"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
require("react");
const getDefaultZIndex = require("../../core/utils/get-default-z-index/get-default-z-index.cjs");
const createVarsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
require("clsx");
const MantineThemeProvider = require("../../core/MantineProvider/MantineThemeProvider/MantineThemeProvider.cjs");
const useProps = require("../../core/MantineProvider/use-props/use-props.cjs");
const useStyles = require("../../core/styles-api/use-styles/use-styles.cjs");
const Box = require("../../core/Box/Box.cjs");
const factory = require("../../core/factory/factory.cjs");
const Loader = require("../Loader/Loader.cjs");
const Overlay = require("../Overlay/Overlay.cjs");
const Transition = require("../Transition/Transition.cjs");
const LoadingOverlay_module_css = require("./LoadingOverlay.module.css.cjs");
const defaultProps = {
  transitionProps: { transition: "fade", duration: 0 },
  overlayProps: { backgroundOpacity: 0.75 },
  zIndex: getDefaultZIndex.getDefaultZIndex("overlay")
};
const varsResolver = createVarsResolver.createVarsResolver((_, { zIndex }) => ({
  root: {
    "--lo-z-index": zIndex == null ? void 0 : zIndex.toString()
  }
}));
const LoadingOverlay = factory.factory((_props, ref) => {
  const props = useProps.useProps("LoadingOverlay", defaultProps, _props);
  const {
    classNames,
    className,
    style,
    styles,
    unstyled,
    vars,
    transitionProps,
    loaderProps,
    overlayProps,
    visible,
    zIndex,
    ...others
  } = props;
  const theme = MantineThemeProvider.useMantineTheme();
  const getStyles = useStyles.useStyles({
    name: "LoadingOverlay",
    classes: LoadingOverlay_module_css.default,
    props,
    className,
    style,
    classNames,
    styles,
    unstyled,
    vars,
    varsResolver
  });
  const _overlayProps = { ...defaultProps.overlayProps, ...overlayProps };
  return /* @__PURE__ */ jsxRuntime.jsx(Transition.Transition, { transition: "fade", ...transitionProps, mounted: !!visible, children: (transitionStyles) => /* @__PURE__ */ jsxRuntime.jsxs(Box.Box, { ...getStyles("root", { style: transitionStyles }), ref, ...others, children: [
    /* @__PURE__ */ jsxRuntime.jsx(Loader.Loader, { ...getStyles("loader"), unstyled, ...loaderProps }),
    /* @__PURE__ */ jsxRuntime.jsx(
      Overlay.Overlay,
      {
        ..._overlayProps,
        ...getStyles("overlay"),
        darkHidden: true,
        unstyled,
        color: (overlayProps == null ? void 0 : overlayProps.color) || theme.white
      }
    ),
    /* @__PURE__ */ jsxRuntime.jsx(
      Overlay.Overlay,
      {
        ..._overlayProps,
        ...getStyles("overlay"),
        lightHidden: true,
        unstyled,
        color: (overlayProps == null ? void 0 : overlayProps.color) || theme.colors.dark[5]
      }
    )
  ] }) });
});
LoadingOverlay.classes = LoadingOverlay_module_css.default;
LoadingOverlay.displayName = "@mantine/core/LoadingOverlay";
exports.LoadingOverlay = LoadingOverlay;
