1import{r as i,k as fe,m as de,l as pe,o as me,p as _e,q as Ne,S as Oe,s as ye,t as Ee,j as l,v as ge,b as he,a as Ie,A as D,C as Te,T as W,h as s,B as q,M as Se,L as Pe,G as xe,w as Q,n as X,x as ve}from"./index-3d3bd5ca.js";import{I as be}from"./InputPhoneNumber-cd74c441.js";import{l as ae,R as Ae}from"./validator-83ca31b9.js";import{L as te}from"./ongphra-brown-86d74b16.js";import{F as V}from"./index-b7ac2889.js";import{C as Re}from"./index-693d658e.js";import{R as Me,C as ne}from"./row-65a5c8ed.js";import{F as J}from"./index-05ad7cf1.js";import"./react-country-flag.esm-a6efec71.js";import"./index-7b3af9cd.js";import"./gapSize-a2278ff3.js";import"./index-da953354.js";import"./EyeOutlined-28b8733e.js";import"./isEqual-90d117b2.js";const Ce=e=>{const{value:n,formatter:o,precision:t,decimalSeparator:a,groupSeparator:_="",prefixCls:O}=e;let f;if(typeof o=="function")f=o(n);else{const d=String(n),N=d.match(/^(-?)(\d*)(\.(\d+))?$/);if(!N||d==="-")f=d;else{const E=N[1];let g=N[2]||"0",c=N[4]||"";g=g.replace(/\B(?=(\d{3})+(?!\d))/g,_),typeof t=="number"&&(c=c.padEnd(t,"0").slice(0,t>0?t:0)),c&&(c=`${a}${c}`),f=[i.createElement("span",{key:"int",className:`${O}-content-value-int`},E,g),c&&i.createElement("span",{key:"decimal",className:`${O}-content-value-decimal`},c)]}}return i.createElement("span",{className:`${O}-content-value`},f)},je=Ce,He=e=>{const{componentCls:n,marginXXS:o,padding:t,colorTextDescription:a,titleFontSize:_,colorTextHeading:O,contentFontSize:f,fontFamily:d}=e;return{[`${n}`]:Object.assign(Object.assign({},pe(e)),{[`${n}-title`]:{marginBottom:o,color:a,fontSize:_},[`${n}-skeleton`]:{paddingTop:t},[`${n}-content`]:{color:O,fontSize:f,fontFamily:d,[`${n}-content-value`]:{display:"inline-block",direction:"ltr"},[`${n}-content-prefix, ${n}-content-suffix`]:{display:"inline-block"},[`${n}-content-prefix`]:{marginInlineEnd:o},[`${n}-content-suffix`]:{marginInlineStart:o}}})}},Ge=e=>{const{fontSizeHeading3:n,fontSize:o}=e;return{titleFontSize:o,contentFontSize:n}},De=fe("Statistic",e=>{const n=de(e,{});return[He(n)]},Ge);var ke=globalThis&&globalThis.__rest||function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(e);a<t.length;a++)n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(o[t[a]]=e[t[a]]);return o};const we=e=>{const{prefixCls:n,className:o,rootClassName:t,style:a,valueStyle:_,value:O=0,title:f,valueRender:d,prefix:N,suffix:E,loading:g=!1,formatter:c,precision:x,decimalSeparator:A=".",groupSeparator:R=",",onMouseEnter:u,onMouseLeave:M}=e,C=ke(e,["prefixCls","className","rootClassName","style","valueStyle","value","title","valueRender","prefix","suffix","loading","formatter","precision","decimalSeparator","groupSeparator","onMouseEnter","onMouseLeave"]),{getPrefixCls:v,direction:y,statistic:b}=i.useContext(me),I=v("statistic",n),[S,P,j]=De(I),p=i.createElement(je,{decimalSeparator:A,groupSeparator:R,prefixCls:I,formatter:c,precision:x,value:O}),T=_e(I,{[`${I}-rtl`]:y==="rtl"},b==null?void 0:b.className,o,t,P,j),H=Ne(C,{aria:!0,data:!0});return S(i.createElement("div",Object.assign({},H,{className:T,style:Object.assign(Object.assign({},b==null?void 0:b.style),a),onMouseEnter:u,onMouseLeave:M}),f&&i.createElement("div",{className:`${I}-title`},f),i.createElement(Oe,{paragraph:!1,loading:g,className:`${I}-skeleton`},i.createElement("div",{style:_,className:`${I}-content`},N&&i.createElement("span",{className:`${I}-content-prefix`},N),d?d(p):p,E&&i.createElement("span",{className:`${I}-content-suffix`},E)))))},Z=we,Le=[["Y",1e3*60*60*24*365],["M",1e3*60*60*24*30],["D",1e3*60*60*24],["H",1e3*60*60],["m",1e3*60],["s",1e3],["S",1]];function Fe(e,n){let o=e;const t=/\[[^\]]*]/g,a=(n.match(t)||[]).map(d=>d.slice(1,-1)),_=n.replace(t,"[]"),O=Le.reduce((d,N)=>{let[E,g]=N;if(d.includes(E)){const c=Math.floor(o/g);return o-=c*g,d.replace(new RegExp(`${E}+`,"g"),x=>{const A=x.length;return c.toString().padStart(A,"0")})}return d},_);let f=0;return O.replace(t,()=>{const d=a[f];return f+=1,d})}function We(e,n){const{format:o=""}=n,t=new Date(e).getTime(),a=Date.now(),_=Math.max(t-a,0);return Fe(_,o)}var Be=globalThis&&globalThis.__rest||function(e,n){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,t=Object.getOwnPropertySymbols(e);a<t.length;a++)n.indexOf(t[a])<0&&Object.prototype.propertyIsEnumerable.call(e,t[a])&&(o[t[a]]=e[t[a]]);return o};const Ue=1e3/30;function $e(e){return new Date(e).getTime()}const Ke=e=>{const{value:n,format:o="HH:mm:ss",onChange:t,onFinish:a}=e,_=Be(e,["value","format","onChange","onFinish"]),O=ye(),f=i.useRef(null),d=()=>{a==null||a(),f.current&&(clearInterval(f.current),f.current=null)},N=()=>{const c=$e(n);c>=Date.now()&&(f.current=setInterval(()=>{O(),t==null||t(c-Date.now()),c<Date.now()&&d()},Ue))};i.useEffect(()=>(N(),()=>{f.current&&(clearInterval(f.current),f.current=null)}),[n]);const E=(c,x)=>We(c,Object.assign(Object.assign({},x),{format:o})),g=c=>Ee(c,{title:void 0});return i.createElement(Z,Object.assign({},_,{value:n,valueRender:g,formatter:E}))},ze=i.memo(Ke);Z.Countdown=ze;var U=function(){return U=Object.assign||function(e){for(var n,o=1,t=arguments.length;o<t;o++)for(var a in n=arguments[o])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},U.apply(this,arguments)},w=function(e){return typeof e=="object"},Ve=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return e.filter(function(o){return!w(o)&&o!==!1}).join(" ")},Ye=function(e){var n=e.placeholder,o=e.separator,t=e.isLastChild,a=e.inputStyle,_=e.focu
1s,O=e.isDisabled,f=e.hasErrored,d=e.errorStyle,N=e.focusStyle,E=e.disabledStyle,g=e.shouldAutoFocus,c=e.isInputNum,x=e.index,A=e.value,R=e.className,u=e.isInputSecure,M=function(y,b){var I={};for(var S in y)Object.prototype.hasOwnProperty.call(y,S)&&b.indexOf(S)<0&&(I[S]=y[S]);if(y!=null&&typeof Object.getOwnPropertySymbols=="function"){var P=0;for(S=Object.getOwnPropertySymbols(y);P<S.length;P++)b.indexOf(S[P])<0&&Object.prototype.propertyIsEnumerable.call(y,S[P])&&(I[S[P]]=y[S[P]])}return I}(e,["placeholder","separator","isLastChild","inputStyle","focus","isDisabled","hasErrored","errorStyle","focusStyle","disabledStyle","shouldAutoFocus","isInputNum","index","value","className","isInputSecure"]),C=i.useRef(null);i.useEffect(function(){var y=C.current;y&&_&&g&&y.focus()},[]),i.useEffect(function(){var y=C.current;_&&y&&(y.focus(),y.select())},[_]);var v=i.useMemo(function(){return u?"password":c?"tel":"text"},[u,c]);return l.jsxs("div",U({className:R,style:{display:"flex",alignItems:"center"}},{children:[l.jsx("input",U({"aria-label":"".concat(x===0?"Please enter verification code. ":"").concat(c?"Digit":"Character"," ").concat(x+1),autoComplete:"off",style:Object.assign({width:"1em",textAlign:"center"},w(a)&&a,_&&w(N)&&N,O&&w(E)&&E,f&&w(d)&&d),placeholder:n,className:Ve(a,_&&N,O&&E,f&&d),type:v,ref:C,disabled:O,value:A||""},M)),!t&&l.jsx(l.Fragment,{children:o})]}))},qe=i.forwardRef(function(e,n){var o=e.numInputs,t=o===void 0?4:o,a=e.onChange,_=a===void 0?function(r){return console.log(r)}:a,O=e.isDisabled,f=O!==void 0&&O,d=e.shouldAutoFocus,N=d!==void 0&&d,E=e.value,g=E===void 0?"":E,c=e.isInputSecure,x=c!==void 0&&c,A=e.placeholder,R=e.isInputNum,u=e.containerStyle,M=e.inputStyle,C=e.focusStyle,v=e.separator,y=e.disabledStyle,b=e.hasErrored,I=e.errorStyle,S=e.className,P=e["data-cy"],j=e["data-testid"],p=i.useState(0),T=p[0],H=p[1],G=i.useMemo(function(){return g?g.toString().split(""):[]},[g]),$=i.useMemo(function(){if(typeof A=="string"){if(A.length===t)return A;if(A.length>0)return console.error("Length of the placeholder should be equal to the number of inputs."),""}return""},[t,A]);i.useImperativeHandle(n,function(){return{focusInput:h}});var L=function(r){var m=r.join("");_(m)},B=function(r){return(R?!isNaN(parseInt(r,10)):typeof r=="string")&&r.trim().length===1},h=function(r){var m=Math.max(Math.min(t-1,r),0);H(m)},ee=function(){h(T+1)},Y=function(){h(T-1)},K=function(r){G[T]=r[0],L(G)},re=function(r){if(r.preventDefault(),!f){for(var m=T,F=r.clipboardData.getData("text/plain").slice(0,t-T).split(""),k=0;k<t;++k)k>=T&&F.length>0&&(G[k]=F.shift(),m++);H(m),h(m),L(G)}},se=function(r){r.keyCode===8||r.key==="Backspace"?(r.preventDefault(),K(""),Y()):r.keyCode===46||r.key==="Delete"?(r.preventDefault(),K("")):r.keyCode===37||r.key==="ArrowLeft"?(r.preventDefault(),Y()):r.keyCode===39||r.key==="ArrowRight"?(r.preventDefault(),ee()):r.keyCode!==32&&r.key!==" "&&r.key!=="Spacebar"&&r.key!=="Space"||r.preventDefault()},le=function(r){if(B(r.target.value))ee();else if(!R){var m=r.nativeEvent;m.data===null&&m.inputType==="deleteContentBackward"&&(r.preventDefault(),K(""),Y())}},ie=function(r){return function(m){H(r),m.target.select()}},ce=function(){return H(-1)};return l.jsx("div",U({style:Object.assign({display:"flex"},w(u)&&u),className:w(u)?"":u},{children:new Array(t).fill(null).map(function(r,m){var F,k;return l.jsx(Ye,{placeholder:(F=$[m])!==null&&F!==void 0?F:"",index:m,focus:T===m,value:G[m],onChange:(k=m,function(ue){var z=ue.target.value;k!==0||z.length!==t?B(z)&&K(z):L(z.split(""))}),onKeyDown:se,onInput:le,onPaste:re,onFocus:ie(m),onBlur:ce,separator:v,inputStyle:M,focusStyle:C,isLastChild:m===t-1,isDisabled:f,disabledStyle:y,hasErrored:b,errorStyle:I,shouldAutoFocus:N,isInputNum:R,isInputSecure:x,className:S,"data-cy":P&&"".concat(P,"-").concat(m),"data-testid":j&&"".concat(j,"-").concat(m)},m)})}))});const oe=ae.PhoneNumberUtil.getInstance(),Qe=45;function ft(){const[e]=V.useForm(),[n,o]=i.useState(!1),[t,a]=i.useState(""),[_,O]=i.useState({ref:"",phoneFormat:""}),[f,d]=i.useState(!1),[N,E]=i.useState(!1),[g,c]=i.useState(!1),x=i.useRef(null),A=ge(),R=i.useRef(null),{t:u}=he(),{isDarkMode:M}
1=Ie(),{useBreakpoint:C}=xe,v=C(),y=async P=>{var L,B;const{code:j,dial_code:p,rawValue:T}=P.phone;R.current=P.phone;const H=oe.parse(T,j),G=oe.format(H,ae.PhoneNumberFormat.E164),$={phone_number:G,dial_code:p,phone_number_un_format:T,provider:"phone",version:"v2"};try{d(!0);const h=await Q.post("api/phone-number/register",$);(h==null?void 0:h.code)==200&&(x.current=$,c(!1),O({ref:(L=h==null?void 0:h.data)==null?void 0:L.ref,phoneFormat:G}),a(""),o(!0)),(h==null?void 0:h.code)==406&&X.error(u(s.ALERT.ERROR_FOUND.i18nKey,s.ALERT.ERROR_FOUND.fallback),{details:(B=h==null?void 0:h.data)==null?void 0:B.message})}catch{}finally{d(!1)}},b=async()=>{var j;if(t.length!==6)return;const P={...x.current,ref:_.ref,otp:t};try{E(!0);const p=await Q.post("api/phone-number/login",P);if((p==null?void 0:p.code)==200){localStorage.setItem("accessToken",p==null?void 0:p.data.token);const T=await Q.get("api/user-info");(T==null?void 0:T.code)==200&&(localStorage.setItem("phoneObj",JSON.stringify(R.current)),A(ve({isAuth:!0,me:T.data})))}(p==null?void 0:p.code)==406&&X.error(u(s.ALERT.ERROR_FOUND.i18nKey,s.ALERT.ERROR_FOUND.fallback),{details:(j=p==null?void 0:p.data)==null?void 0:j.messages}),(p==null?void 0:p.code)==401&&X.error(u(s.SIGN_IN_WITH_PHONE_PAGE.ALERT_OTP_WRONG_TITLE.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.ALERT_OTP_WRONG_TITLE.fallback),{details:u(s.SIGN_IN_WITH_PHONE_PAGE.ALERT_OTP_WRONG_DETAIL.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.ALERT_OTP_WRONG_DETAIL.fallback)})}catch{}finally{E(!1)}},I=()=>{x.current=null,o(!1)},S=()=>{x.current=null,o(!1),e.submit()};return l.jsxs("div",{style:{display:"flex",alignItems:"center",minHeight:"100vh"},children:[l.jsx(Re,{className:"custom-card_login",style:{width:"100%",backgroundColor:D.PRIMARY,border:"none",height:v.lg||v.xl||v.xxl?"100%":"100vh",borderRadius:v.lg||v.xl||v.xxl?20:0},children:l.jsxs(Me,{children:[l.jsx(ne,{xs:24,children:l.jsx(J,{justify:"center",align:"center",style:{width:"100%",marginTop:20,marginBottom:20},children:l.jsx("img",{src:te,alt:"ongphra",style:{height:120}})})}),l.jsx(ne,{xs:24,children:l.jsxs(J,{vertical:!0,justify:"start",align:"start",flex:1,style:{height:v.lg||v.xl||v.xxl?"100%":"100vh",padding:25,borderRadius:20,backgroundColor:M?"#303030":Te.WHITE},children:[l.jsx(W.Text,{style:{fontSize:"1rem",color:D.PRIMARY},children:u(s.SIGN_IN_WITH_PHONE_PAGE.MY_PHONE_NUMBER.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.MY_PHONE_NUMBER.fallback)}),l.jsxs(V,{style:{width:"100%"},form:e,name:"form-create-wallpaper",onFinish:y,layout:"vertical",requiredMark:"optional",children:[l.jsx(V.Item,{name:"phone",rules:[{required:!0,message:u(s.VALIDATE_MESSAGE_INPUT_PHONE_NUMBER_REQUIRED.i18nKey,s.VALIDATE_MESSAGE_INPUT_PHONE_NUMBER_REQUIRED.fallback)},{...Ae.isValidPhone,message:u(s.VALIDATE_MESSAGE_INPUT_PHONE_NUMBER.i18nKey,s.VALIDATE_MESSAGE_INPUT_PHONE_NUMBER.fallback)}],style:{marginTop:20},children:l.jsx(be,{})}),l.jsx(V.Item,{children:l.jsx(q,{type:"primary",htmlType:"submit",block:!0,style:{color:M&&D.BODY_DARK,marginTop:10,backgroundColor:D.PRIMARY,border:"none",borderRadius:10},loading:f,children:u(s.SIGN_IN_WITH_PHONE_PAGE.GET_OTP_BUTTON.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.GET_OTP_BUTTON.fallback)})})]}),l.jsx(W.Text,{style:{fontSize:"0.8rem"},children:u(s.SIGN_IN_WITH_PHONE_PAGE.HINT_OTP.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.HINT_OTP.fallback)})]})})]})}),l.jsxs(Se,{classNames:{wrapper:"custom-modal-otp"},title:l.jsxs(J,{vertical:!0,justify:"center",align:"center",style:{width:"100%"},children:[l.jsx("img",{src:M?Pe:te,alt:"ongphra",style:{height:120}}),l.jsx(W.Text,{style:{color:D.PRIMARY,fontSize:16},children:u(s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.CONFIRM_OTP.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.CONFIRM_OTP.fallback)})]}),open:n,onOk:b,onCancel:I,confirmLoading:N,closable:!0,cancelButtonProps:{disabled:N},destroyOnClose:!0,okText:u(s.COMMON.CONFIRM.i18nKey,s.COMMON.CONFIRM.fallback),cancelText:u(s.COMMON.CANCEL.i18nKey,s.COMMON.CANCEL.fallback),okButtonProps:{disabled:t.length!==6},footer:l.jsxs(l.Fragment,{children:[l.jsx(q,{style:{width:"100%",color:M?"#303030":D.WHITE},type:"primary",loading:N,onClick:b,children:u(s.COMMON.CONFIRM.i18nKey,s.COMMON.CONFIRM.fallback)},"submit"),l.jsxs("div",{style:{marginTop:10,display:"flex",justifyContent:"center",alignItems:"center",flexWrap:"wrap"},children:[l.jsx(W.Text,{type:"secondary",children:u(s.SIGN_IN_WITH_PHONE_PAGE.MODA
1L_OTP.NO_MESSAGE.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.NO_MESSAGE.fallback)}),g?l.jsx(q,{type:"ghost",onClick:S,style:{color:D.PRIMARY},children:u(s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.GET_OTP_AGAIN_BUTTON.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.GET_OTP_AGAIN_BUTTON.fallback)}):l.jsx(Z.Countdown,{value:Date.now()+Qe*1e3,format:"ss",valueStyle:{fontSize:14,color:D.PRIMARY,margin:"4px 15px"},prefix:u(s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.GET_NEW_OTP_IN.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.GET_NEW_OTP_IN.fallback),suffix:u(s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.SECOND.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.SECOND.fallback),onFinish:()=>c(!0)})]})]}),centered:!0,className:"custom-header-title-modal",styles:{header:{textAlign:"center"},body:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center"},footer:{marginTop:"3rem"}},children:[l.jsxs(W.Text,{style:{display:"block",fontSize:"0.8rem"},type:"secondary",children:[u(s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.SENT_PHONE_NUMBER.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.SENT_PHONE_NUMBER.fallback)," ",_.phoneFormat]}),l.jsx(W.Text,{style:{fontSize:"0.8rem"},type:"secondary",children:u(s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.REF.i18nKey,s.SIGN_IN_WITH_PHONE_PAGE.MODAL_OTP.REF.fallback)}),l.jsx("div",{style:{margin:"1rem 0"},children:l.jsx(qe,{value:t,onChange:a,numInputs:6,containerStyle:{width:"100%",alignItems:"center",justifyContent:"center",gap:5,flexWrap:"wrap",marginTop:"3rem"},inputStyle:"custom-input-otp-code",shouldAutoFocus:!0,isInputNum:!0})})]})]})}export{ft 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.