1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="34fcd348-a4be-4a34-8ea5-61ce7c200402",e._sentryDebugIdIdentifier="sentry-dbid-34fcd348-a4be-4a34-8ea5-61ce7c200402")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[836],{39440:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/choose-username",function(){return n(6781)}])},24739:function(e,t,n){"use strict";n.d(t,{$:function(){return s},u:function(){return a}});let a=["about","accessibility","account","activities","admin","all","ameliorate","amelioro","api","app","archive","blog","business","categories","chat","comments","communities","community","compare","contact","contribute","dashboard","data","demo","demos","design","dev","discussion","docs","edu","enterprise","events","explanation","explore","faq","favorites","features","feedback","gov","groups","guide","guides","help","hosting","hidden-settings","ideas","images","jobs","learn","login","logout","maintenance","me","media","new","news","notifications","now","official","ontology","org","organizations","partners","plans","playground","polls","popular","privacy","projects","search","security","settings","showcase","signup","solve","stats","status","stories","system","team","tech","terms","topics","tour","tutorial","users","volunteer","welcome","wiki"],s=["account","followers","following","new","settings","stats","topics"]},2110:function(e,t,n){"use strict";n.d(t,{I:function(){return r}});var a=n(1604),s=n(24739);let r=a.z.object({id:a.z.number(),username:a.z.string().min(1).max(39).regex(/^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/i,"Username may only contain alphanumeric characters or single hyphens, and cannot begin or end with a hyphen.").refine(e=>!s.u.includes(e.toLocaleLowerCase()),e=>({message:"".concat(e," is a reserved username.")})),authId:a.z.string(),email:a.z.string().email(),receiveEmailNotifications:a.z.boolean()})},6781:function(e,t,n){"use strict";n.r(t);var a=n(35944),s=n(56312),r=n(50447),i=n(78557),o=n(52058),u=n(57019),c=n(9008),l=n.n(c),d=n(11163),m=n.n(d),f=n(67294),h=n(87536),g=n(1604),p=n(2110),y=n(49715),b=n(29044),w=n(93320);let v=()=>{let e=w.S.useUtils();return{createUser:w.S.user.create.useMutation({onSuccess:(t,n)=>{e.user.findByAuthId.setData({authId:n.authId},t);let a={...t,topics:[]};e.user.findByUsername.setData({username:n.username},a)}})}},Z=e=>g.z.object({username:p.I.shape.username.refine(async t=>!p.I.shape.username.safeParse(t).success||!await e.user.findByUsername.fetch({username:t}),e=>({message:"Username ".concat(e," is not available.")}))});t.default=()=>{var e;let{authUser:t,sessionUser:n,checkSession:c,isLoading:d}=(0,b.Oy)(),g=null==t?void 0:t.sub,p=null==t?void 0:t.email,_=w.S.useUtils(),{createUser:I}=v(),{register:x,handleSubmit:z,formState:{errors:B}}=(0,h.cI)({mode:"onBlur",reValidateMode:"onBlur",resolver:(0,s.F)(Z(_))});if((0,f.useEffect)(()=>{(async()=>{await fetch("/api/auth/refresh-profile"),await c()})()},[c]),d)return(0,a.tZ)(y.g,{});if(!t||!g||!p)return m().push("/api/auth/login"),(0,a.tZ)(y.g,{});if(!t.email_verified)return(0,a.BX)(r.Z,{variant:"h5",textAlign:"center",sx:{margin:2},children:["An email was sent to verify your email address.",(0,a.tZ)("br",{}),"Please verify your email address, then refresh the page."]});if(n){let e=new URLSearchParams(window.location.search).get("returnTo"),t=e&&"/"!==e?e:"/".concat(n.username);return m().push(t),(0,a.tZ)(y.g,{})}let U=e=>{I.mutate({username:e.username,authId:g,email:p})};return(0,a.BX)(a.HY,{children:[(0,a.BX)(l(),{children:[(0,a.tZ)("title",{children:"Choose username | Ameliorate"}),(0,a.tZ)("meta",{name:"description",content:"Choose your username to start solving problems with Ameliorate."})]}),(0,a.tZ)("form",{onSubmit:e=>void z(U)(e),style:{display:"flex",justifyContent:"center"},children:(0,a.BX)(i.Z,{spacing:1,sx:{width:"600px",textAlign:"center",margin:1},children:[(0,a.tZ)(r.Z,{variant:"h4",children:"Choose your username"}),(0,a.tZ)(r.Z,{variant:"body1",children:"Your username is how other users will refer to you and find topics you create."}),(0,a.tZ)(o.Z,{...x("username"),label:"Username",error:!!B.username,helperText:null===(e=B.username)||void 0===e?void 0:e.message,required:!0}),(0,a.tZ)(u.Z,{type:"submit",variant:"contained",children:"Choose username"})]})})]})}},49715:function(e,t,n){"use strict";n.d(t,{g:function(){return r}});var a=n(35944),s=n(97023);let r=()=>(0,a.tZ)("div",{className:"m-auto flex",role:"progressbar",children:(0,a.tZ)(s.Z,{})})}},function(e){e.O(0,[19,204,656,535,312,888,774,179],function(){return e(e.s=39440)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.