import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{B_ as t,Fr as n,Gy as r,Hy as i,Ly as a,Nf as o,Pf as s,Ua as c,Wn as l,Zv as u,ap as d,ch as f,dg as p,lh as m,m_ as h,ri as g,sn as _}from"./index-DDwwBb9e.js";import{t as v}from"./MenuLink-DDhUk0c_.js";import{t as y}from"./useActivePlan-DFB_ziHo.js";var b=e(r()),x=i();function S({label:e,paths:t,children:n}){let r=l(),i=t.some(e=>r?.startsWith(e)),[c,d]=(0,b.useState)(i);return(0,b.useEffect)(()=>{i&&d(!0)},[i]),(0,x.jsxs)(p,{align:`start`,width:`full`,gap:0,children:[(0,x.jsxs)(h,{width:`full`,px:4,py:1,cursor:`pointer`,color:`fg.muted`,_hover:{color:`fg`},onClick:()=>d(e=>!e),children:[(0,x.jsx)(u,{fontSize:`xs`,fontWeight:`semibold`,textTransform:`uppercase`,letterSpacing:`wider`,children:e}),(0,x.jsx)(a,{ml:`auto`,children:c?(0,x.jsx)(s,{size:12}):(0,x.jsx)(o,{size:12})})]}),c&&(0,x.jsx)(p,{align:`start`,width:`full`,gap:1,pl:2,children:n})]})}function C({children:e,isSubscription:r}){let{project:i,hasPermission:a}=d({redirectToOnboarding:!1}),o=f().data?.IS_SAAS??!1,{isEnterprise:s,isLoading:l}=y(),u=l||s,{isLiteMember:b}=g(),{hasAccess:C}=n(),w=m.user.isAdmin.useQuery({},{enabled:C,retry:!1,refetchOnWindowFocus:!1}).data?.isAdmin??!1;return(0,x.jsxs)(_,{compactMenu:!0,children:[(0,x.jsx)(c.Header,{children:(0,x.jsx)(c.Heading,{children:`Settings`})}),(0,x.jsxs)(h,{align:`start`,width:`full`,height:`calc(100vh - 56px - 48px)`,gap:0,children:[(0,x.jsxs)(p,{align:`start`,paddingX:2,paddingY:4,fontSize:`14px`,minWidth:`200px`,height:`full`,overflowY:`auto`,flexShrink:0,gap:2,display:r?`none`:`flex`,children:[(0,x.jsx)(v,{href:`/settings`,children:`General Settings`}),!b&&(0,x.jsx)(v,{href:`/settings/api-keys`,children:`API Keys`}),(0,x.jsxs)(S,{label:`Models`,paths:[`/settings/model-providers`,`/settings/model-costs`,`/settings/secrets`],children:[(0,x.jsx)(v,{href:`/settings/model-providers`,children:`Model Providers`}),(0,x.jsx)(v,{href:`/settings/model-costs`,children:`Model Costs`}),!b&&(0,x.jsx)(v,{href:`/settings/secrets`,children:`Secrets`})]}),(0,x.jsxs)(S,{label:`Teams & Access`,paths:[`/settings/teams`,`/settings/members`,`/settings/groups`,`/settings/roles`,`/settings/role-bindings`,`/settings/authentication`,`/settings/scim`,`/settings/audit-log`],children:[(0,x.jsx)(v,{href:`/settings/members`,includePath:`members`,children:`Members`}),(0,x.jsx)(v,{href:`/settings/teams`,children:`Teams & Projects`}),u&&!b&&(0,x.jsx)(v,{href:`/settings/groups`,children:`Groups`}),u&&!b&&(0,x.jsx)(v,{href:`/settings/roles`,children:`Roles & Permissions`}),(0,x.jsx)(v,{href:`/settings/authentication`,children:`Authentication`}),u&&!b&&(0,x.jsx)(v,{href:`/settings/scim`,children:`SCIM Provisioning`}),u&&!b&&(0,x.jsx)(v,{href:`/settings/role-bindings`,children:`Role Bindings`}),u&&!b&&a(`auditLog:view`)&&(0,x.jsx)(v,{href:`/settings/audit-log`,children:`Audit Log`})]}),(0,x.jsxs)(S,{label:`Features`,paths:[`/settings/annotation-scores`,`/settings/topic-clustering`],children:[(0,x.jsx)(v,{href:`/settings/annotation-scores`,children:`Annotation Scores`}),!b&&i?.slug&&(0,x.jsx)(v,{href:`/${i.slug}/automations`,children:`Automations`}),!b&&(0,x.jsx)(v,{href:`/settings/topic-clustering`,children:`Topic Clustering`})]}),!b&&(0,x.jsxs)(S,{label:`Billing`,paths:[`/settings/usage`,`/settings/subscription`,`/settings/license`],children:[(0,x.jsx)(v,{href:`/settings/usage`,children:`Usage & Billing`}),o&&(0,x.jsx)(v,{href:`/settings/subscription`,children:`Subscription`}),!o&&(0,x.jsx)(v,{href:`/settings/license`,children:`License`})]}),C&&(0,x.jsxs)(S,{label:`Ops`,paths:[`/ops`],children:[(0,x.jsx)(v,{href:`/ops`,children:`Dashboard`}),(0,x.jsx)(v,{href:`/ops/projections`,includePath:`/ops/projections`,children:`Projection Replay`}),(0,x.jsx)(v,{href:`/ops/foundry`,includePath:`/ops/foundry`,children:`The Foundry`}),(0,x.jsx)(v,{href:`/ops/dejaview`,includePath:`/ops/dejaview`,children:`Deja View`}),(0,x.jsx)(v,{href:`/ops/feature-flags`,includePath:`/ops/feature-flags`,children:`Feature Flags`})]}),w&&(0,x.jsxs)(S,{label:`Backoffice`,paths:[`/ops/backoffice`],children:[(0,x.jsx)(v,{href:`/ops/backoffice/users`,includePath:`/ops/backoffice/users`,children:`Users`}),(0,x.jsx)(v,{href:`/ops/backoffice/organizations`,includePath:`/ops/backoffice/organizations`,children:`Organizations`}),(0,x.jsx)(v,{href:`/ops/backoffice/projects`,includePath:`/ops/backoffice/projects`,children:`Projects`}),(0,x.jsx)(v,{href:`/ops/backoffice/subscriptions`,includePath:`/ops/backoffice/subscriptions`,children:`Subscriptions`})]})]}),(0,x.jsx)(t,{maxWidth:`1280px`,padding:4,paddingBottom:16,height:`full`,overflowY:`auto`,flex:1,children:e})]})]})}export{C as t};
//# sourceMappingURL=SettingsLayout-DkhRoxt1.js.map