import { getHelpers } from "./create-styles.mjs";
import { useCss } from "./use-css.mjs";
import { useMantineTheme } from "../../../../../@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/core/MantineProvider/MantineThemeProvider/MantineThemeProvider.mjs";
function sxTransform() {
  const theme = useMantineTheme();
  const { css } = useCss();
  return (sx) => {
    const parsedSx = typeof sx === "function" ? sx(theme, getHelpers(theme)) : sx;
    return !parsedSx ? "" : css(parsedSx);
  };
}
function stylesTransform() {
  const theme = useMantineTheme();
  const { css } = useCss();
  return (styles, payload) => {
    if (!styles) {
      return {};
    }
    const stylesObject = typeof styles === "function" ? styles(theme, payload.props, getHelpers(theme)) : styles;
    return Object.keys(stylesObject).reduce((acc, key) => {
      const value = stylesObject[key];
      const parsedValue = typeof value === "function" ? value(theme) : value;
      return { ...acc, [key]: css(parsedValue) };
    }, {});
  };
}
const emotionTransform = {
  sx: sxTransform,
  styles: stylesTransform
};
export {
  emotionTransform
};
