import { jsx } from "react/jsx-runtime";
import { createContext, useContext, useMemo } from "react";
const CanvasThemeContext = /*#__PURE__*/ createContext(null);
const defaultValue = {
    isDarkMode: false
};
const CanvasThemeProvider = ({ children, isDarkMode })=>{
    const parent = useContext(CanvasThemeContext);
    const resolved = isDarkMode ?? parent?.isDarkMode;
    const value = useMemo(()=>({
            isDarkMode: resolved
        }), [
        resolved
    ]);
    return /*#__PURE__*/ jsx(CanvasThemeContext.Provider, {
        value: value,
        children: children
    });
};
function useCanvasTheme() {
    return useContext(CanvasThemeContext) ?? defaultValue;
}
export { CanvasThemeProvider, useCanvasTheme };
