"use strict";(self.webpackChunkForest_Rangers_System=self.webpackChunkForest_Rangers_System||[]).push([[9325],{69325:function(e,r,n){n.r(r),n.d(r,{default:function(){return D}});var t=n(17592),o=n(70178),c=n(61113),i=n(57829),a=n(90891),d=n(98721),s=n(22227),u=n(1413),l=n(15861),f=n(64687),h=n.n(f),m=n(3463),x=n(58908),p=n(97890),v=n(47313),g=n(75627),Z=n(1432),j=n(35898),y=n(49914),b=n(15480),q=n(32703),C=n(76025),S=n(72473),k=n(46417);function _(){var e=(0,p.s0)(),r=(0,x.Ds)().enqueueSnackbar,n=m.Ry().shape({code1:m.Z_().required("Code is required"),code2:m.Z_().required("Code is required"),code3:m.Z_().required("Code is required"),code4:m.Z_().required("Code is required"),code5:m.Z_().required("Code is required"),code6:m.Z_().required("Code is required")}),t=(0,g.cI)({mode:"all",resolver:(0,Z.X)(n),defaultValues:{code1:"",code2:"",code3:"",code4:"",code5:"",code6:""}}),o=t.watch,c=t.control,i=t.setValue,a=t.handleSubmit,d=t.formState,s=d.isSubmitting,f=d.errors,_=o();(0,v.useEffect)((function(){var e=document.querySelector("input.field-code");return null===e||void 0===e||e.addEventListener("paste",w),function(){null===e||void 0===e||e.removeEventListener("paste",w)}}),[]);var w=function(e){var r=e.clipboardData.getData("text");r=r.split(""),[].forEach.call(document.querySelectorAll(".field-code"),(function(e,n){e.value=r[n];var t="code".concat(n+1);i(t,r[n])})),e.preventDefault()},D=function(){var n=(0,l.Z)(h().mark((function n(t){return h().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,new Promise((function(e){return setTimeout(e,500)}));case 3:console.log("data",Object.values(t).join("")),r("Verify success!"),e(C.vB.root,{replace:!0}),n.next=11;break;case 8:n.prev=8,n.t0=n.catch(0),console.error(n.t0);case 11:case"end":return n.stop()}}),n,null,[[0,8]])})));return function(e){return n.apply(this,arguments)}}();return(0,k.jsx)(S.RV,{methods:t,onSubmit:a(D),children:(0,k.jsxs)(j.Z,{spacing:3,children:[(0,k.jsx)(j.Z,{direction:"row",spacing:2,justifyContent:"center",children:Object.keys(_).map((function(e,r){return(0,k.jsx)(g.Qr,{name:"code".concat(r+1),control:c,render:function(e){var n=e.field,t=e.fieldState.error;return(0,k.jsx)(y.Z,(0,u.Z)((0,u.Z)({},n),{},{error:!!t,autoFocus:0===r,placeholder:"-",onChange:function(e){return function(e,r){var n=e.target,t=n.maxLength,o=n.value,c=n.name.replace("code",""),i=Number(c);if(o.length>=t&&i<6){var a=document.querySelector("input[name=code".concat(i+1,"]"));null!==a&&a.focus()}r(e)}(e,n.onChange)},inputProps:{className:"field-code",maxLength:1,sx:{p:0,textAlign:"center",width:{xs:36,sm:56},height:{xs:36,sm:56}}}}))}},e)}))}),(!!f.code1||!!f.code2||!!f.code3||!!f.code4||!!f.code5||!!f.code6)&&(0,k.jsx)(b.Z,{error:!0,sx:{px:2},children:"Code is required"}),(0,k.jsx)(q.Z,{fullWidth:!0,size:"large",type:"submit",variant:"contained",loading:s,sx:{mt:3},children:"Verify"})]})})}var w=(0,t.ZP)("div")((function(e){return{maxWidth:480,margin:"auto",minHeight:"100vh",display:"flex",justifyContent:"center",flexDirection:"column",padding:e.theme.spacing(12,0)}}));function D(){return(0,k.jsxs)(s.Z,{title:"Verify Code",children:[(0,k.jsx)(d.Z,{}),(0,k.jsx)(o.Z,{children:(0,k.jsxs)(w,{sx:{textAlign:"center"},children:[(0,k.jsx)(c.Z,{variant:"h3",paragraph:!0,children:"Please check your email!"}),(0,k.jsx)(c.Z,{sx:{color:"text.secondary"},children:"We have emailed a 6-digit confirmation code to acb@domain, please enter the code in below box to verify your email."}),(0,k.jsx)(i.Z,{sx:{mt:5,mb:3},children:(0,k.jsx)(_,{})}),(0,k.jsxs)(c.Z,{variant:"body2",children:["Don\u2019t have a code? \xa0",(0,k.jsx)(a.Z,{variant:"subtitle2",onClick:function(){},children:"Resend code"})]})]})})]})}}}]);