import{L as S}from"./CircularLoading.1cc5445b.js";import{d as m,G as y,b as d,er as l,e as t,eA as o,u as s,ak as I,eE as $,eL as A,eu as k,eR as a,eB as T,eC as x,v as g,b0 as B,f as v}from"./registerWidgets.4340e287.js";import{t as C}from"./icons.da02f7f7.js";import{p as w}from"./passwordlessManager.8c70219b.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},i=new Error().stack;i&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[i]="8401c963-1db1-4d69-875f-b298ba8e15b2",n._sentryDebugIdIdentifier="sentry-dbid-8401c963-1db1-4d69-875f-b298ba8e15b2")}catch{}})();const D=n=>(T("data-v-45615a67"),n=n(),x(),n),V={class:"auth-info"},E={class:"auth-header"},K={class:"auth-label"},P={class:"description"},N=["onKeyup"],L={key:0,class:"span-error"},R=D(()=>t("div",{class:"spacer"},null,-1)),M=m({__name:"AuthInfo",props:{invalid:{type:Boolean,default:!1},header:{type:String}},emits:["sendAuthInfo"],setup(n,{emit:i}){const e=y({email:""}),r=()=>{i("sendAuthInfo",e)};return(f,u)=>(d(),l("div",V,[t("div",E,[t("div",K,o(n.header),1),t("div",P,o(s(a).get("i18n_auth_info_description")),1)]),I(t("input",{"onUpdate:modelValue":u[0]||(u[0]=p=>e.email=p),type:"email",placeholder:"Email address",class:"input email-input",onKeyup:A(r,["enter"])},null,40,N),[[$,e.email]]),n.invalid?(d(),l("span",L,o(s(a).get("i18n_auth_info_invalid_email")),1)):k("",!0),R,t("button",{class:"next-button",onClick:r},o(s(a).get("i18n_auth_info_send_code")),1)]))}});const U=g(M,[["__scopeId","data-v-45615a67"]]),G=n=>(T("data-v-5d186e2d"),n=n(),x(),n),j={class:"auth-token"},q={class:"auth-label"},z=["onKeyup"],F={key:0,class:"span-error"},H={key:1,class:"span-error"},J=G(()=>t("div",{class:"spacer"},null,-1)),O={class:"button-icon",viewBox:"0 0 24 24"},Q=["d"],W={class:"footer"},X=m({__name:"AuthToken",props:{expired:{type:Boolean},invalid:{type:Boolean},email:{}},emits:["sendToken","restartAuth","resendToken"],setup(n,{emit:i}){const e=y({token:""}),r=()=>{i("restartAuth")},f=()=>{i("resendToken")},u=()=>{i("sendToken",e.token)};return(p,c)=>(d(),l("div",j,[t("div",q,o(s(a).get("i18n_auth_token_label",{email:p.email})),1),I(t("input",{"onUpdate:modelValue":c[0]||(c[0]=_=>e.token=_),type:"text",placeholder:"Type your verification code",class:"input",onKeyup:A(u,["enter"])},null,40,z),[[$,e.token]]),p.expired?(d(),l("span",F,o(s(a).get("i18n_auth_token_expired")),1)):k("",!0),p.invalid?(d(),l("span",H,o(s(a).get("i18n_auth_token_invalid"))+"} ",1)):k("",!0),J,t("button",{class:"next-button",onClick:u},o(s(a).get("i18n_auth_token_verify_email")),1),t("button",{class:"secondary-button back",onClick:r},[(d(),l("svg",O,[t("path",{d:s(C)},null,8,Q)])),B(" "+o(s(a).get("i18n_auth_token_try_again")),1)]),t("button",{class:"secondary-button back",onClick:f},o(s(a).get("i18n_auth_token_resend_email")),1),t("div",W,o(s(a).get("i18n_auth_token_footer_alternative_email")),1)]))}});const Y=g(X,[["__scopeId","data-v-5d186e2d"]]),Z={key:0,class:"form"},ee={class:"form-wrapper"},te={class:"widget"},ne={key:1,class:"form"},se={class:"form-wrapper"},oe={class:"widget"},ae={key:2,class:"form"},ie={class:"form-wrapper"},de={class:"loading"},le=m({__name:"Passwordless",props:{header:{type:String,default:a.get("i18n_auth_validate_your_email")}},emits:["done"],setup(n,{emit:i}){const e=y({stage:"collect-info",info:null,token:null,invalid:!1}),r=async c=>{e.info=c,e.stage="loading";const _=await w.authenticate(c.email);e.invalid=!!_,_?e.stage="collect-info":e.stage="collect-token"},f=async c=>{var _;if(!!((_=e.info)!=null&&_.email)){e.token=c,e.stage="loading";try{const h=await w.verify(e.info.email,e.token);if(!h)throw new Error("no user");i("done",h),e.stage="done"}catch{e.invalid=!0,e.stage="collect-token"}}},u=()=>{e.info&&r(e.info)},p=()=>{e.stage="collect-info",e.info=null,e.token=null,e.invalid=!1};return(c,_)=>{var h,b;return e.stage==="collect-info"?(d(),l("div",Z,[t("div",ee,[t("div",te,[v(U,{invalid:e.invalid,header:n.header,onSendAuthInfo:r},null,8,["invalid","header"])])])])):e.stage==="collect-token"?(d(),l("div",ne,[t("div",se,[t("div",oe,[v(Y,{invalid:e.invalid,email:(b=(h=e.info)==null?void 0:h.email)!=null?b:"",onSendToken:f,onResendToken:u,onRestartAuth:p},null,8,["invalid","email"])])])])):(d(),l("div",ae,[t("div",ie,[t("div",de,[v(S)])])]))}}});const pe=g(le,[["__scopeId","data-v-40be29c6"]]);export{pe as P};
//# sourceMappingURL=Passwordless.81090626.js.map
