PageSourceSearch

https://dashboard.vlancer.ai/assets/index-CgfJN_OG.js

js vlancer.ai collected 2026-10-05 15:02:26 UTC 7,906 bytes, 1 lines download raw bytes

1import{d as b,x as O,ap as F,j as e,c as B,B as C,ay as U,y as K}from"./index-DMKs-Jou.js";import{L as W}from"./Logo-BuV4Prq2.js";import{u as G,A as H,a as $}from"./useTimeOutMessage-CZ_1vHOS.js";import{I as E}from"./Input-DdknTB-E.js";import{F as D}from"./Form-C3r-G94t.js";import"./FormContainer-BGgz5_Mm.js";import{F as T}from"./FormItem-CMq6_gnq.js";import{P as z}from"./PasswordInput-CJL7B4AT.js";import{u as V,t as q,o as A,C as R,s as P}from"./types-COYF9DOj.js";import{C as J,f as Q}from"./Cellphone-CQ3qVYWX.js";import{c as X}from"./countries.constant-ZY8wRTuX.js";import"./isNil-DIm4sqGa.js";import"./Select-CHZo0vRs.js";const Y=a=>A({email:P({required_error:a("auth.signIn.validation.emailRequired","Please enter your email")}).min(1,{message:a("auth.signIn.validation.emailRequired","Please enter your email")}),password:P({required_error:a("auth.signIn.validation.passwordRequired","Please enter your password")}).min(1,{message:a("auth.signIn.validation.passwordRequired","Please enter your password")})}),Z=a=>{var d,j,I;const[l,r]=b.useState(!1),{t:n}=O(),{disableSubmit:f=!1,className:o,setMessage:m,passwordHint:h}=a,{handleSubmit:x,formState:{errors:u},control:i}=V({defaultValues:{email:"",password:""},resolver:q(Y(n))}),{signIn:c}=F(),g=async s=>{const{email:t,password:p}=s;if(!f){r(!0);const y=await c({email:t,password:p});(y==null?void 0:y.status)==="failed"&&(m==null||m(y.message))}r(!1)};return e.jsx("div",{className:o,children:e.jsxs(D,{onSubmit:x(g),children:[e.jsx(T,{label:n("auth.signIn.form.email","Email"),invalid:!!u.email,errorMessage:(d=u.email)==null?void 0:d.message,children:e.jsx(R,{name:"email",control:i,render:({field:s})=>e.jsx(E,{type:"email",placeholder:n("auth.signIn.form.email","Email"),autoComplete:"off",...s})})}),e.jsx(T,{label:n("auth.signIn.form.password","Password"),invalid:!!u.password,errorMessage:(j=u.password)==null?void 0:j.message,className:B(h?"mb-0":"",(I=u.password)!=null&&I.message?"mb-8":""),children:e.jsx(R,{name:"password",control:i,rules:{required:!0},render:({field:s})=>e.jsx(z,{type:"text",placeholder:n("auth.signIn.form.password","Password"),autoComplete:"off",...s})})}),h,e.jsx(C,{block:!0,loading:l,variant:"solid",type:"submit",children:l?n("auth.signIn.form.signingIn","Signing in..."):n("auth.signIn.form.signInButton","Sign In")})]})})},M=({length:a=6,value:l="",onChange:r,disabled:n=!1,className:f="",inputClass:o,autoFocus:m=!1,placeholder:h,invalid:x=!1})=>{const[u,i]=b.useState(0),c=b.useRef([]);b.useEffect(()=>{c.current=Array(a).fill(null).map((s,t)=>c.current[t]||null)},[a]);const g=(s,t)=>{var S;const p=s.target.value;if(p.length>1)return;const y=l.slice(0,t)+p+l.slice(t+1);r==null||r(y),p&&t<a-1&&(i(t+1),(S=c.current[t+1])==null||S.focus())},d=(s,t)=>{var p,y,S;if(s.key==="Backspace")if(s.preventDefault(),l[t]){const w=l.slice(0,t)+""+l.slice(t+1);r==null||r(w)}else t>0&&(i(t-1),(p=c.current[t-1])==null||p.focus());else s.key==="ArrowLeft"&&t>0?(s.preventDefault(),i(t-1),(y=c.current[t-1])==null||y.focus()):s.key==="ArrowRight"&&t<a-1&&(s.preventDefault(),i(t+1),(S=c.current[t+1])==null||S.focus())},j=s=>{s.preventDefault();const t=s.clipboardData.getData("text/plain").slice(0,a);t.match(/^[0-9]+$/)&&(r==null||r(t.padEnd(a,"")))},I=s=>t=>{c.current[s]=t};return e.jsx("div",{dir:"ltr",className:`flex gap-2 ${f}`,children:Array(a).fill(null).map((s,t)=>e.jsx(E,{ref:I(t),className:B("text-center text-lg",o),type:"text",inputMode:"numeric",pattern:"[0-9]*",maxLength:1,value:l[t]||"",disabled:n,autoFocus:m&&t===0,placeholder:h,"aria-label":`Digit ${t+1} of ${a}`,invalid:x,onChange:p=>g(p,t),onKeyDown:p=>d(p,t),onPaste:j,onFocus:()=>i(t)},t))})},_=6,ee=a=>A({otp:P().min(_,{message:a("auth.signIn.validation.enterCode","Enter the 6-digit code")})}),te=({phoneNumber:a,countryCode:l,setMessage:r,className:n})=>{var g;const[f,o]=b.useState(!1),{t:m}=O(),{handleSubmit:h,control:x,formState:{errors:u}}=V({resolver:q(ee(m))}),{verifyOtp:i}=F(),c=async({otp:d})=>{var j,I;o(!0);try{await i(d,a,l)}catch(s){r==null||r(((I=(j=s==null?void 0:s.response)==null?void 0:j.data)==null?void 0:I.message)??m("auth.signIn.errors.wrongCode","Wrong code, please try again."))}finally{o(!1)}};return e.jsx("div",{className:n,children:e.jsxs(D,{onSubmit:h(c),children:[e.jsx(T,{invalid:!!u.otp,errorMessage:(g=u.otp)==null?void 0:g.message,children:e.jsx(R,{name:"otp",control:x,render:({field:d})=>e.jsx(M,{length:_,inputClass:"",className:" max-w-80 mx-auto",...d})})}),e.jsx(C,{block:!0,loading:f,variant:"solid",type:"submit",children:f?m("auth.signIn.form.verifying","Verifying…"):m("auth.signIn.form.verifyOtp","Verify OTP")})]})})},se=a=>A({phoneNumber:P().regex(/^\d{10}$/,a("auth.signIn.validation.invalidPhone","Invalid phone number")),countryCode:P()}),ae=({disableSubmit:a=!1,className:l,hint:r,setMessage:n})=>{const[f,o]=b.useState(!1),[m,h]=b.useState(!1),[x,u]=b.useState(""),[i,c]=b.useState(""),{t:g}=O(),d=U(w=>w.regionData),j={UK:"GB",US:"US",Israel:"IL",IL:"IL"},I=b.useMemo(()=>
1{if(d!=null&&d.region){const w=j[d.region];if(w){const v=X.find(N=>N.value===w);if(v)return v.dialCode}}return"+44"},[d]),{handleSubmit:s,control:t,formState:{errors:p}}=V({defaultValues:{phoneNumber:"",countryCode:I},resolver:q(se(g))}),{requestOtp:y}=F(),S=async({phoneNumber:w,countryCode:v})=>{var N,L;if(!a){o(!0);try{await y(w,v),u(w),c(v),h(!0)}catch(k){n==null||n(((L=(N=k==null?void 0:k.response)==null?void 0:N.data)==null?void 0:L.message)??g("auth.signIn.errors.failedSendOtp","Failed to send OTP. Please try again."))}finally{o(!1)}}};return m?e.jsx(te,{phoneNumber:x,countryCode:i,setMessage:n,className:l}):e.jsx("div",{className:l,children:e.jsxs(D,{onSubmit:s(S),children:[e.jsx(J,{control:t,errors:p,formatPhone:Q,label:"Cellphone"}),r,e.jsx(C,{block:!0,loading:f,variant:"solid",type:"submit",children:f?g("auth.signIn.form.sendingCode","Sending code…"):g("auth.signIn.form.sendOtp","Send OTP")})]})})},re=({signUpUrl:a="/sign-up",forgetPasswordUrl:l="/forgot-password",disableSubmit:r})=>{const[n,f]=G(),{t:o}=O(),m=K(i=>i.mode),[h,x]=b.useState("credentials"),u=({id:i,label:c})=>e.jsx("button",{type:"button",onClick:()=>x(i),className:`px-4 py-2 font-semibold heading-text transition ${h===i?"border-b-2 border-primary-500 dark:border-primary-400 text-primary-600 dark:text-primary-300":"text-gray-500 hover:text-primary-500 dark:text-gray-400"}`,children:c});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-8",children:e.jsx(W,{type:"streamline",mode:m,imgClass:"mx-auto",logoWidth:60})}),e.jsxs("div",{className:"mb-10",children:[e.jsx("h2",{className:"mb-2",children:o("auth.signIn.title","Welcome back!")}),e.jsx("p",{className:"font-semibold heading-text",children:h==="credentials"?o("auth.signIn.subtitle.credentials","Please enter your credentials to sign in!"):o("auth.signIn.subtitle.otp","Get a one-time code sent to your phone!")})]}),n&&e.jsx(H,{showIcon:!0,className:"mb-4",type:"danger",children:e.jsx("span",{className:"break-all",children:n})}),e.jsxs("div",{className:"flex justify-center gap-4 mb-6 border-b border-gray-200 dark:border-gray-700",children:[e.jsx(u,{id:"credentials",label:o("auth.signIn.tabs.credentials","Email & Password")}),e.jsx(u,{id:"otp",label:o("auth.signIn.tabs.otp","Phone OTP")})]}),h==="credentials"?e.jsx(Z,{disableSubmit:r,setMessage:f,passwordHint:e.jsx("div",{className:"mb-7 mt-2",children:e.jsx($,{to:l,className:"font-semibold heading-text mt-2 underline",themeColor:!1,children:o("auth.signIn.forgotPassword","Forgot password")})})}):e.jsx(ae,{disableSubmit:r,setMessage:f,className:"mb-2"}),e.jsxs("div",{className:"mt-6 text-center",children:[e.jsxs("span",{children:[o("auth.signIn.noAccount","Don't have an account yet?")," "]}),e.jsx($,{to:a,className:"heading-text font-bold",themeColor:!1,children:o("auth.signIn.signUp","Sign up")})]})]})},be=()=>e.jsx(re,{});export{re as SignInBase,be 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.