import * as React from 'react';
import ReactDOM__default from 'react-dom';
import { Primitive } from '../../../../../@radix-ui_react-primitive@2.0.0_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3._3zmfwjcm3t5zu55yjfddt34hay/node_modules/@radix-ui/react-primitive/dist/index.js';
import { useLayoutEffect as useLayoutEffect2 } from '../../../../../@radix-ui_react-use-layout-effect@1.1.0_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-use-layout-effect/dist/index.js';
import { j as jsxRuntimeExports } from '../../../../../react@18.2.0/node_modules/react/jsx-runtime.js';

var PORTAL_NAME = "Portal";
var Portal = React.forwardRef((props, forwardedRef) => {
  const { container: containerProp, ...portalProps } = props;
  const [mounted, setMounted] = React.useState(false);
  useLayoutEffect2(() => setMounted(true), []);
  const container = containerProp || mounted && globalThis?.document?.body;
  return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
});
Portal.displayName = PORTAL_NAME;

export { Portal };
//# sourceMappingURL=index.js.map
