import{R as p,j as e,r as n,H as f,d as j,a as g,b}from"./app-B9XP17Et.js";import{c as m,B as v}from"./Button-DS4qSr3I.js";import{L as w}from"./lock-CnjaDDmd.js";/* empty css            */const i=p.forwardRef(({className:t,error:a,icon:s,...d},l)=>e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"relative",children:[s&&e.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none text-gray-500",children:s}),e.jsx("input",{ref:l,className:m("block w-full rounded-lg border-gray-300 border shadow-xs text-gray-900 placeholder:text-gray-400","focus:ring-4 focus:ring-brand-500/20 focus:border-brand-500 focus:outline-none sm:text-sm transition-shadow",s?"pl-10":"pl-3","py-2.5",a&&"border-red-500 focus:border-red-500 focus:ring-red-500/20",t),...d})]}),a&&e.jsx("p",{className:"mt-1.5 text-sm text-red-600",children:a})]}));i.displayName="Input";function N({className:t,children:a,...s}){return e.jsx("div",{className:m("bg-white rounded-xl border border-gray-200 shadow-xs overflow-hidden",t),...s,children:a})}function y({className:t,children:a,...s}){return e.jsx("div",{className:m("p-6",t),...s,children:a})}function E(){const[t,a]=n.useState(""),[s,d]=n.useState(""),[l,o]=n.useState(""),[x,c]=n.useState(!1),u=async r=>{r.preventDefault(),c(!0),o("");try{(await g.post("/api/login",{username:t,password:s})).data.success&&b.visit("/admin")}catch{o("Username atau password tidak valid. Silakan coba lagi.")}finally{c(!1)}};return e.jsxs("div",{className:"min-h-screen bg-gray-50 flex flex-col justify-center py-12 sm:px-6 lg:px-8",children:[e.jsx(f,{title:"Login Admin"}),e.jsxs("div",{className:"sm:mx-auto sm:w-full sm:max-w-md",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-xl bg-brand-600 shadow-sm",children:e.jsx(w,{className:"h-6 w-6 text-white"})}),e.jsx("h2",{className:"mt-6 text-center text-3xl font-bold tracking-tight text-gray-900",children:"Login Admin"}),e.jsx("p",{className:"mt-2 text-center text-sm text-gray-600",children:"Gunakan akun admin untuk mengakses dashboard kelulusan."})]}),e.jsx("div",{className:"mt-8 sm:mx-auto sm:w-full sm:max-w-md",children:e.jsx(N,{className:"shadow-lg",children:e.jsxs(y,{className:"px-4 py-8 sm:px-10",children:[l&&e.jsx("div",{className:"mb-6 rounded-md bg-red-50 p-4 border border-red-200",children:e.jsxs("div",{className:"flex",children:[e.jsx("div",{className:"shrink-0",children:e.jsx(j,{className:"h-5 w-5 text-red-500","aria-hidden":"true"})}),e.jsxs("div",{className:"ml-3",children:[e.jsx("h3",{className:"text-sm font-medium text-red-800",children:"Login Gagal"}),e.jsx("div",{className:"mt-1 text-sm text-red-700",children:e.jsx("p",{children:l})})]})]})}),e.jsxs("form",{className:"space-y-6",onSubmit:u,children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Username / Email"}),e.jsx(i,{id:"username",name:"username",type:"text",autoComplete:"username",required:!0,value:t,onChange:r=>a(r.target.value),placeholder:"username"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Password"}),e.jsx("div",{className:"mt-1",children:e.jsx(i,{id:"password",name:"password",type:"password",autoComplete:"current-password",required:!0,value:s,onChange:r=>d(r.target.value),placeholder:"••••••••"})})]}),e.jsx("div",{children:e.jsx(v,{type:"submit",variant:"primary",className:"w-full flex justify-center py-2.5 text-base",isLoading:x,children:"Masuk Sistem"})})]})]})})})]})}export{E as default};
