1import{aM as V,aN as O,aO as t,aP as r,aQ as te,aR as C,aS as ie,aT as x,aU as o,bt as B,cq as ae,bz as se,aL as j,aY as a,b3 as A,bd as W,aW as w,aX as N,a$ as G,aZ as h,b4 as R,b1 as Q,b2 as de,b9 as _,dL as Z,dN as ue,es as oe,by as H,c1 as X,bN as ce,bF as K,eu as ne,bG as me,b0 as pe,bw as z,b6 as Y,a_ as F,c6 as le,bu as J}from"./BmvteKEd.js";import{P as ee}from"./Bpd0wbhQ.js";import{T as q}from"./yJs4s2rB.js";import{I as re}from"./CQoG4LCK.js";import{G as fe}from"./DIEVE5Zj.js";import{T as ge}from"./ByYcavol.js";(function(){try{var p=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},e=new p.Error().stack;e&&(p._sentryDebugIds=p._sentryDebugIds||{},p._sentryDebugIds[e]="e98eef5a-a9d6-40d2-9b43-32a3f6ef77d1",p._sentryDebugIdIdentifier="sentry-dbid-e98eef5a-a9d6-40d2-9b43-32a3f6ef77d1")}catch{}})();const he=["width","height","fill","transform"],ve={key:0},we=o("path",{d:"M234.42,162A12,12,0,1,1,213.58,174l-16.86-29.5a127.19,127.19,0,0,1-30.17,13.86L171.84,190a12,12,0,0,1-9.87,13.8,11.22,11.22,0,0,1-2,.17,12,12,0,0,1-11.82-10L143,163.17a136.5,136.5,0,0,1-30.06,0L107.84,194A12,12,0,0,1,96,204a11.22,11.22,0,0,1-2-.17A12,12,0,0,1,84.16,190l5.29-31.72a127.19,127.19,0,0,1-30.17-13.86L42.42,174A12,12,0,1,1,21.58,162L40,129.85a159.73,159.73,0,0,1-17.31-18.31A12,12,0,0,1,41.34,96.46C57.38,116.32,85.44,140,128,140s70.62-23.68,86.66-43.54a12,12,0,0,1,18.67,15.08A159.73,159.73,0,0,1,216,129.85Z"},null,-1),ye=[we],xe={key:1},be=o("path",{d:"M224,104c-16.81,20.81-47.63,48-96,48s-79.19-27.19-96-48c16.81-20.81,47.63-48,96-48S207.19,83.19,224,104Z",opacity:"0.2"},null,-1),ke=o("path",{d:"M228,175a8,8,0,0,1-10.92-3l-19-33.2A123.23,123.23,0,0,1,162,155.46l5.87,35.22a8,8,0,0,1-6.58,9.21A8.4,8.4,0,0,1,160,200a8,8,0,0,1-7.88-6.69l-5.77-34.58a133.06,133.06,0,0,1-36.68,0l-5.77,34.58A8,8,0,0,1,96,200a8.4,8.4,0,0,1-1.32-.11,8,8,0,0,1-6.58-9.21L94,155.46a123.23,123.23,0,0,1-36.06-16.69L39,172A8,8,0,1,1,25.06,164l20-35a153.47,153.47,0,0,1-19.3-20A8,8,0,1,1,38.22,99c16.6,20.54,45.64,45,89.78,45s73.18-24.49,89.78-45A8,8,0,1,1,230.22,109a153.47,153.47,0,0,1-19.3,20l20,35A8,8,0,0,1,228,175Z"},null,-1),_e=[be,ke],Ce={key:2},Pe=o("path",{d:"M230.94,164A8,8,0,1,1,217.05,172l-19-33.2A123.23,123.23,0,0,1,162,155.46l5.87,35.22a8,8,0,0,1-6.58,9.21A8.4,8.4,0,0,1,160,200a8,8,0,0,1-7.88-6.69l-5.77-34.58a133.06,133.06,0,0,1-36.68,0l-5.77,34.58A8,8,0,0,1,96,200a8.4,8.4,0,0,1-1.32-.11,8,8,0,0,1-6.58-9.21L94,155.46a123.23,123.23,0,0,1-36.06-16.69L39,172A8,8,0,1,1,25.06,164l20-35a152.8,152.8,0,0,1-19.3-20,8,8,0,0,1,0-10.06C44.56,75.72,77.55,48,128,48s83.44,27.72,102.22,51a8,8,0,0,1,0,10.06,152.8,152.8,0,0,1-19.3,20Z"},null,-1),Ae=[Pe],Se={key:3},$e=o("path",{d:"M229.21,165a6,6,0,0,1-10.42,6l-20-35.08a122,122,0,0,1-39,18.09l6.17,37a6,6,0,0,1-4.93,6.91,6.85,6.85,0,0,1-1,.08,6,6,0,0,1-5.91-5L148,156.44a128.86,128.86,0,0,1-40,0L101.92,193A6,6,0,0,1,96,198a6.85,6.85,0,0,1-1-.08A6,6,0,0,1,90.08,191l6.17-37a122,122,0,0,1-39-18.09L37.21,171a6,6,0,1,1-10.42-6l20.85-36.48a152,152,0,0,1-20.31-20.77,6,6,0,0,1,9.34-7.54C53.54,121.11,83.07,146,128,146s74.46-24.89,91.33-45.77a6,6,0,0,1,9.34,7.54,152,152,0,0,1-20.31,20.77Z"},null,-1),Ue=[$e],Me={key:4},Le=o("path",{d:"M228,175a8,8,0,0,1-10.92-3l-19-33.2A123.23,123.23,0,0,1,162,155.46l5.87,35.22a8,8,0,0,1-6.58,9.21A8.4,8.4,0,0,1,160,200a8,8,0,0,1-7.88-6.69l-5.77-34.58a133.06,133.06,0,0,1-36.68,0l-5.77,34.58A8,8,0,0,1,96,200a8.4,8.4,0,0,1-1.32-.11,8,8,0,0,1-6.58-9.21L94,155.46a123.23,123.23,0,0,1-36.06-16.69L39,172A8,8,0,1,1,25.06,164l20-35a153.47,153.47,0,0,1-19.3-20A8,8,0,1,1,38.22,99c16.6,20.54,45.64,45,89.78,45s73.18-24.49,89.78-45A8,8,0,1,1,230.22,109a153.47,153.47,0,0,1-19.3,20l20,35A8,8,0,0,1,228,175Z"},null,-1),Re=[Le],Ee={key:5},Ie=o("path",{d:"M226,171.47a3.92,3.92,0,0,1-2,.53,4,4,0,0,1-3.47-2l-21.15-37a120,120,0,0,1-41.91,19.53L164,191.34a4,4,0,0,1-3.29,4.6,3.79,3.79,0,0,1-.67.06,4,4,0,0,1-3.94-3.34l-6.41-38.5a128.17,128.17,0,0,1-43.28,0L100,192.66A4,4,0,0,1,96,196a3.88,3.88,0,0,1-.67-.06,4,4,0,0,1-3.29-4.6l6.48-38.83A120,120,0,0,1,56.62,133L35.47,170A4,4,0,0,1,32,172a3.92,3.92,0,0,1-2-.53A4,4,0,0,1,28.53,166l21.68-37.94a148.24,148.24,0,0,1-21.32-21.56,4,4,0,1,1,6.22-5C52.25,122.71,82.29,148,128,148s75.75-25.29,92.89-46.51a4,4,0,1,1,6.22,5,148.24,148.24,0,0,1-21.32,21.56L227.47,166A4,4,0,0,1,226,171.47Z"},null,-1),Te=[Ie],Ve={name:"PhEyeClosed"},qe=V({...Ve,props:{weight:{type:String},size:{type:[String,Number]},color:{type:String},mirrored:{type:Boolean}},setup(p){const e=p,s=O("weight","regular"),m=O("size","1em"),n=O("color","currentColor"),b=O("mirrored",!1),d=x(()=>e.weight??s),i=x(()=>e.size??m),u=x(()=>e.color??n),f=x(()=>e.mirrored!==void 0?e.mirrored?"scale(-1, 1)":void 0:b?"scale(-1, 1)":void 0);return(l,S)=>(t(),r("svg",ie({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 256 256",width:i.value,height:i.value,fill:u.value,transform:f.value},l.$attrs),[te(l.$slots,"default"),d.value==="bold"?(t(),r("g",ve,ye)):d.value==="duotone"?(t(),r("g",xe,_e)):d.value==="fill"?(t(),r("g",Ce,Ae)):d.value==="light"?(t(),r("g",Se,Ue)):d.value==="regular"?(t(),r("g",Me,Re)):d.value==="thin"?(t(),r("g",Ee,Te)):C("",!0)],16,he))}}),Be={class:"w-full min-h-0 max-h-[calc(100dvh-10rem)] flex flex-col text-ink dark:text-app-text-dark"},Ne={key:1,class:"flex flex-col items-center py-2"},ze={class:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4"},Fe={class:"text-xl font-semibold mb-1"},je={class:"mt-6 w-full space-y-3"},Oe={class:"flex flex-col items-center py-4"},Ze={class:"w-20 h-20 rounded-full bg-primary/10 flex items-center justify-center mb-5 overflow-hidden ring-4 ring-ink/5"},De=["src"],Ge={key:1,class:"text-2xl font-bold text-primary"},We={class:"font-display text-2xl text-ink font-semibold"},He={key:0,class:"font-body text-sm text-ink-muted mt-0.5"},Ke={key:0,class:"mt-6 min-h-0 flex flex-col"},Qe={class:"text-sm font-medium text-ink-muted mb-3"},Xe={key:1,class:"min-h-0 max-h-[30dvh] sm:max-h-64 overflow-y-auto overscroll-contain space-y-1.5 pr-1"},Ye=["onClick"],Je={class:"w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center flex-shrink-0"},et={key:0,class:"text-sm font-semibold text-primary"},tt={class:"text-sm font-medium flex-1"},at={class:"mt-8 space-y-3"},st=V({__name:"AuthenticatedUserPanel",setup(p){const e=B(),s=ae(),m=se(),n=j().$i18n.t,b=_(!1),d=x(()=>(e.profile?.children?.length??0)>0),i=x(()=>e.childAuthRequired||d.value),u=x(()=>ne(m.query.redirect)),f=x(()=>e.profile?.type===Z.Admin?"accent":"primary"),l=x(()=>{switch(e.profile?.type){case Z.Admin:return"authenticatedPanel.roleAdmin";case Z.Restaurant:return"authenticatedPanel.roleRestaurant";default:return""}}),S=x(()=>u.value?"authenticatedPanel.continue":e.profile?.type===Z.Admin?"authenticatedPanel.goToAdmin":"authenticatedPanel.goToRestaurant");function y(){s.push({name:ue.Login.name,query:{signup:"true"}})}function k(){u.value?oe(u.value):H().goToOverview()}async function c($){if(b.value=!0,e.profile&&e.profile._id===$._id){window.location.href=X.Overview.path;return}const E=await ce(j()).childUserAuthentication($._id),U=await e.firebaseSignInWithCustomToken(E.token);await e.handleAuthStateChanged(U.user);const T=K().getPreAuthRoute();K().removePreAuthRoute(),T&&T.length>0?window.location.href=T:H().navigateToName(X.Overview.name),e.childAuthRequired=!1,b.value=!1}return($,E)=>(t(),r("div",Be,[a(e).loading?(t(),A(W,{key:0,class:"my-8 mx-auto"})):a(e).isAnonymous?(t(),r("div",Ne,[o("div",ze,[w(N,{icon:a(G),size:"lg",class:"text-primary"},null,8,["icon"])]),o("h2",Fe,h(a(n)("authenticatedPanel.guest")),1),o("div",je,[w(R,{onClick:y,class:"w-full","t-text":"authenticatedPanel.createAccount",size:"md",variant:"primary"})])])):(t(),r(Q,{key:2},[o("div",Oe,[o("div",Ze,[a(e).profile?.publicInformation?.profilePicture?(t(),r("img",{key:0,src:a(e).profile.publicInformation.profilePicture,class:"w-full h-full object-cover",alt:""},null,8,De)):a(e).profileName?(t(),r("span",Ge,h(a(e).profileName.charAt(0).toUpperCase()),1)):(t(),A(N,{key:2,icon:a(G),size:"lg",class:"text-primary"},null,8,["icon"]))]),o("h2",We,h(a(e).profileName||a(e).profile?.email),1),a(e).profile?.email&&a(e).profileName&&a(e).profileName!==a(e).profile.email?(t(),r("p",He,h(a(e).profile.email),1)):C("",!0),a(e).profile?.type?(t(),A(ee,{key:1,class:"mt-3",color:f.value,"t-text":l.value},null,8,["color","t-text"])):C("",!0)]),i.value?(t(),r("div",Ke,[o("h3",Qe,h(a(n)("authenticatedPanel.switchUser")),1),b.value?(t(),A(W,{key:0,class:"mx-auto my-4"})):(t(),r("div",Xe,[(t(!0),r(Q,null,de(a(e).profile?.children||[],U=>(t(),r("div",{key:U._id,onClick:T=>c(U),class:"flex items-center gap-3 px-3 py-2.5 rounded-xl border border-ink/5 cursor-pointer hover:border-ink/20 hover:shadow-sm transition-all duration-300"},[o("div",Je,[U.publicInformation?.displayName?(t(),r("span",et,h(U.publicInformation.displayName.charAt(0).toUpperCase()),1)):(t(),A(N,{key:1,icon:a(G),size:"sm",class:"text-primary"},null,8,["icon"]))]),o("span",tt,h(U.publicInformation?.displayName||U._id),1),a(e).profile?._id===U._id?(t(),A(ee,{key:0,color:"accent","t-text":"auth.current-user",class:"text-xs"})):C("",!0)],8,Ye))),128))]))])):C("",!0),o("div",at,[w(R,{onClick:k,class:"w-full","t-text":S.value,size:"lg",variant:"primary"},null,8,["t-text"]),w(R,{onClick:a(e).logout,class:"w-full","t-text":"authenticatedPanel.signOut",size:"md",variant:"framed-secondary"},null,8,["onClick"])])],64))]))}}),ot=Object.assign(st,{__name:"AuthAuthenticatedUserPanel"}),nt={},lt={"aria-hidden":"true",class:"h-5 w-5",viewBox:"0 0 24 24"};function rt(p,e){return t(),r("svg",lt,[...e[0]||(e[0]=[o("path",{d:"M12.0003 4.75C13.7703 4.75 15.3553 5.36002 16.6053 6.54998L20.0303 3.125C17.9502 1.19 15.2353 0 12.0003 0C7.31028 0 3.25527 2.69 1.28027 6.60998L5.27028 9.70498C6.21525 6.86002 8.87028 4.75 12.0003 4.75Z",fill:"#EA4335"},null,-1),o("path",{d:"M23.49 12.275C23.49 11.49 23.415 10.73 23.3 10H12V14.51H18.47C18.18 15.99 17.34 17.25 16.08 18.1L19.945 21.1C22.2 19.01 23.49 15.92 23.49 12.275Z",fill:"#4285F4"},null,-1),o("path",{d:"M5.26498 14.2949C5.02498 13.5699 4.88501 12.7999 4.88501 11.9999C4.88501 11.1999 5.01998 10.4299 5.26498 9.7049L1.275 6.60986C0.46 8.22986 0 10.0599 0 11.9999C0 13.9399 0.46 15.7699 1.28 17.3899L5.26498 14.2949Z",fill:"#FBBC05"},null,-1),o("path",{d:"M12.0004 24.0001C15.2404 24.0001 17.9654 22.935 19.9454 21.095L16.0804 18.095C15.0054 18.82 13.6204 19.245 12.0004 19.245C8.8704 19.245 6.21537 17.135 5.2654 14.29L1.27539 17.385C3.25539 21.31 7.3104 24.0001 12.0004 24.0001Z",fill:"#34A853"},null,-1)])])}const it=me(nt,[["render",rt]]),dt={key:0,class:"space-y-6 text-center"},ut={class:"text-lg font-semibold text-app-text dark:text-app-text-dark mb-1"},ct={class:"text-sm text-app-text-secondary dark:text-app-text-secondary-dark"},mt={key:0,class:"rounded-xl border-2 border-green-600 dark:border-green-500 bg-app-50/70 dark:bg-app-dark-50/70 px-4 py-2"},pt={class:"text-sm font-medium"},ft={key:0},gt={key:1},ht=["disabled"],vt={key:2,class:"text-right"},wt={key:4,class:"mt-4 rounded-xl border-2 border-red-600 dark:border-red-500 bg-app-50/70 dark:bg-app-dark-50/70 px-4 py-2"},yt={class:"flex items-center gap-2"},xt={class:"text-error-800 dark:text-error-dark-200 font-medium"},bt={class:"relative flex flex-row items-center"},kt={class:"px-3 text-ink-muted font-body text-sm"},_t=V({__name:"AuthForm",props:{email:{},password:{},confirmPassword:{}
1,isSignUpMode:{type:Boolean},loading:{type:Boolean}},emits:["update:email","update:password","update:confirmPassword","signIn","signUp","forgotPassword","googleSignIn"],setup(p,{emit:e}){const s=p,m=_(!1),n=_(!1),b=_(!1),d=_(!1),i=_(!1),u=e,f=B(),l=j().$i18n.t,S=x(()=>s.isSignUpMode===!1),y=x({get:()=>s.email,set:v=>u("update:email",v)}),k=x({get:()=>s.password,set:v=>u("update:password",v)}),c=x({get:()=>s.confirmPassword,set:v=>u("update:confirmPassword",v)});function $(){n.value=!n.value,f.authError=void 0}async function E(){n.value?await U():s.isSignUpMode?u("signUp"):u("signIn")}async function U(){if(y.value){i.value=!0,f.authError=void 0;try{await f.firebaseSendSignInLink(y.value),b.value=!0}catch(v){f.authError=v}finally{i.value=!1}}}async function T(){i.value=!0,d.value=!1;try{await f.firebaseSendSignInLink(y.value),d.value=!0}catch(v){f.authError=v}finally{i.value=!1}}function D(v){if(!v)return"";let g="";if(v&&typeof v=="object"&&"code"in v)g=String(v.code);else if(v&&typeof v=="object"&&"message"in v){const P=String(v.message).match(/auth\/[a-z-]+/);g=P?P[0]:""}if(g){const M=`auth.errors.${g}`,P=l(M,{},{missingWarn:!1,fallbackWarn:!1});if(P!==M)return P}return l("auth.errors.default")}return K().getUseEmulator()&&(y.value=new Date().getTime()+"@amin.app",k.value="password",c.value="password"),(v,g)=>b.value?(t(),r("div",dt,[w(N,{icon:a(pe),size:"lg",class:"mx-auto text-primary dark:text-primary-dark"},null,8,["icon"]),o("div",null,[o("h3",ut,h(a(l)("landingPages.auth.checkEmail")),1),o("p",ct,h(a(l)("landingPages.auth.checkEmailDescription",{email:y.value})),1)]),d.value?(t(),r("div",mt,[o("span",pt,h(a(l)("landingPages.auth.linkResent")),1)])):C("",!0),w(R,{variant:"text-only-secondary",size:"sm",loading:i.value,onClick:T},{default:z(()=>[i.value?(t(),r("span",ft,h(a(l)("landingPages.auth.sendingLink")),1)):(t(),r("span",gt,h(a(l)("landingPages.auth.resendLink")),1))]),_:1},8,["loading"]),w(R,{variant:"text-only-secondary",size:"xs",onClick:g[0]||(g[0]=M=>{b.value=!1,n.value=!1})},{default:z(()=>[Y(h(a(l)("landingPages.auth.usePassword")),1)]),_:1})])):(t(),r("form",{key:1,class:"space-y-6",onSubmit:F(E,["prevent"])},[o("fieldset",{disabled:s.loading,class:"space-y-6"},[w(q,{modelValue:y.value,"onUpdate:modelValue":g[1]||(g[1]=M=>y.value=M),"label-t":"auth.email",type:"email",autocomplete:"email"},null,8,["modelValue"]),n.value?C("",!0):(t(),A(q,{key:0,modelValue:k.value,"onUpdate:modelValue":g[3]||(g[3]=M=>k.value=M),"label-t":"auth.password",type:m.value?"text":"password",autocomplete:"password"},{inlineButton:z(()=>[w(R,{variant:"text-only-bw",class:"my-auto",icon:m.value?a(qe):a(re),onClick:g[2]||(g[2]=()=>m.value=!m.value)},null,8,["icon"])]),_:1},8,["modelValue","type"])),p.isSignUpMode&&!n.value?(t(),A(q,{key:1,modelValue:c.value,"onUpdate:modelValue":g[4]||(g[4]=M=>c.value=M),"label-t":"auth.confirm-password",type:"password",autocomplete:"new-password"},null,8,["modelValue"])):C("",!0),S.value&&!n.value?(t(),r("div",vt,[w(R,{variant:"text-only-secondary",size:"xs",type:"button","t-text":"auth.forgot-password",onClick:g[5]||(g[5]=F(M=>v.$emit("forgotPassword"),["prevent"]))})])):C("",!0),w(R,{type:"submit",class:"w-full",loading:i.value||s.loading,"t-text":n.value?"landingPages.auth.continueWithEmail":p.isSignUpMode?"auth.create-account":"auth.sign-in"},null,8,["loading","t-text"]),S.value?(t(),A(R,{key:3,variant:"text-only-secondary",size:"xs",type:"button",class:"w-full","t-text":n.value?"landingPages.auth.usePassword":"landingPages.auth.useMagicLink",onClick:$},null,8,["t-text"])):C("",!0),a(f).authError?(t(),r("div",wt,[o("div",yt,[w(N,{icon:a(fe),size:"xs",class:"text-error dark:text-error-dark",filled:""},null,8,["icon"]),o("span",xt,h(D(a(f).authError)),1)])])):C("",!0),o("div",bt,[g[7]||(g[7]=o("div",{class:"flex-1 border-t border-ink/10"},null,-1)),o("span",kt,h(a(l)("auth.or-continue-with")),1),g[8]||(g[8]=o("div",{class:"flex-1 border-t border-ink/10"},null,-1))]),o("button",{class:"flex items-center justify-center w-full px-6 py-3 rounded-xl font-medium transition-all duration-200 text-center border border-ink/10 hover:border-ink/20 text-ink-muted hover:text-ink dark:text-app-text-secondary-dark dark:hover:text-app-text-dark gap-2",onClick:g[6]||(g[6]=F(M=>u("googleSignIn"),["prevent"]))},[w(it),Y(" "+h(a(l)("auth.continue-with-google")),1)])],8,ht)],32))}}),Ct=Object.assign(_t,{__name:"AuthForm"}),Pt={key:0,class:"p-4 bg-success-100 dark:bg-success-dark-100 text-success-700 dark:text-success-dark-700 rounded-lg"},At={class:"font-medium"},St={class:"text-sm mt-1"}
1,$t={key:1,class:"p-4 bg-error-100 dark:bg-error-dark-100 text-error-700 dark:text-error-dark-700 rounded-lg"},Ut={class:"text-sm"},Mt={class:"text-center"},Lt=V({__name:"PasswordResetForm",props:{email:{}},emits:["update:email","backToLogin","resetRequested"],setup(p,{emit:e}){const s=p,m=e,{t:n}=le(),b=B(),d=_(!1),i=_(!1),u=_(""),f=_(!1),l=x({get:()=>s.email,set:c=>m("update:email",c)}),S=x(()=>(f.value||l.value&&l.value.includes("@")&&l.value.length>3)&&!d.value);function y(c){f.value=c}async function k(){if(!l.value){u.value=n("auth.passwordReset.error-enter-email");return}d.value=!0,u.value="";try{await b.firebaseSendPasswordResetEmail(l.value),i.value=!0,m("resetRequested")}catch(c){const $=c instanceof Error?c.message:n("auth.passwordReset.error-failed-send");u.value=$}finally{d.value=!1}}return(c,$)=>(t(),r("form",{class:"space-y-6",onSubmit:F(k,["prevent"])},[w(q,{modelValue:l.value,"onUpdate:modelValue":$[0]||($[0]=E=>l.value=E),"label-t":"auth.email",type:"email",autocomplete:"email",required:"","onUpdate:valid":y,placeholder:c.$t("auth.passwordReset.email-placeholder")},null,8,["modelValue","placeholder"]),w(R,{onClick:k,loading:d.value,text:c.$t("auth.send-reset-email"),disabled:!S.value,class:"w-full"},null,8,["loading","text","disabled"]),i.value?(t(),r("div",Pt,[o("h3",At,h(c.$t("auth.reset-email-sent-title")),1),o("p",St,h(c.$t("auth.reset-email-sent-description")),1)])):C("",!0),u.value?(t(),r("div",$t,[o("p",Ut,h(u.value),1)])):C("",!0),o("div",Mt,[w(R,{variant:"text-only-secondary",size:"xs","t-text":"auth.back-to-signin",onClick:$[1]||($[1]=E=>c.$emit("backToLogin"))})])],32))}}),Rt=Object.assign(Lt,{__name:"AuthPasswordResetForm"}),Et={key:0,class:"p-4 bg-success-100 dark:bg-success-dark-100 text-success-700 dark:text-success-dark-700 rounded-lg"},It={class:"font-medium"},Tt={class:"text-sm mt-1"},Vt={key:1,class:"p-4 bg-error-100 dark:bg-error-dark-100 text-error-700 dark:text-error-dark-700 rounded-lg"},qt={class:"text-sm"},Bt={class:"text-center"},Nt=V({__name:"PasswordConfirmForm",props:{oobCode:{}},emits:["backToLogin","passwordReset"],setup(p,{emit:e}){const s=p,m=e,n=j().$i18n.t,b=B(),d=_(""),i=_(""),u=_(!1),f=_(!1),l=_("");async function S(){if(!d.value){l.value=n("auth.passwordConfirm.error-enter-password");return}if(d.value!==i.value){l.value=n("auth.passwordConfirm.error-passwords-mismatch");return}if(d.value.length<6){l.value=n("auth.passwordConfirm.error-password-too-short");return}u.value=!0,l.value="";try{await b.firebaseConfirmPasswordReset(s.oobCode,d.value),f.value=!0,setTimeout(()=>{m("passwordReset")},3e3)}catch(y){const k=y instanceof Error?y.message:n("auth.passwordConfirm.error-failed-reset");l.value=k}finally{u.value=!1}}return(y,k)=>(t(),r("form",{class:"space-y-6",onSubmit:F(S,["prevent"])},[w(q,{modelValue:d.value,"onUpdate:modelValue":k[0]||(k[0]=c=>d.value=c),"label-t":"auth.new-password",type:"password",autocomplete:"new-password",required:"",placeholder:a(n)("auth.passwordConfirm.new-password-placeholder")},null,8,["modelValue","placeholder"]),w(q,{modelValue:i.value,"onUpdate:modelValue":k[1]||(k[1]=c=>i.value=c),"label-t":"auth.confirm-new-password",type:"password",autocomplete:"new-password",required:"",placeholder:a(n)("auth.passwordConfirm.confirm-password-placeholder")},{inlineButton:z(()=>[w(R,{icon:a(re)},null,8,["icon"])]),_:1},8,["modelValue","placeholder"]),w(R,{onClick:S,loading:u.value,text:a(n)("auth.reset-password"),class:"w-full"},null,8,["loading","text"]),f.value?(t(),r("div",Et,[o("h3",It,h(a(n)("auth.password-reset-success-title")),1),o("p",Tt,h(a(n)("auth.password-reset-success-description")),1)])):C("",!0),l.value?(t(),r("div",Vt,[o("p",qt,h(l.value),1)])):C("",!0),o("div",Bt,[w(R,{variant:"text-only-secondary",size:"xs","t-text":"auth.back-to-signin",onClick:k[2]||(k[2]=c=>y.$emit("backToLogin"))})])],32))}}),zt=Object.assign(Nt,{__name:"AuthPasswordConfirmForm"}),Ft={class:"mt-6"},jt=V({__name:"AuthToggle",props:{isSignUpMode:{type:Boolean}},emits:["update:isSignUpMode"],setup(p,{emit:e}){const s=e,m=[{value:"signin",label:"Sign In"},{value:"signup",label:"Sign Up"}],n=b=>
1{s("update:isSignUpMode",b==="signup")};return(b,d)=>(t(),r("div",Ft,[w(ge,{"model-value":p.isSignUpMode?"signup":"signin",options:m,"onUpdate:modelValue":n},null,8,["model-value"])]))}}),Ot=Object.assign(jt,{__name:"AuthToggle"}),Zt={class:"w-full h-fit bg-white rounded-2xl border border-ink/5 p-8"},Dt={key:0,class:"text-center mb-8"},Gt={class:"font-display text-2xl sm:text-3xl text-ink font-semibold mb-2 mt-0 sm:mt-4"},Wt={class:"font-body text-ink-muted text-sm"},Ht=V({__name:"LoginFormCard",props:{isSignUpMode:{type:Boolean},isPasswordResetMode:{type:Boolean},isPasswordConfirmMode:{type:Boolean}},emits:["update:isSignUpMode"],setup(p){const e=B(),s=j().$i18n.t,m=p;function n(){return m.isPasswordResetMode?s("login.resetPassword"):m.isPasswordConfirmMode?s("login.setNewPassword"):m.isSignUpMode?s("login.createAccount"):s("login.welcomeBack")}function b(){return m.isPasswordResetMode?s("login.resetPasswordSubtitle"):m.isPasswordConfirmMode?s("login.setNewPasswordSubtitle"):m.isSignUpMode?s("login.createAccountSubtitle"):s("login.signInSubtitle")}return(d,i)=>(t(),r("div",Zt,[!a(e).loading&&!a(e).isAuthenticated?(t(),r("div",Dt,[o("h2",Gt,h(n()),1),o("p",Wt,h(b()),1)])):C("",!0),!a(e).loading&&!a(e).isAuthenticated&&!p.isPasswordResetMode&&!p.isPasswordConfirmMode?(t(),A(Ot,{key:1,isSignUpMode:p.isSignUpMode,"onUpdate:isSignUpMode":i[0]||(i[0]=u=>d.$emit("update:isSignUpMode",u)),class:"mb-8"},null,8,["isSignUpMode"])):C("",!0),te(d.$slots,"default")]))}}),Kt=Object.assign(Ht,{__name:"AuthLoginFormCard"}),Qt={class:"flex-1 flex flex-col items-center justify-center px-4 py-6 sm:py-12"},Xt={key:0,class:"mb-6 rounded-xl border border-amber-300 bg-amber-50 px-4 py-3 font-body text-sm text-amber-900"},oa=V({__name:"LoginView",setup(p){const{t:e}=le(),s=B(),m=ae(),n=se(),b=x(()=>(s.profile?.children?.length??0)>0),d=x(()=>ne(n.query.redirect)),i=_(!1);async function u(){if(await s.waitUntilSettled(),s.childAuthRequired||b.value){i.value=!1;return}d.value?await oe(d.value):await H().goToOverview()}const f=_(""),l=_(""),S=_(""),y=_(n.query.signup==="true"),k=x(()=>n.query.mode==="resetPassword"&&!n.query.oobCode),c=x(()=>n.query.mode==="resetPassword"&&!!n.query.oobCode),$=x(()=>n.query.oobCode);J(()=>n.query,P=>{P.mode==="resetPassword"&&(s.authError=void 0)},{immediate:!0}),J(()=>y.value,()=>{s.authError=void 0});function E(){m.push({query:{mode:"resetPassword"}})}function U(){m.push({query:{}})}function T(){}function D(){m.push({query:{}})}async function v(){i.value=!0;try{await s.firebaseSignInGoogle(),await u()}catch(P){i.value=!1,s.authError=P}}async function g(P){P&&P.preventDefault(),i.value=!0;try{await s.firebaseSignInWithEmailAndPassword(f.value,l.value),await u()}catch(L){i.value=!1,s.authError=L}}async function M(P){if(P&&P.preventDefault(),l.value!==S.value){s.authError={message:e("auth.passwordConfirm.error-passwords-mismatch")};return}i.value=!0;try{await s.firebaseSignUpWithEmailAndPassword(f.value,l.value),await u()}catch(L){i.value=!1,s.authError=L}}return(P,L)=>(t(),r("div",Qt,[w(Kt,{class:"w-full max-w-md",isSignUpMode:y.value,isPasswordResetMode:k.value,isPasswordConfirmMode:c.value,"onUpdate:isSignUpMode":L[4]||(L[4]=I=>y.value=I)},{default:z(()=>[a(s).authStateStalled?(t(),r("p",Xt,h(a(e)("login.authStateUnavailable")),1)):C("",!0),a(s).loading&&!i.value?(t(),A(W,{key:1,class:"my-auto mx-auto"})):a(s).isAuthenticated&&!i.value?(t(),A(ot,{key:2})):k.value?(t(),A(Rt,{key:3,email:f.value,"onUpdate:email":L[0]||(L[0]=I=>f.value=I),onBackToLogin:U,onResetRequested:T},null,8,["email"])):c.value?(t(),A(zt,{key:4,oobCode:$.value,onPasswordReset:D,onBackToLogin:U},null,8,["oobCode"])):(t(),A(Ct,{key:5,email:f.value,"onUpdate:email":L[1]||(L[1]=I=>f.value=I),password:l.value,"onUpdate:password":L[2]||(L[2]=I=>l.value=I),confirmPassword:S.value,"onUpdate:confirmPassword":L[3]||(L[3]=I=>S.value=I),isSignUpMode:y.value,loading:i.value,onSignIn:g,onSignUp:M,onGoogleSignIn:v,onForgotPassword:E},null,8,["email","password","confirmPassword","isSignUpMode","loading"]))]),_:1},8,["isSignUpMode","isPasswordResetMode","isPasswordConfirmMode"])]))}});
1export{oa 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.