import { useState, useEffect } from 'react';
import { createPortal } from 'react-dom';
import { jsx } from 'react/jsx-runtime';

function withNextPortalWrapper(Component) {
  return function (props) {
    const [mounted, setMounted] = useState(false);
    useEffect(() => {
      setMounted(true);
    }, [setMounted]);
    return mounted ? /*#__PURE__*/createPortal(/*#__PURE__*/jsx(Component, {
      ...props
    }), document.body) : null;
  };
}

export { withNextPortalWrapper as default };
//# sourceMappingURL=withNextPortal.mjs.map
