import { jsx as _jsx } from "react/jsx-runtime";
import { useMemo } from 'react';
import { ThemeProvider as StyledThemeProvider, default as styled } from '@darajs/styled-components';
import { injectCss, useComponentStyles } from '../shared';
import DynamicComponent from '../shared/dynamic-component/dynamic-component';
import { useVariable } from '../shared/interactivity';
import resolveTheme from '../shared/utils/resolve-theme';
const StyledDiv = injectCss(styled.div `
    /* empty */
`);
function ThemeProvider(props) {
    const [style, css] = useComponentStyles(props);
    const [mainTheme] = useVariable(props.theme);
    const [baseTheme] = useVariable(props.base_theme);
    const theme = useMemo(() => resolveTheme(mainTheme, baseTheme), [baseTheme, mainTheme]);
    return (_jsx(StyledThemeProvider, { theme: theme, children: _jsx(StyledDiv, { style: Object.assign({ fontSize: theme.font.size }, style), "$rawCss": css, children: props.children.map((c) => (_jsx(DynamicComponent, { component: c }, c.uid))) }) }));
}
export default ThemeProvider;
//# sourceMappingURL=theme-provider.js.map