1import{r as o,j as e}from"./vendor-react-D9PeLrAx.js";import{c as g,u as y}from"./vendor-query-PudurbrK.js";import{a as b,b as f}from"./contactPageShared-DK234FvA.js";import{b1 as w,R as j}from"./vendor-icons-OH5kNBSo.js";import"./index-BSNTCWgB.js";import"./vendor-radix-CSvuWcfL.js";const x={ready:"bg-emerald-100 text-emerald-700",close:"bg-amber-100 text-amber-700",building:"bg-blue-100 text-blue-700",watching:"bg-gray-100 text-gray-600"},p={ready:"Ready",close:"Close",building:"Building",watching:"Watching"},N=["ready","close","building","watching"],R=12;function $(){const m=g(),[n,r]=o.useState(!1),[i,s]=o.useState(null),{data:l,isLoading:u}=y({queryKey:["/api/admin/lawsuit-readiness-pipeline"],queryFn:f}),h=async()=>{r(!0),s(null);try{await b("POST","/api/admin/lawsuit-readiness-pipeline/rescan"),s("Re-scan running in the background â statuses refresh as it finishes."),setTimeout(()=>{m.invalidateQueries({queryKey:["/api/admin/lawsuit-readiness-pipeline"]})},1e4)}catch(a){s(a?.message||"Re-scan failed to start")}finally{r(!1)}},c=l?.items??[],t=c.slice(0,R),d=Math.max(0,c.length-t.length);return e.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-4","data-testid":"panel-lawsuit-radar",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-emerald-600"}),e.jsx("h3",{className:"text-sm font-semibold text-gray-700",children:"Lawsuit Radar"}),e.jsx("span",{className:"text-[11px] text-gray-400",children:"statutory clocks across the whole book â updates on mail/response/evidence changes + a daily sweep"})]}),e.jsxs("button",{onClick:h,disabled:n,className:"flex items-center gap-1 px-2 py-1 text-[11px] text-gray-600 border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-50","data-testid":"button-radar-rescan",children:[e.jsx(j,{className:`h-3 w-3 ${n?"animate-spin":""}`}),"Re-scan book"]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:N.map(a=>e.jsx("div",{className:"flex items-center gap-1","data-testid":`chip-radar-count-${a}`,children:e.jsxs("span",{className:`px-2 py-0.5 rounded-full font-semibold text-[11px] ${x[a]}`,children:[p[a],": ",l?.counts?.[a]??0]})},a))}),i&&e.jsx("p",{className:"text-[11px] text-gray-500 mb-2","data-testid":"text-radar-rescan-note",children:i}),u?e.jsx("p",{className:"text-xs text-gray-400",children:"Loading radarâ¦"}):t.length===0?e.jsx("p",{className:"text-xs text-gray-400","data-testid":"text-radar-pipeline-empty",children:"No clients on the radar yet â statuses appear when dispute letters get mailed (or after a re-scan)."}):e.jsxs("div",{className:"space-y-1.5",children:[t.map(a=>e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs","data-testid":`row-radar-pipeline-${a.enrollmentId}`,children:[e.jsx("span",{className:"font-medium text-gray-800 truncate shrink-0 max-w-[160px]",children:a.clientName}),e.jsx("span",{className:"text-gray-500 truncate flex-1",children:a.summary||"â"}),e.jsx("span",{className:"text-gray-400 whitespace-nowrap",children:a.statusSince?new Date(a.statusSince).toLocaleDateString():""}),e.jsx("span",{className:`px-2 py-0.5 rounded-full font-semibold text-[10px] shrink-0 ${x[a.status]}`,children:p[a.status]})]},a.enrollmentId)),d>0&&e.jsxs("p",{className:"text-[11px] text-gray-400",children:["+",d," more â every client's own card shows the full detail."]})]})]})}export{$ as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.