"use strict";const p=(t,n)=>{const e=setTimeout(t,n);return()=>clearTimeout(e)},I=(t,n)=>{const e=setInterval(t,n);return()=>clearInterval(e)};function w(t,n,e={}){const{noTrailing:i=!1,noLeading:r=!1,debounceMode:l}=e;let o,f=!1,a=0;function m(){o&&clearTimeout(o)}function v(c){const{upcomingOnly:s=!1}=c||{};m(),f=!s}function d(...c){if(f)return;const s=this,T=Date.now()-a;function u(){a=Date.now(),n.apply(s,c)}function g(){o=void 0}!r&&l&&!o&&u(),m(),l===void 0&&T>t?r?(a=Date.now(),i||(o=setTimeout(l?g:u,t))):u():i||(o=setTimeout(l?g:u,l===void 0?Math.max(0,t-T):t))}return d.cancel=v,d}function x(t,n,{atBegin:e=!1}={}){return w(t,n,{debounceMode:e!==!1})}const A=t=>{let n=null;const e=i=>{n=null,t(i)};return n==null&&(n=requestAnimationFrame(e)),()=>{n!=null&&(cancelAnimationFrame(n),n=null)}};exports.I=x;exports.T=p;exports.g=A;exports.x=I;
