import { jsx } from "react/jsx-runtime";
import { createContext, useContext } from "react";
import { withEmotionCache } from "@emotion/react";
const EmotionCacheContext = createContext(null);
function useEmotionCache() {
  const cache = useContext(EmotionCacheContext);
  if (cache === null) {
    throw new Error(
      "Emotion cache is not available in context, make sure that you have MantineEmotionProvider in the component tree"
    );
  }
  return cache;
}
const MantineEmotionProvider = withEmotionCache(
  ({ children, cache }, ctx) => /* @__PURE__ */ jsx(EmotionCacheContext.Provider, { value: cache || ctx, children })
);
export {
  EmotionCacheContext,
  MantineEmotionProvider,
  useEmotionCache
};
