1import{j as e,a as h}from"./index-C6tslygu.js";import{h as S,b as l}from"./react-vendor-CJBNYb8e.js";const u={"chatgpt-web":"GPT-5.3","gemini-web":"Gemini 3 Flash","perplexity-web":"Sonar","grok-web":"Grok 3","mistral-web":"Mistral Medium 3","claude-haiku":"Claude Haiku 4.5","claude-sonnet":"Claude Sonnet 4.6","qwen-flash":"Qwen Flash","qwen-max":"Qwen Max","deepseek-chat":"DeepSeek V3","kimi-k2.5":"Kimi K2.5",openai:"ChatGPT (legacy)",gemini:"Gemini (legacy)",perplexity:"Perplexity (legacy)",claude:"Claude (legacy)",qwen:"Qwen (legacy)",deepseek:"DeepSeek (legacy)",kimi:"Kimi (legacy)"};function A(){const{id:c}=S(),[m,k]=l.useState(null),[j,N]=l.useState({}),[f,v]=l.useState(!0),[p,w]=l.useState("");if(l.useEffect(()=>{async function n(){try{const d=await h.getDashboard(c);k(d.dashboard);const t=d.dashboard.trend_data||[],x={};for(const i of t)try{const o=await h.getRunReport(c,i.run_id);x[i.run_id]=o.report}catch{}N(x)}catch(d){w(d.message||"Failed to load report data")}finally{v(!1)}}n()},[c]),f)return e.jsx("div",{className:"p-12 text-center text-gray-400",children:"Loading report..."});if(p)return e.jsx("div",{className:"p-12 text-center text-red-500",children:p});if(!m)return null;const s=m.trend_data||[],b=m.entity||{};return e.jsxs("div",{className:"max-w-4xl mx-auto px-6 py-8 print:px-0 print:py-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-8 print:hidden",children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-gray-100",children:"Run History Report"}),e.jsxs("button",{onClick:()=>window.print(),className:"inline-flex items-center gap-1.5 px-4 py-2 bg-brand-600 text-white text-sm font-medium rounded-lg hover:bg-brand-700 transition",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 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"})}),"Export PDF"]})]}),e.jsxs("div",{className:"mb-8 pb-6 border-b-2 border-brand-600 print:border-brand-800",children:[e.jsx("h2",{className:"text-2xl font-bold text-brand-700 dark:text-brand-400 print:text-brand-800",children:"AI Attention â Run History Report"}),e.jsxs("p",{className:"text-sm text-gray-500 dark:text-gray-400 mt-1",children:[b.value," (",b.type,") · ",s.length," runs ·",s.length>0&&` ${new Date(s[0].computed_at).toLocaleDateString()} â ${new Date(s[s.length-1].computed_at).toLocaleDateString()}`]})]}),[...s].reverse().map((n,d)=>{var y;const t=j[n.run_id],x=(t==null?void 0:t.results)||[],i=(t==null?void 0:t.failed_models)||[],o={};for(const a of x)o[a.prompt]||(o[a.prompt]=[]),o[a.prompt].push(a);return e.jsxs("div",{className:"mb-10 print:break-inside-avoid",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-3",children:[e.jsxs("span",{className:"text-xs font-bold text-white bg-brand-600 px-2 py-0.5 rounded print:bg-brand-800",children:["Run ",s.length-d]}),e.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:new Date(n.computed_at).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),e.jsxs("div",{className:"flex gap-6 mb-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"AAS: "}),e.jsx("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:Number(n.aas).toFixed(1)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"VR: "}),e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:[Number(n.visibility_rate).toFixed(1),"%"]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:"SoV: "}),e.jsxs("span",{className:"font-semibold text-gray-900 dark:text-gray-100",children:[Number(n.sov).toFixed(1),"%"]})]})]}),i.length>0&&e.jsxs("div",{className:"mb-3 px-3 py-2 bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 rounded-lg text-xs text-amber-700 dark:text-amber-300",children:[i.length," model",i.length>
11?"s":""," failed: ",i.map(a=>u[a.model]||a.model).join(", ")]}),((y=t==null?void 0:t.detected_competitors)==null?void 0:y.length)>0&&e.jsxs("div",{className:"mb-4",children:[e.jsx("p",{className:"text-xs font-medium text-gray-400 dark:text-gray-500 uppercase tracking-wider mb-2",children:"Competitors Detected"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.detected_competitors.map((a,g)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-50 dark:bg-gray-800 border border-gray-100 dark:border-gray-700 rounded text-xs text-gray-700 dark:text-gray-300",children:[a.competitor_name,e.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:["AAS ",Number(a.estimated_aas).toFixed(0)]})]},g))})]}),t?Object.entries(o).map(([a,g],_)=>e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"px-3 py-2 bg-gray-50 dark:bg-gray-800 border-l-3 border-brand-500 rounded text-xs text-gray-600 dark:text-gray-400 italic mb-2 print:bg-gray-100",children:['"',a,'"']}),e.jsx("div",{className:"space-y-2 mb-2",children:g.map((r,R)=>e.jsxs("div",{className:`rounded-lg border p-3 ${r.mentioned?"border-green-200 dark:border-green-800 bg-green-50/50 dark:bg-green-900/10":"border-gray-100 dark:border-gray-800"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 mb-1.5",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-700 dark:text-gray-300",children:u[r.model]||r.model}),r.mentioned?e.jsxs("span",{className:"text-[10px] font-semibold text-green-600 dark:text-green-400 bg-green-100 dark:bg-green-900/30 px-1.5 py-0.5 rounded",children:["Mentioned · Rank #",r.rank||"?"]}):e.jsx("span",{className:"text-[10px] text-gray-400 dark:text-gray-500 bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded",children:"Not mentioned"}),r.total_entities_mentioned&&e.jsxs("span",{className:"text-[10px] text-gray-400 dark:text-gray-500",children:[r.total_entities_mentioned," entities detected"]})]}),r.reasoning&&e.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 leading-relaxed whitespace-pre-wrap",children:r.reasoning})]},R))})]},_)):e.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500 mb-4",children:"Report data not available for this run."}),d<s.length-1&&e.jsx("hr",{className:"border-gray-200 dark:border-gray-700 print:border-gray-300"})]},n.run_id)}),e.jsxs("div",{className:"mt-12 pt-4 border-t border-gray-200 dark:border-gray-700 text-center text-xs text-gray-400 dark:text-gray-500 print:mt-8",children:["Generated by AI Attention (aiattention.ai) · ",new Date().toLocaleDateString()]}),e.jsx("style",{children:` 2 @media print { 3 body { -webkit-print-color-adjust: exact; print-color-adjust: exact; } 4 @page { size: A4; margin: 15mm 20mm; } 5 .print\\:hidden { display: none !important; } 6 .print\\:break-inside-avoid { break-inside: avoid; } 7 } 8 `})]})}export{A 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.