(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{48312:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return s(43493)}])},79233:function(e,t,s){"use strict";s.d(t,{Z:function(){return j}});var r=s(85893),l=s(25808),n=s(67294),a=s(69919),i=s.n(a),c=s(67148),u=s(3511),o=s.n(u),d=s(53552);s(36819),s(22020),o().utils.serializeQuery,o().utils.deserializeQuery;var m=s(88584),f=s(96486),x=s.n(f),h=s(98388);function w(e){let{formRef:t,...s}=e,l=x().omit(s,["submitHandler","changeHandler"]);return(0,r.jsx)("form",{...l,className:(0,h.m6)("flex flex-col items-stretch gap-2 w-full bg-transparent","twui-form",s.className),onSubmit:e=>{var t,r;e.preventDefault();let l=Object.fromEntries(new FormData(e.target).entries());null===(t=s.submitHandler)||void 0===t||t.call(s,e,l),null===(r=s.onSubmit)||void 0===r||r.call(s,e)},onChange:e=>{var t,r;e.preventDefault();let l=Object.fromEntries(new FormData(e.target.closest("form")).entries());null===(t=s.changeHandler)||void 0===t||t.call(s,e,l),null===(r=s.onChange)||void 0===r||r.call(s,e)},ref:t,children:s.children})}var g=s(77827),p=s(94495),v=s(60);function j(){let{loading:e,setLoginData:t,submitLogin:s,alert:a}=function(){let[e,t]=(0,n.useState)({}),[s,r]=(0,n.useState)(),{loading:a,setLoading:u}=(0,l.Z)();(0,n.useEffect)(()=>{r(void 0)},[e]);let o=(0,n.useCallback)(async()=>{if(!e.email&&!e.username){r({text:"Please Enter a username or email"});return}let t=c.ZPm.string().min(6).safeParse(e.password||"");if(!t.success){var s;r({text:"Invalid Password: "+(null===(s=d.default.parse(t.error.message))||void 0===s?void 0:s[0].message),field_name:"password"});return}u(!0);try{let t=await i()("/api/auth/login",{method:"POST",body:{...e}});t.success?window.location.reload():(r({text:t.msg||"Login Failed"}),u(!1))}catch(e){u(!1)}},[e]);return{loginData:e,setLoginData:t,loading:a,setLoading:u,submitLogin:o,alert:s,setAlert:r}}();return(0,r.jsxs)(w,{className:"w-full",submitHandler:()=>{s()},children:[(0,r.jsxs)(v.Z,{className:"w-full items-stretch gap-6",children:[(null==a?void 0:a.text)?(0,r.jsx)(m.Z,{color:"error",variant:"outlined",className:"py-2 px-6 opacity-70",children:a.text}):null,(0,r.jsx)(g.Z,{placeholder:"Email Address or Username",title:"Email/Username",changeHandler:e=>{let s=c.ZPm.email().safeParse(e);t(t=>({...t,email:s.success?e:void 0,username:s.success?void 0:e}))},validity:(null==a?void 0:a.field_name)=="email-username"?{isValid:!1,msg:null==a?void 0:a.text}:{isValid:!0},showLabel:!0}),(0,r.jsx)(g.Z,{placeholder:"Password",title:"Password",type:"password",onChange:e=>{t(t=>({...t,password:e.target.value}))},validity:(null==a?void 0:a.field_name)=="password"?{isValid:!1,msg:null==a?void 0:a.text}:{isValid:!0},showLabel:!0}),(0,r.jsx)(p.Z,{title:"Login",loading:e,onClick:s,children:"Login"})]})," "]})}},44306:function(e,t,s){"use strict";s.d(t,{Z:function(){return x}});var r=s(85893),l=s(51833),n=s(57493),a=s(83772),i=s(60705),c=s(80600),u=s(94655),o=s(89028),d=s(98388);function m(e){let{horizontal:t,...s}=e;return(0,r.jsx)("div",{...s,className:(0,d.m6)("",t?"w-10":"w-full h-10","twui-spacer",s.className),children:s.children})}var f=s(60);function x(e){let{children:t}=e;return(0,r.jsx)(c.Z,{className:"w-screen h-screen overflow-hidden",children:(0,r.jsx)(o.Z,{className:"w-full h-full",children:(0,r.jsx)(a.Z,{className:"grid-frame grid-cols-1 h-full",children:(0,r.jsxs)(f.Z,{className:"w-full justify-between h-full grid-cell",children:[(0,r.jsxs)(f.Z,{className:"gap-0",children:[(0,r.jsxs)(u.Z,{children:[(0,r.jsx)(u.Z,{className:"p-6",children:(0,r.jsx)(l.Z,{})}),(0,r.jsx)(i.Z,{vertical:!0})]}),(0,r.jsx)(i.Z,{})]}),(0,r.jsx)(n.Z,{className:"p-10",children:t}),(0,r.jsxs)(f.Z,{children:[(0,r.jsx)(i.Z,{}),(0,r.jsx)(m,{className:"h-20 w-full"})]})]})})})})}},43493:function(e,t,s){"use strict";s.r(t),s.d(t,{__N_SSP:function(){return m},default:function(){return f}});var r=s(85893),l=s(60),n=s(79233),a=s(56211),i=s(89028),c=s(83772),u=s(57493);function o(){return(0,r.jsx)(i.Z,{className:"w-full h-full",children:(0,r.jsx)(c.Z,{className:"w-full h-full",children:(0,r.jsx)(u.Z,{children:(0,r.jsxs)(l.Z,{className:"flex-col",gap:"5",children:[(0,r.jsx)(a.Z,{children:"Welcome"}),(0,r.jsx)(n.Z,{})]})})})})}var d=s(44306),m=!0;function f(){return(0,r.jsx)(d.Z,{children:(0,r.jsx)(o,{})})}},88584:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});var r=s(85893);s(67294);var l=s(98388);function n(e){let{color:t,variant:s,children:n,href:a,newTab:i,linkProps:c,...u}=e,o=(0,r.jsx)("div",{...u,className:(0,l.m6)("text-xs px-2 py-0.5 rounded-full outline-0","text-center flex items-center justify-center","secondary"==t?"bg-secondary text-white outline-secbg-secondary":"success"==t?"bg-success outline-success text-white":"error"==t?"bg-orange-700 outline-orange-700":"gray"==t?(0,l.m6)("bg-slate-100 outline-slate-200 dark:bg-gray-dark dark:outline-gray-dark","text-slate-800 dark:text-white"):"bg-primary text-white outline-primbg-primary twui-tag-primary","outlined"==s?"!bg-transparent outline-1 "+("secondary"==t?"text-secondary":"success"==t?"text-success dark:text-success-dark":"error"==t?"text-orange-700":"gray"==t?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark twui-tag-primary-outlined"):"ghost"==s?"!bg-transparent outline-none border-none "+("secondary"==t?"text-secondary":"success"==t?"text-success dark:text-success-dark":"error"==t?"text-orange-700":"gray"==t?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark"):"","twui-tag",u.className),children:n});return a?(0,r.jsx)("a",{href:a,target:i?"_blank":void 0,...c,className:(0,l.m6)("hover:opacity-80",null==c?void 0:c.className),children:o}):o}},57493:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});var r=s(85893),l=s(98388);function n(e){let{...t}=e;return(0,r.jsx)("div",{...t,className:(0,l.m6)("flex flex-col items-center justify-center gap-4 p-2 w-full","h-full twui-center",t.className),children:t.children})}},83772:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});var r=s(85893),l=s(98388);function n(e){let{...t}=e;return(0,r.jsx)("div",{...t,className:(0,l.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",t.className),children:t.children})}},56211:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});var r=s(85893),l=s(98388);function n(e){let{...t}=e;return(0,r.jsx)("h2",{...t,className:(0,l.m6)("text-2xl md:text-3xl mb-4","twui-headings twui-heading","twui-h2",t.className),children:t.children})}},89028:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});var r=s(85893),l=s(98388);function n(e){let{...t}=e;return(0,r.jsx)("section",{...t,className:(0,l.m6)("flex flex-col items-center w-full","px-4 sm:px-10 py-10","twui-section",t.className),children:t.children})}}},function(e){e.O(0,[662,75,664,433,225,7,827,888,774,179],function(){return e(e.s=48312)}),_N_E=e.O()}]);