import{d as L,u as S,ah as E,ct as C,ae as M,r as f,e as w,f as a,h as s,x as c,v as u,g as e,bi as U,aG as V,aJ as I,aI as N,F as R,y as $,i as h,C as F,z as G,a0 as q,o as r,B as D,cu as H}from"./BxiWQxwE.js";import{H as O,_ as j}from"./Mgz3HV5C.js";const z={standard:O},A={class:"login-form"},J={key:0},K={class:"login-form__input-field"},Q={for:"username"},W={key:0},X={class:"login-form__input-field__wrapper"},Y=["placeholder"],Z={key:1,class:"login-form__errors"},ee={class:"login-form__flex-wrapper"},se={type:"submit"},ae=L({__name:"CloudForgotPassword",props:{messages:{type:Object,default:()=>({})},showTitles:{type:Boolean,default:!0},showLabels:{type:Boolean,default:!1},showIcons:{type:Boolean,default:!0},togglePasswordVisibility:{type:Boolean,default:!0}},setup(i){const y=i,v=S(),{currentSiteIso:g}=E(),{messages:b}=C(y),{resetPassword:k}=M(),_=f(!1),m=f([]),P=w(()=>`${H(g.value)}?returnUrl=${String(v.query.returnUrl)??v.path}`),n=f(""),t=w(()=>{const p=g.value.toUpperCase();return z.standard[p].auth}),o=w(()=>({username:t.value.username,password:t.value.password,forgotPassword:t.value.lostPassword,backToLogin:t.value.backToLogin,send:t.value.send,forgotPasswordTitle:t.value.lostPassword,resetPasswordErrorMessage:t.value.resetPasswordErrorMessage,...b.value})),T=()=>{_.value=!1,m.value=[]},x=async()=>{if(T(),!n.value){m.value.push(o.value.resetPasswordErrorMessage),_.value=!0;return}await k({username:n.value})};return(p,d)=>{const B=q;return r(),a("div",A,[s("form",{onSubmit:d[1]||(d[1]=G(l=>x(),["prevent"]))},[i.showTitles?(r(),a("h1",J,u(e(o).forgotPasswordTitle),1)):c("",!0),s("div",K,[s("label",Q,[i.showLabels?(r(),a("span",W,u(e(o).username),1)):c("",!0),s("div",X,[i.showIcons?U(p.$slots,"user-icon",{key:0},()=>[h(j,{icon:"user"})]):c("",!0),V(s("input",{id:"username","onUpdate:modelValue":d[0]||(d[0]=l=>N(n)?n.value=l:null),type:"text",placeholder:e(o).username,"aria-required":"true",autocomplete:"username"},null,8,Y),[[I,e(n)]])])])]),e(_)?(r(),a("div",Z,[s("ul",null,[(r(!0),a(R,null,$(e(m),l=>(r(),a("li",{key:l,role:"alert",class:"error"},u(l),1))),128))])])):c("",!0),s("div",ee,[h(B,{to:e(P)},{default:F(()=>[D(u(e(o).backToLogin),1)]),_:1},8,["to"])]),s("button",se,u(e(o).send),1)],32)])}}});export{ae as default};
