1import{d as w,r as h,f as C,j as e}from"./vendor-react-C5PewRsl.js";import{Y as b,Z as f,ag as v,a as I,E as A,a4 as i,T,i as y}from"./main-DoxpiNgY.js";import{a as E,u as P,A as S}from"./vendor-misc-DVk-0spb.js";import{M as _,a as O,b as z,c as F}from"./McpPage-DMPeWiR9.js";import"./vendor-runtime-DG-GlVKR.js";import"./index-FFROJYLR.js";import"./vendor-ui-BKWhI8D_.js";import"./vendor-icons-Nh3lIdcn.js";import"./vendor-analytics-aNB2-Vwh.js";import"./vendor-sentry-SKD9L_Jy.js";try{let s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},a=new s.Error().stack;a&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[a]="17b9e781-2304-44f5-81d6-d84a545ccf33",s._sentryDebugIdIdentifier="sentry-dbid-17b9e781-2304-44f5-81d6-d84a545ccf33")}catch{}const M=(s,a)=>a.startsWith("raycast:")?"raycast":s==="chatgpt.com"||s==="platform.openai.com"?"chatgpt":s==="claude.ai"||s==="claude.com"?"claude":"other",R=({stateId:s,onAllow:a,onDeny:o,consentMutation:r,isLoadingDetails:l,detailsError:d,consentDetails:t,confirmUntrustedClient:c,setConfirmUntrustedClient:m})=>{var x,g;return s?e.jsx(z,{children:e.jsx(F,{title:"Connect to Fyxer AI",description:"An application wants to access your Fyxer AI account",actions:e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"outline",size:"md",label:"Deny",className:"w-full flex-1",onClick:o}),e.jsx(y,{variant:"primary",size:"md",label:"Allow",className:"w-full flex-1",onClick:a,disabled:r.isPending||l||!!d||!t||!t.isTrustedClient&&!c})]}),children:e.jsxs("div",{className:"space-y-4","aria-busy":l,children:[l&&e.jsx("div",{role:"status",className:"rounded-lg border border-rb-gray-neutral bg-rb-parchment-light p-4",children:e.jsx("p",{className:"text-sm leading-normal text-rb-secondary-dark",children:"Loading app details..."})}),d&&e.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-rb-error/20 bg-rb-error/5 p-3",children:[e.jsx(i,{name:"Warning",size:16,className:"mt-0.5 text-rb-error"}),e.jsx("p",{className:"text-sm leading-normal text-rb-error",children:d})]}),t&&e.jsxs("div",{className:"rounded-lg border border-rb-gray-neutral bg-rb-white p-4 shadow-rb-shadow-soft-xs",children:[e.jsx("p",{className:"text-sm leading-[1.4] font-medium text-rb-darkbtn",children:"App"}),e.jsx("p",{className:"mt-0.5 text-sm leading-normal wrap-break-word text-rb-secondary-dark",children:t.clientName}),e.jsx("p",{className:"mt-3 text-sm leading-[1.4] font-medium text-rb-darkbtn",children:"Redirect domain"}),e.jsx("p",{className:"mt-0.5 text-sm leading-normal break-all text-rb-secondary-dark",children:t.redirectHost})]}),t&&!t.isTrustedClient&&e.jsxs("div",{className:"rounded-lg border border-rb-warning/30 bg-rb-warning/10 p-4",children:[e.jsx("p",{className:"text-sm leading-[1.4] font-medium text-rb-darkbtn",children:"External app warning"}),e.jsxs("p",{className:"mt-2 text-sm leading-normal text-rb-secondary-dark",children:["This app uses an unverified redirect domain. Only continue if you trust ",t.redirectHost,"."]}),e.jsxs("label",{className:"group/checkbox mt-3 flex cursor-pointer items-start gap-2 rounded-sm focus-within:ring-2 focus-within:ring-rb-gray-hovered focus-within:ring-offset-1 focus-within:outline-hidden",children:[e.jsx("input",{type:"checkbox",checked:c,onChange:n=>m(n.target.checked),className:"sr-only"}),e.jsx("span",{className:"mt-0.5",children:e.jsx(T,{checked:c})}),e.jsx("span",{className:"text-sm leading-normal text-rb-secondary-dark",children:"I trust this app and redirect domain."})]})]}),e.jsxs("div",{className:"rounded-lg border border-rb-gray-neutral bg-rb-parchment-light p-4",children:[e.jsx("p",{className:"text-sm leading-[1.4] font-medium text-rb-darkbtn",children:"This will allow the application to:"}),e.jsxs("ul",{className:"mt-3 space-y-2 pl-0",children:[e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(i,{name:"Check",size:18,className:"mt-0.5 shrink-0 text-rb-success"}),e.jsx("p",{className:"text-sm leading-normal text-rb-secondary-dark",children:"Search across your meetings, emails, and documents"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(i,{name:"Check",size:18,className:"mt-0.5 shrink-0 text-rb-success"}),e.jsx("p",{className:"text-sm leading-normal text-rb-secondary-dark",children:"View your meeting recordings and transcripts"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(i,{name:"Check",size:18,className:"mt-0.5 shrink-0 text-rb-success"}),e.jsx("p",{className:"text-sm leading-normal text-rb-secondary-dark",children:"Read and search emails in your inbox, including Fyxer labels"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(i,{name:"Check",size:18,className:"mt-0.5 shrink-0 text-rb-success"}),e.jsx("p",{className:"text-sm leading-normal text-rb-secondary-dark",children:"Create email drafts on your behalf"})]}),e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(i,{name:"Check",size:18,className:"mt-0.5 shrink-0 text-rb-success"}),e.jsx("p",{className:"text-sm leading-normal text-rb-secondary-dark",children:"Look up contact information from your communication history"})]})]})]}),r.isError&&e.jsxs("div",{role:"alert",className:"flex items-start gap-2 rounded-lg border border-rb-error/20 bg-rb-error/5 p-3",children:[e.jsx(i,{name:"Warning",size:16,className:"mt-0.5 text-rb-error"}),e.jsx("p",{className:"text-sm leading-normal text-rb-error",children:r.error instanceof S?((g=(x=r.error.response)==null?void 0:x.data)==null?void 0:g.message)||r.error.message:"Failed to authorize. Please try again."})]})]})})}):e.jsx(O,{title:"Invalid Request",message:"Missing OAuth state. Please try again from your AI assistant."})},V=()=>{const[s]=w(),a=b.session.string(f.MCP_OAUTH_STATE_ID),o=b.session.string(f.MCP_OAUTH_ORG_ID),r=s.get("state_id")||a.get(),l=v(),{logEvent:d}=I(),[t,c]=h.useState(!1),[m,x]=h.useState(!1),g=C(),n=E({queryKey:["mcp-consent-details",r],queryFn:()=>l.mcpOauth.getConsentDetails({stateId:r??""}),enabled:!!r}),u=P({mutationFn:l.mcpOauth.consent,onSuccess:k=>{const p=n.data;d(A.MCP_OAUTH_CONNECTED,{service:p?M(p.redirectHost,p.redirectUri):"other"}),c(!0),a.remove(),o.remove(),window.location.href=k.redirectUrl}}),j=()=>{r&&n.data&&u.mutate({stateId:r,confirmUntrustedClient:n.data.isTrustedClient?void 0:m})},N=()=>{a.remove(),o.remove(),g("/org")};return u.isPending||t?e.jsx(_,{}):e.jsx(R,{stateId:r??"",onAllow:j,onDeny:N,consentMutation:u,isLoadingDetails:n.isLoading||n.isFetching,detailsError:n.isError?"Failed to load app details. Please try again.":null,consentDetails:n.data,confirmUntrustedClient:m,setConfirmUntrustedClient:x})};export{V as McpConsentPage};
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.