MOON
Server: Apache
System: Linux server1.studioinfinity.com.br 2.6.32-954.3.5.lve1.4.90.el6.x86_64 #1 SMP Tue Feb 21 12:26:30 UTC 2023 x86_64
User: artinside (517)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/netdata/usr/local/share/netdata/web/v3/4567.20db084a4d9e887d9c2c.chunk.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"4feb900574abdd30667a599041aadc4fc9f8ac80"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="441db761-4c6d-4b66-898e-36653bc569a9",e._sentryDebugIdIdentifier="sentry-dbid-441db761-4c6d-4b66-898e-36653bc569a9")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[4567],{57738(e,t,o){o.d(t,{L:()=>y});o(98992),o(8872);var n=o(96540),r=o(76667),a=o(30569),s=o(63872),l=o(19186),i=o(10602),d=o(24609),c=o(30731),u=o(96957),h=o(67294),p=o(45706),x=o(3319);const g=e=>"function"===e.type&&"feed"===e.flavour,m=(e,t)=>{const o=t[0]||null;return Object.entries(e).reduce((e,t)=>{let[n,r]=t;const{pristine:a,data:s,columns:l,aggregations:i,aggregatedView:d,acceptedParams:c,requiredParams:u,...h}=r;return"chart"===h.type?e[n]={...h,nodesScope:[]}:(e=>"function"===e.type&&!g(e))(h)?e[n]={...h,selectedNodeIds:o?[o]:[]}:g(h)?e[n]={...h,selectedNodeIds:[]}:e[n]="selectedNodeIds"in h?{...h,selectedNodeIds:[]}:h,e},{})},y=()=>{const e=(0,r.Zp)(),[t,o]=(0,s.A)(),g=(0,d.vt)(),y=(0,l.ID)(),b=(0,d.bq)(),f=(0,l.QW)(),j=(0,i.CK)(),w=(0,i.nj)(),{sendLog:v}=(0,x.A)();return(0,a.yF)((0,n.useCallback)(async(n,r,a)=>{if(w)try{const{data:o}=await(0,c.f7)(g,y,a),{layout:n,containerIds:s,containers:l,cards:i,dashboard:d}=(0,p.S)(o),x=m(i,j),w=`Copy of ${d.name}`,{data:k}=await(0,c.k9)(g,y,{name:w}),I={version:k.version+1||2,snapshot:{uiState:{layout:n,containerIds:s,containers:l,cards:x,respectNodesScope:d.respectNodesScope,duplicate:{id:a}}}};await(0,c.mQ)(g,y,k.id,I),r((0,u._d)(k.id),{name:w,...I,spaceId:g,roomId:y,...k,loaded:!0}),r((0,h.hZ)(y),{...k,spaceId:g,roomId:y}),v({feature:"DuplicatedCustomDashboard",isSuccess:!0,dashboardId:k.id}),t({header:"Dashboards",text:"Dashboard duplicated!"}),e(`/spaces/${b}/rooms/${f}/dashboards/${k.slug}`,{state:{showDuplicateWizard:!0}})}catch(s){o(s)}else o({header:"Dashboards",text:"Please wait for nodes to finish loading."})},[g,y,b,f,j,w,e,t,o,v]))}},82308(e,t,o){o.d(t,{lZ:()=>I,Uu:()=>k,BG:()=>S,NV:()=>C});o(74423),o(33110),o(98992),o(54520),o(3949),o(81454),o(25509),o(65223),o(60321),o(41927),o(11632),o(64377),o(66771),o(12516),o(68931),o(52514),o(35694),o(52774),o(49536),o(21926),o(94483),o(16215);var n=o(96540),r=o(30569),a=o(63872),s=o(24609),l=o(19186),i=o(67294),d=o(30731),c=o(45706),u=o(96957),h=o(6393),p=o(57068);o(8872);const x=["pristine","data","columns","aggregations","aggregatedView","requiredParams","flowRows","flowColumns","flowGroupByKeys","flowFacets","flowMetrics","flowMapFlows","flowTimeseries","flowViewCache","topologyGraph","topologyActorRows","topologyLinkRows","topologyMeta","presentation"],g=(e,t,o)=>{const n=new Set(Object.values(o.layout||{}).flat().map(e=>e.id)),r=Object.keys(t).filter(e=>n.has(e)).reduce((e,o)=>(e[o]=(e=>{const t={...e};return x.forEach(e=>delete t[e]),t})(t[o]),e),{});return{name:e.name,respectNodesScope:e.respectNodesScope,cards:r,layout:o.layout,containerIds:o.containerIds,containers:o.containers}};var m=o(72402),y=(o(71517),o(11379),o(93777),o(14190),o(12359),o(86097),o(17273),o(27415),o(19929),o(37583),o(55122),o(20230),o(57268),o(79733),o(69861));const b=new TextEncoder,f=(e,t)=>{const o=URL.createObjectURL(e),n=document.createElement("a");n.href=o,n.download=t,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(o)},j=async(e,t)=>{const o=await(async e=>{const t=e.reduce((e,t)=>{let{name:o,content:n}=t;return e[o]=b.encode(n),e},{});return(0,y.L)(t)})(t),n=new Blob([o],{type:"application/zip"});f(n,e.endsWith(".zip")?e:`${e}.zip`)};var w=o(28864);const v=async(e,t,o,n)=>{const r=e((0,u.Qx)({id:t}));if(r?.fullyLoaded){return{dashboard:r,cards:e((0,h.nG)({id:t})),layoutState:e((0,p.kY)({id:t}))}}const a=r?.spaceId||o,s=r?.roomId||n,{data:l}=await(0,d.f7)(a,s,t),{dashboard:i,cards:x,layout:g,containerIds:m,containers:y}=(0,c.S)(l);return{dashboard:{...i,spaceId:a,roomId:s},cards:x,layoutState:{layout:g,containerIds:m,containers:y}}},k=()=>{const e=(0,s.vt)(),t=(0,l.ID)(),[,o]=(0,a.A)();return(0,r.yF)((0,n.useCallback)(async(n,r,a)=>{try{const{dashboard:o,cards:r,layoutState:s}=await v(n,a,e,t),l=g(o,r,s);((e,t)=>{const o=new Blob([JSON.stringify(t,null,2)],{type:"application/json"});f(o,e.endsWith(".json")?e:`${e}.json`)})(`${o.slug||o.name||a}.json`,l)}catch(s){o({header:"Export",text:s.message})}},[e,t,o]))},I=()=>{const e=(0,s.vt)(),t=(0,l.ID)(),[,o]=(0,a.A)();return(0,r.yF)((0,n.useCallback)(async(n,r,a)=>{try{const o=(await Promise.all(a.map(o=>v(n,o,e,t)))).map(e=>{let{dashboard:t,cards:o,layoutState:n}=e;return{name:`${t.slug||t.name||t.id}.json`,content:JSON.stringify(g(t,o,n),null,2)}});await j("dashboards.zip",(e=>{const t=new Map;return e.map(e=>{let{name:o,content:n}=e;const r=o.replace(/\.json$/,""),a=t.get(r)||0;return t.set(r,a+1),{name:0===a?`${r}.json`:`${r}-${a+1}.json`,content:n}})})(o))}catch(s){o({header:"Export",text:s.message})}},[e,t,o]))},C=()=>{const e=(0,s.vt)(),t=(0,l.ID)(),o=(0,w.yK)(e,t),[,c]=(0,a.A)();return(0,r.yF)((0,n.useCallback)(async(n,r,a)=>{const s=(0,m.kv)(a),l=((e,t)=>(e((0,i.z_)({id:t,key:"ids"}))||[]).map(t=>e((0,u.Qx)({id:t}))?.name).filter(Boolean))(n,t),h=((e,t)=>{if(!t.includes(e))return e;let o=1,n=`${e} (imported)`;for(;t.includes(n);)o+=1,n=`${e} (imported ${o})`;return n})(a.name,l);try{const{data:n}=await o({name:h}),l={version:(n.version||1)+1,snapshot:{uiState:{layout:s.layout,containerIds:s.containerIds,containers:s.containers,cards:s.cards,respectNodesScope:a.respectNodesScope??!0}}};await(0,d.mQ)(e,t,n.id,l);const c={name:h,...l,spaceId:e,roomId:t,...n,loaded:!0};return r((0,u._d)(n.id),c),r((0,i.hZ)(t),c),{ok:!0,dashboard:c}}catch(p){return c({header:"Import",text:`Failed to create dashboard "${h}"`}),{ok:!1,error:p}}},[e,t,o,c]))},S=e=>(0,r.yF)((0,n.useCallback)((t,o,n)=>{const r=t((0,h.nG)({id:e})),a=t((0,p.kY)({id:e})),{headerId:s,targetContainerId:l,newCards:i,layoutEntriesForTarget:d}=(0,m.M7)(n,{cards:r,layoutState:a}),c=new Set(Object.keys(r));Object.values(i).forEach(t=>{c.has(t.id)||o((0,h.nG)({id:e,resourceId:t.id}),t)}),o((0,p.xB)(e),e=>({...e||{},[l]:d}));const x=Object.keys(i).filter(e=>!c.has(e));return o((0,u.Qx)({id:e}),e=>({...e,cardIds:[...e?.cardIds||[],...x]})),{ok:!0,addedIds:x,headerId:s}},[e]))},94567(e,t,o){o.d(t,{J:()=>Dn,A:()=>Mn});var n=o(96540),r=o(76667),a=o(98591),s=o(85660),l=o(96957),i=o(78385),d=o(57068),c=o(6393),u=o(19186),h=o(87083),p=o(24013),x=(o(98992),o(81454),o(38429)),g=o(29263),m=o(24609),y=o(77814),b=(o(74423),o(3949),o(25509),o(65223),o(60321),o(41927),o(11632),o(64377),o(66771),o(12516),o(68931),o(52514),o(35694),o(52774),o(49536),o(21926),o(94483),o(16215),o(30569)),f=o(1011),j=o(33718);const w={text:j.cY,chart:j.Pk,nodeGrid:j.Lj,nodeList:j.Ng,nodeStats:j.wj,alertStatus:j.z6,alertsPerNode:j.fB,hourlyAlerts:j.XG,statsOverview:j.$2,dataRetention:j.fD,alertNodes:j.Sp,replicationStats:j.G4},v=(e,t)=>"chart"===e.type?((e,t)=>{const{type:o,layout:n,context:r,...a}=e;return{...j.kG,...j.Pk,id:(0,f.A)(),contextScope:[r],nodesScope:t,...a}})(e,t):((e,t)=>{const{type:o,layout:n,...r}=e,a=w[o];return((e,t)=>"nodesScope"in e?{...e,nodesScope:t}:"selectedNodeIds"in e?{...e,selectedNodeIds:t}:e)({...j.kG,...a,id:(0,f.A)(),...r},t)})(e,t),k=e=>(0,b.yF)((t,o,n,r)=>{const a=t((0,d.kY)({id:e,key:"layout"})),s=t((0,d.kY)({id:e,key:"containerIds"}))[0]||"A",i=(e=>{let t=0;return Object.values(e).forEach(e=>{e.forEach(e=>{const o=e.top+e.height;o>t&&(t=o)})}),t})(a),u=((e,t)=>{let o=0,n=t,r=0;return e.map(e=>{const{w:t,h:a}=e.layout;o+t>12&&(n+=r,o=0,r=0);const s={left:o,top:n,width:t,height:a,minWidth:1,minHeight:1};return o+=t,r=Math.max(r,a),s})})(n.cards,i),h=[];n.cards.forEach((t,n)=>{const a=v(t,r),l={...u[n],id:a.id};h.push(a.id),o((0,c.nG)({id:e,resourceId:a.id}),a),o((0,d.xB)(e),e=>({...e,[s]:[...e[s]||[],l]}))}),o((0,l.Qx)({id:e,key:"cardIds"}),e=>[...e,...h]),o((0,d.MX)(e),e=>e.includes(s)?e:[...new Set([...e,s])])}),I=[{id:"server-overview",name:"Server Overview",description:"Node status, CPU, memory, disk, and network at a glance",category:"infrastructure",contexts:["system.cpu","system.ram","disk.space","system.net"],cards:[{type:"text",textType:"title",text:"Server Overview",layout:{w:12,h:1}},{type:"nodeStats",layout:{w:4,h:4}},{type:"nodeGrid",layout:{w:8,h:4}},{type:"chart",context:"system.cpu",title:"Top Nodes by CPU Utilization",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"system.ram",title:"Top Nodes by Memory Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Top Nodes by Disk Space",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"system.net",title:"Top Nodes by Network Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"server-deep-dive",name:"Server Deep Dive",description:"Comprehensive single-server metrics: load, CPU, memory, disk, network, and more",category:"infrastructure",contexts:["system.load","system.cpu","system.ram","system.net","disk.io","disk.space","system.interrupts","system.fds","mem.pgfaults"],cards:[{type:"text",textType:"title",text:"Server Metrics",layout:{w:12,h:1}},{type:"chart",context:"system.load",title:"System Load Average",layout:{w:6,h:6}},{type:"chart",context:"system.cpu",title:"CPU Utilization",layout:{w:6,h:6}},{type:"chart",context:"system.ram",title:"Memory Usage",layout:{w:6,h:6}},{type:"chart",context:"system.net",title:"Network Traffic",layout:{w:6,h:6}},{type:"chart",context:"disk.io",title:"Disk I/O",layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Top Partitions by Disk Space",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Disk Space Distribution",chartLibrary:"d3pie",groupBy:["percentage-of-instance"],layout:{w:6,h:6}},{type:"chart",context:"system.interrupts",title:"System Interrupts",layout:{w:6,h:6}},{type:"chart",context:"system.fds",title:"Open File Descriptors",layout:{w:6,h:6}},{type:"chart",context:"mem.pgfaults",title:"Memory Page Faults",layout:{w:6,h:6}},{type:"chart",context:"mem.committed",title:"Committed Memory",layout:{w:6,h:6}}]},{id:"disk-performance",name:"Disk Performance",description:"I/O throughput, IOPS, latency, utilization, and space across disks",category:"infrastructure",contexts:["disk.io","disk.ops","disk.await","disk.space","disk.util"],cards:[{type:"text",textType:"title",text:"Disk Performance",layout:{w:12,h:1}},{type:"chart",context:"disk.io",title:"Top Disks by I/O Throughput",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["device"],layout:{w:6,h:6}},{type:"chart",context:"disk.ops",title:"Top Disks by IOPS",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["device"],layout:{w:6,h:6}},{type:"chart",context:"disk.await",title:"Top Disks by Latency",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["device"],layout:{w:6,h:6}},{type:"chart",context:"disk.util",title:"Top Disks by Utilization",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["device"],layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Disk Space Distribution",chartLibrary:"d3pie",groupBy:["percentage-of-instance"],layout:{w:6,h:6}},{type:"chart",context:"disk.space",title:"Top Mounts by Disk Space",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}}]},{id:"container-overview",name:"Container Overview",description:"CPU, memory, network, and I/O across all containers",category:"containers",contexts:["cgroup.cpu","cgroup.mem_usage","cgroup.net_net","cgroup.io"],cards:[{type:"text",textType:"title",text:"Container Monitoring",layout:{w:12,h:1}},{type:"chart",context:"cgroup.cpu",title:"Top Containers by CPU Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}},{type:"chart",context:"cgroup.mem_usage",title:"Top Containers by Memory Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}},{type:"chart",context:"cgroup.mem_usage",title:"Memory Distribution",chartLibrary:"d3pie",groupBy:["percentage-of-instance"],layout:{w:6,h:6}},{type:"chart",context:"cgroup.net_net",title:"Top Containers by Network Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}},{type:"chart",context:"cgroup.io",title:"Top Containers by I/O",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["instance"],layout:{w:6,h:6}}]},{id:"kubernetes-overview",name:"Kubernetes Overview",description:"CPU, memory, network, and throttling across Kubernetes namespaces",category:"containers",contexts:["k8s.cgroup.cpu","k8s.cgroup.mem_usage","k8s.cgroup.net_net","k8s.cgroup.throttled_duration"],cards:[{type:"text",textType:"title",text:"Kubernetes Overview",layout:{w:12,h:1}},{type:"chart",context:"k8s.cgroup.cpu",title:"Top Namespaces by CPU",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["k8s_namespace"],layout:{w:6,h:6}},{type:"chart",context:"k8s.cgroup.mem_usage",title:"Top Namespaces by Memory",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["k8s_namespace"],layout:{w:6,h:6}},{type:"chart",context:"k8s.cgroup.net_net",title:"Top Namespaces by Network Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["k8s_namespace"],layout:{w:6,h:6}},{type:"chart",context:"k8s.cgroup.throttled_duration",title:"Top Namespaces by CPU Throttling",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["k8s_namespace"],layout:{w:6,h:6}}]},{id:"network-device-overview",name:"Network Device Overview",description:"Traffic, errors, status, and CPU for SNMP-monitored network devices",category:"network",contexts:["snmp.device_net_interface_traffic","snmp.device_prof_cpu_usage","snmp.device_net_interface_errors","snmp.device_net_interface_oper_status"],cards:[{type:"text",textType:"title",text:"Network Monitoring",layout:{w:12,h:1}},{type:"nodeGrid",layout:{w:12,h:4}},{type:"chart",context:"snmp.device_net_interface_traffic",title:"Top Devices by Interface Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"snmp.device_net_interface_errors",title:"Top Devices by Interface Errors",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"snmp.device_net_interface_oper_status",title:"Top Devices by Interface Status",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"snmp.device_prof_cpu_usage",title:"Top Devices by CPU Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"firewall-metrics",name:"Firewall Metrics",description:"Network traffic, SNMP CPU, system CPU, and memory for firewall devices",category:"network",contexts:["snmp.device_net_interface_traffic","snmp.device_prof_cpu_usage","system.cpu","system.ram"],cards:[{type:"text",textType:"title",text:"Firewall Metrics",layout:{w:12,h:1}},{type:"chart",context:"snmp.device_net_interface_traffic",title:"Top Devices by Network Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"snmp.device_prof_cpu_usage",title:"Top Devices by CPU Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"system.cpu",title:"Top Nodes by System CPU",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"system.ram",title:"Top Nodes by Memory Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"dns-network-health",name:"DNS & Network Health",description:"Ping latency, packet loss, and DNS query performance",category:"network",contexts:["ping.host_rtt","ping.host_packet_loss","dns_query.query_time","dns_query.query_status"],cards:[{type:"text",textType:"title",text:"DNS & Network Health",layout:{w:12,h:1}},{type:"chart",context:"ping.host_rtt",title:"Top Hosts by Round-Trip Time",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["host"],layout:{w:6,h:6}},{type:"chart",context:"ping.host_packet_loss",title:"Top Hosts by Packet Loss",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["host"],layout:{w:6,h:6}},{type:"chart",context:"dns_query.query_time",title:"Top DNS Servers by Query Time",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["server"],layout:{w:6,h:6}},{type:"chart",context:"dns_query.query_status",title:"DNS Query Status",chartLibrary:"bars",groupBy:["dimension"],layout:{w:6,h:6}}]},{id:"web-server-overview",name:"Web Server Overview",description:"Connections, requests, traffic, and workers for Nginx and Apache servers",category:"applications",contexts:["nginx.connections","nginx.requests","apache.connections","apache.requests","apache.net","apache.workers"],cards:[{type:"text",textType:"title",text:"Web Server Overview",layout:{w:12,h:1}},{type:"chart",context:"nginx.connections",title:"Top Nodes by Nginx Connections",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"nginx.requests",title:"Top Nodes by Nginx Requests",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"apache.connections",title:"Top Nodes by Apache Connections",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"apache.requests",title:"Top Nodes by Apache Requests",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"apache.net",title:"Top Nodes by Apache Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"apache.workers",title:"Top Nodes by Apache Workers",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"database-overview",name:"Database Overview",description:"Queries, connections, traffic, and storage for MySQL and Postgres",category:"applications",contexts:["mysql.queries","mysql.connections","mysql.net","postgres.connections_utilization","postgres.db_size"],cards:[{type:"text",textType:"title",text:"Database Overview",layout:{w:12,h:1}},{type:"chart",context:"mysql.queries",title:"Top Nodes by MySQL Queries",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"mysql.connections",title:"Top Nodes by MySQL Connections",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"mysql.net",title:"Top Nodes by MySQL Traffic",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"postgres.connections_utilization",title:"Top Nodes by Postgres Connection Usage",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}},{type:"chart",context:"postgres.db_size",title:"Top Databases by Size",dimensionsSort:"valueDesc",chartLibrary:"bars",groupBy:["node"],layout:{w:6,h:6}}]},{id:"endpoint-monitoring",name:"Endpoint Monitoring",description:"Availability and response time for HTTP-checked endpoints",category:"applications",contexts:["httpcheck.response_time","httpcheck.status"],cards:[{type:"text",textType:"title",text:"Endpoint Monitoring",layout:{w:12,h:1}},{type:"chart",context:"httpcheck.status",title:"Endpoint Status by URL",chartLibrary:"bars",groupBy:["label"],groupByLabel:["url"],layout:{w:6,h:6}},{type:"chart",context:"httpcheck.response_time",title:"Top Endpoints by Response Time",dimensionsSort:"valueDesc",groupBy:["label"],groupByLabel:["url"],layout:{w:6,h:6}}]},{id:"certificate-expiry",name:"Certificate & Domain Expiry",description:"SSL certificate and domain registration expiration monitoring",category:"applications",contexts:["x509check.time_until_expiration","whoisquery.time_until_expiration"],cards:[{type:"text",textType:"title",text:"Certificate & Domain Expiry",layout:{w:12,h:1}},{type:"chart",context:"x509check.time_until_expiration",title:"Certificates by Time Until Expiry",dimensionsSort:"valueAsc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["source"],layout:{w:6,h:6}},{type:"chart",context:"whoisquery.time_until_expiration",title:"Domains by Time Until Expiry",dimensionsSort:"valueAsc",chartLibrary:"bars",groupBy:["label"],groupByLabel:["domain"],layout:{w:6,h:6}}]}];o(54520);const C=(e,t)=>{const o=new Set(t),n=e.filter(e=>((e,t)=>{if(e.has(t))return!0;if(!t.includes("*"))return!1;const o=new RegExp("^"+t.replace(/\./g,"\\.").replace(/\*/g,".*")+"$");return[...e].some(e=>o.test(e))})(o,e));return{matched:n.length,total:e.length}};var S=o(74848);const T=e=>{let{matched:t,total:o}=e;const n=((e,t)=>0===e?"textLite":e===t?"success":"warning")(t,o);return(0,S.jsx)(x.Flex,{padding:[1,2],round:1,background:"elementBackground",alignItems:"center",children:(0,S.jsxs)(x.Text,{color:n,fontSize:"10px",strong:!0,children:[t,"/",o," metrics available"]})})},F={text:"border",chart:"primary",nodeGrid:"success",nodeStats:"warning",nodeList:"disabled",alertStatus:"error",alertsPerNode:"error",hourlyAlerts:"warning",statsOverview:"accent",dataRetention:"disabled",alertNodes:"error",replicationStats:"accent"},N=e=>{let{preset:t}=e;const{cards:o}=t;let n=0,r=0,a=0;const s=o.map((e,t)=>{const{w:o,h:s}=e.layout;n+o>12&&(r+=a,n=0,a=0);const l={position:"absolute",left:16*n,top:4*r,width:16*o-1,height:4*s-1};return n+=o,a=Math.max(a,s),(0,S.jsx)(x.Flex,{round:1,background:F[e.type]||"border",backgroundOpacity:.3,border:{side:"all",color:F[e.type]||"border"},style:l},t)}),l=4*(r+a);return(0,S.jsx)(x.Flex,{position:"relative",width:"192px",height:`${l}px`,children:s})},A=e=>{let{preset:t,availability:o,onClick:n}=e;return(0,S.jsxs)(x.Flex,{column:!0,gap:2,padding:[3],round:1,border:{side:"all",color:"border"},background:"mainBackground",cursor:"pointer",_hover:{border:{side:"all",color:"primary"}},onClick:n,"data-testid":`preset-card-${t.id}`,children:[(0,S.jsx)(x.Flex,{justifyContent:"center",padding:[2],children:(0,S.jsx)(N,{preset:t})}),(0,S.jsx)(x.Text,{strong:!0,children:t.name}),(0,S.jsx)(x.TextSmall,{color:"textDescription",children:t.description}),(0,S.jsx)(T,{matched:o.matched,total:o.total})]})};var L=o(10602),B=o(42721);const D=e=>{let{preset:t,onApply:o,onBack:r}=e;const a=(0,L.CK)(),[s,l]=(0,n.useState)([]);return(0,S.jsxs)(x.Flex,{column:!0,gap:4,padding:[4],height:"100%",children:[(0,S.jsxs)(x.Flex,{column:!0,gap:2,children:[(0,S.jsx)(x.H4,{children:t.name}),(0,S.jsx)(x.Text,{color:"textLite",children:"Select which nodes these charts should display data from. Leave empty to include all nodes."})]}),(0,S.jsx)(x.Flex,{flex:!0,overflow:{vertical:"auto"},children:(0,S.jsx)(B.A,{nodeIds:a,selectedNodeIds:s,setSelectedNodeIds:l,multi:!0})}),(0,S.jsxs)(x.Flex,{gap:2,justifyContent:"flex-end",children:[(0,S.jsx)(x.Button,{label:"Back",flavour:"hollow",onClick:r}),(0,S.jsx)(x.Button,{label:"Apply template",onClick:()=>o(s)})]})]})},M=[{id:"infrastructure",name:"Infrastructure",icon:"node"},{id:"containers",name:"Containers",icon:"container"},{id:"network",name:"Network",icon:"networkingStack"},{id:"applications",name:"Applications",icon:"applicationsSolid"}],_=e=>{let{category:t,isActive:o,onClick:n}=e;return(0,S.jsxs)(x.Flex,{alignItems:"center",gap:2,padding:[2,3],round:.5,cursor:"pointer",background:o?"primary":void 0,backgroundOpacity:o?.1:void 0,_hover:o?void 0:{background:"primary",backgroundOpacity:.05},onClick:n,"data-testid":`preset-category-${t.id}`,children:[(0,S.jsx)(x.Icon,{name:t.icon,color:o?"primary":"text",width:"16px",height:"16px"}),(0,S.jsx)(x.Text,{color:o?"primary":"text",strong:o,children:t.name})]})},O=e=>{let{categories:t,activeCategoryId:o,onSelect:n}=e;return(0,S.jsx)(x.Flex,{column:!0,gap:1,padding:[2],width:"180px",flex:"shrink",children:t.map(e=>(0,S.jsx)(_,{category:e,isActive:o===e.id,onClick:()=>n(e.id)},e.id))})},z=e=>{let{presets:t,availableContexts:o,onSelect:n}=e;return(0,S.jsx)(x.Flex,{column:!0,gap:4,padding:[4],flex:!0,children:t.map(e=>(0,S.jsx)(A,{preset:e,availability:C(e.contexts,o),onClick:()=>n(e)},e.id))})},E=e=>{let{dashboardId:t,onClose:o}=e;const r=(0,m.vt)(),a=(0,u.ID)(),{charts:s}=(0,y.A)(r,a),l=k(t),[i,d]=(0,n.useState)(M[0].id),[c,h]=(0,n.useState)(null),p=(0,n.useMemo)(()=>Object.keys(s),[s]),b=(0,n.useMemo)(()=>{return e=i,I.filter(t=>t.category===e);var e},[i]),f=e=>{l(c,e),o()};return c?(0,S.jsx)(x.Layer,{position:"center",backdrop:!0,onClickOutside:o,onEsc:o,children:(0,S.jsxs)(x.Flex,{column:!0,background:"mainBackground",round:2,width:"600px",height:{max:"80vh"},border:{side:"all",color:"border"},children:[(0,S.jsx)(g.z,{title:"Select Nodes",isSubmodal:!0,onClose:()=>h(null)}),(0,S.jsx)(D,{preset:c,onApply:f,onBack:()=>h(null)})]})}):(0,S.jsx)(x.Layer,{position:"center",backdrop:!0,onClickOutside:o,onEsc:o,children:(0,S.jsxs)(x.Flex,{column:!0,background:"mainBackground",round:2,width:"800px",height:{max:"80vh"},border:{side:"all",color:"border"},children:[(0,S.jsx)(g.z,{title:"Dashboard Templates",onClose:o}),(0,S.jsxs)(x.Flex,{flex:!0,overflow:"hidden",children:[(0,S.jsx)(O,{categories:M,activeCategoryId:i,onSelect:d}),(0,S.jsx)(x.Flex,{flex:!0,overflow:{vertical:"auto"},border:{side:"left",color:"border"},children:(0,S.jsx)(z,{presets:b,availableContexts:p,onSelect:h})})]})]})})},$=e=>{let{dashboardId:t,compact:o,...r}=e;const[,s]=(0,a.A)("addChartModal"),[l,i]=(0,n.useState)(!1),[d,c]=(0,n.useState)(null),h=(0,p.TG)().length>0,b=(0,m.vt)(),f=(0,u.ID)(),{charts:j}=(0,y.A)(b,f),w=k(t),v=(0,n.useMemo)(()=>Object.keys(j),[j]),T=(0,n.useMemo)(()=>(e=>{const t=I.map(t=>{const o=C(t.contexts,e);return{preset:t,availability:o,ratio:o.total>0?o.matched/o.total:0}});return t.sort((e,t)=>t.ratio-e.ratio),t.slice(0,4)})(v),[v]),F=e=>{w(d,e),c(null)};return d?(0,S.jsx)(x.Layer,{position:"center",backdrop:!0,onClickOutside:()=>c(null),onEsc:()=>c(null),children:(0,S.jsxs)(x.Flex,{column:!0,background:"mainBackground",round:2,width:"600px",height:{max:"80vh"},border:{side:"all",color:"border"},children:[(0,S.jsx)(g.z,{title:"Select Nodes",isSubmodal:!0,onClose:()=>c(null)}),(0,S.jsx)(D,{preset:d,onApply:F,onBack:()=>c(null)})]})}):(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",justifyContent:"center",overflow:{vertical:"auto"},flex:!0,basis:0,"data-testid":"dashboardBlankSlate",...r,children:[h?(0,S.jsx)(S.Fragment,{children:!o&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(x.Text,{margin:[0,0,4],children:"Based on your setup we recommend these templates to start with"}),(0,S.jsx)(x.Flex,{gap:6,wrap:!0,children:T.map(e=>{let{preset:t,availability:o}=e;return(0,S.jsx)(x.Flex,{width:"220px",children:(0,S.jsx)(A,{preset:t,availability:o,onClick:()=>c(t)})},t.id)})}),(0,S.jsx)(x.Text,{margin:[8,0,4],color:"textLite",children:"or you can start building your own dashboard from scratch!"}),(0,S.jsxs)(x.Flex,{gap:2,children:[(0,S.jsx)(x.Button,{onClick:s,label:"Add chart","data-testid":"dashboardBlankSlate-addChart"}),(0,S.jsx)(x.Button,{flavour:"hollow",onClick:()=>i(!0),label:"Browse templates","data-testid":"dashboardBlankSlate-browseTemplates"})]})]})}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(x.Text,{textAlign:"center",children:"You don't have any available node to retrieve charts from."}),(0,S.jsx)(x.Text,{textAlign:"center",children:"Please verify your nodes' state and/or connect a new node to Netdata"})]}),l&&(0,S.jsx)(E,{dashboardId:t,onClose:()=>i(!1)})]})};var P=o(882);const U="20px",R=(0,P.css)(["background-image:radial-gradient( circle,"," ",",transparent "," );background-size:"," ",";background-position:center center;"],(0,x.getColor)("borderSecondary"),"1px","1px",U,U),q=(0,P.default)(x.Flex).attrs(e=>{let{active:t}=e;return{width:"100%",flex:!0,overflow:"hidden",...t&&{background:"mainBackground"}}}).withConfig({displayName:"gridBackground__GridBackground",componentId:"sc-86s97v-0"})(["",""],e=>{let{active:t}=e;return t&&R});o(72577);var G=o(32788),V=o(47410),K=o(23226),H=o(5907),W=o(21e3),Q=o(87733),J=o(67012),Y=o(28657),Z=o(87398),X=o(13752),ee=o(92815),te=o(72582),oe=o(78072),ne=o(91832),re=o(23565),ae=o(52795),se=o(54251),le=o(45087);const ie=()=>(0,S.jsxs)(x.Flex,{column:!0,width:"300px",gap:1,children:[(0,S.jsx)(x.TextSmall,{strong:!0,children:"Not finding a chart?"}),(0,S.jsxs)(x.TextSmall,{children:["When selecting",(0,S.jsx)(x.TextSmall,{strong:!0,margin:[0,1],children:"All Nodes"}),"you search and add charts using their context. The outcome will be a composite chart over All Nodes, like on the Overview tab."]}),(0,S.jsxs)(x.TextSmall,{children:["When you select a",(0,S.jsx)(x.TextSmall,{strong:!0,margin:[0,1],children:"specific Node"}),"you search and add charts using their name. The result is a specific chart over the node selected, like on Single Node tab."]})]}),de=()=>(0,S.jsx)(le.A,{isBasic:!0,plain:!0,content:ie,align:"bottom",children:(0,S.jsx)(x.Icon,{name:"question",color:"textDescription",size:"small"})}),ce=e=>{let{spaceId:t,roomId:o,value:r,onChange:a,options:s,testid:l,selectedNodeIds:i,metadata:d}=e;const[c,u]=(0,n.useState)(),h=r?.value,p=(0,Z.eg)(),g=(0,re.CS)({type:"chart",entity:h,path:"/"}),m=(0,Q.K)({spaceId:t,roomId:o}),y=(0,n.useMemo)(()=>{p.getNodes({id:"newDashboardChart"}).forEach(e=>e.destroy());const{info:e,valueRange:t,height:n,colors:r}=(0,W.Ay)(d),a=p.makeChart({attributes:{id:"newDashboardChart",contextScope:[h],host:m,roomId:o,info:e,valueRange:t,height:n+207,enabledNavigation:!1,nodesScope:i,...r&&{colors:r},toolboxElements:[oe.default,te.default,X.default,ee.default,ne.A]}});p.getRoot().appendChild(a),u((0,ae.A)(a.getAttributes()));const s=a.getAttribute("chartLibrary");return a.setAttributes({...c,...(0,ae.A)(g,!0)}),(0,se.A)(a,s,a.getAttribute("chartLibrary")),a},[p,h]);return(0,J.A)(()=>{if(!y||!g)return;const e=y.getAttribute("chartLibrary");y.updateAttributes({...c,...(0,ae.A)(g,!0)}),(0,se.A)(y,e,y.getAttribute("chartLibrary")),y.trigger("fetch")},[y,o,h,g,c]),(0,n.useLayoutEffect)(()=>()=>y.destroy(),[]),(0,S.jsxs)(x.Flex,{gap:6,column:!0,children:[(0,S.jsxs)(x.Flex,{gap:2,column:!0,"data-testid":l,children:[(0,S.jsxs)(x.Flex,{gap:2,children:[(0,S.jsx)(x.H5,{children:"Chart context"}),(0,S.jsx)(de,{})]}),(0,S.jsx)(x.Select,{options:s,value:r,onChange:a,isClearable:!0,form:l})]}),r&&(0,S.jsx)(x.Flex,{height:{min:"320px"},column:!0,children:(0,S.jsx)(Y.A,{chart:y,margin:[2,0,0]})})]})};var ue=o(43116);const he={label:"All Nodes",value:"all-nodes"},pe={label:"All Nodes (no reachable nodes)",value:"all-nodes",isDisabled:!0},xe=e=>{let{id:t,isLive:o,nodeStatus:n,name:r}=e;return{label:o?r:`${r} (${n})`,value:t,isDisabled:!o}},ge=e=>({value:e,label:e}),me=e=>{let{id:t,onClose:o}=e;const r=(0,m.vt)(),a=(0,u.ID)(),s=(0,l.fz)(t,"name"),i=(0,u.XA)("name"),d=(0,L.CK)(),c=(0,p.BU)().length>0,h=(0,L.nj)(),b=(0,p.Gt)(d),f=(0,H.nM)(t),j=c?he:pe,[w,v]=(0,n.useState)(j.value),[k,I]=(0,n.useState)(null),C=(0,n.useMemo)(()=>[j,...b.map(xe)],[b]),T=(0,n.useMemo)(()=>C.find(e=>{let{value:t}=e;return t===w}),[C,w]),F=(0,n.useCallback)(e=>{v(e?.value||j.value),I(null)},[]),N=(0,n.useMemo)(()=>w===j.value?[]:[w],[w]),{charts:A,error:B}=(0,y.A)(r,a,N),D=(0,n.useMemo)(()=>Object.keys(A).sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:"accent",ignorePunctuation:!0})).map(ge),[A]);(0,n.useEffect)(()=>{D.length&&T&&I(e=>e||D[0].value)},[k,D,T]);const M=(0,n.useMemo)(()=>k&&ge(k),[k]),_=(0,n.useCallback)(e=>I(e?.value),[]),O=A[k],z=(0,Z.eg)(),E=(0,n.useCallback)(()=>{const e=z.getNode({id:"newDashboardChart"}),t=(0,ae.h)(e.getAttributes());f(t.contextScope,t,()=>setTimeout(o))},[w,O]),$=!k,[,P]=(0,K.A)();return(0,n.useEffect)(()=>(P(!0),()=>P(!1))),(0,S.jsx)(G.GO,{onClose:o,children:B?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g.z,{onClose:o,title:"Add Chart to Dashboard"}),(0,S.jsx)(G.Yv,{height:"100%",padding:[0,8],children:(0,S.jsx)(ue.A,{error:B})})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(g.z,{onClose:o,title:"Add Chart to Dashboard",children:(0,S.jsx)(x.Button,{label:"Add chart",icon:"plus",onClick:E,disabled:$,"data-testid":"addChartModal-addChart-button"})}),(0,S.jsxs)(V.U,{children:["Add Charts to ",s]}),(0,S.jsx)(G.Yv,{overflow:"visible",children:(0,S.jsxs)(x.Flex,{gap:6,column:!0,children:[(0,S.jsxs)(x.Flex,{gap:2,column:!0,"data-testid":"addChartModal-selectNodes",children:[(0,S.jsxs)(x.H5,{children:["Nodes in ",i]}),(0,S.jsx)(x.Select,{options:C,value:T,onChange:F,isLoading:!h,isClearable:!0,form:"addChartModal-selectNodes"})]}),M&&(0,S.jsx)(ce,{id:t,spaceId:r,roomId:a,value:M,onChange:_,options:D,testid:"addChartModal-selectChart",selectedNodeIds:N,metadata:A[k]})]})})]})})};var ye=o(28864),be=o(44245),fe=o(63872);o(37550);const je=e=>"function"===e.type&&"feed"!==e.flavour,we=e=>"chart"===e.type||("function"===e.type&&"feed"===e.flavour||"function"!==e.type&&"selectedNodeIds"in e),ve=e=>{const t=(0,c._S)(e);return(0,n.useMemo)(()=>(e=>{const t=Object.values(e),o=t.some(we),n=t.filter(je),r=[{type:"global",hasNodeFilter:o}];return n.forEach(e=>{r.push({type:"singleNode",cardId:e.id,cardTitle:e.customTitle||e.displayName||e.id,flavour:e.flavour})}),r})(t||{}),[t])};var ke=o(38757);const Ie=e=>{let{name:t,setName:o,isNameValid:n,setIsNameValid:r,globalNodeIds:a,setGlobalNodeIds:s,hasNodeFilter:l}=e;const i=(0,L.CK)();return(0,S.jsxs)(x.Flex,{column:!0,gap:4,children:[(0,S.jsx)(ke.A,{value:t,label:"Dashboard Name",onChange:e=>o(e.target.value),isValid:n,setIsValid:r,"data-testid":"duplicateWizard-name-input"}),l&&(0,S.jsxs)(x.Flex,{column:!0,gap:2,children:[(0,S.jsx)(x.Text,{strong:!0,children:"Select Nodes"}),(0,S.jsx)(B.A,{nodeIds:i,selectedNodeIds:a,setSelectedNodeIds:s})]})]})},Ce={fn:"Function",logs:"Logs",function:"Function"},Se=e=>{let{cardTitle:t,flavour:o,selectedNodeId:n,setSelectedNodeId:r}=e;const a=(0,L.CK)();return(0,S.jsxs)(x.Flex,{column:!0,gap:4,children:[(0,S.jsxs)(x.Flex,{column:!0,gap:1,children:[(0,S.jsx)(x.Text,{strong:!0,children:t}),(0,S.jsxs)(x.Text,{color:"textLite",children:[Ce[o]||"Function"," card"]})]}),(0,S.jsxs)(x.Flex,{column:!0,gap:2,children:[(0,S.jsx)(x.Text,{strong:!0,children:"Select Node"}),(0,S.jsx)(B.A,{nodeIds:a,selectedNodeIds:n?[n]:[],setSelectedNodeIds:e=>r(e[0]||null),multi:!1})]})]})},Te=e=>{let{dashboardId:t,onClose:o}=e;const{name:a,slug:s}=(0,l.fz)(t),i=(0,L.CK)(),d=ve(t),h=(0,r.Zp)(),p=(0,u.r9)(),m=(0,be.DF)(),[y,f]=(0,n.useState)(0),[j,w]=(0,n.useState)(a),[v,k]=(0,n.useState)(!0),[I,C]=(0,n.useState)([]),[T,F]=(0,n.useState)(()=>{const e={};return d.forEach(t=>{"singleNode"===t.type&&(e[t.cardId]=i[0]||null)}),e}),N=(0,ye.DH)(t),A=d[y],B=y===d.length-1,D=0===y,[M,_]=(0,n.useState)(!1),[,O]=(0,fe.A)(),z=(0,b.yF)((0,n.useCallback)((e,o)=>{const n=e((0,c.nG)({id:t}));Object.entries(n).forEach(e=>{let[n,r]=e;"chart"===r.type&&I.length>0?o((0,c.nG)({id:t,resourceId:n}),e=>({...e,nodesScope:I})):"function"===r.type&&"feed"!==r.flavour&&T[n]?o((0,c.nG)({id:t,resourceId:n}),e=>({...e,selectedNodeIds:[T[n]]})):("function"===r.type&&"feed"===r.flavour&&I.length>0||"selectedNodeIds"in r&&I.length>0)&&o((0,c.nG)({id:t,resourceId:n}),e=>({...e,selectedNodeIds:I}))}),o((0,l.Qx)({id:t}),e=>({...e,duplicate:null,...j!==a?{name:j}:{}}))},[t,I,T,j,a])),E=(0,b.yF)((0,n.useCallback)((e,o)=>{o((0,l.Qx)({id:t}),e=>({...e,duplicate:null}))},[t])),$=(0,n.useCallback)(async()=>{_(!0),z();try{const{data:e}=await N(),{slug:n}=e;if(n!==s){const e=`${p}/dashboards/${n}`;m({id:t,slug:n,path:e}),h(e,{replace:!0})}o()}catch(e){O(e),_(!1)}},[z,N,o,O,s,p,m,t,h]),P=(0,n.useCallback)(async()=>{_(!0),E();try{await N(),o()}catch(e){O(e),_(!1)}},[E,N,o,O]),U=(0,n.useCallback)(()=>{B?$():f(e=>e+1)},[B,$]),R=(0,n.useCallback)(()=>{f(e=>Math.max(0,e-1))},[]);return(0,S.jsxs)(G.GO,{onClose:o,"data-testid":"duplicateWizard-modal",children:[(0,S.jsx)(g.z,{onClose:o,title:"Set Up Duplicate",children:(0,S.jsx)(x.Flex,{gap:2,children:(0,S.jsx)(x.Button,{label:"Skip, I'll keep it as is",flavour:"hollow",onClick:P,disabled:M,"data-testid":"duplicateWizard-skip"})})}),(0,S.jsx)(G.Yv,{children:(0,S.jsxs)(x.Flex,{column:!0,gap:4,children:[(0,S.jsxs)(x.Text,{color:"textLite",children:["Step ",y+1," of ",d.length]}),"global"===A.type&&(0,S.jsx)(Ie,{name:j,setName:w,isNameValid:v,setIsNameValid:k,globalNodeIds:I,setGlobalNodeIds:C,hasNodeFilter:A.hasNodeFilter}),"singleNode"===A.type&&(0,S.jsx)(Se,{cardTitle:A.cardTitle,flavour:A.flavour,selectedNodeId:T[A.cardId],setSelectedNodeId:e=>F(t=>({...t,[A.cardId]:e}))}),(0,S.jsxs)(x.Flex,{justifyContent:"between",gap:2,children:[!D&&(0,S.jsx)(x.Button,{label:"Back",flavour:"hollow",onClick:R,"data-testid":"duplicateWizard-back"}),(0,S.jsx)(x.Flex,{flex:!0}),(0,S.jsx)(x.Button,{label:B?"Complete":"Next",onClick:U,disabled:!v||M,isLoading:M,"data-testid":"duplicateWizard-next"})]})]})})]})};var Fe=o(88255),Ne=o(65380),Ae=o(42790),Le=o(83330),Be=o(60908),De=(o(8872),o(85163)),Me=o(71123);const _e=function(e,t){let{containerIds:o,containers:n,layout:r}=e,{extraKey:a}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const s={},l=o.reduce((e,o)=>{const l=(0,Me.bj)(r[o],"vertical");return e[o]={...n[o],level:0,id:o,subMenuIds:l.reduce((e,n)=>{let{id:r}=n;return"text"!==t(r).type&&e.push(`${o}|${r}`),e},[]),subMenuChartIds:[],link:`${(0,De.A)(`menu_${o}`)}`,forceVisibility:!0,arFlavour:"anomaly",extraKey:a},l.forEach(e=>{const n=`${o}|${e.id}`,r=t(e.id);"text"!==r.type&&(s[n]={name:r.title,level:1,id:n,menuId:o,chartIds:[],link:`${(0,De.A)(`menu_${o}_submenu_${n}`)}`,arFlavour:"anomaly",showAR:!1,extraKey:a})}),e},{});return{menuIds:o,menuById:l,subMenuById:s}};var Oe=o(6304),ze=o(57738),Ee=o(99728),$e=o(67294),Pe=o(51262),Ue=o(39175);const Re=e=>{let{id:t}=e;const[o,r]=(0,l.TN)({id:t,key:"name"}),[a,s]=(0,n.useState)(o||"");(0,n.useEffect)(()=>{s(o||"")},[o]);const i=(0,n.useCallback)(e=>{s(e.target.value)},[]),d=(0,n.useCallback)(()=>{a!==o&&r(a||"Untitled Dashboard")},[a,o,r]);return(0,S.jsx)(x.TextInput,{value:a,onChange:i,onBlur:d,placeholder:"Untitled Dashboard","data-testid":"dashboardHeader-title-input",width:"180px"})},qe=function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];!function(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{navigator:o}=(0,n.useContext)(r._3),a=(0,r.zy)();(0,n.useEffect)(()=>{if(!t)return;const n=o.block(t=>{const o={...t,retry(){n(),t.retry()}};e(o)});return n},[o,e,t,a])}((0,n.useCallback)(t=>{"REPLACE"!==t.action?window.confirm(e)&&t.retry():t.retry()},[e]),t)},Ge="Are you sure you want to leave this dashboard?\nChanges will be lost.";var Ve=o(51571);const Ke=e=>{let{id:t}=e;const[,o]=(0,fe.A)(),n=(0,ye.DH)(t,{onFail:o}),r=(0,l.fz)(t,"processing"),a=(0,l.fz)(t,"isOwner"),s=(0,l.zN)(t);return(0,S.jsx)(Ve.A,{permission:a?"dashboard:UpdateSelf":"dashboard:Update",label:"Save",onClick:()=>n(),disabled:s,isLoading:r,"data-testid":"dashboardHeaderActionBar-save-button","data-ga":"action-bar::click-save::cust-dashboard"})},He=e=>{let{id:t}=e;const o=(e=>{const t=(0,l.zN)(e),o=(0,ye.Cb)(e),r=(0,i.x3)();return(0,n.useCallback)(()=>{if(!t){if(!window.confirm(Ge))return;o()}r(!1)},[t,o,r])})(t);return(0,S.jsxs)(x.Flex,{gap:2,alignItems:"center",children:[(0,S.jsx)(Ke,{id:t}),(0,S.jsx)(x.Button,{label:"Exit",flavour:"hollow",onClick:o,"data-testid":"dashboardHeaderActionBar-exit-button","data-ga":"action-bar::click-exit::cust-dashboard"})]})},We=(0,n.memo)(He);var Qe=o(74891),Je=o(93912);const Ye=(0,Qe.A)(x.Toggle),Ze=(0,S.jsxs)(Je.A,{title:"Apply global filters",description:"Controls which nodes each card queries.",children:[(0,S.jsxs)(x.Text,{color:"tooltipText",children:[(0,S.jsx)(x.Text,{strong:!0,color:"tooltipText",children:"When ON"})," ","\u2014 every card uses the dashboard's global node filter."]}),(0,S.jsxs)(x.Text,{color:"tooltipText",children:[(0,S.jsx)(x.Text,{strong:!0,color:"tooltipText",children:"When OFF"})," ","\u2014 cards with their own node selection use that selection; cards without one fall back to the global filter."]}),(0,S.jsx)(x.TextSmall,{color:"tooltipText",italic:!0,children:"Single-node cards (e.g. a function or logs card with one node picked) always use their selected node regardless of this toggle."})]}),Xe=e=>{let{id:t,...o}=e;const[r,a]=(0,l.TN)({id:t,key:"respectNodesScope"}),s=(0,ye.DH)(t),i=(0,n.useCallback)(()=>{a(!r),s()},[r,a]);return(0,S.jsx)(Ye,{...o,colored:!0,onChange:i,checked:!r,margin:[0],labelRight:"Apply global filters",tooltip:Ze})};var et=o(82308),tt=o(72402),ot=o(93337);const nt=e=>{let{id:t}=e;const o=(0,n.useRef)(null),[r,a]=(0,n.useState)(null),[,s]=(0,fe.A)(),l=(0,et.Uu)(),i=(0,et.BG)(t),d=(0,c._S)(t),u=!d||0===Object.keys(d).length,h=(0,n.useCallback)(async e=>{const t=e.target.files?.[0];if(e.target.value="",!t)return;const o=await t.text(),n=(0,tt.DK)(o);if(!n.ok)return void s({header:"Import",text:n.error});const r=(0,tt.L8)(n.value);r.ok?a(n.value):s({header:"Import",text:`Invalid dashboard file: ${r.error}`})},[s]),p=(0,n.useCallback)(()=>a(null),[]),g=(0,n.useCallback)(e=>{a(null),i(e)},[i]);return(0,S.jsxs)(x.Flex,{gap:2,alignItems:"center",children:[(0,S.jsx)(x.IconButton,{icon:"download",tooltip:u?"Dashboard is empty":"Export dashboard",flavour:"hollow",small:!0,disabled:u,onClick:()=>l(t),"data-testid":"dashboardHeader-export-button"}),(0,S.jsx)(x.IconButton,{icon:"upload",tooltip:"Import into dashboard",flavour:"hollow",small:!0,onClick:()=>o.current?.click(),"data-testid":"dashboardHeader-import-button"}),(0,S.jsx)("input",{ref:o,type:"file",accept:".json,application/json",style:{display:"none"},onChange:h,"data-testid":"dashboardHeader-import-file"}),r&&(0,S.jsx)(ot.A,{payload:r,mode:"extend",onConfirm:g,onClose:p})]})};var rt=o(67916),at=o(12273),st=o(81214);const lt=e=>{let{dashboardId:t,spaceId:o,roomId:r,onClose:a}=e;const[s,l]=(0,n.useState)(!1),[i,d]=(0,n.useState)(null),[c,u]=(0,n.useState)(!1),[{after:h,before:p}]=(0,Ae.N9)();return(0,S.jsx)(x.Modal,{backdropProps:{backdropBlur:!0},onClickOutside:a,onEsc:a,children:(0,S.jsxs)(x.ModalContent,{width:"600px",children:[(0,S.jsxs)(x.ModalHeader,{children:["TV Mode URL",(0,S.jsx)(x.ModalCloseButton,{onClose:a})]}),(0,S.jsx)(x.ModalBody,{column:!0,gap:4,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(at.FU,{children:i}),(0,S.jsxs)(x.Flex,{alignItems:"center",background:"warningBackground",gap:4,padding:[3,3],round:!0,children:[(0,S.jsx)(x.Text,{color:"warning",children:"\u26a0\ufe0f"}),(0,S.jsx)(x.Text,{children:"This URL contains a unique access token. Keep it secure and only share with trusted users."})]})]}):(0,S.jsx)(x.Text,{children:"Generate a shareable TV mode URL for this dashboard. A new access token will be created automatically."})}),(0,S.jsxs)(x.ModalFooter,{gap:2,children:[(0,S.jsx)(x.Button,{flavour:"hollow",onClick:a,children:"Cancel"}),i?(0,S.jsx)(x.Button,{onClick:async()=>{if(i)try{await(0,st.A)(i)&&(u(!0),setTimeout(()=>u(!1),2e3))}catch(e){console.error("Failed to copy URL:",e)}},children:c?"Copied!":"Copy URL"}):(0,S.jsx)(x.Button,{onClick:async()=>{l(!0);try{const e=function(e,t,o,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const s=window.location.origin,l=new URLSearchParams(location.search).get("agent");return`${s}/webviews/dashboards/${t}?space_id=${o}&room_id=${n}${l?`&agent=${l}`:""}#token=${e}&after=${r}&before=${a}`}((await(0,rt.Ey)({description:`TV Mode - Dashboard ${t}`,scope:"scope:all"})).data.token,t,o,r,h,p);d(e)}catch(e){console.error("Failed to create token:",e)}finally{l(!1)}},disabled:s,children:s?"Generating...":"Generate a new URL"})]})]})})};var it=o(46587);const dt=(0,Qe.A)(x.Button),ct=e=>{let{dashboardId:t,spaceId:o,roomId:r,iconOnly:a,small:s}=e;const l=(0,it.uW)("isAnonymous"),[i,d]=(0,n.useState)(!1),c=(0,n.useMemo)(()=>l?"Sign in first to generate a TV mode URL":"Generate TV Mode URL",[l]);return(0,S.jsxs)(S.Fragment,{children:[a?(0,S.jsx)(x.IconButton,{icon:"monitoring",tooltip:c,flavour:"hollow",small:s,onClick:()=>d(!0),"data-testid":"tv-button",disabled:l}):(0,S.jsx)(dt,{flavour:"hollow",icon:"monitoring",tooltip:c,onClick:()=>d(!0),"data-testid":"tv-button",textTransform:"none",disabled:l,noWrapper:!0,children:"TV mode"}),i&&(0,S.jsx)(lt,{dashboardId:t,spaceId:o,roomId:r,onClose:()=>d(!1)})]})},ut=e=>{let{id:t,onOpenDuplicateWizard:o}=e;const{name:r,spaceId:a,roomId:s,duplicate:d}=(0,l.fz)(t),c=(0,i.x3)(),u=(0,ze.L)(),h=(0,Ee.JT)("dashboard:Create"),p=(0,$e.q)(),{hasLimitations:g,maxDashboards:m}=(0,Pe.A)(),y=p.some(e=>e===Ue.LA),b=h&&!(g&&p.length-(y?1:0)>=m),[f,,j,w]=(0,Oe.A)(),v=(0,n.useCallback)(()=>{w(),u(t)},[t,u,w]);return(0,S.jsxs)(x.Flex,{justifyContent:"between",alignItems:"center",padding:[4,0],"data-testid":"dashboardHeader",children:[(0,S.jsx)(x.Text,{color:"text",children:r||"Untitled Dashboard"}),(0,S.jsxs)(x.Flex,{gap:2,alignItems:"center",children:[d&&(0,S.jsx)(x.IconButton,{icon:"gear",tooltip:"Set up duplicate",flavour:"hollow",small:!0,onClick:o,"data-testid":"dashboardHeader-updateDuplicate-button","data-ga":"header::click-update-duplicate::cust-dashboard"}),(0,S.jsx)(x.IconButton,{icon:"settings",tooltip:"Edit dashboard",flavour:"hollow",small:!0,onClick:()=>c(!0),"data-testid":"dashboardHeader-edit-button","data-ga":"header::click-edit::cust-dashboard"}),(0,S.jsx)(x.IconButton,{icon:"copy",tooltip:b?"Duplicate dashboard":"Cannot duplicate",flavour:"hollow",small:!0,onClick:j,disabled:!b,"data-testid":"dashboardHeader-duplicate-button","data-ga":"header::click-duplicate::cust-dashboard"}),(0,S.jsx)(ct,{dashboardId:t,spaceId:a,roomId:s,iconOnly:!0,small:!0})]}),f&&(0,S.jsx)(x.ConfirmationDialog,{title:"Duplicate dashboard",message:`A new dashboard named "Copy of ${r||"Untitled Dashboard"}" will be created in this room with the same layout and card configuration. Node selections will be reset so you can configure them for the new dashboard.`,confirmLabel:"Duplicate",handleConfirm:v,handleDecline:w,isConfirmPositive:!0,hideIcon:!0,"data-testid":"dashboardHeader-duplicate-confirm","data-ga":"header::confirm-duplicate::cust-dashboard"})]})},ht=e=>{let{id:t}=e;return(0,S.jsxs)(x.Flex,{justifyContent:"between",alignItems:"center",padding:[4,0],"data-testid":"dashboardHeader",children:[(0,S.jsxs)(x.Flex,{gap:2,alignItems:"center",children:[(0,S.jsx)(Re,{id:t}),(0,S.jsx)(nt,{id:t})]}),(0,S.jsxs)(x.Flex,{gap:4,alignItems:"center",children:[(0,S.jsx)(Xe,{id:t}),(0,S.jsx)(We,{id:t})]})]})},pt=e=>{let{id:t,isEditMode:o,onOpenDuplicateWizard:n}=e;return o?(0,S.jsx)(ht,{id:t}):(0,S.jsx)(ut,{id:t,onOpenDuplicateWizard:n})},xt=(0,n.memo)(pt);var gt=o(85877);const mt="typography",yt="metrics",bt="functions",ft="logs",jt="feed",wt="infrastructure",vt="roomOverview",kt="presets",It=[{id:mt,icon:"text_add",tooltip:"Typography"},{id:yt,icon:"room_overview",tooltip:"Metrics"},{id:bt,icon:"live",tooltip:"Live"},{id:ft,icon:"logs",tooltip:"Logs"},{id:jt,icon:"feed",tooltip:"Events"},{id:wt,icon:"nodes_hollow",tooltip:"Infrastructure"},{id:vt,icon:"room_home",tooltip:"Room Overview"},{id:kt,icon:"dashboard",tooltip:"Templates"}],Ct=(0,P.default)(x.Flex).attrs(e=>{let{$active:t}=e;return{alignItems:"center",justifyContent:"center",cursor:"pointer",padding:[3,4],round:.5,border:{side:"all",color:"primary"},background:t?"primary":"transparent",_hover:t?{background:"primary"}:{background:"primary",backgroundOpacity:.1},zIndex:51}}).withConfig({displayName:"toolbar__ToolbarButtonContainer",componentId:"sc-18uufnr-0"})(["transition:background 0.15s;"]),St=e=>{let{id:t,icon:o,tooltip:n,isActive:r,onClick:a}=e;return(0,S.jsx)(Ct,{"data-testid":`toolbar-button-${t}`,$active:r,onClick:a,title:n,children:(0,S.jsx)(x.Icon,{name:o,color:r?"mainBackground":"primary",width:"16px",height:"16px"})})},Tt=()=>{const e=(0,i.wz)(),t=(0,i.ww)();return(0,S.jsx)(x.Flex,{"data-testid":"palette-toolbar",column:!0,alignItems:"center",justifyContent:"center",padding:[0,2],gap:6,height:"100%",children:It.map(o=>(0,S.jsx)(St,{id:o.id,icon:o.icon,tooltip:o.tooltip,isActive:e===o.id,onClick:()=>t(o.id)},o.id))})};var Ft=o(25616);const Nt=e=>{let{item:t}=e;const{context:o,metadata:r,nodeIds:a}=t,s=(0,Z.eg)(),l=(0,m.vt)(),i=(0,u.ID)(),d=(0,Q.K)({spaceId:l,roomId:i}),c=`preview-${o}`,h=(0,n.useMemo)(()=>{s.getNodes({id:c}).forEach(e=>e.destroy());const{info:e,valueRange:t,height:n,colors:l}=(0,W.Ay)(r),u=s.makeChart({attributes:{id:c,contextScope:[o],host:d,roomId:i,info:e,valueRange:t,height:(n||0)+207,enabledNavigation:!1,nodesScope:a,...l&&{colors:l}}});return s.getRoot().appendChild(u),u},[s,o,c,d,i,r,a]);return(0,n.useLayoutEffect)(()=>()=>h.destroy(),[h]),(0,S.jsx)(x.Flex,{height:{min:"320px"},column:!0,children:(0,S.jsx)(Y.A,{chart:h,margin:[2,0,0]})})};var At=o(31522),Lt=o(65067),Bt=o(56452);const Dt=e=>{let{item:t}=e;const{selectedNodeIds:o,groupBy:n=[],colorBy:r=At.jZ}=t.config,a=(0,L.CK)(),s=(0,L.nj)(),l=o?.length?o:a,i=(0,p.Gt)(l);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:"Node Grid"})}),(0,S.jsx)(x.Flex,{flex:!0,overflow:"auto",children:(0,S.jsx)(Bt.A,{nodes:i,groupBy:n,colorBy:r,loaded:s})})]})};var Mt=o(49181),_t=o(59092);const Ot={nodeStatus:e=>(0,Mt.GM)(e.state),alertStatus:e=>{if((e.alerts_critical||0)>0)return"Critical";return(e.alerts_warning||0)>0?"Warning":"No alerts"}},zt=e=>{let{item:t}=e;const{selectedNodeIds:o,groupBy:r}=t.config,a=(0,L.CK)(),s=(0,L.nj)(),l=o?.length?o:a,i=(0,p.Gt)(l),d=(0,n.useMemo)(()=>(e=>{const t={reachable:0,stale:1,unreachable:2,created:3};return[...e].sort((e,o)=>(t[e.state]??4)-(t[o.state]??4))})(i),[i]),c=(0,n.useMemo)(()=>{const e=Ot[r];if(!e)return null;const t={};return d.forEach(o=>{const n=e(o);t[n]||(t[n]=[]),t[n].push(o)}),Object.entries(t)},[d,r]);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:`Node List (${i.length})`})}),(0,S.jsx)(x.Flex,{flex:!0,column:!0,overflow:"auto",children:(0,S.jsx)(_t.A,{nodes:d,groupedNodes:c,loaded:s,nodeCount:i.length})})]})};var Et=o(41716),$t=o(19075),Pt=o(94230);const Ut=e=>{let{item:t}=e;const{selectedNodeIds:o}=t.config,r=(0,Et.s)("ids")||[],a=(0,Et.s)("loaded"),s=(0,$t.Gq)(r),l=(0,n.useMemo)(()=>o?.length?new Set(o):null,[o]),{critical:i,warning:d}=(0,n.useMemo)(()=>(l?s.filter(e=>l.has(e.nodeId)):s).reduce((e,t)=>{let{status:o}=t;return e[o]=(e[o]||0)+1,e},{critical:0,warning:0,clear:0}),[s,l]);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:"Alert Status"})}),(0,S.jsx)(x.Flex,{flex:!0,column:!0,overflow:"hidden",children:(0,S.jsx)(Pt.A,{critical:i,warning:d,loaded:a})})]})};var Rt=o(95760);const qt=e=>{let{item:t}=e;const{selectedNodeIds:o}=t.config,r=(0,L.CK)(),a=o?.length?o:r,s=(0,p.Gt)(a),l=(0,L.nj)(),i=(0,Et.s)("ids")||[],d=(0,Et.s)("loaded"),c=(0,$t.Gq)(i),u=l&&d,h=(0,n.useMemo)(()=>{const e={};return c.forEach(t=>{if(!t.nodeId)return;e[t.nodeId]||(e[t.nodeId]={critical:[],warning:[]});const o=t.status?.toLowerCase();"critical"===o?e[t.nodeId].critical.push(t):"warning"===o&&e[t.nodeId].warning.push(t)}),s.map(t=>({node:t,criticalAlerts:e[t.id]?.critical||[],warningAlerts:e[t.id]?.warning||[]})).filter(e=>{let{criticalAlerts:t,warningAlerts:o}=e;return t.length>0||o.length>0}).sort((e,t)=>{const o=1e3*e.criticalAlerts.length+e.warningAlerts.length;return 1e3*t.criticalAlerts.length+t.warningAlerts.length-o})},[s,c]);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:"Alerts Per Node"})}),(0,S.jsx)(x.Flex,{flex:!0,column:!0,overflow:"auto",children:(0,S.jsx)(Rt.A,{nodesWithAlerts:h,nodeCount:s.length,loaded:u})})]})};var Gt=o(52346);const Vt=72e5,Kt=3e5,Ht=e=>{let{item:t}=e;const{selectedNodeIds:o}=t.config,r=(0,Et.s)("ids")||[],a=(0,Et.s)("loaded"),s=(0,$t.Gq)(r),l=(0,L.CK)(),i=o?.length?o:l,{buckets:d,maxTotal:c,totalAlerts:u}=(0,n.useMemo)(()=>{const e=Date.now(),t=e-Vt,n=Array.from({length:24},(e,o)=>({ts:t+o*Kt,critical:0,warning:0})),r=o?.length?s.filter(e=>i.includes(e.nodeId)):s;r.forEach(o=>{if(!o.lastUpdated)return;const r=1e3*o.lastUpdated;if(r<t||r>e)return;const a=Math.floor((r-t)/Kt);if(a<0||a>=24)return;const s=o.status?.toLowerCase();"critical"===s?n[a].critical++:"warning"===s&&n[a].warning++});const a=Math.max(...n.map(e=>e.critical+e.warning),1),l=r.filter(o=>{const n=o.status?.toLowerCase();if("critical"!==n&&"warning"!==n)return!1;if(!o.lastUpdated)return!1;const r=1e3*o.lastUpdated;return r>=t&&r<=e}).length;return{buckets:n,maxTotal:a,totalAlerts:l}},[s,o,i]);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:`Alerts by Hour (${u})`})}),(0,S.jsx)(x.Flex,{flex:!0,column:!0,overflow:"hidden",padding:[2],children:(0,S.jsx)(Gt.A,{buckets:d,maxTotal:c,totalAlerts:u,loaded:a})})]})};var Wt=o(77125);const Qt=e=>{let{item:t}=e;const{selectedNodeIds:o,visibleItems:r}=t.config,a=(0,L.CK)(),s=o?.length?o:a,l=(0,p.Gt)(s),i=(0,L.nj)(),d=(0,Et.s)("ids")||[],c=(0,Et.s)("loaded"),u=(0,$t.Gq)(d),h=i&&c,g=(0,n.useMemo)(()=>new Set(s),[s]),m=(0,n.useMemo)(()=>{const e={Live:0,Stale:0,Offline:0,Unseen:0};return l.forEach(t=>{const o=(0,Mt.GM)(t.state);e[o]=(e[o]||0)+1}),e},[l]),{critical:y,warning:b,clear:f}=(0,n.useMemo)(()=>(o?.length?u.filter(e=>g.has(e.nodeId)):u).reduce((e,t)=>{let{status:o}=t;return e[o]=(e[o]||0)+1,e},{critical:0,warning:0,clear:0}),[u,o,g]);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:`Nodes (${Object.values(m).reduce((e,t)=>e+t,0)})`})}),(0,S.jsx)(x.Flex,{flex:!0,column:!0,overflow:"auto",children:(0,S.jsx)(Wt.A,{statusCounts:m,critical:y,warning:b,clear:f,visibleItems:r,loaded:h})})]})};var Jt=o(58533),Yt=o(87242);const Zt=[],Xt=e=>{let{item:t}=e;const{visibleItems:o}=t.config||{},{loaded:r,metricsCollected:a=0}=(0,Jt.VH)(),s=(0,m.vt)(),l=(0,u.ID)(),{charts:i,loaded:d,error:c}=(0,y.A)(s,l,Zt),h=Object.keys(i).length,{loaded:p,value:g}=(0,$t.oU)(),b=g?.length||0,f=(0,n.useMemo)(()=>[{id:"metrics",label:"Metrics available",value:a,loaded:r},{id:"charts",label:"Charts visualized",value:h,loaded:d&&!c},{id:"alerts",label:"Alerts configured",value:b,loaded:p}].filter(e=>!o||o.includes(e.id)),[a,r,h,d,c,b,p,o]);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:"Stats Overview"})}),(0,S.jsx)(x.Flex,{flex:!0,alignItems:"center",justifyContent:"center",gap:4,children:(0,S.jsx)(Yt.A,{stats:f})})]})};var eo=o(46025);const to=e=>{let{item:t}=e;const{dataRetention:o,loaded:n}=(0,Jt.VH)();return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:"Data Retention per Node"})}),(0,S.jsx)(x.Flex,{flex:!0,overflow:"hidden",padding:[2,3,3],children:n?o?.length?(0,S.jsx)(eo.A,{dataRetention:o}):(0,S.jsx)(x.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:"No retention data"})}):(0,S.jsx)(x.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:"Loading..."})})})]})};var oo=o(7761),no=o(39431);const ro=e=>{let{item:t}=e;const{visibleItems:o}=t.config||{},n=(0,oo.jg)();return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"transparent",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:"Nodes with most alerts (24h)"})}),(0,S.jsx)(x.Flex,{flex:!0,column:!0,overflow:"auto",gap:3,children:(0,S.jsx)(no.A,{alertsStats:n,visibleItems:o,loaded:n.loaded})})]})};var ao=o(19529);const so=e=>{let{item:t}=e;const{visibleItems:o}=t.config||{},{loaded:r,totalParents:a,totalChildren:s,totalStandalone:l,replicationFactor:i}=(0,oo.c8)(),d=(0,n.useMemo)(()=>[{label:"Parents",value:a,color:["blue","indigo"],id:"parents"},{label:"Children",value:s,color:["purple","lilac"],id:"children"},{label:"Standalone",value:l,color:["yellow","yellow120"],id:"standalone"}].filter(e=>!o||o.includes(e.id)),[a,s,l,o]),c=(0,n.useMemo)(()=>[{label:"None",value:i?.r_1||0,color:At.q5.r_1,id:"none"},{label:"Single",value:i?.r_2||0,color:At.q5.r_2,id:"single"},{label:"Multi",value:i?.["r_*"]||0,color:At.q5["r_*"],id:"multi"}].filter(e=>!o||o.includes(e.id)),[i,o]);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"elementBackground",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:"Replication"})}),(0,S.jsx)(x.Flex,{flex:!0,column:!0,overflow:"auto",gap:3,children:(0,S.jsx)(ao.A,{topologyData:d,replicationData:c,loaded:r})})]})};o(33110);var lo=o(81989),io=o(44252),co=o(13607),uo=o(26571),ho=o(81445),po=o(71488);const xo=(0,n.lazy)(()=>Promise.all([o.e(7986),o.e(6370)]).then(o.bind(o,20675))),go=(0,n.lazy)(()=>Promise.all([o.e(5219),o.e(8723)]).then(o.bind(o,78723))),mo=e=>{let{item:t}=e;const{selectedFn:o,flavour:r,visibleItems:a,nodeIds:s,fnType:l,flowView:i,acceptedParams:d,functionParamsFilters:c,defaultCharts:u,displayName:h}=t.config,p=(0,uo.A)({selectedFn:o,selectedNodeIds:s,fnType:l,flowView:i,acceptedParams:d,functionParamsFilters:c,enablePolling:!1}),{loading:g,loaded:m,data:y,columns:b,error:f,sortedColumns:j,sortColumn:w,sortDirection:v,columnVisibility:k,pinnedColumns:I,groupByColumns:C,manualSorting:T,charts:F,onRefresh:N,histogram:A,availableHistograms:L,customCharts:B}=p,D=!a||a.includes("charts"),M=!a||a.includes("table"),_=D&&!!u?.length,O=D&&!!A,z=D&&!!B,E="feed"===r,$=(0,n.useCallback)(()=>{},[]);return(0,S.jsxs)(Lt.A,{column:!0,overflow:"hidden",background:"transparent",border:{side:"all",color:"borderSecondary"},children:[(0,S.jsx)(x.Flex,{padding:[2,3],children:(0,S.jsx)(x.Text,{strong:!0,children:h||o||"Function"})}),(0,S.jsxs)(x.Flex,{flex:!0,column:!0,overflow:"hidden",children:[!m&&g&&(0,S.jsx)(x.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:"Loading..."})}),f&&(0,S.jsx)(x.Flex,{padding:[2,3],alignItems:"center",children:(0,S.jsx)(x.Text,{color:"error",children:"string"===typeof f?f:f.errorMessage||"Error"})}),m&&"flows"===l&&(0,S.jsx)(n.Suspense,{fallback:null,children:(0,S.jsx)(xo,{flowView:i,flowRows:p.flowRows,flowColumns:p.flowColumns,flowGroupByKeys:p.flowGroupByKeys,flowTimeseries:p.flowTimeseries,flowMapFlows:p.flowMapFlows,visibleItems:a,selectedFn:o,selectedNodeIds:s})}),m&&"topology"===l&&(0,S.jsx)(n.Suspense,{fallback:null,children:(0,S.jsx)(go,{topologyGraph:p.topologyGraph,topologyActorRows:p.topologyActorRows,presentation:p.presentation,filterKey:JSON.stringify(c||{})})}),m&&(!l||"table"===l)&&(_||M||O||z)&&(0,S.jsxs)(x.Flex,{flex:!0,column:!0,overflow:"hidden",gap:2,children:[O&&(0,S.jsx)(lo.A,{...M&&{height:"380px"},histogram:A,availableHistograms:L,data:y,histogramId:A?.id,filters:(c||{})[A?.id]||null,onFiltersChange:$,toolboxReload:e=>{let{disabled:t}=e;return(0,S.jsx)(co.A,{onRefresh:N,loading:g,testId:"preview-function-histogram",dataGa:"preview-function-histogram"})},hideToolbox:!0,nodeIds:s,fn:o}),_&&(0,S.jsx)(po.A,{defaultCharts:u,charts:F,data:y,columns:b,groupByColumns:C,loaded:m,selectedFn:o,onRefresh:N,loading:g,compact:M,hideToolbox:!0}),z&&(0,S.jsx)(io.A,{customCharts:B,data:y,containerWidth:0,paramsKey:{extraKey:"preview"}}),M&&(0,S.jsx)(ho.A,{title:(0,S.jsx)(co.A,{onRefresh:N,loading:g,testId:"preview-function-table",dataGa:"preview-function-table"}),data:y,columns:b,sortedColumns:j,sortColumn:w,sortDirection:v,columnVisibility:k,pinnedColumns:I,groupByColumns:C,loaded:m,manualSorting:T,isFeed:E})]}),m&&(!l||"table"===l)&&!_&&!M&&!O&&!z&&(0,S.jsx)(x.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:D?"No chart data":"No table data"})})]})]})},yo={chart:Nt,text:null,nodeGrid:Dt,nodeList:zt,alertStatus:Ut,alertsPerNode:qt,hourlyAlerts:Ht,nodeStats:Qt,statsOverview:Xt,dataRetention:to,alertNodes:ro,replicationStats:so,function:mo},bo=e=>{let{item:t}=e;const o=yo[t.type];return o?(0,S.jsx)(Ft.Ay,{fallback:(0,S.jsx)(Ft.dK,{canRetry:!1}),children:(0,S.jsx)(o,{item:t})}):null},fo=e=>{let{items:t}=e;return(0,S.jsx)(x.Flex,{column:!0,gap:3,overflow:"auto",width:"100%",children:t.map(e=>(0,S.jsx)(bo,{item:e},e.type+"-"+(e.context||e.config?.textType||e.config?.selectedFn||"")))})},jo=e=>{let{title:t}=e;return(0,S.jsx)(x.Text,{color:"text",fontSize:"12px",lineHeight:"16px",children:t})},wo=e=>{let{label:t="Import",onClick:o,disabled:n}=e;return(0,S.jsx)(x.Flex,{justifyContent:"end",padding:[4,0],children:(0,S.jsx)(x.Button,{label:t,onClick:o,disabled:n})})},vo={title:!1,subtitle:!1,body:!1},ko={title:x.H1,subtitle:x.H4,body:x.TextBig},Io=e=>{let{type:t,label:o,preview:n,checked:r,onToggle:a}=e;const s=ko[t];return(0,S.jsxs)(x.Flex,{column:!0,gap:2,padding:[2,3],border:{side:"all",color:"border"},width:"100%",height:{min:"78px"},children:[(0,S.jsxs)(x.Flex,{alignItems:"center",gap:1,children:[(0,S.jsx)(x.Checkbox,{checked:r,onChange:a}),(0,S.jsx)(x.Text,{color:"text",children:o})]}),(0,S.jsx)(s,{color:"textFocus",children:n})]})},Co=e=>{let{dashboardId:t,onPreviewChange:o}=e;const[r,a]=(0,n.useState)(vo),s=(0,H.Kv)(t),l=(0,i.WM)(),d=e=>a(t=>({...t,[e]:!t[e]}));(0,n.useEffect)(()=>{if(!o)return;const e=[];r.title&&e.push({type:"text",config:{textType:"title"}}),r.subtitle&&e.push({type:"text",config:{textType:"subtitle"}}),r.body&&e.push({type:"text",config:{textType:"body"}}),o(e)},[r,o]);const c=r.title||r.subtitle||r.body;return(0,S.jsxs)(x.Flex,{column:!0,gap:2,flex:!0,children:[(0,S.jsx)(jo,{title:"Titles and text"}),(0,S.jsxs)(x.Flex,{column:!0,gap:2.5,children:[(0,S.jsx)(Io,{type:"title",label:"Title",preview:"Heading 1",checked:r.title,onToggle:()=>d("title")}),(0,S.jsx)(Io,{type:"subtitle",label:"Subtitle",preview:"Heading 2",checked:r.subtitle,onToggle:()=>d("subtitle")}),(0,S.jsx)(Io,{type:"body",label:"Body",preview:"Lorem Ipsum",checked:r.body,onToggle:()=>d("body")})]}),(0,S.jsx)(wo,{label:"Import components",onClick:()=>{let e=null;r.title&&(e=s({dashboardId:t,textType:"title"})),r.subtitle&&(e=s({dashboardId:t,textType:"subtitle"})),r.body&&(e=s({dashboardId:t,textType:"body"})),a(vo),l(null),e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=document.querySelector(`[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})})})},disabled:!c})]})};var So=o(95932);const To=e=>{let{label:t}=e;return(0,S.jsx)(x.Text,{color:"textLite",fontSize:"11px",lineHeight:"14px",children:t})};var Fo=o(98054),No=o(33099),Ao=o(47427);const Lo=e=>{let{children:t,...o}=e;return(0,S.jsx)(x.Flex,{alignItems:"center",gap:2,padding:[1,2],cursor:"pointer",_hover:{background:"borderSecondary"},...o,children:t})},Bo=e=>{let{dashboardId:t,onPreviewChange:o}=e;const[r,a]=(0,n.useState)(new Set),[s,l]=(0,n.useState)(null),[d,c]=(0,n.useState)(null),[u,h]=(0,n.useState)([]),[p,g]=(0,n.useState)({}),m=(0,L.CK)(),y=(0,So.A)(p,{nodeIds:m,selectedNodeIds:u}),{menuIds:b,menuById:f,roomCharts:j}=(0,No.A)(y),w=(0,H.nM)(t),v=(0,i.WM)(),k=(0,Z.eg)();(0,n.useEffect)(()=>{if(!o)return;const e=setTimeout(()=>{const e=Array.from(r).filter(e=>j[e]).map(e=>({type:"chart",context:e,metadata:j[e],nodeIds:y}));o(e)},150);return()=>clearTimeout(e)},[r,y,j,o]);const I=(0,n.useMemo)(()=>d?b.filter(e=>{const t=f[e];return!!t&&t.contexts?.some(e=>d.has(e))}):b,[b,f,d]),C=(0,n.useMemo)(()=>{if(!s||!f[s])return[];const e=(f[s].contexts||[]).filter(e=>j[e]).map(e=>({id:e,context:e,title:j[e].title||e}));return d?e.filter(e=>d.has(e.context)):e},[s,f,j,d]),T=(0,n.useCallback)(e=>{a(t=>{const o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})},[]),F=(0,n.useCallback)(()=>{const e=y.length>0?{nodesScope:y}:{},t=Array.from(r),o=t.length;let n=null;t.forEach((t,r)=>{const a=1===o||3===o&&2===r?12:6;let s={};const l=k.getNode({id:`preview-${t}`});l&&(s=(0,ae.h)(l.getAttributes())),w([t],{...e,...s,itemLayout:{width:a}},e=>{n=e.id})}),a(new Set),v(null),n&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const e=document.querySelector(`[data-id="${n}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[r,w,y,v,k]),N=(0,n.useCallback)(e=>e.contexts?.some(e=>j[e]),[j]),A=r.size>0,D=b.length>0;return(0,S.jsxs)(x.Flex,{column:!0,height:"100%",gap:1,overflow:"hidden",children:[(0,S.jsx)(jo,{title:"Metrics"}),(0,S.jsx)(To,{label:"Select Nodes"}),(0,S.jsx)(B.A,{nodeIds:m,selectedNodeIds:u,setSelectedNodeIds:h,filters:p,setFilters:g}),(0,S.jsx)(To,{label:"Select Metrics"}),(0,S.jsx)(Ao.A,{onFilteredContextIdsChange:c}),(0,S.jsxs)(x.Flex,{height:"100%",overflow:"hidden",children:[(0,S.jsx)(x.Flex,{column:!0,width:"280px",overflow:{vertical:"auto"},padding:[2,0],border:{side:"right",color:"borderSecondary"},children:D?(0,S.jsx)(Fo.A,{menuIds:I,menuById:f,selectedId:s,onSelect:l,isItemVisible:N}):(0,S.jsx)(x.Flex,{padding:[4],justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:"Loading categories..."})})}),(0,S.jsxs)(x.Flex,{column:!0,flex:!0,overflow:{vertical:"auto"},padding:[2,0],children:[!s&&(0,S.jsx)(x.Flex,{padding:[4],justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:"Select a category"})}),s&&0===C.length&&(0,S.jsx)(x.Flex,{padding:[4],justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:"No metrics in this category"})}),C.map(e=>(0,S.jsxs)(Lo,{onClick:()=>T(e.context),children:[(0,S.jsx)(x.Checkbox,{checked:r.has(e.context),onChange:t=>{t.stopPropagation(),T(e.context)}}),(0,S.jsx)(x.Text,{ellipsis:!0,children:e.title})]},e.id))]})]}),(0,S.jsx)(wo,{label:A?`Import (${r.size})`:"Import",onClick:F,disabled:!A})]})};var Do=o(16373),Mo=o(7414);const _o=e=>{let{value:t,onChange:o}=e;return(0,S.jsx)(x.TextInput,{value:t,onChange:e=>o(e.target.value),placeholder:"Search functions...",iconLeft:(0,S.jsx)(x.Icon,{name:"magnify",color:"textLite",size:"small"}),width:"100%",height:"32px"})};var Oo=o(15744),zo=o(33479);const Eo=e=>e.name,$o=e=>e.slug,Po=e=>e?e[0].toUpperCase()+e.slice(1):"",Uo=(e,t)=>{const o=[];return e.forEach(e=>{const n=t[e];n?.isFunction?o.push(e):n?.descendantIds&&o.push(...n.descendantIds)}),o},Ro=(e,t)=>(t[e.value]={name:e.fullLabel||e.label,shortName:Po(e.label),slug:e.value,isFunction:!0},e.value),qo=(e,t)=>{const o=`group:${e.parent}`,n=[];return e.subgroups?.forEach(e=>n.push(qo(e,t))),e.children?.forEach(e=>n.push(Ro(e,t))),t[o]={name:Po(e.parent),childrenIds:n,descendantIds:Uo(n,t)},o},Go=(e,t)=>{const o=e.title.toLowerCase().replace(/\s+/g,"-"),n=[];return e.items.forEach(e=>{"group"===e.type?n.push(qo(e.data,t)):"standalone"===e.type||"leaf"===e.type?n.push(Ro(e.data,t)):"category"===e.type&&n.push(Go(e.data,t))}),t[o]={name:e.title,icon:e.icon,childrenIds:n,descendantIds:Uo(n,t)},o},Vo=(e,t)=>(0,n.useMemo)(()=>{const o=t?e.filter(e=>e.name.toLowerCase().includes(t.toLowerCase())):e,{categories:n,groups:r,standalone:a}=(0,zo.GS)(o,$o,Eo,":",Oo.A),s={},l=[];return n.forEach(e=>l.push(Go(e,s))),r.forEach(e=>l.push(qo(e,s))),a.forEach(e=>l.push(Ro(e,s))),{menuIds:l,menuById:s}},[e,t]);var Ko=o(84103);const Ho={type:"table"},Wo=(e,t,o)=>{const[r,a]=(0,n.useState)({loading:!1,data:null,error:null}),s=(0,u.ID)(),l=(0,p.yN)(t),i=(0,n.useRef)(!1);return(0,n.useEffect)(()=>{if(!e)return void a({loading:!1,data:null,error:null});if("feed"===o)return void a({loading:!1,data:Ho,error:null});if(!t?.length)return void a({loading:!1,data:null,error:null});i.current=!1,a(e=>({...e,loading:!0,error:null}));const n=Date.now();return(0,Ko.JJ)({roomId:s,cloudNodeIds:l,nodeIds:t,fn:e,after:n-9e5,before:n,transactionId:(0,f.A)()}).then(e=>{if(i.current)return;a({loading:!1,data:e?.data||e,error:null})}).catch(e=>{i.current||a({loading:!1,data:null,error:e})}),()=>{i.current=!0}},[e,s,t?.length,l?.[0]]),r};var Qo=o(380);const Jo=e=>{let{flowView:t,onFlowViewChange:o,visibleItems:r,onVisibleItemsChange:a}=e;const s=(0,n.useCallback)(e=>{const t=e.target.value,n=(0,Mo.l3)(t);o(t),a(n.visibleItems)},[o,a]);Mo.KC.find(e=>e.id===t)||Mo.KC[0];return(0,S.jsx)(x.Flex,{column:!0,gap:2,children:Mo.KC.map(e=>{const o=t===e.id;return(0,S.jsxs)(x.Flex,{column:!0,gap:2,children:[(0,S.jsx)(x.RadioButton,{label:e.label,value:e.id,checked:o,onChange:s}),o&&e.items.length>1&&(0,S.jsx)(x.Flex,{padding:[0,0,0,6],children:(0,S.jsx)(Qo.A,{items:e.items,selected:r||[],onChange:a})})]},e.id)})})},Yo=e=>{let{flavour:t,functionInfo:o,flowView:n,visibleItems:r,onFlowViewChange:a,onVisibleItemsChange:s}=e;if("flows"===o?.type)return(0,S.jsx)(Jo,{flowView:n,onFlowViewChange:a,visibleItems:r,onVisibleItemsChange:s});const l=(0,Mo.nV)(o,t);return l.length<=1?null:(0,S.jsx)(Qo.A,{items:l,selected:r||[],onChange:s})},Zo={fn:"Live",logs:"Logs",feed:"Events"},Xo={fn:"Select Function",logs:"Logs Viewer",feed:"Select Event"},en=e=>{let{flavour:t,dashboardId:o,onPreviewChange:r}=e;const[a,s]=(0,n.useState)([]),[l,d]=(0,n.useState)({}),[c,u]=(0,n.useState)(""),[h,p]=(0,n.useState)(null),[g,m]=(0,n.useState)(null),[y,b]=(0,n.useState)(null),[f,j]=(0,n.useState)({}),w="feed"===t,v=(0,L.CK)();(0,n.useEffect)(()=>{!w&&0===a.length&&v.length>0&&s([v[0]])},[w,v]);const k=(0,So.A)(l,{nodeIds:v,selectedNodeIds:a}),{loaded:I,value:C}=(0,Do.vx)({},t),T=(0,n.useMemo)(()=>k.length?C.filter(e=>k.some(t=>e.nodes?.[t])):C,[C,k]),{menuIds:F,menuById:N}=Vo(T,c),A=F.length>1||!!N[F[0]]?.childrenIds?.length;(0,n.useEffect)(()=>{if(!h||!N[h]){for(const e of F){const t=N[e];if(t?.isFunction)return void p(e);if(t?.descendantIds?.length)return void p(t.descendantIds[0])}p(null)}},[F,N]);const D=(0,H.VI)(o),M=(0,i.WM)(),_="feed"!==t,O=k.length>0,z=O||_?k:v,{loading:E,data:$}=Wo(h,z,t);(0,n.useEffect)(()=>{r&&r(h&&!E&&$?[{type:"function",config:{selectedFn:h,flavour:t,visibleItems:y,flowView:g,nodeIds:z,fnType:$.type||"",displayName:N[h]?.name||"",defaultCharts:$.defaultCharts||[],acceptedParams:$.acceptedParams||[],functionParamsFilters:f}}]:[])},[h,y,g,f,z,$,E,r,t,N]);const P=(0,n.useCallback)(e=>{p(t=>t===e?null:e),m(null),b(null),j({})},[]);(0,n.useEffect)(()=>{if(!$?.type)return;const e=(0,Mo.Om)($.type);m(e.flowView||null),b(e.visibleItems)},[h,$?.type]);const U=!!h&&!!$&&!E&&(!_||O),R=(0,n.useCallback)(()=>{if(!U)return;const e=D({dashboardId:o,flavour:t,selectedFn:h,displayName:N[h]?.name||"",selectedNodeIds:z,visibleItems:y,flowView:g,fnType:$.type||"",defaultCharts:$.defaultCharts||[],acceptedParams:$.acceptedParams||[],requiredParams:$.requiredParams||[],columns:$.columns||{},functionParamsFilters:f});M(null),e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=document.querySelector(`[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[U,D,o,t,h,N,z,y,g,$,f,M]);return _&&!O?(0,S.jsxs)(x.Flex,{column:!0,height:"100%",gap:1,overflow:"hidden",children:[(0,S.jsx)(jo,{title:Zo[t]||"Live"}),(0,S.jsx)(To,{label:"Select Node"}),(0,S.jsx)(B.A,{nodeIds:v,selectedNodeIds:a,setSelectedNodeIds:s,filters:l,setFilters:d,multi:!1}),(0,S.jsx)(x.Flex,{flex:!0,alignItems:"center",justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:"Select a node to see available functions"})})]}):(0,S.jsxs)(x.Flex,{column:!0,height:"100%",gap:1,overflow:"hidden",children:[(0,S.jsx)(jo,{title:Zo[t]||"Live"}),"feed"!==t&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(To,{label:w?"Select Nodes":"Select Node"}),(0,S.jsx)(B.A,{nodeIds:v,selectedNodeIds:a,setSelectedNodeIds:s,filters:l,setFilters:d,multi:w})]}),!w&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(To,{label:"Search"}),(0,S.jsx)(_o,{value:c,onChange:u})]}),(0,S.jsxs)(x.Flex,{height:"100%",overflow:"hidden",children:[A&&(0,S.jsxs)(x.Flex,{column:!0,width:"280px",overflow:{vertical:"auto"},padding:[2,0],border:{side:"right",color:"borderSecondary"},children:[(0,S.jsx)(To,{label:Xo[t]||"Select Function"}),F.length>0?(0,S.jsx)(Fo.A,{menuIds:F,menuById:N,selectedId:h,onSelect:P}):(0,S.jsx)(x.Flex,{padding:[4],justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:I?"No functions available":"Loading functions..."})})]}),(0,S.jsxs)(x.Flex,{column:!0,flex:!0,overflow:{vertical:"auto"},padding:[2],children:[!h&&(0,S.jsx)(x.Flex,{padding:[4],justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:I?"No functions available":"Loading functions..."})}),h&&E&&(0,S.jsx)(x.Flex,{padding:[4],justifyContent:"center",children:(0,S.jsx)(x.Text,{color:"textLite",children:"Loading function info..."})}),h&&!E&&$&&(0,S.jsxs)(x.Flex,{column:!0,gap:2,children:[(0,S.jsx)(x.Text,{strong:!0,children:N[h]?.name||h}),(0,S.jsx)(Yo,{flavour:t,functionInfo:$,flowView:g,visibleItems:y,onFlowViewChange:m,onVisibleItemsChange:b})]})]})]}),(0,S.jsx)(wo,{label:"Import",onClick:R,disabled:!U})]})};o(30670),o(71517),o(11379),o(93777),o(14190),o(12359),o(86097),o(17273),o(27415),o(19929),o(37583),o(55122),o(20230),o(57268),o(79733);const tn=e=>{let{children:t,...o}=e;return(0,S.jsx)(x.Flex,{column:!0,round:1,overflow:"hidden",border:{side:"all",color:"borderSecondary"},background:"mainBackground",...o,children:t})},on="nodeGrid",nn="nodeList",rn="alertStatus",an="alertsPerNode",sn="hourlyAlerts",ln={Live:"success",Stale:"warning",Offline:"textLite",Unseen:"textDescription"},dn=e=>{let{nodeStatusCounts:t}=e;if(0===Object.values(t).reduce((e,t)=>e+t,0))return(0,S.jsx)(tn,{padding:[2],children:(0,S.jsx)(x.Text,{color:"textLite",fontSize:"10px",children:"No nodes"})});const o=Object.entries(t).flatMap(e=>{let[t,o]=e;return Array.from({length:o},(e,o)=>({key:`${t}-${o}`,color:ln[t]}))});return(0,S.jsx)(tn,{padding:[2],children:(0,S.jsx)(x.Flex,{gap:1,flexWrap:!0,children:o.slice(0,96).map(e=>{let{key:t,color:o}=e;return(0,S.jsx)(x.Flex,{width:"8px",height:"8px",round:"50%",background:o},t)})})})},cn=e=>{let{nodes:t}=e;const o=t.slice(0,4);return 0===o.length?(0,S.jsx)(tn,{children:(0,S.jsx)(x.Text,{color:"textLite",fontSize:"10px",padding:[1],children:"No nodes"})}):(0,S.jsxs)(tn,{children:[o.map((e,t)=>(0,S.jsxs)(x.Flex,{alignItems:"center",padding:[1],gap:2,border:t<o.length-1?{side:"bottom",color:"borderSecondary"}:void 0,children:[(0,S.jsx)(x.Text,{fontSize:"10px",flex:!0,truncate:!0,children:e.name}),(0,S.jsx)(x.Flex,{flex:!0}),(0,S.jsx)(x.Flex,{width:"8px",height:"8px",round:"50%",background:ln[(0,Mt.GM)(e.state)]})]},e.id)),t.length>4&&(0,S.jsx)(x.Flex,{padding:[1],justifyContent:"center",children:(0,S.jsxs)(x.Text,{fontSize:"9px",color:"textLite",children:["+",t.length-4," more"]})})]})},un=e=>{let{alertCounts:t}=e;return(0,S.jsx)(tn,{children:(0,S.jsxs)(x.Flex,{children:[(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",justifyContent:"center",padding:[2],flex:!0,background:"error",backgroundOpacity:.2,children:[(0,S.jsx)(x.Text,{fontSize:"10px",color:"error",children:"Critical"}),(0,S.jsx)(x.Text,{fontSize:"20px",strong:!0,color:"error",children:t.critical})]}),(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",justifyContent:"center",padding:[2],flex:!0,background:"warning",backgroundOpacity:.2,children:[(0,S.jsx)(x.Text,{fontSize:"10px",color:"warning",children:"Warning"}),(0,S.jsx)(x.Text,{fontSize:"20px",strong:!0,color:"warning",children:t.warning})]})]})})},hn=e=>{let{alertsByNode:t}=e;const o=t.slice(0,3);return 0===o.length?(0,S.jsx)(tn,{padding:[2],children:(0,S.jsx)(x.Text,{color:"textLite",fontSize:"10px",children:"No alerts"})}):(0,S.jsxs)(tn,{padding:[2],children:[o.map(e=>(0,S.jsxs)(x.Flex,{alignItems:"center",gap:2,margin:[0,0,1,0],children:[(0,S.jsx)(x.Text,{fontSize:"11px",truncate:!0,flex:!0,children:e.name}),(0,S.jsxs)(x.Flex,{gap:1,alignItems:"center",children:[e.critical>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(x.Flex,{width:"6px",height:"6px",round:"50%",background:"error"}),(0,S.jsx)(x.Text,{fontSize:"10px",color:"textLite",children:e.critical})]}),e.warning>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(x.Flex,{width:"6px",height:"6px",round:"50%",background:"warning"}),(0,S.jsx)(x.Text,{fontSize:"10px",color:"textLite",children:e.warning})]})]})]},e.nodeId)),t.length>3&&(0,S.jsxs)(x.Text,{fontSize:"9px",color:"textLite",children:["+",t.length-3," more"]})]})},pn=e=>{let{buckets:t}=e;const o=Math.max(1,...t.map(e=>e.critical+e.warning));return(0,S.jsx)(tn,{padding:[2],children:(0,S.jsx)(x.Flex,{alignItems:"end",justifyContent:"center",gap:1,height:"50px",children:t.map((e,t)=>{const n=e.critical+e.warning,r=Math.max(2,Math.round(n/o*48)),a=e.critical>0?"error":e.warning>0?"warning":"mainBackgroundDisabled";return(0,S.jsx)(x.Flex,{width:"6px",height:`${r}px`,background:a,round:1},t)})})})},xn=e=>{let{nodeStatusCounts:t}=e;const o=Object.values(t).reduce((e,t)=>e+t,0);return(0,S.jsxs)(tn,{padding:[2],children:[(0,S.jsx)(x.Flex,{justifyContent:"space-around",children:Object.entries(ln).map(e=>{let[o,n]=e;return(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",gap:0,children:[(0,S.jsx)(x.Flex,{width:"8px",height:"8px",round:"50%",background:n}),(0,S.jsx)(x.Text,{fontSize:"10px",children:t[o]||0})]},o)})}),o>0&&(0,S.jsx)(x.Flex,{justifyContent:"center",margin:[1,0,0,0],children:(0,S.jsxs)(x.Text,{fontSize:"9px",color:"textLite",children:[o," nodes"]})})]})},gn=e=>{let{children:t,...o}=e;return(0,S.jsx)(x.Flex,{column:!0,gap:2,flex:!0,width:{min:0},...o,children:t})},mn=e=>{let{label:t,checked:o,onToggle:n}=e;return(0,S.jsx)(x.Checkbox,{checked:o,onChange:n,label:t})},yn=e=>{let{dashboardId:t,onPreviewChange:o}=e;const[r,a]=(0,n.useState)([]),[s,l]=(0,n.useState)({}),[d,c]=(0,n.useState)(new Set),[u,h]=(0,n.useState)({nodeStats:[]}),g=(0,L.CK)(),m=(0,So.A)(s,{nodeIds:g,selectedNodeIds:r}),y=(0,p.Gt)(g),b=(0,Et.s)("ids")||[],f=(0,$t.Gq)(b),j=(0,n.useMemo)(()=>{if(0===m.length)return y;const e=new Set(m);return y.filter(t=>e.has(t.id))},[y,m]),w=(0,n.useMemo)(()=>{const e={Live:0,Stale:0,Offline:0,Unseen:0};return j.forEach(t=>{const o=(0,Mt.GM)(t.state);e[o]=(e[o]||0)+1}),e},[j]),v=(0,n.useMemo)(()=>{if(0===m.length)return f;const e=new Set(m);return f.filter(t=>e.has(t.nodeId))},[f,m]),k=(0,n.useMemo)(()=>{const e={critical:0,warning:0,clear:0};return v.forEach(t=>{void 0!==e[t.status]&&e[t.status]++}),e},[v]),I=(0,n.useMemo)(()=>{const e={};v.forEach(t=>{e[t.nodeId]||(e[t.nodeId]={critical:0,warning:0}),"critical"===t.status&&e[t.nodeId].critical++,"warning"===t.status&&e[t.nodeId].warning++});const t=new Map(j.map(e=>[e.id,e.name]));return Object.entries(e).map(e=>{let[o,n]=e;return{nodeId:o,name:t.get(o)||o,...n}}).sort((e,t)=>1e3*t.critical+t.warning-(1e3*e.critical+e.warning))},[v,j]),C=(0,n.useMemo)(()=>{const e=Array.from({length:24},()=>({critical:0,warning:0}));return v.forEach(t=>{if(!t.lastUpdated)return;const o=new Date(1e3*t.lastUpdated).getHours();"critical"===t.status&&e[o].critical++,"warning"===t.status&&e[o].warning++}),e},[v]),T=(0,i.WM)(),F=(0,H.hu)(t),N=(0,H.Pp)(t),A=(0,H.Rt)(t),D=(0,H.HR)(t),M=(0,H.h$)(t),_=(0,H.Qv)(t),O=(0,n.useCallback)(e=>{c(t=>{const o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})},[]),z=(0,n.useCallback)((e,t)=>{h(o=>({...o,[e]:t}))},[]),E=(0,n.useCallback)(()=>{const e=m.length>0?{selectedNodeIds:m}:{};let t=null;d.forEach(o=>{switch(o){case on:t=F(e);break;case nn:t=N(e);break;case rn:t=A(e);break;case an:t=D(e);break;case sn:t=M(e)}}),u.nodeStats.length>0&&(t=_({...e,visibleItems:u.nodeStats})),c(new Set),h({nodeStats:[]}),T(null),t&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const e=document.querySelector(`[data-id="${t}"]`);e&&e.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[d,u,m,T,F,N,A,D,M,_]),$=d.size>0||u.nodeStats.length>0;return(0,n.useEffect)(()=>{if(!o)return;if(!$)return void o([]);const e=[...d].map(e=>({type:e,config:{selectedNodeIds:m}}));u.nodeStats.length>0&&e.push({type:"nodeStats",config:{selectedNodeIds:m,visibleItems:u.nodeStats}}),o(e)},[$,d,u,m,o]),(0,S.jsxs)(x.Flex,{column:!0,height:"100%",overflow:"hidden",children:[(0,S.jsx)(jo,{title:"Infrastructure"}),(0,S.jsxs)(x.Flex,{column:!0,flex:!0,overflow:"auto",padding:[3],gap:4,children:[(0,S.jsx)(B.A,{nodeIds:g,selectedNodeIds:r,setSelectedNodeIds:a,filters:s,setFilters:l}),(0,S.jsxs)(x.Flex,{gap:3,children:[(0,S.jsxs)(gn,{children:[(0,S.jsx)(mn,{label:"Node grid",checked:d.has(on),onToggle:()=>O(on)}),(0,S.jsx)(dn,{nodeStatusCounts:w})]}),(0,S.jsxs)(gn,{children:[(0,S.jsx)(mn,{label:"Node List",checked:d.has(nn),onToggle:()=>O(nn)}),(0,S.jsx)(cn,{nodes:j})]})]}),(0,S.jsxs)(x.Flex,{column:!0,gap:3,children:[(0,S.jsx)(x.Text,{strong:!0,children:"Alerts"}),(0,S.jsxs)(x.Flex,{gap:3,children:[(0,S.jsxs)(gn,{children:[(0,S.jsx)(mn,{label:"Alert Status",checked:d.has(rn),onToggle:()=>O(rn)}),(0,S.jsx)(un,{alertCounts:k})]}),(0,S.jsxs)(gn,{children:[(0,S.jsx)(mn,{label:"Alerts per Node",checked:d.has(an),onToggle:()=>O(an)}),(0,S.jsx)(hn,{alertsByNode:I})]})]}),(0,S.jsxs)(gn,{children:[(0,S.jsx)(mn,{label:"Hourly Alerts",checked:d.has(sn),onToggle:()=>O(sn)}),(0,S.jsx)(pn,{buckets:C})]})]}),(0,S.jsx)(Qo.f,{label:"Node Stats",items:Mo.Qu.nodeStats,selected:u.nodeStats,onChange:e=>z("nodeStats",e),children:(0,S.jsx)(xn,{nodeStatusCounts:w})})]}),(0,S.jsx)(wo,{label:"Import",onClick:E,disabled:!$})]})},bn="dataRetention",fn=()=>(0,S.jsx)(tn,{padding:[2],children:(0,S.jsxs)(x.Flex,{justifyContent:"space-around",children:[(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",children:[(0,S.jsx)(x.Text,{fontSize:"8px",color:"textLite",children:"Metrics"}),(0,S.jsx)(x.Text,{fontSize:"14px",strong:!0,children:"1.2K"})]}),(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",children:[(0,S.jsx)(x.Text,{fontSize:"8px",color:"textLite",children:"Charts"}),(0,S.jsx)(x.Text,{fontSize:"14px",strong:!0,children:"340"})]}),(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",children:[(0,S.jsx)(x.Text,{fontSize:"8px",color:"textLite",children:"Alerts"}),(0,S.jsx)(x.Text,{fontSize:"14px",strong:!0,children:"52"})]})]})}),jn=e=>{let{alertsByNode:t}=e;const o=t.slice(0,3);return(0,S.jsxs)(tn,{padding:[2],children:[(0,S.jsx)(x.Flex,{alignItems:"end",justifyContent:"center",gap:1,height:"30px",children:o.map(e=>{const t=e.critical+e.warning,n=Math.max(1,...o.map(e=>e.critical+e.warning)),r=Math.max(4,Math.round(t/n*28));return(0,S.jsxs)(x.Flex,{width:"12px",height:`${r}px`,round:1,children:[e.critical>0&&(0,S.jsx)(x.Flex,{flex:!0,background:"error",round:1}),e.warning>0&&(0,S.jsx)(x.Flex,{flex:!0,background:"warning",round:1})]},e.nodeId)})}),0===o.length&&(0,S.jsx)(x.Text,{fontSize:"10px",color:"textLite",children:"No alerts"})]})},wn=()=>(0,S.jsx)(tn,{padding:[2],children:(0,S.jsx)(x.Flex,{alignItems:"end",justifyContent:"center",gap:2,height:"30px",children:[18,24,12,20,8].map((e,t)=>(0,S.jsx)(x.Flex,{width:"8px",height:`${e}px`,background:"primary",round:1},t))})}),vn=()=>(0,S.jsx)(tn,{padding:[2],children:(0,S.jsxs)(x.Flex,{justifyContent:"space-around",children:[(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",children:[(0,S.jsx)(x.Text,{fontSize:"8px",color:"textLite",children:"Parents"}),(0,S.jsx)(x.Text,{fontSize:"12px",strong:!0,children:"P"})]}),(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",children:[(0,S.jsx)(x.Text,{fontSize:"8px",color:"textLite",children:"Children"}),(0,S.jsx)(x.Text,{fontSize:"12px",strong:!0,children:"C"})]}),(0,S.jsxs)(x.Flex,{column:!0,alignItems:"center",children:[(0,S.jsx)(x.Text,{fontSize:"8px",color:"textLite",children:"Standalone"}),(0,S.jsx)(x.Text,{fontSize:"12px",strong:!0,children:"S"})]})]})}),kn=e=>{let{children:t,...o}=e;return(0,S.jsx)(x.Flex,{column:!0,gap:2,flex:!0,width:{min:0},...o,children:t})},In=e=>{let{label:t,checked:o,onToggle:n}=e;return(0,S.jsx)(x.Checkbox,{checked:o,onChange:n,label:t})},Cn=e=>{let{dashboardId:t,onPreviewChange:o}=e;const[r,a]=(0,n.useState)(new Set),[s,l]=(0,n.useState)({statsOverview:[],alertNodes:[],replicationStats:[]}),d=(0,L.CK)(),c=(0,p.Gt)(d),u=(0,Et.s)("ids")||[],h=(0,$t.Gq)(u),g=(0,n.useMemo)(()=>{const e={};h.forEach(t=>{e[t.nodeId]||(e[t.nodeId]={critical:0,warning:0}),"critical"===t.status&&e[t.nodeId].critical++,"warning"===t.status&&e[t.nodeId].warning++});const t=new Map(c.map(e=>[e.id,e.name]));return Object.entries(e).map(e=>{let[o,n]=e;return{nodeId:o,name:t.get(o)||o,...n}}).sort((e,t)=>1e3*t.critical+t.warning-(1e3*e.critical+e.warning))},[h,c]),m=(0,i.WM)(),y=(0,H.fM)(t),b=(0,H.Vs)(t),f=(0,H.ez)(t),j=(0,H.cj)(t),w=(0,n.useCallback)(e=>{a(t=>{const o=new Set(t);return o.has(e)?o.delete(e):o.add(e),o})},[]),v=(0,n.useCallback)((e,t)=>{l(o=>({...o,[e]:t}))},[]),k=Object.values(s).some(e=>e.length>0),I=r.size>0||k;(0,n.useEffect)(()=>{if(!o)return;if(!I)return void o([]);const e=Array.from(r).map(e=>({type:e,config:{}}));Object.entries(s).forEach(t=>{let[o,n]=t;n.length>0&&e.push({type:o,config:{visibleItems:n}})}),o(e)},[I,r,s,o]);const C=(0,n.useCallback)(()=>{let e=null;r.forEach(t=>{if(t===bn)e=b({})}),Object.entries(s).forEach(t=>{let[o,n]=t;if(0===n.length)return;const r={statsOverview:y,alertNodes:f,replicationStats:j}[o];r&&(e=r({visibleItems:n}))}),a(new Set),l({statsOverview:[],alertNodes:[],replicationStats:[]}),m(null),e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{const t=document.querySelector(`[data-id="${e}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"nearest"})})})},[r,s,m,y,b,f,j]);return(0,S.jsxs)(x.Flex,{column:!0,height:"100%",overflow:"hidden",children:[(0,S.jsx)(jo,{title:"Room Overview"}),(0,S.jsxs)(x.Flex,{column:!0,flex:!0,overflow:"auto",padding:[3],gap:4,children:[(0,S.jsx)(Qo.f,{label:"Stats Overview",items:Mo.Qu.statsOverview,selected:s.statsOverview,onChange:e=>v("statsOverview",e),children:(0,S.jsx)(fn,{})}),(0,S.jsx)(Qo.f,{label:"Alert Nodes",items:Mo.Qu.alertNodes,selected:s.alertNodes,onChange:e=>v("alertNodes",e),children:(0,S.jsx)(jn,{alertsByNode:g})}),(0,S.jsxs)(kn,{children:[(0,S.jsx)(In,{label:"Data Retention",checked:r.has(bn),onToggle:()=>w(bn)}),(0,S.jsx)(wn,{})]}),(0,S.jsx)(Qo.f,{label:"Replication",items:Mo.Qu.replicationStats,selected:s.replicationStats,onChange:e=>v("replicationStats",e),children:(0,S.jsx)(vn,{})})]}),(0,S.jsx)(wo,{label:"Import",onClick:C,disabled:!I})]})},Sn={[mt]:Co,[yt]:Bo,[bt]:e=>(0,S.jsx)(en,{...e,flavour:"fn"}),[ft]:e=>(0,S.jsx)(en,{...e,flavour:"logs"}),[jt]:e=>(0,S.jsx)(en,{...e,flavour:"feed"}),[wt]:yn,[vt]:Cn},Tn={[mt]:718,[yt]:680,[bt]:680,[ft]:680,[jt]:680,[wt]:680,[vt]:680},Fn={top:"top",left:"right"},Nn=(0,P.default)(x.Flex).withConfig({displayName:"palette__AnimatedContainer",componentId:"sc-112dxl5-0"})(["transition:width 0.2s ease-out;max-width:calc(100vw - 200px);"]),An=e=>{let{panelId:t,dashboardId:o,targetRef:r,onClose:a}=e;const[s,l]=(0,n.useState)([]),i=(0,n.useMemo)(()=>Sn[t],[t]),d=Tn[t]||680,c=s.length>0,u=s.some(e=>{const{fnType:t,flowView:o}=e.config||{};return"topology"===t||!("flows"!==t||!o||"table-sankey"===o)})?640:420;const h=c?d+u:d;return i&&r.current?(0,S.jsx)(x.Drop,{align:Fn,target:r.current,onEsc:a,onClickOutside:a,dataDrop:"palette-panel-drop",zIndex:68,backdrop:!0,backdropProps:{background:["transparent","full"],zIndex:50},margin:[2,0,0,2],children:(0,S.jsxs)(Nn,{width:`${h}px`,height:{max:"80vh"},background:"panelBg",overflow:"hidden",children:[(0,S.jsx)(x.Flex,{width:`${d}px`,padding:[4],children:(0,S.jsx)(i,{dashboardId:o,onPreviewChange:l})}),c&&(0,S.jsx)(x.Flex,{flex:!0,padding:[4],border:{side:"left",color:"borderSecondary"},overflow:"auto",background:"panelBg",children:(0,S.jsx)(fo,{items:s})})]})}):null},Ln=e=>{let{dashboardId:t}=e;const o=(0,i.wz)(),r=(0,i.WM)(),a=(0,n.useRef)(null),s=(0,n.useCallback)(()=>r(null),[]);return(0,S.jsxs)(x.Flex,{ref:a,height:"100%",children:[(0,S.jsx)(Tt,{}),o===kt&&(0,S.jsx)(E,{dashboardId:t,onClose:s}),o&&o!==kt&&(0,S.jsx)(An,{panelId:o,dashboardId:t,targetRef:a,onClose:s},o)]})},Bn=()=>((0,Ne.A)(),null),Dn=(0,n.memo)(e=>{let{id:t,roomId:o,nodeIds:u=[],isOnTV:h}=e;const[p,,,x]=(0,a.A)("addChartModal"),{fullyLoaded:g,cardIds:m,name:y}=(0,l.fz)(t),b=(0,i.tD)(),f=(0,i.x3)(),j=(0,n.useRef)(!1);(0,n.useEffect)(()=>{g&&!j.current&&(j.current=!0,f(0===m.length))},[g,m.length,f]);const w=(0,r.zy)(),v=(0,r.Zp)(),[k,I]=(0,n.useState)(!1);(0,n.useEffect)(()=>{g&&w.state?.showDuplicateWizard&&(I(!0),v(w.pathname,{replace:!0,state:{}}))},[g]);const C=(0,n.useCallback)(()=>I(!0),[]),T=(0,n.useCallback)(()=>I(!1),[]);(e=>{const t=(0,l.zN)(e),o=(0,i.tD)();qe(Ge,o&&!t)})(t);const[F,{width:N}]=(0,s.A)(),[A,L]=(0,Ae.N9)("chartName",{key:o,extraKey:t,flavour:"val"}),B=(0,d.Xc)(t),D=(0,c.T6)(t);return(0,S.jsx)(Be.Ay,{feature:"custom-dashboard",children:(0,S.jsx)(Jt.Ay,{dashboardId:t,children:(0,S.jsxs)(Le.A,{getObject:D,ids:B,getMenu:_e,extraKey:t,children:[(0,S.jsx)(Bn,{}),!h&&b&&(0,S.jsx)(Ln,{dashboardId:t}),(0,S.jsxs)(Fe.A,{ref:F,overflow:"hidden",background:"mainBackground",padding:[0,4],children:[!h&&(0,S.jsx)(xt,{id:t,isEditMode:b,onOpenDuplicateWizard:C}),g&&m.length>0&&(0,S.jsx)(q,{active:b&&!h,children:(0,S.jsx)(gt.A,{id:t,containerWidth:N,initialChartName:A,onChartNameChange:L,isOnTV:h})}),g&&0===m.length&&!h&&(0,S.jsx)(q,{active:!0,children:(0,S.jsx)($,{dashboardId:t})}),p&&!h&&(0,S.jsx)(me,{id:t,onClose:x}),k&&(0,S.jsx)(Te,{dashboardId:t,onClose:T})]})]})})})}),Mn=(0,n.memo)(e=>{let{id:t,isOnTV:o}=e;const n=(0,u.ID)(),r=(0,h.w7)({extraKey:"dashboard",merge:!1,scoped:!0}),a=(0,p.TG)(r);return(0,S.jsx)(Dn,{id:t,roomId:n,nodeIds:a,isOnTV:o})})},93337(e,t,o){o.d(t,{A:()=>a});o(98992),o(54520),o(96540);var n=o(38429),r=o(74848);const a=e=>{let{payload:t,mode:o,onConfirm:a,onClose:s}=e;const l=Object.values(t.cards),i=l.filter(e=>"chart"===e.type).length,d=l.filter(e=>"text"===e.type).length,c="new"===o?`Import "${t.name}" as a new dashboard`:`Extend current dashboard with "${t.name}"`,u="new"===o?"A new dashboard will be created in this room.":"Imported cards will be appended below the current content.",h=(0,r.jsxs)(r.Fragment,{children:["Contains ",(0,r.jsxs)("strong",{children:[i," charts"]})," and ",(0,r.jsxs)("strong",{children:[d," text cards"]}),".",(0,r.jsx)("br",{}),u]});return(0,r.jsx)(n.ConfirmationDialog,{confirmLabel:"Import",declineLabel:"Cancel",handleConfirm:()=>a(t),handleDecline:s,message:h,title:c,"data-testid":"importDashboardDialog"})}},72402(e,t,o){o.d(t,{DK:()=>a,L8:()=>l,M7:()=>d,kv:()=>i});o(98992),o(30670),o(3949),o(81454),o(8872),o(71517),o(11379),o(93777),o(14190),o(12359),o(86097),o(17273),o(27415),o(19929),o(37583),o(55122),o(20230),o(57268),o(79733);var n=o(1011),r=o(82418);const a=e=>{try{return{ok:!0,value:JSON.parse(e)}}catch(t){return{ok:!1,error:`Invalid dashboard file: ${t.message}`}}},s=e=>e&&"object"===typeof e&&!Array.isArray(e),l=e=>{if(!s(e))return{ok:!1,error:"root must be an object"};if("string"!==typeof e.name||!e.name)return{ok:!1,error:"name must be a non-empty string"};if(!s(e.cards)||0===Object.keys(e.cards).length)return{ok:!1,error:"cards must be a non-empty object"};if(!Array.isArray(e.containerIds)||0===e.containerIds.length)return{ok:!1,error:"containerIds must be a non-empty array"};if(!s(e.containers))return{ok:!1,error:"containers must be an object"};if(!s(e.layout))return{ok:!1,error:"layout must be an object"};for(const[t,o]of Object.entries(e.cards)){if(!s(o))return{ok:!1,error:`cards[${t}] must be an object`};if("string"!==typeof o.type)return{ok:!1,error:`cards[${t}].type must be a string`}}for(const t of e.containerIds){const o=e.layout[t];if(!Array.isArray(o))return{ok:!1,error:`layout[${t}] must be an array`};for(let n=0;n<o.length;n++){const r=o[n];if(!s(r)||"string"!==typeof r.id)return{ok:!1,error:`layout[${t}][${n}].id required`};if(!e.cards[r.id])return{ok:!1,error:`layout[${t}][${n}] references unknown card ${r.id}`};if(["top","left","width","height"].some(e=>"number"!==typeof r[e]))return{ok:!1,error:`layout[${t}][${n}] missing numeric placement`}}}return{ok:!0}},i=e=>{const t=new Map,o={};Object.values(e.cards).forEach(e=>{const r=(0,n.A)();t.set(e.id,r),o[r]={...e,id:r}});const r=Object.keys(e.layout).reduce((o,n)=>(o[n]=e.layout[n].map(e=>({...e,id:t.get(e.id)})),o),{});return{...e,cards:o,layout:r,idMap:t}},d=(e,t)=>{const o=i(e),a=t.layoutState.containerIds?.[0]||"A",s=t.layoutState.layout?.[a]||[],l=(s||[]).reduce((e,t)=>Math.max(e,(t.top??0)+(t.height??0)),0);const d=(0,n.A)(),c={id:d,type:"text",text:`<p>${e.name}</p>`,textType:"title"},u={id:d,top:l,left:0,width:12,height:r.JN};let h=l+r.JN;const p=(o.containerIds||Object.keys(o.layout)).flatMap(e=>(o.layout[e]||[]).map(e=>{const t={...e,top:h,left:e.left??0};return h+=e.height??0,t})),x=[...s,u,...p];return{headerId:d,targetContainerId:a,newCards:{...o.cards,[d]:c},layoutEntriesForTarget:x}}}}]);