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