@carbon/charts
Version:
Carbon Charts component library
1,568 lines • 441 kB
JavaScript
import { t as qr, af as fl, i as gl, ag as ml, ah as jr, ai as Kr, aj as vl, ak as yl, al as El, am as Sl, an as Qr, ao as ba, ap as hn, g as O, p as ee, a as un, C as Oa, aq as Et, w as kt, X as Nn, E as La, H as te, ar as Jr, as as Ms, c as xl, a0 as be, I as yi, K as Ei, e as le, S as Tn, R as Ee, f as xe, x as Se, P as Tl, h as an, O as bl, at as to, au as Pe, z as xt, l as Jt, a2 as Ut, a1 as Ol, M as Ll, av as eo, y as Nt, q as vn, n as Fn, W as Us, aw as Al, ax as Ml, ay as Si, az as Aa, A as Ce, aA as Ma, aB as no, aC as wl } from "./color-scale-utils-C4KU2jNr.mjs";
import { z as rt, a0 as b, O as Tt, r as Ae, q as We, L as Cl, A as ie, m as st, t as _e, X as rn, S as Dt, e as Q, Z as Xe, i as qt, f as wa, K as Fs, d as _l, H as Wn, n as Ws, I as Xs, C as Ys, p as Xn, b as Ca, D as Zs, V as kl, y as ke, a1 as Yn, Q as qs } from "./axis-scales-CFRGPXH8.mjs";
import { R as ct } from "./a11y-ePqvrObQ.mjs";
import { t as as, s as D, h as _a, e as Xt, c as rs, f as Ie, g as de, m as js, i as ka, j as Ia, k as on, l as $t, n as Ra, o as Il, q as Rl, u as Zi, D as I, v as Dl, w as xi, G as Da, x as ps, y as Nl, a as Pl, p as Ot, r as Na, b as $l } from "./angle-utils-Dy0Gf7Eb.mjs";
import { b as so, c as pt, a as qi, s as Gl } from "./array-D6ni_TQq.mjs";
function Vl(i, t, e, n) {
for (var s = -1, a = i == null ? 0 : i.length; ++s < a; )
e = t(e, i[s], s, i);
return e;
}
function Bl(i) {
return function(t) {
return i?.[t];
};
}
var Hl = {
// Latin-1 Supplement block.
À: "A",
Á: "A",
Â: "A",
Ã: "A",
Ä: "A",
Å: "A",
à: "a",
á: "a",
â: "a",
ã: "a",
ä: "a",
å: "a",
Ç: "C",
ç: "c",
Ð: "D",
ð: "d",
È: "E",
É: "E",
Ê: "E",
Ë: "E",
è: "e",
é: "e",
ê: "e",
ë: "e",
Ì: "I",
Í: "I",
Î: "I",
Ï: "I",
ì: "i",
í: "i",
î: "i",
ï: "i",
Ñ: "N",
ñ: "n",
Ò: "O",
Ó: "O",
Ô: "O",
Õ: "O",
Ö: "O",
Ø: "O",
ò: "o",
ó: "o",
ô: "o",
õ: "o",
ö: "o",
ø: "o",
Ù: "U",
Ú: "U",
Û: "U",
Ü: "U",
ù: "u",
ú: "u",
û: "u",
ü: "u",
Ý: "Y",
ý: "y",
ÿ: "y",
Æ: "Ae",
æ: "ae",
Þ: "Th",
þ: "th",
ß: "ss",
// Latin Extended-A block.
Ā: "A",
Ă: "A",
Ą: "A",
ā: "a",
ă: "a",
ą: "a",
Ć: "C",
Ĉ: "C",
Ċ: "C",
Č: "C",
ć: "c",
ĉ: "c",
ċ: "c",
č: "c",
Ď: "D",
Đ: "D",
ď: "d",
đ: "d",
Ē: "E",
Ĕ: "E",
Ė: "E",
Ę: "E",
Ě: "E",
ē: "e",
ĕ: "e",
ė: "e",
ę: "e",
ě: "e",
Ĝ: "G",
Ğ: "G",
Ġ: "G",
Ģ: "G",
ĝ: "g",
ğ: "g",
ġ: "g",
ģ: "g",
Ĥ: "H",
Ħ: "H",
ĥ: "h",
ħ: "h",
Ĩ: "I",
Ī: "I",
Ĭ: "I",
Į: "I",
İ: "I",
ĩ: "i",
ī: "i",
ĭ: "i",
į: "i",
ı: "i",
Ĵ: "J",
ĵ: "j",
Ķ: "K",
ķ: "k",
ĸ: "k",
Ĺ: "L",
Ļ: "L",
Ľ: "L",
Ŀ: "L",
Ł: "L",
ĺ: "l",
ļ: "l",
ľ: "l",
ŀ: "l",
ł: "l",
Ń: "N",
Ņ: "N",
Ň: "N",
Ŋ: "N",
ń: "n",
ņ: "n",
ň: "n",
ŋ: "n",
Ō: "O",
Ŏ: "O",
Ő: "O",
ō: "o",
ŏ: "o",
ő: "o",
Ŕ: "R",
Ŗ: "R",
Ř: "R",
ŕ: "r",
ŗ: "r",
ř: "r",
Ś: "S",
Ŝ: "S",
Ş: "S",
Š: "S",
ś: "s",
ŝ: "s",
ş: "s",
š: "s",
Ţ: "T",
Ť: "T",
Ŧ: "T",
ţ: "t",
ť: "t",
ŧ: "t",
Ũ: "U",
Ū: "U",
Ŭ: "U",
Ů: "U",
Ű: "U",
Ų: "U",
ũ: "u",
ū: "u",
ŭ: "u",
ů: "u",
ű: "u",
ų: "u",
Ŵ: "W",
ŵ: "w",
Ŷ: "Y",
ŷ: "y",
Ÿ: "Y",
Ź: "Z",
Ż: "Z",
Ž: "Z",
ź: "z",
ż: "z",
ž: "z",
IJ: "IJ",
ij: "ij",
Œ: "Oe",
œ: "oe",
ʼn: "'n",
ſ: "s"
}, zl = Bl(Hl), Ul = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, Fl = "\\u0300-\\u036f", Wl = "\\ufe20-\\ufe2f", Xl = "\\u20d0-\\u20ff", Yl = Fl + Wl + Xl, Zl = "[" + Yl + "]", ql = RegExp(Zl, "g");
function jl(i) {
return i = qr(i), i && i.replace(Ul, zl).replace(ql, "");
}
var Kl = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
function Ql(i) {
return i.match(Kl) || [];
}
var Jl = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
function tc(i) {
return Jl.test(i);
}
var io = "\\ud800-\\udfff", ec = "\\u0300-\\u036f", nc = "\\ufe20-\\ufe2f", sc = "\\u20d0-\\u20ff", ic = ec + nc + sc, ao = "\\u2700-\\u27bf", ro = "a-z\\xdf-\\xf6\\xf8-\\xff", ac = "\\xac\\xb1\\xd7\\xf7", rc = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", oc = "\\u2000-\\u206f", lc = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", oo = "A-Z\\xc0-\\xd6\\xd8-\\xde", cc = "\\ufe0e\\ufe0f", lo = ac + rc + oc + lc, co = "['’]", Pa = "[" + lo + "]", uc = "[" + ic + "]", uo = "\\d+", hc = "[" + ao + "]", ho = "[" + ro + "]", po = "[^" + io + lo + uo + ao + ro + oo + "]", dc = "\\ud83c[\\udffb-\\udfff]", pc = "(?:" + uc + "|" + dc + ")", fc = "[^" + io + "]", fo = "(?:\\ud83c[\\udde6-\\uddff]){2}", go = "[\\ud800-\\udbff][\\udc00-\\udfff]", Je = "[" + oo + "]", gc = "\\u200d", $a = "(?:" + ho + "|" + po + ")", mc = "(?:" + Je + "|" + po + ")", Ga = "(?:" + co + "(?:d|ll|m|re|s|t|ve))?", Va = "(?:" + co + "(?:D|LL|M|RE|S|T|VE))?", mo = pc + "?", vo = "[" + cc + "]?", vc = "(?:" + gc + "(?:" + [fc, fo, go].join("|") + ")" + vo + mo + ")*", yc = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", Ec = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", Sc = vo + mo + vc, xc = "(?:" + [hc, fo, go].join("|") + ")" + Sc, Tc = RegExp([
Je + "?" + ho + "+" + Ga + "(?=" + [Pa, Je, "$"].join("|") + ")",
mc + "+" + Va + "(?=" + [Pa, Je + $a, "$"].join("|") + ")",
Je + "?" + $a + "+" + Ga,
Je + "+" + Va,
Ec,
yc,
uo,
xc
].join("|"), "g");
function bc(i) {
return i.match(Tc) || [];
}
function Oc(i, t, e) {
return i = qr(i), t = t, t === void 0 ? tc(i) ? bc(i) : Ql(i) : i.match(t) || [];
}
var Lc = "['’]", Ac = RegExp(Lc, "g");
function Mc(i) {
return function(t) {
return Vl(Oc(jl(t).replace(Ac, "")), i, "");
};
}
function wc(i, t, e) {
return i === i && (e !== void 0 && (i = i <= e ? i : e), t !== void 0 && (i = i >= t ? i : t)), i;
}
function yo(i, t, e) {
return e === void 0 && (e = t, t = void 0), e !== void 0 && (e = as(e), e = e === e ? e : 0), t !== void 0 && (t = as(t), t = t === t ? t : 0), wc(as(i), t, e);
}
var Cc = "Expected a function";
function _c(i, t, e) {
if (typeof i != "function")
throw new TypeError(Cc);
return setTimeout(function() {
i.apply(void 0, e);
}, t);
}
var kc = fl(function(i, t, e) {
return _c(i, as(t) || 0, e);
});
function Ic(i, t) {
var e = -1, n = gl(i) ? Array(i.length) : [];
return so(i, function(s, a, r) {
n[++e] = t(s, a, r);
}), n;
}
function Rc(i, t) {
var e = Kr(i) ? ml : Ic;
return e(i, jr(t));
}
var Dc = 1 / 0;
function Nc(i, t) {
return vl(Rc(i, t), Dc);
}
function Eo(i, t) {
return yl(i, t);
}
var Ye = Mc(function(i, t, e) {
return i + (e ? "-" : "") + t.toLowerCase();
});
function Pc(i, t) {
var e;
return so(i, function(n, s, a) {
return e = t(n, s, a), !e;
}), !!e;
}
function $c(i, t, e) {
var n = Kr(i) ? El : Pc;
return n(i, jr(t));
}
class $e {
constructor() {
this._partials = new Float64Array(32), this._n = 0;
}
add(t) {
const e = this._partials;
let n = 0;
for (let s = 0; s < this._n && s < 32; s++) {
const a = e[s], r = t + a, o = Math.abs(t) < Math.abs(a) ? t - (r - a) : a - (r - t);
o && (e[n++] = o), t = r;
}
return e[n] = t, this._n = n + 1, this;
}
valueOf() {
const t = this._partials;
let e = this._n, n, s, a, r = 0;
if (e > 0) {
for (r = t[--e]; e > 0 && (n = r, s = t[--e], r = n + s, a = s - (r - n), !a); )
;
e > 0 && (a < 0 && t[e - 1] < 0 || a > 0 && t[e - 1] > 0) && (s = a * 2, n = r + s, s == n - r && (r = n));
}
return r;
}
}
function* Gc(i) {
for (const t of i)
yield* t;
}
function So(i) {
return Array.from(Gc(i));
}
function Vc(i) {
return i;
}
var os = 1, ls = 2, Ti = 3, bn = 4, Ba = 1e-6;
function Bc(i) {
return "translate(" + i + ",0)";
}
function Hc(i) {
return "translate(0," + i + ")";
}
function zc(i) {
return (t) => +i(t);
}
function Uc(i, t) {
return t = Math.max(0, i.bandwidth() - t * 2) / 2, i.round() && (t = Math.round(t)), (e) => +i(e) + t;
}
function Fc() {
return !this.__axis;
}
function ws(i, t) {
var e = [], n = null, s = null, a = 6, r = 6, o = 3, c = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, l = i === os || i === bn ? -1 : 1, h = i === bn || i === ls ? "x" : "y", d = i === os || i === Ti ? Bc : Hc;
function u(p) {
var f = n ?? (t.ticks ? t.ticks.apply(t, e) : t.domain()), m = s ?? (t.tickFormat ? t.tickFormat.apply(t, e) : Vc), g = Math.max(a, 0) + o, v = t.range(), x = +v[0] + c, y = +v[v.length - 1] + c, E = (t.bandwidth ? Uc : zc)(t.copy(), c), S = p.selection ? p.selection() : p, T = S.selectAll(".domain").data([null]), C = S.selectAll(".tick").data(f, t).order(), k = C.exit(), G = C.enter().append("g").attr("class", "tick"), R = C.select("line"), M = C.select("text");
T = T.merge(T.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), C = C.merge(G), R = R.merge(G.append("line").attr("stroke", "currentColor").attr(h + "2", l * a)), M = M.merge(G.append("text").attr("fill", "currentColor").attr(h, l * g).attr("dy", i === os ? "0em" : i === Ti ? "0.71em" : "0.32em")), p !== S && (T = T.transition(p), C = C.transition(p), R = R.transition(p), M = M.transition(p), k = k.transition(p).attr("opacity", Ba).attr("transform", function(B) {
return isFinite(B = E(B)) ? d(B + c) : this.getAttribute("transform");
}), G.attr("opacity", Ba).attr("transform", function(B) {
var N = this.parentNode.__axis;
return d((N && isFinite(N = N(B)) ? N : E(B)) + c);
})), k.remove(), T.attr("d", i === bn || i === ls ? r ? "M" + l * r + "," + x + "H" + c + "V" + y + "H" + l * r : "M" + c + "," + x + "V" + y : r ? "M" + x + "," + l * r + "V" + c + "H" + y + "V" + l * r : "M" + x + "," + c + "H" + y), C.attr("opacity", 1).attr("transform", function(B) {
return d(E(B) + c);
}), R.attr(h + "2", l * a), M.attr(h, l * g).text(m), S.filter(Fc).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", i === ls ? "start" : i === bn ? "end" : "middle"), S.each(function() {
this.__axis = E;
});
}
return u.scale = function(p) {
return arguments.length ? (t = p, u) : t;
}, u.ticks = function() {
return e = Array.from(arguments), u;
}, u.tickArguments = function(p) {
return arguments.length ? (e = p == null ? [] : Array.from(p), u) : e.slice();
}, u.tickValues = function(p) {
return arguments.length ? (n = p == null ? null : Array.from(p), u) : n && n.slice();
}, u.tickFormat = function(p) {
return arguments.length ? (s = p, u) : s;
}, u.tickSize = function(p) {
return arguments.length ? (a = r = +p, u) : a;
}, u.tickSizeInner = function(p) {
return arguments.length ? (a = +p, u) : a;
}, u.tickSizeOuter = function(p) {
return arguments.length ? (r = +p, u) : r;
}, u.tickPadding = function(p) {
return arguments.length ? (o = +p, u) : o;
}, u.offset = function(p) {
return arguments.length ? (c = +p, u) : c;
}, u;
}
function Wc(i) {
return ws(os, i);
}
function Xc(i) {
return ws(ls, i);
}
function ji(i) {
return ws(Ti, i);
}
function xo(i) {
return ws(bn, i);
}
const bi = { capture: !0, passive: !1 };
function Oi(i) {
i.preventDefault(), i.stopImmediatePropagation();
}
function Yc(i) {
var t = i.document.documentElement, e = D(i).on("dragstart.drag", Oi, bi);
"onselectstart" in t ? e.on("selectstart.drag", Oi, bi) : (t.__noselect = t.style.MozUserSelect, t.style.MozUserSelect = "none");
}
function Zc(i, t) {
var e = i.document.documentElement, n = D(i).on("dragstart.drag", null);
t && (n.on("click.drag", Oi, bi), setTimeout(function() {
n.on("click.drag", null);
}, 0)), "onselectstart" in e ? n.on("selectstart.drag", null) : (e.style.MozUserSelect = e.__noselect, delete e.__noselect);
}
function qc(i, t) {
for (var e = new Array(t), n = 0; n < t; ++n) e[n] = i(n / (t - 1));
return e;
}
const jc = (i) => +i, Ks = (i) => () => i;
function Kc(i, {
sourceEvent: t,
target: e,
selection: n,
mode: s,
dispatch: a
}) {
Object.defineProperties(this, {
type: { value: i, enumerable: !0, configurable: !0 },
sourceEvent: { value: t, enumerable: !0, configurable: !0 },
target: { value: e, enumerable: !0, configurable: !0 },
selection: { value: n, enumerable: !0, configurable: !0 },
mode: { value: s, enumerable: !0, configurable: !0 },
_: { value: a }
});
}
function Qc(i) {
i.stopImmediatePropagation();
}
function Qs(i) {
i.preventDefault(), i.stopImmediatePropagation();
}
var Ha = { name: "drag" }, Js = { name: "space" }, Ze = { name: "handle" }, qe = { name: "center" };
const { abs: za, max: Gt, min: Vt } = Math;
function Ua(i) {
return [+i[0], +i[1]];
}
function Fa(i) {
return [Ua(i[0]), Ua(i[1])];
}
var cs = {
name: "x",
handles: ["w", "e"].map(Li),
input: function(i, t) {
return i == null ? null : [[+i[0], t[0][1]], [+i[1], t[1][1]]];
},
output: function(i) {
return i && [i[0][0], i[1][0]];
}
}, ti = {}, ye = {
overlay: "crosshair",
selection: "move",
n: "ns-resize",
e: "ew-resize",
s: "ns-resize",
w: "ew-resize",
nw: "nwse-resize",
ne: "nesw-resize",
se: "nwse-resize",
sw: "nesw-resize"
}, Wa = {
e: "w",
w: "e",
nw: "ne",
ne: "nw",
se: "sw",
sw: "se"
}, Xa = {
n: "s",
s: "n",
nw: "sw",
ne: "se",
se: "ne",
sw: "nw"
}, Jc = {
overlay: 1,
selection: 1,
n: null,
e: 1,
s: null,
w: -1,
nw: -1,
ne: 1,
se: 1,
sw: -1
}, tu = {
overlay: 1,
selection: 1,
n: -1,
e: null,
s: 1,
w: null,
nw: -1,
ne: -1,
se: 1,
sw: 1
};
function Li(i) {
return { type: i };
}
function eu(i) {
return !i.ctrlKey && !i.button;
}
function nu() {
var i = this.ownerSVGElement || this;
return i.hasAttribute("viewBox") ? (i = i.viewBox.baseVal, [[i.x, i.y], [i.x + i.width, i.y + i.height]]) : [[0, 0], [i.width.baseVal.value, i.height.baseVal.value]];
}
function su() {
return navigator.maxTouchPoints || "ontouchstart" in this;
}
function ei(i) {
for (; !i.__brush; ) if (!(i = i.parentNode)) return;
return i.__brush;
}
function iu(i) {
return i[0][0] === i[1][0] || i[0][1] === i[1][1];
}
function To() {
return au(cs);
}
function au(i) {
var t = nu, e = eu, n = su, s = !0, a = Sl("start", "brush", "end"), r = 6, o;
function c(g) {
var v = g.property("__brush", m).selectAll(".overlay").data([Li("overlay")]);
v.enter().append("rect").attr("class", "overlay").attr("pointer-events", "all").attr("cursor", ye.overlay).merge(v).each(function() {
var y = ei(this).extent;
D(this).attr("x", y[0][0]).attr("y", y[0][1]).attr("width", y[1][0] - y[0][0]).attr("height", y[1][1] - y[0][1]);
}), g.selectAll(".selection").data([Li("selection")]).enter().append("rect").attr("class", "selection").attr("cursor", ye.selection).attr("fill", "#777").attr("fill-opacity", 0.3).attr("stroke", "#fff").attr("shape-rendering", "crispEdges");
var x = g.selectAll(".handle").data(i.handles, function(y) {
return y.type;
});
x.exit().remove(), x.enter().append("rect").attr("class", function(y) {
return "handle handle--" + y.type;
}).attr("cursor", function(y) {
return ye[y.type];
}), g.each(l).attr("fill", "none").attr("pointer-events", "all").on("mousedown.brush", u).filter(n).on("touchstart.brush", u).on("touchmove.brush", p).on("touchend.brush touchcancel.brush", f).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
}
c.move = function(g, v, x) {
g.tween ? g.on("start.brush", function(y) {
h(this, arguments).beforestart().start(y);
}).on("interrupt.brush end.brush", function(y) {
h(this, arguments).end(y);
}).tween("brush", function() {
var y = this, E = y.__brush, S = h(y, arguments), T = E.selection, C = i.input(typeof v == "function" ? v.apply(this, arguments) : v, E.extent), k = Qr(T, C);
function G(R) {
E.selection = R === 1 && C === null ? null : k(R), l.call(y), S.brush();
}
return T !== null && C !== null ? G : G(1);
}) : g.each(function() {
var y = this, E = arguments, S = y.__brush, T = i.input(typeof v == "function" ? v.apply(y, E) : v, S.extent), C = h(y, E).beforestart();
ba(y), S.selection = T === null ? null : T, l.call(y), C.start(x).brush(x).end(x);
});
}, c.clear = function(g, v) {
c.move(g, null, v);
};
function l() {
var g = D(this), v = ei(this).selection;
v ? (g.selectAll(".selection").style("display", null).attr("x", v[0][0]).attr("y", v[0][1]).attr("width", v[1][0] - v[0][0]).attr("height", v[1][1] - v[0][1]), g.selectAll(".handle").style("display", null).attr("x", function(x) {
return x.type[x.type.length - 1] === "e" ? v[1][0] - r / 2 : v[0][0] - r / 2;
}).attr("y", function(x) {
return x.type[0] === "s" ? v[1][1] - r / 2 : v[0][1] - r / 2;
}).attr("width", function(x) {
return x.type === "n" || x.type === "s" ? v[1][0] - v[0][0] + r : r;
}).attr("height", function(x) {
return x.type === "e" || x.type === "w" ? v[1][1] - v[0][1] + r : r;
})) : g.selectAll(".selection,.handle").style("display", "none").attr("x", null).attr("y", null).attr("width", null).attr("height", null);
}
function h(g, v, x) {
var y = g.__brush.emitter;
return y && (!x || !y.clean) ? y : new d(g, v, x);
}
function d(g, v, x) {
this.that = g, this.args = v, this.state = g.__brush, this.active = 0, this.clean = x;
}
d.prototype = {
beforestart: function() {
return ++this.active === 1 && (this.state.emitter = this, this.starting = !0), this;
},
start: function(g, v) {
return this.starting ? (this.starting = !1, this.emit("start", g, v)) : this.emit("brush", g), this;
},
brush: function(g, v) {
return this.emit("brush", g, v), this;
},
end: function(g, v) {
return --this.active === 0 && (delete this.state.emitter, this.emit("end", g, v)), this;
},
emit: function(g, v, x) {
var y = D(this.that).datum();
a.call(
g,
this.that,
new Kc(g, {
sourceEvent: v,
target: c,
selection: i.output(this.state.selection),
mode: x,
dispatch: a
}),
y
);
}
};
function u(g) {
if (o && !g.touches || !e.apply(this, arguments)) return;
var v = this, x = g.target.__data__.type, y = (s && g.metaKey ? x = "overlay" : x) === "selection" ? Ha : s && g.altKey ? qe : Ze, E = i === ti ? null : Jc[x], S = i === cs ? null : tu[x], T = ei(v), C = T.extent, k = T.selection, G = C[0][0], R, M, B = C[0][1], N, w, L = C[1][0], P, $, _ = C[1][1], V, q, X = 0, F = 0, Z, ot = E && S && s && g.shiftKey, j, Y, K = Array.from(g.touches || [g], (at) => {
const gt = at.identifier;
return at = hn(at, v), at.point0 = at.slice(), at.identifier = gt, at;
});
ba(v);
var et = h(v, arguments, !0).beforestart();
if (x === "overlay") {
k && (Z = !0);
const at = [K[0], K[1] || K[0]];
T.selection = k = [[
R = i === ti ? G : Vt(at[0][0], at[1][0]),
N = i === cs ? B : Vt(at[0][1], at[1][1])
], [
P = i === ti ? L : Gt(at[0][0], at[1][0]),
V = i === cs ? _ : Gt(at[0][1], at[1][1])
]], K.length > 1 && H(g);
} else
R = k[0][0], N = k[0][1], P = k[1][0], V = k[1][1];
M = R, w = N, $ = P, q = V;
var ut = D(v).attr("pointer-events", "none"), nt = ut.selectAll(".overlay").attr("cursor", ye[x]);
if (g.touches)
et.moved = z, et.ended = W;
else {
var it = D(g.view).on("mousemove.brush", z, !0).on("mouseup.brush", W, !0);
s && it.on("keydown.brush", bt, !0).on("keyup.brush", Le, !0), Yc(g.view);
}
l.call(v), et.start(g, y.name);
function z(at) {
for (const gt of at.changedTouches || [at])
for (const Kt of K)
Kt.identifier === gt.identifier && (Kt.cur = hn(gt, v));
if (ot && !j && !Y && K.length === 1) {
const gt = K[0];
za(gt.cur[0] - gt[0]) > za(gt.cur[1] - gt[1]) ? Y = !0 : j = !0;
}
for (const gt of K)
gt.cur && (gt[0] = gt.cur[0], gt[1] = gt.cur[1]);
Z = !0, Qs(at), H(at);
}
function H(at) {
const gt = K[0], Kt = gt.point0;
var Bt;
switch (X = gt[0] - Kt[0], F = gt[1] - Kt[1], y) {
case Js:
case Ha: {
E && (X = Gt(G - R, Vt(L - P, X)), M = R + X, $ = P + X), S && (F = Gt(B - N, Vt(_ - V, F)), w = N + F, q = V + F);
break;
}
case Ze: {
K[1] ? (E && (M = Gt(G, Vt(L, K[0][0])), $ = Gt(G, Vt(L, K[1][0])), E = 1), S && (w = Gt(B, Vt(_, K[0][1])), q = Gt(B, Vt(_, K[1][1])), S = 1)) : (E < 0 ? (X = Gt(G - R, Vt(L - R, X)), M = R + X, $ = P) : E > 0 && (X = Gt(G - P, Vt(L - P, X)), M = R, $ = P + X), S < 0 ? (F = Gt(B - N, Vt(_ - N, F)), w = N + F, q = V) : S > 0 && (F = Gt(B - V, Vt(_ - V, F)), w = N, q = V + F));
break;
}
case qe: {
E && (M = Gt(G, Vt(L, R - X * E)), $ = Gt(G, Vt(L, P + X * E))), S && (w = Gt(B, Vt(_, N - F * S)), q = Gt(B, Vt(_, V + F * S)));
break;
}
}
$ < M && (E *= -1, Bt = R, R = P, P = Bt, Bt = M, M = $, $ = Bt, x in Wa && nt.attr("cursor", ye[x = Wa[x]])), q < w && (S *= -1, Bt = N, N = V, V = Bt, Bt = w, w = q, q = Bt, x in Xa && nt.attr("cursor", ye[x = Xa[x]])), T.selection && (k = T.selection), j && (M = k[0][0], $ = k[1][0]), Y && (w = k[0][1], q = k[1][1]), (k[0][0] !== M || k[0][1] !== w || k[1][0] !== $ || k[1][1] !== q) && (T.selection = [[M, w], [$, q]], l.call(v), et.brush(at, y.name));
}
function W(at) {
if (Qc(at), at.touches) {
if (at.touches.length) return;
o && clearTimeout(o), o = setTimeout(function() {
o = null;
}, 500);
} else
Zc(at.view, Z), it.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null);
ut.attr("pointer-events", "all"), nt.attr("cursor", ye.overlay), T.selection && (k = T.selection), iu(k) && (T.selection = null, l.call(v)), et.end(at, y.name);
}
function bt(at) {
switch (at.keyCode) {
case 16: {
ot = E && S;
break;
}
case 18: {
y === Ze && (E && (P = $ - X * E, R = M + X * E), S && (V = q - F * S, N = w + F * S), y = qe, H(at));
break;
}
case 32: {
(y === Ze || y === qe) && (E < 0 ? P = $ - X : E > 0 && (R = M - X), S < 0 ? V = q - F : S > 0 && (N = w - F), y = Js, nt.attr("cursor", ye.selection), H(at));
break;
}
default:
return;
}
Qs(at);
}
function Le(at) {
switch (at.keyCode) {
case 16: {
ot && (j = Y = ot = !1, H(at));
break;
}
case 18: {
y === qe && (E < 0 ? P = $ : E > 0 && (R = M), S < 0 ? V = q : S > 0 && (N = w), y = Ze, H(at));
break;
}
case 32: {
y === Js && (at.altKey ? (E && (P = $ - X * E, R = M + X * E), S && (V = q - F * S, N = w + F * S), y = qe) : (E < 0 ? P = $ : E > 0 && (R = M), S < 0 ? V = q : S > 0 && (N = w), y = Ze), nt.attr("cursor", ye[x]), H(at));
break;
}
default:
return;
}
Qs(at);
}
}
function p(g) {
h(this, arguments).moved(g);
}
function f(g) {
h(this, arguments).ended(g);
}
function m() {
var g = this.__brush || { selection: null };
return g.extent = Fa(t.apply(this, arguments)), g.dim = i, g;
}
return c.extent = function(g) {
return arguments.length ? (t = typeof g == "function" ? g : Ks(Fa(g)), c) : t;
}, c.filter = function(g) {
return arguments.length ? (e = typeof g == "function" ? g : Ks(!!g), c) : e;
}, c.touchable = function(g) {
return arguments.length ? (n = typeof g == "function" ? g : Ks(!!g), c) : n;
}, c.handleSize = function(g) {
return arguments.length ? (r = +g, c) : r;
}, c.keyModifiers = function(g) {
return arguments.length ? (s = !!g, c) : s;
}, c.on = function() {
var g = a.on.apply(a, arguments);
return g === a ? c : g;
}, c;
}
const Ai = Math.PI, Mi = 2 * Ai, Re = 1e-6, ru = Mi - Re;
function bo(i) {
this._ += i[0];
for (let t = 1, e = i.length; t < e; ++t)
this._ += arguments[t] + i[t];
}
function ou(i) {
let t = Math.floor(i);
if (!(t >= 0)) throw new Error(`invalid digits: ${i}`);
if (t > 15) return bo;
const e = 10 ** t;
return function(n) {
this._ += n[0];
for (let s = 1, a = n.length; s < a; ++s)
this._ += Math.round(arguments[s] * e) / e + n[s];
};
}
let Ki = class {
constructor(t) {
this._x0 = this._y0 = // start of current subpath
this._x1 = this._y1 = null, this._ = "", this._append = t == null ? bo : ou(t);
}
moveTo(t, e) {
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +e}`;
}
closePath() {
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
}
lineTo(t, e) {
this._append`L${this._x1 = +t},${this._y1 = +e}`;
}
quadraticCurveTo(t, e, n, s) {
this._append`Q${+t},${+e},${this._x1 = +n},${this._y1 = +s}`;
}
bezierCurveTo(t, e, n, s, a, r) {
this._append`C${+t},${+e},${+n},${+s},${this._x1 = +a},${this._y1 = +r}`;
}
arcTo(t, e, n, s, a) {
if (t = +t, e = +e, n = +n, s = +s, a = +a, a < 0) throw new Error(`negative radius: ${a}`);
let r = this._x1, o = this._y1, c = n - t, l = s - e, h = r - t, d = o - e, u = h * h + d * d;
if (this._x1 === null)
this._append`M${this._x1 = t},${this._y1 = e}`;
else if (u > Re) if (!(Math.abs(d * c - l * h) > Re) || !a)
this._append`L${this._x1 = t},${this._y1 = e}`;
else {
let p = n - r, f = s - o, m = c * c + l * l, g = p * p + f * f, v = Math.sqrt(m), x = Math.sqrt(u), y = a * Math.tan((Ai - Math.acos((m + u - g) / (2 * v * x))) / 2), E = y / x, S = y / v;
Math.abs(E - 1) > Re && this._append`L${t + E * h},${e + E * d}`, this._append`A${a},${a},0,0,${+(d * p > h * f)},${this._x1 = t + S * c},${this._y1 = e + S * l}`;
}
}
arc(t, e, n, s, a, r) {
if (t = +t, e = +e, n = +n, r = !!r, n < 0) throw new Error(`negative radius: ${n}`);
let o = n * Math.cos(s), c = n * Math.sin(s), l = t + o, h = e + c, d = 1 ^ r, u = r ? s - a : a - s;
this._x1 === null ? this._append`M${l},${h}` : (Math.abs(this._x1 - l) > Re || Math.abs(this._y1 - h) > Re) && this._append`L${l},${h}`, n && (u < 0 && (u = u % Mi + Mi), u > ru ? this._append`A${n},${n},0,1,${d},${t - o},${e - c}A${n},${n},0,1,${d},${this._x1 = l},${this._y1 = h}` : u > Re && this._append`A${n},${n},0,${+(u >= Ai)},${d},${this._x1 = t + n * Math.cos(a)},${this._y1 = e + n * Math.sin(a)}`);
}
rect(t, e, n, s) {
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +e}h${n = +n}v${+s}h${-n}Z`;
}
toString() {
return this._;
}
};
function Cs() {
return new Ki();
}
Cs.prototype = Ki.prototype;
var mt = 1e-6, Oo = 1e-12, ht = Math.PI, Zt = ht / 2, Ya = ht / 4, jt = ht * 2, zt = 180 / ht, At = ht / 180, vt = Math.abs, Lo = Math.atan, Ge = Math.atan2, yt = Math.cos, lu = Math.exp, cu = Math.log, ft = Math.sin, Me = Math.sign || function(i) {
return i > 0 ? 1 : i < 0 ? -1 : 0;
}, ce = Math.sqrt, uu = Math.tan;
function hu(i) {
return i > 1 ? 0 : i < -1 ? ht : Math.acos(i);
}
function Oe(i) {
return i > 1 ? Zt : i < -1 ? -Zt : Math.asin(i);
}
function se() {
}
function fs(i, t) {
i && qa.hasOwnProperty(i.type) && qa[i.type](i, t);
}
var Za = {
Feature: function(i, t) {
fs(i.geometry, t);
},
FeatureCollection: function(i, t) {
for (var e = i.features, n = -1, s = e.length; ++n < s; ) fs(e[n].geometry, t);
}
}, qa = {
Sphere: function(i, t) {
t.sphere();
},
Point: function(i, t) {
i = i.coordinates, t.point(i[0], i[1], i[2]);
},
MultiPoint: function(i, t) {
for (var e = i.coordinates, n = -1, s = e.length; ++n < s; ) i = e[n], t.point(i[0], i[1], i[2]);
},
LineString: function(i, t) {
wi(i.coordinates, t, 0);
},
MultiLineString: function(i, t) {
for (var e = i.coordinates, n = -1, s = e.length; ++n < s; ) wi(e[n], t, 0);
},
Polygon: function(i, t) {
ja(i.coordinates, t);
},
MultiPolygon: function(i, t) {
for (var e = i.coordinates, n = -1, s = e.length; ++n < s; ) ja(e[n], t);
},
GeometryCollection: function(i, t) {
for (var e = i.geometries, n = -1, s = e.length; ++n < s; ) fs(e[n], t);
}
};
function wi(i, t, e) {
var n = -1, s = i.length - e, a;
for (t.lineStart(); ++n < s; ) a = i[n], t.point(a[0], a[1], a[2]);
t.lineEnd();
}
function ja(i, t) {
var e = -1, n = i.length;
for (t.polygonStart(); ++e < n; ) wi(i[e], t, 1);
t.polygonEnd();
}
function tn(i, t) {
i && Za.hasOwnProperty(i.type) ? Za[i.type](i, t) : fs(i, t);
}
function Ci(i) {
return [Ge(i[1], i[0]), Oe(i[2])];
}
function dn(i) {
var t = i[0], e = i[1], n = yt(e);
return [n * yt(t), n * ft(t), ft(e)];
}
function Zn(i, t) {
return i[0] * t[0] + i[1] * t[1] + i[2] * t[2];
}
function gs(i, t) {
return [i[1] * t[2] - i[2] * t[1], i[2] * t[0] - i[0] * t[2], i[0] * t[1] - i[1] * t[0]];
}
function ni(i, t) {
i[0] += t[0], i[1] += t[1], i[2] += t[2];
}
function qn(i, t) {
return [i[0] * t, i[1] * t, i[2] * t];
}
function _i(i) {
var t = ce(i[0] * i[0] + i[1] * i[1] + i[2] * i[2]);
i[0] /= t, i[1] /= t, i[2] /= t;
}
function ki(i, t) {
function e(n, s) {
return n = i(n, s), t(n[0], n[1]);
}
return i.invert && t.invert && (e.invert = function(n, s) {
return n = t.invert(n, s), n && i.invert(n[0], n[1]);
}), e;
}
function Ii(i, t) {
return vt(i) > ht && (i -= Math.round(i / jt) * jt), [i, t];
}
Ii.invert = Ii;
function Ao(i, t, e) {
return (i %= jt) ? t || e ? ki(Qa(i), Ja(t, e)) : Qa(i) : t || e ? Ja(t, e) : Ii;
}
function Ka(i) {
return function(t, e) {
return t += i, vt(t) > ht && (t -= Math.round(t / jt) * jt), [t, e];
};
}
function Qa(i) {
var t = Ka(i);
return t.invert = Ka(-i), t;
}
function Ja(i, t) {
var e = yt(i), n = ft(i), s = yt(t), a = ft(t);
function r(o, c) {
var l = yt(c), h = yt(o) * l, d = ft(o) * l, u = ft(c), p = u * e + h * n;
return [
Ge(d * s - p * a, h * e - u * n),
Oe(p * s + d * a)
];
}
return r.invert = function(o, c) {
var l = yt(c), h = yt(o) * l, d = ft(o) * l, u = ft(c), p = u * s - d * a;
return [
Ge(d * s + u * a, h * e + p * n),
Oe(p * e - h * n)
];
}, r;
}
function du(i) {
i = Ao(i[0] * At, i[1] * At, i.length > 2 ? i[2] * At : 0);
function t(e) {
return e = i(e[0] * At, e[1] * At), e[0] *= zt, e[1] *= zt, e;
}
return t.invert = function(e) {
return e = i.invert(e[0] * At, e[1] * At), e[0] *= zt, e[1] *= zt, e;
}, t;
}
function pu(i, t, e, n, s, a) {
if (e) {
var r = yt(t), o = ft(t), c = n * e;
s == null ? (s = t + n * jt, a = t - c / 2) : (s = tr(r, s), a = tr(r, a), (n > 0 ? s < a : s > a) && (s += n * jt));
for (var l, h = s; n > 0 ? h > a : h < a; h -= c)
l = Ci([r, -o * yt(h), -o * ft(h)]), i.point(l[0], l[1]);
}
}
function tr(i, t) {
t = dn(t), t[0] -= i, _i(t);
var e = hu(-t[1]);
return ((-t[2] < 0 ? -e : e) + jt - mt) % jt;
}
function Mo() {
var i = [], t;
return {
point: function(e, n, s) {
t.push([e, n, s]);
},
lineStart: function() {
i.push(t = []);
},
lineEnd: se,
rejoin: function() {
i.length > 1 && i.push(i.pop().concat(i.shift()));
},
result: function() {
var e = i;
return i = [], t = null, e;
}
};
}
function us(i, t) {
return vt(i[0] - t[0]) < mt && vt(i[1] - t[1]) < mt;
}
function jn(i, t, e, n) {
this.x = i, this.z = t, this.o = e, this.e = n, this.v = !1, this.n = this.p = null;
}
function wo(i, t, e, n, s) {
var a = [], r = [], o, c;
if (i.forEach(function(f) {
if (!((m = f.length - 1) <= 0)) {
var m, g = f[0], v = f[m], x;
if (us(g, v)) {
if (!g[2] && !v[2]) {
for (s.lineStart(), o = 0; o < m; ++o) s.point((g = f[o])[0], g[1]);
s.lineEnd();
return;
}
v[0] += 2 * mt;
}
a.push(x = new jn(g, f, null, !0)), r.push(x.o = new jn(g, null, x, !1)), a.push(x = new jn(v, f, null, !1)), r.push(x.o = new jn(v, null, x, !0));
}
}), !!a.length) {
for (r.sort(t), er(a), er(r), o = 0, c = r.length; o < c; ++o)
r[o].e = e = !e;
for (var l = a[0], h, d; ; ) {
for (var u = l, p = !0; u.v; ) if ((u = u.n) === l) return;
h = u.z, s.lineStart();
do {
if (u.v = u.o.v = !0, u.e) {
if (p)
for (o = 0, c = h.length; o < c; ++o) s.point((d = h[o])[0], d[1]);
else
n(u.x, u.n.x, 1, s);
u = u.n;
} else {
if (p)
for (h = u.p.z, o = h.length - 1; o >= 0; --o) s.point((d = h[o])[0], d[1]);
else
n(u.x, u.p.x, -1, s);
u = u.p;
}
u = u.o, h = u.z, p = !p;
} while (!u.v);
s.lineEnd();
}
}
}
function er(i) {
if (t = i.length) {
for (var t, e = 0, n = i[0], s; ++e < t; )
n.n = s = i[e], s.p = n, n = s;
n.n = s = i[0], s.p = n;
}
}
function si(i) {
return vt(i[0]) <= ht ? i[0] : Me(i[0]) * ((vt(i[0]) + ht) % jt - ht);
}
function fu(i, t) {
var e = si(t), n = t[1], s = ft(n), a = [ft(e), -yt(e), 0], r = 0, o = 0, c = new $e();
s === 1 ? n = Zt + mt : s === -1 && (n = -Zt - mt);
for (var l = 0, h = i.length; l < h; ++l)
if (u = (d = i[l]).length)
for (var d, u, p = d[u - 1], f = si(p), m = p[1] / 2 + Ya, g = ft(m), v = yt(m), x = 0; x < u; ++x, f = E, g = T, v = C, p = y) {
var y = d[x], E = si(y), S = y[1] / 2 + Ya, T = ft(S), C = yt(S), k = E - f, G = k >= 0 ? 1 : -1, R = G * k, M = R > ht, B = g * T;
if (c.add(Ge(B * G * ft(R), v * C + B * yt(R))), r += M ? k + G * jt : k, M ^ f >= e ^ E >= e) {
var N = gs(dn(p), dn(y));
_i(N);
var w = gs(a, N);
_i(w);
var L = (M ^ k >= 0 ? -1 : 1) * Oe(w[2]);
(n > L || n === L && (N[0] || N[1])) && (o += M ^ k >= 0 ? 1 : -1);
}
}
return (r < -mt || r < mt && c < -Oo) ^ o & 1;
}
function Co(i, t, e, n) {
return function(s) {
var a = t(s), r = Mo(), o = t(r), c = !1, l, h, d, u = {
point: p,
lineStart: m,
lineEnd: g,
polygonStart: function() {
u.point = v, u.lineStart = x, u.lineEnd = y, h = [], l = [];
},
polygonEnd: function() {
u.point = p, u.lineStart = m, u.lineEnd = g, h = So(h);
var E = fu(l, n);
h.length ? (c || (s.polygonStart(), c = !0), wo(h, mu, E, e, s)) : E && (c || (s.polygonStart(), c = !0), s.lineStart(), e(null, null, 1, s), s.lineEnd()), c && (s.polygonEnd(), c = !1), h = l = null;
},
sphere: function() {
s.polygonStart(), s.lineStart(), e(null, null, 1, s), s.lineEnd(), s.polygonEnd();
}
};
function p(E, S) {
i(E, S) && s.point(E, S);
}
function f(E, S) {
a.point(E, S);
}
function m() {
u.point = f, a.lineStart();
}
function g() {
u.point = p, a.lineEnd();
}
function v(E, S) {
d.push([E, S]), o.point(E, S);
}
function x() {
o.lineStart(), d = [];
}
function y() {
v(d[0][0], d[0][1]), o.lineEnd();
var E = o.clean(), S = r.result(), T, C = S.length, k, G, R;
if (d.pop(), l.push(d), d = null, !!C) {
if (E & 1) {
if (G = S[0], (k = G.length - 1) > 0) {
for (c || (s.polygonStart(), c = !0), s.lineStart(), T = 0; T < k; ++T) s.point((R = G[T])[0], R[1]);
s.lineEnd();
}
return;
}
C > 1 && E & 2 && S.push(S.pop().concat(S.shift())), h.push(S.filter(gu));
}
}
return u;
};
}
function gu(i) {
return i.length > 1;
}
function mu(i, t) {
return ((i = i.x)[0] < 0 ? i[1] - Zt - mt : Zt - i[1]) - ((t = t.x)[0] < 0 ? t[1] - Zt - mt : Zt - t[1]);
}
const nr = Co(
function() {
return !0;
},
vu,
Eu,
[-ht, -Zt]
);
function vu(i) {
var t = NaN, e = NaN, n = NaN, s;
return {
lineStart: function() {
i.lineStart(), s = 1;
},
point: function(a, r) {
var o = a > 0 ? ht : -ht, c = vt(a - t);
vt(c - ht) < mt ? (i.point(t, e = (e + r) / 2 > 0 ? Zt : -Zt), i.point(n, e), i.lineEnd(), i.lineStart(), i.point(o, e), i.point(a, e), s = 0) : n !== o && c >= ht && (vt(t - n) < mt && (t -= n * mt), vt(a - o) < mt && (a -= o * mt), e = yu(t, e, a, r), i.point(n, e), i.lineEnd(), i.lineStart(), i.point(o, e), s = 0), i.point(t = a, e = r), n = o;
},
lineEnd: function() {
i.lineEnd(), t = e = NaN;
},
clean: function() {
return 2 - s;
}
};
}
function yu(i, t, e, n) {
var s, a, r = ft(i - e);
return vt(r) > mt ? Lo((ft(t) * (a = yt(n)) * ft(e) - ft(n) * (s = yt(t)) * ft(i)) / (s * a * r)) : (t + n) / 2;
}
function Eu(i, t, e, n) {
var s;
if (i == null)
s = e * Zt, n.point(-ht, s), n.point(0, s), n.point(ht, s), n.point(ht, 0), n.point(ht, -s), n.point(0, -s), n.point(-ht, -s), n.point(-ht, 0), n.point(-ht, s);
else if (vt(i[0] - t[0]) > mt) {
var a = i[0] < t[0] ? ht : -ht;
s = e * a / 2, n.point(-a, s), n.point(0, s), n.point(a, s);
} else
n.point(t[0], t[1]);
}
function Su(i) {
var t = yt(i), e = 2 * At, n = t > 0, s = vt(t) > mt;
function a(h, d, u, p) {
pu(p, i, e, u, h, d);
}
function r(h, d) {
return yt(h) * yt(d) > t;
}
function o(h) {
var d, u, p, f, m;
return {
lineStart: function() {
f = p = !1, m = 1;
},
point: function(g, v) {
var x = [g, v], y, E = r(g, v), S = n ? E ? 0 : l(g, v) : E ? l(g + (g < 0 ? ht : -ht), v) : 0;
if (!d && (f = p = E) && h.lineStart(), E !== p && (y = c(d, x), (!y || us(d, y) || us(x, y)) && (x[2] = 1)), E !== p)
m = 0, E ? (h.lineStart(), y = c(x, d), h.point(y[0], y[1])) : (y = c(d, x), h.point(y[0], y[1], 2), h.lineEnd()), d = y;
else if (s && d && n ^ E) {
var T;
!(S & u) && (T = c(x, d, !0)) && (m = 0, n ? (h.lineStart(), h.point(T[0][0], T[0][1]), h.point(T[1][0], T[1][1]), h.lineEnd()) : (h.point(T[1][0], T[1][1]), h.lineEnd(), h.lineStart(), h.point(T[0][0], T[0][1], 3)));
}
E && (!d || !us(d, x)) && h.point(x[0], x[1]), d = x, p = E, u = S;
},
lineEnd: function() {
p && h.lineEnd(), d = null;
},
// Rejoin first and last segments if there were intersections and the first
// and last points were visible.
clean: function() {
return m | (f && p) << 1;
}
};
}
function c(h, d, u) {
var p = dn(h), f = dn(d), m = [1, 0, 0], g = gs(p, f), v = Zn(g, g), x = g[0], y = v - x * x;
if (!y) return !u && h;
var E = t * v / y, S = -t * x / y, T = gs(m, g), C = qn(m, E), k = qn(g, S);
ni(C, k);
var G = T, R = Zn(C, G), M = Zn(G, G), B = R * R - M * (Zn(C, C) - 1);
if (!(B < 0)) {
var N = ce(B), w = qn(G, (-R - N) / M);
if (ni(w, C), w = Ci(w), !u) return w;
var L = h[0], P = d[0], $ = h[1], _ = d[1], V;
P < L && (V = L, L = P, P = V);
var q = P - L, X = vt(q - ht) < mt, F = X || q < mt;
if (!X && _ < $ && (V = $, $ = _, _ = V), F ? X ? $ + _ > 0 ^ w[1] < (vt(w[0] - L) < mt ? $ : _) : $ <= w[1] && w[1] <= _ : q > ht ^ (L <= w[0] && w[0] <= P)) {
var Z = qn(G, (-R + N) / M);
return ni(Z, C), [w, Ci(Z)];
}
}
}
function l(h, d) {
var u = n ? i : ht - i, p = 0;
return h < -u ? p |= 1 : h > u && (p |= 2), d < -u ? p |= 4 : d > u && (p |= 8), p;
}
return Co(r, o, a, n ? [0, -i] : [-ht, i - ht]);
}
function xu(i, t, e, n, s, a) {
var r = i[0], o = i[1], c = t[0], l = t[1], h = 0, d = 1, u = c - r, p = l - o, f;
if (f = e - r, !(!u && f > 0)) {
if (f /= u, u < 0) {
if (f < h) return;
f < d && (d = f);
} else if (u > 0) {
if (f > d) return;
f > h && (h = f);
}
if (f = s - r, !(!u && f < 0)) {
if (f /= u, u < 0) {
if (f > d) return;
f > h && (h = f);
} else if (u > 0) {
if (f < h) return;
f < d && (d = f);
}
if (f = n - o, !(!p && f > 0)) {
if (f /= p, p < 0) {
if (f < h) return;
f < d && (d = f);
} else if (p > 0) {
if (f > d) return;
f > h && (h = f);
}
if (f = a - o, !(!p && f < 0)) {
if (f /= p, p < 0) {
if (f > d) return;
f > h && (h = f);
} else if (p > 0) {
if (f < h) return;
f < d && (d = f);
}
return h > 0 && (i[0] = r + h * u, i[1] = o + h * p), d < 1 && (t[0] = r + d * u, t[1] = o + d * p), !0;
}
}
}
}
}
var On = 1e9, Kn = -On;
function Tu(i, t, e, n) {
function s(l, h) {
return i <= l && l <= e && t <= h && h <= n;
}
function a(l, h, d, u) {
var p = 0, f = 0;
if (l == null || (p = r(l, d)) !== (f = r(h, d)) || c(l, h) < 0 ^ d > 0)
do
u.point(p === 0 || p === 3 ? i : e, p > 1 ? n : t);
while ((p = (p + d + 4) % 4) !== f);
else
u.point(h[0], h[1]);
}
function r(l, h) {
return vt(l[0] - i) < mt ? h > 0 ? 0 : 3 : vt(l[0] - e) < mt ? h > 0 ? 2 : 1 : vt(l[1] - t) < mt ? h > 0 ? 1 : 0 : h > 0 ? 3 : 2;
}
function o(l, h) {
return c(l.x, h.x);
}
function c(l, h) {
var d = r(l, 1), u = r(h, 1);
return d !== u ? d - u : d === 0 ? h[1] - l[1] : d === 1 ? l[0] - h[0] : d === 2 ? l[1] - h[1] : h[0] - l[0];
}
return function(l) {
var h = l, d = Mo(), u, p, f, m, g, v, x, y, E, S, T, C = {
point: k,
lineStart: B,
lineEnd: N,
polygonStart: R,
polygonEnd: M
};
function k(L, P) {
s(L, P) && h.point(L, P);
}
function G() {
for (var L = 0, P = 0, $ = p.length; P < $; ++P)
for (var _ = p[P], V = 1, q = _.length, X = _[0], F, Z, ot = X[0], j = X[1]; V < q; ++V)
F = ot, Z = j, X = _[V], ot = X[0], j = X[1], Z <= n ? j > n && (ot - F) * (n - Z) > (j - Z) * (i - F) && ++L : j <= n && (ot - F) * (n - Z) < (j - Z) * (i - F) && --L;
return L;
}
function R() {
h = d, u = [], p = [], T = !0;
}
function M() {
var L = G(), P = T && L, $ = (u = So(u)).length;
(P || $) && (l.polygonStart(), P && (l.lineStart(), a(null, null, 1, l), l.lineEnd()), $ && wo(u, o, L, a, l), l.polygonEnd()), h = l, u = p = f = null;
}
function B() {
C.point = w, p && p.push(f = []), S = !0, E = !1, x = y = NaN;
}
function N() {
u && (w(m, g), v && E && d.rejoin(), u.push(d.result())), C.point = k, E && h.lineEnd();
}
function w(L, P) {
var $ = s(L, P);
if (p && f.push([L, P]), S)
m = L, g = P, v = $, S = !1, $ && (h.lineStart(), h.point(L, P));
else if ($ && E) h.point(L, P);
else {
var _ = [x = Math.max(Kn, Math.min(On, x)), y = Math.max(Kn, Math.min(On, y))], V = [L = Math.max(Kn, Math.min(On, L)), P = Math.max(Kn, Math.min(On, P))];
xu(_, V, i, t, e, n) ? (E || (h.lineStart(), h.point(_[0], _[1])), h.point(V[0], V[1]), $ || h.lineEnd(), T = !1) : $ && (h.lineStart(), h.point(L, P), T = !1);
}
x = L, y = P, E = $;
}
return C;
};
}
const Ri = (i) => i;
var ii = new $e(), Di = new $e(), _o, ko, Ni, Pi, Te = {
point: se,
lineStart: se,
lineEnd: se,
polygonStart: function() {
Te.lineStart = bu, Te.lineEnd = Lu;
},
polygonEnd: function() {
Te.lineStart = Te.lineEnd = Te.point = se, ii.add(vt(Di)), Di = new $e();
},
result: function() {
var i = ii / 2;
return ii = new $e(), i;
}
};
function bu() {
Te.point = Ou;
}
function Ou(i, t) {
Te.point = Io, _o = Ni = i, ko = Pi = t;
}
function Io(i, t) {
Di.add(Pi * i - Ni * t), Ni = i, Pi = t;
}
function Lu() {
Io(_o, ko);
}
var pn = 1 / 0, ms = pn, Pn = -pn, vs = Pn, ys = {
point: Au,
lineStart: se,
lineEnd: se,
polygonStart: se,
polygonEnd: se,
result: function() {
var i = [[pn, ms], [Pn, vs]];
return Pn = vs = -(ms = pn = 1 / 0), i;
}
};
function Au(i, t) {
i < pn && (pn = i), i > Pn && (Pn = i), t < ms && (ms = t), t > vs && (vs = t);
}
var $i = 0, Gi = 0, Ln = 0, Es = 0, Ss = 0, ln = 0, Vi = 0, Bi = 0, An = 0, Ro, Do, pe, fe, ne = {
point: Ve,
lineStart: sr,
lineEnd: ir,
polygonStart: function() {
ne.lineStart = Cu, ne.lineEnd = _u;
},
polygonEnd: function() {
ne.point = Ve, ne.lineStart = sr, ne.lineEnd = ir;
},
result: function() {
var i = An ? [Vi / An, Bi / An] : ln ? [Es / ln, Ss / ln] : Ln ? [$i / Ln, Gi / Ln] : [NaN, NaN];
return $i = Gi = Ln = Es = Ss = ln = Vi = Bi = An = 0, i;
}
};
function Ve(i, t) {
$i += i, Gi += t, ++Ln;
}
function sr() {
ne.point = Mu;
}
function Mu(i, t) {
ne.point = wu, Ve(pe = i, fe = t);
}
function wu(i, t) {
var e = i - pe, n = t - fe, s = ce(e * e + n * n);
Es += s * (pe + i) / 2, Ss += s * (fe + t) / 2, ln += s, Ve(pe = i, fe = t);
}
function ir() {
ne.point = Ve;
}
function Cu() {
ne.point = ku;
}
function _u() {
No(Ro, Do);
}
function ku(i, t) {
ne.point = No, Ve(Ro = pe = i, Do = fe = t);
}
function No(i, t) {
var e = i - pe, n = t - fe, s = ce(e * e + n * n);
Es += s * (pe + i) / 2, Ss += s * (fe + t) / 2, ln += s, s = fe * i - pe * t, Vi += s * (pe + i), Bi += s * (fe + t), An += s * 3, Ve(pe = i, fe = t);
}
function Po(i) {
this._context = i;
}
Po.prototype = {
_radius: 4.5,
pointRadius: function(i) {
return this._radius = i, this;
},
polygonStart: function() {
this._line = 0;
},
polygonEnd: function() {
this._line = NaN;
},
lineStart: function() {
this._point = 0;
},
lineEnd: function() {
this._line === 0 && this._context.closePath(), this._point = NaN;
},
point: function(i, t) {
switch (this._point) {
case 0: {
this._context.moveTo(i, t), this._point = 1;
break;
}
case 1: {
this._context.lineTo(i, t);
break;
}
default: {
this._context.moveTo(i + this._radius, t), this._context.arc(i, t, this._radius, 0, jt);
break;
}
}
},
result: se
};
var Hi = new $e(), ai, $o, Go, Mn, wn, $n = {
point: se,
lineStart: function() {
$n.point = Iu;
},
lineEnd: function() {
ai && Vo($o, Go), $n.point = se;
},
polygonStart: function() {
ai = !0;
},
polygonEnd: function() {
ai = null;
},
result: function() {
var i = +Hi;
return Hi = new $e(), i;
}
};
function Iu(i, t) {
$n.point = Vo, $o = Mn = i, Go = wn = t;
}
function Vo(i, t) {
Mn -= i, wn -= t, Hi.add(ce(Mn * Mn + wn * wn)), Mn = i, wn = t;
}
let ar, xs, rr, or;
class lr {
constructor(t) {
this._append = t == null ? Bo : Ru(t), this._radius = 4.5, this._ = "";
}
pointRadius(t) {
return this._radius = +t, this;
}
polygonStart() {
this._line = 0;
}
polygonEnd() {
this._line = NaN;
}
lineStart() {
this._point = 0;
}
lineEnd() {
this._line === 0 && (this._ += "Z"), this._point = NaN;
}
point(t, e) {
switch (this._point) {
case 0: {
this._append`M${t},${e}`, this._point = 1;
break;
}
case 1: {
this._append`L${t},${e}`;
break;
}
default: {
if (this._append`M${t},${e}`, this._radius !== rr || this._append !== xs) {
const n = this._radius, s = this._;
this._ = "", this._append`m0,${n}a${n},${n} 0 1,1 0,${-2 * n}a${n},${n} 0 1,1 0,${2 * n}z`, rr = n, xs = this._append, or = this._, this._ = s;
}
this._ += or;
break;
}
}
}
result() {
const t = this._;
return this._ = "", t.length ? t : null;
}
}
function Bo(i) {
let t = 1;
this._ += i[0];
for (const e = i.length; t < e; ++t)
this._ += arguments[t] + i[t];
}
function Ru(i) {
const t = Math.floor(i);
if (!(t >= 0)) throw new RangeError(`invalid digits: ${i}`);
if (t > 15) return Bo;
if (t !== ar) {
const e = 10 ** t;
ar = t, xs = function(s) {
let a = 1;
this._ += s[0];
for (const r = s.length; a < r; ++a)
this._ += Math.round(arguments[a] * e) / e + s[a];
};
}
return xs;
}
function Du(i, t) {
let e = 3, n = 4.5, s, a;
function r(o) {
return o && (typeof n == "function" && a.pointRadius(+n.apply(this, arguments)), tn(o, s(a))), a.result();
}
return r.area = function(o) {
return tn(o, s(Te)), Te.result();
}, r.measure = function(o) {
return tn(o, s($n)), $n.result();
}, r.bounds = function(o) {
return tn(o, s(ys)), ys.result();
}, r.centroid = function(o) {
return tn(o, s(ne)), ne.result();
}, r.projection = function(o) {
return arguments.length ? (s = o == null ? (i = null, Ri) : (i = o).stream, r) : i;
}, r.context = function(o) {
return arguments.length ? (a = o == null ? (t = null, new lr(e)) : new Po(t = o), typeof n != "function" && a.pointRadius(n), r) : t;
}, r.pointRadius = function(o) {
return arguments.length ? (n = typeof o == "function" ? o : (a.pointRadius(+o), +o), r) : n;
}, r.digits = function(o) {
if (!arguments.length) return e;
if (o == null) e = null;
else {
const c = Math.floor(o);
if (!(c >= 0)) throw new RangeError(`invalid digits: ${o}`);
e = c;
}
return t === null && (a = new lr(e)), r;
}, r.projection(i).digits(e).context(t);
}
function Qi(i) {
return function(t) {
var e = new zi();
for (var n in i) e[n] = i[n];
return e.stream = t, e;
};
}
function zi() {
}
zi.prototype = {
constructor: zi,
point: function(i, t) {
this.stream.point(i, t);
},
sphere: function() {
this.stream.sphere();
},
lineStart: function()