(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8997],{809:(e,r,s)=>{"use strict";s.d(r,{Sd:()=>p,n4:()=>m,tw:()=>u});var t=s(37876),n=s(26650),o=s(947),a=s(36038),i=s(87303),l=s(88992),c=s(60513);let d=c.z.object({email:c.z.string().email().min(1),first_name:c.z.string().min(1),last_name:c.z.string().min(1),password:c.z.string().min(1),password_confirmation:c.z.string().min(1),receive_newsletter:c.z.boolean().optional(),accept_terms:c.z.boolean()}),p=d.refine(e=>e.password===e.password_confirmation,{message:"Passwords must match",path:["password_confirmation"]}).refine(e=>e.accept_terms,{message:"You must accept the terms",path:["accept_terms"]}),u=d.extend({invite_token:c.z.string().min(1)}).refine(e=>e.password===e.password_confirmation,{message:"Passwords must match",path:["password_confirmation"]}).refine(e=>e.accept_terms,{message:"You must accept the terms",path:["accept_terms"]}),m=e=>{let{children:r}=e,{register:s,setValue:c,getValues:d,watch:p}=(0,l.xW)();return(0,t.jsxs)(i.B,{gap:"$4",children:[(0,t.jsx)(o.pd,{...s("email"),type:"email",placeholder:"Email",autoComplete:"email",defaultValue:d("email"),autoFocus:!d("email")}),(0,t.jsxs)(i.B,{gap:"$4",direction:"horizontal",children:[(0,t.jsx)(o.pd,{...s("first_name"),placeholder:"First name",autoComplete:"given-name"}),(0,t.jsx)(o.pd,{...s("last_name"),placeholder:"Last name",autoComplete:"family-name"})]}),(0,t.jsx)(a.y,{...s("password"),placeholder:"Password",autoComplete:"new-password",value:p("password")}),(0,t.jsx)(a.y,{...s("password_confirmation"),placeholder:"Confirm password",autoComplete:"new-password",value:p("password_confirmation")}),r,(0,t.jsxs)(i.B,{gap:"$1",children:[(0,t.jsx)(n.Sc,{checked:p("accept_terms"),onCheckedChange:e=>{c("accept_terms",e)},children:"Accept Are.na Terms and Privacy conditions"}),(0,t.jsx)(n.Sc,{checked:p("receive_newsletter"),onCheckedChange:e=>{c("receive_newsletter",e)},children:"Receive our monthly newsletter?"})]})]})}},6455:(e,r,s)=>{"use strict";s.d(r,{n:()=>a});var t=s(37876),n=s(93026),o=s(87303);let a=e=>{let{active:r,children:s,more:n,...a}=e;return(0,t.jsxs)(i,{active:r,...a,children:[(0,t.jsx)(o.B,{gap:"$3",direction:"horizontal",css:{p:"$3",alignItems:"center",justifyContent:"space-between"},children:s}),n&&(0,t.jsx)(l,{children:n})]})},i=(0,n.pH)("div",{borderRadius:"$1",bg:"$background",color:"$link",border:"1px solid",borderColor:"$gray3",overflow:"hidden",variants:{premium:{true:{borderColor:"$blue2"}},active:{true:{bg:"$gray1",borderColor:"$gray2",button:{mixBlendMode:"$colors$blend"}}}}}),l=(0,n.pH)("div",{p:"$3",bg:"$gray1",color:"$foreground",borderTop:"1px solid",borderColor:"$gray2",height:"100%"})},10109:(e,r,s)=>{"use strict";s.r(r),s.d(r,{__N_SSP:()=>E,default:()=>z});var t=s(37876),n=s(89572),o=s(76841),a=s(52001),i=s(14232),l=s(5336),c=s(89099),d=s(48230),p=s.n(d),u=s(37747),m=s(809),h=s(54761),g=s(52447),w=s(88992),f=s(13810);let x=e=>{let{id:r,onReady:s,removeOnUnmount:t=!1,skip:n=!1,...o}=e;(0,i.useEffect)(()=>{if(n)return;if(document.getElementById(r)){null==s||s();return}let e=document.createElement("script");return e.id=r,e.async=!0,e.onload=()=>null==s?void 0:s(),"src"in o&&(e.src=o.src),"text"in o&&(e.text=o.text),document.body.appendChild(e),()=>{if(t){let e=document.getElementById(r);e&&document.body.removeChild(e)}}},[r,s,t,o,n])},b=e=>{let{skip:r=!1}=e;return x({id:"google-recaptcha",src:"https://www.google.com/recaptcha/api.js?render=".concat("6LcOpZcUAAAAAGZXvVnafxDKMwL_pgO3ki6vOzb7"),skip:r}),{execute:async e=>{let{action:s}=e;return r?null:new Promise((e,r)=>{window.grecaptcha||e(null),window.grecaptcha.ready(()=>{window.grecaptcha.execute(String("6LcOpZcUAAAAAGZXvVnafxDKMwL_pgO3ki6vOzb7"),{action:s}).then(e).catch(r)})})}}};var _=s(87303),j=s(6455),y=s(34131),$=s(90872),v=s(4439),C=s(5097),k=s(99742);let S="/welcome";var E=!0;function z(){let{query:e}=(0,c.useRouter)(),r=String(e.redirectTo||S),s=String(e.planId||y.Cu),{sendGenericError:d,sendToast:x}=(0,a.Yf)(),[E,z]=(0,i.useState)(s),{subscription:A}=(0,$.j)(E),{execute:P}=b({skip:"true"===k.env.NEXT_PUBLIC_SKIP_RECAPTCHA}),I=(0,w.mN)({resolver:(0,f.u)(m.Sd)}),[N,O]=(0,i.useState)("Idle"),B=async e=>{O("Loading");let s=null;try{s=await P({action:"sign_up"})}catch(e){console.error(e)}try{let t=await fetch("/api/sign_up",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e.email,first_name:e.first_name,last_name:e.last_name,password:e.password,password_confirmation:e.password_confirmation,receive_newsletter:e.receive_newsletter,validation_token:s})}),n=await t.json();if("error"in n)throw Error(n.error);if(O("Success"),r===S&&E!==y.Cu){window.location.href="/billing?planId=".concat(E);return}window.location.href=r}catch(e){d(e),O("Idle")}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.p,{title:"Sign Up | Are.na"}),(0,t.jsx)(u.n,{children:(0,t.jsx)(w.Op,{...I,children:(0,t.jsxs)(n.a,{as:"form",method:"POST",action:"/api/sign_up",onSubmit:I.handleSubmit(B,e=>{Object.entries(e).forEach(e=>{let[r,s]=e;s&&x({title:(0,g.NK)(r),description:s.message,variant:"error"})})}),css:{display:"flex",flexDirection:"column",gap:"$6"},children:[(0,t.jsx)(m.n4,{children:r===S&&"extension"!==e.source&&(0,t.jsx)(_.B,{gap:"$2",css:{my:"$6"},children:y.X1.map(e=>(0,t.jsxs)(j.n,{active:e.id===A.id,children:[(0,t.jsxs)(n.a,{children:[(0,t.jsx)(l.E,{size:"md",css:{fontWeight:"bold"},children:e.name}),(0,t.jsx)(l.E,{size:"xs",children:e.description})]}),(0,t.jsx)(_.B,{gap:"$1",direction:"horizontal",children:e.standardPlans.map(e=>(0,t.jsxs)(o.$,{size:"sm",type:"button",disabled:e.id===E,onClick:()=>{z(e.id)},children:[(0,C.v)({amount:e.amount,currency:e.currency||"USD"})," ","/ ",e.term]},e.id))})]},e.id))})}),(0,t.jsx)(h.Es,{children:(0,t.jsx)(o.$,{type:"submit",disabled:"Loading"===N||"Success"===N,children:{Idle:"Sign up",Loading:"Signing up...",Success:"Redirecting"}[N]})}),(0,t.jsxs)(l.E,{size:"sm",css:{textAlign:"center",color:"$link"},children:["Already a member?"," ",(0,t.jsx)(n.a,{as:p(),href:"/login",css:{fontWeight:"bold"},children:"Log in"})]})]})})})]})}},10616:(e,r,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/sign_up",function(){return s(10109)}])},26650:(e,r,s)=>{"use strict";s.d(r,{Sc:()=>l,XZ:()=>c});var t=s(37876),n=s(93026),o=s(84147),a=s(22365),i=s(77680);let l=e=>{let{checked:r,children:s,disabled:n,onCheckedChange:a}=e;return(0,t.jsx)(o.D,{disabled:n,role:"checkbox","aria-checked":r,onClick:()=>{null==a||a(!r)},children:(0,t.jsxs)(d,{checked:r,children:[(0,t.jsx)(c,{disabled:n,checked:!!r,children:r&&(0,t.jsx)(i.Srz,{})}),s]})})},c=(0,n.pH)("div",{all:"unset",backgroundColor:"$background",width:12,height:12,borderRadius:"$1",display:"flex",alignItems:"center",justifyContent:"center",color:"$slate",border:"1px solid $slate","&:focus":{borderColor:"$focus"},"&:disabled":{color:"$gray4",borderColor:"$gray4"},variants:{checked:{true:{color:"$link",borderColor:"$link"}},disabled:{true:{color:"$gray4",borderColor:"$gray4"}}}}),d=(0,n.pH)(a.J,{display:"flex",alignItems:"center",fontWeight:"bold",gap:"$2",userSelect:"none",color:"$slate",cursor:"pointer","&:hover, &:focus":{color:"$foreground"},"&:focus":{outline:0,"> div":{borderColor:"$focus"}},"&:disabled > div":{color:"$gray4",borderColor:"$gray4"},variants:{disabled:{true:{color:"$gray4"}},checked:{true:{color:"$link"}}}})},36038:(e,r,s)=>{"use strict";s.d(r,{y:()=>c});var t=s(37876),n=s(84147),o=s(33210),a=s(39220),i=s(77680),l=s(14232);let c=(0,l.forwardRef)((e,r)=>{let[s,c]=(0,l.useState)("password");return(0,t.jsx)(o.o,{ref:r,type:s,label:(0,t.jsx)(a.m_,{label:"password"===s?"Show password":"Hide password",children:(0,t.jsx)(n.D,{onClick:()=>{c(e=>"password"===e?"text":"password")},css:{display:"flex"},"aria-label":"password"===s?"Show password":"Hide password",children:"password"===s?(0,t.jsx)(i.N5q,{}):(0,t.jsx)(i.luy,{})})}),...e})});c.displayName="PasswordInput"},37747:(e,r,s)=>{"use strict";s.d(r,{n:()=>c});var t=s(37876),n=s(4068),o=s(68944),a=s(12209),i=s(88024),l=s(1261);let c=e=>{let{children:r,span:s="narrow"}=e;return(0,t.jsx)(i.Y,{css:{py:0,color:"$link"},children:(0,t.jsx)(a.e,{children:(0,t.jsxs)(a.VP,{span:s,css:{display:"flex",flexDirection:"column",justifyContent:"center",minHeight:"calc(100dvh - ".concat(o.MJ,"px)"),py:"$6","@bp1":{py:"$3"}},children:[(0,t.jsx)(n.g,{css:{width:20,height:12,color:"$slate"}}),(0,t.jsx)(l.h,{y:"$4"}),r]})})})}},90872:(e,r,s)=>{"use strict";s.d(r,{j:()=>o});var t=s(34131),n=s(14232);let o=e=>(0,n.useMemo)(()=>{let r=(0,t.yg)(e),s=r.plans.find(r=>{let{id:s}=r;return s===e});return s?{plan:s,subscription:r}:(console.error("No plan found for planId: ".concat(e,". Returning default plan.")),{plan:t.Eo.plans[0],subscription:t.Eo})},[e])}},e=>{var r=r=>e(e.s=r);e.O(0,[636,6593,8792],()=>r(10616)),_N_E=e.O()}]);