const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./components-BwghXArV.js","./react-vendor-CA0rJa9X.js","./chart-vendor-DaawxCPP.js","./ui-vendor-JECKYej-.js","./utils-vendor-CE1sAHAe.js","./pdf-vendor-BCfpGmV_.js","./services-CHBUqA3M.js"])))=>i.map(i=>d[i]); import{a as e,L as s,E as t,c as a,A as l,P as i,b as n,W as r,R as c,_ as d,d as o,V as m,C as x,S as u,I as h,e as p,f as g,D as b,g as j,G as v,h as f,u as y,i as N,j as w,k,l as S,m as _,n as C,o as E,p as z,q as T,r as A,B as I,s as M,t as D,v as L,w as R,x as P,y as O,z as F,F as U,H as $,U as B,J as H,K as q,M as V,N as K,O as G,Q as J,T as W,X as Y,Y as Q,Z as X,$ as Z,a0 as ee,a1 as se,a2 as te,a3 as ae,a4 as le,a5 as ie,a6 as ne,a7 as re,a8 as ce,a9 as de,aa as oe,ab as me,ac as xe,ad as ue,ae as he,af as pe,ag as ge}from"./components-BwghXArV.js";import{r as be,j as je,q as ve,T as fe,I as ye,X as Ne,b6 as we,b7 as ke,A as Se,l as _e,k as Ce,b8 as Ee,b9 as ze,ba as Te,O as Ae,bb as Ie,bc as Me,bd as De,f as Le,aM as Re,be as Pe,bf as Oe,bg as Fe,bh as Ue,au as $e,F as Be,d as He,aG as qe,g as Ve,ac as Ke,bi as Ge,ax as Je,aI as We,ad as Ye,C as Qe,t as Xe,bj as Ze,i as es,bk as ss,bl as ts,aE as as,e as ls,m as is,bm as ns,a8 as rs,bn as cs,aK as ds,E as os,aT as ms,bo as xs,aJ as us,bp as hs,bq as ps}from"./react-vendor-CA0rJa9X.js";import{h as gs,j as bs,k as js,A as vs}from"./services-CHBUqA3M.js";const fs=be.createContext(void 0),ys=()=>{const e=be.useContext(fs);if(!e)throw new Error("useToast must be used within a ToastProvider");return e},Ns=({children:e})=>{const[s,t]=be.useState([]),a=be.useCallback(e=>{t(s=>s.filter(s=>s.id!==e))},[]),l=be.useCallback((e,s="info",l=3e3)=>{const i=Math.random().toString(36).substr(2,9);t(t=>[...t,{id:i,message:e,type:s,duration:l}]),setTimeout(()=>{a(i)},l)},[a]);return je.jsxs(fs.Provider,{value:{addToast:l,removeToast:a},children:[e,je.jsx("div",{className:"fixed bottom-4 right-4 z-50 flex flex-col gap-2",children:s.map(e=>je.jsxs("div",{className:`\n flex items-center gap-2 px-4 py-3 rounded-lg shadow-lg text-white min-w-[300px] animate-slideIn\n ${"success"===e.type?"bg-green-600":""}\n ${"error"===e.type?"bg-red-600":""}\n ${"warning"===e.type?"bg-yellow-600":""}\n ${"info"===e.type?"bg-blue-600":""}\n `,role:"alert",children:["success"===e.type&&je.jsx(ve,{size:18}),"error"===e.type&&je.jsx(fe,{size:18}),"warning"===e.type&&je.jsx(fe,{size:18}),"info"===e.type&&je.jsx(ye,{size:18}),je.jsx("span",{className:"flex-1 text-sm font-medium",children:e.message}),je.jsx("button",{onClick:()=>a(e.id),className:"text-white/80 hover:text-white","aria-label":"Close notification",children:je.jsx(Ne,{size:16})})]},e.id))})]})},ws=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.al),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),ks=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.am),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),Ss=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.an),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),_s=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.ao),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),Cs=be.memo(({title:e,value:s,icon:t,trend:l,isCritical:i=!1,sparklineData:n,sparklineColor:r})=>je.jsxs("div",{className:a("p-4 rounded-xl border shadow-sm transition-all hover:shadow-md",i?"bg-red-50 border-red-100 dark:bg-red-900/10 dark:border-red-900/30":"bg-white border-slate-200 dark:bg-slate-900 dark:border-slate-800"),children:[je.jsxs("div",{className:"flex justify-between items-start mb-2",children:[je.jsx("div",{className:a("p-2 rounded-lg",i?"bg-red-100 dark:bg-red-900/20":"bg-slate-100 dark:bg-slate-800"),children:t}),je.jsx("span",{className:a("text-xs font-medium px-2 py-0.5 rounded-full",i?"bg-red-100 text-red-700":"bg-green-100 text-green-700"),children:l})]}),je.jsx("h3",{className:"text-2xl font-bold text-slate-900 dark:text-white mb-1",children:s}),je.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400 mb-2",children:e}),n&&je.jsx(Ce.Suspense,{fallback:je.jsx("div",{className:"h-8 bg-slate-200 dark:bg-slate-700 animate-pulse rounded"}),children:je.jsx(ks,{data:n,color:r,height:32})})]}));Cs.displayName="KPICard";const Es=be.memo(()=>Ce.useMemo(()=>{try{const e=localStorage.getItem("rookieChecklist");return!e||!JSON.parse(e||"{}").run_analysis}catch{return!0}},[])?je.jsx("div",{className:"mb-6",children:je.jsx(c,{})}):null);Es.displayName="RookieChecklistWrapper";const zs=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{var c,d,o,m,x,u,h,p;const{data:g,isLoading:b,error:j}=we({queryKey:["dashboard-metrics"],queryFn:()=>e.getMetrics(),refetchInterval:6e4,staleTime:3e4});if(b)return je.jsx("div",{className:"p-6",children:je.jsx(s,{text:"Loading Intelligence Dashboard..."})});if(j)return je.jsx("div",{className:"p-6",children:je.jsx(t,{error:j.message})});const v=(()=>{const e=(null==g?void 0:g.systemHealth)||0;return e>90?{label:"System Operational",color:"bg-green-500",text:"text-slate-600 dark:text-slate-300"}:e>70?{label:"Degraded Performance",color:"bg-yellow-500",text:"text-yellow-700 dark:text-yellow-400"}:{label:"System Critical",color:"bg-red-500",text:"text-red-700 dark:text-red-400"}})();return je.jsxs("div",{className:"p-6 space-y-6 bg-slate-50 dark:bg-slate-950 min-h-screen",children:[je.jsxs("header",{className:"flex justify-between items-center mb-6","data-tour":"dashboard-header",children:[je.jsxs("div",{children:[je.jsx("h1",{className:"text-2xl font-bold text-slate-900 dark:text-white",children:"Command Center"}),je.jsx("p",{className:"text-slate-500 text-sm",children:"Real-time fraud monitoring & intelligence"})]}),je.jsx("div",{className:"flex gap-2",children:je.jsxs("span",{className:a("flex items-center gap-2 px-3 py-1 bg-white dark:bg-slate-900 rounded-full border border-slate-200 dark:border-slate-800 text-xs font-medium",v.text),children:[je.jsx("span",{className:a("w-2 h-2 rounded-full animate-pulse",v.color)}),v.label]})})]}),je.jsx(Es,{}),je.jsxs("section",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4","data-tour":"metrics-grid",children:[je.jsx(Cs,{title:"Total Cases",value:(null==g?void 0:g.totalCases)||0,icon:je.jsx(ke,{className:"text-blue-500"}),trend:"",sparklineData:null==(c=null==g?void 0:g.sparklineData)?void 0:c.totalCases,sparklineColor:"#3b82f6"}),je.jsx(Cs,{title:"Open Investigations",value:(null==g?void 0:g.openCases)||0,icon:je.jsx(Se,{className:"text-amber-500"}),trend:"",sparklineData:null==(d=null==g?void 0:g.sparklineData)?void 0:d.openCases,sparklineColor:"#f59e0b"}),je.jsx(Cs,{title:"Critical Alerts",value:(null==g?void 0:g.criticalCases)||0,icon:je.jsx(fe,{className:"text-red-500"}),isCritical:!0,trend:"",sparklineData:null==(o=null==g?void 0:g.sparklineData)?void 0:o.criticalCases,sparklineColor:"#ef4444"}),je.jsx(Cs,{title:"Active Analysts",value:(null==g?void 0:g.activeAnalysts)||0,icon:je.jsx(_e,{className:"text-emerald-500"}),trend:"",sparklineData:null==(m=null==g?void 0:g.sparklineData)?void 0:m.analysts,sparklineColor:"#10b981"})]}),je.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-12 gap-6 h-[500px]",children:[je.jsx("div",{className:"lg:col-span-8 h-full flex flex-col","data-tour":"threat-map",children:je.jsx(Ce.Suspense,{fallback:je.jsx("div",{className:"h-full w-full bg-slate-100 dark:bg-slate-800 animate-pulse rounded-xl"}),children:je.jsx(ws,{})})}),je.jsxs("div",{className:"lg:col-span-4 h-full flex flex-col gap-6","data-tour":"ai-watchtower",children:[je.jsx(l,{}),je.jsx(i,{caseId:"492"})]})]}),je.jsxs("section",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 h-[400px]",children:[je.jsx("div",{className:"lg:col-span-1 h-full",children:je.jsx(n,{})}),je.jsx("div",{className:"lg:col-span-1 h-full",children:je.jsx(Ce.Suspense,{fallback:je.jsx("div",{className:"h-full w-full bg-slate-100 dark:bg-slate-800 animate-pulse rounded-xl"}),children:je.jsx(Ss,{data:[{date:"Jan 1",volume:4e3},{date:"Jan 5",volume:3e3},{date:"Jan 10",volume:2e3},{date:"Jan 15",volume:2780},{date:"Jan 20",volume:1890},{date:"Jan 25",volume:2390},{date:"Jan 30",volume:3490}]})})}),je.jsx("div",{className:"lg:col-span-1 h-full",children:je.jsx(Ce.Suspense,{fallback:je.jsx("div",{className:"h-full w-full bg-slate-100 dark:bg-slate-800 animate-pulse rounded-xl"}),children:je.jsx(_s,{data:[{name:"Critical",value:(null==(x=null==g?void 0:g.riskDistribution)?void 0:x.critical)||0,color:"#ef4444"},{name:"High",value:(null==(u=null==g?void 0:g.riskDistribution)?void 0:u.high)||0,color:"#f59e0b"},{name:"Medium",value:(null==(h=null==g?void 0:g.riskDistribution)?void 0:h.medium)||0,color:"#3b82f6"},{name:"Low",value:(null==(p=null==g?void 0:g.riskDistribution)?void 0:p.low)||0,color:"#10b981"}]})})})]}),je.jsx(r,{})]})}},Symbol.toStringTag,{value:"Module"})),Ts=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.ap),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),As=Ce.lazy(()=>d(()=>Promise.resolve().then(()=>tt),void 0,import.meta.url)),Is=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const{data:s}=we({queryKey:["cases",t],queryFn:()=>e.getCases(t)});var t;const a=(null==s?void 0:s.cases)||[],l=(()=>{const s=Ee();return ze({mutationFn:s=>e.createCase(s),onSuccess:()=>{s.invalidateQueries({queryKey:["cases"]})}})})(),{caseId:i}=Te(),n=Ae(),[r,c]=be.useState(""),[d,p]=be.useState(!1),[g,b]=be.useState(new Set),[j,v]=be.useState("list"),f=i||null,y=(e=>{const s=be.useRef(null),t=be.useRef(null),a=be.useRef(0);return be.useEffect(()=>{const l=s.current;if(!l)return;const i=e=>{const s=e.touches[0];t.current={x:s.clientX,y:s.clientY,time:Date.now()}},n=s=>{if(!t.current)return;const l=s.changedTouches[0],i=l.clientX-t.current.x,n=l.clientY-t.current.y,r=Date.now()-t.current.time,c=Math.sqrt(i*i+n*n),{onSwipeLeft:d,onSwipeRight:o,onSwipeUp:m,onSwipeDown:x,onTap:u,onDoubleTap:h,minSwipeDistance:p=50,maxTapDuration:g=300}=e;if(c<10&&rp&&(Math.abs(i)>Math.abs(n)?i>0?null==o||o():null==d||d():n>0?null==x||x():null==m||m()),t.current=null},r=e=>{t.current&&e.preventDefault()};return l.addEventListener("touchstart",i,{passive:!1}),l.addEventListener("touchend",n,{passive:!1}),l.addEventListener("touchmove",r,{passive:!1}),()=>{l.removeEventListener("touchstart",i),l.removeEventListener("touchend",n),l.removeEventListener("touchmove",r)}},[e]),s})({onSwipeLeft:()=>{const e=a.findIndex(e=>e.id===f);e>=0&&e{const e=a.findIndex(e=>e.id===f);e>0&&w(a[e-1].id)}}),N=be.useCallback(()=>p(!0),[p]),w=be.useCallback(e=>{n(`/cases/${e}`)},[n]),k=(e,s)=>{s&&s.stopPropagation();const t=new Set(g);t.has(e)?t.delete(e):t.add(e),b(t)},S=a.filter(e=>{var s;return null==(s=e.title)?void 0:s.toLowerCase().includes(r.toLowerCase())});return je.jsxs("div",{className:"flex h-[calc(100vh-64px)] overflow-hidden bg-slate-50 dark:bg-slate-950 flex-col",children:[je.jsxs("div",{className:"h-16 px-6 border-b border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 flex justify-between items-center shrink-0",children:[je.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2 text-slate-900 dark:text-white",children:["Cases",je.jsx("span",{className:"bg-slate-100 dark:bg-slate-800 text-slate-500 text-xs px-2 py-0.5 rounded-full",children:a.length})]}),je.jsxs("div",{className:"flex items-center gap-4",children:[je.jsxs("div",{className:"flex bg-slate-100 dark:bg-slate-800 p-1 rounded-lg",children:[je.jsx("button",{onClick:()=>v("list"),className:"p-1.5 rounded-md transition-colors "+("list"===j?"bg-white dark:bg-slate-700 shadow-sm text-blue-600":"text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"),"aria-label":"List View",children:je.jsx(Ie,{size:18})}),je.jsx("button",{onClick:()=>v("kanban"),className:"p-1.5 rounded-md transition-colors "+("kanban"===j?"bg-white dark:bg-slate-700 shadow-sm text-blue-600":"text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"),"aria-label":"Kanban View",children:je.jsx(Me,{size:18})}),je.jsx("button",{onClick:()=>v("adjudication"),className:"p-1.5 rounded-md transition-colors "+("adjudication"===j?"bg-white dark:bg-slate-700 shadow-sm text-blue-600":"text-slate-500 hover:text-slate-700 dark:hover:text-slate-300"),"aria-label":"Adjudication View",children:je.jsx(De,{size:18})})]}),je.jsxs("div",{className:"relative",children:[je.jsx(Le,{className:"absolute left-3 top-2.5 text-slate-400",size:16}),je.jsx("input",{type:"text",placeholder:"Search cases...",className:"pl-9 pr-3 py-2 bg-slate-50 dark:bg-slate-800 border border-slate-200 dark:border-slate-700 rounded-lg text-sm focus:ring-2 focus:ring-blue-500 w-64",value:r,onChange:e=>c(e.target.value)})]}),je.jsxs(o,{onClick:N,className:"bg-blue-600 hover:bg-blue-700 text-white border-0",children:[je.jsx(Re,{size:18,className:"mr-2"})," New Case"]})]})]}),je.jsx("div",{ref:y,className:"flex-1 overflow-hidden relative",children:"list"===j?je.jsxs("div",{className:"flex h-full",children:[je.jsx("div",{className:"w-1/3 border-r border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 overflow-y-auto shrink-0",children:je.jsxs("div",{className:"case-list-content",children:[je.jsxs("div",{className:"px-4 py-2 bg-slate-50 dark:bg-slate-900 border-b border-slate-200 dark:border-slate-800 flex items-center",children:[je.jsxs("button",{onClick:g.size===S.length&&S.length>0?()=>{b(new Set)}:()=>{const e=new Set(S.map(e=>e.id));b(e)},className:"flex items-center gap-2 text-xs font-medium text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",children:[g.size===S.length&&S.length>0?je.jsx(Pe,{size:14,className:"text-blue-500"}):je.jsx(Oe,{size:14}),g.size===S.length&&S.length>0?"Deselect All":"Select All"]}),g.size>0&&je.jsxs("span",{className:"text-xs text-slate-500 dark:text-slate-400 ml-4",children:[g.size," selected"]})]}),je.jsx(m,{items:S,estimateSize:120,getItemKey:e=>e.id,renderItem:e=>{const s=g.has(e.id);return je.jsxs("div",{className:"flex items-center p-4 border-b border-slate-200 dark:border-slate-800 cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors "+(f===e.id?"bg-blue-50 dark:bg-blue-900/20 border-l-4 border-l-blue-500":"hover:bg-slate-50 dark:hover:bg-slate-800 border-l-4 border-l-transparent"),onClick:()=>w(e.id),onKeyDown:s=>{"Enter"!==s.key&&" "!==s.key||(s.preventDefault(),w(e.id))},tabIndex:0,role:"button","aria-current":f===e.id?"page":void 0,"aria-label":`Open case: ${e.title}`,children:[je.jsx("div",{className:"mr-3 shrink-0",onClick:s=>k(e.id,s),role:"checkbox","aria-checked":s,tabIndex:0,"aria-label":`Select case ${e.title}`,onKeyDown:s=>{"Enter"!==s.key&&" "!==s.key||(s.stopPropagation(),k(e.id))},children:s?je.jsx(Pe,{size:20,className:"text-blue-500"}):je.jsx(Oe,{size:20,className:"text-slate-300 dark:text-slate-600 hover:text-slate-400"})}),je.jsxs("div",{className:"flex-1 min-w-0",children:[je.jsx("div",{className:"flex justify-between items-start",children:je.jsx("p",{className:"font-semibold text-slate-800 dark:text-white transition-colors truncate pr-2",children:e.title})}),je.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[je.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded uppercase font-bold bg-slate-100 dark:bg-slate-800 text-slate-600 dark:text-slate-400",children:e.status}),je.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded uppercase font-bold "+("HIGH"===e.priority?"bg-red-100 text-red-700":"bg-amber-100 text-amber-700"),children:e.priority})]}),je.jsx("p",{className:"text-sm text-slate-600 dark:text-slate-400 mb-2 line-clamp-2",children:e.description}),je.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-500 dark:text-slate-400",children:[je.jsxs("span",{children:["Created ",new Date(e.createdAt).toLocaleDateString()]}),je.jsxs("span",{children:["Risk: ",e.riskScore||0,"%"]})]})]})]},e.id)},emptyMessage:"No cases found matching your search.",className:"h-[calc(100%-44px)]"})]})}),je.jsx("div",{className:"flex-1 flex flex-col h-full overflow-hidden bg-slate-50 dark:bg-slate-950",children:f?je.jsx(x,{isOpen:!0,caseId:f,onClose:()=>n("/cases"),isEmbedded:!0}):je.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-slate-400",children:[je.jsx(Ie,{size:48,className:"mb-4 opacity-20"}),je.jsx("p",{children:"Select a case to view details"})]})})]}):"kanban"===j?je.jsx(Ce.Suspense,{fallback:je.jsx(u,{className:"h-full w-full"}),children:je.jsx(Ts,{})}):je.jsx(Ce.Suspense,{fallback:je.jsx(u,{className:"h-full w-full"}),children:je.jsx(As,{})})}),d&&je.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:je.jsx("div",{className:"bg-white dark:bg-slate-900 rounded-xl shadow-2xl w-full max-w-4xl max-h-[90vh] overflow-hidden",children:je.jsx(h,{isOpen:d,onComplete:async e=>{const s={title:e.title,description:e.description,type:"FRAUD",priority:"MEDIUM",status:"OPEN"};try{await l.mutateAsync(s),p(!1)}catch(t){}},onClose:()=>p(!1)})})})]})}},Symbol.toStringTag,{value:"Module"})),Ms=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.aq),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)),Ds=({children:e})=>{const{setNodeRef:s}=y({id:"canvas"});return je.jsx("div",{ref:s,className:"w-full h-full",children:e})},Ls=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const{caseId:s}=Te(),[t,a]=be.useState(void 0),[l,i]=be.useState(!0),[n,r]=be.useState(null),[c,d]=be.useState("high"),[m,x]=be.useState(0),u=be.useCallback(async()=>{i(!0),r(null);try{const s=await e.getGraphData(),t={nodes:s.nodes.map(e=>{var s;return{id:e.id,group:e.type,label:e.name||e.id,val:(null==(s=e.properties)?void 0:s.val)||5}}),links:s.links.map(e=>({source:e.source,target:e.target,type:e.type}))};a(t)}catch(s){r("Failed to load investigation data.")}finally{i(!1)}},[]);be.useEffect(()=>{u()},[m,u]);const{addToast:h}=ys();if(l)return je.jsx(p,{});if(n)return je.jsx("div",{className:"p-8 text-red-500",children:n});const y=(null==t?void 0:t.nodes.length)||0;return je.jsx(g,{onError:(e,s)=>{},children:je.jsx(b,{onDragEnd:e=>{const{active:s,over:l}=e;if(l&&"graph-canvas-droppable"===l.id&&s.data.current){const e=s.data.current;if(null==t?void 0:t.nodes.some(e=>e.id===s.id))return void h(`${e.label} is already in the graph.`,"info");const l={id:String(s.id),group:e.type||"unknown",label:e.label||String(s.id),val:10,x:0,y:0};a(e=>{if(e)return{...e,nodes:[...e.nodes,l],links:e.links}}),h(`Added ${e.label} to investigation queue`,"success")}},children:je.jsxs("div",{className:"flex h-[calc(100vh-64px)] overflow-hidden bg-slate-950",children:[je.jsx(j,{}),je.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-slate-950 relative",children:[je.jsxs("div",{className:"h-14 border-b border-slate-800 flex justify-between items-center px-6 bg-slate-900 shadow-sm z-20",children:[je.jsxs("h1",{className:"font-bold text-slate-100 flex items-center gap-2",children:[je.jsx(Fe,{size:20,className:"text-blue-500"}),"Investigation #",s||"492",": Shell Corp Network"]}),je.jsxs("div",{className:"flex gap-3 items-center",children:[je.jsx(v,{currentMode:c,datasetSize:y,onModeChange:d}),je.jsxs(o,{variant:"secondary",onClick:()=>{x(e=>e+1)},children:[je.jsx(Ue,{className:"w-4 h-4 mr-2"}),"Reset"]}),je.jsxs(o,{variant:"primary",onClick:async()=>{const a=s||"default";try{h("Saving snapshot...","info"),await e.saveGraphSnapshot(a,t),h("Snapshot saved successfully","success")}catch(l){h("Failed to save snapshot","error")}},children:[je.jsx($e,{className:"w-4 h-4 mr-2"}),"Save Snapshot"]})]})]}),je.jsx("div",{className:"flex-1 relative overflow-hidden",children:je.jsx(f,{totalNodes:y,currentNodes:y,strategy:"ultra"===c?"virtual":"low"===c?"progressive":"hybrid",children:je.jsx(Ds,{children:je.jsx(be.Suspense,{fallback:je.jsx("div",{className:"flex items-center justify-center h-full",children:je.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})}),children:je.jsx(Ms,{data:t},m)})})})})]})]})})})}},Symbol.toStringTag,{value:"Module"}));function Rs(){const[e,s]=be.useState([]);return{toast:e=>{s(s=>[...s,e])},toasts:e}}const Ps=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const{toast:e}=Rs(),{drafts:t,isLoading:a,isError:l,updateDraft:i}=(()=>{const e=Ee(),s=we({queryKey:["agentDrafts"],queryFn:()=>gs.getAgentDrafts()}),t=ze({mutationFn:({id:e,updates:s})=>gs.updateAgentDraft(e,s),onSuccess:()=>{e.invalidateQueries({queryKey:["agentDrafts"]})}});return{drafts:s.data||[],isLoading:s.isLoading,isError:s.isError,updateDraft:t.mutate,isUpdating:t.isPending}})(),[n,r]=be.useState(""),[c,d]=be.useState("all"),[o,m]=be.useState("all"),[x,u]=be.useState(null),[h,p]=be.useState(""),g=be.useMemo(()=>t.filter(e=>{const s=e.title.toLowerCase().includes(n.toLowerCase())||e.agentName.toLowerCase().includes(n.toLowerCase())||e.targetEntity.toLowerCase().includes(n.toLowerCase())||e.tags.some(e=>e.toLowerCase().includes(n.toLowerCase())),t="all"===c||e.status===c,a="all"===o||e.draftType===o;return s&&t&&a}),[t,n,c,o]),b=e=>{u(e),p(e.content)},j=(s,t)=>{i({id:s,updates:{status:t,lastModified:(new Date).toISOString()}},{onSuccess:()=>{e({title:"Status Updated",description:`Draft status changed to ${t}`})}})};return a?je.jsx("div",{className:"p-6",children:je.jsx(s,{text:"Loading Agent Drafts..."})}):l?je.jsx("div",{className:"p-6 text-center",children:je.jsx("p",{className:"text-red-500",children:"Failed to load agent drafts."})}):je.jsxs("div",{className:"p-6 space-y-6",children:[je.jsx("div",{className:"flex items-center justify-between",children:je.jsxs("div",{children:[je.jsx("h1",{className:"text-3xl font-bold",children:"Agent Drafts"}),je.jsx("p",{className:"text-slate-600 dark:text-slate-400 mt-2",children:"Review and edit AI-generated content drafts"})]})}),je.jsx(N,{drafts:t}),je.jsx(w,{searchTerm:n,onSearchChange:r,statusFilter:c,onStatusChange:d,typeFilter:o,onTypeChange:m}),je.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:g.map(e=>je.jsx(k,{draft:e,onEdit:b,onStatusChange:j},e.id))}),0===g.length&&je.jsxs("div",{className:"text-center py-12",children:[je.jsx(Be,{className:"w-12 h-12 text-muted-foreground mx-auto mb-4"}),je.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No drafts found"}),je.jsx("p",{className:"text-muted-foreground",children:n||"all"!==c||"all"!==o?"Try adjusting your filters":"No agent drafts available at this time"})]}),je.jsx(S,{draft:x,isOpen:!!x,onClose:()=>u(null),onSave:s=>{x&&i({id:x.id,updates:{content:s,status:"reviewing",lastModified:(new Date).toISOString()}},{onSuccess:()=>{u(null),p(""),e({title:"Draft Updated",description:"Draft has been saved and marked for review"})},onError:()=>{e({title:"Update Failed",description:"Could not save draft changes",variant:"destructive"})}})},content:h,onContentChange:p})]})}},Symbol.toStringTag,{value:"Module"})),Os=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const{toast:e}=Rs(),{approvals:t,isLoading:a,isError:l,updateApproval:i}=(()=>{const e=Ee(),s=we({queryKey:["agentApprovals"],queryFn:()=>gs.getAgentApprovals()}),t=ze({mutationFn:({id:e,status:s})=>gs.updateApprovalStatus(e,s),onSuccess:()=>{e.invalidateQueries({queryKey:["agentApprovals"]})}});return{approvals:s.data||[],isLoading:s.isLoading,isError:s.isError,updateApproval:t.mutate,isUpdating:t.isPending}})(),[n,r]=be.useState(""),[c,d]=be.useState("all"),[o,m]=be.useState("all"),x=be.useMemo(()=>t.filter(e=>{const s=e.agentName.toLowerCase().includes(n.toLowerCase())||e.action.toLowerCase().includes(n.toLowerCase())||e.target.toLowerCase().includes(n.toLowerCase()),t="all"===c||e.status===c,a="all"===o||e.risk===o;return s&&t&&a}),[t,n,c,o]);return a?je.jsx("div",{className:"p-6",children:je.jsx(s,{text:"Loading Agent Approvals..."})}):l?je.jsx("div",{className:"p-6 text-center",children:je.jsx("p",{className:"text-red-500",children:"Failed to load agent approvals queue."})}):je.jsxs("div",{className:"p-6 space-y-6",children:[je.jsx("div",{className:"flex items-center justify-between",children:je.jsxs("div",{children:[je.jsx("h1",{className:"text-3xl font-bold",children:"Agent Approvals"}),je.jsx("p",{className:"text-slate-600 dark:text-slate-400 mt-2",children:"Review and approve automated agent actions"})]})}),je.jsx(_,{approvals:t}),je.jsx(C,{searchTerm:n,onSearchChange:r,statusFilter:c,onStatusChange:d,riskFilter:o,onRiskChange:m}),je.jsx(E,{approvals:x,onApproval:(s,t)=>{i({id:s,status:"approve"===t?"approved":"rejected"},{onSuccess:()=>{e({title:"approve"===t?"Approved":"Rejected",description:`Agent action ${t}d successfully`})},onError:()=>{e({title:"Operation Failed",description:`Could not ${t} the agent action`,variant:"destructive"})}})}})]})}},Symbol.toStringTag,{value:"Module"})),Fs=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const[e,s]=be.useState(null),[t,a]=be.useState([]),[l,i]=be.useState(!0),[n,r]=be.useState(null);be.useEffect(()=>{c();const e=setInterval(c,3e4);return()=>clearInterval(e)},[]);const c=async()=>{try{i(!0);const[e,t]=await Promise.all([bs.getMonitoringDashboard(),js.getComplianceDashboard().catch(()=>({recent_audit_events:0,pending_regulatory_reports:0,open_security_incidents:0,overdue_access_reviews:0,expiring_training_records:0,high_risk_events_last_100:0,overall_compliance_score:0}))]);s(e);const l=[{name:"API Connectivity",status:"healthy",message:"Compliance API responding"},{name:"Database Connection",status:t.recent_audit_events>0?"healthy":"warning",message:`${t.recent_audit_events} recent audit events`},{name:"Compliance Engine",status:t.overall_compliance_score>80?"healthy":"warning",message:`Compliance score: ${t.overall_compliance_score}%`},{name:"Alert System",status:0===t.open_security_incidents?"healthy":"warning",message:`${t.open_security_incidents} open security incidents`},{name:"Audit Logging",status:"healthy",message:"Audit system operational"}];a(l)}catch(e){r("Failed to load monitoring data")}finally{i(!1)}},d=e=>{switch(e){case"critical":return"text-red-700 bg-red-100 border-red-200";case"high":return"text-orange-700 bg-orange-100 border-orange-200";case"medium":return"text-yellow-700 bg-yellow-100 border-yellow-200";case"low":return"text-blue-700 bg-blue-100 border-blue-200";default:return"text-gray-700 bg-gray-100 border-gray-200"}},o=e=>{switch(e){case"healthy":return"text-green-700 bg-green-100";case"degraded":return"text-yellow-700 bg-yellow-100";case"unhealthy":return"text-red-700 bg-red-100";default:return"text-gray-700 bg-gray-100"}};return l?je.jsx("div",{className:"flex items-center justify-center min-h-screen",children:je.jsx("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-blue-600"})}):n?je.jsxs(z,{className:"m-4",children:[je.jsx(fe,{className:"h-4 w-4"}),je.jsx(T,{children:"Error"}),je.jsx(A,{children:n})]}):je.jsxs("div",{className:"space-y-6 p-6",children:[je.jsxs("div",{className:"flex items-center justify-between",children:[je.jsxs("div",{children:[je.jsx("h1",{className:"text-3xl font-bold text-gray-900",children:"Compliance Monitoring"}),je.jsx("p",{className:"text-gray-600 mt-2",children:"Real-time monitoring of compliance systems and alerts"})]}),je.jsxs("div",{className:"flex space-x-2",children:[je.jsxs(I,{variant:"outline",size:"sm",onClick:c,children:[je.jsx(Se,{className:"h-4 w-4 mr-2"}),"Refresh"]}),je.jsxs(I,{variant:"outline",size:"sm",children:[je.jsx(He,{className:"h-4 w-4 mr-2"}),"Configure"]})]})]}),je.jsxs(M,{children:[je.jsxs(D,{children:[je.jsxs(L,{className:"flex items-center",children:[je.jsx(qe,{className:"h-5 w-5 mr-2"}),"System Health Overview"]}),je.jsx(R,{children:"Current status of compliance systems and infrastructure"})]}),je.jsx(P,{children:je.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[je.jsxs("div",{className:"text-center",children:[je.jsxs("div",{className:"text-2xl font-bold text-green-600",children:[(null==e?void 0:e.system_health.uptime)||0,"%"]}),je.jsx("p",{className:"text-sm text-gray-600",children:"Uptime"})]}),je.jsxs("div",{className:"text-center",children:[je.jsxs("div",{className:"text-2xl font-bold text-blue-600",children:[(null==e?void 0:e.system_health.response_time)||0,"ms"]}),je.jsx("p",{className:"text-sm text-gray-600",children:"Response Time"})]}),je.jsxs("div",{className:"text-center",children:[je.jsxs("div",{className:"text-2xl font-bold text-red-600",children:[100*((null==e?void 0:e.system_health.error_rate)||0),"%"]}),je.jsx("p",{className:"text-sm text-gray-600",children:"Error Rate"})]}),je.jsxs("div",{className:"text-center",children:[je.jsx("div",{className:"text-2xl font-bold text-purple-600",children:(null==e?void 0:e.system_health.active_users)||0}),je.jsx("p",{className:"text-sm text-gray-600",children:"Active Users"})]})]})})]}),je.jsxs(M,{children:[je.jsxs(D,{children:[je.jsxs(L,{className:"flex items-center",children:[je.jsx(Ve,{className:"h-5 w-5 mr-2"}),"Active Alerts (",(null==e?void 0:e.active_alerts.length)||0,")"]}),je.jsx(R,{children:"Current compliance alerts requiring attention"})]}),je.jsx(P,{children:0===(null==e?void 0:e.active_alerts.length)?je.jsxs("div",{className:"text-center py-8",children:[je.jsx(ve,{className:"h-12 w-12 text-green-600 mx-auto mb-4"}),je.jsx("p",{className:"text-gray-600",children:"No active alerts"}),je.jsx("p",{className:"text-sm text-gray-500",children:"All systems operating normally"})]}):je.jsx("div",{className:"space-y-4",children:null==e?void 0:e.active_alerts.map(e=>je.jsx("div",{className:`p-4 border rounded-lg ${d(e.severity)}`,children:je.jsxs("div",{className:"flex items-start justify-between",children:[je.jsxs("div",{className:"flex-1",children:[je.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[je.jsx(fe,{className:"h-4 w-4"}),je.jsx(O,{variant:"outline",className:"capitalize",children:e.severity}),je.jsx("span",{className:"text-sm text-gray-500",children:new Date(e.timestamp).toLocaleString()})]}),je.jsx("p",{className:"font-medium",children:e.message}),e.metadata&&Object.keys(e.metadata).length>0&&je.jsxs("div",{className:"mt-2 text-sm text-gray-600",children:[je.jsx("strong",{children:"Details:"})," ",JSON.stringify(e.metadata)]})]}),je.jsxs("div",{className:"ml-4",children:[!e.acknowledged&&je.jsx(I,{size:"sm",onClick:()=>(async e=>{try{await bs.acknowledgeAlert(e),await c()}catch(s){}})(e.id),children:"Acknowledge"}),e.acknowledged&&!e.resolved&&je.jsx(O,{className:"bg-yellow-100 text-yellow-800",children:"Acknowledged"}),e.resolved&&je.jsx(O,{className:"bg-green-100 text-green-800",children:"Resolved"})]})]})},e.id))})})]}),je.jsxs(M,{children:[je.jsxs(D,{children:[je.jsxs(L,{className:"flex items-center",children:[je.jsx(Ke,{className:"h-5 w-5 mr-2"}),"Performance Metrics"]}),je.jsx(R,{children:"Key performance indicators for compliance systems"})]}),je.jsx(P,{children:je.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[je.jsxs("div",{children:[je.jsxs("div",{className:"flex items-center justify-between mb-2",children:[je.jsx("span",{className:"text-sm font-medium",children:"API Response Time"}),je.jsxs("span",{className:"text-sm text-gray-600",children:[(null==e?void 0:e.performance_metrics.api_response_time)||0,"ms"]})]}),je.jsx(F,{value:Math.min(((null==e?void 0:e.performance_metrics.api_response_time)||0)/5,100),className:"h-2"}),je.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Target: ","<","500ms"]})]}),je.jsxs("div",{children:[je.jsxs("div",{className:"flex items-center justify-between mb-2",children:[je.jsx("span",{className:"text-sm font-medium",children:"Database Query Time"}),je.jsxs("span",{className:"text-sm text-gray-600",children:[(null==e?void 0:e.performance_metrics.database_query_time)||0,"ms"]})]}),je.jsx(F,{value:Math.min(((null==e?void 0:e.performance_metrics.database_query_time)||0)/2,100),className:"h-2"}),je.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Target: ","<","100ms"]})]}),je.jsxs("div",{children:[je.jsxs("div",{className:"flex items-center justify-between mb-2",children:[je.jsx("span",{className:"text-sm font-medium",children:"Error Rate"}),je.jsxs("span",{className:"text-sm text-gray-600",children:[100*((null==e?void 0:e.performance_metrics.error_rate)||0),"%"]})]}),je.jsx(F,{value:1e3*((null==e?void 0:e.performance_metrics.error_rate)||0),className:"h-2"}),je.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Target: ","<","1%"]})]})]})})]}),je.jsxs(M,{children:[je.jsxs(D,{children:[je.jsxs(L,{className:"flex items-center",children:[je.jsx(Ge,{className:"h-5 w-5 mr-2"}),"Compliance Trends"]}),je.jsx(R,{children:"Historical compliance scores and alert patterns"})]}),je.jsx(P,{children:je.jsx("div",{className:"space-y-4",children:null==e?void 0:e.compliance_trends.map((e,s)=>je.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[je.jsxs("div",{children:[je.jsx("p",{className:"font-medium",children:e.period}),je.jsxs("p",{className:"text-sm text-gray-600",children:[e.alerts_count," alerts • Score: ",e.score,"%"]})]}),je.jsxs("div",{className:"flex items-center space-x-2",children:[je.jsxs(O,{variant:e.score>=90?"default":"secondary",children:[e.score,"%"]}),e.alerts_count>0&&je.jsxs(O,{variant:"destructive",children:[e.alerts_count," alerts"]})]})]},s))})})]}),je.jsxs(M,{children:[je.jsxs(D,{children:[je.jsxs(L,{className:"flex items-center",children:[je.jsx(Je,{className:"h-5 w-5 mr-2"}),"System Health Checks"]}),je.jsx(R,{children:"Automated health checks for compliance systems"})]}),je.jsx(P,{children:je.jsx("div",{className:"space-y-3",children:t.map((e,s)=>je.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[je.jsxs("div",{className:"flex items-center space-x-3",children:[je.jsx(ve,{className:"h-5 w-5 text-green-600"}),je.jsxs("div",{children:[je.jsx("p",{className:"font-medium",children:e.name}),je.jsx("p",{className:"text-sm text-gray-600",children:e.message})]})]}),je.jsx(O,{className:o(e.status),children:e.status})]},s))})})]})]})}},Symbol.toStringTag,{value:"Module"}));const Us=new class{constructor(){this.monitors=new Map,this.cleanupRegistry=new WeakMap,this.memoryThresholds={warning:104857600,critical:209715200,max:268435456},this.eventListeners=new WeakMap,this.timers=new Set,this.intervals=new Set,this.startMemoryMonitoring()}startMemoryMonitoring(){"undefined"!=typeof performance&&performance.memory&&(this.memoryCheckInterval=setInterval(()=>{this.checkMemoryUsage()},3e4),this.takeMemorySnapshot("initial"))}checkMemoryUsage(){if(!performance.memory)return;const{usedJSHeapSize:e,totalJSHeapSize:s,jsHeapSizeLimit:t}=performance.memory,a={used:e,total:s,limit:t,percentage:e/t*100};e>this.memoryThresholds.critical?this.triggerMemoryAlert("critical",a):e>this.memoryThresholds.warning&&this.triggerMemoryAlert("warning",a),a.percentage>80&&this.performEmergencyCleanup()}triggerMemoryAlert(e,s){var t;const a=new CustomEvent("memoryAlert",{detail:{level:e,memoryUsage:s,timestamp:Date.now()}});window.dispatchEvent(a),(null==(t=window.electronAPI)?void 0:t.logMemoryAlert)&&window.electronAPI.logMemoryAlert(e,s)}takeMemorySnapshot(e="snapshot"){if(!performance.memory)return null;const s={label:e,timestamp:Date.now(),memory:{...performance.memory},activeTimers:this.timers.size,activeIntervals:this.intervals.size,registeredCleanups:this.cleanupRegistry.size};return this.memorySnapshots=this.memorySnapshots||[],this.memorySnapshots.push(s),this.memorySnapshots.length>10&&this.memorySnapshots.shift(),s}registerCleanup(e,s){this.cleanupRegistry.has(e)||this.cleanupRegistry.set(e,[]),this.cleanupRegistry.get(e).push(s)}unregisterCleanup(e){if(this.cleanupRegistry.has(e)){this.cleanupRegistry.get(e).forEach(e=>{try{e()}catch(s){}}),this.cleanupRegistry.delete(e)}}addTrackedEventListener(e,s,t,a){if(this.eventListeners.has(e)||this.eventListeners.set(e,[]),e.addEventListener(s,t,a),this.eventListeners.get(e).push({event:s,handler:t,options:a}),e.parentNode){const s=new MutationObserver(t=>{t.forEach(t=>{t.removedNodes.forEach(t=>{(t===e||t.contains(e))&&(this.removeElementListeners(e),s.disconnect())})})});s.observe(e.parentNode,{childList:!0,subtree:!0})}}removeElementListeners(e){if(this.eventListeners.has(e)){this.eventListeners.get(e).forEach(({event:s,handler:t})=>{e.removeEventListener(s,t)}),this.eventListeners.delete(e)}}setTrackedTimeout(e,s,...t){const a=setTimeout(()=>{this.timers.delete(a),e(...t)},s);return this.timers.add(a),a}clearTrackedTimeout(e){this.timers.has(e)&&(clearTimeout(e),this.timers.delete(e))}setTrackedInterval(e,s,...t){const a=setInterval(e,s,...t);return this.intervals.add(a),a}clearTrackedInterval(e){this.intervals.has(e)&&(clearInterval(e),this.intervals.delete(e))}performEmergencyCleanup(){Array.from(this.timers).slice(0,Math.floor(.5*this.timers.size)).forEach(e=>{this.clearTrackedTimeout(e)});Array.from(this.intervals).slice(0,Math.floor(.3*this.intervals.size)).forEach(e=>{this.clearTrackedInterval(e)}),window.gc&&window.gc(),this.takeMemorySnapshot("post-cleanup")}cleanup(){this.timers.forEach(e=>clearTimeout(e)),this.timers.clear(),this.intervals.forEach(e=>clearInterval(e)),this.intervals.clear(),this.memoryCheckInterval&&clearInterval(this.memoryCheckInterval),this.cleanupRegistry=new WeakMap,this.eventListeners=new WeakMap}};"undefined"!=typeof window&&window.addEventListener("beforeunload",()=>{Us.cleanup()});const $s=({title:e,value:s,unit:t,icon:l,trend:i,status:n,children:r})=>je.jsxs($.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"glass-card p-6",children:[je.jsx("div",{className:"flex items-center justify-between mb-4",children:je.jsxs("div",{className:"flex items-center gap-3",children:[je.jsx("div",{className:a("p-2 rounded-lg","good"===n?"bg-success-500/20":"warning"===n?"bg-warning-500/20":"bg-error-500/20"),children:je.jsx(l,{className:a("w-5 h-5","good"===n?"text-success-400":"warning"===n?"text-warning-400":"text-error-400")})}),je.jsxs("div",{children:[je.jsx("h3",{className:"font-semibold text-sm",children:e}),je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx("span",{className:"text-2xl font-bold",children:s}),je.jsx("span",{className:"text-sm text-secondary-400",children:t}),i&&je.jsxs("div",{className:a("flex items-center gap-1 text-xs",i>0?"text-success-400":"text-error-400"),children:[i>0?je.jsx(Ge,{className:"w-3 h-3"}):je.jsx(Ze,{className:"w-3 h-3"}),Math.abs(i),"%"]})]})]})]})}),r]}),Bs=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const{isConnected:e,addListener:s}=U(),[t,l]=be.useState({ipc:{calls:0,avgResponseTime:0,cacheHitRate:0},memory:{used:0,limit:1,percentage:0},components:{renderCount:0,avgRenderTime:0},api:{totalCalls:0,avgResponseTime:0,errorRate:0},system:{cpu:0,memory:0,uptime:0}}),[i]=be.useState([]),[n,r]=be.useState("5m");be.useEffect(()=>{const e=async()=>{var e,s;const t=(null==(e=Us.getBatchStats)?void 0:e.call(Us))||{},a={calls:Object.values(t).reduce((e,s)=>e+(s.pendingRequests||0),0),avgResponseTime:45,cacheHitRate:78},i=(null==(s=Us.getMemoryStats)?void 0:s.call(Us))||{},n=i.current?{used:i.current.usedJSHeapSize||0,limit:i.current.jsHeapSizeLimit||1,percentage:(i.current.usedJSHeapSize||0)/(i.current.jsHeapSizeLimit||1)*100}:{used:0,limit:1,percentage:0},r={renderCount:i.registeredComponents||0,avgRenderTime:16};l(e=>({...e,ipc:a,memory:n,components:r}))},t=s(e=>{if("system_metrics"===e.type&&e.metrics){const s=e.metrics;l(e=>({...e,system:{cpu:s.cpu_percent||e.system.cpu,memory:s.memory_percent||e.system.memory,uptime:s.uptime||e.system.uptime},api:{totalCalls:s.request_count||e.api.totalCalls,avgResponseTime:s.response_time_avg||e.api.avgResponseTime,errorRate:s.error_rate||e.api.errorRate}}))}}),a=setInterval(()=>{e()},2e3);return e(),()=>{clearInterval(a),t()}},[e,s]);const c=e=>{if(!e)return"0 B";const s=Math.floor(Math.log(e)/Math.log(1024));return`${(e/Math.pow(1024,s)).toFixed(1)} ${["B","KB","MB","GB"][s]}`},d=(e,s)=>e>=s.critical?"text-error-400":e>=s.warning?"text-warning-400":"text-success-400";return je.jsxs("div",{className:"space-y-6",children:[je.jsxs("div",{className:"flex items-center justify-between",children:[je.jsxs("div",{children:[je.jsx("h1",{className:"text-3xl font-bold title-gradient",children:"Performance Dashboard"}),je.jsx("p",{className:"text-secondary-400 mt-2",children:"Real-time application performance monitoring"})]}),je.jsxs("div",{className:"flex items-center gap-4",children:[je.jsxs("select",{value:n,onChange:e=>r(e.target.value),"aria-label":"Select Time Range",className:"px-3 py-2 bg-glass-background border border-glass-border rounded-lg text-sm",children:[je.jsx("option",{value:"1m",children:"Last Minute"}),je.jsx("option",{value:"5m",children:"Last 5 Minutes"}),je.jsx("option",{value:"15m",children:"Last 15 Minutes"}),je.jsx("option",{value:"1h",children:"Last Hour"})]}),je.jsx("button",{onClick:()=>{var e;return null==(e=Us.takeMemorySnapshot)?void 0:e.call(Us,"manual-dashboard")},className:"btn btn-secondary",children:"📸 Snapshot"})]})]}),i.length>0&&je.jsx("div",{className:"space-y-2",children:i.slice(-3).map(e=>je.jsx($.div,{initial:{opacity:0,x:-20},animate:{opacity:1,x:0},className:a("p-4 rounded-lg border","critical"===e.level?"bg-error-500/10 border-error-500/20 text-error-400":"bg-warning-500/10 border-warning-500/20 text-warning-400"),children:je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx(fe,{className:"w-4 h-4"}),je.jsx("span",{className:"text-sm font-medium",children:e.message}),je.jsx("span",{className:"text-xs opacity-70 ml-auto",children:e.timestamp.toLocaleTimeString()})]})},e.id))}),je.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[je.jsx($s,{title:"IPC Performance",value:t.ipc.avgResponseTime,unit:"ms avg",icon:Ke,trend:-12,status:"good",children:je.jsxs("div",{className:"space-y-2 text-xs text-secondary-400",children:[je.jsxs("div",{className:"flex justify-between",children:[je.jsx("span",{children:"Calls/min"}),je.jsx("span",{children:t.ipc.calls})]}),je.jsxs("div",{className:"flex justify-between",children:[je.jsx("span",{children:"Cache Hit Rate"}),je.jsxs("span",{children:[t.ipc.cacheHitRate,"%"]})]})]})}),je.jsx($s,{title:"Memory Usage",value:t.memory.percentage.toFixed(1),unit:"%",icon:We,trend:3,status:t.memory.percentage>80?"critical":t.memory.percentage>60?"warning":"good",children:je.jsxs("div",{className:"space-y-2 text-xs text-secondary-400",children:[je.jsxs("div",{className:"flex justify-between",children:[je.jsx("span",{children:"Used"}),je.jsx("span",{children:c(t.memory.used)})]}),je.jsxs("div",{className:"flex justify-between",children:[je.jsx("span",{children:"Limit"}),je.jsx("span",{children:c(t.memory.limit)})]})]})}),je.jsx($s,{title:"API Response",value:t.api.avgResponseTime,unit:"ms avg",icon:Se,trend:-8,status:t.api.avgResponseTime>200?"warning":"good",children:je.jsxs("div",{className:"space-y-2 text-xs text-secondary-400",children:[je.jsxs("div",{className:"flex justify-between",children:[je.jsx("span",{children:"Total Calls"}),je.jsx("span",{children:t.api.totalCalls.toLocaleString()})]}),je.jsxs("div",{className:"flex justify-between",children:[je.jsx("span",{children:"Error Rate"}),je.jsxs("span",{children:[(100*t.api.errorRate).toFixed(2),"%"]})]})]})}),je.jsx($s,{title:"System Health",value:t.system.cpu,unit:"% CPU",icon:Ye,trend:2,status:t.system.cpu>70?"warning":"good",children:je.jsxs("div",{className:"space-y-2 text-xs text-secondary-400",children:[je.jsxs("div",{className:"flex justify-between",children:[je.jsx("span",{children:"Uptime"}),je.jsxs("span",{children:[t.system.uptime,"m"]})]}),je.jsxs("div",{className:"flex justify-between",children:[je.jsx("span",{children:"Components"}),je.jsx("span",{children:t.components.renderCount})]})]})})]}),je.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[je.jsxs("div",{className:"glass-card p-6",children:[je.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[je.jsx(Qe,{className:"w-5 h-5 text-primary-400"}),je.jsx("h3",{className:"text-lg font-semibold",children:"Performance Timeline"})]}),je.jsxs("div",{className:"space-y-4",children:[je.jsxs("div",{className:"flex items-center justify-between p-3 bg-secondary-800/50 rounded-lg",children:[je.jsxs("div",{className:"flex items-center gap-3",children:[je.jsx(ve,{className:"w-4 h-4 text-success-400"}),je.jsx("span",{className:"text-sm",children:"IPC Optimization"})]}),je.jsx("span",{className:"text-xs text-secondary-400",children:"Active"})]}),je.jsxs("div",{className:"flex items-center justify-between p-3 bg-secondary-800/50 rounded-lg",children:[je.jsxs("div",{className:"flex items-center gap-3",children:[je.jsx(Se,{className:"w-4 h-4 text-primary-400"}),je.jsx("span",{className:"text-sm",children:"Memory Monitoring"})]}),je.jsx("span",{className:"text-xs text-secondary-400",children:"Active"})]}),je.jsxs("div",{className:"flex items-center justify-between p-3 bg-secondary-800/50 rounded-lg",children:[je.jsxs("div",{className:"flex items-center gap-3",children:[je.jsx(Xe,{className:"w-4 h-4 text-warning-400"}),je.jsx("span",{className:"text-sm",children:"Cache Warming"})]}),je.jsx("span",{className:"text-xs text-secondary-400",children:"Pending"})]})]})]}),je.jsxs("div",{className:"glass-card p-6",children:[je.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[je.jsx(Se,{className:"w-5 h-5 text-primary-400"}),je.jsx("h3",{className:"text-lg font-semibold",children:"System Resources"})]}),je.jsxs("div",{className:"space-y-4",children:[je.jsxs("div",{children:[je.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[je.jsx("span",{children:"Memory Usage"}),je.jsxs("span",{className:d(t.memory.percentage,{warning:60,critical:80}),children:[t.memory.percentage.toFixed(1),"%"]})]}),je.jsx("div",{className:"w-full bg-secondary-700 rounded-full h-3",children:je.jsx("div",{className:a("h-3 rounded-full transition-all duration-300",t.memory.percentage>80?"bg-error-500":t.memory.percentage>60?"bg-warning-500":"bg-success-500"),style:{width:`${Math.min(t.memory.percentage,100)}%`}})})]}),je.jsxs("div",{children:[je.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[je.jsx("span",{children:"CPU Usage"}),je.jsxs("span",{className:d(t.system.cpu,{warning:50,critical:70}),children:[t.system.cpu,"%"]})]}),je.jsx("div",{className:"w-full bg-secondary-700 rounded-full h-3",children:je.jsx("div",{className:a("h-3 rounded-full transition-all duration-300",t.system.cpu>70?"bg-error-500":t.system.cpu>50?"bg-warning-500":"bg-success-500"),style:{width:`${Math.min(t.system.cpu,100)}%`}})})]}),je.jsx("div",{className:"pt-4 border-t border-glass-border",children:je.jsxs("div",{className:"flex justify-between items-center",children:[je.jsx("span",{className:"text-sm font-medium",children:"Performance Score"}),je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx("span",{className:"text-lg font-bold text-success-400",children:"92"}),je.jsx(Ge,{className:"w-4 h-4 text-success-400"})]})]})})]})]})]})]})}},Symbol.toStringTag,{value:"Module"})),Hs=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.ar),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(e=>({default:e.ForensicCanvas}))),qs=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.as),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(e=>({default:e.TamperDetector}))),Vs=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.at),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(e=>({default:e.MensReaAnalyzer}))),Ks=Ce.lazy(()=>d(()=>import("./components-BwghXArV.js").then(e=>e.au),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url).then(e=>({default:e.HypothesisBoard}))),Gs=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const[t,a]=be.useState(null),[l,i]=be.useState(null),[n,r]=be.useState(320),[c,d]=be.useState([]),[m,x]=be.useState(!0),[u,h]=be.useState(null),[p,g]=be.useState(!1);be.useEffect(()=>{(async()=>{try{x(!0);const s=await e.getEvidence("CASE-2024-001");d(s),h(null),s.length>0&&v(s[0])}catch(s){h("Failed to load evidence files. Please check connection.")}finally{x(!1)}})()},[]);const[b,j]=be.useState("EVIDENCE"),v=e=>{const s=`${vs}/evidence/${e.id}/download`;a(s),i(e)},f=e=>{if(0===e)return"0 B";const s=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,s)).toFixed(1))+" "+["B","KB","MB","GB"][s]};return m?je.jsx(s,{}):u?je.jsxs("div",{className:"flex items-center justify-center h-screen bg-slate-950 text-red-400 gap-2",children:[je.jsx(es,{size:24}),je.jsx("p",{children:u})]}):je.jsxs("div",{className:"flex flex-col h-[calc(100vh-64px)] overflow-hidden bg-slate-950 text-slate-200",children:[je.jsxs("div",{className:"bg-slate-900 border-b border-slate-800 px-4 h-12 flex items-center gap-4 shrink-0",children:[je.jsx("button",{onClick:()=>j("EVIDENCE"),className:"text-sm font-medium px-4 py-3 border-b-2 transition-colors "+("EVIDENCE"===b?"border-blue-500 text-blue-400":"border-transparent text-slate-400 hover:text-slate-200"),children:"Evidence Board"}),je.jsx("button",{onClick:()=>j("MENS_REA"),className:"text-sm font-medium px-4 py-3 border-b-2 transition-colors "+("MENS_REA"===b?"border-purple-500 text-purple-400":"border-transparent text-slate-400 hover:text-slate-200"),children:"Mens Rea Analysis"}),je.jsx("button",{onClick:()=>j("HYPOTHESIS"),className:"text-sm font-medium px-4 py-3 border-b-2 transition-colors "+("HYPOTHESIS"===b?"border-amber-500 text-amber-400":"border-transparent text-slate-400 hover:text-slate-200"),children:"Hypothesis Testing"})]}),je.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[je.jsxs("div",{className:"w-64 bg-slate-900 border-r border-slate-800 flex flex-col shrink-0",children:[je.jsxs("div",{className:"p-4 border-b border-slate-800 flex justify-between items-center bg-slate-900 sticky top-0 z-10",children:[je.jsxs("h2",{className:"font-bold flex items-center gap-2 text-slate-100",children:[je.jsx(ss,{size:18,className:"text-blue-500"}),"Evidence Locker"]}),je.jsx("span",{className:"text-xs bg-slate-800 px-2 py-0.5 rounded text-slate-400 font-mono",children:c.length})]}),je.jsxs("div",{className:"p-2 flex-1 overflow-y-auto",children:[je.jsxs("div",{className:"relative mb-4 px-2",children:[je.jsx(Le,{className:"absolute left-4 top-2 text-slate-500",size:14}),je.jsx("input",{type:"text",placeholder:"Filter chain of custody...",className:"w-full bg-slate-950 border border-slate-800 rounded pl-8 pr-2 py-1.5 text-xs focus:ring-1 focus:ring-blue-500 focus:outline-none"})]}),je.jsx("div",{className:"px-2 mb-4",children:je.jsxs(o,{onClick:()=>g(!0),size:"sm",className:"w-full justify-center",children:[je.jsx(Re,{size:14,className:"mr-1"})," Add Evidence"]})}),je.jsxs("div",{className:"space-y-1",children:[je.jsx("div",{className:"flex items-center gap-1 text-xs font-bold text-slate-500 uppercase tracking-wider mb-2 px-2 mt-4",children:"Case #2024-001 Box"}),c.map(e=>je.jsxs("button",{onClick:()=>v(e),className:"w-full flex items-center gap-3 p-2 rounded-lg text-left transition-all border "+((null==l?void 0:l.id)===e.id&&"EVIDENCE"===b?"bg-blue-900/20 text-blue-200 border-blue-500/30 shadow-sm":"border-transparent hover:bg-slate-800 text-slate-400 hover:text-slate-200"),children:[je.jsx("div",{className:"p-2 rounded bg-slate-800 shrink-0 "+((null==l?void 0:l.id)===e.id&&"EVIDENCE"===b?"bg-blue-900/50 text-blue-400":""),children:"pdf"===e.fileType?je.jsx(Be,{size:16}):je.jsx(ts,{size:16})}),je.jsxs("div",{className:"overflow-hidden min-w-0",children:[je.jsx("span",{className:"truncate text-sm font-medium block",children:e.fileName}),je.jsxs("span",{className:"text-[10px] text-slate-500 font-mono",children:[f(e.sizeBytes)," • ",new Date(e.uploadedAt).toLocaleDateString()]})]})]},e.id)),0===c.length&&je.jsxs("div",{className:"text-center p-8 text-slate-500 border border-dashed border-slate-800 rounded m-2",children:[je.jsx("div",{className:"w-12 h-12 bg-slate-800 rounded-full flex items-center justify-center mx-auto mb-3",children:je.jsx("svg",{className:"w-6 h-6 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:je.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})})}),je.jsx("h4",{className:"font-semibold text-slate-400 mb-2",children:"No Evidence Yet"})]})]})]})]}),je.jsxs("div",{className:"flex-1 bg-slate-950 relative flex flex-col min-w-0 overflow-hidden",children:["EVIDENCE"===b&&je.jsxs("div",{className:"flex h-full w-full",children:[je.jsx("div",{className:"flex-1 relative",children:je.jsx(be.Suspense,{fallback:je.jsx(s,{}),children:je.jsx(Hs,{fileUrl:t,evidence:l})})}),je.jsx("button",{className:"w-1 bg-slate-800 hover:bg-blue-500 cursor-col-resize transition-colors z-10 hover:w-1.5 focus:outline-none focus:ring-1 focus:ring-blue-500",onMouseDown:e=>{e.preventDefault();const s=e.clientX,t=n,a=e=>{const a=t-(e.clientX-s);r(Math.max(250,Math.min(600,a)))},l=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",l)};document.addEventListener("mousemove",a),document.addEventListener("mouseup",l)},onKeyDown:e=>{"ArrowLeft"===e.key?(e.preventDefault(),r(Math.max(200,n-20))):"ArrowRight"===e.key&&(e.preventDefault(),r(Math.min(600,n+20)))},"aria-label":"Resize analysis panel","aria-valuenow":n,"aria-valuemin":200,"aria-valuemax":600,type:"button"}),je.jsxs("div",{className:"bg-slate-900 border-l border-slate-800 flex flex-col shrink-0",style:{width:n},children:[je.jsx("div",{className:"h-10 border-b border-slate-800 flex items-center px-4 justify-between bg-slate-900",children:je.jsx("span",{className:"font-bold text-xs uppercase tracking-wider text-slate-400",children:"Analysis Tools"})}),je.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[je.jsx(be.Suspense,{fallback:je.jsx("div",{className:"text-slate-500",children:"Loading analysis tools..."}),children:je.jsx(qs,{evidence:l})}),je.jsxs("div",{className:"bg-slate-950 border border-slate-800 rounded-lg p-3",children:[je.jsx("h4",{className:"text-xs font-bold text-slate-500 uppercase mb-3 text-center",children:"Case Notes"}),je.jsx("textarea",{className:"w-full h-32 bg-slate-900 border border-slate-800 rounded p-2 text-sm text-slate-300 focus:ring-1 focus:ring-blue-500 focus:outline-none resize-none font-mono",placeholder:"Enter forensic observations..."}),je.jsx("div",{className:"mt-2 flex justify-end",children:je.jsx("button",{className:"bg-slate-800 hover:bg-slate-700 text-slate-300 text-xs font-bold py-1 px-3 rounded transition-colors",children:"Save"})})]})]})]})]}),"MENS_REA"===b&&je.jsx(be.Suspense,{fallback:je.jsx(s,{}),children:je.jsx(Vs,{evidence:c})}),"HYPOTHESIS"===b&&je.jsx(be.Suspense,{fallback:je.jsx(s,{}),children:je.jsx(Ks,{evidence:c})})]})]}),je.jsx(B,{isOpen:p,onClose:()=>g(!1),onUploadComplete:e=>{const s=e.map((e,s)=>({id:`new-${Date.now()}-${s}`,caseId:"CASE-2024-001",fileName:e.name,fileType:e.type.includes("pdf")?"pdf":"image",sizeBytes:e.size,uploadedAt:(new Date).toISOString(),uploadedBy:"Current User",filePath:"",hash:"pending..."}));d(e=>[...s,...e])}})]})}},Symbol.toStringTag,{value:"Module"})),Js=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const[s,t]=be.useState([]),[a,l]=be.useState([]),[i,n]=be.useState(!1),[r,c]=be.useState(!1),[d,m]=be.useState({}),{addToast:x}=ys(),u=e=>{l(s=>s.map((s,t)=>t===e?{...s,status:"paused",isPaused:!0}:s)),K.announce(`Processing for ${a[e].file.name} paused`,"polite")},h=e=>{l(s=>s.map((s,t)=>t===e?{...s,status:"processing",isPaused:!1}:s)),K.announce(`Processing for ${a[e].file.name} resumed`,"polite")},p=e=>{l(s=>s.map((s,t)=>t===e?{...s,status:"cancelled",isCancellable:!1,progress:0}:s)),K.announce(`Processing for ${a[e].file.name} cancelled`,"polite")},g=a.filter(e=>{var s,t,a;if(d.documentType&&d.documentType.length>0&&(!(null==(s=e.result)?void 0:s.document_type)||!d.documentType.includes(e.result.document_type)))return!1;if(d.status&&d.status.length>0&&!d.status.includes(e.status))return!1;if(void 0!==d.minSize&&e.result&&e.result.sizeBytes"completed"===e.status&&!e.isSaved);return je.jsxs("div",{className:"flex h-[calc(100vh-64px)] overflow-hidden bg-slate-50 dark:bg-slate-950",children:[je.jsx("div",{className:"w-1/4 border-r border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-900 overflow-y-auto shrink-0",children:je.jsx(H,{filterOptions:[{id:"documentType",label:"Document Type",type:"checkbox",options:[{value:"bank_statement",label:"Bank Statement"},{value:"expense_report",label:"Expense Report"},{value:"general_document",label:"General Document"},{value:"image",label:"Image"},{value:"text",label:"Text"}]},{id:"status",label:"Processing Status",type:"checkbox",options:[{value:"pending",label:"Pending"},{value:"processing",label:"Processing"},{value:"completed",label:"Completed"},{value:"error",label:"Error"},{value:"paused",label:"Paused"},{value:"cancelled",label:"Cancelled"}]},{id:"minSize",label:"Minimum Size (bytes)",type:"slider",min:0,max:1e6,defaultValue:0},{id:"searchTerm",label:"Search",type:"search"}],selectedFilters:d,onFilterChange:e=>{m(e)}})}),je.jsxs("div",{className:"flex-1 flex flex-col h-full overflow-hidden p-6",children:[je.jsxs("header",{className:"page-header mb-6",children:[je.jsx("h1",{className:"text-3xl font-bold",children:"Data Ingestion"}),je.jsx("p",{className:"text-slate-600 dark:text-slate-400",children:"Upload and process evidence files for fraud detection analysis"})]}),je.jsxs("section",{className:"upload-section mb-6","aria-labelledby":"upload-heading",children:[je.jsx("h2",{id:"upload-heading",className:"sr-only",children:"File Upload"}),je.jsx(q,{onFilesDropped:e=>{t(s=>[...s,...e]);const s=e.map(e=>({file:e,status:"pending",progress:0,isPaused:!1,isCancellable:!0,isSaved:!1}));l(e=>[...e,...s]),K.announce(`${e.length} files selected for processing`,"polite")},accept:".pdf,.docx,.xlsx,.csv,.jpg,.jpeg,.png,.tiff",multiple:!0}),je.jsxs("div",{className:"action-section mt-4 flex gap-4",children:[s.length>0&&je.jsxs(o,{onClick:async()=>{if(0!==s.length){n(!0),K.announce("Starting file processing","polite");for(let i=0;ie.map((e,s)=>s===i?{...e,status:"processing",progress:10}:e)),K.announce(`Processing ${r.name}`,"polite");try{const s=await e.analyzeFile(r);l(e=>e.map((e,t)=>{var a,l,n,r;return t===i?{...e,status:"completed",progress:100,result:{fileType:(null==(a=s.file_info)?void 0:a.file_type)||"unknown",sizeBytes:(null==(l=s.file_info)?void 0:l.size_bytes)||0,ocrText:(null==(n=s.text_analysis)?void 0:n.extracted_text)||"",extracted_tables:(null==(r=s.text_analysis)?void 0:r.extracted_tables)||[],document_type:s.document_type,bank_statement_data:s.bank_statement_data,expense_data:s.expense_data}}:e})),K.announce(`${r.name} processing completed successfully`,"polite")}catch(t){l(e=>e.map((e,s)=>s===i?{...e,status:"error",progress:100,error:t instanceof Error?t.message:"Processing failed"}:e)),K.announce(`${r.name} processing failed: ${t instanceof Error?t.message:"Unknown error"}`,"assertive")}}n(!1),K.announce("File processing completed","polite")}},disabled:i,loading:i,loadingText:"Processing files...","aria-describedby":"process-files-description",children:[je.jsx(as,{size:16,"aria-hidden":"true"}),i?"Processing...":"Process Files"]}),b&&je.jsxs(o,{onClick:async()=>{const s="CASE-001",t=a.map((e,s)=>({...e,index:s})).filter(e=>"completed"===e.status&&!e.isSaved);if(0===t.length)return void x("No new completed items to save.","info");c(!0),K.announce("Saving evidence to case...","polite");let i=0;for(const a of t)try{const t=await e.uploadEvidence(s,a.file);l(e=>e.map((e,s)=>s===a.index?{...e,isSaved:!0,savedId:t.id}:e)),i++}catch(n){x(`Failed to save ${a.file.name}. It may already exist or backend is unavailable.`,"error")}c(!1),i>0&&(x(`Successfully saved ${i} files to Case ${s}`,"success"),K.announce("Evidence saved successfully","polite"))},disabled:r||i,loading:r,loadingText:"Saving...",variant:"primary",className:"bg-green-600 hover:bg-green-700 text-white",children:[je.jsx($e,{size:16,"aria-hidden":"true"}),"Save to Case"]}),je.jsx("div",{id:"process-files-description",className:"sr-only",children:"Process the selected files for fraud detection analysis"})]})]}),g.length>0&&je.jsxs("section",{className:"results-section flex-1 overflow-y-auto","aria-labelledby":"results-heading",children:[je.jsxs("h2",{id:"results-heading",className:"text-2xl font-bold mb-4",children:["Processing Results (",g.length," filtered)"]}),je.jsx("div",{className:"results-list space-y-4",role:"log","aria-live":"polite","aria-atomic":"false",children:g.map((e,s)=>je.jsx(V,{result:e,index:s,onPause:u,onResume:h,onCancel:p},s))})]}),0===g.length&&a.length>0&&je.jsx("p",{className:"p-4 text-center text-slate-500 dark:text-slate-400",children:"No results match your current filters."}),0===a.length&&je.jsx("p",{className:"p-4 text-center text-slate-500 dark:text-slate-400",children:"Upload files to see processing results."})]})]})}},Symbol.toStringTag,{value:"Module"})),Ws=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const[s,t]=be.useState(void 0),[a,l]=be.useState(!0),[i,n]=be.useState(null),r=async()=>{l(!0),n(null);try{const s=await e.getGraphData(),a={nodes:s.nodes.map(e=>{var s;return{id:e.id,group:e.type,label:e.name||e.id,val:(null==(s=e.properties)?void 0:s.val)||5,...e.properties}}),links:s.links.map(e=>({source:e.source,target:e.target,type:e.type}))};t(a)}catch(s){n("Failed to load network visualization. Please try again.")}finally{l(!1)}};return be.useEffect(()=>{r()},[]),je.jsxs("div",{className:"space-y-6",children:[je.jsxs("div",{className:"flex justify-between items-start",children:[je.jsxs("div",{children:[je.jsx("h1",{className:"text-3xl font-bold tracking-tight text-gray-900 dark:text-white",children:"Network Analysis"}),je.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Maximize detection by visualizing complex relationships between entities, accounts, and transactions."})]}),je.jsxs(o,{onClick:r,variant:"secondary",loading:a,children:[je.jsx(ls,{className:"mr-2 h-4 w-4"}),"Refresh Data"]})]}),je.jsxs("div",{className:"bg-white dark:bg-slate-900 p-6 rounded-lg shadow border border-gray-200 dark:border-slate-800",children:[je.jsxs("div",{className:"flex justify-between items-center mb-4",children:[je.jsx("h2",{className:"text-lg font-medium dark:text-white",children:"Global Entity Relationship Graph"}),je.jsxs("div",{className:"text-xs text-slate-500",children:[(null==s?void 0:s.nodes.length)||0," Entities • ",(null==s?void 0:s.links.length)||0," Connections"]})]}),a?je.jsx("div",{className:"h-[500px] flex items-center justify-center bg-slate-50 dark:bg-slate-950 rounded-lg border border-slate-200 dark:border-slate-800",children:je.jsxs("div",{className:"text-center",children:[je.jsx(is,{className:"h-8 w-8 animate-spin text-blue-500 mx-auto mb-2"}),je.jsx("p",{className:"text-sm text-slate-500",children:"Analyzing network topology..."})]})}):i?je.jsx("div",{className:"h-[500px] flex items-center justify-center bg-red-50 dark:bg-red-900/10 rounded-lg border border-red-200 dark:border-red-900/50",children:je.jsxs("div",{className:"text-center text-red-600 dark:text-red-400",children:[je.jsx("p",{className:"font-medium",children:i}),je.jsx("button",{onClick:r,className:"text-sm underline mt-2 hover:text-red-700",children:"Retry"})]})}):je.jsx("div",{"data-tour":"network-graph",children:je.jsx(G,{data:s,height:600})})]})]})}},Symbol.toStringTag,{value:"Module"})),Ys=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const[s,t]=be.useState(null),{formatCurrency:a,formatDate:l}=J(),[i,n]=be.useState([]),[r,c]=be.useState(!0),d=async()=>{try{c(!0);const s=await e.getReconciliationItems();n(Array.isArray(s)?s:[])}catch(s){}finally{c(!1)}};be.useEffect(()=>{d()},[]);const o=async s=>{try{const t=i.find(e=>e.id===s);t&&(await e.reconcileTransaction(t.transactionId),n(e=>e.map(e=>e.id===s?{...e,status:"matched"}:e)),d())}catch(t){}},m=async s=>{try{const t=i.find(e=>e.id===s);t&&(await e.flagTransaction(t.transactionId,"User flagged from UI"),n(e=>e.map(e=>e.id===s?{...e,status:"discrepancy"}:e)),d())}catch(t){}},x=i.filter(e=>(e.source.includes("Bank")||"Bank Feed"===e.source)&&"matched"!==e.status&&"discrepancy"!==e.status),u=i.filter(e=>(e.source.includes("Ledger")||"Internal Ledger"===e.source)&&"matched"!==e.status&&"discrepancy"!==e.status),h=i.filter(e=>"discrepancy"===e.status);return je.jsxs("div",{className:"page h-[calc(100vh-4rem)] flex flex-col overflow-hidden",children:[je.jsxs("header",{className:"flex-shrink-0 mb-4 flex justify-between items-center",children:[je.jsxs("div",{children:[je.jsx("h1",{className:"text-2xl font-bold text-slate-900 dark:text-white",children:"Reconciliation"}),je.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:"Match transactions and resolve discrepancies"})]}),je.jsx("div",{className:"flex gap-2",children:je.jsx("button",{onClick:()=>{},className:"btn btn-secondary",children:je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx(ns,{size:16}),je.jsx("span",{children:"Export Report"})]})})})]}),r?je.jsxs("div",{className:"flex-1 grid grid-cols-12 gap-6 animate-pulse",children:[je.jsx("div",{className:"col-span-9 bg-slate-100 dark:bg-slate-800 rounded-xl"}),je.jsx("div",{className:"col-span-3 bg-slate-100 dark:bg-slate-800 rounded-xl"})]}):je.jsxs("div",{className:"flex-1 grid grid-cols-12 gap-6 min-h-0",children:[je.jsx("div",{className:"col-span-9 flex flex-col min-h-0",children:je.jsx(W,{bankItems:x,ledgerItems:u,onMatch:(e,s)=>o(e),className:"flex-1 min-h-0"})}),je.jsxs("div",{className:"col-span-3 flex flex-col gap-6 overflow-y-auto pr-2",children:[je.jsxs("div",{className:"p-4 bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-slate-800 shadow-sm",children:[je.jsx("h3",{className:"font-semibold text-slate-700 dark:text-slate-300 mb-3 text-sm uppercase tracking-wider",children:"Match Configuration"}),je.jsxs("div",{className:"space-y-4",children:[je.jsxs("div",{children:[je.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[je.jsx("span",{className:"text-slate-500",children:"Confidence Threshold"}),je.jsx("span",{className:"font-mono text-blue-600",children:"85%"})]}),je.jsx("input",{type:"range",className:"w-full h-1 bg-slate-200 rounded-lg appearance-none cursor-pointer",min:"50",max:"100",defaultValue:"85"})]}),je.jsxs("div",{className:"space-y-2",children:[je.jsx("span",{className:"text-xs font-semibold text-slate-500",children:"Algorithms"}),je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx("input",{type:"checkbox",id:"alg-fuzzy",defaultChecked:!0,className:"rounded border-slate-300 text-blue-600 focus:ring-blue-500"}),je.jsx("label",{htmlFor:"alg-fuzzy",className:"text-sm text-slate-600 dark:text-slate-400",children:"Fuzzy Match (Names)"})]}),je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx("input",{type:"checkbox",id:"alg-amount",defaultChecked:!0,className:"rounded border-slate-300 text-blue-600 focus:ring-blue-500"}),je.jsx("label",{htmlFor:"alg-amount",className:"text-sm text-slate-600 dark:text-slate-400",children:"Exact Amount"})]}),je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx("input",{type:"checkbox",id:"alg-date",defaultChecked:!0,className:"rounded border-slate-300 text-blue-600 focus:ring-blue-500"}),je.jsx("label",{htmlFor:"alg-date",className:"text-sm text-slate-600 dark:text-slate-400",children:"Date Window (±3d)"})]})]}),je.jsx("button",{className:"w-full py-2 bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 rounded-lg text-sm font-medium hover:bg-blue-100 dark:hover:bg-blue-900/40 transition-colors",children:"Run Auto-Match"})]})]}),je.jsxs("div",{className:"p-4 bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-slate-800 shadow-sm",children:[je.jsx("h3",{className:"font-semibold text-slate-700 dark:text-slate-300 mb-4",children:"Summary"}),je.jsxs("div",{className:"space-y-3",children:[je.jsxs("div",{className:"flex justify-between text-sm",children:[je.jsx("span",{className:"text-slate-500",children:"Match Rate"}),je.jsxs("span",{className:"font-medium text-green-600",children:[Math.round(i.filter(e=>"matched"===e.status).length/i.length*100||0),"%"]})]}),je.jsxs("div",{className:"flex justify-between text-sm",children:[je.jsx("span",{className:"text-slate-500",children:"Pending"}),je.jsx("span",{className:"font-medium text-slate-700 dark:text-slate-300",children:x.length+u.length})]}),je.jsxs("div",{className:"flex justify-between text-sm",children:[je.jsx("span",{className:"text-slate-500",children:"Exceptions"}),je.jsx("span",{className:"font-medium text-orange-600",children:h.length})]})]})]}),je.jsx(Y,{items:h,onFlag:m})]})]}),s&&je.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[je.jsx("div",{className:"absolute inset-0 bg-black/50",onClick:()=>t(null),role:"button",tabIndex:0,onKeyDown:e=>"Escape"===e.key&&t(null),"aria-label":"Close modal"}),je.jsxs("div",{className:"relative bg-white dark:bg-slate-900 rounded-lg max-w-lg w-full p-6 shadow-xl z-10",role:"dialog","aria-modal":"true",tabIndex:-1,children:[je.jsx("h2",{className:"text-xl font-bold mb-4",children:"Transaction Details"}),je.jsxs("div",{className:"space-y-2 mb-6 text-sm text-slate-700 dark:text-slate-300",children:[je.jsxs("p",{children:[je.jsx("strong",{children:"Transaction ID:"})," ",je.jsx("span",{className:"font-mono",children:s.transactionId})]}),je.jsxs("p",{children:[je.jsx("strong",{children:"Source:"})," ",s.source]}),je.jsxs("p",{children:[je.jsx("strong",{children:"Amount:"})," ",a(s.amount,s.currency)]}),je.jsxs("p",{children:[je.jsx("strong",{children:"Date:"})," ",l(s.date)]}),je.jsxs("p",{children:[je.jsx("strong",{children:"Status:"})," ",je.jsx("span",{className:"capitalize",children:s.status})]}),s.discrepancyAmount&&je.jsxs("p",{className:"text-orange-600",children:[je.jsx("strong",{children:"Discrepancy:"})," ",a(s.discrepancyAmount,s.currency)]}),s.notes&&je.jsxs("p",{children:[je.jsx("strong",{children:"Notes:"})," ",s.notes]})]}),je.jsxs("div",{className:"flex justify-end gap-2",children:["matched"!==s.status&&je.jsx("button",{onClick:()=>{o(s.id),t(null)},className:"btn btn-primary",children:je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx(ve,{size:16}),je.jsx("span",{children:"Reconcile"})]})}),"discrepancy"===s.status&&je.jsx("button",{onClick:()=>{m(s.id),t(null)},className:"btn btn-danger",children:je.jsxs("div",{className:"flex items-center gap-2",children:[je.jsx(fe,{size:16}),je.jsx("span",{children:"Flag"})]})}),je.jsx("button",{onClick:()=>t(null),className:"btn btn-secondary",children:"Close"})]})]})]})]})}},Symbol.toStringTag,{value:"Module"})),Qs=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const[s,t]=be.useState("overview"),[a,l]=be.useState([]),[i,n]=be.useState(null),[r,c]=be.useState(!0);be.useEffect(()=>{d()},[]);const d=async()=>{try{c(!0);const[s,t]=await Promise.all([e.getIntegrations(),e.getIntegrationMetrics()]);l(s),n(t)}catch(s){}finally{c(!1)}};return r?je.jsxs("div",{className:"integration-hub-loading",children:[je.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-500"}),je.jsx("p",{className:"mt-2 text-slate-600",children:"Loading Integration Hub..."})]}):je.jsxs("div",{className:"integration-hub",children:[je.jsx("div",{className:"hub-header",children:je.jsxs("div",{className:"flex items-center justify-between",children:[je.jsxs("div",{children:[je.jsxs("h1",{className:"text-2xl font-bold text-slate-900 flex items-center",children:[je.jsx(rs,{className:"w-8 h-8 text-blue-600 mr-3"}),"Integration Hub"]}),je.jsx("p",{className:"text-slate-600 mt-1",children:"Connect and manage third-party integrations and APIs"})]}),je.jsx("div",{className:"flex items-center space-x-3",children:je.jsxs("button",{className:"bg-blue-600 text-white px-4 py-2 rounded-lg hover:bg-blue-700 flex items-center",children:[je.jsx(Re,{className:"w-4 h-4 mr-2"}),"Add Integration"]})})]})}),i&&je.jsxs("div",{className:"metrics-overview",children:[je.jsxs("div",{className:"metric-card",children:[je.jsx("div",{className:"metric-icon",children:je.jsx(Se,{className:"w-6 h-6 text-blue-600"})}),je.jsxs("div",{className:"metric-content",children:[je.jsx("div",{className:"metric-value",children:i.totalIntegrations}),je.jsx("div",{className:"metric-label",children:"Total Integrations"})]})]}),je.jsxs("div",{className:"metric-card",children:[je.jsx("div",{className:"metric-icon",children:je.jsx(ve,{className:"w-6 h-6 text-green-600"})}),je.jsxs("div",{className:"metric-content",children:[je.jsx("div",{className:"metric-value",children:i.activeIntegrations}),je.jsx("div",{className:"metric-label",children:"Active"})]})]}),je.jsxs("div",{className:"metric-card",children:[je.jsx("div",{className:"metric-icon",children:je.jsx(Qe,{className:"w-6 h-6 text-purple-600"})}),je.jsxs("div",{className:"metric-content",children:[je.jsxs("div",{className:"metric-value",children:[(100*i.successRate).toFixed(1),"%"]}),je.jsx("div",{className:"metric-label",children:"Success Rate"})]})]}),je.jsxs("div",{className:"metric-card",children:[je.jsx("div",{className:"metric-icon",children:je.jsx(Xe,{className:"w-6 h-6 text-orange-600"})}),je.jsxs("div",{className:"metric-content",children:[je.jsxs("div",{className:"metric-value",children:[i.averageLatency,"ms"]}),je.jsx("div",{className:"metric-label",children:"Avg Latency"})]})]})]}),je.jsx("div",{className:"hub-tabs",children:[{id:"overview",label:"Overview",icon:Qe},{id:"integrations",label:"Integrations",icon:qe},{id:"marketplace",label:"API Marketplace",icon:cs},{id:"graphql",label:"GraphQL Federation",icon:Ke},{id:"events",label:"Event Bus",icon:Se},{id:"analytics",label:"Analytics",icon:Ge}].map(e=>je.jsxs("button",{onClick:()=>t(e.id),className:"tab-button "+(s===e.id?"active":""),children:[je.jsx(e.icon,{className:"w-4 h-4 mr-2"}),e.label]},e.id))}),je.jsxs(Q,{mode:"wait",children:["overview"===s&&je.jsx(X,{}),"integrations"===s&&je.jsx(Z,{integrations:a}),"marketplace"===s&&je.jsx(ee,{}),"graphql"===s&&je.jsx(se,{}),"events"===s&&je.jsx(te,{}),"analytics"===s&&je.jsx(ae,{integrations:a})]})]})}},Symbol.toStringTag,{value:"Module"})),Xs={"en-US":"English (US)","en-GB":"English (UK)","es-ES":"Español","fr-FR":"Français","de-DE":"Deutsch","ja-JP":"日本語","id-ID":"Bahasa Indonesia","en-MY":"English (Malaysia)","en-SG":"English (Singapore)","th-TH":"ไทย (Thailand)"},Zs=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const[s,t]=be.useState("general"),{settings:a,setLocale:l,setTimezone:i}=le(),{addToast:n}=ys(),[r,c]=be.useState({theme:"dark",notifications:!0,autoSave:!1,maxFileSize:"10"}),[d,m]=be.useState(!1),x=be.useMemo(()=>ie().map(e=>({value:e,label:e.replace(/_/g," ").replace("/"," / ")})),[]),u=(e,s)=>{c(t=>({...t,[e]:s}))},h=async()=>{m(!0);try{await e.saveUserPreferences({...r,locale:a}),n("Settings saved successfully","success"),K.announce("Settings saved successfully","polite")}catch(s){K.announce("Failed to save settings","assertive")}finally{m(!1)}},p=[{id:"general",label:"General",icon:He},{id:"notifications",label:"Notifications",icon:Ve},{id:"security",label:"Security",icon:Je},{id:"detection",label:"Detection Logic",icon:ds},{id:"accessibility",label:"Accessibility",icon:os},{id:"system",label:"System",icon:Se}],g=Object.entries(Xs).map(([e,s])=>({value:e,label:s})),b=[{name:"theme",label:"Theme",type:"select",options:[{value:"dark",label:"Dark Theme"},{value:"light",label:"Light Theme"},{value:"auto",label:"Auto (System)"}],validation:{required:"Please select a theme"}},{name:"language",label:"Language",type:"select",options:g,validation:{required:"Please select a language"}},{name:"maxFileSize",label:"Maximum File Size (MB)",type:"number",validation:{required:"Maximum file size is required",minLength:{value:1,message:"File size must be at least 1MB"},maxLength:{value:3,message:"File size cannot exceed 999MB"}}}];return je.jsxs("div",{className:"page",children:[je.jsxs("header",{className:"mb-6",children:[je.jsx("h1",{className:"text-2xl font-bold",children:"Settings"}),je.jsx("p",{className:"text-slate-500 mt-1",children:"Configure application preferences and system options"})]}),je.jsx("div",{className:"flex gap-1 border-b border-slate-200 dark:border-slate-700 mb-6",role:"tablist",children:p.map(e=>je.jsxs("button",{role:"tab","aria-selected":s===e.id,"aria-controls":`panel-${e.id}`,onClick:()=>t(e.id),className:"flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors border-b-2 -mb-px "+(s===e.id?"border-blue-600 text-blue-600":"border-transparent text-slate-500 hover:text-slate-800 hover:border-slate-300"),children:[je.jsx(e.icon,{size:16}),e.label]},e.id))}),je.jsxs("div",{className:"settings-content",children:["general"===s&&je.jsx("div",{id:"panel-general",role:"tabpanel","aria-labelledby":"tab-general",className:"animate-fadeIn",children:je.jsxs("section",{"aria-labelledby":"general-settings-heading",children:[je.jsx("h2",{id:"general-settings-heading",className:"text-lg font-bold mb-4",children:"General Settings"}),je.jsx(ne,{fields:b,onSubmit:e=>{Object.entries(e).forEach(([e,s])=>{u(e,s)}),h()},submitLabel:"Save Settings",loading:d,className:"settings-form"}),je.jsx("div",{className:"additional-settings mt-6 space-y-4",children:je.jsxs("div",{className:"setting-item flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsx("label",{htmlFor:"auto-save-toggle",className:"setting-label font-medium",children:"Auto-save Changes"}),je.jsx("input",{id:"auto-save-toggle",type:"checkbox",checked:r.autoSave,onChange:e=>u("autoSave",e.target.checked),className:"w-5 h-5 rounded","aria-describedby":"auto-save-description"})]})}),je.jsxs("div",{className:"mt-8",children:[je.jsxs("h3",{className:"text-md font-bold mb-4 flex items-center gap-2",children:[je.jsx(rs,{size:18,className:"text-blue-500"}),"Regional Settings"]}),je.jsxs("div",{className:"space-y-4",children:[je.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsxs("div",{children:[je.jsx("label",{htmlFor:"language-select",className:"font-medium block",children:"Language"}),je.jsx("p",{className:"text-sm text-slate-500",children:"Display language for the application"})]}),je.jsx("select",{id:"language-select",value:a.locale,onChange:e=>l(e.target.value),className:"px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-900 text-sm min-w-[180px]","aria-label":"Select language",children:g.map(e=>je.jsx("option",{value:e.value,children:e.label},e.value))})]}),je.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsxs("div",{children:[je.jsx("label",{htmlFor:"timezone-select",className:"font-medium block",children:"Timezone"}),je.jsx("p",{className:"text-sm text-slate-500",children:"All dates and times will be displayed in this timezone"})]}),je.jsx("select",{id:"timezone-select",value:a.timezone,onChange:e=>i(e.target.value),className:"px-3 py-2 border border-slate-300 dark:border-slate-600 rounded-lg bg-white dark:bg-slate-900 text-sm min-w-[220px]","aria-label":"Select timezone",children:x.map(e=>je.jsx("option",{value:e.value,children:e.label},e.value))})]})]})]})]})}),"notifications"===s&&je.jsx("div",{id:"panel-notifications",role:"tabpanel","aria-labelledby":"tab-notifications",className:"animate-fadeIn",children:je.jsxs("section",{"aria-labelledby":"notifications-heading",children:[je.jsx("h2",{id:"notifications-heading",className:"text-lg font-bold mb-4",children:"Notification Preferences"}),je.jsxs("div",{className:"space-y-4",children:[je.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsxs("div",{children:[je.jsx("label",{htmlFor:"notifications-toggle",className:"font-medium block",children:"Enable Notifications"}),je.jsx("p",{className:"text-sm text-slate-500",children:"Receive alerts for important events"})]}),je.jsx("input",{id:"notifications-toggle",type:"checkbox",checked:r.notifications,onChange:e=>u("notifications",e.target.checked),className:"w-5 h-5 rounded"})]}),je.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsxs("div",{children:[je.jsx("label",{htmlFor:"email-notifications",className:"font-medium block",children:"Email Notifications"}),je.jsx("p",{className:"text-sm text-slate-500",children:"Receive daily digest via email"})]}),je.jsx("input",{id:"email-notifications",type:"checkbox",className:"w-5 h-5 rounded"})]}),je.jsxs("div",{className:"flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsxs("div",{children:[je.jsx("label",{htmlFor:"critical-alerts",className:"font-medium block",children:"Critical Alerts Only"}),je.jsx("p",{className:"text-sm text-slate-500",children:"Only notify for high-priority items"})]}),je.jsx("input",{id:"critical-alerts",type:"checkbox",className:"w-5 h-5 rounded"})]})]})]})}),"security"===s&&je.jsxs("div",{id:"panel-security",role:"tabpanel","aria-labelledby":"tab-security",className:"animate-fadeIn",children:[je.jsx("section",{"aria-labelledby":"rbac-heading",className:"mb-8",children:je.jsx(re,{})}),je.jsxs("section",{"aria-labelledby":"audit-log-heading",children:[je.jsxs("h2",{id:"audit-log-heading",className:"text-lg font-bold flex items-center gap-2 mb-4",children:[je.jsx(ms,{size:20,className:"text-blue-500"}),"Audit Log"]}),je.jsx(ce,{})]})]}),"detection"===s&&je.jsxs("div",{id:"panel-detection",role:"tabpanel","aria-labelledby":"tab-detection",className:"animate-fadeIn",children:[je.jsxs("div",{className:"mb-6",children:[je.jsx("h2",{className:"text-lg font-bold mb-2",children:"Fraud Detection Rules"}),je.jsx("p",{className:"text-slate-500",children:"Configure automated logic for flagging suspicious transactions."})]}),je.jsx(de,{})]}),"accessibility"===s&&je.jsx("div",{id:"panel-accessibility",role:"tabpanel","aria-labelledby":"tab-accessibility",className:"animate-fadeIn",children:je.jsxs("section",{"aria-labelledby":"accessibility-heading",className:"mb-8",children:[je.jsxs("h2",{id:"accessibility-heading",className:"text-lg font-bold flex items-center gap-2 mb-4",children:[je.jsx(os,{size:20,className:"text-blue-500"}),"Accessibility Settings"]}),je.jsx("p",{className:"text-slate-500 mb-6",children:"Customize the application to meet your accessibility needs."}),je.jsx(oe,{})]})}),"system"===s&&je.jsxs("div",{id:"panel-system",role:"tabpanel","aria-labelledby":"tab-system",className:"animate-fadeIn",children:[je.jsxs("section",{"aria-labelledby":"health-heading",className:"mb-8",children:[je.jsxs("h2",{id:"health-heading",className:"text-lg font-bold flex items-center gap-2 mb-4",children:[je.jsx(Se,{size:20,className:"text-green-500"}),"System Health"]}),je.jsx(me,{})]}),je.jsxs("section",{"aria-labelledby":"system-info-heading",children:[je.jsx("h2",{id:"system-info-heading",className:"text-lg font-bold mb-4",children:"System Information"}),je.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[je.jsxs("div",{className:"p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsx("span",{className:"text-sm text-slate-500 block",children:"Version"}),je.jsx("span",{className:"text-lg font-bold",children:"1.0.0"})]}),je.jsxs("div",{className:"p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsx("span",{className:"text-sm text-slate-500 block",children:"Database"}),je.jsx("span",{className:"text-lg font-bold text-green-600",children:"Connected"})]}),je.jsxs("div",{className:"p-4 bg-slate-50 dark:bg-slate-800 rounded-lg",children:[je.jsx("span",{className:"text-sm text-slate-500 block",children:"Memory Usage"}),je.jsx("span",{className:"text-lg font-bold",children:"245 MB"})]})]})]})]})]}),je.jsxs("section",{className:"settings-actions mt-8 flex gap-3","aria-label":"Settings actions",children:[je.jsxs(o,{onClick:h,disabled:d,loading:d,loadingText:"Saving settings...",variant:"primary",children:[je.jsx($e,{size:16,"aria-hidden":"true"}),"Save All Settings"]}),je.jsxs(o,{onClick:()=>{c({theme:"dark",notifications:!0,autoSave:!1,maxFileSize:"10"}),l("en-US"),i(xe()),K.announce("Settings reset to defaults","polite")},variant:"secondary","aria-describedby":"reset-description",children:[je.jsx(ls,{size:16,"aria-hidden":"true"}),"Reset to Defaults"]})]})]})}},Symbol.toStringTag,{value:"Module"})),et=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{var e,s;const t=Ae(),a=(null==(s=null==(e=xs().state)?void 0:e.from)?void 0:s.pathname)||"/";return je.jsxs("div",{className:"min-h-screen flex bg-slate-50 dark:bg-slate-950 text-slate-900 dark:text-slate-100 font-sans",children:[je.jsx("div",{className:"flex-1 flex flex-col justify-center py-12 px-4 sm:px-6 lg:flex-none lg:w-1/2 xl:w-[480px] bg-white dark:bg-slate-900 z-10 relative",children:je.jsxs("div",{className:"mx-auto w-full max-w-sm lg:w-96",children:[je.jsxs("div",{className:"mb-10 animate-in fade-in slide-in-from-bottom duration-700",children:[je.jsx("div",{className:"h-12 w-12 bg-blue-600 rounded-xl flex items-center justify-center mb-6 shadow-lg shadow-blue-600/20",children:je.jsx(us,{className:"w-7 h-7 text-white"})}),je.jsx("h2",{className:"text-3xl font-extrabold tracking-tight",children:"Welcome Back"}),je.jsx("p",{className:"mt-2 text-sm text-slate-500 dark:text-slate-400",children:"Sign in to access your intelligence dashboard."})]}),je.jsxs("div",{className:"mt-8 animate-in fade-in slide-in-from-bottom duration-700 delay-150",children:[je.jsx(ue,{onSuccess:()=>{t(a,{replace:!0})}}),je.jsx("div",{className:"mt-6 text-center",children:je.jsxs("p",{className:"text-xs text-slate-400",children:["By signing in, you agree to our",je.jsx("a",{href:"/terms",className:"text-blue-600 hover:text-blue-500 mx-1",children:"Terms of Service"}),"and",je.jsx("a",{href:"/privacy",className:"text-blue-600 hover:text-blue-500 mx-1",children:"Privacy Policy"}),"."]})})]})]})}),je.jsxs("div",{className:"hidden lg:block relative flex-1 bg-slate-900 overflow-hidden",children:[je.jsxs("div",{className:"absolute inset-0",children:[je.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-slate-900 via-slate-800 to-black opacity-90 z-0"}),je.jsx(Ge,{className:"absolute inset-0 h-full w-full opacity-5 pointer-events-none text-blue-500"}),je.jsx("div",{className:"absolute top-1/4 left-1/4 w-96 h-96 bg-blue-600/20 rounded-full blur-3xl animate-pulse"}),je.jsx("div",{className:"absolute bottom-1/3 right-1/4 w-64 h-64 bg-purple-600/20 rounded-full blur-3xl animate-pulse delay-1000"})]}),je.jsxs("div",{className:"relative z-10 h-full flex flex-col justify-between p-12 text-white",children:[je.jsx("div",{className:"flex justify-end",children:je.jsx("div",{className:"text-xs font-mono opacity-50 border border-white/20 px-3 py-1 rounded-full",children:"SYSTEM_STATUS: ONLINE"})}),je.jsxs("div",{className:"max-w-xl mb-20",children:[je.jsx("div",{className:"h-1 w-20 bg-blue-500 mb-8 rounded-full"}),je.jsxs("h1",{className:"text-5xl font-bold tracking-tight leading-tight mb-6",children:["Advanced Fraud Detection & ",je.jsx("span",{className:"text-transparent bg-clip-text bg-gradient-to-r from-blue-400 to-purple-400",children:"Network Intelligence"})]}),je.jsx("p",{className:"text-xl text-slate-300 font-light leading-relaxed",children:"Uncover hidden connections, detect complex patterns, and protect your platform with our next-generation investigation suite."})]}),je.jsxs("div",{className:"flex gap-4 text-xs font-mono text-slate-400",children:[je.jsx("div",{children:"v2.4.0-RC1"}),je.jsx("div",{children:"•"}),je.jsx("div",{children:"SECURE_CONNECTION"})]})]})]})]})}},Symbol.toStringTag,{value:"Module"})),st=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const e=Ae();return je.jsx("div",{className:"min-h-screen flex flex-col items-center justify-center bg-slate-50 dark:bg-slate-950 p-4",children:je.jsxs("div",{className:"max-w-md w-full text-center space-y-8",children:[je.jsxs("div",{className:"relative w-32 h-32 mx-auto",children:[je.jsx("div",{className:"absolute inset-0 bg-blue-100 dark:bg-blue-900/30 rounded-full animate-pulse"}),je.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:je.jsx(Le,{size:48,className:"text-blue-500 dark:text-blue-400"})})]}),je.jsxs("div",{className:"space-y-4",children:[je.jsx("h1",{className:"text-4xl font-extrabold text-slate-900 dark:text-white tracking-tight",children:"404"}),je.jsx("h2",{className:"text-xl font-medium text-slate-700 dark:text-slate-300",children:"Page Not Found"}),je.jsx("p",{className:"text-slate-500 dark:text-slate-400",children:"The page you're looking for doesn't exist. Perhaps it was moved, deleted, or you typed the URL incorrectly."})]}),je.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4",children:[je.jsxs(o,{onClick:()=>e(-1),variant:"secondary",className:"w-full justify-center",children:[je.jsx(hs,{size:16,className:"mr-2"}),"Go Back"]}),je.jsxs(o,{onClick:()=>e("/"),className:"w-full justify-center",children:[je.jsx(ps,{size:16,className:"mr-2"}),"Dashboard"]})]}),je.jsxs("div",{className:"pt-8 border-t border-slate-200 dark:border-slate-800",children:[je.jsx("p",{className:"text-xs font-semibold text-slate-400 uppercase tracking-wider mb-4",children:"FREQUENTLY VISITED"}),je.jsxs("div",{className:"space-y-2",children:[je.jsxs("button",{onClick:()=>e("/"),className:"w-full flex items-center p-3 text-sm rounded-lg hover:bg-white dark:hover:bg-slate-900 hover:shadow-sm transition-all text-slate-600 dark:text-slate-400 hover:text-blue-600 dark:hover:text-blue-400 group",children:[je.jsx("div",{className:"p-2 bg-slate-100 dark:bg-slate-800 rounded mr-3 group-hover:bg-blue-50 dark:group-hover:bg-blue-900/30",children:je.jsx(ps,{size:16})}),"Dashboard Overview"]}),je.jsxs("button",{onClick:()=>e("/cases"),className:"w-full flex items-center p-3 text-sm rounded-lg hover:bg-white dark:hover:bg-slate-900 hover:shadow-sm transition-all text-slate-600 dark:text-slate-400 hover:text-blue-600 dark:hover:text-blue-400 group",children:[je.jsx("div",{className:"p-2 bg-slate-100 dark:bg-slate-800 rounded mr-3 group-hover:bg-blue-50 dark:group-hover:bg-blue-900/30",children:je.jsx(Be,{size:16})}),"Case Management"]})]})]})]})})}},Symbol.toStringTag,{value:"Module"})),tt=Object.freeze(Object.defineProperty({__proto__:null,default:()=>{const[s,t]=be.useState([]),[a,l]=be.useState(null),[i,n]=be.useState(!0),{addToast:r}=ys(),c=be.useCallback(async()=>{try{n(!0);const s=await e.getAlerts();t(s),s.length}catch(s){}finally{n(!1)}},[a]);be.useEffect(()=>{c()},[c]);const d=s.find(e=>e.id===a),o=be.useCallback(async(a,i)=>{try{t(e=>e.map(e=>e.id===a?{...e,status:i}:e));const n=s.findIndex(e=>e.id===a),c=s.find((e,s)=>s>n&&"pending"===e.status)||s.find((e,s)=>s{if(!["INPUT","TEXTAREA"].includes(e.target.tagName))if(a||!(s.length>0)||"ArrowDown"!==e.key&&"ArrowUp"!==e.key)if("ArrowDown"===e.key){const e=s.findIndex(e=>e.id===a);ee.id===a);e>0&&l(s[e-1].id)}else a&&"pending"===(null==d?void 0:d.status)&&("a"!==e.key&&"A"!==e.key||o(a,"approved"),"r"!==e.key&&"R"!==e.key||o(a,"rejected"),"e"!==e.key&&"E"!==e.key||o(a,"escalated"));else l(s[0].id)},[s,a,d,o]);return be.useEffect(()=>(window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)),[m]),je.jsx(he,{isDetailOpen:!!a,list:je.jsx(ge,{alerts:s,selectedId:a,onSelect:e=>{l(e.id)},loading:i}),detail:d?je.jsx(pe,{alert:d,onApprove:e=>o(e,"approved"),onReject:e=>o(e,"rejected"),onEscalate:e=>o(e,"escalated")}):null})}},Symbol.toStringTag,{value:"Module"}));export{Ps as A,Is as C,zs as D,Gs as F,Ls as I,et as L,Ws as N,Bs as P,Ys as R,Zs as S,Ns as T,Os as a,Fs as b,Js as c,Qs as d,st as e};