File: //proc/self/root/opt/netdata/netdata-web-files/v3/7817.6be287c5d1ae6124eb99.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:"6866bb78c87eb499c83445c224071f481cf2061d"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="9b2f743c-c438-44a9-9bd6-eb7b31846f1e",e._sentryDebugIdIdentifier="sentry-dbid-9b2f743c-c438-44a9-9bd6-eb7b31846f1e")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[7817],{37817(e,t,n){n.r(t),n.d(t,{default:()=>xt});var i=n(79997),s=n(76667),a=n(74848);const r=e=>{let{Sidebar:t,children:n}=e;return t?(0,a.jsxs)(i._V,{"data-testid":"insights-layout-container",children:[(0,a.jsx)(t,{}),n]}):n};var o=n(55024);const l=()=>(0,a.jsx)(i.p6,{"data-testid":"insights-sidebar-labels",padding:[1,1,0,0],children:(0,a.jsx)(o.A,{showBelowRemainingCredits:3})});var c=n(30413);const d=()=>(0,a.jsxs)(i.oe,{"data-testid":"insights-sidebar-container",children:[(0,a.jsx)(l,{}),(0,a.jsx)(c.A,{})]});var u=n(96540),m=n(38429),h=n(46587),p=n(81685);const g=()=>(0,a.jsxs)(m.Flex,{"data-testid":"insights-overview-header-container",column:!0,gap:2,children:[(0,a.jsx)(m.TextBig,{color:"menuItem",children:"Insights and investigations"}),(0,a.jsxs)(m.Text,{color:"menuItem",lineHeight:1.5,children:["Use Al to run automated investigations and generate insights.",(0,a.jsx)("br",{}),"Make better decisions, faster, without sifting through dashboards or writing complicated queries."]})]});n(98992),n(81454);var x=n(882);const f=(0,x.default)(m.Box).attrs(e=>({...e})).withConfig({displayName:"styled__OverviewGrid",componentId:"sc-wl3070-0"})(["display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;"]);var v=n(27805),b=n(18121),j=n(54521),y=n(25383);const w="panelBg",C=e=>{let{id:t,icon:n,color:i,bg:s=w,title:r,description:o,Component:l,...c}=e;const{loaded:d,onButtonClick:h}=(0,y.A)(),[p,g]=(0,b.useHovered)({},[d]),x=(0,u.useCallback)(()=>{h(t)},[t,h]);return(0,a.jsxs)(j.I0,{ref:p,"data-testid":"insights-overview-report-item-card-container",gap:3,background:g?s:w,justifyContent:"between",border:{side:"all",color:g?i:"mainBackground"},cursor:"pointer",onClick:x,...c,children:[(0,a.jsxs)(m.Flex,{column:!0,gap:3,children:[(0,a.jsxs)(m.Flex,{alignItem:"center",gap:2,children:[(0,a.jsx)(m.Icon,{name:n}),(0,a.jsx)(m.TextBig,{color:i,children:r})]}),(0,a.jsx)(m.Flex,{justifyContent:"center",children:l?(0,a.jsx)(l,{}):null}),(0,a.jsx)(m.Flex,{children:(0,a.jsx)(m.Text,{color:"menuItem",children:o})})]}),(0,a.jsx)(m.Flex,{justifyContent:"end",children:(0,a.jsx)(m.Text,{color:"primary",children:"Generate report"})})]})},k=()=>{const{insights:e,investigations:t}=(0,v.A)();return(0,a.jsxs)(f,{"data-testid":"insights-overview-grid-container",children:[e.map(e=>(0,a.jsx)(C,{...e},e.id)),t.map((e,t)=>(0,a.jsx)(C,{...e,start:2*t+1,span:2},e.id))]})},I=()=>(0,a.jsxs)(m.Flex,{"data-testid":"insights-overview-container",column:!0,gap:4,padding:[4],children:[(0,a.jsx)(g,{}),(0,a.jsx)(k,{})]});n(72577);var S=n(17702);n(54520),n(8872);const T={tiny:m.Text,default:m.TextBig},A=e=>{let{size:t,...n}=e;const i=T[t]||T.default;return(0,a.jsx)(i,{...n})};var F=n(74891);const M=(0,F.A)(m.Icon),B=(P=(0,u.memo)(e=>{let{selectedItems:t=[],placeholder:n,size:i}=e;const s=(0,u.useMemo)(()=>t.filter(Boolean),[t]),r=(0,u.useMemo)(()=>({size:i,truncate:!0,style:{maxWidth:1===s.length?"300px":"150px"}}),[i,s.length]);return s&&s.length?(0,a.jsxs)(m.Flex,{gap:1,alignItems:"center",children:[(0,a.jsx)(A,{...r,children:s[0].label}),t.length>1?(0,a.jsxs)(A,{size:i,whiteSpace:"nowrap",children:["and ",t.length-1," more"]}):null]}):(0,a.jsx)(A,{size:i,color:"placeholder",children:n})}),e=>{let{iconProps:t={},...n}=e;return t.name?(0,a.jsxs)(m.Flex,{alignItems:"center",gap:2,children:[(0,a.jsx)(M,{noWrapper:!0,...t}),(0,a.jsx)(P,{...n})]}):(0,a.jsx)(P,{...n})});var P;const V=e=>{let{selectedItems:t,placeholder:n,ref:i,size:s,isDisabled:r,dataTestId:o,clickOnIcon:l,iconProps:c,onClick:d,...h}=e;const p=(0,u.useMemo)(()=>r?{opacity:.8}:l?{}:{onClick:d,cursor:"pointer"},[r,l,d]),g=(0,u.useMemo)(()=>!r&&l?{onClick:d,cursor:"pointer"}:{},[r,l,d]);return(0,a.jsxs)(m.Flex,{ref:i,gap:2,height:"24px",padding:[1,2],alignItems:"center",justifyContent:"between",background:"inputBg",round:.5,"data-testid":`multi-select-container-${o}`,...p,...h,children:[(0,a.jsx)(B,{size:s,selectedItems:t,placeholder:n,iconProps:c}),(0,a.jsx)(m.Icon,{color:"textLite",name:"chevron_right",rotate:1,width:"24px",...g})]})},R=(0,u.memo)(V);n(74423);var z=n(31792);const N=(0,F.A)(m.Checkbox),q=e=>{let{group:t,label:n,isParent:i}=e;return(0,a.jsxs)(m.Flex,{gap:2,alignItems:"center",padding:[0,0,0,1],children:[(0,a.jsx)(m.Text,{truncate:!0,style:{maxWidth:"200px"},color:t?"textLite":"text",children:n}),i?(0,a.jsx)(m.Pill,{size:"small",flavour:"success",hollow:!0,children:"parent"}):null]})},_=()=>{},D=e=>{let{value:t,maxNumberOfSelectedItems:n,makeItemProps:i,item:s,onItemClick:r,itemProps:o,...l}=e;const{group:c,allSelected:d,someSelected:h,value:p,label:g,isParent:x}=s,{makeItemContainerProps:f=_,makeCheckboxProps:v=_}=i||{},b=(0,u.useMemo)(()=>f({value:t,maxNumberOfSelectedItems:n,item:s,...l}),[f]),j=(0,u.useMemo)(()=>v({value:t,maxNumberOfSelectedItems:n,item:s,...l}),[v]),y=(0,u.useMemo)(()=>c?d:t.includes(p),[c,d,t,p]),w=(0,u.useMemo)(()=>!!n&&(!c&&!y&&t.length===n),[c,y,t,n]),C=(0,u.useCallback)(e=>{r({checked:e,...c?{group:c}:{node:s}})},[c,s,r]);return(0,a.jsx)(z.b1,{"aria-selected":!1,selected:!1,disabled:!1,...l,...o,"data-testid":`multi-select-item-${g}`,multi:!0,padding:[1,c?0:2],...b,children:(0,a.jsx)(m.Flex,{gap:2,alignItems:"center",flex:!0,children:(0,a.jsx)(N,{checked:y,onChange:C,label:(0,a.jsx)(q,{group:c,label:g,isParent:x}),indeterminate:!!c&&h,disabled:w,...j})})})},L={group:!0,label:"Select all"},K=e=>{let{selectedItems:t,setSelectedItems:n,options:i=[],maxNumberOfSelectedItems:s,allSelectedValue:r,hasSearch:o,makeItemProps:l,dataTestId:c}=e;const d=(0,u.useMemo)(()=>t.map(e=>{let{value:t}=e;return t}),[t]),h=(0,u.useMemo)(()=>d.length===i.length,[d,i]),p=(0,u.useMemo)(()=>d.length&&!h,[d,h]),g=(0,u.useMemo)(()=>s&&i.length>s,[i,s]),x=(0,u.useMemo)(()=>{const e=i.find(e=>{let{value:t}=e;return t===r});return[{...{...L,...g?{label:`Select top ${s}`}:e?{label:e.label}:{}},allSelected:h,someSelected:p},...i]},[i,r,h,p,g]),f=(0,u.useCallback)(e=>{let{group:s,node:a,checked:r}=e;s?n(h?[]:i):r?t.find(e=>e.value===a.value)||n([...t,a]):n(t.filter(e=>e.value!==a.value))},[i,t,n,h]);return(0,a.jsx)(m.Flex,{column:!0,gap:2,padding:[2,3],children:(0,a.jsx)(z.V$,{items:x,Item:e=>(0,a.jsx)(D,{maxNumberOfSelectedItems:s,makeItemProps:l,...e}),onItemClick:f,value:d,hasSearch:o,height:{max:"400px"},searchMargin:[0,0,2,0],"data-testid":`multi-select-checkboxes-${c}`})})};var O=n(6304);const W={makeItemContainerProps:()=>{},makeCheckboxProps:()=>{}},$=(0,u.memo)(e=>{let{label:t,value:n,allSelectedValue:i,placeholder:s="Select...",options:r=[],maxNumberOfSelectedItems:o,styles:l={},onChange:c,isDisabled:d,hasSearch:h=!0,clickOnIcon:p,containerProps:g={},accessorProps:x={},dropProps:f={},makeItemProps:v={},dataTestId:b="",iconProps:j}=e;const y=(0,u.useRef)(),{size:w}=l,[C,,k,I]=(0,O.A)(!1),[S,T]=(0,u.useState)([]),F=(0,u.useMemo)(()=>({...W,...v}),[v]),M=(0,u.useMemo)(()=>r.find(e=>{let{value:t}=e;return t===i}),[r,i]),B=(0,u.useMemo)(()=>r.filter(e=>{let{value:t}=e;return t!==i}),[r,i]),P=(0,u.useCallback)(()=>{I();const e=M&&S.length===B.length?[M]:S;c(e)},[M,S,c,I]),V=(0,u.useCallback)(()=>{d||(C?P():k())},[d,C,k,P]);return(0,u.useEffect)(()=>{let e=n?Array.isArray(n)?n:[n]:[];i&&(Array.isArray(n)&&n.find(e=>e.value===i)||n===i)&&(e=B),T(e)},[n,i,B]),(0,a.jsxs)(m.Flex,{flex:"1",column:!0,gap:1,...g,children:[t?(0,a.jsx)(A,{size:w,children:t}):null,(0,a.jsx)(R,{ref:y,placeholder:s,selectedItems:S,size:w,isDisabled:d,dataTestId:b,clickOnIcon:p,iconProps:j,onClick:V,...x}),C&&y.current?(0,a.jsx)(m.Drop,{target:y.current,align:{top:"bottom",left:"left"},background:"modalBackground",margin:[2,0,0],round:.5,close:P,onClickOutside:P,onEsc:P,...f,children:(0,a.jsx)(K,{selectedItems:S,setSelectedItems:T,options:B,allSelectedValue:i,hasSearch:h,dataTestId:b,maxNumberOfSelectedItems:o,makeItemProps:F})}):null]})}),E=$;var H=n(21996),U=n(99094);const G=`${U.Nn}px`,J=e=>{let{definitionId:t,variable:n,variables:i=[],index:s,containerProps:r={},componentProps:o={}}=e;const{onVariableChange:l}=(0,p.g0)(),{id:c,value:d,isMulti:h,fieldPrefix:g,maxLength:x}=n,f=(0,u.useMemo)(()=>{if(0===s)return!0;const e=i[s-1]?.value;return Array.isArray(e)?!!e.length:!!e},[i,s]),v=(0,u.useMemo)(()=>function(){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return 0===e?{}:(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).slice(0,e).reduce((e,t)=>{let{id:n,value:i}=t;return{...e,[n]:i.value}},{})}(i,s),[i,s]),{loaded:b,options:j,error:y}=(0,p._R)({definitionId:t,variableId:c,variables:v}),w="nodes"===n.id,C=!!x,k=x?H.A:h?E:m.Select,I=(0,u.useMemo)(()=>w?(j?.values||[]).filter(e=>{let{value:t}=e;return t!==U.Gr}):[],[w,j]),S=(0,u.useMemo)(()=>({hasSearch:w,...C?{width:"100%",rows:3,fontSize:"12px",maxLength:x,placeholder:"Type your query"}:{},...o}),[w,I.length,C,x,o]),T=(0,u.useCallback)(e=>{l({id:c,value:e})},[c,l]);return y?null:(0,a.jsxs)(a.Fragment,{children:[g?(0,a.jsx)(m.Text,{children:n.fieldPrefix}):null,(0,a.jsx)(m.Flex,{"data-testid":"insights-query-field-container",width:{min:C?80:G,max:C?80:50},padding:[2,1],...r,children:(0,a.jsx)(k,{options:j?.values||[],allSelectedValue:U.Gr,value:d,onChange:T,isMulti:h,isDisabled:!b||!f,styles:{minWidth:G,size:"tiny"},dropProps:{width:70},...S})})]})};var Q=n(85702),Y=n(23117),Z=n(49074);const X=e=>{let{onDismiss:t}=e;return(0,a.jsxs)(m.Flex,{column:!0,gap:4,children:[(0,a.jsxs)(m.Flex,{alignItems:"center",gap:1,children:[(0,a.jsx)(m.Icon,{name:"ai",color:"primaryAI"}),(0,a.jsx)(m.H3,{color:"primaryAI",children:"Schedule report"})]}),(0,a.jsx)(m.TextBig,{children:"Did you know you can schedule this report to automatically run at a time and date of your choice?"}),(0,a.jsx)(m.Flex,{children:(0,a.jsx)(S.A,{label:"OK, don't show again.",flavour:"hollow",small:!0,onClick:t,icon:""})})]})},ee=(0,Z.A)(Q.A),te=e=>{let{definitionId:t,variables:n=[]}=e;const{tooltip:i,isDisabled:s}=(0,Y.J)(),{insights:r=[]}=(0,v.A)(),{title:o,description:l,icon:c,Component:d}=r.find(e=>{let{id:n}=e;return n===t})||{},h=(0,u.useMemo)(()=>({recurrenceValue:U.tC[t]||U.tC.default}),[t]);return(0,a.jsxs)(m.Flex,{"data-testid":"insights-default-query-container",column:!0,alignItems:"center",gap:15,padding:[10,4,0,4],children:[(0,a.jsxs)(m.Flex,{alignItems:"center",column:!0,gap:6,children:[(0,a.jsxs)(m.Flex,{alignItems:"center",column:!0,gap:2,children:[(0,a.jsxs)(m.Flex,{alignItems:"center",gap:1,children:[(0,a.jsx)(m.Icon,{name:c}),(0,a.jsx)(m.TextBig,{color:"menuItem",children:o})]}),(0,a.jsx)(m.Text,{color:"menuItem",children:l})]}),d?(0,a.jsx)(d,{}):null]}),(0,a.jsxs)(m.Flex,{"data-testid":"insights-default-query-fields-container",column:!0,gap:4,padding:[4],background:"panelBg",border:{side:"all",color:"border"},round:!0,children:[(0,a.jsx)(m.Flex,{alignItems:"center",justifyContent:"center",gap:1,flexWrap:!0,height:{min:"30px"},children:n.map((e,i)=>(0,a.jsx)(J,{variable:e,definitionId:t,variables:n,index:i},e.id))}),(0,a.jsxs)(m.Flex,{alignItems:"center",justifyContent:"end",gap:2,children:[(0,a.jsx)(ee,{initialSchedulerState:h,PopoverContent:X,tooltip:i,disabled:s,small:!0,dropContainerProps:{iconContainerProps:{position:"relative",left:"40%"}},popoverProps:{timeout:200,localStorageKey:"dissmiss-report-scheduler-promotion"}}),(0,a.jsx)(Y.A,{small:!0})]})]})]})};var ne=n(43252);const ie="Something went wrong",se=e=>{let{message:t=ie}=e;return(0,a.jsx)(m.Flex,{"data-testid":"insights-investigation-chat-item-error",children:(0,a.jsx)(i.qm,{children:(0,a.jsxs)(m.TextBig,{color:"error",children:["Error: ",t]})})})},ae=e=>{let{type:t,question:n,response:s,error:r}=e;const{message:o}=(0,u.useMemo)(()=>(e=>e?"string"===typeof e?{message:e}:{message:e.response?.data?.errorMessage||e?.message||ie}:{})(r),[r]);return t===ne.$p.error?(0,a.jsx)(se,{message:o}):(0,a.jsxs)(m.Flex,{column:!0,gap:2,children:[n?(0,a.jsx)(m.Flex,{"data-testid":"insights-investigation-chat-item-question",children:(0,a.jsx)(i.qm,{children:(0,a.jsx)(m.TextBig,{children:n})})}):null,s?(0,a.jsx)(m.Flex,{justifyContent:"end","data-testid":"insights-investigation-chat-item-response",children:(0,a.jsx)(i.qm,{background:"inputBg",children:(0,a.jsx)(m.TextBig,{children:s})})}):null]})},re=function(){let{chat:e=[]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,u.useRef)();return(0,u.useEffect)(()=>{t?.current&&t.current.scrollIntoView({behavior:"smooth"})},[e,t?.current]),(0,a.jsxs)(a.Fragment,{children:[e.map(e=>(0,a.jsx)(ae,{...e},e.id)),(0,a.jsx)("div",{ref:t})]})},oe=e=>{let{id:t,title:n,onClick:i}=e;const[s,r]=(0,b.useHovered)({},[]),o=(0,u.useCallback)(()=>{"function"===typeof i&&i({id:t})},[t,i]);return(0,a.jsx)(m.Flex,{ref:s,cursor:"pointer",onClick:o,padding:[2,3],border:{side:"all",color:r?"primary":"border"},children:(0,a.jsx)(m.Text,{color:r?"primary":"menuItem",children:n})})},le=e=>{let{title:t,items:n=[],onItemClick:i}=e;return(0,a.jsxs)(m.Flex,{column:!0,gap:4,padding:[4],background:"panelBg",children:[(0,a.jsx)(m.TextBig,{color:"menuItem",children:t}),n.map(e=>(0,a.jsx)(oe,{onClick:i,...e},e.id))]})},ce=[{id:"troubleshoot-problem",title:"Troubleshoot a problem",items:[{id:"checkout-pods-crashing",title:"Why are my checkout-service pods crashing repeatedly?",content:'Why are my checkout-service pods crashing repeatedly?\n\nContext:\n- Started after: [deployment at 14:00 UTC of version 2.3.1]\n- Impact: [Customer checkout failures, lost revenue ~$X/hour]\n- Recent changes: [Updated payment gateway integration, increased worker threads from 10 to 20]\n- Error pattern in logs: ["connection refused to payment-service:8080", "Java heap space"]\n\nEnvironment: production / eks-prod-us-east-1\nRelated services: payment-service, inventory-service, redis-session-store'},{id:"root-cause-increased-5xx-errors",title:"Find root cause of increased 5xx errors in API gateway",content:'Find root cause of increased 5xx errors in API gateway\n\nweb_log_1m_unmatched and web_log_1m_bad_requests are spiking. Context:\n- Affected endpoints: [/api/v2/checkout, /api/v2/inventory/check]\n- Started when: [Right after payments-service v1.5.0 deployment]\n- External factors: [Marketing campaign launched, 3x normal traffic, new payment provider integration went live]\n- Customer impact: [Cart abandonment up 40%, support tickets about "payment errors"]'},{id:"high-memory-usage",title:"What's causing high memory usage on node web-prod-03?",content:"What's causing high memory usage on node web-prod-03?\n\nThe system.ram utilization alert triggered. Additional context:\n- Recent changes: [Deployed new caching strategy, increased Node.js heap size to 4GB]\n- This node runs: [customer-facing API, websocket connections for live chat]\n- Business impact: [Customer complaints about slow page loads, chat disconnections]\n- Different from other nodes because: [Only node running the legacy monolith alongside microservices]"},{id:"microservices-causing-latency",title:"Which microservices are causing latency in user requests?",content:'Which microservices are causing latency in user requests?\n\nUser experience context:\n- Customer complaints: [Mobile app "freezing" during checkout, web pages taking 5+ seconds to load]\n- Started: [After microservices migration last week]\n- Critical user journeys affected: [Login \u2192 Browse \u2192 Add to Cart \u2192 Checkout]\n\nArchitecture context:\n- Total microservices: [23 services in production]\n- Recent changes: [Split monolith into user, catalog, and order services]\n- Service mesh: [Using Istio with mTLS enabled]\n- Tracing: [Jaeger deployed but only 10% sampling]\n\nSpecific issues observed:\n- [Cascading timeouts during peak hours]\n- [Checkout service calling 7 different services synchronously]\n- [No circuit breakers implemented yet]\n\nBusiness impact: [Cart abandonment up 25%, mobile app store rating dropped to 3.2 stars]'}]},{id:"analyze-change",title:"Analyze a change",items:[{id:"compare-system-metrics",title:"Compare system metrics before and after recent deployment",content:"Compare system metrics before and after recent deployment\n\nDeployment details:\n- Service: user-authentication-service v2.2.0\n- Deployed: 2025-01-24 09:00 UTC\n- Changes: [Switched from JWT to Redis sessions, added Argon2 password hashing, implemented rate limiting]\n\nSpecific concerns:\n- [Users reporting intermittent logouts]\n- [Session persistence issues after pod restarts]\n- [Suspicious increase in redis_connected_clients]\n\nTime windows: 24h before deployment vs 24h after"},{id:"redis-affect-cache-performance",title:"How did the Redis upgrade affect cache performance?",content:"How did the Redis upgrade affect cache performance?\n\nUpgrade: Redis 6.2.7 \u2192 7.2.0 on 2025-01-22 02:00 UTC\n\nBusiness context:\n- [Product catalog cache serving Black Friday traffic prep]\n- [Concerns about new Redis features overhead]\n- [Need to validate investment in upgrade was worthwhile]\n\nSpecific checks needed:\n- Impact on our Node.js connection pooling\n- Whether new eviction policies are better for our use case\n- Any compatibility issues with our caching library"},{id:"impact-of-scaling-from-3-to-5",title:"Show impact of scaling from 3 to 5 replicas on user-service",content:"Show impact of scaling from 3 to 5 replicas on user-service\n\nScaling event: 2025-01-23 15:00 UTC (HPA triggered by cpu.utilization > 80%)\n\nBusiness context:\n- [New feature launch driving 30% more traffic]\n- [Customer complaints about slow profile pages]\n- [Preparing for Super Bowl Sunday traffic spike]\n\nSpecific concerns:\n- [Database connection pool exhaustion errors in logs]\n- [Uneven load distribution despite round-robin LB]\n- [Session affinity issues after scaling]"},{id:"what-changed-in-network-traffic-patterns-this-week",title:"What changed in network traffic patterns this week?",content:"What changed in network traffic patterns this week?\n\nContext for unusual patterns:\n- [Launched new mobile app on Tuesday]\n- [CDN configuration changed Thursday - moved static assets to new domain]\n- [Office VPN migration might be affecting internal traffic]\n- [New customer in Asia significantly increasing APAC traffic]\n\nSpecific concerns:\n- [20% increase in AWS bandwidth costs]\n- [European users reporting latency issues]\n- [Suspicious traffic spike from specific IP ranges]\n\nInfrastructure: AWS multi-region with Istio service mesh"}]},{id:"optimize-performance",title:"Optimize performance",items:[{id:"additional-resources",title:"Which services would benefit most from additional resources?",content:"Which services would benefit most from additional resources?\n\nBusiness context:\n- Budget: [Additional $5K/month approved for scaling]\n- Growth: [20% MoM traffic increase, Black Friday prep needed]\n- New features coming: [Real-time inventory, ML-based recommendations]\n\nCurrent pain points:\n- [Payment service timeouts during flash sales]\n- [Search service degradation when catalog updates run]\n- [Batch processing jobs failing due to OOM kills]\n\nSLA requirements:\n- API 95th percentile < 200ms\n- Search results < 500ms\n- Payment processing < 2s\n\nHelp prioritize which services to scale first for maximum business impact."},{id:"identify-underutilized-nodes-for-cost-optimization",title:"Identify underutilized nodes for cost optimization",content:"Identify underutilized nodes for cost optimization\n\nContext:\n- Monthly AWS bill: [$12K for compute]\n- Environment: Mixed workloads (prod + staging on same cluster)\n- Constraints: [Need 2 nodes per AZ for HA, GPU nodes must stay for ML workloads]\n\nKnown issues:\n- [Dev environments running 24/7 but only used 9-5]\n- [Batch processing nodes idle 20h/day]\n- [Overprovisioned after last Black Friday, traffic never reached expected levels]\n\nGoal: Find $2-3K/month in savings without impacting reliability"},{id:"analyze-container-resource-limits-vs-actual-usage",title:"Analyze container resource limits vs actual usage",content:"Analyze container resource limits vs actual usage\n\nCurrent state:\n- Total pods: [150 across production]\n- Resource requests/limits set: [Only 60% have proper limits defined]\n- Recent OOMKills: [12 in the last week]\n\nProblem indicators:\n- [Some pods using 10% of requested resources (overprovisioned)]\n- [Others constantly hitting CPU throttling]\n- [Memory limits based on old load tests from 2023]\n- [Java apps with -Xmx not aligned with container limits]\n\nBusiness impact:\n- [Wasting ~$3K/month on overprovisioned resources]\n- [Critical services getting throttled during peak hours]\n- [Unpredictable performance affecting SLAs]\n\nRecent changes:\n- [Migrated from VMs to containers 6 months ago]\n- [Copied VM resource allocations without optimization]\n- [Traffic patterns changed significantly after new feature launch]\n\nGoal: Right-size all containers for optimal performance and cost"},{id:"predict-capacity-needs-for-black-friday-traffic",title:"Predict capacity needs for Black Friday traffic",content:"Predict capacity needs for Black Friday traffic\n\nLast year's data:\n- Peak: 50K concurrent users, 2K orders/minute\n- Growth rate: 40% YoY\n- Multiplier: 8-10x normal traffic\n\nCurrent limitations:\n- Payment gateway: 100 TPS rate limit\n- Database connections: 200 max\n- Redis memory: 32GB per node\n- CDN: 100TB monthly quota\n\nBusiness requirements:\n- Zero downtime\n- <500ms response time during peak\n- Handle 3K orders/minute\n- Support new livestream shopping feature\n\nWhat's our scaling strategy and when should we start provisioning?"}]}],de=e=>{let{isNarrow:t,onItemClick:n}=e;return(0,a.jsxs)(m.Flex,{column:!0,gap:4,padding:[2,0,0,0],children:[(0,a.jsx)(m.Flex,{column:!0,gap:2,children:(0,a.jsx)(m.TextBig,{color:"textLite",children:"These examples provide starting templates\u2014customize them with your specific context. Netdata understands any investigation query, not just these categories."})}),(0,a.jsx)(m.Flex,{column:t,gap:4,children:ce.map(e=>(0,a.jsx)(le,{onItemClick:n,...e},e.id))})]})};n(37550);var ue=n(1011);const me=e=>{let{state:t,query:n,variableIds:i}=e;return t&&n?t.clarificationId?(n.variables.find(e=>{let{id:t}=e;return t===i.clarifications})?.value||[]).map(e=>e.id===t.clarificationId?{...e,response:t.textValue}:e):t.textValue:""},he=e=>({id:(0,ue.A)(),type:ne.$p.response,response:e.textValue}),pe=e=>{let{query:t,variableIds:n}=e;return{...t,variables:t.variables.filter(e=>!(e.id===n.clarifications&&!Array.isArray(e.value)))}},ge=()=>!1,xe={textValue:"",textPlaceHolder:"Describe your investigation. Include context like when it started, what changed, impact, and what you've already tried...",variableId:ne.Vs.reportDescription,clarificationId:null,clarifications:[],chat:[],error:null},fe=e=>{let{variables:t,textRef:n,parentRef:i,schedulerState:s}=e;const{query:a,onVariableChange:r}=(0,p.g0)(),o=(0,p.fT)(),[,l]=(0,p.W5)(),[c,d]=(0,u.useState)(xe),{textValue:m,textPlaceHolder:h,chat:g}=c,x=(0,u.useCallback)(()=>{d(e=>({...e,textValue:xe.textValue}))},[xe,d]),f=(0,u.useCallback)(e=>{let{isScheduled:t}=e;n?.current&&n.current.focus(),t?o():(l(),x())},[n,l,x,o]),v=(0,u.useCallback)(e=>{const t=e?.response?.status;if(422===t){const t=e?.response?.data?.details?.clarification_questions;Array.isArray(t)&&(d(e=>{const n=t.filter(t=>!e.clarifications.map(e=>{let{id:t}=e;return t}).includes(t.id));return{...e,variableId:ne.Vs.clarifications,textPlaceHolder:"Type your answer",clarificationId:n[0]?.id,clarifications:[...e.clarifications,...n],chat:[...e.chat,n[0]]}}),x())}else d(t=>({...t,chat:[...t.chat,{id:(0,ue.A)(),type:ne.$p.error,error:e}]}));n?.current&&n.current.focus()},[n,d,x]),{isLoading:b,onGenerate:j}=(0,Y.J)({query:pe({query:a,variableIds:ne.Vs}),onSuccess:f,onError:v,checkErrorNotification:ge,schedulerState:s}),{maxLength:y}=(0,u.useMemo)(()=>t.find(e=>{let{id:t}=e;return t===ne.Vs.reportDescription}),[t]),{items:w}=(0,u.useMemo)(()=>t.find(e=>{let{id:t}=e;return t===ne.Vs.clarifications}),[t]),C=(0,u.useMemo)(()=>w?.properties?.find(e=>{let{id:t}=e;return"response"===t})?.max_length||1e3,[w]),k=(0,u.useMemo)(()=>c.clarificationId?C||ne.Gt:y||ne.Gt,[c,y,C]),I=(0,u.useMemo)(()=>c.clarifications.some(e=>{let{response:t}=e;return!t}),[c]),S=(0,u.useMemo)(()=>c.clarifications.map(e=>{let{id:t}=e;return t}).indexOf(c.clarificationId)===c.clarifications.length-1,[c]),T=(0,u.useMemo)(()=>b?"Loading...":m?.length?null:"Please type something",[b,m]),A=(0,u.useMemo)(()=>!!m?.length,[m]),F=(0,u.useCallback)(e=>{d(t=>({...t,textValue:e}))},[d]),M=(0,u.useCallback)(()=>{const e=me({state:c,query:a,variableIds:ne.Vs});r({id:c.variableId,value:e})},[c,a,r]),B=(0,u.useCallback)(e=>{if(I){const{clarificationId:e,clarifications:t,pendingClarification:n}=(e=>{let t=e.clarificationId;const n=e.clarifications.map((n,i)=>n.id===e.clarificationId?(t=e.clarifications[i+1]?.id,{...n,response:e.textValue}):n),i=n.find(e=>{let{response:t}=e;return!t});return{clarificationId:t,clarifications:n,pendingClarification:i}})(c);if(S){const e={...a,variables:a.variables.map(e=>e.id===ne.Vs.clarifications?{...e,value:t}:e)};d(e=>({...e,chat:[...e.chat,he(e)]})),j(e)}else d(i=>({...i,textValue:xe.textValue,clarificationId:e,clarifications:t,chat:[...i.chat,he(i),n]}))}else d(e=>({...e,chat:[...e.chat,he(e)]})),j(e)},[c,xe,a,I,S,j]),P=(0,u.useCallback)(()=>{A&&B()},[A,B]),V=(0,u.useCallback)(e=>{if("Enter"===e.key&&!e.shiftKey&&A){e.preventDefault(),c.variableId===ne.Vs.reportDescription&&r({id:c.variableId,value:c.textValue});const t=me({state:c,query:a,variableIds:ne.Vs}),n={...a,variables:a.variables.map(e=>e.id===c.variableId?{...e,value:t}:e)};B(pe({query:n,variableIds:ne.Vs}))}},[c,a,A,r,B]),R=(0,u.useCallback)(e=>{let{id:t}=e;const n=(e=>ce.map(e=>[...e.items]).flat().find(t=>t.id===e))(t);n&&(d(e=>({...e,textValue:n.content})),r({id:ne.Vs.reportDescription,value:n.content}),i?.current&&i.current.scrollTo({top:0,behavior:"smooth"}))},[d,r,i]);return{isLoading:b,chat:g,submitButtonToootip:T,canSubmit:A,textValue:m,textPlaceHolder:h,textMaxLength:k,onTextChange:F,onTextBlur:M,onKeyDown:V,onSubmit:P,onExampleItemClick:R}},ve=(0,F.A)(m.Button),be=e=>{let{canSubmit:t,isLoading:n,isActive:i,...s}=e;const r=(0,u.useMemo)(()=>!t||n?{}:{tooltip:i?"Report is scheduled":"Schedule report",tooltipProps:{align:"bottom"}},[i,t,n]);return(0,a.jsx)(ve,{flavour:"hollow",disabled:!t||n,padding:[1,2],label:i?"Scheduled":"Schedule",icon:"clock_hollow",neutral:!i,...r,...s})},je=e=>{let{flavour:t,variables:n,parentRef:s}=e;const r=(0,u.useRef)(),o=t===ne.Rh.troubleshooter,[l,c]=(0,u.useState)(),{isLoading:d,chat:h,submitButtonToootip:p,canSubmit:g,textValue:x,textPlaceHolder:f,textMaxLength:v,onTextChange:b,onTextBlur:j,onKeyDown:y,onSubmit:w,onExampleItemClick:C}=fe({variables:n,textRef:r,parentRef:s,schedulerState:l}),k=!!h.length,I=(0,u.useCallback)(e=>{const{name:t,rrule:n,recipientIds:i}=e||{};c({name:t,rrule:n,recipientIds:i})},[c]),S=l?()=>c():void 0,T=(0,u.useCallback)(e=>(0,a.jsx)(be,{canSubmit:g,isLoading:d,isActive:!!l,...e}),[g,d,l]);return(0,a.jsxs)(m.Flex,{"data-testid":"insights-custom-investigation-container",width:"100%",column:!0,gap:2,padding:[4,4,0,4],children:[k?null:(0,a.jsx)(m.TextBig,{color:"menuItem",children:"Start a New Investigation"}),(0,a.jsxs)(m.Flex,{"data-testid":"insights-investigation-container",width:"100%",alignItems:"center",column:!0,gap:2,children:[k?(0,a.jsx)(m.Flex,{"data-testid":"insights-investigation-chat-container",width:"100%",height:"calc(100vh - 570px)",overflow:{vertical:"auto"},column:!0,gap:2,padding:[2,2,2,0],children:(0,a.jsx)(re,{chat:h})}):null,(0,a.jsx)(m.Flex,{"data-testid":"insights-investigation-prompt-container",width:"100%",column:!0,gap:4,alignItems:"center",justifyContent:"center",children:(0,a.jsxs)(m.Flex,{"data-testid":"insights-investigation-prompt-input-container",width:"100%",position:"relative",children:[(0,a.jsx)(H.A,{ref:r,tabIndex:"0","data-testid":"insights-investigation-prompt-input",width:"100%",maxLength:v,rows:3,placeholder:f,value:x,onChange:b,onBlur:j,onKeyDown:y,autoFocus:"autofocus",disabled:d,round:"2px"}),(0,a.jsxs)(m.Flex,{alignItems:"center",gap:2,position:"absolute",right:"8px",bottom:"8px",children:[(0,a.jsx)(Q.A,{Accessor:T,onSubmit:I,onPause:S}),(0,a.jsx)(ve,{onClick:w,disabled:!g||d,tooltip:p,padding:[.5,1.5],children:(0,a.jsx)(i.AQ,{isBlinking:d,name:"arrow_left",rotate:1})})]})]})})]}),k?null:(0,a.jsx)(de,{isNarrow:o,onItemClick:C})]})};var ye=n(62718),we=n(41588),Ce=n(41716),ke=n(56473);const Ie=()=>{const[e,t]=(0,u.useState)({}),n=(0,Ce.s)("loaded"),i=!!(0,Ce.s)("ids").length,s=(0,ke.QD)({extraKey:"alerts"}),{onVariableChange:a}=(0,p.g0)(),r=(0,u.useCallback)(n=>{const i=Object.keys(n||{}),s=Object.keys(e||{}),r=1===i.length?i:i.filter(e=>!s.includes(e)),o=Object.fromEntries(r.map(e=>[e,!0]));a({id:"alert_transition",value:r?.[0]||""}),t(o)},[e,t,a]);return{rowSelection:e,onRowSelectionChange:r,loaded:n,hasAlerts:i,alerts:s}};var Se=n(61841),Te=n(24013),Ae=n(75894),Fe=n(42376),Me=n(3527),Be=n(74518),Pe=n(79748),Ve=n(93997),Re=n(14681);const ze=e=>{let{row:t,value:n}=e;const{info:i}=t.original;return(0,a.jsx)(Pe.A,{Component:m.Text,flavour:"tableLink",cursor:"pointer",showToolTip:!0,content:i,children:n})},Ne=e=>{let{row:t,nodeName:n}=e;const{id:i,nodeId:s}=t.original,r=(0,Te.d3)(s,{alertId:i});return(0,a.jsx)(Re.A,{nodeId:s,extraKey:"alerts",onClick:r,"data-testid":`alertsTableSchema-nodeName-${n}`,"data-ga":`alerts-table::click-node::alerts-view::${n}`,children:n})},qe=e=>{let{row:t,value:n}=e;const{id:i,nodeId:s,instanceName:r}=t.original,o=(0,Te.d3)(s,{alertId:i}),l=`Go to the chart for instance "${r}" to view the alert`;return(0,a.jsx)(Be.A,{flavour:"tableLink",onClick:o,TextComponent:Pe.A,text:r,"data-testid":`alertsTableSchema-chart-id-${n}`,"data-ga":`alerts-table::click-chartId::alerts-view::${n}`,showToolTip:!0,content:l})},_e={critical:1,warning:2,clear:3},De=[{id:"status",accessorKey:"status",header:"Status",cell:e=>{let{getValue:t}=e;return(0,a.jsx)(m.Flex,{padding:[0,2],justifyContent:"center",flex:!0,children:(0,a.jsx)(Ae.A,{flavour:t(),"data-testid":"alertsTable-alertPill","data-ga":`alerts-table::click-status::alerts-view::${t()}`,children:t()})})},size:100,sortingFn:(e,t)=>_e[e.original.status]-_e[t.original.status]},{id:"summary",accessorKey:"summary",header:"Alert",cell:e=>{let{row:t,getValue:n}=e;return(0,a.jsx)(ze,{row:t,value:n()})},fullWidth:!0,size:300},{id:"displayName",accessorKey:"displayName",header:"Name",cell:e=>{let{row:t,getValue:n}=e;return(0,a.jsx)(ze,{row:t,value:n()})},size:100},{id:"context",accessorKey:"context",header:"Context",cell:e=>{let{getValue:t}=e;const n=(0,s.Zp)(),i=t(),[,r]=(0,Ve.sK)(),o=`Go to ${i} context in charts overview`,[l,c]=(0,Se.Ay)(),d=(0,u.useCallback)(()=>{r(i),n(`/spaces/${l}/rooms/${c}/overview`)},[i,r,n,l,c]);return(0,a.jsx)(Be.A,{flavour:"tableLink",onClick:d,TextComponent:Pe.A,text:i,"data-testid":`alertsTableSchema-alertContext-${i}`,"data-ga":`alerts-table::click-chartId::alerts-view::${i}`,showToolTip:!0,content:o})},size:100},{id:"instance",header:"Instance",accessorKey:"instance",cell:e=>{let{row:t,getValue:n}=e;return(0,a.jsx)(qe,{row:t,value:n()})},size:150},{id:"nodeName",header:"Node",accessorKey:"nodeName",cell:e=>{let{row:t,getValue:n}=e;return(0,a.jsx)(Ne,{row:t,nodeName:n()})},size:100},{id:"value",header:"Latest value",accessorKey:"value",cell:e=>{let{row:t,getValue:n}=e;const{status:i,units:s}=t.original;return(0,a.jsx)(m.Flex,{padding:[0,2],justifyContent:"end",children:(0,a.jsx)(Me.A,{loaded:!0,status:i,units:s,value:n(),"data-testid":"alertsTableSchema-alertValue","data-ga":"alerts-table::click-alert-value::alerts-view"})})},size:150},{id:"lastUpdated",header:"Updated at",accessorKey:"lastUpdated",cell:e=>{let{getValue:t}=e;return(0,a.jsx)(Fe.A,{rawTime:t(),secs:!0,"data-testid":"alertsTableSchema-latestUpdated"})},size:100},{id:"lastStatusChangeValue",header:"Triggered value",accessorKey:"lastStatusChangeValue",cell:e=>{let{row:t,getValue:n}=e;const{status:i,units:s}=t.original;return(0,a.jsx)(m.Flex,{padding:[0,2],justifyContent:"end",children:(0,a.jsx)(Me.A,{loaded:!0,status:i,units:s,value:n(),"data-testid":"alertsTableSchema-triggeredValue","data-ga":"alerts-table::click-triggered-value::alerts-view"})})},size:100},{id:"lastStatusChange",header:"Triggered at",accessorKey:"lastStatusChange",cell:e=>{let{getValue:t}=e;return(0,a.jsx)(Fe.A,{rawTime:t(),secs:!0,"data-testid":"alertsTableSchema-lastStatusChange"})},size:100}],Le=e=>{let{rowSelection:t,alerts:n=[],onRowSelectionChange:i}=e;return(0,a.jsx)(m.Flex,{width:{max:"calc(100vw - 640px)"},height:{max:"calc(100vh - 540px)"},children:(0,a.jsx)(m.Table,{rowSelection:t,enableSorting:!0,enableSelection:!0,singleRowSelection:!0,getRowId:e=>{let{id:t}=e;return t},onRowSelectionChange:i,data:n,dataColumns:De,enableColumnPinning:!0,enableResizing:!0,meta:{searchStyles:{width:"350px"}}})})},Ke=()=>{const{rowSelection:e,onRowSelectionChange:t,loaded:n,hasAlerts:i,alerts:s}=Ie();return n?i?(0,a.jsxs)(m.Flex,{"data-testid":"insights-alert-investigation-container",width:"100%",column:!0,gap:4,padding:[4,0,0,0],children:[(0,a.jsx)(m.Text,{children:"Select an alert to start an investigation."}),(0,a.jsx)(Le,{rowSelection:e,alerts:s,onRowSelectionChange:t}),(0,a.jsx)(m.Flex,{justifyContent:"center",children:(0,a.jsx)(Y.A,{label:"Troubleshoot selected alert",incompleteQueryMessage:"First select an alert and then generate a report."})})]}):(0,a.jsx)(we.A,{}):(0,a.jsx)(ye.$n,{})},Oe=(0,x.default)(m.Box).withConfig({displayName:"loader__Loader",componentId:"sc-1s7ni28-0"})(["width:60px;aspect-ratio:2;--dot:no-repeat radial-gradient(circle closest-side,"," 90%,#0000);background:var(--dot) 0% 50%,var(--dot) 50% 50%,var(--dot) 100% 50%;background-size:calc(100% / 3) 50%;animation:movingDots 1s infinite linear;@keyframes movingDots{20%{background-position:0% 0%,50% 50%,100% 50%;}40%{background-position:0% 100%,50% 0%,100% 50%;}60%{background-position:0% 50%,50% 100%,100% 0%;}80%{background-position:0% 50%,50% 50%,100% 100%;}}"],(0,m.getColor)("textLite"));var We=n(3941);const $e=(0,x.default)(m.TextBigger).attrs(e=>({lineHeight:2,textAlign:"center",color:"primary",...e})).withConfig({displayName:"quotes__QuoteText",componentId:"sc-xo7l3k-0"})(["font-family:monospace;"]),Ee=U.a_.sort(()=>Math.random()-.5),He=e=>{let{frequency:t=60}=e;const[n,i]=(0,u.useState)(t),[s,r]=(0,u.useState)(0),[o,l]=(0,u.useState)(0),c=(0,u.useCallback)(()=>{s>=100&&l(e=>e===Ee.length-1?0:e+1),r(e=>s>=100?0:e+.2)},[s,r,l,i]);return(0,We.A)(c,n),(0,a.jsxs)(m.Flex,{width:{max:"50%"},column:!0,gap:12,alignItems:"center",children:[(0,a.jsx)($e,{children:Ee[o].text}),(0,a.jsx)(Oe,{})]})},Ue=()=>(0,a.jsxs)(m.Flex,{column:!0,gap:20,flex:"grow",justifyContent:"center",children:[(0,a.jsx)(m.Flex,{width:"100%",alignItems:"center",justifyContent:"center",children:(0,a.jsx)(He,{})}),(0,a.jsx)(m.Flex,{width:"100%",alignItems:"center",justifyContent:"center",children:(0,a.jsx)(m.TextBigger,{color:"textLite",children:"Your report is being generated. This may take a few minutes. You will be notified when it is ready."})})]}),Ge=(0,F.A)(m.Icon),Je=()=>{const{query:e}=(0,p.g0)(),t=(0,p.fT)();return e?.definitionId?(0,a.jsx)(m.Flex,{position:"absolute",top:2,right:2,children:(0,a.jsx)(Ge,{name:"x",color:"menuItem",cursor:"pointer",onClick:t,tooltip:"Back to overview",tooltipProps:{align:"bottom"},noWrapper:!0})}):null},Qe=e=>{let{containerRef:t,...n}=e;const[i,s]=(0,u.useState)(),r=(0,u.useMemo)(()=>({width:"100%",height:`${i}px`,overflow:{vertical:"auto"}}),[i]);return(0,u.useEffect)(()=>{t?.current&&s(t.current.getBoundingClientRect()?.height-60)},[t,s]),(0,a.jsx)(m.Flex,{...r,children:(0,a.jsx)(je,{...n})})},Ye=(e=>t=>{const n=(0,u.useRef)();return(0,a.jsxs)(m.Flex,{position:"relative",flex:"grow",justifyContent:"center",ref:n,"data-testid":"insights-query-generator-container",children:[(0,a.jsx)(Je,{}),(0,a.jsx)(e,{...t,containerRef:n})]})})(e=>{let{definitionId:t,definitionName:n,variables:i=[],containerRef:s}=e;const r=(0,h.uW)("isAnonymous"),[o]=(0,p.W5)(),l=(0,u.useMemo)(()=>({[U.oG.investigation]:{Component:Qe,props:{variables:i,containerRef:s}},[U.oG.alertInvestigation]:{Component:Ke,props:{}},default:{Component:te,props:{definitionId:t,definitionName:n,variables:i}}}),[t,n,i,s]),{Component:c,props:d}=(0,u.useMemo)(()=>l[t]||l.default,[t,l]);return r?null:o?(0,a.jsx)(Ue,{}):t?(0,a.jsx)(c,{...d}):(0,a.jsx)(I,{})});var Ze=n(74090),Xe=n(24868),et=n(99728),tt=n(76375),nt=n(73902),it=n(50100);const st=e=>{let{id:t}=e;const n=(0,p.CF)({id:t}),[i,s]=(0,b.useHovered)({},[]),{goToReport:r}=(0,it.A)(),o=(0,u.useCallback)(()=>{r(t)},[t,r]);return n?.name?(0,a.jsx)(m.Flex,{ref:i,padding:[2,4],round:!0,cursor:"pointer",...s?{background:"panelBg"}:{},onClick:o,children:(0,a.jsx)(m.Text,{color:"menuItem",children:n.name})}):null};var at=n(10444);const rt=(0,x.default)(m.ModalContent).attrs(e=>{let{isMobile:t}=e;return{width:t?{base:"95vw"}:{base:100}}}).withConfig({displayName:"modal__StyledModalContent",componentId:"sc-1tq9d73-0"})([""]),ot=e=>{let{ids:t,onClose:n}=e;const i=(0,at.J)();return(0,a.jsx)(m.Modal,{backdropProps:{backdropBlur:!0},onClickOutside:n,onEsc:n,children:(0,a.jsxs)(rt,{"data-testid":"unread-reports-modal",isMobile:i,children:[(0,a.jsxs)(m.ModalHeader,{children:[(0,a.jsx)(m.H4,{children:"Unread Reports"}),(0,a.jsx)(m.ModalCloseButton,{onClose:n})]}),(0,a.jsxs)(m.ModalBody,{gap:3,children:[(0,a.jsx)(m.TextBig,{children:"Which report would you like to open?"}),(0,a.jsx)(m.Flex,{column:!0,gap:2,padding:[2,0],children:t.map(e=>(0,a.jsx)(st,{id:e},e))})]})]})})},lt=e=>{let{ids:t,open:n}=e;const{goToReport:i}=(0,it.A)(),s=(0,u.useCallback)(()=>{t?.length&&(1===t.length?i(t[0]):n())},[t,n,i]);return t?.length?1===t.length?(0,a.jsxs)(m.TextBig,{children:["There is one unread report."," ",(0,a.jsx)(Pe.A,{Component:m.TextBig,onClick:s,children:"View it"})]}):(0,a.jsxs)(m.TextBig,{children:["There are ",t.length," unread reports."," ",(0,a.jsx)(Pe.A,{Component:m.TextBig,onClick:s,children:"View them"})]}):null},ct=()=>{const[e,,t,n]=(0,O.A)(),[i]=(0,p.x)();return i?.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(m.Flex,{alignItems:"center",gap:2,padding:[2,4],background:"panelBg",children:[(0,a.jsx)(m.Icon,{name:"warning_triangle",color:"warning"}),(0,a.jsx)(lt,{ids:i,open:t})]}),e?(0,a.jsx)(ot,{ids:i,onClose:n}):null]}):null};var dt=n(29022),ut=n(47090);const mt=e=>{let{title:t,message:n}=e;return(0,a.jsx)(dt.A,{title:t,children:(0,a.jsx)(m.TextBig,{children:n})})},ht=e=>{let{title:t="Error",error:n}=e;if(!n)return(0,a.jsx)(mt,{title:t,message:"Something went wromg"});const i=U.sO[n?.errorMsgKey];if(i)return(0,a.jsx)(mt,{...i});const s="string"===typeof n?n:(0,ut.o)(n?.errorMsgKey,null)||n?.errorMessage||ut.B.get("default");return(0,a.jsx)(mt,{title:t,message:s})};var pt=n(4204);const gt=()=>{const e=(0,et.JT)("insights:ReadReport"),{loaded:t,error:n}=(0,p.A_)(),[o]=(0,p.rQ)(),{loaded:l,isPaid:c}=(0,tt.A)();return t&&l?e?n?(0,a.jsx)(ht,{error:n}):(0,a.jsx)(r,{Sidebar:d,children:(0,a.jsxs)(i.J3,{"data-testid":"insights-main-container",children:[(0,a.jsx)(ct,{}),(0,a.jsxs)(s.BV,{children:[(0,a.jsx)(s.qh,{path:"report-preview/:reportId",element:(0,a.jsx)(Ze.A,{})}),(0,a.jsx)(s.qh,{path:"*",element:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Ye,{...o}),(0,a.jsx)(Xe.A,{collapsed:!o?.definitionId},o?.definitionId)]})})]})]})}):c?(0,a.jsx)(ht,{error:{errorMsgKey:"ErrForbidden"}}):(0,a.jsx)(nt.A,{}):(0,a.jsx)(ye.BJ,{})},xt=()=>pt.ei?(0,a.jsx)(nt.A,{}):(0,a.jsx)(gt,{})}}]);