import{u as C,r as l,j as e}from"./vendor-react-CGAml-me.js";import{u as L,D,a as z,B as g,b as E,c as t,L as h,I as u,d as m,e as S}from"./index-BoGb7ncW.js";import{C as A,a as F,b as T,c as B,d as M}from"./card-C65ifeRR.js";import{u as I}from"./vendor-i18n-DzUOdQ2j.js";import{f as q,p as R,q as U}from"./vendor-icons-JKgav82F.js";import"./vendor-query-BbgYCJYB.js";import"./vendor-radix-Hvp89ZoW.js";function O(){const{t:a,i18n:i}=I(),x=C(),p=L(s=>s.setAuth),[n,b]=l.useState(""),[o,f]=l.useState(""),[d,c]=l.useState(!1),j=async s=>{if(s.preventDefault(),!n.trim()||!o.trim()){m.error(a("auth.fieldRequired"));return}c(!0);try{const N=await S.post("/auth/login",{username:n,password:o}),{access_token:k,user:y}=N.data;p(y,k),x("/dashboard")}catch{m.error(a("auth.loginFailed"))}finally{c(!1)}},r=s=>{i.changeLanguage(s)},v={zh:"中文","zh-TW":"繁體中文",en:"English",ja:"日本語",ko:"한국어",de:"Deutsch",fr:"Français"},w=()=>v[i.language]??"English";return e.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-gradient-to-br from-orange-50 via-white to-orange-100 dark:from-gray-950 dark:via-gray-900 dark:to-orange-950 px-4",children:[e.jsx("div",{className:"absolute top-0 left-0 w-96 h-96 bg-orange-200/30 dark:bg-orange-900/20 rounded-full blur-3xl -translate-x-1/2 -translate-y-1/2"}),e.jsx("div",{className:"absolute bottom-0 right-0 w-96 h-96 bg-orange-300/30 dark:bg-orange-800/20 rounded-full blur-3xl translate-x-1/2 translate-y-1/2"}),e.jsx("div",{className:"absolute top-4 right-4",children:e.jsxs(D,{children:[e.jsx(z,{asChild:!0,children:e.jsxs(g,{variant:"outline",size:"sm",className:"gap-2 backdrop-blur-sm bg-white/50 dark:bg-gray-900/50",children:[e.jsx(q,{className:"h-4 w-4"}),w()]})}),e.jsxs(E,{align:"end",children:[e.jsx(t,{onClick:()=>r("zh"),children:"中文"}),e.jsx(t,{onClick:()=>r("zh-TW"),children:"繁體中文"}),e.jsx(t,{onClick:()=>r("en"),children:"English"}),e.jsx(t,{onClick:()=>r("ja"),children:"日本語"}),e.jsx(t,{onClick:()=>r("ko"),children:"한국어"}),e.jsx(t,{onClick:()=>r("de"),children:"Deutsch"}),e.jsx(t,{onClick:()=>r("fr"),children:"Français"})]})]})}),e.jsxs(A,{className:"w-full max-w-sm shadow-2xl backdrop-blur-sm bg-white/80 dark:bg-gray-900/80 border-orange-200/50 dark:border-orange-900/50 animate-in fade-in zoom-in duration-500",children:[e.jsxs(F,{className:"text-center space-y-3 pb-4",children:[e.jsx("div",{className:"flex justify-center",children:e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 bg-orange-400/20 dark:bg-orange-600/20 rounded-2xl blur-xl animate-pulse"}),e.jsx("img",{src:"/icon.png",alt:"Nanobot",className:"relative h-16 w-16 rounded-2xl shadow-lg ring-2 ring-orange-100 dark:ring-orange-900/50"})]})}),e.jsxs("div",{children:[e.jsx(T,{className:"text-2xl font-bold bg-gradient-to-r from-orange-600 to-orange-400 bg-clip-text text-transparent",children:"Nanobot"}),e.jsx(B,{className:"text-sm mt-1",children:a("auth.login")})]})]}),e.jsx(M,{children:e.jsxs("form",{onSubmit:j,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"username",className:"text-sm font-medium",children:a("auth.username")}),e.jsxs("div",{className:"relative",children:[e.jsx(R,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-orange-500"}),e.jsx(u,{id:"username",value:n,onChange:s=>b(s.target.value),autoComplete:"username",className:"pl-10 h-10 border-orange-200 focus-visible:ring-orange-500 bg-gradient-to-r from-orange-50/50 to-white dark:from-orange-950/30 dark:to-gray-800",placeholder:a("auth.username")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{htmlFor:"password",className:"text-sm font-medium",children:a("auth.password")}),e.jsxs("div",{className:"relative",children:[e.jsx(U,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-orange-500"}),e.jsx(u,{id:"password",type:"password",value:o,onChange:s=>f(s.target.value),autoComplete:"current-password",className:"pl-10 h-10 border-orange-200 focus-visible:ring-orange-500 bg-gradient-to-r from-orange-50/50 to-white dark:from-orange-950/30 dark:to-gray-800",placeholder:a("auth.password")})]})]}),e.jsx(g,{type:"submit",className:"w-full h-10 mt-6 bg-gradient-to-r from-orange-500 to-orange-600 hover:from-orange-600 hover:to-orange-700 text-white font-semibold shadow-xl shadow-orange-500/40 hover:shadow-orange-600/50 transition-all duration-300 hover:scale-[1.02]",disabled:d,children:a(d?"common.loading":"auth.loginButton")})]})})]})]})}export{O as default};
