"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1494],{21494(K,_,a){a.r(_),a.d(_,{default:()=>R});var t=a(74848),e=a(2543),W=a.n(e),E=a(92745),P=a(6975),g=a(34999),M=a(36303),O=a(31286),u=a(77256),s=a(38533),f=a(70907),D=a(35480),m=a(43825);const v="unknown";function C({alertManagerSource:l,instances:h,policyName:A}){const{treeMatchingResults:d,isLoading:B,error:c}=(0,m.U)(l.name,h,A);if(c){const n=(0,E.t)("alerting.notification-preview.error","Could not load routing preview for {{alertmanager}}",{alertmanager:l.name});return(0,t.jsx)(g.F,{title:n,severity:"error",children:(0,u.JZ)(c)})}if(B)return(0,t.jsx)(P._,{text:(0,E.t)("alerting.notification-preview-by-alert-manager.text-loading-routing-preview","Loading routing preview...")});const I=d.some(n=>n.matchedRoutes.length>0),L=d.flatMap(({labels:n,matchedRoutes:i})=>Array.from(i).map(({route:o,routeTree:r,matchDetails:U})=>({labels:n,receiver:o.receiver||v,routeTree:r,matchDetails:U}))),T=(0,e.groupBy)(L,"receiver");return I?(0,t.jsx)(O.a,{display:"flex",direction:"column",gap:1,width:"100%",children:(0,t.jsx)(s.B,{direction:"column",gap:0,children:Object.entries(T).map(([n,i])=>(0,t.jsx)(f.gx,{name:n,matchedInstancesCount:i.length,children:(0,t.jsx)(s.B,{direction:"column",gap:0,children:i.map(({routeTree:o,matchDetails:r})=>(0,t.jsx)(D.t,{matchedInstance:r,policyTreeSpec:o.expandedSpec,policyTreeMetadata:o.metadata},r.labels.join(",")))})},n))})}):null}const R=(0,M.Xc)(C)}}]);

//# sourceMappingURL=1494.5c92a44052e8730284ea.js.map