"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8648],{"./public/app/core/hooks/useCleanup.ts":(e,t,a)=>{a.d(t,{x:()=>l});var n=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),r=a("./.yarn/__virtual__/react-redux-virtual-7ad20a440e/3/opt/drone/yarncache/react-redux-npm-7.2.6-134f5ed64d-0bf142ce0d.zip/node_modules/react-redux/es/index.js"),i=a("./public/app/core/actions/cleanUp.ts");function l(e){const t=(0,r.useDispatch)(),a=(0,n.useRef)(e);a.current=e,(0,n.useEffect)((()=>()=>{t((0,i.e)({stateSelector:a.current}))}),[t])}},"./public/app/features/alerting/unified/AmRoutes.tsx":(e,t,a)=>{a.r(t),a.d(t,{default:()=>Ee});var n=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),r=a("./.yarn/__virtual__/@emotion-css-virtual-72c314ddb1/3/opt/drone/yarncache/@emotion-css-npm-11.7.1-25ff8755a7-ac1f56656f.zip/node_modules/@emotion/css/dist/emotion-css.esm.js"),i=a("./packages/grafana-ui/src/index.ts"),l=a("./.yarn/__virtual__/react-redux-virtual-7ad20a440e/3/opt/drone/yarncache/react-redux-npm-7.2.6-134f5ed64d-0bf142ce0d.zip/node_modules/react-redux/es/index.js"),s=a("./.yarn/__virtual__/react-router-virtual-31642fe47a/3/opt/drone/yarncache/react-router-npm-5.2.1-ea754d7473-7daae084bf.zip/node_modules/react-router/esm/react-router.js"),o=a("./public/app/core/hooks/useCleanup.ts"),c=a("./public/app/features/alerting/unified/components/AlertingPageWrapper.tsx"),u=a("./public/app/features/alerting/unified/components/AlertManagerPicker.tsx"),d=a("./public/app/plugins/datasource/alertmanager/types.ts"),p=a("./public/app/features/alerting/unified/utils/time.ts"),m=a("../../opt/drone/yarncache/lodash-npm-4.17.21-6382451519-eb835a2e51.zip/node_modules/lodash/lodash.js"),g=a("./public/app/features/alerting/unified/utils/alertmanager.ts"),v=a("./public/app/features/alerting/unified/utils/datasource.ts");const h=["",p.qr[0].value],x=(e,t)=>Object.entries(null!=e?e:{}).reduce(((e,a)=>{let[n,r]=a;return[...e,{name:n,value:r,operator:t?d._M.regex:d._M.equal}]}),[]),f=e=>{if(!e)return h;const[t,a]=e?(0,p.bG)(e):[void 0,void 0],n=p.qr.find((e=>e.value===a));return t&&n?[String(t),n.value]:h},j=e=>e.value,b={name:"",value:"",operator:d._M.equal},y={id:"",groupBy:[],object_matchers:[],routes:[],continue:!1,receiver:"",groupWaitValue:"",groupWaitValueType:p.qr[0].value,groupIntervalValue:"",groupIntervalValueType:p.qr[0].value,repeatIntervalValue:"",repeatIntervalValueType:p.qr[0].value,muteTimeIntervals:[]},C=e=>{var t,a,n,r,i,l,s,o,c;if(!e||0===Object.keys(e).length)return[y,{}];const[u,d]=f(e.group_wait),[p,m]=f(e.group_interval),[v,h]=f(e.repeat_interval),j=String(Math.random()),b={[j]:e},S=[];null===(t=e.routes)||void 0===t||t.forEach((e=>{const[t,a]=C(e);S.push(t),Object.assign(b,a)}));return[{id:j,object_matchers:[...e.matchers?null!==(a=null===(n=e.matchers)||void 0===n?void 0:n.map((e=>(0,g.cm)((0,g.tC)(e)))))&&void 0!==a?a:[]:null!==(r=null===(i=e.object_matchers)||void 0===i?void 0:i.map((e=>({name:e[0],operator:e[1],value:e[2]}))))&&void 0!==r?r:[],...x(e.match,!1),...x(e.match_re,!0)],continue:null!==(l=e.continue)&&void 0!==l&&l,receiver:null!==(s=e.receiver)&&void 0!==s?s:"",groupBy:null!==(o=e.group_by)&&void 0!==o?o:[],groupWaitValue:u,groupWaitValueType:d,groupIntervalValue:p,groupIntervalValueType:m,repeatIntervalValue:v,repeatIntervalValueType:h,routes:S,muteTimeIntervals:null!==(c=e.mute_time_intervals)&&void 0!==c?c:[]},b]},S=(e,t,a)=>{const n=a[t.id],r=Object.assign({},null!=n?n:{},{continue:t.continue,group_by:t.groupBy,object_matchers:t.object_matchers.length?t.object_matchers.map((e=>[e.name,e.operator,e.value])):void 0,match:void 0,match_re:void 0,group_wait:t.groupWaitValue?`${t.groupWaitValue}${t.groupWaitValueType}`:void 0,group_interval:t.groupIntervalValue?`${t.groupIntervalValue}${t.groupIntervalValueType}`:void 0,repeat_interval:t.repeatIntervalValue?`${t.repeatIntervalValue}${t.repeatIntervalValueType}`:void 0,routes:t.routes.map((t=>S(e,t,a))),mute_time_intervals:t.muteTimeIntervals});return e!==v.GC?(r.matchers=t.object_matchers.map((e=>{let{name:t,operator:a,value:n}=e;return`${t}${a}${n}`})),r.object_matchers=void 0):r.matchers=void 0,t.receiver&&(r.receiver=t.receiver),(0,m.omitBy)(r,m.isUndefined)},_=e=>({label:e,value:e}),I=e=>(null!=e?e:[]).map(_),N=e=>{var t;return e&&null!==(t=j(e))&&void 0!==t?t:""},V=e=>{return e?(null!=(t=e)?t:[]).map(j):[];var t},$=e=>{if(e)return/^\d+$/.test(e)?void 0:"Must be a positive integer."};var w=a("./public/app/features/alerting/unified/utils/misc.ts");const k=e=>({container:r.css`
      align-items: center;
      display: flex;
      flex-flow: row nowrap;

      & > * + * {
        margin-left: ${e.spacing(1)};
      }
    `,input:r.css`
      flex: 1;
    `,timingContainer:r.css`
      max-width: ${e.spacing(33)};
    `,smallInput:r.css`
      width: ${e.spacing(6.5)};
    `,linkText:r.css`
      text-decoration: underline;
    `,collapse:r.css`
      border: none;
      background: none;
      color: ${e.colors.text.primary};
    `});var M,O,T=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const B=["onChange","ref"],F=["onChange","ref"],q=["onChange","ref"],z=["onChange","ref"],P=["onChange","ref"];function A(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}const G=e=>{var t;let{alertManagerSourceName:a,onCancel:l,onSave:s,receivers:o,routes:c}=e;const u=(0,i.useStyles2)(k),[d,m]=(0,n.useState)(!1),[g,v]=(0,n.useState)(I(c.groupBy));return(0,T.jsx)(i.Form,{defaultValues:c,onSubmit:s,children:e=>{var n,s,c,h;let{control:x,errors:f,setValue:j}=e;return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(i.Field,{label:"Default contact point",invalid:!!f.receiver,error:null===(n=f.receiver)||void 0===n?void 0:n.message,children:(0,T.jsx)(T.Fragment,{children:(0,T.jsxs)("div",{className:u.container,"data-testid":"am-receiver-select",children:[(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=A(e.field,B);return(0,T.jsx)(i.Select,Object.assign({"aria-label":"Default contact point"},a,{className:u.input,onChange:e=>t(N(e)),options:o,menuShouldPortal:!0}))},control:x,name:"receiver",rules:{required:{value:!0,message:"Required."}}}),M||(M=(0,T.jsx)("span",{children:"or"})),(0,T.jsx)(i.Link,{className:u.linkText,href:(0,w.eQ)("/alerting/notifications/receivers/new",a),children:"Create a contact point"})]})})}),(0,T.jsx)(i.Field,{label:"Group by",description:"Group alerts when you receive a notification based on labels.","data-testid":"am-group-select",children:(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=A(e.field,F);return(0,T.jsx)(i.MultiSelect,Object.assign({"aria-label":"Group by",menuShouldPortal:!0},a,{allowCustomValue:!0,className:u.input,onCreateOption:e=>{v((t=>[...t,_(e)])),j("groupBy",[...a.value,e])},onChange:e=>t(V(e)),options:g}))},control:x,name:"groupBy"})}),(0,T.jsxs)(i.Collapse,{collapsible:!0,className:u.collapse,isOpen:d,label:"Timing options",onToggle:m,children:[(0,T.jsx)(i.Field,{label:"Group wait",description:"The waiting time until the initial notification is sent for a new group created by an incoming alert. Default 30 seconds.",invalid:!!f.groupWaitValue,error:null===(s=f.groupWaitValue)||void 0===s?void 0:s.message,"data-testid":"am-group-wait",children:(0,T.jsx)(T.Fragment,{children:(0,T.jsxs)("div",{className:(0,r.cx)(u.container,u.timingContainer),children:[(0,T.jsx)(i.InputControl,{render:e=>{let{field:t,fieldState:{invalid:a}}=e;return(0,T.jsx)(i.Input,Object.assign({},t,{className:u.smallInput,invalid:a,placeholder:"Default 30 seconds"}))},control:x,name:"groupWaitValue",rules:{validate:$}}),(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=A(e.field,q);return(0,T.jsx)(i.Select,Object.assign({menuShouldPortal:!0},a,{className:u.input,onChange:e=>t(N(e)),options:p.qr,"aria-label":"Group wait type"}))},control:x,name:"groupWaitValueType"})]})})}),(0,T.jsx)(i.Field,{label:"Group interval",description:"The waiting time to send a batch of new alerts for that group after the first notification was sent. Default 5 minutes.",invalid:!!f.groupIntervalValue,error:null===(c=f.groupIntervalValue)||void 0===c?void 0:c.message,"data-testid":"am-group-interval",children:(0,T.jsx)(T.Fragment,{children:(0,T.jsxs)("div",{className:(0,r.cx)(u.container,u.timingContainer),children:[(0,T.jsx)(i.InputControl,{render:e=>{let{field:t,fieldState:{invalid:a}}=e;return(0,T.jsx)(i.Input,Object.assign({},t,{className:u.smallInput,invalid:a,placeholder:"Default 5 minutes"}))},control:x,name:"groupIntervalValue",rules:{validate:$}}),(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=A(e.field,z);return(0,T.jsx)(i.Select,Object.assign({menuShouldPortal:!0},a,{className:u.input,onChange:e=>t(N(e)),options:p.qr,"aria-label":"Group interval type"}))},control:x,name:"groupIntervalValueType"})]})})}),(0,T.jsx)(i.Field,{label:"Repeat interval",description:"The waiting time to resend an alert after they have successfully been sent. Default 4 hours.",invalid:!!f.repeatIntervalValue,error:null===(h=f.repeatIntervalValue)||void 0===h?void 0:h.message,"data-testid":"am-repeat-interval",children:(0,T.jsx)(T.Fragment,{children:(0,T.jsxs)("div",{className:(0,r.cx)(u.container,u.timingContainer),children:[(0,T.jsx)(i.InputControl,{render:e=>{let{field:t,fieldState:{invalid:a}}=e;return(0,T.jsx)(i.Input,Object.assign({},t,{className:u.smallInput,invalid:a,placeholder:"Default 4 hours"}))},control:x,name:"repeatIntervalValue",rules:{validate:$}}),(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=A(e.field,P);return(0,T.jsx)(i.Select,Object.assign({menuShouldPortal:!0},a,{className:u.input,menuPlacement:"top",onChange:e=>t(N(e)),options:p.qr,"aria-label":"Repeat interval type"}))},control:x,name:"repeatIntervalValueType"})]})})})]}),(0,T.jsxs)("div",{className:u.container,children:[O||(O=(0,T.jsx)(i.Button,{type:"submit",children:"Save"})),t||(t=(0,T.jsx)(i.Button,{onClick:l,type:"reset",variant:"secondary",fill:"outline",children:"Cancel"}))]})]})}})},R=e=>({container:r.css`
      display: grid;
      font-style: ${e.typography.fontSize};
      grid-template-columns: ${e.spacing(15.5)} auto;

      ${e.breakpoints.down("md")} {
        grid-template-columns: 100%;
      }
    `,titleCell:r.css`
      color: ${e.colors.text.primary};
    `,valueCell:r.css`
      color: ${e.colors.text.secondary};
      margin-bottom: ${e.spacing(1)};
    `}),W=e=>{let{routes:t}=e;const a=(0,i.useStyles2)(R),n=t.receiver||"-",r=t.groupBy.join(", ")||"-",l=t.groupWaitValue?`${t.groupWaitValue}${t.groupWaitValueType}`:"-",s=t.groupIntervalValue?`${t.groupIntervalValue}${t.groupIntervalValueType}`:"-",o=t.repeatIntervalValue?`${t.repeatIntervalValue}${t.repeatIntervalValueType}`:"-";return(0,T.jsxs)("div",{className:a.container,children:[(0,T.jsx)("div",{className:a.titleCell,children:"Contact point"}),(0,T.jsx)("div",{className:a.valueCell,"data-testid":"am-routes-root-receiver",children:n}),(0,T.jsx)("div",{className:a.titleCell,children:"Group by"}),(0,T.jsx)("div",{className:a.valueCell,"data-testid":"am-routes-root-group-by",children:r}),(0,T.jsx)("div",{className:a.titleCell,children:"Timings"}),(0,T.jsxs)("div",{className:a.valueCell,"data-testid":"am-routes-root-timings",children:["Group wait: ",l," | Group interval: ",s," | Repeat interval: ",o]})]})};var E,L;const D=e=>{let{isEditMode:t,onSave:a,onEnterEditMode:n,onExitEditMode:r,receivers:l,routes:s,alertManagerSourceName:o}=e;const c=(0,i.useStyles2)(U),u=(0,v.RY)(o);return(0,T.jsxs)("div",{className:c.container,"data-testid":"am-root-route-container",children:[(0,T.jsxs)("div",{className:c.titleContainer,children:[(0,T.jsxs)("h5",{className:c.title,children:["Root policy - ",E||(E=(0,T.jsx)("i",{children:"default for all alerts"}))]}),!t&&!u&&(0,T.jsx)(i.Button,{icon:"pen",onClick:n,size:"sm",type:"button",variant:"secondary",children:"Edit"})]}),L||(L=(0,T.jsx)("p",{children:"All alerts will go to the default contact point, unless you set additional matchers in the specific routing area."})),t?(0,T.jsx)(G,{alertManagerSourceName:o,onCancel:r,onSave:a,receivers:l,routes:s}):(0,T.jsx)(W,{routes:s})]})},U=e=>({container:r.css`
      background-color: ${e.colors.background.secondary};
      color: ${e.colors.text.secondary};
      padding: ${e.spacing(2)};
    `,titleContainer:r.css`
      color: ${e.colors.text.primary};
      display: flex;
      flex-flow: row nowrap;
    `,title:r.css`
      flex: 100%;
    `});var Z=a("./.yarn/__virtual__/react-use-virtual-00326e70ba/3/opt/drone/yarncache/react-use-npm-17.3.2-a032cbeb01-7379460f51.zip/node_modules/react-use/esm/useDebounce.js"),J=a("./public/app/features/alerting/unified/hooks/useURLSearchParams.ts"),Q=a("./public/app/features/alerting/unified/components/alert-groups/MatcherFilter.tsx");const Y=e=>{let{children:t}=e;const a=(0,i.useStyles)(H);return(0,T.jsx)("div",{className:a.container,children:t})},H=e=>({container:r.css`
      background-color: ${e.colors.bg2};
      color: ${e.colors.textSemiWeak};
      padding: ${e.spacing.xl};
      text-align: center;
    `}),K=e=>{let{buttonIcon:t,buttonLabel:a,buttonSize:n="lg",buttonVariant:r="primary",onButtonClick:l,text:s,href:o}=e;const c=(0,i.useStyles)(X),u={className:c.button,icon:t,size:n,variant:r};return(0,T.jsx)(Y,{children:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("p",{className:c.text,children:s}),o?(0,T.jsx)(i.LinkButton,Object.assign({href:o,type:"button"},u,{children:a})):(0,T.jsx)(i.Button,Object.assign({onClick:l,type:"button"},u,{children:a}))]})})},X=e=>({container:r.css`
      background-color: ${e.colors.bg2};
      color: ${e.colors.textSemiWeak};
      padding: ${e.spacing.xl};
      text-align: center;
    `,text:r.css`
      margin-bottom: ${e.spacing.md};
    `,button:r.css`
      margin: ${e.spacing.md} 0 ${e.spacing.sm};
    `});var ee=a("./public/app/features/alerting/unified/components/DynamicTable.tsx"),te=a("./public/app/features/alerting/unified/utils/redux.ts"),ae=a("./public/app/features/alerting/unified/hooks/useAlertManagerSourceName.ts"),ne=a("./public/app/features/alerting/unified/hooks/useUnifiedAlertingSelector.ts");const re=["onChange","ref"],ie=["onChange","ref"],le=["onChange","ref"],se=["onChange","ref"],oe=["onChange","ref"],ce=["onChange","ref"],ue=["onChange","ref"];var de,pe;function me(e,t){if(null==e)return{};var a,n,r={},i=Object.keys(e);for(n=0;n<i.length;n++)a=i[n],t.indexOf(a)>=0||(r[a]=e[a]);return r}const ge=e=>{var t;let{onCancel:a,onSave:l,receivers:s,routes:o}=e;const c=(0,i.useStyles2)(ve),u=(0,i.useStyles2)(k),[d,m]=(0,n.useState)(o.groupBy.length>0),[v,h]=(0,n.useState)(!!o.groupWaitValue||!!o.groupIntervalValue||!!o.repeatIntervalValue),[x,f]=(0,n.useState)(I(o.groupBy)),j=function(){const[e]=(0,ae.k)(),t=(0,ne._)((e=>e.amConfigs));return(0,n.useMemo)((()=>{var a,n,r;const{result:i}=e&&t[e]||te.oq,l=null!==(a=null==i?void 0:i.alertmanager_config)&&void 0!==a?a:{};return null!==(n=null==l||null===(r=l.mute_time_intervals)||void 0===r?void 0:r.map((e=>({value:e.name,label:e.name,description:e.time_intervals.map((e=>(0,g.uK)(e))).join(", AND ")}))))&&void 0!==n?n:[]}),[e,t])}();return(0,T.jsx)(i.Form,{defaultValues:o,onSubmit:l,children:e=>{var n,l,o;let{control:y,register:C,errors:S,setValue:I}=e;return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("input",Object.assign({type:"hidden"},C("id"))),(0,T.jsx)(i.FieldArray,{name:"object_matchers",control:y,children:e=>{let{fields:t,append:a,remove:n}=e;return(0,T.jsxs)(T.Fragment,{children:[de||(de=(0,T.jsx)("div",{children:"Matching labels"})),(0,T.jsx)("div",{className:c.matchersContainer,children:t.map(((e,t)=>{var a,r,l,s,o,u,d,p,m,v;const h=`object_matchers[${t}]`;return(0,T.jsxs)(i.HorizontalGroup,{align:"flex-start",children:[(0,T.jsx)(i.Field,{label:"Label",invalid:!(null===(a=S.object_matchers)||void 0===a||null===(r=a[t])||void 0===r||!r.name),error:null===(l=S.object_matchers)||void 0===l||null===(s=l[t])||void 0===s||null===(o=s.name)||void 0===o?void 0:o.message,children:(0,T.jsx)(i.Input,Object.assign({},C(`${h}.name`,{required:"Field is required"}),{defaultValue:e.name,placeholder:"label"}))}),(0,T.jsx)(i.Field,{label:"Operator",children:(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=me(e.field,re);return(0,T.jsx)(i.Select,Object.assign({},a,{className:c.matchersOperator,onChange:e=>t(null==e?void 0:e.value),options:g.tA,"aria-label":"Operator"}))},defaultValue:e.operator,control:y,name:`${h}.operator`,rules:{required:{value:!0,message:"Required."}}})}),(0,T.jsx)(i.Field,{label:"Value",invalid:!(null===(u=S.object_matchers)||void 0===u||null===(d=u[t])||void 0===d||!d.value),error:null===(p=S.object_matchers)||void 0===p||null===(m=p[t])||void 0===m||null===(v=m.value)||void 0===v?void 0:v.message,children:(0,T.jsx)(i.Input,Object.assign({},C(`${h}.value`,{required:"Field is required"}),{defaultValue:e.value,placeholder:"value"}))}),(0,T.jsx)(i.IconButton,{className:c.removeButton,tooltip:"Remove matcher",name:"trash-alt",onClick:()=>n(t),children:"Remove"})]},e.id)}))}),(0,T.jsx)(i.Button,{className:c.addMatcherBtn,icon:"plus",onClick:()=>a(b),variant:"secondary",type:"button",children:"Add matcher"})]})}}),(0,T.jsx)(i.Field,{label:"Contact point",children:(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=me(e.field,ie);return(0,T.jsx)(i.Select,Object.assign({"aria-label":"Contact point"},a,{className:u.input,onChange:e=>t(N(e)),options:s,menuShouldPortal:!0}))},control:y,name:"receiver"})}),(0,T.jsx)(i.Field,{label:"Continue matching subsequent sibling nodes",children:(0,T.jsx)(i.Switch,Object.assign({id:"continue-toggle"},C("continue")))}),(0,T.jsx)(i.Field,{label:"Override grouping",children:(0,T.jsx)(i.Switch,{id:"override-grouping-toggle",value:d,onChange:()=>m((e=>!e))})}),d&&(0,T.jsx)(i.Field,{label:"Group by",description:"Group alerts when you receive a notification based on labels.",children:(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=me(e.field,le);return(0,T.jsx)(i.MultiSelect,Object.assign({"aria-label":"Group by",menuShouldPortal:!0},a,{allowCustomValue:!0,className:u.input,onCreateOption:e=>{f((t=>[...t,_(e)])),I("groupBy",[...a.value,e])},onChange:e=>t(V(e)),options:x}))},control:y,name:"groupBy"})}),(0,T.jsx)(i.Field,{label:"Override general timings",children:(0,T.jsx)(i.Switch,{id:"override-timings-toggle",value:v,onChange:()=>h((e=>!e))})}),v&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(i.Field,{label:"Group wait",description:"The waiting time until the initial notification is sent for a new group created by an incoming alert.",invalid:!!S.groupWaitValue,error:null===(n=S.groupWaitValue)||void 0===n?void 0:n.message,children:(0,T.jsx)(T.Fragment,{children:(0,T.jsxs)("div",{className:(0,r.cx)(u.container,u.timingContainer),children:[(0,T.jsx)(i.InputControl,{render:e=>{let{field:t,fieldState:{invalid:a}}=e;return(0,T.jsx)(i.Input,Object.assign({},t,{className:u.smallInput,invalid:a,placeholder:"Time","aria-label":"Group wait value"}))},control:y,name:"groupWaitValue",rules:{validate:$}}),(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=me(e.field,se);return(0,T.jsx)(i.Select,Object.assign({menuShouldPortal:!0},a,{className:u.input,onChange:e=>t(N(e)),options:p.qr,"aria-label":"Group wait type"}))},control:y,name:"groupWaitValueType"})]})})}),(0,T.jsx)(i.Field,{label:"Group interval",description:"The waiting time to send a batch of new alerts for that group after the first notification was sent.",invalid:!!S.groupIntervalValue,error:null===(l=S.groupIntervalValue)||void 0===l?void 0:l.message,children:(0,T.jsx)(T.Fragment,{children:(0,T.jsxs)("div",{className:(0,r.cx)(u.container,u.timingContainer),children:[(0,T.jsx)(i.InputControl,{render:e=>{let{field:t,fieldState:{invalid:a}}=e;return(0,T.jsx)(i.Input,Object.assign({},t,{className:u.smallInput,invalid:a,placeholder:"Time","aria-label":"Group interval value"}))},control:y,name:"groupIntervalValue",rules:{validate:$}}),(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=me(e.field,oe);return(0,T.jsx)(i.Select,Object.assign({menuShouldPortal:!0},a,{className:u.input,onChange:e=>t(N(e)),options:p.qr,"aria-label":"Group interval type"}))},control:y,name:"groupIntervalValueType"})]})})}),(0,T.jsx)(i.Field,{label:"Repeat interval",description:"The waiting time to resend an alert after they have successfully been sent.",invalid:!!S.repeatIntervalValue,error:null===(o=S.repeatIntervalValue)||void 0===o?void 0:o.message,children:(0,T.jsx)(T.Fragment,{children:(0,T.jsxs)("div",{className:(0,r.cx)(u.container,u.timingContainer),children:[(0,T.jsx)(i.InputControl,{render:e=>{let{field:t,fieldState:{invalid:a}}=e;return(0,T.jsx)(i.Input,Object.assign({},t,{className:u.smallInput,invalid:a,placeholder:"Time","aria-label":"Repeat interval value"}))},control:y,name:"repeatIntervalValue",rules:{validate:$}}),(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=me(e.field,ce);return(0,T.jsx)(i.Select,Object.assign({menuShouldPortal:!0},a,{className:u.input,menuPlacement:"top",onChange:e=>t(N(e)),options:p.qr,"aria-label":"Repeat interval type"}))},control:y,name:"repeatIntervalValueType"})]})})})]}),(0,T.jsx)(i.Field,{label:"Mute timings","data-testid":"am-mute-timing-select",description:"Add mute timing to policy",invalid:!!S.muteTimeIntervals,children:(0,T.jsx)(i.InputControl,{render:e=>{let{field:{onChange:t}}=e,a=me(e.field,ue);return(0,T.jsx)(i.MultiSelect,Object.assign({"aria-label":"Mute timings",menuShouldPortal:!0},a,{className:u.input,onChange:e=>t(V(e)),options:j}))},control:y,name:"muteTimeIntervals"})}),(0,T.jsxs)("div",{className:c.buttonGroup,children:[pe||(pe=(0,T.jsx)(i.Button,{type:"submit",children:"Save policy"})),t||(t=(0,T.jsx)(i.Button,{onClick:a,fill:"outline",type:"button",variant:"secondary",children:"Cancel"}))]})]})}})},ve=e=>{const t=e.spacing(3.5);return{addMatcherBtn:r.css`
      margin-bottom: ${t};
    `,matchersContainer:r.css`
      background-color: ${e.colors.background.secondary};
      margin: ${e.spacing(1,0)};
      padding: ${e.spacing(1,4.6,1,1.5)};
      width: fit-content;
    `,matchersOperator:r.css`
      min-width: 140px;
    `,nestedPolicies:r.css`
      margin-top: ${t};
    `,removeButton:r.css`
      margin-left: ${e.spacing(1)};
      margin-top: ${e.spacing(2.5)};
    `,buttonGroup:r.css`
      margin: ${e.spacing(6)} 0 ${t};

      & > * + * {
        margin-left: ${e.spacing(1.5)};
      }
    `}};var he,xe,fe,je,be,ye,Ce=a("./public/app/features/alerting/unified/state/actions.ts");const Se=e=>{var t;let{alertManagerSourceName:a,muteTimingNames:r,hideActions:s}=e;const o=(0,i.useStyles2)(Ie),c=(0,l.useDispatch)(),u=(0,ne._)((e=>e.amConfigs)),[d,p]=(0,n.useState)(""),{result:m}=a&&u[a]||te.oq,g=(0,n.useMemo)((()=>{var e,t;return(null!==(e=null==m||null===(t=m.alertmanager_config)||void 0===t?void 0:t.mute_time_intervals)&&void 0!==e?e:[]).filter((e=>{let{name:t}=e;return!r||r.includes(t)})).map((e=>({id:e.name,data:e})))}),[null==m||null===(t=m.alertmanager_config)||void 0===t?void 0:t.mute_time_intervals,r]),v=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2?arguments[2]:void 0;return(0,n.useMemo)((()=>{const n=[{id:"name",label:"Name",renderCell:function(e){let{data:t}=e;return t.name},size:"250px"},{id:"timeRange",label:"Time range",renderCell:e=>{let{data:t}=e;return _e(t.time_intervals)}}];return t||n.push({id:"actions",label:"Actions",renderCell:function(t){let{data:n}=t;return(0,T.jsxs)("div",{children:[(0,T.jsx)(i.Link,{href:(0,w.eQ)("/alerting/routes/mute-timing/edit",e,{muteName:n.name}),children:je||(je=(0,T.jsx)(i.IconButton,{name:"edit",title:"Edit mute timing"}))}),(0,T.jsx)(i.IconButton,{name:"trash-alt",title:"Delete mute timing",onClick:()=>a(n.name)})]})},size:"100px"}),n}),[e,t,a])}(a,s,p);return(0,T.jsxs)("div",{className:o.container,children:[!s&&(he||(he=(0,T.jsx)("h5",{children:"Mute timings"}))),!s&&(xe||(xe=(0,T.jsx)("p",{children:"Mute timings are a named interval of time that may be referenced in the notification policy tree to mute particular notification policies for specific times of the day."}))),!s&&g.length>0&&(0,T.jsx)(i.LinkButton,{className:o.addMuteButton,icon:"plus",variant:"primary",href:(0,w.eQ)("alerting/routes/mute-timing/new",a),children:"New mute timing"}),g.length>0?(0,T.jsx)(ee.t,{items:g,cols:v}):s?fe||(fe=(0,T.jsx)("p",{children:"No mute timings configured"})):(0,T.jsx)(K,{text:"You haven't created any mute timings yet",buttonLabel:"Add mute timing",buttonIcon:"plus",buttonSize:"lg",href:(0,w.eQ)("alerting/routes/mute-timing/new",a)}),!s&&(0,T.jsx)(i.ConfirmModal,{isOpen:!!d,title:"Delete mute timing",body:`Are you sure you would like to delete "${d}"`,confirmText:"Delete",onConfirm:()=>c((0,Ce.r0)(a,d)),onDismiss:()=>p("")})]})};function _e(e){return e.map(((e,t)=>{const{times:a,weekdays:r,days_of_month:i,months:l,years:s}=e,o=(0,g.u6)(a),c=(0,g.v7)(r),u=(0,g.J8)(i),d=(0,g.m8)(l),p=(0,g.qw)(s);return(0,T.jsxs)(n.Fragment,{children:[`${o} ${c}`,be||(be=(0,T.jsx)("br",{})),[u,d,p].join(" | "),ye||(ye=(0,T.jsx)("br",{}))]},JSON.stringify(e)+t)}))}const Ie=e=>({container:r.css`
    display: flex;
    flex-flow: column nowrap;
  `,addMuteButton:r.css`
    margin-bottom: ${e.spacing(2)};
    align-self: flex-end;
  `});var Ne;const Ve=e=>{let{onChange:t,receivers:a,routes:r,readOnly:l=!1}=e;const s=(0,i.useStyles2)($e),o=(0,i.useStyles2)(R),[c]=(0,ae.k)(),u=r.groupWaitValue?`${r.groupWaitValue}${r.groupWaitValueType}`:"-",d=r.groupIntervalValue?`${r.groupIntervalValue}${r.groupIntervalValueType}`:"-",p=r.repeatIntervalValue?`${r.repeatIntervalValue}${r.repeatIntervalValueType}`:"-",[m,g]=(0,n.useState)(r.routes),[v,h]=(0,n.useState)(!1);return(0,T.jsxs)("div",{className:o.container,children:[(0,T.jsx)("div",{className:o.titleCell,children:"Group wait"}),(0,T.jsx)("div",{className:o.valueCell,children:u}),(0,T.jsx)("div",{className:o.titleCell,children:"Group interval"}),(0,T.jsx)("div",{className:o.valueCell,children:d}),(0,T.jsx)("div",{className:o.titleCell,children:"Repeat interval"}),(0,T.jsx)("div",{className:o.valueCell,children:p}),(0,T.jsx)("div",{className:o.titleCell,children:"Nested policies"}),(0,T.jsxs)("div",{className:o.valueCell,children:[m.length?(0,T.jsx)(Oe,{isAddMode:v,onCancelAdd:()=>{h(!1),g((e=>{const t=[...e];return t.pop(),t}))},onChange:e=>{t(Object.assign({},r,{routes:e})),v&&h(!1)},receivers:a,routes:m}):Ne||(Ne=(0,T.jsx)("p",{children:"No nested policies configured."})),!v&&!l&&(0,T.jsx)(i.Button,{className:s.addNestedRoutingBtn,icon:"plus",onClick:()=>{g((e=>[...e,y])),h(!0)},variant:"secondary",type:"button",children:"Add nested policy"})]}),(0,T.jsx)("div",{className:o.titleCell,children:"Mute timings"}),(0,T.jsx)("div",{className:o.valueCell,children:(0,T.jsx)(Se,{alertManagerSourceName:c,muteTimingNames:r.muteTimeIntervals,hideActions:!0})})]})},$e=e=>({addNestedRoutingBtn:r.css`
      margin-top: ${e.spacing(2)};
    `});var we,ke=a("./public/app/features/alerting/unified/components/silences/Matchers.tsx");const Me=(e,t)=>{const a=[...e],n=a.findIndex((e=>e.id===t.id));return n>=0&&(a[n]=Object.assign({},a[n],t)),a},Oe=e=>{let{isAddMode:t,onCancelAdd:a,onChange:r,receivers:l,routes:s,filters:o,readOnly:c=!1}=e;const[u,d]=(0,n.useState)(!1),[p,v]=(0,n.useState)(),h=(0,n.useCallback)((e=>v(e.id)),[]),x=(0,n.useCallback)((()=>v(void 0)),[]),f=[{id:"matchingCriteria",label:"Matching labels",renderCell:e=>(0,T.jsx)(ke.g,{matchers:e.data.object_matchers.map(g._J)}),size:10},{id:"groupBy",label:"Group by",renderCell:e=>e.data.groupBy.join(", ")||"-",size:5},{id:"receiverChannel",label:"Contact point",renderCell:e=>e.data.receiver||"-",size:5},{id:"muteTimings",label:"Mute timings",renderCell:e=>e.data.muteTimeIntervals.join(", ")||"-",size:5},...c?[]:[{id:"actions",label:"Actions",renderCell:e=>{if(e.renderExpandedContent)return null;return(0,T.jsxs)(i.HorizontalGroup,{children:[(0,T.jsx)(i.Button,{"aria-label":"Edit route",icon:"pen",onClick:()=>{h(e),d(!0)},size:"sm",type:"button",variant:"secondary",children:"Edit"}),(0,T.jsx)(i.IconButton,{"aria-label":"Delete route",name:"trash-alt",onClick:()=>{const t=((e,t)=>e.filter((e=>e.id!==t.id)))(s,e.data);r(t)},type:"button"})]})},size:"100px"}]],j=(0,n.useMemo)((()=>((e,t,a)=>{const n=(0,g.Zh)(null!=t?t:"");let r=e;return n.length&&(r=e.filter((e=>{const t=e.object_matchers.map(g._J);return(0,m.intersectionWith)(t,n,m.isEqual).length>0}))),a&&a.length>0&&(r=r.filter((e=>e.receiver.toLowerCase().includes(a.toLowerCase())))),r})(s,null==o?void 0:o.queryString,null==o?void 0:o.contactPoint)),[s,o]),b=(0,n.useMemo)((()=>{return(t?s:j).map(((t,a)=>{var n;return{id:null!==(n=null==e?void 0:e(t))&&void 0!==n?n:a,data:t}}));var e}),[t,s,j]);return(0,n.useEffect)((()=>{t&&b.length&&v(b[b.length-1].id),!t&&b.length&&v(void 0)}),[t,b]),s.length>0&&0===j.length?we||(we=(0,T.jsx)(Y,{children:(0,T.jsx)("p",{children:"No policies found"})})):(0,T.jsx)(ee.t,{cols:f,isExpandable:!0,items:b,testIdGenerator:()=>"am-routes-row",onCollapse:x,onExpand:h,isExpanded:e=>p===e.id,renderExpandedContent:e=>t||u?(0,T.jsx)(ge,{onCancel:()=>{t&&a(),d(!1)},onSave:e=>{const t=Me(s,e);d(!1),r(t)},receivers:l,routes:e.data}):(0,T.jsx)(Ve,{onChange:e=>{const t=Me(s,e);r(t)},receivers:l,routes:e.data,readOnly:c})})};var Te,Be,Fe,qe,ze,Pe;const Ae=e=>{var t,a;let{onChange:r,onRootRouteEdit:l,receivers:s,routes:o,readOnly:c=!1}=e;const[u,d]=(0,n.useState)([...o.routes]),[p,m]=(0,n.useState)(!1),[g,v]=(0,J.j)(),{queryString:h,contactPoint:x}=(0,w.$f)(g),[f,j]=(0,n.useState)({queryString:h,contactPoint:x});(0,Z.Z)((()=>{v({queryString:f.queryString,contactPoint:f.contactPoint})}),400,[f]);const C=(0,i.useStyles2)(Ge),S=()=>{j({queryString:void 0,contactPoint:void 0}),v({queryString:void 0,contactPoint:void 0})},_=()=>{S(),m(!0),d((()=>[...o.routes,Object.assign({},y,{matchers:[b]})]))};return(0,T.jsxs)("div",{className:C.container,children:[Te||(Te=(0,T.jsx)("h5",{children:"Specific routing"})),Be||(Be=(0,T.jsx)("p",{children:"Send specific alerts to chosen contact points, based on matching criteria"})),o.receiver?u.length>0?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)("div",{children:[!p&&(0,T.jsxs)("div",{className:C.searchContainer,children:[(0,T.jsx)(Q.F,{onFilterChange:e=>j((t=>Object.assign({},t,{queryString:e}))),queryString:null!==(t=f.queryString)&&void 0!==t?t:"",className:C.filterInput}),(0,T.jsxs)("div",{className:C.filterInput,children:[qe||(qe=(0,T.jsx)(i.Label,{children:"Search by contact point"})),(0,T.jsx)(i.Input,{onChange:e=>{let{currentTarget:t}=e;return j((e=>Object.assign({},e,{contactPoint:t.value})))},value:null!==(a=f.contactPoint)&&void 0!==a?a:"",placeholder:"Search by contact point","data-testid":"search-query-input",prefix:ze||(ze=(0,T.jsx)(i.Icon,{name:"search"}))})]}),(h||x)&&(0,T.jsx)(i.Button,{variant:"secondary",icon:"times",onClick:S,className:C.clearFilterBtn,children:"Clear filters"})]}),!p&&!c&&(0,T.jsx)("div",{className:C.addMatcherBtnRow,children:(0,T.jsx)(i.Button,{className:C.addMatcherBtn,icon:"plus",onClick:_,type:"button",children:"New policy"})})]}),(0,T.jsx)(Oe,{isAddMode:p,readOnly:c,onCancelAdd:()=>{m(!1),d([...o.routes])},onChange:e=>{r(Object.assign({},o,{routes:e})),p&&m(!1)},receivers:s,routes:u,filters:{queryString:h,contactPoint:x}})]}):c?Pe||(Pe=(0,T.jsx)(Y,{children:(0,T.jsx)("p",{children:"There are no specific policies configured."})})):(0,T.jsx)(K,{buttonIcon:"plus",buttonLabel:"New specific policy",onButtonClick:_,text:"You haven't created any specific policies yet."}):c?Fe||(Fe=(0,T.jsx)(Y,{children:(0,T.jsx)("p",{children:"There is no default contact point configured for the root route."})})):(0,T.jsx)(K,{buttonIcon:"rocket",buttonLabel:"Set a default contact point",onButtonClick:l,text:"You haven't set a default contact point for the root route yet."})]})},Ge=e=>({container:r.css`
      display: flex;
      flex-flow: column wrap;
    `,searchContainer:r.css`
      display: flex;
      flex-flow: row nowrap;
      padding-bottom: ${e.spacing(2)};
      border-bottom: 1px solid ${e.colors.border.strong};
    `,clearFilterBtn:r.css`
      align-self: flex-end;
      margin-left: ${e.spacing(1)};
    `,filterInput:r.css`
      width: 340px;
      & + & {
        margin-left: ${e.spacing(1)};
      }
    `,addMatcherBtnRow:r.css`
      display: flex;
      flex-flow: column nowrap;
      padding: ${e.spacing(2)} 0;
    `,addMatcherBtn:r.css`
      align-self: flex-end;
    `});var Re,We;const Ee=(0,i.withErrorBoundary)((()=>{var e;const t=(0,l.useDispatch)(),a=(0,i.useStyles2)(Le),[r,d]=(0,n.useState)(!1),[p,m]=(0,ae.k)(),g=!p||(0,v.RY)(p),h=(0,ne._)((e=>e.amConfigs)),x=(0,n.useCallback)((()=>{p&&t((0,Ce.Yh)(p))}),[p,t]);(0,n.useEffect)((()=>{x()}),[x]);const{result:f,loading:j,error:b}=p&&h[p]||te.oq,y=null==f?void 0:f.alertmanager_config,[_,N]=(0,n.useMemo)((()=>C(null==y?void 0:y.route)),[null==y?void 0:y.route]),V=I((null!==(e=null==y?void 0:y.receivers)&&void 0!==e?e:[]).map((e=>e.name))),$=()=>{d(!0)},w=()=>{d(!1)};(0,o.x)((e=>e.unifiedAlerting.saveAMConfig));const k=e=>{if(!f)return;const a=S(p,Object.assign({},_,e),N);r&&w(),t((0,Ce.mM)({newConfig:Object.assign({},f,{alertmanager_config:Object.assign({},f.alertmanager_config,{route:a})}),oldConfig:f,alertManagerSourceName:p,successMessage:"Saved",refetch:!0}))};return p?(0,T.jsxs)(c.J,{pageId:"am-routes",children:[(0,T.jsx)(u.P,{current:p,onChange:m}),b&&!j&&(0,T.jsx)(i.Alert,{severity:"error",title:"Error loading Alertmanager config",children:b.message||"Unknown error."}),j&&(We||(We=(0,T.jsx)(i.LoadingPlaceholder,{text:"Loading Alertmanager config..."}))),f&&!j&&!b&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(D,{alertManagerSourceName:p,isEditMode:r,onSave:k,onEnterEditMode:$,onExitEditMode:w,receivers:V,routes:_}),(0,T.jsx)("div",{className:a.break}),(0,T.jsx)(Ae,{onChange:k,readOnly:g,onRootRouteEdit:$,receivers:V,routes:_}),(0,T.jsx)("div",{className:a.break}),(0,T.jsx)(Se,{alertManagerSourceName:p})]})]}):Re||(Re=(0,T.jsx)(s.l_,{to:"/alerting/routes"}))}),{style:"page"}),Le=e=>({break:r.css`
    width: 100%;
    height: 0;
    margin-bottom: ${e.spacing(2)};
  `})},"./public/app/features/alerting/unified/components/AlertingPageWrapper.tsx":(e,t,a)=>{a.d(t,{J:()=>s});a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js");var n=a("./public/app/core/components/Page/Page.tsx"),r=a("./public/app/core/selectors/navModel.ts"),i=a("./.yarn/__virtual__/react-redux-virtual-7ad20a440e/3/opt/drone/yarncache/react-redux-npm-7.2.6-134f5ed64d-0bf142ce0d.zip/node_modules/react-redux/es/index.js"),l=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const s=e=>{let{children:t,pageId:a,isLoading:s}=e;const o=(0,r.h)((0,i.useSelector)((e=>e.navIndex)),a);return(0,l.jsx)(n.Z,{navModel:o,children:(0,l.jsx)(n.Z.Contents,{isLoading:s,children:t})})}},"./public/app/features/alerting/unified/components/alert-groups/MatcherFilter.tsx":(e,t,a)=>{a.d(t,{F:()=>o});a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js");var n,r,i=a("./packages/grafana-ui/src/index.ts"),l=a("./.yarn/__virtual__/@emotion-css-virtual-72c314ddb1/3/opt/drone/yarncache/@emotion-css-npm-11.7.1-25ff8755a7-ac1f56656f.zip/node_modules/@emotion/css/dist/emotion-css.esm.js"),s=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const o=e=>{let{className:t,onFilterChange:a,defaultQueryString:l,queryString:o}=e;const u=(0,i.useStyles2)(c),d=n||(n=(0,s.jsx)(i.Icon,{name:"search"}));return(0,s.jsxs)("div",{className:t,children:[(0,s.jsxs)(i.Label,{children:[(0,s.jsx)(i.Tooltip,{content:r||(r=(0,s.jsxs)("div",{children:["Filter alerts using label querying, ex:",(0,s.jsx)("pre",{children:'{severity="critical", instance=~"cluster-us-.+"}'})]})),children:(0,s.jsx)(i.Icon,{className:u.icon,name:"info-circle",size:"xs"})}),"Search by label"]}),(0,s.jsx)(i.Input,{placeholder:"Search",defaultValue:l,value:o,onChange:e=>{const t=e.target;a(t.value)},"data-testid":"search-query-input",prefix:d,className:u.inputWidth})]})},c=e=>({icon:l.css`
    margin-right: ${e.spacing(.5)};
  `,inputWidth:l.css`
    width: 340px;
    flex-grow: 0;
  `})},"./public/app/features/alerting/unified/components/silences/Matchers.tsx":(e,t,a)=>{a.d(t,{g:()=>c});var n=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),r=a("./packages/grafana-ui/src/index.ts"),i=a("./.yarn/__virtual__/@emotion-css-virtual-72c314ddb1/3/opt/drone/yarncache/@emotion-css-npm-11.7.1-25ff8755a7-ac1f56656f.zip/node_modules/@emotion/css/dist/emotion-css.esm.js"),l=a("./public/app/features/alerting/unified/components/AlertLabel.tsx"),s=a("./public/app/features/alerting/unified/utils/alertmanager.ts"),o=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/jsx-runtime.js");const c=e=>{let{matchers:t,onRemoveLabel:a}=e;const i=(0,r.useStyles)(u),c=(0,n.useCallback)((e=>{a&&a(e)}),[a]);return(0,o.jsx)("div",{className:i.wrapper,children:t.map(((e,t)=>{const{name:n,value:r}=e;return(0,o.jsx)(l.i,{labelKey:n,value:r,operator:(0,s.zy)(e),onRemoveLabel:a?()=>c(t):void 0},`${n}-${r}-${t}`)}))})},u=e=>({wrapper:i.css`
    & > * {
      margin-top: ${e.spacing.xs};
      margin-right: ${e.spacing.xs};
    }
    padding-bottom: ${e.spacing.xs};
  `})},"./public/app/features/alerting/unified/hooks/useAlertManagerSourceName.ts":(e,t,a)=>{a.d(t,{k:()=>c});var n=a("./public/app/core/hooks/useQueryParams.ts"),r=a("./public/app/core/store.ts"),i=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),l=a("./public/app/features/alerting/unified/utils/constants.ts"),s=a("./public/app/features/alerting/unified/utils/datasource.ts");function o(e){return e===s.GC||!!(0,s.aM)().find((t=>t.name===e))}function c(){const[e,t]=(0,n.K)(),a=(0,i.useCallback)((e=>{o(e)&&(e===s.GC?(r.Z.delete(l.de),t({[l.c4]:null})):(r.Z.set(l.de,e),t({[l.c4]:e})))}),[t]),c=e[l.c4];if(c&&"string"==typeof c)return o(c)?[c,a]:[void 0,a];const u=r.Z.get(l.de);return u&&"string"==typeof u&&o(u)?(a(u),[u,a]):[s.GC,a]}},"./public/app/features/alerting/unified/hooks/useURLSearchParams.ts":(e,t,a)=>{a.d(t,{j:()=>l});var n=a("../../opt/drone/yarncache/react-npm-17.0.2-99ba37d931-b254cc17ce.zip/node_modules/react/index.js"),r=a("./.yarn/__virtual__/react-router-virtual-31642fe47a/3/opt/drone/yarncache/react-router-npm-5.2.1-ea754d7473-7daae084bf.zip/node_modules/react-router/esm/react-router.js"),i=a("./packages/grafana-runtime/src/index.ts");function l(){const{search:e}=(0,r.TH)();return[(0,n.useMemo)((()=>new URLSearchParams(e)),[e]),(0,n.useCallback)(((e,t)=>{i.locationService.partial(e,t)}),[])]}}}]);
//# sourceMappingURL=AlertAmRoutes.cd4ada1146b53ad3284f.js.map