function d(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}function l(t,s=""){const o={};if(!t||typeof t!="object")return o;for(const[r,n]of Object.entries(t)){const e=s?`${s}.${r}`:r;n===!0||n===!1?o[e]=n:n&&typeof n=="object"&&Object.assign(o,l(n,e))}return o}function h(t,s){const o=new Map;for(const e of s)o.set(e.groupname,e);const r={};for(const e of t){const c=o.get(e);if(!c||c.enabled===!1)continue;const a=c.readableName||c.groupname;for(const[u,p]of Object.entries(l(c.access))){const f=r[u]??={allows:[],denies:[]};(p?f.allows:f.denies).push(a)}}const n={};for(const[e,{allows:c,denies:a}]of Object.entries(r))a.length>0?n[e]={state:"denied",groups:a}:c.length>0&&(n[e]={state:"allowed",groups:c});return n}function i(t,s=""){const o=[];if(!t||typeof t!="object")return o;for(const[r,n]of Object.entries(t)){const e=s?`${s}.${r}`:r;n===!0?o.push(e):n&&typeof n=="object"&&o.push(...i(n,e))}return o}function b(t){const s=i(t.access);return s.includes("api.super")||s.includes("admin.super")}function m(t){return i(t.access).some(s=>s.startsWith("admin.")||s.startsWith("api."))}function y(t){const s=[],o=new Set,r=n=>{for(const e of n)o.has(e.name)||(o.add(e.name),s.push({value:e.name,label:e.label||e.name,hint:e.name})),e.children?.length&&r(e.children)};return r(t),s.sort((n,e)=>n.value.localeCompare(e.value))}export{i as f,m as h,b as i,y as p,h as r,d as t};
