/*!
 * (C) Gasco https://gasco-web-component.herokuapp.com/ - MIT License
 */
import{c as e,r}from"./p-67499028.js";const t=async(r,t,o,n,i,s)=>{var a;if(r)return r.attachViewToDom(t,o,n,s);if(!(i||"string"==typeof o||o instanceof HTMLElement))throw new Error("framework delegate is missing");const c="string"==typeof o?null===(a=t.ownerDocument)||void 0===a?void 0:a.createElement(o):o;return s&&s.forEach((e=>c.classList.add(e))),n&&Object.assign(c,n),t.appendChild(c),await new Promise((r=>e(c,r))),c},o=(e,r)=>{if(r){if(e)return e.removeViewFromDom(r.parentElement,r);r.remove()}return Promise.resolve()},n=()=>{let r,t;return{attachViewToDom:async(o,n,i={},s=[])=>{var a;if(r=o,n){const t="string"==typeof n?null===(a=r.ownerDocument)||void 0===a?void 0:a.createElement(n):n;s.forEach((e=>t.classList.add(e))),Object.assign(t,i),r.appendChild(t),await new Promise((r=>e(t,r)))}const c=document.querySelector("gasco-app")||document.body;return t=document.createComment("gasco teleport"),r.parentNode.insertBefore(t,r),c.appendChild(r),r},removeViewFromDom:()=>(r&&t&&(t.parentNode.insertBefore(r,t),t.remove()),Promise.resolve())}},i=async e=>{const t=e;if(t){if(null!=t.componentOnReady){if(null!=await t.componentOnReady())return}else if(null!=t.__registerHost){const e=new Promise((e=>r(e)));return void await e}await Promise.all(Array.from(t.children).map(i))}};export{n as C,t as a,o as b,i as d}