import{u as v,r as N,b as _,j as e,H as L,R as y,L as C}from"./vendor-rThclpOQ.js";import{I as c}from"./input-error-Br4ngfdE.js";import{L as I}from"./loading-button-DKhpmf6V.js";import{T as k}from"./text-link-C6jxyhzG.js";import{B as F}from"./button-ZcsoqUQn.js";import{C as R}from"./checkbox-9ljr9HlI.js";import{I as u}from"./input-BeqyurrI.js";import{L as d}from"./label-CtY1vfZY.js";import{A as E}from"./auth-layout-Dx3k4-FS.js";import"./utils-8KAaAB9H.js";import"./index-DquVdLUg.js";import"./app-logo-Bj2M2lhk.js";import"./main-CC75Iw88.js";import"./sonner-CgbrDmPW.js";import"./index-CWNIUFqh.js";function Q({status:p,recaptcha:i,canResetPassword:x,googleLogIn:h}){const{props:f}=v(),{auth:t,input:s,button:l}=f.translate,n=N.useRef(null),{data:a,setData:o,post:g,processing:j,errors:m,reset:b}=_({email:"",password:"",remember:!1,recaptcha:"",recaptcha_status:i.status}),w=r=>{r.preventDefault(),g(route("login"),{onFinish:()=>b("password","recaptcha"),onError:()=>{n.current&&n.current.reset()}})};return e.jsxs(E,{title:t.login_title,description:t.login_description,children:[e.jsx(L,{title:t.login_title}),e.jsxs("form",{className:"flex flex-col gap-6",onSubmit:w,children:[e.jsxs("div",{className:"grid gap-6",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(d,{htmlFor:"email",children:s.email}),e.jsx(u,{id:"email",type:"email",required:!0,autoFocus:!0,tabIndex:1,autoComplete:"email",value:a.email,onChange:r=>o("email",r.target.value),placeholder:s.email_placeholder}),e.jsx(c,{message:m.email})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(d,{htmlFor:"password",children:s.password}),x&&e.jsx(k,{href:route("password.request"),className:"ml-auto text-sm",tabIndex:5,children:t.forgot_password})]}),e.jsx(u,{id:"password",type:"password",required:!0,tabIndex:2,autoComplete:"current-password",value:a.password,onChange:r=>o("password",r.target.value),placeholder:s.password_placeholder}),e.jsx(c,{message:m.password})]}),i.status&&e.jsxs("div",{children:[e.jsx(y,{ref:n,sitekey:i.siteKey,onChange:r=>o("recaptcha",r)}),e.jsx(c,{message:m.recaptcha})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx(R,{id:"remember",name:"remember",checked:a.remember,onClick:()=>o("remember",!a.remember),tabIndex:3}),e.jsx(d,{htmlFor:"remember",children:s.remember_me})]}),e.jsx(I,{loading:j,type:"submit",className:"w-full",children:l.login}),h&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"after:border-border relative text-center text-sm after:absolute after:inset-0 after:top-1/2 after:z-0 after:flex after:items-center after:border-t",children:e.jsx("span",{className:"bg-background text-muted-foreground relative z-10 px-2",children:t.continue_with})}),e.jsx("a",{type:"button",className:"w-full",href:"auth/google",children:e.jsx(F,{type:"button",variant:"outline",className:"w-full",children:l.continue_with_google})})]})]}),e.jsxs("div",{className:"text-center text-sm",children:[t.no_account," ",e.jsx(C,{href:route("register"),className:"underline underline-offset-4",children:l.sign_up})]})]}),p&&e.jsx("div",{className:"mb-4 text-center text-sm font-medium text-green-600",children:p})]})}export{Q as default};
