// Screen: Insights (AI analyst layer) function Insights({ go, nav }) { const { useState } = React; const [toast, showToast] = useToast(); const [q, setQ] = useState(''); const [thread, setThread] = useState([]); // {q, a} const [thinking, setThinking] = useState(false); const ask = (question) => { const text = (question || q).trim(); if (!text || thinking) return; setQ(''); setThinking(true); window.setTimeout(() => { const a = ASK_ANSWERS[text] || 'I looked across all three stores for the last 90 days. The short answer: the pattern you’re asking about concentrates at Burlington and inside your Medicare Part D mix. I’ve queued a full breakdown under Reports → Margin by Payer — the three numbers that matter are GP per fill ($6.10 on Part D vs $11.40 on Regence), refill completion (81% at Burlington vs 89% flagship), and compounding share (31% / 7% / 5% by store).'; setThread(t => [{ q: text, a }, ...t]); setThinking(false); }, 700); }; return (
{/* Ask bar */}
setQ(e.target.value)} onKeyDown={e => { if (e.key === 'Enter') ask(); }} >
{ASK_CHIPS.map(c => ( ))}
{thread.length > 0 ? (
{thread.map((t, i) => (
Analyst
“{t.q}”

{t.a}

))}
) : null} {/* Findings */}
{INSIGHTS.map(card => (
{card.tag}

{card.title}

{card.body}

{card.facts.map(([k, v], i) => (
{v}
{k}
))}
))}
); } Object.assign(window, { Insights });