import{u as m}from"./urlGenerator-87d92adb.js";import{r as v,b as k,d as y,o as r,c as t,a as e,z as w,H as L,F as d,m as p,n as h,t as b,e as u}from"./app-91dba96b.js";import"./appFunction-1b5b1f43.js";const M={id:"sidebar",class:"sidebar js-sidebar"},E={class:"sidebar-content js-simplebar"},A=["href"],S={class:"align-middle"},j={class:"sidebar-nav"},q=["href"],x=["src"],B={class:"align-middle"},C=["data-bs-target"],D=["src"],I={class:"align-middle"},N=["id"],V=["href"],H={__name:"sidebar",props:{data:Object},setup(f){const c=v(window.location.href),g=o=>{if(o.url&&o.url===c.value)return!0;if(o.subMenu){for(const n of o.subMenu)if(n.url&&n.url===c.value)return!0}return!1},_=o=>{const n=o.closest(".sidebar-item");n&&(n.classList.add("active"),_(n))};return k(()=>{document.querySelectorAll(".sidebar-item").forEach(a=>{g(a)&&(a.classList.add("active"),_(a))}),document.querySelectorAll(".sidebar-dropdown").forEach(a=>{a.querySelectorAll(".sidebar-item").forEach(i=>{i.classList.contains("active")&&a.classList.add("show")}),a.addEventListener("click",i=>{i.target.closest(".sidebar-item")||a.classList.toggle("show")})})}),(o,n)=>{const a=y("app-logo");return r(),t("nav",M,[e("div",E,[e("a",{class:"sidebar-brand",href:w(m)("dashboard")},[e("span",S,[L(a)])],8,A),e("ul",j,[(r(!0),t(d,null,p(f.data,(s,i)=>(r(),t(d,{key:i},[s.permission?(r(),t("li",{key:0,class:h(["sidebar-item",{active:s.url===c.value}])},[s.subMenu?u("",!0):(r(),t("a",{key:0,class:"sidebar-link",href:s.id?"#"+s.id:s.url},[e("img",{class:"sidebar_icon align-middle",src:s.icon},null,8,x),e("span",B,b(s.name),1)],8,q)),s.subMenu?(r(),t(d,{key:1},[e("a",{"data-bs-target":`#${s.id}`,"data-bs-toggle":"collapse",class:"sidebar-link"},[e("img",{class:"sidebar_icon align-middle",src:s.icon},null,8,D),e("span",I,b(s.name),1)],8,C),e("ul",{id:`${s.id}`,class:"sidebar-dropdown list-unstyled collapse","data-bs-parent":"#sidebar"},[(r(!0),t(d,null,p(s.subMenu,(l,z)=>(r(),t(d,null,[l.permission===!0||l.permission===""?(r(),t("li",{key:0,class:h(["sidebar-item",{active:l.url===c.value}])},[e("a",{class:"sidebar-link",href:l.url},b(l.name),9,V)],2)):u("",!0)],64))),256))],8,N)],64)):u("",!0)],2)):u("",!0)],64))),128))])])])}}};export{H as default};
