import{_ as U,a as V}from"./hLi6Tdy_.js";import{_ as k}from"./Du23p2ZK.js";import{_ as C}from"./dbr-bJEC.js";import{e as D}from"./lRkhHGoP.js";import{v as F,s as R,m as E,A as O,n as T,H as I,r as y,_ as N,o as d,c as w,L as B,aw as H,a as M,b as m,w as c,d as _,t as p,q as b,p as W,I as j}from"./CChoqk00.js";import{u as q}from"./MVVtZ0CP.js";import{u as A}from"./DTzhji9-.js";import{u as h}from"./oBAm95WQ.js";import"./DgZ9OEJo.js";import"./D7TmchvX.js";import"./4Fu3KWqy.js";import"./BBOawLyY.js";const L=F({__name:"ResetPasswordFormStep3",setup(r,{expose:s}){s();const o=R(),e=E(),{t:f}=O(),i=T();o.signUpData.email.length===0&&(i.currentStep=0);const{passwordError:a,isPasswordValid:u}=q(),n=I().public.WHM_EXTRAS,l=y(!1),t=y(""),x=async()=>{if(!u())return;if(n&&!t.value){a.value=f("OTPCodeRequired");return}const P=n?t.value:o.signUpData.token,{error:v}=await o.passwordReset(P,o.signUpData.password);if(v){a.value=v;return}l.value=!0,h(()=>{e.push("/login"),h(()=>{o.clearData(),o.clearOtp(),i.currentStep=0},1e3)},5e3)},{tracker:g}=A();g("page_view","page","reset password step 3");const S={sStore:o,router:e,t:f,store:i,passwordError:a,isPasswordValid:u,isWhm:n,showSuccess:l,otpCode:t,setNewPassword:x,tracker:g,get VOtpInput(){return D}};return Object.defineProperty(S,"__isScriptSetup",{enumerable:!1,value:!0}),S}}),z={key:0,class:"mb-4"},X={key:1,class:"py-3 px-4 bg-emerald-100 outline outline-1 outline-green-500 rounded text-sm text-emerald-800"};function G(r,s,o,e,f,i){const a=U,u=V,n=k,l=C;return e.showSuccess?(d(),w("div",X,p(r.$t("PasswordSuccessFullyChanged")),1)):(d(),w("form",{key:0,onSubmit:j(e.setNewPassword,["prevent"])},[B(M("input",{id:"email","onUpdate:modelValue":s[0]||(s[0]=t=>e.sStore.signUpData.email=t),type:"email",class:"hidden"},null,512),[[H,e.sStore.signUpData.email]]),m(a,{modelValue:e.sStore.signUpData.password,"onUpdate:modelValue":s[1]||(s[1]=t=>e.sStore.signUpData.password=t),class:"mb-4",type:"password","id-":"new-password",autocomplete:"new-password"},{default:c(()=>[_(p(r.$t("Password")),1)]),_:1},8,["modelValue"]),e.isWhm?(d(),w("div",z,[m(u,null,{default:c(()=>[_(p(r.$t("EnterOTPCode")),1)]),_:1}),m(e.VOtpInput,{ref:"otpInput",value:e.otpCode,"onUpdate:value":s[2]||(s[2]=t=>e.otpCode=t),"input-classes":"otp-input","conditional-class":["one","two","three","four"],separator:"","input-type":"number","num-inputs":6,"should-auto-focus":!0,"should-focus-order":!0,placeholder:[],class:"flex gap-4"},null,8,["value"])])):b("",!0),e.passwordError?(d(),W(n,{key:1},{default:c(()=>[_(p(e.passwordError),1)]),_:1})):b("",!0),m(l,{size:"small",class:"px-8 py-2",type:"submit",tag:"button"},{default:c(()=>[_(p(r.$t("Finish")),1)]),_:1})],32))}const ne=Object.assign(N(L,[["render",G],["__file","ResetPasswordFormStep3.vue"]]),{__name:"ResetPasswordFormStep3"});export{ne as default};
