1import{r as p,j as e}from"./react-core.DJiaDNPT.js";import{u}from"./react-query.BPQxxLgJ.js";import{k as g,R as m,n as b}from"./index.CKQejW0v.js";import{l as y,x as f,aT as _,aR as j}from"./vendors.D5VPZlu6.js";import{e as k,L as w}from"./react-router.CDx91DFN.js";const N={get:async t=>{try{return(await g.get(`/oauth/interaction/${encodeURIComponent(t)}`,{headers:{Accept:"application/json"}})).data}catch(s){const a=s.response;if(a?.status===401&&a.data?.state==="login"&&typeof a.data.loginUrl=="string")return a.data;throw s}}},x=/^[A-Za-z0-9_-]{16,128}$/;function l(t,s){if(!x.test(s))return!1;try{const a=new URL(b()||"http://localhost:3000").origin,n=new URL(t);return n.origin===a&&n.pathname===`/oauth/interaction/${s}`&&!n.search&&!n.hash}catch{return!1}}function R(){const{t}=y(),[s]=k(),a=s.get("interaction")||"",n=x.test(a),i=u({queryKey:["mcp","interaction",a],queryFn:()=>N.get(a),enabled:n,staleTime:0,gcTime:0,retry:!1}),o=i.data?.state==="continue"?i.data.continueUrl:null;p.useEffect(()=>{o&&l(o,a)&&window.location.assign(o)},[o,a]);const r=i.data?.state==="consent"?i.data:null,c=r?.scopes.includes("media:submit")===!0,d=r&&l(r.submitUrl,a)?r.submitUrl:null,h=!n||i.isError||!!(o&&!l(o,a))||!!(r&&!d);return e.jsx("main",{className:"flex min-h-screen flex-col items-center justify-center bg-gray-50 px-4 py-10 dark:bg-[#0e1726]",children:e.jsxs("div",{className:"w-full max-w-lg",children:[e.jsxs("div",{className:"mb-8 flex items-center justify-center gap-3",children:[e.jsx("img",{src:"/assets/images/logo/favicon.svg",alt:"",className:"h-10 w-10"}),e.jsx("span",{className:"text-xl font-bold text-gray-900 dark:text-white",children:"UaiTec"})]}),e.jsx("div",{className:"rounded-2xl border border-gray-200 bg-white p-6 shadow-xl dark:border-gray-700 dark:bg-gray-900 sm:p-8",children:h?e.jsxs("div",{role:"alert",className:"text-center",children:[e.jsx(f,{className:"mx-auto h-10 w-10 text-amber-600","aria-hidden":"true"}),e.jsx("h1",{className:"mt-4 text-xl font-bold text-gray-900 dark:text-white",children:t("mcp_authorize_expired_title","Connection link expired")}),e.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:t("mcp_authorize_expired","This authorization link is invalid or expired. Start the connection again from your AI client.")})]}):i.isPending||o?e.jsx("div",{role:"status",className:"py-6 text-center text-sm text-gray-600 dark:text-gray-300",children:t("mcp_authorize_loading","Checking your connectionâ¦")}):i.data?.state==="login"?e.jsxs("div",{role:"alert",className:"text-center",children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900 dark:text-white",children:t("mcp_authorize_login_title","Sign in to continue")}),e.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-300",children:t("mcp_authorize_login","Your UaiTec session has ended. Sign in again, then retry the connection from your AI client.")}),e.jsx("a",{href:m.AUTH.LOGIN,className:"mt-5 inline-flex rounded-lg bg-brand-900 px-5 py-2.5 font-semibold text-white",children:t("sign_in","Sign in")})]}):r&&d?e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"h-10 w-10 text-brand-900 dark:text-brand-400","aria-hidden":"true"}),e.jsx("h1",{className:"mt-4 text-2xl font-bold text-gray-900 dark:text-white",children:t("mcp_authorize_title","Connect this AI app?")}),e.jsx("p",{className:"mt-2 break-all text-lg font-semibold text-gray-900 dark:text-white",children:r.clientName}),!r.clientVerified&&e.jsx("p",{className:"mt-2 rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-900/10 dark:text-amber-200",children:t("mcp_authorize_unverified","App name supplied by the client; verify that you opened the right app.")}),e.jsxs("div",{className:"mt-6 rounded-xl border border-gray-200 bg-gray-50 p-4 dark:border-gray-700 dark:bg-gray-800/60",children:[e.jsx("h2",{className:"font-semibold text-gray-900 dark:text-white",children:t("mcp_authorize_scope_title","Read access to your library")}),e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-gray-600 dark:text-gray-300",children:c?t("mcp_authorize_read_scope","This app can search and read recordings you own, including transcript excerpts and stored analyses."):t("mcp_authorize_scope","This app can search and read recordings you own, including transcript excerpts and stored analyses. It cannot upload, edit or delete through this connection.")})]}),c&&e.jsxs("div",{className:"mt-3 rounded-xl border border-brand-200 bg-brand-50 p-4 dark:border-brand-900 dark:bg-brand-900/10",children:[e.jsx("h2",{className:"font-semibold text-gray-900 dark:text-white",children:t("mcp_authorize_submit_title","Request media processing")}),e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-gray-600 dark:text-gray-300",children:t("mcp_authorize_submit_scope","This app can request video and audio imports. You must approve each recording and its credit cost in UaiTec before processing starts.")})]}),e.jsx("p",{className:"mt-4 text-xs leading-relaxed text-gray-500 dark:text-gray-400",children:t("mcp_authorize_note","This connection lasts up to 30 days. It stops when you disconnect the app in UaiTec, change your password or delete your account.")}),e.jsxs("form",{"aria-label":t("mcp_authorize_form","Authorize AI connection"),action:d,method:"post",className:"mt-7 flex flex-col gap-3 sm:flex-row",children:[e.jsx("input",{type:"hidden",name:"csrf",value:r.csrf}),e.jsx("button",{type:"submit",name:"decision",value:"allow",className:"flex-1 rounded-lg bg-brand-900 px-5 py-3 font-semibold text-white transition hover:bg-brand-800",children:c?t("mcp_authorize_allow_submit","Allow read and import requests"):t("mcp_authorize_allow","Allow read access")}),e.jsx("button",{type:"submit",name:"decision",value:"deny",className:"rounded-lg border border-gray-300 px-5 py-3 font-semibold text-gray-700 transition hover:bg-gray-100 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-800",children:t("mcp_authorize_deny","Cancel connection")})]})]}):null}),e.jsxs(w,{to:m.MCP.ROOT,className:"mt-6 inline-flex items-center gap-2 text-sm font-medium text-gray-600 hover:text-brand-900 dark:text-gray-400 dark:hover:text-brand-400",children:[e.jsx(j,{className:"h-4 w-4","aria-hidden":"true"}),t("mcp_authorize_back","Back to connections")]})]})})}export{R 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.