const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["strapi-ye6TfKul.js","strapi-D6821bIJ.css"])))=>i.map(i=>d[i]);
import{gH as f,hn as A,hl as C,iW as D,iU as U,cb as B,hS as F,d5 as H,iv as _,iY as O,iB as R,iA as G,fH as s,ci as l,jB as I,w as W,jD as K,b5 as V,iC as Y,ix as $,bL as E,bo as z,aZ as Z,bU as q,bY as N,r as J,bz as Q}from"./strapi-ye6TfKul.js";import{s as X}from"./sortBy-BHPiSJWc.js";import{s as ss}from"./selectors-Br3dx8yO.js";import"./_baseMap-CagEH0Ml.js";import"./_baseEach-BHFmNlG9.js";const es=a=>a.map(o=>{const n=o.links.map(r=>({...r,isDisplayed:!1}));return{...o,links:n}}),v=()=>{const[{isLoading:a,menu:o},n]=f.useState({isLoading:!0,menu:[]}),r=A("useSettingsMenu",t=>t.checkUserHasPermissions),u=C("useSettingsMenu",t=>t.shouldUpdateStrapi),m=D("useSettingsMenu",t=>t.settings),g=U(ss),x=f.useMemo(()=>B(),[]),{admin:L,global:p}=F(x,async()=>(await H(async()=>{const{SETTINGS_LINKS_EE:t}=await import("./strapi-ye6TfKul.js").then(e=>e.e0);return{SETTINGS_LINKS_EE:t}},__vite__mapDeps([0,1]))).SETTINGS_LINKS_EE(),{combine(t,e){return{admin:[...e.admin,...t.admin],global:[...t.global,...e.global]}},defaultValue:{admin:[],global:[]}}),d=f.useCallback(t=>{if(!t.id)throw new Error("The settings menu item must have an id attribute.");return{...t,permissions:g.settings?.[t.id]?.main??[]}},[g.settings]);return f.useEffect(()=>{const t=async()=>{const T=await(S=>Promise.all(S.reduce((h,j,k)=>{const y=j.links.map(async(M,b)=>({hasPermission:(await r(M.permissions)).length>0,sectionIndex:k,linkIndex:b}));return[...h,...y]},[])))(P);n(S=>({...S,isLoading:!1,menu:P.map((h,j)=>({...h,links:h.links.map((k,y)=>{const M=T.find(b=>b.sectionIndex===j&&b.linkIndex===y);return{...k,isDisplayed:!!M?.hasPermission}})}))}))},{global:e,...i}=m,P=es([{...e,links:X([...e.links,...p.map(d)],c=>c.id).map(c=>({...c,hasNotification:c.id==="000-application-infos"&&u}))},{id:"permissions",intlLabel:{id:"Settings.permissions",defaultMessage:"Administration Panel"},links:L.map(d)},...Object.values(i)]);t()},[L,p,m,u,d,r]),{isLoading:a,menu:o.map(t=>({...t,links:t.links.filter(e=>e.isDisplayed)}))}},ts=K(V)`
  border-radius: 50%;
  padding: ${({theme:a})=>a.spaces[2]};
  height: 2rem;
`,w=({isFullPage:a=!1})=>{const{menu:o}=v(),{formatMessage:n}=_(),{trackUsage:r}=O(),{pathname:u}=R(),{license:m}=G(),g=m?.features.map(e=>e.name),x={"content-releases":"cms-content-releases","review-workflows":"review-workflows",sso:"sso",auditLogs:"audit-logs","auditLogs-purchase-page":"audit-logs"},p=o.filter(e=>!e.links.every(i=>i.isDisplayed===!1)).map(e=>({...e,title:e.intlLabel,links:e.links.map(i=>({...i,id:i.id,title:i.intlLabel,name:i.id,to:i.to.startsWith("/")?i.to:`/settings/${i.to}`}))})),d=n({id:"global.settings",defaultMessage:"Settings"}),t=e=>()=>{r("willNavigate",{from:u,to:e})};return s.jsxs(l.Main,{"aria-label":d,children:[!a&&s.jsxs(s.Fragment,{children:[s.jsx(l.Header,{label:d}),s.jsx(I,{})]}),s.jsxs(l.Content,{children:[a&&s.jsxs(s.Fragment,{children:[s.jsx(l.Header,{label:d}),s.jsx(I,{})]}),s.jsx(l.Sections,{children:p.map(e=>s.jsx(l.Section,{label:n(e.intlLabel),children:e.links.map(i=>s.jsx(l.Link,{to:i.to,onClick:t(i.to),label:n(i.intlLabel),endAction:s.jsxs(s.Fragment,{children:[i?.licenseOnly&&s.jsx(W,{fill:(g||[]).includes(x[i.id])?"primary600":"neutral300",width:"1.5rem",height:"1.5rem"}),i?.hasNotification&&s.jsx(ts,{"aria-label":"Notification",backgroundColor:"primary600",textColor:"neutral0",children:"1"})]}),children:n(i.intlLabel)},i.id))},e.id))})]})]})},ls=()=>{const a=Y("/settings/:settingId/*"),{formatMessage:o}=_(),{isLoading:n}=v(),r=$();return n?s.jsx(E.Loading,{}):a?.params.settingId?s.jsxs(Z.Root,{sideNav:s.jsx(w,{}),children:[s.jsx(E.Title,{children:o({id:"global.settings",defaultMessage:"Settings"})}),s.jsx(q,{display:{initial:"block",medium:"none"},paddingLeft:N,paddingRight:N,paddingTop:N,children:s.jsx(J,{fallback:"/settings"})}),s.jsx(Q,{})]}):r?s.jsxs(s.Fragment,{children:[s.jsx(E.Title,{children:o({id:"global.settings",defaultMessage:"Settings"})}),s.jsx(l.PageWrapper,{children:s.jsx(w,{isFullPage:!0})})]}):s.jsx(z,{to:"application-infos"})};export{ls as Layout};
