"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
require("react");
const getSize = require("../../core/utils/get-size/get-size.cjs");
const createVarsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
require("clsx");
const useProps = require("../../core/MantineProvider/use-props/use-props.cjs");
const useStyles = require("../../core/styles-api/use-styles/use-styles.cjs");
const factory = require("../../core/factory/factory.cjs");
const Affix = require("../Affix/Affix.cjs");
const CloseButton = require("../CloseButton/CloseButton.cjs");
const Paper = require("../Paper/Paper.cjs");
const Transition = require("../Transition/Transition.cjs");
const Dialog_module_css = require("./Dialog.module.css.cjs");
const defaultProps = {
  shadow: "md",
  p: "md",
  withBorder: false,
  transitionProps: { transition: "pop-top-right", duration: 200 },
  position: {
    bottom: 30,
    right: 30
  }
};
const varsResolver = createVarsResolver.createVarsResolver((_, { size }) => ({
  root: {
    "--dialog-size": getSize.getSize(size, "dialog-size")
  }
}));
const Dialog = factory.factory((_props, ref) => {
  const props = useProps.useProps("Dialog", defaultProps, _props);
  const {
    classNames,
    className,
    style,
    styles,
    unstyled,
    vars,
    zIndex,
    position,
    keepMounted,
    opened,
    transitionProps,
    withCloseButton,
    withinPortal,
    children,
    onClose,
    portalProps,
    ...others
  } = props;
  const getStyles = useStyles.useStyles({
    name: "Dialog",
    classes: Dialog_module_css.default,
    props,
    className,
    style,
    classNames,
    styles,
    unstyled,
    vars,
    varsResolver
  });
  return /* @__PURE__ */ jsxRuntime.jsx(
    Affix.Affix,
    {
      zIndex,
      position,
      ref,
      withinPortal,
      portalProps,
      unstyled,
      children: /* @__PURE__ */ jsxRuntime.jsx(Transition.Transition, { keepMounted, mounted: opened, ...transitionProps, children: (transitionStyles) => /* @__PURE__ */ jsxRuntime.jsxs(
        Paper.Paper,
        {
          unstyled,
          ...getStyles("root", { style: transitionStyles }),
          ...others,
          children: [
            withCloseButton && /* @__PURE__ */ jsxRuntime.jsx(CloseButton.CloseButton, { onClick: onClose, unstyled, ...getStyles("closeButton") }),
            children
          ]
        }
      ) })
    }
  );
});
Dialog.classes = Dialog_module_css.default;
Dialog.displayName = "@mantine/core/Dialog";
exports.Dialog = Dialog;
