"use client";
const require_get_default_z_index = require("../../core/utils/get-default-z-index/get-default-z-index.cjs");
const require_use_props = require("../../core/MantineProvider/use-props/use-props.cjs");
const require_use_styles = require("../../core/styles-api/use-styles/use-styles.cjs");
const require_factory = require("../../core/factory/factory.cjs");
const require_Paper = require("../Paper/Paper.cjs");
const require_OptionalPortal = require("../Portal/OptionalPortal.cjs");
const require_FloatingWindow_module = require("./FloatingWindow.module.cjs");
let react = require("react");
let _mantine_hooks = require("@mantine/hooks");
let react_jsx_runtime = require("react/jsx-runtime");
//#region packages/@mantine/core/src/components/FloatingWindow/FloatingWindow.tsx
const defaultProps = {
	constrainToViewport: true,
	zIndex: require_get_default_z_index.getDefaultZIndex("overlay")
};
const FloatingWindow = require_factory.factory((_props) => {
	const props = require_use_props.useProps("FloatingWindow", defaultProps, _props);
	const { classNames, className, style, styles, unstyled, vars, mod, enabled, constrainToViewport, constrainOffset, dragHandleSelector, excludeDragHandleSelector, axis, initialPosition, onPositionChange, onDragStart, onDragEnd, setPositionRef, withinPortal, portalProps, zIndex, ref, ...others } = props;
	const getStyles = require_use_styles.useStyles({
		name: "FloatingWindow",
		classes: require_FloatingWindow_module.default,
		props,
		className,
		style,
		classNames,
		styles,
		unstyled,
		vars
	});
	const floatingWindow = (0, _mantine_hooks.useFloatingWindow)({
		enabled,
		constrainToViewport,
		constrainOffset,
		dragHandleSelector,
		excludeDragHandleSelector,
		axis,
		initialPosition,
		onPositionChange,
		onDragStart,
		onDragEnd
	});
	(0, react.useImperativeHandle)(setPositionRef, () => floatingWindow.setPosition, [floatingWindow.setPosition]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_OptionalPortal.OptionalPortal, {
		withinPortal,
		...portalProps,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Paper.Paper, {
			ref: (0, _mantine_hooks.useMergedRef)(ref, floatingWindow.ref),
			mod: [{ dragging: floatingWindow.isDragging }, mod],
			...getStyles("root"),
			...others,
			__vars: { "--floating-window-z-index": zIndex.toString() }
		})
	});
});
FloatingWindow.displayName = "@mantine/core/FloatingWindow";
FloatingWindow.classes = require_FloatingWindow_module.default;
//#endregion
exports.FloatingWindow = FloatingWindow;

//# sourceMappingURL=FloatingWindow.cjs.map