(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,34033,e=>{"use strict";var s=e.i(19985),a=e.i(35335),t=e.i(10445),l=e.i(48593),i=e.i(31724),d=e.i(29375);e.s(["default",0,function(){let[e,r]=(0,a.useState)(""),[n,c]=(0,a.useState)(""),[m,o]=(0,a.useState)(""),[u,x]=(0,a.useState)(!1),h=(0,t.useRouter)(),{setUser:p}=(0,l.useAuth)(),b=async s=>{s.preventDefault(),o(""),x(!0);try{let s=await d.default.post("/auth/login",{email:e,password:n});if(s.success&&s.data){(0,i.setToken)(s.data.token),p(s.data.user);let e=s.data.user.role;"admin"===e?h.push("/admin/dashboard"):"assistant"===e?h.push("/assistant/dashboard"):"recovery"===e&&h.push("/recovery/dashboard")}}catch(e){o(e.message||"Login failed. Please check your credentials.")}finally{x(!1)}};return(0,s.jsx)("div",{className:"min-h-screen flex items-center justify-center bg-[var(--background)] p-4 fixed inset-0 z-50",children:(0,s.jsxs)("div",{className:"card w-full max-w-md p-8 shadow-lg relative bg-[var(--card)]",children:[(0,s.jsxs)("div",{className:"text-center mb-8",children:[(0,s.jsx)("h1",{className:"text-3xl font-bold text-primary mb-2",children:"Credical"}),(0,s.jsx)("p",{className:"text-[var(--text-muted)]",children:"Sign in to your account"})]}),m&&(0,s.jsx)("div",{className:"bg-danger-light text-danger p-3 rounded-xl text-sm mb-6 border border-danger/20",children:m}),(0,s.jsxs)("form",{onSubmit:b,className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Email Address"}),(0,s.jsx)("div",{className:"relative",children:(0,s.jsx)("input",{type:"email",className:"input-field pl-10",placeholder:"you@credical.com",value:e,onChange:e=>r(e.target.value),required:!0})})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Password"}),(0,s.jsx)("div",{className:"relative",children:(0,s.jsx)("input",{type:"password",className:"input-field pl-10",placeholder:"••••••••",value:n,onChange:e=>c(e.target.value),required:!0})})]}),(0,s.jsx)("button",{type:"submit",className:"btn-primary w-full py-3",disabled:u,children:u?"Signing in...":"Sign In"})]}),(0,s.jsxs)("div",{className:"mt-8 text-center text-xs text-[var(--text-muted)]",children:[(0,s.jsx)("p",{children:"Demo Credentials:"}),(0,s.jsxs)("div",{className:"flex justify-center gap-4 mt-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-semibold block",children:"Admin"}),"admin@credical.com"]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-semibold block",children:"Password (All)"}),"Admin@123"]})]})]})]})})}])}]);