1import{O as A,P as I,N as O,r as a,j as e,a0 as j}from"./vendor-tF6AKaQH.js";import{P as R,p as U}from"./PageMetadata-DfELedTP.js";import{k as D,r as F,p as l,R as d,B as y,l as H,s as B}from"./index-B_Twxck6.js";import{u as G}from"./redux-nPTL3_Y6.js";import{I as b}from"./input-Bnz7nTyK.js";import{L as N}from"./label-D4LIZUV7.js";import"./three-DQ3O7-sJ.js";import"./query-rSCQzsi3.js";import"./ui-lib-SIfkAfLg.js";import"./icons-B3V7Hv4S.js";function Y(){const{t}=A(),m=I(),w=G(),{lng:S}=O(),r=S??"en",E=D(),[n,T]=a.useState(""),[p,k]=a.useState(""),[h,c]=a.useState(null),[L,x]=a.useState(!1),[i,g]=a.useState(!1),[u,f]=a.useState(!1),P=async s=>{s.preventDefault(),c(null),x(!1),g(!0);try{const o=await H({email:n,password:p},{suppressErrorToast:!0});w(B({idToken:o.data.tokens.idToken,refreshToken:o.data.tokens.refreshToken})),m(l(d.DASHBOARD,r))}catch(o){const v=o,C=v.response?.status;c(v.response?.data.message??t("auth.login.error")),x(C===403)}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[e.jsx(R,{title:U("Login"),description:"Sign in to your portfolio account.",noIndex:!0}),e.jsxs("div",{className:"flex flex-col gap-2 text-center",children:[e.jsx("h1",{className:"text-3xl font-bold bg-linear-to-r from-gradient-from to-gradient-to bg-clip-text text-transparent",children:t("auth.login.title")}),e.jsx("p",{className:"text-muted-foreground text-balance",children:t("auth.login.description")})]}),e.jsxs("form",{onSubmit:s=>{P(s)},className:"space-y-6",children:[h&&e.jsxs("div",{className:"space-y-2 rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:[e.jsx("p",{children:h}),L&&n.trim()!==""&&e.jsx("p",{children:e.jsx("button",{type:"button",onClick:()=>{(async()=>{const s=n.trim();if(!(s===""||u)){f(!0);try{await F({email:s},{suppressErrorToast:!0}),m(l(d.AUTH.CONFIRM_SIGNUP,r),{state:{email:s}})}catch{c(t("auth.login.error"))}finally{f(!1)}}})()},disabled:u,className:"font-medium text-primary underline underline-offset-4 hover:no-underline disabled:opacity-50",children:t(u?"auth.login.verifySending":"auth.login.verifyEmailCta")})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"email",children:t("auth.login.email")}),e.jsx(b,{id:"email",type:"email",placeholder:t("auth.login.emailPlaceholder"),value:n,onChange:s=>{T(s.target.value)},required:!0,disabled:i})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(N,{htmlFor:"password",children:t("auth.login.password")}),e.jsx(j,{to:l(d.AUTH.FORGOT_PASSWORD,r),className:"text-sm text-primary underline underline-offset-2 hover:no-underline",children:t("auth.login.forgotPassword")})]}),e.jsx(b,{id:"password",type:"password",placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",value:p,onChange:s=>{k(s.target.value)},required:!0,disabled:i})]}),e.jsx(y,{type:"submit",variant:"gradient",className:"w-full",disabled:i,children:t(i?"auth.login.loading":"auth.login.submit")}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:t("auth.login.orContinueWith")})})]}),e.jsxs("div",{className:"relative",children:[e.jsxs(y,{type:"button",variant:"outline",className:"w-full opacity-50 cursor-not-allowed",disabled:!0,children:[e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"me-2 h-5 w-5",children:e.jsx("path",{d:"M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z",fill:"currentColor"})}),t("auth.login.loginWithGoogle")]}),e.jsx("span",{className:"absolute -top-2 -end-2 bg-linear-to-r from-gradient-from to-gradient-to text-on-gradient text-xs px-2 py-1 rounded-full shadow-lg",children:t("auth.branded.comingSoon")})]}),E&&e.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:[t("auth.login.noAccount")," ",e.jsx(j,{to:l(d.AUTH.SIGNUP,r),className:"font-medium text-primary underline underline-offset-4 hover:no-underline",children:t("auth.login.signUp")})]})]})]})}export{Y 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.