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