/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import{e}from"./p-C8IsBmNU.js";import{c as o}from"./p-BiTKUjko.js";const t=async(e,t,i,r,n,s)=>{var a;if(e)return e.attachViewToDom(t,i,n,r);if(!(s||"string"==typeof i||i instanceof HTMLElement))throw new Error("framework delegate is missing");const m="string"==typeof i?null===(a=t.ownerDocument)||void 0===a?void 0:a.createElement(i):i;return r&&r.forEach((e=>m.classList.add(e))),n&&Object.assign(m,n),t.appendChild(m),await new Promise((e=>o(m,e))),m},i=(e,o)=>{if(o){if(e)return e.removeViewFromDom(o.parentElement,o);o.remove()}return Promise.resolve()},r=()=>{let t,i;return{attachViewToDom:async(r,n,s={},a=[])=>{var m,c;let l;if(t=r,n){const e="string"==typeof n?null===(m=t.ownerDocument)||void 0===m?void 0:m.createElement(n):n;a.forEach((o=>e.classList.add(o))),Object.assign(e,s),t.appendChild(e),l=e,await new Promise((t=>o(e,t)))}else if(t.children.length>0&&("ION-MODAL"===t.tagName||"ION-POPOVER"===t.tagName)&&!(l=t.children[0]).classList.contains("ion-delegate-host")){const e=null===(c=t.ownerDocument)||void 0===c?void 0:c.createElement("div");e.classList.add("ion-delegate-host"),a.forEach((o=>e.classList.add(o))),e.append(...t.children),t.appendChild(e),l=e}const d=e.get("appRootSelector","ion-app"),f=document.querySelector(d)||document.body;return i=document.createComment("ionic teleport"),t.parentNode.insertBefore(i,t),f.appendChild(t),null!=l?l:t},removeViewFromDom:()=>(t&&i&&(i.parentNode.insertBefore(t,i),i.remove()),Promise.resolve())}};export{r as C,t as a,i as d}