import{d as G,u as U,c as _,w as o,r as n,a as z,o as r,b as t,e as d,f as g,t as E,g as f,h as u,i as R,j as $,k as b,_ as D}from"./index-jHWjNw8g.js";const H="/assets/banner-bordered-BZHf9RGK.svg";function K(s){return typeof s=="object"&&s!==null&&"status"in s&&"message"in s}const M={key:2,class:"divider-row my-5"},T=G({__name:"LoginPage",setup(s){const x=z(),a=U(),c=b(""),p=b(""),v=b(!1),l=b("");async function C(){l.value="";try{await a.login(c.value,p.value),x.replace("/")}catch(m){K(m)?l.value=m.detail||m.message||"Login failed":l.value="An unexpected error occurred"}}function V(){window.location.href="/api/v1/auth/oauth/google"}return(m,e)=>{const S=n("v-alert"),y=n("v-text-field"),w=n("v-btn"),h=n("v-form"),k=n("v-divider"),L=n("v-icon"),A=n("v-card"),B=n("v-col"),I=n("v-row"),N=n("v-container"),P=n("v-main"),j=n("v-app");return r(),_(j,null,{default:o(()=>[t(P,{class:"login-background"},{default:o(()=>[t(N,{class:"fill-height",fluid:""},{default:o(()=>[t(I,{align:"center",justify:"center"},{default:o(()=>[t(B,{cols:"12",sm:"8",md:"5",lg:"4",xl:"3"},{default:o(()=>[e[8]||(e[8]=d("div",{class:"text-center mb-8"},[d("div",{class:"logo-icon mx-auto mb-2"},[d("img",{src:H,alt:"YAAI Logo",width:"600px"})]),d("p",{class:"app-subtitle"},"Sign in to continue")],-1)),t(A,{class:"login-card pa-6"},{default:o(()=>[l.value?(r(),_(S,{key:0,type:"error",variant:"tonal",density:"compact",closable:"",class:"mb-4","onClick:close":e[0]||(e[0]=i=>l.value="")},{default:o(()=>[g(E(l.value),1)]),_:1})):f("",!0),u(a).authConfig?.local_enabled?(r(),_(h,{key:1,onSubmit:R(C,["prevent"])},{default:o(()=>[t(y,{modelValue:c.value,"onUpdate:modelValue":e[1]||(e[1]=i=>c.value=i),label:"Username","prepend-inner-icon":"mdi-account-outline",autofocus:"",class:"mb-2"},null,8,["modelValue"]),t(y,{modelValue:p.value,"onUpdate:modelValue":e[2]||(e[2]=i=>p.value=i),type:v.value?"text":"password",label:"Password","prepend-inner-icon":"mdi-lock-outline","append-inner-icon":v.value?"mdi-eye-off":"mdi-eye",class:"mb-4","onClick:appendInner":e[3]||(e[3]=i=>v.value=!v.value)},null,8,["modelValue","type","append-inner-icon"]),t(w,{type:"submit",color:"primary",size:"large",block:"",loading:u(a).loading,disabled:!c.value||!p.value},{default:o(()=>[...e[4]||(e[4]=[g(" Sign In ",-1)])]),_:1},8,["loading","disabled"])]),_:1})):f("",!0),u(a).authConfig?.local_enabled&&u(a).authConfig?.google_oauth_enabled?(r(),$("div",M,[t(k),e[5]||(e[5]=d("span",{class:"divider-text"},"or",-1)),t(k)])):f("",!0),u(a).authConfig?.google_oauth_enabled?(r(),_(w,{key:3,variant:"outlined",size:"large",block:"",class:"google-btn",onClick:V},{prepend:o(()=>[t(L,null,{default:o(()=>[...e[6]||(e[6]=[g("mdi-google",-1)])]),_:1})]),default:o(()=>[e[7]||(e[7]=g(" Sign in with Google ",-1))]),_:1})):f("",!0)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})}}}),Z=D(T,[["__scopeId","data-v-f967658f"]]);export{Z as default};
