(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[613],{12120:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/auth/signup",function(){return t(10505)}])},78513:function(e,n,t){"use strict";t.d(n,{Z:function(){return d}});var r=t(85893),s=t(77827),l=t(94495),i=t(60),c=t(5606),a=t(25808),o=t(67294),u=t(79265);function d(e){var n,t,d,f;let{new_deployment_user:h}=e,{newUser:m,setNewUser:p,loading:w,setLoading:x,isPasswordConfirmed:j,setIsPasswordConfirmed:g,pageProps:y}=function(e){let{new_deployment_user:n}=e,{pageProps:t}=(0,o.useContext)(c.AppContext),[r,s]=(0,o.useState)({}),{loading:l,setLoading:i}=(0,a.Z)(),[u,d]=(0,o.useState)(!1);return{newUser:r,setNewUser:s,loading:l,setLoading:i,isPasswordConfirmed:u,setIsPasswordConfirmed:d,pageProps:t}}({new_deployment_user:h}),Z=!!(j&&(null===(n=m.password)||void 0===n?void 0:n.match(/./))&&(null===(t=m.confirmed_password)||void 0===t?void 0:t.match(/./)));return(0,r.jsx)("form",{onSubmit:e=>{e.preventDefault()},children:(0,r.jsxs)(i.Z,{className:"w-full items-stretch gap-6",children:[(0,r.jsx)(s.Z,{placeholder:"Eg. John",title:"First Name",changeHandler:e=>{p(n=>({...n,first_name:e}))},required:!0,showLabel:!0}),(0,r.jsx)(s.Z,{placeholder:"Eg. Doe",title:"Last Name",changeHandler:e=>{p(n=>({...n,last_name:e}))},showLabel:!0}),(0,r.jsx)(s.Z,{placeholder:"Email Address",title:"Email",type:"email",changeHandler:e=>{p(n=>({...n,email:e}))},required:!0,showLabel:!0}),y.user.id?(0,r.jsx)(s.Z,{placeholder:"Username",title:"Username",changeHandler:e=>{p(n=>({...n,username:e}))},validationRegex:/^[a-z0-9\-]{3,}$/,info:(0,r.jsxs)(r.Fragment,{children:["Allowed characters:"," ",(0,r.jsx)("code",{children:(0,r.jsx)("b",{children:"a-z, 0-9, -"})}),"."]}),wrapperWrapperProps:{className:"items-start!"},required:!0,showLabel:!0}):null,(0,r.jsx)(s.Z,{placeholder:"Password",title:"Password",type:"password",changeHandler:e=>{p(n=>({...n,password:e}))},validity:{isValid:!((null===(d=m.password)||void 0===d?void 0:d.match(/./))&&(null===(f=m.confirmed_password)||void 0===f?void 0:f.match(/./)))||Z,msg:"Passwords don't match"},required:!0,showLabel:!0}),(0,r.jsx)(s.Z,{placeholder:"Confirm Password",title:"Confirm Password",type:"password",changeHandler:e=>{p(n=>({...n,confirmed_password:e})),g(e==m.password)},showLabel:!0}),(0,r.jsx)(l.Z,{title:"Login",onClick:()=>{Z&&window.confirm("Create Super Admin Account?")&&(x(!0),(0,u.Z)("/api/auth/signup",{method:"POST",body:{new_user:m}}).then(e=>{console.log("res",e),e.success&&window.location.reload()}).finally(()=>{}))},loading:w,children:y.user.super_admin?"Add User":"Signup"})]})})}},44306:function(e,n,t){"use strict";t.d(n,{Z:function(){return m}});var r=t(85893),s=t(51833),l=t(57493),i=t(83772),c=t(60705),a=t(80600),o=t(94655),u=t(89028),d=t(98388);function f(e){let{horizontal:n,...t}=e;return(0,r.jsx)("div",{...t,className:(0,d.m6)("",n?"w-10":"w-full h-10","twui-spacer",t.className),children:t.children})}var h=t(60);function m(e){let{children:n}=e;return(0,r.jsx)(a.Z,{className:"w-screen h-screen overflow-hidden",children:(0,r.jsx)(u.Z,{className:"w-full h-full",children:(0,r.jsx)(i.Z,{className:"grid-frame grid-cols-1 h-full",children:(0,r.jsxs)(h.Z,{className:"w-full justify-between h-full grid-cell",children:[(0,r.jsxs)(h.Z,{className:"gap-0",children:[(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(o.Z,{className:"p-6",children:(0,r.jsx)(s.Z,{})}),(0,r.jsx)(c.Z,{vertical:!0})]}),(0,r.jsx)(c.Z,{})]}),(0,r.jsx)(l.Z,{className:"p-10",children:n}),(0,r.jsxs)(h.Z,{children:[(0,r.jsx)(c.Z,{}),(0,r.jsx)(f,{className:"h-20 w-full"})]})]})})})})}},10505:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return o},default:function(){return u}});var r=t(85893),s=t(56211),l=t(60),i=t(78513);function c(){return(0,r.jsxs)(l.Z,{className:"w-full items-center max-w-lg",children:[(0,r.jsx)(s.Z,{children:"Create Super Admin Account"}),(0,r.jsx)(i.Z,{})]})}var a=t(44306),o=!0;function u(){return(0,r.jsx)(a.Z,{children:(0,r.jsx)(c,{})})}},57493:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(85893),s=t(98388);function l(e){let{...n}=e;return(0,r.jsx)("div",{...n,className:(0,s.m6)("flex flex-col items-center justify-center gap-4 p-2 w-full","h-full twui-center",n.className),children:n.children})}},83772:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(85893),s=t(98388);function l(e){let{...n}=e;return(0,r.jsx)("div",{...n,className:(0,s.m6)("flex w-full max-w-container gap-4 justify-between","flex-wrap flex-col xl:flex-row items-start xl:items-center","twui-container",n.className),children:n.children})}},56211:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(85893),s=t(98388);function l(e){let{...n}=e;return(0,r.jsx)("h2",{...n,className:(0,s.m6)("text-2xl md:text-3xl mb-4","twui-headings twui-heading","twui-h2",n.className),children:n.children})}},89028:function(e,n,t){"use strict";t.d(n,{Z:function(){return l}});var r=t(85893),s=t(98388);function l(e){let{...n}=e;return(0,r.jsx)("section",{...n,className:(0,s.m6)("flex flex-col items-center w-full","px-4 sm:px-10 py-10","twui-section",n.className),children:n.children})}},79265:function(e,n,t){"use strict";t.d(n,{Z:function(){return i}});var r=t(96486),s=t.n(r),l={stringify:function(e,n,t){try{return JSON.stringify(e,n||void 0,t)}catch(e){return}}};async function i(e,n){let t;let r={"Content-Type":"application/json"};(null==n?void 0:n.csrfKey)&&n.csrfValue&&(r[n.csrfKey]=n.csrfValue);let i=e;if((null==n?void 0:n.query)&&(i+=function(e){let n="?";if("object"!=typeof e)return console.log("Invalid Query type"),n;if(Array.isArray(e))return console.log("Query is an Array. This is invalid."),n;if(!e)return console.log("No Query provided."),n;let t=Object.keys(e),r=[];return t.forEach(n=>{if(!n||!e[n])return;let t=e[n];if("object"==typeof t){let e=l.stringify(t);r.push("".concat(n,"=").concat(encodeURIComponent(String(e))))}else"string"==typeof t||"number"==typeof t?r.push("".concat(n,"=").concat(encodeURIComponent(t))):r.push("".concat(n,"=").concat(String(t)))}),n+=r.join("&")}(n.query)),"string"==typeof n)try{t="post"===n?(await fetch(i,{method:n,headers:r})).json():(await fetch(i)).json()}catch(e){console.log("FetchAPI error #1:",e.message),t=null}else if("object"==typeof n)try{let e;if(n.body&&"object"==typeof n.body){let e=s().cloneDeep(n.body);n.body=JSON.stringify(e)}if(n.headers){n.headers=s().merge(n.headers,r);let t={...n};e=await fetch(i,t)}else{let t={...n,headers:r};e=await fetch(i,t)}t=e.json()}catch(e){console.log("FetchAPI error #2:",e.message),t=null}else try{let e=await fetch(i);t=await e.json()}catch(e){console.log("FetchAPI error #3:",e.message),t=null}return t}}},function(e){e.O(0,[662,75,664,433,7,827,888,774,179],function(){return e(e.s=12120)}),_N_E=e.O()}]);