'use client';
import React from 'react';
import { localStorageColorSchemeManager } from './color-scheme-managers/local-storage-manager.mjs';
import { MantineContext } from './Mantine.context.mjs';
import { MantineClasses } from './MantineClasses/MantineClasses.mjs';
import { MantineCssVariables } from './MantineCssVariables/MantineCssVariables.mjs';
import { MantineThemeProvider } from './MantineThemeProvider/MantineThemeProvider.mjs';
import { suppressNextjsWarning } from './suppress-nextjs-warning.mjs';
import '@mantine/hooks';
import { useProviderColorScheme } from './use-mantine-color-scheme/use-provider-color-scheme.mjs';
import { useRespectReduceMotion } from './use-respect-reduce-motion/use-respect-reduce-motion.mjs';

suppressNextjsWarning();
function MantineProvider({
  theme,
  children,
  getStyleNonce,
  withStaticClasses = true,
  withGlobalClasses = true,
  deduplicateCssVariables = true,
  withCssVariables = true,
  cssVariablesSelector = ":root",
  classNamesPrefix = "mantine",
  colorSchemeManager = localStorageColorSchemeManager(),
  defaultColorScheme = "light",
  getRootElement = () => document.documentElement,
  cssVariablesResolver,
  forceColorScheme
}) {
  const { colorScheme, setColorScheme, clearColorScheme } = useProviderColorScheme({
    defaultColorScheme,
    forceColorScheme,
    manager: colorSchemeManager,
    getRootElement
  });
  useRespectReduceMotion({
    respectReducedMotion: theme?.respectReducedMotion || false,
    getRootElement
  });
  return /* @__PURE__ */ React.createElement(
    MantineContext.Provider,
    {
      value: {
        colorScheme,
        setColorScheme,
        clearColorScheme,
        getRootElement,
        classNamesPrefix,
        getStyleNonce,
        cssVariablesResolver,
        cssVariablesSelector,
        withStaticClasses
      }
    },
    /* @__PURE__ */ React.createElement(MantineThemeProvider, { theme }, withCssVariables && /* @__PURE__ */ React.createElement(
      MantineCssVariables,
      {
        cssVariablesSelector,
        deduplicateCssVariables
      }
    ), withGlobalClasses && /* @__PURE__ */ React.createElement(MantineClasses, null), children)
  );
}
MantineProvider.displayName = "@mantine/core/MantineProvider";
function HeadlessMantineProvider({ children, theme }) {
  return /* @__PURE__ */ React.createElement(
    MantineContext.Provider,
    {
      value: {
        colorScheme: "auto",
        setColorScheme: () => {
        },
        clearColorScheme: () => {
        },
        getRootElement: () => document.documentElement,
        classNamesPrefix: "mantine",
        cssVariablesSelector: ":root",
        withStaticClasses: false,
        headless: true
      }
    },
    /* @__PURE__ */ React.createElement(MantineThemeProvider, { theme }, children)
  );
}
HeadlessMantineProvider.displayName = "@mantine/core/HeadlessMantineProvider";

export { HeadlessMantineProvider, MantineProvider };
//# sourceMappingURL=MantineProvider.mjs.map
