import { jsx as _jsx } from "react/jsx-runtime";
/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
import React, { useContext, useMemo } from 'react';
const Context = React.createContext(undefined);
export const ColorModeProvider = ({ children, colorMode, setColorMode, }) => {
    const value = useMemo(() => {
        return { colorMode, setColorMode };
    }, [colorMode, setColorMode]);
    return _jsx(Context.Provider, { value: value, children: children });
};
export function useColorMode() {
    const context = useContext(Context);
    if (context === null || context === undefined) {
        throw new Error('ColorModeProvider');
    }
    return context;
}
