import { s as e, t } from "./rafScheduler-CYaktF5t.js";
import { t as n } from "./messageBus-D2dmTOBd.js";
import { t as r } from "./useMessageBus-Cj1eCJEb.js";
import { a as i, r as a, t as o } from "./timeSeries-DOHskCta.js";
import { useCallback as s, useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
import { jsx as f } from "react/jsx-runtime";
//#region node_modules/uplot/dist/uPlot.esm.js
var p = !0, m = "uplot", h = "u-hz", g = "u-vt", _ = "u-title", v = "u-wrap", y = "u-under", b = "u-over", x = "u-axis", S = "u-off", C = "u-select", w = "u-cursor-x", T = "u-cursor-y", E = "u-cursor-pt", ee = "u-legend", te = "u-live", ne = "u-inline", re = "u-series", ie = "u-marker", ae = "u-label", oe = "u-value", se = "width", ce = "height", le = "top", ue = "bottom", de = "left", fe = "right", D = "#000", pe = "#0000", me = "mousemove", he = "mousedown", ge = "mouseup", _e = "mouseenter", ve = "mouseleave", ye = "dblclick", be = "resize", xe = "scroll", Se = "change", Ce = "dppxchange", we = "--", O = typeof window < "u", Te = O ? document : null, Ee = O ? window : null, De = O ? navigator : null, k, A;
function Oe() {
	let e = devicePixelRatio;
	k != e && (k = e, A && Ve(Se, A, Oe), A = matchMedia(`(min-resolution: ${k - .001}dppx) and (max-resolution: ${k + .001}dppx)`), Be(Se, A, Oe), Ee.dispatchEvent(new CustomEvent(Ce)));
}
function ke(e, t) {
	if (t != null) {
		let n = e.classList;
		!n.contains(t) && n.add(t);
	}
}
function Ae(e, t) {
	let n = e.classList;
	n.contains(t) && n.remove(t);
}
function j(e, t, n) {
	e.style[t] = n + "px";
}
function je(e, t, n, r) {
	let i = Te.createElement(e);
	return t != null && ke(i, t), n?.insertBefore(i, r), i;
}
function Me(e, t) {
	return je("div", e, t);
}
var M = /* @__PURE__ */ new WeakMap();
function Ne(e, t, n, r, i) {
	let a = "translate(" + t + "px," + n + "px)";
	a != M.get(e) && (e.style.transform = a, M.set(e, a), t < 0 || n < 0 || t > r || n > i ? ke(e, S) : Ae(e, S));
}
var Pe = /* @__PURE__ */ new WeakMap();
function Fe(e, t, n) {
	let r = t + n;
	r != Pe.get(e) && (Pe.set(e, r), e.style.background = t, e.style.borderColor = n);
}
var Ie = /* @__PURE__ */ new WeakMap();
function Le(e, t, n, r) {
	let i = t + "" + n;
	i != Ie.get(e) && (Ie.set(e, i), e.style.height = n + "px", e.style.width = t + "px", e.style.marginLeft = r ? -t / 2 + "px" : 0, e.style.marginTop = r ? -n / 2 + "px" : 0);
}
var Re = { passive: !0 }, ze = {
	...Re,
	capture: !0
};
function Be(e, t, n, r) {
	t.addEventListener(e, n, r ? ze : Re);
}
function Ve(e, t, n, r) {
	t.removeEventListener(e, n, Re);
}
O && Oe();
function He(e, t, n, r) {
	let i;
	n ||= 0, r ||= t.length - 1;
	let a = r <= 2147483647;
	for (; r - n > 1;) i = a ? n + r >> 1 : L((n + r) / 2), t[i] < e ? n = i : r = i;
	return e - t[n] <= t[r] - e ? n : r;
}
function N(e) {
	return (t, n, r) => {
		let i = -1, a = -1;
		for (let a = n; a <= r; a++) if (e(t[a])) {
			i = a;
			break;
		}
		for (let i = r; i >= n; i--) if (e(t[i])) {
			a = i;
			break;
		}
		return [i, a];
	};
}
var Ue = (e) => e != null, We = (e) => e != null && e > 0, Ge = N(Ue), P = N(We);
function Ke(e, t, n, r = 0, i = !1) {
	let a = i ? P : Ge, o = i ? We : Ue;
	[t, n] = a(e, t, n);
	let s = e[t], c = e[t];
	if (t > -1) if (r == 1) s = e[t], c = e[n];
	else if (r == -1) s = e[n], c = e[t];
	else for (let r = t; r <= n; r++) {
		let t = e[r];
		o(t) && (t < s ? s = t : t > c && (c = t));
	}
	return [s ?? B, c ?? -B];
}
function qe(e, t, n, r) {
	let i = z(e), a = z(t);
	e == t && (i == -1 ? (e *= n, t /= n) : (e /= n, t *= n));
	let o = n == 10 ? ut : dt, s = i == 1 ? L : ot, c = a == 1 ? ot : L, l = s(o(at(e))), u = c(o(at(t))), d = lt(n, l), f = lt(n, u);
	return n == 10 && (l < 0 && (d = H(d, -l)), u < 0 && (f = H(f, -u))), r || n == 2 ? (e = d * i, t = f * a) : (e = Dt(e, d), t = Et(t, f)), [e, t];
}
function Je(e, t, n, r) {
	let i = qe(e, t, n, r);
	return e == 0 && (i[0] = 0), t == 0 && (i[1] = 0), i;
}
var Ye = .1, Xe = {
	mode: 3,
	pad: Ye
}, Ze = {
	pad: 0,
	soft: null,
	mode: 0
}, Qe = {
	min: Ze,
	max: Ze
};
function $e(e, t, n, r) {
	return Rt(n) ? tt(e, t, n) : (Ze.pad = n, Ze.soft = r ? 0 : null, Ze.mode = r ? 3 : 0, tt(e, t, Qe));
}
function F(e, t) {
	return e ?? t;
}
function et(e, t, n) {
	for (t = F(t, 0), n = F(n, e.length - 1); t <= n;) {
		if (e[t] != null) return !0;
		t++;
	}
	return !1;
}
function tt(e, t, n) {
	let r = n.min, i = n.max, a = F(r.pad, 0), o = F(i.pad, 0), s = F(r.hard, -B), c = F(i.hard, B), l = F(r.soft, B), u = F(i.soft, -B), d = F(r.mode, 0), f = F(i.mode, 0), p = t - e, m = ut(p), h = ct(at(e), at(t)), g = at(ut(h) - m);
	(p < 1e-24 || g > 10) && (p = 0, (e == 0 || t == 0) && (p = 1e-24, d == 2 && l != B && (a = 0), f == 2 && u != -B && (o = 0)));
	let _ = p || h || 1e3, v = lt(10, L(ut(_))), y = H(Dt(e - _ * (p == 0 ? e == 0 ? .1 : 1 : a), v / 10), 24), b = e >= l && (d == 1 || d == 3 && y <= l || d == 2 && y >= l) ? l : B, x = ct(s, y < b && e >= b ? b : st(b, y)), S = H(Et(t + _ * (p == 0 ? t == 0 ? .1 : 1 : o), v / 10), 24), C = t <= u && (f == 1 || f == 3 && S >= u || f == 2 && S <= u) ? u : -B, w = st(c, S > C && t <= C ? C : ct(C, S));
	return x == w && x == 0 && (w = 100), [x, w];
}
var nt = new Intl.NumberFormat(O ? De.language : "en-US"), rt = (e) => nt.format(e), I = Math, it = I.PI, at = I.abs, L = I.floor, R = I.round, ot = I.ceil, st = I.min, ct = I.max, lt = I.pow, z = I.sign, ut = I.log10, dt = I.log2, ft = (e, t = 1) => I.sinh(e) * t, pt = (e, t = 1) => I.asinh(e / t), B = Infinity;
function mt(e) {
	return (ut((e ^ e >> 31) - (e >> 31)) | 0) + 1;
}
function ht(e, t, n) {
	return st(ct(e, t), n);
}
function gt(e) {
	return typeof e == "function";
}
function V(e) {
	return gt(e) ? e : () => e;
}
var _t = () => {}, vt = (e) => e, yt = (e, t) => t, bt = (e) => null, xt = (e) => !0, St = (e, t) => e == t, Ct = /\.\d*?(?=9{6,}|0{6,})/gm, wt = (e) => {
	if (Ft(e) || Ot.has(e)) return e;
	let t = `${e}`, n = t.match(Ct);
	if (n == null) return e;
	let r = n[0].length - 1;
	if (t.indexOf("e-") != -1) {
		let [e, n] = t.split("e");
		return +`${wt(e)}e${n}`;
	}
	return H(e, r);
};
function Tt(e, t) {
	return wt(H(wt(e / t)) * t);
}
function Et(e, t) {
	return wt(ot(wt(e / t)) * t);
}
function Dt(e, t) {
	return wt(L(wt(e / t)) * t);
}
function H(e, t = 0) {
	if (Ft(e)) return e;
	let n = 10 ** t;
	return R(e * n * (1 + 2 ** -52)) / n;
}
var Ot = /* @__PURE__ */ new Map();
function kt(e) {
	return (("" + e).split(".")[1] || "").length;
}
function At(e, t, n, r) {
	let i = [], a = r.map(kt);
	for (let o = t; o < n; o++) {
		let t = at(o), n = H(lt(e, o), t);
		for (let s = 0; s < r.length; s++) {
			let c = e == 10 ? +`${r[s]}e${o}` : r[s] * n, l = (o >= 0 ? 0 : t) + (o >= a[s] ? 0 : a[s]), u = e == 10 ? c : H(c, l);
			i.push(u), Ot.set(u, l);
		}
	}
	return i;
}
var jt = {}, Mt = [], Nt = [null, null], Pt = Array.isArray, Ft = Number.isInteger, It = (e) => e === void 0;
function Lt(e) {
	return typeof e == "string";
}
function Rt(e) {
	let t = !1;
	if (e != null) {
		let n = e.constructor;
		t = n == null || n == Object;
	}
	return t;
}
function zt(e) {
	return typeof e == "object" && !!e;
}
var Bt = Object.getPrototypeOf(Uint8Array), Vt = "__proto__";
function Ht(e, t = Rt) {
	let n;
	if (Pt(e)) {
		let r = e.find((e) => e != null);
		if (Pt(r) || t(r)) {
			n = Array(e.length);
			for (let r = 0; r < e.length; r++) n[r] = Ht(e[r], t);
		} else n = e.slice();
	} else if (e instanceof Bt) n = e.slice();
	else if (t(e)) {
		n = {};
		for (let r in e) r != Vt && (n[r] = Ht(e[r], t));
	} else n = e;
	return n;
}
function U(e) {
	let t = arguments;
	for (let n = 1; n < t.length; n++) {
		let r = t[n];
		for (let t in r) t != Vt && (Rt(e[t]) ? U(e[t], Ht(r[t])) : e[t] = Ht(r[t]));
	}
	return e;
}
var Ut = 0, Wt = 1, Gt = 2;
function Kt(e, t, n) {
	for (let r = 0, i, a = -1; r < t.length; r++) {
		let o = t[r];
		if (o > a) {
			for (i = o - 1; i >= 0 && e[i] == null;) e[i--] = null;
			for (i = o + 1; i < n && e[i] == null;) e[a = i++] = null;
		}
	}
}
function qt(e, t) {
	if (Xt(e)) {
		let t = e[0].slice();
		for (let n = 1; n < e.length; n++) t.push(...e[n].slice(1));
		return Zt(t[0]) || (t = Yt(t)), t;
	}
	let n = /* @__PURE__ */ new Set();
	for (let t = 0; t < e.length; t++) {
		let r = e[t][0], i = r.length;
		for (let e = 0; e < i; e++) n.add(r[e]);
	}
	let r = [Array.from(n).sort((e, t) => e - t)], i = r[0].length, a = /* @__PURE__ */ new Map();
	for (let e = 0; e < i; e++) a.set(r[0][e], e);
	for (let n = 0; n < e.length; n++) {
		let o = e[n], s = o[0];
		for (let e = 1; e < o.length; e++) {
			let c = o[e], l = Array(i).fill(void 0), u = t ? t[n][e] : Wt, d = [];
			for (let e = 0; e < c.length; e++) {
				let t = c[e], n = a.get(s[e]);
				t === null ? u != Ut && (l[n] = t, u == Gt && d.push(n)) : l[n] = t;
			}
			Kt(l, d, i), r.push(l);
		}
	}
	return r;
}
var Jt = typeof queueMicrotask > "u" ? (e) => Promise.resolve().then(e) : queueMicrotask;
function Yt(e) {
	let t = e[0], n = t.length, r = Array(n);
	for (let e = 0; e < r.length; e++) r[e] = e;
	r.sort((e, n) => t[e] - t[n]);
	let i = [];
	for (let t = 0; t < e.length; t++) {
		let a = e[t], o = Array(n);
		for (let e = 0; e < n; e++) o[e] = a[r[e]];
		i.push(o);
	}
	return i;
}
function Xt(e) {
	let t = e[0][0], n = t.length;
	for (let r = 1; r < e.length; r++) {
		let i = e[r][0];
		if (i.length != n) return !1;
		if (i != t) {
			for (let e = 0; e < n; e++) if (i[e] != t[e]) return !1;
		}
	}
	return !0;
}
function Zt(e, t = 100) {
	let n = e.length;
	if (n <= 1) return !0;
	let r = 0, i = n - 1;
	for (; r <= i && e[r] == null;) r++;
	for (; i >= r && e[i] == null;) i--;
	if (i <= r) return !0;
	let a = ct(1, L((i - r + 1) / t));
	for (let t = e[r], n = r + a; n <= i; n += a) {
		let r = e[n];
		if (r != null) {
			if (r <= t) return !1;
			t = r;
		}
	}
	return !0;
}
var W = [
	"January",
	"February",
	"March",
	"April",
	"May",
	"June",
	"July",
	"August",
	"September",
	"October",
	"November",
	"December"
], G = [
	"Sunday",
	"Monday",
	"Tuesday",
	"Wednesday",
	"Thursday",
	"Friday",
	"Saturday"
];
function Qt(e) {
	return e.slice(0, 3);
}
var $t = G.map(Qt), en = {
	MMMM: W,
	MMM: W.map(Qt),
	WWWW: G,
	WWW: $t
};
function tn(e) {
	return (e < 10 ? "0" : "") + e;
}
function nn(e) {
	return (e < 10 ? "00" : e < 100 ? "0" : "") + e;
}
var rn = {
	YYYY: (e) => e.getFullYear(),
	YY: (e) => (e.getFullYear() + "").slice(2),
	MMMM: (e, t) => t.MMMM[e.getMonth()],
	MMM: (e, t) => t.MMM[e.getMonth()],
	MM: (e) => tn(e.getMonth() + 1),
	M: (e) => e.getMonth() + 1,
	DD: (e) => tn(e.getDate()),
	D: (e) => e.getDate(),
	WWWW: (e, t) => t.WWWW[e.getDay()],
	WWW: (e, t) => t.WWW[e.getDay()],
	HH: (e) => tn(e.getHours()),
	H: (e) => e.getHours(),
	h: (e) => {
		let t = e.getHours();
		return t == 0 ? 12 : t > 12 ? t - 12 : t;
	},
	AA: (e) => e.getHours() >= 12 ? "PM" : "AM",
	aa: (e) => e.getHours() >= 12 ? "pm" : "am",
	a: (e) => e.getHours() >= 12 ? "p" : "a",
	mm: (e) => tn(e.getMinutes()),
	m: (e) => e.getMinutes(),
	ss: (e) => tn(e.getSeconds()),
	s: (e) => e.getSeconds(),
	fff: (e) => nn(e.getMilliseconds())
};
function an(e, t) {
	t ||= en;
	let n = [], r = /\{([a-z]+)\}|[^{]+/gi, i;
	for (; i = r.exec(e);) n.push(i[0][0] == "{" ? rn[i[1]] : i[0]);
	return (e) => {
		let r = "";
		for (let i = 0; i < n.length; i++) r += typeof n[i] == "string" ? n[i] : n[i](e, t);
		return r;
	};
}
var on = new Intl.DateTimeFormat().resolvedOptions().timeZone;
function sn(e, t) {
	let n;
	return t == "UTC" || t == "Etc/UTC" ? n = /* @__PURE__ */ new Date(+e + e.getTimezoneOffset() * 6e4) : t == on ? n = e : (n = new Date(e.toLocaleString("en-US", { timeZone: t })), n.setMilliseconds(e.getMilliseconds())), n;
}
var cn = (e) => e % 1 == 0, ln = [
	1,
	2,
	2.5,
	5
], un = At(10, -32, 0, ln), dn = At(10, 0, 32, ln), fn = dn.filter(cn), pn = un.concat(dn), mn = "{YYYY}", hn = "\n{YYYY}", gn = "{M}/{D}", _n = "\n{M}/{D}", vn = "\n{M}/{D}/{YY}", yn = "{h}:{mm}{aa}", bn = "\n{h}:{mm}{aa}", xn = ":{ss}", K = null;
function Sn(e) {
	let t = e * 1e3, n = t * 60, r = n * 60, i = r * 24, a = i * 30, o = i * 365, s = (e == 1 ? At(10, 0, 3, ln).filter(cn) : At(10, -3, 0, ln)).concat([
		t,
		t * 5,
		t * 10,
		t * 15,
		t * 30,
		n,
		n * 5,
		n * 10,
		n * 15,
		n * 30,
		r,
		r * 2,
		r * 3,
		r * 4,
		r * 6,
		r * 8,
		r * 12,
		i,
		i * 2,
		i * 3,
		i * 4,
		i * 5,
		i * 6,
		i * 7,
		i * 8,
		i * 9,
		i * 10,
		i * 15,
		a,
		a * 2,
		a * 3,
		a * 4,
		a * 6,
		o,
		o * 2,
		o * 5,
		o * 10,
		o * 25,
		o * 50,
		o * 100
	]), c = [
		[
			o,
			mn,
			K,
			K,
			K,
			K,
			K,
			K,
			1
		],
		[
			i * 28,
			"{MMM}",
			hn,
			K,
			K,
			K,
			K,
			K,
			1
		],
		[
			i,
			gn,
			hn,
			K,
			K,
			K,
			K,
			K,
			1
		],
		[
			r,
			"{h}{aa}",
			vn,
			K,
			_n,
			K,
			K,
			K,
			1
		],
		[
			n,
			yn,
			vn,
			K,
			_n,
			K,
			K,
			K,
			1
		],
		[
			t,
			xn,
			"\n{M}/{D}/{YY} {h}:{mm}{aa}",
			K,
			"\n{M}/{D} {h}:{mm}{aa}",
			K,
			bn,
			K,
			1
		],
		[
			e,
			":{ss}.{fff}",
			"\n{M}/{D}/{YY} {h}:{mm}{aa}",
			K,
			"\n{M}/{D} {h}:{mm}{aa}",
			K,
			bn,
			K,
			1
		]
	];
	function l(t) {
		return (s, c, l, u, d, f) => {
			let p = [], m = d >= o, h = d >= a && d < o, g = t(l), _ = H(g * e, 3), v = Mn(g.getFullYear(), m ? 0 : g.getMonth(), h || m ? 1 : g.getDate()), y = H(v * e, 3);
			if (h || m) {
				let n = h ? d / a : 0, r = m ? d / o : 0, i = _ == y ? _ : H(Mn(v.getFullYear() + r, v.getMonth() + n, 1) * e, 3), s = new Date(R(i / e)), c = s.getFullYear(), l = s.getMonth();
				for (let a = 0; i <= u; a++) {
					let o = Mn(c + r * a, l + n * a, 1), s = o - t(H(o * e, 3));
					i = H((+o + s) * e, 3), i <= u && p.push(i);
				}
			} else {
				let a = d >= i ? i : d, o = y + (L(l) - L(_)) + Et(_ - y, a);
				p.push(o);
				let m = t(o), h = m.getHours() + m.getMinutes() / n + m.getSeconds() / r, g = d / r, v = f / s.axes[c]._space;
				for (; o = H(o + d, e == 1 ? 0 : 3), !(o > u);) if (g > 1) {
					let e = L(H(h + g, 6)) % 24, n = t(o).getHours() - e;
					n > 1 && (n = -1), o -= n * r, h = (h + g) % 24;
					let i = p[p.length - 1];
					H((o - i) / d, 3) * v >= .7 && p.push(o);
				} else p.push(o);
			}
			return p;
		};
	}
	return [
		s,
		c,
		l
	];
}
var [Cn, wn, Tn] = Sn(1), [En, Dn, On] = Sn(.001);
At(2, -53, 53, [1]);
function kn(e, t) {
	return e.map((e) => e.map((n, r) => r == 0 || r == 8 || n == null ? n : t(r == 1 || e[8] == 0 ? n : e[1] + n)));
}
function An(e, t) {
	return (n, r, i, a, o) => {
		let s = t.find((e) => o >= e[0]) || t[t.length - 1], c, l, u, d, f, p;
		return r.map((t) => {
			let n = e(t), r = n.getFullYear(), i = n.getMonth(), a = n.getDate(), o = n.getHours(), m = n.getMinutes(), h = n.getSeconds(), g = r != c && s[2] || i != l && s[3] || a != u && s[4] || o != d && s[5] || m != f && s[6] || h != p && s[7] || s[1];
			return c = r, l = i, u = a, d = o, f = m, p = h, g(n);
		});
	};
}
function jn(e, t) {
	let n = an(t);
	return (t, r, i, a, o) => r.map((t) => n(e(t)));
}
function Mn(e, t, n) {
	return new Date(e, t, n);
}
function Nn(e, t) {
	return t(e);
}
var Pn = "{YYYY}-{MM}-{DD} {h}:{mm}{aa}";
function Fn(e, t) {
	return (n, r, i, a) => a == null ? we : t(e(r));
}
function In(e, t) {
	let n = e.series[t];
	return n.width ? n.stroke(e, t) : n.points.width ? n.points.stroke(e, t) : null;
}
function Ln(e, t) {
	return e.series[t].fill(e, t);
}
var Rn = {
	show: !0,
	live: !0,
	isolate: !1,
	mount: _t,
	markers: {
		show: !0,
		width: 2,
		stroke: In,
		fill: Ln,
		dash: "solid"
	},
	idx: null,
	idxs: null,
	values: []
};
function zn(e, t) {
	let n = e.cursor.points, r = Me(), i = n.size(e, t);
	j(r, se, i), j(r, ce, i);
	let a = i / -2;
	j(r, "marginLeft", a), j(r, "marginTop", a);
	let o = n.width(e, t, i);
	return o && j(r, "borderWidth", o), r;
}
function Bn(e, t) {
	let n = e.series[t].points;
	return n._fill || n._stroke;
}
function Vn(e, t) {
	let n = e.series[t].points;
	return n._stroke || n._fill;
}
function Hn(e, t) {
	return e.series[t].points.size;
}
var Un = [0, 0];
function Wn(e, t, n) {
	return Un[0] = t, Un[1] = n, Un;
}
function Gn(e, t, n, r = !0) {
	return (e) => {
		e.button == 0 && (!r || e.target == t) && n(e);
	};
}
function Kn(e, t, n, r = !0) {
	return (e) => {
		(!r || e.target == t) && n(e);
	};
}
var qn = {
	show: !0,
	x: !0,
	y: !0,
	lock: !1,
	move: Wn,
	points: {
		one: !1,
		show: zn,
		size: Hn,
		width: 0,
		stroke: Vn,
		fill: Bn
	},
	bind: {
		mousedown: Gn,
		mouseup: Gn,
		click: Gn,
		dblclick: Gn,
		mousemove: Kn,
		mouseleave: Kn,
		mouseenter: Kn
	},
	drag: {
		setScale: !0,
		x: !0,
		y: !1,
		dist: 0,
		uni: null,
		click: (e, t) => {
			t.stopPropagation(), t.stopImmediatePropagation();
		},
		_x: !1,
		_y: !1
	},
	focus: {
		dist: (e, t, n, r, i) => r - i,
		prox: -1,
		bias: 0
	},
	hover: {
		skip: [void 0],
		prox: null,
		bias: 0
	},
	left: -10,
	top: -10,
	idx: null,
	dataIdx: null,
	idxs: null,
	event: null
}, Jn = {
	show: !0,
	stroke: "rgba(0,0,0,0.07)",
	width: 2
}, Yn = U({}, Jn, { filter: yt }), Xn = U({}, Yn, { size: 10 }), Zn = U({}, Jn, { show: !1 }), Qn = "12px system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", $n = "bold 12px system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, \"Noto Sans\", sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"", q = 1.5, er = {
	show: !0,
	scale: "x",
	stroke: D,
	space: 50,
	gap: 5,
	alignTo: 1,
	size: 50,
	labelGap: 0,
	labelSize: 30,
	labelFont: $n,
	side: 2,
	grid: Yn,
	ticks: Xn,
	border: Zn,
	font: Qn,
	lineGap: q,
	rotate: 0
}, tr = "Value", nr = "Time", rr = {
	show: !0,
	scale: "x",
	auto: !1,
	sorted: 1,
	min: B,
	max: -Infinity,
	idxs: []
};
function ir(e, t, n, r, i) {
	return t.map((e) => e == null ? "" : rt(e));
}
function ar(e, t, n, r, i, a, o) {
	let s = [], c = Ot.get(i) || 0;
	n = o ? n : H(Et(n, i), c);
	for (let e = n; e <= r; e = H(e + i, c)) s.push(Object.is(e, -0) ? 0 : e);
	return s;
}
function or(e, t, n, r, i, a, o) {
	let s = [], c = e.scales[e.axes[t].scale].log;
	i = lt(c, L((c == 10 ? ut : dt)(n))), c == 10 && (i = pn[He(i, pn)]);
	let l = n, u = i * c;
	c == 10 && (u = pn[He(u, pn)]);
	do
		s.push(l), l += i, c == 10 && !Ot.has(l) && (l = H(l, Ot.get(i))), l >= u && (i = l, u = i * c, c == 10 && (u = pn[He(u, pn)]));
	while (l <= r);
	return s;
}
function sr(e, t, n, r, i, a, o) {
	let s = e.scales[e.axes[t].scale].asinh, c = r > s ? or(e, t, ct(s, n), r, i) : [s], l = r >= 0 && n <= 0 ? [0] : [];
	return (n < -s ? or(e, t, ct(s, -r), -n, i) : [s]).reverse().map((e) => -e).concat(l, c);
}
var J = /./, cr = /[12357]/, lr = /[125]/, ur = /1/, dr = (e, t, n, r) => e.map((e, i) => t == 4 && e == 0 || i % r == 0 && n.test(e.toExponential()[+(e < 0)]) ? e : null);
function fr(e, t, n, r, i) {
	let a = e.axes[n], o = a.scale, s = e.scales[o], c = e.valToPos, l = a._space, u = c(10, o), d = c(9, o) - u >= l ? J : c(7, o) - u >= l ? cr : c(5, o) - u >= l ? lr : ur;
	if (d == ur) {
		let e = at(c(1, o) - u);
		if (e < l) return dr(t.slice().reverse(), s.distr, d, ot(l / e)).reverse();
	}
	return dr(t, s.distr, d, 1);
}
function pr(e, t, n, r, i) {
	let a = e.axes[n], o = a.scale, s = a._space, c = e.valToPos, l = at(c(1, o) - c(2, o));
	return l < s ? dr(t.slice().reverse(), 3, J, ot(s / l)).reverse() : t;
}
function mr(e, t, n, r) {
	return r == null ? we : t == null ? "" : rt(t);
}
var hr = {
	show: !0,
	scale: "y",
	stroke: D,
	space: 30,
	gap: 5,
	alignTo: 1,
	size: 50,
	labelGap: 0,
	labelSize: 30,
	labelFont: $n,
	side: 3,
	grid: Yn,
	ticks: Xn,
	border: Zn,
	font: Qn,
	lineGap: q,
	rotate: 0
};
function gr(e, t) {
	return H((3 + (e || 1) * 2) * t, 3);
}
function _r(e, t) {
	let { scale: n, idxs: r } = e.series[0], i = e._data[0], a = e.valToPos(i[r[0]], n, !0), o = at(e.valToPos(i[r[1]], n, !0) - a) / (e.series[t].points.space * k);
	return r[1] - r[0] <= o;
}
var vr = {
	scale: null,
	auto: !0,
	sorted: 0,
	min: B,
	max: -Infinity
}, yr = (e, t, n, r, i) => i, br = {
	show: !0,
	auto: !0,
	sorted: 0,
	gaps: yr,
	alpha: 1,
	facets: [U({}, vr, { scale: "x" }), U({}, vr, { scale: "y" })]
}, xr = {
	scale: "y",
	auto: !0,
	sorted: 0,
	show: !0,
	spanGaps: !1,
	gaps: yr,
	alpha: 1,
	points: {
		show: _r,
		filter: null
	},
	values: null,
	min: B,
	max: -Infinity,
	idxs: [],
	path: null,
	clip: null
};
function Sr(e, t, n, r, i) {
	return n / 10;
}
var Cr = {
	time: p,
	auto: !0,
	distr: 1,
	log: 10,
	asinh: 1,
	min: null,
	max: null,
	dir: 1,
	ori: 0
}, wr = U({}, Cr, {
	time: !1,
	ori: 1
}), Tr = {};
function Er(e, t) {
	let n = Tr[e];
	return n || (n = {
		key: e,
		plots: [],
		sub(e) {
			n.plots.push(e);
		},
		unsub(e) {
			n.plots = n.plots.filter((t) => t != e);
		},
		pub(e, t, r, i, a, o, s) {
			for (let c = 0; c < n.plots.length; c++) n.plots[c] != t && n.plots[c].pub(e, t, r, i, a, o, s);
		}
	}, e != null && (Tr[e] = n)), n;
}
var Dr = 1, Or = 2;
function kr(e, t, n) {
	let r = e.mode, i = e.series[t], a = r == 2 ? e._data[t] : e._data, o = e.scales, s = e.bbox, c = a[0], l = r == 2 ? a[1] : a[t], u = r == 2 ? o[i.facets[0].scale] : o[e.series[0].scale], d = r == 2 ? o[i.facets[1].scale] : o[i.scale], f = s.left, p = s.top, m = s.width, h = s.height, g = e.valToPosH, _ = e.valToPosV;
	return u.ori == 0 ? n(i, c, l, u, d, g, _, f, p, m, h, Rr, Br, Hr, Wr, Kr) : n(i, c, l, u, d, _, g, p, f, h, m, zr, Vr, Ur, Gr, qr);
}
function Ar(e, t) {
	let n = 0, r = 0, i = F(e.bands, Mt);
	for (let e = 0; e < i.length; e++) {
		let a = i[e];
		a.series[0] == t ? n = a.dir : a.series[1] == t && (a.dir == 1 ? r |= 1 : r |= 2);
	}
	return [n, r == 1 ? -1 : r == 2 ? 1 : r == 3 ? 2 : 0];
}
function jr(e, t, n, r, i) {
	let a = e.mode, o = e.series[t], s = a == 2 ? o.facets[1].scale : o.scale, c = e.scales[s];
	return i == -1 ? c.min : i == 1 ? c.max : c.distr == 3 ? c.dir == 1 ? c.min : c.max : 0;
}
function Mr(e, t, n, r, i, a) {
	return kr(e, t, (e, t, o, s, c, l, u, d, f, p, m) => {
		let h = e.pxRound, g = s.dir * (s.ori == 0 ? 1 : -1), _ = s.ori == 0 ? Br : Vr, v, y;
		g == 1 ? (v = n, y = r) : (v = r, y = n);
		let b = h(l(t[v], s, p, d)), x = h(u(o[v], c, m, f)), S = h(l(t[y], s, p, d)), C = h(u(a == 1 ? c.max : c.min, c, m, f)), w = new Path2D(i);
		return _(w, S, C), _(w, b, C), _(w, b, x), w;
	});
}
function Nr(e, t, n, r, i, a) {
	let o = null;
	if (e.length > 0) {
		o = new Path2D();
		let s = t == 0 ? Hr : Ur, c = n;
		for (let t = 0; t < e.length; t++) {
			let n = e[t];
			if (n[1] > n[0]) {
				let e = n[0] - c;
				e > 0 && s(o, c, r, e, r + a), c = n[1];
			}
		}
		let l = n + i - c;
		l > 0 && s(o, c, r - 10 / 2, l, r + a + 10);
	}
	return o;
}
function Pr(e, t, n) {
	let r = e[e.length - 1];
	r && r[0] == t ? r[1] = n : e.push([t, n]);
}
function Fr(e, t, n, r, i, a, o) {
	let s = [], c = e.length;
	for (let l = i == 1 ? n : r; l >= n && l <= r; l += i) if (t[l] === null) {
		let u = l, d = l;
		if (i == 1) for (; ++l <= r && t[l] === null;) d = l;
		else for (; --l >= n && t[l] === null;) d = l;
		let f = a(e[u]), p = d == u ? f : a(e[d]), m = u - i;
		f = o <= 0 && m >= 0 && m < c ? a(e[m]) : f;
		let h = d + i;
		p = o >= 0 && h >= 0 && h < c ? a(e[h]) : p, p >= f && s.push([f, p]);
	}
	return s;
}
function Ir(e) {
	return e == 0 ? vt : e == 1 ? R : (t) => Tt(t, e);
}
function Lr(e) {
	let t = e == 0 ? Rr : zr, n = e == 0 ? (e, t, n, r, i, a) => {
		e.arcTo(t, n, r, i, a);
	} : (e, t, n, r, i, a) => {
		e.arcTo(n, t, i, r, a);
	}, r = e == 0 ? (e, t, n, r, i) => {
		e.rect(t, n, r, i);
	} : (e, t, n, r, i) => {
		e.rect(n, t, i, r);
	};
	return (e, i, a, o, s, c = 0, l = 0) => {
		c == 0 && l == 0 ? r(e, i, a, o, s) : (c = st(c, o / 2, s / 2), l = st(l, o / 2, s / 2), t(e, i + c, a), n(e, i + o, a, i + o, a + s, c), n(e, i + o, a + s, i, a + s, l), n(e, i, a + s, i, a, l), n(e, i, a, i + o, a, c), e.closePath());
	};
}
var Rr = (e, t, n) => {
	e.moveTo(t, n);
}, zr = (e, t, n) => {
	e.moveTo(n, t);
}, Br = (e, t, n) => {
	e.lineTo(t, n);
}, Vr = (e, t, n) => {
	e.lineTo(n, t);
}, Hr = Lr(0), Ur = Lr(1), Wr = (e, t, n, r, i, a) => {
	e.arc(t, n, r, i, a);
}, Gr = (e, t, n, r, i, a) => {
	e.arc(n, t, r, i, a);
}, Kr = (e, t, n, r, i, a, o) => {
	e.bezierCurveTo(t, n, r, i, a, o);
}, qr = (e, t, n, r, i, a, o) => {
	e.bezierCurveTo(n, t, i, r, o, a);
};
function Jr(e) {
	return (e, t, n, r, i) => kr(e, t, (t, a, o, s, c, l, u, d, f, p, m) => {
		let { pxRound: h, points: g } = t, _, v;
		s.ori == 0 ? (_ = Rr, v = Wr) : (_ = zr, v = Gr);
		let y = H(g.width * k, 3), b = (g.size - g.width) / 2 * k, x = H(b * 2, 3), S = new Path2D(), C = new Path2D(), { left: w, top: T, width: E, height: ee } = e.bbox;
		Hr(C, w - x, T - x, E + x * 2, ee + x * 2);
		let te = (e) => {
			if (o[e] != null) {
				let t = h(l(a[e], s, p, d)), n = h(u(o[e], c, m, f));
				_(S, t + b, n), v(S, t, n, b, 0, it * 2);
			}
		};
		if (i) i.forEach(te);
		else for (let e = n; e <= r; e++) te(e);
		return {
			stroke: y > 0 ? S : null,
			fill: S,
			clip: C,
			flags: 3
		};
	});
}
function Yr(e) {
	return (t, n, r, i, a, o) => {
		r != i && (a != r && o != r && e(t, n, r), a != i && o != i && e(t, n, i), e(t, n, o));
	};
}
var Xr = Yr(Br), Zr = Yr(Vr);
function Qr(e) {
	let t = F(e?.alignGaps, 0);
	return (e, n, r, i) => kr(e, n, (a, o, s, c, l, u, d, f, p, m, h) => {
		[r, i] = Ge(s, r, i);
		let g = a.pxRound, _ = (e) => g(u(e, c, m, f)), v = (e) => g(d(e, l, h, p)), y, b;
		c.ori == 0 ? (y = Br, b = Xr) : (y = Vr, b = Zr);
		let x = c.dir * (c.ori == 0 ? 1 : -1), S = {
			stroke: new Path2D(),
			fill: null,
			clip: null,
			band: null,
			gaps: null,
			flags: Dr
		}, C = S.stroke, w = !1;
		if (i - r >= m * 4) {
			let t = (t) => e.posToVal(t, c.key, !0), n = null, a = null, l, u, d = _(o[x == 1 ? r : i]), f = _(o[r]), p = _(o[i]), m = t(x == 1 ? f + 1 : p - 1);
			for (let e = x == 1 ? r : i; e >= r && e <= i; e += x) {
				let r = o[e], i = (x == 1 ? r < m : r > m) ? d : _(r), c = s[e];
				i == d ? c == null ? c === null && (w = !0) : (u = c, n == null ? (y(C, i, v(u)), l = n = a = u) : u < n ? n = u : u > a && (a = u)) : (n != null && b(C, d, v(n), v(a), v(l), v(u)), c == null ? (n = a = null, c === null && (w = !0)) : (u = c, y(C, i, v(u)), n = a = l = u), d = i, m = t(d + x));
			}
			n != null && n != a && d != null && b(C, d, v(n), v(a), v(l), v(u));
		} else for (let e = x == 1 ? r : i; e >= r && e <= i; e += x) {
			let t = s[e];
			t === null ? w = !0 : t != null && y(C, _(o[e]), v(t));
		}
		let [T, E] = Ar(e, n);
		if (a.fill != null || T != 0) {
			let t = S.fill = new Path2D(C), s = v(a.fillTo(e, n, a.min, a.max, T)), c = _(o[r]), l = _(o[i]);
			x == -1 && ([l, c] = [c, l]), y(t, l, s), y(t, c, s);
		}
		if (!a.spanGaps) {
			let l = [];
			w && l.push(...Fr(o, s, r, i, x, _, t)), S.gaps = l = a.gaps(e, n, r, i, l), S.clip = Nr(l, c.ori, f, p, m, h);
		}
		return E != 0 && (S.band = E == 2 ? [Mr(e, n, r, i, C, -1), Mr(e, n, r, i, C, 1)] : Mr(e, n, r, i, C, E)), S;
	});
}
function $r(e) {
	let t = F(e.align, 1), n = F(e.ascDesc, !1), r = F(e.alignGaps, 0), i = F(e.extend, !1);
	return (e, a, o, s) => kr(e, a, (c, l, u, d, f, p, m, h, g, _, v) => {
		[o, s] = Ge(u, o, s);
		let y = c.pxRound, { left: b, width: x } = e.bbox, S = (e) => y(p(e, d, _, h)), C = (e) => y(m(e, f, v, g)), w = d.ori == 0 ? Br : Vr, T = {
			stroke: new Path2D(),
			fill: null,
			clip: null,
			band: null,
			gaps: null,
			flags: Dr
		}, E = T.stroke, ee = d.dir * (d.ori == 0 ? 1 : -1), te = C(u[ee == 1 ? o : s]), ne = S(l[ee == 1 ? o : s]), re = ne, ie = ne;
		i && t == -1 && (ie = b, w(E, ie, te)), w(E, ne, te);
		for (let e = ee == 1 ? o : s; e >= o && e <= s; e += ee) {
			let n = u[e];
			if (n == null) continue;
			let r = S(l[e]), i = C(n);
			t == 1 ? w(E, r, te) : w(E, re, i), w(E, r, i), te = i, re = r;
		}
		let ae = re;
		i && t == 1 && (ae = b + x, w(E, ae, te));
		let [oe, se] = Ar(e, a);
		if (c.fill != null || oe != 0) {
			let t = T.fill = new Path2D(E), n = C(c.fillTo(e, a, c.min, c.max, oe));
			w(t, ae, n), w(t, ie, n);
		}
		if (!c.spanGaps) {
			let i = [];
			i.push(...Fr(l, u, o, s, ee, S, r));
			let f = c.width * k / 2, p = n || t == 1 ? f : -f, m = n || t == -1 ? -f : f;
			i.forEach((e) => {
				e[0] += p, e[1] += m;
			}), T.gaps = i = c.gaps(e, a, o, s, i), T.clip = Nr(i, d.ori, h, g, _, v);
		}
		return se != 0 && (T.band = se == 2 ? [Mr(e, a, o, s, E, -1), Mr(e, a, o, s, E, 1)] : Mr(e, a, o, s, E, se)), T;
	});
}
function ei(e, t, n, r, i, a, o = B) {
	if (e.length > 1) {
		let s = null;
		for (let c = 0, l = Infinity; c < e.length; c++) if (t[c] !== void 0) {
			if (s != null) {
				let t = at(e[c] - e[s]);
				t < l && (l = t, o = at(n(e[c], r, i, a) - n(e[s], r, i, a)));
			}
			s = c;
		}
	}
	return o;
}
function ti(e) {
	e ||= jt;
	let t = F(e.size, [
		.6,
		B,
		1
	]), n = e.align || 0, r = e.gap || 0, i = e.radius;
	i = i == null ? [0, 0] : typeof i == "number" ? [i, 0] : i;
	let a = V(i), o = 1 - t[0], s = F(t[1], B), c = F(t[2], 1), l = F(e.disp, jt), u = F(e.each, (e) => {}), { fill: d, stroke: f } = l;
	return (e, t, i, p) => kr(e, t, (m, h, g, _, v, y, b, x, S, C, w) => {
		let T = m.pxRound, E = n, ee = r * k, te = s * k, ne = c * k, re, ie;
		_.ori == 0 ? [re, ie] = a(e, t) : [ie, re] = a(e, t);
		let ae = _.dir * (_.ori == 0 ? 1 : -1), oe = _.ori == 0 ? Hr : Ur, se = _.ori == 0 ? u : (e, t, n, r, i, a, o) => {
			u(e, t, n, i, r, o, a);
		}, ce = F(e.bands, Mt).find((e) => e.series[0] == t), le = ce == null ? 0 : ce.dir, ue = m.fillTo(e, t, m.min, m.max, le), de = T(b(ue, v, w, S)), fe, D, pe, me = C, he = T(m.width * k), ge = !1, _e = null, ve = null, ye = null, be = null;
		d != null && (he == 0 || f != null) && (ge = !0, _e = d.values(e, t, i, p), ve = /* @__PURE__ */ new Map(), new Set(_e).forEach((e) => {
			e != null && ve.set(e, new Path2D());
		}), he > 0 && (ye = f.values(e, t, i, p), be = /* @__PURE__ */ new Map(), new Set(ye).forEach((e) => {
			e != null && be.set(e, new Path2D());
		})));
		let { x0: xe, size: Se } = l;
		if (xe != null && Se != null) {
			E = 1, h = xe.values(e, t, i, p), xe.unit == 2 && (h = h.map((t) => e.posToVal(x + t * C, _.key, !0)));
			let n = Se.values(e, t, i, p);
			D = Se.unit == 2 ? n[0] * C : y(n[0], _, C, x) - y(0, _, C, x), me = ei(h, g, y, _, C, x, me), pe = me - D + ee;
		} else me = ei(h, g, y, _, C, x, me), pe = me * o + ee, D = me - pe;
		pe < 1 && (pe = 0), he >= D / 2 && (he = 0), pe < 5 && (T = vt);
		let Ce = pe > 0, we = me - pe - (Ce ? he : 0);
		D = T(ht(we, ne, te)), fe = (E == 0 ? D / 2 : E == ae ? 0 : D) - E * ae * ((E == 0 ? ee / 2 : 0) + (Ce ? he / 2 : 0));
		let O = {
			stroke: null,
			fill: null,
			clip: null,
			band: null,
			gaps: null,
			flags: 0
		}, Te = ge ? null : new Path2D(), Ee = null;
		if (ce != null) Ee = e.data[ce.series[1]];
		else {
			let { y0: n, y1: r } = l;
			n != null && r != null && (g = r.values(e, t, i, p), Ee = n.values(e, t, i, p));
		}
		let De = re * D, A = ie * D;
		for (let n = ae == 1 ? i : p; n >= i && n <= p; n += ae) {
			let r = g[n];
			if (r == null) continue;
			if (Ee != null) {
				let e = Ee[n] ?? 0;
				if (r - e == 0) continue;
				de = b(e, v, w, S);
			}
			let i = y(_.distr != 2 || l != null ? h[n] : n, _, C, x), a = b(F(r, ue), v, w, S), o = T(i - fe), s = T(ct(a, de)), c = T(st(a, de)), u = s - c;
			if (r != null) {
				let i = r < 0 ? A : De, a = r < 0 ? De : A;
				ge ? (he > 0 && ye[n] != null && oe(be.get(ye[n]), o, c + L(he / 2), D, ct(0, u - he), i, a), _e[n] != null && oe(ve.get(_e[n]), o, c + L(he / 2), D, ct(0, u - he), i, a)) : oe(Te, o, c + L(he / 2), D, ct(0, u - he), i, a), se(e, t, n, o - he / 2, c, D + he, u);
			}
		}
		return he > 0 ? O.stroke = ge ? be : Te : ge || (O._fill = m.width == 0 ? m._fill : m._stroke ?? m._fill, O.width = 0), O.fill = ge ? ve : Te, O;
	});
}
function ni(e, t) {
	let n = F(t?.alignGaps, 0);
	return (t, r, i, a) => kr(t, r, (o, s, c, l, u, d, f, p, m, h, g) => {
		[i, a] = Ge(c, i, a);
		let _ = o.pxRound, v = (e) => _(d(e, l, h, p)), y = (e) => _(f(e, u, g, m)), b, x, S;
		l.ori == 0 ? (b = Rr, S = Br, x = Kr) : (b = zr, S = Vr, x = qr);
		let C = l.dir * (l.ori == 0 ? 1 : -1), w = v(s[C == 1 ? i : a]), T = w, E = [], ee = [];
		for (let e = C == 1 ? i : a; e >= i && e <= a; e += C) if (c[e] != null) {
			let t = s[e], n = v(t);
			E.push(T = n), ee.push(y(c[e]));
		}
		let te = {
			stroke: e(E, ee, b, S, x, _),
			fill: null,
			clip: null,
			band: null,
			gaps: null,
			flags: Dr
		}, ne = te.stroke, [re, ie] = Ar(t, r);
		if (o.fill != null || re != 0) {
			let e = te.fill = new Path2D(ne), n = y(o.fillTo(t, r, o.min, o.max, re));
			S(e, T, n), S(e, w, n);
		}
		if (!o.spanGaps) {
			let e = [];
			e.push(...Fr(s, c, i, a, C, v, n)), te.gaps = e = o.gaps(t, r, i, a, e), te.clip = Nr(e, l.ori, p, m, h, g);
		}
		return ie != 0 && (te.band = ie == 2 ? [Mr(t, r, i, a, ne, -1), Mr(t, r, i, a, ne, 1)] : Mr(t, r, i, a, ne, ie)), te;
	});
}
function ri(e) {
	return ni(ii, e);
}
function ii(e, t, n, r, i, a) {
	let o = e.length;
	if (o < 2) return null;
	let s = new Path2D();
	if (n(s, e[0], t[0]), o == 2) r(s, e[1], t[1]);
	else {
		let n = Array(o), r = Array(o - 1), a = Array(o - 1), c = Array(o - 1);
		for (let n = 0; n < o - 1; n++) a[n] = t[n + 1] - t[n], c[n] = e[n + 1] - e[n], r[n] = a[n] / c[n];
		n[0] = r[0];
		for (let e = 1; e < o - 1; e++) r[e] === 0 || r[e - 1] === 0 || r[e - 1] > 0 != r[e] > 0 ? n[e] = 0 : (n[e] = 3 * (c[e - 1] + c[e]) / ((2 * c[e] + c[e - 1]) / r[e - 1] + (c[e] + 2 * c[e - 1]) / r[e]), isFinite(n[e]) || (n[e] = 0));
		n[o - 1] = r[o - 2];
		for (let r = 0; r < o - 1; r++) i(s, e[r] + c[r] / 3, t[r] + n[r] * c[r] / 3, e[r + 1] - c[r] / 3, t[r + 1] - n[r + 1] * c[r] / 3, e[r + 1], t[r + 1]);
	}
	return s;
}
var ai = /* @__PURE__ */ new Set();
function oi() {
	for (let e of ai) e.syncRect(!0);
}
O && (Be(be, Ee, oi), Be(xe, Ee, oi, !0), Be(Ce, Ee, () => {
	Y.pxRatio = k;
}));
var si = Qr(), ci = Jr();
function li(e, t, n, r) {
	return (r ? [e[0], e[1]].concat(e.slice(2)) : [e[0]].concat(e.slice(1))).map((e, r) => di(e, r, t, n));
}
function ui(e, t) {
	return e.map((e, n) => n == 0 ? {} : U({}, t, e));
}
function di(e, t, n, r) {
	return U({}, t == 0 ? n : r, e);
}
function fi(e, t, n) {
	return t == null ? Nt : [t, n];
}
var pi = fi;
function mi(e, t, n) {
	return t == null ? Nt : $e(t, n, Ye, !0);
}
function hi(e, t, n, r) {
	return t == null ? Nt : qe(t, n, e.scales[r].log, !1);
}
var gi = hi;
function _i(e, t, n, r) {
	return t == null ? Nt : Je(t, n, e.scales[r].log, !1);
}
var vi = _i;
function yi(e, t, n, r, i) {
	let a = ct(mt(e), mt(t)), o = t - e, s = He(i / r * o, n);
	do {
		let e = n[s], t = r * e / o;
		if (t >= i && a + (e < 5 ? Ot.get(e) : 0) <= 17) return [e, t];
	} while (++s < n.length);
	return [0, 0];
}
function bi(e) {
	let t, n;
	return e = e.replace(/(\d+)px/, (e, r) => (t = R((n = +r) * k)) + "px"), [
		e,
		t,
		n
	];
}
function xi(e) {
	e.show && [e.font, e.labelFont].forEach((e) => {
		let t = H(e[2] * k, 1);
		e[0] = e[0].replace(/[0-9.]+px/, t + "px"), e[1] = t;
	});
}
function Y(e, t, n) {
	let r = { mode: F(e.mode, 1) }, i = r.mode;
	function a(e, t, n, r) {
		let i = t.valToPct(e);
		return r + n * (t.dir == -1 ? 1 - i : i);
	}
	function o(e, t, n, r) {
		let i = t.valToPct(e);
		return r + n * (t.dir == -1 ? i : 1 - i);
	}
	function s(e, t, n, r) {
		return t.ori == 0 ? a(e, t, n, r) : o(e, t, n, r);
	}
	r.valToPosH = a, r.valToPosV = o;
	let c = !1;
	r.status = 0;
	let l = r.root = Me(m);
	if (e.id != null && (l.id = e.id), ke(l, e.class), e.title) {
		let t = Me(_, l);
		t.textContent = e.title;
	}
	let u = je("canvas"), d = r.ctx = u.getContext("2d"), f = Me(v, l);
	Be("click", f, (e) => {
		e.target === D && (X != Ni || Z != Pi) && Ri.click(r, e);
	}, !0);
	let p = r.under = Me(y, f);
	f.appendChild(u);
	let D = r.over = Me(b, f);
	e = Ht(e);
	let be = +F(e.pxAlign, 1), xe = Ir(be);
	(e.plugins || []).forEach((t) => {
		t.opts && (e = t.opts(r, e) || e);
	});
	let Se = e.ms || .001, O = r.series = i == 1 ? li(e.series || [], rr, xr, !1) : ui(e.series || [null], br), De = r.axes = li(e.axes || [], er, hr, !0), A = r.scales = {}, Oe = r.bands = e.bands || [];
	Oe.forEach((e) => {
		e.fill = V(e.fill || null), e.dir = F(e.dir, -1);
	});
	let M = i == 2 ? O[1].facets[0].scale : O[0].scale, Pe = {
		axes: ni,
		series: Gr
	}, Ie = (e.drawOrder || ["axes", "series"]).map((e) => Pe[e]);
	function Re(e) {
		let t = e.distr == 3 ? (t) => ut(t > 0 ? t : e.clamp(r, t, e.min, e.max, e.key)) : e.distr == 4 ? (t) => pt(t, e.asinh) : e.distr == 100 ? (t) => e.fwd(t) : (e) => e;
		return (n) => {
			let r = t(n), { _min: i, _max: a } = e, o = a - i;
			return (r - i) / o;
		};
	}
	function ze(t) {
		let n = A[t];
		if (n == null) {
			let r = (e.scales || jt)[t] || jt;
			if (r.from != null) {
				ze(r.from);
				let e = U({}, A[r.from], r, { key: t });
				e.valToPct = Re(e), A[t] = e;
			} else {
				n = A[t] = U({}, t == M ? Cr : wr, r), n.key = t;
				let e = n.time, a = n.range, o = Pt(a);
				if ((t != M || i == 2 && !e) && (o && (a[0] == null || a[1] == null) && (a = {
					min: a[0] == null ? Xe : {
						mode: 1,
						hard: a[0],
						soft: a[0]
					},
					max: a[1] == null ? Xe : {
						mode: 1,
						hard: a[1],
						soft: a[1]
					}
				}, o = !1), !o && Rt(a))) {
					let e = a;
					a = (t, n, r) => n == null ? Nt : $e(n, r, e);
				}
				n.range = V(a || (e ? pi : t == M ? n.distr == 3 ? gi : n.distr == 4 ? vi : fi : n.distr == 3 ? hi : n.distr == 4 ? _i : mi)), n.auto = V(o ? !1 : n.auto), n.clamp = V(n.clamp || Sr), n._min = n._max = null, n.valToPct = Re(n);
			}
		}
	}
	ze("x"), ze("y"), i == 1 && O.forEach((e) => {
		ze(e.scale);
	}), De.forEach((e) => {
		ze(e.scale);
	});
	for (let t in e.scales) ze(t);
	let N = A[M], Ue = N.distr, We, Ge;
	N.ori == 0 ? (ke(l, h), We = a, Ge = o) : (ke(l, g), We = o, Ge = a);
	let P = {};
	for (let e in A) {
		let t = A[e];
		(t.min != null || t.max != null) && (P[e] = {
			min: t.min,
			max: t.max
		}, t.min = t.max = null);
	}
	let Ze = e.tzDate || ((e) => new Date(R(e / Se))), Qe = e.fmtDate || an, tt = Se == 1 ? Tn(Ze) : On(Ze), nt = An(Ze, kn(Se == 1 ? wn : Dn, Qe)), rt = Fn(Ze, Nn(Pn, Qe)), I = [], L = r.legend = U({}, Rn, e.legend), z = r.cursor = U({}, qn, { drag: { y: i == 2 } }, e.cursor), dt = L.show, mt = z.show, _t = L.markers;
	L.idxs = I, _t.width = V(_t.width), _t.dash = V(_t.dash), _t.stroke = V(_t.stroke), _t.fill = V(_t.fill);
	let vt, Ct, wt, Et = [], Dt = [], At, Ft = !1, Bt = {};
	if (L.live) {
		let e = O[1] ? O[1].values : null;
		Ft = e != null, At = Ft ? e(r, 1, 0) : { _: 0 };
		for (let e in At) Bt[e] = we;
	}
	if (dt) if (vt = je("table", ee, l), wt = je("tbody", null, vt), L.mount(r, vt), Ft) {
		Ct = je("thead", null, vt, wt);
		let e = je("tr", null, Ct);
		for (var Vt in je("th", null, e), At) je("th", ae, e).textContent = Vt;
	} else ke(vt, ne), L.live && ke(vt, te);
	let Ut = { show: !0 }, Wt = { show: !1 };
	function Gt(e, t) {
		if (t == 0 && (Ft || !L.live || i == 2)) return Nt;
		let n = [], a = je("tr", re, wt, wt.childNodes[t]);
		ke(a, e.class), e.show || ke(a, S);
		let o = je("th", null, a);
		if (_t.show) {
			let e = Me(ie, o);
			if (t > 0) {
				let n = _t.width(r, t);
				n && (e.style.border = n + "px " + _t.dash(r, t) + " " + _t.stroke(r, t)), e.style.background = _t.fill(r, t);
			}
		}
		let s = Me(ae, o);
		for (var c in e.label instanceof HTMLElement ? s.appendChild(e.label) : s.textContent = e.label, t > 0 && (_t.show || (s.style.color = e.width > 0 ? _t.stroke(r, t) : _t.fill(r, t)), qt("click", o, (t) => {
			if (z._lock) return;
			Mn(t);
			let n = O.indexOf(e);
			if ((t.ctrlKey || t.metaKey) != L.isolate) {
				let e = O.some((e, t) => t > 0 && t != n && e.show);
				O.forEach((t, r) => {
					r > 0 && Gi(r, e ? r == n ? Ut : Wt : Ut, !0, $.setSeries);
				});
			} else Gi(n, { show: !e.show }, !0, $.setSeries);
		}, !1), zn && qt(_e, o, (t) => {
			z._lock || (Mn(t), Gi(O.indexOf(e), $i, !0, $.setSeries));
		}, !1)), At) {
			let e = je("td", oe, a);
			e.textContent = "--", n.push(e);
		}
		return [a, n];
	}
	let Kt = /* @__PURE__ */ new Map();
	function qt(e, t, n, i = !0) {
		let a = Kt.get(t) || {}, o = z.bind[e](r, t, n, i);
		o && (Be(e, t, a[e] = o), Kt.set(t, a));
	}
	function Yt(e, t, n) {
		let r = Kt.get(t) || {};
		for (let n in r) (e == null || n == e) && (Ve(n, t, r[n]), delete r[n]);
		e ?? Kt.delete(t);
	}
	let Xt = 0, Zt = 0, W = 0, G = 0, Qt = 0, $t = 0, en = Qt, tn = $t, nn = W, rn = G, on = 0, sn = 0, cn = 0, ln = 0;
	r.bbox = {};
	let un = !1, dn = !1, mn = !1, hn = !1, gn = !1, _n = !1;
	function vn(e, t, n) {
		(n || e != r.width || t != r.height) && yn(e, t), ri(!1), mn = !0, dn = !0, Ci();
	}
	function yn(e, t) {
		r.width = Xt = W = e, r.height = Zt = G = t, Qt = $t = 0, K(), Sn();
		let n = r.bbox;
		on = n.left = Tt(Qt * k, .5), sn = n.top = Tt($t * k, .5), cn = n.width = Tt(W * k, .5), ln = n.height = Tt(G * k, .5);
	}
	function bn() {
		let e = !1, t = 0;
		for (; !e;) {
			t++;
			let n = ei(t), i = ti(t);
			e = t == 3 || n && i, e || (yn(r.width, r.height), dn = !0);
		}
	}
	function xn({ width: e, height: t }) {
		vn(e, t);
	}
	r.setSize = xn;
	function K() {
		let e = !1, t = !1, n = !1, r = !1;
		De.forEach((i, a) => {
			if (i.show && i._show) {
				let { side: a, _size: o } = i, s = a % 2, c = o + (i.label == null ? 0 : i.labelSize);
				c > 0 && (s ? (W -= c, a == 3 ? (Qt += c, r = !0) : n = !0) : (G -= c, a == 0 ? ($t += c, e = !0) : t = !0));
			}
		}), Yn[0] = e, Yn[1] = n, Yn[2] = t, Yn[3] = r, W -= $n[1] + $n[3], Qt += $n[3], G -= $n[2] + $n[0], $t += $n[0];
	}
	function Sn() {
		let e = Qt + W, t = $t + G, n = Qt, r = $t;
		function i(i, a) {
			switch (i) {
				case 1: return e += a, e - a;
				case 2: return t += a, t - a;
				case 3: return n -= a, n + a;
				case 0: return r -= a, r + a;
			}
		}
		De.forEach((e, t) => {
			if (e.show && e._show) {
				let t = e.side;
				e._pos = i(t, e._size), e.label != null && (e._lpos = i(t, e.labelSize));
			}
		});
	}
	if (z.dataIdx == null) {
		let e = z.hover, n = e.skip = new Set(e.skip ?? []);
		n.add(void 0);
		let r = e.prox = V(e.prox), i = e.bias ??= 0;
		z.dataIdx = (e, a, o, s) => {
			if (a == 0) return o;
			let c = o, l = r(e, a, o, s) ?? B, u = l >= 0 && l < B, d = N.ori == 0 ? W : G, f = z.left, p = t[0], m = t[a];
			if (n.has(m[o])) {
				c = null;
				let e = null, t = null, r;
				if (i == 0 || i == -1) for (r = o; e == null && r-- > 0;) n.has(m[r]) || (e = r);
				if (i == 0 || i == 1) for (r = o; t == null && r++ < m.length;) n.has(m[r]) || (t = r);
				if (e != null || t != null) if (u) {
					let n = e == null ? -Infinity : We(p[e], N, d, 0), r = t == null ? Infinity : We(p[t], N, d, 0), i = f - n, a = r - f;
					i <= a ? i <= l && (c = e) : a <= l && (c = t);
				} else c = t == null ? e : e == null ? t : o - e <= t - o ? e : t;
			} else u && at(f - We(p[o], N, d, 0)) > l && (c = null);
			return c;
		};
	}
	let Mn = (e) => {
		z.event = e;
	};
	z.idxs = I, z._lock = !1;
	let In = z.points;
	In.show = V(In.show), In.size = V(In.size), In.stroke = V(In.stroke), In.width = V(In.width), In.fill = V(In.fill);
	let Ln = r.focus = U({}, e.focus || { alpha: .3 }, z.focus), zn = Ln.prox >= 0, Bn = zn && In.one, Vn = [], Hn = [], Un = [];
	function Wn(e, t) {
		let n = In.show(r, t);
		if (n instanceof HTMLElement) return ke(n, E), ke(n, e.class), Ne(n, -10, -10, W, G), D.insertBefore(n, Vn[t]), n;
	}
	function Gn(e, t) {
		if (i == 1 || t > 0) {
			let t = i == 1 && A[e.scale].time, n = e.value;
			e.value = t ? Lt(n) ? Fn(Ze, Nn(n, Qe)) : n || rt : n || mr, e.label = e.label || (t ? nr : tr);
		}
		if (Bn || t > 0) {
			e.width = e.width == null ? 1 : e.width, e.paths = e.paths || si || bt, e.fillTo = V(e.fillTo || jr), e.pxAlign = +F(e.pxAlign, be), e.pxRound = Ir(e.pxAlign), e.stroke = V(e.stroke || null), e.fill = V(e.fill || null), e._stroke = e._fill = e._paths = e._focus = null;
			let t = gr(ct(1, e.width), 1), n = e.points = U({}, {
				size: t,
				width: ct(1, t * .2),
				stroke: e.stroke,
				space: t * 2,
				paths: ci,
				_stroke: null,
				_fill: null
			}, e.points);
			n.show = V(n.show), n.filter = V(n.filter), n.fill = V(n.fill), n.stroke = V(n.stroke), n.paths = V(n.paths), n.pxAlign = e.pxAlign;
		}
		if (dt) {
			let n = Gt(e, t);
			Et.splice(t, 0, n[0]), Dt.splice(t, 0, n[1]), L.values.push(null);
		}
		if (mt) {
			I.splice(t, 0, null);
			let n = null;
			Bn ? t == 0 && (n = Wn(e, t)) : t > 0 && (n = Wn(e, t)), Vn.splice(t, 0, n), Hn.splice(t, 0, 0), Un.splice(t, 0, 0);
		}
		Oa("addSeries", t);
	}
	function Kn(e, t) {
		t ??= O.length, e = i == 1 ? di(e, t, rr, xr) : di(e, t, {}, br), O.splice(t, 0, e), Gn(O[t], t);
	}
	r.addSeries = Kn;
	function Jn(e) {
		if (O.splice(e, 1), dt) {
			L.values.splice(e, 1), Dt.splice(e, 1);
			let t = Et.splice(e, 1)[0];
			Yt(null, t.firstChild), t.remove();
		}
		mt && (I.splice(e, 1), Vn.splice(e, 1)[0].remove(), Hn.splice(e, 1), Un.splice(e, 1)), Oa("delSeries", e);
	}
	r.delSeries = Jn;
	let Yn = [
		!1,
		!1,
		!1,
		!1
	];
	function Xn(e, t) {
		if (e._show = e.show, e.show) {
			let n = e.side % 2, i = A[e.scale];
			i ??= (e.scale = n ? O[1].scale : M, A[e.scale]);
			let a = i.time;
			e.size = V(e.size), e.space = V(e.space), e.rotate = V(e.rotate), Pt(e.incrs) && e.incrs.forEach((e) => {
				!Ot.has(e) && Ot.set(e, kt(e));
			}), e.incrs = V(e.incrs || (i.distr == 2 ? fn : a ? Se == 1 ? Cn : En : pn)), e.splits = V(e.splits || (a && i.distr == 1 ? tt : i.distr == 3 ? or : i.distr == 4 ? sr : ar)), e.stroke = V(e.stroke), e.grid.stroke = V(e.grid.stroke), e.ticks.stroke = V(e.ticks.stroke), e.border.stroke = V(e.border.stroke);
			let o = e.values;
			e.values = Pt(o) && !Pt(o[0]) ? V(o) : a ? Pt(o) ? An(Ze, kn(o, Qe)) : Lt(o) ? jn(Ze, o) : o || nt : o || ir, e.filter = V(e.filter || (i.distr >= 3 && i.log == 10 ? fr : i.distr == 3 && i.log == 2 ? pr : yt)), e.font = bi(e.font), e.labelFont = bi(e.labelFont), e._size = e.size(r, null, t, 0), e._space = e._rotate = e._incrs = e._found = e._splits = e._values = null, e._size > 0 && (Yn[t] = !0, e._el = Me(x, f));
		}
	}
	function Zn(e, t, n, r) {
		let [i, a, o, s] = n, c = t % 2, l = 0;
		return c == 0 && (s || a) && (l = t == 0 && !i || t == 2 && !o ? R(er.size / 3) : 0), c == 1 && (i || o) && (l = t == 1 && !a || t == 3 && !s ? R(hr.size / 2) : 0), l;
	}
	let Qn = r.padding = (e.padding || [
		Zn,
		Zn,
		Zn,
		Zn
	]).map((e) => V(F(e, Zn))), $n = r._padding = Qn.map((e, t) => e(r, t, Yn, 0)), q, J = null, cr = null, lr = i == 1 ? O[0].idxs : null, ur = null, dr = !1;
	function _r(e, n) {
		if (t = e ?? [], r.data = r._data = t, i == 2) {
			q = 0;
			for (let e = 1; e < O.length; e++) q += t[e][0].length;
		} else {
			t.length == 0 && (r.data = r._data = t = [[]]), ur = t[0], q = ur.length;
			let e = t;
			if (Ue == 2) {
				e = t.slice();
				let n = e[0] = Array(q);
				for (let e = 0; e < q; e++) n[e] = e;
			}
			r._data = t = e;
		}
		if (ri(!0), Oa("setData"), Ue == 2 && (mn = !0), n !== !1) {
			let e = N;
			e.auto(r, dr) ? vr() : Wi(M, e.min, e.max), hn ||= z.left >= 0, _n = !0, Ci();
		}
	}
	r.setData = _r;
	function vr() {
		dr = !0;
		let e, n;
		i == 1 && (q > 0 ? (J = lr[0] = 0, cr = lr[1] = q - 1, e = t[0][J], n = t[0][cr], Ue == 2 ? (e = J, n = cr) : e == n && (Ue == 3 ? [e, n] = qe(e, e, N.log, !1) : Ue == 4 ? [e, n] = Je(e, e, N.log, !1) : N.time ? n = e + R(86400 / Se) : [e, n] = $e(e, n, Ye, !0))) : (J = lr[0] = e = null, cr = lr[1] = n = null)), Wi(M, e, n);
	}
	let yr, Tr, kr, Ar, Mr, Nr, Pr, Fr, Lr, Rr;
	function zr(e, t, n, r, i, a) {
		e ??= pe, n ??= Mt, r ??= "butt", i ??= pe, a ??= "round", e != yr && (d.strokeStyle = yr = e), i != Tr && (d.fillStyle = Tr = i), t != kr && (d.lineWidth = kr = t), a != Mr && (d.lineJoin = Mr = a), r != Nr && (d.lineCap = Nr = r), n != Ar && d.setLineDash(Ar = n);
	}
	function Br(e, t, n, r) {
		t != Tr && (d.fillStyle = Tr = t), e != Pr && (d.font = Pr = e), n != Fr && (d.textAlign = Fr = n), r != Lr && (d.textBaseline = Lr = r);
	}
	function Vr(e, t, n, i, a = 0) {
		if (i.length > 0 && e.auto(r, dr) && (t == null || t.min == null)) {
			let t = F(J, 0), r = F(cr, i.length - 1), o = n.min == null ? Ke(i, t, r, a, e.distr == 3) : [n.min, n.max];
			e.min = st(e.min, n.min = o[0]), e.max = ct(e.max, n.max = o[1]);
		}
	}
	let Hr = {
		min: null,
		max: null
	};
	function Ur() {
		for (let e in A) {
			let t = A[e];
			P[e] == null && (t.min == null || P[M] != null && t.auto(r, dr)) && (P[e] = Hr);
		}
		for (let e in A) {
			let t = A[e];
			P[e] == null && t.from != null && P[t.from] != null && (P[e] = Hr);
		}
		P[M] != null && ri(!0);
		let e = {};
		for (let t in P) {
			let n = P[t];
			if (n != null) {
				let a = e[t] = Ht(A[t], zt);
				if (n.min != null) U(a, n);
				else if (t != M || i == 2) if (q == 0 && a.from == null) {
					let e = a.range(r, null, null, t);
					a.min = e[0], a.max = e[1];
				} else a.min = B, a.max = -Infinity;
			}
		}
		if (q > 0) {
			O.forEach((n, a) => {
				if (i == 1) {
					let i = n.scale, o = P[i];
					if (o == null) return;
					let s = e[i];
					if (a == 0) {
						let e = s.range(r, s.min, s.max, i);
						s.min = e[0], s.max = e[1], J = He(s.min, t[0]), cr = He(s.max, t[0]), cr - J > 1 && (t[0][J] < s.min && J++, t[0][cr] > s.max && cr--), n.min = ur[J], n.max = ur[cr];
					} else n.show && n.auto && Vr(s, o, n, t[a], n.sorted);
					n.idxs[0] = J, n.idxs[1] = cr;
				} else if (a > 0 && n.show && n.auto) {
					let [r, i] = n.facets, o = r.scale, s = i.scale, [c, l] = t[a], u = e[o], d = e[s];
					u != null && Vr(u, P[o], r, c, r.sorted), d != null && Vr(d, P[s], i, l, i.sorted), n.min = i.min, n.max = i.max;
				}
			});
			for (let t in e) {
				let n = e[t], i = P[t];
				if (n.from == null && (i == null || i.min == null)) {
					let e = n.range(r, n.min == B ? null : n.min, n.max == -Infinity ? null : n.max, t);
					n.min = e[0], n.max = e[1];
				}
			}
		}
		for (let t in e) {
			let n = e[t];
			if (n.from != null) {
				let i = e[n.from];
				if (i.min == null) n.min = n.max = null;
				else {
					let e = n.range(r, i.min, i.max, t);
					n.min = e[0], n.max = e[1];
				}
			}
		}
		let n = {}, a = !1;
		for (let t in e) {
			let r = e[t], i = A[t];
			if (i.min != r.min || i.max != r.max) {
				i.min = r.min, i.max = r.max;
				let e = i.distr;
				i._min = e == 3 ? ut(i.min) : e == 4 ? pt(i.min, i.asinh) : e == 100 ? i.fwd(i.min) : i.min, i._max = e == 3 ? ut(i.max) : e == 4 ? pt(i.max, i.asinh) : e == 100 ? i.fwd(i.max) : i.max, n[t] = a = !0;
			}
		}
		if (a) {
			O.forEach((e, t) => {
				i == 2 ? t > 0 && n.y && (e._paths = null) : n[e.scale] && (e._paths = null);
			});
			for (let e in n) mn = !0, Oa("setScale", e);
			mt && z.left >= 0 && (hn = _n = !0);
		}
		for (let e in P) P[e] = null;
	}
	function Wr(e) {
		let t = ht(J - 1, 0, q - 1), n = ht(cr + 1, 0, q - 1);
		for (; e[t] == null && t > 0;) t--;
		for (; e[n] == null && n < q - 1;) n++;
		return [t, n];
	}
	function Gr() {
		if (q > 0) {
			let e = O.some((e) => e._focus) && Rr != Ln.alpha;
			e && (d.globalAlpha = Rr = Ln.alpha), O.forEach((e, n) => {
				if (n > 0 && e.show && (Kr(n, !1), Kr(n, !0), e._paths == null)) {
					let a = Rr;
					Rr != e.alpha && (d.globalAlpha = Rr = e.alpha);
					let o = i == 2 ? [0, t[n][0].length - 1] : Wr(t[n]);
					e._paths = e.paths(r, n, o[0], o[1]), Rr != a && (d.globalAlpha = Rr = a);
				}
			}), O.forEach((e, t) => {
				if (t > 0 && e.show) {
					let n = Rr;
					Rr != e.alpha && (d.globalAlpha = Rr = e.alpha), e._paths != null && qr(t, !1);
					{
						let n = e._paths == null ? null : e._paths.gaps, i = e.points.show(r, t, J, cr, n), a = e.points.filter(r, t, i, n);
						(i || a) && (e.points._paths = e.points.paths(r, t, J, cr, a), qr(t, !0));
					}
					Rr != n && (d.globalAlpha = Rr = n), Oa("drawSeries", t);
				}
			}), e && (d.globalAlpha = Rr = 1);
		}
	}
	function Kr(e, t) {
		let n = t ? O[e].points : O[e];
		n._stroke = n.stroke(r, e), n._fill = n.fill(r, e);
	}
	function qr(e, t) {
		let n = t ? O[e].points : O[e], { stroke: r, fill: i, clip: a, flags: o, _stroke: s = n._stroke, _fill: c = n._fill, _width: l = n.width } = n._paths;
		l = H(l * k, 3);
		let u = null, f = l % 2 / 2;
		t && c == null && (c = l > 0 ? "#fff" : s);
		let p = n.pxAlign == 1 && f > 0;
		if (p && d.translate(f, f), !t) {
			let e = on - l / 2, t = sn - l / 2, n = cn + l, r = ln + l;
			u = new Path2D(), u.rect(e, t, n, r);
		}
		t ? Yr(s, l, n.dash, n.cap, c, r, i, o, a) : Jr(e, s, l, n.dash, n.cap, c, r, i, o, u, a), p && d.translate(-f, -f);
	}
	function Jr(e, n, i, a, o, s, c, l, u, d, f) {
		let p = !1;
		u != 0 && Oe.forEach((m, h) => {
			if (m.series[0] == e) {
				let e = O[m.series[1]], g = t[m.series[1]], _ = (e._paths || jt).band;
				Pt(_) && (_ = m.dir == 1 ? _[0] : _[1]);
				let v, y = null;
				e.show && _ && et(g, J, cr) ? (y = m.fill(r, h) || s, v = e._paths.clip) : _ = null, Yr(n, i, a, o, y, c, l, u, d, f, v, _), p = !0;
			}
		}), p || Yr(n, i, a, o, s, c, l, u, d, f);
	}
	function Yr(e, t, n, r, i, a, o, s, c, l, u, f) {
		zr(e, t, n, r, i), (c || l || f) && (d.save(), c && d.clip(c), l && d.clip(l)), f ? (s & 3) == 3 ? (d.clip(f), u && d.clip(u), Zr(i, o), Xr(e, a, t)) : s & Or ? (Zr(i, o), d.clip(f), Xr(e, a, t)) : s & Dr && (d.save(), d.clip(f), u && d.clip(u), Zr(i, o), d.restore(), Xr(e, a, t)) : (Zr(i, o), Xr(e, a, t)), (c || l || f) && d.restore();
	}
	function Xr(e, t, n) {
		n > 0 && (t instanceof Map ? t.forEach((e, t) => {
			d.strokeStyle = yr = t, d.stroke(e);
		}) : t != null && e && d.stroke(t));
	}
	function Zr(e, t) {
		t instanceof Map ? t.forEach((e, t) => {
			d.fillStyle = Tr = t, d.fill(e);
		}) : t != null && e && d.fill(t);
	}
	function Qr(e, t, n, i) {
		let a = De[e], o;
		if (i <= 0) o = [0, 0];
		else {
			let s = a._space = a.space(r, e, t, n, i);
			o = yi(t, n, a._incrs = a.incrs(r, e, t, n, i, s), i, s);
		}
		return a._found = o;
	}
	function $r(e, t, n, r, i, a, o, s, c, l) {
		let u = o % 2 / 2;
		be == 1 && d.translate(u, u), zr(s, o, c, l, s), d.beginPath();
		let f, p, m, h, g = i + (r == 0 || r == 3 ? -a : a);
		n == 0 ? (p = i, h = g) : (f = i, m = g);
		for (let r = 0; r < e.length; r++) t[r] != null && (n == 0 ? f = m = e[r] : p = h = e[r], d.moveTo(f, p), d.lineTo(m, h));
		d.stroke(), be == 1 && d.translate(-u, -u);
	}
	function ei(e) {
		let t = !0;
		return De.forEach((n, i) => {
			if (!n.show) return;
			let a = A[n.scale];
			if (a.min == null) {
				n._show && (t = !1, n._show = !1, ri(!1));
				return;
			} else n._show || (t = !1, n._show = !0, ri(!1));
			let o = n.side, s = o % 2, { min: c, max: l } = a, [u, d] = Qr(i, c, l, s == 0 ? W : G);
			if (d == 0) return;
			let f = a.distr == 2, p = n._splits = n.splits(r, i, c, l, u, d, f), m = a.distr == 2 ? p.map((e) => ur[e]) : p, h = a.distr == 2 ? ur[p[1]] - ur[p[0]] : u, g = n._values = n.values(r, n.filter(r, m, i, d, h), i, d, h);
			n._rotate = o == 2 ? n.rotate(r, g, i, d) : 0;
			let _ = n._size;
			n._size = ot(n.size(r, g, i, e)), _ != null && n._size != _ && (t = !1);
		}), t;
	}
	function ti(e) {
		let t = !0;
		return Qn.forEach((n, i) => {
			let a = n(r, i, Yn, e);
			a != $n[i] && (t = !1), $n[i] = a;
		}), t;
	}
	function ni() {
		for (let e = 0; e < De.length; e++) {
			let t = De[e];
			if (!t.show || !t._show) continue;
			let n = t.side, i = n % 2, a, o, c = t.stroke(r, e), l = n == 0 || n == 3 ? -1 : 1, [u, f] = t._found;
			if (t.label != null) {
				let s = t.labelGap * l, p = R((t._lpos + s) * k);
				Br(t.labelFont[0], c, "center", n == 2 ? le : ue), d.save(), i == 1 ? (a = o = 0, d.translate(p, R(sn + ln / 2)), d.rotate((n == 3 ? -it : it) / 2)) : (a = R(on + cn / 2), o = p);
				let m = gt(t.label) ? t.label(r, e, u, f) : t.label;
				d.fillText(m, a, o), d.restore();
			}
			if (f == 0) continue;
			let p = A[t.scale], m = i == 0 ? cn : ln, h = i == 0 ? on : sn, g = t._splits, _ = p.distr == 2 ? g.map((e) => ur[e]) : g, v = p.distr == 2 ? ur[g[1]] - ur[g[0]] : u, y = t.ticks, b = t.border, x = y.show ? y.size : 0, S = R(x * k), C = R((t.alignTo == 2 ? t._size - x - t.gap : t.gap) * k), w = t._rotate * -it / 180, T = xe(t._pos * k), E = T + (S + C) * l;
			o = i == 0 ? E : 0, a = i == 1 ? E : 0;
			let ee = t.font[0];
			Br(ee, c, t.align == 1 ? de : t.align == 2 ? fe : w > 0 ? de : w < 0 ? fe : i == 0 ? "center" : n == 3 ? fe : de, w || i == 1 ? "middle" : n == 2 ? le : ue);
			let te = t.font[1] * t.lineGap, ne = g.map((e) => xe(s(e, p, m, h))), re = t._values;
			for (let e = 0; e < re.length; e++) {
				let t = re[e];
				if (t != null) {
					i == 0 ? a = ne[e] : o = ne[e], t = "" + t;
					let n = t.indexOf("\n") == -1 ? [t] : t.split(/\n/gm);
					for (let e = 0; e < n.length; e++) {
						let t = n[e];
						w ? (d.save(), d.translate(a, o + e * te), d.rotate(w), d.fillText(t, 0, 0), d.restore()) : d.fillText(t, a, o + e * te);
					}
				}
			}
			y.show && $r(ne, y.filter(r, _, e, f, v), i, n, T, S, H(y.width * k, 3), y.stroke(r, e), y.dash, y.cap);
			let ie = t.grid;
			ie.show && $r(ne, ie.filter(r, _, e, f, v), i, i == 0 ? 2 : 1, i == 0 ? sn : on, i == 0 ? ln : cn, H(ie.width * k, 3), ie.stroke(r, e), ie.dash, ie.cap), b.show && $r([T], [1], +(i == 0), i == 0 ? 1 : 2, i == 1 ? sn : on, i == 1 ? ln : cn, H(b.width * k, 3), b.stroke(r, e), b.dash, b.cap);
		}
		Oa("drawAxes");
	}
	function ri(e) {
		O.forEach((t, n) => {
			n > 0 && (t._paths = null, e && (i == 1 ? (t.min = null, t.max = null) : t.facets.forEach((e) => {
				e.min = null, e.max = null;
			})));
		});
	}
	let ii = !1, oi = !1, Y = [];
	function Si() {
		oi = !1;
		for (let e = 0; e < Y.length; e++) Oa(...Y[e]);
		Y.length = 0;
	}
	function Ci() {
		ii ||= (Jt(Ti), !0);
	}
	function wi(e, t = !1) {
		ii = !0, oi = t, e(r), Ti(), t && Y.length > 0 && queueMicrotask(Si);
	}
	r.batch = wi;
	function Ti() {
		if (un &&= (Ur(), !1), mn &&= (bn(), !1), dn) {
			if (j(p, de, Qt), j(p, le, $t), j(p, se, W), j(p, ce, G), j(D, de, Qt), j(D, le, $t), j(D, se, W), j(D, ce, G), j(f, se, Xt), j(f, ce, Zt), u.width = R(Xt * k), u.height = R(Zt * k), De.forEach(({ _el: e, _show: t, _size: n, _pos: r, side: i }) => {
				if (e != null) if (t) {
					let t = i === 3 || i === 0 ? n : 0, a = i % 2 == 1;
					j(e, a ? "left" : "top", r - t), j(e, a ? "width" : "height", n), j(e, a ? "top" : "left", a ? $t : Qt), j(e, a ? "height" : "width", a ? G : W), Ae(e, S);
				} else ke(e, S);
			}), yr = Tr = kr = Mr = Nr = Pr = Fr = Lr = Ar = null, Rr = 1, fa(!0), Qt != en || $t != tn || W != nn || G != rn) {
				ri(!1);
				let e = W / nn, t = G / rn;
				if (mt && !hn && z.left >= 0) {
					z.left *= e, z.top *= t, ki && Ne(ki, R(z.left), 0, W, G), Ai && Ne(Ai, 0, R(z.top), W, G);
					for (let n = 0; n < Vn.length; n++) {
						let r = Vn[n];
						r != null && (Hn[n] *= e, Un[n] *= t, Ne(r, ot(Hn[n]), ot(Un[n]), W, G));
					}
				}
				if (Q.show && !gn && Q.left >= 0 && Q.width > 0) {
					Q.left *= e, Q.width *= e, Q.top *= t, Q.height *= t;
					for (let e in ha) j(Vi, e, Q[e]);
				}
				en = Qt, tn = $t, nn = W, rn = G;
			}
			Oa("setSize"), dn = !1;
		}
		Xt > 0 && Zt > 0 && (d.clearRect(0, 0, u.width, u.height), Oa("drawClear"), Ie.forEach((e) => e()), Oa("draw")), Q.show && gn && (Hi(Q), gn = !1), mt && hn && (ua(null, !0, !1), hn = !1), L.show && L.live && _n && (ca(), _n = !1), c || (c = !0, r.status = 1, Oa("ready")), dr = !1, ii = !1;
	}
	r.redraw = (e, t) => {
		mn = t || !1, e === !1 ? Ci() : Wi(M, N.min, N.max);
	};
	function Ei(e, n) {
		let i = A[e];
		if (i.from == null) {
			if (q == 0) {
				let t = i.range(r, n.min, n.max, e);
				n.min = t[0], n.max = t[1];
			}
			if (n.min > n.max) {
				let e = n.min;
				n.min = n.max, n.max = e;
			}
			if (q > 1 && n.min != null && n.max != null && n.max - n.min < 1e-16) return;
			e == M && i.distr == 2 && q > 0 && (n.min = He(n.min, t[0]), n.max = He(n.max, t[0]), n.min == n.max && n.max++), P[e] = n, un = !0, Ci();
		}
	}
	r.setScale = Ei;
	let Di, Oi, ki, Ai, ji, Mi, Ni, Pi, Fi, Ii, X, Z, Li = !1, Ri = z.drag, zi = Ri.x, Bi = Ri.y;
	mt && (z.x && (Di = Me(w, D)), z.y && (Oi = Me(T, D)), N.ori == 0 ? (ki = Di, Ai = Oi) : (ki = Oi, Ai = Di), X = z.left, Z = z.top);
	let Q = r.select = U({
		show: !0,
		over: !0,
		left: 0,
		width: 0,
		top: 0,
		height: 0
	}, e.select), Vi = Q.show ? Me(C, Q.over ? D : p) : null;
	function Hi(e, t) {
		if (Q.show) {
			for (let t in e) Q[t] = e[t], t in ha && j(Vi, t, e[t]);
			t !== !1 && Oa("setSelect");
		}
	}
	r.setSelect = Hi;
	function Ui(e) {
		if (O[e].show) dt && Ae(Et[e], S);
		else if (dt && ke(Et[e], S), mt) {
			let t = Bn ? Vn[0] : Vn[e];
			t != null && Ne(t, -10, -10, W, G);
		}
	}
	function Wi(e, t, n) {
		Ei(e, {
			min: t,
			max: n
		});
	}
	function Gi(e, t, n, a) {
		t.focus != null && ea(e), t.show != null && O.forEach((n, r) => {
			r > 0 && (e == r || e == null) && (n.show = t.show, Ui(r), i == 2 ? (Wi(n.facets[0].scale, null, null), Wi(n.facets[1].scale, null, null)) : Wi(n.scale, null, null), Ci());
		}), n !== !1 && Oa("setSeries", e, t), a && Ma("setSeries", r, e, t);
	}
	r.setSeries = Gi;
	function Ki(e, t) {
		U(Oe[e], t);
	}
	function qi(e, t) {
		e.fill = V(e.fill || null), e.dir = F(e.dir, -1), t ??= Oe.length, Oe.splice(t, 0, e);
	}
	function Ji(e) {
		e == null ? Oe.length = 0 : Oe.splice(e, 1);
	}
	r.addBand = qi, r.setBand = Ki, r.delBand = Ji;
	function Yi(e, t) {
		O[e].alpha = t, mt && Vn[e] != null && (Vn[e].style.opacity = t), dt && Et[e] && (Et[e].style.opacity = t);
	}
	let Xi, Zi, Qi, $i = { focus: !0 };
	function ea(e) {
		if (e != Qi) {
			let t = e == null, n = Ln.alpha != 1;
			O.forEach((r, a) => {
				if (i == 1 || a > 0) {
					let i = t || a == 0 || a == e;
					r._focus = t ? null : i, n && Yi(a, i ? 1 : Ln.alpha);
				}
			}), Qi = e, n && Ci();
		}
	}
	dt && zn && qt(ve, vt, (e) => {
		z._lock || (Mn(e), Qi != null && Gi(null, $i, !0, $.setSeries));
	});
	function ta(e, t, n) {
		let r = A[t];
		n && (e = e / k - (r.ori == 1 ? $t : Qt));
		let i = W;
		r.ori == 1 && (i = G, e = i - e), r.dir == -1 && (e = i - e);
		let a = r._min, o = r._max, s = e / i, c = a + (o - a) * s, l = r.distr;
		return l == 3 ? lt(10, c) : l == 4 ? ft(c, r.asinh) : l == 100 ? r.bwd(c) : c;
	}
	function na(e, n) {
		return He(ta(e, M, n), t[0], J, cr);
	}
	r.valToIdx = (e) => He(e, t[0]), r.posToIdx = na, r.posToVal = ta, r.valToPos = (e, t, n) => A[t].ori == 0 ? a(e, A[t], n ? cn : W, n ? on : 0) : o(e, A[t], n ? ln : G, n ? sn : 0), r.setCursor = (e, t, n) => {
		X = e.left, Z = e.top, ua(null, t, n);
	};
	function ra(e, t) {
		j(Vi, de, Q.left = e), j(Vi, se, Q.width = t);
	}
	function ia(e, t) {
		j(Vi, le, Q.top = e), j(Vi, ce, Q.height = t);
	}
	let aa = N.ori == 0 ? ra : ia, oa = N.ori == 1 ? ra : ia;
	function sa() {
		if (dt && L.live) for (let e = +(i == 2); e < O.length; e++) {
			if (e == 0 && Ft) continue;
			let t = L.values[e], n = 0;
			for (let r in t) Dt[e][n++].firstChild.nodeValue = t[r];
		}
	}
	function ca(e, t) {
		if (e != null && (e.idxs ? e.idxs.forEach((e, t) => {
			I[t] = e;
		}) : It(e.idx) || I.fill(e.idx), L.idx = I[0]), dt && L.live) {
			for (let e = 0; e < O.length; e++) (e > 0 || i == 1 && !Ft) && la(e, I[e]);
			sa();
		}
		_n = !1, t !== !1 && Oa("setLegend");
	}
	r.setLegend = ca;
	function la(e, n) {
		let i = O[e], a = e == 0 && Ue == 2 ? ur : t[e], o;
		Ft ? o = i.values(r, e, n) ?? Bt : (o = i.value(r, n == null ? null : a[n], e, n), o = o == null ? Bt : { _: o }), L.values[e] = o;
	}
	function ua(e, n, a) {
		Fi = X, Ii = Z, [X, Z] = z.move(r, X, Z), z.left = X, z.top = Z, mt && (ki && Ne(ki, R(X), 0, W, G), Ai && Ne(Ai, 0, R(Z), W, G));
		let o, s = J > cr;
		Xi = B, Zi = null;
		let c = N.ori == 0 ? W : G, l = N.ori == 1 ? W : G;
		if (X < 0 || q == 0 || s) {
			o = z.idx = null;
			for (let e = 0; e < O.length; e++) {
				let t = Vn[e];
				t != null && Ne(t, -10, -10, W, G);
			}
			zn && Gi(null, $i, !0, e == null && $.setSeries), L.live && (I.fill(o), _n = !0);
		} else {
			let e, n, a;
			i == 1 && (e = N.ori == 0 ? X : Z, n = ta(e, M), o = z.idx = He(n, t[0], J, cr), a = We(t[0][o], N, c, 0));
			let s = -10, u = -10, d = 0, f = 0, p = !0, m = "", h = "";
			for (let e = +(i == 2); e < O.length; e++) {
				let g = O[e], _ = I[e], v = _ == null ? null : i == 1 ? t[e][_] : t[e][1][_], y = z.dataIdx(r, e, o, n), b = y == null ? null : i == 1 ? t[e][y] : t[e][1][y];
				if (_n = _n || b != v || y != _, I[e] = y, e > 0 && g.show) {
					let n = y == null ? -10 : y == o ? a : We(i == 1 ? t[0][y] : t[e][0][y], N, c, 0), _ = b == null ? -10 : Ge(b, i == 1 ? A[g.scale] : A[g.facets[1].scale], l, 0);
					if (zn && b != null) {
						let t = N.ori == 1 ? X : Z, n = at(Ln.dist(r, e, y, _, t));
						if (n < Xi) {
							let r = Ln.bias;
							if (r != 0) {
								let i = ta(t, g.scale), a = b >= 0 ? 1 : -1, o = i >= 0 ? 1 : -1;
								o == a && (o == 1 ? r == 1 ? b >= i : b <= i : r == 1 ? b <= i : b >= i) && (Xi = n, Zi = e);
							} else Xi = n, Zi = e;
						}
					}
					if (_n || Bn) {
						let t, i;
						N.ori == 0 ? (t = n, i = _) : (t = _, i = n);
						let a, o, c, l, g, v, y = !0, b = In.bbox;
						if (b != null) {
							y = !1;
							let t = b(r, e);
							c = t.left, l = t.top, a = t.width, o = t.height;
						} else c = t, l = i, a = o = In.size(r, e);
						if (v = In.fill(r, e), g = In.stroke(r, e), Bn) e == Zi && Xi <= Ln.prox && (s = c, u = l, d = a, f = o, p = y, m = v, h = g);
						else {
							let t = Vn[e];
							t != null && (Hn[e] = c, Un[e] = l, Le(t, a, o, y), Fe(t, v, g), Ne(t, ot(c), ot(l), W, G));
						}
					}
				}
			}
			if (Bn) {
				let e = Ln.prox;
				if (_n || (Qi == null ? Xi <= e : Xi > e || Zi != Qi)) {
					let e = Vn[0];
					e != null && (Hn[0] = s, Un[0] = u, Le(e, d, f, p), Fe(e, m, h), Ne(e, ot(s), ot(u), W, G));
				}
			}
		}
		if (Q.show && Li) if (e != null) {
			let [t, n] = $.scales, [r, i] = $.match, [a, o] = e.cursor.sync.scales, s = e.cursor.drag;
			if (zi = s._x, Bi = s._y, zi || Bi) {
				let { left: s, top: u, width: d, height: f } = e.select, p = e.scales[a].ori, m = e.posToVal, h, g, _, v, y, b = t != null && r(t, a), x = n != null && i(n, o);
				b && zi ? (p == 0 ? (h = s, g = d) : (h = u, g = f), _ = A[t], v = We(m(h, a), _, c, 0), y = We(m(h + g, a), _, c, 0), aa(st(v, y), at(y - v))) : aa(0, c), x && Bi ? (p == 1 ? (h = s, g = d) : (h = u, g = f), _ = A[n], v = Ge(m(h, o), _, l, 0), y = Ge(m(h + g, o), _, l, 0), oa(st(v, y), at(y - v))) : oa(0, l);
			} else ga();
		} else {
			let e = at(Fi - ji), t = at(Ii - Mi);
			if (N.ori == 1) {
				let n = e;
				e = t, t = n;
			}
			zi = Ri.x && e >= Ri.dist, Bi = Ri.y && t >= Ri.dist;
			let n = Ri.uni;
			n == null ? Ri.x && Ri.y && (zi || Bi) && (zi = Bi = !0) : zi && Bi && (zi = e >= n, Bi = t >= n, !zi && !Bi && (t > e ? Bi = !0 : zi = !0));
			let r, i;
			zi && (N.ori == 0 ? (r = Ni, i = X) : (r = Pi, i = Z), aa(st(r, i), at(i - r)), Bi || oa(0, l)), Bi && (N.ori == 1 ? (r = Ni, i = X) : (r = Pi, i = Z), oa(st(r, i), at(i - r)), zi || aa(0, c)), !zi && !Bi && (aa(0, 0), oa(0, 0));
		}
		if (Ri._x = zi, Ri._y = Bi, e == null) {
			if (a) {
				if (Aa != null) {
					let [e, t] = $.scales;
					$.values[0] = e == null ? null : ta(N.ori == 0 ? X : Z, e), $.values[1] = t == null ? null : ta(N.ori == 1 ? X : Z, t);
				}
				Ma(me, r, X, Z, W, G, o);
			}
			if (zn) {
				let e = a && $.setSeries, t = Ln.prox;
				Qi == null ? Xi <= t && Gi(Zi, $i, !0, e) : Xi > t ? Gi(null, $i, !0, e) : Zi != Qi && Gi(Zi, $i, !0, e);
			}
		}
		_n && (L.idx = o, ca()), n !== !1 && Oa("setCursor");
	}
	let da = null;
	Object.defineProperty(r, "rect", { get() {
		return da ?? fa(!1), da;
	} });
	function fa(e = !1) {
		e ? da = null : (da = D.getBoundingClientRect(), Oa("syncRect", da));
	}
	function pa(e, t, n, r, i, a, o) {
		z._lock || Li && e != null && e.movementX == 0 && e.movementY == 0 || (ma(e, t, n, r, i, a, o, !1, e != null), e == null ? ua(t, !0, !1) : ua(null, !0, !0));
	}
	function ma(e, t, n, i, a, o, c, l, u) {
		if (da ?? fa(!1), Mn(e), e != null) n = e.clientX - da.left, i = e.clientY - da.top;
		else {
			if (n < 0 || i < 0) {
				X = -10, Z = -10;
				return;
			}
			let [e, r] = $.scales, c = t.cursor.sync, [l, u] = c.values, [d, f] = c.scales, [p, m] = $.match, h = t.axes[0].side % 2 == 1, g = N.ori == 0 ? W : G, _ = N.ori == 1 ? W : G, v = h ? o : a, y = h ? a : o, b = h ? i : n, x = h ? n : i;
			if (n = d == null ? b / v * g : p(e, d) ? s(l, A[e], g, 0) : -10, i = f == null ? x / y * _ : m(r, f) ? s(u, A[r], _, 0) : -10, N.ori == 1) {
				let e = n;
				n = i, i = e;
			}
		}
		u && (t == null || t.cursor.event.type == me) && ((n <= 1 || n >= W - 1) && (n = Tt(n, W)), (i <= 1 || i >= G - 1) && (i = Tt(i, G))), l ? (ji = n, Mi = i, [Ni, Pi] = z.move(r, n, i)) : (X = n, Z = i);
	}
	let ha = {
		width: 0,
		height: 0,
		left: 0,
		top: 0
	};
	function ga() {
		Hi(ha, !1);
	}
	let _a, va, ya, ba;
	function xa(e, t, n, i, a, o, s) {
		Li = !0, zi = Bi = Ri._x = Ri._y = !1, ma(e, t, n, i, a, o, s, !0, !1), e != null && (qt(ge, Te, Sa, !1), Ma(he, r, Ni, Pi, W, G, null));
		let { left: c, top: l, width: u, height: d } = Q;
		_a = c, va = l, ya = u, ba = d;
	}
	function Sa(e, t, n, i, a, o, s) {
		Li = Ri._x = Ri._y = !1, ma(e, t, n, i, a, o, s, !1, !0);
		let { left: c, top: l, width: u, height: d } = Q, f = u > 0 || d > 0, p = _a != c || va != l || ya != u || ba != d;
		if (f && p && Hi(Q), Ri.setScale && f && p) {
			let e = c, t = u, n = l, r = d;
			if (N.ori == 1 && (e = l, t = d, n = c, r = u), zi && Wi(M, ta(e, M), ta(e + t, M)), Bi) for (let e in A) {
				let t = A[e];
				e != M && t.from == null && t.min != B && Wi(e, ta(n + r, e), ta(n, e));
			}
			ga();
		} else z.lock && (z._lock = !z._lock, ua(t, !0, e != null));
		e != null && (Yt(ge, Te), Ma(ge, r, X, Z, W, G, null));
	}
	function Ca(e, t, n, r, i, a, o) {
		if (z._lock) return;
		Mn(e);
		let s = Li;
		if (Li) {
			let e = !0, t = !0, n, r;
			N.ori == 0 ? (n = zi, r = Bi) : (n = Bi, r = zi), n && r && (e = X <= 10 || X >= W - 10, t = Z <= 10 || Z >= G - 10), n && e && (X = X < Ni ? 0 : W), r && t && (Z = Z < Pi ? 0 : G), ua(null, !0, !0), Li = !1;
		}
		X = -10, Z = -10, I.fill(null), ua(null, !0, !0), s && (Li = s);
	}
	function wa(e, t, n, i, a, o, s) {
		z._lock || (Mn(e), vr(), ga(), e != null && Ma(ye, r, X, Z, W, G, null));
	}
	function Ta() {
		De.forEach(xi), vn(r.width, r.height, !0);
	}
	Be(Ce, Ee, Ta);
	let Ea = {};
	Ea.mousedown = xa, Ea.mousemove = pa, Ea.mouseup = Sa, Ea.dblclick = wa, Ea.setSeries = (e, t, n, i) => {
		let a = $.match[2];
		n = a(r, t, n), n != -1 && Gi(n, i, !0, !1);
	}, mt && (qt(he, D, xa), qt(me, D, pa), qt(_e, D, (e) => {
		Mn(e), fa(!1);
	}), qt(ve, D, Ca), qt(ye, D, wa), ai.add(r), r.syncRect = fa);
	let Da = r.hooks = e.hooks || {};
	function Oa(e, t, n) {
		oi ? Y.push([
			e,
			t,
			n
		]) : e in Da && Da[e].forEach((e) => {
			e.call(null, r, t, n);
		});
	}
	(e.plugins || []).forEach((e) => {
		for (let t in e.hooks) Da[t] = (Da[t] || []).concat(e.hooks[t]);
	});
	let ka = (e, t, n) => n, $ = U({
		key: null,
		setSeries: !1,
		filters: {
			pub: xt,
			sub: xt
		},
		scales: [M, O[1] ? O[1].scale : null],
		match: [
			St,
			St,
			ka
		],
		values: [null, null]
	}, z.sync);
	$.match.length == 2 && $.match.push(ka), z.sync = $;
	let Aa = $.key, ja = Er(Aa);
	function Ma(e, t, n, r, i, a, o) {
		$.filters.pub(e, t, n, r, i, a, o) && ja.pub(e, t, n, r, i, a, o);
	}
	ja.sub(r);
	function Na(e, t, n, r, i, a, o) {
		$.filters.sub(e, t, n, r, i, a, o) && Ea[e](null, t, n, r, i, a, o);
	}
	r.pub = Na;
	function Pa() {
		ja.unsub(r), ai.delete(r), Kt.clear(), Ve(Ce, Ee, Ta), l.remove(), vt?.remove(), Oa("destroy");
	}
	r.destroy = Pa;
	function Fa() {
		Oa("init", e, t), _r(t || e.data, !1), P[M] ? Ei(M, P[M]) : vr(), gn = Q.show && (Q.width > 0 || Q.height > 0), hn = _n = !0, vn(e.width, e.height);
	}
	return O.forEach(Gn), De.forEach(Xn), n ? n instanceof HTMLElement ? (n.appendChild(l), Fa()) : n(r, Fa) : Fa(), r;
}
Y.assign = U, Y.fmtNum = rt, Y.rangeNum = $e, Y.rangeLog = qe, Y.rangeAsinh = Je, Y.orient = kr, Y.pxRatio = k, Y.join = qt, Y.fmtDate = an, Y.tzDate = sn, Y.sync = Er;
{
	Y.addGap = Pr, Y.clipGaps = Nr;
	let e = Y.paths = { points: Jr };
	e.linear = Qr, e.stepped = $r, e.bars = ti, e.spline = ri;
}
//#endregion
//#region src/features/panels/JointStatePlot/Component.tsx
var Si = 3, Ci = .5;
function wi() {
	return {
		timestamps: [],
		perJoint: [],
		jointNames: [],
		lastTs: -Infinity,
		typicalInterval: .02,
		realRowCount: 0
	};
}
function Ti(e, t) {
	if (!e || typeof e != "object") return null;
	let n = e[t];
	if (typeof n != "object" || !n || !("length" in n)) return null;
	let r = n.length;
	return typeof r != "number" || r === 0 ? null : n;
}
function Ei(e) {
	if (!e || typeof e != "object") return null;
	let t = e.name;
	if (!t || typeof t != "object" || !("length" in t)) return null;
	let n = t.length;
	if (typeof n != "number" || n === 0) return null;
	let r = [];
	for (let e = 0; e < n; e++) {
		let n = t[e];
		r.push(typeof n == "string" ? n : `joint_${e}`);
	}
	return r;
}
function Di(e, t, n, r) {
	let o = !1, s = !1;
	for (let c of t) {
		let t = Ti(c.message, n);
		if (!t) continue;
		let l = Ei(c.message);
		if (!l || l.length !== t.length) continue;
		(e.jointNames.length !== l.length || l.some((t, n) => t !== e.jointNames[n])) && (e.timestamps = [], e.perJoint = Array.from({ length: l.length }, () => []), e.jointNames = l, e.lastTs = -Infinity, e.realRowCount = 0, o = !0);
		let u = i(a(c, r).time);
		if (e.lastTs > -Infinity && u - e.lastTs > Math.max(e.typicalInterval * Si, Ci)) {
			e.timestamps.push((e.lastTs + u) / 2);
			for (let t of e.perJoint) t.push(null);
		}
		e.timestamps.push(u);
		for (let n = 0; n < e.jointNames.length; n++) {
			let r = t[n];
			e.perJoint[n].push(typeof r == "number" && Number.isFinite(r) ? r : null);
		}
		if (e.lastTs > -Infinity && u > e.lastTs) {
			let t = u - e.lastTs;
			t < Ci && (e.typicalInterval = e.typicalInterval * .9 + t * .1);
		}
		e.lastTs = u, e.realRowCount += 1, s = !0;
	}
	return {
		topologyChanged: o,
		hasNewData: s
	};
}
function Oi(e, t) {
	if (e.jointNames.length === 0 || e.timestamps.length <= t) return;
	let n = [];
	for (let t = 0; t < e.timestamps.length; t++) e.timestamps[t] !== null && n.push(t);
	if (n.length <= t) return;
	let r = e.perJoint.map((r) => {
		let i = o(n.map((t) => ({
			x: e.timestamps[t],
			y: r[t]
		})).filter((e) => e.y !== null && e.x !== null), t), a = new Set(i.map((e) => e.x)), s = /* @__PURE__ */ new Set();
		for (let t of n) a.has(e.timestamps[t]) && s.add(t);
		return s;
	}), i = /* @__PURE__ */ new Set();
	for (let t = 0; t < e.timestamps.length; t++) e.timestamps[t] === null && i.add(t);
	for (let e of r) for (let t of e) i.add(t);
	let a = Array.from(i).sort((e, t) => e - t);
	e.timestamps = a.map((t) => e.timestamps[t]);
	for (let t = 0; t < e.perJoint.length; t++) e.perJoint[t] = a.map((n) => e.perJoint[t][n]);
}
function ki(e) {
	return [[], ...Array.from({ length: e }, () => [])];
}
function Ai(e) {
	return [e.timestamps, ...e.perJoint];
}
function ji(e) {
	return `hsl(${e * 137.508 % 360}, 70%, 50%)`;
}
var Mi = ({ player: i, panelId: a, topic: o, field: p, selectedJoints: m, timestampMode: h, maxPointsPerJoint: g }) => {
	let { formatMessage: _ } = e(), v = u(null), y = u(null), b = u(wi()), x = u(!1), S = u(null), [C, w] = d(0);
	c(() => {
		if (!o) {
			i.unregisterSubscriptions(a);
			return;
		}
		return i.registerSubscriptions(a, [{
			topic: o,
			subscriberId: a
		}]), () => i.unregisterSubscriptions(a);
	}, [
		i,
		a,
		o
	]), c(() => {
		b.current = wi(), w(0), S.current && (S.current(), S.current = null, x.current = !1), y.current?.setData(ki(0));
	}, [
		o,
		p,
		h
	]);
	let T = s(() => {
		x.current || !y.current || (x.current = !0, S.current = t(() => {
			x.current = !1, S.current = null, y.current?.setData(Ai(b.current));
		}));
	}, []);
	c(() => {
		let e = n.getSubscriberMessages(a);
		if (!e || e.length === 0) return;
		let t = b.current, { topologyChanged: r, hasNewData: i } = Di(t, e, p, h);
		if (!i) return;
		let o = Math.floor(g * 1.5);
		if (t.realRowCount > o && Oi(t, g), r) {
			w((e) => e + 1);
			return;
		}
		T();
	}, [
		r(a),
		a,
		p,
		h,
		g,
		T
	]);
	let E = l(() => b.current.jointNames, [C]);
	return c(() => {
		let e = v.current;
		if (!e || E.length === 0) return;
		let t = new Y({
			title: "",
			id: a,
			width: e.offsetWidth || 400,
			height: Math.max((e.offsetHeight || 200) - 30, 80),
			series: [{ label: _({ id: "panels.jointStatePlot.axis.time" }) }, ...E.map((e, t) => ({
				label: e,
				stroke: ji(t),
				width: 1.5,
				points: { show: !1 },
				spanGaps: !1
			}))],
			axes: [{
				grid: { show: !0 },
				stroke: "#888",
				font: "10px sans-serif"
			}, {
				grid: { show: !0 },
				stroke: "#888",
				font: "10px sans-serif"
			}],
			cursor: { drag: { setScale: !0 } },
			legend: { show: !1 },
			scales: { x: { time: !0 } }
		}, Ai(b.current), e);
		y.current = t;
		for (let e = 0; e < E.length; e++) {
			let n = m.length === 0 || m.includes(E[e]);
			t.setSeries(e + 1, { show: n });
		}
		let n = new ResizeObserver(() => {
			v.current && y.current && y.current.setSize({
				width: v.current.offsetWidth,
				height: Math.max(v.current.offsetHeight - 30, 80)
			});
		});
		return n.observe(e), () => {
			n.disconnect(), S.current && (S.current(), S.current = null, x.current = !1), t.destroy(), y.current = null;
		};
	}, [
		a,
		C,
		_
	]), c(() => {
		let e = y.current;
		if (!e) return;
		let t = b.current.jointNames;
		for (let n = 0; n < t.length; n++) {
			let r = m.length === 0 || m.includes(t[n]);
			e.setSeries(n + 1, { show: r });
		}
		e.redraw();
	}, [m]), /* @__PURE__ */ f("div", {
		ref: v,
		className: "flex-1 min-h-0 w-full overflow-hidden"
	});
};
//#endregion
export { Mi as JointStatePlotComponent };
