import{C as bt,r as C,p as Mt,P as xt,q as Lt,O as _t,t as et,D as xe,s as It,K as lt,N as Tt,R as ne,as as jt,W as Bt,U as Ut,X as qt,V as Kt,at as Ht,au as ut,av as ot,ap as We,Z as $t,G as O,aq as Wt,H as zt,aw as Zt,$ as ze}from"./screen.html-7a5JuVXO.js";import{d as he,j as H}from"./BLLock-n8n7x0Gc.js";const Xt="/assets/mail_code_send-iXU_3k-1.svg";var Yt={root:"p-float-label"},Gt=`
@layer primereact {
    .p-float-label {
        display: block;
        position: relative;
    }
    
    .p-float-label label {
        position: absolute;
        pointer-events: none;
        top: 50%;
        margin-top: -.5rem;
        transition-property: all;
        transition-timing-function: ease;
        line-height: 1;
    }
    
    .p-float-label:has(textarea) label {
        top: 1rem;
    }
    
    .p-float-label:has(input:focus) label,
    .p-float-label:has(input.p-filled) label,
    .p-float-label:has(input:-webkit-autofill) label,
    .p-float-label:has(textarea:focus) label,
    .p-float-label:has(textarea.p-filled) label,
    .p-float-label:has(.p-inputwrapper-focus) label,
    .p-float-label:has(.p-inputwrapper-filled) label {
        top: -.75rem;
        font-size: 12px;
    }
    
    .p-float-label .p-placeholder,
    .p-float-label input::placeholder,
    .p-float-label .p-inputtext::placeholder {
        opacity: 0;
        transition-property: all;
        transition-timing-function: ease;
    }
    
    .p-float-label .p-focus .p-placeholder,
    .p-float-label input:focus::placeholder,
    .p-float-label .p-inputtext:focus::placeholder {
        opacity: 1;
        transition-property: all;
        transition-timing-function: ease;
    }
}`,Le=bt.extend({defaultProps:{__TYPE:"FloatLabel",children:void 0},css:{classes:Yt,styles:Gt}}),Vt=C.memo(C.forwardRef(function(e,n){var t=Mt(),s=C.useContext(xt),i=Le.getProps(e,s),l=C.useRef(n),g=Le.setMetaData({props:i}),v=g.ptm,_=g.cx,x=g.isUnstyled;Lt(Le.css.styles,x,{name:"floatlabel"}),C.useEffect(function(){_t.combinedRefs(l,n)},[l,n]);var N=t({ref:l,className:et(_("root"))},Le.getOtherProps(i),v("root"));return C.createElement("span",N,i.children)}));Vt.displayName="FloatLabel";function Qe(){return Qe=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Qe.apply(this,arguments)}var Jt={root:function(n){var t=n.props,s=n.context;return et("p-inputmask",{"p-filled":t.filled,"p-invalid":t.invalid,"p-variant-filled":t.variant?t.variant==="filled":s&&s.inputStyle==="filled"})}},Ze=bt.extend({defaultProps:{__TYPE:"InputMask",autoClear:!0,autoFocus:!1,className:null,disabled:!1,id:null,mask:null,maxLength:null,invalid:!1,variant:null,name:null,onBlur:null,onChange:null,onComplete:null,onFocus:null,placeholder:null,readOnly:!1,required:!1,size:null,slotChar:"_",style:null,tabIndex:null,tooltip:null,tooltipOptions:null,type:"text",unmask:!1,value:null,children:void 0},css:{classes:Jt}}),wt=C.memo(C.forwardRef(function(e,n){var t=C.useContext(xt),s=Ze.getProps(e,t),i=C.useRef(null),l=C.useRef(null),g=C.useRef(0),v=C.useRef([]),_=C.useRef([]),x=C.useRef(0),N=C.useRef(null),V=C.useRef(!1),te=C.useRef(null),re=C.useRef(null),D=C.useRef(null),T=C.useRef(null),W=C.useRef(null),ae=C.useRef(!1),A={props:s},ie=Ze.setMetaData(A),le=ie.cx,F=function(c,y){var d,m,k,P=i.current;return!P||!P.offsetParent||P!==document.activeElement?null:(typeof c=="number"?(m=c,k=typeof y=="number"?y:m,P.setSelectionRange?P.setSelectionRange(m,k):P.createTextRange&&(d=P.createTextRange(),d.collapse(!0),d.moveEnd("character",k),d.moveStart("character",m),d.select())):P.setSelectionRange?(m=P.selectionStart,k=P.selectionEnd):document.selection&&document.selection.createRange&&(d=document.selection.createRange(),m=0-d.duplicate().moveStart("character",-1e5),k=m+d.text.length),{begin:m,end:k})},fe=function(){for(var c=l.current;c<=g.current;c++)if(v.current[c]&&_.current[c]===Y(c))return!1;return!0},Y=C.useCallback(function(S){return S<s.slotChar.length?s.slotChar.charAt(S):s.slotChar.charAt(0)},[s.slotChar]),ue=function(){return s.unmask?Ve():i.current&&i.current.value},z=function(c){for(;++c<x.current&&!v.current[c];);return c},Z=function(c){for(;--c>=0&&!v.current[c];);return c},pe=function(c,y){var d,m;if(!(c<0)){for(d=c,m=z(y);d<x.current;d++)if(v.current[d]){if(m<x.current&&v.current[d].test(_.current[m]))_.current[d]=_.current[m],_.current[m]=Y(m);else break;m=z(m)}J(),F(Math.max(l.current,c))}},w=function(c){var y,d,m,k;for(y=c,d=Y(c);y<x.current;y++)if(v.current[y])if(m=z(y),k=_.current[y],_.current[y]=d,m<x.current&&v.current[m].test(k))d=k;else break},E=function(c){var y=i.current.value,d=F();if(d){if(N.current.length&&N.current.length>y.length){for(X(!0);d.begin>0&&!v.current[d.begin-1];)d.begin--;if(d.begin===0)for(;d.begin<l.current&&!v.current[d.begin];)d.begin++;F(d.begin,d.begin)}else{for(X(!0);d.begin<x.current&&!v.current[d.begin];)d.begin++;F(d.begin,d.begin)}s.onComplete&&fe()&&s.onComplete({originalEvent:c,value:ue()}),oe(c)}},L=function(c){if(V.current=!1,X(),oe(c),Ee(),s.onBlur&&s.onBlur(c),i.current.value!==te.current){var y=document.createEvent("HTMLEvents");y.initEvent("change",!0,!1),i.current.dispatchEvent(y)}},U=function(c){if(!s.readOnly){var y=c.which||c.keyCode,d,m,k;if(N.current=i.current.value,y===8||y===46||xe.isIOS()&&y===127){if(d=F(),!d)return;m=d.begin,k=d.end,k-m===0&&(m=y!==46?Z(m):k=z(m-1),k=y===46?z(k):k),K(m,k),pe(m,k-1),oe(c),c.preventDefault()}else y===13?(L(c),oe(c)):y===27&&(i.current.value=te.current,F(0,X()),oe(c),c.preventDefault())}},G=function(c){if(!s.readOnly){var y=F();if(y){var d=c.which||c.keyCode,m,k,P,r;if(!(c.ctrlKey||c.altKey||c.metaKey||d<32)){if(d&&d!==13){if(y.end-y.begin!==0&&(K(y.begin,y.end),pe(y.begin,y.end-1)),m=z(y.begin-1),m<x.current&&(k=String.fromCharCode(d),v.current[m].test(k))){if(w(m),_.current[m]=k,J(),P=z(m),xe.isAndroid()){var a=function(){F(P)};setTimeout(a,0)}else F(P);y.begin<=g.current&&(r=fe())}c.preventDefault()}oe(c),s.onComplete&&r&&s.onComplete({originalEvent:c,value:ue()})}}}},K=function(c,y){var d;for(d=c;d<y&&d<x.current;d++)v.current[d]&&(_.current[d]=Y(d))},J=function(){i.current&&(i.current.value=_.current.join(""))},X=function(c){re.current=!0;var y=i.current&&i.current.value,d=-1,m,k,P;for(m=0,P=0;m<x.current;m++)if(v.current[m]){for(_.current[m]=Y(m);P++<y.length;)if(k=y.charAt(P-1),v.current[m].test(k)){_.current[m]=k,d=m;break}if(P>y.length){K(m+1,x.current);break}}else _.current[m]===y.charAt(P)&&P++,m<D.current&&(d=m);return c?J():d+1<D.current?s.autoClear||_.current.join("")===T.current?(i.current&&i.current.value&&(i.current.value=""),K(0,x.current)):J():(J(),i.current&&(i.current.value=i.current.value.substring(0,d+1))),D.current?m:l.current},me=function(c){if(!s.readOnly){V.current=!0,clearTimeout(W.current);var y;i.current?te.current=i.current.value:te.current="",y=X()||0,W.current=setTimeout(function(){i.current===document.activeElement&&(J(),y===s.mask.replace("?","").length?F(0,y):F(y),Ee())},100),s.onFocus&&s.onFocus(c)}},Pe=function(c){ae.current?E(c):De(c)},De=function(c){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!s.readOnly){if(!y){var d=X(!0);F(d)}oe(c),s.onComplete&&fe()&&s.onComplete({originalEvent:c,value:ue()})}},Ve=C.useCallback(function(){for(var S=[],c=0;c<_.current.length;c++){var y=_.current[c];v.current[c]&&y!==Y(c)&&S.push(y)}return S.join("")},[Y]),oe=function(c){if(s.onChange){var y=s.unmask?Ve():c&&c.target.value;s.onChange({originalEvent:c,value:T.current!==y?y:"",stopPropagation:function(){c.stopPropagation()},preventDefault:function(){c.preventDefault()},target:{name:s.name,id:s.id,value:T.current!==y?y:""}})}},Ee=function(){i.current&&i.current.value&&i.current.value.length>0?xe.addClass(i.current,"p-filled"):xe.removeClass(i.current,"p-filled")},be=function(c){var y;return i.current&&(s.value==null?i.current.value="":(i.current.value=s.value,y=X(c),setTimeout(function(){if(i.current)return J(),X(c)},10)),te.current=i.current.value),Ee(),y},Se=C.useCallback(function(){return s.unmask?s.value!==Ve():T.current!==i.current.value&&i.current.value!==s.value},[s.unmask,s.value,Ve]),we=function(){if(s.mask){v.current=[],D.current=s.mask.length,x.current=s.mask.length,l.current=null;var c={9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"};ae.current=xe.isChrome()&&xe.isAndroid();for(var y=s.mask.split(""),d=0;d<y.length;d++){var m=y[d];m==="?"?(x.current--,D.current=d):c[m]?(v.current.push(new RegExp(c[m])),l.current===null&&(l.current=v.current.length-1),d<D.current&&(g.current=v.current.length-1)):v.current.push(null)}_.current=[];for(var k=0;k<y.length;k++){var P=y[k];P!=="?"&&(c[P]?_.current.push(Y(k)):_.current.push(P))}T.current=_.current.join("")}};C.useImperativeHandle(n,function(){return{props:s,focus:function(){return xe.focus(i.current)},getElement:function(){return i.current}}}),C.useEffect(function(){_t.combinedRefs(i,n)},[i,n]),It(function(){we(),be()}),lt(function(){we(),F(be(!0)),s.unmask&&oe()},[s.mask]),lt(function(){Se()&&be()},[Se]);var Me=Ze.getOtherProps(s),Ke=et(s.className,le("root",{context:t}));return C.createElement(Tt,Qe({ref:i,autoFocus:s.autoFocus,id:s.id,type:s.type,name:s.name,style:s.style,className:Ke},Me,{placeholder:s.placeholder,size:s.size,maxLength:s.maxLength,tabIndex:s.tabIndex,disabled:s.disabled,readOnly:s.readOnly,onFocus:me,onBlur:L,onKeyDown:U,onKeyPress:G,onInput:Pe,onPaste:function(c){return De(c,!0)},required:s.required,tooltip:s.tooltip,tooltipOptions:s.tooltipOptions,pt:s.pt,unstyled:s.unstyled,__parentMetadata:{parent:A}}))}));wt.displayName="InputMask";var Ne=e=>e.type==="checkbox",ke=e=>e instanceof Date,$=e=>e==null;const At=e=>typeof e=="object";var B=e=>!$(e)&&!Array.isArray(e)&&At(e)&&!ke(e),Qt=e=>B(e)&&e.target?Ne(e.target)?e.target.checked:e.target.value:e,er=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,tr=(e,n)=>e.has(er(n)),rr=e=>{const n=e.constructor&&e.constructor.prototype;return B(n)&&n.hasOwnProperty("isPrototypeOf")},tt=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function se(e){let n;const t=Array.isArray(e);if(e instanceof Date)n=new Date(e);else if(e instanceof Set)n=new Set(e);else if(!(tt&&(e instanceof Blob||e instanceof FileList))&&(t||B(e)))if(n=t?[]:{},!t&&!rr(e))n=e;else for(const s in e)e.hasOwnProperty(s)&&(n[s]=se(e[s]));else return e;return n}var Oe=e=>Array.isArray(e)?e.filter(Boolean):[],I=e=>e===void 0,p=(e,n,t)=>{if(!n||!B(e))return t;const s=Oe(n.split(/[,[\].]+?/)).reduce((i,l)=>$(i)?i:i[l],e);return I(s)||s===e?I(e[n])?t:e[n]:s},ye=e=>typeof e=="boolean";const ct={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ce={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ve={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};ne.createContext(null);var sr=(e,n,t,s=!0)=>{const i={defaultValues:n._defaultValues};for(const l in e)Object.defineProperty(i,l,{get:()=>{const g=l;return n._proxyFormState[g]!==ce.all&&(n._proxyFormState[g]=!s||ce.all),t&&(t[g]=!0),e[g]}});return i},ee=e=>B(e)&&!Object.keys(e).length,nr=(e,n,t,s)=>{t(e);const{name:i,...l}=e;return ee(l)||Object.keys(l).length>=Object.keys(n).length||Object.keys(l).find(g=>n[g]===(!s||ce.all))},Xe=e=>Array.isArray(e)?e:[e];function ar(e){const n=ne.useRef(e);n.current=e,ne.useEffect(()=>{const t=!e.disabled&&n.current.subject&&n.current.subject.subscribe({next:n.current.next});return()=>{t&&t.unsubscribe()}},[e.disabled])}var de=e=>typeof e=="string",ir=(e,n,t,s,i)=>de(e)?(s&&n.watch.add(e),p(t,e,i)):Array.isArray(e)?e.map(l=>(s&&n.watch.add(l),p(t,l))):(s&&(n.watchAll=!0),t),rt=e=>/^\w*$/.test(e),Ft=e=>Oe(e.replace(/["|']|\]/g,"").split(/\.|\[/)),M=(e,n,t)=>{let s=-1;const i=rt(n)?[n]:Ft(n),l=i.length,g=l-1;for(;++s<l;){const v=i[s];let _=t;if(s!==g){const x=e[v];_=B(x)||Array.isArray(x)?x:isNaN(+i[s+1])?{}:[]}e[v]=_,e=e[v]}return e},lr=(e,n,t,s,i)=>n?{...t[e],types:{...t[e]&&t[e].types?t[e].types:{},[s]:i||!0}}:{},ft=e=>({isOnSubmit:!e||e===ce.onSubmit,isOnBlur:e===ce.onBlur,isOnChange:e===ce.onChange,isOnAll:e===ce.all,isOnTouch:e===ce.onTouched}),dt=(e,n,t)=>!t&&(n.watchAll||n.watch.has(e)||[...n.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const Re=(e,n,t,s)=>{for(const i of t||Object.keys(e)){const l=p(e,i);if(l){const{_f:g,...v}=l;if(g){if(g.refs&&g.refs[0]&&n(g.refs[0],i)&&!s)break;if(g.ref&&n(g.ref,g.name)&&!s)break;Re(v,n)}else B(v)&&Re(v,n)}}};var ur=(e,n,t)=>{const s=Oe(p(e,t));return M(s,"root",n[t]),M(e,t,s),e},st=e=>e.type==="file",ge=e=>typeof e=="function",je=e=>{if(!tt)return!1;const n=e?e.ownerDocument:0;return e instanceof(n&&n.defaultView?n.defaultView.HTMLElement:HTMLElement)},Te=e=>de(e),nt=e=>e.type==="radio",Be=e=>e instanceof RegExp;const vt={value:!1,isValid:!1},yt={value:!0,isValid:!0};var kt=e=>{if(Array.isArray(e)){if(e.length>1){const n=e.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:n,isValid:!!n.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!I(e[0].attributes.value)?I(e[0].value)||e[0].value===""?yt:{value:e[0].value,isValid:!0}:yt:vt}return vt};const ht={isValid:!1,value:null};var Dt=e=>Array.isArray(e)?e.reduce((n,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:n,ht):ht;function gt(e,n,t="validate"){if(Te(e)||Array.isArray(e)&&e.every(Te)||ye(e)&&!e)return{type:t,message:Te(e)?e:"",ref:n}}var Fe=e=>B(e)&&!Be(e)?e:{value:e,message:""},pt=async(e,n,t,s,i)=>{const{ref:l,refs:g,required:v,maxLength:_,minLength:x,min:N,max:V,pattern:te,validate:re,name:D,valueAsNumber:T,mount:W,disabled:ae}=e._f,A=p(n,D);if(!W||ae)return{};const ie=g?g[0]:l,le=w=>{s&&ie.reportValidity&&(ie.setCustomValidity(ye(w)?"":w||""),ie.reportValidity())},F={},fe=nt(l),Y=Ne(l),ue=fe||Y,z=(T||st(l))&&I(l.value)&&I(A)||je(l)&&l.value===""||A===""||Array.isArray(A)&&!A.length,Z=lr.bind(null,D,t,F),pe=(w,E,L,U=ve.maxLength,G=ve.minLength)=>{const K=w?E:L;F[D]={type:w?U:G,message:K,ref:l,...Z(w?U:G,K)}};if(i?!Array.isArray(A)||!A.length:v&&(!ue&&(z||$(A))||ye(A)&&!A||Y&&!kt(g).isValid||fe&&!Dt(g).isValid)){const{value:w,message:E}=Te(v)?{value:!!v,message:v}:Fe(v);if(w&&(F[D]={type:ve.required,message:E,ref:ie,...Z(ve.required,E)},!t))return le(E),F}if(!z&&(!$(N)||!$(V))){let w,E;const L=Fe(V),U=Fe(N);if(!$(A)&&!isNaN(A)){const G=l.valueAsNumber||A&&+A;$(L.value)||(w=G>L.value),$(U.value)||(E=G<U.value)}else{const G=l.valueAsDate||new Date(A),K=me=>new Date(new Date().toDateString()+" "+me),J=l.type=="time",X=l.type=="week";de(L.value)&&A&&(w=J?K(A)>K(L.value):X?A>L.value:G>new Date(L.value)),de(U.value)&&A&&(E=J?K(A)<K(U.value):X?A<U.value:G<new Date(U.value))}if((w||E)&&(pe(!!w,L.message,U.message,ve.max,ve.min),!t))return le(F[D].message),F}if((_||x)&&!z&&(de(A)||i&&Array.isArray(A))){const w=Fe(_),E=Fe(x),L=!$(w.value)&&A.length>+w.value,U=!$(E.value)&&A.length<+E.value;if((L||U)&&(pe(L,w.message,E.message),!t))return le(F[D].message),F}if(te&&!z&&de(A)){const{value:w,message:E}=Fe(te);if(Be(w)&&!A.match(w)&&(F[D]={type:ve.pattern,message:E,ref:l,...Z(ve.pattern,E)},!t))return le(E),F}if(re){if(ge(re)){const w=await re(A,n),E=gt(w,ie);if(E&&(F[D]={...E,...Z(ve.validate,E.message)},!t))return le(E.message),F}else if(B(re)){let w={};for(const E in re){if(!ee(w)&&!t)break;const L=gt(await re[E](A,n),ie,E);L&&(w={...L,...Z(E,L.message)},le(L.message),t&&(F[D]=w))}if(!ee(w)&&(F[D]={ref:ie,...w},!t))return F}}return le(!0),F};function or(e,n){const t=n.slice(0,-1).length;let s=0;for(;s<t;)e=I(e)?s++:e[n[s++]];return e}function cr(e){for(const n in e)if(e.hasOwnProperty(n)&&!I(e[n]))return!1;return!0}function j(e,n){const t=Array.isArray(n)?n:rt(n)?[n]:Ft(n),s=t.length===1?e:or(e,t),i=t.length-1,l=t[i];return s&&delete s[l],i!==0&&(B(s)&&ee(s)||Array.isArray(s)&&cr(s))&&j(e,t.slice(0,-1)),e}var Ye=()=>{let e=[];return{get observers(){return e},next:i=>{for(const l of e)l.next&&l.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(l=>l!==i)}}),unsubscribe:()=>{e=[]}}},Ue=e=>$(e)||!At(e);function _e(e,n){if(Ue(e)||Ue(n))return e===n;if(ke(e)&&ke(n))return e.getTime()===n.getTime();const t=Object.keys(e),s=Object.keys(n);if(t.length!==s.length)return!1;for(const i of t){const l=e[i];if(!s.includes(i))return!1;if(i!=="ref"){const g=n[i];if(ke(l)&&ke(g)||B(l)&&B(g)||Array.isArray(l)&&Array.isArray(g)?!_e(l,g):l!==g)return!1}}return!0}var Et=e=>e.type==="select-multiple",fr=e=>nt(e)||Ne(e),Ge=e=>je(e)&&e.isConnected,St=e=>{for(const n in e)if(ge(e[n]))return!0;return!1};function qe(e,n={}){const t=Array.isArray(e);if(B(e)||t)for(const s in e)Array.isArray(e[s])||B(e[s])&&!St(e[s])?(n[s]=Array.isArray(e[s])?[]:{},qe(e[s],n[s])):$(e[s])||(n[s]=!0);return n}function Ct(e,n,t){const s=Array.isArray(e);if(B(e)||s)for(const i in e)Array.isArray(e[i])||B(e[i])&&!St(e[i])?I(n)||Ue(t[i])?t[i]=Array.isArray(e[i])?qe(e[i],[]):{...qe(e[i])}:Ct(e[i],$(n)?{}:n[i],t[i]):t[i]=!_e(e[i],n[i]);return t}var Ie=(e,n)=>Ct(e,n,qe(n)),Rt=(e,{valueAsNumber:n,valueAsDate:t,setValueAs:s})=>I(e)?e:n?e===""?NaN:e&&+e:t&&de(e)?new Date(e):s?s(e):e;function Je(e){const n=e.ref;if(!(e.refs?e.refs.every(t=>t.disabled):n.disabled))return st(n)?n.files:nt(n)?Dt(e.refs).value:Et(n)?[...n.selectedOptions].map(({value:t})=>t):Ne(n)?kt(e.refs).value:Rt(I(n.value)?e.ref.value:n.value,e)}var dr=(e,n,t,s)=>{const i={};for(const l of e){const g=p(n,l);g&&M(i,l,g._f)}return{criteriaMode:t,names:[...e],fields:i,shouldUseNativeValidation:s}},Ce=e=>I(e)?e:Be(e)?e.source:B(e)?Be(e.value)?e.value.source:e.value:e,vr=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function mt(e,n,t){const s=p(e,t);if(s||rt(t))return{error:s,name:t};const i=t.split(".");for(;i.length;){const l=i.join("."),g=p(n,l),v=p(e,l);if(g&&!Array.isArray(g)&&t!==l)return{name:t};if(v&&v.type)return{name:l,error:v};i.pop()}return{name:t}}var yr=(e,n,t,s,i)=>i.isOnAll?!1:!t&&i.isOnTouch?!(n||e):(t?s.isOnBlur:i.isOnBlur)?!e:(t?s.isOnChange:i.isOnChange)?e:!0,hr=(e,n)=>!Oe(p(e,n)).length&&j(e,n);const gr={mode:ce.onSubmit,reValidateMode:ce.onChange,shouldFocusError:!0};function pr(e={}){let n={...gr,...e},t={submitCount:0,isDirty:!1,isLoading:ge(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:n.errors||{},disabled:n.disabled||!1},s={},i=B(n.defaultValues)||B(n.values)?se(n.defaultValues||n.values)||{}:{},l=n.shouldUnregister?{}:se(i),g={action:!1,mount:!1,watch:!1},v={mount:new Set,unMount:new Set,array:new Set,watch:new Set},_,x=0;const N={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},V={values:Ye(),array:Ye(),state:Ye()},te=ft(n.mode),re=ft(n.reValidateMode),D=n.criteriaMode===ce.all,T=r=>a=>{clearTimeout(x),x=setTimeout(r,a)},W=async r=>{if(N.isValid||r){const a=n.resolver?ee((await ue()).errors):await Z(s,!0);a!==t.isValid&&V.state.next({isValid:a})}},ae=(r,a)=>{(N.isValidating||N.validatingFields)&&((r||Array.from(v.mount)).forEach(u=>{u&&(a?M(t.validatingFields,u,a):j(t.validatingFields,u))}),V.state.next({validatingFields:t.validatingFields,isValidating:!ee(t.validatingFields)}))},A=(r,a=[],u,h,f=!0,o=!0)=>{if(h&&u){if(g.action=!0,o&&Array.isArray(p(s,r))){const b=u(p(s,r),h.argA,h.argB);f&&M(s,r,b)}if(o&&Array.isArray(p(t.errors,r))){const b=u(p(t.errors,r),h.argA,h.argB);f&&M(t.errors,r,b),hr(t.errors,r)}if(N.touchedFields&&o&&Array.isArray(p(t.touchedFields,r))){const b=u(p(t.touchedFields,r),h.argA,h.argB);f&&M(t.touchedFields,r,b)}N.dirtyFields&&(t.dirtyFields=Ie(i,l)),V.state.next({name:r,isDirty:w(r,a),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else M(l,r,a)},ie=(r,a)=>{M(t.errors,r,a),V.state.next({errors:t.errors})},le=r=>{t.errors=r,V.state.next({errors:t.errors,isValid:!1})},F=(r,a,u,h)=>{const f=p(s,r);if(f){const o=p(l,r,I(u)?p(i,r):u);I(o)||h&&h.defaultChecked||a?M(l,r,a?o:Je(f._f)):U(r,o),g.mount&&W()}},fe=(r,a,u,h,f)=>{let o=!1,b=!1;const R={name:r},q=!!(p(s,r)&&p(s,r)._f.disabled);if(!u||h){N.isDirty&&(b=t.isDirty,t.isDirty=R.isDirty=w(),o=b!==R.isDirty);const Q=q||_e(p(i,r),a);b=!!(!q&&p(t.dirtyFields,r)),Q||q?j(t.dirtyFields,r):M(t.dirtyFields,r,!0),R.dirtyFields=t.dirtyFields,o=o||N.dirtyFields&&b!==!Q}if(u){const Q=p(t.touchedFields,r);Q||(M(t.touchedFields,r,u),R.touchedFields=t.touchedFields,o=o||N.touchedFields&&Q!==u)}return o&&f&&V.state.next(R),o?R:{}},Y=(r,a,u,h)=>{const f=p(t.errors,r),o=N.isValid&&ye(a)&&t.isValid!==a;if(e.delayError&&u?(_=T(()=>ie(r,u)),_(e.delayError)):(clearTimeout(x),_=null,u?M(t.errors,r,u):j(t.errors,r)),(u?!_e(f,u):f)||!ee(h)||o){const b={...h,...o&&ye(a)?{isValid:a}:{},errors:t.errors,name:r};t={...t,...b},V.state.next(b)}},ue=async r=>{ae(r,!0);const a=await n.resolver(l,n.context,dr(r||v.mount,s,n.criteriaMode,n.shouldUseNativeValidation));return ae(r),a},z=async r=>{const{errors:a}=await ue(r);if(r)for(const u of r){const h=p(a,u);h?M(t.errors,u,h):j(t.errors,u)}else t.errors=a;return a},Z=async(r,a,u={valid:!0})=>{for(const h in r){const f=r[h];if(f){const{_f:o,...b}=f;if(o){const R=v.array.has(o.name);ae([h],!0);const q=await pt(f,l,D,n.shouldUseNativeValidation&&!a,R);if(ae([h]),q[o.name]&&(u.valid=!1,a))break;!a&&(p(q,o.name)?R?ur(t.errors,q,o.name):M(t.errors,o.name,q[o.name]):j(t.errors,o.name))}b&&await Z(b,a,u)}}return u.valid},pe=()=>{for(const r of v.unMount){const a=p(s,r);a&&(a._f.refs?a._f.refs.every(u=>!Ge(u)):!Ge(a._f.ref))&&be(r)}v.unMount=new Set},w=(r,a)=>(r&&a&&M(l,r,a),!_e(Pe(),i)),E=(r,a,u)=>ir(r,v,{...g.mount?l:I(a)?i:de(r)?{[r]:a}:a},u,a),L=r=>Oe(p(g.mount?l:i,r,e.shouldUnregister?p(i,r,[]):[])),U=(r,a,u={})=>{const h=p(s,r);let f=a;if(h){const o=h._f;o&&(!o.disabled&&M(l,r,Rt(a,o)),f=je(o.ref)&&$(a)?"":a,Et(o.ref)?[...o.ref.options].forEach(b=>b.selected=f.includes(b.value)):o.refs?Ne(o.ref)?o.refs.length>1?o.refs.forEach(b=>(!b.defaultChecked||!b.disabled)&&(b.checked=Array.isArray(f)?!!f.find(R=>R===b.value):f===b.value)):o.refs[0]&&(o.refs[0].checked=!!f):o.refs.forEach(b=>b.checked=b.value===f):st(o.ref)?o.ref.value="":(o.ref.value=f,o.ref.type||V.values.next({name:r,values:{...l}})))}(u.shouldDirty||u.shouldTouch)&&fe(r,f,u.shouldTouch,u.shouldDirty,!0),u.shouldValidate&&me(r)},G=(r,a,u)=>{for(const h in a){const f=a[h],o=`${r}.${h}`,b=p(s,o);(v.array.has(r)||!Ue(f)||b&&!b._f)&&!ke(f)?G(o,f,u):U(o,f,u)}},K=(r,a,u={})=>{const h=p(s,r),f=v.array.has(r),o=se(a);M(l,r,o),f?(V.array.next({name:r,values:{...l}}),(N.isDirty||N.dirtyFields)&&u.shouldDirty&&V.state.next({name:r,dirtyFields:Ie(i,l),isDirty:w(r,o)})):h&&!h._f&&!$(o)?G(r,o,u):U(r,o,u),dt(r,v)&&V.state.next({...t}),V.values.next({name:g.mount?r:void 0,values:{...l}})},J=async r=>{g.mount=!0;const a=r.target;let u=a.name,h=!0;const f=p(s,u),o=()=>a.type?Je(f._f):Qt(r),b=R=>{h=Number.isNaN(R)||R===p(l,u,R)};if(f){let R,q;const Q=o(),Ae=r.type===ct.BLUR||r.type===ct.FOCUS_OUT,Nt=!vr(f._f)&&!n.resolver&&!p(t.errors,u)&&!f._f.deps||yr(Ae,p(t.touchedFields,u),t.isSubmitted,re,te),He=dt(u,v,Ae);M(l,u,Q),Ae?(f._f.onBlur&&f._f.onBlur(r),_&&_(0)):f._f.onChange&&f._f.onChange(r);const $e=fe(u,Q,Ae,!1),Ot=!ee($e)||He;if(!Ae&&V.values.next({name:u,type:r.type,values:{...l}}),Nt)return N.isValid&&W(),Ot&&V.state.next({name:u,...He?{}:$e});if(!Ae&&He&&V.state.next({...t}),n.resolver){const{errors:at}=await ue([u]);if(b(Q),h){const Pt=mt(t.errors,s,u),it=mt(at,s,Pt.name||u);R=it.error,u=it.name,q=ee(at)}}else ae([u],!0),R=(await pt(f,l,D,n.shouldUseNativeValidation))[u],ae([u]),b(Q),h&&(R?q=!1:N.isValid&&(q=await Z(s,!0)));h&&(f._f.deps&&me(f._f.deps),Y(u,q,R,$e))}},X=(r,a)=>{if(p(t.errors,a)&&r.focus)return r.focus(),1},me=async(r,a={})=>{let u,h;const f=Xe(r);if(n.resolver){const o=await z(I(r)?r:f);u=ee(o),h=r?!f.some(b=>p(o,b)):u}else r?(h=(await Promise.all(f.map(async o=>{const b=p(s,o);return await Z(b&&b._f?{[o]:b}:b)}))).every(Boolean),!(!h&&!t.isValid)&&W()):h=u=await Z(s);return V.state.next({...!de(r)||N.isValid&&u!==t.isValid?{}:{name:r},...n.resolver||!r?{isValid:u}:{},errors:t.errors}),a.shouldFocus&&!h&&Re(s,X,r?f:v.mount),h},Pe=r=>{const a={...g.mount?l:i};return I(r)?a:de(r)?p(a,r):r.map(u=>p(a,u))},De=(r,a)=>({invalid:!!p((a||t).errors,r),isDirty:!!p((a||t).dirtyFields,r),isTouched:!!p((a||t).touchedFields,r),isValidating:!!p((a||t).validatingFields,r),error:p((a||t).errors,r)}),Ve=r=>{r&&Xe(r).forEach(a=>j(t.errors,a)),V.state.next({errors:r?t.errors:{}})},oe=(r,a,u)=>{const h=(p(s,r,{_f:{}})._f||{}).ref;M(t.errors,r,{...a,ref:h}),V.state.next({name:r,errors:t.errors,isValid:!1}),u&&u.shouldFocus&&h&&h.focus&&h.focus()},Ee=(r,a)=>ge(r)?V.values.subscribe({next:u=>r(E(void 0,a),u)}):E(r,a,!0),be=(r,a={})=>{for(const u of r?Xe(r):v.mount)v.mount.delete(u),v.array.delete(u),a.keepValue||(j(s,u),j(l,u)),!a.keepError&&j(t.errors,u),!a.keepDirty&&j(t.dirtyFields,u),!a.keepTouched&&j(t.touchedFields,u),!a.keepIsValidating&&j(t.validatingFields,u),!n.shouldUnregister&&!a.keepDefaultValue&&j(i,u);V.values.next({values:{...l}}),V.state.next({...t,...a.keepDirty?{isDirty:w()}:{}}),!a.keepIsValid&&W()},Se=({disabled:r,name:a,field:u,fields:h,value:f})=>{if(ye(r)){const o=r?void 0:I(f)?Je(u?u._f:p(h,a)._f):f;M(l,a,o),fe(a,o,!1,!1,!0)}},we=(r,a={})=>{let u=p(s,r);const h=ye(a.disabled);return M(s,r,{...u||{},_f:{...u&&u._f?u._f:{ref:{name:r}},name:r,mount:!0,...a}}),v.mount.add(r),u?Se({field:u,disabled:a.disabled,name:r,value:a.value}):F(r,!0,a.value),{...h?{disabled:a.disabled}:{},...n.progressive?{required:!!a.required,min:Ce(a.min),max:Ce(a.max),minLength:Ce(a.minLength),maxLength:Ce(a.maxLength),pattern:Ce(a.pattern)}:{},name:r,onChange:J,onBlur:J,ref:f=>{if(f){we(r,a),u=p(s,r);const o=I(f.value)&&f.querySelectorAll&&f.querySelectorAll("input,select,textarea")[0]||f,b=fr(o),R=u._f.refs||[];if(b?R.find(q=>q===o):o===u._f.ref)return;M(s,r,{_f:{...u._f,...b?{refs:[...R.filter(Ge),o,...Array.isArray(p(i,r))?[{}]:[]],ref:{type:o.type,name:r}}:{ref:o}}}),F(r,!1,void 0,o)}else u=p(s,r,{}),u._f&&(u._f.mount=!1),(n.shouldUnregister||a.shouldUnregister)&&!(tr(v.array,r)&&g.action)&&v.unMount.add(r)}}},Me=()=>n.shouldFocusError&&Re(s,X,v.mount),Ke=r=>{ye(r)&&(V.state.next({disabled:r}),Re(s,(a,u)=>{let h=r;const f=p(s,u);f&&ye(f._f.disabled)&&(h||(h=f._f.disabled)),a.disabled=h},0,!1))},S=(r,a)=>async u=>{let h;u&&(u.preventDefault&&u.preventDefault(),u.persist&&u.persist());let f=se(l);if(V.state.next({isSubmitting:!0}),n.resolver){const{errors:o,values:b}=await ue();t.errors=o,f=b}else await Z(s);if(j(t.errors,"root"),ee(t.errors)){V.state.next({errors:{}});try{await r(f,u)}catch(o){h=o}}else a&&await a({...t.errors},u),Me(),setTimeout(Me);if(V.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ee(t.errors)&&!h,submitCount:t.submitCount+1,errors:t.errors}),h)throw h},c=(r,a={})=>{p(s,r)&&(I(a.defaultValue)?K(r,se(p(i,r))):(K(r,a.defaultValue),M(i,r,se(a.defaultValue))),a.keepTouched||j(t.touchedFields,r),a.keepDirty||(j(t.dirtyFields,r),t.isDirty=a.defaultValue?w(r,se(p(i,r))):w()),a.keepError||(j(t.errors,r),N.isValid&&W()),V.state.next({...t}))},y=(r,a={})=>{const u=r?se(r):i,h=se(u),f=ee(r),o=f?i:h;if(a.keepDefaultValues||(i=u),!a.keepValues){if(a.keepDirtyValues)for(const b of v.mount)p(t.dirtyFields,b)?M(o,b,p(l,b)):K(b,p(o,b));else{if(tt&&I(r))for(const b of v.mount){const R=p(s,b);if(R&&R._f){const q=Array.isArray(R._f.refs)?R._f.refs[0]:R._f.ref;if(je(q)){const Q=q.closest("form");if(Q){Q.reset();break}}}}s={}}l=e.shouldUnregister?a.keepDefaultValues?se(i):{}:se(o),V.array.next({values:{...o}}),V.values.next({values:{...o}})}v={mount:a.keepDirtyValues?v.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},g.mount=!N.isValid||!!a.keepIsValid||!!a.keepDirtyValues,g.watch=!!e.shouldUnregister,V.state.next({submitCount:a.keepSubmitCount?t.submitCount:0,isDirty:f?!1:a.keepDirty?t.isDirty:!!(a.keepDefaultValues&&!_e(r,i)),isSubmitted:a.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:f?[]:a.keepDirtyValues?a.keepDefaultValues&&l?Ie(i,l):t.dirtyFields:a.keepDefaultValues&&r?Ie(i,r):{},touchedFields:a.keepTouched?t.touchedFields:{},errors:a.keepErrors?t.errors:{},isSubmitSuccessful:a.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1})},d=(r,a)=>y(ge(r)?r(l):r,a);return{control:{register:we,unregister:be,getFieldState:De,handleSubmit:S,setError:oe,_executeSchema:ue,_getWatch:E,_getDirty:w,_updateValid:W,_removeUnmounted:pe,_updateFieldArray:A,_updateDisabledField:Se,_getFieldArray:L,_reset:y,_resetDefaultValues:()=>ge(n.defaultValues)&&n.defaultValues().then(r=>{d(r,n.resetOptions),V.state.next({isLoading:!1})}),_updateFormState:r=>{t={...t,...r}},_disableForm:Ke,_subjects:V,_proxyFormState:N,_setErrors:le,get _fields(){return s},get _formValues(){return l},get _state(){return g},set _state(r){g=r},get _defaultValues(){return i},get _names(){return v},set _names(r){v=r},get _formState(){return t},set _formState(r){t=r},get _options(){return n},set _options(r){n={...n,...r}}},trigger:me,register:we,handleSubmit:S,watch:Ee,setValue:K,getValues:Pe,reset:d,resetField:c,clearErrors:Ve,unregister:be,setError:oe,setFocus:(r,a={})=>{const u=p(s,r),h=u&&u._f;if(h){const f=h.refs?h.refs[0]:h.ref;f.focus&&(f.focus(),a.shouldSelect&&f.select())}},getFieldState:De}}function mr(e={}){const n=ne.useRef(),t=ne.useRef(),[s,i]=ne.useState({isDirty:!1,isValidating:!1,isLoading:ge(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ge(e.defaultValues)?void 0:e.defaultValues});n.current||(n.current={...pr(e),formState:s});const l=n.current.control;return l._options=e,ar({subject:l._subjects.state,next:g=>{nr(g,l._proxyFormState,l._updateFormState,!0)&&i({...l._formState})}}),ne.useEffect(()=>l._disableForm(e.disabled),[l,e.disabled]),ne.useEffect(()=>{if(l._proxyFormState.isDirty){const g=l._getDirty();g!==s.isDirty&&l._subjects.state.next({isDirty:g})}},[l,s.isDirty]),ne.useEffect(()=>{e.values&&!_e(e.values,t.current)?(l._reset(e.values,l._options.resetOptions),t.current=e.values,i(g=>({...g}))):l._resetDefaultValues()},[e.values,l]),ne.useEffect(()=>{e.errors&&l._setErrors(e.errors)},[e.errors,l]),ne.useEffect(()=>{l._state.mount||(l._updateValid(),l._state.mount=!0),l._state.watch&&(l._state.watch=!1,l._subjects.state.next({...l._formState})),l._removeUnmounted()}),ne.useEffect(()=>{e.shouldUnregister&&l._subjects.values.next({values:l._getWatch()})},[e.shouldUnregister,l]),n.current.formState=sr(s,l),n.current}function br({identity:e,old_otp_codes:n,device_id:t}){const[s,i]=Bt(!1),{toaster:l}=Ut(),g=qt(),v=Kt(),_=mr({defaultValues:{otp:"",email:e.email}}),x=C.useMemo(()=>n.find(D=>D.type==="email_verification"&&he.unix(D.send_at).add(5,"minutes").isAfter(he())),[n]),[N,V]=C.useState(0);Ht(()=>{he().isAfter(he.unix((x==null?void 0:x.send_at)??0).add(5,"minutes"))?g(We.actions.clearOtps("email_verification")):V(he.unix((x==null?void 0:x.send_at)??0).add(5,"minutes").diff(he(),"seconds"))},1e3,x!==void 0);const te=C.useCallback(()=>{_.setValue("otp",""),ut.post(ot.email.validate,{email:e.email,device_id:t},void 0,i).then(D=>{var T;if(D.status===!0)(T=l.current)==null||T.show({severity:"info",summary:H("util.success"),detail:D.message,life:5e3}),g(We.actions.addOtp({type:"email_verification",send_at:he().unix()}));else throw new Error(H("util.error"))}).catch(D=>{var T;(T=l.current)==null||T.show({severity:"error",summary:H("util.error"),detail:D.message})})},[]),re=_.handleSubmit(D=>{if(!D.email){v("/mail/change");return}ut.post(ot.email.check,{email:D.email,otp:D.otp.replaceAll("-","").replaceAll("_",""),device_id:t},void 0,i).then(T=>{if(T.status!==!0)throw new Error(H("util.error"));g(We.actions.clearOtps("email_verification")),g($t.actions.updateIdentity({email_verified_at:he().unix().toString()})),v("/")}).catch(T=>{var W;(W=l.current)==null||W.show({severity:"error",summary:H("util.error"),detail:T.message})})});return e.email_verified_at===null&&O.jsx(O.Fragment,{children:O.jsx(Wt,{animateIn:"slideInLeft",animateOut:"fadeOut",animateOnce:!0,delay:5,children:O.jsx("div",{className:"row",children:O.jsx("div",{className:"col-12",children:O.jsx(zt,{header:H("mail.validate.panel.header"),children:O.jsx(Zt,{loading:s,children:O.jsx("form",{onSubmit:re,children:O.jsxs("div",{className:"row mx-auto w-full gap-3 text-center",children:[O.jsx("div",{className:"col-12 inline-flex items-center justify-center",children:O.jsx("img",{src:Xt,className:"aspect-square max-h-[320px]"})}),!x&&O.jsxs("div",{className:"col-12 flex flex-col gap-1",children:[O.jsx("p",{className:"text-2xl font-bold",children:H("mail.validate.panel.title.send_code")}),O.jsx("span",{className:"text-base",children:H("mail.validate.panel.title.send_code_desc")})]}),x&&O.jsxs("div",{className:"col-12 flex flex-col gap-1",children:[O.jsx("p",{className:"text-2xl font-bold",children:H("mail.validate.panel.title.check_your_mail")}),O.jsx("span",{className:"text-base",children:H("mail.validate.panel.title.check_your_mail_desc")})]}),O.jsx("div",{className:"col-12",children:O.jsxs("div",{className:`mx-auto flex w-fit flex-row items-center gap-6 rounded-lg border-2 border-gray-200 p-1 px-2 text-xs transition-transform dark:border-slate-500 ${x?"scale-100":"scale-110"}`,children:[O.jsx("span",{className:"text-base",children:e.email}),O.jsx(ze,{type:"button",className:"p-1 text-xs",outlined:!0,label:H("mail.validate.form.chage_mail"),size:"small",severity:"info",onClick:()=>v("/mail/change")})]})}),x&&O.jsxs(Vt,{children:[O.jsx(wt,{..._.register("otp",{required:!0}),mask:"9-9-9-9-9-9",className:"p-inputtext-lg w-full text-center font-semibold",invalid:_.formState.errors.otp!==void 0}),O.jsx("label",{children:H("util.otp_code")})]}),O.jsxs("div",{className:"col-12",children:[x&&_.getValues("otp").replaceAll("-","").replaceAll("_","").length>1&&O.jsx(ze,{type:"submit",label:H("util.validate"),className:"my-2 w-full transition-all"}),O.jsx(ze,{type:"button",label:x?H("util.send_again_after",{duration:N}):H("util.send_code"),disabled:x!==void 0,severity:x?"secondary":"help",className:"w-full",onClick:te})]})]})})})})})})})})}const xr=e=>({identity:e.mainStorage.identity,old_otp_codes:e.clientStorage.otps,device_id:e.mainStorage.device_id}),wr=jt(xr)(br);export{wr as default};
