"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4501,1488],{36333:(Y,N,i)=>{i.r(N),i.d(N,{default:()=>va,useMuteTimingNavData:()=>ia});var a=i(96540),v=i(24180),P=i(42418),T=i(83277),R=i(33450),f=i(32196),k=i(49785),$=i(40845),g=i(39558),M=i(84167),p=i(88575),E=i(10354),b=i(55852),G=i(80348),F=i(51488),O=i(70383),w=i(23770),W=i(98164),U=i(56361),C=i(2543);const B=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],z=["january","february","march","april","may","june","july","august","september","october","november","december"],S={times:[{start_time:"",end_time:""}],weekdays:"",days_of_month:"",months:"",years:"",location:""},x=(e,n,t)=>e?e.split(",").map(o=>o.trim()).every(o=>o.split(":").every(n))||t:!0,V=e=>e?e.split(",").map(n=>n.trim()):void 0,ta=e=>{const n=e.time_intervals.map(({times:t,weekdays:o,days_of_month:l,months:u,years:h,location:s})=>{const r={times:t.filter(({start_time:c,end_time:m})=>!!c&&!!m),weekdays:V(o)?.map(c=>c.toLowerCase()),days_of_month:V(l),months:V(u),years:V(h),location:s||void 0};return(0,C.omitBy)(r,C.isUndefined)});return{name:e.name,time_intervals:n}};var Q=i(48205),Z=i(67061),J=i(14578),ra=i(39268),X=i(14186),na=i(29158),j=i(4724);const q="Times must be between 00:00 and 24:00 UTC",oa=({intervalIndex:e})=>{const n=(0,$.of)(sa),{register:t,formState:o,getValues:l}=(0,k.xW)(),{fields:u,append:h,remove:s}=(0,k.jz)({name:`time_intervals.${e}.times`}),r=o.errors.time_intervals?.[e],c=r?.times?.some?.(m=>m?.start_time||m?.end_time)??!1;return a.createElement("div",null,a.createElement(p.D,{className:n.field,label:"Time range",description:"The time inclusive of the start and exclusive of the end time (in UTC if no location has been selected, otherwise local time)",invalid:c},a.createElement(a.Fragment,null,u.map((m,A)=>{const d=r?.times?.[A],H=`time_intervals.${e}.times.${A}.start_time`,L=`time_intervals.${e}.times.${A}.end_time`,D=()=>{const y=l(H),K=l(L);return[y,K]};return a.createElement("div",{className:n.timeRange,key:m.id},a.createElement(ra.C,null,a.createElement(X.I,{label:"Start time",invalid:!!d?.start_time,error:d?.start_time?.message},a.createElement(E.p,{...t(H,{validate:y=>{if(!(0,j.Hy)(y))return q;const[I,_]=D();if(!(0,j.oB)(I,_))return"Start time must be before end time"}}),className:n.timeRangeInput,maxLength:5,suffix:a.createElement(J.I,{name:"clock-nine"}),defaultValue:m.start_time,placeholder:"HH:mm","data-testid":"mute-timing-starts-at"})),a.createElement(X.I,{label:"End time",invalid:!!d?.end_time,error:d?.end_time?.message},a.createElement(E.p,{...t(`time_intervals.${e}.times.${A}.end_time`,{validate:y=>{if(!(0,j.Hy)(y))return q;const[I,_]=D();if(!(0,j.oB)(I,_))return"End time must be after start time"}}),className:n.timeRangeInput,maxLength:5,suffix:a.createElement(J.I,{name:"clock-nine"}),defaultValue:m.end_time,placeholder:"HH:mm","data-testid":"mute-timing-ends-at"})),a.createElement(na.K,{className:n.deleteTimeRange,title:"Remove",name:"trash-alt",onClick:y=>{y.preventDefault(),s(A)},tooltip:"Remove time range"})))}))),a.createElement(b.$n,{className:n.addTimeRange,variant:"secondary",type:"button",icon:"plus",onClick:()=>h({start_time:"",end_time:""})},"Add another time range"))},sa=e=>({field:(0,f.css)`
    margin-bottom: 0;
  `,timeRange:(0,f.css)`
    margin-bottom: ${e.spacing(1)};
  `,timeRangeInput:(0,f.css)`
    width: 90px;
  `,deleteTimeRange:(0,f.css)`
    margin: ${e.spacing(1)} 0 0 ${e.spacing(.5)};
  `,addTimeRange:(0,f.css)`
    margin-bottom: ${e.spacing(2)};
  `});var ca=i(88323);const ma=["Africa/Abidjan","Africa/Accra","Africa/Addis_Ababa","Africa/Algiers","Africa/Asmara","Africa/Bamako","Africa/Bangui","Africa/Banjul","Africa/Bissau","Africa/Blantyre","Africa/Brazzaville","Africa/Bujumbura","Africa/Cairo","Africa/Casablanca","Africa/Ceuta","Africa/Conakry","Africa/Dakar","Africa/Dar_es_Salaam","Africa/Djibouti","Africa/Douala","Africa/El_Aaiun","Africa/Freetown","Africa/Gaborone","Africa/Harare","Africa/Johannesburg","Africa/Juba","Africa/Kampala","Africa/Khartoum","Africa/Kigali","Africa/Kinshasa","Africa/Lagos","Africa/Libreville","Africa/Lome","Africa/Luanda","Africa/Lubumbashi","Africa/Lusaka","Africa/Malabo","Africa/Maputo","Africa/Maseru","Africa/Mbabane","Africa/Mogadishu","Africa/Monrovia","Africa/Nairobi","Africa/Ndjamena","Africa/Niamey","Africa/Nouakchott","Africa/Ouagadougou","Africa/Porto-Novo","Africa/Sao_Tome","Africa/Tripoli","Africa/Tunis","Africa/Windhoek","America/Adak","America/Anchorage","America/Anguilla","America/Antigua","America/Araguaina","America/Argentina/Buenos_Aires","America/Argentina/Catamarca","America/Argentina/Cordoba","America/Argentina/Jujuy","America/Argentina/La_Rioja","America/Argentina/Mendoza","America/Argentina/Rio_Gallegos","America/Argentina/Salta","America/Argentina/San_Juan","America/Argentina/San_Luis","America/Argentina/Tucuman","America/Argentina/Ushuaia","America/Aruba","America/Asuncion","America/Atikokan","America/Bahia","America/Bahia_Banderas","America/Barbados","America/Belem","America/Belize","America/Blanc-Sablon","America/Boa_Vista","America/Bogota","America/Boise","America/Cambridge_Bay","America/Campo_Grande","America/Cancun","America/Caracas","America/Cayenne","America/Cayman","America/Chicago","America/Chihuahua","America/Ciudad_Juarez","America/Costa_Rica","America/Creston","America/Cuiaba","America/Curacao","America/Danmarkshavn","America/Dawson","America/Dawson_Creek","America/Denver","America/Detroit","America/Dominica","America/Edmonton","America/Eirunepe","America/El_Salvador","America/Fort_Nelson","America/Fortaleza","America/Glace_Bay","America/Godthab","America/Goose_Bay","America/Grand_Turk","America/Grenada","America/Guadeloupe","America/Guatemala","America/Guayaquil","America/Guyana","America/Halifax","America/Havana","America/Hermosillo","America/Indiana/Indianapolis","America/Indiana/Knox","America/Indiana/Marengo","America/Indiana/Petersburg","America/Indiana/Tell_City","America/Indiana/Vevay","America/Indiana/Vincennes","America/Indiana/Winamac","America/Inuvik","America/Iqaluit","America/Jamaica","America/Juneau","America/Kentucky/Louisville","America/Kentucky/Monticello","America/Kralendijk","America/La_Paz","America/Lima","America/Los_Angeles","America/Lower_Princes","America/Maceio","America/Managua","America/Manaus","America/Marigot","America/Martinique","America/Matamoros","America/Mazatlan","America/Menominee","America/Merida","America/Metlakatla","America/Mexico_City","America/Miquelon","America/Moncton","America/Monterrey","America/Montevideo","America/Montreal","America/Montserrat","America/Nassau","America/New_York","America/Nipigon","America/Nome","America/Noronha","America/North_Dakota/Beulah","America/North_Dakota/Center","America/North_Dakota/New_Salem","America/Nuuk","America/Ojinaga","America/Panama","America/Pangnirtung","America/Paramaribo","America/Phoenix","America/Port-au-Prince","America/Port_of_Spain","America/Porto_Velho","America/Puerto_Rico","America/Punta_Arenas","America/Rainy_River","America/Rankin_Inlet","America/Recife","America/Regina","America/Resolute","America/Rio_Branco","America/Santa_Isabel","America/Santarem","America/Santiago","America/Santo_Domingo","America/Sao_Paulo","America/Scoresbysund","America/Shiprock","America/Sitka","America/St_Barthelemy","America/St_Johns","America/St_Kitts","America/St_Lucia","America/St_Thomas","America/St_Vincent","America/Swift_Current","America/Tegucigalpa","America/Thule","America/Thunder_Bay","America/Tijuana","America/Toronto","America/Tortola","America/Vancouver","America/Whitehorse","America/Winnipeg","America/Yakutat","America/Yellowknife","Antarctica/Casey","Antarctica/Davis","Antarctica/DumontDUrville","Antarctica/Macquarie","Antarctica/Mawson","Antarctica/McMurdo","Antarctica/Palmer","Antarctica/Rothera","Antarctica/South_Pole","Antarctica/Syowa","Antarctica/Troll","Antarctica/Vostok","Arctic/Longyearbyen","Asia/Aden","Asia/Almaty","Asia/Amman","Asia/Anadyr","Asia/Aqtau","Asia/Aqtobe","Asia/Ashgabat","Asia/Atyrau","Asia/Baghdad","Asia/Bahrain","Asia/Baku","Asia/Bangkok","Asia/Barnaul","Asia/Beirut","Asia/Bishkek","Asia/Brunei","Asia/Calcutta","Asia/Chita","Asia/Choibalsan","Asia/Chongqing","Asia/Colombo","Asia/Damascus","Asia/Dhaka","Asia/Dili","Asia/Dubai","Asia/Dushanbe","Asia/Famagusta","Asia/Gaza","Asia/Harbin","Asia/Hebron","Asia/Ho_Chi_Minh","Asia/Hong_Kong","Asia/Hovd","Asia/Irkutsk","Asia/Jakarta","Asia/Jayapura","Asia/Jerusalem","Asia/Kabul","Asia/Kamchatka","Asia/Karachi","Asia/Kashgar","Asia/Kathmandu","Asia/Katmandu","Asia/Khandyga","Asia/Krasnoyarsk","Asia/Kuala_Lumpur","Asia/Kuching","Asia/Kuwait","Asia/Macau","Asia/Magadan","Asia/Makassar","Asia/Manila","Asia/Muscat","Asia/Nicosia","Asia/Novokuznetsk","Asia/Novosibirsk","Asia/Omsk","Asia/Oral","Asia/Phnom_Penh","Asia/Pontianak","Asia/Pyongyang","Asia/Qatar","Asia/Qostanay","Asia/Qyzylorda","Asia/Rangoon","Asia/Riyadh","Asia/Sakhalin","Asia/Samarkand","Asia/Seoul","Asia/Shanghai","Asia/Singapore","Asia/Srednekolymsk","Asia/Taipei","Asia/Tashkent","Asia/Tbilisi","Asia/Tehran","Asia/Thimphu","Asia/Tokyo","Asia/Tomsk","Asia/Ulaanbaatar","Asia/Urumqi","Asia/Ust-Nera","Asia/Vientiane","Asia/Vladivostok","Asia/Yakutsk","Asia/Yangon","Asia/Yekaterinburg","Asia/Yerevan","Atlantic/Azores","Atlantic/Bermuda","Atlantic/Canary","Atlantic/Cape_Verde","Atlantic/Faroe","Atlantic/Madeira","Atlantic/Reykjavik","Atlantic/South_Georgia","Atlantic/St_Helena","Atlantic/Stanley","Australia/Adelaide","Australia/Brisbane","Australia/Broken_Hill","Australia/Currie","Australia/Darwin","Australia/Eucla","Australia/Hobart","Australia/Lindeman","Australia/Lord_Howe","Australia/Melbourne","Australia/Perth","Australia/Sydney","Europe/Amsterdam","Europe/Andorra","Europe/Astrakhan","Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels","Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen","Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man","Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Kirov","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana","Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk","Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague","Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Saratov","Europe/Simferopol","Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Ulyanovsk","Europe/Uzhgorod","Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw","Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","GMT","Indian/Antananarivo","Indian/Chagos","Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives","Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Local","Pacific/Apia","Pacific/Auckland","Pacific/Bougainville","Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury","Pacific/Fakaofo","Pacific/Fiji","Pacific/Funafuti","Pacific/Galapagos","Pacific/Gambier","Pacific/Guadalcanal","Pacific/Guam","Pacific/Honolulu","Pacific/Johnston","Pacific/Kanton","Pacific/Kiritimati","Pacific/Kosrae","Pacific/Kwajalein","Pacific/Majuro","Pacific/Marquesas","Pacific/Midway","Pacific/Nauru","Pacific/Niue","Pacific/Norfolk","Pacific/Noumea","Pacific/Pago_Pago","Pacific/Palau","Pacific/Pitcairn","Pacific/Pohnpei","Pacific/Ponape","Pacific/Port_Moresby","Pacific/Rarotonga","Pacific/Saipan","Pacific/Tahiti","Pacific/Tarawa","Pacific/Tongatapu","Pacific/Truk","Pacific/Wake","Pacific/Wallis","UTC"],la=e=>{const n=ma.map(t=>({label:t,value:t}));return a.createElement(ca.l6,{...e,options:n})},ua=()=>{const e=(0,$.of)(aa),{formState:n,register:t,setValue:o}=(0,k.xW)(),{fields:l,append:u,remove:h}=(0,k.jz)({name:"time_intervals"});return a.createElement(M.n,{label:"Time intervals"},a.createElement(a.Fragment,null,a.createElement("p",null,"A time interval is a definition for a moment in time. All fields are lists, and at least one list element must be satisfied to match the field. If a field is left blank, any moment of time will match the field. For an instant of time to match a complete time interval, all fields must match. A mute timing can contain multiple time intervals."),a.createElement(Z.B,{direction:"column",gap:2},l.map((s,r)=>{const c=n.errors;return t(`time_intervals.${r}.location`),a.createElement("div",{key:s.id,className:e.timeIntervalSection},a.createElement(oa,{intervalIndex:r}),a.createElement(p.D,{label:"Location",invalid:!!c.time_intervals?.[r]?.location,error:c.time_intervals?.[r]?.location?.message},a.createElement(la,{prefix:a.createElement(J.I,{name:"map-marker"}),width:50,onChange:m=>{o(`time_intervals.${r}.location`,m.value)},defaultValue:{label:s.location,value:s.location},"data-testid":"mute-timing-location"})),a.createElement(p.D,{label:"Days of the week"},a.createElement(fa,{onChange:m=>{o(`time_intervals.${r}.weekdays`,m)},defaultValue:s.weekdays})),a.createElement(p.D,{label:"Days of the month",description:"The days of the month, 1-31, of a month. Negative values can be used to represent days which begin at the end of the month",invalid:!!c.time_intervals?.[r]?.days_of_month,error:c.time_intervals?.[r]?.days_of_month?.message},a.createElement(E.p,{...t(`time_intervals.${r}.days_of_month`,{validate:m=>x(m,A=>{const d=parseInt(A,10);return d>-31&&d<0||d>0&&d<32},"Invalid day")}),width:50,defaultValue:s.days_of_month,placeholder:"Example: 1, 14:16, -1","data-testid":"mute-timing-days"})),a.createElement(p.D,{label:"Months",description:"The months of the year in either numerical or the full calendar month",invalid:!!c.time_intervals?.[r]?.months,error:c.time_intervals?.[r]?.months?.message},a.createElement(E.p,{...t(`time_intervals.${r}.months`,{validate:m=>x(m,A=>z.includes(A)||parseInt(A,10)<13&&parseInt(A,10)>0,"Invalid month")}),width:50,placeholder:"Example: 1:3, may:august, december",defaultValue:s.months,"data-testid":"mute-timing-months"})),a.createElement(p.D,{label:"Years",invalid:!!c.time_intervals?.[r]?.years,error:c.time_intervals?.[r]?.years?.message??""},a.createElement(E.p,{...t(`time_intervals.${r}.years`,{validate:m=>x(m,A=>/^\d{4}$/.test(A),"Invalid year")}),width:50,placeholder:"Example: 2021:2022, 2030",defaultValue:s.years,"data-testid":"mute-timing-years"})),a.createElement(b.$n,{type:"button",variant:"destructive",fill:"outline",icon:"trash-alt",onClick:()=>h(r)},"Remove time interval"))})),a.createElement(b.$n,{type:"button",variant:"secondary",className:e.removeTimeIntervalButton,onClick:()=>{u(S)},icon:"plus"},"Add another time interval")))},Aa=e=>{const n=e.split(",").map(t=>t.trim()).flatMap(t=>t.includes(":")?da(t):t).map(t=>t.toLowerCase()).filter(t=>B.includes(t));return(0,C.uniq)(n)};function da(e){const[n="",t=""]=e.split(":"),o=B.indexOf(n),l=B.indexOf(t);return B.slice(o,l+1)}const fa=({defaultValue:e="",onChange:n})=>{const t=(0,$.of)(aa),o=Aa(e),[l,u]=(0,a.useState)(o),h=s=>{l.includes(s)?u(r=>(0,C.without)(r,s)):u(r=>(0,C.concat)(r,s))};return(0,a.useEffect)(()=>{n(l.join(", "))},[l,n]),a.createElement("div",{"data-testid":"mute-timing-weekdays"},a.createElement(Z.B,{gap:1},B.map(s=>{const r=(0,f.cx)(t.dayOfTheWeek,l.includes(s)&&"selected"),c=s.slice(0,3);return a.createElement("button",{type:"button",key:s,className:r,onClick:()=>h(s)},(0,C.upperFirst)(c))})))},aa=e=>({input:(0,f.css)`
    width: 400px;
  `,timeIntervalSection:(0,f.css)`
    background-color: ${e.colors.background.secondary};
    padding: ${e.spacing(2)};
  `,removeTimeIntervalButton:(0,f.css)`
    margin-top: ${e.spacing(2)};
  `,dayOfTheWeek:(0,f.css)`
    cursor: pointer;
    user-select: none;
    padding: ${e.spacing(1)} ${e.spacing(3)};

    border: solid 1px ${e.colors.border.medium};
    background: none;
    border-radius: ${e.shape.radius.default};

    color: ${e.colors.text.secondary};

    &.selected {
      font-weight: ${e.typography.fontWeightBold};
      color: ${e.colors.primary.text};
      border-color: ${e.colors.primary.border};
      background: ${e.colors.primary.transparent};
    }
  `}),ga=e=>{const n={name:"",time_intervals:[S]};if(!e)return n;const t=e.time_intervals.map(o=>({times:o.times??S.times,weekdays:o.weekdays?.join(", ")??S.weekdays,days_of_month:o.days_of_month?.join(", ")??S.days_of_month,months:o.months?.join(", ")??S.months,years:o.years?.join(", ")??S.years,location:o.location??S.location}));return{name:e.name,time_intervals:t}},pa=({muteTiming:e,showError:n,loading:t,provenance:o})=>{const l=(0,G.useDispatch)(),{selectedAlertmanager:u}=(0,O.VI)(),h=(0,$.of)(ha),[s,r]=(0,a.useState)(!1),{currentData:c}=(0,F.f)(u),m=c?.alertmanager_config,A=ga(e),d=(0,k.mN)({defaultValues:A}),H=L=>{if(!c)return;const D=ta(L),y=e?m?.mute_time_intervals?.filter(({name:_})=>_!==e.name):m?.mute_time_intervals,K={...c,alertmanager_config:{...m,route:e&&D.name!==e.name?(0,W.Lt)(D.name,e.name,m?.route??{}):m?.route,mute_time_intervals:[...y||[],D]}},I=l((0,w.RW)({newConfig:K,oldConfig:c,alertManagerSourceName:u,successMessage:"Mute timing saved",redirectPath:"/alerting/routes/",redirectSearch:"tab=mute_timings"}));r(!0),I.unwrap().finally(()=>{r(!1)})};return a.createElement(a.Fragment,null,o&&a.createElement(Q.Yi,{resource:Q.hk.MuteTiming}),t&&a.createElement(g._,{text:"Loading mute timing"}),n&&a.createElement(P.F,{title:"No matching mute timing found"}),c&&!t&&!n&&a.createElement(k.Op,{...d},a.createElement("form",{onSubmit:d.handleSubmit(H),"data-testid":"mute-timing-form"},a.createElement(M.n,{label:"Create mute timing",disabled:!!o||s},a.createElement(p.D,{required:!0,label:"Name",description:"A unique name for the mute timing",invalid:!!d.formState.errors?.name,error:d.formState.errors.name?.message},a.createElement(E.p,{...d.register("name",{required:!0,validate:L=>{if(!e)return m?.mute_time_intervals?.find(({name:y})=>L===y)?`Mute timing already exists for "${L}"`:!0}}),className:h.input,"data-testid":"mute-timing-name"})),a.createElement(ua,null),a.createElement(b.$n,{type:"submit",className:h.submitButton,disabled:s},"Save mute timing"),a.createElement(b.z9,{type:"button",variant:"secondary",fill:"outline",href:(0,U.nL)("/alerting/routes/",u,{tab:"mute_timings"}),disabled:s},"Cancel")))))},ha=e=>({input:(0,f.css)`
    width: 400px;
  `,submitButton:(0,f.css)`
    margin-right: ${e.spacing(1)};
  `}),ea=pa,Ea=()=>{const[e]=(0,T.s)(),{selectedAlertmanager:n}=(0,O.VI)(),{currentData:t,isLoading:o,error:l}=(0,F.f)(n,{refetchOnFocus:!0,refetchOnReconnect:!0}),u=t?.alertmanager_config,h=(0,a.useCallback)(s=>{const r=u?.mute_time_intervals?.find(({name:c})=>c===s);if(r){const c=u?.muteTimeProvenances?.[r.name];return{...r,provenance:c}}return r},[u]);return a.createElement(a.Fragment,null,l&&!o&&!t&&a.createElement(P.F,{severity:"error",title:`Error loading Alertmanager config for ${n}`},l.message||"Unknown error."),t&&!l&&a.createElement(v.dO,null,a.createElement(v.qh,{exact:!0,path:"/alerting/routes/mute-timing/new"},a.createElement(ea,{loading:o})),a.createElement(v.qh,{exact:!0,path:"/alerting/routes/mute-timing/edit"},()=>{if(e.muteName){const s=h(String(e.muteName)),r=s?.provenance;return a.createElement(ea,{loading:o,muteTiming:s,showError:!s&&!o,provenance:r})}return a.createElement(v.rd,{to:"/alerting/routes"})})))},ya=()=>{const e=ia();return a.createElement(R.y,{navId:"am-routes",pageNav:e,accessType:"notification"},a.createElement(Ea,null))};function ia(){const{isExact:e,path:n}=(0,v.W5)(),[t,o]=(0,a.useState)();return(0,a.useEffect)(()=>{n==="/alerting/routes/mute-timing/new"?o({id:"alert-policy-new",text:"Add mute timing"}):n==="/alerting/routes/mute-timing/edit"&&o({id:"alert-policy-edit",text:"Edit mute timing"})},[n,e]),t}const va=ya},4724:(Y,N,i)=>{i.d(N,{Hy:()=>f,av:()=>$,oB:()=>k});var a=i(95093),v=i.n(a),P=i(96540),T=i(98164);const R=/^((([01][0-9])|(2[0-3])):[0-5][0-9])$|(^24:00$)/,f=g=>g?R.test(g):!0,k=(g,M)=>{if(!g&&!M)return!0;if(!g&&M||g&&!M)return!1;const p="HH:mm",E=v()().startOf("day").add(g,p),b=v()().startOf("day").add(M,p);return!!(g&&M&&E.isBefore(b)||g&&M&&b.isAfter(E))};function $(g){return g.time_intervals.map((p,E)=>{const{times:b,weekdays:G,days_of_month:F,months:O,years:w,location:W}=p,U=(0,T.Dm)(b,W),C=(0,T.uH)(G),B=(0,T.UL)(F),z=(0,T.$P)(O),S=(0,T.mP)(w);return P.createElement(P.Fragment,{key:JSON.stringify(p)+E},`${U} ${C}`,P.createElement("br",null),[B,z,S].join(" | "),P.createElement("br",null))})}},51488:(Y,N,i)=>{i.d(N,{f:()=>v});var a=i(82843);function v(P,T){const R=a.m.endpoints.getAlertmanagerConfiguration.useQuery(P??"",{...T,skip:!P});return{...R,error:R.error}}}}]);

//# sourceMappingURL=MuteTimings.cb66b37f52c9ee3ce1da.js.map