import{M as t}from"./p-a4d32aeb.js";import{c as n}from"./p-8cd54418.js";import{g as a}from"./p-24c4a299.js";import{c as r}from"./p-1a820863.js";
/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */const e=t=>r().duration(t?400:300),s=t=>{let n,s;const o=t.width+8,i=r(),c=r();t.isEndSide?(n=o+"px",s="0px"):(n=-o+"px",s="0px"),i.addElement(t.menuInnerEl).fromTo("transform",`translateX(${n})`,`translateX(${s})`);const p="ios"===a(t),u=p?.2:.25;return c.addElement(t.backdropEl).fromTo("opacity",.01,u),e(p).addAnimation([i,c])},o=t=>{let n,s;const o=a(t),i=t.width;t.isEndSide?(n=-i+"px",s=i+"px"):(n=i+"px",s=-i+"px");const c=r().addElement(t.menuInnerEl).fromTo("transform",`translateX(${s})`,"translateX(0px)"),p=r().addElement(t.contentEl).fromTo("transform","translateX(0px)",`translateX(${n})`),u=r().addElement(t.backdropEl).fromTo("opacity",.01,.32);return e("ios"===o).addAnimation([c,p,u])},i=t=>{const n=a(t),s=t.width*(t.isEndSide?-1:1)+"px",o=r().addElement(t.contentEl).fromTo("transform","translateX(0px)",`translateX(${s})`);return e("ios"===n).addAnimation(o)},c=(()=>{const a=new Map,r=[],e=async t=>{if(await y(),"start"===t||"end"===t){return w((n=>n.side===t&&!n.disabled))||w((n=>n.side===t))}if(null!=t)return w((n=>n.menuId===t));return w((t=>!t.disabled))||(r.length>0?r[0].el:void 0)},c=async()=>(await y(),m()),p=(t,n)=>{a.set(t,n)},u=t=>{const n=t.side;r.filter((a=>a.side===n&&a!==t)).forEach((t=>t.disabled=!0))},m=()=>w((t=>t._isOpen)),l=()=>r.some((t=>t.isAnimating)),w=t=>{const n=r.find(t);if(void 0!==n)return n.el},y=()=>Promise.all(Array.from(document.querySelectorAll("ion-menu")).map((t=>new Promise((a=>n(t,a))))));return p("reveal",i),p("push",o),p("overlay",s),"undefined"!=typeof document&&document.addEventListener("ionBackButton",(n=>{const a=m();a&&n.detail.register(t,(()=>a.close()))})),{registerAnimation:p,get:e,getMenus:async()=>(await y(),r.map((t=>t.el))),getOpen:c,isEnabled:async t=>{const n=await e(t);return!!n&&!n.disabled},swipeGesture:async(t,n)=>{const a=await e(n);return a&&(a.swipeGesture=t),a},isAnimating:async()=>(await y(),l()),isOpen:async t=>{if(null!=t){const n=await e(t);return void 0!==n&&n.isOpen()}return void 0!==await c()},enable:async(t,n)=>{const a=await e(n);return a&&(a.disabled=!t),a},toggle:async t=>{const n=await e(t);return!!n&&n.toggle()},close:async t=>{const n=await(void 0!==t?e(t):c());return void 0!==n&&n.close()},open:async t=>{const n=await e(t);return!!n&&n.open()},_getOpenSync:m,_createAnimation:(t,n)=>{const r=a.get(t);if(!r)throw new Error("animation not registered");return r(n)},_register:t=>{r.indexOf(t)<0&&(t.disabled||u(t),r.push(t))},_unregister:t=>{const n=r.indexOf(t);n>-1&&r.splice(n,1)},_setOpen:async(t,n,a)=>{if(l())return!1;if(n){const n=await c();n&&t.el!==n&&await n.setOpen(!1,!1)}return t._setOpen(n,a)},_setActiveMenu:u}})();
/*!
 * (C) Ionic http://ionicframework.com - MIT License
 */export{c as m}