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.17.8_patch_hash_3qirwkgu3wxhvd6hnr2gb24yzq_@mantine_hooks@7.17.8_react@18.3.1_e5yvlgwhmeykc75dkphi7jou6q/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
};
