1import{q as y,r as c,s as g,j as e,v as C,z as v,l as z,F as S,B as w}from"./index-BLS9OhwZ.js";const u=()=>g.auth.oauth,E=()=>{var f;const[j]=y(),n=j.get("authorization_id")??"",[a,N]=c.useState(null),[d,i]=c.useState(null),[m,l]=c.useState(!1);c.useEffect(()=>{let o=!0;return(async()=>{if(!n){i("Missing authorization_id");return}const{data:s}=await g.auth.getSession();if(!s.session){const b=window.location.pathname+window.location.search;window.location.href=`/auth?next=${encodeURIComponent(b)}`;return}const{data:t,error:r}=await u().getAuthorizationDetails(n);if(!o)return;if(r){i(r.message);return}const p=(t==null?void 0:t.redirect_url)??(t==null?void 0:t.redirect_to);if(p&&!(t!=null&&t.client)){window.location.href=p;return}N(t)})(),()=>{o=!1}},[n]);const x=async o=>{l(!0);const{data:s,error:t}=o?await u().approveAuthorization(n):await u().denyAuthorization(n);if(t){l(!1),i(t.message);return}const r=(s==null?void 0:s.redirect_url)??(s==null?void 0:s.redirect_to);if(!r){l(!1),i("No redirect returned by the authorization server.");return}window.location.href=r},h=((f=a==null?void 0:a.client)==null?void 0:f.name)??"an app";return e.jsx("main",{className:"min-h-screen flex items-center justify-center bg-background px-4 py-12",children:e.jsx(C,{className:"w-full max-w-md",children:e.jsx(v,{className:"p-6 md:p-8",children:d?e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold mb-2",children:"Could not load this request"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d})]}):a?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex items-center gap-2 text-xs font-medium uppercase tracking-wide text-primary bg-primary/10 rounded-full px-4 py-1.5 mb-4",children:[e.jsx(S,{className:"h-3.5 w-3.5"}),"Connect an app"]}),e.jsxs("h1",{className:"text-xl md:text-2xl font-semibold mb-3",children:["Connect ",h," to your Parent Line account"]}),e.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:[h," will be able to use Parent Line as you â including reading your own conversations with Sophie. You can revoke access at any time."]}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[e.jsx(w,{disabled:m,onClick:()=>x(!0),className:"flex-1",children:"Approve"}),e.jsx(w,{disabled:m,variant:"outline",onClick:()=>x(!1),className:"flex-1",children:"Deny"})]})]}):e.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[e.jsx(z,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Loading authorization requestâ¦"})]})})})})};export{E 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.