1import{u as q,_ as G}from"./66qxjfSP.js";import{aS as M,dl as F,ds as H,d0 as O,ck as z,df as e,co as d,aE as y,aB as s,d5 as x,aD as k,F as P,cD as U,cd as K,av as I,cm as V,dJ as L,aC as R,dM as $,X as Y,aM as E,dQ as T,dN as Q,dG as W,b$ as J,cA as A,cG as B,aw as X,cR as Z,dr as ee,dp as te,aO as D,M as se,a8 as ae,a as ne,cb as oe,C as le}from"./DQ0-OjHB.js";import{_ as j}from"./CkaVkg8B.js";import{u as re}from"./D8IRIzj6.js";import"./Qw4wAjIf.js";import"./B1jvW_lo.js";import"./C1W-148R.js";import"./CNVFa_WZ.js";(function(){try{var c=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};c.SENTRY_RELEASE={id:"856ea8a89609759cbc0129a94ad9628e840a24bc"};var u=new c.Error().stack;u&&(c._sentryDebugIds=c._sentryDebugIds||{},c._sentryDebugIds[u]="138f79dd-fbb5-4dba-a5cd-bea089256ba5",c._sentryDebugIdIdentifier="sentry-dbid-138f79dd-fbb5-4dba-a5cd-bea089256ba5")}catch{}})();const ie={key:0,class:"ref-account-newsletter ref-panel bg-surface text-surface-on rounded-2xl px-6"},de={class:"flex flex-col gap-6 py-6"},ce={key:0,class:"text-[0.875rem] text-gray-500"},ue={key:1,class:"flex items-center justify-between gap-4"},me={class:"text-[0.875rem] text-warning"},fe={key:2,class:"flex flex-col gap-4"},pe={key:0,class:"text-[0.875rem] text-gray-500"},be={class:"font-medium"},ye={class:"text-[0.875rem] text-gray-500"},ve=["checked","disabled","onChange"],ge={key:1,class:"text-[0.875rem] text-warning"},he=M({__name:"Newsletter",setup(c){const u=F(),f=H(),{preferences:n,loading:h,saving:v,error:l,saveError:i,isAvailable:p}=O(f),b=(g,a)=>f.setChannel(g,a);z(()=>f.load());const C=I(()=>!!u.user?.phoneNumber),r=I(()=>!n.value?.email&&!n.value?.sms),o=I(()=>[{key:"email",label:"Email",description:"Competition launches, results and offers by email.",disabled:n.value?.email===null,hint:n.value?.email===null?"Unavailable for your account":void 0},{key:"sms",label:"Text message",description:"Reminders and results by SMS.",disabled:!C.value||n.value?.sms===null,hint:C.value?n.value?.sms===null?"Unavailable for your account":void 0:"Add a phone number to receive text updates"}]);async function _(g,a){const t=a.target;await b(g,t.checked)||(t.checked=!!n.value?.[g])}return(g,a)=>e(h)||e(l)||e(p)?(d(),y("div",ie,[s("div",de,[a[3]||(a[3]=s("div",null,[s("h3",{class:"text-xl font-semibold"}," Newsletter "),s("p",{class:"text-[0.875rem] text-gray-500 mt-1"}," Choose how you'd like to hear from us. You can change this at any time. ")],-1)),e(h)?(d(),y("p",ce," Loading your preferences⦠")):e(l)?(d(),y("div",ue,[s("p",me,x(e(l)),1),s("button",{class:"btn btn-sm px-5",onClick:a[0]||(a[0]=t=>e(f).load())}," Try again ")])):(d(),y("div",fe,[e(r)?(d(),y("p",pe," You're not currently subscribed. Turn on a channel below to start receiving updates. ")):k("",!0),(d(!0),y(P,null,U(e(o),t=>(d(),y("div",{key:t.key,class:"flex items-center justify-between gap-4"},[s("div",null,[s("p",be,x(t.label),1),s("p",ye,x(t.hint??t.description),1)]),s("label",{class:K(["relative inline-flex items-center shrink-0",t.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"])},[s("input",{type:"checkbox",class:"sr-only peer",checked:!!e(n)?.[t.key],disabled:t.disabled||e(v)===t.key,onChange:m=>_(t.key,m)},null,40,ve),a[1]||(a[1]=s("div",{class:"w-11 h-6 bg-gray-300 rounded-full peer-checked:bg-primary transition-colors"},null,-1)),a[2]||(a[2]=s("div",{class:"absolute left-1 w-4 h-4 bg-white rounded-full transition-transform peer-checked:translate-x-5"},null,-1))],2)]))),128)),e(i)?(d(),y("p",ge,x(e(i)),1)):k("",!0)]))])])):k("",!0)}}),xe={class:"ref-account-delete-confirm ref-panel px-5 pb-5"},_e={key:0},we={class:"flex items-center justify-between mt-8"},ke=["disabled"],Ce={key:1},Se={class:"mt-3 text-center"},De=["disabled"],Ae={class:"flex items-center justify-between mt-8"},$e=["disabled"],Ne=M({__name:"DeleteAccountConfirmation",props:{show:{type:Boolean},close:{type:Function}},emits:["deleted"],setup(c,{emit:u}){const f=c,n=u,h=A("warning"),v=A(""),l=A(""),i=A(!1),p=A(0);let b;function C(){p.value=60,clearInterval(b),b=Z(()=>{p.value--,p.value<=0&&clearInterval(b)}
1,1e3)}async function r(){i.value=!0,l.value="";try{await B(),h.value="verify",C()}catch(a){l.value=a.message||"Failed to send verification code."}finally{i.value=!1}}async function o(){if(v.value.length!==6){l.value="Please enter the 6-digit code.";return}i.value=!0,l.value="";try{await X({code:v.value}),n("deleted")}catch(a){l.value=a.message||"Failed to delete account."}finally{i.value=!1}}async function _(){if(!(p.value>0)){i.value=!0,l.value="";try{await B(),C()}catch(a){l.value=a.message||"Failed to resend code."}finally{i.value=!1}}}function g(){h.value="warning",v.value="",l.value="",i.value=!1,p.value=0,clearInterval(b)}return V(()=>{clearInterval(b)}),L(()=>f.show,a=>{a||g()}),(a,t)=>{const m=j,N=Y;return d(),R(N,{show:c.show,close:c.close,title:"Delete your account"},{default:$(()=>[s("div",xe,[e(h)==="warning"?(d(),y("div",_e,[t[3]||(t[3]=s("p",{class:"font-semibold text-error"}," This action is permanent and cannot be undone. ",-1)),t[4]||(t[4]=s("p",{class:"mt-2"}," All your data will be deleted. A verification code will be sent to your email to confirm this action. ",-1)),e(l)?(d(),R(m,{key:0,background:!0,type:"error",class:"mt-4"},{default:$(()=>[E(x(e(l)),1)]),_:1})):k("",!0),s("footer",we,[s("button",{class:"btn btn-secondary",onClick:t[0]||(t[0]=T((...S)=>c.close&&c.close(...S),["prevent"]))}," Cancel "),s("button",{class:"btn bg-warning text-white hover:bg-red-700",disabled:e(i),onClick:T(r,["prevent"])},x(e(i)?"Sending...":"Send Verification Code"),9,ke)])])):k("",!0),e(h)==="verify"?(d(),y("div",Ce,[t[5]||(t[5]=s("p",{class:"mb-4"}," Enter the 6-digit code sent to your email. ",-1)),Q(s("input",{"onUpdate:modelValue":t[1]||(t[1]=S=>J(v)?v.value=S:null),type:"text",maxlength:"6",inputmode:"numeric",pattern:"[0-9]{6}",placeholder:"000000",class:"w-full text-center text-2xl tracking-[0.3em] font-mono border border-surface-on-300 rounded-xl p-3 focus:outline-none focus:ring-2 focus:ring-primary"},null,512),[[W,e(v)]]),e(l)?(d(),R(m,{key:0,background:!0,type:"error",class:"mt-4"},{default:$(()=>[E(x(e(l)),1)]),_:1})):k("",!0),s("div",Se,[s("button",{class:"text-sm text-primary underline disabled:opacity-50 disabled:no-underline",disabled:e(p)>0||e(i),onClick:T(_,["prevent"])},x(e(p)>0?`Resend code in ${e(p)}s`:"Resend code"),9,De)]),s("footer",Ae,[s("button",{class:"btn btn-secondary",onClick:t[2]||(t[2]=T((...S)=>c.close&&c.close(...S),["prevent"]))}," Cancel "),s("button",{class:"btn bg-warning text-white hover:bg-red-700",disabled:e(i)||e(v).length!==6,onClick:T(o,["prevent"])},x(e(i)?"Deleting...":"Confirm Deletion"),9,$e)])])):k("",!0)])]),_:1},8,["show","close"])}}}),Te={class:"flex flex-col gap-6"},Ie={class:"ref-account-delete ref-panel bg-surface text-surface-on rounded-2xl px-6"},Re={class:"flex flex-col gap-6 py-6"},Ee={class:"flex justify-between items-center gap-4"},qe=M({__name:"profile",setup(c){ee({title:"Profile"});const u=q(),f=F(),n=re(),h=te(),v=I(()=>h.getConfigByKey(le.REGISTRATION.IS_BIRTHDATE_REQUIRED)==="true"),l=I(()=>{const r=f.user,o=[{name:"firstName",label:"First name",value:"",type:"text",colSpan:2},{name:"lastName",label:"Last name",value:"",type:"text",colSpan:2},{name:"email",label:"Email",value:"",type:"email",colSpan:2},{name:"phoneNumber",label:"Phone",value:"",type:"tel",colSpan:2}];v.value&&o.push({name:"birthday",label:"Date of birth",value:"",type:"date",colSpan:2});const _=o.map(t=>{const m=t.name;return{...t,value:r[m]||void 0}}),g=[{name:"address",label:"Street",value:"",type:"text",colSpan:2},{name:"address2",label:" ",value:"",type:"text",colSpan:2},{name:"city",label:"Town/City",value:"",type:"text",colSpan:2},{name:"postCode",label:"Postcode",value:"",type:"text",colSpan:2},{name:"countryCode",label:"Country",value:"",type:"select",options:h.getAllowedCountries.map(({name:t,code:m})=>({label:t,value:m})),colSpan:2}].map(t=>{if(r?.addresses?.length??!1){const m=r.addresses[0],N=t.name;return{...t,value:m[N]??void 0}}return t}),a=[{name:"displayName",label:"Display name",value:r.displayName||"",type:"text",colSpan:2,placeholder:"Enter your public display name",pattern:"^[a-zA-Z0-9\\s\\-_']{2,50}$",conditionallyRequired:!0,requiredWhen:"isAnonymous",requiredWhenValue:!0,helpText:"Used when anonymous identity is enabled"}
1,{name:"isAnonymous",label:"Anonymous",value:r.isAnonymous||!1,type:"checkbox",colSpan:2,helpText:"Hide your real name on leaderboards and winner announcements"}].map(t=>{const m=t.name;return{...t,value:r[m]??t.value}});return[{title:"Your details",fields:_},{title:"Privacy Settings",fields:a},{title:"Billing address",fields:g}]});async function i(r){switch(u.title){case"Your details":await n.updateUser({id:f.user?.id,...r});break;case"Privacy Settings":await n.updateUser({id:f.user?.id,...r});break;case"Billing address":{const o=(f.user?.addresses??[])[0];o?await n.updateAddress({id:o.id,...r}):await n.createAddress({...r,type:ne.BILLING});break}}}function p(){f.open("forgotPassword")}const b=A(!1);async function C(){b.value=!1,await f.logout(),oe("/")}return L(()=>u.show,r=>{r||n.$clean()}),V(()=>{n.$clean()}),(r,o)=>{const _=G,g=he,a=Ne,t=j,m=se,N=Y,S=ae;return d(),y("div",Te,[(d(!0),y(P,null,U(e(l),w=>(d(),R(_,{key:w.title,heading:w.title,fields:w.fields,onClick:Me=>e(u).open(w.title,w.fields)},null,8,["heading","fields","onClick"]))),128)),D(_,{key:"password",heading:"Reset password",onClick:p}),D(g),s("div",Ie,[s("div",Re,[s("div",Ee,[o[2]||(o[2]=s("div",null,[s("h3",{class:"text-xl font-semibold"}," Delete your account "),s("p",{class:"text-sm text-gray-500 mt-1"}," Permanently delete your account and all associated data. ")],-1)),s("button",{class:"btn btn-sm px-5 gap-2 bg-warning text-white hover:bg-red-700",onClick:o[0]||(o[0]=w=>b.value=!0)}," Delete ")])])]),D(a,{show:e(b),close:()=>b.value=!1,onDeleted:C},null,8,["show","close"]),D(N,{title:e(u).title,show:e(u).show,close:e(u).close},{default:$(()=>[D(m,{class:"ref-account-details-edit","display-header":!1,"form-fields":e(u).fields,"submit-button":!0,title:e(u).title,onSubmit:o[1]||(o[1]=w=>i(w))},{"submit-buttons":$(()=>[e(n).error||e(n).message?(d(),R(t,{key:0,background:!0,type:e(n).error?"error":"success"},{default:$(()=>[o[3]||(o[3]=s("div",{class:"bg-success-50"},null,-1)),E(" "+x(e(n).error||e(n).message),1)]),_:1},8,["type"])):k("",!0),o[4]||(o[4]=s("button",{type:"submit",class:"btn btn-primary w-full"}," Save ",-1))]),_:1},8,["form-fields","title"])]),_:1},8,["title","show","close"]),D(S)])}}});export{qe 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.