1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2742],{5948:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>f});var a=n(26514),i=n(75834),l=n(46225),r=n(63052),s=n(76575),o=n(41429),c=n(73755),u=n(61968),d=n(45549),h=n(44525),p=n(86307);let m=()=>{var e,t,n;let d=(0,l.useRouter)(),m=(0,s.useSelector)(c.WV),f=(0,s.useSelector)(u.VM),[y,w]=(0,i.useState)(null),[x,g]=(0,i.useState)("This application"),[_,j]=(0,i.useState)(!1),[v,N]=(0,i.useState)(null),S=(0,o.T$)(d.query.scope),b="string"==typeof d.query.resource?d.query.resource:null,R=!1;if(b)try{R="/admin/mcp"===new URL(b).pathname}catch(e){}let k=R&&S.includes("founder:analytics:read");(0,i.useEffect)(()=>{w((0,o.J8)((0,o.zH)(d.asPath)))},[d.asPath]),(0,i.useEffect)(()=>{let e="string"==typeof d.query.client_id?d.query.client_id:null;e&&fetch("/api/better-auth/oauth2/public-client?client_id=".concat(encodeURIComponent(e)),{credentials:"same-origin"}).then(e=>e.ok?e.json():null).then(e=>{if((null==e?void 0:e.client_name)||(null==e?void 0:e.name)){var t;g(null!=(t=e.client_name)?t:e.name)}}).catch(()=>null)},[d.query.client_id]);let A=async e=>{j(!0),N(null);try{let t=(0,o.zH)(d.asPath),n=await fetch("/api/better-auth/oauth2/consent?".concat(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({accept:e,oauth_query:t})}),a=await n.json().catch(()=>({}));if(!n.ok||!a.url)throw Error("Unable to save consent");if(e&&(null==f?void 0:f.id))try{r.Ay.identify(f.id),r.Ay.capture("mcp_oauth_grant_created",{},{transport:"sendBeacon",send_instantly:!0})}catch(e){}window.location.assign(a.url)}catch(e){N("We could not finish authorization. Return to RootNote and try connecting again."),j(!1)}};return(0,a.jsx)("div",{className:"container flex max-w-2xl items-center justify-center px-4 py-8",children:(0,a.jsxs)(p.Zp,{className:"w-full max-w-lg",children:[(0,a.jsxs)(p.aR,{children:[(0,a.jsxs)(p.ZB,{children:["Authorize ",x]}),(0,a.jsx)(p.BT,{children:k?"Review the administrator account this founder analytics connection will use.":"Review the RootNote account and workspace this connection will use."})]}),(0,a.jsxs)(p.Wu,{className:"space-y-5",children:[(0,a.jsxs)("div",{className:"bg-muted rounded-md p-4 text-sm",children:[(0,a.jsxs)("p",{children:[(0,a.jsx)("span",{className:"font-medium",children:"Account:"})," ",null!=(t=null==m||null==(e=m.attributes)?void 0:e.email)?t:"Signed-in RootNote account"]}),!k&&(0,a.jsxs)("p",{children:[(0,a.jsx)("span",{className:"font-medium",children:"Workspace:"})," ",null!=(n=null==y?void 0:y.name)?n:"Selected RootNote workspace"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"mb-2 text-sm font-medium",children:"This application will be able to:"}),(0,a.jsx)("ul",{className:"list-disc space-y-1 pl-5 text-sm",children:S.map(e=>{var t;return(0,a.jsx)("li",{children:null!=(t=o.pZ[e])?t:e},e)})})]}),v&&(0,a.jsx)("p",{className:"text-destructive text-sm",children:v}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(h.$,{variant:"outline",disabled:_,onClick:()=>A(!1),children:"Cancel"}),(0,a.jsx)(h.$,{disabled:_,onClick:()=>A(!0),children:_?"Authorizingâ¦":"Authorize"})]})]})]})})};m.getLayout=function(e){return(0,a.jsx)(d.Dt,{allowSignUp:!1,children:e})};let f=m},41429:(e,t,n)=>{"use strict";n.d(t,{A8:()=>u,J8:()=>c,T$:()=>s,pZ:()=>l,zH:()=>r});let a="rootnote.oauth.workspace",i=new Set(["sig","exp","ba_iat","ba_pl","ba_param"]),l={openid:"Confirm your RootNote identity",profile:"View your name and profile",email:"View your email address",offline_access:"Stay connected until you revoke access","creators:read":"View creators in the selected workspace","connections:read":"View connected platforms and accounts","analytics:read":"View creator performance and analytics","founder:analytics:read":"View aggregate RootNote business analytics"};function r(e){var t;return null!=(t=e.split("?")[1])?t:""}function s(e){var t;let n=Array.isArray(e)?e[0]:e;return null!=(t=null==n?void 0:n.split(" ").filter(Boolean))?t:[]}function o(e){let t=new URLSearchParams(e),n=new URLSearchParams;return[...t.entries()].filter(e=>{let[t]=e;return!i.has(t)}).sort((e,t)=>
1{let[n,a]=e,[i,l]=t;return n===i?a.localeCompare(l):n.localeCompare(i)}).forEach(e=>{let[t,a]=e;return n.append(t,a)}),n.toString()}function c(e){try{let t=sessionStorage.getItem(a);if(!t)return null;let n=JSON.parse(t)[o(e)];return"string"==typeof(null==n?void 0:n.id)&&"string"==typeof(null==n?void 0:n.name)?{id:n.id,name:n.name}:null}catch(e){return null}}function u(e,t){let n={};try{var i;let e=JSON.parse(null!=(i=sessionStorage.getItem(a))?i:"{}");e&&"object"==typeof e&&!Array.isArray(e)&&(n=e)}catch(e){}n[o(e)]=t;try{sessionStorage.setItem(a,JSON.stringify(n))}catch(e){}}},54118:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/oauth/consent",function(){return n(5948)}])}},e=>{e.O(0,[2700,9104,5549,636,6593,8792],()=>e(e.s=54118)),_N_E=e.O()}]); 2//# sourceMappingURL=consent-f61833f598b64e99.js.map
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.