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