PageSourceSearch

https://msagheb.ir/app/assets/index-FMJkMzPI.js

js msagheb.ir collected 2026-10-02 20:52:43 UTC 4,261 bytes, 1 lines download raw bytes

1import{r as p,d as w,u as D,j as e}from"./react-CC1faa-K.js";import{u as k,a as R,b as g,Q as x,c as f,n as S,L as b,T as L,B,s as $,d as F}from"./index-CQYgi704.js";import{u as N,s as U,C as V}from"./forms-Cz4Q3b43.js";import{S as m,I as j,E as _,v as C,R as z}from"./mui-DWCKKmMe.js";import{A as I,o as K}from"./index-DKY9k4Os.js";import{A as W}from"./index-qBwnDbY0.js";import{d as Q}from"./icons-BnvIFHtd.js";import"./dates-DjetTc6v.js";import"./query-DMVz0aUJ.js";import"./neshan-D5pLIdoN.js";import"./motion-CrTrTS3t.js";const Y=o=>{let l,i,s;const t=Math.floor(o/3600),n=Math.floor((o-t*3600)/60),r=Math.floor(o-t*3600-n*60);return l=t.toString(),i=n.toString(),s=r.toString(),t<10&&(l="0"+t.toString()),n<10&&(i="0"+n.toString()),r<10&&(s="0"+r.toString()),t>0?`${l}:${i}:${s}`:`${i}:${s}`},H=()=>{const[o,l]=p.useState(0),[i,s]=p.useState(!1),t=n=>l(n);return p.useEffect(()=>{if(o===0)return;let n;const r=()=>{const d=new Date().getTime(),u=+Math.floor(o/1e3)-Math.floor(d/1e3);return u>=0?(s(Y(u)),!0):(s(!1),!1)};return r()&&(n=setInterval(()=>{r()||clearInterval(n)},1e3)),()=>{n&&clearInterval(n)}},[o]),{remainedTime:i,generateTimer:t}},it=()=>{const{t:o}=k(),{configObj:l,isLoading:i}=R(),s=w(),t=D(),{generateTimer:n,remainedTime:r}=H(),d=g(I,x.CheckMobile),u=g(I,x.LoginWithOtp),{control:T,handleSubmit:M,formState:{errors:h,isValid:v},setError:y}=N({resolver:U(K(o)),mode:"onChange",defaultValues:{otpCode:""}}),A=a=>{u.mutate({mobileNumber:t?.state?.mobile,otpID:t?.state?.otpId,otpText:a.otpCode,ip:"127.1.1.1",mac:null,device:null,agent:navigator?.userAgent||""},{onSuccess:({data:c})=>
1{if(c?.tokenID){const O=Math.ceil((c?.expired_At*1e3-Date.now())/864e5);$(F,c?.tokenID||"",O),s("/auth/setpassword",{state:{mobile:t?.state?.mobile,url:decodeURIComponent(t?.state?.url)}})}},onError:c=>{y("otpCode",{type:"manual",message:o("auth.errors.generic",{message:c?.response?.data?.message})})}})},P=()=>{d.mutate({mobileNumber:t?.state?.mobile,ip:"127.1.1.1",mac:null,device:null,agent:navigator?.userAgent||"",loginType:l.loginOTP.type??b.SMS},{onSuccess:({data:a})=>{a?.otp?.id&&(t.state.expire=a.otp.expireDate,t.state.otpId=a.otp.id,n(a.otp.expireDate*1e3))}})};p.useLayoutEffect(()=>{(!t.state||!t?.state?.mobile||!t?.state?.otpId||!t?.state?.expire)&&s("/auth/login"),n((t?.state?.expire||0)*1e3)},[t.state]);const E=p.useMemo(()=>!t.state||!t?.state?.url?!1:t?.state?.url&&t?.state?.url.length>0&&t?.state?.url.toString().startsWith("http"),[]);return e.jsx(W,{children:e.jsxs(m,{position:"absolute",top:"60%",left:"50%",sx:{transform:"translate(-50%, -50%)"},width:"100%",px:{xs:"1.5rem",md:"3.75rem"},component:"form",onSubmit:M(A),children:[e.jsx(m,{flexDirection:"row",alignContent:"center",justifyContent:"center",children:e.jsxs(m,{width:"80%",children:[e.jsxs(m,{direction:"row",mb:2,children:[e.jsxs(f,{variant:"Caption",mt:1,children:[o("auth.otp.sentPrefix")," ",e.jsx("b",{children:S.toPersian(t?.state?.mobile)})," ",l.loginOTP.type===b.Bale?o("auth.otp.sentViaBale"):o("auth.otp.sentViaSms")," ",o("auth.otp.sentSuffix")]}),e.jsx(j,{sx:{mt:-1},onClick:()=>s(`/auth/login${E?`?url=${encodeURIComponent(t?.state?.url)}`:""}`),children:e.jsx(_,{color:"error",sx:{fontSize:"14px"}})})]}),e.jsx(V,{name:"otpCode",control:T,render:({field:a})=>e.jsx(L,{...a,autoFocus:!0,onChange:c=>{a?.onChange(c)},variant:"outlined",label:o("auth.otp.placeholder"),placeholder:"12345",slotProps:{input:{inputProps:{maxLength:6},startAdornment:e.jsx(C,{position:"start",children:e.jsx(Q,{})}),endAdornment:e.jsx(C,{position:"end",children:t?.state?.expire&&e.jsxs(e.Fragment,{children:[e.jsx(f,{variant:"CaptionBold",children:r?S.toPersian(r):"--:--"}),e.jsx(j,{disabled:!!r,onClick:P,children:e.jsx(z,{sx:{fontSize:"14px"}})})]})})},htmlInput:{inputMode:"numeric",pattern:"[0-9]*",textAlign:"center"}},sx:{".MuiInputBase-input":{textAlign:"center"}}})}),h.otpCode&&e.jsx(m,{mt:"0.5rem",sx:{color:"#D32F2F",fontSize:"0.75rem"},children:h.otpCode.message})]})}),e.jsx(m,{mt:"1.8rem",alignItems:"center",justifyContent:"center",children:e.jsx(B,{sx:{width:"154px",borderRadius:"100px"},loading:i||u.isPending,disabled:i||!v||u.isPending,type:"submit",children:u.isPending?o("auth.loggingIn"):o("auth.otp.button")})})]})})};export{it 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.