var r=0,l=0,a=0,h=1e3,s,f,u=0,o=0,_=0,c=typeof performance=="object"&&performance.now?performance:Date,k=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function v(){return o||(k(y),o=c.now()+_)}function y(){o=0}function w(){this._call=this._time=this._next=null}w.prototype=T.prototype={constructor:w,restart:function(n,t,e){if(typeof n!="function")throw new TypeError("callback is not a function");e=(e==null?v():+e)+(t==null?0:+t),!this._next&&f!==this&&(f?f._next=this:s=this,f=this),this._call=n,this._time=e,m()},stop:function(){this._call&&(this._call=null,this._time=1/0,m())}};function T(n,t,e){var i=new w;return i.restart(n,t,e),i}function d(){v(),++r;for(var n=s,t;n;)(t=o-n._time)>=0&&n._call.call(void 0,t),n=n._next;--r}function p(){o=(u=c.now())+_,r=l=0;try{d()}finally{r=0,F(),o=0}}function I(){var n=c.now(),t=n-u;t>h&&(_-=t,u=n)}function F(){for(var n,t=s,e,i=1/0;t;)t._call?(i>t._time&&(i=t._time),n=t,t=t._next):(e=t._next,t._next=null,t=n?n._next=e:s=e);f=n,m(i)}function m(n){if(!r){l&&(l=clearTimeout(l));var t=n-o;t>24?(n<1/0&&(l=setTimeout(p,n-c.now()-_)),a&&(a=clearInterval(a))):(a||(u=c.now(),a=setInterval(I,h)),r=1,k(p))}}function b(n,t,e){var i=new w;return t=t==null?0:+t,i.restart(x=>{i.stop(),n(x+t)},t,e),i}export{b as a,v as n,T as t};
