1import{r as o,j as e}from"./vendor-react-2KYUPUk0.js";import{a as f,B as l,X as j,Y as b,Z as g,b$ as N,_ as S,$ as C,m as v,a0 as k,o as y,c0 as E,c1 as T,a2 as _,c2 as R,c3 as A}from"./index-9VkdFAcH.js";import{A as u}from"./index--hXc0W7V.js";import{S as d,a as I,b as P}from"./oauth-scopes-B8d5Wdxv.js";import"./vendor-radix-D3KcWVSr.js";import"./vendor-apollo-Cmz0lnME.js";const m=R("/auth/consent");function U(t,i,n){switch(t){case"pkce_required":return{title:n("auth.consentInvalidRequestTitle"),subtitle:n("auth.consentPkceRequiredSubtitle")};case"scope_required":return{title:n("auth.consentInvalidRequestTitle"),subtitle:n("auth.consentScopeRequiredSubtitle",{scopes:(i??[]).join(", ")})};case"not_configured":case"headless_accept_failed":return{title:n("auth.consentUnavailableTitle"),subtitle:n("auth.consentUnavailableSubtitle")};case"wrong_user":return{title:n("auth.consentWrongUserTitle"),subtitle:n("auth.consentWrongUserSubtitle")};default:return{title:n("auth.consentExpiredTitle"),subtitle:n("auth.consentExpiredSubtitle")}}}function q(){const{consent:t,consentErrorCode:i,consentRequiredScopes:n}=m.useLoaderData(),{consent_challenge:h}=m.useSearch(),{t:s}=f(),[r,x]=o.useState(!1),c=!t&&!i&&!!h;if(o.useEffect(()=>{c&&window.location.replace(window.location.href)},[c]),!t){const{title:a,subtitle:p}=U(i,n,s);return e.jsx(u,{title:a,subtitle:p,children:!c&&e.jsx(l,{asChild:!0,variant:"outline",children:e.jsx("a",{href:"/",children:s("common.goHome")})})})}return e.jsx(u,{title:s("auth.consentTitle"),subtitle:s("auth.consentSubtitle",{client:t.clientName}),children:e.jsxs(j,{children:[e.jsxs(b,{children:[e.jsxs(g,{className:"flex items-center gap-2",children:[e.jsx(N,{className:"size-5 text-primary"}),t.clientName]}),e.jsxs(S,{className:"space-y-2",children:[e.jsx("span",{className:"block font-medium text-amber-700 dark:text-amber-400",children:s("auth.consentUnverifiedClient")}),t.clientUri&&e.jsx("a",{href:t.clientUri,rel:"noreferrer noopener",target:"_blank",className:"block underline underline-offset-4",children:t.clientUri}),e.jsxs("span",{className:"block",children:[s("auth.consentClientId"),":"," ",e.jsx("span",{className:"font-mono text-xs",children:t.clientId})]}),e.jsxs("span",{className:"block",children:[s("auth.consentRedirectOrigin"),":"," ",e.jsx("span",{className:"font-mono text-xs",children:t.redirectOrigin??s("auth.consentNoRedirectOrigin")})]})]})]}),e.jsxs(C,{className:"space-y-4",children:[t.retryAfterFailure&&e.jsxs(v,{variant:"destructive",children:[e.jsx(k,{}),e.jsx(y,{children:s("auth.consentFailed")})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:s("auth.consentScopesTitle")}),e.jsx("ul",{className:"space-y-2",children:t.scopes.map(a=>e.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[e.jsx(E,{className:"size-4 mt-0.5 text-muted-foreground shrink-0"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-mono text-xs",children:a}),d[a]&&e.jsx("span",{className:a===I||a===P?"block text-amber-700 dark:text-amber-400":"block text-muted-foreground",children:s(d[a])})]})]},a))})]}),t.audiences.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:s("auth.consentAudienceTitle")}),e.jsx("p",{className:"font-mono text-xs text-muted-foreground break-all",children:t.audiences.join(", ")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("auth.consentRememberHint")})]}),e.jsx(T,{children:e.jsxs("form",{method:"post",action:"/auth/consent",className:_("flex w-full gap-3",r&&"pointer-events-none opacity-70"),"aria-busy":r,onSubmit:a=>{r&&a.preventDefault(),x(!0)},children:[e.jsx("input",{type:"hidden",name:"consent_challenge",value:t.challenge}),e.jsx("input",{type:"hidden",name:"csrf_token",value:t.csrfToken}),e.jsx(l,{type:"submit",name:"decision",value:"deny",variant:"outline",className:"flex-1",children:s("auth.consentDeny")}),e.jsx(l,{type:"submit",name:"decision",value:"approve",className:"flex-1",children:s("auth.consentApprove")})]})})]})})}const z=q,B=A;export{z as component,B as pendingComponent};
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.