import*as l from"lucide-react";import{isValidElement as P}from"react";import{cn as m}from"@donotdev/components";import{jsx as c}from"react/jsx-runtime";function S(e){if(!e)return l.Palette;let t=e.replace(/['"]/g,"");return l[t]||l.Palette}var b=({icon:e,fallback:t,className:r,ariaHidden:s=!1})=>{let o=e||t;if(!o)return null;let i="dndev-size-md";if(typeof o=="function"||typeof o=="object"&&o!==null&&"render"in o)return c(o,{className:m(i,r),style:{flexShrink:0},"aria-hidden":s});if(typeof o=="string"){if(!/^[a-zA-Z0-9_-]+$/.test(o))return c("span",{className:m(i,r),style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o});let p=S(o);return c(p,{className:m(i,r),style:{flexShrink:0},"aria-hidden":s})}return P(o)?c("span",{className:r,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o}):c("span",{className:r,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o})},z=b;import*as E from"@donotdev/auth";import{DEGRADED_AUTH_API as L}from"@donotdev/core";var d=E?.useAuth;function T(e){return L[e]}function y(e){return d?d(e):T(e)}var O=typeof d=="function";import{useMemo as h}from"react";import{useNavigationStore as K}from"@donotdev/core";import{USER_ROLES as F}from"@donotdev/core";import{useLocation as k}from"@donotdev/ui/routing/hooks";function g(){let e=k(),t=y("user"),r=!!t,s=t?.role||F.GUEST,o=K(i=>!i||typeof i.getFilteredRoutes!="function"?[]:i.getFilteredRoutes({authenticated:r,role:s}));return h(()=>Array.isArray(o)?o.map(i=>({...i,isActive:_(i.path,e.pathname),hasChildren:!1,children:void 0})).sort((i,a)=>i.label.localeCompare(a.label,void 0,{sensitivity:"base"})):[],[o,e.pathname])}function J(e){let t=g();return h(()=>t.find(r=>r.path===e),[t,e])}function _(e,t){return e==="/"?t==="/":t===e?!0:t.startsWith(e+"/")}import{useCallback as f,useMemo as A}from"react";import{useNavigationStore as u}from"@donotdev/core";import{useNavigate as j}from"@donotdev/ui/routing/hooks";var te=()=>{let e=j(),t=g()??[],r=u(n=>n.favorites),s=u(n=>n.recent),o=u(n=>n.toggleFavorite),i=u(n=>n.isFavorite),a=u(n=>n.addRecent),v=A(()=>t.length?t.filter(n=>r.includes(n.path)):[],[r,t]),p=A(()=>t.length?t.filter(C=>s.includes(C.path)).slice(0,5):[],[s,t]),N=f(n=>{o(n)},[o]),R=f(n=>i(n),[i]),I=f(n=>{a(n)},[a]),x=f(n=>{I(n),e(n)},[e,I]);return{navigationItems:t,favoriteItems:v,recentItems:p,toggleFavorite:N,isFavorite:R,navigateToItem:x}};export{b as a,z as b,y as c,O as d,g as e,J as f,te as g};
