1import{w as S,a as z,j as e,b as P,r as a}from"./chunk-OIYGIGL5-gwPc8tBz.js";import{C as E}from"./client-only-DX6BhWFv.js";import{L as g,B as y}from"./button-C-rmsvyO.js";import{G as I}from"./error-boundary-wmm73Qsd.js";import"./cx-JWMrrZN5.js";import"./bundle-mjs-BWt8Cp2A.js";import"./index-BnGtwJ93.js";import"./is-react-component-CT1NlcGF.js";function _(){const[t]=P(),[l,j]=a.useState(null),[w,N]=a.useState(!0),[d,x]=a.useState(!1),[o,s]=a.useState(null);a.useEffect(()=>{async function r(){try{const n=t.get("client_id");if(!n){s("Missing client information.");return}const c=`/api/auth/oauth2/public-client?client_id=${encodeURIComponent(n)}`,i=await fetch(c,{credentials:"include"});if(!i.ok){s("Failed to load consent information.");return}if(!(i.headers.get("content-type")||"").includes("application/json")){s("Failed to load consent information.");return}const b=await i.json(),h=t.get("scope"),C=h?h.split(" "):[];j({client:{name:b.client_name},scopes:C})}catch{s("Failed to load consent information.")}finally{N(!1)}}r()},[t]);async function p(r){x(!0),s(null);try{const n=await fetch("/api/auth/oauth2/consent",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({accept:r,oauth_query:t.toString()}),redirect:"follow"});if(n.redirected){window.location.href=n.url;return}if(n.ok){const c=await n.json(),i=c.uri??c.url;if(i){window.location.href=i;return}}s("Something went wrong. Please try again.")}catch{s("Something went wrong. Please try again.")}finally{x(!1)}}if(w)return e.jsx("div",{className:"flex justify-center py-10",children:e.jsx(g,{size:"xl",type:"line-simple"})});if(o&&!l)return e.jsx("div",{className:"bg-error-secondary rounded-lg px-4 py-3",children:e.jsx("p",{className:"text-error-primary text-sm",children:o})});const v=l?.client?.name||"An application",u=l?.scopes||[],f=t.get("redirect_uri");let m=null;if(f)try{m=new URL(f).hostname}catch{}return e.jsxs("div",{className:"z-10 flex flex-col gap-6",children:[e.jsxs("p",{className:"text-secondary text-md",children:[e.jsx("strong",{className:"text-primary font-medium",children:v})," is requesting access to your Iconited account."]}),m&&e.jsxs("p",{className:"text-tertiary text-sm",children:["Will redirect to: ",e.jsx("code",{className:"text-secondary",children:m})]}),u.length>0&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("p",{className:"text-tertiary text-sm font-medium",children:"This will allow the application to:"}),e.jsx("ul",{className:"flex flex-col gap-1",children:u.map(r=>e.jsxs("li",{className:"text-secondary text-sm flex items-center gap-2",children:[e.jsx("span",{className:"text-tertiary",children:"â¢"}),k(r)]},r))})]}),o&&e.jsx("div",{className:"bg-error-secondary rounded-lg px-4 py-3",children:e.jsx("p",{className:"text-error-primary text-sm",children:o})}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(y,{type:"button",size:"lg",isLoading:d,disabled:d,onClick:()=>void p(!0),children:"Allow access"}),e.jsx(y,{type:"button",size:"lg",color:"secondary",disabled:d,onClick:()=>void p(!1),children:"Deny"})]})]})}function k(t){switch(t){case"openid":return"Verify your identity";case"offline_access":return"Stay connected (refresh tokens)";default:return t}}const O=S(function(){return e.jsx("section",{className:"bg-primary relative min-h-screen overflow-hidden px-4 py-12 md:px-8 md:pt-24",children:e.jsxs("div",{className:"relative z-10 mx-auto flex w-full flex-col gap-8 sm:max-w-90",children:[e.jsx("div",{className:"flex flex-col items-center gap-6 text-center",children:e.jsxs("div",{className:"z-10 flex flex-col gap-2 md:gap-3",children:[e.jsx("h1",{className:"text-display-xs text-primary md:text-display-sm font-semibold",children:"Authorize Access"}),e.jsx("p",{className:"text-md text-tertiary self-stretch p-0",children:"Review the permissions being requested."})]})}),e.jsx(E,{fallback:e.jsx("div",{className:"flex justify-center py-10",children:e.jsx(g,{size:"xl",type:"line-simple"})}),children:()=>e.jsx(_,{})})]})})}),G=()=>[{title:"Authorize - Iconited"}],J=z(function(){return e.jsx(I,{})});
1export{J as ErrorBoundary,O as default,G as meta}; 2//# sourceMappingURL=oauth2.consent-DmdCe96q.js.map
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.