"use strict";(()=>{vare={};e.id=7537,e.ids=[636,7537],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){returnfunctione(t,r){returnrint?t[r]:"then"int&&"function"==typeoft.then?t.then(t=>e(t,r)):"function"==typeoft&&"default"===r?t:void0}}})},75370:(e,t,r)=>{r.r(t),r.d(t,{config:()=>I,default:()=>D,getServerSideProps:()=>N,getStaticPaths:()=>R,getStaticProps:()=>A,reportWebVitals:()=>L,routeModule:()=>k,unstable_getServerProps:()=>T,unstable_getServerSideProps:()=>$,unstable_getStaticParams:()=>C,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>M});vars={};r.r(s),r.d(s,{ResetPasswordContext:()=>E,default:()=>j,getServerSideProps:()=>b});vari=r(63865),n=r(9455),a=r(30671),o=r(49407),u=r(68268),l=r(8732),c=r(82015),p=r.n(c),m=r(71457),d=r(87472),x=r(32415),g=r(20048),f=r.n(g),h=r(63715),S=r(13002),y=r(77463),_=r.n(y),P=r(22373),w=r.n(P),v=r(27825),q=r.n(v);letE=p().createContext({});functionj(e){let{email:t}=e,r="Reset Password | Datasquirel",s="Set a new password",i=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:r}),(0,l.jsx)("meta",{name:"description",content:s}),(0,l.jsx)(d.A,{pageTitle:r,pageDescription:s,pagePathname:"/"})]}),[n,a]=p().useState(!1),[o,u]=p().useState(!1);return(0,l.jsx)(m.A,{head:i,user:e.user,children:(0,l.jsx)(E.Provider,{value:{user:e.user},children:(0,l.jsx)("main",{children:(0,l.jsxs)("section",{children:[n&&(0,l.jsx)(x.A,{}),(0,l.jsx)("div",{className:"main-container flex-col items-start",children:o?(0,l.jsx)(S.A,{message:"Password Updated Sucessfully. Redirecting you ..."}):(0,l.jsxs)(p().Fragment,{children:[(0,l.jsx)("h1",{className:"m-0 text-4xl",children:"Reset Password"}),(0,l.jsx)("span",{children:"Please enter new passord and confirm it"}),(0,l.jsxs)("form",{className:"max-w-xl w-full flex flex-col items-stretch gap-4",onSubmit:e=>{a(!0),e.preventDefault();letr=e.target,s=r.password.value,i=r["confirm-password"].classList.contains("warning");if(s?.length<8){window.alert("Password must be at least 8 characters"),setTimeout(()=>{a(!1)},500);return}if(i){window.alert("Passwords don't match"),setTimeout(()=>{a(!1)},500);return}(0,h.A)(`/api/resetPassword?email=${t}&password=${s}`).then(e=>{setTimeout(()=>{a(!1)},500),setTimeout(()=>{window.location.href="/logout?login=true"},1e3),e.success&&u(!0)})},children:[(0,l.jsx)("input",{type:"password",name:"password",id:"password",className:"w-full",placeholder:"New Password",required:!0}),(0,l.jsx)("input",{type:"password",name:"confirm-password",id:"confirm-password",className:"w-full",placeholder:"Confirm New Password",required:!0,onInput:e=>{lett=e.target,r=t.closest("form");try{r.password.value.match(RegExp(`^${q().escapeRegExp(t.value)}$`))?t.classList.remove("warning"):t.classList.add("warning")}catch(t){(0,h.A)("/api/admin/clientError",{method:"post",body:{component:"reset-password-page-component/lines-170-177",message:t.message,user:{}}}),e.target.classList.add("warning")}}}),(0,l.jsx)("button",{children:"Reset Password"})]})]})})]})})})})}asyncfunctionb({req:e,res:t,query:r}){lets=awaitf()(e,t);if(!r?.token?.toString()?.match(/./))return{redirect:{destination:"/",permanent:!1}};leti=null;try{lete=_()({encryptedString:r.token.toString()}),t=JSON.parse(e||"");if(Date.now()-t.dateCode>36e5)return{redirect:{destination:"/",permanent:!1}};i=t.email}catch(e){returnw()({component:"reset-password-page-component/getServersideProps/lines-251-260",message:e.message,user:s}),{redirect:{destination:"/",permanent:!1}}}returni?.match(/./)?{props:{user:s,email:i}}:{redirect:{destination:"/",permanent:!1}}}letD=(0,a.M)(s,"default"),A=(0,a.M)(s,"getStaticProps"),R=(0,a.M)(s,"getStaticPaths"),N=(0,a.M)(s,"getServerSideProps"),I=(0,a.M)(s,"config"),L=(0,a.M)(s,"reportWebVitals"),M=(0,a.M)(s,"unstable_getStaticProps"),O=(0,a.M)(s,"unstable_getStaticPaths"),C=(0,a.M)(s,"unstable_getStaticParams"),T=(0,a.M)(s,"unstable_getServerProps"),$=(0,a.M)(s,"unstable_getServerSideProps"),k=newi.PagesRouteModule({definition:{kind:n.A.PAGES,page:"/reset-password",pathname:"/reset-password",bun