const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./WebSystemOutageMessaging-DbgmkouI.mjs","./B6m6oxrG.js","./entry.Dr2vXc07.css","./WebSystemOutageMessaging.ByU8g0wO.css"])))=>i.map(i=>d[i]); import{_ as S,g as h,d as l,e as n,P,j as a,x as c,f as t,h as u,r as m,t as k,bK as F,U as x,bL as I,bc as R,T as V,q as T,br as p,at as U,u as _,bD as O,R as W}from"#entry";import{_ as q}from"./WebSiteUserRegisteredSites-8K0XdmGx.mjs";const B=P(()=>W(()=>import("./WebSystemOutageMessaging-DbgmkouI.mjs"),__vite__mapDeps([0,1,2,3]),import.meta.url).then(e=>e.default||e)),C={setup(){return{recaptcha:O()}},data(){return{id:null,passwordValues:{password:"",recaptchaToken:""},userInfo:null,error:"",showErrors:!1,passwordErrors:{},path:"",processing:!1,message:null}},computed:{submitDisabled(){return!this.passwordValues.password},passwordFieldInfo(){return{rows:[{fields:{password:{type:"password",label:"Password",placeholder:"Enter Password",required:!0,maxLength:32,disabled:this.processing,showErrors:this.showErrors,icon:!0,confirmation:{required:!0,placeholder:"Confirm Password",label:"Re-enter"}}}}]}}},async mounted(){this.path=_().query?.redirectTo,this.id=_().path.split("/").pop();const e=await p.getSiteUserStub(this.id);e.error?this.error=`There was a problem completing your request. Please try again or contact customerservice@${this.$ss.tenantInfo.domain}.`:this.userInfo=e?.data},methods:{update(e,s,i){this.passwordValues[e]=s,this.passwordErrors[e]={errorObj:i}},submitForm(){this.showErrors=U(this.passwordErrors??{})>0},async handleSubmit(){try{if(this.error="",this.processing=!0,this.showErrors)throw new Error("Please correct the issues with this form");const e=await this.recaptcha("siteUserResetPassword"),s=await p.resetPassword(this.id,this.passwordValues.password,e);if(s?.error)throw new Error(s.message);this.message=s.data.message,window.location=this.path==="/account/login"?"/account/login":`/account/login?redirectTo=${this.path}`,this.processing=!1}catch(e){this.error=e,this.processing=!1}}}},D={key:0},N=["href"],z={key:1,class:"columns"},L={class:"column form"},j={class:"submit"};function $(e,s,i,d,r,o){const f=B,w=q,b=I,g=R,y=F,v=V;return e.$ss.systemOutage?.disableOmeda?(n(),h(f,{key:0})):(n(),l("div",{key:1,class:"choose-password-form",style:T({fontFamily:e.$ss.general.primaryFontFamily})},[a(v,null,{default:c(()=>[s[4]||(s[4]=t("h1",{class:"title",style:{color:"var(--color-primary-main)"}},[t("div",null,"Reset Password")],-1)),r.userInfo?.username?u("",!0):(n(),l("div",D,[s[1]||(s[1]=m(" The link you have clicked has already been used or is expired. Please submit your request again and if you continue to have problems, contact ",-1)),t("a",{href:`mailto:customerservice@${e.$ss.tenantInfo.domain}`},"customerservice@"+k(e.$ss.tenantInfo.domain),9,N),s[2]||(s[2]=m(" for further assistance. ",-1))])),r.userInfo?.username?(n(),l("div",z,[t("div",L,[a(y,{error:r.error,message:r.message,processing:r.processing},{default:c(()=>[t("form",{onSubmit:s[0]||(s[0]=x((...E)=>o.handleSubmit&&o.handleSubmit(...E),["prevent"]))},[s[3]||(s[3]=t("div",null," Please enter a new password for your account. This new password will take effect on all Endeavor brand sites. ",-1)),a(w,{"registered-sites":r.userInfo?.registeredSites??[]},null,8,["registered-sites"]),a(b,{"field-info":o.passwordFieldInfo,"field-values":r.passwordValues,onUpdate:o.update},null,8,["field-info","field-values","onUpdate"]),t("div",j,[a(g,{label:"Submit",type:"submit",size:"large",disabled:o.submitDisabled,onOnClick:o.submitForm},null,8,["disabled","onOnClick"])])],32)]),_:1},8,["error","message","processing"])])])):u("",!0)]),_:1})],4))}const A=Object.assign(S(C,[["render",$],["__scopeId","data-v-12dd900d"]]),{__name:"WebSiteUserResetPasswordForm"}),K={__name:"SiteUserResetPasswordBlock",props:{data:{type:Object,required:!0}},setup(e){return(s,i)=>{const d=A;return n(),h(d)}}};export{K as default};