vendor: 4,846 bytes, line 1
1import{d as Kt,D as qt,a1 as Ht,z as Ot,s as P,r as c,o as Zt,J as Jt,a as Qt,c as i,f as ot,w as he,T as Xt,b as t,F as C,h as L,i as ea,j as m,v as h,n as x,t as o,k as u,u as r,g as v,e as ta,M as X,Q as rt,a2 as aa,K as sa,E as na,q as k,C as lt,l as ia,m as n}from"./index-BWLfjhcL.js";import{a as oa,_ as ra}from"./Strava_Logo.svg-Ck_LrGzY.js";import{_ as la}from"./api_logo_pwrdBy_strava_horiz_white-nCHXI2PK.js";import{u as ca}from"./profile-BWyybNI3.js";import{u as ua}from"./activities-CqpZRyZo.js";import{u as da}from"./useStrava-DKA5_lC5.js";import{_ as pa}from"./ZoneTables.vue_vue_type_script_setup_true_lang-UnP1jDym.js";import{u as fa}from"./useUnits-C5UY8e1P.js";import"./useGarminAttribution-B5hWPBns.js";import"./structure-KtBna_-r.js";const va="/assets/wahoo_logo_small_black-CH4hvsyr.png",ya={class:"p-4 md:p-6"},ba={key:0,class:"fixed bottom-6 left-1/2 -translate-x-1/2 z-50 flex items-center gap-3 px-5 py-3 rounded-xl bg-primary text-on-primary text-base font-bold uppercase tracking-widest shadow-lg"},ga={class:"bg-surface-container-low rounded-xl overflow-hidden"},xa={class:"flex flex-col md:flex-row"},ma={class:"md:min-w-[12rem] md:border-r border-outline-variant/20 p-3 flex flex-row md:flex-col gap-1 overflow-x-auto md:overflow-visible flex-shrink-0"},ha=["onClick"],ka={class:"flex-1 p-6"},_a={key:0},wa={class:"grid grid-cols-1 sm:grid-cols-2 gap-4"},Ca={class:"flex flex-col gap-1"},Sa={class:"flex flex-col gap-1"},Pa={class:"flex flex-col gap-1"},Da={class:"flex flex-col gap-1"},Fa={class:"flex items-center bg-surface-container rounded-lg overflow-hidden"},$a={class:"flex flex-col gap-1"},ja={class:"flex gap-2"},Ta={class:"flex items-center gap-3 pt-2"},Ua={class:"flex gap-1 bg-surface-container rounded-lg p-1"},Ga={class:"text-base text-on-surface-variant"},Ma={class:"flex items-center gap-3 pt-2"},La={class:"flex gap-1 bg-surface-container rounded-lg p-1"},Ya=["onClick"],Va={class:"flex items-center gap-3 pt-2"},Ia={class:"flex gap-1 bg-surface-container rounded-lg p-1"},Na={class:"text-base text-on-surface-variant"},Aa={class:"flex items-center gap-3 pt-2"},Ea={key:0,class:"flex flex-col gap-1"},Ra={class:"flex gap-2"},Wa=["value"],Ba={class:"flex justify-end pt-2"},za=["disabled"],Ka={key:0,class:"material-symbols-outlined text-base leading-none animate-spin"},qa={key:1,class:"material-symbols-outlined text-base leading-none"},Ha={key:1},Oa={class:"space-y-4"},Za={class:"text-base font-black text-on-surface w-12 flex-shrink-0"},Ja={class:"flex flex-col gap-1 flex-1 min-w-[140px]"},Qa={class:"text-base font-bold uppercase tracking-widest text-on-surface-variant flex items-center gap-1"},Xa=["onUpdate:modelValue"],es={class:"flex flex-col gap-1 flex-1 min-w-[140px]"},ts={class:"text-base font-bold uppercase tracking-widest text-on-surface-variant flex items-center gap-1"},as=["onUpdate:modelValue"],ss={class:"flex justify-end mt-6"},ns=["disabled"],is={key:0,class:"material-symbols-outlined text-base leading-none animate-spin"},os={key:1,class:"material-symbols-outlined text-base leading-none"},rs={key:2},ls={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 max-w-3xl"},cs={class:"flex flex-col gap-1"},us={class:"flex flex-col gap-1"},ds={class:"flex flex-col gap-1"},ps={class:"flex flex-col gap-1"},fs={class:"flex flex-col gap-1"},vs={class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},ys={class:"flex flex-col gap-1"},bs={class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},gs=["min","max"],xs={key:0,class:"mt-4 bg-error/10 text-error text-base rounded-lg px-4 py-2 max-w-3xl"},ms={class:"flex justify-end mt-6 max-w-3xl"},hs=["disabled"],ks={key:0,class:"material-symbols-outlined text-base leading-none animate-spin"},_s={key:1,class:"material-symbols-outlined text-base leading-none"},ws={key:1,class:"mt-10"},Cs={key:3},Ss={key:0,class:"flex items-center gap-2 text-base text-on-surface-variant"},Ps={key:1,class:"space-y-3 max-w-2xl"},Ds=["aria-checked","aria-label","onClick"],Fs={class:"flex flex-col gap-1"},$s={class:"text-base font-bold uppercase tracking-widest text-on-surface"},js={class:"text-base text-on-surface-variant"},Ts={class:"flex flex-wrap items-center justify-between gap-3 pt-2"},Us=["disabled"],Gs={key:0,class:"flex items-center gap-2 text-base text-on-surface-variant"},Ms={key:4},Ls={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"},Ys={class:"bg-surface-container rounded-xl p-4 flex flex-col gap-4"},Vs={key:0,class:"text-base text-error leading-relaxed"},Is={key:1,class:"text-base text-on-surface-variant leading-relaxed"},Ns=["disabled"],As={key:3,class:"space-y-2"},Es={class:"flex items-center gap-3"},Rs=["disabled"],Ws={class:"bg-surface-container rounded-xl p-4 flex flex-col gap-4"},Bs={key:1,class:"space-y-2"},zs={class:"flex items-center gap-3"}
1,Ks=["disabled"],qs=["disabled"],Hs={key:0,class:"material-symbols-outlined text-base leading-none animate-spin"},Os={key:1,class:"material-symbols-outlined text-base leading-none"},Zs={key:5},Js={class:"flex gap-1 bg-surface-container rounded-lg p-1 w-fit mb-4"},Qs=["onClick"],Xs={class:"text-base text-on-surface-variant mb-4"},en={class:"flex flex-col gap-3"},tn={class:"flex flex-col items-center justify-center gap-3 p-8 border-2 border-dashed border-outline-variant/30 rounded-xl cursor-pointer hover:border-primary/50 transition-colors group"},an={class:"text-base text-on-surface-variant uppercase tracking-widest"},sn=["accept"],nn={key:0,class:"flex items-center gap-2 text-base text-on-surface-variant uppercase tracking-widest"},on={key:6,class:"space-y-6"},rn={class:"bg-surface-container rounded-xl p-5 flex items-center justify-between gap-4"},ln={class:"text-xl font-black text-on-surface flex items-center gap-2"},cn={key:0,class:"text-base text-on-surface-variant mt-1"},un={key:1,class:"text-base text-error mt-1"},dn={key:0,class:"relative border border-primary/20 rounded-xl p-5 space-y-3"},pn={key:0,class:"absolute inset-0 bg-surface/70 rounded-xl flex items-center justify-center gap-3 z-10"},fn=["disabled"],vn={key:2,class:"space-y-3"},yn={key:0,class:"flex items-center gap-2 text-on-surface-variant"},bn={key:1,class:"bg-surface-container rounded-lg p-4 space-y-2"},gn={class:"text-on-surface-variant"},xn={key:0,class:"flex justify-between text-base text-on-surface-variant border-t border-outline-variant pt-2"},mn={class:"border-t border-outline-variant pt-2 flex justify-between text-base font-bold"},hn={class:"text-on-surface"},kn={class:"flex items-center gap-3"},_n=["disabled"],wn={key:1,class:"border border-error/20 rounded-xl p-5 space-y-3"},Cn={key:1,class:"flex items-center gap-3"},Sn=["disabled"],Pn={key:2,class:"border border-primary/20 rounded-xl p-5 space-y-3"},Dn={class:"text-base text-on-surface-variant"},Fn=["disabled"],$n={class:"bg-surface-container rounded-xl p-5 space-y-3"},jn={class:"flex items-center justify-between gap-4"},Tn={class:"text-xl font-black text-on-surface flex items-center gap-2"},Un={key:0,class:"text-base text-on-surface-variant mt-1"},Gn={key:1,class:"text-base text-on-surface-variant mt-1"},Mn={key:2,class:"text-base text-on-surface-variant mt-1"},Ln={key:3,class:"text-base text-on-surface-variant mt-1"},Yn={key:4,class:"text-base text-error mt-1"},Vn={key:0,class:"pt-1"},In={key:1,class:"flex items-center gap-3"},Nn=["disabled"],An={key:1,class:"pt-1"},En=["disabled"],Rn={key:0,class:"flex justify-center py-6"},Wn={key:1,class:"text-base text-on-surface-variant"},Bn={key:2,class:"text-base text-on-surface-variant"},zn={key:3,class:"divide-y divide-outline-variant/10"},Kn={class:"text-base font-bold text-on-surface"},qn={class:"text-base text-on-surface-variant"},Hn={class:"flex items-center gap-3"},On=["href"],Zn={key:7},Jn={key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4"},Qn={class:"relative bg-surface-container-low rounded-xl p-6 w-full max-w-sm shadow-2xl"},Xn={class:"flex justify-end gap-2"},ei=["disabled"],ti={key:0,class:"material-symbols-outlined text-sm leading-none animate-spin"},ai={key:1,class:"material-symbols-outlined text-sm leading-none"},si={key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4"},ni={class:"relative bg-surface-container-low rounded-xl p-6 w-full max-w-sm shadow-2xl"},ii={class:"flex flex-col gap-1 mb-4"},oi={key:0,class:"text-base text-error mt-1"},ri={class:"flex justify-end gap-3"},li=["disabled"],ci={key:0,class:"material-symbols-outlined text-base leading-none animate-spin"},ui={key:1,class:"material-symbols-outlined text-base leading-none"},_i=Kt({__name:"ProfileView",setup(di){const{initiateStravaLogin:ct}=da(),ee=ua(),f=ca(),ke=sa(),{distanceUnit:te,weightUnit:ut,toDisplayDistance:Le,fromDisplayDistance:Ye,toDisplayWeight:_e,fromDisplayWeight:dt,toDisplayPaceSeconds:pt,fromDisplayPaceSeconds:ft}=fa(),Ve=na(),Y=qt(),{isPro:j,subscription:T,isCoach:F,coachSubscription:g}=Ht(Y),we=Ot(),vt=P(()=>{var a;return!!((a=T.value)!=null&&a.current_price_id)&&T.value.current_price_id===we.stripePriceMonthly}),Ce=c([]),Se=c(!1),W=P(()=>{var a;return((a=T.value)==null?void 0:a.cancel_at_period_end)??!1}),ae=c(!1),se=c(!1),ne=c(!1),B=c(!1),z=c(!1),V=c(!1),S=c(null),ie=c(!1),U=c(!1),yt=P(()=>{const a=g.value;if((a==null?void 0:a.status)==="trialing"&&F.value)return"Free trial";if((a==null?void 0:a.status)==="expired")return"Trial ended";const e=a==null?void 0:a.tier;return!e||e==="none"||!F.value?"None":{starter:"Coach Starter",plus:"Coach Plus",team:"Coach Team",unlimited:"Coach
1Unlimited"}[e]??e});async function bt(){var a,e;U.value=!0;try{await Y.cancelCoachSubscription(),ie.value=!1,d("Coach plan set to cancel at period end.")}catch(l){d(((e=(a=l.response)==null?void 0:a.data)==null?void 0:e.error)??"Failed to cancel Coach plan.")}finally{U.value=!1}}async function gt(){var a,e;U.value=!0;try{await Y.resumeCoachSubscription(),d("Coach plan resumed â auto-renewal is back on.")}catch(l){d(((e=(a=l.response)==null?void 0:a.data)==null?void 0:e.error)??"Failed to resume Coach plan.")}finally{U.value=!1}}async function Ie(){if(j.value){Se.value=!0;try{const a=await k.get("/api/subscriptions/invoices/");Ce.value=a.data}catch{}finally{Se.value=!1}}}async function xt(){var a,e;ne.value=!0;try{await k.post("/api/subscriptions/resume/"),await Y.fetchSubscription(),d("Subscription resumed â auto-renewal is back on.")}catch(l){d(((e=(a=l.response)==null?void 0:a.data)==null?void 0:e.error)??"Failed to resume subscription.")}finally{ne.value=!1}}async function mt(){var a,e;V.value=!0,S.value=null,z.value=!0;try{const l=await k.get("/api/subscriptions/switch-plan/preview/",{params:{price_id:we.stripePriceYearly}});S.value=l.data}catch(l){z.value=!1,d(((e=(a=l.response)==null?void 0:a.data)==null?void 0:e.error)??"Failed to load price preview.")}finally{V.value=!1}}async function ht(){var a,e;B.value=!0,z.value=!1;try{await k.post("/api/subscriptions/switch-plan/",{price_id:we.stripePriceYearly}),await Promise.all([Y.fetchSubscription(),Ie()]),d("Switched to yearly â you've been charged the prorated difference.")}catch(l){d(((e=(a=l.response)==null?void 0:a.data)==null?void 0:e.error)??"Failed to switch plan.")}finally{B.value=!1}}async function kt(){var a,e;se.value=!0;try{await k.post("/api/subscriptions/cancel/"),await Y.fetchSubscription(),ae.value=!1,d("Subscription will cancel at end of billing period.")}catch(l){d(((e=(a=l.response)==null?void 0:a.data)==null?void 0:e.error)??"Failed to cancel subscription.")}finally{se.value=!1}}function I(a){return new Date(a).toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})}const _t=["Profile","Goals","Physiology","Notifications","Connections","Data Upload","Billing","Delete Profile"],b=c({ftp:null,threshold_hr:null,max_hr:null,resting_hr:null,weight_kg:null}),N=c(""),K=c(!1),q=c(""),wt=P(()=>{const a=f.physiology;return!!(a&&(a.power_zones||a.hr_zones||a.pace_zones))}),H=P(()=>{var a;return((a=f.physiologySuggestions)==null?void 0:a.ftp)??null}),O=P(()=>{var a;return((a=f.physiologySuggestions)==null?void 0:a.threshold_hr)??null});function Ne(a){const e=a==="ftp"?H.value:O.value;e&&(b.value[a]=e.value)}function Ae(a){return new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ct(a){const e=a.trim().match(/^(\d{1,2}):(\d{2})$/);if(!e)return null;const l=parseInt(e[1],10)*60+parseInt(e[2],10),y=Math.round(ft(l)),$=Math.floor(y/3600),R=Math.floor(y%3600/60),me=y%60;return`${String($).padStart(2,"0")}:${String(R).padStart(2,"0")}:${String(me).padStart(2,"0")}`}function St(a){if(!a)return"";const e=a.split(":").map(Number);if(e.length!==3)return"";const l=e[0]*3600+e[1]*60+e[2],y=pt(l),$=Math.floor(y/60),R=Math.round(y%60);return`${$}:${R.toString().padStart(2,"0")}`}const Pt=P(()=>Math.round(_e(30))),Dt=P(()=>Math.round(_e(200)));function Ft(){const a=f.physiology;a&&(b.value={ftp:a.ftp,threshold_hr:a.threshold_hr,max_hr:a.max_hr,resting_hr:a.resting_hr,weight_kg:a.weight_kg!=null?Math.round(_e(a.weight_kg)*10)/10:null},N.value=St(a.threshold_pace))}async function $t(){var e;K.value=!0,q.value="";const a=N.value?Ct(N.value):null;if(N.value&&!a){q.value=`Threshold pace must look like 4:30 (minutes:seconds per ${te.value}).`,K.value=!1;return}try{await f.savePhysiology({ftp:b.value.ftp||null,threshold_hr:b.value.threshold_hr||null,max_hr:b.value.max_hr||null,resting_hr:b.value.resting_hr||null,weight_kg:b.value.weight_kg!=null?dt(b.value.weight_kg):null,threshold_pace:a}),d("Physiology saved.")}catch(l){const y=(e=l.response)==null?void 0:e.data;q.value=typeof y=="string"?y:Object.values(y??{}).flat().join(" ")||"Failed to save."}finally{K.value=!1}}const _=c("Profile"),Pe=c(null),De=c(""),Fe=c(!1),A=c("fit"),jt=[{type:"fit",label:"FIT File"},{type:"csv",label:"CSV"}],$e=new Date().getFullYear(),je=[$e-2,$e-1,$e],oe=c({}),re=c({}),Te=[{key:"group_event_reminders",label:"Group event reminders",description:"A reminder the day before an event you created or joined."},{key:"group_event_updates",label:"Group event changes",description:"When an event you joined is edited or cancelled."},{key:"training_reminders",label:"Training reminders",description:"A summary of tomorrow's planned workouts from your coach."},{key:"coaching_updates",label:"Coaching updates",description:"When someone accepts or declines your coaching invitation."},{key:"plan_changes",label:"Plan changes",description:"When your coach adds, changes or cancels one of your workouts."}],w=c({group_event_reminders:!0,group_event_updates:!0,training_reminders:!0,coaching_updates:!0,plan_changes:!0}),Ue=c(!1),le=c(!1),Ee=c(!1),Tt=P(()=>Te.every(a=>!w.value[a.key]));async function Ut(){if(!Ee.value){Ue.value=!0;try{const{data:a}=await k.get("/api/users/email-preferences/");w.value={...w.value,...a},Ee.value=!0}catch{d("Failed to load email preferences.")}finally{Ue.value=!1}}}async function Re(a){const e={...w.value};w.value={...w.value,...a},le.value=!0;try{const{data:l}=await k.patch("/api/users/email-preferences/",a);w.value={...w.value,...l}}catch{w.value=e,d("Failed to save email preferences.")}finally{le.value=!1}}function Gt(a){Re({[a]:!w.value[a]})}function Mt(){Re(Object.fromEntries(Te.map(a=>[a.key,!1])))}const Z=c(!1),J=c(""),ce=c(!1),E=c(""),ue=c(!1),de=c(!1),pe=c(!1),fe=c(!1),ve=c(!1),ye=c({visible:!1,message:""}
1),p=c({display_name:"",first_name:"",last_name:"",email:"",profile_slug:"",is_profile_public:!1,preferred_unit_system:"metric",date_format:"dmy",time_format:"24h"});function be(a,e){var l,y;return((y=(l=f.profile)==null?void 0:l.yearly_goals.find($=>$.year===a&&$.sport===e))==null?void 0:y.distance_goal)||0}async function Lt(a){var y;const e=a.target;if(!((y=e.files)!=null&&y[0]))return;const l=e.files[0];De.value=l.name,Fe.value=!0;try{A.value==="fit"?await ee.uploadFIT(l):await ee.uploadCSV(l),De.value="",Pe.value&&(Pe.value.value=""),d("File uploaded successfully!"),await ee.fetchActivities()}catch{d("Failed to upload file. Please try again.")}finally{Fe.value=!1}}const We=P(()=>{var a;return p.value.is_profile_public?`${window.location.origin}/u/${p.value.profile_slug||((a=f.profile)==null?void 0:a.profile_slug)}`:""});async function Yt(){try{await navigator.clipboard.writeText(We.value),d("Profile URL copied to clipboard!")}catch{console.error("Failed to copy URL")}}async function Vt(){const a=[];for(const e of je){const l=Math.round(Ye(Number(oe.value[e])||0));l!==be(e,"cycling")&&a.push({year:e,distance_goal:l,sport:"cycling"});const y=Math.round(Ye(Number(re.value[e])||0));y!==be(e,"running")&&a.push({year:e,distance_goal:y,sport:"running"})}if(!a.length){d("No goal changes to save.");return}try{f.loading=!0,await f.saveYearlyGoals(a),d("Goals successfully updated!")}catch{d("Failed to update goals. Please try again.")}finally{f.loading=!1}}function It(){fe.value=!0}async function Nt(){ve.value=!0;try{await k.delete("/api/users/delete-account/"),lt().logout()}catch{d("Failed to delete account. Please try again."),ve.value=!1}}async function At(){ue.value=!0;try{const{data:a}=await k.get("/api/auth/garmin/initiate");window.location.href=a.auth_url}catch{d("Failed to initiate Garmin connection"),ue.value=!1}}async function Et(){pe.value=!0;try{const{data:a}=await k.delete("/api/auth/garmin/disconnect");await f.fetchProfile(),de.value=!1,d((a==null?void 0:a.deregistered_at_garmin)===!1?"Garmin disconnected here, but Garmin did not confirm. Please also revoke Sporlyst in Garmin Connect.":"Garmin disconnected")}catch{d("Failed to disconnect Garmin. Please try again.")}finally{pe.value=!1}}const D=c(null),ge=c(!1),xe=c(!1);let Q=null;const G=P(()=>{var a;return((a=D.value)==null?void 0:a.status)==="running"}),Be=P(()=>{const a=D.value;if(!a)return"";if(a.status==="idle")return`Import your last ${a.days} days of Strava activities.`;if(a.status==="running")return`Importing your last ${a.days} days of Strava activitiesâ¦`;if(a.status==="rate_limited")return"Paused by Stravaâs rate limit. It carries on by itself shortly.";if(a.status==="error")return"The import stopped before it finished. Try again.";const e=[`${a.imported} imported`];return a.merged&&e.push(`${a.merged} matched to activities you already had`),a.held&&e.push(`${a.held} waiting for Garmin`),`Last ${a.days} days: ${e.join(", ")}.`});async function ze(){const{data:a}=await k.get("/api/activities/sync_strava/");D.value=a}async function Rt(){var a;if(!((a=f.profile)!=null&&a.has_strava)){D.value=null;return}try{await ze()}catch{D.value=null}G.value&&Ke()}function Ke(){Q||(Q=setInterval(async()=>{try{await ze()}catch{}G.value||(Ge(),ee.fetchActivities())},3e3))}function Ge(){Q&&clearInterval(Q),Q=null}async function Wt(){try{const{data:a}=await k.post("/api/activities/sync_strava/");D.value=a}catch(a){const e=a.response;if((e==null?void 0:e.status)!==409||!e.data){d("Could not start the Strava import. Please try again.");return}D.value=e.data}G.value&&Ke()}async function Bt(){xe.value=!0;try{const{data:a}=await k.delete("/api/auth/strava/disconnect");await f.fetchProfile(),ge.value=!1,Ge(),D.value=null,d((a==null?void 0:a.deauthorized_at_strava)===!1?"Strava disconnected here, but Strava did not confirm. Please also revoke Sporlyst in your Strava settings.":"Strava disconnected")}catch{d("Failed to disconnect Strava. Please try again.")}finally{xe.value=!1}}Zt(async()=>{f.fetchPhysiology().then(Ft),f.fetchPhysiologySuggestions(),await f.fetchProfile(),f.profile&&(p.value={...f.profile}
1,je.forEach(e=>{oe.value[e]=Math.round(Le(be(e,"cycling"))),re.value[e]=Math.round(Le(be(e,"running")))})),Rt(),ke.query.strava==="connected"&&(_.value="Connections",d("Strava connected â importing your recent activities."),Ve.replace({query:{}}));const a=ke.query.garmin;if(a){if(_.value="Connections",a==="success")await f.fetchProfile(),d("Garmin connected successfully!");else{const e=ke.query.reason;d({already_connected:"This Garmin account is already connected to another user.",session_expired:"Session expired. Please try again.",user_not_found:"User not found. Please log in again.",auth_failed:"Garmin connection failed. Please try again."}[e??""]??"Garmin connection failed.")}Ve.replace({query:{}})}}),Jt(_,a=>{a==="Billing"&&Ie(),a==="Notifications"&&Ut()}),Qt(Ge);async function qe(){var a,e;if(E.value="",!J.value.trim()){E.value="Email is required";return}ce.value=!0;try{await k.post("/api/users/change-email/",{email:J.value.trim()}),Z.value=!1,J.value="",d("Verification email sent! Check your new inbox.")}catch(l){E.value=((e=(a=l==null?void 0:l.response)==null?void 0:a.data)==null?void 0:e.error)||"Failed to send verification email"}finally{ce.value=!1}}async function zt(){try{f.loading=!0,await f.updateProfile(p.value),await lt().fetchUserProfile(),d("Profile successfully updated!")}catch{d("Failed to update profile. Please try again.")}finally{f.loading=!1}}let Me=null;function d(a){ye.value={visible:!0,message:a},Me&&clearTimeout(Me),Me=setTimeout(()=>{ye.value.visible=!1},3e3)}return(a,e)=>{var y,$,R,me,He,Oe,Ze,Je,Qe,Xe,et,tt,at,st,nt,it;const l=ia("router-link");return n(),i("div",ya,[ot(Xt,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 translate-y-2","enter-to-class":"opacity-100 translate-y-0","leave-active-class":"transition-all duration-200 ease-in","leave-from-class":"opacity-100 translate-y-0","leave-to-class":"opacity-0 translate-y-2"},{default:he(()=>[ye.value.visible?(n(),i("div",ba,[e[34]||(e[34]=t("span",{class:"material-symbols-outlined text-base leading-none",style:{"font-variation-settings":"'FILL' 1"}},"check_circle",-1)),v(" "+o(ye.value.message),1)])):u("",!0)]),_:1}),t("div",ga,[t("div",xa,[t("div",ma,[(n(),i(C,null,L(_t,s=>t("button",{key:s,onClick:M=>_.value=s,class:x(["whitespace-nowrap text-left px-4 py-2.5 rounded-lg text-base font-bold uppercase tracking-widest transition-all",_.value===s?"bg-primary text-on-primary":"text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high"])},o(s),11,ha)),64))]),t("div",ka,[_.value==="Profile"?(n(),i("div",_a,[e[49]||(e[49]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-6"},"Profile Settings",-1)),t("form",{onSubmit:ea(zt,["prevent"]),class:"space-y-4"},[t("div",wa,[t("div",Ca,[e[35]||(e[35]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"First Name",-1)),m(t("input",{"onUpdate:modelValue":e[0]||(e[0]=s=>p.value.first_name=s),type:"text",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,p.value.first_name]])]),t("div",Sa,[e[36]||(e[36]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Last Name",-1)),m(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>p.value.last_name=s),type:"text",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,p.value.last_name]])]),t("div",Pa,[e[37]||(e[37]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Display Name",-1)),m(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>p.value.display_name=s),type:"text",placeholder:"Your public name",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,p.value.display_name]])]),t("div",Da,[e[39]||(e[39]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Profile URL",-1)),t("div",Fa,[e[38]||(e[38]=t("span",{class:"px-3 py-2.5 text-base text-on-surface-variant select-none"},"/u/",-1)),m(t("input",{"onUpdate:modelValue":e[3]||(e[3]=s=>p.value.profile_slug=s),type:"text",placeholder:"your-slug",class:"flex-1 bg-transparent py-2.5 pr-4 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,p.value.profile_slug]])])]),t("div",$a,[e[40]||(e[40]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Email",-1)),t("div",ja,[m(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>p.value.email=s),type:"email",readonly:"",class:"flex-1 bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface opacity-70 cursor-default outline-none"},null,512),[[h,p.value.email]]),t("button",{type:"button",onClick:e[5]||(e[5]=s=>Z.value=!0),class:"px-4 py-2 rounded-lg bg-primary/10 text-primary text-base font-black uppercase tracking-widest hover:bg-primary/20 transition-colors flex-shrink-0"}," Change ")])])]),t("div",Ta,[e[41]||(e[41]=t("span",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Units",-1)),t("div",Ua,[t("button",{type:"button",onClick:e[6]||(e[6]=s=>p.value.preferred_unit_system="metric"),class:x(["px-4 py-1.5 rounded-md text-base font-black uppercase tracking-widest transition-all",p.value.preferred_unit_system==="metric"?"bg-primary text-on-primary":"text-on-surface-variant hover:text-on-surface"])},"Metric",2),t("button",{type:"button",onClick:e[7]||(e[7]=s=>p.value.preferred_unit_system="imperial"),class:x(["px-4 py-1.5 rounded-md text-base font-black uppercase tracking-widest transition-all",p.value.preferred_unit_system==="imperial"?"bg-primary text-on-primary":"text-on-surface-variant hover:text-on-surface"])},"Imperial",2)]),t("span",Ga,o(p.value.preferred_unit_system==="imperial"?"mi, lb, °F":"km, kg, °C"),1)]),t("div",Ma,[e[42]||(e[42]=t("span",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Dates",-1)),t("div",La,[(n(),i(C,null,L(["dmy","mdy","ymd"],s=>t("button",{key:s,type:"button",onClick:M=>p.value.date_format=s,class:x(["px-4 py-1.5 rounded-md text-base font-black uppercase tracking-widest transition-all",p.value.date_format===s?"bg-primary text-on-primary":"text-on-surface-variant hover:text-on-surface"])},o(s==="dmy"?"DD/MM/YYYY":s==="mdy"?"MM/DD/YYYY":"YYYY-MM-DD"),11,Ya)),64))])]),t("div",Va,[e[43]||(e[43]=t("span",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Time",-1)),t("div",Ia,[t("button",{type:"button",onClick:e[8]||(e[8]=s=>p.value.time_format="24h"),class:x(["px-4 py-1.5 rounded-md text-base font-black uppercase tracking-widest transition-all",p.value.time_format==="24h"?"bg-primary text-on-primary":"text-on-surface-variant hover:text-on-surface"])},"24-hour",2),t("button",{type:"button",onClick:e[9]||(e[9]=s=>p.value.time_format="12h"),class:x(["px-4 py-1.5 rounded-md text-base font-black uppercase tracking-widest transition-all",p.value.time_format==="12h"?"bg-primary text-on-primary":"text-on-surface-variant hover:text-on-surface"])},"12-hour (AM/PM)",2)]),t("span",Na,o(p.value.time_format==="12h"?"2:30 PM":"14:30"),1)]),t("div",Aa,[t("button",{type:"button",onClick:e[10]||(e[10]=s=>p.value.is_profile_public=!p.value.is_profile_public),class:x(["relative inline-flex h-6 w-11 items-center rounded-full transition-colors flex-shrink-0",p.value.is_profile_public?"bg-primary":"bg-surface-container-highest"])}
1,[t("span",{class:x(["inline-block h-4 w-4 rounded-full bg-on-primary transform transition-transform",p.value.is_profile_public?"translate-x-6":"translate-x-1"])},null,2)],2),e[44]||(e[44]=t("span",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Make profile public",-1)),e[45]||(e[45]=t("span",{class:"material-symbols-outlined text-base leading-none text-on-surface-variant cursor-help",title:"When enabled, your profile and activities will be visible to anyone with the link"},"info",-1))]),p.value.is_profile_public?(n(),i("div",Ea,[e[47]||(e[47]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Public Profile URL",-1)),t("div",Ra,[t("input",{value:We.value,type:"text",readonly:"",class:"flex-1 bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface opacity-70 cursor-default outline-none"},null,8,Wa),t("button",{type:"button",onClick:Yt,class:"flex items-center justify-center w-10 h-10 rounded-lg bg-surface-container-high text-on-surface-variant hover:text-on-surface transition-colors flex-shrink-0"},e[46]||(e[46]=[t("span",{class:"material-symbols-outlined text-base leading-none"},"content_copy",-1)]))])])):u("",!0),t("div",Ba,[t("button",{type:"submit",disabled:r(f).loading,class:"flex items-center gap-2 bg-primary text-on-primary px-6 py-2.5 rounded-lg text-base font-black uppercase tracking-widest hover:opacity-90 transition-opacity disabled:opacity-50"},[r(f).loading?(n(),i("span",Ka,"progress_activity")):(n(),i("span",qa,"save")),e[48]||(e[48]=v(" Save Changes "))],8,za)])],32)])):u("",!0),_.value==="Goals"?(n(),i("div",Ha,[e[53]||(e[53]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-6"},"Yearly Distance Goals",-1)),t("div",Oa,[(n(),i(C,null,L(je,s=>t("div",{key:s,class:"flex flex-wrap items-center gap-4"},[t("span",Za,o(s),1),t("div",Ja,[t("label",Qa,[e[50]||(e[50]=t("span",{class:"material-symbols-outlined text-base leading-none"},"directions_bike",-1)),v(" Cycling ("+o(r(te))+") ",1)]),m(t("input",{"onUpdate:modelValue":M=>oe.value[s]=M,type:"number",step:"1",min:"0",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,8,Xa),[[h,oe.value[s],void 0,{number:!0}]])]),t("div",es,[t("label",ts,[e[51]||(e[51]=t("span",{class:"material-symbols-outlined text-base leading-none"},"directions_run",-1)),v(" Running ("+o(r(te))+") ",1)]),m(t("input",{"onUpdate:modelValue":M=>re.value[s]=M,type:"number",step:"1",min:"0",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,8,as),[[h,re.value[s],void 0,{number:!0}]])])])),64))]),t("div",ss,[t("button",{onClick:Vt,disabled:r(f).loading,class:"flex items-center gap-2 bg-primary text-on-primary px-6 py-2.5 rounded-lg text-base font-black uppercase tracking-widest hover:opacity-90 transition-opacity disabled:opacity-50"},[r(f).loading?(n(),i("span",is,"progress_activity")):(n(),i("span",os,"save")),e[52]||(e[52]=v(" Save Changes "))],8,ns)])])):u("",!0),_.value==="Physiology"?(n(),i("div",rs,[e[61]||(e[61]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-2"},"Physiological Profile",-1)),e[62]||(e[62]=t("p",{class:"text-base text-on-surface-variant mb-6"}," Threshold values used for structured workout targets, training load estimates, and (with your consent) visible to your coach. ",-1)),t("div",ls,[t("div",cs,[e[54]||(e[54]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"FTP (W)",-1)),m(t("input",{"onUpdate:modelValue":e[11]||(e[11]=s=>b.value.ftp=s),type:"number",min:"50",max:"600",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,b.value.ftp,void 0,{number:!0}]]),H.value&&H.value.value!==b.value.ftp?(n(),i("button",{key:0,type:"button",onClick:e[12]||(e[12]=s=>Ne("ftp")),class:"text-left text-sm text-tertiary hover:text-tertiary/80 transition-colors"}," Suggested: "+o(H.value.value)+" W (from "+o(Ae(H.value.date))+") â apply ",1)):u("",!0)]),t("div",us,[e[55]||(e[55]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Threshold HR (bpm)",-1)),m(t("input",{"onUpdate:modelValue":e[13]||(e[13]=s=>b.value.threshold_hr=s),type:"number",min:"25",max:"250",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,b.value.threshold_hr,void 0,{number:!0}]]),O.value&&O.value.value!==b.value.threshold_hr?(n(),i("button",{key:0,t
1ype:"button",onClick:e[14]||(e[14]=s=>Ne("threshold_hr")),class:"text-left text-sm text-tertiary hover:text-tertiary/80 transition-colors"}," Suggested: "+o(O.value.value)+" bpm (from "+o(Ae(O.value.date))+") â apply ",1)):u("",!0)]),t("div",ds,[e[56]||(e[56]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Max HR (bpm)",-1)),m(t("input",{"onUpdate:modelValue":e[15]||(e[15]=s=>b.value.max_hr=s),type:"number",min:"25",max:"250",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,b.value.max_hr,void 0,{number:!0}]])]),t("div",ps,[e[57]||(e[57]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Resting HR (bpm)",-1)),m(t("input",{"onUpdate:modelValue":e[16]||(e[16]=s=>b.value.resting_hr=s),type:"number",min:"25",max:"250",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,b.value.resting_hr,void 0,{number:!0}]])]),t("div",fs,[t("label",vs,"Threshold pace (min/"+o(r(te))+")",1),m(t("input",{"onUpdate:modelValue":e[17]||(e[17]=s=>N.value=s),type:"text",placeholder:"4:30",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,512),[[h,N.value]])]),t("div",ys,[t("label",bs,"Weight ("+o(r(ut))+")",1),m(t("input",{"onUpdate:modelValue":e[18]||(e[18]=s=>b.value.weight_kg=s),type:"number",min:Pt.value,max:Dt.value,step:"0.1",class:"bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 focus:ring-primary/50 transition"},null,8,gs),[[h,b.value.weight_kg,void 0,{number:!0}]])])]),q.value?(n(),i("div",xs,o(q.value),1)):u("",!0),t("div",ms,[t("button",{onClick:$t,disabled:K.value,class:"flex items-center gap-2 bg-primary text-on-primary px-6 py-2.5 rounded-lg text-base font-black uppercase tracking-widest hover:opacity-90 transition-opacity disabled:opacity-50"},[K.value?(n(),i("span",ks,"progress_activity")):(n(),i("span",_s,"save")),e[58]||(e[58]=v(" Save Changes "))],8,hs)]),wt.value?(n(),i("div",ws,[e[59]||(e[59]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-2"},"Training Zones",-1)),e[60]||(e[60]=t("p",{class:"text-base text-on-surface-variant mb-4"}," Computed from your threshold values â they update automatically when you save. ",-1)),ot(pa,{physiology:r(f).physiology},null,8,["physiology"])])):u("",!0)])):u("",!0),_.value==="Notifications"?(n(),i("div",Cs,[e[65]||(e[65]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-2"},"Email Notifications",-1)),e[66]||(e[66]=t("p",{class:"text-base text-on-surface-variant mb-6"}," Choose which emails Sporlyst sends you. Account emails â sign-up, password resets, email changes and payment receipts â are always sent. ",-1)),Ue.value?(n(),i("div",Ss,e[63]||(e[63]=[t("span",{class:"material-symbols-outlined text-base leading-none animate-spin"},"progress_activity",-1),v(" Loading preferences⦠")]))):(n(),i("div",Ps,[(n(),i(C,null,L(Te,s=>t("div",{key:s.key,class:"flex items-start gap-4 bg-surface-container rounded-xl p-4"},[t("button",{type:"button",role:"switch","aria-checked":w.value[s.key],"aria-label":s.label,onClick:M=>Gt(s.key),class:x(["relative inline-flex h-6 w-11 items-center rounded-full transition-colors flex-shrink-0 mt-0.5",w.value[s.key]?"bg-primary":"bg-surface-container-highest"])},[t("span",{class:x(["inline-block h-4 w-4 rounded-full bg-on-primary transform transition-transform",w.value[s.key]?"translate-x-6":"translate-x-1"])},null,2)],10,Ds),t("div",Fs,[t("span",$s,o(s.label),1),t("span",js,o(s.description),1)])])),64)),t("div",Ts,[t("button",{type:"button",onClick:Mt,disabled:le.value||Tt.value,class:"text-base font-bold uppercase tracking-widest text-on-surface-variant hover:text-on-surface transition-colors disabled:opacity-40"}," Turn all off ",8,Us),le.value?(n(),i("span",Gs,e[64]||(e[64]=[t("span",{class:"material-symbols-outlined text-base leading-none animate-spin"},"progress_activity",-1),v(" Saving⦠")]))):u("",!0)])]))])):u("",!0),_.value==="Connections"?(n(),i("div",Ms,[e[78]||(e[78]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-2"},"Connect Your Accounts",-1)),e[79]||(e[79]=t("p",{class:"text-base text-on-surface-variant uppercase tracking-widest mb-6"}
1," Connect your fitness accounts to automatically sync your activities ",-1)),t("div",Ls,[t("div",Ys,[e[70]||(e[70]=t("div",{class:"h-16 flex items-center justify-center"},[t("img",{src:oa,alt:"Strava",class:"max-h-full max-w-full object-contain"})],-1)),(y=r(f).profile)!=null&&y.has_strava?(n(),i(C,{key:0},[e[68]||(e[68]=t("div",{class:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg text-base font-black uppercase tracking-widest text-white opacity-60",style:{"background-color":"#FC4C02"}},[t("span",{class:"material-symbols-outlined text-base leading-none",style:{"font-variation-settings":"'FILL' 1"}},"check_circle"),v(" Connected ")],-1)),D.value&&!D.value.can_read_activities?(n(),i("p",Vs," Strava did not share your activities. Disconnect, then connect again and allow activity access. ")):Be.value?(n(),i("p",Is,o(Be.value),1)):u("",!0),t("button",{onClick:Wt,disabled:G.value,class:"w-full flex items-center justify-center gap-2 px-4 py-2 rounded-lg text-base font-bold uppercase tracking-widest text-primary bg-surface-container-high hover:bg-surface-container-highest transition-colors disabled:opacity-50"},[t("span",{class:x(["material-symbols-outlined text-base leading-none",{"animate-spin":G.value}])},o(G.value?"progress_activity":"sync"),3),v(" "+o(G.value?"Importingâ¦":`Import last ${(($=D.value)==null?void 0:$.days)??30} days`),1)],8,Ns),ge.value?(n(),i("div",As,[e[67]||(e[67]=t("p",{class:"text-base text-on-surface-variant leading-relaxed"}," New activities stop syncing. Activities already imported stay in your account. You can reconnect at any time. ",-1)),t("div",Es,[t("button",{onClick:Bt,disabled:xe.value,class:"px-4 py-2 bg-error text-on-error font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 disabled:opacity-50"},o(xe.value?"Disconnectingâ¦":"Confirm disconnect"),9,Rs),t("button",{onClick:e[20]||(e[20]=s=>ge.value=!1),class:"text-base text-on-surface-variant hover:text-on-surface"}," Keep connected ")])])):(n(),i("button",{key:2,onClick:e[19]||(e[19]=s=>ge.value=!0),class:"w-full text-base font-bold uppercase tracking-widest text-on-surface-variant hover:text-error transition-colors"}," Disconnect "))],64)):(n(),i("button",{key:1,onClick:e[21]||(e[21]=s=>r(ct)("connect")),class:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg text-base font-black uppercase tracking-widest hover:opacity-90 transition-opacity",style:{"background-color":"#FC4C02",color:"white"}},e[69]||(e[69]=[t("span",{class:"material-symbols-outlined text-base leading-none"},"link",-1),v(" Connect Strava ")]))),e[71]||(e[71]=t("a",{href:"https://www.strava.com",target:"_blank",rel:"noopener",class:"flex justify-center py-1"},[t("img",{src:la,alt:"Powered by Strava",class:"h-4 w-auto"})],-1))]),t("div",Ws,[e[75]||(e[75]=t("div",{class:"h-16 flex items-center justify-center"},[t("img",{src:ra,alt:"Garmin",class:"max-h-full max-w-full object-contain"})],-1)),(R=r(f).profile)!=null&&R.has_garmin?(n(),i(C,{key:0},[e[73]||(e[73]=t("div",{class:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg text-base font-black uppercase tracking-widest text-white opacity-60",style:{"background-color":"#007DC3"}},[t("span",{class:"material-symbols-outlined text-base leading-none",style:{"font-variation-settings":"'FILL' 1"}},"check_circle"),v(" Connected ")],-1)),de.value?(n(),i("div",Bs,[e[72]||(e[72]=t("p",{class:"text-base text-on-surface-variant leading-relaxed"}," New activities stop syncing. Activities already imported stay in your account. You can reconnect at any time. ",-1)),t("div",zs,[t("button",{onClick:Et,disabled:pe.value,class:"px-4 py-2 bg-error text-on-error font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 disabled:opacity-50"},o(pe.value?"Disconnectingâ¦":"Confirm disconnect"),9,Ks),t("button",{onClick:e[23]||(e[23]=s=>de.value=!1),class:"text-base text-on-surface-variant hover:text-on-surface"}," Keep connected ")])])):(n(),i("button",{key:0,onClick:e[22]||(e[22]=s=>de.value=!0),class:"w-full text-base font-bold uppercase tracking-widest text-on-surface-variant hover:text-error transition-colors"}," Disconnect "))],64)):(n(),i("button",{key:1,onClick:At,disabled:ue.value,class:"w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg text-base font-black uppercase tracking-widest hover:opacity-90 transition-opacity disabled:opacity-50 text-white",style:{"background-color":"#007DC3"}},[ue.value?(n(),i("span",Hs,"progress_activity")):(n(),i("span",Os,"link")),e[74]||(e[74]=v(" Connect Garmin "))],8,qs)),e[76]||(e[76]=t("p",{class:"text-center text-sm font-bold uppercase tracking-widest text-on-surface-variant"},[v(" Powered by "),t("a",{href:"https://connect.garmin.com",target:"_blank",rel:"noopener",class:"underline hover:text-primary"},"Garmin Connect")],-1))]),e[77]||(e[77]=ta('<div class="bg-surface-container rounded-xl p-4 flex flex-col gap-4"><div class="h-16 flex items-center justify-center opacity-50"><img src="'+va+'" alt="Wahoo" class="max-h-full max-w-full object-contain"></div><div class="text-center"><span class="inline-block px-2 py-0.5 rounded-full text-base font-black uppercase tracking-widest bg-primary/10 text-primary mb-2">Coming Soon</span></div><button disabled class="w-full flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg text-base font-black uppercase tracking-widest opacity-40 cursor-not-allowed bg-surface-container-high text-on-surface-variant"><span class="material-symbols-outlined text-base leading-none">link</span> Connect Wahoo </button></div>',1))])])):u("",!0),_.value==="Data Upload"?(n(),i("div",Zs,[e[85]||(e[85]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-6"},"Upload Activities",-1)),t("div",Js,[(n(),i(C,null,L(jt,s=>t("button",{key:s.type,onClick:M=>A.value=s.type,class:x(["px-4 py-2 rounded-md text-base font-black uppercase tracking-widest transition-all",A.value===s.type?"bg-primary text-on-primary":"text-on-surface-variant hover:text-on-surface"])},o(s.label),11,Qs)),64))]),t("p",Xs,[A.value==="fit"?(n(),i(C,{key:0},[e[80]||(e[80]=v(" Upload a ")),e[81]||(e[81]=t("span",{class:"text-primary font-bold"},".fit",-1)),e[82]||(e[82]=v(" file directly from your Garmin or Wahoo device. Includes full GPS route, heart rate, power, and cadence streams. "))],64)):(n(),i(C,{key:1},[v(" Upload a Garmin CSV export. Contains summary stats per activity â no GPS data. ")],64))]),t("div",en,[t("label",t
1n,[e[83]||(e[83]=t("span",{class:"material-symbols-outlined text-3xl text-on-surface-variant group-hover:text-primary transition-colors"},"upload_file",-1)),t("span",an,o(De.value||`Click to select a .${A.value} file`),1),t("input",{ref_key:"fileInput",ref:Pe,type:"file",accept:A.value==="fit"?".fit":".csv",class:"hidden",onChange:Lt},null,40,sn)]),Fe.value?(n(),i("div",nn,e[84]||(e[84]=[t("span",{class:"material-symbols-outlined text-base leading-none animate-spin"},"progress_activity",-1),v(" Uploading⦠")]))):u("",!0)])])):u("",!0),_.value==="Billing"?(n(),i("div",on,[e[103]||(e[103]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface"},"Billing",-1)),t("div",rn,[t("div",null,[e[86]||(e[86]=t("p",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant mb-1"},"Current Plan",-1)),t("p",ln,[t("span",{class:x(["material-symbols-outlined text-xl leading-none",r(j)?"text-primary":"text-on-surface-variant"]),style:{"font-variation-settings":"'FILL' 1"}},"workspace_premium",2),v(" "+o(r(j)?"Pro":"Free"),1)]),(me=r(T))!=null&&me.current_period_end&&!W.value?(n(),i("p",cn," Renews "+o(I(r(T).current_period_end)),1)):u("",!0),W.value&&((He=r(T))!=null&&He.current_period_end)?(n(),i("p",un," Cancels "+o(I(r(T).current_period_end))+" â access until then ",1)):u("",!0)]),r(j)?u("",!0):(n(),X(l,{key:0,to:"/upgrade",class:"px-5 py-2.5 bg-primary text-on-primary font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 transition-all whitespace-nowrap"},{default:he(()=>e[87]||(e[87]=[v("Upgrade to Pro")])),_:1}))]),r(j)&&vt.value&&!W.value?(n(),i("div",dn,[B.value?(n(),i("div",pn,e[88]||(e[88]=[t("span",{class:"material-symbols-outlined text-2xl text-primary animate-spin"},"progress_activity",-1),t("span",{class:"text-base font-bold uppercase tracking-widest text-on-surface"},"Processing paymentâ¦",-1)]))):u("",!0),e[92]||(e[92]=t("p",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Switch to Yearly",-1)),e[93]||(e[93]=t("p",{class:"text-base text-on-surface-variant"}," Save with an annual plan. Your unused monthly days will be credited and the difference charged today. ",-1)),z.value?(n(),i("div",vn,[V.value?(n(),i("div",yn,e[89]||(e[89]=[t("span",{class:"material-symbols-outlined text-base animate-spin"},"progress_activity",-1),t("span",{class:"text-base"},"Calculating chargeâ¦",-1)]))):S.value?(n(),i("div",bn,[(n(!0),i(C,null,L(S.value.lines,s=>(n(),i("div",{key:s.description,class:"flex justify-between text-base"},[t("span",gn,o(s.description),1),t("span",{class:x(s.amount<0?"text-primary":"text-on-surface")},o(s.amount<0?"-":"")+o(S.value.currency)+" "+o(Math.abs(s.amount).toFixed(2)),3)]))),128)),S.value.tax>0?(n(),i("div",xn,[e[90]||(e[90]=t("span",null,"VAT",-1)),t("span",null,o(S.value.currency)+" "+o(S.value.tax.toFixed(2)),1)])):u("",!0),t("div",mn,[e[91]||(e[91]=t("span",{class:"text-on-surface"},"Charged today",-1)),t("span",hn,o(S.value.currency)+" "+o(S.value.amount_due.toFixed(2)),1)])])):u("",!0),t("div",kn,[t("button",{onClick:ht,disabled:B.value||V.value||!S.value,class:"px-4 py-2 bg-primary text-on-primary font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 disabled:opacity-50"},o(B.value?"Switchingâ¦":"Confirm & pay"),9,_n),t("button",{onClick:e[24]||(e[24]=s=>{z.value=!1,S.value=null}),class:"text-base text-on-surface-variant hover:text-on-surface"}," Cancel ")])])):(n(),i("button",{key:1,onClick:mt,disabled:V.value,class:"px-4 py-2 bg-primary text-on-primary font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 disabled:opacity-50"},o(V.value?"Loadingâ¦":"Switch to yearly"),9,fn))])):u("",!0),r(j)&&!W.value?(n(),i("div",wn,[e[94]||(e[94]=t("p",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Cancel Subscription",-1)),e[95]||(e[95]=t("p",{class:"text-base text-on-surface-variant"}," You keep Pro access until the end of your billing period. No refunds for partial periods. ",-1)),ae.value?(n(),i("div",Cn,[t("button",{onClick:kt,disabled:se.value,class:"px-4 py-2 bg-error text-on-error font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 disabled:opacity-50"},o(se.value?"Cancelingâ¦":"Confirm cancel"),9,Sn),t("button",{onClick:e[26]||(e[26]=s=>ae.value=!1),class:"text-base text-on-surface-variant hover:text-on-surface"}," Keep subscription ")])):(n(),i("button",{key:0,onClick:e[25]||(e[25]=s=>ae.value=!0),class:"text-base font-bold uppercase tracking-widest text-error hover:underline"},"Cancel auto-renewal"))])):u("",!0),r(j)&&W.value?(n(),i("div",Pn,[e[96]||(e[96]=t("p",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"Resume Subscription",-1)),t("p",Dn," Changed your mind? Resume now and your subscription will continue as normal after "+o(I(r(T).current_period_end))+". ",1),t("button",{onClick:xt,disabled:ne.value,class:"px-4 py-2 bg-primary text-on-primary font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 disabled:opacity-50"},o(ne.value?"Resumingâ¦":"Resume subscription"),9,Fn)])):u("",!0),t("div",$n,[t("div",jn,[t("div",null,[e[97]||(e[97]=t("p",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant mb-1"},"Coach Plan",-1)),t("p",Tn,[t("span",{class:x(["material-symbols-outlined text-xl leading-none",r(F)?"text-primary":"text-on-surface-variant"]),style:{"font-variation-settings":"'FILL' 1"}},"sports",2),v(" "+o(yt.value),1)]),r(F)?(n(),i("p",Un,[((Oe=r(g))==null?void 0:Oe.seat_limit)===null?(n(),i(C,{key:0},[v(o((Ze=r(g))==null?void 0:Ze.seats_used)+" trainees · unlimited seats ",1)],64)):(n(),i(C,{key:1},[v(o((Je=r(g))==null?void 0:Je.seats_used)+" / "+o((Qe=r(g))==null?void 0:Qe.seat_limit)+" trainee seats used ",1)],64))])):u("",!0),((Xe=r(g))==null?void 0:Xe.status)==="trialing"&&r(F)?(n(),i("p",Gn,o(r(g).tri
1al_days_left)+" "+o(r(g).trial_days_left===1?"day":"days")+" left â no card on file ",1)):u("",!0),((et=r(g))==null?void 0:et.status)==="expired"?(n(),i("p",Mn," Your data is kept and exportable. Pick a plan to start scheduling again. ")):u("",!0),r(F)&&((tt=r(g))!=null&&tt.current_period_end)&&!r(g).cancel_at_period_end?(n(),i("p",Ln," Renews "+o(I(r(g).current_period_end)),1)):u("",!0),r(F)&&((at=r(g))!=null&&at.cancel_at_period_end)&&r(g).current_period_end?(n(),i("p",Yn," Cancels "+o(I(r(g).current_period_end))+" â access until then ",1)):u("",!0)]),r(F)?(n(),X(l,{key:1,to:"/coach-plans",class:"text-base font-bold uppercase tracking-widest text-primary hover:opacity-80 transition-opacity whitespace-nowrap"},{default:he(()=>e[99]||(e[99]=[v("Change plan")])),_:1})):(n(),X(l,{key:0,to:"/coach-plans",class:"px-5 py-2.5 bg-surface-container-high text-primary font-black uppercase tracking-widest rounded-lg text-base hover:bg-surface-container-highest transition-all whitespace-nowrap"},{default:he(()=>e[98]||(e[98]=[v("See Coach plans")])),_:1}))]),r(F)&&((st=r(g))==null?void 0:st.status)!=="trialing"&&!((nt=r(g))!=null&&nt.cancel_at_period_end)?(n(),i("div",Vn,[ie.value?(n(),i("div",In,[t("button",{onClick:bt,disabled:U.value,class:"px-4 py-2 bg-error text-on-error font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 disabled:opacity-50"},o(U.value?"Cancelingâ¦":"Confirm cancel"),9,Nn),t("button",{onClick:e[28]||(e[28]=s=>ie.value=!1),class:"text-base text-on-surface-variant hover:text-on-surface"}," Keep plan ")])):(n(),i("button",{key:0,onClick:e[27]||(e[27]=s=>ie.value=!0),class:"text-base font-bold uppercase tracking-widest text-error hover:underline"},"Cancel Coach plan"))])):u("",!0),r(F)&&((it=r(g))!=null&&it.cancel_at_period_end)?(n(),i("div",An,[t("button",{onClick:gt,disabled:U.value,class:"px-4 py-2 bg-primary text-on-primary font-black uppercase tracking-widest rounded-lg text-base hover:opacity-90 disabled:opacity-50"},o(U.value?"Resumingâ¦":"Resume Coach plan"),9,En)])):u("",!0)]),t("div",null,[e[102]||(e[102]=t("p",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant mb-3"},"Payment History",-1)),Se.value?(n(),i("div",Rn,e[100]||(e[100]=[t("span",{class:"material-symbols-outlined text-2xl text-primary animate-spin"},"progress_activity",-1)]))):r(j)?Ce.value.length===0?(n(),i("p",Bn,"No invoices found.")):(n(),i("div",zn,[(n(!0),i(C,null,L(Ce.value,s=>(n(),i("div",{key:s.id,class:"flex items-center justify-between py-3 gap-4"},[t("div",null,[t("p",Kn,o(s.currency)+" "+o(s.amount.toFixed(2)),1),t("p",qn,o(I(new Date(s.date*1e3).toISOString())),1)]),t("div",Hn,[t("span",{class:x(["text-xs font-bold uppercase tracking-widest px-2 py-0.5 rounded-full",s.status==="paid"?"bg-primary/10 text-primary":"bg-error/10 text-error"])},o(s.status),3),s.pdf?(n(),i("a",{key:0,href:s.pdf,target:"_blank",class:"text-base text-on-surface-variant hover:text-primary transition-colors",title:"Download PDF"},e[101]||(e[101]=[t("span",{class:"material-symbols-outlined text-base leading-none"},"download",-1)]),8,On)):u("",!0)])]))),128))])):(n(),i("p",Wn,"No payments yet."))])])):u("",!0),_.value==="Delete Profile"?(n(),i("div",Zn,[e[106]||(e[106]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-6"},"Delete Profile",-1)),t("div",{class:"border border-error/30 rounded-xl p-6"},[e[105]||(e[105]=t("p",{class:"text-base text-error uppercase tracking-widest font-bold mb-4"},"Warning: This action cannot be undone.",-1)),t("button",{onClick:It,class:"flex items-center gap-2 border border-error text-error px-5 py-2.5 rounded-lg text-base font-black uppercase tracking-widest hover:bg-error/10 transition-colors"},e[104]||(e[104]=[t("span",{class:"material-symbols-outlined text-base leading-none"},"delete",-1),v(" Delete Profile ")]))])])):u("",!0)])])]),(n(),X(rt,{to:"body"},[fe.value?(n(),i("div",Jn,[t("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e[29]||(e[29]=s=>fe.value=!1)}),t("div",Qn,[e[108]||(e[108]=t("h3",{class:"text-sm font-black uppercase tracking-widest text-error mb-2"},"Delete Account",-1)),e[109]||(e[109]=t("p",{class:"text-sm text-on-surface-variant uppercase tracking-widest mb-6"}," This will permanently delete your account and all data. This cannot be undone. ",-1)),t("div",Xn,[t("button",{type:"button",onClick:e[30]||(e[30]=s=>fe.value=!1),class:"px-4 py-2 rounded-lg text-sm font-black uppercase tracking-widest text-on-surface-variant hover:bg-surface-container-high transition-colors"}," Cancel "),t("button",{onClick:Nt,disabled:ve.value,class:"flex items-center gap-1.5 bg-error text-on-error px-4 py-2 rounded-lg text-sm font-black uppercase tracking-widest hover:opacity-90 transition-opacity disabled:opacity-50"},[ve.value?(n(),i("span",ti,"progress_activity")):(n(),i("span",ai,"delete_forever")),e[107]||(e[107]=v(" Confirm "))],8,ei)])])])):u("",!0)])),(n(),X(rt,{to:"body"},[Z.value?(n(),i("div",si,[t("div",{class:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e[31]||(e[31]=s=>Z.value=!1)}),t("div",ni,[e[112]||(e[112]=t("h3",{class:"text-base font-black uppercase tracking-widest text-on-surface mb-2"},"Change Email Address",-1)),e[113]||(e[113]=t("p",{class:"text-base text-on-surface-variant uppercase tracking-widest mb-6"}
1," A verification link will be sent to your new email address. ",-1)),t("div",ii,[e[110]||(e[110]=t("label",{class:"text-base font-bold uppercase tracking-widest text-on-surface-variant"},"New Email Address",-1)),m(t("input",{"onUpdate:modelValue":e[32]||(e[32]=s=>J.value=s),type:"email",placeholder:"[email protected]",onKeyup:aa(qe,["enter"]),class:x(["bg-surface-container rounded-lg px-4 py-2.5 text-base text-on-surface outline-none focus:ring-1 transition",E.value?"ring-1 ring-error focus:ring-error":"focus:ring-primary/50"])},null,34),[[h,J.value]]),E.value?(n(),i("p",oi,o(E.value),1)):u("",!0)]),t("div",ri,[t("button",{type:"button",onClick:e[33]||(e[33]=s=>Z.value=!1),class:"px-5 py-2 rounded-lg text-base font-black uppercase tracking-widest text-on-surface-variant hover:bg-surface-container-high transition-colors"}," Cancel "),t("button",{onClick:qe,disabled:ce.value,class:"flex items-center gap-2 bg-primary text-on-primary px-5 py-2 rounded-lg text-base font-black uppercase tracking-widest hover:opacity-90 transition-opacity disabled:opacity-50"},[ce.value?(n(),i("span",ci,"progress_activity")):(n(),i("span",ui,"mark_email_read")),e[111]||(e[111]=v(" Send Verification "))],8,li)])])])):u("",!0)]))])}}});export{_i 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.