1import{j as e}from"./vendor-query-CtIF-MNZ.js";import{j as I,r as x}from"./vendor-react-BfTl68nP.js";import{s as O,B as p,R as S}from"./index-BfEqxQPi.js";import{S as f}from"./SEOHead-CywBROiR.js";import{a8 as k,aI as F}from"./vendor-icons-hHTr3Gms.js";import"./vendor-radix-q0rzatl0.js";import"./constants-Beo90Mnx.js";function N(){return O.auth.oauth??null}function _(r){return Array.isArray(r.scopes)&&r.scopes.length?r.scopes:typeof r.scope=="string"&&r.scope.trim()?r.scope.trim().split(/\s+/):[]}const E={openid:"Verify your identity",email:"See your email address",profile:"See your basic profile"};function U(){var j,w,y;const[r]=I(),o=r.get("authorization_id")??"",[c,v]=x.useState(null),[b,n]=x.useState(null),[h,u]=x.useState(!1);x.useEffect(()=>{let s=!0;return(async()=>{if(!o){n("Missing authorization_id");return}const a=N();if(!a){n("OAuth authorization is unavailable in this build.");return}const{data:i}=await O.auth.getSession();if(!i.session){const C=window.location.pathname+window.location.search;window.location.href="/auth?next="+encodeURIComponent(C);return}const{data:m,error:l}=await a.getAuthorizationDetails(o);if(!s)return;if(l){n(l.message);return}const t=m??null,V=(t==null?void 0:t.redirect_url)??(t==null?void 0:t.redirect_to);if(V&&!(t!=null&&t.client)){window.location.href=V;return}v(t)})(),()=>{s=!1}},[o]);async function g(s){u(!0),n(null);const a=N();if(!a){u(!1),n("OAuth authorization is unavailable in this build.");return}const{data:i,error:m}=s?await a.approveAuthorization(o):await a.denyAuthorization(o);if(m){u(!1),n(m.message);return}const l=(i==null?void 0:i.redirect_url)??(i==null?void 0:i.redirect_to);if(!l){u(!1),n("No redirect returned by the authorization server.");return}window.location.href=l}if(b)return e.jsxs("div",{className:"min-h-screen bg-[#FAFAF8] flex items-center justify-center px-4",children:[e.jsx(f,{title:"Authorization error â VOVV.AI",description:"OAuth authorization for VOVV.AI.",noindex:!0}),e.jsxs("div",{className:"max-w-md w-full rounded-2xl border border-[#ece9e3] bg-white p-8 text-center",children:[e.jsx(k,{className:"w-10 h-10 mx-auto mb-4 text-destructive"}),e.jsx("h1",{className:"text-xl font-semibold text-foreground mb-2",children:"Could not load this request"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:b}),e.jsx(p,{variant:"outline",onClick:()=>window.history.back(),children:"Go back"})]})]});if(!c)return e.jsxs(e.Fragment,{children:[e.jsx(f,{title:"Connecting⦠â VOVV.AI",description:"OAuth authorization for VOVV.AI.",noindex:!0}),e.jsx(S,{fullScreen:!0})]});const d=((j=c.client)==null?void 0:j.name)??"An external app",z=((y=(w=c.client)==null?void 0:w.redirect_uris)==null?void 0:y[0])??c.redirect_uri??"â",A=_(c);return e.jsxs("div",{className:"min-h-screen bg-[#FAFAF8] flex items-center justify-center px-4 py-16",children:[e.jsx(f,{title:`Connect ${d} â VOVV.AI`,description:"OAuth authorization for VOVV.AI.",noindex:!0}),e.jsxs("div",{className:"max-w-md w-full rounded-2xl border border-[#ece9e3] bg-white p-8",children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.2em] text-muted-foreground mb-3",children:"Authorize access"}),e.jsxs("h1",{className:"text-2xl font-semibold text-foreground tracking-[-0.02em] mb-3",children:["Connect ",d," to VOVV.AI"]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:[d," will be able to call VOVV.AI's enabled tools while you're signed in â reading your products, generated images, brand profiles, and credit balance as you."]}),e.jsxs("div",{className:"rounded-xl border border-[#ece9e3] bg-[#FAFAF8] p-4 mb-6 space-y-3",children:[e.jsxs("div",{className:"text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-semibold text-foreground/80",children:"Redirects to:"}),e.jsx("br",{}),e.jsx("span",{className:"break-all",children:z})]}),A.length>0&&e.jsx("ul",{className:"space-y-1.5 pt-1",children:A.map(s=>e.jsxs("li",{className:"flex items-start gap-2 text-xs text-foreground/85",children:[e.jsx(F,{className:"w-3.5 h-3.5 text-primary shrink-0 mt-0.5"}),e.jsx("span",{children:E[s]??`Additional permission: ${s}`})]},s))})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground leading-relaxed mb-6",children:"This does not bypass VOVV.AI's permissions. Exter
1nal access always acts as your account and respects the same data rules as when you use the app."}),e.jsxs("div",{className:"flex flex-col-reverse sm:flex-row gap-2 sm:gap-3",children:[e.jsx(p,{variant:"outline",onClick:()=>g(!1),disabled:h,className:"w-full",children:"Cancel connection"}),e.jsx(p,{onClick:()=>g(!0),disabled:h,className:"w-full",children:h?"Workingâ¦":`Approve ${d}`})]})]})]})}export{U 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.