genomefeatures
Version:
A D3 based genome feature rendering
1,611 lines • 340 kB
JavaScript
function mn(t, e) {
return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function fo(t, e) {
return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function Oa(t) {
let e, n, i;
t.length !== 2 ? (e = mn, n = (o, f) => mn(t(o), f), i = (o, f) => t(o) - f) : (e = t === mn || t === fo ? t : co, n = t, i = t);
function r(o, f, c = 0, u = o.length) {
if (c < u) {
if (e(f, f) !== 0) return u;
do {
const m = c + u >>> 1;
n(o[m], f) < 0 ? c = m + 1 : u = m;
} while (c < u);
}
return c;
}
function a(o, f, c = 0, u = o.length) {
if (c < u) {
if (e(f, f) !== 0) return u;
do {
const m = c + u >>> 1;
n(o[m], f) <= 0 ? c = m + 1 : u = m;
} while (c < u);
}
return c;
}
function s(o, f, c = 0, u = o.length) {
const m = r(o, f, c, u - 1);
return m > c && i(o[m - 1], f) > -i(o[m], f) ? m - 1 : m;
}
return { left: r, center: s, right: a };
}
function co() {
return 0;
}
function uo(t) {
return t === null ? NaN : +t;
}
const ho = Oa(mn), po = ho.right;
Oa(uo).center;
const _o = Math.sqrt(50), go = Math.sqrt(10), mo = Math.sqrt(2);
function Tn(t, e, n) {
const i = (e - t) / Math.max(0, n), r = Math.floor(Math.log10(i)), a = i / Math.pow(10, r), s = a >= _o ? 10 : a >= go ? 5 : a >= mo ? 2 : 1;
let o, f, c;
return r < 0 ? (c = Math.pow(10, -r) / s, o = Math.round(t * c), f = Math.round(e * c), o / c < t && ++o, f / c > e && --f, c = -c) : (c = Math.pow(10, r) * s, o = Math.round(t / c), f = Math.round(e / c), o * c < t && ++o, f * c > e && --f), f < o && 0.5 <= n && n < 2 ? Tn(t, e, n * 2) : [o, f, c];
}
function vo(t, e, n) {
if (e = +e, t = +t, n = +n, !(n > 0)) return [];
if (t === e) return [t];
const i = e < t, [r, a, s] = i ? Tn(e, t, n) : Tn(t, e, n);
if (!(a >= r)) return [];
const o = a - r + 1, f = new Array(o);
if (i)
if (s < 0) for (let c = 0; c < o; ++c) f[c] = (a - c) / -s;
else for (let c = 0; c < o; ++c) f[c] = (a - c) * s;
else if (s < 0) for (let c = 0; c < o; ++c) f[c] = (r + c) / -s;
else for (let c = 0; c < o; ++c) f[c] = (r + c) * s;
return f;
}
function gi(t, e, n) {
return e = +e, t = +t, n = +n, Tn(t, e, n)[2];
}
function wo(t, e, n) {
e = +e, t = +t, n = +n;
const i = e < t, r = i ? gi(e, t, n) : gi(t, e, n);
return (i ? -1 : 1) * (r < 0 ? 1 / -r : r);
}
function yo(t) {
return t;
}
var vn = 1, Gn = 2, mi = 3, rn = 4, ar = 1e-6;
function xo(t) {
return "translate(" + t + ",0)";
}
function bo(t) {
return "translate(0," + t + ")";
}
function ko(t) {
return (e) => +t(e);
}
function To(t, e) {
return e = Math.max(0, t.bandwidth() - e * 2) / 2, t.round() && (e = Math.round(e)), (n) => +t(n) + e;
}
function Eo() {
return !this.__axis;
}
function La(t, e) {
var n = [], i = null, r = null, a = 6, s = 6, o = 3, f = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, c = t === vn || t === rn ? -1 : 1, u = t === rn || t === Gn ? "x" : "y", m = t === vn || t === mi ? xo : bo;
function p(_) {
var T = i ?? (e.ticks ? e.ticks.apply(e, n) : e.domain()), z = r ?? (e.tickFormat ? e.tickFormat.apply(e, n) : yo), N = Math.max(a, 0) + o, A = e.range(), k = +A[0] + f, b = +A[A.length - 1] + f, y = (e.bandwidth ? To : ko)(e.copy(), f), S = _.selection ? _.selection() : _, $ = S.selectAll(".domain").data([null]), E = S.selectAll(".tick").data(T, e).order(), F = E.exit(), L = E.enter().append("g").attr("class", "tick"), B = E.select("line"), x = E.select("text");
$ = $.merge($.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), E = E.merge(L), B = B.merge(L.append("line").attr("stroke", "currentColor").attr(u + "2", c * a)), x = x.merge(L.append("text").attr("fill", "currentColor").attr(u, c * N).attr("dy", t === vn ? "0em" : t === mi ? "0.71em" : "0.32em")), _ !== S && ($ = $.transition(_), E = E.transition(_), B = B.transition(_), x = x.transition(_), F = F.transition(_).attr("opacity", ar).attr("transform", function(U) {
return isFinite(U = y(U)) ? m(U + f) : this.getAttribute("transform");
}), L.attr("opacity", ar).attr("transform", function(U) {
var H = this.parentNode.__axis;
return m((H && isFinite(H = H(U)) ? H : y(U)) + f);
})), F.remove(), $.attr("d", t === rn || t === Gn ? s ? "M" + c * s + "," + k + "H" + f + "V" + b + "H" + c * s : "M" + f + "," + k + "V" + b : s ? "M" + k + "," + c * s + "V" + f + "H" + b + "V" + c * s : "M" + k + "," + f + "H" + b), E.attr("opacity", 1).attr("transform", function(U) {
return m(y(U) + f);
}), B.attr(u + "2", c * a), x.attr(u, c * N).text(z), S.filter(Eo).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === Gn ? "start" : t === rn ? "end" : "middle"), S.each(function() {
this.__axis = y;
});
}
return p.scale = function(_) {
return arguments.length ? (e = _, p) : e;
}, p.ticks = function() {
return n = Array.from(arguments), p;
}, p.tickArguments = function(_) {
return arguments.length ? (n = _ == null ? [] : Array.from(_), p) : n.slice();
}, p.tickValues = function(_) {
return arguments.length ? (i = _ == null ? null : Array.from(_), p) : i && i.slice();
}, p.tickFormat = function(_) {
return arguments.length ? (r = _, p) : r;
}, p.tickSize = function(_) {
return arguments.length ? (a = s = +_, p) : a;
}, p.tickSizeInner = function(_) {
return arguments.length ? (a = +_, p) : a;
}, p.tickSizeOuter = function(_) {
return arguments.length ? (s = +_, p) : s;
}, p.tickPadding = function(_) {
return arguments.length ? (o = +_, p) : o;
}, p.offset = function(_) {
return arguments.length ? (f = +_, p) : f;
}, p;
}
function sr(t) {
return La(vn, t);
}
function So(t) {
return La(mi, t);
}
var Ao = { value: () => {
} };
function Ca() {
for (var t = 0, e = arguments.length, n = {}, i; t < e; ++t) {
if (!(i = arguments[t] + "") || i in n || /[\s.]/.test(i)) throw new Error("illegal type: " + i);
n[i] = [];
}
return new wn(n);
}
function wn(t) {
this._ = t;
}
function $o(t, e) {
return t.trim().split(/^|\s+/).map(function(n) {
var i = "", r = n.indexOf(".");
if (r >= 0 && (i = n.slice(r + 1), n = n.slice(0, r)), n && !e.hasOwnProperty(n)) throw new Error("unknown type: " + n);
return { type: n, name: i };
});
}
wn.prototype = Ca.prototype = {
constructor: wn,
on: function(t, e) {
var n = this._, i = $o(t + "", n), r, a = -1, s = i.length;
if (arguments.length < 2) {
for (; ++a < s; ) if ((r = (t = i[a]).type) && (r = No(n[r], t.name))) return r;
return;
}
if (e != null && typeof e != "function") throw new Error("invalid callback: " + e);
for (; ++a < s; )
if (r = (t = i[a]).type) n[r] = or(n[r], t.name, e);
else if (e == null) for (r in n) n[r] = or(n[r], t.name, null);
return this;
},
copy: function() {
var t = {}, e = this._;
for (var n in e) t[n] = e[n].slice();
return new wn(t);
},
call: function(t, e) {
if ((r = arguments.length - 2) > 0) for (var n = new Array(r), i = 0, r, a; i < r; ++i) n[i] = arguments[i + 2];
if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
for (a = this._[t], i = 0, r = a.length; i < r; ++i) a[i].value.apply(e, n);
},
apply: function(t, e, n) {
if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
for (var i = this._[t], r = 0, a = i.length; r < a; ++r) i[r].value.apply(e, n);
}
};
function No(t, e) {
for (var n = 0, i = t.length, r; n < i; ++n)
if ((r = t[n]).name === e)
return r.value;
}
function or(t, e, n) {
for (var i = 0, r = t.length; i < r; ++i)
if (t[i].name === e) {
t[i] = Ao, t = t.slice(0, i).concat(t.slice(i + 1));
break;
}
return n != null && t.push({ name: e, value: n }), t;
}
var vi = "http://www.w3.org/1999/xhtml";
const lr = {
svg: "http://www.w3.org/2000/svg",
xhtml: vi,
xlink: "http://www.w3.org/1999/xlink",
xml: "http://www.w3.org/XML/1998/namespace",
xmlns: "http://www.w3.org/2000/xmlns/"
};
function Hn(t) {
var e = t += "", n = e.indexOf(":");
return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), lr.hasOwnProperty(e) ? { space: lr[e], local: t } : t;
}
function Io(t) {
return function() {
var e = this.ownerDocument, n = this.namespaceURI;
return n === vi && e.documentElement.namespaceURI === vi ? e.createElement(t) : e.createElementNS(n, t);
};
}
function Do(t) {
return function() {
return this.ownerDocument.createElementNS(t.space, t.local);
};
}
function Fa(t) {
var e = Hn(t);
return (e.local ? Do : Io)(e);
}
function Ro() {
}
function Fi(t) {
return t == null ? Ro : function() {
return this.querySelector(t);
};
}
function Mo(t) {
typeof t != "function" && (t = Fi(t));
for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
for (var a = e[r], s = a.length, o = i[r] = new Array(s), f, c, u = 0; u < s; ++u)
(f = a[u]) && (c = t.call(f, f.__data__, u, a)) && ("__data__" in f && (c.__data__ = f.__data__), o[u] = c);
return new Pt(i, this._parents);
}
function za(t) {
return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
}
function Oo() {
return [];
}
function Ba(t) {
return t == null ? Oo : function() {
return this.querySelectorAll(t);
};
}
function Lo(t) {
return function() {
return za(t.apply(this, arguments));
};
}
function Co(t) {
typeof t == "function" ? t = Lo(t) : t = Ba(t);
for (var e = this._groups, n = e.length, i = [], r = [], a = 0; a < n; ++a)
for (var s = e[a], o = s.length, f, c = 0; c < o; ++c)
(f = s[c]) && (i.push(t.call(f, f.__data__, c, s)), r.push(f));
return new Pt(i, r);
}
function Ha(t) {
return function() {
return this.matches(t);
};
}
function Pa(t) {
return function(e) {
return e.matches(t);
};
}
var Fo = Array.prototype.find;
function zo(t) {
return function() {
return Fo.call(this.children, t);
};
}
function Bo() {
return this.firstElementChild;
}
function Ho(t) {
return this.select(t == null ? Bo : zo(typeof t == "function" ? t : Pa(t)));
}
var Po = Array.prototype.filter;
function Vo() {
return Array.from(this.children);
}
function Uo(t) {
return function() {
return Po.call(this.children, t);
};
}
function Zo(t) {
return this.selectAll(t == null ? Vo : Uo(typeof t == "function" ? t : Pa(t)));
}
function qo(t) {
typeof t != "function" && (t = Ha(t));
for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
for (var a = e[r], s = a.length, o = i[r] = [], f, c = 0; c < s; ++c)
(f = a[c]) && t.call(f, f.__data__, c, a) && o.push(f);
return new Pt(i, this._parents);
}
function Va(t) {
return new Array(t.length);
}
function Go() {
return new Pt(this._enter || this._groups.map(Va), this._parents);
}
function En(t, e) {
this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
}
En.prototype = {
constructor: En,
appendChild: function(t) {
return this._parent.insertBefore(t, this._next);
},
insertBefore: function(t, e) {
return this._parent.insertBefore(t, e);
},
querySelector: function(t) {
return this._parent.querySelector(t);
},
querySelectorAll: function(t) {
return this._parent.querySelectorAll(t);
}
};
function Wo(t) {
return function() {
return t;
};
}
function Xo(t, e, n, i, r, a) {
for (var s = 0, o, f = e.length, c = a.length; s < c; ++s)
(o = e[s]) ? (o.__data__ = a[s], i[s] = o) : n[s] = new En(t, a[s]);
for (; s < f; ++s)
(o = e[s]) && (r[s] = o);
}
function Yo(t, e, n, i, r, a, s) {
var o, f, c = /* @__PURE__ */ new Map(), u = e.length, m = a.length, p = new Array(u), _;
for (o = 0; o < u; ++o)
(f = e[o]) && (p[o] = _ = s.call(f, f.__data__, o, e) + "", c.has(_) ? r[o] = f : c.set(_, f));
for (o = 0; o < m; ++o)
_ = s.call(t, a[o], o, a) + "", (f = c.get(_)) ? (i[o] = f, f.__data__ = a[o], c.delete(_)) : n[o] = new En(t, a[o]);
for (o = 0; o < u; ++o)
(f = e[o]) && c.get(p[o]) === f && (r[o] = f);
}
function Ko(t) {
return t.__data__;
}
function Jo(t, e) {
if (!arguments.length) return Array.from(this, Ko);
var n = e ? Yo : Xo, i = this._parents, r = this._groups;
typeof t != "function" && (t = Wo(t));
for (var a = r.length, s = new Array(a), o = new Array(a), f = new Array(a), c = 0; c < a; ++c) {
var u = i[c], m = r[c], p = m.length, _ = Qo(t.call(u, u && u.__data__, c, i)), T = _.length, z = o[c] = new Array(T), N = s[c] = new Array(T), A = f[c] = new Array(p);
n(u, m, z, N, A, _, e);
for (var k = 0, b = 0, y, S; k < T; ++k)
if (y = z[k]) {
for (k >= b && (b = k + 1); !(S = N[b]) && ++b < T; ) ;
y._next = S || null;
}
}
return s = new Pt(s, i), s._enter = o, s._exit = f, s;
}
function Qo(t) {
return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function jo() {
return new Pt(this._exit || this._groups.map(Va), this._parents);
}
function tl(t, e, n) {
var i = this.enter(), r = this, a = this.exit();
return typeof t == "function" ? (i = t(i), i && (i = i.selection())) : i = i.append(t + ""), e != null && (r = e(r), r && (r = r.selection())), n == null ? a.remove() : n(a), i && r ? i.merge(r).order() : r;
}
function el(t) {
for (var e = t.selection ? t.selection() : t, n = this._groups, i = e._groups, r = n.length, a = i.length, s = Math.min(r, a), o = new Array(r), f = 0; f < s; ++f)
for (var c = n[f], u = i[f], m = c.length, p = o[f] = new Array(m), _, T = 0; T < m; ++T)
(_ = c[T] || u[T]) && (p[T] = _);
for (; f < r; ++f)
o[f] = n[f];
return new Pt(o, this._parents);
}
function nl() {
for (var t = this._groups, e = -1, n = t.length; ++e < n; )
for (var i = t[e], r = i.length - 1, a = i[r], s; --r >= 0; )
(s = i[r]) && (a && s.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(s, a), a = s);
return this;
}
function il(t) {
t || (t = rl);
function e(m, p) {
return m && p ? t(m.__data__, p.__data__) : !m - !p;
}
for (var n = this._groups, i = n.length, r = new Array(i), a = 0; a < i; ++a) {
for (var s = n[a], o = s.length, f = r[a] = new Array(o), c, u = 0; u < o; ++u)
(c = s[u]) && (f[u] = c);
f.sort(e);
}
return new Pt(r, this._parents).order();
}
function rl(t, e) {
return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function al() {
var t = arguments[0];
return arguments[0] = this, t.apply(null, arguments), this;
}
function sl() {
return Array.from(this);
}
function ol() {
for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
for (var i = t[e], r = 0, a = i.length; r < a; ++r) {
var s = i[r];
if (s) return s;
}
return null;
}
function ll() {
let t = 0;
for (const e of this) ++t;
return t;
}
function fl() {
return !this.node();
}
function cl(t) {
for (var e = this._groups, n = 0, i = e.length; n < i; ++n)
for (var r = e[n], a = 0, s = r.length, o; a < s; ++a)
(o = r[a]) && t.call(o, o.__data__, a, r);
return this;
}
function ul(t) {
return function() {
this.removeAttribute(t);
};
}
function hl(t) {
return function() {
this.removeAttributeNS(t.space, t.local);
};
}
function dl(t, e) {
return function() {
this.setAttribute(t, e);
};
}
function pl(t, e) {
return function() {
this.setAttributeNS(t.space, t.local, e);
};
}
function _l(t, e) {
return function() {
var n = e.apply(this, arguments);
n == null ? this.removeAttribute(t) : this.setAttribute(t, n);
};
}
function gl(t, e) {
return function() {
var n = e.apply(this, arguments);
n == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, n);
};
}
function ml(t, e) {
var n = Hn(t);
if (arguments.length < 2) {
var i = this.node();
return n.local ? i.getAttributeNS(n.space, n.local) : i.getAttribute(n);
}
return this.each((e == null ? n.local ? hl : ul : typeof e == "function" ? n.local ? gl : _l : n.local ? pl : dl)(n, e));
}
function Ua(t) {
return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
}
function vl(t) {
return function() {
this.style.removeProperty(t);
};
}
function wl(t, e, n) {
return function() {
this.style.setProperty(t, e, n);
};
}
function yl(t, e, n) {
return function() {
var i = e.apply(this, arguments);
i == null ? this.style.removeProperty(t) : this.style.setProperty(t, i, n);
};
}
function xl(t, e, n) {
return arguments.length > 1 ? this.each((e == null ? vl : typeof e == "function" ? yl : wl)(t, e, n ?? "")) : Le(this.node(), t);
}
function Le(t, e) {
return t.style.getPropertyValue(e) || Ua(t).getComputedStyle(t, null).getPropertyValue(e);
}
function bl(t) {
return function() {
delete this[t];
};
}
function kl(t, e) {
return function() {
this[t] = e;
};
}
function Tl(t, e) {
return function() {
var n = e.apply(this, arguments);
n == null ? delete this[t] : this[t] = n;
};
}
function El(t, e) {
return arguments.length > 1 ? this.each((e == null ? bl : typeof e == "function" ? Tl : kl)(t, e)) : this.node()[t];
}
function Za(t) {
return t.trim().split(/^|\s+/);
}
function zi(t) {
return t.classList || new qa(t);
}
function qa(t) {
this._node = t, this._names = Za(t.getAttribute("class") || "");
}
qa.prototype = {
add: function(t) {
var e = this._names.indexOf(t);
e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
},
remove: function(t) {
var e = this._names.indexOf(t);
e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
},
contains: function(t) {
return this._names.indexOf(t) >= 0;
}
};
function Ga(t, e) {
for (var n = zi(t), i = -1, r = e.length; ++i < r; ) n.add(e[i]);
}
function Wa(t, e) {
for (var n = zi(t), i = -1, r = e.length; ++i < r; ) n.remove(e[i]);
}
function Sl(t) {
return function() {
Ga(this, t);
};
}
function Al(t) {
return function() {
Wa(this, t);
};
}
function $l(t, e) {
return function() {
(e.apply(this, arguments) ? Ga : Wa)(this, t);
};
}
function Nl(t, e) {
var n = Za(t + "");
if (arguments.length < 2) {
for (var i = zi(this.node()), r = -1, a = n.length; ++r < a; ) if (!i.contains(n[r])) return !1;
return !0;
}
return this.each((typeof e == "function" ? $l : e ? Sl : Al)(n, e));
}
function Il() {
this.textContent = "";
}
function Dl(t) {
return function() {
this.textContent = t;
};
}
function Rl(t) {
return function() {
var e = t.apply(this, arguments);
this.textContent = e ?? "";
};
}
function Ml(t) {
return arguments.length ? this.each(t == null ? Il : (typeof t == "function" ? Rl : Dl)(t)) : this.node().textContent;
}
function Ol() {
this.innerHTML = "";
}
function Ll(t) {
return function() {
this.innerHTML = t;
};
}
function Cl(t) {
return function() {
var e = t.apply(this, arguments);
this.innerHTML = e ?? "";
};
}
function Fl(t) {
return arguments.length ? this.each(t == null ? Ol : (typeof t == "function" ? Cl : Ll)(t)) : this.node().innerHTML;
}
function zl() {
this.nextSibling && this.parentNode.appendChild(this);
}
function Bl() {
return this.each(zl);
}
function Hl() {
this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function Pl() {
return this.each(Hl);
}
function Vl(t) {
var e = typeof t == "function" ? t : Fa(t);
return this.select(function() {
return this.appendChild(e.apply(this, arguments));
});
}
function Ul() {
return null;
}
function Zl(t, e) {
var n = typeof t == "function" ? t : Fa(t), i = e == null ? Ul : typeof e == "function" ? e : Fi(e);
return this.select(function() {
return this.insertBefore(n.apply(this, arguments), i.apply(this, arguments) || null);
});
}
function ql() {
var t = this.parentNode;
t && t.removeChild(this);
}
function Gl() {
return this.each(ql);
}
function Wl() {
var t = this.cloneNode(!1), e = this.parentNode;
return e ? e.insertBefore(t, this.nextSibling) : t;
}
function Xl() {
var t = this.cloneNode(!0), e = this.parentNode;
return e ? e.insertBefore(t, this.nextSibling) : t;
}
function Yl(t) {
return this.select(t ? Xl : Wl);
}
function Kl(t) {
return arguments.length ? this.property("__data__", t) : this.node().__data__;
}
function Jl(t) {
return function(e) {
t.call(this, e, this.__data__);
};
}
function Ql(t) {
return t.trim().split(/^|\s+/).map(function(e) {
var n = "", i = e.indexOf(".");
return i >= 0 && (n = e.slice(i + 1), e = e.slice(0, i)), { type: e, name: n };
});
}
function jl(t) {
return function() {
var e = this.__on;
if (e) {
for (var n = 0, i = -1, r = e.length, a; n < r; ++n)
a = e[n], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++i] = a;
++i ? e.length = i : delete this.__on;
}
};
}
function tf(t, e, n) {
return function() {
var i = this.__on, r, a = Jl(e);
if (i) {
for (var s = 0, o = i.length; s < o; ++s)
if ((r = i[s]).type === t.type && r.name === t.name) {
this.removeEventListener(r.type, r.listener, r.options), this.addEventListener(r.type, r.listener = a, r.options = n), r.value = e;
return;
}
}
this.addEventListener(t.type, a, n), r = { type: t.type, name: t.name, value: e, listener: a, options: n }, i ? i.push(r) : this.__on = [r];
};
}
function ef(t, e, n) {
var i = Ql(t + ""), r, a = i.length, s;
if (arguments.length < 2) {
var o = this.node().__on;
if (o) {
for (var f = 0, c = o.length, u; f < c; ++f)
for (r = 0, u = o[f]; r < a; ++r)
if ((s = i[r]).type === u.type && s.name === u.name)
return u.value;
}
return;
}
for (o = e ? tf : jl, r = 0; r < a; ++r) this.each(o(i[r], e, n));
return this;
}
function Xa(t, e, n) {
var i = Ua(t), r = i.CustomEvent;
typeof r == "function" ? r = new r(e, n) : (r = i.document.createEvent("Event"), n ? (r.initEvent(e, n.bubbles, n.cancelable), r.detail = n.detail) : r.initEvent(e, !1, !1)), t.dispatchEvent(r);
}
function nf(t, e) {
return function() {
return Xa(this, t, e);
};
}
function rf(t, e) {
return function() {
return Xa(this, t, e.apply(this, arguments));
};
}
function af(t, e) {
return this.each((typeof e == "function" ? rf : nf)(t, e));
}
function* sf() {
for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
for (var i = t[e], r = 0, a = i.length, s; r < a; ++r)
(s = i[r]) && (yield s);
}
var Bi = [null];
function Pt(t, e) {
this._groups = t, this._parents = e;
}
function Se() {
return new Pt([[document.documentElement]], Bi);
}
function of() {
return this;
}
Pt.prototype = Se.prototype = {
constructor: Pt,
select: Mo,
selectAll: Co,
selectChild: Ho,
selectChildren: Zo,
filter: qo,
data: Jo,
enter: Go,
exit: jo,
join: tl,
merge: el,
selection: of,
order: nl,
sort: il,
call: al,
nodes: sl,
node: ol,
size: ll,
empty: fl,
each: cl,
attr: ml,
style: xl,
property: El,
classed: Nl,
text: Ml,
html: Fl,
raise: Bl,
lower: Pl,
append: Vl,
insert: Zl,
remove: Gl,
clone: Yl,
datum: Kl,
on: ef,
dispatch: af,
[Symbol.iterator]: sf
};
function Et(t) {
return typeof t == "string" ? new Pt([[document.querySelector(t)]], [document.documentElement]) : new Pt([[t]], Bi);
}
function Jt(t) {
return typeof t == "string" ? new Pt([document.querySelectorAll(t)], [document.documentElement]) : new Pt([za(t)], Bi);
}
function Hi(t, e, n) {
t.prototype = e.prototype = n, n.constructor = t;
}
function Ya(t, e) {
var n = Object.create(t.prototype);
for (var i in e) n[i] = e[i];
return n;
}
function tn() {
}
var Xe = 0.7, Sn = 1 / Xe, Me = "\\s*([+-]?\\d+)\\s*", Ye = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", ie = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", lf = /^#([0-9a-f]{3,8})$/, ff = new RegExp(`^rgb\\(${Me},${Me},${Me}\\)$`), cf = new RegExp(`^rgb\\(${ie},${ie},${ie}\\)$`), uf = new RegExp(`^rgba\\(${Me},${Me},${Me},${Ye}\\)$`), hf = new RegExp(`^rgba\\(${ie},${ie},${ie},${Ye}\\)$`), df = new RegExp(`^hsl\\(${Ye},${ie},${ie}\\)$`), pf = new RegExp(`^hsla\\(${Ye},${ie},${ie},${Ye}\\)$`), fr = {
aliceblue: 15792383,
antiquewhite: 16444375,
aqua: 65535,
aquamarine: 8388564,
azure: 15794175,
beige: 16119260,
bisque: 16770244,
black: 0,
blanchedalmond: 16772045,
blue: 255,
blueviolet: 9055202,
brown: 10824234,
burlywood: 14596231,
cadetblue: 6266528,
chartreuse: 8388352,
chocolate: 13789470,
coral: 16744272,
cornflowerblue: 6591981,
cornsilk: 16775388,
crimson: 14423100,
cyan: 65535,
darkblue: 139,
darkcyan: 35723,
darkgoldenrod: 12092939,
darkgray: 11119017,
darkgreen: 25600,
darkgrey: 11119017,
darkkhaki: 12433259,
darkmagenta: 9109643,
darkolivegreen: 5597999,
darkorange: 16747520,
darkorchid: 10040012,
darkred: 9109504,
darksalmon: 15308410,
darkseagreen: 9419919,
darkslateblue: 4734347,
darkslategray: 3100495,
darkslategrey: 3100495,
darkturquoise: 52945,
darkviolet: 9699539,
deeppink: 16716947,
deepskyblue: 49151,
dimgray: 6908265,
dimgrey: 6908265,
dodgerblue: 2003199,
firebrick: 11674146,
floralwhite: 16775920,
forestgreen: 2263842,
fuchsia: 16711935,
gainsboro: 14474460,
ghostwhite: 16316671,
gold: 16766720,
goldenrod: 14329120,
gray: 8421504,
green: 32768,
greenyellow: 11403055,
grey: 8421504,
honeydew: 15794160,
hotpink: 16738740,
indianred: 13458524,
indigo: 4915330,
ivory: 16777200,
khaki: 15787660,
lavender: 15132410,
lavenderblush: 16773365,
lawngreen: 8190976,
lemonchiffon: 16775885,
lightblue: 11393254,
lightcoral: 15761536,
lightcyan: 14745599,
lightgoldenrodyellow: 16448210,
lightgray: 13882323,
lightgreen: 9498256,
lightgrey: 13882323,
lightpink: 16758465,
lightsalmon: 16752762,
lightseagreen: 2142890,
lightskyblue: 8900346,
lightslategray: 7833753,
lightslategrey: 7833753,
lightsteelblue: 11584734,
lightyellow: 16777184,
lime: 65280,
limegreen: 3329330,
linen: 16445670,
magenta: 16711935,
maroon: 8388608,
mediumaquamarine: 6737322,
mediumblue: 205,
mediumorchid: 12211667,
mediumpurple: 9662683,
mediumseagreen: 3978097,
mediumslateblue: 8087790,
mediumspringgreen: 64154,
mediumturquoise: 4772300,
mediumvioletred: 13047173,
midnightblue: 1644912,
mintcream: 16121850,
mistyrose: 16770273,
moccasin: 16770229,
navajowhite: 16768685,
navy: 128,
oldlace: 16643558,
olive: 8421376,
olivedrab: 7048739,
orange: 16753920,
orangered: 16729344,
orchid: 14315734,
palegoldenrod: 15657130,
palegreen: 10025880,
paleturquoise: 11529966,
palevioletred: 14381203,
papayawhip: 16773077,
peachpuff: 16767673,
peru: 13468991,
pink: 16761035,
plum: 14524637,
powderblue: 11591910,
purple: 8388736,
rebeccapurple: 6697881,
red: 16711680,
rosybrown: 12357519,
royalblue: 4286945,
saddlebrown: 9127187,
salmon: 16416882,
sandybrown: 16032864,
seagreen: 3050327,
seashell: 16774638,
sienna: 10506797,
silver: 12632256,
skyblue: 8900331,
slateblue: 6970061,
slategray: 7372944,
slategrey: 7372944,
snow: 16775930,
springgreen: 65407,
steelblue: 4620980,
tan: 13808780,
teal: 32896,
thistle: 14204888,
tomato: 16737095,
turquoise: 4251856,
violet: 15631086,
wheat: 16113331,
white: 16777215,
whitesmoke: 16119285,
yellow: 16776960,
yellowgreen: 10145074
};
Hi(tn, be, {
copy(t) {
return Object.assign(new this.constructor(), this, t);
},
displayable() {
return this.rgb().displayable();
},
hex: cr,
// Deprecated! Use color.formatHex.
formatHex: cr,
formatHex8: _f,
formatHsl: gf,
formatRgb: ur,
toString: ur
});
function cr() {
return this.rgb().formatHex();
}
function _f() {
return this.rgb().formatHex8();
}
function gf() {
return Ka(this).formatHsl();
}
function ur() {
return this.rgb().formatRgb();
}
function be(t) {
var e, n;
return t = (t + "").trim().toLowerCase(), (e = lf.exec(t)) ? (n = e[1].length, e = parseInt(e[1], 16), n === 6 ? hr(e) : n === 3 ? new Zt(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : n === 8 ? an(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : n === 4 ? an(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = ff.exec(t)) ? new Zt(e[1], e[2], e[3], 1) : (e = cf.exec(t)) ? new Zt(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = uf.exec(t)) ? an(e[1], e[2], e[3], e[4]) : (e = hf.exec(t)) ? an(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = df.exec(t)) ? _r(e[1], e[2] / 100, e[3] / 100, 1) : (e = pf.exec(t)) ? _r(e[1], e[2] / 100, e[3] / 100, e[4]) : fr.hasOwnProperty(t) ? hr(fr[t]) : t === "transparent" ? new Zt(NaN, NaN, NaN, 0) : null;
}
function hr(t) {
return new Zt(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
}
function an(t, e, n, i) {
return i <= 0 && (t = e = n = NaN), new Zt(t, e, n, i);
}
function mf(t) {
return t instanceof tn || (t = be(t)), t ? (t = t.rgb(), new Zt(t.r, t.g, t.b, t.opacity)) : new Zt();
}
function wi(t, e, n, i) {
return arguments.length === 1 ? mf(t) : new Zt(t, e, n, i ?? 1);
}
function Zt(t, e, n, i) {
this.r = +t, this.g = +e, this.b = +n, this.opacity = +i;
}
Hi(Zt, wi, Ya(tn, {
brighter(t) {
return t = t == null ? Sn : Math.pow(Sn, t), new Zt(this.r * t, this.g * t, this.b * t, this.opacity);
},
darker(t) {
return t = t == null ? Xe : Math.pow(Xe, t), new Zt(this.r * t, this.g * t, this.b * t, this.opacity);
},
rgb() {
return this;
},
clamp() {
return new Zt(ye(this.r), ye(this.g), ye(this.b), An(this.opacity));
},
displayable() {
return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
},
hex: dr,
// Deprecated! Use color.formatHex.
formatHex: dr,
formatHex8: vf,
formatRgb: pr,
toString: pr
}));
function dr() {
return `#${ve(this.r)}${ve(this.g)}${ve(this.b)}`;
}
function vf() {
return `#${ve(this.r)}${ve(this.g)}${ve(this.b)}${ve((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function pr() {
const t = An(this.opacity);
return `${t === 1 ? "rgb(" : "rgba("}${ye(this.r)}, ${ye(this.g)}, ${ye(this.b)}${t === 1 ? ")" : `, ${t})`}`;
}
function An(t) {
return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
}
function ye(t) {
return Math.max(0, Math.min(255, Math.round(t) || 0));
}
function ve(t) {
return t = ye(t), (t < 16 ? "0" : "") + t.toString(16);
}
function _r(t, e, n, i) {
return i <= 0 ? t = e = n = NaN : n <= 0 || n >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new jt(t, e, n, i);
}
function Ka(t) {
if (t instanceof jt) return new jt(t.h, t.s, t.l, t.opacity);
if (t instanceof tn || (t = be(t)), !t) return new jt();
if (t instanceof jt) return t;
t = t.rgb();
var e = t.r / 255, n = t.g / 255, i = t.b / 255, r = Math.min(e, n, i), a = Math.max(e, n, i), s = NaN, o = a - r, f = (a + r) / 2;
return o ? (e === a ? s = (n - i) / o + (n < i) * 6 : n === a ? s = (i - e) / o + 2 : s = (e - n) / o + 4, o /= f < 0.5 ? a + r : 2 - a - r, s *= 60) : o = f > 0 && f < 1 ? 0 : s, new jt(s, o, f, t.opacity);
}
function wf(t, e, n, i) {
return arguments.length === 1 ? Ka(t) : new jt(t, e, n, i ?? 1);
}
function jt(t, e, n, i) {
this.h = +t, this.s = +e, this.l = +n, this.opacity = +i;
}
Hi(jt, wf, Ya(tn, {
brighter(t) {
return t = t == null ? Sn : Math.pow(Sn, t), new jt(this.h, this.s, this.l * t, this.opacity);
},
darker(t) {
return t = t == null ? Xe : Math.pow(Xe, t), new jt(this.h, this.s, this.l * t, this.opacity);
},
rgb() {
var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, n = this.l, i = n + (n < 0.5 ? n : 1 - n) * e, r = 2 * n - i;
return new Zt(
Wn(t >= 240 ? t - 240 : t + 120, r, i),
Wn(t, r, i),
Wn(t < 120 ? t + 240 : t - 120, r, i),
this.opacity
);
},
clamp() {
return new jt(gr(this.h), sn(this.s), sn(this.l), An(this.opacity));
},
displayable() {
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
},
formatHsl() {
const t = An(this.opacity);
return `${t === 1 ? "hsl(" : "hsla("}${gr(this.h)}, ${sn(this.s) * 100}%, ${sn(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
}
}));
function gr(t) {
return t = (t || 0) % 360, t < 0 ? t + 360 : t;
}
function sn(t) {
return Math.max(0, Math.min(1, t || 0));
}
function Wn(t, e, n) {
return (t < 60 ? e + (n - e) * t / 60 : t < 180 ? n : t < 240 ? e + (n - e) * (240 - t) / 60 : e) * 255;
}
const Pi = (t) => () => t;
function yf(t, e) {
return function(n) {
return t + n * e;
};
}
function xf(t, e, n) {
return t = Math.pow(t, n), e = Math.pow(e, n) - t, n = 1 / n, function(i) {
return Math.pow(t + i * e, n);
};
}
function bf(t) {
return (t = +t) == 1 ? Ja : function(e, n) {
return n - e ? xf(e, n, t) : Pi(isNaN(e) ? n : e);
};
}
function Ja(t, e) {
var n = e - t;
return n ? yf(t, n) : Pi(isNaN(t) ? e : t);
}
const $n = function t(e) {
var n = bf(e);
function i(r, a) {
var s = n((r = wi(r)).r, (a = wi(a)).r), o = n(r.g, a.g), f = n(r.b, a.b), c = Ja(r.opacity, a.opacity);
return function(u) {
return r.r = s(u), r.g = o(u), r.b = f(u), r.opacity = c(u), r + "";
};
}
return i.gamma = t, i;
}(1);
function kf(t, e) {
e || (e = []);
var n = t ? Math.min(e.length, t.length) : 0, i = e.slice(), r;
return function(a) {
for (r = 0; r < n; ++r) i[r] = t[r] * (1 - a) + e[r] * a;
return i;
};
}
function Tf(t) {
return ArrayBuffer.isView(t) && !(t instanceof DataView);
}
function Ef(t, e) {
var n = e ? e.length : 0, i = t ? Math.min(n, t.length) : 0, r = new Array(i), a = new Array(n), s;
for (s = 0; s < i; ++s) r[s] = Vi(t[s], e[s]);
for (; s < n; ++s) a[s] = e[s];
return function(o) {
for (s = 0; s < i; ++s) a[s] = r[s](o);
return a;
};
}
function Sf(t, e) {
var n = /* @__PURE__ */ new Date();
return t = +t, e = +e, function(i) {
return n.setTime(t * (1 - i) + e * i), n;
};
}
function Qt(t, e) {
return t = +t, e = +e, function(n) {
return t * (1 - n) + e * n;
};
}
function Af(t, e) {
var n = {}, i = {}, r;
(t === null || typeof t != "object") && (t = {}), (e === null || typeof e != "object") && (e = {});
for (r in e)
r in t ? n[r] = Vi(t[r], e[r]) : i[r] = e[r];
return function(a) {
for (r in n) i[r] = n[r](a);
return i;
};
}
var yi = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, Xn = new RegExp(yi.source, "g");
function $f(t) {
return function() {
return t;
};
}
function Nf(t) {
return function(e) {
return t(e) + "";
};
}
function Qa(t, e) {
var n = yi.lastIndex = Xn.lastIndex = 0, i, r, a, s = -1, o = [], f = [];
for (t = t + "", e = e + ""; (i = yi.exec(t)) && (r = Xn.exec(e)); )
(a = r.index) > n && (a = e.slice(n, a), o[s] ? o[s] += a : o[++s] = a), (i = i[0]) === (r = r[0]) ? o[s] ? o[s] += r : o[++s] = r : (o[++s] = null, f.push({ i: s, x: Qt(i, r) })), n = Xn.lastIndex;
return n < e.length && (a = e.slice(n), o[s] ? o[s] += a : o[++s] = a), o.length < 2 ? f[0] ? Nf(f[0].x) : $f(e) : (e = f.length, function(c) {
for (var u = 0, m; u < e; ++u) o[(m = f[u]).i] = m.x(c);
return o.join("");
});
}
function Vi(t, e) {
var n = typeof e, i;
return e == null || n === "boolean" ? Pi(e) : (n === "number" ? Qt : n === "string" ? (i = be(e)) ? (e = i, $n) : Qa : e instanceof be ? $n : e instanceof Date ? Sf : Tf(e) ? kf : Array.isArray(e) ? Ef : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? Af : Qt)(t, e);
}
function If(t, e) {
return t = +t, e = +e, function(n) {
return Math.round(t * (1 - n) + e * n);
};
}
var mr = 180 / Math.PI, xi = {
translateX: 0,
translateY: 0,
rotate: 0,
skewX: 0,
scaleX: 1,
scaleY: 1
};
function ja(t, e, n, i, r, a) {
var s, o, f;
return (s = Math.sqrt(t * t + e * e)) && (t /= s, e /= s), (f = t * n + e * i) && (n -= t * f, i -= e * f), (o = Math.sqrt(n * n + i * i)) && (n /= o, i /= o, f /= o), t * i < e * n && (t = -t, e = -e, f = -f, s = -s), {
translateX: r,
translateY: a,
rotate: Math.atan2(e, t) * mr,
skewX: Math.atan(f) * mr,
scaleX: s,
scaleY: o
};
}
var on;
function Df(t) {
const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
return e.isIdentity ? xi : ja(e.a, e.b, e.c, e.d, e.e, e.f);
}
function Rf(t) {
return t == null || (on || (on = document.createElementNS("http://www.w3.org/2000/svg", "g")), on.setAttribute("transform", t), !(t = on.transform.baseVal.consolidate())) ? xi : (t = t.matrix, ja(t.a, t.b, t.c, t.d, t.e, t.f));
}
function ts(t, e, n, i) {
function r(c) {
return c.length ? c.pop() + " " : "";
}
function a(c, u, m, p, _, T) {
if (c !== m || u !== p) {
var z = _.push("translate(", null, e, null, n);
T.push({ i: z - 4, x: Qt(c, m) }, { i: z - 2, x: Qt(u, p) });
} else (m || p) && _.push("translate(" + m + e + p + n);
}
function s(c, u, m, p) {
c !== u ? (c - u > 180 ? u += 360 : u - c > 180 && (c += 360), p.push({ i: m.push(r(m) + "rotate(", null, i) - 2, x: Qt(c, u) })) : u && m.push(r(m) + "rotate(" + u + i);
}
function o(c, u, m, p) {
c !== u ? p.push({ i: m.push(r(m) + "skewX(", null, i) - 2, x: Qt(c, u) }) : u && m.push(r(m) + "skewX(" + u + i);
}
function f(c, u, m, p, _, T) {
if (c !== m || u !== p) {
var z = _.push(r(_) + "scale(", null, ",", null, ")");
T.push({ i: z - 4, x: Qt(c, m) }, { i: z - 2, x: Qt(u, p) });
} else (m !== 1 || p !== 1) && _.push(r(_) + "scale(" + m + "," + p + ")");
}
return function(c, u) {
var m = [], p = [];
return c = t(c), u = t(u), a(c.translateX, c.translateY, u.translateX, u.translateY, m, p), s(c.rotate, u.rotate, m, p), o(c.skewX, u.skewX, m, p), f(c.scaleX, c.scaleY, u.scaleX, u.scaleY, m, p), c = u = null, function(_) {
for (var T = -1, z = p.length, N; ++T < z; ) m[(N = p[T]).i] = N.x(_);
return m.join("");
};
};
}
var Mf = ts(Df, "px, ", "px)", "deg)"), Of = ts(Rf, ", ", ")", ")"), Ce = 0, Ue = 0, He = 0, es = 1e3, Nn, Ze, In = 0, ke = 0, Pn = 0, Ke = typeof performance == "object" && performance.now ? performance : Date, ns = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
setTimeout(t, 17);
};
function Ui() {
return ke || (ns(Lf), ke = Ke.now() + Pn);
}
function Lf() {
ke = 0;
}
function Dn() {
this._call = this._time = this._next = null;
}
Dn.prototype = is.prototype = {
constructor: Dn,
restart: function(t, e, n) {
if (typeof t != "function") throw new TypeError("callback is not a function");
n = (n == null ? Ui() : +n) + (e == null ? 0 : +e), !this._next && Ze !== this && (Ze ? Ze._next = this : Nn = this, Ze = this), this._call = t, this._time = n, bi();
},
stop: function() {
this._call && (this._call = null, this._time = 1 / 0, bi());
}
};
function is(t, e, n) {
var i = new Dn();
return i.restart(t, e, n), i;
}
function Cf() {
Ui(), ++Ce;
for (var t = Nn, e; t; )
(e = ke - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
--Ce;
}
function vr() {
ke = (In = Ke.now()) + Pn, Ce = Ue = 0;
try {
Cf();
} finally {
Ce = 0, zf(), ke = 0;
}
}
function Ff() {
var t = Ke.now(), e = t - In;
e > es && (Pn -= e, In = t);
}
function zf() {
for (var t, e = Nn, n, i = 1 / 0; e; )
e._call ? (i > e._time && (i = e._time), t = e, e = e._next) : (n = e._next, e._next = null, e = t ? t._next = n : Nn = n);
Ze = t, bi(i);
}
function bi(t) {
if (!Ce) {
Ue && (Ue = clearTimeout(Ue));
var e = t - ke;
e > 24 ? (t < 1 / 0 && (Ue = setTimeout(vr, t - Ke.now() - Pn)), He && (He = clearInterval(He))) : (He || (In = Ke.now(), He = setInterval(Ff, es)), Ce = 1, ns(vr));
}
}
function wr(t, e, n) {
var i = new Dn();
return e = e == null ? 0 : +e, i.restart((r) => {
i.stop(), t(r + e);
}, e, n), i;
}
var Bf = Ca("start", "end", "cancel", "interrupt"), Hf = [], rs = 0, yr = 1, ki = 2, yn = 3, xr = 4, Ti = 5, xn = 6;
function Vn(t, e, n, i, r, a) {
var s = t.__transition;
if (!s) t.__transition = {};
else if (n in s) return;
Pf(t, n, {
name: e,
index: i,
// For context during callback.
group: r,
// For context during callback.
on: Bf,
tween: Hf,
time: a.time,
delay: a.delay,
duration: a.duration,
ease: a.ease,
timer: null,
state: rs
});
}
function Zi(t, e) {
var n = te(t, e);
if (n.state > rs) throw new Error("too late; already scheduled");
return n;
}
function re(t, e) {
var n = te(t, e);
if (n.state > yn) throw new Error("too late; already running");
return n;
}
function te(t, e) {
var n = t.__transition;
if (!n || !(n = n[e])) throw new Error("transition not found");
return n;
}
function Pf(t, e, n) {
var i = t.__transition, r;
i[e] = n, n.timer = is(a, 0, n.time);
function a(c) {
n.state = yr, n.timer.restart(s, n.delay, n.time), n.delay <= c && s(c - n.delay);
}
function s(c) {
var u, m, p, _;
if (n.state !== yr) return f();
for (u in i)
if (_ = i[u], _.name === n.name) {
if (_.state === yn) return wr(s);
_.state === xr ? (_.state = xn, _.timer.stop(), _.on.call("interrupt", t, t.__data__, _.index, _.group), delete i[u]) : +u < e && (_.state = xn, _.timer.stop(), _.on.call("cancel", t, t.__data__, _.index, _.group), delete i[u]);
}
if (wr(function() {
n.state === yn && (n.state = xr, n.timer.restart(o, n.delay, n.time), o(c));
}), n.state = ki, n.on.call("start", t, t.__data__, n.index, n.group), n.state === ki) {
for (n.state = yn, r = new Array(p = n.tween.length), u = 0, m = -1; u < p; ++u)
(_ = n.tween[u].value.call(t, t.__data__, n.index, n.group)) && (r[++m] = _);
r.length = m + 1;
}
}
function o(c) {
for (var u = c < n.duration ? n.ease.call(null, c / n.duration) : (n.timer.restart(f), n.state = Ti, 1), m = -1, p = r.length; ++m < p; )
r[m].call(t, u);
n.state === Ti && (n.on.call("end", t, t.__data__, n.index, n.group), f());
}
function f() {
n.state = xn, n.timer.stop(), delete i[e];
for (var c in i) return;
delete t.__transition;
}
}
function Vf(t, e) {
var n = t.__transition, i, r, a = !0, s;
if (n) {
e = e == null ? null : e + "";
for (s in n) {
if ((i = n[s]).name !== e) {
a = !1;
continue;
}
r = i.state > ki && i.state < Ti, i.state = xn, i.timer.stop(), i.on.call(r ? "interrupt" : "cancel", t, t.__data__, i.index, i.group), delete n[s];
}
a && delete t.__transition;
}
}
function Uf(t) {
return this.each(function() {
Vf(this, t);
});
}
function Zf(t, e) {
var n, i;
return function() {
var r = re(this, t), a = r.tween;
if (a !== n) {
i = n = a;
for (var s = 0, o = i.length; s < o; ++s)
if (i[s].name === e) {
i = i.slice(), i.splice(s, 1);
break;
}
}
r.tween = i;
};
}
function qf(t, e, n) {
var i, r;
if (typeof n != "function") throw new Error();
return function() {
var a = re(this, t), s = a.tween;
if (s !== i) {
r = (i = s).slice();
for (var o = { name: e, value: n }, f = 0, c = r.length; f < c; ++f)
if (r[f].name === e) {
r[f] = o;
break;
}
f === c && r.push(o);
}
a.tween = r;
};
}
function Gf(t, e) {
var n = this._id;
if (t += "", arguments.length < 2) {
for (var i = te(this.node(), n).tween, r = 0, a = i.length, s; r < a; ++r)
if ((s = i[r]).name === t)
return s.value;
return null;
}
return this.each((e == null ? Zf : qf)(n, t, e));
}
function qi(t, e, n) {
var i = t._id;
return t.each(function() {
var r = re(this, i);
(r.value || (r.value = {}))[e] = n.apply(this, arguments);
}), function(r) {
return te(r, i).value[e];
};
}
function as(t, e) {
var n;
return (typeof e == "number" ? Qt : e instanceof be ? $n : (n = be(e)) ? (e = n, $n) : Qa)(t, e);
}
function Wf(t) {
return function() {
this.removeAttribute(t);
};
}
function Xf(t) {
return function() {
this.removeAttributeNS(t.space, t.local);
};
}
function Yf(t, e, n) {
var i, r = n + "", a;
return function() {
var s = this.getAttribute(t);
return s === r ? null : s === i ? a : a = e(i = s, n);
};
}
function Kf(t, e, n) {
var i, r = n + "", a;
return function() {
var s = this.getAttributeNS(t.space, t.local);
return s === r ? null : s === i ? a : a = e(i = s, n);
};
}
function Jf(t, e, n) {
var i, r, a;
return function() {
var s, o = n(this), f;
return o == null ? void this.removeAttribute(t) : (s = this.getAttribute(t), f = o + "", s === f ? null : s === i && f === r ? a : (r = f, a = e(i = s, o)));
};
}
function Qf(t, e, n) {
var i, r, a;
return function() {
var s, o = n(this), f;
return o == null ? void this.removeAttributeNS(t.space, t.local) : (s = this.getAttributeNS(t.space, t.local), f = o + "", s === f ? null : s === i && f === r ? a : (r = f, a = e(i = s, o)));
};
}
function jf(t, e) {
var n = Hn(t), i = n === "transform" ? Of : as;
return this.attrTween(t, typeof e == "function" ? (n.local ? Qf : Jf)(n, i, qi(this, "attr." + t, e)) : e == null ? (n.local ? Xf : Wf)(n) : (n.local ? Kf : Yf)(n, i, e));
}
function tc(t, e) {
return function(n) {
this.setAttribute(t, e.call(this, n));
};
}
function ec(t, e) {
return function(n) {
this.setAttributeNS(t.space, t.local, e.call(this, n));
};
}
function nc(t, e) {
var n, i;
function r() {
var a = e.apply(this, arguments);
return a !== i && (n = (i = a) && ec(t, a)), n;
}
return r._value = e, r;
}
function ic(t, e) {
var n, i;
function r() {
var a = e.apply(this, arguments);
return a !== i && (n = (i = a) && tc(t, a)), n;
}
return r._value = e, r;
}
function rc(t, e) {
var n = "attr." + t;
if (arguments.length < 2) return (n = this.tween(n)) && n._value;
if (e == null) return this.tween(n, null);
if (typeof e != "function") throw new Error();
var i = Hn(t);
return this.tween(n, (i.local ? nc : ic)(i, e));
}
function ac(t, e) {
return function() {
Zi(this, t).delay = +e.apply(this, arguments);
};
}
function sc(t, e) {
return e = +e, function() {
Zi(this, t).delay = e;
};
}
function oc(t) {
var e = this._id;
return arguments.length ? this.each((typeof t == "function" ? ac : sc)(e, t)) : te(this.node(), e).delay;
}
function lc(t, e) {
return function() {
re(this, t).duration = +e.apply(this, arguments);
};
}
function fc(t, e) {
return e = +e, function() {
re(this, t).duration = e;
};
}
function cc(t) {
var e = this._id;
return arguments.length ? this.each((typeof t == "function" ? lc : fc)(e, t)) : te(this.node(), e).duration;
}
function uc(t, e) {
if (typeof e != "function") throw new Error();
return function() {
re(this, t).ease = e;
};
}
function hc(t) {
var e = this._id;
return arguments.length ? this.each(uc(e, t)) : te(this.node(), e).ease;
}
function dc(t, e) {
return function() {
var n = e.apply(this, arguments);
if (typeof n != "function") throw new Error();
re(this, t).ease = n;
};
}
function pc(t) {
if (typeof t != "function") throw new Error();
return this.each(dc(this._id, t));
}
function _c(t) {
typeof t != "function" && (t = Ha(t));
for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
for (var a = e[r], s = a.length, o = i[r] = [], f, c = 0; c < s; ++c)
(f = a[c]) && t.call(f, f.__data__, c, a) && o.push(f);
return new ce(i, this._parents, this._name, this._id);
}
function gc(t) {
if (t._id !== this._id) throw new Error();
for (var e = this._groups, n = t._groups, i = e.length, r = n.length, a = Math.min(i, r), s = new Array(i), o = 0; o < a; ++o)
for (var f = e[o], c = n[o], u = f.length, m = s[o] = new Array(u), p, _ = 0; _ < u; ++_)
(p = f[_] || c[_]) && (m[_] = p);
for (; o < i; ++o)
s[o] = e[o];
return new ce(s, this._parents, this._name, this._id);
}
function mc(t) {
return (t + "").trim().split(/^|\s+/).every(function(e) {
var n = e.indexOf(".");
return n >= 0 && (e = e.slice(0, n)), !e || e === "start";
});
}
function vc(t, e, n) {
var i, r, a = mc(e) ? Zi : re;
return function() {
var s = a(this, t), o = s.on;
o !== i && (r = (i = o).copy()).on(e, n), s.on = r;
};
}
function wc(t, e) {
var n = this._id;
return arguments.length < 2 ? te(this.node(), n).on.on(t) : this.each(vc(n, t, e));
}
function yc(t) {
return function() {
var e = this.parentNode;
for (var n in this.__transition) if (+n !== t) return;
e && e.removeChild(this);
};
}
function xc() {
return this.on("end.remove", yc(this._id));
}
function bc(t) {
var e = this._name, n = this._id;
typeof t != "function" && (t = Fi(t));
for (var i = this._groups, r = i.length, a = new Array(r), s = 0; s < r; ++s)
for (var o = i[s], f = o.length, c = a[s] = new Array(f), u, m, p = 0; p < f; ++p)
(u = o[p]) && (m = t.call(u, u.__data__, p, o)) && ("__data__" in u && (m.__data__ = u.__data__), c[p] = m, Vn(c[p], e, n, p, c, te(u, n)));
return new ce(a, this._parents, e, n);
}
function kc(t) {
var e = this._name, n = thi