UNPKG

@explorables/spinwheels

Version:

This explorable is a spatial implementation of the Kuramoto Model for phase coupled oscillators. It illustrates spatial synchronization and the dynamics of phase singularities.

1,572 lines 231 kB
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode('/*! tailwindcss v4.1.4 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial}}}@layer theme{:root,:host{--tw-font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--tw-color-black:#000;--tw-color-white:#fff;--tw-spacing:.25rem;--tw-container-5xl:64rem;--tw-text-2xl:1.5rem;--tw-text-2xl--line-height:calc(2/1.5);--tw-text-3xl:1.875rem;--tw-text-3xl--line-height: 1.2 ;--tw-text-5xl:3rem;--tw-text-5xl--line-height:1;--tw-font-weight-light:300}}@layer base,components;@layer utilities{.tw\\:m-8{margin:calc(var(--tw-spacing)*8)}.tw\\:grid{display:grid}.tw\\:max-w-5xl{max-width:var(--tw-container-5xl)}.tw\\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.tw\\:bg-white{background-color:var(--tw-color-white)}.tw\\:p-0{padding:calc(var(--tw-spacing)*0)}.tw\\:px-1{padding-inline:calc(var(--tw-spacing)*1)}.tw\\:px-10{padding-inline:calc(var(--tw-spacing)*10)}.tw\\:font-sans{font-family:var(--tw-font-sans)}.tw\\:text-2xl{font-size:var(--tw-text-2xl);line-height:var(--tw-leading,var(--tw-text-2xl--line-height))}.tw\\:text-3xl{font-size:var(--tw-text-3xl);line-height:var(--tw-leading,var(--tw-text-3xl--line-height))}.tw\\:text-5xl{font-size:var(--tw-text-5xl);line-height:var(--tw-leading,var(--tw-text-5xl--line-height))}.tw\\:font-light{--tw-font-weight:var(--tw-font-weight-light);font-weight:var(--tw-font-weight-light)}.tw\\:text-black{color:var(--tw-color-black)}@media (min-width:40rem){.tw\\:sm\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.tw\\:sm\\:gap-8{gap:calc(var(--tw-spacing)*8)}.tw\\:sm\\:p-0{padding:calc(var(--tw-spacing)*0)}}@media (prefers-color-scheme:dark){.tw\\:dark\\:bg-black{background-color:var(--tw-color-black)}.tw\\:dark\\:text-white{color:var(--tw-color-white)}}.debug-grid-16{background-image:linear-gradient(90deg,#0000ff1a 1px,#0000 1px),linear-gradient(#0000ff1a 1px,#0000 1px);background-repeat:repeat;background-size:6.25% 6.25%,6.25% 6.25%}}.explorable *,.explorable :before,.explorable :after{box-sizing:border-box}@property --tw-font-weight{syntax:"*";inherits:false}._displayPanel_pb0r4_1,._controlPanel_pb0r4_8{display:block;line-height:0;box-sizing:border-box}._displayPanel_pb0r4_1>canvas,._displayPanel_pb0r4_1>svg,._controlPanel_pb0r4_8>svg,._controlPanel_pb0r4_8>canvas{display:block;box-sizing:border-box}')),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})(); const ju = { id: "spinwheels", display_type: "canvas", debug: !1, debug_lattice: "debug-grid-16", controls_grid: { nx: 12, ny: 12 }, display_size: { width: 505, height: 505 }, controls_size: { width: 480, height: 480 }, display_class: " tw:p-0", controls_class: "d3-widgets tw:p-0", container_class: "tw:font-sans tw:font-light tw:grid tw:grid-cols-1 tw:sm:grid-cols-2 tw:sm:gap-8 tw:px-1 tw:sm:p-0 tw:m-8" }; function Qe(t, e) { return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN; } function Fu(t, e) { return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN; } function $o(t) { let e, n, r; t.length !== 2 ? (e = Qe, n = (s, c) => Qe(t(s), c), r = (s, c) => t(s) - c) : (e = t === Qe || t === Fu ? t : Du, n = t, r = t); function i(s, c, u = 0, l = s.length) { if (u < l) { if (e(c, c) !== 0) return l; do { const h = u + l >>> 1; n(s[h], c) < 0 ? u = h + 1 : l = h; } while (u < l); } return u; } function a(s, c, u = 0, l = s.length) { if (u < l) { if (e(c, c) !== 0) return l; do { const h = u + l >>> 1; n(s[h], c) <= 0 ? u = h + 1 : l = h; } while (u < l); } return u; } function o(s, c, u = 0, l = s.length) { const h = i(s, c, u, l - 1); return h > u && r(s[h - 1], c) > -r(s[h], c) ? h - 1 : h; } return { left: i, center: o, right: a }; } function Du() { return 0; } function Lu(t) { return t === null ? NaN : +t; } const qu = $o(Qe), Xu = qu.right; $o(Lu).center; const Bu = Math.sqrt(50), Hu = Math.sqrt(10), Uu = Math.sqrt(2); function hn(t, e, n) { const r = (e - t) / Math.max(0, n), i = Math.floor(Math.log10(r)), a = r / Math.pow(10, i), o = a >= Bu ? 10 : a >= Hu ? 5 : a >= Uu ? 2 : 1; let s, c, u; return i < 0 ? (u = Math.pow(10, -i) / o, s = Math.round(t * u), c = Math.round(e * u), s / u < t && ++s, c / u > e && --c, u = -u) : (u = Math.pow(10, i) * o, s = Math.round(t / u), c = Math.round(e / u), s * u < t && ++s, c * u > e && --c), c < s && 0.5 <= n && n < 2 ? hn(t, e, n * 2) : [s, c, u]; } function Yu(t, e, n) { if (e = +e, t = +t, n = +n, !(n > 0)) return []; if (t === e) return [t]; const r = e < t, [i, a, o] = r ? hn(e, t, n) : hn(t, e, n); if (!(a >= i)) return []; const s = a - i + 1, c = new Array(s); if (r) if (o < 0) for (let u = 0; u < s; ++u) c[u] = (a - u) / -o; else for (let u = 0; u < s; ++u) c[u] = (a - u) * o; else if (o < 0) for (let u = 0; u < s; ++u) c[u] = (i + u) / -o; else for (let u = 0; u < s; ++u) c[u] = (i + u) * o; return c; } function Mr(t, e, n) { return e = +e, t = +t, n = +n, hn(t, e, n)[2]; } function Gu(t, e, n) { e = +e, t = +t, n = +n; const r = e < t, i = r ? Mr(e, t, n) : Mr(t, e, n); return (r ? -1 : 1) * (i < 0 ? 1 / -i : i); } var Vu = { value: () => { } }; function No() { for (var t = 0, e = arguments.length, n = {}, r; t < e; ++t) { if (!(r = arguments[t] + "") || r in n || /[\s.]/.test(r)) throw new Error("illegal type: " + r); n[r] = []; } return new tn(n); } function tn(t) { this._ = t; } function Ku(t, e) { return t.trim().split(/^|\s+/).map(function(n) { var r = "", i = n.indexOf("."); if (i >= 0 && (r = n.slice(i + 1), n = n.slice(0, i)), n && !e.hasOwnProperty(n)) throw new Error("unknown type: " + n); return { type: n, name: r }; }); } tn.prototype = No.prototype = { constructor: tn, on: function(t, e) { var n = this._, r = Ku(t + "", n), i, a = -1, o = r.length; if (arguments.length < 2) { for (; ++a < o; ) if ((i = (t = r[a]).type) && (i = Wu(n[i], t.name))) return i; return; } if (e != null && typeof e != "function") throw new Error("invalid callback: " + e); for (; ++a < o; ) if (i = (t = r[a]).type) n[i] = Li(n[i], t.name, e); else if (e == null) for (i in n) n[i] = Li(n[i], t.name, null); return this; }, copy: function() { var t = {}, e = this._; for (var n in e) t[n] = e[n].slice(); return new tn(t); }, call: function(t, e) { if ((i = arguments.length - 2) > 0) for (var n = new Array(i), r = 0, i, a; r < i; ++r) n[r] = arguments[r + 2]; if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t); for (a = this._[t], r = 0, i = a.length; r < i; ++r) a[r].value.apply(e, n); }, apply: function(t, e, n) { if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t); for (var r = this._[t], i = 0, a = r.length; i < a; ++i) r[i].value.apply(e, n); } }; function Wu(t, e) { for (var n = 0, r = t.length, i; n < r; ++n) if ((i = t[n]).name === e) return i.value; } function Li(t, e, n) { for (var r = 0, i = t.length; r < i; ++r) if (t[r].name === e) { t[r] = Vu, t = t.slice(0, r).concat(t.slice(r + 1)); break; } return n != null && t.push({ name: e, value: n }), t; } var Ar = "http://www.w3.org/1999/xhtml"; const qi = { svg: "http://www.w3.org/2000/svg", xhtml: Ar, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }; function In(t) { var e = t += "", n = e.indexOf(":"); return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), qi.hasOwnProperty(e) ? { space: qi[e], local: t } : t; } function Zu(t) { return function() { var e = this.ownerDocument, n = this.namespaceURI; return n === Ar && e.documentElement.namespaceURI === Ar ? e.createElement(t) : e.createElementNS(n, t); }; } function Ju(t) { return function() { return this.ownerDocument.createElementNS(t.space, t.local); }; } function To(t) { var e = In(t); return (e.local ? Ju : Zu)(e); } function Qu() { } function ii(t) { return t == null ? Qu : function() { return this.querySelector(t); }; } function tc(t) { typeof t != "function" && (t = ii(t)); for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i) for (var a = e[i], o = a.length, s = r[i] = new Array(o), c, u, l = 0; l < o; ++l) (c = a[l]) && (u = t.call(c, c.__data__, l, a)) && ("__data__" in c && (u.__data__ = c.__data__), s[l] = u); return new L(r, this._parents); } function ec(t) { return t == null ? [] : Array.isArray(t) ? t : Array.from(t); } function nc() { return []; } function So(t) { return t == null ? nc : function() { return this.querySelectorAll(t); }; } function rc(t) { return function() { return ec(t.apply(this, arguments)); }; } function ic(t) { typeof t == "function" ? t = rc(t) : t = So(t); for (var e = this._groups, n = e.length, r = [], i = [], a = 0; a < n; ++a) for (var o = e[a], s = o.length, c, u = 0; u < s; ++u) (c = o[u]) && (r.push(t.call(c, c.__data__, u, o)), i.push(c)); return new L(r, i); } function Po(t) { return function() { return this.matches(t); }; } function Eo(t) { return function(e) { return e.matches(t); }; } var ac = Array.prototype.find; function oc(t) { return function() { return ac.call(this.children, t); }; } function sc() { return this.firstElementChild; } function uc(t) { return this.select(t == null ? sc : oc(typeof t == "function" ? t : Eo(t))); } var cc = Array.prototype.filter; function lc() { return Array.from(this.children); } function fc(t) { return function() { return cc.call(this.children, t); }; } function hc(t) { return this.selectAll(t == null ? lc : fc(typeof t == "function" ? t : Eo(t))); } function dc(t) { typeof t != "function" && (t = Po(t)); for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i) for (var a = e[i], o = a.length, s = r[i] = [], c, u = 0; u < o; ++u) (c = a[u]) && t.call(c, c.__data__, u, a) && s.push(c); return new L(r, this._parents); } function ko(t) { return new Array(t.length); } function pc() { return new L(this._enter || this._groups.map(ko), this._parents); } function dn(t, e) { this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e; } dn.prototype = { constructor: dn, 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 gc(t) { return function() { return t; }; } function yc(t, e, n, r, i, a) { for (var o = 0, s, c = e.length, u = a.length; o < u; ++o) (s = e[o]) ? (s.__data__ = a[o], r[o] = s) : n[o] = new dn(t, a[o]); for (; o < c; ++o) (s = e[o]) && (i[o] = s); } function bc(t, e, n, r, i, a, o) { var s, c, u = /* @__PURE__ */ new Map(), l = e.length, h = a.length, f = new Array(l), d; for (s = 0; s < l; ++s) (c = e[s]) && (f[s] = d = o.call(c, c.__data__, s, e) + "", u.has(d) ? i[s] = c : u.set(d, c)); for (s = 0; s < h; ++s) d = o.call(t, a[s], s, a) + "", (c = u.get(d)) ? (r[s] = c, c.__data__ = a[s], u.delete(d)) : n[s] = new dn(t, a[s]); for (s = 0; s < l; ++s) (c = e[s]) && u.get(f[s]) === c && (i[s] = c); } function _c(t) { return t.__data__; } function vc(t, e) { if (!arguments.length) return Array.from(this, _c); var n = e ? bc : yc, r = this._parents, i = this._groups; typeof t != "function" && (t = gc(t)); for (var a = i.length, o = new Array(a), s = new Array(a), c = new Array(a), u = 0; u < a; ++u) { var l = r[u], h = i[u], f = h.length, d = mc(t.call(l, l && l.__data__, u, r)), g = d.length, b = s[u] = new Array(g), m = o[u] = new Array(g), w = c[u] = new Array(f); n(l, h, b, m, w, d, e); for (var p = 0, M = 0, y, v; p < g; ++p) if (y = b[p]) { for (p >= M && (M = p + 1); !(v = m[M]) && ++M < g; ) ; y._next = v || null; } } return o = new L(o, r), o._enter = s, o._exit = c, o; } function mc(t) { return typeof t == "object" && "length" in t ? t : Array.from(t); } function wc() { return new L(this._exit || this._groups.map(ko), this._parents); } function xc(t, e, n) { var r = this.enter(), i = this, a = this.exit(); return typeof t == "function" ? (r = t(r), r && (r = r.selection())) : r = r.append(t + ""), e != null && (i = e(i), i && (i = i.selection())), n == null ? a.remove() : n(a), r && i ? r.merge(i).order() : i; } function Mc(t) { for (var e = t.selection ? t.selection() : t, n = this._groups, r = e._groups, i = n.length, a = r.length, o = Math.min(i, a), s = new Array(i), c = 0; c < o; ++c) for (var u = n[c], l = r[c], h = u.length, f = s[c] = new Array(h), d, g = 0; g < h; ++g) (d = u[g] || l[g]) && (f[g] = d); for (; c < i; ++c) s[c] = n[c]; return new L(s, this._parents); } function Ac() { for (var t = this._groups, e = -1, n = t.length; ++e < n; ) for (var r = t[e], i = r.length - 1, a = r[i], o; --i >= 0; ) (o = r[i]) && (a && o.compareDocumentPosition(a) ^ 4 && a.parentNode.insertBefore(o, a), a = o); return this; } function $c(t) { t || (t = Nc); function e(h, f) { return h && f ? t(h.__data__, f.__data__) : !h - !f; } for (var n = this._groups, r = n.length, i = new Array(r), a = 0; a < r; ++a) { for (var o = n[a], s = o.length, c = i[a] = new Array(s), u, l = 0; l < s; ++l) (u = o[l]) && (c[l] = u); c.sort(e); } return new L(i, this._parents).order(); } function Nc(t, e) { return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN; } function Tc() { var t = arguments[0]; return arguments[0] = this, t.apply(null, arguments), this; } function Sc() { return Array.from(this); } function Pc() { for (var t = this._groups, e = 0, n = t.length; e < n; ++e) for (var r = t[e], i = 0, a = r.length; i < a; ++i) { var o = r[i]; if (o) return o; } return null; } function Ec() { let t = 0; for (const e of this) ++t; return t; } function kc() { return !this.node(); } function Oc(t) { for (var e = this._groups, n = 0, r = e.length; n < r; ++n) for (var i = e[n], a = 0, o = i.length, s; a < o; ++a) (s = i[a]) && t.call(s, s.__data__, a, i); return this; } function zc(t) { return function() { this.removeAttribute(t); }; } function Cc(t) { return function() { this.removeAttributeNS(t.space, t.local); }; } function Ic(t, e) { return function() { this.setAttribute(t, e); }; } function Rc(t, e) { return function() { this.setAttributeNS(t.space, t.local, e); }; } function jc(t, e) { return function() { var n = e.apply(this, arguments); n == null ? this.removeAttribute(t) : this.setAttribute(t, n); }; } function Fc(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 Dc(t, e) { var n = In(t); if (arguments.length < 2) { var r = this.node(); return n.local ? r.getAttributeNS(n.space, n.local) : r.getAttribute(n); } return this.each((e == null ? n.local ? Cc : zc : typeof e == "function" ? n.local ? Fc : jc : n.local ? Rc : Ic)(n, e)); } function Oo(t) { return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView; } function Lc(t) { return function() { this.style.removeProperty(t); }; } function qc(t, e, n) { return function() { this.style.setProperty(t, e, n); }; } function Xc(t, e, n) { return function() { var r = e.apply(this, arguments); r == null ? this.style.removeProperty(t) : this.style.setProperty(t, r, n); }; } function Bc(t, e, n) { return arguments.length > 1 ? this.each((e == null ? Lc : typeof e == "function" ? Xc : qc)(t, e, n ?? "")) : Kt(this.node(), t); } function Kt(t, e) { return t.style.getPropertyValue(e) || Oo(t).getComputedStyle(t, null).getPropertyValue(e); } function Hc(t) { return function() { delete this[t]; }; } function Uc(t, e) { return function() { this[t] = e; }; } function Yc(t, e) { return function() { var n = e.apply(this, arguments); n == null ? delete this[t] : this[t] = n; }; } function Gc(t, e) { return arguments.length > 1 ? this.each((e == null ? Hc : typeof e == "function" ? Yc : Uc)(t, e)) : this.node()[t]; } function zo(t) { return t.trim().split(/^|\s+/); } function ai(t) { return t.classList || new Co(t); } function Co(t) { this._node = t, this._names = zo(t.getAttribute("class") || ""); } Co.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 Io(t, e) { for (var n = ai(t), r = -1, i = e.length; ++r < i; ) n.add(e[r]); } function Ro(t, e) { for (var n = ai(t), r = -1, i = e.length; ++r < i; ) n.remove(e[r]); } function Vc(t) { return function() { Io(this, t); }; } function Kc(t) { return function() { Ro(this, t); }; } function Wc(t, e) { return function() { (e.apply(this, arguments) ? Io : Ro)(this, t); }; } function Zc(t, e) { var n = zo(t + ""); if (arguments.length < 2) { for (var r = ai(this.node()), i = -1, a = n.length; ++i < a; ) if (!r.contains(n[i])) return !1; return !0; } return this.each((typeof e == "function" ? Wc : e ? Vc : Kc)(n, e)); } function Jc() { this.textContent = ""; } function Qc(t) { return function() { this.textContent = t; }; } function tl(t) { return function() { var e = t.apply(this, arguments); this.textContent = e ?? ""; }; } function el(t) { return arguments.length ? this.each(t == null ? Jc : (typeof t == "function" ? tl : Qc)(t)) : this.node().textContent; } function nl() { this.innerHTML = ""; } function rl(t) { return function() { this.innerHTML = t; }; } function il(t) { return function() { var e = t.apply(this, arguments); this.innerHTML = e ?? ""; }; } function al(t) { return arguments.length ? this.each(t == null ? nl : (typeof t == "function" ? il : rl)(t)) : this.node().innerHTML; } function ol() { this.nextSibling && this.parentNode.appendChild(this); } function sl() { return this.each(ol); } function ul() { this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild); } function cl() { return this.each(ul); } function ll(t) { var e = typeof t == "function" ? t : To(t); return this.select(function() { return this.appendChild(e.apply(this, arguments)); }); } function fl() { return null; } function hl(t, e) { var n = typeof t == "function" ? t : To(t), r = e == null ? fl : typeof e == "function" ? e : ii(e); return this.select(function() { return this.insertBefore(n.apply(this, arguments), r.apply(this, arguments) || null); }); } function dl() { var t = this.parentNode; t && t.removeChild(this); } function pl() { return this.each(dl); } function gl() { var t = this.cloneNode(!1), e = this.parentNode; return e ? e.insertBefore(t, this.nextSibling) : t; } function yl() { var t = this.cloneNode(!0), e = this.parentNode; return e ? e.insertBefore(t, this.nextSibling) : t; } function bl(t) { return this.select(t ? yl : gl); } function _l(t) { return arguments.length ? this.property("__data__", t) : this.node().__data__; } function vl(t) { return function(e) { t.call(this, e, this.__data__); }; } function ml(t) { return t.trim().split(/^|\s+/).map(function(e) { var n = "", r = e.indexOf("."); return r >= 0 && (n = e.slice(r + 1), e = e.slice(0, r)), { type: e, name: n }; }); } function wl(t) { return function() { var e = this.__on; if (e) { for (var n = 0, r = -1, i = e.length, a; n < i; ++n) a = e[n], (!t.type || a.type === t.type) && a.name === t.name ? this.removeEventListener(a.type, a.listener, a.options) : e[++r] = a; ++r ? e.length = r : delete this.__on; } }; } function xl(t, e, n) { return function() { var r = this.__on, i, a = vl(e); if (r) { for (var o = 0, s = r.length; o < s; ++o) if ((i = r[o]).type === t.type && i.name === t.name) { this.removeEventListener(i.type, i.listener, i.options), this.addEventListener(i.type, i.listener = a, i.options = n), i.value = e; return; } } this.addEventListener(t.type, a, n), i = { type: t.type, name: t.name, value: e, listener: a, options: n }, r ? r.push(i) : this.__on = [i]; }; } function Ml(t, e, n) { var r = ml(t + ""), i, a = r.length, o; if (arguments.length < 2) { var s = this.node().__on; if (s) { for (var c = 0, u = s.length, l; c < u; ++c) for (i = 0, l = s[c]; i < a; ++i) if ((o = r[i]).type === l.type && o.name === l.name) return l.value; } return; } for (s = e ? xl : wl, i = 0; i < a; ++i) this.each(s(r[i], e, n)); return this; } function jo(t, e, n) { var r = Oo(t), i = r.CustomEvent; typeof i == "function" ? i = new i(e, n) : (i = r.document.createEvent("Event"), n ? (i.initEvent(e, n.bubbles, n.cancelable), i.detail = n.detail) : i.initEvent(e, !1, !1)), t.dispatchEvent(i); } function Al(t, e) { return function() { return jo(this, t, e); }; } function $l(t, e) { return function() { return jo(this, t, e.apply(this, arguments)); }; } function Nl(t, e) { return this.each((typeof e == "function" ? $l : Al)(t, e)); } function* Tl() { for (var t = this._groups, e = 0, n = t.length; e < n; ++e) for (var r = t[e], i = 0, a = r.length, o; i < a; ++i) (o = r[i]) && (yield o); } var Fo = [null]; function L(t, e) { this._groups = t, this._parents = e; } function ke() { return new L([[document.documentElement]], Fo); } function Sl() { return this; } L.prototype = ke.prototype = { constructor: L, select: tc, selectAll: ic, selectChild: uc, selectChildren: hc, filter: dc, data: vc, enter: pc, exit: wc, join: xc, merge: Mc, selection: Sl, order: Ac, sort: $c, call: Tc, nodes: Sc, node: Pc, size: Ec, empty: kc, each: Oc, attr: Dc, style: Bc, property: Gc, classed: Zc, text: el, html: al, raise: sl, lower: cl, append: ll, insert: hl, remove: pl, clone: bl, datum: _l, on: Ml, dispatch: Nl, [Symbol.iterator]: Tl }; function Pl(t) { return typeof t == "string" ? new L([[document.querySelector(t)]], [document.documentElement]) : new L([[t]], Fo); } function oi(t, e, n) { t.prototype = e.prototype = n, n.constructor = t; } function Do(t, e) { var n = Object.create(t.prototype); for (var r in e) n[r] = e[r]; return n; } function Oe() { } var ve = 0.7, pn = 1 / ve, Yt = "\\s*([+-]?\\d+)\\s*", me = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", et = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", El = /^#([0-9a-f]{3,8})$/, kl = new RegExp(`^rgb\\(${Yt},${Yt},${Yt}\\)$`), Ol = new RegExp(`^rgb\\(${et},${et},${et}\\)$`), zl = new RegExp(`^rgba\\(${Yt},${Yt},${Yt},${me}\\)$`), Cl = new RegExp(`^rgba\\(${et},${et},${et},${me}\\)$`), Il = new RegExp(`^hsl\\(${me},${et},${et}\\)$`), Rl = new RegExp(`^hsla\\(${me},${et},${et},${me}\\)$`), Xi = { 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 }; oi(Oe, Ct, { copy(t) { return Object.assign(new this.constructor(), this, t); }, displayable() { return this.rgb().displayable(); }, hex: Bi, // Deprecated! Use color.formatHex. formatHex: Bi, formatHex8: jl, formatHsl: Fl, formatRgb: Hi, toString: Hi }); function Bi() { return this.rgb().formatHex(); } function jl() { return this.rgb().formatHex8(); } function Fl() { return Lo(this).formatHsl(); } function Hi() { return this.rgb().formatRgb(); } function Ct(t) { var e, n; return t = (t + "").trim().toLowerCase(), (e = El.exec(t)) ? (n = e[1].length, e = parseInt(e[1], 16), n === 6 ? Ui(e) : n === 3 ? new R(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : n === 8 ? Fe(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : n === 4 ? Fe(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 = kl.exec(t)) ? new R(e[1], e[2], e[3], 1) : (e = Ol.exec(t)) ? new R(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = zl.exec(t)) ? Fe(e[1], e[2], e[3], e[4]) : (e = Cl.exec(t)) ? Fe(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = Il.exec(t)) ? Vi(e[1], e[2] / 100, e[3] / 100, 1) : (e = Rl.exec(t)) ? Vi(e[1], e[2] / 100, e[3] / 100, e[4]) : Xi.hasOwnProperty(t) ? Ui(Xi[t]) : t === "transparent" ? new R(NaN, NaN, NaN, 0) : null; } function Ui(t) { return new R(t >> 16 & 255, t >> 8 & 255, t & 255, 1); } function Fe(t, e, n, r) { return r <= 0 && (t = e = n = NaN), new R(t, e, n, r); } function Dl(t) { return t instanceof Oe || (t = Ct(t)), t ? (t = t.rgb(), new R(t.r, t.g, t.b, t.opacity)) : new R(); } function gn(t, e, n, r) { return arguments.length === 1 ? Dl(t) : new R(t, e, n, r ?? 1); } function R(t, e, n, r) { this.r = +t, this.g = +e, this.b = +n, this.opacity = +r; } oi(R, gn, Do(Oe, { brighter(t) { return t = t == null ? pn : Math.pow(pn, t), new R(this.r * t, this.g * t, this.b * t, this.opacity); }, darker(t) { return t = t == null ? ve : Math.pow(ve, t), new R(this.r * t, this.g * t, this.b * t, this.opacity); }, rgb() { return this; }, clamp() { return new R(kt(this.r), kt(this.g), kt(this.b), yn(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: Yi, // Deprecated! Use color.formatHex. formatHex: Yi, formatHex8: Ll, formatRgb: Gi, toString: Gi })); function Yi() { return `#${Pt(this.r)}${Pt(this.g)}${Pt(this.b)}`; } function Ll() { return `#${Pt(this.r)}${Pt(this.g)}${Pt(this.b)}${Pt((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`; } function Gi() { const t = yn(this.opacity); return `${t === 1 ? "rgb(" : "rgba("}${kt(this.r)}, ${kt(this.g)}, ${kt(this.b)}${t === 1 ? ")" : `, ${t})`}`; } function yn(t) { return isNaN(t) ? 1 : Math.max(0, Math.min(1, t)); } function kt(t) { return Math.max(0, Math.min(255, Math.round(t) || 0)); } function Pt(t) { return t = kt(t), (t < 16 ? "0" : "") + t.toString(16); } function Vi(t, e, n, r) { return r <= 0 ? t = e = n = NaN : n <= 0 || n >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new K(t, e, n, r); } function Lo(t) { if (t instanceof K) return new K(t.h, t.s, t.l, t.opacity); if (t instanceof Oe || (t = Ct(t)), !t) return new K(); if (t instanceof K) return t; t = t.rgb(); var e = t.r / 255, n = t.g / 255, r = t.b / 255, i = Math.min(e, n, r), a = Math.max(e, n, r), o = NaN, s = a - i, c = (a + i) / 2; return s ? (e === a ? o = (n - r) / s + (n < r) * 6 : n === a ? o = (r - e) / s + 2 : o = (e - n) / s + 4, s /= c < 0.5 ? a + i : 2 - a - i, o *= 60) : s = c > 0 && c < 1 ? 0 : o, new K(o, s, c, t.opacity); } function ql(t, e, n, r) { return arguments.length === 1 ? Lo(t) : new K(t, e, n, r ?? 1); } function K(t, e, n, r) { this.h = +t, this.s = +e, this.l = +n, this.opacity = +r; } oi(K, ql, Do(Oe, { brighter(t) { return t = t == null ? pn : Math.pow(pn, t), new K(this.h, this.s, this.l * t, this.opacity); }, darker(t) { return t = t == null ? ve : Math.pow(ve, t), new K(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, r = n + (n < 0.5 ? n : 1 - n) * e, i = 2 * n - r; return new R( ur(t >= 240 ? t - 240 : t + 120, i, r), ur(t, i, r), ur(t < 120 ? t + 240 : t - 120, i, r), this.opacity ); }, clamp() { return new K(Ki(this.h), De(this.s), De(this.l), yn(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 = yn(this.opacity); return `${t === 1 ? "hsl(" : "hsla("}${Ki(this.h)}, ${De(this.s) * 100}%, ${De(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`; } })); function Ki(t) { return t = (t || 0) % 360, t < 0 ? t + 360 : t; } function De(t) { return Math.max(0, Math.min(1, t || 0)); } function ur(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 si = (t) => () => t; function Xl(t, e) { return function(n) { return t + n * e; }; } function Bl(t, e, n) { return t = Math.pow(t, n), e = Math.pow(e, n) - t, n = 1 / n, function(r) { return Math.pow(t + r * e, n); }; } function Hl(t) { return (t = +t) == 1 ? qo : function(e, n) { return n - e ? Bl(e, n, t) : si(isNaN(e) ? n : e); }; } function qo(t, e) { var n = e - t; return n ? Xl(t, n) : si(isNaN(t) ? e : t); } const wt = function t(e) { var n = Hl(e); function r(i, a) { var o = n((i = gn(i)).r, (a = gn(a)).r), s = n(i.g, a.g), c = n(i.b, a.b), u = qo(i.opacity, a.opacity); return function(l) { return i.r = o(l), i.g = s(l), i.b = c(l), i.opacity = u(l), i + ""; }; } return r.gamma = t, r; }(1); function Ul(t, e) { e || (e = []); var n = t ? Math.min(e.length, t.length) : 0, r = e.slice(), i; return function(a) { for (i = 0; i < n; ++i) r[i] = t[i] * (1 - a) + e[i] * a; return r; }; } function Yl(t) { return ArrayBuffer.isView(t) && !(t instanceof DataView); } function Gl(t, e) { var n = e ? e.length : 0, r = t ? Math.min(n, t.length) : 0, i = new Array(r), a = new Array(n), o; for (o = 0; o < r; ++o) i[o] = Rn(t[o], e[o]); for (; o < n; ++o) a[o] = e[o]; return function(s) { for (o = 0; o < r; ++o) a[o] = i[o](s); return a; }; } function Vl(t, e) { var n = /* @__PURE__ */ new Date(); return t = +t, e = +e, function(r) { return n.setTime(t * (1 - r) + e * r), n; }; } function G(t, e) { return t = +t, e = +e, function(n) { return t * (1 - n) + e * n; }; } function Kl(t, e) { var n = {}, r = {}, i; (t === null || typeof t != "object") && (t = {}), (e === null || typeof e != "object") && (e = {}); for (i in e) i in t ? n[i] = Rn(t[i], e[i]) : r[i] = e[i]; return function(a) { for (i in n) r[i] = n[i](a); return r; }; } var $r = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, cr = new RegExp($r.source, "g"); function Wl(t) { return function() { return t; }; } function Zl(t) { return function(e) { return t(e) + ""; }; } function Xo(t, e) { var n = $r.lastIndex = cr.lastIndex = 0, r, i, a, o = -1, s = [], c = []; for (t = t + "", e = e + ""; (r = $r.exec(t)) && (i = cr.exec(e)); ) (a = i.index) > n && (a = e.slice(n, a), s[o] ? s[o] += a : s[++o] = a), (r = r[0]) === (i = i[0]) ? s[o] ? s[o] += i : s[++o] = i : (s[++o] = null, c.push({ i: o, x: G(r, i) })), n = cr.lastIndex; return n < e.length && (a = e.slice(n), s[o] ? s[o] += a : s[++o] = a), s.length < 2 ? c[0] ? Zl(c[0].x) : Wl(e) : (e = c.length, function(u) { for (var l = 0, h; l < e; ++l) s[(h = c[l]).i] = h.x(u); return s.join(""); }); } function Rn(t, e) { var n = typeof e, r; return e == null || n === "boolean" ? si(e) : (n === "number" ? G : n === "string" ? (r = Ct(e)) ? (e = r, wt) : Xo : e instanceof Ct ? wt : e instanceof Date ? Vl : Yl(e) ? Ul : Array.isArray(e) ? Gl : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? Kl : G)(t, e); } function Jl(t, e) { return t = +t, e = +e, function(n) { return Math.round(t * (1 - n) + e * n); }; } var Wi = 180 / Math.PI, Nr = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }; function Bo(t, e, n, r, i, a) { var o, s, c; return (o = Math.sqrt(t * t + e * e)) && (t /= o, e /= o), (c = t * n + e * r) && (n -= t * c, r -= e * c), (s = Math.sqrt(n * n + r * r)) && (n /= s, r /= s, c /= s), t * r < e * n && (t = -t, e = -e, c = -c, o = -o), { translateX: i, translateY: a, rotate: Math.atan2(e, t) * Wi, skewX: Math.atan(c) * Wi, scaleX: o, scaleY: s }; } var Le; function Ql(t) { const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + ""); return e.isIdentity ? Nr : Bo(e.a, e.b, e.c, e.d, e.e, e.f); } function tf(t) { return t == null || (Le || (Le = document.createElementNS("http://www.w3.org/2000/svg", "g")), Le.setAttribute("transform", t), !(t = Le.transform.baseVal.consolidate())) ? Nr : (t = t.matrix, Bo(t.a, t.b, t.c, t.d, t.e, t.f)); } function Ho(t, e, n, r) { function i(u) { return u.length ? u.pop() + " " : ""; } function a(u, l, h, f, d, g) { if (u !== h || l !== f) { var b = d.push("translate(", null, e, null, n); g.push({ i: b - 4, x: G(u, h) }, { i: b - 2, x: G(l, f) }); } else (h || f) && d.push("translate(" + h + e + f + n); } function o(u, l, h, f) { u !== l ? (u - l > 180 ? l += 360 : l - u > 180 && (u += 360), f.push({ i: h.push(i(h) + "rotate(", null, r) - 2, x: G(u, l) })) : l && h.push(i(h) + "rotate(" + l + r); } function s(u, l, h, f) { u !== l ? f.push({ i: h.push(i(h) + "skewX(", null, r) - 2, x: G(u, l) }) : l && h.push(i(h) + "skewX(" + l + r); } function c(u, l, h, f, d, g) { if (u !== h || l !== f) { var b = d.push(i(d) + "scale(", null, ",", null, ")"); g.push({ i: b - 4, x: G(u, h) }, { i: b - 2, x: G(l, f) }); } else (h !== 1 || f !== 1) && d.push(i(d) + "scale(" + h + "," + f + ")"); } return function(u, l) { var h = [], f = []; return u = t(u), l = t(l), a(u.translateX, u.translateY, l.translateX, l.translateY, h, f), o(u.rotate, l.rotate, h, f), s(u.skewX, l.skewX, h, f), c(u.scaleX, u.scaleY, l.scaleX, l.scaleY, h, f), u = l = null, function(d) { for (var g = -1, b = f.length, m; ++g < b; ) h[(m = f[g]).i] = m.x(d); return h.join(""); }; }; } var ef = Ho(Ql, "px, ", "px)", "deg)"), nf = Ho(tf, ", ", ")", ")"); function qe(t, e) { e === void 0 && (e = t, t = Rn); for (var n = 0, r = e.length - 1, i = e[0], a = new Array(r < 0 ? 0 : r); n < r; ) a[n] = t(i, i = e[++n]); return function(o) { var s = Math.max(0, Math.min(r - 1, Math.floor(o *= r))); return a[s](o - s); }; } var Wt = 0, fe = 0, se = 0, Uo = 1e3, bn, he, _n = 0, It = 0, jn = 0, we = typeof performance == "object" && performance.now ? performance : Date, Yo = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) { setTimeout(t, 17); }; function Fn() { return It || (Yo(rf), It = we.now() + jn); } function rf() { It = 0; } function xe() { this._call = this._time = this._next = null; } xe.prototype = Go.prototype = { constructor: xe, restart: function(t, e, n) { if (typeof t != "function") throw new TypeError("callback is not a function"); n = (n == null ? Fn() : +n) + (e == null ? 0 : +e), !this._next && he !== this && (he ? he._next = this : bn = this, he = this), this._call = t, this._time = n, Tr(); }, stop: function() { this._call && (this._call = null, this._time = 1 / 0, Tr()); } }; function Go(t, e, n) { var r = new xe(); return r.restart(t, e, n), r; } function af() { Fn(), ++Wt; for (var t = bn, e; t; ) (e = It - t._time) >= 0 && t._call.call(void 0, e), t = t._next; --Wt; } function Zi() { It = (_n = we.now()) + jn, Wt = fe = 0; try { af(); } finally { Wt = 0, sf(), It = 0; } } function of() { var t = we.now(), e = t - _n; e > Uo && (jn -= e, _n = t); } function sf() { for (var t, e = bn, n, r = 1 / 0; e; ) e._call ? (r > e._time && (r = e._time), t = e, e = e._next) : (n = e._next, e._next = null, e = t ? t._next = n : bn = n); he = t, Tr(r); } function Tr(t) { if (!Wt) { fe && (fe = clearTimeout(fe)); var e = t - It; e > 24 ? (t < 1 / 0 && (fe = setTimeout(Zi, t - we.now() - jn)), se && (se = clearInterval(se))) : (se || (_n = we.now(), se = setInterval(of, Uo)), Wt = 1, Yo(Zi)); } } function Ji(t, e, n) { var r = new xe(); return e = e == null ? 0 : +e, r.restart((i) => { r.stop(), t(i + e); }, e, n), r; } function uf(t, e, n) { var r = new xe(), i = e; return r._restart = r.restart, r.restart = function(a, o, s) { o = +o, s = s == null ? Fn() : +s, r._restart(function c(u) { u += i, r._restart(c, i += o, s), a(u); }, o, s); }, r.restart(t, e, n), r; } var cf = No("start", "end", "cancel", "interrupt"), lf = [], Vo = 0, Qi = 1, Sr = 2, en = 3, ta = 4, Pr = 5, nn = 6; function Dn(t, e, n, r, i, a) { var o = t.__transition; if (!o) t.__transition = {}; else if (n in o) return; ff(t, n, { name: e, index: r, // For context during callback. group: i, // For context during callback. on: cf, tween: lf, time: a.time, delay: a.delay, duration: a.duration, ease: a.ease, timer: null, state: Vo }); } function ui(t, e) { var n = J(t, e); if (n.state > Vo) throw new Error("too late; already scheduled"); return n; } function it(t, e) { var n = J(t, e); if (n.state > en) throw new Error("too late; already running"); return n; } function J(t, e) { var n = t.__transition; if (!n || !(n = n[e])) throw new Error("transition not found"); return n; } function ff(t, e, n) { var r = t.__transition, i; r[e] = n, n.timer = Go(a, 0, n.time); function a(u) { n.state = Qi, n.timer.restart(o, n.delay, n.time), n.delay <= u && o(u - n.delay); } function o(u) { var l, h, f, d; if (n.state !== Qi) return c(); for (l in r) if (d = r[l], d.name === n.name) { if (d.state === en) return Ji(o); d.state === ta ? (d.state = nn, d.timer.stop(), d.on.call("interrupt", t, t.__data__, d.index, d.group), delete r[l]) : +l < e && (d.state = nn, d.timer.stop(), d.on.call("cancel", t, t.__data__, d.index, d.group), delete r[l]); } if (Ji(function() { n.state === en && (n.state = ta, n.timer.restart(s, n.delay, n.time), s(u)); }), n.state = Sr, n.on.call("start", t, t.__data__, n.index, n.group), n.state === Sr) { for (n.state = en, i = new Array(f = n.tween.length), l = 0, h = -1; l < f; ++l) (d = n.tween[l].value.call(t, t.__data__, n.index, n.group)) && (i[++h] = d); i.length = h + 1; } } function s(u) { for (var l = u < n.duration ? n.ease.call(null, u / n.duration) : (n.timer.restart(c), n.state = Pr, 1), h = -1, f = i.length; ++h < f; ) i[h].call(t, l); n.state === Pr && (n.on.call("end", t, t.__data__, n.index, n.group), c()); } function c() { n.state = nn, n.timer.stop(), delete r[e]; for (var u in r) return; delete t.__transition; } } function hf(t, e) { var n = t.__transition, r, i, a = !0, o; if (n) { e = e == null ? null : e + ""; for (o in n) { if ((r = n[o]).name !== e) { a = !1; continue; } i = r.state > Sr && r.state < Pr, r.state = nn, r.timer.stop(), r.on.call(i ? "interrupt" : "cancel", t, t.__data__, r.index, r.group), delete n[o]; } a && delete t.__transition; } } function df(t) { return this.each(function() { hf(this, t); }); } function pf(t, e) { var n, r; return function() { var i = it(this, t), a = i.tween; if (a !== n) { r = n = a; for (var o = 0, s = r.length; o < s; ++o) if (r[o].name === e) { r = r.slice(), r.splice(o, 1); break; } } i.tween = r; }; } function gf(t, e, n) { var r, i; if (typeof n != "function") throw new Error(); return function() { var a = it(this, t), o = a.tween; if (o !== r) { i = (r = o).slice(); for (var s = { name: e, value: n }, c = 0, u = i.length; c < u; ++c) if (i[c].name === e) { i[c] = s; break; } c === u && i.push(s); } a.tween = i; }; } function yf(t, e) { var n = this._id; if (t += "", arguments.length < 2) { for (var r = J(this.node(), n).tween, i = 0, a = r.length, o; i < a; ++i) if ((o = r[i]).name === t) return o.value; return null; } return this.each((e == null ? pf : gf)(n, t, e)); } function ci(t, e, n) { var r = t._id; return t.each(function() { var i = it(this, r); (i.value || (i.value = {}))[e] = n.apply(this, arguments); }), function(i) { return J(i, r).value[e]; }; } function Ko(t, e) { var n; return (typeof e == "number" ? G : e instanceof Ct ? wt : (n = Ct(e)) ? (e = n, wt) : Xo)(t, e); } function bf(t) { return function() { this.removeAttribute(t); }; } function _f(t) { return function() { this.removeAttributeNS(t.space, t.local); }; } function vf(t, e, n) { var r, i = n + "", a; return function() { var o = this.getAttribute(t); return o === i ? null : o === r ? a : a = e(r = o, n); }; } function mf(t, e, n) { var r, i = n + "", a; return function() { var o = this.getAttributeNS(t.space, t.local); return o === i ? null : o === r ? a : a = e(r = o, n); }; } function wf(t, e, n) { var r, i, a; return function() { var o, s = n(this), c; return s == null ? void this.removeAttribute(t) : (o = this.getAttribute(t), c = s + "", o === c ? null : o === r && c === i ? a : (i = c, a = e(r = o, s))); }; } function xf(t, e, n) { var r, i, a; return function() { var o, s = n(this), c; return s == null ? void this.removeAttributeNS(t.space, t.local) : (o = this.getAttributeNS(t.space, t.local), c = s + "", o === c ? null : o === r && c === i ? a : (i = c, a = e(r = o, s))); }; } function Mf(t, e) { var n = In(t), r = n === "transform" ? nf : Ko; return this.attrTween(t, typeof e == "function" ? (n.local ? xf : wf)(n, r, ci(this, "attr." + t, e)) : e == null ? (n.local ? _f : bf)(n) : (n.local ? mf : vf)(n, r, e)); } function Af(t, e) { return function(n) { this.setAttribute(t, e.call(this, n)); }; } function $f(t, e) { return function(n) { this.setAttributeNS(t.space, t.local, e.call(this, n)); }; } function Nf(t, e) { var n, r; function i() { var a = e.apply(this, arguments); return a !== r && (n = (r = a) && $f(t, a)), n; } return i._value = e, i; } function Tf(t, e) { var n, r; function i() { var a = e.apply(this, arguments); return a !== r && (n = (r = a) && Af(t, a)), n; } return i._value = e, i; } function Sf(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 r = In(t); return this.tween(n, (r.local ? Nf : Tf)(r, e)); } function Pf(t, e) { return function() { ui(this, t).delay = +e.apply(this, arguments); }; } function Ef(t, e) { return e = +e, function() { ui(this, t).delay = e; }; } function kf(t) { var e = this._id; return arguments.length ? this.each((typeof t == "function" ? Pf : Ef)(e, t)) : J(this.node(), e).delay; } function Of(t, e) { return function() { it(this, t).duration = +e.apply(this, arguments); }; } function zf(t, e) { return e = +e, function() { it(this, t).duration = e; }; } function Cf(t) { var e = this._id; return arguments.length ? this.each((typeof t == "function" ? Of : zf)(e, t)) : J(this.node(), e).duration; } function If(t, e) { if (typeof e != "function") throw new Error(); return function() { it(this, t).ease = e; }; } function Rf(t) { var e = this._id; return arguments.length ? this.each(If(e, t)) : J(this.node(), e).ease; } function jf(t, e) { return function() { var n = e.apply(this, arguments); if (typeof n != "function") throw new Error(); it(this, t).ease = n; }; } function Ff(t) { if (typeof t != "function") throw new Error(); return this.each(jf(this._id, t)); } function Df(t) { typeof t != "function" && (t = Po(t)); for (var e = this._groups, n = e.length, r = new Array(n), i = 0; i < n; ++i) for (var a = e[i], o = a.length, s = r[i] = [], c, u = 0; u < o; ++u) (c = a[u]) && t.call(c, c.__data__, u, a) && s.push(c); return new ft(r, this._parents, this._name, this._id); } function Lf(t) { if (t._id !== this._id) throw new Error(); for (var e = this._groups, n = t._groups, r = e.length, i = n.length, a = Math.min(r, i), o = new Array(r), s = 0; s < a; ++s) for (var c = e[s], u = n[s], l = c.length, h = o[s] = new Array(l), f, d = 0; d < l; ++d) (f = c[d] || u[d]) && (h[d] = f); for (; s < r; ++s) o[s] = e[s]; return new ft(o, this._parents, this._name, this._id); } function qf(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 Xf(t, e, n) { var r, i, a = qf(e) ? ui : it; return function() { var o = a(this, t), s = o.on; s !== r && (i = (r = s).copy()).on(e, n), o.on = i; }; } function Bf(t, e) { var n = this._id; return arguments.length < 2 ? J(this.node(), n).on.on(t) : this.each(Xf(n, t, e)); } function Hf(t) { return function() { var e = this.parentNode; for (var n in this.__transition) if (+n !== t) return; e && e.removeChild(this); }; } function Uf() { return this.on("end.remove", Hf(this._id)); } function Yf(t) { var e = this._name, n = this._id; typeof t != "function" && (t = ii(t)); for (var r = this._groups, i = r.length, a = new Array(i), o = 0; o < i; ++o) for (var s = r[o], c = s.length, u = a[o] = new Array(c), l, h, f = 0; f < c; ++f) (l = s[f]) && (h = t.call(l, l.__data__, f, s)) && ("__data__" in l && (h.__data__ = l.__data__), u[f] = h, Dn(u[f], e, n, f