import { jsx } from "react/jsx-runtime";
import { useContext, useState, useEffect } from "react";
/* empty css                                                                                                                                                                                             */
/* empty css                                                                                                                                                                                              */
/* empty css                                                                                                                                                                                                      */
/* empty css                                                                                                                                                                                                 */
/* empty css                                                                                                                                                                                                 */
import { NavMenuRefContext } from "./nav-menu-ref-context.mjs";
import { Portal } from "../../../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Portal/Portal.mjs";
const NavMenuPortal = ({ children }) => {
  const ctx = useContext(NavMenuRefContext);
  const [target, setTarget] = useState();
  useEffect(() => {
    if (ctx == null ? void 0 : ctx.current) {
      setTarget(ctx.current);
    }
  }, [ctx]);
  if (!ctx) {
    return null;
  }
  if (!target) {
    return null;
  }
  return /* @__PURE__ */ jsx(Portal, { target, children });
};
export {
  NavMenuPortal
};
