import { jsx as _jsx } from "@emotion/react/jsx-runtime";
import { useMemo, useContext } from 'react';
import { ThemeProvider as ThemeProviderEmotion } from '@emotion/react';
import { theme } from 'antd';
import { customToken as customTokenLight } from '../../themes/light';
import { customToken as customTokenDark } from '../../themes/dark';
import { ThemeContext } from './contexts';
const TOKEN_MAP = {
    light: customTokenLight,
    dark: customTokenDark,
};
export const ThemeTokenProvider = ({ children }) => {
    const { token } = theme.useToken();
    const mode = useContext(ThemeContext);
    const combinedToken = useMemo(() => (Object.assign(Object.assign({}, token), TOKEN_MAP[mode])), [token, mode]);
    return (_jsx(ThemeProviderEmotion, { theme: combinedToken, children: children }));
};
