"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const isElement = require("../../core/utils/is-element/is-element.cjs");
require("clsx");
const VisuallyHidden = require("../VisuallyHidden/VisuallyHidden.cjs");
const useFocusTrap = require("../../../../../../../@mantine_hooks@7.15.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-focus-trap/use-focus-trap.cjs");
const useMergedRef = require("../../../../../../../@mantine_hooks@7.15.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-merged-ref/use-merged-ref.cjs");
function FocusTrap({
  children,
  active = true,
  refProp = "ref",
  innerRef
}) {
  const focusTrapRef = useFocusTrap.useFocusTrap(active);
  const ref = useMergedRef.useMergedRef(focusTrapRef, innerRef);
  if (!isElement.isElement(children)) {
    return children;
  }
  return React.cloneElement(children, { [refProp]: ref });
}
function FocusTrapInitialFocus(props) {
  return /* @__PURE__ */ jsxRuntime.jsx(VisuallyHidden.VisuallyHidden, { tabIndex: -1, "data-autofocus": true, ...props });
}
FocusTrap.displayName = "@mantine/core/FocusTrap";
FocusTrapInitialFocus.displayName = "@mantine/core/FocusTrapInitialFocus";
FocusTrap.InitialFocus = FocusTrapInitialFocus;
exports.FocusTrap = FocusTrap;
exports.FocusTrapInitialFocus = FocusTrapInitialFocus;
