"use client";
import * as React from 'react';
import { useSyncExternalStore } from 'react';
import 'react/jsx-runtime';

var AppThemeContext = React.createContext(null);
function useTheme() {
  const context = React.useContext(AppThemeContext);
  if (context == null) {
    throw new Error("useTheme must be used within AppThemeProvider");
  }
  return context;
}

// src/theme/use-app-shell-dark-appearance.ts
function subscribeHtmlDarkClass(onStoreChange) {
  const root = document.documentElement;
  const observer = new MutationObserver(onStoreChange);
  observer.observe(root, { attributes: true, attributeFilter: ["class"] });
  return () => observer.disconnect();
}
function getSnapshotHtmlHasDarkClass() {
  return document.documentElement.classList.contains("dark");
}
function useAppShellDarkAppearance() {
  const { resolvedTheme, theme } = useTheme();
  const themeSaysDark = (resolvedTheme != null ? resolvedTheme : theme) === "dark";
  return useSyncExternalStore(
    subscribeHtmlDarkClass,
    () => getSnapshotHtmlHasDarkClass() || themeSaysDark,
    () => false
  );
}

export { useAppShellDarkAppearance };
//# sourceMappingURL=use-app-shell-dark-appearance.js.map
//# sourceMappingURL=use-app-shell-dark-appearance.js.map