PageSourceSearch

https://www.valueinvestinghub.com/assets/TenKAnalysisAdmin-D-RG2MbY.js

js valueinvestinghub.com collected 2026-10-09 22:57:53 UTC 27,187 bytes, 1 lines download raw bytes

1import{u as te,b as ae,a as D,j as e}from"./react-query-DtH7GInu.js";import{r as w}from"./charts-DXTQz_Nw.js";import{n as S,v as oe,C as b,l as v,m as N,N as A,b as y,as as F,o as $,bJ as Z,a2 as xe,a3 as me,a4 as ue,a5 as he,a6 as V,ar as fe,B as P,bz as je,bA as pe,bB as G,bC as L,bD as ge,bE as R,H as be}from"./index-Bk2jHtle.js";import{T as ve,a as E}from"./tabs-Ce-pKgjy.js";import{S as Ne}from"./StyledTabsList-XiII8IH3.js";import{S as B}from"./StyledTabTrigger-CdlTltxQ.js";import{C as X}from"./CacheStatusBadge-WiFsDs-0.js";import{T as ye}from"./textarea-ouqu71nA.js";import{bY as we,aw as ke,b7 as Y,bn as J,p as re,X as le,bp as ne,L as _e,cH as Ce,x as Ae,z as Se,a3 as Te,a2 as Fe,aq as Le,bZ as Re,aI as Ee,aZ as Be,a4 as qe}from"./ui-components-BYDPAGXP.js";import{P as Ke}from"./progress-wV8gSBlx.js";import{L as De}from"./vendors-C_aCOv2N.js";import{f as Ie}from"./formatDistanceToNow-CSyOfTXg.js";import"./constructNow-BA0H02cX.js";import"./differenceInCalendarMonths-DsgLznm3.js";import"./differenceInMilliseconds-XhW3QbYV.js";function Oe(){const t=te();return ae({mutationFn:async l=>{const{data:r,error:a}=await S.functions.invoke("submit-10k-batch",{body:l});if(a)throw new Error(a.message||"Batch submission failed");if(!r)throw new Error("No response from submit-10k-batch");return r},onSuccess:()=>{t.invalidateQueries({queryKey:["tenk-batches"]})}})}function W(t,l){return`${t}-${l}`}function $e(t,l){return D({queryKey:["bulk-10k-availability",t.slice().sort().join(","),l.slice().sort().join(",")],enabled:t.length>0&&l.length>0,staleTime:6e4,queryFn:async()=>{const{data:r,error:a}=await S.from("stock_10k_filings").select("symbol, fiscal_year, filing_date, is_available").in("symbol",t).in("fiscal_year",l);if(a)throw a;const n={};for(const i of t)for(const p of l)n[W(i,p)]={symbol:i,fiscal_year:p,status:"unknown"};for(const i of r??[]){const p=W(i.symbol,i.fiscal_year);n[p]&&(n[p]={symbol:i.symbol,fiscal_year:i.fiscal_year,status:i.is_available?"available":"unavailable",filing_date:i.filing_date??void 0})}return n}})}function Pe(){const t=te();return ae({mutationFn:async({symbol:l,fiscal_year:r})=>{const{data:a,error:n}=await S.functions.invoke("check-10k-availability",{body:{symbol:l,fiscalYear:r}});if(n)throw new Error(n.message);if(!a?.success||!a.data)throw new Error(a?.error||"Availability check failed");return a.data},onSettled:()=>{t.invalidateQueries({queryKey:["bulk-10k-availability"]})}})}const ee=[{id:"claude-opus-4-7",label:"Opus 4.7 — best quality",batchInput:7.5,batchOutput:37.5},{id:"claude-sonnet-4-6",label:"Sonnet 4.6 — production default",batchInput:1.5,batchOutput:7.5},{id:"claude-haiku-4-5",label:"Haiku 4.5 — cheapest",batchInput:.5,batchOutput:2.5}],U=new Date().getUTCFullYear(),Me=Array.from({length:6},(t,l)=>U-l),se=50;function He({status:t}){return t==="available"?e.jsx(re,{className:"w-4 h-4 text-emerald-600 mx-auto","aria-label":"Available"}):t==="unavailable"?e.jsx(le,{className:"w-4 h-4 text-destructive mx-auto","aria-label":"Not filed"}):e.jsx(ne,{className:"w-4 h-4 text-muted-foreground mx-auto","aria-label":"Unknown"})}function Ue(t){const l=new Set,r=[];for(const a of t.split(/[,\s]+/)){const n=a.trim().toUpperCase();n&&/^[A-Z]{1,5}(\.[A-Z]{1,3})?$/.test(n)&&(l.has(n)||(l.add(n),r.push(n)))}return r}function Ye(){const{toast:t}=oe(),l=Oe(),r=Pe(),[a,n]=w.useState(""),[i,p]=w.useState([U-1]),[c,f]=w.useState("claude-opus-4-7"),[o,k]=w.useState(""),[j,q]=w.useState(!1),x=w.useMemo(()=>Ue(a),[a]),d=$e(x,i),m=d.data??{},u=i.filter(s=>s>=U),_=Object.values(m).filter(s=>s.status==="unknown").length,T=Object.values(m).filter(s=>s.status==="unavailable").length,ie=Object.values(m).filter(s=>s.status==="available").length;async function ce(){const s=Object.values(m).filter(h=>h.status==="unknown");if(s.length===0)return;const g=8;for(let h=0;h<s.length;h+=g){const K=s.slice(h,h+g);await Promise.allSettled(K.map(O=>r.mutateAsync({symbol:O.symbol,fiscal_year:O.fiscal_year})))}d.refetch()}const I=w.useMemo(()=>a.split(/[,\s]+/).map(s=>s.trim()).filter(s=>s.length>0&&!/^[A-Z]{1,5}(\.[A-Z]{1,3}
1)?$/i.test(s)),[a]),M=c==="custom"?o.trim():c,C=w.useMemo(()=>{const s=[];for(const g of x)for(const h of i)s.push({symbol:g,fiscal_year:h,force_rerun:j});return s},[x,i,j]),Q=C.length>se,z=C.length>0&&!Q&&!!M&&!l.isPending,H=ee.find(s=>s.id===M);async function de(){if(z)try{const s=await l.mutateAsync({items:C,model:M});t({title:"Batch submitted",description:`${s.submitted} queued, ${s.skipped} skipped. Anthropic batch: ${s.anthropic_batch_id??"—"}. Results usually within 1-2 hours.`}),n("")}catch(s){const g=s instanceof Error?s.message:"Unknown error";t({title:"Batch submission failed",description:g,variant:"destructive"})}}return e.jsxs(b,{children:[e.jsxs(v,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(we,{className:"w-5 h-5"}),"Queue Batch Analyses"]}),e.jsx(A,{children:"Submit many ticker × year 10-K analyses in one Anthropic Message Batch (50% cheaper than real-time). Results usually land within 1–2 hours; SLA is 24h. Batched analyses include qualitative analysis + scoring; DCF valuation and financial history charts are omitted and can be added later via the single-ticker refresh."})]}),e.jsxs(y,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:"tickers",children:"Tickers"}),e.jsx(ye,{id:"tickers",placeholder:"AAPL, MSFT, GOOG  (comma, space, or newline separated)",value:a,onChange:s=>n(s.target.value),rows:4,className:"font-mono"}),e.jsxs("div",{className:"flex flex-wrap gap-2 items-center text-sm text-muted-foreground",children:[e.jsxs("span",{children:[x.length," parsed"]}),I.length>0&&e.jsxs("span",{className:"text-amber-600",children:["(",I.length," unrecognized: ",I.slice(0,3).join(", "),I.length>3?"…":"",")"]})]}),x.length>0&&e.jsxs("div",{className:"flex flex-wrap gap-1 pt-1",children:[x.slice(0,40).map(s=>e.jsx($,{variant:"secondary",className:"font-mono text-xs",children:s},s)),x.length>40&&e.jsxs($,{variant:"outline",className:"text-xs",children:["+",x.length-40," more"]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{children:"Fiscal years"}),e.jsx("div",{className:"flex flex-wrap gap-4",children:Me.map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{id:`year-${s}`,checked:i.includes(s),onCheckedChange:g=>{p(h=>g?[...h,s].sort((K,O)=>O-K):h.filter(K=>K!==s))}}),e.jsx(F,{htmlFor:`year-${s}`,className:"cursor-pointer",children:s})]},s))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{htmlFor:"model",children:"Model"}),e.jsxs(xe,{value:c,onValueChange:f,children:[e.jsx(me,{id:"model",children:e.jsx(ue,{})}),e.jsxs(he,{children:[ee.map(s=>e.jsx(V,{value:s.id,children:s.label},s.id)),e.jsx(V,{value:"custom",children:"Other (enter model ID)"})]})]}),c==="custom"&&e.jsx(fe,{placeholder:"e.g. claude-opus-4-7",value:o,onChange:s=>k(s.target.value),className:"font-mono"}),H&&e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(ke,{className:"w-3 h-3"}),"Batch price: $",H.batchInput.toFixed(2),"/MTok input, $",H.batchOutput.toFixed(2),"/MTok output (50% off list)."]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Z,{id:"force-rerun",checked:j,onCheckedChange:s=>q(!!s)}),e.jsxs(F,{htmlFor:"force-rerun",className:"cursor-pointer flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4"}),"Force re-run (supersede existing analyses)"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground -mt-4",children:"By default, ticker/years that already have a completed analysis are skipped to save cost. Toggle to re-analyze and mark the old one superseded."}),u.length>0&&e.jsxs("div",{className:"flex items-start gap-2 border-l-2 border-amber-500 bg-amber-500/10 pl-4 py-3 rounded-r-md text-sm",children:[e.jsx(J,{className:"w-4 h-4 mt-0.5 text-amber-600 shrink-0"}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-amber-800",children:["Future fiscal year selected: FY ",u.join(", ")]}),e.jsx("div",{className:"text-amber-700 text-xs mt-1",children:'10-Ks for the current fiscal year typically file in Q1 of the following year — items are likely to fail with "No 10-K foun
1d" until then. Use the availability check below to confirm before submitting.'})]})]}),x.length>0&&i.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(F,{children:"Availability preview"}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(re,{className:"w-3 h-3 text-emerald-600"})," ",ie]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(le,{className:"w-3 h-3 text-destructive"})," ",T]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ne,{className:"w-3 h-3 text-muted-foreground"})," ",_]}),_>0&&e.jsxs(P,{size:"sm",variant:"outline",onClick:ce,disabled:r.isPending,className:"ml-2 h-7 text-xs",children:[r.isPending?e.jsx(_e,{className:"w-3 h-3 mr-1 animate-spin"}):null,"Check ",_," unknown",_===1?"":"s"]})]})]}),e.jsx("div",{className:"overflow-x-auto border rounded-md",children:e.jsxs("table",{className:"text-xs w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-muted/50",children:[e.jsx("th",{className:"text-left px-3 py-2 font-medium",children:"Ticker"}),i.map(s=>e.jsxs("th",{className:"px-3 py-2 font-medium text-center",children:["FY ",s]},s))]})}),e.jsx("tbody",{children:x.map(s=>e.jsxs("tr",{className:"border-t",children:[e.jsx("td",{className:"px-3 py-1.5 font-mono",children:s}),i.map(g=>{const h=m[`${s}-${g}`];return e.jsx("td",{className:"px-3 py-1.5 text-center",children:e.jsx(He,{status:h?.status??"unknown"})},g)})]},s))})]})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"✓ known filed, ✗ known not filed, ? not checked yet. Unknowns will still be attempted at submit; failures are recorded per item."})]}),e.jsxs("div",{className:"border-l-2 border-primary/30 pl-4 py-2 space-y-1 bg-muted/30 rounded-r-md",children:[e.jsxs("div",{className:"text-sm",children:[e.jsx("span",{className:"font-semibold",children:C.length})," item",C.length===1?"":"s"," will be queued",C.length>0&&e.jsxs(e.Fragment,{children:[" (",x.length," ticker",x.length===1?"":"s"," × ",i.length," year",i.length===1?"":"s",")"]}),T>0&&e.jsxs("span",{className:"text-destructive",children:[" — ",T," known unavailable and will error at submit"]})]}),Q&&e.jsxs("div",{className:"flex items-center gap-1 text-sm text-destructive",children:[e.jsx(J,{className:"w-4 h-4"}),"Over the ",se,"-item per-batch cap. Reduce tickers or years, or split into multiple submissions."]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(P,{onClick:de,disabled:!z,children:l.isPending?"Submitting…":`Submit batch (${C.length})`}),l.error&&e.jsx("span",{className:"text-sm text-destructive",children:l.error instanceof Error?l.error.message:String(l.error)})]})]})]})}function Qe(t=25){return D({queryKey:["tenk-batches",t],queryFn:async()=>{const{data:l,error:r}=await S.from("stock_10k_batches").select("*").order("submitted_at",{ascending:!1}).limit(t);if(r)throw r;return l??[]},refetchInterval:3e4,staleTime:15e3})}function ze(t){return D({queryKey:["tenk-batch-items",t],queryFn:async()=>{if(!t)return[];const{data:l,error:r}=await S.from("stock_10k_batch_items").select("*").eq("batch_id",t).order("symbol",{ascending:!0}).order("fiscal_year",{ascending:!1});if(r)throw r;return l??[]},enabled:!!t,refetchInterval:3e4})}function Ze({status:t}){const r={submitted:{label:"Submitted",variant:"secondary"},in_progress:{label:"In progress",variant:"default"},completed:{label:"Completed",variant:"outline"},failed:{label:"Failed",variant:"destructive"},cancelled:{label:"Cancelled",variant:"outline"}}[t];return e.jsx($,{variant:r.variant,children:r.label})}function Ve({status:t}){const r={queued:{label:"Queued",variant:"secondary"},succeeded:{label:"Succeeded",variant:"default"},errored:{label:"Errored",variant:"destructive"},skipped:{label:"Skipped",variant:"outline"}}[t];return e.jsx($,{variant:r.variant,children:r.label})}function Ge({batchId:t}){const{data:l,isLoading:r}=ze(t);return r?e.jsx("div",{className:"text-sm text-muted-foreground py-2",children:"Loading items…"}):!l||l.length===0?e.jsx("div",{className:"text-sm text-muted-foreground py-2",children:"No items."}):e.jsx("div",{className:"border-t border-l-2 border-l-primary/30 pl-4 mt-2",children:e.jsxs(je,{children:[e.jsx(pe,{children:e.jsxs(G,{children:[e.jsx(L,{className:"w-24",children:"Symbol"}),e.jsx(L,{className:"w-20",children:"FY"}),e.jsx(L,{className:"w-28",children:"Status"}),e.jsx(L,{className:"w-20",children:"In tok"}),e.jsx(L,{className:"w-20",children:"Out tok"}),e.jsx(L,{children:"Notes / link"})]})}),e.jsx(ge,{children:l.map(a=>e.jsxs(G,{children:[e.jsx(R,{className:"font-mono text-xs",children:a.symbol}),e.jsx(R,{children:a.fiscal_year}),e.jsx(R,{children:e.jsx(Ve,{status:a.status})}),e.jsx(R,{className:"text-xs",children:a.input_tokens?.toLocaleStr
1ing()??"—"}),e.jsx(R,{className:"text-xs",children:a.output_tokens?.toLocaleString()??"—"}),e.jsxs(R,{className:"text-xs",children:[a.status==="succeeded"&&a.analysis_id&&e.jsxs(De,{to:`/10k-analysis/${a.symbol}/${a.fiscal_year}`,className:"text-primary hover:underline flex items-center gap-1",children:["View analysis ",e.jsx(Te,{className:"w-3 h-3"})]}),a.status==="skipped"&&a.analysis_id&&e.jsx("span",{className:"text-muted-foreground",children:"Existing analysis kept (no force-rerun)"}),a.status==="errored"&&a.error_message&&e.jsx("span",{className:"text-destructive text-xs",children:a.error_message})]})]},a.id))})]})})}function Xe({batch:t}){const[l,r]=w.useState(!1),a=t.total_items-t.skipped_items,n=t.completed_items+t.failed_items,i=a>0?Math.round(n/a*100):100;return e.jsxs("div",{className:"border rounded-md",children:[e.jsxs("button",{type:"button",onClick:()=>r(p=>!p),className:"w-full flex items-center gap-3 px-4 py-3 hover:bg-muted/50 text-left",children:[l?e.jsx(Ae,{className:"w-4 h-4 shrink-0"}):e.jsx(Se,{className:"w-4 h-4 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(Ze,{status:t.status}),e.jsx("span",{className:"font-mono text-sm",children:t.model}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[t.total_items," items (",t.completed_items," ✓ / ",t.failed_items," ✗ / ",t.skipped_items," skipped)"]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["submitted ",Ie(new Date(t.submitted_at),{addSuffix:!0})]}),t.actual_cost_usd!==null&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",t.actual_cost_usd.toFixed(4)]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[e.jsx(Ke,{value:i,className:"h-1.5 max-w-md"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[i,"%"]})]})]})]}),l&&e.jsx(Ge,{batchId:t.id})]})}function Je(){const{data:t,isLoading:l,refetch:r,isFetching:a}=Qe(50);return e.jsxs(b,{children:[e.jsxs(v,{className:"flex flex-row items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Ce,{className:"w-5 h-5"}),"Batches"]}),e.jsx(A,{children:"All 10-K analysis batches (auto-refreshes every 30s). Click a row to see per-item statuses."})]}),e.jsxs(P,{variant:"outline",size:"sm",onClick:()=>r(),disabled:a,children:[e.jsx(Y,{className:`w-4 h-4 mr-2 ${a?"animate-spin":""}`}),"Refresh"]})]}),e.jsx(y,{children:l?e.jsx("p",{className:"text-muted-foreground",children:"Loading…"}):!t||t.length===0?e.jsxs("p",{className:"text-muted-foreground",children:["No batches submitted yet. Head to ",e.jsx("span",{className:"font-medium",children:"Queue Batch"})," to submit your first."]}):e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsx(Xe,{batch:n},n.id))})})]})}function fs(){return e.jsxs("div",{className:"container mx-auto px-4 py-8 max-w-7xl",children:[e.jsx(be,{children:e.jsx("title",{children:"10-K Analysis Admin Dashboard"})}),e.jsx(We,{})]})}function We(){const[t,l]=w.useState(0),{data:r,isLoading:a}=D({queryKey:["10k-admin-stats",t],queryFn:async()=>{const{data:c,error:f}=await S.from("stock_10k_analyses").select("*",{count:"exact"}).is("superseded_by",null);if(f)throw f;const o=c||[],k=o.length,j=o.reduce((d,m)=>(d[m.investment_verdict]=(d[m.investment_verdict]||0)+1,d),{}),q=o.reduce((d,m)=>d+m.total_score,0)/(k||1),x={excellent:o.filter(d=>d.total_score>=80).length,good:o.filter(d=>d.total_score>=60&&d.total_score<80).length,fair:o.filter(d=>d.total_score>=40&&d.total_score<60).length,poor:o.filter(d=>d.total_score<40).length};return{total:k,verdicts:j,avgScore:q.toFixed(1),scoreRanges:x,recentAnalyses:o.sort((d,m)=>new Date(m.created_at).getTime()-new Date(d.created_at).getTime()).slice(0,10),topAnalyses:o.sort((d,m)=>m.total_score-d.total_score).slice(0,10)}},staleTime:60*1e3}),{data:n,isLoading:i}=D({queryKey:["10k-cache-stats",t],queryFn:async()=>{const{data:c,error:f}=await S.from("stock_10k_analyses").select("*").is("superseded_by",null);if(f)throw f;const o=new Date,k=c||[],j=k.filter(u=>u.cache_expires_at!==null),q=j.filter(u=>new Date(u.cache_expires_at)<o),x=j.filter(u=>{if(!u.cache_expires_at)return!1;const T=(new Date(u.cache_expires_at).getTime()-o.getTime())/(1e3*60*60*24);return T>0&&T<=30}),d=j.map(u=>{const _=new Date(u.created_at);return(o.getTime()-_.getTime())/(1e3*60*60*24)}),m=d.length>0?d.reduce((u,_)=>u+_,0)/d.length:0;return{totalCached:j.length,totalUncached:k.length-j.length,expired:q.length,nearExpiration:x.length,averageAge:m.toFixed(1),hitRate:k.length>0?(j.length/k.length*100).toFixed(1):"0"}},staleTime:60*1e3}),p=()=>{l(c=>c+1)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-8",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold tracking-tight flex items-center gap-3",children:[e.jsx(Fe,{className:"w-6 h-6 text-primary"}),"10-K Analysis Dashboard"]}),e.jsx("p",{className:"text-muted-foreground mt-2 text-sm",children:"System monitoring, batch queue, and per-analysis performance metrics"})]}),e.jsxs(P,{onClick:p,variant:"outline",children:[e.jsx(Y,{className:"w-4 h-4 mr-2"}),"Refresh"]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:[e.jsxs(b,{children:[e.jsx(v,{className:"pb-3",children:e.jsx(N,{className:"text-sm font-medium text-muted-foreground",children:"Total Analyses"})}),e.jsxs(y,{children:[e.jsx("div",{className:"text-3xl font-bold",children:a?"-":r?.total||0}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Current analyses"})]})]}),e.jsxs(b,{children:[e.jsx(v,{className:"pb-3",children:e.jsx(N,{className:"text-sm font-medium text-muted-foreground",children:"Average Score"})}),e.jsxs(y,{children:[e.jsxs("div",{className:"text-3xl font-bold",children:[a?"-":r?.avgScore||"0","/100"]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Across all analyses"})]})]}),e.jsxs(b,{children:[e.jsx(v,{className:"pb-3",children:e.jsx(N,{className:"text-sm font-medium text-muted-foreground",children:"Cache Hit Rate"})}),e.jsxs(y,{children:[e.jsxs("div",{className:"text-3xl font-bold",children:[i?"-":n?.hitRate||"0","%"]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[i?"-":n?.totalCached||0," cached"]})]})]}),e.jsxs(b,{children:[e.jsx(v,{className:"pb-3",children:e.jsx(N,{className:"text-sm font-medium text-muted-foreground",children:"Cache Expired"})}),e.jsxs(y,{children:[e.jsx("div",{className:"text-3xl font-bold text-red-600",children:i?"-":n?.expired||0}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[i?"-":n?.nearExpiration||0," expiring soon"]})]})]})]}),e.jsxs(ve,{defaultValue:"overview",className:"space-y-6",children:[e.jsxs(Ne,{className:"grid w-full grid-cols-6",children:[e.jsx(B,{value:"overview",children:"Overview"}),e.jsx(B,{value:"cache",children:"Cache Stats"}),e.jsx(B,{value:"recent",children:"Recent"}),e.jsx(B,{value:"top",children:"Top Performers"}),e.jsx(B,{value:"queue-batch",children:"Queue Batch"}),e.jsx(B,{value:"batches",children:"Batches"})]}),e.jsxs(E,{value:"overview",className:"space-y-6",children:[e.jsxs(b,{children:[e.jsxs(v,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"w-5 h-5"}),"Investment Verdict Distribution"]}),e.jsx(A,{children:"Breakdown of analyses by recommendation"})]}),e.jsx(y,{children:a?e.jsx("p",{className:"text-muted-foreground",children:"Loading..."}):e.jsx("div",{className:"space-y-3",children:Object.entries(r?.verdicts||{}).map(([c,f])=>e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"capitalize",children:c.replace(/_/g," ").toLowerCase()})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-32 bg-secondary rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full",style:{width:`${f/(r?.total||1)*100}%`}})}),e.jsx("span",{className:"text-sm font-medium w-12 text-right",children:f})]})]},c))})})]}),e.jsxs(b,{children:[e.jsxs(v,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Re,{className:"w-5 h-5"}),"Score Distribution"]}),e.jsx(A,{children:"Analyses grouped by score ranges"})]}),e.jsx(y,{children:a?e.jsx("p",{className:"text-muted-foreground",children:"Loading..."}):e.jsxs("div",{className:"grid grid-cols-4 gap-4",children:[e.jsxs("div",{className:"bg-green-500/10 border border-green-500/20 rounded-lg p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:r?.scoreRanges.excellent||0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Excellent (80+)"})]}),e.jsxs("div",{className:"bg-blue-500/10 border border-blue-500/20 rounded-lg p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:r?.scoreRanges.good||0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Good (60-79)"})]}),e.jsxs("div",{className:"bg-yellow-500/10 border border-yellow-500/20 rounded-lg p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:r?.scoreRanges.fair||0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Fair (40-59)"})]}),e.jsxs("div",{className:"bg-red-500/10 border border-red-500/20 rounded-lg p-4 text-center",children:[e.jsx("div",{className:"text-2xl font-bold text-red-600",children:r?.scoreRanges.poor||0}),e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Poor (<40)"})]})]})})]})]}),e.jsx(E,{value:"cache",className:"space-y-6",children:e.jsxs(b,{children:[e.jsxs(v,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Ee,{className:"w-5 h-5"}),"Cache Performance"]}),e.jsx(A,{children:"Cache efficiency and status"})]}),e.jsx(y,{children:i?e.jsx("p",{className:"text-muted-foreground",children:"Loading..."}):e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Total Cached"}),e.jsx("div",{className:"text-2xl font-bold",children:n?.totalCached||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Uncached"}),e.jsx("div",{className:"text-2xl font-bold",children:n?.totalUncached||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Average Age"}),e.jsxs("div",{className:"text-2xl font-bold",children:[n?.averageAge||0," days"]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Expired"}),e.jsx("div",{className:"text-2xl font-bold text-red-600",children:n?.expired||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Near Expiration"}),e.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:n?.nearExpiration||0})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground mb-1",children:"Hit Rate"}),e.jsxs("div",{className:"text-2xl font-bold text-green-600",children:[n?.hitRate||0,"%"]})]})]})})})]})}),e.jsx(E,{value:"recent",className:"space-y-6",children:e.jsxs(b,{children:[e.jsxs(v,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(Be,{className:"w-5 h-5"}),"Recent Analyses"]}),e.jsx(A,{children:"Last 10 analyses created"})]}),e.jsx(y,{children:a?e.jsx("p",{className:"text-muted-foreground",children:"Loading..."}):e.jsx("div",{className:"space-y-2",children:r?.recentAnalyses.map(c=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg hover:bg-secondary/50 transition-colors",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"font-medium",children:c.symbol}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["FY ",c.fiscal_year]}
1)]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(X,{createdAt:c.created_at,cacheExpiresAt:c.cache_expires_at,variant:"compact"}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"font-bold",children:[c.total_score,"/100"]}),e.jsx("div",{className:"text-xs text-muted-foreground capitalize",children:c.investment_verdict.replace(/_/g," ").toLowerCase()})]})]})]},c.id))})})]})}),e.jsx(E,{value:"top",className:"space-y-6",children:e.jsxs(b,{children:[e.jsxs(v,{children:[e.jsxs(N,{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"w-5 h-5"}),"Top Performing Analyses"]}),e.jsx(A,{children:"Highest scored analyses"})]}),e.jsx(y,{children:a?e.jsx("p",{className:"text-muted-foreground",children:"Loading..."}):e.jsx("div",{className:"space-y-2",children:r?.topAnalyses.map((c,f)=>e.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg hover:bg-secondary/50 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{className:"text-2xl font-bold text-muted-foreground",children:["#",f+1]}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:c.symbol}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:["FY ",c.fiscal_year]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(X,{createdAt:c.created_at,cacheExpiresAt:c.cache_expires_at,variant:"compact"}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:c.total_score}),e.jsx("div",{className:"text-xs text-muted-foreground capitalize",children:c.investment_verdict.replace(/_/g," ").toLowerCase()})]})]})]},c.id))})})]})}),e.jsx(E,{value:"queue-batch",className:"space-y-6",children:e.jsx(Ye,{})}),e.jsx(E,{value:"batches",className:"space-y-6",children:e.jsx(Je,{})})]})]})}export{We as TenKAnalysisAdminContent,fs 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.