import{r,_ as N,u as S,g as _,j as i,a as E,L as u}from"../main2.js";const p=r.lazy(()=>N(()=>import("./icons-n8_WHgs6.js"),__vite__mapDeps([0,1])));function I({css:g,style:j,cbOnClick:d}){const c=S(),[f,x]=r.useState([]),[w,v]=r.useState(""),P=()=>{E().then(n=>{let s=n.data;s&&x(s)})};r.useEffect(()=>{v(c.pathname??window.top.location.pathname),_("menu").then(n=>{if(n&&n.data)x(n.data);else throw e}).catch(n=>{P()})},[]),r.useEffect(()=>{c.state&&c.state.enableScroll&&setTimeout(()=>{h(window.location.hash)},500)},[]);const k=n=>{let s=0;for(;n;)s+=n.offsetTop,n=n.offsetParent;return s},h=n=>{n=n.replace("#","").replace("index","").replace("/","");let s=document.getElementById(n);window.scrollTo({behavior:"smooth",top:k(s)})},m=({name:n,id:s,path:t,hasChild:l,isSubMenu:o})=>{let a={className:"",id:`nav-${n}-${s}`,to:t!=null&&t.includes("#")?{pathname:t,state:{enableScroll:!0}}:t};return t!=null&&t.includes("#")?i.jsx(u,{...a,onClick:()=>{(!l||o&&t&&t!=="")&&d(!0),h(t),localStorage.getItem("editorPreviewMode")&&localStorage.getItem("editorPreviewMode")==="true"&&(top.window.location.href=t==="#"?"/index":t)},children:n}):t==""?i.jsxs(u,{...a,onClick:()=>(!l||o&&t&&t!=="")&&d(!0),children:[" ",n," "]}):i.jsxs(u,{...a,onClick:()=>{(!l||o&&t&&t!=="")&&d(!0),localStorage.getItem("editorPreviewMode")&&localStorage.getItem("editorPreviewMode")==="true"&&(top.window.location.href=t==="#"?"/index":t)},children:[" ",n," "]})};return i.jsx(i.Fragment,{children:i.jsx("div",{id:"second-menu-theme",children:i.jsx("div",{className:"menu-container",children:i.jsx("div",{className:"header-menu",children:i.jsx("div",{className:"menu-inner",children:i.jsx("ul",{className:"nav",children:f&&f.map((n,s)=>i.jsxs("div",{className:`dropdown relative inline-block cursor-pointer ${w==n.link?"active":""}`,children:[i.jsxs("li",{className:`${g}`,style:j,children:[m({name:n.name,id:n.id,path:n.link,hasChild:n.child.length>0}),n.child.length>0&&i.jsx("span",{children:i.jsx(r.Suspense,{fallback:i.jsx(i.Fragment,{}),children:i.jsx(p,{icon:"FaAngleDown"})})})]}),i.jsx("div",{className:`dropdown-content 
                                                    md:absolute bg-white shadow-slate-800 min-w-48
                                                    md:shadow-lg
                                                    hidden
                                                    md:text-left
                                                    `,children:n.child.map((t,l)=>i.jsxs("div",{children:[i.jsx("li",{children:m({name:t.name,id:t.id,path:t.link,hasChild:t.child.length>0,isSubMenu:!0})},l),i.jsx("div",{className:"subchild-menu",children:t.child.map((o,a)=>i.jsx(i.Fragment,{children:i.jsx("li",{children:m({name:o.name,id:o.id,path:o.link,hasChild:!1})},a)}))})]},l))},s+n.name)]},s))})})})})})})}export{I as default};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = ["assets/icons-n8_WHgs6.js","main2.js"]
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}