import{u as D,m as N,h as q,q as H,s as I,g as u,t as J,v as K,r as m,j as Q,o as i,a as h,f as n,l as a,F as W,d as f,e as s,k as g,x as c,y,b as d,w as _}from"./app-44623493.js";const X={class:"space-y-6"},Y={class:"flex items-center justify-between"},Z={key:0,class:"flex justify-center space-x-2"},ee=f("i",{class:"fab fa-google"},null,-1),te=f("i",{class:"fab fa-facebook"},null,-1),oe=f("i",{class:"fab fa-twitter"},null,-1),ae=f("i",{class:"fab fa-github"},null,-1),se={key:1,class:"flex items-center justify-center"},ne={key:0,class:"mt-4 space-y-4"},$="auth/user/",le={__name:"Login",setup(re){const v=D(),V=N(),F=q(),O=H("emitter"),p=I($),C=u("auth.enableOauthLogin"),G=u("auth.enableRegistration"),R=u("auth.enableResetPassword"),j=u("auth.enableGoogleOauthLogin"),E=u("auth.enableFacebookOauthLogin"),M=u("auth.enableTwitterOauthLogin"),T=u("auth.enableGithubOauthLogin"),U=u("system.mode"),k={email:"",password:"",rememberMe:!1},r=J({...k});K(async()=>{await F.dispatch("auth/user/setCSRF")});const x=()=>{Object.assign(r,k),V.push(v.query.ref?v.query.ref:{name:"Dashboard"})},w=t=>{r.email=t+"@"+t+".com",r.password="password",O.emit("submitForm")};return(t,e)=>{const A=m("GuestHeader"),L=m("BaseInput"),P=m("BaseCheckbox"),B=m("BaseLink"),l=m("BaseButton"),S=m("FormAction"),z=m("ParentTransition"),b=Q("tooltip");return i(),h(W,null,[n(A,{label:t.$trans("auth.login.login_title")},null,8,["label"]),n(z,{appear:"",visibility:!0},{default:a(()=>[n(S,{"no-card":"","no-action-button":"","init-url":$,"init-form":k,form:r,action:"login","after-submit":x},{default:a(()=>[f("div",X,[n(L,{type:"text","leading-icon":"fas fa-envelope",modelValue:r.email,"onUpdate:modelValue":e[0]||(e[0]=o=>r.email=o),name:"email",label:t.$trans("auth.login.props.email_or_username"),error:s(p).email,"onUpdate:error":e[1]||(e[1]=o=>s(p).email=o),autofocus:""},null,8,["modelValue","label","error"]),n(L,{type:"password","leading-icon":"fas fa-key",modelValue:r.password,"onUpdate:modelValue":e[2]||(e[2]=o=>r.password=o),name:"password",label:t.$trans("auth.login.props.password"),error:s(p).password,"onUpdate:error":e[3]||(e[3]=o=>s(p).password=o)},null,8,["modelValue","label","error"]),f("div",Y,[n(P,{modelValue:r.rememberMe,"onUpdate:modelValue":e[4]||(e[4]=o=>r.rememberMe=o),name:"rememberMe",label:t.$trans("auth.login.props.remember_me")},null,8,["modelValue","label"]),s(R)?(i(),g(B,{key:0,to:"Password"},{default:a(()=>[c(y(t.$trans("auth.password.forgot_password")),1)]),_:1})):d("",!0)]),s(C)?(i(),h("div",Z,[s(j)?_((i(),g(l,{key:0,as:"a",href:"/auth/google/redirect",design:"danger",size:"xs"},{default:a(()=>[ee]),_:1})),[[b,t.$trans("config.auth.props.login_with_client",{attribute:"Google"})]]):d("",!0),s(E)?_((i(),g(l,{key:1,as:"a",href:"/auth/facebook/redirect",design:"facebook",size:"xs"},{default:a(()=>[te]),_:1})),[[b,t.$trans("config.auth.props.login_with_client",{attribute:"Facebook"})]]):d("",!0),s(M)?_((i(),g(l,{key:2,as:"a",href:"/auth/twitter/redirect",design:"info",size:"xs"},{default:a(()=>[oe]),_:1})),[[b,t.$trans("config.auth.props.login_with_client",{attribute:"Twitter"})]]):d("",!0),s(T)?_((i(),g(l,{key:3,as:"a",href:"/auth/github/redirect",size:"xs"},{default:a(()=>[ae]),_:1})),[[b,t.$trans("config.auth.props.login_with_client",{attribute:"Github"})]]):d("",!0)])):d("",!0),s(G)?(i(),h("div",se,[n(B,{to:"Register"},{default:a(()=>[c(y(t.$trans("auth.register.register_title")),1)]),_:1})])):d("",!0),n(l,{type:"submit",block:""},{default:a(()=>[c(y(t.$trans("auth.login.login")),1)]),_:1})])]),_:1},8,["form"]),s(U)?d("",!0):(i(),h("div",ne,[n(l,{onClick:e[5]||(e[5]=o=>w("admin")),block:"",design:"success"},{default:a(()=>[c("Login as Admin")]),_:1}),n(l,{onClick:e[6]||(e[6]=o=>w("manager")),block:"",design:"info"},{default:a(()=>[c("Login as Manager")]),_:1}),n(l,{onClick:e[7]||(e[7]=o=>w("staff")),block:"",design:"danger"},{default:a(()=>[c("Login as Staff")]),_:1})]))]),_:1})],64)}}};export{le as default};
