"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[957],{50957(K,e,a){a.r(e),a.d(e,{default:()=>R});var t=a(14553),E=a(2543),W=a.n(E),l=a(92745),P=a(6975),g=a(34999),O=a(36303),u=a(31286),M=a(77256),s=a(38533),f=a(70907),D=a(35480),m=a(43825);const v="unknown";function C({alertManagerSource:_,instances:B,policyName:A}){const{treeMatchingResults:c,isLoading:h,error:d}=(0,m.U)(_.name,B,A);if(d){const n=(0,l.t)("alerting.notification-preview.error","Could not load routing preview for {{alertmanager}}",{alertmanager:_.name});return(0,t.jsx)(g.F,{title:n,severity:"error",children:(0,M.JZ)(d)})}if(h)return(0,t.jsx)(P._,{text:(0,l.t)("alerting.notification-preview-by-alert-manager.text-loading-routing-preview","Loading routing preview...")});const I=c.some(n=>n.matchedRoutes.length>0),L=c.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)(u.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.BN,{name:n,matchedInstancesCount:i.length,alertmanagerSourceName:_.name,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,O.Xc)(C)}}]);

//# sourceMappingURL=957-react19.dcd0bb082a03bfc37b5e.js.map