1import{r as F,j as e,m as n}from"./vendor-motion-9qIbWfdh.js";import{a as B,u as V}from"./vendor-query-CrasLRbE.js";import{h as T,da as Z,db as J,bH as q,aD as X,q as U,dc as ee,j as te,aG as se,a7 as x,L as E,ae as C,k as y,bz as ae,C as $,as as N,y as D,b8 as ie,bb as re,bc as ne,bd as le,be as oe,bf as ce,bg as de,bh as O,aw as xe,Z as G,F as z,am as K,aa as R,B as H,N as me,g as he,bB as pe,z as Y,bL as ue,ab as ge,ad as je,b5 as be,H as fe}from"./index-RER_5nha.js";import{E as ye}from"./EarlyUnlockModal-CwOXMQgO.js";import"./vendor-react-C0Dkio3Y.js";import"./vendor-charts-JEUKlbbs.js";import"./credit-card-cVznZL7v.js";function Ne(a,s){switch(a){case"start_scan":return"/";case"view_results":return s?`/scan/${s}`:"/";case"view_insights":return"/blueprint?tab=insights";case"complete_bio_brief":return"/";case"connect_steps":return"/settings";case"log_meal":return"/log-meal";default:return"/"}}const i="#00FFC3";function ke({wholeFoods:a,ultraProcessed:s,redFlag:r}){const t=2*Math.PI*61,h=[{pct:a,color:i,label:"Clean"},{pct:s,color:"#F59E0B",label:"Processed"},{pct:r,color:"#EF4444",label:"Red Flag"}].filter(j=>j.pct>0);let v=0;return e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"relative flex-shrink-0","data-testid":"chart-deception-donut",children:[e.jsxs("svg",{width:140,height:140,viewBox:"0 0 140 140",className:"-rotate-90",children:[e.jsx("circle",{cx:140/2,cy:140/2,r:61,fill:"none",stroke:"#1A2028",strokeWidth:18}),h.map((j,A)=>{const k=j.pct/100*t,c=t-k,W=e.jsx(n.circle,{cx:140/2,cy:140/2,r:61,fill:"none",stroke:j.color,strokeWidth:18,strokeDasharray:`${k} ${c}`,strokeDashoffset:-v,strokeLinecap:"round",initial:{strokeDasharray:`0 ${t}`},animate:{strokeDasharray:`${k} ${c}`},transition:{duration:.8,delay:A*.2}},A);return v+=k,W})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsxs("span",{className:"text-2xl font-bold text-white font-mono","data-testid":"value-clean-pct",children:[a,"%"]}),e.jsx("span",{className:"text-[10px] text-slate-500 tracking-wider uppercase",children:"Clean"})]})]}),e.jsxs("div",{className:"flex flex-col gap-2.5",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full",style:{background:i}}),e.jsx("span",{className:"text-xs text-slate-400 tracking-wide",children:"Whole Foods"}),e.jsxs("span",{className:"text-xs font-bold text-white ml-auto font-mono",children:[a,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-amber-500"}),e.jsx("span",{className:"text-xs text-slate-400 tracking-wide",children:"Ultra-Processed"}),e.jsxs("span",{className:"text-xs font-bold text-white ml-auto font-mono",children:[s,"%"]})]}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-500"}),e.jsx("span",{className:"text-xs text-slate-400 tracking-wide",children:"Red Flags present"}),e.jsxs("span",{className:"text-xs font-bold text-white ml-auto font-mono",children:[r,"%"]})]})]})]})}function we({score:a}){const[,s]=T(),r=h=>h>=80?"#00FFC3":h>=60?"#14B8A6":h>=40?"#C8A24A":h>=25?"#F59E0B":"#EF4444",l=a?.details??{proteinIntake:0,proteinTarget:0,waterIntakeOz:0,sleepHours:null},g=a?.forecast??{suggestions:[]},m={suggestions:Array.isArray(g?.suggestions)?g.suggestions:[]},t=(l?.proteinTarget||1)>0?Math.round((l?.proteinIntake??0)/(l?.proteinTarget||1)*100):0;return e.jsxs(x,{className:"p-4 relative overflow-hidden bg-[#151A21] border-[#1A2028] hover:border-[#00FFC3]/20 transition-all cursor-pointer",onClick:()=>s("/daily-data"),"data-testid":"card-biosync-summary",children:[e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[2px]",style:{background:i}}),e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{className:"w-5 h-5",style:{color:i},strokeWidth:1.5}),e.jsx("h2",{className:"text-base font-bold text-white tracking-wide",children:"Recovery Brief"}),e.jsx(N,{className:"w-4 h-4 text-slate-600"})]}),e.jsxs("div",{className:"px-2.5 py-1 rounded text-xs font-bold font-mono",style:{color:r(a?.score??0),background:`${r(a?.score??0)}15`,border:`1px solid ${r(a?.score??0)}30`},"data-testid":"badge-recovery-score",children:[a?.score??0,"%"]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-3",children:[e.jsxs("div",{className:"text-center p-2.5 rounded bg-[#0D1117] border border-[#1A2028]",children:[e.jsx(ge,{className:"w-4 h-4 mx-auto mb-1",style:{color:i}}),e.jsxs("p",{className:"text-lg font-bold text-white font-mono","data-testid":"value-protein-pct",children:[t,"%"]}),e.jsx("p",{className:"text-[10px] text-slate-500 tracking-wider up
1percase",children:"Protein"})]}),e.jsxs("div",{className:"text-center p-2.5 rounded bg-[#0D1117] border border-[#1A2028]",children:[e.jsx(je,{className:"w-4 h-4 mx-auto mb-1 text-blue-400"}),e.jsxs("p",{className:"text-lg font-bold text-white font-mono","data-testid":"value-water-oz",children:[l.waterIntakeOz??0,"oz"]}),e.jsx("p",{className:"text-[10px] text-slate-500 tracking-wider uppercase",children:"Water"})]}),e.jsxs("div",{className:"text-center p-2.5 rounded bg-[#0D1117] border border-[#1A2028]",children:[e.jsx(be,{className:"w-4 h-4 mx-auto mb-1 text-purple-400"}),e.jsx("p",{className:"text-lg font-bold text-white font-mono","data-testid":"value-sleep-hrs",children:l.sleepHours?`${l.sleepHours}h`:"--"}),e.jsx("p",{className:"text-[10px] text-slate-500 tracking-wider uppercase",children:"Sleep"})]})]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed","data-testid":"text-recovery-message",children:a?.statusMessage??""}),(m.suggestions?.length??0)>0&&e.jsxs("div",{className:"mt-2.5 flex items-start gap-2 p-2 rounded bg-[#00FFC3]/5 border border-[#00FFC3]/10",children:[e.jsx(G,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0",style:{color:i}}),e.jsx("p",{className:"text-xs font-medium",style:{color:i},"data-testid":"text-recovery-tip",children:m.suggestions[0]})]})]})}function ve(){const{data:a}=q(),[,s]=T();if(!a?.kosmoMessage)return null;const r=()=>{if(!a)return;const g=Ne(a.kosmoNextAction??"start_scan",a.lastScanId);fe("kosmo_cta_clicked",{event_category:"kosmo",action:a.kosmoNextAction??"start_scan",source:"insights_banner"}),s(g)},l=a.kosmoNextAction==="start_scan"?"Scan Now":a.kosmoNextAction==="view_insights"?"Review Intel":a.kosmoNextAction==="view_results"?"See Results":"Go";return e.jsx(n.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},className:"px-4 py-2","data-testid":"banner-kosmo-insights",children:e.jsx("div",{className:"rounded-xl bg-gradient-to-r from-[#00FFC3]/10 to-[#00FFC3]/5 border border-[#00FFC3]/20 p-3",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(pe,{mood:a.kosmoPriority==="high"?"energized":"calm",size:"sm"}),e.jsx("p",{className:"flex-1 text-xs text-white/80","data-testid":"text-kosmo-insights-message",children:a.kosmoMessage}),e.jsx("button",{onClick:r,className:"shrink-0 px-3 py-1.5 rounded-lg bg-[#00FFC3] text-[#0A0D10] text-[11px] font-bold hover:bg-[#00FFC3]/90 active:scale-[0.97] transition-all","data-testid":"button-kosmo-insights-cta",children:l})]})})})}function Ae(){const[,a]=T();return e.jsxs(n.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},className:"px-6 py-12 text-center space-y-6",children:[e.jsx(n.div,{animate:{scale:[1,1.05,1]},transition:{repeat:1/0,duration:2,ease:"easeInOut"},className:"w-24 h-24 rounded-full flex items-center justify-center mx-auto",style:{background:`${i}15`,border:`1px solid ${i}30`},children:e.jsx(D,{className:"w-12 h-12",style:{color:i}})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-white mb-2 tracking-wide","data-testid":"text-empty-insights-title",children:"INTEL DASHBOARD AWAITING DATA"}),e.jsx("p",{className:"text-slate-500 text-sm leading-relaxed max-w-xs mx-auto",children:"Scan at least 3 meals to unlock your Deception Ratio, recovery brief, and Kosmo's tactical interventions."})]}),e.jsxs(y,{size:"lg",className:"font-bold px-8 tracking-wider text-xs",style:{background:i,color:"#0A0D10"},onClick:()=>a("/"),"data-testid":"button-scan-first-meal",children:[e.jsx(D,{className:"w-5 h-5 mr-2"}),"INITIATE FIRST SCAN"]}),e.jsx("div",{className:"grid grid-cols-3 gap-3 pt-4",children:[{icon:$,label:"Deception Ratio",desc:"Clean vs processed"},{icon:Y,label:"Recovery Brief",desc:"Protein, sleep, water"},{icon:ue,label:"Kosmo Intel",desc:"Tactical nudges"}].map((s,r)=>e.jsxs(n.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{delay:.3+r*.1},className:"text-center",children:[e.jsx("div",{className:"w-10 h-10 bg-[#151A21] border border-[#1A2028] rounded flex items-center justify-center mx-auto mb-1.5",children:e.jsx(s.icon,{className:"w-5 h-5 text-slate-500"})}),e.jsx("p",{className:"text-[11px] font-medium text-white tracking-wide",children:s.label}),e.jsx("p",{className:"text-[9px] text-slate-600",children:s.desc})]},r))})]})}
1class u extends F.Component{constructor(s){super(s),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(s,r){}render(){return this.state.hasError?null:this.props.children}}function Ee({embedded:a}){const[,s]=T(),[r,l]=F.useState(!1),[g,m]=F.useState(!1),{data:t,isLoading:h}=Z(),{isUnlocked:v}=J(),{data:j}=q(),{data:A}=X(),k=A?.isPremium===!0||!!A?.isPilot,{data:c}=B({queryKey:["/api/weekly-audit/status"]});F.useEffect(()=>{const d=new URLSearchParams(window.location.search),p=d.get("audit_unlock"),w=d.get("session_id");p==="success"&&w&&(fetch(`/api/weekly-audit/verify-early-unlock?session_id=${w}`,{credentials:"include"}).then(o=>o.json()).then(o=>{o.success&&(U.invalidateQueries({queryKey:["/api/weekly-audit/status"]}),s("/weekly-audit"))}).catch(o=>console.error("Verify early unlock error:",o)),window.history.replaceState({},"","/insights"))},[]);const W=V({mutationFn:()=>he("POST","/api/weekly-audit/early-unlock").then(d=>d.json()),onSuccess:()=>{U.invalidateQueries({queryKey:["/api/weekly-audit/status"]}),m(!1),s("/weekly-audit")}}),I=v("neural_hub"),_=v("performance_audit"),{data:P}=B({queryKey:["/api/biosync/score"],enabled:I});F.useEffect(()=>{ee()},[]);const L=e.jsxs("div",{className:a?"bg-[#0A0E14] pb-24 max-w-lg lg:max-w-2xl mx-auto":"min-h-screen bg-[#0A0E14] pb-32 max-w-lg lg:max-w-2xl mx-auto",children:[!a&&e.jsx("div",{className:"bg-[#0D1117] px-6 pb-4 sticky top-0 z-10 border-b border-[#1A2028]",style:{paddingTop:"calc(env(safe-area-inset-top, 0px) + 8px)"},children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(te,{}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h1",{className:"text-xl font-bold text-white tracking-wide",children:"Health Insights"}),e.jsx("p",{className:"text-[11px] text-white/30 font-normal",children:"Weekly patterns, trends, and behavior analysis."})]})]})}),e.jsx(u,{children:e.jsx(ve,{})}),h?e.jsxs("div",{className:"flex flex-col items-center justify-center py-32 space-y-4",children:[e.jsx(se,{className:"w-10 h-10 animate-spin",style:{color:i},"data-testid":"loader-insights"}),e.jsx("p",{className:"text-slate-500 text-sm tracking-wider",children:"Compiling intel..."})]}):t?.hasEnoughData?e.jsxs("div",{className:"px-4 py-4 space-y-4",children:[e.jsx(u,{children:e.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},children:(()=>{const d=Math.max(j?.scansTotal??0,j?.calibrationScansCompleted??0),p=c?.status==="ready"||c?.status==="completed"||d>=8,w=Math.max(0,8-d),o=c?.daysSoFar??0,Q=c?.confidence??0,M=c?.canEarlyUnlock??!1,b=c?.status==="collecting",S=Math.max(0,7-o);return k?e.jsxs(e.Fragment,{children:[e.jsxs(x,{className:"p-4 bg-[#151A21] border-[#1A2028] transition-all cursor-pointer hover:border-[#00FFC3]/20 overflow-hidden relative",onClick:p?()=>s("/weekly-audit"):()=>l(!0),"data-testid":"card-weekly-audit",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative w-12 h-12 flex items-center justify-center flex-shrink-0",children:[e.jsxs("svg",{className:"absolute inset-0 w-12 h-12 -rotate-90",viewBox:"0 0 48 48",children:[e.jsx("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:"#1A2028",strokeWidth:"2.5"}),e.jsx("circle",{cx:"24",cy:"24",r:"20",fill:"none",stroke:p?i:b?"#C8A24A":"#334155",strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${o/7*125.6} 125.6`})]}),e.jsx($,{className:"w-5 h-5 relative z-10",style:{color:p?i:b?"#C8A24A":"#64748B"}})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-base font-bold text-white tracking-wide",children:"Weekly Performance Audit"}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:p?"Your 7-day intelligence report is ready":b?`Day ${o} of 7 â ${S} day${S!==1?"s":""} remaining`:"Complete 8 scans to start your first audit cycle"})]}),p?e.jsx(C,{className:"text-[10px] bg-[#00FFC3]/10 border-[#00FFC3]/30 font-bold",style:{color:i},children:"Ready"}):b?e.jsxs(C,{className:"text-[10px] bg-[#C8A24A]/10 border-[#C8A24A]/30 text-[#C8A24A] font-bold",children:["Day ",o,"/7"]}):e.jsxs(C,{className:"text-[10px] bg-[#0D1117] text-slate-500 border border-[#1A2028] font-mono",children:[w," scans to go"]})]}),e.jsx("div",{className:"mt-3 flex items-center gap-2",children:p?e.jsxs(y,{size:"sm",className:"font-bold text-xs tracking-wider",style:{background:i,color:"#0A0D10"},onClick:f=>{f.stopPropagation(),s("/weekly-audit")},"data-testid":"button-view-audit",children:["View Full Audit",e.jsx(N,{className:"w-3.5 h-3.5 ml-1"})]}):b&&M?e.jsxs(e.Fragment,{children:[e.jsxs(y,{size:"sm",variant:"outline",className:"font-bold text-xs tracking-wider border-[#C8A24A]/30 text-[#C8A24A] bg-[#C8A24A]/5 hover:bg-[#C8A24A]/10",onClick:f=>{f.stopPropagation(),m(!0)},"data-testid":"button-early-unlock-audit",children:[e.jsx(E,{className:"w-3 h-3 mr-1"}),"Unlock Early â $3.99"]}),e.jsxs("span",{className:"text-[10px] text-slate-500",children:["or wait ",S," day",S!==1?"s":""]})]}):e.jsxs(y,{size:"sm",className:"font-bold text-xs tracking-wider",style:{background:i,color:"#0A0D10"},onClick:f=>{f.stopPropagation(),s("/")},"data-testid":"button-audit-scan-unlock",children:[e.jsx(D,{className:"w-3.5 h-3.5 mr-1.5"}),"Scan Now"]})})]}),e.jsx(ie,{open:r,onOpenChange:l,children:e.jsxs(re,{className:"bg-[#151A21] border-[#1A2028] max-w-sm",children:[e.jsxs(ne,{children:[e.jsx(le,{className:"text-white",children:"Weekly Audit"}),e.jsx(oe,{className:"text-slate-400",children:b?`Your audit cycle is on day ${o} of 7. You can pay $3.99 to unlock it early, or wait for the full report.`:`Unlocks in ${w} more scan${w!==1?"s":""}.`})]}),e.jsxs(ce,{children:[e.jsx(de,{className:"bg-transparent border-[#1A2028] text-slate-400 hover:text-white","data-testid":"button-gate-dismiss",children:"Not now"}),b&&M?e.jsxs(O,{style:{background:"linear-gradient(135deg, #C8A24A, #DEB85A)",color:"#0A0D10"},className:"font-bold",onClick:()=>{l(!1),m(!0)},"data-testid":"button-gate-early-unlock",children:[e.jsx(E,{className:"w-3.5 h-3.5 mr-1"}),"Unlock Early â $3.99"]}):e.jsx(O,{style:{background:i,color:"#0A0D10"},className:"font-bold",onClick:()=>s("/"),"data-testid":"button-gate-scan",children:"Scan Now"})]})]})}),e.jsx(ye,{open:g,onClose:()=>m(!1),onUnlock:()=>W.mutate(),daysSoFar:o,confidence:Q,isPending:W.isPending})]}):e.jsxs(x,{className:"p-4 bg-[#151A21] border-[#1A2028] transition-all cursor-pointer hover:border-[#C8A24A]/20 relative overflow-hidden",onClick:()=>s("/pricing?source=weekly_audit"),"data-testid":"card-weekly-audit-locked",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-[#C8A24A]/[0.03] to-transparent pointer-events-none"}),e.jsxs("div",{className:"flex items-center gap-3 relative",children:[e.jsxs("div",{className:"relative w-12 h-12 flex items-center justify-center flex-shrink-0",children:[e.jsx("div",{className:"absolute inset-0 rounded-full bg-[#C8A24A]/10 border border-[#C8A24A]/20"}),e.jsx(E,{className:"w-5 h-5 relative z-10 text-[#C8A24A]"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-base font-bold text-white tracking-wide",children:"Weekly Performance Audit"}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:"7-day intelligence report â Pro subscribers only"})]}),e.jsx(C,{className:"text-[10px] bg-[#C8A24A]/10 border-[#C8A24A]/30 text-[#C8A24A] font-bold",children:"PRO"})]}),e.jsx("div",{className:"mt-3 relative",children:e.jsxs(y,{size:"sm",className:"font-bold text-xs tracking-wider text-black",style:{background:"linear-gradient(135deg, #C8A24A, #DEB85A)"},onClick:f=>{f.stopPropagation(),s("/pricing?source=weekly_audit")},"data-testid":"button-upgrade-audit",children:[e.jsx(ae,{className:"w-3.5 h-3.5 mr-1.5"}),"Upgrade to Unlock"]})})]})})()})}),t?.deceptionRatio&&e.jsx(u,{children:e.jsx(n.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.05},children:e.jsxs(x,{className:"p-4 cursor-pointer bg-[#151A21] border-[#1A2028] hover:border-[#00FFC3]/20 transition-all",onClick:()=>s("/insights/deception"),"data-testid":"card-deception-ratio",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(xe,{className:"w-5 h-5",style:{color:i},strokeWidth:1.5}),e.jsx("h2",{className:"text-base font-bold text-white tracking-wide",children:"Deception Ratio"}),e.jsxs(C,{className:"text-[10px] ml-auto bg-[#0D1117] text-slate-400 border border-[#1A2028] font-mono",children:[t.deceptionRatio?.counts?.total??0," meals"]}),e.jsx(N,{className:"w-4 h-4 text-slate-600"})]}),e.jsx(ke,{wholeFoods:t.deceptionRatio?.wholeFoods??0,ultraProcessed:t.deceptionRatio?.ultraProcessed??0,redFlag:t.deceptionRatio?.redFlag??0}),(t.deceptionRatio?.counts?.redFlag??0)>0&&e.jsxs("p",{className:"text-[11px] text-red-400 mt-2 font-mono","data-testid":"text-redflag-count",children:[t.deceptionRatio?.counts?.redFlag??0," of ",t.deceptionRatio?.counts?.total??0," meals flagged"]}),e.jsx("p",{className:"text-xs text-slate-500 mt-4 leading-relaxed","data-testid":"text-deception-summary",children:t.deceptionRatio?.summary??""}),e.jsx("p",{className:"text-[10px] text-slate-600 mt-2 leading-relaxed","data-testid":"text-deception-caption",children:"Measures how many meals contain misleading or ultra-processed ingredients."})]})})}),e.jsx(u,{children:e.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.12},children:e.jsxs(x,{className:"p-4 cursor-pointer bg-[#151A21] border-[#1A2028] hover:border-[#00FFC3]/20 transition-all",onClick:()=>s("/insights/history"),"data-testid":"card-bio-brief-history",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(D,{className:"w-5 h-5",style:{color:i},strokeWidth:1.5}),e.jsx("h2",{className:"text-base font-bold text-white tracking-wide",children:"Bio Brief History"}),e.jsx(N,{className:"w-4 h-4 text-slate-600 ml-auto"})]}),e.jsx("p",{className:"text-xs text-slate-400 leading-relaxed",children:"Review your past scan briefs and track how your food choices are evolving over time."}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 p-2 rounded bg-[#00FFC3]/5 border border-[#00FFC3]/10",children:[e.jsx(G,{className:"w-3.5 h-3.5 flex-shrink-0",style:{color:i}}),e.jsxs("p",{className:"text-xs font-medium",style:{color:i},children:[t?.totalScans||0," scans analyzed"]})]})]})})}),I&&P&&P.score>0&&e.jsx(u,{children:e.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1},children:e.jsx(we,{score:P})})}),e.jsx(u,{children:e.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.15},children:e.jsxs(x,{className:"p-4 cursor-pointer bg-[#151A21] border-[#1A2028] hover:border-[#00FFC3]/20 transition-all",onClick:()=>s("/impact?tab=fuel-log"),"data-testid":"card-weekly-comparison",children:[e.jsxs("h2",{className:"text-base font-bold text-white mb-4 flex items-center gap-2 tracking-wide",children:[e.jsx(z,{className:"w-5 h-5",style:{color:i},strokeWidth:1.5}),"This Week vs Last Week",e.jsx(N,{className:"w-4 h-4 text-slate-600 ml-auto"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Avg Daily Calories"}),t?.trends?.calorieChange!=null&&(t.lastWeek?.scanCount??0)>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[(t?.trends?.calorieChange??0)>=0?e.jsx(z,{className:"w-4 h-4 text-red-400",strokeWidth:1.5}):e.jsx(K,{className:"w-4 h-4",style:{color:i},strokeWidth:1.5}),e.jsxs("span",{className:R("text-sm font-bold font-mono",(t?.trends?.calorieChange??0)>=0?"text-red-400":"text-[#00FFC3]"),children:[Math.abs(t?.trends?.calorieChange??0).toFixed(0),"%"]})]})]}),e.jsxs("div",{className:"flex gap-6 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-[10px] tracking-wider up
1percase",children:"This Week"}),e.jsx("p",{className:"font-bold text-white text-lg font-mono","data-testid":"value-calories-this-week",children:Math.round(t?.thisWeek?.avg?.calories||0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-[10px] tracking-wider uppercase",children:"Last Week"}),(t.lastWeek?.scanCount??0)===0?e.jsx("p",{className:"font-bold text-slate-600 text-lg font-mono","data-testid":"value-calories-last-week",children:"â"}):e.jsx("p",{className:"font-bold text-slate-400 text-lg font-mono","data-testid":"value-calories-last-week",children:Math.round(t.lastWeek?.avg?.calories||0)})]})]})]}),e.jsxs("div",{className:"space-y-2 border-t border-[#1A2028] pt-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-slate-400 uppercase tracking-wider",children:"Avg Daily Protein"}),t?.trends?.proteinChange!=null&&(t.lastWeek?.scanCount??0)>0&&e.jsxs("div",{className:"flex items-center gap-1",children:[(t?.trends?.proteinChange??0)>=0?e.jsx(z,{className:"w-4 h-4",style:{color:i},strokeWidth:1.5}):e.jsx(K,{className:"w-4 h-4 text-red-400",strokeWidth:1.5}),e.jsxs("span",{className:R("text-sm font-bold font-mono",(t?.trends?.proteinChange??0)>=0?"text-[#00FFC3]":"text-red-400"),children:[Math.abs(t?.trends?.proteinChange??0).toFixed(0),"%"]})]})]}),e.jsxs("div",{className:"flex gap-6 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-[10px] tracking-wider uppercase",children:"This Week"}),e.jsxs("p",{className:"font-bold text-white text-lg font-mono","data-testid":"value-protein-this-week",children:[Math.round(t?.thisWeek?.avg?.protein||0),"g"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-[10px] tracking-wider uppercase",children:"Last Week"}),(t.lastWeek?.scanCount??0)===0?e.jsx("p",{className:"font-bold text-slate-600 text-lg font-mono","data-testid":"value-protein-last-week",children:"â"}):e.jsxs("p",{className:"font-bold text-slate-400 text-lg font-mono","data-testid":"value-protein-last-week",children:[Math.round(t.lastWeek?.avg?.protein||0),"g"]})]})]})]}),(t.lastWeek?.scanCount??0)===0&&e.jsx("p",{className:"text-[11px] text-slate-600 pt-2 italic","data-testid":"text-last-week-helper",children:"Last week data appears after your second week."}),e.jsxs("div",{className:"border-t border-[#1A2028] pt-4 flex gap-6 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-[10px] tracking-wider uppercase",children:"Scans This Week"}),e.jsx("p",{className:"font-bold text-white text-lg font-mono","data-testid":"value-scans-this-week",children:t?.thisWeek?.scanCount??0})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-slate-600 text-[10px] tracking-wider uppercase",children:"Scans Last Week"}),(t?.lastWeek?.scanCount??0)===0?e.jsx("p",{className:"font-bold text-slate-600 text-lg font-mono","data-testid":"value-scans-last-week",children:"â"}):e.jsx("p",{className:"font-bold text-slate-400 text-lg font-mono","data-testid":"value-scans-last-week",children:t?.lastWeek?.scanCount??0})]})]})]})]})})}),e.jsx(u,{children:_?e.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsxs(x,{className:"p-4 cursor-pointer bg-[#151A21] border-[#1A2028] hover:border-[#00FFC3]/20 transition-all",onClick:()=>s("/vera"),"data-testid":"card-audit-entry",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(n.div,{className:"w-12 h-12 rounded-xl bg-gradient-to-br from-[#00FFC3]/20 to-[#00FFC3]/5 border border-[#00FFC3]/30 flex items-center justify-center flex-shrink-0",animate:{boxShadow:["0 0 0px rgba(0,255,195,0)","0 0 16px rgba(0,255,195,0.25)","0 0 0px rgba(0,255,195,0)"]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},children:e.jsx(H,{className:"w-6 h-6",style:{color:i}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-base font-bold text-white tracking-wide",children:"Performance Audit unlocked"}),e.jsx("p",{className:"text-xs text-slate-400 mt-0.5",children:"Your first weekly audit is ready. Want Kosmo to summarize it?"})]}),e.jsx(N,{className:"w-5 h-5 text-slate-500 flex-shrink-0"})]}),e.jsx("div",{className:"mt-3",children:e.jsx(y,{size:"sm",className:"font-bold text-xs tracking-wider",style:{background:i,color:"#0A0D10"},onClick:d=>{d.stopPropagation(),s("/vera")},"data-testid":"button-view-audit",children:"View Audit"})})]})}):e.jsx(n.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{delay:.2},children:e.jsxs(x,{className:"p-4 bg-[#151A21] border-[#1A2028]","data-testid":"card-audit-locked",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-[#0D1117] border border-[#1A2028] flex items-center justify-center flex-shrink-0",children:e.jsx(H,{className:"w-6 h-6 text-slate-600"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"text-base font-bold text-slate-400 tracking-wide",children:"Performance Audit"}),e.jsxs("p",{className:"text-xs text-slate-500 mt-0.5",children:["Keep scanning â Performance Audit unlocks in ",Math.max(8-(t?.totalScans||0),0)," scans."]})]})]}),e.jsx("div",{className:"mt-3",children:e.jsxs(y,{size:"sm",variant:"outline",className:"font-bold text-xs tracking-wider border-[#1A2028] text-slate-400 hover:text-white",onClick:()=>s("/"),"data-testid":"button-scan-now-audit",children:[e.jsx(D,{className:"w-4 h-4 mr-1.5"}),"Scan Now"]})})]})})}),_&&t?.avgTransparency!=null&&e.jsx(u,{children:e.jsx(n.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.3},children:e.jsxs(x,{className:"p-4 cursor-pointer bg-[#151A21] border-[#1A2028] hover:border-[#00FFC3]/20 transition-all",onClick:()=>s("/history"),"data-testid":"card-food-quality",children:[e.jsxs("h2",{className:"text-base font-bold text-white mb-4 flex items-center gap-2 tracking-wide",children:[e.jsx($,{className:"w-5 h-5",style:{color:i},strokeWidth:1.5}),"Food Quality",e.jsx(N,{className:"w-4 h-4 text-slate-600 ml-auto"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-end gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium text-slate-500 mb-2 tracking-wider uppercase",children:"Transparency Score"}),e.jsx("p",{className:R("text-4xl font-bold font-mono",(t?.avgTransparency??0)>=70?"text-[#00FFC3]":(t?.avgTransparency??0)>=50?"text-amber-500":"text-red-400"),"data-testid":"value-transparency-score",children:Math.round(t?.avgTransparency??0)})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"w-full bg-[#0D1117] rounded-full h-2 border border-[#1A2028]",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.min(t?.avgTransparency??0,100)}%`,background:(t?.avgTransparency??0)>=70?`linear-gradient(90deg, ${i}80, ${i})`:(t?.avgTransparency??0)>=50?"linear-gradient(90deg, #78350f, #f59e0b)":"linear-gradient(90deg, #7f1d1d, #ef4444)"},"data-testid":"progress-transparency"})}),e.jsx("p",{className:"text-[10px] text-slate-500 mt-1 tracking-wider",children:(t?.avgTransparency??0)>=70?"Excellent":(t?.avgTransparency??0)>=50?"Good":"Needs Improvement"})]})]}),e.jsx("p",{className:"text-xs text-slate-500 leading-relaxed",children:(t?.avgTransparency??0)>=70?"Your meals have clear, transparent nutrition labels.":(t?.avgTransparency??0)>=50?"Most of your meals have good nutrition visibility.":"Try scanning meals with more detailed nutrition information."})]})]})})})]}):e.jsx(Ae,{})]});return a?L:e.jsx(me,{children:L})}export{Ee 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.