import{defineComponent as u,onBeforeMount as f,onMounted as l,watch as d,onUpdated as c,nextTick as s,createVNode as p,Teleport as m}from"vue";import{useInjectPortal as C}from"../vc-trigger/context.mjs";import g from"./vue-types/index.mjs";const M=u({compatConfig:{MODE:3},name:"Portal",inheritAttrs:!1,props:{getContainer:g.func.isRequired,didUpdate:Function},setup(n,{slots:o}){let r=!0,e;const{shouldRender:t}=C();function i(){t.value&&(e=n.getContainer())}f(()=>{r=!1,i()}),l(()=>{e||i()});const a=d(t,()=>{t.value&&!e&&(e=n.getContainer()),e&&a()});return c(()=>{s(()=>{t.value&&n.didUpdate?.(n)})}),()=>t.value?r?o.default?.():e?p(m,{to:e},o):null:null}});export{M as default};
