1import{r as b,j as e}from"./vendor-react-D9PeLrAx.js";import{u as O}from"./vendor-query-PudurbrK.js";import{B as k,C as l,j as n,n as c,h as d}from"./index-BSNTCWgB.js";import{B as x}from"./badge-CEK8OBHd.js";import{I as w}from"./input-CF8i93XH.js";import{L as g}from"./label-DuN-mopM.js";import{S as z,a as U,b as _,c as E,d as y}from"./select-DJeRyCQy.js";import"./vendor-icons-OH5kNBSo.js";import"./vendor-radix-CSvuWcfL.js";const S=["A","B","C","D","F","U","ungraded"];function q(){if(typeof window>"u")return{};const r=window.localStorage.getItem("adminToken")||"";return r?{Authorization:`Bearer ${r}`}:{}}async function G(r){const i=await fetch(`/api/admin/mirror-telemetry${r}`,{headers:{...q()}}),h=await i.json().catch(()=>({}));if(!i.ok||!h.ok)throw new Error(h.error||`${i.status} ${i.statusText}`);return h}function p(r){if(!r)return"â";try{return new Date(r).toLocaleString()}catch{return String(r)}}function m(r){return r?r.charAt(0).toUpperCase()+r.slice(1):"â"}function I(r){switch(r){case"invariant_overcount":return"Invariant overcount";case"zombie":return"Zombie (zero pages)";case"other_failure":return"Other failure";default:return"â"}}function Y(r){switch(r){case"phantom_oc_echo":return"Phantom original-creditor echo";case"merge_double_extraction":return"Merge double-extraction";default:return r}}function W(r){const i=r||"ungraded",h=i==="A"?"bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-100":i==="B"?"bg-lime-100 text-lime-800 dark:bg-lime-900 dark:text-lime-100":i==="C"?"bg-amber-100 text-amber-800 dark:bg-amber-900 dark:text-amber-100":i==="D"?"bg-orange-200 text-orange-900 dark:bg-orange-900 dark:text-orange-100":i==="F"?"bg-rose-200 text-rose-900 dark:bg-rose-900 dark:text-rose-100":i==="U"?"bg-purple-200 text-purple-900 dark:bg-purple-900 dark:text-purple-100":"bg-slate-200 text-slate-700 dark:bg-slate-700 dark:text-slate-200";return e.jsx(x,{className:h,"data-testid":`badge-grade-${i}`,children:i.toUpperCase()})}function f(r){return r==="captured"?e.jsx(x,{className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900 dark:text-emerald-100",children:"captured"}):e.jsx(x,{className:"bg-slate-200 text-slate-700 dark:bg-slate-700 dark:text-slate-200",children:"not_yet_captured"})}function ae({onOpenClient:r}={}){const[i,h]=b.useState(""),[N,C]=b.useState(""),[u,F]=b.useState("all"),[v,B]=b.useState("1000");function T(t){if(t){try{sessionStorage.setItem("crm_pending_import_intel",JSON.stringify({enrollmentId:t}))}catch{}r?r(t):window.location.assign("/admin/dashboard")}}function $(){const t=new URLSearchParams;if(i){const j=new Date(i);isNaN(j.getTime())||t.set("start",j.toISOString())}if(N){const j=new Date(N);isNaN(j.getTime())||t.set("end",j.toISOString())}u&&u!=="all"&&t.set("bureau",u);const a=parseInt(v,10);Number.isFinite(a)&&a>0&&t.set("limit",String(Math.min(a,5e3)));const o=t.toString();return o?`?${o}`:""}const D=$(),{data:A,isLoading:M,isError:P,error:R,refetch:L,isFetching:H}=O({queryKey:["/api/admin/mirror-telemetry",{start:i,end:N,bureau:u,limit:v}],queryFn:()=>G(D),staleTime:3e4}),s=A?.report;return e.jsxs("div",{className:"container mx-auto max-w-7xl p-6 space-y-6","data-testid":"page-mirror-telemetry",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold","data-testid":"text-mirror-telemetry-title",children:"Mirror Telemetry â Diagnostic View"}),e.jsx("p",{className:"text-sm text-muted-foreground max-w-3xl mt-1",children:"Read-only view of PDFâUI parity grades for credit report imports. This page is observation-only â it does not change how imports are graded, does not flag accounts for review, and does not affect dispute generation. See the field-capture and fingerprint notes for known gaps."})]}),e.jsx(k,{variant:"outline",onClick:()=>L(),disabled:H,"data-testid":"button-mirror-telemetry-refresh",children:H?"Refreshingâ¦":"Refresh"})]}),e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Filters"})}),e.jsx(d,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(g,{htmlFor:"filter-start",children:"Start (ISO or YYYY-MM-DD)"}),e.jsx(w,{id:"filter-start",value:i,onChange:t=>h(t.target.value),placeholder:"2026-05-01","data-testid":"input-filter-start"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(g,{htmlFor:"filter-end",children:"End (ISO or YYYY-MM-DD)"}),e.jsx(w,{id:"filter-end",value:N,onChange:t=>C(t.target.value),placeholder:"2026-05-22","data-testid":"input-filter-end"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(g,{htmlFor:"filter-bureau",children:"Bureau"}),e.jsxs(z,{value:u,onValueChange:F,children:[e.jsx(U,{id:"filter-bureau","data-testid":"select-filter-bureau",children:e.jsx(_,{placeholder:"All bureaus"})}),e.jsxs(E,{children:[e.jsx(y,{value:"all",children:"All bureaus"}),e.jsx(y,{value:"equifax",children:"Equifax"}
1),e.jsx(y,{value:"experian",children:"Experian"}),e.jsx(y,{value:"transunion",children:"TransUnion"})]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(g,{htmlFor:"filter-limit",children:"Limit (1â5000)"}),e.jsx(w,{id:"filter-limit",type:"number",min:1,max:5e3,value:v,onChange:t=>B(t.target.value),"data-testid":"input-filter-limit"})]})]})})]}),M?e.jsx(l,{children:e.jsx(d,{className:"py-8 text-center text-muted-foreground","data-testid":"state-loading",children:"Loading telemetryâ¦"})}):P?e.jsx(l,{children:e.jsxs(d,{className:"py-8 text-center","data-testid":"state-error",children:[e.jsx("p",{className:"text-rose-700 dark:text-rose-300 font-medium",children:"Failed to load telemetry."}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:R?.message||"Unknown error"})]})}):!s||s.totalManifests===0?e.jsx(l,{children:e.jsx(d,{className:"py-8 text-center text-muted-foreground","data-testid":"state-empty",children:"No import manifests match the current filters."})}):e.jsxs(e.Fragment,{children:[e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Summary"})}),e.jsx(d,{children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{"data-testid":"stat-total-manifests",children:[e.jsx("div",{className:"text-muted-foreground",children:"Total manifests"}),e.jsx("div",{className:"text-2xl font-semibold",children:s.totalManifests})]}),e.jsxs("div",{"data-testid":"stat-graded-manifests",children:[e.jsx("div",{className:"text-muted-foreground",children:"Graded"}),e.jsx("div",{className:"text-2xl font-semibold",children:s.gradedManifests})]}),e.jsxs("div",{"data-testid":"stat-window-start",children:[e.jsx("div",{className:"text-muted-foreground",children:"Window start"}),e.jsx("div",{className:"text-base",children:p(s.window.start)})]}),e.jsxs("div",{"data-testid":"stat-window-end",children:[e.jsx("div",{className:"text-muted-foreground",children:"Window end"}),e.jsx("div",{className:"text-base",children:p(s.window.end)})]})]})})]}),s.importHealth&&e.jsxs(l,{"data-testid":"card-import-health",children:[e.jsxs(n,{children:[e.jsx(c,{className:"text-base",children:"Import health (account-wide)"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Pass / fail / rolled-back / zombie / processing across all clients in this window, derived from the same per-client Import Intelligence classifier. Observation-only â these numbers do not change any import or dispute behavior. "Passed" means the import reached a completed status; per-row completeness is shown in the grade distribution below.'})]}),e.jsxs(d,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-3 md:grid-cols-6 gap-3 text-sm",children:[e.jsxs("div",{"data-testid":"health-total",children:[e.jsx("div",{className:"text-muted-foreground",children:"Total"}),e.jsx("div",{className:"text-xl font-semibold",children:s.importHealth.overall.total})]}),e.jsxs("div",{"data-testid":"health-passed",children:[e.jsx("div",{className:"text-muted-foreground",children:"Passed"}),e.jsx("div",{className:"text-xl font-semibold text-emerald-700 dark:text-emerald-300",children:s.importHealth.overall.passed})]}),e.jsxs("div",{"data-testid":"health-failed",children:[e.jsx("div",{className:"text-muted-foreground",children:"Failed"}),e.jsx("div",{className:"text-xl font-semibold text-rose-700 dark:text-rose-300",children:s.importHealth.overall.failed})]}),e.jsxs("div",{"data-testid":"health-rolledback",children:[e.jsx("div",{className:"text-muted-foreground",children:"Rolled back"}),e.jsx("div",{className:"text-xl font-semibold",children:s.importHealth.overall.rolledBack})]}),e.jsxs("div",{"data-testid":"health-zombie",children:[e.jsx("div",{className:"text-muted-foreground",children:"Zombie"}),e.jsx("div",{className:"text-xl font-semibold",children:s.importHealth.overall.zombie})]}),e.jsxs("div",{"data-testid":"health-processing",children:[e.jsx("div",{className:"text-muted-foreground",children:"Processing"}),e.jsx("div",{className:"text-xl font-semibold",children:s.importHealth.overall.processing})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-health-by-bureau",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Bureau"}),e.jsx("th",{className:"py-2 pr-4",children:"Total"}),e.jsx("th",{className:"py-2 pr-4",children:"Passed"}),e.jsx("th",{className:"py-2 pr-4",children:"Failed"}),e.jsx("th",{className:"py-2 pr-4",children:"Rolled back"}),e.jsx("th",{className:"py-2 pr-4",children:"Zombie"}),e.jsx("th",{className:"py-2 pr-4",children:"Processing"})]})}),e.jsx("tbody",{children:s.importHealth.byBureau.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-health-bureau-${t.bureau}`,children:[e.jsx("td",{className:"py-2 pr-4",children:m(t.bureau)}),e.jsx("td",{className:"py-2 pr-4",children:t.total}),e.jsx("td",{className:"py-2 pr-4",children:t.passed}),e.jsx("td",{className:"py-2 pr-4",children:t.failed}),e.jsx("td",{className:"py-2 pr-4",children:t.rolledBack}),e.jsx("td",{className:"py-2 pr-4",children:t.zombie}),e.jsx("td",{className:"py-2 pr-4",children:t.processing})]},t.bureau))})]})})]})]}),s.importHealth&&(s.importHealth.failureTaxonomy.length>0||s.importHealth.weakestAreas.length>0)&&e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[e.jsxs(l,{"data-testid":"card-failure-taxonomy",children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Failures by type"})}),e.jsx(d,{children:s.importHealth.failureTaxonomy.length===0?e.jsx("div",{className:"text-sm text-muted-foreground","data-testid":"failure-taxonomy-empty",children:"No failed or zombie imports in this window."}):e.jsxs("table",{className:"w-full text-sm","data-testid":"table-failure-taxonomy",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Failure type"}),e.jsx("th",{className:"py-2 pr-4",children:"Count"}),e.jsx("th",{className:"py-2 pr-4",children:"By bureau"})]})}),e.jsx("tbody",{children:s.importHealth.failureTaxonomy.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-failure-type-${t.failureType}`,children:[e.jsx("td",{className:"py-2 pr-4",children:I(t.failureType)}),e.jsx("td",{className:"py-2 pr-4",children:t.count}),e.jsx("td",{className:"py-2 pr-4 text-xs text-muted-foreground",children:Object.entries(t.bureaus).map(([a,o])=>`${m(a)}: ${o}`).join(" · ")})]},t.failureType))})]})})]}),e.jsxs(l,{"data-testid":"card-weakest-areas",children:[e.jsxs(n,{children:[e.jsx(c,{className:"text-base",children:"Weakest areas (bureau à failure type)"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Ranked by failure count, then by share of that bureau's imports."})]}),e.jsx(d,{children:s.importHealth.weakestAreas.length===0?e.jsx("div",{className:"text-sm text-muted-foreground","data-testid":"weakest-areas-empty",children:"No failed or zombie imports in this window."}):e.jsxs("table",{className:"w-full text-sm","data-testid":"table-weakest-areas",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Bureau"}),e.jsx("th",{className:"py-2 pr-4",children:"Failure type"}),e.jsx("th",{className:"py-2 pr-4",children:"Count"}),e.jsx("th",{className:"py-2 pr-4",children:"Share of bureau"})]})}),e.jsx("tbody",{children:s.importHealth.weakestAreas.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-weakest-${t.bureau}-${t.failureType}`,children:[e.jsx("td",{className:"py-2 pr-4",children:m(t.bureau)}),e.jsx("td",{className:"py-2 pr-4",children:I(t.failureType)}),e.jsx("td",{className:"py-2 pr-4",children:t.count}),e.jsxs("td",{className:"py-2 pr-4",children:[t.failRatePct.toFixed(1),"%",e.jsxs("span",{className:"text-xs text-muted-foreground",children:[" ","(",t.count,"/",t.bureauTotal,")"]})]})]},`${t.bureau}-${t.failureType}`))})]})})]})]}),s.importHealth&&e.jsxs(l,{"data-testid":"card-recent-failures",children:[e.jsxs(n,{children:[e.jsx(c,{className:"text-base",children:"Recent failures"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Newest failed and zombie imports. Open a row to review that client's Import Intelligence Center."})]}),e.jsx(d,{children:s.importHealth.recentFailures.length===0?e.jsx("div",{className:"text-sm text-muted-foreground","data-testid":"recent-failures-empty",children:"No failed or zombie imports in this window."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-recent-failures",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"When"}),e.jsx("th",{className:"py-2 pr-4",children:"Bureau"}),e.jsx("th",{className:"py-2 pr-4",children:"Status"}),e.jsx("th",{className:"py-2 pr-4",children:"Type"}),e.jsx("th",{className:"py-2 pr-4",children:"File"}),e.jsx("th",{className:"py-2 pr-4"})]})}),e.jsx("tbody",{children:s.importHealth.recentFailures.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-recent-failure-${t.manifestId}`,children:[e.jsx("td",{className:"py-2 pr-4 whitespace-nowrap",children:p(t.createdAt)}),e.jsx("td",{className:"py-2 pr-4",children:m(t.bureau)}),e.jsx("td",{className:"py-2 pr-4",children:t.statusLabel}),e.jsx("td",{className:"py-2 pr-4",children:t.failureType?I(t.failureType):"â"}),e.jsx("td",{className:"py-2 pr-4 max-w-[16rem] truncate",title:t.fileName||"",children:t.fileName||"â"}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx(k,{size:"sm",variant:"outline",onClick:()=>T(t.enrollmentId),"data-testid":`button-open-client-${t.manifestId}`,children:"Open in CRM"})})]},t.manifestId))})]})})})]}),s.importHealth?.needsAttention&&e.jsxs(l,{"data-testid":"card-needs-attention",children:[e.jsxs(n,{children:[e.jsxs(c,{className:"text-base",children:["Completed but needs review (",s.importHealth.needsAttention.total,")"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Imports that finished without error but the validator flags for a human: thin pay history, or an unverifiable / failed mirror grade. Same verdict each client sees in their Import Intelligence Center."})]}),e.jsx(d,{children:s.importHealth.needsAttention.total===0?e.jsx("div",{className:"text-sm text-muted-foreground","data-testid":"needs-attention-empty",children:"No completed imports need review in this window."}):e.jsxs(e.Fragment,{children:[s.importHealth.needsAttention.byReason.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 mb-3","data-testid":"needs-attention-reasons",children:s.importHealth.needsAttention.byReason.map(t=>e.jsxs("span",{className:"text-xs rounded-full border px-2 py-0.5 bg-amber-50 text-amber-800 border-amber-200","data-testid":`needs-attention-reason-${t.decisionId}`,children:[t.statusLabel,": ",t.count]},t.decisionId))}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-needs-attention",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"When"}),e.jsx("th",{className:"py-2 pr-4",children:"Bureau"}),e.jsx("th",{className:"py-2 pr-4",children:"Reason"}),e.jsx("th",{className:"py-2 pr-4",children:"Pay history"}),e.jsx("th",{className:"py-2 pr-4",children:"Grade"}),e.jsx("th",{className:"py-2 pr-4",children:"File"}),e.jsx("th",{className:"py-2 pr-4"})]})}),e.jsx("tbody",{children:s.importHealth.needsAttention.recent.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-needs-attention-${t.manifestId}`,children:[e.jsx("td",{className:"py-2 pr-4 whitespace-nowrap",children:p(t.createdAt)}),e.jsx("td",{className:"py-2 pr-4",children:m(t.bureau)}),e.jsx("td",{className:"py-2 pr-4",children:t.statusLabel}),e.jsx("td",{className:"py-2 pr-4",children:t.payHistoryPct!=null?`${t.payHistoryPct}%`:"â"}),e.jsx("td",{className:"py-2 pr-4",children:t.grade||"â"}),e.jsx("td",{className:"py-2 pr-4 max-w-[16rem] truncate",title:t.fileName||"",children:t.fileName||"â"}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx(k,{size:"sm",variant:"outline",onClick:()=>T(t.enrollmentId),"data-testid":`button-open-attention-${t.manifestId}`,children:"Open in CRM"})})]},t.manifestId))})]})})]})})]}),s.importHealth?.forensics&&e.jsxs(l,{"data-testid":"card-forensic-insights",children:[e.jsxs(n,{children:[e.jsx(c,{className:"text-base",children:"Forensic insights (coverage-gated)"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s.importHealth.forensics.note})]}),e.jsxs(d,{children:[e.jsx("div",{className:"flex flex-wrap gap-6 mb-4 text-sm",children:e.jsxs("div",{"data-testid":"forensic-coverage",children:[e.jsx("div",{className:"text-muted-foreground",children:"Forensic coverage"}),e.jsxs("div",{className:"text-xl font-semibold",children:[s.importHealth.forensics.withBundle," / ",s.importHealth.forensics.totalConsidered,s.importHealth.forensics.coveragePct!=null&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:[" ","(",s.importHealth.forensics.coveragePct,"%)"]})]})]})}),s.importHealth.forensics.withBundle===0?e.jsx("div",{className:"text-sm text-muted-foreground","data-testid":"forensic-no-bundles",children:"No evidence bundles available for the imports in scope yet â forensic breakdown will populate as newer imports accrue bundles."}):e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Pattern frequency"}),s.importHealth.forensics.patterns.length===0?e.jsx("div",{className:"text-sm text-muted-foreground","data-testid":"forensic-patterns-empty",children:"No phantom-echo or merge double-extraction signal in the loaded bundles."}):e.jsxs("table",{className:"w-full text-sm","data-testid":"table-forensic-patterns",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Pattern"}),e.jsx("th",{className:"py-2 pr-4",children:"Count"}),e.jsx("th",{className:"py-2 pr-4",children:"% of loaded"})]})}),e.jsx("tbody",{children:s.importHealth.forensics.patterns.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-forensic-pattern-${t.pattern}`,children:[e.jsx("td",{className:"py-2 pr-4",children:Y(t.pattern)}),e.jsx("td",{className:"py-2 pr-4",children:t.count}),e.jsx("td",{className:"py-2 pr-4",children:t.pct==null?e.jsx("span",{className:"text-muted-foreground",title:"Sample below threshold â percentage suppressed",children:"suppressed"}):`${t.pct}%`})]},t.pattern))})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium mb-2",children:"Most affected creditors"}),s.importHealth.forensics.affectedCreditors.length===0?e.jsx("div",{className:"text-sm text-muted-foreground","data-testid":"forensic-creditors-empty",children:"No creditor-level forensic signal in the loaded bundles."}):e.jsxs("table",{className:"w-full text-sm","data-testid":"table-forensic-creditors",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Creditor"}),e.jsx("th",{className:"py-2 pr-4",children:"Occurrences"})]})}),e.jsx("tbody",{children:s.importHealth.forensics.affectedCreditors.slice(0,10).map(t=>e.jsxs("tr",{className:"border-b",children:[e.jsx("td",{className:"py-2 pr-4 max-w-[16rem] truncate",title:t.creditor,children:t.creditor}),e.jsx("td",{className:"py-2 pr-4",children:t.count})]},t.creditor))})]})]})]})]})]}),s.importHealth?.libraryNudge&&e.jsxs(l,{"data-testid":"card-library-nudge",children:[e.jsxs(n,{children:[e.jsx(c,{className:"text-base",children:"Patterns not yet catalogued"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Observed failure signatures matched against the Import Intelligence Library by signature, not free text. Uncatalogued signals should be documented (add an IIL-NNN entry + lock test)."})]}),e.jsx(d,{children:s.importHealth.libraryNudge.allCatalogued?e.jsx("div",{className:"text-sm text-muted-foreground","data-testid":"library-nudge-all-catalogued",children:"All observed failure signatures are catalogued in
1 the Import Intelligence Library."}):e.jsxs("table",{className:"w-full text-sm","data-testid":"table-library-nudge",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Signature"}),e.jsx("th",{className:"py-2 pr-4",children:"Occurrences"})]})}),e.jsx("tbody",{children:s.importHealth.libraryNudge.uncatalogued.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-uncatalogued-${t.detector}`,children:[e.jsx("td",{className:"py-2 pr-4",children:t.detector}),e.jsx("td",{className:"py-2 pr-4",children:t.count})]},t.detector))})]})})]}),e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Bureau à Grade distribution"})}),e.jsx(d,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-bureau-grade",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Bureau"}),e.jsx("th",{className:"py-2 pr-4",children:"Total"}),S.map(t=>e.jsx("th",{className:"py-2 pr-4",children:t.toUpperCase()},t))]})}),e.jsx("tbody",{children:s.bureauGradeDistribution.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-bureau-${t.bureau}`,children:[e.jsx("td",{className:"py-2 pr-4",children:m(t.bureau)}),e.jsx("td",{className:"py-2 pr-4",children:t.total}),S.map(a=>e.jsxs("td",{className:"py-2 pr-4",children:[e.jsx("div",{children:t.counts[a]??0}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[(t.percentages[a]??0).toFixed(1),"%"]})]},a))]},t.bureau))})]})})})]}),e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Divergence totals by section"})}),e.jsx(d,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-divergence-totals",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Section"}),e.jsx("th",{className:"py-2 pr-4",children:"Declared (sum)"}),e.jsx("th",{className:"py-2 pr-4",children:"Imported (sum)"}),e.jsx("th",{className:"py-2 pr-4",children:"Î (declared â imported)"}),e.jsx("th",{className:"py-2 pr-4",children:"Manifests w/ divergence"})]})}),e.jsx("tbody",{children:s.divergenceTotalsBySection.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-divergence-section-${t.section}`,children:[e.jsx("td",{className:"py-2 pr-4",children:t.section}),e.jsx("td",{className:"py-2 pr-4",children:t.declaredSum}),e.jsx("td",{className:"py-2 pr-4",children:t.importedSum}),e.jsx("td",{className:"py-2 pr-4",children:t.deltaSum}),e.jsx("td",{className:"py-2 pr-4",children:t.manifestsWithDivergence})]},t.section))})]})})})]}),e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Unknown sections by bureau"})}),e.jsx(d,{children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-unknown-sections",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Bureau"}),e.jsx("th",{className:"py-2 pr-4",children:"Manifests w/ unknowns"}),e.jsx("th",{className:"py-2 pr-4",children:"% of manifests"}),e.jsx("th",{className:"py-2 pr-4",children:"Section frequency"})]})}),e.jsx("tbody",{children:s.unknownSectionsByBureau.map(t=>e.jsxs("tr",{className:"border-b align-top","data-testid":`row-unknown-bureau-${t.bureau}`,children:[e.jsx("td",{className:"py-2 pr-4",children:m(t.bureau)}),e.jsxs("td",{className:"py-2 pr-4",children:[t.manifestsWithUnknownSections," / ",t.totalManifests]}),e.jsxs("td",{className:"py-2 pr-4",children:[(t.pct??0).toFixed(1),"%"]}),e.jsx("td",{className:"py-2 pr-4",children:Object.entries(t.sectionFrequency||{}).length===0?e.jsx("span",{className:"text-muted-foreground",children:"â"}):e.jsx("div",{className:"flex flex-wrap gap-1",children:Object.entries(t.sectionFrequency).map(([a,o])=>e.jsxs(x,{variant:"secondary",children:[a,": ",o]},a))})})]},t.bureau))})]})})})]}),e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Top divergence tokens"})}),e.jsx(d,{children:s.topDivergenceTokens.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No non-match divergences recorded in window."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-top-tokens",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Token (base shape)"}),e.jsx("th",{className:"py-2 pr-4",children:"Count"}),e.jsx("th",{className:"py-2 pr-4",children:"By bureau"})]})}),e.jsx("tbody",{children:s.topDivergenceTokens.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-token-${t.tokenBase}`,children:[e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:t.tokenBase}),e.jsx("td",{className:"py-2 pr-4",children:t.count}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:Object.entries(t.bureaus).map(([a,o])=>e.jsxs(x,{variant:"outline",children:[m(a),": ",o]},a))})})]},t.tokenBase))})]})})})]}),e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Recent low-grade manifests (D / F)"})}),e.jsx(d,{children:s.recentLowGrades.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No D/F manifests in window."}):e.jsx("div",{className:"space-y-3",children:s.recentLowGrades.map(t=>e.jsxs("div",{className:"border rounded p-3 text-sm","data-testid":`row-low-grade-${t.manifestId}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[W(t.grade),e.jsx("span",{className:"font-medium",children:m(t.bureau)}),e.jsxs("span",{className:"text-muted-foreground",children:["manifest #",t.manifestId]}),e.jsxs("span",{className:"text-muted-foreground",children:["enrollment ",t.enrollmentId]}),e.jsx("span",{className:"text-muted-foreground ml-auto",children:p(t.createdAt)})]}),t.fileName?e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["file: ",t.fileName]}):null,t.divergences.length>0?e.jsx("div",{className:"mt-2 overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-muted-foreground",children:[e.jsx("th",{className:"py-1 pr-3",children:"Section"}),e.jsx("th",{className:"py-1 pr-3",children:"Declared"}),e.jsx("th",{className:"py-1 pr-3",children:"Imported"}),e.jsx("th",{className:"py-1 pr-3",children:"Î"}),e.jsx("th",{className:"py-1 pr-3",children:"Severity"})]})}),e.jsx("tbody",{children:t.divergences.map((a,o)=>e.jsxs("tr",{className:"border-t",children:[e.jsx("td",{className:"py-1 pr-3",children:a.section}),e.jsx("td",{className:"py-1 pr-3",children:a.declared??"â"}),e.jsx("td",{className:"py-1 pr-3",children:a.imported??"â"}),e.jsx("td",{className:"py-1 pr-3",children:a.delta??"â"}),e.jsx("td",{className:"py-1 pr-3",children:a.severity})]},`${t.manifestId}-${o}`))})]})}):null,t.unknownSections.length>0?e.jsxs("div",{className:"mt-2 flex flex-wrap gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"unknown sections:"}),t.unknownSections.map(a=>e.jsx(x,{variant:"secondary",className:"text-xs",children:a},a))]}):null]},t.manifestId))})})]}),e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Field-capture status"})}),e.jsxs(d,{children:[e.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["These fields are not yet persisted on ",e.jsx("code",{children:"import_manifests"}),". The page surfaces the gap so a future task can add capture â values are never inferred or fabricated."]}
1),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-3 text-sm","data-testid":"field-capture-status",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground",children:"sourceText"}),f(s.fieldCaptureStatus.sourceText)]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground",children:"parserVersion"}),f(s.fieldCaptureStatus.parserVersion)]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground",children:"ocrFallbackFlag"}),f(s.fieldCaptureStatus.ocrFallbackFlag)]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground",children:"pdfType"}),f(s.fieldCaptureStatus.pdfType)]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-muted-foreground",children:"importDurationMs"}),f(s.fieldCaptureStatus.importDurationMs)]})]})]})]}),e.jsxs(l,{children:[e.jsx(n,{children:e.jsx(c,{className:"text-base",children:"Template fingerprint buckets (heuristic / non-authoritative)"})}),e.jsxs(d,{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-3","data-testid":"text-fingerprint-note",children:s.fingerprintNote}),s.fingerprintBuckets.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No fingerprint buckets available â sourceText is not persisted on manifests today, so this is a clustering hint only (will populate if a future task adds capture). Fingerprints are never used for grading or enforcement."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm","data-testid":"table-fingerprint-buckets",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b text-left",children:[e.jsx("th",{className:"py-2 pr-4",children:"Fingerprint"}),e.jsx("th",{className:"py-2 pr-4",children:"Count"}),e.jsx("th",{className:"py-2 pr-4",children:"By bureau"}),e.jsx("th",{className:"py-2 pr-4",children:"By grade"})]})}),e.jsx("tbody",{children:s.fingerprintBuckets.map(t=>e.jsxs("tr",{className:"border-b","data-testid":`row-fingerprint-${t.fingerprint}`,children:[e.jsx("td",{className:"py-2 pr-4 font-mono text-xs",children:t.fingerprint}),e.jsx("td",{className:"py-2 pr-4",children:t.count}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:Object.entries(t.bureaus).map(([a,o])=>e.jsxs(x,{variant:"outline",children:[m(a),": ",o]},a))})}),e.jsx("td",{className:"py-2 pr-4",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:S.map(a=>t.grades[a]?e.jsxs(x,{variant:"secondary",children:[a.toUpperCase(),": ",t.grades[a]]},a):null)})})]},t.fingerprint))})]})})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground text-center","data-testid":"text-generated-at",children:["Generated at ",p(s.generatedAt)]})]})]})}export{ae 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.