import{aF as c,aC as a}from"./iframe-DvhcA1iZ.js";import"./preload-helper-PPVm8Dsz.js";var n={},i;function m(){if(i)return n;i=1;var e=c();return n.createRoot=e.createRoot,n.hydrateRoot=e.hydrateRoot,n}var R=m(),s=new Map;function v(){return globalThis.IS_REACT_ACT_ENVIRONMENT}var p=({callback:e,children:r})=>{let t=a.useRef();return a.useLayoutEffect(()=>{t.current!==e&&(t.current=e,e())},[e]),r};typeof Promise.withResolvers>"u"&&(Promise.withResolvers=()=>{let e=null,r=null;return{promise:new Promise((t,o)=>{e=t,r=o}),resolve:e,reject:r}});var d=async(e,r,t)=>{let o=await E(r,t);if(v()){o.render(e);return}let{promise:u,resolve:l}=Promise.withResolvers();return o.render(a.createElement(p,{callback:l},e)),u},w=(e,r)=>{let t=s.get(e);t&&(t.unmount(),s.delete(e))},E=async(e,r)=>{let t=s.get(e);return t||(t=R.createRoot(e,r),s.set(e,t)),t};export{d as renderElement,w as unmountElement};
