1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9143],{59143:function(e,a,l){l.r(a);var i=l(11527),s=l(73766),t=l(50959),n=l(88717),r=l(63947),o=l(94985),d=l(48558),u=l(79871),c=l(69569),m=l(32975),p=l(24443),v=l(99957),f=l(46670),h=l(89076),x=l(56586),g=l(43352),y=l(19048),w=l(31719),j=l(53346),b=l(79260),k=l(14943),V=l(7242),P=l(9734),U=l(70571),C=l(74193),q=l(28077),N=l(71428),S=l(5754),A=l(57897),E=l(8807),I=l(15598),B=l(20203),z=l(11260),T=l(65086),G=l(94470);let O="azure-ad";a.default=e=>{var a,l,R,Z,_,D,M,F,L,K,Q,$,H;let{isOpen:W,onClose:Y}=e,X=(0,s.useRouter)(),J=(0,o.m)(),{t:ee}=(0,V.$G)("popup"),{redirectId:ea,requestAccessEmail:el,token:ei,onUpdateRequestAccessEmail:es}=(0,d.t)(),{isAuthenticated:et,isGuest:en}=(0,c.t)(),{flow:er,studioId:eo,studio:ed,isCustomDomain:eu,portal:ec,accessGroup:em,currentPage:ep,onUpdateCurrentPopup:ev}=(0,r.D)(),{style:ef}=(0,n.H)(),[eh,ex]=(0,t.useState)({email:"",password:"",confirmPassword:""}),[eg,ey]=(0,t.useState)(!1),[ew,ej]=(0,t.useState)(!1),[eb,ek]=(0,t.useState)(""),{accessRequestError:eV,accessRequestSuccess:eP,isRequestingAccess:eU,requestStudioAccess:eC,resetAccessRequestStatus:eq}=(0,u.TE)(),eN=null===(K=null==ed?void 0:null===(l=ed.design)||void 0===l?void 0:null===(a=l.visibility)||void 0===a?void 0:a.showEmailAndPassAuth)||void 0===K||K,eS=null===(Q=null==ed?void 0:null===(Z=ed.design)||void 0===Z?void 0:null===(R=Z.visibility)||void 0===R?void 0:R.showGoogleAuth)||void 0===Q||Q,eA=null!==($=null==ed?void 0:null===(D=ed.design)||void 0===D?void 0:null===(_=D.visibility)||void 0===_?void 0:_.showMicrosoftAuth)&&void 0!==$&&$,eE=null!==(H=null==ed?void 0:null===(F=ed.design)||void 0===F?void 0:null===(M=F.visibility)||void 0===M?void 0:M.showMagicLinkAuth)&&void 0!==H&&H,eI=eN&&!eE,eB=eS||eA,ez=g.S.user.mutations.verifyInvitationToken.useMutation(),eT=g.S.user.create.user.useMutation(),eG=(0,x.dV)({currentPage:ep,studioId:eo,isCustomDomain:eu,redirectId:ea,portalPath:null==ec?void 0:ec.path}),eO=(null==ep?void 0:ep.type)==="deployment"&&(null==ed?void 0:null===(L=ed.deployments.find(e=>e.deploymentId===ep.id))||void 0===L?void 0:L.visibility)==="invite_only",eR=(null==ep?void 0:ep.type)==="deployment",eZ="invite-only"===er||eO,e_="auth"===er||eZ,eD=(0,v.i1)({portal:ec,accessGroup:em}),eM=(0,v.th)({accessGroup:eD,t:ee,trialKey:"signUp.trialBody",trialDefaultValue:"Sign up to start your free {{days}}-day trial"}),eF=(null==eD?void 0:eD.type)==="invite_only"||"invite-only"===er,eL=eF?eR?ee("signUp.privateToolTitle",{defaultValue:"Private Tool"}):ee("signUp.privatePortalTitle",{defaultValue:"Private Portal"}):ee("signUp.title",{defaultValue:"Welcome"}),eK=eF?eR?ee("signUp.privateToolBody",{defaultValue:"This tool is available by invitation only. Please create an account to continue."}):ee("signUp.privatePortalBody",{defaultValue:"This portal is available by invitation only. Please create an account to continue."}):null!=eM?eM:ee("signUp.body",{defaultValue:"Sign up to access"}),{shouldRender:eQ}=(0,G.U)({isOpen:W,onClose:Y}),e$=(Array.isArray(X.query.token)?X.query.token[0]:X.query.token)||ei||"",eH=(0,f.o)(Array.isArray(X.query.join)?X.query.join[0]:X.query.join),eW=g.S.user.get.joinLink.useQuery({token:eH},{enabled:!!eH}),eY=e$.startsWith("INVITE"),eX=g.S.user.get.invitationToken.useQuery({token:e$},{enabled:eY}),eJ=!!eX.data,e0=ew&&!eP,e1=(0,u.jr)(eh.email||el),e7=eR?ee("login.unauthorizedToolBody",{email:e1,defaultValue:"{{email}} isn't currently authorized for this tool. Please try another email or request access to continue."}):ee("login.unauthorizedPortalBody",{email:e1,defaultValue:"{{email}} isn't currently authorized for this portal. Please try another email or request access to continue."}),e4=ee("login.accessRequestSentBody",{defaultValue:"The workspace owner has been notified. You'll receive an email if access is approved."});(0,t.useEffect)(()=>{var e;let a=null===(e=eX.data)||void 0===e?void 0:e.email;a&&(ex(e=>({...e,email:a})),es(a))},[eX.data,es]),(0,t.useEffect)(()=>{W&&!eJ&&el&&ex(e=>({...e,email:e.email||el}))},[eJ,W,el]);let e5=async e=>{try{if(ek(""),ej(!1),eq(),ey(!0),eH&&!eW.isLoading&&!eW.data)throw Error("This QR invitation is invali
1d or expired.");if("email-password"!==e){et&&en&&await (0,k.signOut)({redirect:!1,callbackUrl:eG.logoutCallbackUrl}),eY&&await ez.mutateAsync({token:e$});let a=await (0,k.signIn)(e,{callbackUrl:eG.getOAuthCallbackUrl(e===O?"microsoft":"google"),redirect:!1,isInviteOnly:eZ,authAccessGroupId:null==eD?void 0:eD.accessGroupId,...eH&&{joinToken:eH}});if(null==a?void 0:a.error)throw Error(a.error);return}let{email:a,password:l,confirmPassword:i}=eh,s=a.trim().toLowerCase();if(es(s),!s||!l||!i)throw Error("All fields are required.");if(!s.includes("@")||!s.includes("."))throw Error("Invalid email address.");if(l!==i)throw Error("Passwords do not match.");(0,p.Ok)(l),await eT.mutateAsync({studioId:eo,email:s,password:l,...e$&&{token:e$},...eH&&{joinToken:eH},...eZ&&{isInviteOnly:!0},...(null==eD?void 0:eD.accessGroupId)&&{authAccessGroupId:eD.accessGroupId}}),(0,h.je)({method:"email"}),ex({email:"",password:"",confirmPassword:""}),et&&await (0,k.signOut)({redirect:!1,callbackUrl:eG.logoutCallbackUrl});let t=await (0,k.signIn)("email-password",{studioId:eo,email:s,password:l,redirect:!1,callbackUrl:eG.credentialsCallbackUrl});if(null==t?void 0:t.error)throw Error(t.error);if(eG.shouldRefreshCurrentPage){window.location.reload();return}window.location.href=eG.afterCredentialsUrl}catch(a){let e=(0,m.Z)(a);"CredentialsSignin"===e&&(e="You have entered an invalid email or password."),e.includes("Invalid email")&&(e="Invalid email address."),(0,u.xp)(e)&&(ej(!0),es((0,u.jr)(eh.email)),e=(0,u.Wr)(e)),ek((0,u.xp)(e)?"":J(e))}finally{ey(!1)}},e9=()=>{ek(""),ej(!1),eq(),ex({email:"",password:"",confirmPassword:""})},e2=async()=>{ek("");let e=(0,u.jr)(eh.email||el),a=(0,v.jw)({accessGroup:eD,currentPage:ep,studio:ed});es(e),await eC({email:e,message:a})};return eQ?(0,i.jsx)(E.Vq,{open:W,onOpenChange:Y,children:(0,i.jsxs)(E.cZ,{blocking:e_,className:(0,y.cn)("glass-color pb-12 md:max-w-[560px]",e_&&"pt-20 md:max-w-[813px]"),..."Real Head Pro"!==ef.font&&{style:{fontFamily:ef.font}},...e_&&{onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault()},children:[(0,i.jsx)(j.TX,{children:(0,i.jsxs)(E.fK,{children:[(0,i.jsx)(E.$N,{children:eL}),(0,i.jsx)(w.Be,{children:eP?e4:ew?e7:eK})]})}),!e_&&(0,i.jsx)("div",{className:"flex justify-end",children:(0,i.jsx)(A.z,{variant:"glass",size:"icon",onClick:Y,children:(0,i.jsx)(N.Z,{})})}),(0,i.jsx)("div",{className:"flex flex-col items-center",children:(0,i.jsxs)("div",{className:"flex w-full max-w-[341px] flex-col items-center",children:[(0,i.jsxs)(S.qE,{className:"h-[68px] w-[68px]",children:[(0,i.jsx)(S.F$,{src:null==ed?void 0:ed.image,alt:"".concat(null==ed?void 0:ed.name," Logo")}),(0,i.jsx)(S.Q5,{})]}),(0,i.jsxs)("div",{className:"mt-4 flex flex-col gap-2 text-center",children:[(0,i.jsxs)("h3",{className:"flex items-center justify-center gap-2 text-2xl font-semibold",children:[eF&&(0,i.jsx)(C.Z,{className:"size-6 shrink-0"}),(0,i.jsx)("span",{children:eL})]}),(0,i.jsx)("p",{className:"text-lg",children:eP?e4:ew?e7:eK})]}),eI&&!ew&&!eP&&(0,i.jsxs)("div",{className:"mt-6 flex w-full flex-col gap-2",children:[(0,i.jsx)(T.e,{id:"email",type:"email",value:eh.email,disabled:eJ,readOnly:eJ,placeholder:ee("emailPlaceholder",{defaultValue:"Email"}),onChange:e=>{eJ||(eq(),ex(a=>({...a,email:e.target.value})))},required:!0}),(0,i.jsx)(T.e,{id:"password",type:"password",value:eh.password,placeholder:ee("passwordPlaceholder",{defaultValue:"Password"}),onChange:e=>{ex(a=>({...a,password:e.target.value}))},required:!0}),(0,i.jsx)(T.e,{id:"confirm-password",type:"password",value:eh.confirmPassword,placeholder:ee("signUp.confirmPasswordPlaceholder",{defaultValue:"Confirm password"}),onChange:e=>{ex(a=>({...a,confirmPassword:e.target.value}))},onKeyDown:e=>{"Enter"===e.key&&e5("email-password")},required:!0}),(0,i.jsx)("p",{className:"px-1 text-xs leading-5 text-foreground opacity-70",children:ee("signUp.passwordRequirements",{defaultValue:"Password requirements: 8+ characters, one uppercase letter, and one number"})}),!!(eb||eV)&&(0,i.jsx)(B.$,{variant:"destructive",children:(0,i.jsx)(B.E,{value:eb||eV})})]}),(0,i.jsxs)("div",{className:"mt-6 flex w-full flex-col gap-2",children:[!!eP&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(z.z,{variant:"primary",disabled:!0,children:ee("login.accessRequestSentBtn",{defaultValue:"Request sent"})}),(0,i.jsxs)(z.z,{variant:"transparent",onClick:e9,disabled:eg||eU,className:"mt-2",children:[(0,i.jsx)(b.Z,{className:"h-4 w-4"}),ee("login.backToSignInBtn",{defaultValue:"Back to Sign in"})]})]}),e0&&(0,i.jsx)(z.z,{variant:"primary",onClick:e2,disabled:eg||eU,children:eU?ee("requestAccess.sendingBtn",{defaultValue:"Sending request..."}):ee("requestAccess.requestAccessBtn",{defaultValue:"Request access"})}),ew&&!eP&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{className:"py-1 text-center text-sm",children:ee("or",{defaultValue:"or"})}),(0,i.jsxs)(z.z,{variant:"transparent",onClick:e9,disabled:eg||eU,className:"mt-2",children:[(0,i.jsx)(b.Z,{className:"h-4 w-4"}),ee("signUp.differentEmailBtn",{defaultValue:"Sign up with a different email"})]})]}),eI&&!ew&&!eP&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(z.z,{variant:"primary",onClick:()=>e5("email-password"),disabled:eg||eU,children:ee("signUp.createAccountBtn",{defaultValue:"Create account"})}),(eB||eE)&&(0,i.jsx)("p",{className:"py-1 text-center text-sm",children:ee("or",{defaultValue:"or"})})]}),eE&&!ew&&!eP&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(z.z,{variant:"primary",onClick:()=>ev("magic-link"),disabled:eg||eU,children:[(0,i.jsx)(U.Z,{}),ee("login.loginMagicLinkBtn",{defaultValue:"Send me a magic link"})]}),eB&&(0,i.jsx)("p",{className:"py-1 text-center text-sm",children:ee("or",{defaultValue:"or"})})]}),eS&&!ew&&!eP&&(0,i.jsxs)(z.z,{variant:"primary",onClick:()=>e5("google"),disabled:eg||eU,children:[(0,i.jsx)(P.Z,{}),ee("signUp.signUpGoogleBtn",{defaultValue:"Sign up with Google"})]}),eA&&!ew&&!eP&&(0,i.jsxs)(z.z,{variant:"primary",onClick:()=>e5(O),disabled:eg||eU,children:[(0,i.jsx)(q.Z,{}),ee("signUp.signUpMicrosoftBtn",{defaultValue:"Sign up with Microsoft"})]}),!ew&&!eP&&(0,i.jsx)(I.M,{className:"mt-2 text-center text-sm [&_b]:cursor-pointer [&_b]:underline [&_b]:underline-offset-2",value:ee("signUp.loginHtml",{defaultValue:"Already have an account? <b>Sign in</b>"}),onClick:()=>ev("login")})]})]})})]})}):null}}}]);
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.