import{O as r,a2 as f,p as l}from"./BKxwI4SA.js";const c="$s";function p(...t){const s=typeof t[t.length-1]=="string"?t.pop():void 0;typeof t[0]!="string"&&t.unshift(s);const[n,o]=t;if(!n||typeof n!="string")throw new TypeError("[nuxt] [useState] key must be a string: "+n);if(o!==void 0&&typeof o!="function")throw new Error("[nuxt] [useState] init must be a function: "+o);const a=c+n,e=r(),u=f(e.payload.state,a);if(u.value===void 0&&o){const i=o();if(l(i))return e.payload.state[a]=i,i;u.value=i}return u}const d=()=>{const t=p("is-dark-theme",()=>!1),s=e=>{typeof document>"u"||document.documentElement.classList.toggle("dark",e)},n=e=>{t.value=e,s(e),typeof localStorage<"u"&&localStorage.setItem("theme",e?"dark":"light")};return{isDark:t,toggleTheme:()=>{n(!t.value)},initTheme:()=>{if(typeof window>"u")return;const e=localStorage.getItem("theme");if(e==="dark"||e==="light"){n(e==="dark");return}n(!1)},setTheme:n}};export{d as u};
