1import{R as r,n as g,o as _,p as I,q as M,s as L,t as k,v as O,w as z,x as A,y as C,z as D,A as P,B as G,C as R,D as U,E as w,F as E,G as B,H as y,m as e,a as p,r as f,S as v,J as F,K as N,L as x,M as m,N as b,O as j,P as $,Q as H,U as q,V as J,W as K,X as Q,Y as V,Z as W,_ as X,$ as Y,a0 as Z}from"./main-BVeaUmEJ.js";function T(){return[{title:z(),icon:g,href:r.Dashboard,external:!1},{title:A(),icon:_,href:r.DashboardCredits,external:!1},...C.payment?.enable?[{title:D(),icon:I,href:r.DashboardBilling,external:!1}]:[],{title:P(),icon:M,href:r.DashboardProfile,external:!1},{title:E(),icon:O,authorizeOnly:["admin"],items:[{title:G(),icon:g,href:r.AdminOverview,external:!1},{title:R(),icon:L,href:r.AdminUsers,external:!1},{title:U(),icon:_,href:r.AdminCredits,external:!1},{title:w(),icon:k,href:r.AdminGalleryOps,external:!1}]}]}function ee(){const l=T(),{data:t}=p.useSession(),n=t?.user?.role;return f.useMemo(()=>{const i=c=>c.filter(a=>a.authorizeOnly?n?a.authorizeOnly.includes(n):!1:!0).map(a=>{if(a.items&&a.items.length>0){const d=i(a.items);return d.length>0?{...a,items:d}:null}return a}).filter(a=>a!==null);return i(l)},[l,n])}function se(){const l=ee(),t=B({select:s=>s.location.pathname})??"",{isMobile:n,setOpenMobile:i}=y(),c=()=>{n&&i(!1)},a=s=>{if(!s)return!1;const o=t.replace(/\/$/,"")||"/",h=s.replace(/\/$/,"")||"/";return o===h},d=(s,o)=>{const h=s.icon;return s.items&&s.items.length>0?e.jsxs(v,{children:[e.jsx(F,{children:s.title}),e.jsx(N,{className:"flex flex-col gap-0.5",children:e.jsx(x,{children:s.items.map(u=>{const S=u.icon;return e.jsx(m,{className:"py-1",children:e.jsx(b,{render:e.jsxs(j,{to:u.href??"#",onClick:c,children:[S?e.jsx(S,{className:"size-4 shrink-0"}):null,e.jsx("span",{className:"truncate font-medium text-sm",children:u.title})]}),isActive:a(u.href)})},u.title)})})})]},o):e.jsx(v,{children:e.jsx(N,{className:"flex flex-col gap-2",children:e.jsx(x,{children:e.jsx(m,{children:e.jsx(b,{render:e.jsxs(j,{to:s.href??"#",onClick:c,children:[h?e.jsx(h,{className:"size-4 shrink-0"}):null,e.jsx("span",{className:"truncate font-medium text-sm",children:s.title})]}),isActive:a(s.href)})})})})},o)};return e.jsx(e.Fragment,{children:l.map(s=>d(s,s.title+(s.items?.map(o=>o.title).join("-")??"")))})}function ae(l){const[t,n]=f.useState(!1),{data:i,isPending:c}=p.useSession(),a=i?.user,{isMobile:d,setOpenMobile:s}=y();f.useEffect(()=>{n(!0)},[]);const o=()=>{d&&s(!1)};return e.jsxs($,{collapsible:"icon",...l,children:[e.jsx(H,{children:e.jsx(x,{children:e.jsx(m,{children:e.jsx(b,{render:e.jsxs(j,{to:r.Generate,onClick:o,children:[e.jsx(q,{className:"size-5"}),e.jsx("span",{className:"truncate font-semibold text-base",children:C.metadata?.name})]}),className:"data-[slot=sidebar-menu-button]:!p-1.5"})})})}),e.jsx(J,{children:!c&&t&&e.jsx(se,{})}),e.jsx(K,{className:"flex flex-col gap-4",children:!c&&t&&e.jsx(Q,{user:a??null})})]})}function ne({children:l}){const{data:t,isPending:n}=p.useSession(),i=W();return f.useEffect(()=>{n||t?.user||i({to:r.Login})},[t,n,i]),n?e.jsxs("div",{className:"flex min-h-svh items-center justify-center",children:[e.jsx(X,{className:"size-6"}),e.jsx("span",{className:"sr-only",children:"Loading..."})]}):t?.user?e.jsxs(Y,{className:"min-h-svh flex",style:{"--sidebar-width":"calc(var(--spacing) * 72)","--header-height":"calc(var(--spacing) * 12)"},children:[e.jsx(ae,{variant:"inset"}),e.jsx(Z,{children:l})]}):null}function te(){return e.jsx(ne,{children:e.jsx(V,{})})}const ie=te;export{ie as component};
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.