"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const is = require("../_utils/is.js");
const vue = require("vue");
const THEME_KEY = "__theme__";
function useTheme(defaultTheme = "light") {
  if (!is.isClient) {
    return {
      theme: vue.ref(defaultTheme)
    };
  }
  const currentTheme = vue.ref(localStorage.getItem(THEME_KEY) || defaultTheme);
  vue.watchEffect(() => {
    const theme = currentTheme.value;
    document.documentElement.dataset.oTheme = theme;
    localStorage.setItem(THEME_KEY, theme);
  });
  return {
    theme: currentTheme
  };
}
exports.useTheme = useTheme;
