import{w as i,B as a}from"./p-3d23a42a.js";const n="ionViewWillLeave",e="ionViewDidLeave",o="ionViewWillUnload",s=a=>new Promise(((n,e)=>{i((()=>{t(a),r(a).then((i=>{i.animation&&i.animation.destroy(),c(a),n(i)}),(i=>{c(a),e(i)}))}))})),t=i=>{const a=i.enteringEl,n=i.leavingEl;h(a,n,i.direction),i.showGoBack?a.classList.add("can-go-back"):a.classList.remove("can-go-back"),V(a,!1),n&&V(n,!1)},r=async i=>{const n=await d(i);return n&&a.isBrowser?w(n,i):l(i)},c=i=>{const a=i.leavingEl;i.enteringEl.classList.remove("ion-page-invisible"),void 0!==a&&a.classList.remove("ion-page-invisible")},d=async i=>{if(i.leavingEl&&i.animated&&0!==i.duration)return i.animationBuilder?i.animationBuilder:"ios"===i.mode?(await import("./p-97e03cb4.js")).iosTransitionAnimation:(await import("./p-1b5d4ef9.js")).mdTransitionAnimation},w=async(i,a)=>{await p(a,!0);const n=i(a.baseEl,a);u(a.enteringEl,a.leavingEl);const e=await m(n,a);return a.progressCallback&&a.progressCallback(void 0),e&&v(a.enteringEl,a.leavingEl),{hasCompleted:e,animation:n}},l=async i=>{const a=i.enteringEl,n=i.leavingEl;return await p(i,!1),u(a,n),v(a,n),{hasCompleted:!0}},p=async(i,a)=>{const n=(void 0!==i.deepWait?i.deepWait:a)?[f(i.enteringEl),f(i.leavingEl)]:[y(i.enteringEl),y(i.leavingEl)];await Promise.all(n),await b(i.viewIsReady,i.enteringEl)},b=async(i,a)=>{i&&await i(a)},m=(i,a)=>{const n=a.progressCallback,e=new Promise((a=>{i.onFinish((i=>a(1===i)))}));return n?(i.progressStart(!0),n(i)):i.play(),e},u=(i,a)=>{g(a,"ionViewWillLeave"),g(i,"ionViewWillEnter")},v=(i,a)=>{g(i,"ionViewDidEnter"),g(a,"ionViewDidLeave")},g=(i,a)=>{if(i){const n=new CustomEvent(a,{bubbles:!1,cancelable:!1});i.dispatchEvent(n)}},y=i=>i&&i.componentOnReady?i.componentOnReady():Promise.resolve(),f=async i=>{const a=i;if(a){if(null!=a.componentOnReady&&null!=await a.componentOnReady())return;await Promise.all(Array.from(a.children).map(f))}},V=(i,a)=>{a?(i.setAttribute("aria-hidden","true"),i.classList.add("ion-page-hidden")):(i.hidden=!1,i.removeAttribute("aria-hidden"),i.classList.remove("ion-page-hidden"))},h=(i,a,n)=>{void 0!==i&&(i.style.zIndex="back"===n?"99":"101"),void 0!==a&&(a.style.zIndex="100")},L=i=>{if(i.classList.contains("ion-page"))return i;return i.querySelector(":scope > .ion-page, :scope > ion-nav, :scope > ion-tabs")||i};export{o as L,n as a,e as b,f as d,L as g,g as l,V as s,s as t}