import '../../../preact/compat/dist/compat.module.mjs';
import ThemeProviderNoVars from './ThemeProviderNoVars.mjs';
import { CssVarsProvider } from './ThemeProviderWithVars.mjs';
import THEME_ID from './identifier.mjs';
import { jsx as u } from '../../../preact/jsx-runtime/dist/jsxRuntime.module.mjs';

function ThemeProvider({
  theme,
  ...props
}) {
  if (typeof theme === 'function') {
    return /*#__PURE__*/u(ThemeProviderNoVars, {
      theme: theme,
      ...props
    });
  }
  const muiTheme = THEME_ID in theme ? theme[THEME_ID] : theme;
  if (!('colorSchemes' in muiTheme)) {
    return /*#__PURE__*/u(ThemeProviderNoVars, {
      theme: theme,
      ...props
    });
  }
  return /*#__PURE__*/u(CssVarsProvider, {
    theme: theme,
    ...props
  });
}

export { ThemeProvider as default };
//# sourceMappingURL=ThemeProvider.mjs.map
