1import{j as e,l as S,s as j}from"./main-CMViuH_f.js";import{d as I,a as n,L as E}from"./vendor-react-Bjxsyr_G.js";import{I as x}from"./Input-BBroo5uU.js";import{c as L,a as f}from"./vendor-forms-Chlqk9RW.js";import{D as O}from"./vendor-redux-CkTbKByD.js";import{B as k}from"./Button-DzyKh4DA.js";import{c as R,v as C}from"./validation-CmgQtWDq.js";import{u as G}from"./vendor-i18n-CmmgQqfv.js";const l=L({username:f().trim().required().min(3).max(50),password:f().required().min(8)}),T={username:"",password:"",remember:!1},b={username:"LOGIN.USERNAME",password:"LOGIN.PASSWORD"};function P(){const h=I(),{t}=G(),m=O(),[s,g]=n.useState(T),[c,d]=n.useState({}),[N,p]=n.useState(!1),u=n.useMemo(()=>R(l,b,d),[]),o=n.useCallback((a,i)=>{const r={...s,[a]:i};g(r),u(a,r)},[s,u]),y=n.useMemo(()=>{try{return l.isValidSync(s)}catch{return!1}},[s]),w=async()=>{const{isValid:a,errors:i}=await C(l,s,{labelKeys:b,abortEarly:!1});if(d(i),!!a)try{p(!0);const r={username:s.username,password:s.password,remember_me:s.remember};await m(S(r)).unwrap(),h("/dashboard")}catch(r){m(j({notification:typeof r=="string"?r:"LOGIN.SUBMIT_FAILED",notificationColor:"red",forTranslation:!0}))}finally{p(!1)}},v=!y;return e.jsxs("div",{className:"w-full",children:[e.jsxs("div",{className:"text-center space-y-2 max-w-[640px] mx-auto",children:[e.jsx("p",{className:"block font-bold text-[13.6px] leading-[1.5] md:text-[14.4px] md:leading-[21.5938px] tracking-normal whitespace-normal break-words text-[var(--mdn-text-87)]",children:t("LOGIN.FIRST_SUBTITLE")}),e.jsx("p",{className:"block font-bold text-[13.6px] leading-[1.5] md:text-[14.4px] md:leading-[21.5938px] tracking-normal whitespace-normal break-words text-[var(--mdn-text-87)]",children:t("LOGIN.SECOND_SUBTITLE")})]}),e.jsxs("form",{className:"mt-6 space-y-6",onSubmit:a=>{a.preventDefault(),w()},noValidate:!0,children:[e.jsx(x,{label:t("LOGIN.USERNAME"),name:"username",value:s.username,onChange:a=>o("username",a.target.value),autoComplete:"username",error:c.username,inputClassName:"h-14"}),e.jsx(x,{label:t("LOGIN.PASSWORD"),type:"password",name:"password",value:s.password,onChange:a=>o("password",a.target.value),autoComplete:"current-password",error:c.password,inputClassName:"h-14"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("label",{className:"block select-none cursor-pointer h-[34px]",children:[e.jsx("input",{type:"checkbox",checked:s.remember,onChange:a=>o("remember",a.target.checked),className:"peer align-middle cursor-pointer h-4 w-4 rounded-sm border-2 border-[var(--mdn-border-38)] accent-[var(--mdn-text-87)]"}),e.jsx("span",{className:"align-middle ml-2 text-[16px] font-normal text-[var(--mdn-text-60)] peer-checked:text-[var(--mdn-text-87)]",style:{fontFamily:"Roboto, sans-serif"},children:t("LOGIN.REMEMBER_ME")})]}),e.jsx(E,{to:"/forgot-password",className:"underline text-[14.4px] font-normal leading-[21.6px] text-[var(--mdn-text-secondary)]",style:{fontFamily:"Roboto, sans-serif"},children:t("LOGIN.FORGOT_PASSWORD")})]}),e.jsx("div",{className:"flex items-center justify-end gap-3",children:e.jsx(k,{type:"submit",disabled:v,loading:N,children:t("LOGIN.SUBMIT")})})]})]})}export{P 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.