1import{c as A,o as u,p as g,q as v,r as i,j as e,L as w,b as L,X as S}from"./index-Y4vvi71f.js";import{u as b}from"./useServerFn-Bqirg4zv.js";import{t as p}from"./index-_OpiMWyM.js";import{L as I}from"./loader-circle-BVA1EkK_.js";import{H as M}from"./heart-pulse-BkZNhjoa.js";import{B as y}from"./bot-CVU89QKX.js";import{I as P}from"./info-BhXUSwTJ.js";import{A as k}from"./activity-B7rMU7_F.js";import{R as T}from"./refresh-cw-DAat4apy.js";import{B as R}from"./bell-hKe_FXqe.js";import{T as D}from"./target-BbwIB6Ko.js";import{A as E}from"./arrow-right-WkYSoU4F.js";import{S as F}from"./shield-alert-Ba_s6a1C.js";import{C as G}from"./circle-check-DrcEg3qT.js";const H=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]],O=A("clipboard-list",H),$=u({method:"POST"}).middleware([g]).handler(v("156063fb740169255136b05162869ae97bf501cd8e99c118cc0b33265c5a53b7")),B=u({method:"POST"}).middleware([g]).handler(v("e9146988be5f8d230b61bde7189286258c560a715b9243f1aafc99abf78ae549")),Y=u({method:"POST"}).middleware([g]).handler(v("1c3a2d6cfae0fdcdb642dadfa18e0592482d90fb2a711d86532387901ab66b4b"));u({method:"POST"}).middleware([g]).handler(v("7064ec87f71f6e110e68f5b3941a3debafd14b51cdd64283ebf8588ae0e649c9"));const W=()=>{const n=new Date().getHours();return n<12?"Good morning":n<18?"Good afternoon":"Good evening"};function le(){const n=b($),f=b(B),j=b(Y),[t,x]=i.useState(null),[c,m]=i.useState(!0),[o,N]=i.useState(!1),[h,d]=i.useState(!1),r=async(s=!1)=>{s||m(!0);try{x(await n({data:void 0}))}catch{s||p.error("Could not load your wellness data.")}finally{m(!1)}};i.useEffect(()=>{r();const s=setInterval(()=>{r(!0)},45e3);return()=>clearInterval(s)},[]);const l=t?.pulse??null,a=i.useMemo(()=>l===null?"Not enough data yet":l>=75?"Steady and supported":l>=50?"Holding, with room to rest":l>=30?"Needs support today":"Reach for support now",[l]);return c&&!t?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-silver/60 py-20 justify-center",children:[e.jsx(I,{className:"w-4 h-4 animate-spin"})," Building your live wellness picture"]}):e.jsxs("div",{className:"space-y-6 max-w-7xl",children:[e.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gold uppercase tracking-widest",children:W()}),e.jsx("h1",{className:"font-display text-3xl sm:text-4xl font-bold mt-1",children:"Live Wellness Command Center"}),e.jsx("p",{className:"text-silver/70 mt-1 text-sm",children:"Everything below comes from what you entered or connected. Support signals, not clinical measurements."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>d(!0),className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-2xl bg-white/5 ring-1 ring-white/10 text-sm hover:bg-white/10",children:[e.jsx(M,{className:"w-4 h-4 text-gold"})," Quick check in"]}),e.jsxs(w,{to:"/dashboard/agent",className:"inline-flex items-center gap-2 px-4 py-2.5 rounded-2xl bg-gradient-to-r from-primary to-accent text-primary-foreground text-sm font-medium glow-primary",children:[e.jsx(y,{className:"w-4 h-4"})," Open AI Agents"]})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"glass-strong rounded-3xl p-6 relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-gold/20 to-transparent"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-xs uppercase tracking-widest text-gold",children:"Wellness Pulse"}),e.jsx("button",{onClick:()=>N(s=>!s),className:"text-silver/60 hover:text-foreground",title:"Why this number",children:e.jsx(P,{className:"w-4 h-4"})})]}),e.jsx("div",{className:"font-display text-6xl font-bold text-gradient-gold mt-2",children:l??"--"}),e.jsx("div",{className:"text-xs text-silver/70 mt-1",children:a}),t?.trend&&e.jsxs("div",{className:`text-xs mt-1 ${t.trend.direction==="down"?"text-rose-300":t.trend.direction==="up"?"text-emerald-300":"text-silver/60"}`,children:[t.trend.direction==="up"?"Up":t.trend.direction==="down"?"Down":"Flat"," ",Math.abs(t.trend.delta)," versus last week"]}),e.jsx("div",{className:"mt-4 h-2 rounded-full bg-white/10 overflow-hidden",children:e.jsx("div",{className:"h-full bg-gradient-to-r from-gold to-primary rounded-full transition-all",style:{width:`${l??0}%`}})}),o&&e.jsxs("div",{className:"mt-4 space-y-2",children:[t?.factors.map(s=>e.jsxs("div",{className:"text-xs",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{className:"text-silver/80",children:s.label}),e.jsx("span",{className:s.value===null?"text-silver/40":"text-foreground",children:s.value??"no signal"})]}),e.jsx("div",{className:"text-[11px] text-silver/50",children:s.detail})]},s.key)),e.jsx("p",{className:"text-[11px] text-silver/50 pt-1",children:"Your Pulse is an average of the signals that have data. It is never a diagnosis."})]})]})]}),e.jsxs("div",{className:"glass rounded-3xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-xs text-silver/60 uppercase tracking-widest",children:"Your check ins"}),e.jsx(k,{className:"w-4 h-4 text-gold"})]}),t&&t.moodSeries.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-end gap-1.5 h-28 mt-4",children:t.moodSeries.map((s,C)=>e.jsx("div",{title:`${new Date(s.at).toLocaleDateString()} · mood ${s.mood} of 5`,className:"flex-1 rounded-t-xl bg-gradient-to-t from-primary to-accent transition-all",style:{height:`${s.mood/5*100}%`}},C))}),e.jsxs("div",{className:"text-[11px] text-silver/50 mt-2",children:["Last ",t.moodSeries.length," self reported check in",t.moodSeries.length===1?"":"s"]})]}):e.jsxs("div",{className:"mt-6 text-sm text-silver/60",children:["No check ins yet. Your first one takes about twenty seconds and starts your Pulse.",e.jsx("button",{onClick:()=>d(!0),className:"block text-gold mt-2",children:"Start a check in"})]})]}),e.jsxs("div",{className:"glass rounded-3xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"text-xs text-silver/60 uppercase tracking-widest",children:"Today"}),e.jsx(O,{className:"w-4 h-4 text-gold"})]}),t&&t.today.items.length>0?e.jsx("div",{className:"space-y-2",children:t.today.items.map(s=>e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx("span",{className:"text-xs text-silver/50 w-12",children:s.at.slice(0,5)}),e.jsx("span",{className:s.done?"line-through text-silver/40":"",children:s.title})]},s.id))}):e.jsx("div",{className:"text-sm text-silver/60",children:"No plan for today yet. Ask GSS AI to build a light plan and it will appear here."}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-4 text-center",children:[e.jsxs("div",{className:"p-2 rounded-xl bg-white/5",children:[e.jsx("div",{className:"font-display text-xl",children:t?.counts.checkinsThisWeek??0}),e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-silver/50",children:"Check ins 7d"})]}),e.jsxs("div",{className:"p-2 rounded-xl bg-white/5",children:[e.jsx("div",{className:"font-display text-xl",children:t?.counts.activeGoals??0}),e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-silver/50",children:"Active goals"})]})]})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"glass rounded-3xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(y,{className:"w-4 h-4 text-gold"}),e.jsx("span",{className:"text-xs uppercase tracking-widest text-silver/60",children:"AI observations"})]}),e.jsx("button",{onClick:()=>{r()},className:"text-silver/60 hover:text-foreground",title:"Refresh",children:e.jsx(T,{className:"w-3.5 h-3.5"})})]}),t&&t.insights.length>0?e.jsx("div",{className:"space-y-3",children:t.insights.map(s=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-2xl bg-white/5",children:[e.jsx("div",{className:"w-9 h-9 rounded-xl bg-gradient-to-br from-primary/30 to-accent/20 flex items-center justify-center shrink-0",children:s.kind==="followup"?e.jsx(R,{className:"w-4 h-4 text-gold"}):s.kind==="goal"?e.jsx(D,{className:"w-4 h-4 text-gold"}):e.jsx(L,{className:"w-4 h-4 text-gold"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"text-sm",children:s.title}),e.jsx("div",{className:"text-xs text-silver/60 mt-0.5",children:s.body}),e.jsxs(w,{to:"/dashboard/agent",className:"text-xs text-gold inline-flex items-center gap-1 mt-1",children:["Talk it through ",e.jsx(E,{className:"w-3 h-3"})]})]}),s.source==="stored"&&e.jsx("button",{title:"Dismiss",onClick:async()=>{try{await j({data:{id:s.id}}),r(!0)}catch{p.error("Could not dismiss that.")}},className:"text-silver/40 hover:text-foreground",children:e.jsx(S,{className:"w-3.5 h-3.5"})})]},s.id))}):e.jsx("div",{className:"text-sm text-silver/60",children:"No observations yet. As you check in, set goals and talk with the agents, patterns will show up here with the reason behind them."})]}),e.jsxs("div",{className:"glass rounded-3xl p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"w-4 h-4 text-gold"}),e.jsx("span",{className:"text-xs uppercase tracking-widest text-silver/60",children:"Live activity"})]}),e.jsxs(w,{to:"/dashboard/crisis",className:"text-xs text-gold inline-flex items-center gap-1",children:[e.jsx(F,{className:"w-3.5 h-3.5"})," Safety Center"]})]}),t&&t.feed.length>0?e.jsx("div",{className:"space-y-2 max-h-[22rem] overflow-y-auto pr-1",children:t.feed.map(s=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-2xl bg-white/5",children:[e.jsx(G,{className:"w-4 h-4 text-gold mt-0.5 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-sm truncate",children:s.title}),s.detail&&e.jsx("div",{className:"text-xs text-silver/60 line-clamp-2",children:s.detail})]}),e.jsx("div",{className:"text-[10px] text-silver/50 whitespace-nowrap",children:new Date(s.at).toLocaleStr
1ing(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]},s.id))}):e.jsx("div",{className:"text-sm text-silver/60",children:"Your activity feed is empty. Real events appear here as they happen."})]})]}),h&&e.jsx(z,{onClose:()=>d(!1),onSaved:s=>{x(s),d(!1)},submit:f})]})}function z({onClose:n,onSaved:f,submit:j}){const[t,x]=i.useState(3),[c,m]=i.useState(50),[o,N]=i.useState(50),[h,d]=i.useState(""),[r,l]=i.useState(!1);return e.jsx("div",{className:"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm flex items-center justify-center p-4",children:e.jsxs("div",{className:"glass-strong rounded-3xl p-6 w-full max-w-md space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"font-display text-lg font-semibold",children:"Quick check in"}),e.jsx("button",{onClick:n,className:"p-2 rounded-lg hover:bg-white/10 text-silver/70",children:e.jsx(S,{className:"w-4 h-4"})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs uppercase tracking-widest text-silver/60 mb-2",children:"How are you feeling"}),e.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(a=>e.jsx("button",{onClick:()=>x(a),className:`flex-1 py-2 rounded-xl text-sm ${t===a?"bg-gradient-to-r from-primary to-accent text-primary-foreground":"bg-white/5 ring-1 ring-white/10"}`,children:a},a))}),e.jsxs("div",{className:"flex justify-between text-[10px] text-silver/50 mt-1",children:[e.jsx("span",{children:"Very low"}),e.jsx("span",{children:"Great"})]})]}),e.jsxs("label",{className:"block",children:[e.jsxs("div",{className:"text-xs uppercase tracking-widest text-silver/60 mb-1",children:["Stress ",c]}),e.jsx("input",{type:"range",min:0,max:100,value:c,onChange:a=>m(Number(a.target.value)),className:"w-full accent-primary"})]}),e.jsxs("label",{className:"block",children:[e.jsxs("div",{className:"text-xs uppercase tracking-widest text-silver/60 mb-1",children:["Energy ",o]}),e.jsx("input",{type:"range",min:0,max:100,value:o,onChange:a=>N(Number(a.target.value)),className:"w-full accent-primary"})]}),e.jsx("textarea",{value:h,onChange:a=>d(a.target.value.slice(0,500)),placeholder:"Anything you want to note (optional)",rows:3,className:"w-full bg-white/5 rounded-xl px-3 py-2 text-sm outline-none ring-1 ring-white/10 focus:ring-primary/50"}),e.jsx("button",{disabled:r,onClick:async()=>{l(!0);try{const a=await j({data:{mood:t,stress:c,energy:o,note:h,tags:[]}});p.success("Check in saved. Your Pulse is updated."),f(a)}catch{p.error("Could not save that check in.")}finally{l(!1)}},className:"w-full py-3 rounded-2xl bg-gradient-to-r from-primary to-accent text-primary-foreground text-sm font-medium glow-primary disabled:opacity-60",children:r?"Saving":"Save check in"}),e.jsx("p",{className:"text-[11px] text-silver/50 text-center",children:"Self reported support signal. Not a clinical assessment."})]})})}export{le as component};
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.