import{r as l,q as r,j as t,T as N,z as y,c as b}from"./index-CUDottTv.js";import{T as w}from"./topbar-892TvyNb.js";import{B as v}from"./badge-BOfEUuSW.js";import"./textarea-DAwdLdON.js";import{D as E}from"./detail-panel-YWSVnqP_.js";import{u as I}from"./use-connected-3Ljk-Uwv.js";import{d as T}from"./issue-detector-CH2FjMfV.js";import{I as k}from"./info-C0v7mgTM.js";const C={high:{icon:y,color:"text-red",badge:"red"},medium:{icon:N,color:"text-amber",badge:"amber"},low:{icon:k,color:"text-blue",badge:"blue"}};function $(){const[i,g]=l.useState("all"),[o,d]=l.useState(null);I();const c=r(e=>e.network),m=r(e=>e.console),x=r(e=>e.state),p=r(e=>e.renders),u=r(e=>e.performance),h=r(e=>e.database),a=l.useMemo(()=>{const e=[...c,...m,...x,...p,...u,...h];return e.length===0?[]:T(e)},[c,m,x,p,u,h]),f=l.useMemo(()=>i==="all"?a:a.filter(e=>e.severity===i),[i,a]),s=o?a.find(e=>e.id===o):null;return t.jsxs("div",{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[t.jsx(w,{tabs:[{id:"all",label:"All"},{id:"high",label:"High"},{id:"medium",label:"Medium"},{id:"low",label:"Low"}],activeTab:i,onTabChange:g}),t.jsxs("div",{className:"flex-1 flex min-h-0 overflow-hidden",children:[t.jsx("div",{className:"flex-1 overflow-y-auto",children:t.jsx("div",{className:"divide-y divide-border-muted",children:f.map(e=>{const n=C[e.severity],j=n.icon;return t.jsxs("div",{onClick:()=>d(e.id),className:b("flex items-start gap-3 px-5 py-3 cursor-pointer transition-colors hover:bg-bg-hover",o===e.id&&"bg-bg-active"),children:[t.jsx(j,{size:16,className:b("mt-0.5 shrink-0",n.color)}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-[13px] font-medium text-text-primary",children:e.title}),t.jsx(v,{variant:n.badge,size:"sm",children:e.severity})]}),t.jsx("p",{className:"text-[12px] text-text-tertiary mt-0.5 truncate",children:e.description})]}),t.jsx(v,{size:"sm",children:e.pattern})]},e.id)})})}),t.jsx(E,{open:s!==null,onClose:()=>d(null),title:s==null?void 0:s.title,subtitle:s?`${s.severity} · ${s.pattern}`:"",children:s&&t.jsxs("div",{className:"p-4 space-y-4",children:[t.jsx("div",{children:t.jsx("p",{className:"text-[13px] text-text-secondary",children:s.description})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-medium text-text-muted uppercase tracking-wider mb-2",children:"Evidence"}),t.jsx("div",{className:"space-y-1.5",children:s.evidence.map((e,n)=>t.jsx("div",{className:"bg-bg-elevated rounded-md px-3 py-2 border border-border-muted",children:t.jsx("p",{className:"text-[12px] font-mono text-text-secondary",children:e})},n))})]}),s.suggestion&&t.jsxs("div",{className:"bg-green-muted border border-green-border rounded-md p-3",children:[t.jsx("p",{className:"text-[11px] font-medium text-green uppercase tracking-wider mb-1",children:"Suggestion"}),t.jsx("p",{className:"text-[13px] text-text-secondary",children:s.suggestion})]})]})})]})]})}export{$ as IssuesPage};
