1import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,r as n}from"./framework-CgvwdT60.js";import{i as r,r as i}from"./index-B-jgS-f2.js";import a from"./link-sJef3k0n.js";import{t as o}from"./arrow-right-C_gXYKDI.js";import{t as s}from"./loader-circle-DnSpEq47.js";import{t as c}from"./strings-BB1G30Jo.js";var l=e(t(),1),u=n();function d(){let e=i(),t=r().get(`next`)??``,n=t.startsWith(`/`)&&!t.startsWith(`//`)?t:null,[d,f]=(0,l.useState)(()=>typeof navigator<`u`&&navigator.language?.toLowerCase().startsWith(`zh`)?`zh`:`en`),[p,m]=(0,l.useState)(`email`),[h,g]=(0,l.useState)(``),[_,v]=(0,l.useState)(``),[y,b]=(0,l.useState)(null),[x,S]=(0,l.useState)(``),[C,w]=(0,l.useState)(null),T=C!==null,E=(0,l.useRef)(null);(0,l.useEffect)(()=>{p===`code`&&E.current?.focus()},[p]);async function D(e,t){let n=await fetch(e,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error(String(r.error??c(d,`common.error`)));return r}async function O(e){e?.preventDefault(),S(``),w(`send`);try{let e=await D(`/api/auth/start`,{email:h,language:d});b(typeof e.localCode==`string`?e.localCode:null),m(`code`)}catch(e){S(e instanceof Error?e.message:c(d,`common.error`))}finally{w(null)}}async function k(t){t.preventDefault(),S(``),w(`verify`);try{let t=await D(`/api/auth/verify`,{email:h,code:_,language:d});e.push(n??(typeof t.next==`string`?t.next:`/dashboard/`)),e.refresh()}catch(e){S(e instanceof Error?e.message:c(d,`common.error`)),w(null)}}return(0,u.jsx)(`main`,{style:{minHeight:`100vh`,display:`grid`,placeItems:`center`,padding:`24px 16px`},children:(0,u.jsxs)(`div`,{style:{width:`min(420px, 100%)`},children:[(0,u.jsxs)(`div`,{className:`row-between`,style:{marginBottom:26},children:[(0,u.jsx)(`img`,{src:`/brand/uniming-logo-primary.svg`,alt:`UNIMING`,style:{height:30}}),(0,u.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>f(d===`en`?`zh`:`en`),children:d===`en`?`䏿`:`English`})]}),(0,u.jsx)(`div`,{className:`card card-pad`,children:p===`email`?(0,u.jsxs)(`form`,{onSubmit:O,className:`stack`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{children:c(d,`auth.signInTitle`)}),(0,u.jsx)(`p`,{className:`muted small`,style:{marginTop:8},children:c(d,`auth.signInLead`)})]}),(0,u.jsxs)(`div`,{className:`field`,children:[(0,u.jsx)(`label`,{htmlFor:`email`,children:c(d,`auth.email`)}),(0,u.jsx)(`input`,{id:`email`,className:`input`,type:`email`,required:!0,autoComplete:`email`,autoCapitalize:`off`,spellCheck:!1,value:h,onChange:e=>g(e.target.value)})]}),(0,u.jsx)(`input`,{type:`text`,name:`website`,tabIndex:-1,autoComplete:`off`,"aria-hidden":!0,className:`sr-only`,onChange:()=>void 0}),x&&(0,u.jsx)(`p`,{className:`notice notice-error small`,children:x}),(0,u.jsxs)(`button`,{className:`btn btn-block`,type:`submit`,disabled:T||!h,children:[C===`send`?(0,u.jsx)(`span`,{className:`spinner`}):(0,u.jsx)(o,{"aria-hidden":!0}),c(d,`auth.sendCode`)]}),(0,u.jsxs)(`p`,{className:`tiny muted`,style:{margin:0,textAlign:`center`},children:[c(d,`signup.newHere`),` `,(0,u.jsx)(a,{href:`/sign-up/`,children:c(d,`signup.startTrial`)})]})]}):(0,u.jsxs)(`form`,{onSubmit:k,className:`stack`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{children:c(d,`auth.codeTitle`)}),(0,u.jsxs)(`p`,{className:`muted small`,style:{marginTop:8},children:[c(d,`auth.codeLead`),` `,(0,u.jsx)(`strong`,{children:h})]})]}),y&&(0,u.jsxs)(`p`,{className:`notice notice-info small`,children:[c(d,`auth.localCode`),`: `,(0,u.jsx)(`strong`,{className:`mono`,children:y})]}),(0,u.jsxs)(`div`,{className:`field`,children:[(0,u.jsx)(`label`,{htmlFor:`code`,children:c(d,`auth.code`)}),(0,u.jsx)(`input`,{id:`code`,ref:E,className:`input input-code`,inputMode:`numeric`,autoComplete:`one-time-code`,pattern:`\\d{6}`,maxLength:6,required:!0,value:_,onChange:e=>v(e.target.value.replace(/\D/g,``))})]}),x&&(0,u.jsx)(`p`,{className:`notice notice-error small`,children:x}),(0,u.jsxs)(`button`,{className:`btn btn-block`,type:`submit`,disabled:T||_.length!==6,children:[C===`verify`?(0,u.jsx)(s,{className:`spinner`,"aria-hidden":!0}):(0,u.jsx)(o,{"aria-hidden":!0}),c(d,`auth.verify`)]}),(0,u.jsxs)(`div`,{className:`row`,style:{justifyContent:`center`},children:[(0,u.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>O(),disabled:T,children:c(d,`auth.resend`)}),(0,u.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>{m(`email`),v(``),S(``),b(null)},children:c(d,`auth.changeEmail`)})]})]})}),(0,u.jsx)(`p`,{className:`tiny muted`,style:{marginTop:18,textAlign:`center`},children:c(d,`auth.disclaimer`)})]})})}export{d as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.