/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */
import{e as n,f as e,w as i,B as a}from"./p-gD7P82jx.js";import{r as o}from"./p-hPTD29t1.js";const r="ionViewWillEnter",t="ionViewDidEnter",s="ionViewWillLeave",c="ionViewDidLeave",l="ionViewWillUnload",u=n=>{n.tabIndex=-1,n.focus()},d=n=>null!==n.offsetParent,f="ion-last-focus",p=e=>{if(n.get("focusManagerPriority",!1)){const n=document.activeElement;null!==n&&(null==e?void 0:e.contains(n))&&n.setAttribute(f,"true")}},w=i=>{const a=n.get("focusManagerPriority",!1);if(Array.isArray(a)&&!i.contains(document.activeElement)){const n=i.querySelector(`[${f}]`);if(n&&d(n))return void u(n);for(const n of a)switch(n){case"content":const a=i.querySelector('main, [role="main"]');if(a&&d(a))return void u(a);break;case"heading":const o=i.querySelector('h1, [role="heading"][aria-level="1"]');if(o&&d(o))return void u(o);break;case"banner":const r=i.querySelector('header, [role="banner"]');if(r&&d(r))return void u(r);break;default:e(`Unrecognized focus manager priority value ${n}`)}u(i)}},v=n=>new Promise(((e,a)=>{i((()=>{const i=A(n);m(n,i),g(n).then((i=>{i.animation&&i.animation.destroy(),b(n),e(i)}),(e=>{b(n),a(e)})).finally((()=>{W(i,!1)}))}))})),m=(n,e)=>{const i=n.enteringEl,a=n.leavingEl;p(a),U(i,a,n.direction),W(e,!0),n.showGoBack?i.classList.add("can-go-back"):i.classList.remove("can-go-back"),M(i,!1),i.style.setProperty("pointer-events","none"),a&&(M(a,!1),a.style.setProperty("pointer-events","none"))},g=async n=>{const e=await h(n);return e&&a.isBrowser?y(e,n):P(n)},b=n=>{const e=n.enteringEl,i=n.leavingEl;e.classList.remove("ion-page-invisible"),e.style.removeProperty("pointer-events"),void 0!==i&&(i.classList.remove("ion-page-invisible"),i.style.removeProperty("pointer-events")),w(e)},h=async n=>{if(n.leavingEl&&n.animated&&0!==n.duration)return n.animationBuilder?n.animationBuilder:"ios"===n.mode?(await import("./p-TL0QOgYo.js")).iosTransitionAnimation:(await import("./p-DOsU-ODO.js")).mdTransitionAnimation},y=async(n,e)=>{await k(e,!0);const i=n(e.baseEl,e);V(e.enteringEl,e.leavingEl);const a=await j(i,e);return e.progressCallback&&e.progressCallback(void 0),a&&L(e.enteringEl,e.leavingEl),{hasCompleted:a,animation:i}},P=async e=>{const i=e.enteringEl,a=e.leavingEl,o=n.get("focusManagerPriority",!1);return await k(e,o),V(i,a),L(i,a),{hasCompleted:!0}},k=async(n,e)=>{(void 0!==n.deepWait?n.deepWait:e)&&await Promise.all([E(n.enteringEl),E(n.leavingEl)]),await D(n.viewIsReady,n.enteringEl)},D=async(n,e)=>{n&&await n(e)},j=(n,e)=>{const i=e.progressCallback,a=new Promise((e=>{n.onFinish((n=>e(1===n)))}));return i?(n.progressStart(!0),i(n)):n.play(),a},V=(n,e)=>{O(e,s),O(n,r)},L=(n,e)=>{O(n,t),O(e,c)},O=(n,e)=>{if(n){const i=new CustomEvent(e,{bubbles:!1,cancelable:!1});n.dispatchEvent(i)}},C=()=>new Promise((n=>o((()=>o((()=>n())))))),E=async n=>{const e=n;if(e){if(null!=e.componentOnReady){if(null!=await e.componentOnReady())return}else if(null!=e.__registerHost){const n=new Promise((n=>o(n)));return void await n}await Promise.all(Array.from(e.children).map(E))}},M=(n,e)=>{e?(n.setAttribute("aria-hidden","true"),n.classList.add("ion-page-hidden")):(n.hidden=!1,n.removeAttribute("aria-hidden"),n.classList.remove("ion-page-hidden"))},U=(n,e,i)=>{void 0!==n&&(n.style.zIndex="back"===i?"99":"101"),void 0!==e&&(e.style.zIndex="100")},W=(n,e)=>{if(!n)return;const i="header-transitioning";e?n.classList.add(i):n.classList.remove(i)},x=n=>{if(n.classList.contains("ion-page"))return n;return n.querySelector(":scope > .ion-page, :scope > ion-nav, :scope > ion-tabs")||n},A=n=>{if("ios"!==n.mode)return null;const e="back"===n.direction?n.leavingEl:n.enteringEl;return e?e.querySelector("ion-header"):null};export{r as L,t as a,s as b,c,l as d,E as e,x as g,O as l,M as s,v as t,C as w}