"use client"
import{c as h}from"./chunk-BMZDMOXG.mjs";import{d as m,g as u,i as t}from"./chunk-JP57AFGB.mjs";import{ChevronDown as k,Menu as v,X as w}from"lucide-react";import r from"next/link";import{useParams as g}from"next/navigation";import{useEffect as x,useState as b}from"react";import L from"swr";import{Fragment as C,jsx as e,jsxs as i}from"react/jsx-runtime";function S({theme:d="light"}){let{domain:c="dub.co"}=g(),[a,s]=b(!1);x(()=>{a?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[a]);let{data:l}=L(c==="dub.co"&&"/api/auth/session",u,{dedupingInterval:6e4});return i("div",{className:t(d==="dark"&&"dark"),children:[e("button",{onClick:()=>s(!a),className:t("fixed right-3 top-3 z-40 rounded-full p-2 transition-colors duration-200 hover:bg-gray-200 focus:outline-none active:bg-gray-300 lg:hidden dark:hover:bg-white/20 dark:active:bg-white/30",a&&"hover:bg-gray-100 active:bg-gray-200"),children:a?e(w,{className:"h-5 w-5 text-gray-600 dark:text-white/70"}):e(v,{className:"h-5 w-5 text-gray-600 dark:text-white/70"})}),e("nav",{className:t("fixed inset-0 z-20 hidden w-full bg-white px-5 py-16 lg:hidden dark:bg-black dark:text-white/70",a&&"block"),children:i("ul",{className:"grid divide-y divide-gray-200 dark:divide-white/[0.15]",children:[h.map(({name:o,href:f,childItems:p},n)=>e(z,{name:o,href:f,childItems:p,setOpen:s},n)),l&&Object.keys(l).length>0?e("li",{className:"py-3",children:e(r,{href:m,className:"flex w-full font-semibold capitalize",children:"Dashboard"})}):i(C,{children:[e("li",{className:"py-3",children:e(r,{href:`${m}/login`,className:"flex w-full font-semibold capitalize",children:"Log in"})}),e("li",{className:"py-3",children:e(r,{href:`${m}/register`,className:"flex w-full font-semibold capitalize",children:"Sign Up"})})]})]})})]})}var z=({name:d,href:c,childItems:a,setOpen:s})=>{let{domain:l="dub.co"}=g(),[o,f]=b(!1);return a?i("li",{className:"py-3",children:[i("button",{className:"flex w-full justify-between",onClick:()=>f(!o),children:[e("p",{className:"font-semibold",children:d}),e(k,{className:t("h-5 w-5 text-gray-500 transition-all dark:text-white/50",o&&"rotate-180")})]}),o&&e("div",{className:"grid gap-4 overflow-hidden py-4",children:a.map(({title:p,href:n,icon:y,iconClassName:N})=>i(r,{href:l==="dub.co"?`/${n}`:`https://dub.co/${n}`,onClick:()=>s(!1),className:"flex w-full space-x-2",children:[e(y,{className:t("h-5 w-5 text-gray-500 dark:text-white/80",N)}),e("span",{className:"text-sm",children:p})]},n))})]}):e("li",{className:"py-3",children:e(r,{href:l==="dub.co"?`/${c}`:`https://dub.co/${c}`,onClick:()=>s(!1),className:"flex w-full font-semibold capitalize",children:d})})};export{S as a};
