(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6086],{42866:function(e,r,s){Promise.resolve().then(s.bind(s,4946))},4946:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return b}});var a=s(57437),n=s(16463),t=s(2265),l=s(88726),o=s(90912),i=s(78613),c=s(31014),d=s(25524),u=s(39343),m=s(39527),h=s(92369),x=s(56541),p=s(42907);function f(e){var r,s,n,l,o;let{register:i,handleSubmit:f,setError:b,formState:{errors:v}}=(0,u.cI)({resolver:(0,c.F)(p.i2),mode:"onChange"}),{mutateAsync:g}=(0,d.D)({mutationFn:m.Z.user.first}),{onCreate:w,onAuthenticationError:j}=e,y=(0,t.useCallback)(e=>{let r=g(e,{onError:e=>{var r;let{status:s}=null!==(r=e.response)&&void 0!==r?r:{};switch(s){case 401:null==j||j(e);break;case 409:b("email",{message:"Email already exists"});break;default:b("username",{message:"Unknown error"})}}});null==w||w(r)},[b,j,g,w]);return(0,a.jsxs)("form",{className:"flex flex-col gap-1",onSubmit:f(y),children:[(0,a.jsx)(h.ZA,{label:"Username",name:"username",help:"This name will be used to identify you in the app.",error:null===(r=v.username)||void 0===r?void 0:r.message,children:(0,a.jsx)(h.II,{...i("username")})}),(0,a.jsx)(h.ZA,{label:"Name",name:"name",error:null===(s=v.name)||void 0===s?void 0:s.message,help:"Please provide your full name. This is especially helpful for sharing your annotations, ensuring correct attribution.",children:(0,a.jsx)(h.II,{...i("name")})}),(0,a.jsx)(h.ZA,{label:"Email",name:"email",error:null===(n=v.email)||void 0===n?void 0:n.message,help:"Provide a valid email address. While not displayed in the app, it helps others contact you regarding annotated data.",children:(0,a.jsx)(h.II,{type:"email",...i("email")})}),(0,a.jsx)(h.ZA,{label:"Password",name:"password",error:null===(l=v.password)||void 0===l?void 0:l.message,help:"Create a strong password with at least 8 characters, including one number and one letter.",children:(0,a.jsx)(h.II,{type:"password",...i("password")})}),(0,a.jsx)(h.ZA,{label:"Confirm password",name:"password_confirm",error:null===(o=v.password_confirm)||void 0===o?void 0:o.message,help:"Enter the same password again.",children:(0,a.jsx)(h.II,{type:"password",...i("password_confirm")})}),(0,a.jsx)("div",{className:"flex flex-row justify-center",children:(0,a.jsx)(x.Z,{type:"submit",variant:"primary",children:"Create account"})})]})}function b(){let e=(0,n.useRouter)(),r=(0,t.useCallback)(r=>{l.ZP.promise(r.then(r=>(e.push("/login"),r)),{loading:"Creating account...",success:"Account created!",error:"Failed to create account"})},[e]),s=(0,t.useCallback)(()=>{l.ZP.error("This is not your first time here, is it?"),e.push("/login")},[e]);return(0,a.jsx)("div",{className:"flex flex-col items-center justify-center min-h-screen",children:(0,a.jsxs)("div",{className:"flex flex-col max-w-prose gap-4",children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col items-center gap-4 text-center text-7xl",children:[(0,a.jsx)(o.b_,{width:128,height:128}),(0,a.jsx)("span",{className:"font-sans font-bold text-emerald-500 underline decoration-8",children:"Whombat"})]}),(0,a.jsx)("h1",{className:"text-3xl font-bold text-center",children:"Welcome!"}),(0,a.jsx)("p",{className:"max-w-prose text-center",children:"Let's get started by creating your account. Provide your information and set up a secure password below."}),(0,a.jsx)(f,{onCreate:r,onAuthenticationError:s}),(0,a.jsx)(i.Z,{children:(0,a.jsx)("p",{className:"text-sm max-w-prose text-center",children:"Your data is stored locally on your computer and is not sent to any server."})})]})})}},78613:function(e,r,s){"use strict";s.d(r,{Z:function(){return l}});var a=s(57437),n=s(56800),t=s.n(n);function l(e){let{title:r,className:s,children:n}=e;return(0,a.jsxs)("div",{className:t()(s,"flex items-center p-3 text-sm text-blue-800 border border-blue-300 rounded-lg bg-blue-50 dark:bg-gray-800 dark:text-blue-400 dark:border-blue-800"),role:"alert",children:[(0,a.jsx)("svg",{className:"inline flex-shrink-0 mr-3 w-4 h-4","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 20 20",children:(0,a.jsx)("path",{d:"M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"})}),(0,a.jsx)("span",{className:"sr-only",children:"Info"}),(0,a.jsxs)("div",{children:[null!=r," ",n]})]})}}},function(e){e.O(0,[5501,7819,5660,9772,8472,5657,9226,6259,3215,5347,9527,4593,2971,7023,1744],function(){return e(e.s=42866)}),_N_E=e.O()}]);