import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
import {
  Devtools
} from "./chunk-5AHVOSAL.mjs";
import {
  ErrorBoundary
} from "./chunk-SXXO7MP3.mjs";

// src/app/App.tsx
import React, { useEffect, useState } from "react";
import { ClientProvider } from "@dxos/react-client";
import { ThemeProvider } from "@dxos/react-ui";
import { defaultTx } from "@dxos/ui-theme";
var useThemeWatcher = () => {
  const [themeMode, setThemeMode] = useState("dark");
  const setTheme = ({ matches: prefersDark }) => {
    document.documentElement.classList[prefersDark ? "add" : "remove"]("dark");
    setThemeMode(prefersDark ? "dark" : "light");
  };
  useEffect(() => {
    const modeQuery = window.matchMedia("(prefers-color-scheme: dark)");
    setTheme({
      matches: modeQuery.matches
    });
    modeQuery.addEventListener("change", setTheme);
    return () => modeQuery.removeEventListener("change", setTheme);
  }, []);
  return themeMode;
};
var App = (props) => {
  const themeMode = useThemeWatcher();
  return /* @__PURE__ */ React.createElement(ThemeProvider, {
    tx: defaultTx,
    themeMode,
    noCache: true
  }, /* @__PURE__ */ React.createElement(ErrorBoundary, null, /* @__PURE__ */ React.createElement(ClientProvider, props, /* @__PURE__ */ React.createElement(Devtools, null))));
};
var App_default = App;
export {
  App,
  App_default as default
};
//# sourceMappingURL=App-5UIVU5YD.mjs.map
