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