"use client"
import{c as g}from"./chunk-GLJUY3FU.mjs";import{a as p}from"./chunk-H4UN7NPI.mjs";import{ChevronDown as v,Menu as y,X as k}from"lucide-react";import m from"next/link";import{useParams as h}from"next/navigation";import{useEffect as w,useState as b}from"react";import x from"swr";import{Fragment as _,jsx as e,jsxs as n}from"react/jsx-runtime";function O({theme:l="light",staticDomain:o}){let{domain:r="dub.co"}=h();o&&(r=o);let[a,i]=b(!1);w(()=>{a?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[a]);let{data:s}=x(r.endsWith("dub.co")&&"/api/auth/session",void 0,{dedupingInterval:6e4});return n("div",{className:(void 0)(l==="dark"&&"dark"),children:[e("button",{onClick:()=>i(!a),className:(void 0)("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(k,{className:"h-5 w-5 text-gray-600 dark:text-white/70"}):e(y,{className:"h-5 w-5 text-gray-600 dark:text-white/70"})}),e("nav",{className:(void 0)("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:n("ul",{className:"grid divide-y divide-gray-200 dark:divide-white/[0.15]",children:[g.map(({name:f,href:d,childItems:c},u)=>e(C,{name:f,href:d,childItems:c,setOpen:i},u)),s&&Object.keys(s).length>0?e("li",{className:"py-3",children:e(m,{href:void 0,className:"flex w-full font-semibold capitalize",children:"Dashboard"})}):n(_,{children:[e("li",{className:"py-3",children:e(m,{href:`${void 0}/login`,className:"flex w-full font-semibold capitalize",children:"Log in"})}),e("li",{className:"py-3",children:e(m,{href:`${void 0}/register`,className:"flex w-full font-semibold capitalize",children:"Sign Up"})})]})]})})]})}var C=({name:l,href:o,childItems:r,setOpen:a})=>{let{domain:i="dub.co"}=h(),[s,f]=b(!1);return r?e("li",{className:"py-3",children:n(p,{height:!0,children:[n("button",{className:"flex w-full justify-between",onClick:()=>f(!s),children:[e("p",{className:"font-semibold",children:l}),e(v,{className:(void 0)("h-5 w-5 text-gray-500 transition-all dark:text-white/50",s&&"rotate-180")})]}),s&&e("div",{className:"grid gap-4 overflow-hidden py-4",children:r.map(({title:d,href:c,icon:u,iconClassName:N})=>n(m,{href:(void 0)(c,i,{utm_source:"Custom Domain",utm_medium:"Navbar",utm_campaign:i,utm_content:d}),onClick:()=>a(!1),className:"flex w-full space-x-2",children:[e(u,{className:(void 0)("h-5 w-5 text-gray-500 dark:text-white/80",N)}),e("span",{className:"text-sm",children:d})]},c))})]})}):o?e("li",{className:"py-3",children:e(m,{href:(void 0)(o,i,{utm_source:"Custom Domain",utm_medium:"Navbar",utm_campaign:i,utm_content:l}),onClick:()=>a(!1),className:"flex w-full font-semibold capitalize",children:l})}):null};export{O as a};
