import r from"@babel/runtime/helpers/toConsumableArray";import{useRef as n,useMemo as t,useEffect as e}from"react";var u=function(r,n){return Number.isFinite(n)?{timeout:setTimeout(r,n)}:{raf:requestAnimationFrame(r)}},i=function(r){null!=r&&r.timeout&&clearTimeout(r.timeout),null!=r&&r.raf&&cancelAnimationFrame(r.raf)},o=function(o){var c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=n(null),l=n([]),m=n(o);m.current=o;var f=t((function(){return function(){for(var n=arguments.length,t=new Array(n),e=0;e<n;e++)t[e]=arguments[e];l.current=t,a.current||(a.current=u((function(){m.current.apply(m,r(l.current)),a.current=null}),c))}}),[]);return e((function(){return function(){return i(a.current)}}),[]),f};export{o as useThrottledCallback};
//# sourceMappingURL=useThrottledCallback.js.map
