PageSourceSearch

https://www.fitscript.me/assets/dashboard-settings-C_JOOS8S.js

js fitscript.me collected 2026-10-09 21:55:44 UTC 55,566 bytes, 2 lines download raw bytes

1import{r as g,j as e,a as Je}from"./vendor-react--7KVbddC.js";import{H as Xe}from"./intake-sexual-health-women-WpBd_TnA.js";import{h as Re,x as Ze,l as et,r as tt,k as it,aB as at,L as st,t as Y,ao as lt,aq as nt,ap as rt,ar as ot}from"./index-BbCLsO8e.js";import{b as ct,a as pe,u as he}from"./vendor-query-Bdhgs2nn.js";import{D as dt,i as pt}from"./dashboard-activity-DRuIHUXR.js";import{B as $e}from"./lab-psc-booking-Dp5gi4-Q.js";import{I as ht}from"./admin-orders-D1PCuNXs.js";import{at as mt,i as ft,aV as ut,s as gt,d as qe,X as Ye,L as Ie,K as xt,C as Ce,t as De,aW as yt,U as Ke,F as Ge,O as K,I as We,N as Qe,aX as bt,r as jt,aY as me,af as wt,aZ as vt,aw as St}from"./vendor-icons-BpBIpQRV.js";import{m as Ve,T as fe,b as ke,n as Nt,f as kt,j as $t,d as Ue}from"./advanced-insights-pill-CVIoelgK.js";import{u as Ct,d as zt}from"./lab-method-step-BRGCm4OO.js";import{W as Et,E as He,n as Pt,q as At}from"./wizlo-pay-embed-Dq6DBI56.js";import{LANDING_PEAK as _e,LANDING_PROTOCOL as Me}from"./subscription-checkout-n5m3oyF-.js";import{A as Lt,m as Oe}from"./vendor-motion-ONUFGdVn.js";import"./not-found-O1ORAned.js";import"./admin-analytics-traffic-W9PminUA.js";import"./admin-team-Cz4EtZjp.js";import"./brand-guide-UTyK-g0m.js";import"./vendor-utils-D9StxGwk.js";import"./use-page-title-CiuEJcGx.js";import"./useScoreHistory-B1auEpsi.js";import"./vendor-recharts-DvcstDAP.js";import"./vendor-lodash-C6HSi9hW.js";import"./rx-cadence-DD3WAsKD.js";import"./dialog-DIYsd0xd.js";import"./index-D__1TD_o.js";import"./care-attention-CZYSMIL1.js";import"./select-jlOvBJ9v.js";import"./types-C5Gq-VJf.js";const Tt="[email protected]",It={error:{bar:"border-red-400/30 bg-red-500/5",iconBg:"bg-red-500/15 text-red-400",icon:"text-red-400"},warning:{bar:"border-amber-400/30 bg-amber-500/5",iconBg:"bg-amber-500/15 text-amber-400",icon:"text-amber-400"},info:{bar:"border-[#051b42]/30 bg-[#051b42]/5",iconBg:"bg-[#051b42]/15 text-[#051b42]",icon:"text-[#051b42]"}};function Ft({variant:n="error",title:B,message:v,context:i,detail:S,onDismiss:ue,className:E}){const[k,se]=g.useState(!1),N=It[n],t=n==="info"?mt:ft,d=()=>{const _=`[${i}] ${B}`,P=[v,"","Please leave the details below so we can investigate.","",`Context: ${i}`,`Page: ${typeof window<"u"?window.location.href:""}`,S?`Technical detail: ${S}`:""].filter(Boolean).join(`
2`);window.location.href=`mailto:${Tt}?subject=${encodeURIComponent(_)}&body=${encodeURIComponent(P)}`};return e.jsx("div",{role:"alert",className:Re("rounded-2xl border p-4 sm:p-5",N.bar,E),"data-testid":`support-banner-${n}`,children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:Re("w-9 h-9 rounded-full flex items-center justify-center flex-shrink-0",N.iconBg),children:e.jsx(t,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:B}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:v}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-3",children:[e.jsxs($e,{size:"sm",className:"bg-[#051b42] cta-shine text-white text-xs",onClick:d,"data-testid":"support-banner-contact",children:[e.jsx(ut,{className:"w-3.5 h-3.5 mr-1.5"}),"Contact Support"]}),S?e.jsx($e,{size:"sm",variant:"ghost",className:"text-xs text-muted-foreground hover:text-foreground",onClick:()=>se(_=>!_),"data-testid":"support-banner-toggle-detail",children:k?e.jsxs(e.Fragment,{children:[e.jsx(gt,{className:"w-3.5 h-3.5 mr-1"}),"Hide details"]}):e.jsxs(e.Fragment,{children:[e.jsx(qe,{className:"w-3.5 h-3.5 mr-1"}),"Show details"]})}):null]}),S&&k?e.jsx("pre",{className:"mt-3 p-3 rounded-lg bg-muted/40 text-xs text-muted-foreground overflow-x-auto whitespace-pre-wrap break-all",children:S}):null]}),ue?e.jsx("button",{type:"button",onClick:ue,className:"text-muted-foreground hover:text-foreground transition-colors","aria-label":"Dismiss","data-testid":"support-banner-dismiss",children:e.jsx(Ye,{className:"w-4 h-4"})}):null]})})}const Bt=n=>`$${(n/100).toFixed(2)}`,_t=n=>({visa:"Visa",mastercard:"Mastercard",amex:"American Express","american-express":"American Express",discover:"Discover"})[n==null?void 0:n.toLowerCase()]??(n?n.charAt(0).toUpperCase()+n.slice(1):"Card"),Fe=n=>n?new Date(n).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):"—",Mt={paid:{label:"Paid",text:"#0EA57A"}
2,failed:{label:"Failed",text:"#EF4444"},trial:{label:"Trial started",text:"#B45309"},card_update:{label:"Card updated",text:"#051b42"}};function Dt({data:n,loading:B,failed:v,scale:i,fieldColor:S,isDark:ue,isDesktop:E,onCancel:k,cancelling:se,onCardUpdated:N,onPlanChanged:t}){var Te;const[d,_]=g.useState(!1),[P,le]=g.useState(!1),ne=g.useCallback(()=>{le(!1),Q(null)},[]),[ze,re]=g.useState(!1),[ge,xe]=g.useState(null),[oe,ye]=g.useState(null),[G,Q]=g.useState(null),[z,M]=g.useState(null),[$,be]=g.useState("monthly"),D=P&&(n==null?void 0:n.status)!=="canceled"&&(n==null?void 0:n.status)!=="cancelled";Ct(D);const{panelProps:Ee}=zt({open:D,onClose:ne,label:"Change plan"}),[je,Pe]=g.useState({}),V={fontSize:14*i,letterSpacing:`${-.56*i}px`,color:S},C="#051b42",T=E?{paddingLeft:32*i,paddingRight:28*i}:{paddingLeft:20,paddingRight:20},R={height:40*i,paddingInline:16*i,fontSize:12*i,letterSpacing:`${-.24*i}px`,background:"#fff",color:"#051b42",border:"1px solid rgba(5,27,66,0.12)"},Ae=s=>e.jsx("p",{className:"font-medium",style:{fontSize:20*i,letterSpacing:`${-.8*i}px`,color:S},children:s}),W=(s,m=!1)=>e.jsx("div",{className:"bg-card w-full overflow-hidden flex flex-col",style:{minHeight:120*i,...T,paddingBlock:24*i,gap:m?0:12*i,justifyContent:"center",alignItems:m?"center":"stretch"},children:s}),J=({title:s,action:m,children:u})=>e.jsxs("div",{className:"flex flex-col w-full",style:{gap:16*i},children:[e.jsxs("div",{className:"flex items-center justify-between w-full",style:{gap:12*i},children:[Ae(s),m]}),u]}),ce=(s,m,u,x,y)=>e.jsxs("div",{className:`flex items-center justify-between w-full ${y!=null&&y.onClick?"cursor-pointer":""}`,style:{gap:12*i},onClick:y==null?void 0:y.onClick,"data-testid":y==null?void 0:y.testId,children:[e.jsxs("div",{className:"flex items-center min-w-0",style:{gap:12*i},children:[e.jsx("span",{className:"shrink-0",style:{color:S,opacity:.7},children:s}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:x?"truncate":"",style:{fontSize:14*i,letterSpacing:`${-.56*i}px`,color:S},children:m}),u&&e.jsx("p",{className:x?"truncate":"",style:{fontSize:12*i,color:S,opacity:.6},children:u})]})]}),x&&e.jsx("div",{className:"flex items-center shrink-0",style:{gap:12*i},children:x})]});if(v)return e.jsx("div",{className:"bg-white border border-[rgba(5,27,66,0.1)]",style:{padding:24*i},"data-testid":"membership-error",children:e.jsx("p",{style:V,children:"We couldn't load your membership. Refresh, or contact [email protected]."})});if(B||!n)return e.jsx("div",{className:"bg-white border border-[rgba(5,27,66,0.1)]",style:{padding:24*i},children:e.jsxs("p",{className:"flex items-center",style:{...V,gap:8*i},children:[e.jsx(Ie,{className:"animate-spin",style:{width:16*i,height:16*i}})," Loading membership…"]})});const{cancelled:I,trialing:U,accessUntil:X}=Ve(n),Le=I?"Access ends":U?"First charge":"Renews",we=I||U?X:n.currentPeriodEnd,de=fe[n.tier]??n.tier,ve=Math.round((ke.peak.monthly*12-ke.peak.annual)/(ke.peak.monthly*12)*100),F=async s=>{if(ge===s)return xe(null);if(xe(s),je[s])return;const m=await fetch(`/api/wizlo-pay/membership/charges/${s}`,{credentials:"include"});if(!m.ok)return;const u=await m.json();Pe(x=>({...x,[s]:u}))};return e.jsxs("div",{className:"w-full font-inter flex flex-col",style:{gap:56*i},"data-testid":"membership-panel",children:[e.jsxs("div",{className:"bg-[#051b42] w-full overflow-hidden flex flex-col lg:flex-row lg:items-center lg:justify-between !border-0",style:{minHeight:120*i,...T,paddingBlock:24*i,gap:24*i},children:[e.jsxs("div",{className:"flex flex-col",style:{gap:12*i},children:[e.jsxs("p",{className:"font-medium",style:{fontSize:20*i,letterSpacing:`${-.8*i}px`,color:"#fff"},children:[de,U?" · Trial":I?" · Cancelled":""]}),e.jsxs("p",{style:{fontSize:14*i,letterSpacing:`${-.56*i}px`,color:"#fff"},children:["$",n.priceDollars,"/",n.period==="annual"?"yr":"mo"," · ",Le," ",Fe(we)]})]}),!I&&e.jsx("div",{className:"flex flex-col sm:flex-row sm:flex-wrap",style:{gap:12*i},children:d?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:k,disabled:se,"data-testid":"confirm-cancel-membership",className:"flex items-center justify-center w-full sm:w-auto 
2sm:flex-1 lg:flex-none min-w-0 disabled:opacity-70",style:{...R,border:`${Math.max(2*i,2)}px solid #051b42`},children:se?e.jsx(Ie,{className:"animate-spin",style:{width:16*i,height:16*i}}):"Yes, cancel"}),e.jsx("button",{onClick:()=>_(!1),className:"flex items-center justify-center w-full sm:w-auto sm:flex-1 lg:flex-none min-w-0",style:R,children:"Keep membership"})]}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{be(n.period),le(s=>!s)},"data-testid":"adjust-plan",className:"flex items-center justify-center w-full sm:w-auto sm:flex-1 lg:flex-none min-w-0",style:R,children:"Adjust plan"}),e.jsx("button",{onClick:()=>_(!0),"data-testid":"cancel-membership",className:"flex items-center justify-center w-full sm:w-auto sm:flex-1 lg:flex-none min-w-0",style:R,children:"Cancel membership"})]})})]}),d&&!I&&e.jsx("div",{className:"bg-white border border-[rgba(5,27,66,0.1)]",style:{padding:24*i},children:e.jsxs("p",{style:V,children:["You'll keep ",de," access until ",Fe(n.currentPeriodEnd),", and nothing is charged after that."]})}),I&&e.jsx("div",{className:"bg-white border border-[rgba(5,27,66,0.1)]",style:{padding:24*i},children:e.jsxs("p",{style:V,children:["Your membership is cancelled. You keep access until ",Fe(n.currentPeriodEnd),"."]})}),P&&!I&&Je.createPortal(e.jsx(Lt,{children:e.jsx(Oe.div,{className:"fixed inset-0 z-[1100] overflow-y-auto",style:{background:"rgba(5,27,66,0.35)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)"},initial:{opacity:0}
2,animate:{opacity:1},exit:{opacity:0},onClick:ne,"data-scroll-container":"true","data-testid":"plan-switcher-overlay",children:e.jsx("div",{className:"flex min-h-full items-center justify-center",style:{padding:E?24*i:16},children:e.jsxs(Oe.div,{className:"dashboard-light relative bg-[#f4f8ff] font-inter w-full overflow-hidden",style:{maxWidth:E?913*i:void 0},initial:{y:24,opacity:0},animate:{y:0,opacity:1},exit:{y:24,opacity:0},transition:{type:"spring",damping:30,stiffness:300},onClick:s=>s.stopPropagation(),"data-testid":"plan-switcher-sheet",...Ee,children:[e.jsxs("button",{onClick:ne,className:"flex items-center",style:{gap:10*i,paddingLeft:20*i,paddingRight:10*i,paddingTop:20*i,paddingBottom:10*i},"data-testid":"button-close-plan-switcher",children:[e.jsx(xt,{style:{width:24*i,height:24*i,color:C}}),e.jsx("span",{style:{fontSize:20*i,letterSpacing:`${-.8*i}px`,color:C},children:"Back"})]}),e.jsxs("div",{className:"flex flex-col",style:{paddingInline:E?40*i:20,paddingTop:E?24*i:32,paddingBottom:E?40*i:48,gap:E?28*i:32},children:[e.jsxs("div",{className:"flex flex-col items-center lg:items-start",style:{gap:8*i},children:[e.jsx("p",{className:"font-medium text-center lg:text-left",style:{fontSize:24*i,letterSpacing:`${-.96*i}px`,color:C},children:"Choose your plan"}),e.jsx("p",{className:"text-center lg:text-left",style:{fontSize:18*i,letterSpacing:`${-.72*i}px`,color:C},children:"Switching charges the card already on file"})]}),e.jsx("div",{className:"flex flex-wrap items-center",style:{gap:8*i},children:["monthly","annual"].map(s=>{const m=$===s;return e.jsx("button",{type:"button",onClick:()=>be(s),className:"capitalize transition-colors",style:{fontSize:12*i,letterSpacing:`${-.48*i}px`,padding:`${8*i}px ${16*i}px`,border:`1px solid ${m?C:"rgba(5,27,66,0.1)"}`,background:m?C:"#fff",color:m?"#fff":C},"data-testid":`switch-period-${s}`,children:s==="annual"?`Annual · Save ${ve}%`:"Monthly"},s)})}),e.jsx("div",{className:"flex flex-col sm:flex-row sm:items-stretch",children:["protocol","peak"].map(s=>{var O,Z;const m=((O=ke[s])==null?void 0:O[$])>0?$:"monthly",u=s===n.tier&&m===n.period,x=((Z=ke[s])==null?void 0:Z[m])??0,y=s==="peak",j=y?"#ffffff":C,L=oe===s,H=s==="peak"?_e:Me;return e.jsxs("div",{className:`relative flex flex-1 flex-col justify-between ${y?"bg-[#051b42] !border-0":"bg-white"}`,style:{padding:E?32*i:20,gap:28*i},"data-testid":`plan-option-${s}`,children:[u&&e.jsx("span",{className:"absolute",style:{right:E?32*i:20,top:E?32*i:20,fontSize:12*i,letterSpacing:`${-.24*i}px`,color:j,background:y?"rgba(255,255,255,0.15)":"rgba(5,27,66,0.08)",padding:"4px 10px"},children:"Current plan"}),e.jsxs("div",{className:"flex flex-col",style:{gap:24*i,color:j},children:[e.jsxs("div",{className:"flex flex-col",style:{gap:4*i},children:[e.jsx("p",{style:{fontSize:20*i,letterSpacing:`${-.8*i}px`,fontWeight:500},children:fe[s]}),e.jsx("p",{style:{fontSize:16*i,letterSpacing:`${-.64*i}px`},children:s==="protocol"?"Atlas + Health Score on your existing labs":"Full system + group coaching · clinician-supervised"})]}),e.jsxs("div",{className:"flex flex-col",style:{gap:4*i},children:[e.jsxs("p",{style:{fontSize:40*i,letterSpacing:`${-1.6*i}px`,fontWeight:500},children:["$",x,"/",m==="annual"?"yr":"mo"]}),e.jsx("p",{style:{fontSize:16*i,letterSpacing:`${-.64*i}px`},children:$==="annual"&&m==="monthly"?"Monthly only":s==="protocol"?"After your free trial. Cancel anytime.":`Billed ${m==="annual"?"annually":"monthly"}`})]}),e.jsx("div",{className:"flex w-full flex-col",style:{gap:10*i},children:H.map(q=>e.jsxs("div",{className:"flex w-full items-center",style:{gap:4*i},children:[e.jsx(Ce,{className:"shrink-0",style:{width:20*i,height:20*i,color:j},strokeWidth:2}),e.jsx("p",{style:{fontSize:14*i,letterSpacing:`${-.56*i}px`,color:j},children:q})]},q))})]}),e.jsx("button",{type:"button",disabled:u||L,onClick:()=>{M({tier:s,period:m,price:x}),Q(null)},className:"flex w-full items-center justify-center transition hover:opacity-90 disabled:opacity-60",style:{height:48*i,fontSize:14*i,letterSpacing:`${-.56*i}px`,fontWeight:500,background:y?"#fff":C,color:y?C:"#fff",border:"1px solid rgba(255,255,255,0.12)"},"data-testid":`switch-to-${s}`,children:L?e.jsx(Ie,{className:"w-4 h-4 animate-spin"}):u?"Your current plan":`${y?"Upgrade to":"Switch to"} ${fe[s]}`})]},s)})}),z&&(()=>
2{const s=z.tier==="peak",m=s?Me:_e,u=s?_e:Me,x=j=>!/^Everything in /i.test(j),y=(s?u.filter(j=>!m.includes(j)):m.filter(j=>!u.includes(j))).filter(x);return e.jsxs("div",{className:"bg-white flex flex-col",style:{padding:24*i,gap:16*i},"data-testid":"switch-confirm",children:[e.jsxs("div",{className:"flex flex-col",style:{gap:8*i},children:[e.jsxs("p",{className:"font-medium",style:{fontSize:20*i,letterSpacing:`${-.8*i}px`,color:C},children:[s?"Upgrade to":"Switch to"," ",fe[z.tier]]}),e.jsxs("p",{style:{fontSize:14*i,letterSpacing:`${-.56*i}px`,color:"rgba(5,27,66,0.6)"},children:["You'll be charged $",z.price," today and your billing date restarts."]})]}),y.length>0&&e.jsxs("div",{className:"flex flex-col",style:{gap:10*i},children:[e.jsx("p",{className:"font-medium",style:{fontSize:14*i,letterSpacing:`${-.56*i}px`,color:C},children:s?"What you gain":"What you give up"}),y.map(j=>e.jsxs("div",{className:"flex items-start",style:{gap:8*i,background:s?"#f4f8ff":"rgba(180,35,24,0.06)",padding:`${10*i}px ${12*i}px`},children:[s?e.jsx(Ce,{className:"shrink-0",style:{width:18*i,height:18*i,color:C},strokeWidth:2}):e.jsx(Ye,{className:"shrink-0",style:{width:18*i,height:18*i,color:"#b42318"},strokeWidth:2}),e.jsx("span",{style:{fontSize:14*i,letterSpacing:`${-.56*i}px`,color:C},children:j})]},j))]}),e.jsxs("div",{className:"flex flex-col sm:flex-row",style:{gap:12*i},children:[e.jsx("button",{onClick:async()=>{ye(z.tier),Q(null);try{const j=await fetch("/api/wizlo-pay/membership/change-plan",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({tier:z.tier,period:z.period})}),L=await j.json();if(!j.ok){const H=L.error==="card_not_ready"?"Your saved card isn't ready to charge yet. Update your payment method and try again.":L.error==="no_card_on_file"?"No card on file. Add one under Payment method first.":L.error==="charge_failed"?"Your card was declined. Update your payment method and try again.":L.error||"Could not switch plan";throw new Error(H)}M(null),le(!1),t()}catch(j){Q(j instanceof Error?j.message:"Could not switch plan")}finally{ye(null)}},disabled:!!oe,className:"flex w-full sm:w-auto items-center justify-center bg-[#051b42] text-white !border-0 hover:opacity-90 disabled:opacity-70",style:{height:48*i,paddingInline:24*i,fontSize:14*i,letterSpacing:`${-.56*i}px`,fontWeight:500},"data-testid":"confirm-switch",children:oe?e.jsx(Ie,{className:"animate-spin",style:{width:18*i,height:18*i}}):`Confirm · $${z.price}`}),e.jsxs("button",{onClick:()=>{M(null),Q(null)},className:"flex w-full sm:w-auto items-center justify-center",style:{height:48*i,paddingInline:24*i,fontSize:14*i,letterSpacing:`${-.56*i}px`,background:"#fff",color:C,border:"1px solid rgba(5,27,66,0.12)"},children:["Keep ",de]})]})]})})(),G&&e.jsx("p",{style:{fontSize:14*i,letterSpacing:`${-.56*i}px`,color:"#b42318"},children:G}),e.jsx("p",{style:{fontSize:12*i,letterSpacing:`${-.48*i}px`,color:"rgba(5,27,66,0.5)"},children:"You're charged the new plan today and your billing date restarts. No refund is issued for the remainder of the current period."})]})]})})})}),document.body),e.jsx(J,{title:"Payment method",children:W(ze?e.jsxs(e.Fragment,{children:[e.jsx("p",{style:{fontSize:12*i,color:S,opacity:.6},children:"Your card is verified and saved. No charge is taken."}),e.jsx(Et,{elementId:"membership-card-update",tokenUrl:"/api/wizlo-pay/membership/embed-token",tokenBody:{tier:n.tier,period:n.period,mode:"update-card"},recurring:!0,addOnly:!0,ctaLabel:"Save card",onConfirm:async s=>{const m=await fetch("/api/wizlo-pay/membership/confirm",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({transactionId:s})}),u=await m.json();if(!m.ok)throw new Error(u.error||"Could not save the card");return u},onSuccess:()=>{re(!1),N()}}),e.jsx("button",{onClick:()=>re(!1),className:"self-start flex items-center justify-center",style:R,children:"Cancel"})]}):ce(e.jsx(De,{style:{width:20*i,height:20*i}}),n.paymentMethod?`${_t(n.paymentMethod.scheme)} •••• ${n.paymentMethod.last4}`:"No card on file",(Te=n.paymentMethod)!=null&&Te.expiry?`Expires ${n.paymentMethod.expiry}`:"Add a card to keep your membership active",e.jsx("button",{onClick:()=>re(!0),className:"flex items-center justify-center shrink-0 bg-[#051b42] border border-[rgba(5,27,66,0.12)] text-white capitalize",style:{height:36*i,width:E?157*i:void 0,paddingInline:E?void 0:16,fontSize:14*i,letterSpacing:`${-.28*i}px`},"data-testid":"update-payment-method",children:n.paymentMethod?"Update":"Add card"}),{testId:"saved-card"}))}),n.features.length>0&&e.jsx(J,{title:"Benefits",children:W(n.features.map(s=>e.jsx("div",{children:ce(e.jsx(Ce,{style:{width:20*i,height:20*i},strokeWidth:2}),s,"")},s)))}),e.jsx(J,{title:"Billing history",children:n.charges.filter(s=>
2s.status!=="card_update").length===0?W(e.jsx("p",{style:{fontSize:14*i,letterSpacing:`${-.56*i}px`,color:S},children:"No charges yet."}),!0):W(n.charges.filter(s=>s.status!=="card_update").map((s,m)=>{var H,O,Z,q;const u=s.gr4vy_transaction_id,x=u?je[u]:void 0,y=Mt[s.status]??{label:s.status,text:S},j=!!u&&ge===u,L=s.status==="card_update"?De:yt;return e.jsxs("div",{className:"flex flex-col",style:{gap:10*i},children:[ce(e.jsx(L,{style:{width:20*i,height:20*i}}),`${fe[s.tier]??s.tier} · ${s.period==="annual"?"Annual":"Monthly"}`,`${Fe(s.created_at)}${s.status==="paid"?` · ${Bt(s.amount_cents)}`:""}`,e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"capitalize",style:{fontSize:12*i,color:y.text},children:y.label}),u&&(j?e.jsx(qe,{style:{width:16*i,height:16*i,color:S,opacity:.6}}):e.jsx(Ke,{style:{width:16*i,height:16*i,color:S,opacity:.6}}))]}),{onClick:u?()=>F(u):void 0,testId:`charge-${m}`}),j&&e.jsx("div",{className:"flex flex-col",style:{gap:10*i,paddingLeft:32*i,paddingBottom:4*i},children:x?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col",style:{gap:6*i},children:[["Transaction",x.transactionId],["Gateway status",x.gatewayStatus],["Billed to",(H=x.billing)==null?void 0:H.name],["Email",(O=x.billing)==null?void 0:O.email],["Address",(q=(Z=x.billing)==null?void 0:Z.address)!=null&&q.city?[x.billing.address.line1,x.billing.address.city,x.billing.address.state,x.billing.address.postalCode].filter(Boolean).join(", "):null]].filter(([,a])=>!!a).map(([a,p])=>e.jsxs("div",{className:"flex flex-wrap",style:{gap:8*i},children:[e.jsx("span",{style:{fontSize:12*i,color:S,opacity:.6,minWidth:110*i},children:a}),e.jsx("span",{className:"min-w-0 break-all",style:{fontSize:12*i,color:S},children:p})]},a))}),e.jsx("a",{href:`/api/wizlo-pay/membership/charges/${x.transactionId}/invoice.pdf`,target:"_blank",rel:"noreferrer",className:"flex items-center justify-center self-start",style:{height:36*i,paddingInline:16*i,fontSize:14*i,letterSpacing:`${-.28*i}px`,background:"#fff",color:C,border:"1px solid rgba(5,27,66,0.12)"},"data-testid":"download-invoice",children:"Download invoice"})]}):e.jsx("span",{style:{fontSize:12*i,color:S,opacity:.6},children:"Loading details…"})})]},u??m)}))})]})}const Rt={oura:"Oura Ring",whoop:"WHOOP","eight-sleep":"Eight Sleep",eight_sleep:"Eight Sleep","apple-health":"Apple Health",apple_health:"Apple Health",dexcom:"Dexcom",libre:"Freestyle Libre"},Wt=[{key:"personal",label:"Personal Information",short:"Personal"},{key:"address",label:"Billing Address",short:"Address"},{key:"body",label:"Body Parameters",short:"Body"}],Ut={heightFeet:"",heightInches:"",weight:"",exerciseLevel:"",sleepHours:"",stressLevel:"",dietType:""},Ht=[{key:"profile",label:"Profile",iconSrc:"/images/figma/icons/tab-profile.svg"},{key:"membership",label:"Membership",iconSrc:"/images/figma/icons/tab-membership.svg"},{key:"history",label:"History",iconSrc:"/images/figma/icons/tab-history.svg"},{key:"integrations",label:"Integrations",iconSrc:"/images/figma/icons/tab-integrations.svg"},{key:"memory",label:"Atlas Memory",icon:e.jsx(Qe,{className:"w-5 h-5"})}],Ot=[{id:"oura",name:"Oura Ring",icon:e.jsx(me,{className:"w-6 h-6"})},{id:"whoop_v2",name:"WHOOP",icon:e.jsx(K,{className:"w-6 h-6"})},{id:"fitbit",name:"Fitbit",icon:e.jsx(me,{className:"w-6 h-6"})},{id:"garmin",name:"Garmin",icon:e.jsx(me,{className:"w-6 h-6"})},{id:"google_fit",name:"Google Fit",icon:e.jsx(K,{className:"w-6 h-6"})},{id:"google_health",name:"Google Health",icon:e.jsx(K,{className:"w-6 h-6"})},{id:"polar",name:"Polar",icon:e.jsx(me,{className:"w-6 h-6"})},{id:"withings",name:"Withings",icon:e.jsx(me,{className:"w-6 h-6"})},{id:"wahoo",name:"Wahoo",icon:e.jsx(K,{className:"w-6 h-6"})},{id:"ultrahuman",name:"Ultrahuman",icon:e.jsx(me,{className:"w-6 h-6"})},{id:"cronometer",name:"Cronometer",icon:e.jsx(Ge,{className:"w-6 h-6"})},{id:"omron",name:"Omron",icon:e.jsx(wt,{className:"w-6 h-6"})},{id:"peloton",name:"Peloton",icon:e.jsx(K,{className:"w-6 h-6"})},{id:"zwift",name:"Zwift",icon:e.jsx(K,{className:"w-6 h-6"})},{id:"hammerhead",name:"Hammerhead",icon:e.jsx(K,{className:"w-6 h-6"})},{id:"beurer_api",name:"Beurer",icon:e.jsx(vt,{className:"w-6 h-6"})},{id:"freestyle_libre",name:"FreeStyle Libre",icon:e.jsx(St,{className:"w-6 h-6"})}],qt=new Set(["whoop","eight-sleep","eight_sleep","apple-health","apple_health_kit","dexcom"]);function ji(){var q;const[n,B]=g.useState("profile"),{user:v}=Ze(),{toast:i}=et(),{theme:S,setTheme:ue,resolvedTheme:E}=tt(),k=E==="dark",{scale:se,isDesktop:N}=it(),t=N?se:1,d=k?"#e8ecf0":"#051b42",_=k?"rgba(255,255,255,0.05)":"rgba(5,27,66,0.05)",P=ct(),[le,ne]=g.useState(""),[ze,re]=g.useState(""),[ge,xe]=g.useState(""),[oe,ye]=g.useState(""),[G,Q]=g.useState("personal"),[z,M]=g.useState(He),[$,be]=g.useState(Ut),[D,Ee]=g.useState(null);g.useEffect(()=>{const a=new URLSearchParams(window.location.search).get("tab");a&&["profile","membership","history","integrations","memory"].includes(a)&&B(a)},[]),g.useEffect(()=>{const a=new URLSearchParams(window.location.search),p=a.get("wearable_error")||(a.get("state")==="error"?a.get("error_type")||"connection_failed":null);if(!p)return;const l=a.get("provider")||"";Ee({provider:l,providerLabel:Rt[l]||l||"your wearable",errorCode:p,detail:a.get("detail")||a.get("error")||void 0}),B("integrations"),["wearable_error","provider","detail","state","error_type","error","connected"].forEach(h=>a.delete(h));const f=a.toString(),c=window.location.pathname+(f?`?${f}`:"")+window.location.hash;window.history.replaceState({},"",c)},[]),g.useEffect(()=>{if(v){ne(v.firstName||""),re(v.lastName||""),xe(v.dateOfBirth||""),ye(at(v.sex));const a=v.billingAddress;M({...He,...a??{}})}},[v]);const je=pe({mutationFn:async()=>Y("PATCH","/api/user/profile",{firstName:le,lastName:ze,dateOfBirth:ge,biologicalSex:oe}),onSuccess:()=>{i({title:"Profile updated",description:"Your changes have been saved."}),P.invalidateQueries({queryKey:["/api/auth/user"]})},onError:()=>{i({title:"Error",description:"Failed to save changes. Try again.",variant:"destructive"})}}),Pe=pe({mutationFn:async()=>Y("PATCH","/api/user/profile",{billingAddress:z}),onSuccess:()=>{i({title:"Billing address saved",description:"Checkout will use it from now on."}),P.invalidateQueries({queryKey:["/api/auth/user"]})},onError:a=>{const l=(a instanceof Error?a.message:"").match(/\{.*\}$/);let f="Failed to save your address. Try again.";try{f=l?JSON.parse(l[0]).message??f:f}catch{}i({title:"Address not saved",description:f,variant:"destructive"})}}),V=he({queryKey:["/api/onboarding/profile"],enabled:n==="profile",queryFn:async()=>{const a=await fetch("/api/onboarding/profile",{credentials:"include"});return a.ok?a.json():null}});g.useEffect(()=>{const a=V.data;if(!a)return;const p=l=>l==null?"":String(l);be({heightFeet:p(a.heightFeet),heightInches:p(a.heightInches),weight:p(a.weight),exerciseLevel:p(a.exerciseLevel),sleepHours:p(a.sleepHours),stressLevel:p(a.stressLevel),dietType:p(a.dietType)})},[V.data]);const C=pe({mutationFn:async()=>{const a=l=>{const f=Number(l.trim());return l.trim()===""||!Number.isFinite(f)?void 0:f},p=l=>l.trim()===""?void 0:l;return Y("PATCH","/api/onboarding",{stepData:{heightFeet:a($.heightFeet),heightInches:a($.heightInches),weight:a($.weight),exerciseLevel:p($.exerciseLevel),sleepHours:p($.sleepHours),stressLevel:p($.stressLevel),dietType:p($.dietType)}})},onSuccess:()=>{i({title:"Body parameters saved",description:"Atlas will use these going forward."}),P.invalidateQueries({queryKey:["/api/onboarding/profile"]})},onError:()=>i({title:"Error",description:"Failed to save. Try again.",variant:"destructive"})}),T=he({queryKey:["/api/wizlo-pay/membership"],enabled:n==="membership",queryFn:async()=>{const a=await fetch("/api/wizlo-pay/membership",{credentials:"include"});if(!a.ok&&a.status!==304)throw new Error("Could not load membership");return a.json()}}),R=pe({mutationFn:async()=>(await Y("POST","/api/wizlo-pay/membership/cancel")).json(),onSuccess:a=>{i({title:"Membership cancelled",description:a!=null&&a.cancelAt?`You keep access until ${new Date(a.cancelAt).toLocaleDateString()}.`:"You keep access until the end of your billing period."}),P.invalidateQueries({queryKey:["/api/wizlo-pay/membership"]}),P.invalidateQueries({queryKey:["/api/auth/user"]})},onError:()=>i({title:"Couldn't cancel",description:"Please contact [email protected].",variant:"destructive"})}),Ae=he({queryKey:["/api/labs/uploads"],enabled:n==="history",queryFn:async()=>{const a=await fetch("/api/labs/uploads",{credentials:"include"});return a.ok?a.json():[]}}),W=he({queryKey:["/api/activity"],enabled:n==="history",queryFn:async()=>{const a=await fetch("/api/activity",{credentials:"include"});return a.ok?a.json():[]}}),J=he({queryKey:["/api/wearables/connections"],enabled:n==="integrations",queryFn:async()=>{const a=await fetch("/api/wearables/connections",{credentials:"include"});return a.ok?a.json():{connections:[]}},retry:!1}),ce=he({queryKey:["/api/advisor/memory"],enabled:n==="memory",queryFn:async()=>{const a=await fetch("/api/advisor/memory",{credentials:"include"});return a.ok?a.json():[]}}),[I,U]=g.useState(null),[X,Le]=g.useState(""),we=pe({mutationFn:async({id:a,fact:p})=>Y("PATCH",`/api/advisor/memory/${a}`,{fact:p}),onSuccess:()=>{U(null),P.invalidateQueries({queryKey:["/api/advisor/memory"]}),i({title:"Memory updated"})},onError:()=>i({title:"Couldn't update that memory",variant:"destructive"})}),de=pe({mutationFn:async a=>Y("DELETE",`/api/advisor/memory/${a}`),onSuccess:()=>{P.invalidateQueries({queryKey:["/api/advisor/memory"]}),i({title:"Memory removed",description:"Atlas will no longer reference it."})},onError:()=>i({title:"Couldn't remove that memory",variant:"destructive"})}),ve=Nt(v==null?void 0:v.subscriptionTier),F=((v==null?void 0:v.subscriptionStatus)||"").toLowerCase(),Te=new Set(["canceled","cancelled","read_only"]),s=kt(ve)&&!Te.has(F),m=F==="trialing",u=F==="past_due",x=fe[ve],y=Array.isArray(J.data)?J.data:((q=J.data)==null?void 0:q.connections)||[],j=new Map(y.map(a=>[a.provider,a])),L=y.filter(a=>(a==null?void 0:a.isActive)!==!1&&!qt.has(a.provider)),H=new Set(Ot.map(a=>a.id));L.filter(a=>!H.has(a.provider));const O=async a=>{try{const l=await(await Y("POST","/api/wearables/junction/link-token",a?{provider:a}:{})).json(),f=l.oauthUrl||l.linkWebUrl;if(f){window.location.href=f;return}i({title:"Couldn't start",description:l.message||"Please try again.",variant:"destructive"})}catch{i({title:"Error",description:"Failed to start the connection flow.",variant:"destructive"})}},Z="bg-background border-border text-foreground placeholder:text-muted-foreground
2/50";return e.jsxs(e.Fragment,{children:[e.jsx(Xe,{children:e.jsx("title",{children:"Settings | FITSCRIPT"})}),e.jsxs(dt,{maxWidth:"full",children:[e.jsx("div",{className:"flex items-center border-b border-[rgba(0,0,0,0.1)] w-fit max-w-full overflow-x-auto font-inter",style:{gap:12*t,marginBottom:40*t},children:Ht.map(a=>{const p=n===a.key;return e.jsxs("button",{onClick:()=>B(a.key),"data-testid":`settings-tab-${a.key}`,className:"flex items-center border-b whitespace-nowrap transition-colors",style:{gap:8*t,padding:12*t,borderColor:p?"#051b42":"transparent"},children:[a.iconSrc?e.jsx("img",{src:a.iconSrc,alt:"",style:{width:20*t,height:20*t,filter:k?"invert(1)":"none"}}):e.jsx("span",{style:{width:20*t,height:20*t,color:k?"#e8ecf0":"#051b42",display:"inline-flex"},children:a.icon}),e.jsx("span",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:k?"#e8ecf0":"#051b42"},children:a.label})]},a.key)})}),D&&e.jsx("div",{className:"mb-4",children:e.jsx(Ft,{variant:"error",title:`Couldn't connect ${D.providerLabel}`,message:"Something went wrong on our end finishing the connection. Try again, and if it keeps failing, our team will sort it out for you.",context:`wearable-connect:${D.provider||"unknown"}:${D.errorCode}`,detail:D.detail,onDismiss:()=>Ee(null)})}),u&&e.jsxs("div",{className:"mb-4 p-4 rounded-xl bg-red-500/10 border border-red-500/30 flex items-center gap-3",children:[e.jsx(De,{className:"w-5 h-5 text-red-400 flex-shrink-0"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-red-400",children:"Payment failed"}),e.jsx("p",{className:"text-xs text-red-400/70",children:"Your last payment didn't go through. Update your billing info to keep your membership active."})]}),e.jsx($e,{size:"sm",variant:"outline",className:"border-red-400/30 text-red-400 hover:bg-red-400/10 text-xs",onClick:()=>{window.location.href="/pricing"},children:"Update Billing"})]}),n==="profile"&&(()=>{const a=k?"#e8ecf0":"#051b42",l={background:k?"rgba(255,255,255,0.05)":"rgba(5,27,66,0.05)",color:a,backdropFilter:"blur(6.8px)",height:48*t,paddingInline:16*t,fontSize:14*t,fontWeight:500,letterSpacing:`${-.56*t}px`},f={color:a,fontSize:12*t,letterSpacing:`${-.48*t}px`},c=(o,b)=>e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",style:{gap:10*t},children:[e.jsx("label",{style:f,children:o}),b]}),h="w-full outline-none placeholder:opacity-50",r=(...o)=>e.jsx("div",{className:"flex flex-col sm:flex-row w-full",style:{gap:16*t},children:o.map((b,A)=>e.jsx(g.Fragment,{children:b},A))}),w=(o,b,A,Se,Be)=>e.jsxs("select",{className:h,style:l,value:o,onChange:Ne=>b(Ne.target.value),"data-testid":Be,children:[e.jsx("option",{value:"",children:Se}),A.map(Ne=>e.jsx("option",{value:Ne,children:Ne},Ne))]}),ee=(o,b,A,Se)=>e.jsx("button",{onClick:b,disabled:A,className:"flex items-center justify-center max-w-full bg-[#051b42] border border-[rgba(5,27,66,0.12)] text-white capitalize disabled:opacity-70",style:{height:36*t,width:220*t,fontSize:12*t,letterSpacing:`${-.24*t}px`},"data-testid":Se,children:A?"Saving...":o}),te=(o,b,A,Se,Be)=>e.jsxs("div",{className:"bg-card w-full font-inter flex flex-col",style:{gap:32*t,padding:24*t},"data-testid":Be,children:[e.jsxs("div",{className:"flex flex-col",style:{gap:8*t,maxWidth:576*t},children:[e.jsx("p",{className:"font-medium",style:{fontSize:20*t,letterSpacing:`${-.8*t}px`,color:k?"#fff":"#000"},children:o}),e.jsx("p",{style:{fontSize:12*t,letterSpacing:`${-.48*t}px`,color:a,opacity:.85},children:b})]}),e.jsx("div",{className:"flex flex-col w-full",style:{gap:24*t},children:A}),Se]}),ie=o=>b=>M(A=>({...A,[o]:b.target.value})),ae=o=>b=>be(A=>({...A,[o]:b}));return e.jsxs("div",{className:"w-full font-inter flex flex-col",style:{gap:24*t},children:[e.jsx("div",{className:"bg-card w-full",style:{padding:12*t},children:e.jsx("div",{className:"grid grid-cols-3",style:{background:_},"data-testid":"profile-subtabs",children:Wt.map(o=>{const b=G===o.key;return e.jsxs("button",{onClick:()=>Q(o.key),className:"flex items-center justify-center text-center transition-colors",style:{paddingBlock:12*t,paddingInline:8*t,fontSize:14*t,letterSpacing:`${-.56*t}px`,background:b?"#051b42":"transparent",color:b?"#fff":a},"data-testid":`profile-subtab-${o.key}`,children:[e.jsx("span",{className:"sm:hidden",children:o.short}),e.jsx("span",{className:"hidden sm:inline",children:o.label})]},o.key)})})}),G==="personal"&&te("Personal Information","Optional details about your lab work",e.jsxs(e.Fragment,{children:[r(c("First Name",e.jsx("input",{className:h,style:l,placeholder:"Enter your first name",value:le,onChange:o=>ne(o.target.value),"data-testid":"input-first-name"})),c("Last Name",e.jsx("input",{className:h,style:l,placeholder:"Enter your last name",value:ze,onChange:o=>re(o.target.value),"data-testid":"input-last-name"}))),r(c("Email",e.jsx("input",{className:h,style:{...l,opacity:.7},value:(v==null?void 0:v.email)||"",readOnly:!0,disabled:!0,placeholder:"Enter your email address"})),c("Date of Birth",e.jsx("input",{className:h,style:l,type:"date",value:ge,onChange:o=>xe(o.target.value),"data-testid":"input-dob"}))),e.jsxs("div",{className:"flex flex-col",style:{gap:10*t},children:[e.jsx("label",{style:f,children:"Biological Sex"}),e.jsx("div",{className:"flex",style:{gap:10*t},children:["male","female"].map(o=>e.jsxs("button",{onClick:()=>ye(o),className:"flex items-center",style:{gap:4*t},"data-testid":`sex-${o}`,children:[e.jsx("img",{src:oe===o?"/images/figma/icons/radio-on.svg":"/images/figma/icons/radio-off.svg",alt:"",style:{width:16*t,height:16*t,filter:k?"invert(1)":"none"}}),e.jsx("span",{style:{fontSize:12*t,letterSpacing:`${-.24*t}px`,color:a},children:o.charAt(0).toUpperCase()+o.slice(1)})]},o))})]})]}),ee("Save Changes",()=>je.mutate(),je.isPending,"button-save-profile"),"profile-card"),G==="address"&&te("Billing Address","Used to ship your labs, supplements, and prescriptions. Parcels go to the name under Personal Information.",e.jsxs(e.Fragment,{children:[c("Phone",e.jsx("input",{className:h,style:l,type:"tel",inputMode:"tel",placeholder:"(555) 555-5555",value:z.phone,onChange:ie("phone"),"data-testid":"input-addr-phone"})),c("Address",e.jsx(Pt,{inputClassName:h,inputStyle:l,value:z.line1,onChange:o=>M(b=>({...b,line1:o})),onSelect:o=>M(b=>({...b,line1:o.line1||b.line1,line2:o.line2||b.line2,city:o.city||b.city,state:o.state||b.state,zip:o.zip||b.zip}))}
2)),c("Apt, suite, etc. (optional)",e.jsx("input",{className:h,style:l,placeholder:"Apartment, suite, unit",value:z.line2,onChange:ie("line2"),"data-testid":"input-addr-line2"})),r(c("City",e.jsx("input",{className:h,style:l,placeholder:"Enter your city",value:z.city,onChange:ie("city"),"data-testid":"input-addr-city"})),c("State",e.jsxs("select",{className:h,style:l,value:z.state,onChange:ie("state"),"data-testid":"select-addr-state",children:[e.jsx("option",{value:"",children:"Select"}),At.map(o=>e.jsx("option",{value:o,children:o},o))]}))),r(c("ZIP Code",e.jsx("input",{className:h,style:l,inputMode:"numeric",placeholder:"Enter your ZIP code",value:z.zip,onChange:ie("zip"),"data-testid":"input-addr-zip"})),c("Country",e.jsx("input",{className:h,style:{...l,opacity:.7},value:z.country,readOnly:!0,disabled:!0})))]}),ee("Save Address",()=>Pe.mutate(),Pe.isPending,"button-save-address"),"address-card"),G==="body"&&te("Body Parameters","The height, weight, and lifestyle answers Atlas reads alongside your labs",e.jsxs(e.Fragment,{children:[r(c("Height (feet)",e.jsx("input",{className:h,style:l,inputMode:"numeric",placeholder:"5",value:$.heightFeet,onChange:o=>ae("heightFeet")(o.target.value),"data-testid":"input-height-feet"})),c("Height (inches)",e.jsx("input",{className:h,style:l,inputMode:"numeric",placeholder:"10",value:$.heightInches,onChange:o=>ae("heightInches")(o.target.value),"data-testid":"input-height-inches"}))),r(c("Weight (lbs)",e.jsx("input",{className:h,style:l,inputMode:"numeric",placeholder:"185",value:$.weight,onChange:o=>ae("weight")(o.target.value),"data-testid":"input-weight"})),c("Exercise per week",w($.exerciseLevel,ae("exerciseLevel"),lt,"Select","select-exercise-level"))),r(c("Sleep quality",w($.sleepHours,ae("sleepHours"),rt,"Select","select-sleep-quality")),c("Stress level",w($.stressLevel,ae("stressLevel"),nt,"Select","select-stress-level"))),c("Diet",w($.dietType,ae("dietType"),ot,"Select","select-diet-type"))]}),ee("Save Parameters",()=>C.mutate(),C.isPending,"button-save-body-params"),"body-params-card")]})})(),n==="membership"&&(()=>{var c,h,r;const a=((c=T.data)==null?void 0:c.trialEligible)!==!1,p=Ve({status:F,tier:ve,trialEndsAt:((h=T.data)==null?void 0:h.trialEndsAt)??null,currentPeriodEnd:((r=T.data)==null?void 0:r.currentPeriodEnd)??null}),l=p.keepsAccess?$t(p.accessUntil):null,f=s?`${x}${m?": Trial active":": Active"}`:F==="canceled"||F==="cancelled"?l?`Your subscription has been canceled. You keep ${x} access until ${l}. Nothing will be charged. Pick a plan to restart.`:"Your subscription has been canceled. Pick a plan to restart.":F==="read_only"?"Your 7-day trial ended. Existing labs are read-only. Pick a plan to unlock new uploads.":"You're on the Free Plan. Pick a plan to unlock full biomarker analysis, AI protocols, and wearable sync.";return e.jsxs("div",{className:"w-full font-inter flex flex-col",style:{gap:32*t},"data-testid":"membership-card",children:[!s&&e.jsxs("div",{className:"flex flex-col",style:{gap:8*t},children:[e.jsx("p",{className:"font-medium",style:{fontSize:24*t,letterSpacing:`${-.96*t}px`,color:k?"#fff":"#000"},children:"Current Plan"}),e.jsx("p",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d},children:f})]}),s?e.jsx(Dt,{data:T.data,loading:T.isLoading,failed:T.isError,scale:t,fieldColor:d,isDark:k,isDesktop:N,onCancel:()=>R.mutate(),cancelling:R.isPending,onCardUpdated:()=>{i({title:"Card updated",description:"Future charges use your new card."}),P.invalidateQueries({queryKey:["/api/wizlo-pay/membership"]})},onPlanChanged:()=>{i({title:"Plan updated",description:"Your new plan is active."}),P.invalidateQueries({queryKey:["/api/wizlo-pay/membership"]}),P.invalidateQueries({queryKey:["/api/auth/user"]})}}):e.jsxs("div",{className:"flex flex-col lg:flex-row items-stretch w-full",style:{gap:16*t},children:[e.jsxs("a",{href:"/dashboard/choose-plan?plan=protocol",className:"flex-1 min-w-0 bg-card flex flex-col justify-between overflow-hidden",style:{minHeight:N?420*t:320,padding:N?`${32*t}px ${40*t}px`:"24px 20px"},"data-testid":"plan-fast-start",children:[e.jsxs("div",{className:"flex flex-col",style:{gap:20*t},children:[e.jsxs("div",{className:"flex flex-col",style:{gap:10*t},children:[e.jsxs("div",{className:"flex items-center",style:{gap:8*t},children:[e.jsx("span",{style:{fontSize:20*t,letterSpacing:`${-.8*t}px`,color:d},children:"Protocol"}),a&&e.jsx("span",{className:"flex items-center",style:{background:"#051b42",padding:`${4*t}px ${8*t}px`,fontSize:14*t,letterSpacing:`${-.56*t}px`,color:"#fff"},children:"7 day trial"})]}),e.jsx("span",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d,opacity:.75},children:"Atlas + Health Score on your existing labs"}),e.jsx("span",{className:"font-medium",style:{fontSize:N?40*t:30,letterSpacing:"-0.08em",color:d},children:"$20/mo"}),a&&e.jsx("span",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d,opacity:.75},children:"After your free trial. Cancel anytime."})]}),e.jsx("ul",{className:"flex flex-col",style:{gap:8*t},children:Ue.protocol.slice(0,6).map(w=>e.jsxs("li",{className:"flex items-start",style:{gap:8*t},children:[e.jsx(Ce,{style:{width:14*t,height:14*t,marginTop:3*t,flexShrink:0,color:d}}),e.jsx("span",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d},children:w})]},w))})]}),e.jsx("div",{className:"flex items-center justify-center w-full font-medium",style:{background:"#051b42",border:"1px solid rgba(255,255,255,0.12)",height:40*t,marginTop:20*t,fontSize:12*t,letterSpacing:`${-.24*t}px`,color:"#fff"},children:a?"Start free trial":"Get Protocol"})]}),e.jsxs("a",{href:"/dashboard/choose-plan?plan=peak&period=monthly",className:"flex-1 min-w-0 bg-[#051b42] flex flex-col justify-between overflow-hidden !border-0",style:{minHeight:N?420*t:320,padding:N?`${32*t}px ${40*t}px`:"24px 20px"},"data-testid":"plan-protocol",children:[e.jsxs("div",{className:"flex flex-col",style:{gap:20*t},children:[e.jsxs("div",{className:"flex flex-col",style:{gap:10*t},children:[e.jsxs("div",{className:"flex items-center",style:{gap:8*t},children:[e.jsx("span",{style:{fontSize:20*t,letterSpacing:`${-.8*t}px`,color:"#fff"},children:"Peak"}),e.jsx("span",{className:"flex items-center",style:{background:"#f4f8ff",padding:`${4*t}px ${8*t}px`,fontSize:14*t,letterSpacing:`${-.56*t}px`,color:"#051b42"},children:"Most popular"})]}),e.jsx("span",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:"#fff",opacity:.8},children:"Full system + group coaching · clinician-supervised"}),e.jsx("span",{className:"font-medium",style:{fontSize:N?40*t:30,letterSpacing:"-0.08em",color:"#fff"},children:"$99/mo"}),e.jsx("span",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:"#fff",opacity:.8},children:"Billed monthly · or $999/yr"})]}),e.jsx("ul",{className:"flex flex-col",style:{gap:8*t},children:Ue.peak.slice(0,6).map(w=>e.jsxs("li",{className:"flex items-start",style:{gap:8*t},children:[e.jsx(Ce,{style:{width:14*t,height:14*t,marginTop:3*t,flexShrink:0,color:"#fff"}}),e.jsx("span",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:"#fff"},children:w})]},w))})]}),e.jsx("div",{className:"flex items-center justify-center w-full font-medium",style:{background:"#f4f8ff",border:"1px solid rgba(255,255,255,0.12)",height:40*t,marginTop:20*t,fontSize:12*t,letterSpacing:`${-.24*t}px`,color:"#051b42"},children:"Get Peak"})]})]})]})})(),n==="history"&&(()=>{const a=Ae.data||[],p=W.data||[],l=r=>e.jsx("p",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d},children:r}),f=(r,w)=>e.jsx("div",{className:"bg-card w-full overflow-hidden flex flex-col",style:{minHeight:120*t,paddingLeft:32*t,paddingRight:28*t,paddingBlock:24*t,gap:r?0:12*t,justifyContent:"center",alignItems:r?"center":"stretch"},children:w}),c=r=>e.jsx("p",{className:"font-medium",style:{fontSize:20*t,letterSpacing:`${-.8*t}px`,color:d},children:r}),h=(r,w,ee,te)=>e.jsxs("div",{className:"flex items-center justify-between w-full",style:{gap:12*t},children:[e.jsxs("div",{className:"flex items-center min-w-0",style:{gap:12*t},children:[e.jsx("span",{style:{color:d,opacity:.7},children:r}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate",style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d},children:w}),e.jsx("p",{className:"truncate",style:{fontSize:12*t,color:d,opacity:.6},children:ee})]})]}),te]});return e.jsxs("div",{className:"w-full font-inter flex flex-col",style:{gap:56*t},"data-testid":"history-card",children:[e.jsxs("div",{className:"flex flex-col w-full",style:{gap:16*t},children:[c("Lab Uploads"),Ae.isLoading?f(!0,l("Loading…")):a.length===0?f(!0,l("No lab uploads yet.")):f(!1,a.map(r=>{const w=new Date(r.createdAt||r.uploadedAt),ee=r.originalFileName||r.fileName||r.labSource||`Lab Upload · ${w.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}`,te=r.status==="GRADED"||r.status==="completed",ie=r.status==="ERROR"||r.status==="failed";return e.jsx("div",{children:h(e.jsx(Ge,{style:{width:20*t,height:20*t}}),ee,w.toLocaleDateString(),e.jsx("span",{className:"capitalize",style:{fontSize:12*t,color:te?"#0EA57A":ie?"#EF4444":"#B45309"},children:(r.status||"PENDING").toLowerCase()}))},r.id)}
2))]}),e.jsxs("div",{className:"flex flex-col w-full",style:{gap:16*t},children:[c("Activity"),W.isLoading?f(!0,l("Loading…")):p.length===0?f(!0,l("No recent activity.")):f(!1,p.map((r,w)=>e.jsx("div",{children:h(e.jsx(K,{style:{width:20*t,height:20*t}}),r.title||r.type,r.createdAt?new Date(r.createdAt).toLocaleDateString():"")},r.id||w)))]})]})})(),n==="integrations"&&(()=>{const a=(c,h)=>Y("DELETE",`/api/wearables/connections/${c}`).then(()=>{P.invalidateQueries({queryKey:["/api/wearables/connections"]}),pt(),i({title:`${h} disconnected`})}),p=[{id:"dark",label:"Dark",icon:"/images/figma/icons/theme-dark.svg"},{id:"light",label:"Light",icon:"/images/figma/icons/theme-light.svg"},{id:"auto",label:"Auto",icon:"/images/figma/icons/theme-auto.svg"}],l=[[{id:"oura",name:"Oura Ring",icon:"dev-watch",type:"junction"},{id:"apple-health",name:"Apple Health",icon:"dev-heart",type:"direct",comingSoon:!0},{id:"garmin",name:"Garmin",icon:"dev-watch",type:"junction"}],[{id:"whoop_v2",name:"Whoop",icon:"dev-band",type:"junction"},{id:"google_fit",name:"Google Fit",icon:"dev-heart",type:"junction"},{id:"withings",name:"Withings",icon:"dev-healthalt",type:"junction"}],[{id:"fitbit",name:"Fitbit",icon:"dev-watch2",type:"junction"},{id:"polar",name:"Polar",icon:"dev-heartbeat2",type:"junction"},{id:"wahoo",name:"Wahoo",icon:"dev-moon",type:"junction"}]],f=k?"rgba(255,255,255,0.05)":"#f4f8ff";return e.jsxs("div",{className:"w-full font-inter flex flex-col",style:{gap:24*t},"data-testid":"integrations-card",children:[e.jsxs("div",{className:"bg-[#051b42] w-full overflow-hidden flex flex-col lg:flex-row lg:items-center lg:justify-between !border-0",style:{minHeight:120*t,paddingLeft:32*t,paddingRight:28*t,paddingBlock:24*t,gap:24*t},children:[e.jsxs("div",{className:"flex flex-col",style:{gap:12*t},children:[e.jsxs("div",{className:"flex items-center",style:{gap:8*t},children:[e.jsx("p",{className:"font-medium",style:{fontSize:20*t,letterSpacing:`${-.8*t}px`,color:"#fff"},children:"Dashboard Theme"}),e.jsxs("span",{className:"inline-flex items-center font-medium uppercase",style:{gap:4*t,paddingInline:8*t,paddingBlock:3*t,fontSize:12*t,letterSpacing:`${-.24*t}px`,background:"rgba(255,255,255,0.14)",color:"#fff"},"data-testid":"badge-theme-locked",children:[e.jsx(We,{style:{width:11*t,height:11*t}}),"In development"]})]}),e.jsx("p",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:"#fff"},children:"Dark mode is still being built. The dashboard stays in light mode for now. We'll turn this on when it's ready."})]}),e.jsx("div",{className:"flex flex-wrap",style:{gap:12*t},children:p.map(c=>{const h=c.id==="light",r=c.id!=="light";return e.jsxs("button",{onClick:()=>ue(c.id),disabled:!0,"aria-disabled":!0,title:"Dark mode is under development","data-testid":`button-theme-${c.id}`,className:"flex items-center justify-center capitalize flex-1 lg:flex-none min-w-0 disabled:cursor-not-allowed",style:{gap:8*t,height:36*t,width:N?157*t:void 0,paddingInline:N?void 0:8,fontSize:14*t,letterSpacing:`${-.28*t}px`,background:"#fff",color:"#051b42",border:h?`${Math.max(2*t,2)}px solid #051b42`:"1px solid rgba(5,27,66,0.12)",opacity:r?.45:1},children:[r?e.jsx(We,{style:{width:14*t,height:14*t}}):e.jsx("img",{src:c.icon,alt:"",style:{width:16*t,height:16*t}}),c.label]},c.id)})})]}),e.jsxs("div",{className:"bg-card w-full overflow-hidden flex flex-col",style:{gap:40*t,paddingLeft:32*t,paddingRight:28*t,paddingBlock:24*t},children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between w-full",style:{gap:16*t},children:[e.jsxs("div",{className:"flex flex-col",style:{gap:12*t},children:[e.jsx("p",{className:"font-medium",style:{fontSize:20*t,letterSpacing:`${-.8*t}px`,color:d},children:"Connect more devices"}),e.jsx("p",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d},children:"Fitbit, Garmin, Withings, Polar, Peloton & more, in one secure flow."})]}),e.jsx("button",{onClick:()=>O(),"data-testid":"button-connect-junction",className:"flex items-center justify-center shrink-0 bg-[#051b42] border border-[rgba(5,27,66,0.12)] text-white capitalize w-full lg:w-auto",style:{height:36*t,width:N?220*t:void 0,maxWidth:"100%",paddingInline:N?void 0:16,fontSize:12*t,letterSpacing:`${-.24*t}px`},children:"+Connect device"})]}),e.jsx("div",{className:"flex flex-col lg:flex-row lg:justify-between w-full",style:{gap:12*t},children:l.map((c,h)=>e.jsx("div",{className:"flex flex-col w-full",style:{gap:12*t,maxWidth:N?350*t:void 0},children:c.map(r=>{const w=!!j.get(r.id);return e.jsxs("div",{className:"flex items-center justify-between w-full overflow-hidden",style:{background:f,height:86*t,paddingLeft:12*t,paddingRight:16*t},children:[e.jsxs("div",{className:"flex items-start min-w-0",style:{gap:8*t},children:[e.jsx("img",{src:`/images/figma/icons/${r.icon}.svg`,alt:"",className:"shrink-0",style:{width:42*t,height:42*t,filter:k?"invert(1)":"none"}}),e.jsxs("div",{className:"flex flex-col justify-center min-w-0",style:{gap:8*t},children:[e.jsx("p",{className:"truncate",style:{fontSize:16*t,letterSpacing:`${-.32*t}px`,color:d},children:r.name}),e.jsx("p",{style:{fontSize:12*t,letterSpacing:`${-.24*t}px`,color:d},children:r.comingSoon?"Coming soon":w?"Connected":"Not Connected"})]})]}),e.jsx("button",{disabled:r.comingSoon,onClick:()=>r.comingSoon?void 0:w?a(r.id,r.name):O(r.id),className:"flex items-center justify-center shrink-0 bg-[#051b42] border border-[rgba(5,27,66,0.12)] text-white capitalize disabled:opacity-50 disabled:cursor-not-allowed",style:{height:36*t,width:N?157*t:void 0,paddingInline:N?void 0:16,fontSize:14*t,letterSpacing:`${-.28*t}px`},"data-testid":`connect-${r.id}`,children:r.comingSoon?"Coming Soon":w?"Disconnect":"Connect"})]},r.id)})},h))})]})]})})(),n==="memory"&&(()=>{const a=ce.data||[],p=l=>l==="clinical_capture"?"From your intake":l==="user_edited"?"Edited by you":"From a conversation";return e.jsxs("div",{className:"w-full font-inter flex flex-col",style:{gap:24*t},"data-testid":"memory-card",children:[e.jsxs("div",{className:"flex flex-col",style:{gap:8*t,maxWidth:640*t},children:[e.jsx("p",{className:"font-medium",style:{fontSize:20*t,letterSpacing:`${-.8*t}px`,color:d},children:"What Atlas remembers"}),e.jsx("p",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d,opacity:.65}
2,children:"Atlas keeps a short list of durable facts about you (from your intake and past conversations) so it doesn't ask twice. You're in control: edit anything that's off, or delete anything you'd rather it forget."})]}),e.jsxs(st,{href:"/dashboard/settings/import-ai",className:"bg-card w-full flex items-center justify-between",style:{padding:20*t,gap:12*t},"data-testid":"link-import-ai",children:[e.jsxs("div",{className:"flex flex-col",style:{gap:4*t},children:[e.jsx("p",{className:"font-medium",style:{fontSize:16*t,letterSpacing:`${-.64*t}px`,color:d},children:"Import from another AI"}),e.jsx("p",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d,opacity:.65},children:"Already discussed your health with ChatGPT or Claude? Paste it in and Atlas will use it as background."})]}),e.jsx(Ke,{style:{width:18*t,height:18*t,color:d,opacity:.5,flexShrink:0}})]}),ce.isLoading?e.jsx("div",{className:"bg-card w-full flex items-center justify-center",style:{minHeight:120*t},children:e.jsx("p",{style:{fontSize:14*t,color:d},children:"Loading…"})}):a.length===0?e.jsxs("div",{className:"bg-card w-full flex flex-col items-center justify-center text-center",style:{minHeight:160*t,padding:24*t,gap:8*t},children:[e.jsx(Qe,{style:{width:28*t,height:28*t,color:d,opacity:.4}}),e.jsx("p",{style:{fontSize:14*t,color:d},children:"Atlas hasn't saved anything yet."}),e.jsx("p",{style:{fontSize:12*t,color:d,opacity:.6,maxWidth:360*t},children:"As you chat with Atlas, the things worth remembering (your goals, sensitivities, what's worked) show up here."})]}):e.jsx("div",{className:"bg-card w-full flex flex-col",style:{paddingInline:28*t,paddingBlock:8*t},children:a.map((l,f)=>{const c=I===l.id;return e.jsx("div",{className:"flex items-center justify-between w-full",style:{gap:12*t,paddingBlock:16*t,borderTop:f===0?"none":`1px solid ${k?"rgba(255,255,255,0.08)":"rgba(5,27,66,0.08)"}`},"data-testid":`memory-row-${l.id}`,children:c?e.jsxs("div",{className:"flex-1 flex items-center",style:{gap:8*t},children:[e.jsx(ht,{value:X,onChange:h=>Le(h.target.value),className:Z,style:{fontSize:14*t},autoFocus:!0,onKeyDown:h=>{h.key==="Enter"&&X.trim()?we.mutate({id:l.id,fact:X.trim()}):h.key==="Escape"&&U(null)}}),e.jsx($e,{size:"sm",disabled:!X.trim()||we.isPending,onClick:()=>we.mutate({id:l.id,fact:X.trim()}),style:{fontSize:14*t},"data-testid":`memory-save-${l.id}`,children:"Save"}),e.jsx($e,{size:"sm",variant:"ghost",onClick:()=>U(null),style:{fontSize:14*t},children:"Cancel"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{style:{fontSize:14*t,letterSpacing:`${-.56*t}px`,color:d},children:l.fact}),e.jsx("p",{style:{fontSize:12*t,color:d,opacity:.55,marginTop:2*t},children:p(l.source)})]}),e.jsxs("div",{className:"flex items-center shrink-0",style:{gap:4*t},children:[e.jsx("button",{onClick:()=>{U(l.id),Le(l.fact)}
2,className:"rounded-md transition-colors hover:bg-foreground/5",style:{padding:8*t,color:d,opacity:.7},"aria-label":"Edit memory","data-testid":`memory-edit-${l.id}`,children:e.jsx(bt,{style:{width:16*t,height:16*t}})}),e.jsx("button",{onClick:()=>de.mutate(l.id),disabled:de.isPending,className:"rounded-md transition-colors hover:bg-red-500/10",style:{padding:8*t,color:"#EF4444",opacity:.8},"aria-label":"Delete memory","data-testid":`memory-delete-${l.id}`,children:e.jsx(jt,{style:{width:16*t,height:16*t}})})]})]})},l.id)})}),e.jsx("p",{style:{fontSize:12*t,color:d,opacity:.5,maxWidth:640*t},children:"Atlas memory never includes your raw lab values or medications. Those are read live from your record each time. Deleting your account erases everything here permanently."})]})})()]})]})}export{ji 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.