1import{l as e}from"./kEQmWXa8.js";import{D as t,E as n,On as r,Qn as i,_ as a,b as o,ct as s,g as c,mt as l,nr as u,qt as d,tt as f,v as p,vn as m,xt as ee,y as h}from"./BXbynMP6.js";import{w as g}from"./C9qYed9n.js";import{g as _,h as v}from"./Bu1hKs-s.js";import{t as y}from"./B3VSlF_m.js";import{f as b}from"./BZlo7zbs.js";import{r as x}from"./DYGUn0Ix.js";import{n as S}from"./CoGs3CGl.js";import{t as C}from"./QPwzxSyw.js";import{t as w}from"./DY7gZfHv.js";import{t as T}from"./Bw1bBpEW.js";import{i as E,n as te}from"./F99B1zRX.js";import{n as D}from"./CLCL_Dmc.js";import{O,P as k}from"#entry";import{t as A}from"./BCr3GYOZ.js";import{a as j,i as M,r as N}from"./DsYsSrIO.js";var P={class:`flex flex-col w-full`},F={__name:`LoginForm`,props:{showHeading:{type:Boolean,default:!0},forgotPasswordInModal:{type:Boolean,default:!1}},emits:[`success`,`switch-to-register`,`forgot-password`],setup(F,{emit:I}){let L=x({slots:{headerStack:`flex flex-col gap-component-xs md:gap-component-m`,registerCta:`flex w-full items-center gap-component-xxs`,registerText:`text-body-xs lg:text-body-s leading-normal font-normal text-black-80`,registerLink:`text-black-80`,form:`flex flex-col gap-component-2xl`,heading:`text-black-00`,authStack:`flex flex-col gap-component-2xl`,socialSection:`w-full`,socialHint:`text-body-xs leading-normal font-normal text-black-50 mb-component-xs`,fieldGroup:`flex flex-col gap-component-l w-full`,forgotLink:`w-fit text-body-xs leading-normal font-medium text-foreground-page-default border-b border-current focus-visible:focus-ring`}}),{$localeRootPath:R,$_gtm:z}=e(),{t:B,locale:V}=S(),H=v(),U=_();if(H.query?.email||H.query?.password){let e=Object.fromEntries(Object.entries(H.query).filter(([e])=>e!==`email`&&e!==`password`));U.replace({query:e})}let W=O(),G=c(()=>W.maintenance),K=I,{login:q}=D(),J=L(),Y=te().shape({email:E().required(B(`account.fields.email.required`)).email(B(`account.fields.email.email`)),password:E().required(B(`account.fields.password.required`))}),X=T({email:``,password:``,languageCode:b(V.value)},Y),Z=()=>{K(`forgot-password`)},ne=()=>{z.push({event:`gaEvent`,event_name:`sign_up_click`,sign_up_click:{event_category:`Account`,event_action:`Sign Up`,event_label:`Click`}}),K(`switch-to-register`)},Q=m(null),$=m(null),{redirectAfterLogin:re}=j(),ie=async()=>{if(!await X.validate()){await f(),X.errors.email?Q.value?.focus():X.errors.password&&$.value?.focus();return}try{await X.submit(q(X.email,X.password,X.languageCode)),K(`success`),z.push({event:`gaEvent`,event_name:`login`,login:{event_category:`Account`,event_action:`Login`,event_label:`Success`,method:`email`}}),re()}catch(e){X.errors.message&&(X.errors.email=X.errors.message,delete X.errors.message),await f(),Q.value?.focus(),console.warn(`Login error:`,e),z.push({event:`gaEvent`,event_name:`login_fail`,login_fail:{method:`email`}})}};return s(()=>{let e=H.query?.email;e&&typeof e==`string`&&e.length>0&&(X.email=e)}),(e,s)=>{let c=y;return l(),o(`form`,{id:`login-form`,class:i(r(J).form()),novalidate:``,onSubmit:g(ie,[`prevent`])},[a(`div`,{class:i(r(J).headerStack())},[F.showHeading?(l(),p(r(C),{key:0,as:`h2`,size:`m`,class:i(r(J).heading())},{default:d(()=>[ee(e.$slots,`default`,{},()=>[n(u(r(B)(`account.loginPageTitle`)),1)])]),_:3},8,[`class`])):h(``,!0),a(`div`,{class:i(r(J).registerCta())},[a(`p`,{class:i(r(J).registerText())},u(r(B)(`account.modal.noAccount`)),3),t(r(A),{as:`button`,type:`button`,class:i(r(J).registerLink()),size:{initial:`s`,lg:`m`},onClick:ne},{default:d(()=>[n(u(r(B)(`account.modal.registerNow`)),1)]),_:1},8,[`class`])],2)],2),r(G)?.active?(l(),p(M,{key:0,type:`error`,message:r(G)?.message??r(B)(`account.modal.maintenance`)},null,8,[`message`])):h(``,!0),a(`div`,{class:i(r(J).authStack())},[a(`div`,{class:i(r(J).fieldGroup())},[a(`div`,P,[t(k,{ref_key:`emailInput`,ref:Q,"model-value":r(X).email,id:`login-form-email`,error:r(X).errors.email,disabled:r(G)?.active,label:r(B)(`account.labels.email`),name:`email`,type:`email`,autocomplete:`username`,required:``,"onUpdate:modelValue":s[0]||=e=>r(X).email=e},null,8,[`model-value`,`error`,`disabled`,`label`]),t(k,{ref_key:`passwordInput`,ref:$,"model-value":r(X).password,id:`login-form-password`,error:r(X).errors.password,disabled:r(G)?.active,label:r(B)(`account.labels.password`),name:`password`,type:`password`,autocomplete:`current-password`,required:``,"onUpdate:modelValue":s[1]||=e=>r(X).password=e},null,8,[`model-value`,`error`,`disabled`,`label`])]),F.forgotPasswordInModal?(l(),o(`button`,{key:0,t
1ype:`button`,class:i(r(J).forgotLink()),onClick:Z,tabindex:`0`},u(r(B)(`account.modal.forgotPassword`)),3)):(l(),p(c,{key:1,to:r(R)(`/account/reset`),class:i(r(J).forgotLink()),tabindex:`0`},{default:d(()=>[n(u(r(B)(`account.modal.forgotPassword`)),1)]),_:1},8,[`to`,`class`])),t(r(w),{type:`submit`,variant:`secondary`,size:`m`,disabled:r(G)?.active,loading:r(X).processing,class:`w-full`},{default:d(()=>[n(u(r(B)(`account.login`)),1)]),_:1},8,[`disabled`,`loading`])],2),r(G)?.active?h(``,!0):(l(),o(`div`,{key:0,class:i(r(J).socialSection())},[a(`p`,{class:i(r(J).socialHint())},u(r(B)(`auth.orContinueWithEmail`)),3),t(N,{onSuccess:s[2]||=e=>K(`success`)})],2))],2)],34)}}};export{F as t};
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.