import{i as e}from"./p-5ab6b26f.js";let t=0;const n=e=>({create:t=>r(e,t),dismiss:(t,n,i)=>c(document,t,n,e,i),getTop:async()=>m(document,e)}),i=n("ion-alert"),o=n("ion-action-sheet"),s=n("ion-picker"),a=n("ion-popover"),r=(e,n)=>customElements.whenDefined(e).then(()=>{const i=document,o=i.createElement(e);d(i),Object.assign(o,n),o.classList.add("overlay-hidden");const s=t++;return o.overlayIndex=s,o.hasAttribute("id")||(o.id=`ion-overlay-${s}`),u(i).appendChild(o),o.componentOnReady()}),d=e=>{0===t&&(t=1,e.addEventListener("focusin",t=>{const n=m(e);if(n&&n.backdropDismiss&&!h(n,t.target)){const e=n.querySelector("input,button");e&&e.focus()}}),e.addEventListener("ionBackButton",t=>{const n=m(e);n&&n.backdropDismiss&&t.detail.register(100,()=>n.dismiss(void 0,E))}),e.addEventListener("keyup",t=>{if("Escape"===t.key){const t=m(e);t&&t.backdropDismiss&&t.dismiss(void 0,E)}}))},c=(e,t,n,i,o)=>{const s=m(e,i,o);return s?s.dismiss(t,n):Promise.reject("overlay does not exist")},m=(e,t,n)=>{const i=((e,t)=>{const n=Array.from(u(e).children).filter(e=>e.overlayIndex>0);return void 0===t?n:(t=t.toUpperCase(),n.filter(e=>e.tagName===t))})(e,t);return void 0===n?i[i.length-1]:i.find(e=>e.id===n)},l=async(t,n,i,o,s)=>{if(t.presented)return;t.presented=!0,t.willPresent.emit();const a=t.enterAnimation?t.enterAnimation:e.get(n,"ios"===t.mode?i:o);await y(t,a,t.el,s)&&t.didPresent.emit()},p=async(t,n,i,o,s,a,r)=>{if(!t.presented)return!1;t.presented=!1;try{t.willDismiss.emit({data:n,role:i});const d=t.leaveAnimation?t.leaveAnimation:e.get(o,"ios"===t.mode?s:a);await y(t,d,t.el,r),t.didDismiss.emit({data:n,role:i})}catch(e){console.error(e)}return t.el.remove(),!0},u=e=>e.querySelector("ion-app")||e.body,y=async(t,n,i,o)=>{if(t.animation)return t.animation.destroy(),t.animation=void 0,!1;i.classList.remove("overlay-hidden");const s=i.shadowRoot||t.el,a=await __sc_import_webmapgl("./p-d3aa5dba.js").then(e=>e.create(n,s,o));t.animation=a,t.animated&&e.getBoolean("animated",!0)||a.duration(0),t.keyboardClose&&a.beforeAddWrite(()=>{const e=i.ownerDocument.activeElement;e&&e.matches("input, ion-input, ion-textarea")&&e.blur()}),await a.playAsync();const r=a.hasCompleted;return a.destroy(),t.animation=void 0,r},v=(e,t)=>{let n;const i=new Promise(e=>n=e);return f(e,t,e=>{n(e.detail)}),i},f=(e,t,n)=>{const i=o=>{e.removeEventListener(t,i),n(o)};e.addEventListener(t,i)},b=e=>"cancel"===e||e===E,h=(e,t)=>{for(;t;){if(t===e)return!0;t=t.parentElement}return!1},g=e=>e(),w=(t,n)=>{if("function"==typeof t)return e.get("_zoneGate",g)(()=>{try{return t(n)}catch(e){console.error(e)}})},E="backdrop";export{E as B,p as a,s as b,r as c,c as d,v as e,a as f,m as g,o as h,b as i,i as j,l as p,w as s};