import{j as s}from"./@tanstack-D1KSn3AD.js";import{e as h,f,I as o,h as j,i as N,r as g,B as w}from"./index-M2LMbZSu.js";import{u as y}from"./login-mutation-CMNAbZyX.js";import{r as n}from"./@radix-Mqgm9uyP.js";import{u as b}from"./index.esm-5yOGu3_l.js";import{a as v,f as I}from"./@react-router-t1nY6c48.js";import"./@reactflow-DOgoC88E.js";function L(){const c=v(),{setAuthState:i}=h(),{toast:l}=f(),a=n.useId(),t=n.useId(),[m]=I(),u=m.get("redirect"),{register:r,handleSubmit:d}=b(),x=y({onError:e=>{e instanceof Error&&l({status:"error",emphasis:"subtle",icon:s.jsx(N,{className:"h-5 w-5 shrink-0 fill-error-700"}),description:e.message,rounded:!0})},onSuccess:async()=>{i("true"),c(u||g.home)}});function p(e){x.mutate({username:e.username.trim(),password:e.password})}return s.jsxs("form",{onSubmit:d(p),className:"space-y-5",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("label",{htmlFor:a,className:"text-text-sm",children:"Username"}),s.jsx(o,{...r("username"),id:a,className:"w-full"})]}),s.jsxs("div",{className:"space-y-0.5",children:[s.jsx("label",{htmlFor:t,className:"text-text-sm",children:"Password"}),s.jsx(o,{...r("password"),id:t,type:"password",className:"w-full"})]})]}),s.jsx(j,{className:"w-full text-center",size:"md",children:s.jsx("span",{className:"w-full",children:"Login"})})]})}function M(){return s.jsxs(w,{className:"flex w-full max-w-[540px] flex-col gap-5 p-7",children:[s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"mb-0.5 text-display-xs font-semibold",children:"Log in to your account"}),s.jsx("p",{className:"text-theme-text-secondary",children:"Please, fill in your details to log in to your ZenML account."})]}),s.jsx(L,{})]})}export{M as default};
