"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8648],{44243:(e,t,n)=>{n.d(t,{x:()=>l});var a=n(76687),r=n(352),i=n(77829);function l(e){const t=(0,r.I0)(),n=(0,a.useRef)(e);n.current=e,(0,a.useEffect)((()=>()=>{t((0,i.e)({cleanupAction:n.current}))}),[t])}},13587:(e,t,n)=>{n.r(t),n.d(t,{default:()=>ht});var a=n(77813),r=n(76687),i=n(27668),l=n(35562),s=n(42384),o=n(51397),c=n(352),d=n(44243),u=n(87925),g=n(80030),m=n(15760),p=n(78391),v=n(55312),h=n(58124),x=n(72721),j=n(56481),f=n(45550),b=n(60521),y=n(62533),C=n(95296),N=n(27091),w=n(9120),I=n(86832),V=n(41681),S=n(13698),$=n(11126),O=n(95513);const M=["",""],_=(e,t)=>Object.entries(null!=e?e:{}).reduce(((e,n)=>{let[a,r]=n;return[...e,{name:a,value:r,operator:t?V._M.regex:V._M.equal}]}),[]),T=(e,t)=>{if(!e)return null!=t?t:M;const[n,a]=e?(0,O.bG)(e):[void 0,void 0],r=O.qr.find((e=>e.value===a));return n&&r?[String(n),r.value]:M},k=e=>e.value,q={name:"",value:"",operator:V._M.equal},P=[{label:"grafana_folder",value:"grafana_folder"},{label:"alertname",value:"alertname"},{label:"Disable (...)",value:"..."}],W={id:"",overrideGrouping:!1,groupBy:["grafana_folder","alertname"],object_matchers:[],routes:[],continue:!1,receiver:"",overrideTimings:!1,groupWaitValue:"",groupWaitValueType:O.qr[0].value,groupIntervalValue:"",groupIntervalValueType:O.qr[0].value,repeatIntervalValue:"",repeatIntervalValueType:O.qr[0].value,muteTimeIntervals:[]},G=e=>{var t,n,a,r,i,l,s,o,c;if(!e)return[W,{}];const d=String(Math.random()),u={[d]:e};if(0===Object.keys(e).length){return[Object.assign({},W,{id:d}),u]}const g=[];null===(t=e.routes)||void 0===t||t.forEach((e=>{const[t,n]=G(e);g.push(t),Object.assign(u,n)}));const m=e.matchers?null!==(n=null===(a=e.matchers)||void 0===a?void 0:a.map((e=>(0,S.cm)((0,S.tC)(e)))))&&void 0!==n?n:[]: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:[],[p,v]=T(e.group_wait,["","s"]),[h,x]=T(e.group_interval,["","m"]),[j,f]=T(e.repeat_interval,["","h"]);return[{id:d,object_matchers:[...m,..._(e.match,!1),..._(e.match_re,!0)],continue:null!==(l=e.continue)&&void 0!==l&&l,receiver:null!==(s=e.receiver)&&void 0!==s?s:"",overrideGrouping:Array.isArray(e.group_by)&&0!==e.group_by.length,groupBy:null!==(o=e.group_by)&&void 0!==o?o:[],overrideTimings:[p,h,j].some(Boolean),groupWaitValue:p,groupWaitValueType:v,groupIntervalValue:h,groupIntervalValueType:x,repeatIntervalValue:j,repeatIntervalValueType:f,routes:g,muteTimeIntervals:null!==(c=e.mute_time_intervals)&&void 0!==c?c:[]},u]},B=(e,t,n)=>{const a=n[t.id],{overrideGrouping:r,groupBy:i,overrideTimings:l,groupWaitValue:s,groupWaitValueType:o,groupIntervalValue:c,groupIntervalValueType:d,repeatIntervalValue:u,repeatIntervalValueType:g}=t,m=r&&i?i:[],p=l&&s?`${s}${o}`:void 0,v=l&&c?`${c}${d}`:void 0,h=l&&u?`${u}${g}`:void 0,x=Object.assign({},null!=a?a:{},{continue:t.continue,group_by:m,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:p,group_interval:v,repeat_interval:h,routes:t.routes.map((t=>B(e,t,n))),mute_time_intervals:t.muteTimeIntervals});return e!==$.GC?(x.matchers=t.object_matchers.map((e=>{let{name:t,operator:n,value:a}=e;return`${t}${n}${a}`})),x.object_matchers=void 0):x.matchers=void 0,t.receiver&&(x.receiver=t.receiver),(0,I.omitBy)(x,I.isUndefined)},A=e=>({label:e,value:e}),E=e=>(null!=e?e:[]).map(A),F=e=>{var t;return e&&null!==(t=k(e))&&void 0!==t?t:""},R=e=>{return e?(null!=(t=e)?t:[]).map(k):[];var t},z=e=>{if(e)return/^\d+$/.test(e)?void 0:"Must be a positive integer."};var L=n(5504);const D=e=>({container:a.css`
      align-items: center;
      display: flex;
      flex-flow: row nowrap;

      & > * + * {
        margin-left: ${e.spacing(1)};
      }
    `,input:a.css`
      flex: 1;
    `,timingContainer:a.css`
      max-width: ${e.spacing(33)};
    `,smallInput:a.css`
      width: ${e.spacing(6.5)};
    `,linkText:a.css`
      text-decoration: underline;
    `,collapse:a.css`
      border: none;
      background: none;
      color: ${e.colors.text.primary};
    `});var J,K,U=n(52010);const Q=["onChange","ref"],Y=["onChange","ref"],Z=["onChange","ref"],X=["onChange","ref"],H=["onChange","ref"];function ee(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}const te=e=>{var t;let{alertManagerSourceName:n,onCancel:l,onSave:s,receivers:o,routes:c}=e;const d=(0,i.wW)(D),[u,g]=(0,r.useState)(!1),[m,p]=(0,r.useState)(E(c.groupBy));return(0,U.jsx)(j.l,{defaultValues:Object.assign({},c,{overrideTimings:!0,overrideGrouping:!0}),onSubmit:s,children:e=>{var r,i,s,c;let{control:h,errors:x,setValue:j}=e;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(f.g,{label:"Default contact point",invalid:!!x.receiver,error:null===(r=x.receiver)||void 0===r?void 0:r.message,children:(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:d.container,"data-testid":"am-receiver-select",children:[(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=ee(e.field,Q);return(0,U.jsx)(y.Ph,Object.assign({"aria-label":"Default contact point"},n,{className:d.input,onChange:e=>t(F(e)),options:o}))},control:h,name:"receiver",rules:{required:{value:!0,message:"Required."}}}),J||(J=(0,U.jsx)("span",{children:"or"})),(0,U.jsx)(C.r,{className:d.linkText,href:(0,L.eQ)("/alerting/notifications/receivers/new",n),children:"Create a contact point"})]})})}),(0,U.jsx)(f.g,{label:"Group by",description:"Group alerts when you receive a notification based on labels.","data-testid":"am-group-select",children:(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=ee(e.field,Y);return(0,U.jsx)(y.NU,Object.assign({"aria-label":"Group by"},n,{allowCustomValue:!0,className:d.input,onCreateOption:e=>{p((t=>[...t,A(e)])),j("groupBy",[...n.value,e])},onChange:e=>t(R(e)),options:[...P,...m]}))},control:h,name:"groupBy"})}),(0,U.jsxs)(N.U,{collapsible:!0,className:d.collapse,isOpen:u,label:"Timing options",onToggle:g,children:[(0,U.jsx)(f.g,{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:!!x.groupWaitValue,error:null===(i=x.groupWaitValue)||void 0===i?void 0:i.message,"data-testid":"am-group-wait",children:(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:(0,a.cx)(d.container,d.timingContainer),children:[(0,U.jsx)(b.g,{render:e=>{let{field:t,fieldState:{invalid:n}}=e;return(0,U.jsx)(w.I,Object.assign({},t,{className:d.smallInput,invalid:n,placeholder:"30"}))},control:h,name:"groupWaitValue",rules:{validate:z}}),(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=ee(e.field,Z);return(0,U.jsx)(y.Ph,Object.assign({},n,{className:d.input,onChange:e=>t(F(e)),options:O.qr,"aria-label":"Group wait type"}))},control:h,name:"groupWaitValueType"})]})})}),(0,U.jsx)(f.g,{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:!!x.groupIntervalValue,error:null===(s=x.groupIntervalValue)||void 0===s?void 0:s.message,"data-testid":"am-group-interval",children:(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:(0,a.cx)(d.container,d.timingContainer),children:[(0,U.jsx)(b.g,{render:e=>{let{field:t,fieldState:{invalid:n}}=e;return(0,U.jsx)(w.I,Object.assign({},t,{className:d.smallInput,invalid:n,placeholder:"5"}))},control:h,name:"groupIntervalValue",rules:{validate:z}}),(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=ee(e.field,X);return(0,U.jsx)(y.Ph,Object.assign({},n,{className:d.input,onChange:e=>t(F(e)),options:O.qr,"aria-label":"Group interval type"}))},control:h,name:"groupIntervalValueType"})]})})}),(0,U.jsx)(f.g,{label:"Repeat interval",description:"The waiting time to resend an alert after they have successfully been sent. Default 4 hours.",invalid:!!x.repeatIntervalValue,error:null===(c=x.repeatIntervalValue)||void 0===c?void 0:c.message,"data-testid":"am-repeat-interval",children:(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:(0,a.cx)(d.container,d.timingContainer),children:[(0,U.jsx)(b.g,{render:e=>{let{field:t,fieldState:{invalid:n}}=e;return(0,U.jsx)(w.I,Object.assign({},t,{className:d.smallInput,invalid:n,placeholder:"4"}))},control:h,name:"repeatIntervalValue",rules:{validate:z}}),(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=ee(e.field,H);return(0,U.jsx)(y.Ph,Object.assign({},n,{className:d.input,menuPlacement:"top",onChange:e=>t(F(e)),options:O.qr,"aria-label":"Repeat interval type"}))},control:h,name:"repeatIntervalValueType"})]})})})]}),(0,U.jsxs)("div",{className:d.container,children:[K||(K=(0,U.jsx)(v.zx,{type:"submit",children:"Save"})),t||(t=(0,U.jsx)(v.zx,{onClick:l,type:"reset",variant:"secondary",fill:"outline",children:"Cancel"}))]})]})}})},ne=e=>({container:a.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:a.css`
      color: ${e.colors.text.primary};
    `,valueCell:a.css`
      color: ${e.colors.text.secondary};
      margin-bottom: ${e.spacing(1)};
    `}),ae=e=>{let{routes:t}=e;const n=(0,i.wW)(ne),a=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,U.jsxs)("div",{className:n.container,children:[(0,U.jsx)("div",{className:n.titleCell,children:"Contact point"}),(0,U.jsx)("div",{className:n.valueCell,"data-testid":"am-routes-root-receiver",children:a}),(0,U.jsx)("div",{className:n.titleCell,children:"Group by"}),(0,U.jsx)("div",{className:n.valueCell,"data-testid":"am-routes-root-group-by",children:r}),(0,U.jsx)("div",{className:n.titleCell,children:"Timings"}),(0,U.jsxs)("div",{className:n.valueCell,"data-testid":"am-routes-root-timings",children:["Group wait: ",l," | Group interval: ",s," | Repeat interval: ",o]})]})};var re,ie;const le=e=>{let{isEditMode:t,onSave:n,onEnterEditMode:a,onExitEditMode:r,receivers:l,routes:s,alertManagerSourceName:o,readOnly:c=!1}=e;const d=(0,i.wW)(se),u=(0,x.Ko)(o);return(0,U.jsxs)("div",{className:d.container,"data-testid":"am-root-route-container",children:[(0,U.jsxs)("div",{className:d.titleContainer,children:[(0,U.jsxs)("h5",{className:d.title,children:["Root policy - ",re||(re=(0,U.jsx)("i",{children:"default for all alerts"}))]}),!t&&!c&&(0,U.jsx)(h.q,{actions:[u.update],children:(0,U.jsx)(v.zx,{icon:"pen",onClick:a,size:"sm",type:"button",variant:"secondary",children:"Edit"})})]}),ie||(ie=(0,U.jsx)("p",{children:"All alerts will go to the default contact point, unless you set additional matchers in the specific routing area."})),t?(0,U.jsx)(te,{alertManagerSourceName:o,onCancel:r,onSave:n,receivers:l,routes:s}):(0,U.jsx)(ae,{routes:s})]})},se=e=>({container:a.css`
      background-color: ${e.colors.background.secondary};
      color: ${e.colors.text.secondary};
      padding: ${e.spacing(2)};
    `,titleContainer:a.css`
      color: ${e.colors.text.primary};
      display: flex;
      flex-flow: row nowrap;
    `,title:a.css`
      flex: 100%;
    `});var oe=n(93308),ce=n(13627),de=n(39756),ue=n(69369),ge=n(62801);const me=e=>{let{children:t}=e;const n=(0,i.yK)(pe);return(0,U.jsx)("div",{className:n.container,children:t})},pe=e=>({container:a.css`
      background-color: ${e.colors.bg2};
      color: ${e.colors.textSemiWeak};
      padding: ${e.spacing.xl};
      text-align: center;
    `}),ve=e=>{let{buttonIcon:t,buttonLabel:n,buttonSize:a="lg",buttonVariant:r="primary",onButtonClick:l,text:s,href:o,showButton:c=!0}=e;const d=(0,i.yK)(he),u={className:d.button,icon:t,size:a,variant:r};return(0,U.jsx)(me,{children:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{className:d.text,children:s}),c&&(o?(0,U.jsx)(v.Qj,Object.assign({href:o,type:"button"},u,{children:n})):(0,U.jsx)(v.zx,Object.assign({onClick:l,type:"button"},u,{children:n})))]})})},he=e=>({container:a.css`
      background-color: ${e.colors.bg2};
      color: ${e.colors.textSemiWeak};
      padding: ${e.spacing.xl};
      text-align: center;
    `,text:a.css`
      margin-bottom: ${e.spacing.md};
    `,button:a.css`
      margin: ${e.spacing.md} 0 ${e.spacing.sm};
    `});var xe=n(24202),je=n(7053),fe=n(2338),be=n(97867);var ye=n(24301),Ce=n(22179),Ne=n(17435),we=n(94903),Ie=n(46286),Ve=n(27121),Se=n(84362),$e=n(97758),Oe=n(7566);const Me=["onChange","ref"],_e=["onChange","ref"],Te=["onChange","ref"],ke=["onChange","ref"],qe=["onChange","ref"],Pe=["onChange","ref"],We=["onChange","ref"];var Ge,Be;function Ae(e,t){if(null==e)return{};var n,a,r={},i=Object.keys(e);for(a=0;a<i.length;a++)n=i[a],t.indexOf(n)>=0||(r[n]=e[n]);return r}const Ee=e=>{var t;let{onCancel:n,onSave:l,receivers:s,routes:o}=e;const c=(0,i.wW)(Fe),d=(0,i.wW)(D),[u,g]=(0,r.useState)(E(o.groupBy)),m=function(){const e=(0,$e.k)("notification"),[t]=(0,Se.k)(e),n=(0,Oe._)((e=>e.amConfigs));return(0,r.useMemo)((()=>{var e,a,r;const{result:i}=t&&n[t]||Ve.oq,l=null!==(e=null==i?void 0:i.alertmanager_config)&&void 0!==e?e:{};return null!==(a=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,S.uK)(e))).join(", AND ")}))))&&void 0!==a?a:[]}),[t,n])}();return(0,U.jsx)(j.l,{defaultValues:o,onSubmit:l,children:e=>{var r,i,l;let{control:o,register:p,errors:h,setValue:x,watch:j}=e;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("input",Object.assign({type:"hidden"},p("id"))),(0,U.jsx)(Ne.F,{name:"object_matchers",control:o,children:e=>{let{fields:t,append:n,remove:a}=e;return(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)(je.wc,{justify:"flex-start",spacing:"md",children:[Ge||(Ge=(0,U.jsx)("div",{children:"Matching labels"})),0===t.length&&(0,U.jsx)(we.C,{color:"orange",className:c.noMatchersWarning,icon:"exclamation-triangle",text:"If no matchers are specified, this notification policy will handle all alert instances."}),t.length>0&&(0,U.jsx)("div",{className:c.matchersContainer,children:t.map(((e,t)=>{var n,r,i,l,s,d,u,g,m,v;const x=`object_matchers[${t}]`;return(0,U.jsxs)(je.Lh,{align:"flex-start",height:"auto",children:[(0,U.jsx)(f.g,{label:"Label",invalid:!(null===(n=h.object_matchers)||void 0===n||null===(r=n[t])||void 0===r||!r.name),error:null===(i=h.object_matchers)||void 0===i||null===(l=i[t])||void 0===l||null===(s=l.name)||void 0===s?void 0:s.message,children:(0,U.jsx)(w.I,Object.assign({},p(`${x}.name`,{required:"Field is required"}),{defaultValue:e.name,placeholder:"label"}))}),(0,U.jsx)(f.g,{label:"Operator",children:(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=Ae(e.field,Me);return(0,U.jsx)(y.Ph,Object.assign({},n,{className:c.matchersOperator,onChange:e=>t(null==e?void 0:e.value),options:S.tA,"aria-label":"Operator"}))},defaultValue:e.operator,control:o,name:`${x}.operator`,rules:{required:{value:!0,message:"Required."}}})}),(0,U.jsx)(f.g,{label:"Value",invalid:!(null===(d=h.object_matchers)||void 0===d||null===(u=d[t])||void 0===u||!u.value),error:null===(g=h.object_matchers)||void 0===g||null===(m=g[t])||void 0===m||null===(v=m.value)||void 0===v?void 0:v.message,children:(0,U.jsx)(w.I,Object.assign({},p(`${x}.value`,{required:"Field is required"}),{defaultValue:e.value,placeholder:"value"}))}),(0,U.jsx)(fe.h,{className:c.removeButton,tooltip:"Remove matcher",name:"trash-alt",onClick:()=>a(t),children:"Remove"})]},e.id)}))}),(0,U.jsx)(v.zx,{className:c.addMatcherBtn,icon:"plus",onClick:()=>n(q),variant:"secondary",type:"button",children:"Add matcher"})]})})}}),(0,U.jsx)(f.g,{label:"Contact point",children:(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=Ae(e.field,_e);return(0,U.jsx)(y.Ph,Object.assign({"aria-label":"Contact point"},n,{className:d.input,onChange:e=>t(F(e)),options:s}))},control:o,name:"receiver"})}),(0,U.jsx)(f.g,{label:"Continue matching subsequent sibling nodes",children:(0,U.jsx)(Ie.r,Object.assign({id:"continue-toggle"},p("continue")))}),(0,U.jsx)(f.g,{label:"Override grouping",children:(0,U.jsx)(Ie.r,Object.assign({id:"override-grouping-toggle"},p("overrideGrouping")))}),j().overrideGrouping&&(0,U.jsx)(f.g,{label:"Group by",description:"Group alerts when you receive a notification based on labels. If empty it will be inherited from the parent policy.",children:(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=Ae(e.field,Te);return(0,U.jsx)(y.NU,Object.assign({"aria-label":"Group by"},n,{allowCustomValue:!0,className:d.input,onCreateOption:e=>{g((t=>[...t,A(e)])),x("groupBy",[...n.value,e])},onChange:e=>t(R(e)),options:[...P,...u]}))},control:o,name:"groupBy"})}),(0,U.jsx)(f.g,{label:"Override general timings",children:(0,U.jsx)(Ie.r,Object.assign({id:"override-timings-toggle"},p("overrideTimings")))}),j().overrideTimings&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(f.g,{label:"Group wait",description:"The waiting time until the initial notification is sent for a new group created by an incoming alert. If empty it will be inherited from the parent policy.",invalid:!!h.groupWaitValue,error:null===(r=h.groupWaitValue)||void 0===r?void 0:r.message,children:(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:(0,a.cx)(d.container,d.timingContainer),children:[(0,U.jsx)(b.g,{render:e=>{let{field:t,fieldState:{invalid:n}}=e;return(0,U.jsx)(w.I,Object.assign({},t,{className:d.smallInput,invalid:n,"aria-label":"Group wait value"}))},control:o,name:"groupWaitValue",rules:{validate:z}}),(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=Ae(e.field,ke);return(0,U.jsx)(y.Ph,Object.assign({},n,{className:d.input,onChange:e=>t(F(e)),options:O.qr,"aria-label":"Group wait type"}))},control:o,name:"groupWaitValueType"})]})})}),(0,U.jsx)(f.g,{label:"Group interval",description:"The waiting time to send a batch of new alerts for that group after the first notification was sent. If empty it will be inherited from the parent policy.",invalid:!!h.groupIntervalValue,error:null===(i=h.groupIntervalValue)||void 0===i?void 0:i.message,children:(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:(0,a.cx)(d.container,d.timingContainer),children:[(0,U.jsx)(b.g,{render:e=>{let{field:t,fieldState:{invalid:n}}=e;return(0,U.jsx)(w.I,Object.assign({},t,{className:d.smallInput,invalid:n,"aria-label":"Group interval value"}))},control:o,name:"groupIntervalValue",rules:{validate:z}}),(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=Ae(e.field,qe);return(0,U.jsx)(y.Ph,Object.assign({},n,{className:d.input,onChange:e=>t(F(e)),options:O.qr,"aria-label":"Group interval type"}))},control:o,name:"groupIntervalValueType"})]})})}),(0,U.jsx)(f.g,{label:"Repeat interval",description:"The waiting time to resend an alert after they have successfully been sent.",invalid:!!h.repeatIntervalValue,error:null===(l=h.repeatIntervalValue)||void 0===l?void 0:l.message,children:(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)("div",{className:(0,a.cx)(d.container,d.timingContainer),children:[(0,U.jsx)(b.g,{render:e=>{let{field:t,fieldState:{invalid:n}}=e;return(0,U.jsx)(w.I,Object.assign({},t,{className:d.smallInput,invalid:n,"aria-label":"Repeat interval value"}))},control:o,name:"repeatIntervalValue",rules:{validate:z}}),(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=Ae(e.field,Pe);return(0,U.jsx)(y.Ph,Object.assign({},n,{className:d.input,menuPlacement:"top",onChange:e=>t(F(e)),options:O.qr,"aria-label":"Repeat interval type"}))},control:o,name:"repeatIntervalValueType"})]})})})]}),(0,U.jsx)(f.g,{label:"Mute timings","data-testid":"am-mute-timing-select",description:"Add mute timing to policy",invalid:!!h.muteTimeIntervals,children:(0,U.jsx)(b.g,{render:e=>{let{field:{onChange:t}}=e,n=Ae(e.field,We);return(0,U.jsx)(y.NU,Object.assign({"aria-label":"Mute timings"},n,{className:d.input,onChange:e=>t(R(e)),options:m}))},control:o,name:"muteTimeIntervals"})}),(0,U.jsxs)("div",{className:c.buttonGroup,children:[Be||(Be=(0,U.jsx)(v.zx,{type:"submit",children:"Save policy"})),t||(t=(0,U.jsx)(v.zx,{onClick:n,fill:"outline",type:"button",variant:"secondary",children:"Cancel"}))]})]})}})},Fe=e=>{const t=e.spacing(3.5);return{addMatcherBtn:a.css`
      margin-bottom: ${t};
    `,matchersContainer:a.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:a.css`
      min-width: 140px;
    `,nestedPolicies:a.css`
      margin-top: ${t};
    `,removeButton:a.css`
      margin-left: ${e.spacing(1)};
      margin-top: ${e.spacing(2.5)};
    `,buttonGroup:a.css`
      margin: ${e.spacing(6)} 0 ${t};

      & > * + * {
        margin-left: ${e.spacing(1.5)};
      }
    `,noMatchersWarning:a.css`
      padding: ${e.spacing(1)} ${e.spacing(2)};
    `}};var Re,ze,Le,De,Je,Ke,Ue,Qe,Ye=n(68175);const Ze=e=>{var t,n;let{alertManagerSourceName:a,muteTimingNames:l,hideActions:s}=e;const o=(0,i.wW)(He),d=(0,c.I0)(),u=(0,x.Ko)(a),g=(0,Oe._)((e=>e.amConfigs)),[m,j]=(0,r.useState)(""),{result:f}=a&&g[a]||Ve.oq,b=(0,r.useMemo)((()=>{var e,t,n,a;const r=null!==(e=null==f||null===(t=f.alertmanager_config)||void 0===t?void 0:t.mute_time_intervals)&&void 0!==e?e:[],i=null!==(n=null==f||null===(a=f.alertmanager_config)||void 0===a?void 0:a.muteTimeProvenances)&&void 0!==n?n:{};return r.filter((e=>{let{name:t}=e;return!l||l.includes(t)})).map((e=>({id:e.name,data:Object.assign({},e,{provenance:i[e.name]})})))}),[null==f||null===(t=f.alertmanager_config)||void 0===t?void 0:t.mute_time_intervals,null==f||null===(n=f.alertmanager_config)||void 0===n?void 0:n.muteTimeProvenances,l]),y=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;const a=(0,x.Ko)(e),i=ue.Vt.hasPermission(a.update),l=ue.Vt.hasPermission(a.delete),s=!t&&(i||l);return(0,r.useMemo)((()=>{const t=[{id:"name",label:"Name",renderCell:function(e){let{data:t}=e;return(0,U.jsxs)(U.Fragment,{children:[t.name," ",t.provenance&&(De||(De=(0,U.jsx)(p.C0,{})))]})},size:"250px"},{id:"timeRange",label:"Time range",renderCell:e=>{let{data:t}=e;return Xe(t.time_intervals)}}];return s&&t.push({id:"actions",label:"Actions",renderCell:function(t){let{data:r}=t;return r.provenance?(0,U.jsx)("div",{children:(0,U.jsx)(C.r,{href:(0,L.eQ)("/alerting/routes/mute-timing/edit",e,{muteName:r.name}),children:Je||(Je=(0,U.jsx)(fe.h,{name:"file-alt",title:"View mute timing"}))})}):(0,U.jsxs)("div",{children:[(0,U.jsx)(h.q,{actions:[a.update],children:(0,U.jsx)(C.r,{href:(0,L.eQ)("/alerting/routes/mute-timing/edit",e,{muteName:r.name}),children:Ke||(Ke=(0,U.jsx)(fe.h,{name:"edit",title:"Edit mute timing"}))})}),(0,U.jsx)(h.q,{actions:[a.delete],children:(0,U.jsx)(fe.h,{name:"trash-alt",title:"Delete mute timing",onClick:()=>n(r.name)})})]})},size:"100px"}),t}),[e,n,s,a])}(a,s,j);return(0,U.jsxs)("div",{className:o.container,children:[!s&&(Re||(Re=(0,U.jsx)("h5",{children:"Mute timings"}))),!s&&(ze||(ze=(0,U.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&&b.length>0&&(0,U.jsx)(h.q,{actions:[u.create],children:(0,U.jsx)(v.Qj,{className:o.addMuteButton,icon:"plus",variant:"primary",href:(0,L.eQ)("alerting/routes/mute-timing/new",a),children:"New mute timing"})}),b.length>0?(0,U.jsx)(ye.t,{items:b,cols:y}):s?Le||(Le=(0,U.jsx)("p",{children:"No mute timings configured"})):(0,U.jsx)(ve,{text:"You haven't created any mute timings yet",buttonLabel:"Add mute timing",buttonIcon:"plus",buttonSize:"lg",href:(0,L.eQ)("alerting/routes/mute-timing/new",a),showButton:ue.Vt.hasPermission(u.create)}),!s&&(0,U.jsx)(be.s,{isOpen:!!m,title:"Delete mute timing",body:`Are you sure you would like to delete "${m}"`,confirmText:"Delete",onConfirm:()=>d((0,Ye.r0)(a,m)),onDismiss:()=>j("")})]})};function Xe(e){return e.map(((e,t)=>{const{times:n,weekdays:a,days_of_month:i,months:l,years:s}=e,o=(0,S.u6)(n),c=(0,S.v7)(a),d=(0,S.J8)(i),u=(0,S.m8)(l),g=(0,S.qw)(s);return(0,U.jsxs)(r.Fragment,{children:[`${o} ${c}`,Ue||(Ue=(0,U.jsx)("br",{})),[d,u,g].join(" | "),Qe||(Qe=(0,U.jsx)("br",{}))]},JSON.stringify(e)+t)}))}const He=e=>({container:a.css`
    display: flex;
    flex-flow: column nowrap;
  `,addMuteButton:a.css`
    margin-bottom: ${e.spacing(2)};
    align-self: flex-end;
  `});var et;const tt=e=>{let{onChange:t,receivers:n,routes:a,readOnly:l=!1,alertManagerSourceName:s}=e;const o=(0,i.wW)(nt),c=(0,i.wW)(ne),d=(0,x.Ko)(s),u=a.groupWaitValue?`${a.groupWaitValue}${a.groupWaitValueType}`:"-",g=a.groupIntervalValue?`${a.groupIntervalValue}${a.groupIntervalValueType}`:"-",m=a.repeatIntervalValue?`${a.repeatIntervalValue}${a.repeatIntervalValueType}`:"-",[p,j]=(0,r.useState)(a.routes),[f,b]=(0,r.useState)(!1);return(0,U.jsxs)("div",{className:c.container,children:[(0,U.jsx)("div",{className:c.titleCell,children:"Group wait"}),(0,U.jsx)("div",{className:c.valueCell,children:u}),(0,U.jsx)("div",{className:c.titleCell,children:"Group interval"}),(0,U.jsx)("div",{className:c.valueCell,children:g}),(0,U.jsx)("div",{className:c.titleCell,children:"Repeat interval"}),(0,U.jsx)("div",{className:c.valueCell,children:m}),(0,U.jsx)("div",{className:c.titleCell,children:"Nested policies"}),(0,U.jsxs)("div",{className:c.valueCell,children:[p.length?(0,U.jsx)(lt,{isAddMode:f,onCancelAdd:()=>{b(!1),j((e=>{const t=[...e];return t.pop(),t}))},onChange:e=>{t(Object.assign({},a,{routes:e})),f&&b(!1)},receivers:n,routes:p,alertManagerSourceName:s}):et||(et=(0,U.jsx)("p",{children:"No nested policies configured."})),!f&&!l&&(0,U.jsx)(h.q,{actions:[d.create],children:(0,U.jsx)(v.zx,{className:o.addNestedRoutingBtn,icon:"plus",onClick:()=>{j((e=>[...e,W])),b(!0)},variant:"secondary",type:"button",children:"Add nested policy"})})]}),(0,U.jsx)("div",{className:c.titleCell,children:"Mute timings"}),(0,U.jsx)("div",{className:c.valueCell,children:(0,U.jsx)(Ze,{alertManagerSourceName:s,muteTimingNames:a.muteTimeIntervals,hideActions:!0})})]})},nt=e=>({addNestedRoutingBtn:a.css`
      margin-top: ${e.spacing(2)};
    `});var at,rt;const it=(e,t)=>{const n=[...e],a=n.findIndex((e=>e.id===t.id));return a>=0&&(n[a]=Object.assign({},n[a],t)),n},lt=e=>{let{isAddMode:t,onCancelAdd:n,onChange:a,receivers:i,routes:l,filters:s,readOnly:o=!1,alertManagerSourceName:c}=e;const[d,u]=(0,r.useState)(!1),[g,m]=(0,r.useState)(void 0),[p,h]=(0,r.useState)(),j=(0,x.Ko)(c),f=ue.Vt.hasPermission(j.update),b=ue.Vt.hasPermission(j.delete),y=!o&&(f||b),C=(0,r.useCallback)((e=>h(e.id)),[]),N=(0,r.useCallback)((()=>h(void 0)),[]),w=[{id:"matchingCriteria",label:"Matching labels",renderCell:e=>e.data.object_matchers.length?(0,U.jsx)(Ce.g,{matchers:e.data.object_matchers.map(S._J)}):at||(at=(0,U.jsx)("span",{children:"Matches all alert instances"})),size:10},{id:"groupBy",label:"Group by",renderCell:e=>e.data.overrideGrouping&&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},...y?[{id:"actions",label:"Actions",renderCell:e=>{if(e.renderExpandedContent)return null;return(0,U.jsx)(U.Fragment,{children:(0,U.jsxs)(je.Lh,{children:[(0,U.jsx)(v.zx,{"aria-label":"Edit route",icon:"pen",onClick:()=>{C(e),u(!0)},size:"sm",type:"button",variant:"secondary",children:"Edit"}),(0,U.jsx)(fe.h,{"aria-label":"Delete route",name:"trash-alt",onClick:()=>{m(e.data.id)},type:"button"})]})})},size:"100px"}]:[]],V=(0,r.useMemo)((()=>((e,t,n)=>{const a=(0,S.Zh)(null!=t?t:"");let r=e;return a.length&&(r=e.filter((e=>{const t=e.object_matchers.map(S._J);return(0,I.intersectionWith)(t,a,I.isEqual).length>0}))),n&&n.length>0&&(r=r.filter((e=>e.receiver.toLowerCase().includes(n.toLowerCase())))),r})(l,null==s?void 0:s.queryString,null==s?void 0:s.contactPoint)),[l,s]),$=(0,r.useMemo)((()=>{return(t?l:V).map(((t,n)=>{var a;return{id:null!==(a=null==e?void 0:e(t))&&void 0!==a?a:n,data:t}}));var e}),[t,l,V]);return(0,r.useEffect)((()=>{t&&$.length&&h($[$.length-1].id),!t&&$.length&&h(void 0)}),[t,$]),l.length>0&&0===V.length?rt||(rt=(0,U.jsx)(me,{children:(0,U.jsx)("p",{children:"No policies found"})})):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(ye.t,{cols:w,isExpandable:!0,items:$,testIdGenerator:()=>"am-routes-row",onCollapse:N,onExpand:C,isExpanded:e=>p===e.id,renderExpandedContent:e=>t||d?(0,U.jsx)(Ee,{onCancel:()=>{t&&n(),u(!1)},onSave:e=>{const t=it(l,e);u(!1),a(t)},receivers:i,routes:e.data}):(0,U.jsx)(tt,{onChange:e=>{const t=it(l,e);a(t)},receivers:i,routes:e.data,readOnly:o,alertManagerSourceName:c})}),(0,U.jsx)(be.s,{isOpen:!!g,title:"Delete notification policy",body:"Deleting this notification policy will permanently remove it. Are you sure you want to delete this policy?",confirmText:"Yes, delete",icon:"exclamation-triangle",onConfirm:()=>{if(g){const e=((e,t)=>e.filter((e=>e.id!==t)))(l,g);a(e),m(void 0)}},onDismiss:()=>m(void 0)})]})};var st,ot,ct,dt,ut,gt;const mt=e=>{var t,n;let{alertManagerSourceName:a,onChange:l,onRootRouteEdit:s,receivers:o,routes:c,readOnly:d=!1}=e;const[u,g]=(0,r.useState)([...c.routes]),[m,p]=(0,r.useState)(!1),j=(0,x.Ko)(a),f=ue.Vt.hasPermission(j.create),[b,y]=(0,ge.j)(),{queryString:C,contactPoint:N}=(0,L.$f)(b),[I,V]=(0,r.useState)({queryString:C,contactPoint:N});(0,oe.Z)((()=>{y({queryString:I.queryString,contactPoint:I.contactPoint})}),400,[I]);const S=(0,i.wW)(pt),$=()=>{V({queryString:void 0,contactPoint:void 0}),y({queryString:void 0,contactPoint:void 0})},O=()=>{$(),p(!0),g((()=>[...c.routes,Object.assign({},W,{matchers:[q]})]))};return(0,U.jsxs)("div",{className:S.container,children:[st||(st=(0,U.jsx)("h5",{children:"Specific routing"})),ot||(ot=(0,U.jsx)("p",{children:"Send specific alerts to chosen contact points, based on matching criteria"})),c.receiver?u.length>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)("div",{children:[!m&&(0,U.jsxs)("div",{className:S.searchContainer,children:[(0,U.jsx)(xe.F,{onFilterChange:e=>V((t=>Object.assign({},t,{queryString:e}))),defaultQueryString:null!==(t=I.queryString)&&void 0!==t?t:"",className:S.filterInput}),(0,U.jsxs)("div",{className:S.filterInput,children:[dt||(dt=(0,U.jsx)(ce._,{children:"Search by contact point"})),(0,U.jsx)(w.I,{onChange:e=>{let{currentTarget:t}=e;return V((e=>Object.assign({},e,{contactPoint:t.value})))},value:null!==(n=I.contactPoint)&&void 0!==n?n:"",placeholder:"Search by contact point","data-testid":"search-query-input",prefix:ut||(ut=(0,U.jsx)(de.J,{name:"search"}))})]}),(C||N)&&(0,U.jsx)(v.zx,{variant:"secondary",icon:"times",onClick:$,className:S.clearFilterBtn,children:"Clear filters"})]}),!m&&!d&&(0,U.jsx)(h.q,{actions:[j.create],children:(0,U.jsx)("div",{className:S.addMatcherBtnRow,children:(0,U.jsx)(v.zx,{className:S.addMatcherBtn,icon:"plus",onClick:O,type:"button",children:"New policy"})})})]}),(0,U.jsx)(lt,{isAddMode:m,readOnly:d,onCancelAdd:()=>{p(!1),g([...c.routes])},onChange:e=>{l(Object.assign({},c,{routes:e})),m&&p(!1)},receivers:o,routes:u,filters:{queryString:C,contactPoint:N},alertManagerSourceName:a})]}):d?gt||(gt=(0,U.jsx)(me,{children:(0,U.jsx)("p",{children:"There are no specific policies configured."})})):(0,U.jsx)(ve,{buttonIcon:"plus",buttonLabel:"New specific policy",onButtonClick:O,text:"You haven't created any specific policies yet.",showButton:f}):d?ct||(ct=(0,U.jsx)(me,{children:(0,U.jsx)("p",{children:"There is no default contact point configured for the root route."})})):(0,U.jsx)(ve,{buttonIcon:"rocket",buttonLabel:"Set a default contact point",onButtonClick:s,text:"You haven't set a default contact point for the root route yet.",showButton:f})]})},pt=e=>({container:a.css`
      display: flex;
      flex-flow: column wrap;
    `,searchContainer:a.css`
      display: flex;
      flex-flow: row nowrap;
      padding-bottom: ${e.spacing(2)};
      border-bottom: 1px solid ${e.colors.border.strong};
    `,clearFilterBtn:a.css`
      align-self: flex-end;
      margin-left: ${e.spacing(1)};
    `,filterInput:a.css`
      width: 340px;
      & + & {
        margin-left: ${e.spacing(1)};
      }
    `,addMatcherBtnRow:a.css`
      display: flex;
      flex-flow: column nowrap;
      padding: ${e.spacing(2)} 0;
    `,addMatcherBtn:a.css`
      align-self: flex-end;
    `});var vt;const ht=(0,o.Pf)((()=>{var e;const t=(0,c.I0)(),n=(0,i.wW)(xt),[a,o]=(0,r.useState)(!1),v=(0,$e.k)("notification"),[h,x]=(0,Se.k)(v),j=(0,Oe._)((e=>e.amConfigs)),f=(0,r.useCallback)((()=>{h&&t((0,Ye.Yh)(h))}),[h,t]);(0,r.useEffect)((()=>{f()}),[f]);const{result:b,loading:y,error:C}=h&&j[h]||Ve.oq,N=null==b?void 0:b.alertmanager_config,[w,I]=(0,r.useMemo)((()=>G(null==N?void 0:N.route)),[null==N?void 0:N.route]),V=E((null!==(e=null==N?void 0:N.receivers)&&void 0!==e?e:[]).map((e=>e.name))),S=(0,r.useMemo)((()=>{var e;return Boolean(null==N||null===(e=N.route)||void 0===e?void 0:e.provenance)}),[null==N?void 0:N.route]),O=()=>{o(!0)},M=()=>{o(!1)};(0,d.x)((e=>e.unifiedAlerting.saveAMConfig=Ve.oq));const _=e=>{if(!b)return;const n=B(h,Object.assign({},w,e),I);a&&M(),t((0,Ye.mM)({newConfig:Object.assign({},b,{alertmanager_config:Object.assign({},b.alertmanager_config,{route:n})}),oldConfig:b,alertManagerSourceName:h,successMessage:"Saved",refetch:!0}))};if(!h)return(0,U.jsx)(g.J,{pageId:"am-routes",children:(0,U.jsx)(m.I,{availableAlertManagers:v})});const T=!h||((0,$.RY)(h)||S);return(0,U.jsxs)(g.J,{pageId:"am-routes",children:[(0,U.jsx)(u.P,{current:h,onChange:x,dataSources:v}),C&&!y&&(0,U.jsx)(l.b,{severity:"error",title:"Error loading Alertmanager config",children:C.message||"Unknown error."}),S&&(0,U.jsx)(p.Xq,{resource:p.Uv.RootNotificationPolicy}),y&&(vt||(vt=(0,U.jsx)(s.u,{text:"Loading Alertmanager config..."}))),b&&!y&&!C&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(le,{readOnly:T,alertManagerSourceName:h,isEditMode:a,onSave:_,onEnterEditMode:O,onExitEditMode:M,receivers:V,routes:w}),(0,U.jsx)("div",{className:n.break}),(0,U.jsx)(mt,{alertManagerSourceName:h,onChange:_,readOnly:T,onRootRouteEdit:O,receivers:V,routes:w}),(0,U.jsx)("div",{className:n.break}),(0,U.jsx)(Ze,{alertManagerSourceName:h})]})]})}),{style:"page"}),xt=e=>({break:a.css`
    width: 100%;
    height: 0;
    margin-bottom: ${e.spacing(2)};
  `})},99355:(e,t,n)=>{n.d(t,{z:()=>a});const a={filterByLabel:"filtering alert instances by label",loadedList:"loaded Alert Rules list",leavingRuleGroupEdit:"leaving rule group edit without saving"}},80030:(e,t,n)=>{n.d(t,{J:()=>i});n(76687);var a=n(28781),r=n(52010);const i=e=>{let{children:t,pageId:n,pageNav:i,isLoading:l}=e;return(0,r.jsx)(a.T,{pageNav:i,navId:n,children:(0,r.jsx)(a.T.Contents,{isLoading:l,children:t})})}},58124:(e,t,n)=>{n.d(t,{q:()=>i});n(76687);var a=n(69369),r=n(52010);const i=e=>{let{actions:t,children:n,fallback:i=!0}=e;return t.some((e=>a.Vt.hasAccess(e,i)))?(0,r.jsx)(r.Fragment,{children:n}):null}},15760:(e,t,n)=>{n.d(t,{I:()=>m});n(76687);var a,r,i,l,s=n(35562),o=n(84362),c=n(87925),d=n(52010);const u=()=>a||(a=(0,d.jsx)(s.b,{title:"No Alertmanager found",severity:"warning",children:"We could not find any external Alertmanagers and you may not have access to the built-in Grafana Alertmanager."})),g=()=>r||(r=(0,d.jsx)(s.b,{title:"Selected Alertmanager not found. Select a different Alertmanager.",severity:"warning",children:"Selected Alertmanager no longer exists or you may not have permission to access it."})),m=e=>{let{availableAlertManagers:t}=e;const[n,a]=(0,o.k)(t),r=t.length>0;return(0,d.jsx)("div",{children:r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c.P,{onChange:a,dataSources:t}),i||(i=(0,d.jsx)(g,{}))]}):l||(l=(0,d.jsx)(u,{}))})}},78391:(e,t,n)=>{n.d(t,{C0:()=>c,Uv:()=>s,Xq:()=>o});n(76687);var a,r=n(35562),i=n(94903),l=n(52010);let s;!function(e){e.ContactPoint="contact point",e.Template="template",e.MuteTiming="mute timing",e.AlertRule="alert rule",e.RootNotificationPolicy="root notification policy"}(s||(s={}));const o=e=>{let{resource:t}=e;return(0,l.jsxs)(r.b,{title:`This ${t} cannot be edited through the UI`,severity:"info",children:["This ",t," has been provisioned, that means it was created by config. Please contact your server admin to update this ",t,"."]})},c=()=>a||(a=(0,l.jsx)(i.C,{text:"Provisioned",color:"purple"}))},24202:(e,t,n)=>{n.d(t,{F:()=>j});var a,r,i,l=n(77813),s=n(86832),o=n(76687),c=n(95129),d=n(58490),u=n(27668),g=n(39756),m=n(13627),p=n(33097),v=n(9120),h=n(99355),x=n(52010);const j=e=>{let{className:t,onFilterChange:n,defaultQueryString:l}=e;const j=(0,u.wW)(f),b=(0,o.useMemo)((()=>(0,s.debounce)((e=>{(0,d.PN)(h.z.filterByLabel);const t=e.target;n(t.value)}),600)),[n]);(0,o.useEffect)((()=>b.cancel()),[b]);const y=a||(a=(0,x.jsx)(g.J,{name:"search"}));return(0,x.jsxs)("div",{className:t,children:[(0,x.jsx)(m._,{children:(0,x.jsxs)(c.Stack,{gap:.5,children:[r||(r=(0,x.jsx)("span",{children:"Search by label"})),(0,x.jsx)(p.u,{content:i||(i=(0,x.jsxs)("div",{children:["Filter alerts using label querying, ex:",(0,x.jsx)("pre",{children:'{severity="critical", instance=~"cluster-us-.+"}'})]})),children:(0,x.jsx)(g.J,{className:j.icon,name:"info-circle",size:"sm"})})]})}),(0,x.jsx)(v.I,{placeholder:"Search",defaultValue:l,onChange:b,"data-testid":"search-query-input",prefix:y,className:j.inputWidth})]})},f=e=>({icon:l.css`
    margin-right: ${e.spacing(.5)};
  `,inputWidth:l.css`
    width: 340px;
    flex-grow: 0;
  `})},22179:(e,t,n)=>{n.d(t,{g:()=>o});var a=n(77813),r=(n(76687),n(27668)),i=n(28489),l=n(13698),s=n(52010);const o=e=>{let{matchers:t}=e;const n=(0,r.wW)(c);return(0,s.jsx)("div",{children:(0,s.jsx)(i.P,{className:n.tags,tags:t.map((e=>`${e.name}${(0,l.zy)(e)}${e.value}`))})})},c=()=>({tags:a.css`
    justify-content: flex-start;
  `})},84362:(e,t,n)=>{n.d(t,{k:()=>o});var a=n(76687),r=n(95609),i=n(22814),l=n(73285),s=n(11126);function o(e){const[t,n]=(0,r.K)(),o=function(e){return(0,a.useCallback)((t=>e.map((e=>e.name)).includes(t)),[e])}(e),c=(0,a.useCallback)((e=>{o(e)&&(e===s.GC?(i.Z.delete(l.de),n({[l.c4]:null})):(i.Z.set(l.de,e),n({[l.c4]:e})))}),[n,o]),d=t[l.c4];if(d&&"string"==typeof d)return o(d)?[d,c]:[void 0,c];const u=i.Z.get(l.de);return u&&"string"==typeof u&&o(u)?(c(u),[u,c]):o(s.GC)?[s.GC,c]:[void 0,c]}},97758:(e,t,n)=>{n.d(t,{k:()=>i});var a=n(76687),r=n(11126);function i(e){return(0,a.useMemo)((()=>(0,r.LE)(e)),[e])}},62801:(e,t,n)=>{n.d(t,{j:()=>l});var a=n(76687),r=n(63322),i=n(49622);function l(){const{search:e}=(0,r.TH)();return[(0,a.useMemo)((()=>new URLSearchParams(e)),[e]),(0,a.useCallback)(((e,t)=>{i.E1.partial(e,t)}),[])]}}}]);
//# sourceMappingURL=AlertAmRoutes.d016695a316c64a5fe1f.js.map