import{s as a,a as i,b as t}from"../internal/animate.esm.js";import{s as e,g as n}from"../utilities/animation-registry.esm.js";import{w as o}from"../internal/event.esm.js";async function s(e){if(e.emit("nile-show",{cancelable:!0}).defaultPrevented)return void(e.open=!1);await a(e.body),e.body.hidden=!1;const{keyframes:o,options:s}=n(e,"detail.show",{dir:"ltr"});await i(e.body,t(o,e.body.scrollHeight),s),e.body.style.height="auto",e.emit("nile-after-show")}async function r(e){if(e.emit("nile-hide",{cancelable:!0}).defaultPrevented)return void(e.open=!0);await a(e.body);const{keyframes:o,options:s}=n(e,"detail.hide",{dir:"ltr"});await i(e.body,t(o,e.body.scrollHeight),s),e.body.hidden=!0,e.body.style.height="auto",e.emit("nile-after-hide")}async function f(a){if(!a.open&&!a.disabled)return a.open=!0,o(a,"nile-after-show")}async function c(a){if(a.open&&!a.disabled)return a.open=!1,o(a,"nile-after-hide")}function h(a){a.disabled||(a.open?c(a):f(a))}function l(a,i){a.preventDefault(),"Enter"!==a.key&&" "!==a.key||(i.open?c(i):f(i)),"ArrowUp"!==a.key&&"ArrowLeft"!==a.key||c(i),"ArrowDown"!==a.key&&"ArrowRight"!==a.key||f(i)}e("detail.show",{keyframes:[{height:"0",opacity:"0"},{height:"auto",opacity:"1"}],options:{duration:300,easing:"ease"}}),e("detail.hide",{keyframes:[{height:"auto",opacity:"1"},{height:"0",opacity:"0"}],options:{duration:300,easing:"ease"}});export{l as a,s as b,r as c,c as d,h,f as s};
