function animate(t,e){return t.classList.add(e),new Promise((n=>{if((t=>{const e=getComputedStyle(t).getPropertyValue("animation-name");return e&&"none"!==e})(t)){const i=t.getBoundingClientRect(),o=`height: ${i.bottom-i.top}px; width: ${i.right-i.left}px`;t.setAttribute("style",`position: absolute; ${o}`),((t,e)=>{const listener=()=>{t.removeEventListener("animationend",listener),e()};t.addEventListener("animationend",listener)})(t,(()=>{t.classList.remove(e),t.removeAttribute("style"),n()}))}else t.classList.remove(e),n()}))}export default animate;