import{getElement}from"@stencil/core/internal/client";var createDeferredPromise=function(){var e;return{promise:new Promise((function(n){e=n})),resolve:e}},openWormhole=function(e,n,o){void 0===o&&(o=!0);var t="Function"===e.constructor.name?e.prototype:e,r=t.componentWillLoad;t.componentWillLoad=function(){var e=this,t=getElement(this),i=createDeferredPromise(),c=new CustomEvent("openWormhole",{bubbles:!0,composed:!0,detail:{consumer:this,fields:n,updater:function(n,o){(n in t?t:e)[n]=o},onOpen:i}});t.dispatchEvent(c);var l=function(){if(r)return r.call(e)};return o?i.promise.then((function(){return l()})):l()}};export{openWormhole as o};