"use client";
import * as React from "react";
import { useMenuRootContext } from "../root/MenuRootContext.js";
import { MenuPortalContext } from "./MenuPortalContext.js";
import { jsx } from "react/jsx-runtime";
import { FloatingPortal } from "../../floating-ui-react/components/FloatingPortal.js";
const MenuPortal = /* @__PURE__ */ React.forwardRef(function MenuPortal2(props, forwardedRef) {
  const {
    keepMounted = false,
    ...portalProps
  } = props;
  const {
    store
  } = useMenuRootContext();
  const mounted = store.useState("mounted");
  const shouldRender = mounted || keepMounted;
  if (!shouldRender) {
    return null;
  }
  return /* @__PURE__ */ jsx(MenuPortalContext.Provider, {
    value: keepMounted,
    children: /* @__PURE__ */ jsx(FloatingPortal, {
      ref: forwardedRef,
      ...portalProps
    })
  });
});
if (process.env.NODE_ENV !== "production") MenuPortal.displayName = "MenuPortal";
export {
  MenuPortal
};
//# sourceMappingURL=MenuPortal.js.map
