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AsBD,EAAU7U,YAClC,OAAO,EAGT,MAAM5tB,EAAayiC,EAEnB,MAA+B,iBAApBziC,EAAW3E,MAGfsK,OAAO/F,OAAO61B,EAAAA,IAAqB9wB,SAAS3E,EAAW3E","sources":["webpack://grafana/./public/app/core/hooks/useCleanup.ts","webpack://grafana/./public/app/features/alerting/unified/api/preview.ts","webpack://grafana/./public/app/features/alerting/unified/types/preview.ts","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/PreviewRuleResult.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/PreviewRule.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/RuleEditorSection.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/CloudEvaluationBehavior.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/util.ts","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/GroupAndNamespaceFields.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/RuleFolderPicker.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/DetailsStep.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/GrafanaAlertStatePicker.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/GrafanaConditionEvalWarning.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/GrafanaEvaluationBehavior.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/NotificationsStep.tsx","webpack://grafana/../../opt/drone/yarncache/js-yaml-npm-4.1.0-3606f32312-c7830dfd45.zip/node_modules/js-yaml/dist/js-yaml.mjs","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/RuleInspector.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/ConditionField.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useRuleSourcesWithRuler.ts","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/CloudRulesSourcePicker.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/rule-types/RuleType.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/rule-types/GrafanaManagedAlert.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/rule-types/DisabledTooltip.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/rule-types/MimirOrLokiAlert.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/rule-types/MimirOrLokiRecordingRule.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/rule-types/RuleTypePicker.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/AlertType.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/ExpressionEditor.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/VizWrapper.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useVizHeight.ts","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/QueryWrapper.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/QueryRows.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/QueryEditor.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/Query.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/query-and-alert-condition/QueryAndAlertConditionStep.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/AlertRuleForm.tsx","webpack://grafana/./public/app/features/alerting/unified/RuleEditor.tsx","webpack://grafana/./public/app/features/alerting/unified/components/PanelPluginsButtonGroup.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/AnnotationKeyInput.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/AnnotationsField.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/LabelsField.tsx","webpack://grafana/./public/app/features/alerting/unified/components/rule-editor/SelectWIthAdd.tsx","webpack://grafana/./public/app/features/alerting/unified/hooks/useAlertQueriesStatus.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useFolder.ts","webpack://grafana/./public/app/features/alerting/unified/hooks/useIsRuleEditable.ts","webpack://grafana/./public/app/features/alerting/unified/utils/timeRange.ts","webpack://grafana/./public/app/features/alerting/unified/state/AlertingQueryRunner.ts","webpack://grafana/./public/app/features/alerting/unified/utils/accessControlHooks.ts","webpack://grafana/./public/app/features/expressions/guards.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { cleanUpAction, StateSelector } from '../actions/cleanUp';\n\nexport function useCleanup<T>(stateSelector: StateSelector<T>) {\n const dispatch = useDispatch();\n //bit of a hack to unburden user from having to wrap stateSelcetor in a useCallback. Otherwise cleanup would happen on every render\n const selectorRef = useRef(stateSelector);\n selectorRef.current = stateSelector;\n useEffect(() => {\n return () => {\n dispatch(cleanUpAction({ stateSelector: selectorRef.current }));\n };\n }, [dispatch]);\n}\n","import { Observable, of } from 'rxjs';\nimport { catchError, map, share } from 'rxjs/operators';\n\nimport {\n dataFrameFromJSON,\n DataFrameJSON,\n getDefaultTimeRange,\n LoadingState,\n PanelData,\n withLoadingIndicator,\n} from '@grafana/data';\nimport { getBackendSrv, toDataQueryError } from '@grafana/runtime';\n\nimport {\n CloudPreviewRuleRequest,\n GrafanaPreviewRuleRequest,\n isCloudPreviewRequest,\n isGrafanaPreviewRequest,\n PreviewRuleRequest,\n PreviewRuleResponse,\n} from '../types/preview';\nimport { RuleFormType } from '../types/rule-form';\n\nexport function previewAlertRule(request: PreviewRuleRequest): Observable<PreviewRuleResponse> {\n if (isCloudPreviewRequest(request)) {\n return previewCloudAlertRule(request);\n }\n\n if (isGrafanaPreviewRequest(request)) {\n return previewGrafanaAlertRule(request);\n }\n\n throw new Error('unsupported preview rule request');\n}\n\ntype GrafanaPreviewRuleResponse = {\n instances: DataFrameJSON[];\n};\n\nfunction previewGrafanaAlertRule(request: GrafanaPreviewRuleRequest): Observable<PreviewRuleResponse> {\n const type = RuleFormType.grafana;\n\n return withLoadingIndicator({\n whileLoading: createResponse(type),\n source: getBackendSrv()\n .fetch<GrafanaPreviewRuleResponse>({\n method: 'POST',\n url: `/api/v1/rule/test/grafana`,\n data: request,\n })\n .pipe(\n map(({ data }) => {\n return createResponse(type, {\n state: LoadingState.Done,\n series: data.instances.map(dataFrameFromJSON),\n });\n }),\n catchError((error: Error) => {\n return of(\n createResponse(type, {\n state: LoadingState.Error,\n error: toDataQueryError(error),\n })\n );\n }),\n share()\n ),\n });\n}\n\nfunction createResponse(ruleType: RuleFormType, data: Partial<PanelData> = {}): PreviewRuleResponse {\n return {\n ruleType,\n data: {\n state: LoadingState.Loading,\n series: [],\n timeRange: getDefaultTimeRange(),\n ...data,\n },\n };\n}\n\nfunction previewCloudAlertRule(request: CloudPreviewRuleRequest): Observable<PreviewRuleResponse> {\n throw new Error('preview for cloud alerting rules is not implemented');\n}\n","import { PanelData } from '@grafana/data';\nimport { AlertQuery } from 'app/types/unified-alerting-dto';\n\nimport { RuleFormType } from './rule-form';\n\nexport type PreviewRuleRequest = GrafanaPreviewRuleRequest | CloudPreviewRuleRequest;\n\nexport type GrafanaPreviewRuleRequest = {\n grafana_condition: {\n condition: string;\n data: AlertQuery[];\n now: string;\n };\n};\n\nexport type CloudPreviewRuleRequest = {\n dataSourceName: string;\n expr: string;\n};\n\nexport type PreviewRuleResponse = {\n ruleType: RuleFormType;\n data: PanelData;\n};\n\nexport function isCloudPreviewRequest(request: PreviewRuleRequest): request is CloudPreviewRuleRequest {\n return 'expr' in request;\n}\n\nexport function isGrafanaPreviewRequest(request: PreviewRuleRequest): request is GrafanaPreviewRuleRequest {\n return 'grafana_condition' in request;\n}\n","import { css } from '@emotion/css';\nimport React from 'react';\nimport AutoSizer from 'react-virtualized-auto-sizer';\n\nimport { FieldConfigSource, FieldMatcherID, GrafanaTheme2, LoadingState } from '@grafana/data';\nimport { PanelRenderer } from '@grafana/runtime';\nimport { TableCellDisplayMode, useStyles2 } from '@grafana/ui';\n\nimport { PreviewRuleResponse } from '../../types/preview';\nimport { RuleFormType } from '../../types/rule-form';\nimport { messageFromError } from '../../utils/redux';\n\ntype Props = {\n preview: PreviewRuleResponse | undefined;\n};\n\nexport function PreviewRuleResult(props: Props): React.ReactElement | null {\n const { preview } = props;\n const styles = useStyles2(getStyles);\n const fieldConfig: FieldConfigSource = {\n defaults: {},\n overrides: [\n {\n matcher: { id: FieldMatcherID.byName, options: 'Info' },\n properties: [{ id: 'custom.displayMode', value: TableCellDisplayMode.JSONView }],\n },\n ],\n };\n\n if (!preview) {\n return null;\n }\n\n const { data, ruleType } = preview;\n\n if (data.state === LoadingState.Loading) {\n return (\n <div className={styles.container}>\n <span>Loading preview...</span>\n </div>\n );\n }\n\n if (data.state === LoadingState.Error) {\n return (\n <div className={styles.container}>\n {data.error ? messageFromError(data.error) : 'Failed to preview alert rule'}\n </div>\n );\n }\n return (\n <div className={styles.container}>\n <span>\n Preview based on the result of running the query, for this moment.{' '}\n {ruleType === RuleFormType.grafana ? 'Configuration for `no data` and `error handling` is not applied.' : null}\n </span>\n <div className={styles.table}>\n <AutoSizer>\n {({ width, height }) => (\n <div style={{ width: `${width}px`, height: `${height}px` }}>\n <PanelRenderer\n title=\"\"\n width={width}\n height={height}\n pluginId=\"table\"\n data={data}\n fieldConfig={fieldConfig}\n />\n </div>\n )}\n </AutoSizer>\n </div>\n </div>\n );\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n container: css`\n margin: ${theme.spacing(2)} 0;\n `,\n table: css`\n flex: 1 1 auto;\n height: 135px;\n margin-top: ${theme.spacing(2)};\n border: 1px solid ${theme.colors.border.medium};\n border-radius: ${theme.shape.borderRadius(1)};\n `,\n };\n}\n","import { css } from '@emotion/css';\nimport React, { useCallback, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { useMountedState } from 'react-use';\nimport { takeWhile } from 'rxjs/operators';\n\nimport { dateTimeFormatISO, GrafanaTheme2, LoadingState } from '@grafana/data';\nimport { Alert, Button, HorizontalGroup, useStyles2 } from '@grafana/ui';\n\nimport { previewAlertRule } from '../../api/preview';\nimport { useAlertQueriesStatus } from '../../hooks/useAlertQueriesStatus';\nimport { PreviewRuleRequest, PreviewRuleResponse } from '../../types/preview';\nimport { RuleFormType, RuleFormValues } from '../../types/rule-form';\n\nimport { PreviewRuleResult } from './PreviewRuleResult';\n\nconst fields: Array<keyof RuleFormValues> = ['type', 'dataSourceName', 'condition', 'queries', 'expression'];\n\nexport function PreviewRule(): React.ReactElement | null {\n const styles = useStyles2(getStyles);\n const [preview, onPreview] = usePreview();\n const { watch } = useFormContext<RuleFormValues>();\n const [type, condition, queries] = watch(['type', 'condition', 'queries']);\n const { allDataSourcesAvailable } = useAlertQueriesStatus(queries);\n\n if (type === RuleFormType.cloudRecording || type === RuleFormType.cloudAlerting) {\n return null;\n }\n\n const isPreviewAvailable = Boolean(condition) && allDataSourcesAvailable;\n\n return (\n <div className={styles.container}>\n <HorizontalGroup>\n {allDataSourcesAvailable && (\n <Button disabled={!isPreviewAvailable} type=\"button\" variant=\"primary\" onClick={onPreview}>\n Preview alerts\n </Button>\n )}\n {!allDataSourcesAvailable && (\n <Alert title=\"Preview is not available\" severity=\"warning\">\n Cannot display the query preview. Some of the data sources used in the queries are not available.\n </Alert>\n )}\n </HorizontalGroup>\n <PreviewRuleResult preview={preview} />\n </div>\n );\n}\n\nfunction usePreview(): [PreviewRuleResponse | undefined, () => void] {\n const [preview, setPreview] = useState<PreviewRuleResponse | undefined>();\n const { getValues } = useFormContext<RuleFormValues>();\n const isMounted = useMountedState();\n\n const onPreview = useCallback(() => {\n const values = getValues(fields);\n const request = createPreviewRequest(values);\n\n previewAlertRule(request)\n .pipe(takeWhile((response) => !isCompleted(response), true))\n .subscribe((response) => {\n if (!isMounted()) {\n return;\n }\n setPreview(response);\n });\n }, [getValues, isMounted]);\n\n return [preview, onPreview];\n}\n\nfunction createPreviewRequest(values: any[]): PreviewRuleRequest {\n const [type, dataSourceName, condition, queries, expression] = values;\n\n switch (type) {\n case RuleFormType.cloudAlerting:\n return {\n dataSourceName,\n expr: expression,\n };\n\n case RuleFormType.grafana:\n return {\n grafana_condition: {\n condition,\n data: queries,\n now: dateTimeFormatISO(Date.now()),\n },\n };\n\n default:\n throw new Error(`Alert type ${type} not supported by preview.`);\n }\n}\n\nfunction isCompleted(response: PreviewRuleResponse): boolean {\n switch (response.data.state) {\n case LoadingState.Done:\n case LoadingState.Error:\n return true;\n default:\n return false;\n }\n}\n\nfunction getStyles(theme: GrafanaTheme2) {\n return {\n container: css`\n margin-top: ${theme.spacing(2)};\n max-width: ${theme.breakpoints.values.xxl}px;\n `,\n };\n}\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { FieldSet, useStyles2 } from '@grafana/ui';\n\nexport interface RuleEditorSectionProps {\n title: string;\n stepNo: number;\n description?: string;\n}\n\nexport const RuleEditorSection: FC<RuleEditorSectionProps> = ({ title, stepNo, children, description }) => {\n const styles = useStyles2(getStyles);\n\n return (\n <div className={styles.parent}>\n <div>\n <span className={styles.stepNo}>{stepNo}</span>\n </div>\n <div className={styles.content}>\n <FieldSet label={title} className={styles.fieldset}>\n {description && <p className={styles.description}>{description}</p>}\n {children}\n </FieldSet>\n </div>\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n fieldset: css`\n legend {\n font-size: 16px;\n padding-top: ${theme.spacing(0.5)};\n }\n `,\n parent: css`\n display: flex;\n flex-direction: row;\n max-width: ${theme.breakpoints.values.xl};\n & + & {\n margin-top: ${theme.spacing(4)};\n }\n `,\n description: css`\n margin-top: -${theme.spacing(2)};\n color: ${theme.colors.text.secondary};\n `,\n stepNo: css`\n display: inline-block;\n width: ${theme.spacing(4)};\n height: ${theme.spacing(4)};\n line-height: ${theme.spacing(4)};\n border-radius: ${theme.spacing(4)};\n text-align: center;\n color: ${theme.colors.text.maxContrast};\n background-color: ${theme.colors.background.canvas};\n font-size: ${theme.typography.size.lg};\n margin-right: ${theme.spacing(2)};\n `,\n content: css`\n flex: 1;\n `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { Field, Input, InputControl, Select, useStyles } from '@grafana/ui';\n\nimport { RuleFormType, RuleFormValues } from '../../types/rule-form';\nimport { timeOptions } from '../../utils/time';\n\nimport { PreviewRule } from './PreviewRule';\nimport { RuleEditorSection } from './RuleEditorSection';\n\nexport const CloudEvaluationBehavior: FC = () => {\n const styles = useStyles(getStyles);\n const {\n register,\n control,\n watch,\n formState: { errors },\n } = useFormContext<RuleFormValues>();\n\n const type = watch('type');\n\n // cloud recording rules do not have alert conditions\n if (type === RuleFormType.cloudRecording) {\n return null;\n }\n\n return (\n <RuleEditorSection stepNo={2} title=\"Alert evaluation behavior\">\n <Field label=\"For\" description=\"Expression has to be true for this long for the alert to be fired.\">\n <div className={styles.flexRow}>\n <Field invalid={!!errors.forTime?.message} error={errors.forTime?.message} className={styles.inlineField}>\n <Input\n {...register('forTime', { pattern: { value: /^\\d+$/, message: 'Must be a positive integer.' } })}\n width={8}\n />\n </Field>\n <InputControl\n name=\"forTimeUnit\"\n render={({ field: { onChange, ref, ...field } }) => (\n <Select\n {...field}\n options={timeOptions}\n onChange={(value) => onChange(value?.value)}\n width={15}\n className={styles.timeUnit}\n />\n )}\n control={control}\n />\n </div>\n </Field>\n <PreviewRule />\n </RuleEditorSection>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme) => ({\n inlineField: css`\n margin-bottom: 0;\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: flex-start;\n `,\n timeUnit: css`\n margin-left: ${theme.spacing.xs};\n `,\n});\n","import { ValidateResult } from 'react-hook-form';\n\nimport { isExpressionQuery } from 'app/features/expressions/guards';\nimport { AlertQuery } from 'app/types/unified-alerting-dto';\n\nexport function queriesWithUpdatedReferences(\n queries: AlertQuery[],\n previousRefId: string,\n newRefId: string\n): AlertQuery[] {\n return queries.map((query) => {\n if (previousRefId === newRefId) {\n return query;\n }\n\n if (!isExpressionQuery(query.model)) {\n return query;\n }\n\n const isMathExpression = query.model.type === 'math';\n const isReduceExpression = query.model.type === 'reduce';\n const isResampleExpression = query.model.type === 'resample';\n const isClassicExpression = query.model.type === 'classic_conditions';\n\n if (isMathExpression) {\n return {\n ...query,\n model: {\n ...query.model,\n expression: updateMathExpressionRefs(query.model.expression ?? '', previousRefId, newRefId),\n },\n };\n }\n\n if (isResampleExpression || isReduceExpression) {\n const isReferencing = query.model.expression === previousRefId;\n\n return {\n ...query,\n model: {\n ...query.model,\n expression: isReferencing ? newRefId : query.model.expression,\n },\n };\n }\n\n if (isClassicExpression) {\n const conditions = query.model.conditions?.map((condition) => ({\n ...condition,\n query: {\n ...condition.query,\n params: condition.query.params.map((param: string) => (param === previousRefId ? newRefId : param)),\n },\n }));\n\n return { ...query, model: { ...query.model, conditions } };\n }\n\n return query;\n });\n}\n\nexport function updateMathExpressionRefs(expression: string, previousRefId: string, newRefId: string): string {\n const oldExpression = new RegExp('(\\\\$' + previousRefId + '\\\\b)|(\\\\${' + previousRefId + '})', 'gm');\n const newExpression = '${' + newRefId + '}';\n\n return expression.replace(oldExpression, newExpression);\n}\n\n// some gateways (like Istio) will decode \"/\" and \"\\\" characters – this will cause 404 errors for any API call\n// that includes these values in the URL (ie. /my/path%2fto/resource -> /my/path/to/resource)\n//\n// see https://istio.io/latest/docs/ops/best-practices/security/#customize-your-system-on-path-normalization\nexport function checkForPathSeparator(value: string): ValidateResult {\n const containsPathSeparator = value.includes('/') || value.includes('\\\\');\n if (containsPathSeparator) {\n return 'Cannot contain \"/\" or \"\\\\\" characters';\n }\n\n return true;\n}\n","import { css } from '@emotion/css';\nimport React, { FC, useEffect, useMemo, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { useDispatch } from 'react-redux';\n\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Field, InputControl, useStyles2 } from '@grafana/ui';\n\nimport { useUnifiedAlertingSelector } from '../../hooks/useUnifiedAlertingSelector';\nimport { fetchRulerRulesAction } from '../../state/actions';\nimport { RuleFormValues } from '../../types/rule-form';\n\nimport { SelectWithAdd } from './SelectWIthAdd';\nimport { checkForPathSeparator } from './util';\n\ninterface Props {\n rulesSourceName: string;\n}\n\nexport const GroupAndNamespaceFields: FC<Props> = ({ rulesSourceName }) => {\n const {\n control,\n watch,\n formState: { errors },\n setValue,\n } = useFormContext<RuleFormValues>();\n\n const style = useStyles2(getStyle);\n\n const [customGroup, setCustomGroup] = useState(false);\n\n const rulerRequests = useUnifiedAlertingSelector((state) => state.rulerRules);\n const dispatch = useDispatch();\n useEffect(() => {\n dispatch(fetchRulerRulesAction({ rulesSourceName }));\n }, [rulesSourceName, dispatch]);\n\n const rulesConfig = rulerRequests[rulesSourceName]?.result;\n\n const namespace = watch('namespace');\n\n const namespaceOptions = useMemo(\n (): Array<SelectableValue<string>> =>\n rulesConfig ? Object.keys(rulesConfig).map((namespace) => ({ label: namespace, value: namespace })) : [],\n [rulesConfig]\n );\n\n const groupOptions = useMemo(\n (): Array<SelectableValue<string>> =>\n (namespace && rulesConfig?.[namespace]?.map((group) => ({ label: group.name, value: group.name }))) || [],\n [namespace, rulesConfig]\n );\n\n return (\n <div className={style.flexRow}>\n <Field\n data-testid=\"namespace-picker\"\n label=\"Namespace\"\n error={errors.namespace?.message}\n invalid={!!errors.namespace?.message}\n >\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <SelectWithAdd\n {...field}\n className={style.input}\n onChange={(value) => {\n setValue('group', ''); //reset if namespace changes\n onChange(value);\n }}\n onCustomChange={(custom: boolean) => {\n custom && setCustomGroup(true);\n }}\n options={namespaceOptions}\n width={42}\n />\n )}\n name=\"namespace\"\n control={control}\n rules={{\n required: { value: true, message: 'Required.' },\n validate: {\n pathSeparator: checkForPathSeparator,\n },\n }}\n />\n </Field>\n <Field data-testid=\"group-picker\" label=\"Group\" error={errors.group?.message} invalid={!!errors.group?.message}>\n <InputControl\n render={({ field: { ref, ...field } }) => (\n <SelectWithAdd {...field} options={groupOptions} width={42} custom={customGroup} className={style.input} />\n )}\n name=\"group\"\n control={control}\n rules={{\n required: { value: true, message: 'Required.' },\n validate: {\n pathSeparator: checkForPathSeparator,\n },\n }}\n />\n </Field>\n </div>\n );\n};\n\nconst getStyle = (theme: GrafanaTheme2) => ({\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n\n & > * + * {\n margin-left: ${theme.spacing(3)};\n }\n `,\n input: css`\n width: 330px !important;\n `,\n});\n","import React, { FC } from 'react';\n\nimport { FolderPicker, Props as FolderPickerProps } from 'app/core/components/Select/FolderPicker';\nimport { AccessControlAction, PermissionLevelString } from 'app/types';\n\nexport interface Folder {\n title: string;\n id: number;\n}\n\nexport interface RuleFolderPickerProps extends Omit<FolderPickerProps, 'initialTitle' | 'initialFolderId'> {\n value?: Folder;\n /** An empty array of permissions means no filtering at all */\n folderPermissions?: AccessControlAction[];\n}\n\nexport const RuleFolderPicker: FC<RuleFolderPickerProps> = ({ value, folderPermissions = [], ...props }) => {\n return (\n <FolderPicker\n showRoot={false}\n allowEmpty={true}\n initialTitle={value?.title}\n initialFolderId={value?.id}\n accessControlMetadata\n {...props}\n permissionLevel={PermissionLevelString.View}\n />\n );\n};\n","import { css } from '@emotion/css';\nimport classNames from 'classnames';\nimport React, { useCallback } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Stack } from '@grafana/experimental';\nimport { useStyles2, Field, Input, InputControl, Label, Tooltip, Icon } from '@grafana/ui';\nimport { FolderPickerFilter } from 'app/core/components/Select/FolderPicker';\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { DashboardSearchHit } from 'app/features/search/types';\nimport { AccessControlAction } from 'app/types';\n\nimport { RuleForm, RuleFormType, RuleFormValues } from '../../types/rule-form';\n\nimport AnnotationsField from './AnnotationsField';\nimport { GroupAndNamespaceFields } from './GroupAndNamespaceFields';\nimport { RuleEditorSection } from './RuleEditorSection';\nimport { RuleFolderPicker, Folder } from './RuleFolderPicker';\nimport { checkForPathSeparator } from './util';\n\nconst recordingRuleNameValidationPattern = {\n message:\n 'Recording rule name must be valid metric name. It may only contain letters, numbers, and colons. It may not contain whitespace.',\n value: /^[a-zA-Z_:][a-zA-Z0-9_:]*$/,\n};\n\ninterface DetailsStepProps {\n initialFolder: RuleForm | null;\n}\n\nexport const DetailsStep = ({ initialFolder }: DetailsStepProps) => {\n const {\n register,\n watch,\n formState: { errors },\n } = useFormContext<RuleFormValues & { location?: string }>();\n\n const styles = useStyles2(getStyles);\n\n const ruleFormType = watch('type');\n const dataSourceName = watch('dataSourceName');\n const type = watch('type');\n\n const folderFilter = useRuleFolderFilter(initialFolder);\n\n return (\n <RuleEditorSection\n stepNo={type === RuleFormType.cloudRecording ? 2 : 3}\n title={\n type === RuleFormType.cloudRecording ? 'Add details for your recording rule' : 'Add details for your alert'\n }\n description={\n type === RuleFormType.cloudRecording\n ? 'Add labels to help you better manage your rules'\n : 'Write a summary and add labels to help you better manage your alerts'\n }\n >\n <Field\n className={styles.formInput}\n label=\"Rule name\"\n error={errors?.name?.message}\n invalid={!!errors.name?.message}\n >\n <Input\n id=\"name\"\n {...register('name', {\n required: { value: true, message: 'Must enter an alert name' },\n pattern: ruleFormType === RuleFormType.cloudRecording ? recordingRuleNameValidationPattern : undefined,\n validate: {\n pathSeparator: (value: string) => {\n // we use the alert rule name as the \"groupname\" for Grafana managed alerts, so we can't allow path separators\n if (ruleFormType === RuleFormType.grafana) {\n return checkForPathSeparator(value);\n }\n\n return true;\n },\n },\n })}\n />\n </Field>\n\n {(ruleFormType === RuleFormType.cloudRecording || ruleFormType === RuleFormType.cloudAlerting) &&\n dataSourceName && <GroupAndNamespaceFields rulesSourceName={dataSourceName} />}\n\n {ruleFormType === RuleFormType.grafana && (\n <div className={classNames([styles.flexRow, styles.alignBaseline])}>\n <Field\n label={\n <Label htmlFor=\"folder\" description={'Select a folder to store your rule.'}>\n <Stack gap={0.5}>\n Folder\n <Tooltip\n placement=\"top\"\n content={\n <div>\n Each folder has unique folder permission. When you store multiple rules in a folder, the folder\n access permissions get assigned to the rules.\n </div>\n }\n >\n <Icon name=\"info-circle\" size=\"xs\" />\n </Tooltip>\n </Stack>\n </Label>\n }\n className={styles.formInput}\n error={errors.folder?.message}\n invalid={!!errors.folder?.message}\n data-testid=\"folder-picker\"\n >\n <InputControl\n render={({ field: { ref, ...field } }) => (\n <RuleFolderPicker\n inputId=\"folder\"\n {...field}\n enableCreateNew={contextSrv.hasPermission(AccessControlAction.FoldersCreate)}\n enableReset={true}\n filter={folderFilter}\n />\n )}\n name=\"folder\"\n rules={{\n required: { value: true, message: 'Please select a folder' },\n validate: {\n pathSeparator: (folder: Folder) => checkForPathSeparator(folder.title),\n },\n }}\n />\n </Field>\n <Field\n label=\"Group\"\n data-testid=\"group-picker\"\n description=\"Rules within the same group are evaluated after the same time interval.\"\n className={styles.formInput}\n error={errors.group?.message}\n invalid={!!errors.group?.message}\n >\n <Input\n id=\"group\"\n {...register('group', {\n required: { value: true, message: 'Must enter a group name' },\n })}\n />\n </Field>\n </div>\n )}\n {type !== RuleFormType.cloudRecording && <AnnotationsField />}\n </RuleEditorSection>\n );\n};\n\nconst useRuleFolderFilter = (existingRuleForm: RuleForm | null) => {\n const isSearchHitAvailable = useCallback(\n (hit: DashboardSearchHit) => {\n const rbacDisabledFallback = contextSrv.hasEditPermissionInFolders;\n\n const canCreateRuleInFolder = contextSrv.hasAccessInMetadata(\n AccessControlAction.AlertingRuleCreate,\n hit,\n rbacDisabledFallback\n );\n\n const canUpdateInCurrentFolder =\n existingRuleForm &&\n hit.folderId === existingRuleForm.id &&\n contextSrv.hasAccessInMetadata(AccessControlAction.AlertingRuleUpdate, hit, rbacDisabledFallback);\n\n return canCreateRuleInFolder || canUpdateInCurrentFolder;\n },\n [existingRuleForm]\n );\n\n return useCallback<FolderPickerFilter>(\n (folderHits) => folderHits.filter(isSearchHitAvailable),\n [isSearchHitAvailable]\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n alignBaseline: css`\n align-items: baseline;\n margin-bottom: ${theme.spacing(3)};\n `,\n formInput: css`\n width: 275px;\n\n & + & {\n margin-left: ${theme.spacing(3)};\n }\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: flex-end;\n `,\n});\n","import React, { FC, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Select } from '@grafana/ui';\nimport { SelectBaseProps } from '@grafana/ui/src/components/Select/types';\nimport { GrafanaAlertStateDecision } from 'app/types/unified-alerting-dto';\n\ntype Props = Omit<SelectBaseProps<GrafanaAlertStateDecision>, 'options'> & {\n includeNoData: boolean;\n includeError: boolean;\n};\n\nconst options: SelectableValue[] = [\n { value: GrafanaAlertStateDecision.Alerting, label: 'Alerting' },\n { value: GrafanaAlertStateDecision.NoData, label: 'No Data' },\n { value: GrafanaAlertStateDecision.OK, label: 'OK' },\n { value: GrafanaAlertStateDecision.Error, label: 'Error' },\n];\n\nexport const GrafanaAlertStatePicker: FC<Props> = ({ includeNoData, includeError, ...props }) => {\n const opts = useMemo(() => {\n if (!includeNoData) {\n return options.filter((opt) => opt.value !== GrafanaAlertStateDecision.NoData);\n }\n if (!includeError) {\n return options.filter((opt) => opt.value !== GrafanaAlertStateDecision.Error);\n }\n return options;\n }, [includeNoData, includeError]);\n return <Select options={opts} {...props} />;\n};\n","import { isEmpty } from 'lodash';\nimport React, { FC } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { durationToMilliseconds, parseDuration } from '@grafana/data';\nimport { Alert } from '@grafana/ui';\n\nimport { RuleFormValues } from '../../types/rule-form';\n\n// a warning that will be shown if a problematic yet technically valid combination of \"evaluate every\" and \"evaluate for\" is enetered\nexport const GrafanaConditionEvalWarning: FC = () => {\n const { watch } = useFormContext<RuleFormValues>();\n const evaluateFor = watch('evaluateFor');\n const evaluateEvery = watch('evaluateEvery');\n if (evaluateFor === '0') {\n return null;\n }\n const durationFor = parseDuration(evaluateFor);\n const durationEvery = parseDuration(evaluateEvery);\n if (isEmpty(durationFor) || isEmpty(durationEvery)) {\n return null;\n }\n const millisFor = durationToMilliseconds(durationFor);\n const millisEvery = durationToMilliseconds(durationEvery);\n if (millisFor && millisEvery && millisFor <= millisEvery) {\n return (\n <Alert severity=\"warning\" title=\"\">\n Setting a "for" duration that is less than or equal to the evaluation interval will result in the\n evaluation interval being used to calculate when an alert that has stopped receiving data will be closed.\n </Alert>\n );\n }\n return null;\n};\n","import { css } from '@emotion/css';\nimport React, { FC, useState } from 'react';\nimport { useFormContext, RegisterOptions } from 'react-hook-form';\n\nimport { parseDuration, durationToMilliseconds, GrafanaTheme2 } from '@grafana/data';\nimport { Field, InlineLabel, Input, InputControl, useStyles2 } from '@grafana/ui';\n\nimport { RuleFormValues } from '../../types/rule-form';\nimport { positiveDurationValidationPattern, durationValidationPattern } from '../../utils/time';\nimport { CollapseToggle } from '../CollapseToggle';\n\nimport { GrafanaAlertStatePicker } from './GrafanaAlertStatePicker';\nimport { GrafanaConditionEvalWarning } from './GrafanaConditionEvalWarning';\nimport { PreviewRule } from './PreviewRule';\nimport { RuleEditorSection } from './RuleEditorSection';\n\nconst MIN_TIME_RANGE_STEP_S = 10; // 10 seconds\n\nconst forValidationOptions: RegisterOptions = {\n required: {\n value: true,\n message: 'Required.',\n },\n pattern: durationValidationPattern,\n};\n\nconst evaluateEveryValidationOptions: RegisterOptions = {\n required: {\n value: true,\n message: 'Required.',\n },\n pattern: positiveDurationValidationPattern,\n validate: (value: string) => {\n const duration = parseDuration(value);\n if (Object.keys(duration).length) {\n const diff = durationToMilliseconds(duration);\n if (diff < MIN_TIME_RANGE_STEP_S * 1000) {\n return `Cannot be less than ${MIN_TIME_RANGE_STEP_S} seconds.`;\n }\n if (diff % (MIN_TIME_RANGE_STEP_S * 1000) !== 0) {\n return `Must be a multiple of ${MIN_TIME_RANGE_STEP_S} seconds.`;\n }\n }\n return true;\n },\n};\n\nexport const GrafanaEvaluationBehavior: FC = () => {\n const styles = useStyles2(getStyles);\n const [showErrorHandling, setShowErrorHandling] = useState(false);\n const {\n register,\n formState: { errors },\n } = useFormContext<RuleFormValues>();\n\n const evaluateEveryId = 'eval-every-input';\n const evaluateForId = 'eval-for-input';\n\n return (\n // TODO remove \"and alert condition\" for recording rules\n <RuleEditorSection stepNo={2} title=\"Alert evaluation behavior\">\n <Field\n label=\"Evaluate\"\n description=\"Evaluation interval applies to every rule within a group. It can overwrite the interval of an existing alert rule.\"\n >\n <div className={styles.flexRow}>\n <InlineLabel\n htmlFor={evaluateEveryId}\n width={16}\n tooltip=\"How often the alert will be evaluated to see if it fires\"\n >\n Evaluate every\n </InlineLabel>\n <Input id={evaluateEveryId} width={8} {...register('evaluateEvery', evaluateEveryValidationOptions)} />\n <InlineLabel\n htmlFor={evaluateForId}\n width={7}\n tooltip='Once condition is breached, alert will go into pending state. If it is pending for longer than the \"for\" value, it will become a firing alert.'\n >\n for\n </InlineLabel>\n <Field\n className={styles.inlineField}\n error={errors.evaluateFor?.message}\n invalid={!!errors.evaluateFor?.message}\n validationMessageHorizontalOverflow={true}\n >\n <Input id={evaluateForId} width={8} {...register('evaluateFor', forValidationOptions)} />\n </Field>\n </div>\n </Field>\n <GrafanaConditionEvalWarning />\n <CollapseToggle\n isCollapsed={!showErrorHandling}\n onToggle={(collapsed) => setShowErrorHandling(!collapsed)}\n text=\"Configure no data and error handling\"\n className={styles.collapseToggle}\n />\n {showErrorHandling && (\n <>\n <Field htmlFor=\"no-data-state-input\" label=\"Alert state if no data or all values are null\">\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <GrafanaAlertStatePicker\n {...field}\n inputId=\"no-data-state-input\"\n width={42}\n includeNoData={true}\n includeError={false}\n onChange={(value) => onChange(value?.value)}\n />\n )}\n name=\"noDataState\"\n />\n </Field>\n <Field htmlFor=\"exec-err-state-input\" label=\"Alert state if execution error or timeout\">\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <GrafanaAlertStatePicker\n {...field}\n inputId=\"exec-err-state-input\"\n width={42}\n includeNoData={false}\n includeError={true}\n onChange={(value) => onChange(value?.value)}\n />\n )}\n name=\"execErrState\"\n />\n </Field>\n </>\n )}\n <PreviewRule />\n </RuleEditorSection>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n inlineField: css`\n margin-bottom: 0;\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: flex-start;\n `,\n collapseToggle: css`\n margin: ${theme.spacing(2, 0, 2, -1)};\n `,\n});\n","import { css } from '@emotion/css';\nimport React, { FC, useState } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Card, Link, useStyles2, useTheme2 } from '@grafana/ui';\n\nimport LabelsField from './LabelsField';\nimport { RuleEditorSection } from './RuleEditorSection';\n\nexport const NotificationsStep: FC = () => {\n const [hideFlowChart, setHideFlowChart] = useState(false);\n const styles = useStyles2(getStyles);\n const theme = useTheme2();\n\n return (\n <RuleEditorSection\n stepNo={4}\n title=\"Notifications\"\n description=\"Grafana handles the notifications for alerts by assigning labels to alerts. These labels connect alerts to contact points and silence alert instances that have matching labels.\"\n >\n <div>\n <div className={styles.hideButton} onClick={() => setHideFlowChart(!hideFlowChart)}>\n {`${!hideFlowChart ? 'Hide' : 'Show'} flow chart`}\n </div>\n </div>\n <div className={styles.contentWrapper}>\n {!hideFlowChart && (\n <img\n className={styles.flowChart}\n src={`public/img/alerting/notification_policy_${theme.name.toLowerCase()}.svg`}\n alt=\"notification policy flow chart\"\n />\n )}\n <div style={{ display: 'flex', flexDirection: 'column' }}>\n <LabelsField />\n <Card className={styles.card}>\n <Card.Heading>Root route – default for all alerts</Card.Heading>\n <Card.Description>\n Without custom labels, your alert will be routed through the root route. To view and edit the root route,\n go to <Link href=\"/alerting/routes\">notification policies</Link> or contact your admin in case you are\n using non-Grafana alert management.\n </Card.Description>\n </Card>\n </div>\n </div>\n </RuleEditorSection>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n contentWrapper: css`\n display: flex;\n align-items: center;\n `,\n hideButton: css`\n color: ${theme.colors.text.secondary};\n cursor: pointer;\n margin-bottom: ${theme.spacing(1)};\n `,\n card: css`\n max-width: 500px;\n `,\n flowChart: css`\n margin-right: ${theme.spacing(3)};\n `,\n});\n","\n/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */\nfunction isNothing(subject) {\n return (typeof subject === 'undefined') || (subject === null);\n}\n\n\nfunction isObject(subject) {\n return (typeof subject === 'object') && (subject !== null);\n}\n\n\nfunction toArray(sequence) {\n if (Array.isArray(sequence)) return sequence;\n else if (isNothing(sequence)) return [];\n\n return [ sequence ];\n}\n\n\nfunction extend(target, source) {\n var index, length, key, sourceKeys;\n\n if (source) {\n sourceKeys = Object.keys(source);\n\n for (index = 0, length = sourceKeys.length; index < length; index += 1) {\n key = sourceKeys[index];\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\n\nfunction repeat(string, count) {\n var result = '', cycle;\n\n for (cycle = 0; cycle < count; cycle += 1) {\n result += string;\n }\n\n return result;\n}\n\n\nfunction isNegativeZero(number) {\n return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);\n}\n\n\nvar isNothing_1 = isNothing;\nvar isObject_1 = isObject;\nvar toArray_1 = toArray;\nvar repeat_1 = repeat;\nvar isNegativeZero_1 = isNegativeZero;\nvar extend_1 = extend;\n\nvar common = {\n\tisNothing: isNothing_1,\n\tisObject: isObject_1,\n\ttoArray: toArray_1,\n\trepeat: repeat_1,\n\tisNegativeZero: isNegativeZero_1,\n\textend: extend_1\n};\n\n// YAML error class. http://stackoverflow.com/questions/8458984\n\n\nfunction formatError(exception, compact) {\n var where = '', message = exception.reason || '(unknown reason)';\n\n if (!exception.mark) return message;\n\n if (exception.mark.name) {\n where += 'in \"' + exception.mark.name + '\" ';\n }\n\n where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';\n\n if (!compact && exception.mark.snippet) {\n where += '\\n\\n' + exception.mark.snippet;\n }\n\n return message + ' ' + where;\n}\n\n\nfunction YAMLException$1(reason, mark) {\n // Super constructor\n Error.call(this);\n\n this.name = 'YAMLException';\n this.reason = reason;\n this.mark = mark;\n this.message = formatError(this, false);\n\n // Include stack trace in error object\n if (Error.captureStackTrace) {\n // Chrome and NodeJS\n Error.captureStackTrace(this, this.constructor);\n } else {\n // FF, IE 10+ and Safari 6+. Fallback for others\n this.stack = (new Error()).stack || '';\n }\n}\n\n\n// Inherit from Error\nYAMLException$1.prototype = Object.create(Error.prototype);\nYAMLException$1.prototype.constructor = YAMLException$1;\n\n\nYAMLException$1.prototype.toString = function toString(compact) {\n return this.name + ': ' + formatError(this, compact);\n};\n\n\nvar exception = YAMLException$1;\n\n// get snippet for a single line, respecting maxLength\nfunction getLine(buffer, lineStart, lineEnd, position, maxLineLength) {\n var head = '';\n var tail = '';\n var maxHalfLength = Math.floor(maxLineLength / 2) - 1;\n\n if (position - lineStart > maxHalfLength) {\n head = ' ... ';\n lineStart = position - maxHalfLength + head.length;\n }\n\n if (lineEnd - position > maxHalfLength) {\n tail = ' ...';\n lineEnd = position + maxHalfLength - tail.length;\n }\n\n return {\n str: head + buffer.slice(lineStart, lineEnd).replace(/\\t/g, '→') + tail,\n pos: position - lineStart + head.length // relative position\n };\n}\n\n\nfunction padStart(string, max) {\n return common.repeat(' ', max - string.length) + string;\n}\n\n\nfunction makeSnippet(mark, options) {\n options = Object.create(options || null);\n\n if (!mark.buffer) return null;\n\n if (!options.maxLength) options.maxLength = 79;\n if (typeof options.indent !== 'number') options.indent = 1;\n if (typeof options.linesBefore !== 'number') options.linesBefore = 3;\n if (typeof options.linesAfter !== 'number') options.linesAfter = 2;\n\n var re = /\\r?\\n|\\r|\\0/g;\n var lineStarts = [ 0 ];\n var lineEnds = [];\n var match;\n var foundLineNo = -1;\n\n while ((match = re.exec(mark.buffer))) {\n lineEnds.push(match.index);\n lineStarts.push(match.index + match[0].length);\n\n if (mark.position <= match.index && foundLineNo < 0) {\n foundLineNo = lineStarts.length - 2;\n }\n }\n\n if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;\n\n var result = '', i, line;\n var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;\n var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);\n\n for (i = 1; i <= options.linesBefore; i++) {\n if (foundLineNo - i < 0) break;\n line = getLine(\n mark.buffer,\n lineStarts[foundLineNo - i],\n lineEnds[foundLineNo - i],\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),\n maxLineLength\n );\n result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n' + result;\n }\n\n line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);\n result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n';\n result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\\n';\n\n for (i = 1; i <= options.linesAfter; i++) {\n if (foundLineNo + i >= lineEnds.length) break;\n line = getLine(\n mark.buffer,\n lineStarts[foundLineNo + i],\n lineEnds[foundLineNo + i],\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),\n maxLineLength\n );\n result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n';\n }\n\n return result.replace(/\\n$/, '');\n}\n\n\nvar snippet = makeSnippet;\n\nvar TYPE_CONSTRUCTOR_OPTIONS = [\n 'kind',\n 'multi',\n 'resolve',\n 'construct',\n 'instanceOf',\n 'predicate',\n 'represent',\n 'representName',\n 'defaultStyle',\n 'styleAliases'\n];\n\nvar YAML_NODE_KINDS = [\n 'scalar',\n 'sequence',\n 'mapping'\n];\n\nfunction compileStyleAliases(map) {\n var result = {};\n\n if (map !== null) {\n Object.keys(map).forEach(function (style) {\n map[style].forEach(function (alias) {\n result[String(alias)] = style;\n });\n });\n }\n\n return result;\n}\n\nfunction Type$1(tag, options) {\n options = options || {};\n\n Object.keys(options).forEach(function (name) {\n if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {\n throw new exception('Unknown option \"' + name + '\" is met in definition of \"' + tag + '\" YAML type.');\n }\n });\n\n // TODO: Add tag format check.\n this.options = options; // keep original options in case user wants to extend this type later\n this.tag = tag;\n this.kind = options['kind'] || null;\n this.resolve = options['resolve'] || function () { return true; };\n this.construct = options['construct'] || function (data) { return data; };\n this.instanceOf = options['instanceOf'] || null;\n this.predicate = options['predicate'] || null;\n this.represent = options['represent'] || null;\n this.representName = options['representName'] || null;\n this.defaultStyle = options['defaultStyle'] || null;\n this.multi = options['multi'] || false;\n this.styleAliases = compileStyleAliases(options['styleAliases'] || null);\n\n if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {\n throw new exception('Unknown kind \"' + this.kind + '\" is specified for \"' + tag + '\" YAML type.');\n }\n}\n\nvar type = Type$1;\n\n/*eslint-disable max-len*/\n\n\n\n\n\nfunction compileList(schema, name) {\n var result = [];\n\n schema[name].forEach(function (currentType) {\n var newIndex = result.length;\n\n result.forEach(function (previousType, previousIndex) {\n if (previousType.tag === currentType.tag &&\n previousType.kind === currentType.kind &&\n previousType.multi === currentType.multi) {\n\n newIndex = previousIndex;\n }\n });\n\n result[newIndex] = currentType;\n });\n\n return result;\n}\n\n\nfunction compileMap(/* lists... */) {\n var result = {\n scalar: {},\n sequence: {},\n mapping: {},\n fallback: {},\n multi: {\n scalar: [],\n sequence: [],\n mapping: [],\n fallback: []\n }\n }, index, length;\n\n function collectType(type) {\n if (type.multi) {\n result.multi[type.kind].push(type);\n result.multi['fallback'].push(type);\n } else {\n result[type.kind][type.tag] = result['fallback'][type.tag] = type;\n }\n }\n\n for (index = 0, length = arguments.length; index < length; index += 1) {\n arguments[index].forEach(collectType);\n }\n return result;\n}\n\n\nfunction Schema$1(definition) {\n return this.extend(definition);\n}\n\n\nSchema$1.prototype.extend = function extend(definition) {\n var implicit = [];\n var explicit = [];\n\n if (definition instanceof type) {\n // Schema.extend(type)\n explicit.push(definition);\n\n } else if (Array.isArray(definition)) {\n // Schema.extend([ type1, type2, ... ])\n explicit = explicit.concat(definition);\n\n } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {\n // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })\n if (definition.implicit) implicit = implicit.concat(definition.implicit);\n if (definition.explicit) explicit = explicit.concat(definition.explicit);\n\n } else {\n throw new exception('Schema.extend argument should be a Type, [ Type ], ' +\n 'or a schema definition ({ implicit: [...], explicit: [...] })');\n }\n\n implicit.forEach(function (type$1) {\n if (!(type$1 instanceof type)) {\n throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');\n }\n\n if (type$1.loadKind && type$1.loadKind !== 'scalar') {\n throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');\n }\n\n if (type$1.multi) {\n throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');\n }\n });\n\n explicit.forEach(function (type$1) {\n if (!(type$1 instanceof type)) {\n throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');\n }\n });\n\n var result = Object.create(Schema$1.prototype);\n\n result.implicit = (this.implicit || []).concat(implicit);\n result.explicit = (this.explicit || []).concat(explicit);\n\n result.compiledImplicit = compileList(result, 'implicit');\n result.compiledExplicit = compileList(result, 'explicit');\n result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);\n\n return result;\n};\n\n\nvar schema = Schema$1;\n\nvar str = new type('tag:yaml.org,2002:str', {\n kind: 'scalar',\n construct: function (data) { return data !== null ? data : ''; }\n});\n\nvar seq = new type('tag:yaml.org,2002:seq', {\n kind: 'sequence',\n construct: function (data) { return data !== null ? data : []; }\n});\n\nvar map = new type('tag:yaml.org,2002:map', {\n kind: 'mapping',\n construct: function (data) { return data !== null ? data : {}; }\n});\n\nvar failsafe = new schema({\n explicit: [\n str,\n seq,\n map\n ]\n});\n\nfunction resolveYamlNull(data) {\n if (data === null) return true;\n\n var max = data.length;\n\n return (max === 1 && data === '~') ||\n (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));\n}\n\nfunction constructYamlNull() {\n return null;\n}\n\nfunction isNull(object) {\n return object === null;\n}\n\nvar _null = new type('tag:yaml.org,2002:null', {\n kind: 'scalar',\n resolve: resolveYamlNull,\n construct: constructYamlNull,\n predicate: isNull,\n represent: {\n canonical: function () { return '~'; },\n lowercase: function () { return 'null'; },\n uppercase: function () { return 'NULL'; },\n camelcase: function () { return 'Null'; },\n empty: function () { return ''; }\n },\n defaultStyle: 'lowercase'\n});\n\nfunction resolveYamlBoolean(data) {\n if (data === null) return false;\n\n var max = data.length;\n\n return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||\n (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));\n}\n\nfunction constructYamlBoolean(data) {\n return data === 'true' ||\n data === 'True' ||\n data === 'TRUE';\n}\n\nfunction isBoolean(object) {\n return Object.prototype.toString.call(object) === '[object Boolean]';\n}\n\nvar bool = new type('tag:yaml.org,2002:bool', {\n kind: 'scalar',\n resolve: resolveYamlBoolean,\n construct: constructYamlBoolean,\n predicate: isBoolean,\n represent: {\n lowercase: function (object) { return object ? 'true' : 'false'; },\n uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },\n camelcase: function (object) { return object ? 'True' : 'False'; }\n },\n defaultStyle: 'lowercase'\n});\n\nfunction isHexCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||\n ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||\n ((0x61/* a */ <= c) && (c <= 0x66/* f */));\n}\n\nfunction isOctCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));\n}\n\nfunction isDecCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));\n}\n\nfunction resolveYamlInteger(data) {\n if (data === null) return false;\n\n var max = data.length,\n index = 0,\n hasDigits = false,\n ch;\n\n if (!max) return false;\n\n ch = data[index];\n\n // sign\n if (ch === '-' || ch === '+') {\n ch = data[++index];\n }\n\n if (ch === '0') {\n // 0\n if (index + 1 === max) return true;\n ch = data[++index];\n\n // base 2, base 8, base 16\n\n if (ch === 'b') {\n // base 2\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (ch !== '0' && ch !== '1') return false;\n hasDigits = true;\n }\n return hasDigits && ch !== '_';\n }\n\n\n if (ch === 'x') {\n // base 16\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (!isHexCode(data.charCodeAt(index))) return false;\n hasDigits = true;\n }\n return hasDigits && ch !== '_';\n }\n\n\n if (ch === 'o') {\n // base 8\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (!isOctCode(data.charCodeAt(index))) return false;\n hasDigits = true;\n }\n return hasDigits && ch !== '_';\n }\n }\n\n // base 10 (except 0)\n\n // value should not start with `_`;\n if (ch === '_') return false;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (!isDecCode(data.charCodeAt(index))) {\n return false;\n }\n hasDigits = true;\n }\n\n // Should have digits and should not end with `_`\n if (!hasDigits || ch === '_') return false;\n\n return true;\n}\n\nfunction constructYamlInteger(data) {\n var value = data, sign = 1, ch;\n\n if (value.indexOf('_') !== -1) {\n value = value.replace(/_/g, '');\n }\n\n ch = value[0];\n\n if (ch === '-' || ch === '+') {\n if (ch === '-') sign = -1;\n value = value.slice(1);\n ch = value[0];\n }\n\n if (value === '0') return 0;\n\n if (ch === '0') {\n if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);\n if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);\n if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);\n }\n\n return sign * parseInt(value, 10);\n}\n\nfunction isInteger(object) {\n return (Object.prototype.toString.call(object)) === '[object Number]' &&\n (object % 1 === 0 && !common.isNegativeZero(object));\n}\n\nvar int = new type('tag:yaml.org,2002:int', {\n kind: 'scalar',\n resolve: resolveYamlInteger,\n construct: constructYamlInteger,\n predicate: isInteger,\n represent: {\n binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },\n octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },\n decimal: function (obj) { return obj.toString(10); },\n /* eslint-disable max-len */\n hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }\n },\n defaultStyle: 'decimal',\n styleAliases: {\n binary: [ 2, 'bin' ],\n octal: [ 8, 'oct' ],\n decimal: [ 10, 'dec' ],\n hexadecimal: [ 16, 'hex' ]\n }\n});\n\nvar YAML_FLOAT_PATTERN = new RegExp(\n // 2.5e4, 2.5 and integers\n '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +\n // .2e4, .2\n // special case, seems not from spec\n '|\\\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +\n // .inf\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$');\n\nfunction resolveYamlFloat(data) {\n if (data === null) return false;\n\n if (!YAML_FLOAT_PATTERN.test(data) ||\n // Quick hack to not allow integers end with `_`\n // Probably should update regexp & check speed\n data[data.length - 1] === '_') {\n return false;\n }\n\n return true;\n}\n\nfunction constructYamlFloat(data) {\n var value, sign;\n\n value = data.replace(/_/g, '').toLowerCase();\n sign = value[0] === '-' ? -1 : 1;\n\n if ('+-'.indexOf(value[0]) >= 0) {\n value = value.slice(1);\n }\n\n if (value === '.inf') {\n return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;\n\n } else if (value === '.nan') {\n return NaN;\n }\n return sign * parseFloat(value, 10);\n}\n\n\nvar SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;\n\nfunction representYamlFloat(object, style) {\n var res;\n\n if (isNaN(object)) {\n switch (style) {\n case 'lowercase': return '.nan';\n case 'uppercase': return '.NAN';\n case 'camelcase': return '.NaN';\n }\n } else if (Number.POSITIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase': return '.inf';\n case 'uppercase': return '.INF';\n case 'camelcase': return '.Inf';\n }\n } else if (Number.NEGATIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase': return '-.inf';\n case 'uppercase': return '-.INF';\n case 'camelcase': return '-.Inf';\n }\n } else if (common.isNegativeZero(object)) {\n return '-0.0';\n }\n\n res = object.toString(10);\n\n // JS stringifier can build scientific format without dots: 5e-100,\n // while YAML requres dot: 5.e-100. Fix it with simple hack\n\n return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;\n}\n\nfunction isFloat(object) {\n return (Object.prototype.toString.call(object) === '[object Number]') &&\n (object % 1 !== 0 || common.isNegativeZero(object));\n}\n\nvar float = new type('tag:yaml.org,2002:float', {\n kind: 'scalar',\n resolve: resolveYamlFloat,\n construct: constructYamlFloat,\n predicate: isFloat,\n represent: representYamlFloat,\n defaultStyle: 'lowercase'\n});\n\nvar json = failsafe.extend({\n implicit: [\n _null,\n bool,\n int,\n float\n ]\n});\n\nvar core = json;\n\nvar YAML_DATE_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9])' + // [2] month\n '-([0-9][0-9])$'); // [3] day\n\nvar YAML_TIMESTAMP_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9]?)' + // [2] month\n '-([0-9][0-9]?)' + // [3] day\n '(?:[Tt]|[ \\\\t]+)' + // ...\n '([0-9][0-9]?)' + // [4] hour\n ':([0-9][0-9])' + // [5] minute\n ':([0-9][0-9])' + // [6] second\n '(?:\\\\.([0-9]*))?' + // [7] fraction\n '(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour\n '(?::([0-9][0-9]))?))?$'); // [11] tz_minute\n\nfunction resolveYamlTimestamp(data) {\n if (data === null) return false;\n if (YAML_DATE_REGEXP.exec(data) !== null) return true;\n if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;\n return false;\n}\n\nfunction constructYamlTimestamp(data) {\n var match, year, month, day, hour, minute, second, fraction = 0,\n delta = null, tz_hour, tz_minute, date;\n\n match = YAML_DATE_REGEXP.exec(data);\n if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);\n\n if (match === null) throw new Error('Date resolve error');\n\n // match: [1] year [2] month [3] day\n\n year = +(match[1]);\n month = +(match[2]) - 1; // JS month starts with 0\n day = +(match[3]);\n\n if (!match[4]) { // no hour\n return new Date(Date.UTC(year, month, day));\n }\n\n // match: [4] hour [5] minute [6] second [7] fraction\n\n hour = +(match[4]);\n minute = +(match[5]);\n second = +(match[6]);\n\n if (match[7]) {\n fraction = match[7].slice(0, 3);\n while (fraction.length < 3) { // milli-seconds\n fraction += '0';\n }\n fraction = +fraction;\n }\n\n // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute\n\n if (match[9]) {\n tz_hour = +(match[10]);\n tz_minute = +(match[11] || 0);\n delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds\n if (match[9] === '-') delta = -delta;\n }\n\n date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));\n\n if (delta) date.setTime(date.getTime() - delta);\n\n return date;\n}\n\nfunction representYamlTimestamp(object /*, style*/) {\n return object.toISOString();\n}\n\nvar timestamp = new type('tag:yaml.org,2002:timestamp', {\n kind: 'scalar',\n resolve: resolveYamlTimestamp,\n construct: constructYamlTimestamp,\n instanceOf: Date,\n represent: representYamlTimestamp\n});\n\nfunction resolveYamlMerge(data) {\n return data === '<<' || data === null;\n}\n\nvar merge = new type('tag:yaml.org,2002:merge', {\n kind: 'scalar',\n resolve: resolveYamlMerge\n});\n\n/*eslint-disable no-bitwise*/\n\n\n\n\n\n// [ 64, 65, 66 ] -> [ padding, CR, LF ]\nvar BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\\n\\r';\n\n\nfunction resolveYamlBinary(data) {\n if (data === null) return false;\n\n var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;\n\n // Convert one by one.\n for (idx = 0; idx < max; idx++) {\n code = map.indexOf(data.charAt(idx));\n\n // Skip CR/LF\n if (code > 64) continue;\n\n // Fail on illegal characters\n if (code < 0) return false;\n\n bitlen += 6;\n }\n\n // If there are any bits left, source was corrupted\n return (bitlen % 8) === 0;\n}\n\nfunction constructYamlBinary(data) {\n var idx, tailbits,\n input = data.replace(/[\\r\\n=]/g, ''), // remove CR/LF & padding to simplify scan\n max = input.length,\n map = BASE64_MAP,\n bits = 0,\n result = [];\n\n // Collect by 6*4 bits (3 bytes)\n\n for (idx = 0; idx < max; idx++) {\n if ((idx % 4 === 0) && idx) {\n result.push((bits >> 16) & 0xFF);\n result.push((bits >> 8) & 0xFF);\n result.push(bits & 0xFF);\n }\n\n bits = (bits << 6) | map.indexOf(input.charAt(idx));\n }\n\n // Dump tail\n\n tailbits = (max % 4) * 6;\n\n if (tailbits === 0) {\n result.push((bits >> 16) & 0xFF);\n result.push((bits >> 8) & 0xFF);\n result.push(bits & 0xFF);\n } else if (tailbits === 18) {\n result.push((bits >> 10) & 0xFF);\n result.push((bits >> 2) & 0xFF);\n } else if (tailbits === 12) {\n result.push((bits >> 4) & 0xFF);\n }\n\n return new Uint8Array(result);\n}\n\nfunction representYamlBinary(object /*, style*/) {\n var result = '', bits = 0, idx, tail,\n max = object.length,\n map = BASE64_MAP;\n\n // Convert every three bytes to 4 ASCII characters.\n\n for (idx = 0; idx < max; idx++) {\n if ((idx % 3 === 0) && idx) {\n result += map[(bits >> 18) & 0x3F];\n result += map[(bits >> 12) & 0x3F];\n result += map[(bits >> 6) & 0x3F];\n result += map[bits & 0x3F];\n }\n\n bits = (bits << 8) + object[idx];\n }\n\n // Dump tail\n\n tail = max % 3;\n\n if (tail === 0) {\n result += map[(bits >> 18) & 0x3F];\n result += map[(bits >> 12) & 0x3F];\n result += map[(bits >> 6) & 0x3F];\n result += map[bits & 0x3F];\n } else if (tail === 2) {\n result += map[(bits >> 10) & 0x3F];\n result += map[(bits >> 4) & 0x3F];\n result += map[(bits << 2) & 0x3F];\n result += map[64];\n } else if (tail === 1) {\n result += map[(bits >> 2) & 0x3F];\n result += map[(bits << 4) & 0x3F];\n result += map[64];\n result += map[64];\n }\n\n return result;\n}\n\nfunction isBinary(obj) {\n return Object.prototype.toString.call(obj) === '[object Uint8Array]';\n}\n\nvar binary = new type('tag:yaml.org,2002:binary', {\n kind: 'scalar',\n resolve: resolveYamlBinary,\n construct: constructYamlBinary,\n predicate: isBinary,\n represent: representYamlBinary\n});\n\nvar _hasOwnProperty$3 = Object.prototype.hasOwnProperty;\nvar _toString$2 = Object.prototype.toString;\n\nfunction resolveYamlOmap(data) {\n if (data === null) return true;\n\n var objectKeys = [], index, length, pair, pairKey, pairHasKey,\n object = data;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n pairHasKey = false;\n\n if (_toString$2.call(pair) !== '[object Object]') return false;\n\n for (pairKey in pair) {\n if (_hasOwnProperty$3.call(pair, pairKey)) {\n if (!pairHasKey) pairHasKey = true;\n else return false;\n }\n }\n\n if (!pairHasKey) return false;\n\n if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);\n else return false;\n }\n\n return true;\n}\n\nfunction constructYamlOmap(data) {\n return data !== null ? data : [];\n}\n\nvar omap = new type('tag:yaml.org,2002:omap', {\n kind: 'sequence',\n resolve: resolveYamlOmap,\n construct: constructYamlOmap\n});\n\nvar _toString$1 = Object.prototype.toString;\n\nfunction resolveYamlPairs(data) {\n if (data === null) return true;\n\n var index, length, pair, keys, result,\n object = data;\n\n result = new Array(object.length);\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n\n if (_toString$1.call(pair) !== '[object Object]') return false;\n\n keys = Object.keys(pair);\n\n if (keys.length !== 1) return false;\n\n result[index] = [ keys[0], pair[keys[0]] ];\n }\n\n return true;\n}\n\nfunction constructYamlPairs(data) {\n if (data === null) return [];\n\n var index, length, pair, keys, result,\n object = data;\n\n result = new Array(object.length);\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n\n keys = Object.keys(pair);\n\n result[index] = [ keys[0], pair[keys[0]] ];\n }\n\n return result;\n}\n\nvar pairs = new type('tag:yaml.org,2002:pairs', {\n kind: 'sequence',\n resolve: resolveYamlPairs,\n construct: constructYamlPairs\n});\n\nvar _hasOwnProperty$2 = Object.prototype.hasOwnProperty;\n\nfunction resolveYamlSet(data) {\n if (data === null) return true;\n\n var key, object = data;\n\n for (key in object) {\n if (_hasOwnProperty$2.call(object, key)) {\n if (object[key] !== null) return false;\n }\n }\n\n return true;\n}\n\nfunction constructYamlSet(data) {\n return data !== null ? data : {};\n}\n\nvar set = new type('tag:yaml.org,2002:set', {\n kind: 'mapping',\n resolve: resolveYamlSet,\n construct: constructYamlSet\n});\n\nvar _default = core.extend({\n implicit: [\n timestamp,\n merge\n ],\n explicit: [\n binary,\n omap,\n pairs,\n set\n ]\n});\n\n/*eslint-disable max-len,no-use-before-define*/\n\n\n\n\n\n\n\nvar _hasOwnProperty$1 = Object.prototype.hasOwnProperty;\n\n\nvar CONTEXT_FLOW_IN = 1;\nvar CONTEXT_FLOW_OUT = 2;\nvar CONTEXT_BLOCK_IN = 3;\nvar CONTEXT_BLOCK_OUT = 4;\n\n\nvar CHOMPING_CLIP = 1;\nvar CHOMPING_STRIP = 2;\nvar CHOMPING_KEEP = 3;\n\n\nvar PATTERN_NON_PRINTABLE = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/;\nvar PATTERN_NON_ASCII_LINE_BREAKS = /[\\x85\\u2028\\u2029]/;\nvar PATTERN_FLOW_INDICATORS = /[,\\[\\]\\{\\}]/;\nvar PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\\-]+!)$/i;\nvar PATTERN_TAG_URI = /^(?:!|[^,\\[\\]\\{\\}])(?:%[0-9a-f]{2}|[0-9a-z\\-#;\\/\\?:@&=\\+\\$,_\\.!~\\*'\\(\\)\\[\\]])*$/i;\n\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\n\nfunction is_EOL(c) {\n return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);\n}\n\nfunction is_WHITE_SPACE(c) {\n return (c === 0x09/* Tab */) || (c === 0x20/* Space */);\n}\n\nfunction is_WS_OR_EOL(c) {\n return (c === 0x09/* Tab */) ||\n (c === 0x20/* Space */) ||\n (c === 0x0A/* LF */) ||\n (c === 0x0D/* CR */);\n}\n\nfunction is_FLOW_INDICATOR(c) {\n return c === 0x2C/* , */ ||\n c === 0x5B/* [ */ ||\n c === 0x5D/* ] */ ||\n c === 0x7B/* { */ ||\n c === 0x7D/* } */;\n}\n\nfunction fromHexCode(c) {\n var lc;\n\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\n return c - 0x30;\n }\n\n /*eslint-disable no-bitwise*/\n lc = c | 0x20;\n\n if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {\n return lc - 0x61 + 10;\n }\n\n return -1;\n}\n\nfunction escapedHexLen(c) {\n if (c === 0x78/* x */) { return 2; }\n if (c === 0x75/* u */) { return 4; }\n if (c === 0x55/* U */) { return 8; }\n return 0;\n}\n\nfunction fromDecimalCode(c) {\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\n return c - 0x30;\n }\n\n return -1;\n}\n\nfunction simpleEscapeSequence(c) {\n /* eslint-disable indent */\n return (c === 0x30/* 0 */) ? '\\x00' :\n (c === 0x61/* a */) ? '\\x07' :\n (c === 0x62/* b */) ? '\\x08' :\n (c === 0x74/* t */) ? '\\x09' :\n (c === 0x09/* Tab */) ? '\\x09' :\n (c === 0x6E/* n */) ? '\\x0A' :\n (c === 0x76/* v */) ? '\\x0B' :\n (c === 0x66/* f */) ? '\\x0C' :\n (c === 0x72/* r */) ? '\\x0D' :\n (c === 0x65/* e */) ? '\\x1B' :\n (c === 0x20/* Space */) ? ' ' :\n (c === 0x22/* \" */) ? '\\x22' :\n (c === 0x2F/* / */) ? '/' :\n (c === 0x5C/* \\ */) ? '\\x5C' :\n (c === 0x4E/* N */) ? '\\x85' :\n (c === 0x5F/* _ */) ? '\\xA0' :\n (c === 0x4C/* L */) ? '\\u2028' :\n (c === 0x50/* P */) ? '\\u2029' : '';\n}\n\nfunction charFromCodepoint(c) {\n if (c <= 0xFFFF) {\n return String.fromCharCode(c);\n }\n // Encode UTF-16 surrogate pair\n // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF\n return String.fromCharCode(\n ((c - 0x010000) >> 10) + 0xD800,\n ((c - 0x010000) & 0x03FF) + 0xDC00\n );\n}\n\nvar simpleEscapeCheck = new Array(256); // integer, for fast access\nvar simpleEscapeMap = new Array(256);\nfor (var i = 0; i < 256; i++) {\n simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;\n simpleEscapeMap[i] = simpleEscapeSequence(i);\n}\n\n\nfunction State$1(input, options) {\n this.input = input;\n\n this.filename = options['filename'] || null;\n this.schema = options['schema'] || _default;\n this.onWarning = options['onWarning'] || null;\n // (Hidden) Remove? makes the loader to expect YAML 1.1 documents\n // if such documents have no explicit %YAML directive\n this.legacy = options['legacy'] || false;\n\n this.json = options['json'] || false;\n this.listener = options['listener'] || null;\n\n this.implicitTypes = this.schema.compiledImplicit;\n this.typeMap = this.schema.compiledTypeMap;\n\n this.length = input.length;\n this.position = 0;\n this.line = 0;\n this.lineStart = 0;\n this.lineIndent = 0;\n\n // position of first leading tab in the current line,\n // used to make sure there are no tabs in the indentation\n this.firstTabInLine = -1;\n\n this.documents = [];\n\n /*\n this.version;\n this.checkLineBreaks;\n this.tagMap;\n this.anchorMap;\n this.tag;\n this.anchor;\n this.kind;\n this.result;*/\n\n}\n\n\nfunction generateError(state, message) {\n var mark = {\n name: state.filename,\n buffer: state.input.slice(0, -1), // omit trailing \\0\n position: state.position,\n line: state.line,\n column: state.position - state.lineStart\n };\n\n mark.snippet = snippet(mark);\n\n return new exception(message, mark);\n}\n\nfunction throwError(state, message) {\n throw generateError(state, message);\n}\n\nfunction throwWarning(state, message) {\n if (state.onWarning) {\n state.onWarning.call(null, generateError(state, message));\n }\n}\n\n\nvar directiveHandlers = {\n\n YAML: function handleYamlDirective(state, name, args) {\n\n var match, major, minor;\n\n if (state.version !== null) {\n throwError(state, 'duplication of %YAML directive');\n }\n\n if (args.length !== 1) {\n throwError(state, 'YAML directive accepts exactly one argument');\n }\n\n match = /^([0-9]+)\\.([0-9]+)$/.exec(args[0]);\n\n if (match === null) {\n throwError(state, 'ill-formed argument of the YAML directive');\n }\n\n major = parseInt(match[1], 10);\n minor = parseInt(match[2], 10);\n\n if (major !== 1) {\n throwError(state, 'unacceptable YAML version of the document');\n }\n\n state.version = args[0];\n state.checkLineBreaks = (minor < 2);\n\n if (minor !== 1 && minor !== 2) {\n throwWarning(state, 'unsupported YAML version of the document');\n }\n },\n\n TAG: function handleTagDirective(state, name, args) {\n\n var handle, prefix;\n\n if (args.length !== 2) {\n throwError(state, 'TAG directive accepts exactly two arguments');\n }\n\n handle = args[0];\n prefix = args[1];\n\n if (!PATTERN_TAG_HANDLE.test(handle)) {\n throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');\n }\n\n if (_hasOwnProperty$1.call(state.tagMap, handle)) {\n throwError(state, 'there is a previously declared suffix for \"' + handle + '\" tag handle');\n }\n\n if (!PATTERN_TAG_URI.test(prefix)) {\n throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');\n }\n\n try {\n prefix = decodeURIComponent(prefix);\n } catch (err) {\n throwError(state, 'tag prefix is malformed: ' + prefix);\n }\n\n state.tagMap[handle] = prefix;\n }\n};\n\n\nfunction captureSegment(state, start, end, checkJson) {\n var _position, _length, _character, _result;\n\n if (start < end) {\n _result = state.input.slice(start, end);\n\n if (checkJson) {\n for (_position = 0, _length = _result.length; _position < _length; _position += 1) {\n _character = _result.charCodeAt(_position);\n if (!(_character === 0x09 ||\n (0x20 <= _character && _character <= 0x10FFFF))) {\n throwError(state, 'expected valid JSON character');\n }\n }\n } else if (PATTERN_NON_PRINTABLE.test(_result)) {\n throwError(state, 'the stream contains non-printable characters');\n }\n\n state.result += _result;\n }\n}\n\nfunction mergeMappings(state, destination, source, overridableKeys) {\n var sourceKeys, key, index, quantity;\n\n if (!common.isObject(source)) {\n throwError(state, 'cannot merge mappings; the provided source object is unacceptable');\n }\n\n sourceKeys = Object.keys(source);\n\n for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {\n key = sourceKeys[index];\n\n if (!_hasOwnProperty$1.call(destination, key)) {\n destination[key] = source[key];\n overridableKeys[key] = true;\n }\n }\n}\n\nfunction storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,\n startLine, startLineStart, startPos) {\n\n var index, quantity;\n\n // The output is a plain object here, so keys can only be strings.\n // We need to convert keyNode to a string, but doing so can hang the process\n // (deeply nested arrays that explode exponentially using aliases).\n if (Array.isArray(keyNode)) {\n keyNode = Array.prototype.slice.call(keyNode);\n\n for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {\n if (Array.isArray(keyNode[index])) {\n throwError(state, 'nested arrays are not supported inside keys');\n }\n\n if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {\n keyNode[index] = '[object Object]';\n }\n }\n }\n\n // Avoid code execution in load() via toString property\n // (still use its own toString for arrays, timestamps,\n // and whatever user schema extensions happen to have @@toStringTag)\n if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {\n keyNode = '[object Object]';\n }\n\n\n keyNode = String(keyNode);\n\n if (_result === null) {\n _result = {};\n }\n\n if (keyTag === 'tag:yaml.org,2002:merge') {\n if (Array.isArray(valueNode)) {\n for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {\n mergeMappings(state, _result, valueNode[index], overridableKeys);\n }\n } else {\n mergeMappings(state, _result, valueNode, overridableKeys);\n }\n } else {\n if (!state.json &&\n !_hasOwnProperty$1.call(overridableKeys, keyNode) &&\n _hasOwnProperty$1.call(_result, keyNode)) {\n state.line = startLine || state.line;\n state.lineStart = startLineStart || state.lineStart;\n state.position = startPos || state.position;\n throwError(state, 'duplicated mapping key');\n }\n\n // used for this specific key only because Object.defineProperty is slow\n if (keyNode === '__proto__') {\n Object.defineProperty(_result, keyNode, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: valueNode\n });\n } else {\n _result[keyNode] = valueNode;\n }\n delete overridableKeys[keyNode];\n }\n\n return _result;\n}\n\nfunction readLineBreak(state) {\n var ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x0A/* LF */) {\n state.position++;\n } else if (ch === 0x0D/* CR */) {\n state.position++;\n if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {\n state.position++;\n }\n } else {\n throwError(state, 'a line break is expected');\n }\n\n state.line += 1;\n state.lineStart = state.position;\n state.firstTabInLine = -1;\n}\n\nfunction skipSeparationSpace(state, allowComments, checkIndent) {\n var lineBreaks = 0,\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n while (is_WHITE_SPACE(ch)) {\n if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {\n state.firstTabInLine = state.position;\n }\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (allowComments && ch === 0x23/* # */) {\n do {\n ch = state.input.charCodeAt(++state.position);\n } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);\n }\n\n if (is_EOL(ch)) {\n readLineBreak(state);\n\n ch = state.input.charCodeAt(state.position);\n lineBreaks++;\n state.lineIndent = 0;\n\n while (ch === 0x20/* Space */) {\n state.lineIndent++;\n ch = state.input.charCodeAt(++state.position);\n }\n } else {\n break;\n }\n }\n\n if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {\n throwWarning(state, 'deficient indentation');\n }\n\n return lineBreaks;\n}\n\nfunction testDocumentSeparator(state) {\n var _position = state.position,\n ch;\n\n ch = state.input.charCodeAt(_position);\n\n // Condition state.position === state.lineStart is tested\n // in parent on each call, for efficiency. No needs to test here again.\n if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&\n ch === state.input.charCodeAt(_position + 1) &&\n ch === state.input.charCodeAt(_position + 2)) {\n\n _position += 3;\n\n ch = state.input.charCodeAt(_position);\n\n if (ch === 0 || is_WS_OR_EOL(ch)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction writeFoldedLines(state, count) {\n if (count === 1) {\n state.result += ' ';\n } else if (count > 1) {\n state.result += common.repeat('\\n', count - 1);\n }\n}\n\n\nfunction readPlainScalar(state, nodeIndent, withinFlowCollection) {\n var preceding,\n following,\n captureStart,\n captureEnd,\n hasPendingContent,\n _line,\n _lineStart,\n _lineIndent,\n _kind = state.kind,\n _result = state.result,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (is_WS_OR_EOL(ch) ||\n is_FLOW_INDICATOR(ch) ||\n ch === 0x23/* # */ ||\n ch === 0x26/* & */ ||\n ch === 0x2A/* * */ ||\n ch === 0x21/* ! */ ||\n ch === 0x7C/* | */ ||\n ch === 0x3E/* > */ ||\n ch === 0x27/* ' */ ||\n ch === 0x22/* \" */ ||\n ch === 0x25/* % */ ||\n ch === 0x40/* @ */ ||\n ch === 0x60/* ` */) {\n return false;\n }\n\n if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following) ||\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\n return false;\n }\n }\n\n state.kind = 'scalar';\n state.result = '';\n captureStart = captureEnd = state.position;\n hasPendingContent = false;\n\n while (ch !== 0) {\n if (ch === 0x3A/* : */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following) ||\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\n break;\n }\n\n } else if (ch === 0x23/* # */) {\n preceding = state.input.charCodeAt(state.position - 1);\n\n if (is_WS_OR_EOL(preceding)) {\n break;\n }\n\n } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||\n withinFlowCollection && is_FLOW_INDICATOR(ch)) {\n break;\n\n } else if (is_EOL(ch)) {\n _line = state.line;\n _lineStart = state.lineStart;\n _lineIndent = state.lineIndent;\n skipSeparationSpace(state, false, -1);\n\n if (state.lineIndent >= nodeIndent) {\n hasPendingContent = true;\n ch = state.input.charCodeAt(state.position);\n continue;\n } else {\n state.position = captureEnd;\n state.line = _line;\n state.lineStart = _lineStart;\n state.lineIndent = _lineIndent;\n break;\n }\n }\n\n if (hasPendingContent) {\n captureSegment(state, captureStart, captureEnd, false);\n writeFoldedLines(state, state.line - _line);\n captureStart = captureEnd = state.position;\n hasPendingContent = false;\n }\n\n if (!is_WHITE_SPACE(ch)) {\n captureEnd = state.position + 1;\n }\n\n ch = state.input.charCodeAt(++state.position);\n }\n\n captureSegment(state, captureStart, captureEnd, false);\n\n if (state.result) {\n return true;\n }\n\n state.kind = _kind;\n state.result = _result;\n return false;\n}\n\nfunction readSingleQuotedScalar(state, nodeIndent) {\n var ch,\n captureStart, captureEnd;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x27/* ' */) {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n state.position++;\n captureStart = captureEnd = state.position;\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n if (ch === 0x27/* ' */) {\n captureSegment(state, captureStart, state.position, true);\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x27/* ' */) {\n captureStart = state.position;\n state.position++;\n captureEnd = state.position;\n } else {\n return true;\n }\n\n } else if (is_EOL(ch)) {\n captureSegment(state, captureStart, captureEnd, true);\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\n captureStart = captureEnd = state.position;\n\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a single quoted scalar');\n\n } else {\n state.position++;\n captureEnd = state.position;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a single quoted scalar');\n}\n\nfunction readDoubleQuotedScalar(state, nodeIndent) {\n var captureStart,\n captureEnd,\n hexLength,\n hexResult,\n tmp,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x22/* \" */) {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n state.position++;\n captureStart = captureEnd = state.position;\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n if (ch === 0x22/* \" */) {\n captureSegment(state, captureStart, state.position, true);\n state.position++;\n return true;\n\n } else if (ch === 0x5C/* \\ */) {\n captureSegment(state, captureStart, state.position, true);\n ch = state.input.charCodeAt(++state.position);\n\n if (is_EOL(ch)) {\n skipSeparationSpace(state, false, nodeIndent);\n\n // TODO: rework to inline fn with no type cast?\n } else if (ch < 256 && simpleEscapeCheck[ch]) {\n state.result += simpleEscapeMap[ch];\n state.position++;\n\n } else if ((tmp = escapedHexLen(ch)) > 0) {\n hexLength = tmp;\n hexResult = 0;\n\n for (; hexLength > 0; hexLength--) {\n ch = state.input.charCodeAt(++state.position);\n\n if ((tmp = fromHexCode(ch)) >= 0) {\n hexResult = (hexResult << 4) + tmp;\n\n } else {\n throwError(state, 'expected hexadecimal character');\n }\n }\n\n state.result += charFromCodepoint(hexResult);\n\n state.position++;\n\n } else {\n throwError(state, 'unknown escape sequence');\n }\n\n captureStart = captureEnd = state.position;\n\n } else if (is_EOL(ch)) {\n captureSegment(state, captureStart, captureEnd, true);\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\n captureStart = captureEnd = state.position;\n\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a double quoted scalar');\n\n } else {\n state.position++;\n captureEnd = state.position;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a double quoted scalar');\n}\n\nfunction readFlowCollection(state, nodeIndent) {\n var readNext = true,\n _line,\n _lineStart,\n _pos,\n _tag = state.tag,\n _result,\n _anchor = state.anchor,\n following,\n terminator,\n isPair,\n isExplicitPair,\n isMapping,\n overridableKeys = Object.create(null),\n keyNode,\n keyTag,\n valueNode,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x5B/* [ */) {\n terminator = 0x5D;/* ] */\n isMapping = false;\n _result = [];\n } else if (ch === 0x7B/* { */) {\n terminator = 0x7D;/* } */\n isMapping = true;\n _result = {};\n } else {\n return false;\n }\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(++state.position);\n\n while (ch !== 0) {\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === terminator) {\n state.position++;\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = isMapping ? 'mapping' : 'sequence';\n state.result = _result;\n return true;\n } else if (!readNext) {\n throwError(state, 'missed comma between flow collection entries');\n } else if (ch === 0x2C/* , */) {\n // \"flow collection entries can never be completely empty\", as per YAML 1.2, section 7.4\n throwError(state, \"expected the node content, but found ','\");\n }\n\n keyTag = keyNode = valueNode = null;\n isPair = isExplicitPair = false;\n\n if (ch === 0x3F/* ? */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following)) {\n isPair = isExplicitPair = true;\n state.position++;\n skipSeparationSpace(state, true, nodeIndent);\n }\n }\n\n _line = state.line; // Save the current line.\n _lineStart = state.lineStart;\n _pos = state.position;\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\n keyTag = state.tag;\n keyNode = state.result;\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {\n isPair = true;\n ch = state.input.charCodeAt(++state.position);\n skipSeparationSpace(state, true, nodeIndent);\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\n valueNode = state.result;\n }\n\n if (isMapping) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);\n } else if (isPair) {\n _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));\n } else {\n _result.push(keyNode);\n }\n\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x2C/* , */) {\n readNext = true;\n ch = state.input.charCodeAt(++state.position);\n } else {\n readNext = false;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a flow collection');\n}\n\nfunction readBlockScalar(state, nodeIndent) {\n var captureStart,\n folding,\n chomping = CHOMPING_CLIP,\n didReadContent = false,\n detectedIndent = false,\n textIndent = nodeIndent,\n emptyLines = 0,\n atMoreIndented = false,\n tmp,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x7C/* | */) {\n folding = false;\n } else if (ch === 0x3E/* > */) {\n folding = true;\n } else {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n\n while (ch !== 0) {\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {\n if (CHOMPING_CLIP === chomping) {\n chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;\n } else {\n throwError(state, 'repeat of a chomping mode identifier');\n }\n\n } else if ((tmp = fromDecimalCode(ch)) >= 0) {\n if (tmp === 0) {\n throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');\n } else if (!detectedIndent) {\n textIndent = nodeIndent + tmp - 1;\n detectedIndent = true;\n } else {\n throwError(state, 'repeat of an indentation width identifier');\n }\n\n } else {\n break;\n }\n }\n\n if (is_WHITE_SPACE(ch)) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (is_WHITE_SPACE(ch));\n\n if (ch === 0x23/* # */) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (!is_EOL(ch) && (ch !== 0));\n }\n }\n\n while (ch !== 0) {\n readLineBreak(state);\n state.lineIndent = 0;\n\n ch = state.input.charCodeAt(state.position);\n\n while ((!detectedIndent || state.lineIndent < textIndent) &&\n (ch === 0x20/* Space */)) {\n state.lineIndent++;\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (!detectedIndent && state.lineIndent > textIndent) {\n textIndent = state.lineIndent;\n }\n\n if (is_EOL(ch)) {\n emptyLines++;\n continue;\n }\n\n // End of the scalar.\n if (state.lineIndent < textIndent) {\n\n // Perform the chomping.\n if (chomping === CHOMPING_KEEP) {\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\n } else if (chomping === CHOMPING_CLIP) {\n if (didReadContent) { // i.e. only if the scalar is not empty.\n state.result += '\\n';\n }\n }\n\n // Break this `while` cycle and go to the funciton's epilogue.\n break;\n }\n\n // Folded style: use fancy rules to handle line breaks.\n if (folding) {\n\n // Lines starting with white space characters (more-indented lines) are not folded.\n if (is_WHITE_SPACE(ch)) {\n atMoreIndented = true;\n // except for the first content line (cf. Example 8.1)\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\n\n // End of more-indented block.\n } else if (atMoreIndented) {\n atMoreIndented = false;\n state.result += common.repeat('\\n', emptyLines + 1);\n\n // Just one line break - perceive as the same line.\n } else if (emptyLines === 0) {\n if (didReadContent) { // i.e. only if we have already read some scalar content.\n state.result += ' ';\n }\n\n // Several line breaks - perceive as different lines.\n } else {\n state.result += common.repeat('\\n', emptyLines);\n }\n\n // Literal style: just add exact number of line breaks between content lines.\n } else {\n // Keep all line breaks except the header line break.\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\n }\n\n didReadContent = true;\n detectedIndent = true;\n emptyLines = 0;\n captureStart = state.position;\n\n while (!is_EOL(ch) && (ch !== 0)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n captureSegment(state, captureStart, state.position, false);\n }\n\n return true;\n}\n\nfunction readBlockSequence(state, nodeIndent) {\n var _line,\n _tag = state.tag,\n _anchor = state.anchor,\n _result = [],\n following,\n detected = false,\n ch;\n\n // there is a leading tab before this token, so it can't be a block sequence/mapping;\n // it can still be flow sequence/mapping or a scalar\n if (state.firstTabInLine !== -1) return false;\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n if (state.firstTabInLine !== -1) {\n state.position = state.firstTabInLine;\n throwError(state, 'tab characters must not be used in indentation');\n }\n\n if (ch !== 0x2D/* - */) {\n break;\n }\n\n following = state.input.charCodeAt(state.position + 1);\n\n if (!is_WS_OR_EOL(following)) {\n break;\n }\n\n detected = true;\n state.position++;\n\n if (skipSeparationSpace(state, true, -1)) {\n if (state.lineIndent <= nodeIndent) {\n _result.push(null);\n ch = state.input.charCodeAt(state.position);\n continue;\n }\n }\n\n _line = state.line;\n composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);\n _result.push(state.result);\n skipSeparationSpace(state, true, -1);\n\n ch = state.input.charCodeAt(state.position);\n\n if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {\n throwError(state, 'bad indentation of a sequence entry');\n } else if (state.lineIndent < nodeIndent) {\n break;\n }\n }\n\n if (detected) {\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = 'sequence';\n state.result = _result;\n return true;\n }\n return false;\n}\n\nfunction readBlockMapping(state, nodeIndent, flowIndent) {\n var following,\n allowCompact,\n _line,\n _keyLine,\n _keyLineStart,\n _keyPos,\n _tag = state.tag,\n _anchor = state.anchor,\n _result = {},\n overridableKeys = Object.create(null),\n keyTag = null,\n keyNode = null,\n valueNode = null,\n atExplicitKey = false,\n detected = false,\n ch;\n\n // there is a leading tab before this token, so it can't be a block sequence/mapping;\n // it can still be flow sequence/mapping or a scalar\n if (state.firstTabInLine !== -1) return false;\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n if (!atExplicitKey && state.firstTabInLine !== -1) {\n state.position = state.firstTabInLine;\n throwError(state, 'tab characters must not be used in indentation');\n }\n\n following = state.input.charCodeAt(state.position + 1);\n _line = state.line; // Save the current line.\n\n //\n // Explicit notation case. There are two separate blocks:\n // first for the key (denoted by \"?\") and second for the value (denoted by \":\")\n //\n if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {\n\n if (ch === 0x3F/* ? */) {\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\n keyTag = keyNode = valueNode = null;\n }\n\n detected = true;\n atExplicitKey = true;\n allowCompact = true;\n\n } else if (atExplicitKey) {\n // i.e. 0x3A/* : */ === character after the explicit key.\n atExplicitKey = false;\n allowCompact = true;\n\n } else {\n throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');\n }\n\n state.position += 1;\n ch = following;\n\n //\n // Implicit notation case. Flow-style node as the key first, then \":\", and the value.\n //\n } else {\n _keyLine = state.line;\n _keyLineStart = state.lineStart;\n _keyPos = state.position;\n\n if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {\n // Neither implicit nor explicit notation.\n // Reading is done. Go to the epilogue.\n break;\n }\n\n if (state.line === _line) {\n ch = state.input.charCodeAt(state.position);\n\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (ch === 0x3A/* : */) {\n ch = state.input.charCodeAt(++state.position);\n\n if (!is_WS_OR_EOL(ch)) {\n throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');\n }\n\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\n keyTag = keyNode = valueNode = null;\n }\n\n detected = true;\n atExplicitKey = false;\n allowCompact = false;\n keyTag = state.tag;\n keyNode = state.result;\n\n } else if (detected) {\n throwError(state, 'can not read an implicit mapping pair; a colon is missed');\n\n } else {\n state.tag = _tag;\n state.anchor = _anchor;\n return true; // Keep the result of `composeNode`.\n }\n\n } else if (detected) {\n throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');\n\n } else {\n state.tag = _tag;\n state.anchor = _anchor;\n return true; // Keep the result of `composeNode`.\n }\n }\n\n //\n // Common reading code for both explicit and implicit notations.\n //\n if (state.line === _line || state.lineIndent > nodeIndent) {\n if (atExplicitKey) {\n _keyLine = state.line;\n _keyLineStart = state.lineStart;\n _keyPos = state.position;\n }\n\n if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {\n if (atExplicitKey) {\n keyNode = state.result;\n } else {\n valueNode = state.result;\n }\n }\n\n if (!atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);\n keyTag = keyNode = valueNode = null;\n }\n\n skipSeparationSpace(state, true, -1);\n ch = state.input.charCodeAt(state.position);\n }\n\n if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {\n throwError(state, 'bad indentation of a mapping entry');\n } else if (state.lineIndent < nodeIndent) {\n break;\n }\n }\n\n //\n // Epilogue.\n //\n\n // Special case: last mapping's node contains only the key in explicit notation.\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\n }\n\n // Expose the resulting mapping.\n if (detected) {\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = 'mapping';\n state.result = _result;\n }\n\n return detected;\n}\n\nfunction readTagProperty(state) {\n var _position,\n isVerbatim = false,\n isNamed = false,\n tagHandle,\n tagName,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x21/* ! */) return false;\n\n if (state.tag !== null) {\n throwError(state, 'duplication of a tag property');\n }\n\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x3C/* < */) {\n isVerbatim = true;\n ch = state.input.charCodeAt(++state.position);\n\n } else if (ch === 0x21/* ! */) {\n isNamed = true;\n tagHandle = '!!';\n ch = state.input.charCodeAt(++state.position);\n\n } else {\n tagHandle = '!';\n }\n\n _position = state.position;\n\n if (isVerbatim) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (ch !== 0 && ch !== 0x3E/* > */);\n\n if (state.position < state.length) {\n tagName = state.input.slice(_position, state.position);\n ch = state.input.charCodeAt(++state.position);\n } else {\n throwError(state, 'unexpected end of the stream within a verbatim tag');\n }\n } else {\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n\n if (ch === 0x21/* ! */) {\n if (!isNamed) {\n tagHandle = state.input.slice(_position - 1, state.position + 1);\n\n if (!PATTERN_TAG_HANDLE.test(tagHandle)) {\n throwError(state, 'named tag handle cannot contain such characters');\n }\n\n isNamed = true;\n _position = state.position + 1;\n } else {\n throwError(state, 'tag suffix cannot contain exclamation marks');\n }\n }\n\n ch = state.input.charCodeAt(++state.position);\n }\n\n tagName = state.input.slice(_position, state.position);\n\n if (PATTERN_FLOW_INDICATORS.test(tagName)) {\n throwError(state, 'tag suffix cannot contain flow indicator characters');\n }\n }\n\n if (tagName && !PATTERN_TAG_URI.test(tagName)) {\n throwError(state, 'tag name cannot contain such characters: ' + tagName);\n }\n\n try {\n tagName = decodeURIComponent(tagName);\n } catch (err) {\n throwError(state, 'tag name is malformed: ' + tagName);\n }\n\n if (isVerbatim) {\n state.tag = tagName;\n\n } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {\n state.tag = state.tagMap[tagHandle] + tagName;\n\n } else if (tagHandle === '!') {\n state.tag = '!' + tagName;\n\n } else if (tagHandle === '!!') {\n state.tag = 'tag:yaml.org,2002:' + tagName;\n\n } else {\n throwError(state, 'undeclared tag handle \"' + tagHandle + '\"');\n }\n\n return true;\n}\n\nfunction readAnchorProperty(state) {\n var _position,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x26/* & */) return false;\n\n if (state.anchor !== null) {\n throwError(state, 'duplication of an anchor property');\n }\n\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (state.position === _position) {\n throwError(state, 'name of an anchor node must contain at least one character');\n }\n\n state.anchor = state.input.slice(_position, state.position);\n return true;\n}\n\nfunction readAlias(state) {\n var _position, alias,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x2A/* * */) return false;\n\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (state.position === _position) {\n throwError(state, 'name of an alias node must contain at least one character');\n }\n\n alias = state.input.slice(_position, state.position);\n\n if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {\n throwError(state, 'unidentified alias \"' + alias + '\"');\n }\n\n state.result = state.anchorMap[alias];\n skipSeparationSpace(state, true, -1);\n return true;\n}\n\nfunction composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {\n var allowBlockStyles,\n allowBlockScalars,\n allowBlockCollections,\n indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent\n atNewLine = false,\n hasContent = false,\n typeIndex,\n typeQuantity,\n typeList,\n type,\n flowIndent,\n blockIndent;\n\n if (state.listener !== null) {\n state.listener('open', state);\n }\n\n state.tag = null;\n state.anchor = null;\n state.kind = null;\n state.result = null;\n\n allowBlockStyles = allowBlockScalars = allowBlockCollections =\n CONTEXT_BLOCK_OUT === nodeContext ||\n CONTEXT_BLOCK_IN === nodeContext;\n\n if (allowToSeek) {\n if (skipSeparationSpace(state, true, -1)) {\n atNewLine = true;\n\n if (state.lineIndent > parentIndent) {\n indentStatus = 1;\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0;\n } else if (state.lineIndent < parentIndent) {\n indentStatus = -1;\n }\n }\n }\n\n if (indentStatus === 1) {\n while (readTagProperty(state) || readAnchorProperty(state)) {\n if (skipSeparationSpace(state, true, -1)) {\n atNewLine = true;\n allowBlockCollections = allowBlockStyles;\n\n if (state.lineIndent > parentIndent) {\n indentStatus = 1;\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0;\n } else if (state.lineIndent < parentIndent) {\n indentStatus = -1;\n }\n } else {\n allowBlockCollections = false;\n }\n }\n }\n\n if (allowBlockCollections) {\n allowBlockCollections = atNewLine || allowCompact;\n }\n\n if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {\n if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {\n flowIndent = parentIndent;\n } else {\n flowIndent = parentIndent + 1;\n }\n\n blockIndent = state.position - state.lineStart;\n\n if (indentStatus === 1) {\n if (allowBlockCollections &&\n (readBlockSequence(state, blockIndent) ||\n readBlockMapping(state, blockIndent, flowIndent)) ||\n readFlowCollection(state, flowIndent)) {\n hasContent = true;\n } else {\n if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||\n readSingleQuotedScalar(state, flowIndent) ||\n readDoubleQuotedScalar(state, flowIndent)) {\n hasContent = true;\n\n } else if (readAlias(state)) {\n hasContent = true;\n\n if (state.tag !== null || state.anchor !== null) {\n throwError(state, 'alias node should not have any properties');\n }\n\n } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {\n hasContent = true;\n\n if (state.tag === null) {\n state.tag = '?';\n }\n }\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n }\n } else if (indentStatus === 0) {\n // Special case: block sequences are allowed to have same indentation level as the parent.\n // http://www.yaml.org/spec/1.2/spec.html#id2799784\n hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);\n }\n }\n\n if (state.tag === null) {\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n\n } else if (state.tag === '?') {\n // Implicit resolving is not allowed for non-scalar types, and '?'\n // non-specific tag is only automatically assigned to plain scalars.\n //\n // We only need to check kind conformity in case user explicitly assigns '?'\n // tag, for example like this: \"!<?> [0]\"\n //\n if (state.result !== null && state.kind !== 'scalar') {\n throwError(state, 'unacceptable node kind for !<?> tag; it should be \"scalar\", not \"' + state.kind + '\"');\n }\n\n for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {\n type = state.implicitTypes[typeIndex];\n\n if (type.resolve(state.result)) { // `state.result` updated in resolver if matched\n state.result = type.construct(state.result);\n state.tag = type.tag;\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n break;\n }\n }\n } else if (state.tag !== '!') {\n if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {\n type = state.typeMap[state.kind || 'fallback'][state.tag];\n } else {\n // looking for multi type\n type = null;\n typeList = state.typeMap.multi[state.kind || 'fallback'];\n\n for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {\n if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {\n type = typeList[typeIndex];\n break;\n }\n }\n }\n\n if (!type) {\n throwError(state, 'unknown tag !<' + state.tag + '>');\n }\n\n if (state.result !== null && type.kind !== state.kind) {\n throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be \"' + type.kind + '\", not \"' + state.kind + '\"');\n }\n\n if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched\n throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');\n } else {\n state.result = type.construct(state.result, state.tag);\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n }\n }\n\n if (state.listener !== null) {\n state.listener('close', state);\n }\n return state.tag !== null || state.anchor !== null || hasContent;\n}\n\nfunction readDocument(state) {\n var documentStart = state.position,\n _position,\n directiveName,\n directiveArgs,\n hasDirectives = false,\n ch;\n\n state.version = null;\n state.checkLineBreaks = state.legacy;\n state.tagMap = Object.create(null);\n state.anchorMap = Object.create(null);\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n skipSeparationSpace(state, true, -1);\n\n ch = state.input.charCodeAt(state.position);\n\n if (state.lineIndent > 0 || ch !== 0x25/* % */) {\n break;\n }\n\n hasDirectives = true;\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n directiveName = state.input.slice(_position, state.position);\n directiveArgs = [];\n\n if (directiveName.length < 1) {\n throwError(state, 'directive name must not be less than one character in length');\n }\n\n while (ch !== 0) {\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (ch === 0x23/* # */) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (ch !== 0 && !is_EOL(ch));\n break;\n }\n\n if (is_EOL(ch)) break;\n\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n directiveArgs.push(state.input.slice(_position, state.position));\n }\n\n if (ch !== 0) readLineBreak(state);\n\n if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {\n directiveHandlers[directiveName](state, directiveName, directiveArgs);\n } else {\n throwWarning(state, 'unknown document directive \"' + directiveName + '\"');\n }\n }\n\n skipSeparationSpace(state, true, -1);\n\n if (state.lineIndent === 0 &&\n state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&\n state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {\n state.position += 3;\n skipSeparationSpace(state, true, -1);\n\n } else if (hasDirectives) {\n throwError(state, 'directives end mark is expected');\n }\n\n composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);\n skipSeparationSpace(state, true, -1);\n\n if (state.checkLineBreaks &&\n PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {\n throwWarning(state, 'non-ASCII line breaks are interpreted as content');\n }\n\n state.documents.push(state.result);\n\n if (state.position === state.lineStart && testDocumentSeparator(state)) {\n\n if (state.input.charCodeAt(state.position) === 0x2E/* . */) {\n state.position += 3;\n skipSeparationSpace(state, true, -1);\n }\n return;\n }\n\n if (state.position < (state.length - 1)) {\n throwError(state, 'end of the stream or a document separator is expected');\n } else {\n return;\n }\n}\n\n\nfunction loadDocuments(input, options) {\n input = String(input);\n options = options || {};\n\n if (input.length !== 0) {\n\n // Add tailing `\\n` if not exists\n if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&\n input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {\n input += '\\n';\n }\n\n // Strip BOM\n if (input.charCodeAt(0) === 0xFEFF) {\n input = input.slice(1);\n }\n }\n\n var state = new State$1(input, options);\n\n var nullpos = input.indexOf('\\0');\n\n if (nullpos !== -1) {\n state.position = nullpos;\n throwError(state, 'null byte is not allowed in input');\n }\n\n // Use 0 as string terminator. That significantly simplifies bounds check.\n state.input += '\\0';\n\n while (state.input.charCodeAt(state.position) === 0x20/* Space */) {\n state.lineIndent += 1;\n state.position += 1;\n }\n\n while (state.position < (state.length - 1)) {\n readDocument(state);\n }\n\n return state.documents;\n}\n\n\nfunction loadAll$1(input, iterator, options) {\n if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {\n options = iterator;\n iterator = null;\n }\n\n var documents = loadDocuments(input, options);\n\n if (typeof iterator !== 'function') {\n return documents;\n }\n\n for (var index = 0, length = documents.length; index < length; index += 1) {\n iterator(documents[index]);\n }\n}\n\n\nfunction load$1(input, options) {\n var documents = loadDocuments(input, options);\n\n if (documents.length === 0) {\n /*eslint-disable no-undefined*/\n return undefined;\n } else if (documents.length === 1) {\n return documents[0];\n }\n throw new exception('expected a single document in the stream, but found more');\n}\n\n\nvar loadAll_1 = loadAll$1;\nvar load_1 = load$1;\n\nvar loader = {\n\tloadAll: loadAll_1,\n\tload: load_1\n};\n\n/*eslint-disable no-use-before-define*/\n\n\n\n\n\nvar _toString = Object.prototype.toString;\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar CHAR_BOM = 0xFEFF;\nvar CHAR_TAB = 0x09; /* Tab */\nvar CHAR_LINE_FEED = 0x0A; /* LF */\nvar CHAR_CARRIAGE_RETURN = 0x0D; /* CR */\nvar CHAR_SPACE = 0x20; /* Space */\nvar CHAR_EXCLAMATION = 0x21; /* ! */\nvar CHAR_DOUBLE_QUOTE = 0x22; /* \" */\nvar CHAR_SHARP = 0x23; /* # */\nvar CHAR_PERCENT = 0x25; /* % */\nvar CHAR_AMPERSAND = 0x26; /* & */\nvar CHAR_SINGLE_QUOTE = 0x27; /* ' */\nvar CHAR_ASTERISK = 0x2A; /* * */\nvar CHAR_COMMA = 0x2C; /* , */\nvar CHAR_MINUS = 0x2D; /* - */\nvar CHAR_COLON = 0x3A; /* : */\nvar CHAR_EQUALS = 0x3D; /* = */\nvar CHAR_GREATER_THAN = 0x3E; /* > */\nvar CHAR_QUESTION = 0x3F; /* ? */\nvar CHAR_COMMERCIAL_AT = 0x40; /* @ */\nvar CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */\nvar CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */\nvar CHAR_GRAVE_ACCENT = 0x60; /* ` */\nvar CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */\nvar CHAR_VERTICAL_LINE = 0x7C; /* | */\nvar CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */\n\nvar ESCAPE_SEQUENCES = {};\n\nESCAPE_SEQUENCES[0x00] = '\\\\0';\nESCAPE_SEQUENCES[0x07] = '\\\\a';\nESCAPE_SEQUENCES[0x08] = '\\\\b';\nESCAPE_SEQUENCES[0x09] = '\\\\t';\nESCAPE_SEQUENCES[0x0A] = '\\\\n';\nESCAPE_SEQUENCES[0x0B] = '\\\\v';\nESCAPE_SEQUENCES[0x0C] = '\\\\f';\nESCAPE_SEQUENCES[0x0D] = '\\\\r';\nESCAPE_SEQUENCES[0x1B] = '\\\\e';\nESCAPE_SEQUENCES[0x22] = '\\\\\"';\nESCAPE_SEQUENCES[0x5C] = '\\\\\\\\';\nESCAPE_SEQUENCES[0x85] = '\\\\N';\nESCAPE_SEQUENCES[0xA0] = '\\\\_';\nESCAPE_SEQUENCES[0x2028] = '\\\\L';\nESCAPE_SEQUENCES[0x2029] = '\\\\P';\n\nvar DEPRECATED_BOOLEANS_SYNTAX = [\n 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',\n 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'\n];\n\nvar DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\\.[0-9_]*)?$/;\n\nfunction compileStyleMap(schema, map) {\n var result, keys, index, length, tag, style, type;\n\n if (map === null) return {};\n\n result = {};\n keys = Object.keys(map);\n\n for (index = 0, length = keys.length; index < length; index += 1) {\n tag = keys[index];\n style = String(map[tag]);\n\n if (tag.slice(0, 2) === '!!') {\n tag = 'tag:yaml.org,2002:' + tag.slice(2);\n }\n type = schema.compiledTypeMap['fallback'][tag];\n\n if (type && _hasOwnProperty.call(type.styleAliases, style)) {\n style = type.styleAliases[style];\n }\n\n result[tag] = style;\n }\n\n return result;\n}\n\nfunction encodeHex(character) {\n var string, handle, length;\n\n string = character.toString(16).toUpperCase();\n\n if (character <= 0xFF) {\n handle = 'x';\n length = 2;\n } else if (character <= 0xFFFF) {\n handle = 'u';\n length = 4;\n } else if (character <= 0xFFFFFFFF) {\n handle = 'U';\n length = 8;\n } else {\n throw new exception('code point within a string may not be greater than 0xFFFFFFFF');\n }\n\n return '\\\\' + handle + common.repeat('0', length - string.length) + string;\n}\n\n\nvar QUOTING_TYPE_SINGLE = 1,\n QUOTING_TYPE_DOUBLE = 2;\n\nfunction State(options) {\n this.schema = options['schema'] || _default;\n this.indent = Math.max(1, (options['indent'] || 2));\n this.noArrayIndent = options['noArrayIndent'] || false;\n this.skipInvalid = options['skipInvalid'] || false;\n this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);\n this.styleMap = compileStyleMap(this.schema, options['styles'] || null);\n this.sortKeys = options['sortKeys'] || false;\n this.lineWidth = options['lineWidth'] || 80;\n this.noRefs = options['noRefs'] || false;\n this.noCompatMode = options['noCompatMode'] || false;\n this.condenseFlow = options['condenseFlow'] || false;\n this.quotingType = options['quotingType'] === '\"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;\n this.forceQuotes = options['forceQuotes'] || false;\n this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;\n\n this.implicitTypes = this.schema.compiledImplicit;\n this.explicitTypes = this.schema.compiledExplicit;\n\n this.tag = null;\n this.result = '';\n\n this.duplicates = [];\n this.usedDuplicates = null;\n}\n\n// Indents every line in a string. Empty lines (\\n only) are not indented.\nfunction indentString(string, spaces) {\n var ind = common.repeat(' ', spaces),\n position = 0,\n next = -1,\n result = '',\n line,\n length = string.length;\n\n while (position < length) {\n next = string.indexOf('\\n', position);\n if (next === -1) {\n line = string.slice(position);\n position = length;\n } else {\n line = string.slice(position, next + 1);\n position = next + 1;\n }\n\n if (line.length && line !== '\\n') result += ind;\n\n result += line;\n }\n\n return result;\n}\n\nfunction generateNextLine(state, level) {\n return '\\n' + common.repeat(' ', state.indent * level);\n}\n\nfunction testImplicitResolving(state, str) {\n var index, length, type;\n\n for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {\n type = state.implicitTypes[index];\n\n if (type.resolve(str)) {\n return true;\n }\n }\n\n return false;\n}\n\n// [33] s-white ::= s-space | s-tab\nfunction isWhitespace(c) {\n return c === CHAR_SPACE || c === CHAR_TAB;\n}\n\n// Returns true if the character can be printed without escaping.\n// From YAML 1.2: \"any allowed characters known to be non-printable\n// should also be escaped. [However,] This isn’t mandatory\"\n// Derived from nb-char - \\t - #x85 - #xA0 - #x2028 - #x2029.\nfunction isPrintable(c) {\n return (0x00020 <= c && c <= 0x00007E)\n || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)\n || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)\n || (0x10000 <= c && c <= 0x10FFFF);\n}\n\n// [34] ns-char ::= nb-char - s-white\n// [27] nb-char ::= c-printable - b-char - c-byte-order-mark\n// [26] b-char ::= b-line-feed | b-carriage-return\n// Including s-white (for some reason, examples doesn't match specs in this aspect)\n// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark\nfunction isNsCharOrWhitespace(c) {\n return isPrintable(c)\n && c !== CHAR_BOM\n // - b-char\n && c !== CHAR_CARRIAGE_RETURN\n && c !== CHAR_LINE_FEED;\n}\n\n// [127] ns-plain-safe(c) ::= c = flow-out ⇒ ns-plain-safe-out\n// c = flow-in ⇒ ns-plain-safe-in\n// c = block-key ⇒ ns-plain-safe-out\n// c = flow-key ⇒ ns-plain-safe-in\n// [128] ns-plain-safe-out ::= ns-char\n// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator\n// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - “:” - “#” )\n// | ( /* An ns-char preceding */ “#” )\n// | ( “:” /* Followed by an ns-plain-safe(c) */ )\nfunction isPlainSafe(c, prev, inblock) {\n var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);\n var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);\n return (\n // ns-plain-safe\n inblock ? // c = flow-in\n cIsNsCharOrWhitespace\n : cIsNsCharOrWhitespace\n // - c-flow-indicator\n && c !== CHAR_COMMA\n && c !== CHAR_LEFT_SQUARE_BRACKET\n && c !== CHAR_RIGHT_SQUARE_BRACKET\n && c !== CHAR_LEFT_CURLY_BRACKET\n && c !== CHAR_RIGHT_CURLY_BRACKET\n )\n // ns-plain-char\n && c !== CHAR_SHARP // false on '#'\n && !(prev === CHAR_COLON && !cIsNsChar) // false on ': '\n || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'\n || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'\n}\n\n// Simplified test for values allowed as the first character in plain style.\nfunction isPlainSafeFirst(c) {\n // Uses a subset of ns-char - c-indicator\n // where ns-char = nb-char - s-white.\n // No support of ( ( “?” | “:” | “-” ) /* Followed by an ns-plain-safe(c)) */ ) part\n return isPrintable(c) && c !== CHAR_BOM\n && !isWhitespace(c) // - s-white\n // - (c-indicator ::=\n // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”\n && c !== CHAR_MINUS\n && c !== CHAR_QUESTION\n && c !== CHAR_COLON\n && c !== CHAR_COMMA\n && c !== CHAR_LEFT_SQUARE_BRACKET\n && c !== CHAR_RIGHT_SQUARE_BRACKET\n && c !== CHAR_LEFT_CURLY_BRACKET\n && c !== CHAR_RIGHT_CURLY_BRACKET\n // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “\"”\n && c !== CHAR_SHARP\n && c !== CHAR_AMPERSAND\n && c !== CHAR_ASTERISK\n && c !== CHAR_EXCLAMATION\n && c !== CHAR_VERTICAL_LINE\n && c !== CHAR_EQUALS\n && c !== CHAR_GREATER_THAN\n && c !== CHAR_SINGLE_QUOTE\n && c !== CHAR_DOUBLE_QUOTE\n // | “%” | “@” | “`”)\n && c !== CHAR_PERCENT\n && c !== CHAR_COMMERCIAL_AT\n && c !== CHAR_GRAVE_ACCENT;\n}\n\n// Simplified test for values allowed as the last character in plain style.\nfunction isPlainSafeLast(c) {\n // just not whitespace or colon, it will be checked to be plain character later\n return !isWhitespace(c) && c !== CHAR_COLON;\n}\n\n// Same as 'string'.codePointAt(pos), but works in older browsers.\nfunction codePointAt(string, pos) {\n var first = string.charCodeAt(pos), second;\n if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {\n second = string.charCodeAt(pos + 1);\n if (second >= 0xDC00 && second <= 0xDFFF) {\n // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n }\n }\n return first;\n}\n\n// Determines whether block indentation indicator is required.\nfunction needIndentIndicator(string) {\n var leadingSpaceRe = /^\\n* /;\n return leadingSpaceRe.test(string);\n}\n\nvar STYLE_PLAIN = 1,\n STYLE_SINGLE = 2,\n STYLE_LITERAL = 3,\n STYLE_FOLDED = 4,\n STYLE_DOUBLE = 5;\n\n// Determines which scalar styles are possible and returns the preferred style.\n// lineWidth = -1 => no limit.\n// Pre-conditions: str.length > 0.\n// Post-conditions:\n// STYLE_PLAIN or STYLE_SINGLE => no \\n are in the string.\n// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).\n// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).\nfunction chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,\n testAmbiguousType, quotingType, forceQuotes, inblock) {\n\n var i;\n var char = 0;\n var prevChar = null;\n var hasLineBreak = false;\n var hasFoldableLine = false; // only checked if shouldTrackWidth\n var shouldTrackWidth = lineWidth !== -1;\n var previousLineBreak = -1; // count the first line correctly\n var plain = isPlainSafeFirst(codePointAt(string, 0))\n && isPlainSafeLast(codePointAt(string, string.length - 1));\n\n if (singleLineOnly || forceQuotes) {\n // Case: no block styles.\n // Check for disallowed characters to rule out plain and single.\n for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n char = codePointAt(string, i);\n if (!isPrintable(char)) {\n return STYLE_DOUBLE;\n }\n plain = plain && isPlainSafe(char, prevChar, inblock);\n prevChar = char;\n }\n } else {\n // Case: block styles permitted.\n for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n char = codePointAt(string, i);\n if (char === CHAR_LINE_FEED) {\n hasLineBreak = true;\n // Check if any line can be folded.\n if (shouldTrackWidth) {\n hasFoldableLine = hasFoldableLine ||\n // Foldable line = too long, and not more-indented.\n (i - previousLineBreak - 1 > lineWidth &&\n string[previousLineBreak + 1] !== ' ');\n previousLineBreak = i;\n }\n } else if (!isPrintable(char)) {\n return STYLE_DOUBLE;\n }\n plain = plain && isPlainSafe(char, prevChar, inblock);\n prevChar = char;\n }\n // in case the end is missing a \\n\n hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&\n (i - previousLineBreak - 1 > lineWidth &&\n string[previousLineBreak + 1] !== ' '));\n }\n // Although every style can represent \\n without escaping, prefer block styles\n // for multiline, since they're more readable and they don't add empty lines.\n // Also prefer folding a super-long line.\n if (!hasLineBreak && !hasFoldableLine) {\n // Strings interpretable as another type have to be quoted;\n // e.g. the string 'true' vs. the boolean true.\n if (plain && !forceQuotes && !testAmbiguousType(string)) {\n return STYLE_PLAIN;\n }\n return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;\n }\n // Edge case: block indentation indicator can only have one digit.\n if (indentPerLevel > 9 && needIndentIndicator(string)) {\n return STYLE_DOUBLE;\n }\n // At this point we know block styles are valid.\n // Prefer literal style unless we want to fold.\n if (!forceQuotes) {\n return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;\n }\n return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;\n}\n\n// Note: line breaking/folding is implemented for only the folded style.\n// NB. We drop the last trailing newline (if any) of a returned block scalar\n// since the dumper adds its own newline. This always works:\n// • No ending newline => unaffected; already using strip \"-\" chomping.\n// • Ending newline => removed then restored.\n// Importantly, this keeps the \"+\" chomp indicator from gaining an extra line.\nfunction writeScalar(state, string, level, iskey, inblock) {\n state.dump = (function () {\n if (string.length === 0) {\n return state.quotingType === QUOTING_TYPE_DOUBLE ? '\"\"' : \"''\";\n }\n if (!state.noCompatMode) {\n if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {\n return state.quotingType === QUOTING_TYPE_DOUBLE ? ('\"' + string + '\"') : (\"'\" + string + \"'\");\n }\n }\n\n var indent = state.indent * Math.max(1, level); // no 0-indent scalars\n // As indentation gets deeper, let the width decrease monotonically\n // to the lower bound min(state.lineWidth, 40).\n // Note that this implies\n // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.\n // state.lineWidth > 40 + state.indent: width decreases until the lower bound.\n // This behaves better than a constant minimum width which disallows narrower options,\n // or an indent threshold which causes the width to suddenly increase.\n var lineWidth = state.lineWidth === -1\n ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);\n\n // Without knowing if keys are implicit/explicit, assume implicit for safety.\n var singleLineOnly = iskey\n // No block styles in flow mode.\n || (state.flowLevel > -1 && level >= state.flowLevel);\n function testAmbiguity(string) {\n return testImplicitResolving(state, string);\n }\n\n switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,\n testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {\n\n case STYLE_PLAIN:\n return string;\n case STYLE_SINGLE:\n return \"'\" + string.replace(/'/g, \"''\") + \"'\";\n case STYLE_LITERAL:\n return '|' + blockHeader(string, state.indent)\n + dropEndingNewline(indentString(string, indent));\n case STYLE_FOLDED:\n return '>' + blockHeader(string, state.indent)\n + dropEndingNewline(indentString(foldString(string, lineWidth), indent));\n case STYLE_DOUBLE:\n return '\"' + escapeString(string) + '\"';\n default:\n throw new exception('impossible error: invalid scalar style');\n }\n }());\n}\n\n// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.\nfunction blockHeader(string, indentPerLevel) {\n var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';\n\n // note the special case: the string '\\n' counts as a \"trailing\" empty line.\n var clip = string[string.length - 1] === '\\n';\n var keep = clip && (string[string.length - 2] === '\\n' || string === '\\n');\n var chomp = keep ? '+' : (clip ? '' : '-');\n\n return indentIndicator + chomp + '\\n';\n}\n\n// (See the note for writeScalar.)\nfunction dropEndingNewline(string) {\n return string[string.length - 1] === '\\n' ? string.slice(0, -1) : string;\n}\n\n// Note: a long line without a suitable break point will exceed the width limit.\n// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.\nfunction foldString(string, width) {\n // In folded style, $k$ consecutive newlines output as $k+1$ newlines—\n // unless they're before or after a more-indented line, or at the very\n // beginning or end, in which case $k$ maps to $k$.\n // Therefore, parse each chunk as newline(s) followed by a content line.\n var lineRe = /(\\n+)([^\\n]*)/g;\n\n // first line (possibly an empty line)\n var result = (function () {\n var nextLF = string.indexOf('\\n');\n nextLF = nextLF !== -1 ? nextLF : string.length;\n lineRe.lastIndex = nextLF;\n return foldLine(string.slice(0, nextLF), width);\n }());\n // If we haven't reached the first content line yet, don't add an extra \\n.\n var prevMoreIndented = string[0] === '\\n' || string[0] === ' ';\n var moreIndented;\n\n // rest of the lines\n var match;\n while ((match = lineRe.exec(string))) {\n var prefix = match[1], line = match[2];\n moreIndented = (line[0] === ' ');\n result += prefix\n + (!prevMoreIndented && !moreIndented && line !== ''\n ? '\\n' : '')\n + foldLine(line, width);\n prevMoreIndented = moreIndented;\n }\n\n return result;\n}\n\n// Greedy line breaking.\n// Picks the longest line under the limit each time,\n// otherwise settles for the shortest line over the limit.\n// NB. More-indented lines *cannot* be folded, as that would add an extra \\n.\nfunction foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}\n\n// Escapes a double-quoted string.\nfunction escapeString(string) {\n var result = '';\n var char = 0;\n var escapeSeq;\n\n for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n char = codePointAt(string, i);\n escapeSeq = ESCAPE_SEQUENCES[char];\n\n if (!escapeSeq && isPrintable(char)) {\n result += string[i];\n if (char >= 0x10000) result += string[i + 1];\n } else {\n result += escapeSeq || encodeHex(char);\n }\n }\n\n return result;\n}\n\nfunction writeFlowSequence(state, level, object) {\n var _result = '',\n _tag = state.tag,\n index,\n length,\n value;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n value = object[index];\n\n if (state.replacer) {\n value = state.replacer.call(object, String(index), value);\n }\n\n // Write only valid elements, put null instead of invalid elements.\n if (writeNode(state, level, value, false, false) ||\n (typeof value === 'undefined' &&\n writeNode(state, level, null, false, false))) {\n\n if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');\n _result += state.dump;\n }\n }\n\n state.tag = _tag;\n state.dump = '[' + _result + ']';\n}\n\nfunction writeBlockSequence(state, level, object, compact) {\n var _result = '',\n _tag = state.tag,\n index,\n length,\n value;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n value = object[index];\n\n if (state.replacer) {\n value = state.replacer.call(object, String(index), value);\n }\n\n // Write only valid elements, put null instead of invalid elements.\n if (writeNode(state, level + 1, value, true, true, false, true) ||\n (typeof value === 'undefined' &&\n writeNode(state, level + 1, null, true, true, false, true))) {\n\n if (!compact || _result !== '') {\n _result += generateNextLine(state, level);\n }\n\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n _result += '-';\n } else {\n _result += '- ';\n }\n\n _result += state.dump;\n }\n }\n\n state.tag = _tag;\n state.dump = _result || '[]'; // Empty sequence if no valid values.\n}\n\nfunction writeFlowMapping(state, level, object) {\n var _result = '',\n _tag = state.tag,\n objectKeyList = Object.keys(object),\n index,\n length,\n objectKey,\n objectValue,\n pairBuffer;\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n\n pairBuffer = '';\n if (_result !== '') pairBuffer += ', ';\n\n if (state.condenseFlow) pairBuffer += '\"';\n\n objectKey = objectKeyList[index];\n objectValue = object[objectKey];\n\n if (state.replacer) {\n objectValue = state.replacer.call(object, objectKey, objectValue);\n }\n\n if (!writeNode(state, level, objectKey, false, false)) {\n continue; // Skip this pair because of invalid key;\n }\n\n if (state.dump.length > 1024) pairBuffer += '? ';\n\n pairBuffer += state.dump + (state.condenseFlow ? '\"' : '') + ':' + (state.condenseFlow ? '' : ' ');\n\n if (!writeNode(state, level, objectValue, false, false)) {\n continue; // Skip this pair because of invalid value.\n }\n\n pairBuffer += state.dump;\n\n // Both key and value are valid.\n _result += pairBuffer;\n }\n\n state.tag = _tag;\n state.dump = '{' + _result + '}';\n}\n\nfunction writeBlockMapping(state, level, object, compact) {\n var _result = '',\n _tag = state.tag,\n objectKeyList = Object.keys(object),\n index,\n length,\n objectKey,\n objectValue,\n explicitPair,\n pairBuffer;\n\n // Allow sorting keys so that the output file is deterministic\n if (state.sortKeys === true) {\n // Default sorting\n objectKeyList.sort();\n } else if (typeof state.sortKeys === 'function') {\n // Custom sort function\n objectKeyList.sort(state.sortKeys);\n } else if (state.sortKeys) {\n // Something is wrong\n throw new exception('sortKeys must be a boolean or a function');\n }\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n pairBuffer = '';\n\n if (!compact || _result !== '') {\n pairBuffer += generateNextLine(state, level);\n }\n\n objectKey = objectKeyList[index];\n objectValue = object[objectKey];\n\n if (state.replacer) {\n objectValue = state.replacer.call(object, objectKey, objectValue);\n }\n\n if (!writeNode(state, level + 1, objectKey, true, true, true)) {\n continue; // Skip this pair because of invalid key.\n }\n\n explicitPair = (state.tag !== null && state.tag !== '?') ||\n (state.dump && state.dump.length > 1024);\n\n if (explicitPair) {\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n pairBuffer += '?';\n } else {\n pairBuffer += '? ';\n }\n }\n\n pairBuffer += state.dump;\n\n if (explicitPair) {\n pairBuffer += generateNextLine(state, level);\n }\n\n if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {\n continue; // Skip this pair because of invalid value.\n }\n\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n pairBuffer += ':';\n } else {\n pairBuffer += ': ';\n }\n\n pairBuffer += state.dump;\n\n // Both key and value are valid.\n _result += pairBuffer;\n }\n\n state.tag = _tag;\n state.dump = _result || '{}'; // Empty mapping if no valid pairs.\n}\n\nfunction detectType(state, object, explicit) {\n var _result, typeList, index, length, type, style;\n\n typeList = explicit ? state.explicitTypes : state.implicitTypes;\n\n for (index = 0, length = typeList.length; index < length; index += 1) {\n type = typeList[index];\n\n if ((type.instanceOf || type.predicate) &&\n (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&\n (!type.predicate || type.predicate(object))) {\n\n if (explicit) {\n if (type.multi && type.representName) {\n state.tag = type.representName(object);\n } else {\n state.tag = type.tag;\n }\n } else {\n state.tag = '?';\n }\n\n if (type.represent) {\n style = state.styleMap[type.tag] || type.defaultStyle;\n\n if (_toString.call(type.represent) === '[object Function]') {\n _result = type.represent(object, style);\n } else if (_hasOwnProperty.call(type.represent, style)) {\n _result = type.represent[style](object, style);\n } else {\n throw new exception('!<' + type.tag + '> tag resolver accepts not \"' + style + '\" style');\n }\n\n state.dump = _result;\n }\n\n return true;\n }\n }\n\n return false;\n}\n\n// Serializes `object` and writes it to global `result`.\n// Returns true on success, or false on invalid object.\n//\nfunction writeNode(state, level, object, block, compact, iskey, isblockseq) {\n state.tag = null;\n state.dump = object;\n\n if (!detectType(state, object, false)) {\n detectType(state, object, true);\n }\n\n var type = _toString.call(state.dump);\n var inblock = block;\n var tagStr;\n\n if (block) {\n block = (state.flowLevel < 0 || state.flowLevel > level);\n }\n\n var objectOrArray = type === '[object Object]' || type === '[object Array]',\n duplicateIndex,\n duplicate;\n\n if (objectOrArray) {\n duplicateIndex = state.duplicates.indexOf(object);\n duplicate = duplicateIndex !== -1;\n }\n\n if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {\n compact = false;\n }\n\n if (duplicate && state.usedDuplicates[duplicateIndex]) {\n state.dump = '*ref_' + duplicateIndex;\n } else {\n if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {\n state.usedDuplicates[duplicateIndex] = true;\n }\n if (type === '[object Object]') {\n if (block && (Object.keys(state.dump).length !== 0)) {\n writeBlockMapping(state, level, state.dump, compact);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + state.dump;\n }\n } else {\n writeFlowMapping(state, level, state.dump);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\n }\n }\n } else if (type === '[object Array]') {\n if (block && (state.dump.length !== 0)) {\n if (state.noArrayIndent && !isblockseq && level > 0) {\n writeBlockSequence(state, level - 1, state.dump, compact);\n } else {\n writeBlockSequence(state, level, state.dump, compact);\n }\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + state.dump;\n }\n } else {\n writeFlowSequence(state, level, state.dump);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\n }\n }\n } else if (type === '[object String]') {\n if (state.tag !== '?') {\n writeScalar(state, state.dump, level, iskey, inblock);\n }\n } else if (type === '[object Undefined]') {\n return false;\n } else {\n if (state.skipInvalid) return false;\n throw new exception('unacceptable kind of an object to dump ' + type);\n }\n\n if (state.tag !== null && state.tag !== '?') {\n // Need to encode all characters except those allowed by the spec:\n //\n // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */\n // [36] ns-hex-digit ::= ns-dec-digit\n // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */\n // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */\n // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | “-”\n // [39] ns-uri-char ::= “%” ns-hex-digit ns-hex-digit | ns-word-char | “#”\n // | “;” | “/” | “?” | “:” | “@” | “&” | “=” | “+” | “$” | “,”\n // | “_” | “.” | “!” | “~” | “*” | “'” | “(” | “)” | “[” | “]”\n //\n // Also need to encode '!' because it has special meaning (end of tag prefix).\n //\n tagStr = encodeURI(\n state.tag[0] === '!' ? state.tag.slice(1) : state.tag\n ).replace(/!/g, '%21');\n\n if (state.tag[0] === '!') {\n tagStr = '!' + tagStr;\n } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {\n tagStr = '!!' + tagStr.slice(18);\n } else {\n tagStr = '!<' + tagStr + '>';\n }\n\n state.dump = tagStr + ' ' + state.dump;\n }\n }\n\n return true;\n}\n\nfunction getDuplicateReferences(object, state) {\n var objects = [],\n duplicatesIndexes = [],\n index,\n length;\n\n inspectNode(object, objects, duplicatesIndexes);\n\n for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {\n state.duplicates.push(objects[duplicatesIndexes[index]]);\n }\n state.usedDuplicates = new Array(length);\n}\n\nfunction inspectNode(object, objects, duplicatesIndexes) {\n var objectKeyList,\n index,\n length;\n\n if (object !== null && typeof object === 'object') {\n index = objects.indexOf(object);\n if (index !== -1) {\n if (duplicatesIndexes.indexOf(index) === -1) {\n duplicatesIndexes.push(index);\n }\n } else {\n objects.push(object);\n\n if (Array.isArray(object)) {\n for (index = 0, length = object.length; index < length; index += 1) {\n inspectNode(object[index], objects, duplicatesIndexes);\n }\n } else {\n objectKeyList = Object.keys(object);\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);\n }\n }\n }\n }\n}\n\nfunction dump$1(input, options) {\n options = options || {};\n\n var state = new State(options);\n\n if (!state.noRefs) getDuplicateReferences(input, state);\n\n var value = input;\n\n if (state.replacer) {\n value = state.replacer.call({ '': value }, '', value);\n }\n\n if (writeNode(state, 0, value, true, true)) return state.dump + '\\n';\n\n return '';\n}\n\nvar dump_1 = dump$1;\n\nvar dumper = {\n\tdump: dump_1\n};\n\nfunction renamed(from, to) {\n return function () {\n throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +\n 'Use yaml.' + to + ' instead, which is now safe by default.');\n };\n}\n\n\nvar Type = type;\nvar Schema = schema;\nvar FAILSAFE_SCHEMA = failsafe;\nvar JSON_SCHEMA = json;\nvar CORE_SCHEMA = core;\nvar DEFAULT_SCHEMA = _default;\nvar load = loader.load;\nvar loadAll = loader.loadAll;\nvar dump = dumper.dump;\nvar YAMLException = exception;\n\n// Re-export all types in case user wants to create custom schema\nvar types = {\n binary: binary,\n float: float,\n map: map,\n null: _null,\n pairs: pairs,\n set: set,\n timestamp: timestamp,\n bool: bool,\n int: int,\n merge: merge,\n omap: omap,\n seq: seq,\n str: str\n};\n\n// Removed functions from JS-YAML 3.0.x\nvar safeLoad = renamed('safeLoad', 'load');\nvar safeLoadAll = renamed('safeLoadAll', 'loadAll');\nvar safeDump = renamed('safeDump', 'dump');\n\nvar jsYaml = {\n\tType: Type,\n\tSchema: Schema,\n\tFAILSAFE_SCHEMA: FAILSAFE_SCHEMA,\n\tJSON_SCHEMA: JSON_SCHEMA,\n\tCORE_SCHEMA: CORE_SCHEMA,\n\tDEFAULT_SCHEMA: DEFAULT_SCHEMA,\n\tload: load,\n\tloadAll: loadAll,\n\tdump: dump,\n\tYAMLException: YAMLException,\n\ttypes: types,\n\tsafeLoad: safeLoad,\n\tsafeLoadAll: safeLoadAll,\n\tsafeDump: safeDump\n};\n\nexport default jsYaml;\nexport { CORE_SCHEMA, DEFAULT_SCHEMA, FAILSAFE_SCHEMA, JSON_SCHEMA, Schema, Type, YAMLException, dump, load, loadAll, safeDump, safeLoad, safeLoadAll, types };\n","import { css } from '@emotion/css';\nimport { dump, load } from 'js-yaml';\nimport React, { FC, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport AutoSizer from 'react-virtualized-auto-sizer';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, CodeEditor, Drawer, Tab, TabsBar, useStyles2 } from '@grafana/ui';\n\nimport { RuleFormValues } from '../../types/rule-form';\n\ninterface Props {\n onClose: () => void;\n}\n\nconst tabs = [{ label: 'Yaml', value: 'yaml' }];\n\nexport const RuleInspector: FC<Props> = ({ onClose }) => {\n const [activeTab, setActiveTab] = useState('yaml');\n const { setValue } = useFormContext<RuleFormValues>();\n const styles = useStyles2(drawerStyles);\n\n const onApply = (formValues: RuleFormValues) => {\n // Need to loop through all values and set them individually\n // TODO this is not type-safe :(\n for (const key in formValues) {\n // @ts-ignore\n setValue(key, formValues[key]);\n }\n onClose();\n };\n\n return (\n <Drawer\n title=\"Inspect Alert rule\"\n subtitle={\n <div className={styles.subtitle}>\n <RuleInspectorSubtitle setActiveTab={setActiveTab} activeTab={activeTab} />\n </div>\n }\n onClose={onClose}\n >\n {activeTab === 'yaml' && <InspectorYamlTab onSubmit={onApply} />}\n </Drawer>\n );\n};\n\ninterface SubtitleProps {\n activeTab: string;\n setActiveTab: (tab: string) => void;\n}\n\nconst RuleInspectorSubtitle: FC<SubtitleProps> = ({ activeTab, setActiveTab }) => {\n return (\n <TabsBar>\n {tabs.map((tab, index) => {\n return (\n <Tab\n key={`${tab.value}-${index}`}\n label={tab.label}\n value={tab.value}\n onChangeTab={() => setActiveTab(tab.value)}\n active={activeTab === tab.value}\n />\n );\n })}\n </TabsBar>\n );\n};\n\ninterface YamlTabProps {\n onSubmit: (newModel: RuleFormValues) => void;\n}\n\nconst InspectorYamlTab: FC<YamlTabProps> = ({ onSubmit }) => {\n const styles = useStyles2(yamlTabStyle);\n const { getValues } = useFormContext<RuleFormValues>();\n const [alertRuleAsYaml, setAlertRuleAsYaml] = useState(dump(getValues()));\n\n const onApply = () => {\n onSubmit(load(alertRuleAsYaml) as RuleFormValues);\n };\n\n return (\n <>\n <div className={styles.applyButton}>\n <Button type=\"button\" onClick={onApply}>\n Apply\n </Button>\n </div>\n\n <div className={styles.content}>\n <AutoSizer disableWidth>\n {({ height }) => (\n <CodeEditor\n width=\"100%\"\n height={height}\n language=\"yaml\"\n value={alertRuleAsYaml}\n onBlur={setAlertRuleAsYaml}\n monacoOptions={{\n minimap: {\n enabled: false,\n },\n }}\n />\n )}\n </AutoSizer>\n </div>\n </>\n );\n};\n\nconst yamlTabStyle = (theme: GrafanaTheme2) => ({\n content: css`\n flex-grow: 1;\n height: 100%;\n padding-bottom: 16px;\n margin-bottom: ${theme.spacing(2)};\n `,\n applyButton: css`\n display: flex;\n flex-grow: 0;\n `,\n});\n\nconst drawerStyles = () => ({\n subtitle: css`\n display: flex;\n align-items: center;\n justify-content: space-between;\n `,\n});\n","import { css } from '@emotion/css';\nimport { last } from 'lodash';\nimport React, { FC, useEffect, useMemo } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { Alert, Card, Field, InputControl, RadioButtonList, useStyles2 } from '@grafana/ui';\nimport { ExpressionDatasourceUID } from 'app/features/expressions/ExpressionDatasource';\n\nimport { RuleFormValues } from '../../types/rule-form';\n\ninterface Props {\n existing?: boolean;\n}\n\nexport const ConditionField: FC<Props> = ({ existing = false }) => {\n const {\n watch,\n setValue,\n formState: { errors },\n } = useFormContext<RuleFormValues>();\n\n const queries = watch('queries');\n const condition = watch('condition');\n\n const expressions = useMemo(() => {\n return queries.filter((query) => query.datasourceUid === ExpressionDatasourceUID);\n }, [queries]);\n\n const options = useMemo(\n () =>\n queries\n .filter((q) => !!q.refId)\n .map<SelectableValue<string>>((q) => ({\n value: q.refId,\n label: `${q.refId} - ${expressions.includes(q) ? 'expression' : 'query'}`,\n })),\n [queries, expressions]\n );\n\n // automatically use the last expression when new expressions have been added\n useEffect(() => {\n const lastExpression = last(expressions);\n if (lastExpression && !existing) {\n setValue('condition', lastExpression.refId, { shouldValidate: true });\n }\n }, [expressions, setValue, existing]);\n\n // reset condition if option no longer exists or if it is unset, but there are options available\n useEffect(() => {\n const lastExpression = last(expressions);\n const conditionExists = options.find(({ value }) => value === condition);\n\n if (condition && !conditionExists) {\n setValue('condition', lastExpression?.refId ?? null);\n } else if (!condition && lastExpression) {\n setValue('condition', lastExpression.refId, { shouldValidate: true });\n }\n }, [condition, expressions, options, setValue]);\n\n const styles = useStyles2(getStyles);\n\n return options.length ? (\n <Card className={styles.container}>\n <Card.Heading>Set alert condition</Card.Heading>\n <Card.Meta>Select one of your queries or expressions set above that contains your alert condition.</Card.Meta>\n <Card.Actions>\n <Field error={errors.condition?.message} invalid={!!errors.condition?.message}>\n <InputControl\n name=\"condition\"\n render={({ field: { onChange, ref, ...field } }) => (\n <RadioButtonList options={options} onChange={onChange} {...field} />\n )}\n rules={{\n required: {\n value: true,\n message: 'Please select the condition to alert on',\n },\n }}\n />\n </Field>\n </Card.Actions>\n </Card>\n ) : (\n <Alert title=\"No queries or expressions have been configured\" severity=\"warning\" className={styles.container}>\n Create at least one query or expression to be alerted on\n </Alert>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n container: css`\n max-width: ${theme.breakpoints.values.sm}px;\n `,\n});\n","import { DataSourceInstanceSettings } from '@grafana/data';\nimport { PromBasedDataSource } from 'app/types/unified-alerting';\n\nimport { getDataSourceByName } from '../utils/datasource';\n\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\nexport function useRulesSourcesWithRuler(): DataSourceInstanceSettings[] {\n const dataSources = useUnifiedAlertingSelector((state) => state.dataSources);\n\n const dataSourcesWithRuler = Object.values(dataSources)\n .map((ds) => ds.result)\n .filter((ds): ds is PromBasedDataSource => Boolean(ds?.rulerConfig));\n // try fetching rules for each prometheus to see if it has ruler\n\n return dataSourcesWithRuler\n .map((ds) => getDataSourceByName(ds.name))\n .filter((dsConfig): dsConfig is DataSourceInstanceSettings => Boolean(dsConfig));\n}\n","import React, { useCallback } from 'react';\n\nimport { DataSourceInstanceSettings } from '@grafana/data';\nimport { DataSourcePicker } from '@grafana/runtime';\n\nimport { useRulesSourcesWithRuler } from '../../hooks/useRuleSourcesWithRuler';\n\ninterface Props {\n onChange: (ds: DataSourceInstanceSettings) => void;\n value: string | null;\n onBlur?: () => void;\n name?: string;\n}\n\nexport function CloudRulesSourcePicker({ value, ...props }: Props): JSX.Element {\n const rulesSourcesWithRuler = useRulesSourcesWithRuler();\n\n const dataSourceFilter = useCallback(\n (ds: DataSourceInstanceSettings): boolean => {\n return !!rulesSourcesWithRuler.find(({ id }) => id === ds.id);\n },\n [rulesSourcesWithRuler]\n );\n\n return <DataSourcePicker noDefault alerting filter={dataSourceFilter} current={value} {...props} />;\n}\n","import { css, cx } from '@emotion/css';\nimport React, { FC, ReactNode } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Card, useStyles2 } from '@grafana/ui';\n\nimport { RuleFormType } from '../../../types/rule-form';\n\ninterface Props extends SharedProps {\n image: string;\n name: string;\n description: ReactNode;\n value: RuleFormType;\n}\n\n// these properties are shared between all Rule Types\nexport interface SharedProps {\n selected?: boolean;\n disabled?: boolean;\n onClick: (value: RuleFormType) => void;\n}\n\nconst RuleType: FC<Props> = (props) => {\n const { name, description, image, selected = false, value, onClick, disabled = false } = props;\n const styles = useStyles2(getStyles);\n\n const cardStyles = cx({\n [styles.wrapper]: true,\n [styles.disabled]: disabled,\n });\n\n return (\n <Card className={cardStyles} isSelected={selected} onClick={() => onClick(value)} disabled={disabled}>\n <Card.Figure>\n <img src={image} />\n </Card.Figure>\n <Card.Heading>{name}</Card.Heading>\n <Card.Description>{description}</Card.Description>\n </Card>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n wrapper: css`\n width: 380px;\n cursor: pointer;\n user-select: none;\n `,\n disabled: css`\n opacity: 0.5;\n `,\n});\n\nexport { RuleType };\n","import React, { FC } from 'react';\n\nimport { RuleFormType } from '../../../types/rule-form';\n\nimport { RuleType, SharedProps } from './RuleType';\n\nconst GrafanaManagedRuleType: FC<SharedProps> = ({ selected = false, disabled, onClick }) => {\n return (\n <RuleType\n name=\"Grafana managed alert\"\n description={\n <span>\n Supports multiple data sources of any kind.\n <br />\n Transform data with expressions.\n </span>\n }\n image=\"public/img/grafana_icon.svg\"\n selected={selected}\n disabled={disabled}\n value={RuleFormType.grafana}\n onClick={onClick}\n />\n );\n};\n\nexport { GrafanaManagedRuleType };\n","import React, { FC } from 'react';\n\nimport { Tooltip } from '@grafana/ui';\n\ntype Props = {\n visible: boolean;\n};\n\nconst DisabledTooltip: FC<Props> = ({ children, visible = false }) => {\n if (!visible) {\n return <>{children}</>;\n }\n\n return (\n <Tooltip content=\"You do not appear to have any compatible datasources.\" placement=\"top\">\n <div>{children}</div>\n </Tooltip>\n );\n};\n\nexport { DisabledTooltip };\n","import React, { FC } from 'react';\n\nimport { RuleFormType } from '../../../types/rule-form';\n\nimport { DisabledTooltip } from './DisabledTooltip';\nimport { RuleType, SharedProps } from './RuleType';\n\ninterface Props extends SharedProps {\n onClick: (value: RuleFormType) => void;\n}\n\nconst MimirFlavoredType: FC<Props> = ({ selected = false, disabled = false, onClick }) => {\n return (\n <DisabledTooltip visible={disabled}>\n <RuleType\n name=\"Mimir or Loki alert\"\n description={\n <span>\n Use a Mimir, Loki or Cortex datasource.\n <br />\n Expressions are not supported.\n </span>\n }\n image=\"public/img/alerting/mimir_logo.svg\"\n selected={selected}\n disabled={disabled}\n value={RuleFormType.cloudAlerting}\n onClick={onClick}\n />\n </DisabledTooltip>\n );\n};\n\nexport { MimirFlavoredType };\n","import React, { FC } from 'react';\n\nimport { RuleFormType } from '../../../types/rule-form';\n\nimport { DisabledTooltip } from './DisabledTooltip';\nimport { RuleType, SharedProps } from './RuleType';\n\nconst RecordingRuleType: FC<SharedProps> = ({ selected = false, disabled = false, onClick }) => {\n return (\n <DisabledTooltip visible={disabled}>\n <RuleType\n name=\"Mimir or Loki recording rule\"\n description={\n <span>\n Precompute expressions.\n <br />\n Should be combined with an alert rule.\n </span>\n }\n image=\"public/img/alerting/mimir_logo_recording.svg\"\n selected={selected}\n disabled={disabled}\n value={RuleFormType.cloudRecording}\n onClick={onClick}\n />\n </DisabledTooltip>\n );\n};\n\nexport { RecordingRuleType };\n","import { css } from '@emotion/css';\nimport { isEmpty } from 'lodash';\nimport React, { FC } from 'react';\n\nimport { GrafanaTheme2 } from '@grafana/data/src';\nimport { Stack } from '@grafana/experimental';\nimport { useStyles2 } from '@grafana/ui';\n\nimport { useRulesSourcesWithRuler } from '../../../hooks/useRuleSourcesWithRuler';\nimport { RuleFormType } from '../../../types/rule-form';\n\nimport { GrafanaManagedRuleType } from './GrafanaManagedAlert';\nimport { MimirFlavoredType } from './MimirOrLokiAlert';\nimport { RecordingRuleType } from './MimirOrLokiRecordingRule';\n\ninterface RuleTypePickerProps {\n onChange: (value: RuleFormType) => void;\n selected: RuleFormType;\n enabledTypes: RuleFormType[];\n}\n\nconst RuleTypePicker: FC<RuleTypePickerProps> = ({ selected, onChange, enabledTypes }) => {\n const rulesSourcesWithRuler = useRulesSourcesWithRuler();\n const hasLotexDatasources = !isEmpty(rulesSourcesWithRuler);\n\n const styles = useStyles2(getStyles);\n\n return (\n <>\n <Stack direction=\"row\" gap={2}>\n {enabledTypes.includes(RuleFormType.grafana) && (\n <GrafanaManagedRuleType selected={selected === RuleFormType.grafana} onClick={onChange} />\n )}\n {enabledTypes.includes(RuleFormType.cloudAlerting) && (\n <MimirFlavoredType\n selected={selected === RuleFormType.cloudAlerting}\n onClick={onChange}\n disabled={!hasLotexDatasources}\n />\n )}\n {enabledTypes.includes(RuleFormType.cloudRecording) && (\n <RecordingRuleType\n selected={selected === RuleFormType.cloudRecording}\n onClick={onChange}\n disabled={!hasLotexDatasources}\n />\n )}\n </Stack>\n {enabledTypes.includes(RuleFormType.grafana) && (\n <small className={styles.meta}>\n Select “Grafana managed” unless you have a Mimir, Loki or Cortex data source with the Ruler API\n enabled.\n </small>\n )}\n </>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n meta: css`\n color: ${theme.colors.text.disabled};\n `,\n});\n\nexport { RuleTypePicker };\n","import { css } from '@emotion/css';\nimport React, { FC } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { DataSourceInstanceSettings, GrafanaTheme2 } from '@grafana/data';\nimport { Field, InputControl, useStyles2 } from '@grafana/ui';\nimport { contextSrv } from 'app/core/services/context_srv';\nimport { AccessControlAction } from 'app/types';\n\nimport { RuleFormType, RuleFormValues } from '../../../types/rule-form';\nimport { CloudRulesSourcePicker } from '../CloudRulesSourcePicker';\nimport { RuleTypePicker } from '../rule-types/RuleTypePicker';\n\ninterface Props {\n editingExistingRule: boolean;\n}\n\nexport const AlertType: FC<Props> = ({ editingExistingRule }) => {\n const { enabledRuleTypes, defaultRuleType } = getAvailableRuleTypes();\n\n const {\n control,\n formState: { errors },\n getValues,\n setValue,\n watch,\n } = useFormContext<RuleFormValues & { location?: string }>();\n\n const styles = useStyles2(getStyles);\n const ruleFormType = watch('type');\n\n return (\n <>\n {!editingExistingRule && (\n <Field error={errors.type?.message} invalid={!!errors.type?.message} data-testid=\"alert-type-picker\">\n <InputControl\n render={({ field: { onChange } }) => (\n <RuleTypePicker\n aria-label=\"Rule type\"\n selected={getValues('type') ?? defaultRuleType}\n onChange={onChange}\n enabledTypes={enabledRuleTypes}\n />\n )}\n name=\"type\"\n control={control}\n rules={{\n required: { value: true, message: 'Please select alert type' },\n }}\n />\n </Field>\n )}\n\n <div className={styles.flexRow}>\n {(ruleFormType === RuleFormType.cloudRecording || ruleFormType === RuleFormType.cloudAlerting) && (\n <Field\n className={styles.formInput}\n label=\"Select data source\"\n error={errors.dataSourceName?.message}\n invalid={!!errors.dataSourceName?.message}\n data-testid=\"datasource-picker\"\n >\n <InputControl\n render={({ field: { onChange, ref, ...field } }) => (\n <CloudRulesSourcePicker\n {...field}\n onChange={(ds: DataSourceInstanceSettings) => {\n // reset location if switching data sources, as different rules source will have different groups and namespaces\n setValue('location', undefined);\n onChange(ds?.name ?? null);\n }}\n />\n )}\n name=\"dataSourceName\"\n control={control}\n rules={{\n required: { value: true, message: 'Please select a data source' },\n }}\n />\n </Field>\n )}\n </div>\n </>\n );\n};\n\nfunction getAvailableRuleTypes() {\n const canCreateGrafanaRules = contextSrv.hasAccess(\n AccessControlAction.AlertingRuleCreate,\n contextSrv.hasEditPermissionInFolders\n );\n const canCreateCloudRules = contextSrv.hasAccess(AccessControlAction.AlertingRuleExternalWrite, contextSrv.isEditor);\n const defaultRuleType = canCreateGrafanaRules ? RuleFormType.grafana : RuleFormType.cloudAlerting;\n\n const enabledRuleTypes: RuleFormType[] = [];\n if (canCreateGrafanaRules) {\n enabledRuleTypes.push(RuleFormType.grafana);\n }\n if (canCreateCloudRules) {\n enabledRuleTypes.push(RuleFormType.cloudAlerting, RuleFormType.cloudRecording);\n }\n\n return { enabledRuleTypes, defaultRuleType };\n}\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n formInput: css`\n width: 330px;\n & + & {\n margin-left: ${theme.spacing(3)};\n }\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n align-items: flex-end;\n `,\n});\n","import { noop } from 'lodash';\nimport React, { FC, useCallback, useMemo, useState } from 'react';\nimport { useAsync } from 'react-use';\n\nimport { CoreApp, DataQuery } from '@grafana/data';\nimport { getDataSourceSrv } from '@grafana/runtime';\nimport { LokiQuery } from 'app/plugins/datasource/loki/types';\nimport { PromQuery } from 'app/plugins/datasource/prometheus/types';\n\nexport interface ExpressionEditorProps {\n value?: string;\n onChange: (value: string) => void;\n dataSourceName: string; // will be a prometheus or loki datasource\n}\n\nexport const ExpressionEditor: FC<ExpressionEditorProps> = ({ value, onChange, dataSourceName }) => {\n const { mapToValue, mapToQuery } = useQueryMappers(dataSourceName);\n const [query, setQuery] = useState(mapToQuery({ refId: 'A', hide: false }, value));\n const {\n error,\n loading,\n value: dataSource,\n } = useAsync(() => {\n return getDataSourceSrv().get(dataSourceName);\n }, [dataSourceName]);\n\n const onChangeQuery = useCallback(\n (query: DataQuery) => {\n setQuery(query);\n onChange(mapToValue(query));\n },\n [onChange, mapToValue]\n );\n\n if (loading || dataSource?.name !== dataSourceName) {\n return null;\n }\n\n if (error || !dataSource || !dataSource?.components?.QueryEditor) {\n const errorMessage = error?.message || 'Data source plugin does not export any Query Editor component';\n return <div>Could not load query editor due to: {errorMessage}</div>;\n }\n\n const QueryEditor = dataSource?.components?.QueryEditor;\n\n return (\n <QueryEditor\n query={query}\n queries={[query]}\n app={CoreApp.CloudAlerting}\n onChange={onChangeQuery}\n onRunQuery={noop}\n datasource={dataSource}\n />\n );\n};\n\ntype QueryMappers<T extends DataQuery = DataQuery> = {\n mapToValue: (query: T) => string;\n mapToQuery: (existing: T, value: string | undefined) => T;\n};\n\nfunction useQueryMappers(dataSourceName: string): QueryMappers {\n return useMemo(() => {\n const settings = getDataSourceSrv().getInstanceSettings(dataSourceName);\n\n switch (settings?.type) {\n case 'loki':\n case 'prometheus':\n return {\n mapToValue: (query: DataQuery) => (query as PromQuery | LokiQuery).expr,\n mapToQuery: (existing: DataQuery, value: string | undefined) => ({ ...existing, expr: value }),\n };\n default:\n throw new Error(`${dataSourceName} is not supported as an expression editor`);\n }\n }, [dataSourceName]);\n}\n","import { css } from '@emotion/css';\nimport React, { FC, useEffect, useMemo, useState } from 'react';\nimport AutoSizer from 'react-virtualized-auto-sizer';\n\nimport { FieldConfigSource, GrafanaTheme2, PanelData, ThresholdsConfig } from '@grafana/data';\nimport { PanelRenderer } from '@grafana/runtime';\nimport { GraphFieldConfig, GraphTresholdsStyleMode } from '@grafana/schema';\nimport { PanelContext, PanelContextProvider, useStyles2 } from '@grafana/ui';\nimport appEvents from 'app/core/app_events';\nimport { PanelOptions } from 'app/plugins/panel/table/models.gen';\n\nimport { useVizHeight } from '../../hooks/useVizHeight';\nimport { SupportedPanelPlugins, PanelPluginsButtonGroup } from '../PanelPluginsButtonGroup';\n\ninterface Props {\n data: PanelData;\n currentPanel: SupportedPanelPlugins;\n changePanel: (panel: SupportedPanelPlugins) => void;\n thresholds: ThresholdsConfig;\n onThresholdsChange: (thresholds: ThresholdsConfig) => void;\n}\n\ntype PanelFieldConfig = FieldConfigSource<GraphFieldConfig>;\n\nexport const VizWrapper: FC<Props> = ({ data, currentPanel, changePanel, onThresholdsChange, thresholds }) => {\n const [options, setOptions] = useState<PanelOptions>({\n frameIndex: 0,\n showHeader: true,\n });\n const vizHeight = useVizHeight(data, currentPanel, options.frameIndex);\n const styles = useStyles2(getStyles(vizHeight));\n\n const [fieldConfig, setFieldConfig] = useState<PanelFieldConfig>(defaultFieldConfig(thresholds, data));\n\n useEffect(() => {\n setFieldConfig((fieldConfig) => ({\n ...fieldConfig,\n defaults: {\n ...fieldConfig.defaults,\n thresholds: thresholds,\n unit: defaultUnit(data),\n custom: {\n ...fieldConfig.defaults.custom,\n thresholdsStyle: {\n mode: GraphTresholdsStyleMode.Line,\n },\n },\n },\n }));\n }, [thresholds, setFieldConfig, data]);\n\n const context: PanelContext = useMemo(\n () => ({\n eventBus: appEvents,\n canEditThresholds: true,\n onThresholdsChange: onThresholdsChange,\n }),\n [onThresholdsChange]\n );\n\n if (!options || !data) {\n return null;\n }\n\n return (\n <div className={styles.wrapper}>\n <div className={styles.buttonGroup}>\n <PanelPluginsButtonGroup onChange={changePanel} value={currentPanel} />\n </div>\n <AutoSizer>\n {({ width }) => {\n if (width === 0) {\n return null;\n }\n return (\n <div style={{ height: `${vizHeight}px`, width: `${width}px` }}>\n <PanelContextProvider value={context}>\n <PanelRenderer\n height={vizHeight}\n width={width}\n data={data}\n pluginId={currentPanel}\n title=\"title\"\n onOptionsChange={setOptions}\n options={options}\n fieldConfig={fieldConfig}\n />\n </PanelContextProvider>\n </div>\n );\n }}\n </AutoSizer>\n </div>\n );\n};\n\nconst getStyles = (visHeight: number) => (theme: GrafanaTheme2) => ({\n wrapper: css`\n padding: 0 ${theme.spacing(2)};\n height: ${visHeight + theme.spacing.gridSize * 4}px;\n `,\n buttonGroup: css`\n display: flex;\n justify-content: flex-end;\n `,\n});\n\nfunction defaultUnit(data: PanelData): string | undefined {\n return data.series[0]?.fields.find((field) => field.type === 'number')?.config.unit;\n}\n\nfunction defaultFieldConfig(thresholds: ThresholdsConfig, data: PanelData): PanelFieldConfig {\n if (!thresholds) {\n return { defaults: {}, overrides: [] };\n }\n\n return {\n defaults: {\n thresholds: thresholds,\n unit: defaultUnit(data),\n custom: {\n thresholdsStyle: {\n mode: GraphTresholdsStyleMode.Line,\n },\n },\n },\n overrides: [],\n };\n}\n","import { PanelData } from '@grafana/data';\nimport { useTheme2 } from '@grafana/ui';\n\nimport { STAT, TIMESERIES } from '../utils/constants';\n\nexport function useVizHeight(data: PanelData, pluginId: string, frameIndex: number) {\n const theme = useTheme2();\n if (pluginId === TIMESERIES || pluginId === STAT || dataIsEmpty(data)) {\n return 200;\n }\n\n const values = data.series[frameIndex].fields[0].values.length;\n const rowHeight = theme.spacing.gridSize * 5;\n\n /*\n Calculate how if we can make the table smaller than 200px\n for when we only have 1-2 values\n The extra rowHeight is to accommodate the header.\n */\n const tableHeight = values * rowHeight + rowHeight;\n\n return tableHeight >= 200 ? 200 : tableHeight;\n}\n\nfunction dataIsEmpty(data: PanelData) {\n return !data || !data.series[0] || !data.series[0].fields[0] || !data.series[0].fields[0].values;\n}\n","import { css } from '@emotion/css';\nimport { cloneDeep } from 'lodash';\nimport React, { FC, ReactNode, useState } from 'react';\n\nimport {\n CoreApp,\n DataQuery,\n DataSourceInstanceSettings,\n getDefaultRelativeTimeRange,\n GrafanaTheme2,\n LoadingState,\n PanelData,\n RelativeTimeRange,\n ThresholdsConfig,\n} from '@grafana/data';\nimport { RelativeTimeRangePicker, useStyles2 } from '@grafana/ui';\nimport { isExpressionQuery } from 'app/features/expressions/guards';\nimport { QueryEditorRow } from 'app/features/query/components/QueryEditorRow';\nimport { AlertQuery } from 'app/types/unified-alerting-dto';\n\nimport { TABLE, TIMESERIES } from '../../utils/constants';\nimport { SupportedPanelPlugins } from '../PanelPluginsButtonGroup';\n\nimport { VizWrapper } from './VizWrapper';\n\ninterface Props {\n data: PanelData;\n query: AlertQuery;\n queries: AlertQuery[];\n dsSettings: DataSourceInstanceSettings;\n onChangeDataSource: (settings: DataSourceInstanceSettings, index: number) => void;\n onChangeQuery: (query: DataQuery, index: number) => void;\n onChangeTimeRange?: (timeRange: RelativeTimeRange, index: number) => void;\n onRemoveQuery: (query: DataQuery) => void;\n onDuplicateQuery: (query: AlertQuery) => void;\n onRunQueries: () => void;\n index: number;\n thresholds: ThresholdsConfig;\n onChangeThreshold: (thresholds: ThresholdsConfig, index: number) => void;\n}\n\nexport const QueryWrapper: FC<Props> = ({\n data,\n dsSettings,\n index,\n onChangeDataSource,\n onChangeQuery,\n onChangeTimeRange,\n onRunQueries,\n onRemoveQuery,\n onDuplicateQuery,\n query,\n queries,\n thresholds,\n onChangeThreshold,\n}) => {\n const styles = useStyles2(getStyles);\n const isExpression = isExpressionQuery(query.model);\n const [pluginId, changePluginId] = useState<SupportedPanelPlugins>(isExpression ? TABLE : TIMESERIES);\n\n const renderTimePicker = (query: AlertQuery, index: number): ReactNode => {\n if (isExpressionQuery(query.model) || !onChangeTimeRange) {\n return null;\n }\n\n return (\n <RelativeTimeRangePicker\n timeRange={query.relativeTimeRange ?? getDefaultRelativeTimeRange()}\n onChange={(range) => onChangeTimeRange(range, index)}\n />\n );\n };\n\n return (\n <div className={styles.wrapper}>\n <QueryEditorRow<DataQuery>\n alerting\n dataSource={dsSettings}\n onChangeDataSource={!isExpression ? (settings) => onChangeDataSource(settings, index) : undefined}\n id={query.refId}\n index={index}\n key={query.refId}\n data={data}\n query={cloneDeep(query.model)}\n onChange={(query) => onChangeQuery(query, index)}\n onRemoveQuery={onRemoveQuery}\n onAddQuery={() => onDuplicateQuery(cloneDeep(query))}\n onRunQuery={onRunQueries}\n queries={queries}\n renderHeaderExtras={() => renderTimePicker(query, index)}\n app={CoreApp.UnifiedAlerting}\n visualization={\n data.state !== LoadingState.NotStarted ? (\n <VizWrapper\n data={data}\n changePanel={changePluginId}\n currentPanel={pluginId}\n thresholds={thresholds}\n onThresholdsChange={(thresholds) => onChangeThreshold(thresholds, index)}\n />\n ) : null\n }\n hideDisableQuery={true}\n />\n </div>\n );\n};\n\nexport const EmptyQueryWrapper: FC<{}> = ({ children }) => {\n const styles = useStyles2(getStyles);\n return <div className={styles.wrapper}>{children}</div>;\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n wrapper: css`\n label: AlertingQueryWrapper;\n margin-bottom: ${theme.spacing(1)};\n border: 1px solid ${theme.colors.border.medium};\n border-radius: ${theme.shape.borderRadius(1)};\n `,\n});\n","import { omit } from 'lodash';\nimport React, { PureComponent, useState } from 'react';\nimport { DragDropContext, Droppable, DropResult } from 'react-beautiful-dnd';\n\nimport {\n DataQuery,\n DataSourceInstanceSettings,\n LoadingState,\n PanelData,\n RelativeTimeRange,\n ThresholdsConfig,\n ThresholdsMode,\n} from '@grafana/data';\nimport { config, getDataSourceSrv } from '@grafana/runtime';\nimport { Button, Card, Icon } from '@grafana/ui';\nimport { QueryOperationRow } from 'app/core/components/QueryOperationRow/QueryOperationRow';\nimport { isExpressionQuery } from 'app/features/expressions/guards';\nimport { getDatasourceSrv } from 'app/features/plugins/datasource_srv';\nimport { AlertDataQuery, AlertQuery } from 'app/types/unified-alerting-dto';\n\nimport { EmptyQueryWrapper, QueryWrapper } from './QueryWrapper';\nimport { queriesWithUpdatedReferences } from './util';\n\ninterface Props {\n // The query configuration\n queries: AlertQuery[];\n data: Record<string, PanelData>;\n\n // Query editing\n onQueriesChange: (queries: AlertQuery[]) => void;\n onDuplicateQuery: (query: AlertQuery) => void;\n onRunQueries: () => void;\n}\n\ninterface State {\n dataPerQuery: Record<string, PanelData>;\n}\n\nexport class QueryRows extends PureComponent<Props, State> {\n constructor(props: Props) {\n super(props);\n\n this.state = { dataPerQuery: {} };\n }\n\n onRemoveQuery = (query: DataQuery) => {\n this.props.onQueriesChange(\n this.props.queries.filter((item) => {\n return item.model.refId !== query.refId;\n })\n );\n };\n\n onChangeTimeRange = (timeRange: RelativeTimeRange, index: number) => {\n const { queries, onQueriesChange } = this.props;\n onQueriesChange(\n queries.map((item, itemIndex) => {\n if (itemIndex !== index) {\n return item;\n }\n return {\n ...item,\n relativeTimeRange: timeRange,\n };\n })\n );\n };\n\n onChangeThreshold = (thresholds: ThresholdsConfig, index: number) => {\n const { queries, onQueriesChange } = this.props;\n\n const referencedRefId = queries[index].refId;\n\n onQueriesChange(\n queries.map((query) => {\n if (!isExpressionQuery(query.model)) {\n return query;\n }\n\n if (query.model.conditions && query.model.conditions[0].query.params[0] === referencedRefId) {\n return {\n ...query,\n model: {\n ...query.model,\n conditions: query.model.conditions.map((condition, conditionIndex) => {\n // Only update the first condition for a given refId.\n if (condition.query.params[0] === referencedRefId && conditionIndex === 0) {\n return {\n ...condition,\n evaluator: {\n ...condition.evaluator,\n params: [parseFloat(thresholds.steps[1].value.toPrecision(3))],\n },\n };\n }\n return condition;\n }),\n },\n };\n }\n return query;\n })\n );\n };\n\n onChangeDataSource = (settings: DataSourceInstanceSettings, index: number) => {\n const { queries, onQueriesChange } = this.props;\n\n const updatedQueries = queries.map((item, itemIndex) => {\n if (itemIndex !== index) {\n return item;\n }\n\n return copyModel(item, settings.uid);\n });\n onQueriesChange(updatedQueries);\n };\n\n onChangeQuery = (query: DataQuery, index: number) => {\n const { queries, onQueriesChange } = this.props;\n\n // find what queries still have a reference to the old name\n const previousRefId = queries[index].refId;\n const newRefId = query.refId;\n\n onQueriesChange(\n queriesWithUpdatedReferences(queries, previousRefId, newRefId).map((item, itemIndex) => {\n if (itemIndex !== index) {\n return item;\n }\n\n return {\n ...item,\n refId: query.refId,\n queryType: item.model.queryType ?? '',\n model: {\n ...item.model,\n ...query,\n datasource: query.datasource!,\n },\n };\n })\n );\n };\n\n onDragEnd = (result: DropResult) => {\n const { queries, onQueriesChange } = this.props;\n\n if (!result || !result.destination) {\n return;\n }\n\n const startIndex = result.source.index;\n const endIndex = result.destination.index;\n if (startIndex === endIndex) {\n return;\n }\n\n const update = Array.from(queries);\n const [removed] = update.splice(startIndex, 1);\n update.splice(endIndex, 0, removed);\n onQueriesChange(update);\n };\n\n onDuplicateQuery = (query: DataQuery, source: AlertQuery): void => {\n this.props.onDuplicateQuery({\n ...source,\n model: query,\n });\n };\n\n getDataSourceSettings = (query: AlertQuery): DataSourceInstanceSettings | undefined => {\n return getDataSourceSrv().getInstanceSettings(query.datasourceUid);\n };\n\n getThresholdsForQueries = (queries: AlertQuery[]): Record<string, ThresholdsConfig> => {\n const record: Record<string, ThresholdsConfig> = {};\n\n for (const query of queries) {\n if (!isExpressionQuery(query.model)) {\n continue;\n }\n\n if (!Array.isArray(query.model.conditions)) {\n continue;\n }\n\n query.model.conditions.forEach((condition, index) => {\n if (index > 0) {\n return;\n }\n const threshold = condition.evaluator.params[0];\n const refId = condition.query.params[0];\n\n if (condition.evaluator.type === 'outside_range' || condition.evaluator.type === 'within_range') {\n return;\n }\n if (!record[refId]) {\n record[refId] = {\n mode: ThresholdsMode.Absolute,\n steps: [\n {\n value: -Infinity,\n color: config.theme2.colors.success.main,\n },\n ],\n };\n }\n\n record[refId].steps.push({\n value: threshold,\n color: config.theme2.colors.error.main,\n });\n });\n }\n\n return record;\n };\n\n render() {\n const { onDuplicateQuery, onRunQueries, queries } = this.props;\n const thresholdByRefId = this.getThresholdsForQueries(queries);\n\n return (\n <DragDropContext onDragEnd={this.onDragEnd}>\n <Droppable droppableId=\"alerting-queries\" direction=\"vertical\">\n {(provided) => {\n return (\n <div ref={provided.innerRef} {...provided.droppableProps}>\n {queries.map((query, index) => {\n const data: PanelData = this.props.data?.[query.refId] ?? {\n series: [],\n state: LoadingState.NotStarted,\n };\n const dsSettings = this.getDataSourceSettings(query);\n\n if (!dsSettings) {\n return (\n <DatasourceNotFound\n key={`${query.refId}-${index}`}\n index={index}\n model={query.model}\n onUpdateDatasource={() => {\n const defaultDataSource = getDatasourceSrv().getInstanceSettings(null);\n if (defaultDataSource) {\n this.onChangeDataSource(defaultDataSource, index);\n }\n }}\n onRemoveQuery={() => {\n this.onRemoveQuery(query);\n }}\n />\n );\n }\n\n return (\n <QueryWrapper\n index={index}\n key={query.refId}\n dsSettings={dsSettings}\n data={data}\n query={query}\n onChangeQuery={this.onChangeQuery}\n onRemoveQuery={this.onRemoveQuery}\n queries={queries}\n onChangeDataSource={this.onChangeDataSource}\n onDuplicateQuery={onDuplicateQuery}\n onRunQueries={onRunQueries}\n onChangeTimeRange={this.onChangeTimeRange}\n thresholds={thresholdByRefId[query.refId]}\n onChangeThreshold={this.onChangeThreshold}\n />\n );\n })}\n {provided.placeholder}\n </div>\n );\n }}\n </Droppable>\n </DragDropContext>\n );\n }\n}\n\nfunction copyModel(item: AlertQuery, uid: string): Omit<AlertQuery, 'datasource'> {\n return {\n ...item,\n model: omit(item.model, 'datasource'),\n datasourceUid: uid,\n };\n}\n\ninterface DatasourceNotFoundProps {\n index: number;\n model: AlertDataQuery;\n onUpdateDatasource: () => void;\n onRemoveQuery: () => void;\n}\n\nconst DatasourceNotFound = ({ index, onUpdateDatasource, onRemoveQuery, model }: DatasourceNotFoundProps) => {\n const refId = model.refId;\n\n const [showDetails, setShowDetails] = useState<boolean>(false);\n\n const toggleDetails = () => {\n setShowDetails((show) => !show);\n };\n\n const handleUpdateDatasource = () => {\n onUpdateDatasource();\n };\n\n return (\n <EmptyQueryWrapper>\n <QueryOperationRow title={refId} draggable index={index} id={refId} isOpen>\n <Card>\n <Card.Heading>This datasource has been removed</Card.Heading>\n <Card.Description>\n The datasource for this query was not found, it was either removed or is not installed correctly.\n </Card.Description>\n <Card.Figure>\n <Icon name=\"question-circle\" />\n </Card.Figure>\n <Card.Actions>\n <Button key=\"update\" variant=\"secondary\" onClick={handleUpdateDatasource}>\n Update datasource\n </Button>\n <Button key=\"remove\" variant=\"destructive\" onClick={onRemoveQuery}>\n Remove query\n </Button>\n </Card.Actions>\n <Card.SecondaryActions>\n <Button\n key=\"details\"\n onClick={toggleDetails}\n icon={showDetails ? 'angle-up' : 'angle-down'}\n fill=\"text\"\n size=\"sm\"\n >\n Show details\n </Button>\n </Card.SecondaryActions>\n </Card>\n {showDetails && (\n <div>\n <pre>\n <code>{JSON.stringify(model, null, 2)}</code>\n </pre>\n </div>\n )}\n </QueryOperationRow>\n </EmptyQueryWrapper>\n );\n};\n","import { css } from '@emotion/css';\nimport React, { PureComponent } from 'react';\n\nimport {\n DataQuery,\n getDefaultRelativeTimeRange,\n GrafanaTheme2,\n LoadingState,\n PanelData,\n RelativeTimeRange,\n} from '@grafana/data';\nimport { selectors } from '@grafana/e2e-selectors';\nimport { config } from '@grafana/runtime';\nimport { Button, HorizontalGroup, stylesFactory, Tooltip } from '@grafana/ui';\nimport { getNextRefIdChar } from 'app/core/utils/query';\nimport {\n dataSource as expressionDatasource,\n ExpressionDatasourceUID,\n} from 'app/features/expressions/ExpressionDatasource';\nimport { isExpressionQuery } from 'app/features/expressions/guards';\nimport { ExpressionQueryType } from 'app/features/expressions/types';\nimport { defaultCondition } from 'app/features/expressions/utils/expressionTypes';\nimport { AlertQuery } from 'app/types/unified-alerting-dto';\n\nimport { AlertingQueryRunner } from '../../state/AlertingQueryRunner';\nimport { getDefaultOrFirstCompatibleDataSource } from '../../utils/datasource';\n\nimport { QueryRows } from './QueryRows';\n\ninterface Props {\n value?: AlertQuery[];\n onChange: (queries: AlertQuery[]) => void;\n}\n\ninterface State {\n panelDataByRefId: Record<string, PanelData>;\n}\nexport class QueryEditor extends PureComponent<Props, State> {\n private runner: AlertingQueryRunner;\n private queries: AlertQuery[];\n\n constructor(props: Props) {\n super(props);\n this.state = { panelDataByRefId: {} };\n this.runner = new AlertingQueryRunner();\n this.queries = props.value ?? [];\n }\n\n componentDidMount() {\n this.runner.get().subscribe((data) => {\n this.setState({ panelDataByRefId: data });\n });\n }\n\n componentWillUnmount() {\n this.runner.destroy();\n }\n\n onRunQueries = () => {\n const { queries } = this;\n this.runner.run(queries);\n };\n\n onCancelQueries = () => {\n this.runner.cancel();\n };\n\n onChangeQueries = (queries: AlertQuery[]) => {\n this.queries = queries;\n this.props.onChange(queries);\n };\n\n onDuplicateQuery = (query: AlertQuery) => {\n const { queries } = this;\n this.onChangeQueries(addQuery(queries, query));\n };\n\n onNewAlertingQuery = () => {\n const { queries } = this;\n const datasource = getDefaultOrFirstCompatibleDataSource();\n\n if (!datasource) {\n return;\n }\n\n this.onChangeQueries(\n addQuery(queries, {\n datasourceUid: datasource.uid,\n model: {\n refId: '',\n datasource: {\n type: datasource.type,\n uid: datasource.uid,\n },\n },\n })\n );\n };\n\n onNewExpressionQuery = () => {\n const { queries } = this;\n\n this.onChangeQueries(\n addQuery(queries, {\n datasourceUid: ExpressionDatasourceUID,\n model: expressionDatasource.newQuery({\n type: ExpressionQueryType.classic,\n conditions: [defaultCondition],\n }),\n })\n );\n };\n\n isRunning() {\n const data = Object.values(this.state.panelDataByRefId).find((d) => Boolean(d));\n return data?.state === LoadingState.Loading;\n }\n\n renderRunQueryButton() {\n const isRunning = this.isRunning();\n\n if (isRunning) {\n return (\n <Button icon=\"fa fa-spinner\" type=\"button\" variant=\"destructive\" onClick={this.onCancelQueries}>\n Cancel\n </Button>\n );\n }\n\n return (\n <Button icon=\"sync\" type=\"button\" onClick={this.onRunQueries}>\n Run queries\n </Button>\n );\n }\n\n render() {\n const { value = [] } = this.props;\n const { panelDataByRefId } = this.state;\n const styles = getStyles(config.theme2);\n\n const noCompatibleDataSources = getDefaultOrFirstCompatibleDataSource() === undefined;\n\n return (\n <div className={styles.container}>\n <QueryRows\n data={panelDataByRefId}\n queries={value}\n onQueriesChange={this.onChangeQueries}\n onDuplicateQuery={this.onDuplicateQuery}\n onRunQueries={this.onRunQueries}\n />\n <HorizontalGroup spacing=\"sm\" align=\"flex-start\">\n <Tooltip content={'You appear to have no compatible data sources'} show={noCompatibleDataSources}>\n <Button\n type=\"button\"\n icon=\"plus\"\n onClick={this.onNewAlertingQuery}\n variant=\"secondary\"\n aria-label={selectors.components.QueryTab.addQuery}\n disabled={noCompatibleDataSources}\n >\n Add query\n </Button>\n </Tooltip>\n {config.expressionsEnabled && (\n <Button type=\"button\" icon=\"plus\" onClick={this.onNewExpressionQuery} variant=\"secondary\">\n Add expression\n </Button>\n )}\n {this.renderRunQueryButton()}\n </HorizontalGroup>\n </div>\n );\n }\n}\n\nconst addQuery = (queries: AlertQuery[], queryToAdd: Pick<AlertQuery, 'model' | 'datasourceUid'>): AlertQuery[] => {\n const refId = getNextRefIdChar(queries);\n\n const query: AlertQuery = {\n ...queryToAdd,\n refId,\n queryType: '',\n model: {\n ...queryToAdd.model,\n hide: false,\n refId,\n },\n relativeTimeRange: defaultTimeRange(queryToAdd.model),\n };\n\n return [...queries, query];\n};\n\nconst defaultTimeRange = (model: DataQuery): RelativeTimeRange | undefined => {\n if (isExpressionQuery(model)) {\n return;\n }\n\n return getDefaultRelativeTimeRange();\n};\n\nconst getStyles = stylesFactory((theme: GrafanaTheme2) => {\n return {\n container: css`\n background-color: ${theme.colors.background.primary};\n height: 100%;\n max-width: ${theme.breakpoints.values.xxl}px;\n `,\n runWrapper: css`\n margin-top: ${theme.spacing(1)};\n `,\n editorWrapper: css`\n border: 1px solid ${theme.colors.border.medium};\n border-radius: ${theme.shape.borderRadius()};\n `,\n };\n});\n","import React, { FC } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { Field, InputControl } from '@grafana/ui';\n\nimport { RuleFormType, RuleFormValues } from '../../../types/rule-form';\nimport { ExpressionEditor } from '../ExpressionEditor';\nimport { QueryEditor } from '../QueryEditor';\n\nexport const Query: FC = () => {\n const {\n control,\n watch,\n formState: { errors },\n } = useFormContext<RuleFormValues>();\n\n const type = watch('type');\n const dataSourceName = watch('dataSourceName');\n\n const isGrafanaManagedType = type === RuleFormType.grafana;\n const isCloudAlertRuleType = type === RuleFormType.cloudAlerting;\n const isRecordingRuleType = type === RuleFormType.cloudRecording;\n\n const showCloudExpressionEditor = (isRecordingRuleType || isCloudAlertRuleType) && dataSourceName;\n\n return (\n <div>\n {/* This is the PromQL Editor for Cloud rules and recording rules */}\n {showCloudExpressionEditor && (\n <Field error={errors.expression?.message} invalid={!!errors.expression?.message}>\n <InputControl\n name=\"expression\"\n render={({ field: { ref, ...field } }) => {\n return <ExpressionEditor {...field} dataSourceName={dataSourceName} />;\n }}\n control={control}\n rules={{\n required: { value: true, message: 'A valid expression is required' },\n }}\n />\n </Field>\n )}\n\n {/* This is the editor for Grafana managed rules */}\n {isGrafanaManagedType && (\n <Field\n invalid={!!errors.queries}\n error={(!!errors.queries && 'Must provide at least one valid query.') || undefined}\n >\n <InputControl\n name=\"queries\"\n render={({ field: { ref, ...field } }) => <QueryEditor {...field} />}\n control={control}\n rules={{\n validate: (queries) => Array.isArray(queries) && !!queries.length,\n }}\n />\n </Field>\n )}\n </div>\n );\n};\n","import React, { FC } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { RuleFormType, RuleFormValues } from '../../../types/rule-form';\nimport { ConditionField } from '../ConditionField';\nimport { RuleEditorSection } from '../RuleEditorSection';\n\nimport { AlertType } from './AlertType';\nimport { Query } from './Query';\n\ninterface Props {\n editingExistingRule: boolean;\n}\n\nexport const QueryAndAlertConditionStep: FC<Props> = ({ editingExistingRule }) => {\n const { watch } = useFormContext<RuleFormValues>();\n\n const type = watch('type');\n const isGrafanaManagedType = type === RuleFormType.grafana;\n\n return (\n <RuleEditorSection stepNo={1} title=\"Set a query and alert condition\">\n <AlertType editingExistingRule={editingExistingRule} />\n {type && <Query />}\n {isGrafanaManagedType && <ConditionField existing={editingExistingRule} />}\n </RuleEditorSection>\n );\n};\n","import { css } from '@emotion/css';\nimport React, { FC, useMemo, useState } from 'react';\nimport { FormProvider, useForm, UseFormWatch } from 'react-hook-form';\nimport { useDispatch } from 'react-redux';\nimport { Link } from 'react-router-dom';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Button, ConfirmModal, CustomScrollbar, PageToolbar, Spinner, useStyles2 } from '@grafana/ui';\nimport { useAppNotification } from 'app/core/copy/appNotification';\nimport { useCleanup } from 'app/core/hooks/useCleanup';\nimport { useQueryParams } from 'app/core/hooks/useQueryParams';\nimport { RuleWithLocation } from 'app/types/unified-alerting';\n\nimport { useUnifiedAlertingSelector } from '../../hooks/useUnifiedAlertingSelector';\nimport { deleteRuleAction, saveRuleFormAction } from '../../state/actions';\nimport { RuleFormType, RuleFormValues } from '../../types/rule-form';\nimport { initialAsyncRequestState } from '../../utils/redux';\nimport { getDefaultFormValues, getDefaultQueries, rulerRuleToFormValues } from '../../utils/rule-form';\nimport * as ruleId from '../../utils/rule-id';\n\nimport { CloudEvaluationBehavior } from './CloudEvaluationBehavior';\nimport { DetailsStep } from './DetailsStep';\nimport { GrafanaEvaluationBehavior } from './GrafanaEvaluationBehavior';\nimport { NotificationsStep } from './NotificationsStep';\nimport { RuleInspector } from './RuleInspector';\nimport { QueryAndAlertConditionStep } from './query-and-alert-condition/QueryAndAlertConditionStep';\n\ntype Props = {\n existing?: RuleWithLocation;\n};\n\nexport const AlertRuleForm: FC<Props> = ({ existing }) => {\n const styles = useStyles2(getStyles);\n const dispatch = useDispatch();\n const notifyApp = useAppNotification();\n const [queryParams] = useQueryParams();\n const [showEditYaml, setShowEditYaml] = useState(false);\n\n const returnTo: string = (queryParams['returnTo'] as string | undefined) ?? '/alerting/list';\n const [showDeleteModal, setShowDeleteModal] = useState<boolean>(false);\n\n const defaultValues: RuleFormValues = useMemo(() => {\n if (existing) {\n return rulerRuleToFormValues(existing);\n }\n return {\n ...getDefaultFormValues(),\n queries: getDefaultQueries(),\n ...(queryParams['defaults'] ? JSON.parse(queryParams['defaults'] as string) : {}),\n type: RuleFormType.grafana,\n };\n }, [existing, queryParams]);\n\n const formAPI = useForm<RuleFormValues>({\n mode: 'onSubmit',\n defaultValues,\n shouldFocusError: true,\n });\n\n const { handleSubmit, watch } = formAPI;\n\n const type = watch('type');\n const dataSourceName = watch('dataSourceName');\n\n const showStep2 = Boolean(type && (type === RuleFormType.grafana || !!dataSourceName));\n\n const submitState = useUnifiedAlertingSelector((state) => state.ruleForm.saveRule) || initialAsyncRequestState;\n useCleanup((state) => state.unifiedAlerting.ruleForm.saveRule);\n\n const submit = (values: RuleFormValues, exitOnSave: boolean) => {\n dispatch(\n saveRuleFormAction({\n values: {\n ...defaultValues,\n ...values,\n annotations:\n values.annotations\n ?.map(({ key, value }) => ({ key: key.trim(), value: value.trim() }))\n .filter(({ key, value }) => !!key && !!value) ?? [],\n labels:\n values.labels\n ?.map(({ key, value }) => ({ key: key.trim(), value: value.trim() }))\n .filter(({ key }) => !!key) ?? [],\n },\n existing,\n redirectOnSave: exitOnSave ? returnTo : undefined,\n })\n );\n };\n\n const deleteRule = () => {\n if (existing) {\n const identifier = ruleId.fromRulerRule(\n existing.ruleSourceName,\n existing.namespace,\n existing.group.name,\n existing.rule\n );\n\n dispatch(deleteRuleAction(identifier, { navigateTo: '/alerting/list' }));\n }\n };\n\n const onInvalid = () => {\n notifyApp.error('There are errors in the form. Please correct them and try again!');\n };\n\n return (\n <FormProvider {...formAPI}>\n <form onSubmit={(e) => e.preventDefault()} className={styles.form}>\n <PageToolbar title={`${existing ? 'Edit' : 'Create'} alert rule`} pageIcon=\"bell\">\n <Link to={returnTo}>\n <Button variant=\"secondary\" disabled={submitState.loading} type=\"button\" fill=\"outline\">\n Cancel\n </Button>\n </Link>\n {existing ? (\n <Button variant=\"destructive\" type=\"button\" onClick={() => setShowDeleteModal(true)}>\n Delete\n </Button>\n ) : null}\n {isCortexLokiOrRecordingRule(watch) && (\n <Button\n variant=\"secondary\"\n type=\"button\"\n onClick={() => setShowEditYaml(true)}\n disabled={submitState.loading}\n >\n Edit yaml\n </Button>\n )}\n <Button\n variant=\"primary\"\n type=\"button\"\n onClick={handleSubmit((values) => submit(values, false), onInvalid)}\n disabled={submitState.loading}\n >\n {submitState.loading && <Spinner className={styles.buttonSpinner} inline={true} />}\n Save\n </Button>\n <Button\n variant=\"primary\"\n type=\"button\"\n onClick={handleSubmit((values) => submit(values, true), onInvalid)}\n disabled={submitState.loading}\n >\n {submitState.loading && <Spinner className={styles.buttonSpinner} inline={true} />}\n Save and exit\n </Button>\n </PageToolbar>\n <div className={styles.contentOuter}>\n <CustomScrollbar autoHeightMin=\"100%\" hideHorizontalTrack={true}>\n <div className={styles.contentInner}>\n <QueryAndAlertConditionStep editingExistingRule={!!existing} />\n {showStep2 && (\n <>\n {type === RuleFormType.grafana ? <GrafanaEvaluationBehavior /> : <CloudEvaluationBehavior />}\n <DetailsStep initialFolder={defaultValues.folder} />\n <NotificationsStep />\n </>\n )}\n </div>\n </CustomScrollbar>\n </div>\n </form>\n {showDeleteModal ? (\n <ConfirmModal\n isOpen={true}\n title=\"Delete rule\"\n body=\"Deleting this rule will permanently remove it. Are you sure you want to delete this rule?\"\n confirmText=\"Yes, delete\"\n icon=\"exclamation-triangle\"\n onConfirm={deleteRule}\n onDismiss={() => setShowDeleteModal(false)}\n />\n ) : null}\n {showEditYaml ? <RuleInspector onClose={() => setShowEditYaml(false)} /> : null}\n </FormProvider>\n );\n};\n\nconst isCortexLokiOrRecordingRule = (watch: UseFormWatch<RuleFormValues>) => {\n const [ruleType, dataSourceName] = watch(['type', 'dataSourceName']);\n\n return (ruleType === RuleFormType.cloudAlerting || ruleType === RuleFormType.cloudRecording) && dataSourceName !== '';\n};\n\nconst getStyles = (theme: GrafanaTheme2) => {\n return {\n buttonSpinner: css`\n margin-right: ${theme.spacing(1)};\n `,\n form: css`\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n `,\n contentInner: css`\n flex: 1;\n padding: ${theme.spacing(2)};\n `,\n contentOuter: css`\n background: ${theme.colors.background.primary};\n border: 1px solid ${theme.colors.border.weak};\n border-radius: ${theme.shape.borderRadius()};\n margin: ${theme.spacing(0, 2, 2)};\n overflow: hidden;\n flex: 1;\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n `,\n };\n};\n","import { css } from '@emotion/css';\nimport React, { FC, useEffect } from 'react';\nimport { useDispatch } from 'react-redux';\nimport { useAsync } from 'react-use';\n\nimport { GrafanaTheme2 } from '@grafana/data';\nimport { Alert, LinkButton, LoadingPlaceholder, useStyles2, withErrorBoundary } from '@grafana/ui';\nimport Page from 'app/core/components/Page/Page';\nimport { useCleanup } from 'app/core/hooks/useCleanup';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\nimport { RuleIdentifier } from 'app/types/unified-alerting';\n\nimport { AlertRuleForm } from './components/rule-editor/AlertRuleForm';\nimport { useIsRuleEditable } from './hooks/useIsRuleEditable';\nimport { useUnifiedAlertingSelector } from './hooks/useUnifiedAlertingSelector';\nimport { fetchAllPromBuildInfoAction, fetchEditableRuleAction } from './state/actions';\nimport { useRulesAccess } from './utils/accessControlHooks';\nimport * as ruleId from './utils/rule-id';\n\ninterface ExistingRuleEditorProps {\n identifier: RuleIdentifier;\n}\n\nconst ExistingRuleEditor: FC<ExistingRuleEditorProps> = ({ identifier }) => {\n useCleanup((state) => state.unifiedAlerting.ruleForm.existingRule);\n const { loading, result, error, dispatched } = useUnifiedAlertingSelector((state) => state.ruleForm.existingRule);\n const dispatch = useDispatch();\n const { isEditable } = useIsRuleEditable(ruleId.ruleIdentifierToRuleSourceName(identifier), result?.rule);\n\n useEffect(() => {\n if (!dispatched) {\n dispatch(fetchEditableRuleAction(identifier));\n }\n }, [dispatched, dispatch, identifier]);\n\n if (loading || isEditable === undefined) {\n return (\n <Page.Contents>\n <LoadingPlaceholder text=\"Loading rule...\" />\n </Page.Contents>\n );\n }\n\n if (error) {\n return (\n <Page.Contents>\n <Alert severity=\"error\" title=\"Failed to load rule\">\n {error.message}\n </Alert>\n </Page.Contents>\n );\n }\n\n if (!result) {\n return <AlertWarning title=\"Rule not found\">Sorry! This rule does not exist.</AlertWarning>;\n }\n\n if (isEditable === false) {\n return <AlertWarning title=\"Cannot edit rule\">Sorry! You do not have permission to edit this rule.</AlertWarning>;\n }\n\n return <AlertRuleForm existing={result} />;\n};\n\ntype RuleEditorProps = GrafanaRouteComponentProps<{ id?: string }>;\n\nconst RuleEditor: FC<RuleEditorProps> = ({ match }) => {\n const dispatch = useDispatch();\n const { id } = match.params;\n const identifier = ruleId.tryParse(id, true);\n\n const { loading } = useAsync(async () => {\n await dispatch(fetchAllPromBuildInfoAction());\n }, [dispatch]);\n\n const { canCreateGrafanaRules, canCreateCloudRules, canEditRules } = useRulesAccess();\n\n if (!identifier && !canCreateGrafanaRules && !canCreateCloudRules) {\n return <AlertWarning title=\"Cannot create rules\">Sorry! You are not allowed to create rules.</AlertWarning>;\n }\n\n if (identifier && !canEditRules(identifier.ruleSourceName)) {\n return <AlertWarning title=\"Cannot edit rules\">Sorry! You are not allowed to edit rules.</AlertWarning>;\n }\n\n if (loading) {\n return (\n <Page.Contents>\n <LoadingPlaceholder text=\"Loading...\" />\n </Page.Contents>\n );\n }\n\n if (identifier) {\n return <ExistingRuleEditor key={id} identifier={identifier} />;\n }\n\n return <AlertRuleForm />;\n};\n\nconst AlertWarning: FC<{ title: string }> = ({ title, children }) => (\n <Alert className={useStyles2(warningStyles).warning} severity=\"warning\" title={title}>\n <p>{children}</p>\n <LinkButton href=\"alerting/list\">To rule list</LinkButton>\n </Alert>\n);\n\nconst warningStyles = (theme: GrafanaTheme2) => ({\n warning: css`\n margin: ${theme.spacing(4)};\n `,\n});\n\nexport default withErrorBoundary(RuleEditor, { style: 'page' });\n","import React, { useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { config } from '@grafana/runtime';\nimport { RadioButtonGroup } from '@grafana/ui';\n\nimport { STAT, TABLE, TIMESERIES } from '../utils/constants';\n\nexport type SupportedPanelPlugins = 'timeseries' | 'table' | 'stat';\n\ntype Props = {\n value: SupportedPanelPlugins;\n onChange: (value: SupportedPanelPlugins) => void;\n size?: 'sm' | 'md';\n};\n\nexport function PanelPluginsButtonGroup(props: Props): JSX.Element | null {\n const { value, onChange, size = 'md' } = props;\n const panels = useMemo(() => getSupportedPanels(), []);\n\n return <RadioButtonGroup options={panels} value={value} onChange={onChange} size={size} />;\n}\n\nfunction getSupportedPanels(): Array<SelectableValue<SupportedPanelPlugins>> {\n return Object.values(config.panels).reduce((panels: Array<SelectableValue<SupportedPanelPlugins>>, panel) => {\n if (isSupportedPanelPlugin(panel.id)) {\n panels.push({\n value: panel.id,\n label: panel.name,\n imgUrl: panel.info.logos.small,\n });\n }\n return panels;\n }, []);\n}\n\nfunction isSupportedPanelPlugin(id: string): id is SupportedPanelPlugins {\n switch (id) {\n case TIMESERIES:\n case TABLE:\n case STAT:\n return true;\n default:\n return false;\n }\n}\n","import React, { FC, useMemo } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\n\nimport { Annotation, annotationLabels } from '../../utils/constants';\n\nimport { SelectWithAdd } from './SelectWIthAdd';\n\ninterface Props {\n onChange: (value: string) => void;\n existingKeys: string[];\n\n value?: string;\n width?: number;\n className?: string;\n 'aria-label'?: string;\n}\n\nexport const AnnotationKeyInput: FC<Props> = ({ value, existingKeys, 'aria-label': ariaLabel, ...rest }) => {\n const annotationOptions = useMemo(\n (): SelectableValue[] =>\n Object.values(Annotation)\n .filter((key) => !existingKeys.includes(key)) // remove keys already taken in other annotations\n .map((key) => ({ value: key, label: annotationLabels[key] })),\n [existingKeys]\n );\n\n return (\n <SelectWithAdd\n aria-label={ariaLabel}\n value={value}\n options={annotationOptions}\n custom={!!value && !(Object.values(Annotation) as string[]).includes(value)}\n {...rest}\n />\n );\n};\n","import { css, cx } from '@emotion/css';\nimport React, { FC, useCallback } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { Button, Field, FieldArray, Input, InputControl, Label, TextArea, useStyles } from '@grafana/ui';\n\nimport { RuleFormValues } from '../../types/rule-form';\n\nimport { AnnotationKeyInput } from './AnnotationKeyInput';\n\nconst AnnotationsField: FC = () => {\n const styles = useStyles(getStyles);\n const {\n control,\n register,\n watch,\n formState: { errors },\n } = useFormContext();\n const annotations = watch('annotations') as RuleFormValues['annotations'];\n\n const existingKeys = useCallback(\n (index: number): string[] => annotations.filter((_, idx: number) => idx !== index).map(({ key }) => key),\n [annotations]\n );\n\n return (\n <>\n <Label>Summary and annotations</Label>\n <FieldArray name={'annotations'} control={control}>\n {({ fields, append, remove }) => {\n return (\n <div className={styles.flexColumn}>\n {fields.map((field, index) => {\n const isUrl = annotations[index]?.key?.toLocaleLowerCase().endsWith('url');\n const ValueInputComponent = isUrl ? Input : TextArea;\n return (\n <div key={field.id} className={styles.flexRow}>\n <Field\n className={styles.field}\n invalid={!!errors.annotations?.[index]?.key?.message}\n error={errors.annotations?.[index]?.key?.message}\n data-testid={`annotation-key-${index}`}\n >\n <InputControl\n name={`annotations[${index}].key`}\n render={({ field: { ref, ...field } }) => (\n <AnnotationKeyInput\n {...field}\n aria-label={`Annotation detail ${index + 1}`}\n existingKeys={existingKeys(index)}\n width={18}\n />\n )}\n control={control}\n rules={{ required: { value: !!annotations[index]?.value, message: 'Required.' } }}\n />\n </Field>\n <Field\n className={cx(styles.flexRowItemMargin, styles.field)}\n invalid={!!errors.annotations?.[index]?.value?.message}\n error={errors.annotations?.[index]?.value?.message}\n >\n <ValueInputComponent\n data-testid={`annotation-value-${index}`}\n className={cx(styles.annotationValueInput, { [styles.textarea]: !isUrl })}\n {...register(`annotations[${index}].value`)}\n placeholder={isUrl ? 'https://' : `Text`}\n defaultValue={field.value}\n />\n </Field>\n <Button\n type=\"button\"\n className={styles.flexRowItemMargin}\n aria-label=\"delete annotation\"\n icon=\"trash-alt\"\n variant=\"secondary\"\n onClick={() => remove(index)}\n />\n </div>\n );\n })}\n <Button\n className={styles.addAnnotationsButton}\n icon=\"plus-circle\"\n type=\"button\"\n variant=\"secondary\"\n onClick={() => {\n append({ key: '', value: '' });\n }}\n >\n Add info\n </Button>\n </div>\n );\n }}\n </FieldArray>\n </>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme) => ({\n annotationValueInput: css`\n width: 426px;\n `,\n textarea: css`\n height: 76px;\n `,\n addAnnotationsButton: css`\n flex-grow: 0;\n align-self: flex-start;\n margin-left: 148px;\n `,\n flexColumn: css`\n display: flex;\n flex-direction: column;\n `,\n field: css`\n margin-bottom: ${theme.spacing.xs};\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n `,\n flexRowItemMargin: css`\n margin-left: ${theme.spacing.xs};\n `,\n});\n\nexport default AnnotationsField;\n","import { css, cx } from '@emotion/css';\nimport React, { FC } from 'react';\nimport { useFormContext } from 'react-hook-form';\n\nimport { GrafanaTheme } from '@grafana/data';\nimport { Button, Field, FieldArray, Input, InlineLabel, Label, useStyles } from '@grafana/ui';\n\ninterface Props {\n className?: string;\n}\n\nconst LabelsField: FC<Props> = ({ className }) => {\n const styles = useStyles(getStyles);\n const {\n register,\n control,\n watch,\n formState: { errors },\n } = useFormContext();\n const labels = watch('labels');\n return (\n <div className={cx(className, styles.wrapper)}>\n <Label>Custom Labels</Label>\n <FieldArray control={control} name=\"labels\">\n {({ fields, append, remove }) => {\n return (\n <>\n <div className={styles.flexRow}>\n <InlineLabel width={18}>Labels</InlineLabel>\n <div className={styles.flexColumn}>\n {fields.map((field, index) => {\n return (\n <div key={field.id}>\n <div className={cx(styles.flexRow, styles.centerAlignRow)}>\n <Field\n className={styles.labelInput}\n invalid={!!errors.labels?.[index]?.key?.message}\n error={errors.labels?.[index]?.key?.message}\n >\n <Input\n {...register(`labels[${index}].key`, {\n required: { value: !!labels[index]?.value, message: 'Required.' },\n })}\n placeholder=\"key\"\n data-testid={`label-key-${index}`}\n defaultValue={field.key}\n />\n </Field>\n <InlineLabel className={styles.equalSign}>=</InlineLabel>\n <Field\n className={styles.labelInput}\n invalid={!!errors.labels?.[index]?.value?.message}\n error={errors.labels?.[index]?.value?.message}\n >\n <Input\n {...register(`labels[${index}].value`, {\n required: { value: !!labels[index]?.key, message: 'Required.' },\n })}\n placeholder=\"value\"\n data-testid={`label-value-${index}`}\n defaultValue={field.value}\n />\n </Field>\n <Button\n className={styles.deleteLabelButton}\n aria-label=\"delete label\"\n icon=\"trash-alt\"\n variant=\"secondary\"\n onClick={() => {\n remove(index);\n }}\n />\n </div>\n </div>\n );\n })}\n <Button\n className={styles.addLabelButton}\n icon=\"plus-circle\"\n type=\"button\"\n variant=\"secondary\"\n onClick={() => {\n append({});\n }}\n >\n Add label\n </Button>\n </div>\n </div>\n </>\n );\n }}\n </FieldArray>\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme) => {\n return {\n wrapper: css`\n margin-bottom: ${theme.spacing.xl};\n `,\n flexColumn: css`\n display: flex;\n flex-direction: column;\n `,\n flexRow: css`\n display: flex;\n flex-direction: row;\n justify-content: flex-start;\n\n & + button {\n margin-left: ${theme.spacing.xs};\n }\n `,\n deleteLabelButton: css`\n margin-left: ${theme.spacing.xs};\n align-self: flex-start;\n `,\n addLabelButton: css`\n flex-grow: 0;\n align-self: flex-start;\n `,\n centerAlignRow: css`\n align-items: baseline;\n `,\n equalSign: css`\n align-self: flex-start;\n width: 28px;\n justify-content: center;\n margin-left: ${theme.spacing.xs};\n `,\n labelInput: css`\n width: 175px;\n margin-bottom: ${theme.spacing.sm};\n & + & {\n margin-left: ${theme.spacing.sm};\n }\n `,\n };\n};\n\nexport default LabelsField;\n","import React, { FC, useEffect, useMemo, useState } from 'react';\n\nimport { SelectableValue } from '@grafana/data';\nimport { Input, Select } from '@grafana/ui';\n\ninterface Props {\n onChange: (value: string) => void;\n options: Array<SelectableValue<string>>;\n value?: string;\n addLabel?: string;\n className?: string;\n placeholder?: string;\n custom?: boolean;\n onCustomChange?: (custom: boolean) => void;\n width?: number;\n disabled?: boolean;\n 'aria-label'?: string;\n}\n\nexport const SelectWithAdd: FC<Props> = ({\n value,\n onChange,\n options,\n className,\n placeholder,\n width,\n custom,\n onCustomChange,\n disabled = false,\n addLabel = '+ Add new',\n 'aria-label': ariaLabel,\n}) => {\n const [isCustom, setIsCustom] = useState(custom);\n\n useEffect(() => {\n if (custom) {\n setIsCustom(custom);\n }\n }, [custom]);\n\n const _options = useMemo(\n (): Array<SelectableValue<string>> => [...options, { value: '__add__', label: addLabel }],\n [options, addLabel]\n );\n\n if (isCustom) {\n return (\n <Input\n aria-label={ariaLabel}\n width={width}\n autoFocus={!custom}\n value={value || ''}\n placeholder={placeholder}\n className={className}\n disabled={disabled}\n onChange={(e) => onChange((e.target as HTMLInputElement).value)}\n />\n );\n } else {\n return (\n <Select\n aria-label={ariaLabel}\n width={width}\n options={_options}\n value={value}\n className={className}\n placeholder={placeholder}\n disabled={disabled}\n onChange={(val: SelectableValue) => {\n const value = val?.value;\n if (value === '__add__') {\n setIsCustom(true);\n if (onCustomChange) {\n onCustomChange(true);\n }\n onChange('');\n } else {\n onChange(value);\n }\n }}\n />\n );\n }\n};\n","import { useMemo } from 'react';\n\nimport { getDataSourceSrv } from '@grafana/runtime';\nimport { AlertQuery } from 'app/types/unified-alerting-dto';\n\nexport function useAlertQueriesStatus(queries: AlertQuery[]) {\n const allDataSourcesAvailable = useMemo(\n () => queries.every((query) => Boolean(getDataSourceSrv().getInstanceSettings(query.datasourceUid))),\n [queries]\n );\n\n return { allDataSourcesAvailable };\n}\n","import { useEffect } from 'react';\nimport { useDispatch } from 'react-redux';\n\nimport { FolderDTO } from 'app/types';\n\nimport { fetchFolderIfNotFetchedAction } from '../state/actions';\nimport { initialAsyncRequestState } from '../utils/redux';\n\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\ninterface ReturnBag {\n folder?: FolderDTO;\n loading: boolean;\n}\n\nexport function useFolder(uid?: string): ReturnBag {\n const dispatch = useDispatch();\n const folderRequests = useUnifiedAlertingSelector((state) => state.folders);\n useEffect(() => {\n if (uid) {\n dispatch(fetchFolderIfNotFetchedAction(uid));\n }\n }, [dispatch, uid]);\n\n if (uid) {\n const request = folderRequests[uid] || initialAsyncRequestState;\n return {\n folder: request.result,\n loading: request.loading,\n };\n }\n return {\n loading: false,\n };\n}\n","import { contextSrv } from 'app/core/services/context_srv';\nimport { RulerRuleDTO } from 'app/types/unified-alerting-dto';\n\nimport { getRulesPermissions } from '../utils/access-control';\nimport { isGrafanaRulerRule } from '../utils/rules';\n\nimport { useFolder } from './useFolder';\nimport { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector';\n\ninterface ResultBag {\n isEditable?: boolean;\n isRemovable?: boolean;\n loading: boolean;\n}\n\nexport function useIsRuleEditable(rulesSourceName: string, rule?: RulerRuleDTO): ResultBag {\n const dataSources = useUnifiedAlertingSelector((state) => state.dataSources);\n const folderUID = rule && isGrafanaRulerRule(rule) ? rule.grafana_alert.namespace_uid : undefined;\n\n const rulePermission = getRulesPermissions(rulesSourceName);\n\n const { folder, loading } = useFolder(folderUID);\n\n if (!rule) {\n return { isEditable: false, isRemovable: false, loading: false };\n }\n\n // Grafana rules can be edited if user can edit the folder they're in\n // When RBAC is disabled access to a folder is the only requirement for managing rules\n // When RBAC is enabled the appropriate alerting permissions need to be met\n if (isGrafanaRulerRule(rule)) {\n if (!folderUID) {\n throw new Error(\n `Rule ${rule.grafana_alert.title} does not have a folder uid, cannot determine if it is editable.`\n );\n }\n\n const canEditGrafanaRules = contextSrv.hasAccess(rulePermission.update, folder?.canSave ?? false);\n const canRemoveGrafanaRules = contextSrv.hasAccess(rulePermission.delete, folder?.canSave ?? false);\n\n return {\n isEditable: canEditGrafanaRules,\n isRemovable: canRemoveGrafanaRules,\n loading,\n };\n }\n\n // prom rules are only editable by users with Editor role and only if rules source supports editing\n const isRulerAvailable = Boolean(dataSources[rulesSourceName]?.result?.rulerConfig);\n const canEditCloudRules = contextSrv.hasAccess(rulePermission.update, contextSrv.isEditor);\n const canRemoveCloudRules = contextSrv.hasAccess(rulePermission.delete, contextSrv.isEditor);\n\n return {\n isEditable: canEditCloudRules && isRulerAvailable,\n isRemovable: canRemoveCloudRules && isRulerAvailable,\n loading: dataSources[rulesSourceName]?.loading,\n };\n}\n","import { RelativeTimeRange } from '@grafana/data';\nimport { AlertQuery } from 'app/types/unified-alerting-dto';\n\nimport { ExpressionQuery, ExpressionQueryType } from '../../../expressions/types';\n\nconst FALL_BACK_TIME_RANGE = { from: 21600, to: 0 };\n\nexport const getTimeRangeForExpression = (query: ExpressionQuery, queries: AlertQuery[]): RelativeTimeRange => {\n const referencedRefIds: string[] | undefined = getReferencedIds(query, queries);\n\n if (!referencedRefIds) {\n return FALL_BACK_TIME_RANGE;\n }\n\n const { from, to } = getTimeRanges(referencedRefIds, queries);\n\n if (!from.length && !to.length) {\n return FALL_BACK_TIME_RANGE;\n }\n\n return {\n from: Math.max(...from),\n to: Math.min(...to),\n };\n};\n\nconst getReferencedIds = (model: ExpressionQuery, queries: AlertQuery[]): string[] | undefined => {\n switch (model.type) {\n case ExpressionQueryType.classic:\n return getReferencedIdsForClassicCondition(model);\n case ExpressionQueryType.math:\n return getReferencedIdsForMath(model, queries);\n case ExpressionQueryType.resample:\n case ExpressionQueryType.reduce:\n return getReferencedIdsForReduce(model);\n }\n};\n\nconst getReferencedIdsForClassicCondition = (model: ExpressionQuery) => {\n return model.conditions?.map((condition) => {\n return condition.query.params[0];\n });\n};\n\nconst getTimeRanges = (referencedRefIds: string[], queries: AlertQuery[]) => {\n let from: number[] = [];\n let to = [FALL_BACK_TIME_RANGE.to];\n for (const referencedRefIdsKey of referencedRefIds) {\n const query = queries.find((query) => query.refId === referencedRefIdsKey);\n\n if (!query || !query.relativeTimeRange) {\n continue;\n }\n from.push(query.relativeTimeRange.from);\n to.push(query.relativeTimeRange.to);\n }\n\n return {\n from,\n to,\n };\n};\n\nconst getReferencedIdsForMath = (model: ExpressionQuery, queries: AlertQuery[]) => {\n return (\n queries\n // filter queries of type query and filter expression on if it includes any refIds\n .filter((q) => q.queryType === 'query' && model.expression?.includes(q.refId))\n .map((q) => {\n return q.refId;\n })\n );\n};\n\nconst getReferencedIdsForReduce = (model: ExpressionQuery) => {\n return model.expression ? [model.expression] : undefined;\n};\n","import { Observable, of, OperatorFunction, ReplaySubject, Unsubscribable } from 'rxjs';\nimport { catchError, map, share } from 'rxjs/operators';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport {\n dataFrameFromJSON,\n DataFrameJSON,\n getDefaultTimeRange,\n LoadingState,\n PanelData,\n rangeUtil,\n TimeRange,\n withLoadingIndicator,\n} from '@grafana/data';\nimport { FetchResponse, getDataSourceSrv, toDataQueryError } from '@grafana/runtime';\nimport { BackendSrv, getBackendSrv } from 'app/core/services/backend_srv';\nimport { isExpressionQuery } from 'app/features/expressions/guards';\nimport { cancelNetworkRequestsOnUnsubscribe } from 'app/features/query/state/processing/canceler';\nimport { setStructureRevision } from 'app/features/query/state/processing/revision';\nimport { preProcessPanelData } from 'app/features/query/state/runRequest';\nimport { AlertQuery } from 'app/types/unified-alerting-dto';\n\nimport { getTimeRangeForExpression } from '../utils/timeRange';\n\nexport interface AlertingQueryResult {\n frames: DataFrameJSON[];\n}\n\nexport interface AlertingQueryResponse {\n results: Record<string, AlertingQueryResult>;\n}\nexport class AlertingQueryRunner {\n private subject: ReplaySubject<Record<string, PanelData>>;\n private subscription?: Unsubscribable;\n private lastResult: Record<string, PanelData>;\n\n constructor(private backendSrv = getBackendSrv(), private dataSourceSrv = getDataSourceSrv()) {\n this.subject = new ReplaySubject(1);\n this.lastResult = {};\n }\n\n get(): Observable<Record<string, PanelData>> {\n return this.subject.asObservable();\n }\n\n async run(queries: AlertQuery[]) {\n if (queries.length === 0) {\n const empty = initialState(queries, LoadingState.Done);\n return this.subject.next(empty);\n }\n\n // do not execute if one more of the queries are not runnable,\n // for example not completely configured\n for (const query of queries) {\n if (!isExpressionQuery(query.model)) {\n const ds = await this.dataSourceSrv.get(query.datasourceUid);\n if (ds.filterQuery && !ds.filterQuery(query.model)) {\n const empty = initialState(queries, LoadingState.Done);\n return this.subject.next(empty);\n }\n }\n }\n\n this.subscription = runRequest(this.backendSrv, queries).subscribe({\n next: (dataPerQuery) => {\n const nextResult = applyChange(dataPerQuery, (refId, data) => {\n const previous = this.lastResult[refId];\n const preProcessed = preProcessPanelData(data, previous);\n return setStructureRevision(preProcessed, previous);\n });\n\n this.lastResult = nextResult;\n this.subject.next(this.lastResult);\n },\n\n error: (error: Error) => {\n this.lastResult = mapErrorToPanelData(this.lastResult, error);\n this.subject.next(this.lastResult);\n },\n });\n }\n\n cancel() {\n if (!this.subscription) {\n return;\n }\n this.subscription.unsubscribe();\n\n let requestIsRunning = false;\n\n const nextResult = applyChange(this.lastResult, (refId, data) => {\n if (data.state === LoadingState.Loading) {\n requestIsRunning = true;\n }\n\n return {\n ...data,\n state: LoadingState.Done,\n };\n });\n\n if (requestIsRunning) {\n this.subject.next(nextResult);\n }\n }\n\n destroy() {\n if (this.subject) {\n this.subject.complete();\n }\n\n this.cancel();\n }\n}\n\nconst runRequest = (backendSrv: BackendSrv, queries: AlertQuery[]): Observable<Record<string, PanelData>> => {\n const initial = initialState(queries, LoadingState.Loading);\n const request = {\n data: { data: queries },\n url: '/api/v1/eval',\n method: 'POST',\n requestId: uuidv4(),\n };\n\n return withLoadingIndicator({\n whileLoading: initial,\n source: backendSrv.fetch<AlertingQueryResponse>(request).pipe(\n mapToPanelData(initial),\n catchError((error) => of(mapErrorToPanelData(initial, error))),\n cancelNetworkRequestsOnUnsubscribe(backendSrv, request.requestId),\n share()\n ),\n });\n};\n\nconst initialState = (queries: AlertQuery[], state: LoadingState): Record<string, PanelData> => {\n return queries.reduce((dataByQuery: Record<string, PanelData>, query) => {\n dataByQuery[query.refId] = {\n state,\n series: [],\n timeRange: getTimeRange(query, queries),\n };\n\n return dataByQuery;\n }, {});\n};\n\nconst getTimeRange = (query: AlertQuery, queries: AlertQuery[]): TimeRange => {\n if (isExpressionQuery(query.model)) {\n const relative = getTimeRangeForExpression(query.model, queries);\n return rangeUtil.relativeToTimeRange(relative);\n }\n\n if (!query.relativeTimeRange) {\n console.warn(`Query with refId: ${query.refId} did not have any relative time range, using default.`);\n return getDefaultTimeRange();\n }\n\n return rangeUtil.relativeToTimeRange(query.relativeTimeRange);\n};\n\nconst mapToPanelData = (\n dataByQuery: Record<string, PanelData>\n): OperatorFunction<FetchResponse<AlertingQueryResponse>, Record<string, PanelData>> => {\n return map((response) => {\n const { data } = response;\n const results: Record<string, PanelData> = {};\n\n for (const [refId, result] of Object.entries(data.results)) {\n results[refId] = {\n timeRange: dataByQuery[refId].timeRange,\n state: LoadingState.Done,\n series: result.frames.map(dataFrameFromJSON),\n };\n }\n\n return results;\n });\n};\n\nconst mapErrorToPanelData = (lastResult: Record<string, PanelData>, error: Error): Record<string, PanelData> => {\n const queryError = toDataQueryError(error);\n\n return applyChange(lastResult, (refId, data) => {\n return {\n ...data,\n state: LoadingState.Error,\n error: queryError,\n };\n });\n};\n\nconst applyChange = (\n initial: Record<string, PanelData>,\n change: (refId: string, data: PanelData) => PanelData\n): Record<string, PanelData> => {\n const nextResult: Record<string, PanelData> = {};\n\n for (const [refId, data] of Object.entries(initial)) {\n nextResult[refId] = change(refId, data);\n }\n\n return nextResult;\n};\n","import { useMemo } from 'react';\n\nimport { getRulesAccess } from './access-control';\n\nexport function useRulesAccess() {\n return useMemo(() => getRulesAccess(), []);\n}\n","import { DataQuery } from '@grafana/data';\nimport { isExpressionReference } from '@grafana/runtime/src/utils/DataSourceWithBackend';\n\nimport { ExpressionQuery, ExpressionQueryType } from './types';\n\nexport const isExpressionQuery = (dataQuery?: DataQuery): dataQuery is ExpressionQuery => {\n if (!dataQuery) {\n return false;\n }\n\n if (isExpressionReference(dataQuery.datasource)) {\n return true;\n }\n\n const expression = dataQuery as ExpressionQuery;\n\n if (typeof expression.type !== 'string') {\n return false;\n }\n return Object.values(ExpressionQueryType).includes(expression.type);\n};\n"],"names":["useCleanup","stateSelector","dispatch","useDispatch","selectorRef","useRef","current","useEffect","cleanUpAction","previewAlertRule","request","isCloudPreviewRequest","Error","previewCloudAlertRule","isGrafanaPreviewRequest","type","RuleFormType","withLoadingIndicator","whileLoading","createResponse","source","getBackendSrv","fetch","method","url","data","pipe","map","state","LoadingState","series","instances","dataFrameFromJSON","catchError","error","of","toDataQueryError","share","previewGrafanaAlertRule","ruleType","timeRange","getDefaultTimeRange","PreviewRuleResult","props","preview","styles","useStyles2","getStyles","fieldConfig","defaults","overrides","matcher","id","FieldMatcherID","options","properties","value","TableCellDisplayMode","className","container","messageFromError","table","width","height","style","PanelRenderer","title","pluginId","theme","css","spacing","colors","border","medium","shape","borderRadius","fields","PreviewRule","onPreview","setPreview","useState","getValues","useFormContext","isMounted","useMountedState","useCallback","values","dataSourceName","condition","queries","expression","expr","grafana_condition","now","dateTimeFormatISO","Date","createPreviewRequest","takeWhile","response","isCompleted","subscribe","usePreview","watch","allDataSourcesAvailable","useAlertQueriesStatus","isPreviewAvailable","Boolean","HorizontalGroup","Button","disabled","variant","onClick","Alert","severity","breakpoints","xxl","RuleEditorSection","stepNo","children","description","parent","content","FieldSet","label","fieldset","xl","text","secondary","maxContrast","background","canvas","typography","size","lg","CloudEvaluationBehavior","useStyles","register","control","formState","errors","Field","flexRow","invalid","forTime","message","inlineField","Input","pattern","InputControl","name","render","field","onChange","Select","timeOptions","timeUnit","xs","updateMathExpressionRefs","previousRefId","newRefId","oldExpression","RegExp","newExpression","replace","checkForPathSeparator","includes","GroupAndNamespaceFields","rulesSourceName","setValue","getStyle","customGroup","setCustomGroup","rulerRequests","useUnifiedAlertingSelector","rulerRules","fetchRulerRulesAction","rulesConfig","result","namespace","namespaceOptions","useMemo","Object","keys","groupOptions","group","input","onCustomChange","custom","rules","required","validate","pathSeparator","RuleFolderPicker","folderPermissions","FolderPicker","showRoot","allowEmpty","initialTitle","initialFolderId","accessControlMetadata","permissionLevel","PermissionLevelString","recordingRuleNameValidationPattern","DetailsStep","initialFolder","ruleFormType","folderFilter","useRuleFolderFilter","formInput","undefined","classNames","alignBaseline","Label","htmlFor","Stack","gap","Tooltip","placement","Icon","folder","inputId","enableCreateNew","contextSrv","AccessControlAction","enableReset","filter","AnnotationsField","existingRuleForm","isSearchHitAvailable","hit","rbacDisabledFallback","canCreateRuleInFolder","canUpdateInCurrentFolder","folderId","folderHits","GrafanaAlertStateDecision","GrafanaAlertStatePicker","includeNoData","includeError","opts","opt","GrafanaConditionEvalWarning","evaluateFor","evaluateEvery","durationFor","parseDuration","durationEvery","isEmpty","millisFor","durationToMilliseconds","millisEvery","forValidationOptions","durationValidationPattern","evaluateEveryValidationOptions","positiveDurationValidationPattern","duration","length","diff","MIN_TIME_RANGE_STEP_S","GrafanaEvaluationBehavior","showErrorHandling","setShowErrorHandling","evaluateEveryId","evaluateForId","InlineLabel","tooltip","validationMessageHorizontalOverflow","CollapseToggle","isCollapsed","onToggle","collapsed","collapseToggle","NotificationsStep","hideFlowChart","setHideFlowChart","useTheme2","hideButton","contentWrapper","flowChart","src","toLowerCase","alt","display","flexDirection","LabelsField","Card","card","Link","href","isNothing","subject","common","isObject","toArray","sequence","Array","isArray","repeat","string","count","cycle","isNegativeZero","number","Number","NEGATIVE_INFINITY","extend","target","index","key","sourceKeys","formatError","exception","compact","where","reason","mark","line","column","snippet","YAMLException$1","call","this","captureStackTrace","constructor","stack","prototype","create","toString","getLine","buffer","lineStart","lineEnd","position","maxLineLength","head","tail","maxHalfLength","Math","floor","str","slice","pos","padStart","max","maxLength","indent","linesBefore","linesAfter","match","re","lineStarts","lineEnds","foundLineNo","exec","push","i","lineNoLength","min","TYPE_CONSTRUCTOR_OPTIONS","YAML_NODE_KINDS","tag","forEach","indexOf","kind","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","multi","styleAliases","alias","String","compileStyleAliases","compileList","schema","currentType","newIndex","previousType","previousIndex","Schema$1","definition","implicit","explicit","concat","type$1","loadKind","compiledImplicit","compiledExplicit","compiledTypeMap","scalar","mapping","fallback","collectType","arguments","compileMap","seq","failsafe","_null","object","canonical","lowercase","uppercase","camelcase","empty","bool","isOctCode","c","isDecCode","ch","hasDigits","charCodeAt","sign","parseInt","binary","obj","octal","decimal","hexadecimal","toUpperCase","YAML_FLOAT_PATTERN","SCIENTIFIC_WITHOUT_DOT","test","POSITIVE_INFINITY","NaN","parseFloat","res","isNaN","json","core","YAML_DATE_REGEXP","YAML_TIMESTAMP_REGEXP","timestamp","year","month","day","hour","minute","second","date","fraction","delta","UTC","setTime","getTime","toISOString","merge","BASE64_MAP","code","idx","bitlen","charAt","tailbits","bits","Uint8Array","_hasOwnProperty$3","hasOwnProperty","_toString$2","omap","pair","pairKey","pairHasKey","objectKeys","_toString$1","pairs","_hasOwnProperty$2","set","_default","_hasOwnProperty$1","PATTERN_NON_PRINTABLE","PATTERN_NON_ASCII_LINE_BREAKS","PATTERN_FLOW_INDICATORS","PATTERN_TAG_HANDLE","PATTERN_TAG_URI","_class","is_EOL","is_WHITE_SPACE","is_WS_OR_EOL","is_FLOW_INDICATOR","fromHexCode","lc","simpleEscapeSequence","charFromCodepoint","fromCharCode","simpleEscapeCheck","simpleEscapeMap","State$1","filename","onWarning","legacy","listener","implicitTypes","typeMap","lineIndent","firstTabInLine","documents","generateError","throwError","throwWarning","directiveHandlers","YAML","args","major","minor","version","checkLineBreaks","TAG","handle","prefix","tagMap","decodeURIComponent","err","captureSegment","start","end","checkJson","_position","_length","_character","_result","mergeMappings","destination","overridableKeys","quantity","storeMappingPair","keyTag","keyNode","valueNode","startLine","startLineStart","startPos","defineProperty","configurable","enumerable","writable","readLineBreak","skipSeparationSpace","allowComments","checkIndent","lineBreaks","testDocumentSeparator","writeFoldedLines","readBlockSequence","nodeIndent","_line","_tag","_anchor","anchor","detected","anchorMap","composeNode","readTagProperty","tagHandle","tagName","isVerbatim","isNamed","readAnchorProperty","parentIndent","nodeContext","allowToSeek","allowCompact","allowBlockStyles","allowBlockScalars","allowBlockCollections","typeIndex","typeQuantity","typeList","flowIndent","blockIndent","indentStatus","atNewLine","hasContent","following","_keyLine","_keyLineStart","_keyPos","atExplicitKey","readBlockMapping","_lineStart","_pos","terminator","isPair","isExplicitPair","isMapping","readNext","readFlowCollection","captureStart","folding","tmp","chomping","didReadContent","detectedIndent","textIndent","emptyLines","atMoreIndented","readBlockScalar","captureEnd","readSingleQuotedScalar","hexLength","hexResult","readDoubleQuotedScalar","readAlias","withinFlowCollection","hasPendingContent","_lineIndent","_kind","readPlainScalar","readDocument","directiveName","directiveArgs","documentStart","hasDirectives","loadDocuments","nullpos","loadAll_1","iterator","load_1","loader","loadAll","load","_toString","_hasOwnProperty","CHAR_BOM","ESCAPE_SEQUENCES","DEPRECATED_BOOLEANS_SYNTAX","DEPRECATED_BASE60_SYNTAX","encodeHex","character","State","noArrayIndent","skipInvalid","flowLevel","styleMap","compileStyleMap","sortKeys","lineWidth","noRefs","noCompatMode","condenseFlow","quotingType","forceQuotes","replacer","explicitTypes","duplicates","usedDuplicates","indentString","spaces","ind","next","generateNextLine","level","isWhitespace","isPrintable","isNsCharOrWhitespace","isPlainSafe","prev","inblock","cIsNsCharOrWhitespace","cIsNsChar","codePointAt","first","needIndentIndicator","chooseScalarStyle","singleLineOnly","indentPerLevel","testAmbiguousType","char","prevChar","hasLineBreak","hasFoldableLine","shouldTrackWidth","previousLineBreak","plain","isPlainSafeLast","writeScalar","iskey","dump","testImplicitResolving","blockHeader","dropEndingNewline","moreIndented","lineRe","nextLF","lastIndex","foldLine","prevMoreIndented","foldString","escapeSeq","escapeString","indentIndicator","clip","breakRe","curr","writeBlockSequence","writeNode","detectType","block","isblockseq","tagStr","duplicateIndex","duplicate","objectOrArray","objectKey","objectValue","explicitPair","pairBuffer","objectKeyList","sort","writeBlockMapping","writeFlowMapping","writeFlowSequence","encodeURI","getDuplicateReferences","objects","duplicatesIndexes","inspectNode","dump_1","renamed","from","to","tabs","RuleInspector","onClose","activeTab","setActiveTab","drawerStyles","Drawer","subtitle","RuleInspectorSubtitle","InspectorYamlTab","onSubmit","formValues","TabsBar","tab","Tab","onChangeTab","active","yamlTabStyle","alertRuleAsYaml","setAlertRuleAsYaml","applyButton","disableWidth","CodeEditor","language","onBlur","monacoOptions","minimap","enabled","ConditionField","existing","expressions","query","datasourceUid","ExpressionDatasourceUID","q","refId","lastExpression","last","shouldValidate","conditionExists","find","RadioButtonList","sm","useRulesSourcesWithRuler","dataSources","ds","rulerConfig","getDataSourceByName","dsConfig","CloudRulesSourcePicker","rulesSourcesWithRuler","dataSourceFilter","DataSourcePicker","noDefault","alerting","RuleType","image","selected","cardStyles","cx","wrapper","isSelected","GrafanaManagedRuleType","DisabledTooltip","visible","MimirFlavoredType","RecordingRuleType","RuleTypePicker","enabledTypes","hasLotexDatasources","direction","meta","AlertType","editingExistingRule","enabledRuleTypes","defaultRuleType","canCreateGrafanaRules","canCreateCloudRules","getAvailableRuleTypes","ExpressionEditor","mapToValue","mapToQuery","settings","getDataSourceSrv","getInstanceSettings","useQueryMappers","setQuery","hide","loading","dataSource","useAsync","get","onChangeQuery","components","QueryEditor","errorMessage","app","CoreApp","onRunQuery","noop","datasource","VizWrapper","currentPanel","changePanel","onThresholdsChange","thresholds","setOptions","frameIndex","showHeader","vizHeight","TIMESERIES","STAT","dataIsEmpty","rowHeight","gridSize","tableHeight","useVizHeight","setFieldConfig","unit","defaultUnit","thresholdsStyle","mode","GraphTresholdsStyleMode","defaultFieldConfig","context","eventBus","appEvents","canEditThresholds","buttonGroup","PanelPluginsButtonGroup","PanelContextProvider","onOptionsChange","visHeight","config","QueryWrapper","dsSettings","onChangeDataSource","onChangeTimeRange","onRunQueries","onRemoveQuery","onDuplicateQuery","onChangeThreshold","isExpression","isExpressionQuery","model","changePluginId","TABLE","QueryEditorRow","cloneDeep","onAddQuery","renderHeaderExtras","RelativeTimeRangePicker","relativeTimeRange","getDefaultRelativeTimeRange","range","renderTimePicker","visualization","hideDisableQuery","EmptyQueryWrapper","QueryRows","PureComponent","super","onQueriesChange","item","itemIndex","referencedRefId","conditions","params","conditionIndex","evaluator","steps","toPrecision","uid","omit","copyModel","isMathExpression","isReduceExpression","isResampleExpression","isClassicExpression","isReferencing","param","queriesWithUpdatedReferences","queryType","startIndex","endIndex","update","removed","splice","record","threshold","ThresholdsMode","Infinity","color","dataPerQuery","thresholdByRefId","getThresholdsForQueries","onDragEnd","droppableId","provided","ref","innerRef","droppableProps","getDataSourceSettings","DatasourceNotFound","onUpdateDatasource","defaultDataSource","getDatasourceSrv","placeholder","showDetails","setShowDetails","QueryOperationRow","draggable","isOpen","show","icon","fill","JSON","stringify","runner","run","cancel","onChangeQueries","addQuery","getDefaultOrFirstCompatibleDataSource","expressionDatasource","ExpressionQueryType","defaultCondition","panelDataByRefId","AlertingQueryRunner","componentDidMount","setState","componentWillUnmount","destroy","isRunning","d","renderRunQueryButton","onCancelQueries","noCompatibleDataSources","align","onNewAlertingQuery","selectors","onNewExpressionQuery","queryToAdd","getNextRefIdChar","defaultTimeRange","stylesFactory","primary","runWrapper","editorWrapper","Query","isGrafanaManagedType","isCloudAlertRuleType","showCloudExpressionEditor","QueryAndAlertConditionStep","AlertRuleForm","notifyApp","useAppNotification","queryParams","useQueryParams","showEditYaml","setShowEditYaml","returnTo","showDeleteModal","setShowDeleteModal","defaultValues","rulerRuleToFormValues","getDefaultFormValues","getDefaultQueries","parse","formAPI","useForm","shouldFocusError","handleSubmit","showStep2","submitState","ruleForm","saveRule","initialAsyncRequestState","unifiedAlerting","submit","exitOnSave","saveRuleFormAction","annotations","trim","labels","redirectOnSave","onInvalid","e","preventDefault","form","PageToolbar","pageIcon","isCortexLokiOrRecordingRule","Spinner","buttonSpinner","inline","contentOuter","CustomScrollbar","autoHeightMin","hideHorizontalTrack","contentInner","ConfirmModal","body","confirmText","onConfirm","identifier","ruleId","ruleSourceName","rule","deleteRuleAction","navigateTo","onDismiss","weak","ExistingRuleEditor","existingRule","dispatched","isEditable","useIsRuleEditable","fetchEditableRuleAction","Page","LoadingPlaceholder","AlertWarning","warningStyles","warning","LinkButton","withErrorBoundary","async","fetchAllPromBuildInfoAction","canEditRules","useRulesAccess","panels","reduce","panel","isSupportedPanelPlugin","imgUrl","info","logos","small","RadioButtonGroup","AnnotationKeyInput","existingKeys","ariaLabel","rest","annotationOptions","Annotation","annotationLabels","annotationValueInput","textarea","addAnnotationsButton","flexColumn","flexRowItemMargin","_","FieldArray","append","remove","isUrl","toLocaleLowerCase","endsWith","ValueInputComponent","TextArea","defaultValue","deleteLabelButton","addLabelButton","centerAlignRow","equalSign","labelInput","SelectWithAdd","addLabel","isCustom","setIsCustom","_options","autoFocus","val","every","useFolder","folderRequests","folders","fetchFolderIfNotFetchedAction","folderUID","isGrafanaRulerRule","grafana_alert","namespace_uid","rulePermission","getRulesPermissions","isRemovable","canSave","delete","isRulerAvailable","FALL_BACK_TIME_RANGE","getReferencedIds","getReferencedIdsForClassicCondition","getReferencedIdsForMath","getReferencedIdsForReduce","getTimeRanges","referencedRefIds","referencedRefIdsKey","backendSrv","dataSourceSrv","ReplaySubject","lastResult","asObservable","initialState","filterQuery","subscription","runRequest","nextResult","applyChange","previous","preProcessed","preProcessPanelData","setStructureRevision","mapErrorToPanelData","unsubscribe","requestIsRunning","complete","initial","requestId","uuidv4","mapToPanelData","cancelNetworkRequestsOnUnsubscribe","dataByQuery","getTimeRange","relative","getTimeRangeForExpression","rangeUtil","console","warn","results","entries","frames","queryError","change","getRulesAccess","dataQuery","isExpressionReference"],"sourceRoot":""}
|