"use strict";function animateTo(e,t,n){return new Promise((i=>{if((null==n?void 0:n.duration)===1/0)throw new Error("Promise-based animations must be finite.");if(!(null==e?void 0:e.animate))return;const o=e.animate(t,{...n,duration:prefersReducedMotion()?0:n.duration});o&&(o.addEventListener("cancel",i,{once:!0}),o.addEventListener("finish",i,{once:!0}))}))}function prefersReducedMotion(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function stopAnimations(e){var t;return Promise.all(((null===(t=null==e?void 0:e.getAnimations)||void 0===t?void 0:t.call(e))||[]).map((e=>new Promise((t=>{const n=requestAnimationFrame(t);e.addEventListener("cancel",(()=>n),{once:!0}),e.addEventListener("finish",(()=>n),{once:!0}),e.cancel()})))))}function shimKeyframesHeightAuto(e,t){return e.map((e=>({...e,height:"auto"===e.height?`${t}px`:e.height})))}const defaultAnimationRegistry=new Map,customAnimationRegistry=new WeakMap;function ensureAnimation(e){return null!=e?e:{keyframes:[],options:{duration:0}}}function setDefaultAnimation(e,t){defaultAnimationRegistry.set(e,ensureAnimation(t))}function getAnimation(e,t,n={}){var i;const o=customAnimationRegistry.get(e),a=null!==(i=null==o?void 0:o[t])&&void 0!==i?i:defaultAnimationRegistry.get(t);return a?"rtl"===n.dir&&a.rtlKeyframes?{...a,keyframes:a.rtlKeyframes}:a:{keyframes:[],options:{duration:0}}}exports.animateTo=animateTo,exports.getAnimation=getAnimation,exports.setDefaultAnimation=setDefaultAnimation,exports.shimKeyframesHeightAuto=shimKeyframesHeightAuto,exports.stopAnimations=stopAnimations;