1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6136],{60091:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/en/consent",function(){return t(5355)}])},65515:function(e,n,t){"use strict";t.d(n,{AP:function(){return apiSubmitConsent},V1:function(){return apiFetchConsentInfo},VE:function(){return apiRevokeActiveGrant},pf:function(){return apiFetchActiveGrants}});var o=t(1448);let apiFetchConsentInfo=async e=>{let{token:n}=e;return(0,o.A_)("/api/fe/v3/consent",{t:n}).then(e=>e.ok?e.json().then(e=>({success:!0,data:e})):404===e.status?{success:!1,error_type:"not_found"}:401===e.status?(0,o.Yg)():(0,o.xo)())},apiSubmitConsent=async e=>{let{token:n,grant:t,downselected_scopes:r,org_id:s}=e,i={t:n,consent:t};return r&&(i.downselected_scopes=r),s&&(i.org_id=s),(0,o.j0)("/api/fe/v3/consent",i).then(async e=>{if(e.ok){let n=await e.json();return{success:!0,data:{redirect_to:n.redirect_to}}}if(401===e.status)return(0,o.Yg)();let n=await e.json().then(e=>null==e?void 0:e.error_code).catch(()=>void 0);switch(n){case"too_many_grants":return{success:!1,error_type:"too_many_grants"};case"org_not_found":return{success:!1,error_type:"org_not_found"};case"resource_not_found":return{success:!1,error_type:"grant_request_not_found"}}return 403===e.status?{success:!1,error_type:"action_forbidden"}:(0,o.xo)()})},apiFetchActiveGrants=async e=>{let{page_size:n=10,page_number:t}=e;return(0,o.A_)("/api/fe/v3/grant",{page_size:n.toString(),page_number:t.toString()}).then(e=>e.ok?e.json().then(e=>({success:!0,data:e})):401===e.status?(0,o.Yg)():(0,o.xo)())},apiRevokeActiveGrant=async e=>{let{client_id:n}=e;return(0,o.Jl)("/api/fe/v3/grant",{client_id:n}).then(e=>e.ok?{success:!0}:404===e.status?{success:!1,error_type:"not_found"}:401===e.status?(0,o.Yg)():(0,o.xo)())}},5957:function(e,n,t){"use strict";t.d(n,{x:function(){return apiLogout}});var o=t(11163),r=t.n(o),s=t(1448);let apiLogout=()=>(0,s.j0)("/api/v1/logout",{}).then(e=>{e.ok?e.json().then(e=>{e.redirect_to?window.location.href=e.redirect_to:window.location.href="/"}):r().reload()})},28279:function(e,n,t){"use strict";t.d(n,{$:function(){return useLogoutHandler}});var o=t(5957),r=t(70781);let useLogoutHandler=()=>{let{posthogClient:e}=(0,r.r)(),handleLogout=async()=>{e&&e.reset(),await (0,o.x)()};return handleLogout}},5355:function(e,n,t){"use strict";t.r(n),t.d(n,{__N_SSP:function(){return A},default:function(){return en_consent}});var o=t(85893),r=t(43523),s=t(20966),i=t(95117),l=t(47037),a=t.n(l),c=t(11163),u=t(67294),d=t(65515),g=t(1448),h=t(97564),p=t(67841),m=t(64761),x=t(82623),_=t(66137),f=t(25386),k=t(79462),w=t(39686),C=t(54070),j=t(23259),b=t(34736),S=t(17789),y=t(88393),v=t(40423),L=t(92916);function useHeaderTextColor(e){let n=(0,m.rZ)();return n.colors[e?C.xR.LoginBackgroundTextColor:C.xR.LoginForegroundTextColor][6]}function useWarningTones(){let e=(0,m.rZ)();return(0,L.cB)(e,(0,L.wX)(e,C.xR.LoginForegroundColor),(0,L.wX)(e,C.xR.LoginForegroundTextColor))}let UnknownClientBadge=e=>{let{url:n,siteDisplayName:t,tooltipVariant:r}=e,s=useWarningTones(),[l,a]=(0,u.useState)(!1),c=(0,u.useRef)(),cancelClose=()=>window.clearTimeout(c.current),open=()=>{cancelClose(),a(!0)},scheduleClose=()=>{cancelClose(),c.current=window.setTimeout(()=>a(!1),150)};return(0,u.useEffect)(()=>()=>window.clearTimeout(c.current),[]),(0,o.jsxs)(j.J,{opened:l,onChange:a,position:"bottom-end",withArrow:!0,width:320,variant:r,styles:{dropdown:{backgroundColor:s.background,borderColor:s.border,color:s.text}},children:[(0,o.jsx)(j.J.Target,{children:(0,o.jsx)(b.k,{onMouseEnter:open,onMouseLeave:scheduleClose,onFocus:open,onBlur:scheduleClose,onClick:()=>{cancelClose(),a(e=>!e)},"aria-expanded":l,sx:{display:"block",flexShrink:0},children:(0,o.jsx)(S.C,{variant:"outline",size:"lg",radius:"xl",tt:"none",fw:600,sx:{color:s.text,borderColor:s.border,backgroundColor:s.background,cursor:"pointer"},children:"Unknown publisher"})})}),(0,o.jsx)(j.J.Dropdown,{onMouseEnter:cancelClose,onMouseLeave:scheduleClose,onFocusCapture:cancelClose,onBlurCapture:scheduleClose,children:(0,o.jsxs)(i.x,{sx:{overflowWrap:"break-word"},children:[t," doesn't recognize ",(0,o.jsx)("b",{children:n}),". Please double check the URL to ensure it's the destination you expect."]})})]})};var consent_ClientStatusBadge=e=>{let{domain:n,siteDisplayName:t,tooltipVariant:r}=e;return"unknown"===e.kind?(0,o.jsx)(UnknownClientBadge,{url:e.url,siteDisplayName:t,tooltipVariant:r}):(0,o.jsx)(y.u,{label:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("b",{children:n})," is on file with ",t,e.nameOnRecord?" as ".concat(e.nameOnRecord,". The name shown matches that record."):"."]}),position:"bottom-end",withArrow:!0,multiline:!0,width:320,variant:r,events:{hover:!0,focus:!0,touch:!0}
1,children:(0,o.jsx)(S.C,{variant:"outline",size:"lg",radius:"xl",tt:"none",fw:600,tabIndex:0,sx:e=>({color:e.colors[C.xR.LoginForegroundTextColor][6],borderColor:e.colors[C.xR.LoginBorderColor][6],backgroundColor:"transparent",cursor:"default",flexShrink:0}),children:"Recognized"})})},consent_ClientCard=e=>{var n;let{client:t,siteDisplayName:r,variants:s}=e,l=(0,m.rZ)(),a=useWarningTones();if(!t.domain)return null;let c={size:l.other.iconSizes.lg,style:{flexShrink:0}},u="cimd_known"===t.kind?(0,o.jsx)(f.Z,{...c,color:l.colors[C.xR.LoginSuccessButtonColor][6]}):"cimd_unknown"===t.kind?(0,o.jsx)(k.Z,{...c,color:a.icon}):(0,o.jsx)(w.Z,{...c});return(0,o.jsx)(x.X,{variant:C.kI.LoginFrameless,radius:"md",px:"lg",py:"md",children:(0,o.jsxs)(_.Z,{position:"apart",align:"center",spacing:"md",noWrap:!0,children:[(0,o.jsxs)(_.Z,{spacing:"sm",noWrap:!0,sx:{minWidth:0},children:[u,(0,o.jsx)(i.x,{fw:600,size:"lg",truncate:!0,children:t.domain})]}),"cimd_known"===t.kind&&(0,o.jsx)(consent_ClientStatusBadge,{kind:"recognized",nameOnRecord:t.name,domain:t.domain,siteDisplayName:r,tooltipVariant:s.inputPrefix}),"cimd_unknown"===t.kind&&(0,o.jsx)(consent_ClientStatusBadge,{kind:"unknown",url:null!==(n=t.clientIdUrl)&&void 0!==n?n:t.domain,domain:t.domain,siteDisplayName:r,tooltipVariant:s.inputPrefix})]})})},R=t(28855),F=t(54777),consent_SectionLabel=e=>{let{isFrameless:n,children:t}=e,r=useHeaderTextColor(n);return(0,o.jsx)(i.x,{size:"sm",fw:600,color:r,opacity:.7,tt:"uppercase",children:t})},consent_OrgSelector=e=>{let{orgMetaname:n,orgSelectData:t,selectedOrgId:r,setSelectedOrgId:s,isFrameless:i,isFramed:l,variants:a}=e,c=(0,m.rZ)(),u="Select ".concat(n.toLowerCase());return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(h.K,{spacing:"md",children:[(0,o.jsx)(consent_SectionLabel,{isFrameless:i,children:u}),(0,o.jsx)(R.Ph,{variant:a.inputPrefix,placeholder:u,data:t,value:r,onChange:s,"aria-label":u})]}),l&&(0,o.jsx)(F.i,{my:"md",mx:"calc(-1 * ".concat(c.spacing.xl,")")})]})},z=t(64523),T=t(56485),O=t(17010);let I="An application",M=/[\u202A-\u202E\u2066-\u2069]/g,cleanClientString=e=>{if(!e)return null;let n=e.replace(M,"").trim();return n.length>0?n:null},parseUrl=e=>{try{return new URL(e)}catch(e){return null}},isHttpProtocol=e=>"http:"===e||"https:"===e,isCimdClientId=e=>{var n;return(null===(n=parseUrl(e))||void 0===n?void 0:n.protocol)==="https:"},getHttpUrlHostname=e=>{if(!e)return null;let n=parseUrl(e);return n&&isHttpProtocol(n.protocol)&&n.hostname?n.hostname:null},isRedirectOutsideSite=(e,n)=>{let t=getHttpUrlHostname(e),o=getHttpUrlHostname(n);return!!t&&!!o&&t!==o&&!t.endsWith(".".concat(o))},getHttpUrlHost=e=>{if(!e)return null;let n=parseUrl(e);return n&&isHttpProtocol(n.protocol)&&n.host?n.host:null},getClientPresentation=e=>{var n;let t=cleanClientString(e.client_name);if(!isCimdClientId(e.client_id))return{kind:"registered",name:t,displayName:null!=t?t:I,domain:null,clientIdUrl:null,redirectsOffSite:!1};let o=e.client_id,r=getHttpUrlHost(o),s=e.cimd_known_client?cleanClientString(e.cimd_known_client_name):t;return{kind:e.cimd_known_client?"cimd_known":"cimd_unknown",name:s,displayName:null!==(n=null!=s?s:r)&&void 0!==n?n:I,domain:r,clientIdUrl:o,redirectsOffSite:isRedirectOutsideSite(e.redirect_uri,o)}},getConsentSubject=e=>e?"cimd_unknown"!==e.kind?e.displayName:e.name?"An app calling itself â".concat(e.name,"â"):e.domain?"An app at ".concat(e.domain):I:I,getConsentSubtitle=e=>{let{client:n,isOrgScopeFlow:t,orgMetaname:o,siteDisplayName:r}=e,s=t?"your ".concat(o.toLowerCase()," on ").concat(r):"your ".concat(r," account");return"".concat(getConsentSubject(n)," wants permission to access ").concat(s)},formatRedirectTarget=e=>{let n=e.trim(),t=parseUrl(n);if(!t)return{host:n,path:""};let o="/"===t.pathname?"":t.pathname;return isHttpProtocol(t.protocol)?{host:t.host,path:o}:t.host?{host:"".concat(t.protocol,"//").concat(t.host),path:o}:{host:n,path:""}},Callout=e=>{let{tone:n,children:t}=e,r=(0,m.rZ)(),s=useWarningTones(),i=r.colors[C.xR.LoginForegroundTextColor][6],l="warning"===n?s:{background:r.colors[C.xR.LoginForegroundColor][6],border:r.colors[C.xR.LoginBorderColor][6],text:i,icon:r.fn.rgba(i,.7)},a="warning"===n?T.Z:O.Z;return(0,o.jsx)(z.x,{mb:"md",sx:{border:"1px solid ".concat(l.border),backgroundColor:l.background,color:l.text,borderRadius:r.radius.md,padding:"".concat(r.spacing.md," ").concat(r.spacing.lg),overflowWrap:"anywhere"},children:(0,o.jsxs)(_.Z,{spacing:"sm",noWrap:!0,align:"flex-start",children:[(0,o.jsx)(a,{size:r.other.iconSizes.lg,color:l.icon,style:{flexShrink:0,marginTop:2}}),t]})})};var consent_RedirectNotice=e=>{let{redirectUri:n,isLocal:t,isOffSite:r,clientName:s,clientDomain:l}=e,{host:a,path:c}=formatRedirectTarget(n),u=(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("b",{children:a}),c]});return t?(0,o.jsx)(Callout,{tone:"warning",children:(0,o.jsxs)(i.x,{children:["You'll return to ",u,", an app on your computer."," ",s?(0,o.jsxs)(o.Fragment,{children:["Only approve if you just started this from"," ",(0,o.jsx)("b",{children:s}),"."]}):"Only approve if you just started this yourself."]}
1)}):r&&l?(0,o.jsx)(Callout,{tone:"warning",children:(0,o.jsxs)(i.x,{children:["You'll return to ",u,", which is not part of"," ",l,"."]})}):(0,o.jsx)(Callout,{tone:"neutral",children:(0,o.jsxs)(i.x,{children:["You'll return to ",u]})})};function scopeSelectionReducer(e,n){switch(n.kind){case"toggle":{if("all_selected"===e.kind){let e=new Set(n.selectableSlugs);return e.delete(n.slug),{kind:"custom",selectedSlugs:e}}let t=new Set(e.selectedSlugs);if(t.has(n.slug)?t.delete(n.slug):t.add(n.slug),t.size===n.selectableSlugs.length)return{kind:"all_selected"};return{kind:"custom",selectedSlugs:t}}case"restrictTo":{let t=new Set(n.selectableSlugs);if("all_selected"===e.kind)return{kind:"all_selected"};let o=new Set;if(e.selectedSlugs.forEach(e=>{t.has(e)&&o.add(e)}),o.size===n.selectableSlugs.length)return{kind:"all_selected"};return{kind:"custom",selectedSlugs:o}}}}var P=t(38078),consent_ScopeRow=e=>{let{scope:n,isFrameless:t,variants:r,disabled:s,checked:l,onToggle:a,orgMetaname:c}=e,u=useHeaderTextColor(t),d=(0,o.jsx)(z.x,{component:"label",sx:e=>({display:"block",cursor:s?"default":"pointer",borderRadius:e.radius.sm,opacity:s?.5:1,transition:"background-color 100ms ease","&:hover":s?void 0:{backgroundColor:e.fn.rgba(u,.08)}}),children:(0,o.jsxs)(_.Z,{spacing:"lg",px:"md",noWrap:!0,children:[(0,o.jsx)(P.X,{variant:r.inputPrefix,disabled:s,checked:l,onChange:a,"aria-label":n.display_name}),(0,o.jsxs)(h.K,{spacing:"xs",children:[(0,o.jsx)(i.x,{fw:500,children:n.display_name}),(0,o.jsx)(i.x,{size:"sm",children:n.description})]})]})});return s?(0,o.jsx)(y.u,{label:"Your role in this ".concat(c.toLowerCase()," can't grant \"").concat(n.display_name,'".'),position:"top",withArrow:!0,multiline:!0,width:260,children:(0,o.jsx)("div",{children:d})}):d},consent_ScopeList=e=>{let{consentInfo:n,scopeSelection:t,dispatchScopeSelection:r,selectableSlugs:s,isScopeDisabledForOrg:l,isFrameless:a,variants:c,orgMetaname:u}=e,d=n.scopes.length>0;if(!d)return n.scopeless_permission_message?(0,o.jsx)(i.x,{children:n.scopeless_permission_message}):null;let g=n.scopes.filter(e=>e.is_org_scope),p=n.scopes.filter(e=>!e.is_org_scope),renderRow=e=>{var n;let i=l(e.slug,e.is_org_scope);return(0,o.jsx)(consent_ScopeRow,{scope:e,isFrameless:a,variants:c,disabled:i,checked:!i&&(n=e.slug,"all_selected"===t.kind||t.selectedSlugs.has(n)),onToggle:()=>r({kind:"toggle",slug:e.slug,selectableSlugs:s}),orgMetaname:u},e.slug)};return(0,o.jsxs)(o.Fragment,{children:[g.length>0&&(0,o.jsxs)(h.K,{spacing:"md",children:[(0,o.jsx)(consent_SectionLabel,{isFrameless:a,children:"For your ".concat(u.toLowerCase())}),g.map(renderRow)]}),p.length>0&&(0,o.jsxs)(h.K,{spacing:"md",children:[(0,o.jsx)(consent_SectionLabel,{isFrameless:a,children:"For your account"}),p.map(renderRow)]})]})},consent_ConsentForm=e=>{let{consentInfo:n,client:t,siteDisplayName:r,scopeSelection:s,dispatchScopeSelection:l,selectableSlugs:a,isScopeDisabledForOrg:c,orgMetaname:u,isFrameless:d,isFramed:g,variants:m,isSubmitting:x,onSubmit:_,orgSelector:f}=e,k=n.scopes.length>0,w=k||!!n.scopeless_permission_message,C=!!f&&!f.selectedOrgId;return(0,o.jsxs)(h.K,{spacing:"lg",children:[(0,o.jsx)(consent_ClientCard,{client:t,siteDisplayName:r,variants:m}),f&&(0,o.jsx)(consent_OrgSelector,{orgMetaname:u,orgSelectData:f.orgSelectData,selectedOrgId:f.selectedOrgId,setSelectedOrgId:f.setSelectedOrgId,isFrameless:d,isFramed:g,variants:m}),w&&(0,o.jsxs)(h.K,{spacing:"lg",children:[k&&(0,o.jsx)(i.x,{size:"lg",children:"By authorizing, you give it access to the following:"}),(0,o.jsx)(h.K,{spacing:"lg",children:(0,o.jsx)(consent_ScopeList,{consentInfo:n,scopeSelection:s,dispatchScopeSelection:l,selectableSlugs:a,isScopeDisabledForOrg:c,isFrameless:d,variants:m,orgMetaname:u})})]}),(0,o.jsxs)(h.K,{children:[(0,o.jsx)(consent_RedirectNotice,{redirectUri:n.redirect_uri,isLocal:n.is_local_redirect,isOffSite:t.redirectsOffSite,clientName:t.name,clientDomain:t.domain}),(0,o.jsx)(p.z,{variant:m.primary,onClick:()=>_(!0),loading:x,disabled:C,children:"Authorize"}),(0,o.jsx)(p.z,{variant:m.outline,onClick:()=>_(!1),loading:x,children:"Deny"})]})]})},H=t(54685),N=t(28279),consent_LoggedInFooter=e=>{let{email:n,isSplit:t}=e,r=(0,N.$)(),s=t?C.xR.LoginForegroundTextColor:C.xR.LoginBackgroun
1dTextColor,l=t?C.kI.Login:C.kI.LoginFrameless;return(0,o.jsxs)(i.x,{color:s,size:"lg",align:"center",children:[n&&(0,o.jsxs)(o.Fragment,{children:["Logged in as ",(0,o.jsx)("b",{children:n}),"."," "]}),(0,o.jsx)(H.e,{component:"button",type:"button",variant:l,fw:500,size:"lg",onClick:r,children:"Log out"})]})},consent_RedirectingView=e=>{let{redirectUrl:n,clientName:t,variants:r,isFrameless:s}=e,l=useHeaderTextColor(s),[a,c]=(0,u.useState)(5);(0,u.useEffect)(()=>{if(a<=0)return;let e=setTimeout(()=>c(a-1),1e3);return()=>clearTimeout(e)},[a]);let d=a>0;return(0,o.jsxs)(h.K,{spacing:"lg",align:"center",children:[(0,o.jsxs)(i.x,{size:"lg",align:"center",children:["You are being redirected back to ",t,"."]}),(0,o.jsx)(i.x,{size:"md",align:"center",color:l,opacity:.7,children:d?"If you haven't been redirected in ".concat(a," second").concat(1!==a?"s":"",", you can manually redirect by clicking the button below."):"If you were successfully redirected, you can now close this page."}),(0,o.jsx)(p.z,{variant:r.primary,onClick:()=>{window.location.href=n},disabled:d,children:d?"Redirect to ".concat(t):"Click here to redirect manually"})]})},B=t(19236),consent_StatusMessage=e=>{let{title:n,children:t,action:r}=e;return(0,o.jsxs)(h.K,{spacing:"lg",align:"center",children:[n&&(0,o.jsx)(B.D,{order:1,fz:22,align:"center",color:C.xR.ErrorButtonColor,children:n}),(0,o.jsx)(i.x,{size:"lg",align:"center",children:t}),r&&(0,o.jsx)(p.z,{variant:r.variants.outline,onClick:r.onClick,loading:r.loading,fullWidth:!0,children:r.label})]})},U=t(31908);let submitErrorMessage=(e,n)=>{switch(e.error_type){case"unauthorized":return"You must be logged in to continue";case"grant_request_not_found":return"Invalid or expired consent request";case"org_not_found":return"You do not belong to the selected ".concat(n.toLowerCase());case"action_forbidden":return"You do not have permission to manage connections for this ".concat(n.toLowerCase());default:return g.aK}};var A=!0,en_consent=e=>{var n;let{pageConfig:t}=e,l=(0,c.useRouter)(),[h,p]=(0,u.useState)(""),[m,x]=(0,u.useState)(!1),[_,f]=(0,u.useState)(!1),[k,w]=(0,u.useState)(!1),[j,b]=(0,u.useState)(null),[S,y]=(0,u.useState)(null),[L,R]=(0,u.useState)(!1),[F,z]=(0,u.useState)(null),[T,O]=(0,u.useReducer)(scopeSelectionReducer,{kind:"all_selected"}),{isOrgScopeFlow:M,eligibleOrgs:P,hasAnyOrgs:H,orgSelectData:N,selectedOrgId:B,setSelectedOrgId:A,isScopeDisabledForOrg:E,selectableSlugs:Y}=function(e){var n,t,o;let{consentInfo:r,allOrgs:s}=e,[i,l]=(0,u.useState)(null),a=null!==(n=null==r?void 0:r.scopes.some(e=>e.is_org_scope))&&void 0!==n&&n,c=null!==(t=null==r?void 0:r.org_id_to_role_and_permissions)&&void 0!==t?t:{},d=(0,u.useMemo)(()=>a?(null!=s?s:[]).filter(e=>{let n=c[e.id];return void 0!==n&&n.length>0}):[],[a,s,c]),g=(0,u.useMemo)(()=>d.map(e=>({label:e.name,value:e.id})),[d]);(0,u.useEffect)(()=>{1===d.length&&l(d[0].id)},[d]);let h=(0,u.useMemo)(()=>{if(!a||!i)return null;let e=c[i];return e?new Set(e):new Set},[a,i,c]),p=(0,u.useCallback)((e,n)=>a&&!!i&&n&&null!==h&&!h.has(e),[a,i,h]),m=(0,u.useMemo)(()=>{var e;return(null!==(e=null==r?void 0:r.scopes)&&void 0!==e?e:[]).filter(e=>!p(e.slug,e.is_org_scope)).map(e=>e.slug)},[r,p]),x=(null!==(o=null==s?void 0:s.length)&&void 0!==o?o:0)>0;return{isOrgScopeFlow:a,eligibleOrgs:d,hasAnyOrgs:x,orgSelectData:g,selectedOrgId:i,setSelectedOrgId:l,isScopeDisabledForOrg:p,selectableSlugs:m}}({consentInfo:j,allOrgs:t.all_orgs}),{isFrameless:q,isFramed:Z,isSplit:D}=function(e){let n=e.theme.login_ui_theme===v.gq.Frameless,t=e.theme.login_ui_theme===v.gq.Frame,o=e.theme.login_ui_theme===v.gq.SplitScreen;return{isFrameless:n,isFramed:t,isSplit:o}}(t),W=q?{primary:C.Bq.LoginFramelessPrimary,outline:C.Bq.LoginFramelessOutline,inputPrefix:C.kI.LoginFrameless}:{primary:C.Bq.LoginPrimary,outline:C.Bq.LoginOutline,inputPrefix:C.kI.Login},K=useHeaderTextColor(q),V=t.orgs_metaname||"Organization";(0,u.useEffect)(()=>{l.query.t&&a()(l.query.t)?(p(l.query.t),x(!1),l.replace(l.pathname,void 0,{shallow:!0})):x(!0)},[]),(0,u.useEffect)(()=>{h&&(f(!0),(0,d.V1)({token:h}).then(e=>{e.success?b(e.data):"not_found"===e.error_type?y("Invalid or expired consent request"):"unauthorized"===e.error_type?y("You must be logged in to continue"):y(g.aK)}).finally(()=>f(!1)))},[h]),(0,u.useEffect)(()=>{M&&B&&O({kind:"restrictTo",selectableSlugs:Y})},[B]);let handleSubmit=async e=>{w(!0);let n=await (0,d.AP)({token:h,grant:e,downselected_scopes:e?"custom"===T.kind?Y.filter(e=>T.selectedSlugs.has(e)):Y:void 0,org_id:M&&null!=B?B:void 0});if(w(!1),n.success){z(n.data.redirect_to),window.location.href=n.data.redirect_to;return}if("too_many_grants"===n.error_type){R(!0),setTimeout(()=>l.push("/account/ai_integrations"),5e3);return}y(submitErrorMessage(n,V))},G=(0,u.useMemo)(()=>j?getClientPresentation(j):null,[j]),X=null!==(n=null==G?void 0:G.displayName)&&void 0!==n?n:I,J=F?{kind:"redirecting",url:F}:m?{kind:"badToken"}:_?{kind:"loading"}:L?{kind:"tooManyGrants"}:S?{kind:"error",message:S}
1:j&&G?M&&0===P.length?{kind:"ineligibleOrgs",hasAnyOrgs:H}:{kind:"form",consentInfo:j,client:G}:{kind:"loading"},$="badToken"===J.kind||"error"===J.kind||"tooManyGrants"===J.kind,Q=$?"":"redirecting"===J.kind?"Redirecting...":"Authorization Request",ee=$||"redirecting"===J.kind?void 0:getConsentSubtitle({client:G,isOrgScopeFlow:M,orgMetaname:V,siteDisplayName:t.site_display_name});return(0,o.jsx)(U.ZP,{pageConfig:t,pageTitle:"Consent",title:Q,subtitle:ee,bottomChild:(0,o.jsx)(consent_LoggedInFooter,{email:t.email,isSplit:D}),maxTitleWidth:"500px",children:(()=>{switch(J.kind){case"loading":return(0,o.jsx)(r.M,{children:(0,o.jsx)(s.a,{color:C.xR.LoginSuccessButtonColor,size:"lg"})});case"badToken":return(0,o.jsx)(consent_StatusMessage,{title:"Missing consent token",children:"Please try starting the authorization flow again."});case"error":return(0,o.jsx)(consent_StatusMessage,{title:"Something went wrong",children:J.message});case"tooManyGrants":return(0,o.jsxs)(consent_StatusMessage,{children:[(0,o.jsx)(i.x,{size:"md",align:"center",children:"You have too many active connections. You will need to remove some before you can continue."}),(0,o.jsx)(i.x,{size:"md",align:"center",color:K,opacity:.7,children:"Redirecting you to manage your connections..."})]});case"redirecting":return(0,o.jsx)(consent_RedirectingView,{redirectUrl:J.url,clientName:X,variants:W,isFrameless:q});case"ineligibleOrgs":return(0,o.jsx)(consent_StatusMessage,{title:J.hasAnyOrgs?"Unable to authorize":"No ".concat(V.toLowerCase()),action:{label:"Cancel",onClick:()=>handleSubmit(!1),loading:k,variants:W},children:J.hasAnyOrgs?"You do not have permission to manage connections for any ".concat(V.toLowerCase(),". Please contact your ").concat(V.toLowerCase()," administrator."):"You do not belong to any ".concat(V.toLowerCase(),". You need to join one before you can authorize this request.")});case"form":return(0,o.jsx)(consent_ConsentForm,{consentInfo:J.consentInfo,client:J.client,siteDisplayName:t.site_display_name,scopeSelection:T,dispatchScopeSelection:O,selectableSlugs:Y,isScopeDisabledForOrg:E,orgMetaname:V,isFrameless:q,isFramed:Z,variants:W,isSubmitting:k,onSubmit:handleSubmit,orgSelector:M?{orgSelectData:N,selectedOrgId:B,setSelectedOrgId:A}:void 0})}})()})}}},function(e){e.O(0,[3972,7248,3068,9748,9774,2888,179],function(){return e(e.s=60091)}),_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.