1import{r as a,j as e}from"./index-DH5upCF_.js";import{a as S}from"./use-auth-TPfIq22b.js";import{u as E,f as p}from"./input-oK072vMW.js";import{b as x}from"./config-B8zMtmCX.js";import{B as j}from"./button-DRwdnOf9.js";import{C as w,a as g,b as y,c as N,d as P,e as T}from"./card-COBNvZIR.js";import{P as k}from"./PublicApp-C94JQdiF.js";import{S as b}from"./shield-check-CdZZ1I9f.js";import"./sentry-DoNcH3Vn.js";import"./debug-build-BZhfLEvF.js";import"./index-yGfRD_RY.js";import"./PortalContainerContext-DsHXnBUx.js";import"./toaster-3b2j57VQ.js";import"./pageSeo-DeapDCuy.js";import"./plus-Ca8ZhgW-.js";import"./tooltip-B9BzJlgz.js";import"./index-CevOZgwC.js";import"./index-CWubf9D8.js";import"./form-Cc47hsiL.js";import"./check-Cd8ZD35G.js";const q={read:"Read your meetings, transcripts and action items"};function X(){var f;const{userData:s,isLoading:n}=S(),{toast:o}=E(),[c,v]=a.useState(null),[C,d]=a.useState(!0),[l,u]=a.useState(!1),r=new URLSearchParams(window.location.search).get("request_id");a.useEffect(()=>{if(!n){if(!s){window.location.href=`/oauth/login?returnTo=${encodeURIComponent(window.location.href)}`;return}if(!r){d(!1);return}(async()=>{try{const t=await p("GET",x(`/mcp/auth/consent/${r}`));v(await t.json())}catch(t){o({title:"Authorization request unavailable",description:t instanceof Error?t.message:"This request may have expired.",variant:"destructive"})}finally{d(!1)}})()}},[n,s,r,o]);const h=async t=>{if(r){u(!0);try{const i=await(await p("POST",x(`/mcp/auth/consent/${r}`),{decision:t})).json();if(i!=null&&i.redirect){window.location.href=i.redirect;return}throw new Error("No redirect returned")}catch(m){o({title:"Something went wrong",description:m instanceof Error?m.message:"Please try again.",variant:"destructive"}),u(!1)}}};return n||C?e.jsx("div",{className:"flex min-h-screen items-center justify-center",children:e.jsx(k,{size:"md",useLockup:!0})}):c?e.jsx("div",{className:"flex min-h-screen items-center justify-center p-4",children:e.jsxs(w,{className:"w-full max-w-md",children:[e.jsxs(g,{className:"text-center",children:[e.jsx(b,{className:"mx-auto mb-3 h-6 w-6 text-black"}),e.jsxs(y,{children:[c.client_name," wants to access your Bridge account"]}),e.jsxs(N,{children:["Signed in as ",(f=s==null?void 0:s.user)==null?void 0:f.email]})]}),e.jsxs(P,{children:[e.jsx("p",{className:"mb-2 text-sm font-medium",children:"This will allow it to:"}),e.jsx("ul",{className:"space-y-2",children:c.scopes.map(t=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[e.jsx(b,{className:"mt-0.5 h-4 w-4 shrink-0 text-black"}),e.jsx("span",{children:q[t]||t})]},t))})]}),e.jsxs(T,{className:"flex gap-3",children:[e.jsx(j,{variant:"outline",className:"flex-1 rounded-full",disabled:l,onClick:()=>h("deny"),children:"Deny"}),e.jsx(j,{className:"flex-1 rounded-full bg-[#202020] text-white hover:bg-[#2a2a2a]",disabled:l,onClick:()=>h("approve"),children:l?"Authorizingâ¦":"Approve"})]})]})}):e.jsx("div",{className:"flex min-h-screen items-center justify-center p-4",children:e.jsx(w,{className:"w-full max-w-md",children:e.jsxs(g,{children:[e.jsx(y,{children:"Request not found"}),e.jsx(N,{children:"This authorization request is invalid or has expired. Please start the connection again from your app."})]})})})}export{X as default};
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.