Code Duplication    Length = 3165-3193 lines in 2 locations

demo/hill-chart.umd.js 1 location

@@ 1-3193 (lines=3193) @@
1
!(function (t, n) {
2
  'object' == typeof exports && 'undefined' != typeof module
3
    ? (module.exports = n())
4
    : 'function' == typeof define && define.amd
5
    ? define(n)
6
    : ((t = t || self).HillChart = n());
7
})(this, function () {
8
  'use strict';
9
  function t(t, n) {
10
    for (var e = 0; e < n.length; e++) {
11
      var r = n[e];
12
      (r.enumerable = r.enumerable || !1),
13
        (r.configurable = !0),
14
        'value' in r && (r.writable = !0),
15
        Object.defineProperty(t, r.key, r);
16
    }
17
  }
18
  function n(t, n, e) {
19
    return (
20
      n in t
21
        ? Object.defineProperty(t, n, {
22
            value: e,
23
            enumerable: !0,
24
            configurable: !0,
25
            writable: !0,
26
          })
27
        : (t[n] = e),
28
      t
29
    );
30
  }
31
  function e(t, n) {
32
    var e = Object.keys(t);
33
    if (Object.getOwnPropertySymbols) {
34
      var r = Object.getOwnPropertySymbols(t);
35
      n &&
36
        (r = r.filter(function (n) {
37
          return Object.getOwnPropertyDescriptor(t, n).enumerable;
38
        })),
39
        e.push.apply(e, r);
40
    }
41
    return e;
42
  }
43
  function r(t) {
44
    for (var r = 1; r < arguments.length; r++) {
45
      var i = null != arguments[r] ? arguments[r] : {};
46
      r % 2
47
        ? e(Object(i), !0).forEach(function (e) {
48
            n(t, e, i[e]);
49
          })
50
        : Object.getOwnPropertyDescriptors
51
        ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i))
52
        : e(Object(i)).forEach(function (n) {
53
            Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(i, n));
54
          });
55
    }
56
    return t;
57
  }
58
  function i(t) {
59
    return (i = Object.setPrototypeOf
60
      ? Object.getPrototypeOf
61
      : function (t) {
62
          return t.__proto__ || Object.getPrototypeOf(t);
63
        })(t);
64
  }
65
  function o(t, n) {
66
    return (o =
67
      Object.setPrototypeOf ||
68
      function (t, n) {
69
        return (t.__proto__ = n), t;
70
      })(t, n);
71
  }
72
  function a(t) {
73
    if (void 0 === t)
74
      throw new ReferenceError(
75
        "this hasn't been initialised - super() hasn't been called"
76
      );
77
    return t;
78
  }
79
  function u(t, n) {
80
    return !n || ('object' != typeof n && 'function' != typeof n) ? a(t) : n;
81
  }
82
  function s(t) {
83
    var n = (function () {
84
      if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
85
      if (Reflect.construct.sham) return !1;
86
      if ('function' == typeof Proxy) return !0;
87
      try {
88
        return (
89
          Date.prototype.toString.call(
90
            Reflect.construct(Date, [], function () {})
91
          ),
92
          !0
93
        );
94
      } catch (t) {
95
        return !1;
96
      }
97
    })();
98
    return function () {
99
      var e,
100
        r = i(t);
101
      if (n) {
102
        var o = i(this).constructor;
103
        e = Reflect.construct(r, arguments, o);
104
      } else e = r.apply(this, arguments);
105
      return u(this, e);
106
    };
107
  }
108
  var c = (function () {
109
    function t(t, n) {
110
      for (var e = 0; e < n.length; e++) {
111
        var r = n[e];
112
        (r.enumerable = r.enumerable || !1),
113
          (r.configurable = !0),
114
          'value' in r && (r.writable = !0),
115
          Object.defineProperty(t, r.key, r);
116
      }
117
    }
118
    return function (n, e, r) {
119
      return e && t(n.prototype, e), r && t(n, r), n;
120
    };
121
  })();
122
  function l(t, n) {
123
    if (!(t instanceof n))
124
      throw new TypeError('Cannot call a class as a function');
125
  }
126
  var h = { emitDelay: 10, strictMode: !1 },
127
    f = (function () {
128
      function t() {
129
        var n =
130
          arguments.length <= 0 || void 0 === arguments[0] ? h : arguments[0];
131
        l(this, t);
132
        var e = void 0,
133
          r = void 0;
134
        (e = n.hasOwnProperty('emitDelay') ? n.emitDelay : h.emitDelay),
135
          (this._emitDelay = e),
136
          (r = n.hasOwnProperty('strictMode') ? n.strictMode : h.strictMode),
137
          (this._strictMode = r),
138
          (this._listeners = {}),
139
          (this.events = []);
140
      }
141
      return (
142
        c(t, [
143
          {
144
            key: '_addListenner',
145
            value: function (t, n, e) {
146
              if ('function' != typeof n)
147
                throw TypeError('listener must be a function');
148
              -1 === this.events.indexOf(t)
149
                ? ((this._listeners[t] = [{ once: e, fn: n }]),
150
                  this.events.push(t))
151
                : this._listeners[t].push({ once: e, fn: n });
152
            },
153
          },
154
          {
155
            key: 'on',
156
            value: function (t, n) {
157
              this._addListenner(t, n, !1);
158
            },
159
          },
160
          {
161
            key: 'once',
162
            value: function (t, n) {
163
              this._addListenner(t, n, !0);
164
            },
165
          },
166
          {
167
            key: 'off',
168
            value: function (t, n) {
169
              var e,
170
                r,
171
                i = this,
172
                o = this.events.indexOf(t);
173
              t &&
174
                -1 !== o &&
175
                (n
176
                  ? ((e = []),
177
                    (r = i._listeners[t]).forEach(function (t, r) {
178
                      t.fn === n && e.unshift(r);
179
                    }),
180
                    e.forEach(function (t) {
181
                      r.splice(t, 1);
182
                    }),
183
                    r.length || (i.events.splice(o, 1), delete i._listeners[t]))
184
                  : (delete this._listeners[t], this.events.splice(o, 1)));
185
            },
186
          },
187
          {
188
            key: '_applyEvents',
189
            value: function (t, n) {
190
              var e = this._listeners[t];
191
              if (e && e.length) {
192
                var r = [];
193
                e.forEach(function (t, e) {
194
                  t.fn.apply(null, n), t.once && r.unshift(e);
195
                }),
196
                  r.forEach(function (t) {
197
                    e.splice(t, 1);
198
                  });
199
              } else if (this._strictMode)
200
                throw 'No listeners specified for event: ' + t;
201
            },
202
          },
203
          {
204
            key: 'emit',
205
            value: function (t) {
206
              for (
207
                var n = this,
208
                  e = arguments.length,
209
                  r = Array(e > 1 ? e - 1 : 0),
210
                  i = 1;
211
                i < e;
212
                i++
213
              )
214
                r[i - 1] = arguments[i];
215
              this._emitDelay
216
                ? setTimeout(function () {
217
                    n._applyEvents.call(n, t, r);
218
                  }, this._emitDelay)
219
                : this._applyEvents(t, r);
220
            },
221
          },
222
          {
223
            key: 'emitSync',
224
            value: function (t) {
225
              for (
226
                var n = arguments.length, e = Array(n > 1 ? n - 1 : 0), r = 1;
227
                r < n;
228
                r++
229
              )
230
                e[r - 1] = arguments[r];
231
              this._applyEvents(t, e);
232
            },
233
          },
234
          {
235
            key: 'destroy',
236
            value: function () {
237
              (this._listeners = {}), (this.events = []);
238
            },
239
          },
240
        ]),
241
        t
242
      );
243
    })(),
244
    p = 'http://www.w3.org/1999/xhtml',
245
    d = {
246
      svg: 'http://www.w3.org/2000/svg',
247
      xhtml: p,
248
      xlink: 'http://www.w3.org/1999/xlink',
249
      xml: 'http://www.w3.org/XML/1998/namespace',
250
      xmlns: 'http://www.w3.org/2000/xmlns/',
251
    };
252
  function g(t) {
253
    var n = (t += ''),
254
      e = n.indexOf(':');
255
    return (
256
      e >= 0 && 'xmlns' !== (n = t.slice(0, e)) && (t = t.slice(e + 1)),
257
      d.hasOwnProperty(n) ? { space: d[n], local: t } : t
258
    );
259
  }
260
  function y(t) {
261
    return function () {
262
      var n = this.ownerDocument,
263
        e = this.namespaceURI;
264
      return e === p && n.documentElement.namespaceURI === p
265
        ? n.createElement(t)
266
        : n.createElementNS(e, t);
267
    };
268
  }
269
  function v(t) {
270
    return function () {
271
      return this.ownerDocument.createElementNS(t.space, t.local);
272
    };
273
  }
274
  function m(t) {
275
    var n = g(t);
276
    return (n.local ? v : y)(n);
277
  }
278
  function _() {}
279
  function w(t) {
280
    return null == t
281
      ? _
282
      : function () {
283
          return this.querySelector(t);
284
        };
285
  }
286
  function x() {
287
    return [];
288
  }
289
  function b(t) {
290
    return new Array(t.length);
291
  }
292
  function M(t, n) {
293
    (this.ownerDocument = t.ownerDocument),
294
      (this.namespaceURI = t.namespaceURI),
295
      (this._next = null),
296
      (this._parent = t),
297
      (this.__data__ = n);
298
  }
299
  M.prototype = {
300
    constructor: M,
301
    appendChild: function (t) {
302
      return this._parent.insertBefore(t, this._next);
303
    },
304
    insertBefore: function (t, n) {
305
      return this._parent.insertBefore(t, n);
306
    },
307
    querySelector: function (t) {
308
      return this._parent.querySelector(t);
309
    },
310
    querySelectorAll: function (t) {
311
      return this._parent.querySelectorAll(t);
312
    },
313
  };
314
  function k(t, n, e, r, i, o) {
315
    for (var a, u = 0, s = n.length, c = o.length; u < c; ++u)
316
      (a = n[u]) ? ((a.__data__ = o[u]), (r[u] = a)) : (e[u] = new M(t, o[u]));
317
    for (; u < s; ++u) (a = n[u]) && (i[u] = a);
318
  }
319
  function N(t, n, e, r, i, o, a) {
320
    var u,
321
      s,
322
      c,
323
      l = {},
324
      h = n.length,
325
      f = o.length,
326
      p = new Array(h);
327
    for (u = 0; u < h; ++u)
328
      (s = n[u]) &&
329
        ((p[u] = c = '$' + a.call(s, s.__data__, u, n)),
330
        c in l ? (i[u] = s) : (l[c] = s));
331
    for (u = 0; u < f; ++u)
332
      (s = l[(c = '$' + a.call(t, o[u], u, o))])
333
        ? ((r[u] = s), (s.__data__ = o[u]), (l[c] = null))
334
        : (e[u] = new M(t, o[u]));
335
    for (u = 0; u < h; ++u) (s = n[u]) && l[p[u]] === s && (i[u] = s);
336
  }
337
  function S(t, n) {
338
    return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN;
339
  }
340
  function A(t) {
341
    return function () {
342
      this.removeAttribute(t);
343
    };
344
  }
345
  function E(t) {
346
    return function () {
347
      this.removeAttributeNS(t.space, t.local);
348
    };
349
  }
350
  function P(t, n) {
351
    return function () {
352
      this.setAttribute(t, n);
353
    };
354
  }
355
  function O(t, n) {
356
    return function () {
357
      this.setAttributeNS(t.space, t.local, n);
358
    };
359
  }
360
  function j(t, n) {
361
    return function () {
362
      var e = n.apply(this, arguments);
363
      null == e ? this.removeAttribute(t) : this.setAttribute(t, e);
364
    };
365
  }
366
  function T(t, n) {
367
    return function () {
368
      var e = n.apply(this, arguments);
369
      null == e
370
        ? this.removeAttributeNS(t.space, t.local)
371
        : this.setAttributeNS(t.space, t.local, e);
372
    };
373
  }
374
  function C(t) {
375
    return (
376
      (t.ownerDocument && t.ownerDocument.defaultView) ||
377
      (t.document && t) ||
378
      t.defaultView
379
    );
380
  }
381
  function L(t) {
382
    return function () {
383
      this.style.removeProperty(t);
384
    };
385
  }
386
  function z(t, n, e) {
387
    return function () {
388
      this.style.setProperty(t, n, e);
389
    };
390
  }
391
  function D(t, n, e) {
392
    return function () {
393
      var r = n.apply(this, arguments);
394
      null == r
395
        ? this.style.removeProperty(t)
396
        : this.style.setProperty(t, r, e);
397
    };
398
  }
399
  function q(t, n) {
400
    return (
401
      t.style.getPropertyValue(n) ||
402
      C(t).getComputedStyle(t, null).getPropertyValue(n)
403
    );
404
  }
405
  function R(t) {
406
    return function () {
407
      delete this[t];
408
    };
409
  }
410
  function H(t, n) {
411
    return function () {
412
      this[t] = n;
413
    };
414
  }
415
  function I(t, n) {
416
    return function () {
417
      var e = n.apply(this, arguments);
418
      null == e ? delete this[t] : (this[t] = e);
419
    };
420
  }
421
  function V(t) {
422
    return t.trim().split(/^|\s+/);
423
  }
424
  function $(t) {
425
    return t.classList || new B(t);
426
  }
427
  function B(t) {
428
    (this._node = t), (this._names = V(t.getAttribute('class') || ''));
429
  }
430
  function F(t, n) {
431
    for (var e = $(t), r = -1, i = n.length; ++r < i; ) e.add(n[r]);
432
  }
433
  function U(t, n) {
434
    for (var e = $(t), r = -1, i = n.length; ++r < i; ) e.remove(n[r]);
435
  }
436
  function X(t) {
437
    return function () {
438
      F(this, t);
439
    };
440
  }
441
  function W(t) {
442
    return function () {
443
      U(this, t);
444
    };
445
  }
446
  function Y(t, n) {
447
    return function () {
448
      (n.apply(this, arguments) ? F : U)(this, t);
449
    };
450
  }
451
  function G() {
452
    this.textContent = '';
453
  }
454
  function Z(t) {
455
    return function () {
456
      this.textContent = t;
457
    };
458
  }
459
  function K(t) {
460
    return function () {
461
      var n = t.apply(this, arguments);
462
      this.textContent = null == n ? '' : n;
463
    };
464
  }
465
  function Q() {
466
    this.innerHTML = '';
467
  }
468
  function J(t) {
469
    return function () {
470
      this.innerHTML = t;
471
    };
472
  }
473
  function tt(t) {
474
    return function () {
475
      var n = t.apply(this, arguments);
476
      this.innerHTML = null == n ? '' : n;
477
    };
478
  }
479
  function nt() {
480
    this.nextSibling && this.parentNode.appendChild(this);
481
  }
482
  function et() {
483
    this.previousSibling &&
484
      this.parentNode.insertBefore(this, this.parentNode.firstChild);
485
  }
486
  function rt() {
487
    return null;
488
  }
489
  function it() {
490
    var t = this.parentNode;
491
    t && t.removeChild(this);
492
  }
493
  function ot() {
494
    var t = this.cloneNode(!1),
495
      n = this.parentNode;
496
    return n ? n.insertBefore(t, this.nextSibling) : t;
497
  }
498
  function at() {
499
    var t = this.cloneNode(!0),
500
      n = this.parentNode;
501
    return n ? n.insertBefore(t, this.nextSibling) : t;
502
  }
503
  B.prototype = {
504
    add: function (t) {
505
      this._names.indexOf(t) < 0 &&
506
        (this._names.push(t),
507
        this._node.setAttribute('class', this._names.join(' ')));
508
    },
509
    remove: function (t) {
510
      var n = this._names.indexOf(t);
511
      n >= 0 &&
512
        (this._names.splice(n, 1),
513
        this._node.setAttribute('class', this._names.join(' ')));
514
    },
515
    contains: function (t) {
516
      return this._names.indexOf(t) >= 0;
517
    },
518
  };
519
  var ut = {},
520
    st = null;
521
  'undefined' != typeof document &&
522
    ('onmouseenter' in document.documentElement ||
523
      (ut = { mouseenter: 'mouseover', mouseleave: 'mouseout' }));
524
  function ct(t, n, e) {
525
    return (
526
      (t = lt(t, n, e)),
527
      function (n) {
528
        var e = n.relatedTarget;
529
        (e && (e === this || 8 & e.compareDocumentPosition(this))) ||
530
          t.call(this, n);
531
      }
532
    );
533
  }
534
  function lt(t, n, e) {
535
    return function (r) {
536
      var i = st;
537
      st = r;
538
      try {
539
        t.call(this, this.__data__, n, e);
540
      } finally {
541
        st = i;
542
      }
543
    };
544
  }
545
  function ht(t) {
546
    return t
547
      .trim()
548
      .split(/^|\s+/)
549
      .map(function (t) {
550
        var n = '',
551
          e = t.indexOf('.');
552
        return (
553
          e >= 0 && ((n = t.slice(e + 1)), (t = t.slice(0, e))),
554
          { type: t, name: n }
555
        );
556
      });
557
  }
558
  function ft(t) {
559
    return function () {
560
      var n = this.__on;
561
      if (n) {
562
        for (var e, r = 0, i = -1, o = n.length; r < o; ++r)
563
          (e = n[r]),
564
            (t.type && e.type !== t.type) || e.name !== t.name
565
              ? (n[++i] = e)
566
              : this.removeEventListener(e.type, e.listener, e.capture);
567
        ++i ? (n.length = i) : delete this.__on;
568
      }
569
    };
570
  }
571
  function pt(t, n, e) {
572
    var r = ut.hasOwnProperty(t.type) ? ct : lt;
573
    return function (i, o, a) {
574
      var u,
575
        s = this.__on,
576
        c = r(n, o, a);
577
      if (s)
578
        for (var l = 0, h = s.length; l < h; ++l)
579
          if ((u = s[l]).type === t.type && u.name === t.name)
580
            return (
581
              this.removeEventListener(u.type, u.listener, u.capture),
582
              this.addEventListener(u.type, (u.listener = c), (u.capture = e)),
583
              void (u.value = n)
584
            );
585
      this.addEventListener(t.type, c, e),
586
        (u = { type: t.type, name: t.name, value: n, listener: c, capture: e }),
587
        s ? s.push(u) : (this.__on = [u]);
588
    };
589
  }
590
  function dt(t, n, e, r) {
591
    var i = st;
592
    (t.sourceEvent = st), (st = t);
593
    try {
594
      return n.apply(e, r);
595
    } finally {
596
      st = i;
597
    }
598
  }
599
  function gt(t, n, e) {
600
    var r = C(t),
601
      i = r.CustomEvent;
602
    'function' == typeof i
603
      ? (i = new i(n, e))
604
      : ((i = r.document.createEvent('Event')),
605
        e
606
          ? (i.initEvent(n, e.bubbles, e.cancelable), (i.detail = e.detail))
607
          : i.initEvent(n, !1, !1)),
608
      t.dispatchEvent(i);
609
  }
610
  function yt(t, n) {
611
    return function () {
612
      return gt(this, t, n);
613
    };
614
  }
615
  function vt(t, n) {
616
    return function () {
617
      return gt(this, t, n.apply(this, arguments));
618
    };
619
  }
620
  var mt = [null];
621
  function _t(t, n) {
622
    (this._groups = t), (this._parents = n);
623
  }
624
  function wt(t) {
625
    return 'string' == typeof t
626
      ? new _t([[document.querySelector(t)]], [document.documentElement])
627
      : new _t([[t]], mt);
628
  }
629
  function xt() {
630
    for (var t, n = st; (t = n.sourceEvent); ) n = t;
631
    return n;
632
  }
633
  function bt(t, n) {
634
    var e = t.ownerSVGElement || t;
635
    if (e.createSVGPoint) {
636
      var r = e.createSVGPoint();
637
      return (
638
        (r.x = n.clientX),
639
        (r.y = n.clientY),
640
        [(r = r.matrixTransform(t.getScreenCTM().inverse())).x, r.y]
641
      );
642
    }
643
    var i = t.getBoundingClientRect();
644
    return [n.clientX - i.left - t.clientLeft, n.clientY - i.top - t.clientTop];
645
  }
646
  function Mt(t) {
647
    var n = xt();
648
    return n.changedTouches && (n = n.changedTouches[0]), bt(t, n);
649
  }
650
  function kt(t, n, e) {
651
    arguments.length < 3 && ((e = n), (n = xt().changedTouches));
652
    for (var r, i = 0, o = n ? n.length : 0; i < o; ++i)
653
      if ((r = n[i]).identifier === e) return bt(t, r);
654
    return null;
655
  }
656
  function Nt(t, n) {
657
    return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN;
658
  }
659
  _t.prototype = function () {
660
    return new _t([[document.documentElement]], mt);
661
  }.prototype = {
662
    constructor: _t,
663
    select: function (t) {
664
      'function' != typeof t && (t = w(t));
665
      for (
666
        var n = this._groups, e = n.length, r = new Array(e), i = 0;
667
        i < e;
668
        ++i
669
      )
670
        for (
671
          var o, a, u = n[i], s = u.length, c = (r[i] = new Array(s)), l = 0;
672
          l < s;
673
          ++l
674
        )
675
          (o = u[l]) &&
676
            (a = t.call(o, o.__data__, l, u)) &&
677
            ('__data__' in o && (a.__data__ = o.__data__), (c[l] = a));
678
      return new _t(r, this._parents);
679
    },
680
    selectAll: function (t) {
681
      'function' != typeof t &&
682
        (t = (function (t) {
683
          return null == t
684
            ? x
685
            : function () {
686
                return this.querySelectorAll(t);
687
              };
688
        })(t));
689
      for (
690
        var n = this._groups, e = n.length, r = [], i = [], o = 0;
691
        o < e;
692
        ++o
693
      )
694
        for (var a, u = n[o], s = u.length, c = 0; c < s; ++c)
695
          (a = u[c]) && (r.push(t.call(a, a.__data__, c, u)), i.push(a));
696
      return new _t(r, i);
697
    },
698
    filter: function (t) {
699
      'function' != typeof t &&
700
        (t = (function (t) {
701
          return function () {
702
            return this.matches(t);
703
          };
704
        })(t));
705
      for (
706
        var n = this._groups, e = n.length, r = new Array(e), i = 0;
707
        i < e;
708
        ++i
709
      )
710
        for (var o, a = n[i], u = a.length, s = (r[i] = []), c = 0; c < u; ++c)
711
          (o = a[c]) && t.call(o, o.__data__, c, a) && s.push(o);
712
      return new _t(r, this._parents);
713
    },
714
    data: function (t, n) {
715
      if (!t)
716
        return (
717
          (p = new Array(this.size())),
718
          (c = -1),
719
          this.each(function (t) {
720
            p[++c] = t;
721
          }),
722
          p
723
        );
724
      var e = n ? N : k,
725
        r = this._parents,
726
        i = this._groups;
727
      'function' != typeof t &&
728
        (t = (function (t) {
729
          return function () {
730
            return t;
731
          };
732
        })(t));
733
      for (
734
        var o = i.length,
735
          a = new Array(o),
736
          u = new Array(o),
737
          s = new Array(o),
738
          c = 0;
739
        c < o;
740
        ++c
741
      ) {
742
        var l = r[c],
743
          h = i[c],
744
          f = h.length,
745
          p = t.call(l, l && l.__data__, c, r),
746
          d = p.length,
747
          g = (u[c] = new Array(d)),
748
          y = (a[c] = new Array(d));
749
        e(l, h, g, y, (s[c] = new Array(f)), p, n);
750
        for (var v, m, _ = 0, w = 0; _ < d; ++_)
751
          if ((v = g[_])) {
752
            for (_ >= w && (w = _ + 1); !(m = y[w]) && ++w < d; );
753
            v._next = m || null;
754
          }
755
      }
756
      return ((a = new _t(a, r))._enter = u), (a._exit = s), a;
757
    },
758
    enter: function () {
759
      return new _t(this._enter || this._groups.map(b), this._parents);
760
    },
761
    exit: function () {
762
      return new _t(this._exit || this._groups.map(b), this._parents);
763
    },
764
    join: function (t, n, e) {
765
      var r = this.enter(),
766
        i = this,
767
        o = this.exit();
768
      return (
769
        (r = 'function' == typeof t ? t(r) : r.append(t + '')),
770
        null != n && (i = n(i)),
771
        null == e ? o.remove() : e(o),
772
        r && i ? r.merge(i).order() : i
773
      );
774
    },
775
    merge: function (t) {
776
      for (
777
        var n = this._groups,
778
          e = t._groups,
779
          r = n.length,
780
          i = e.length,
781
          o = Math.min(r, i),
782
          a = new Array(r),
783
          u = 0;
784
        u < o;
785
        ++u
786
      )
787
        for (
788
          var s,
789
            c = n[u],
790
            l = e[u],
791
            h = c.length,
792
            f = (a[u] = new Array(h)),
793
            p = 0;
794
          p < h;
795
          ++p
796
        )
797
          (s = c[p] || l[p]) && (f[p] = s);
798
      for (; u < r; ++u) a[u] = n[u];
799
      return new _t(a, this._parents);
800
    },
801
    order: function () {
802
      for (var t = this._groups, n = -1, e = t.length; ++n < e; )
803
        for (var r, i = t[n], o = i.length - 1, a = i[o]; --o >= 0; )
804
          (r = i[o]) &&
805
            (a &&
806
              4 ^ r.compareDocumentPosition(a) &&
807
              a.parentNode.insertBefore(r, a),
808
            (a = r));
809
      return this;
810
    },
811
    sort: function (t) {
812
      function n(n, e) {
813
        return n && e ? t(n.__data__, e.__data__) : !n - !e;
814
      }
815
      t || (t = S);
816
      for (
817
        var e = this._groups, r = e.length, i = new Array(r), o = 0;
818
        o < r;
819
        ++o
820
      ) {
821
        for (
822
          var a, u = e[o], s = u.length, c = (i[o] = new Array(s)), l = 0;
823
          l < s;
824
          ++l
825
        )
826
          (a = u[l]) && (c[l] = a);
827
        c.sort(n);
828
      }
829
      return new _t(i, this._parents).order();
830
    },
831
    call: function () {
832
      var t = arguments[0];
833
      return (arguments[0] = this), t.apply(null, arguments), this;
834
    },
835
    nodes: function () {
836
      var t = new Array(this.size()),
837
        n = -1;
838
      return (
839
        this.each(function () {
840
          t[++n] = this;
841
        }),
842
        t
843
      );
844
    },
845
    node: function () {
846
      for (var t = this._groups, n = 0, e = t.length; n < e; ++n)
847
        for (var r = t[n], i = 0, o = r.length; i < o; ++i) {
848
          var a = r[i];
849
          if (a) return a;
850
        }
851
      return null;
852
    },
853
    size: function () {
854
      var t = 0;
855
      return (
856
        this.each(function () {
857
          ++t;
858
        }),
859
        t
860
      );
861
    },
862
    empty: function () {
863
      return !this.node();
864
    },
865
    each: function (t) {
866
      for (var n = this._groups, e = 0, r = n.length; e < r; ++e)
867
        for (var i, o = n[e], a = 0, u = o.length; a < u; ++a)
868
          (i = o[a]) && t.call(i, i.__data__, a, o);
869
      return this;
870
    },
871
    attr: function (t, n) {
872
      var e = g(t);
873
      if (arguments.length < 2) {
874
        var r = this.node();
875
        return e.local ? r.getAttributeNS(e.space, e.local) : r.getAttribute(e);
876
      }
877
      return this.each(
878
        (null == n
879
          ? e.local
880
            ? E
881
            : A
882
          : 'function' == typeof n
883
          ? e.local
884
            ? T
885
            : j
886
          : e.local
887
          ? O
888
          : P)(e, n)
889
      );
890
    },
891
    style: function (t, n, e) {
892
      return arguments.length > 1
893
        ? this.each(
894
            (null == n ? L : 'function' == typeof n ? D : z)(
895
              t,
896
              n,
897
              null == e ? '' : e
898
            )
899
          )
900
        : q(this.node(), t);
901
    },
902
    property: function (t, n) {
903
      return arguments.length > 1
904
        ? this.each((null == n ? R : 'function' == typeof n ? I : H)(t, n))
905
        : this.node()[t];
906
    },
907
    classed: function (t, n) {
908
      var e = V(t + '');
909
      if (arguments.length < 2) {
910
        for (var r = $(this.node()), i = -1, o = e.length; ++i < o; )
911
          if (!r.contains(e[i])) return !1;
912
        return !0;
913
      }
914
      return this.each(('function' == typeof n ? Y : n ? X : W)(e, n));
915
    },
916
    text: function (t) {
917
      return arguments.length
918
        ? this.each(null == t ? G : ('function' == typeof t ? K : Z)(t))
919
        : this.node().textContent;
920
    },
921
    html: function (t) {
922
      return arguments.length
923
        ? this.each(null == t ? Q : ('function' == typeof t ? tt : J)(t))
924
        : this.node().innerHTML;
925
    },
926
    raise: function () {
927
      return this.each(nt);
928
    },
929
    lower: function () {
930
      return this.each(et);
931
    },
932
    append: function (t) {
933
      var n = 'function' == typeof t ? t : m(t);
934
      return this.select(function () {
935
        return this.appendChild(n.apply(this, arguments));
936
      });
937
    },
938
    insert: function (t, n) {
939
      var e = 'function' == typeof t ? t : m(t),
940
        r = null == n ? rt : 'function' == typeof n ? n : w(n);
941
      return this.select(function () {
942
        return this.insertBefore(
943
          e.apply(this, arguments),
944
          r.apply(this, arguments) || null
945
        );
946
      });
947
    },
948
    remove: function () {
949
      return this.each(it);
950
    },
951
    clone: function (t) {
952
      return this.select(t ? at : ot);
953
    },
954
    datum: function (t) {
955
      return arguments.length
956
        ? this.property('__data__', t)
957
        : this.node().__data__;
958
    },
959
    on: function (t, n, e) {
960
      var r,
961
        i,
962
        o = ht(t + ''),
963
        a = o.length;
964
      if (!(arguments.length < 2)) {
965
        for (u = n ? pt : ft, null == e && (e = !1), r = 0; r < a; ++r)
966
          this.each(u(o[r], n, e));
967
        return this;
968
      }
969
      var u = this.node().__on;
970
      if (u)
971
        for (var s, c = 0, l = u.length; c < l; ++c)
972
          for (r = 0, s = u[c]; r < a; ++r)
973
            if ((i = o[r]).type === s.type && i.name === s.name) return s.value;
974
    },
975
    dispatch: function (t, n) {
976
      return this.each(('function' == typeof n ? vt : yt)(t, n));
977
    },
978
  };
979
  var St,
980
    At,
981
    Et = (1 === (St = Nt).length &&
982
      ((At = St),
983
      (St = function (t, n) {
984
        return Nt(At(t), n);
985
      })),
986
    {
987
      left: function (t, n, e, r) {
988
        for (null == e && (e = 0), null == r && (r = t.length); e < r; ) {
989
          var i = (e + r) >>> 1;
990
          St(t[i], n) < 0 ? (e = i + 1) : (r = i);
991
        }
992
        return e;
993
      },
994
      right: function (t, n, e, r) {
995
        for (null == e && (e = 0), null == r && (r = t.length); e < r; ) {
996
          var i = (e + r) >>> 1;
997
          St(t[i], n) > 0 ? (r = i) : (e = i + 1);
998
        }
999
        return e;
1000
      },
1001
    }).right;
1002
  var Pt = Math.sqrt(50),
1003
    Ot = Math.sqrt(10),
1004
    jt = Math.sqrt(2);
1005
  function Tt(t, n, e) {
1006
    var r = (n - t) / Math.max(0, e),
1007
      i = Math.floor(Math.log(r) / Math.LN10),
1008
      o = r / Math.pow(10, i);
1009
    return i >= 0
1010
      ? (o >= Pt ? 10 : o >= Ot ? 5 : o >= jt ? 2 : 1) * Math.pow(10, i)
1011
      : -Math.pow(10, -i) / (o >= Pt ? 10 : o >= Ot ? 5 : o >= jt ? 2 : 1);
1012
  }
1013
  function Ct(t, n) {
1014
    switch (arguments.length) {
1015
      case 0:
1016
        break;
1017
      case 1:
1018
        this.range(t);
1019
        break;
1020
      default:
1021
        this.range(n).domain(t);
1022
    }
1023
    return this;
1024
  }
1025
  function Lt(t, n, e) {
1026
    (t.prototype = n.prototype = e), (e.constructor = t);
1027
  }
1028
  function zt(t, n) {
1029
    var e = Object.create(t.prototype);
1030
    for (var r in n) e[r] = n[r];
1031
    return e;
1032
  }
1033
  function Dt() {}
1034
  var qt = '\\s*([+-]?\\d+)\\s*',
1035
    Rt = '\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*',
1036
    Ht = '\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*',
1037
    It = /^#([0-9a-f]{3,8})$/,
1038
    Vt = new RegExp('^rgb\\(' + [qt, qt, qt] + '\\)$'),
1039
    $t = new RegExp('^rgb\\(' + [Ht, Ht, Ht] + '\\)$'),
1040
    Bt = new RegExp('^rgba\\(' + [qt, qt, qt, Rt] + '\\)$'),
1041
    Ft = new RegExp('^rgba\\(' + [Ht, Ht, Ht, Rt] + '\\)$'),
1042
    Ut = new RegExp('^hsl\\(' + [Rt, Ht, Ht] + '\\)$'),
1043
    Xt = new RegExp('^hsla\\(' + [Rt, Ht, Ht, Rt] + '\\)$'),
1044
    Wt = {
1045
      aliceblue: 15792383,
1046
      antiquewhite: 16444375,
1047
      aqua: 65535,
1048
      aquamarine: 8388564,
1049
      azure: 15794175,
1050
      beige: 16119260,
1051
      bisque: 16770244,
1052
      black: 0,
1053
      blanchedalmond: 16772045,
1054
      blue: 255,
1055
      blueviolet: 9055202,
1056
      brown: 10824234,
1057
      burlywood: 14596231,
1058
      cadetblue: 6266528,
1059
      chartreuse: 8388352,
1060
      chocolate: 13789470,
1061
      coral: 16744272,
1062
      cornflowerblue: 6591981,
1063
      cornsilk: 16775388,
1064
      crimson: 14423100,
1065
      cyan: 65535,
1066
      darkblue: 139,
1067
      darkcyan: 35723,
1068
      darkgoldenrod: 12092939,
1069
      darkgray: 11119017,
1070
      darkgreen: 25600,
1071
      darkgrey: 11119017,
1072
      darkkhaki: 12433259,
1073
      darkmagenta: 9109643,
1074
      darkolivegreen: 5597999,
1075
      darkorange: 16747520,
1076
      darkorchid: 10040012,
1077
      darkred: 9109504,
1078
      darksalmon: 15308410,
1079
      darkseagreen: 9419919,
1080
      darkslateblue: 4734347,
1081
      darkslategray: 3100495,
1082
      darkslategrey: 3100495,
1083
      darkturquoise: 52945,
1084
      darkviolet: 9699539,
1085
      deeppink: 16716947,
1086
      deepskyblue: 49151,
1087
      dimgray: 6908265,
1088
      dimgrey: 6908265,
1089
      dodgerblue: 2003199,
1090
      firebrick: 11674146,
1091
      floralwhite: 16775920,
1092
      forestgreen: 2263842,
1093
      fuchsia: 16711935,
1094
      gainsboro: 14474460,
1095
      ghostwhite: 16316671,
1096
      gold: 16766720,
1097
      goldenrod: 14329120,
1098
      gray: 8421504,
1099
      green: 32768,
1100
      greenyellow: 11403055,
1101
      grey: 8421504,
1102
      honeydew: 15794160,
1103
      hotpink: 16738740,
1104
      indianred: 13458524,
1105
      indigo: 4915330,
1106
      ivory: 16777200,
1107
      khaki: 15787660,
1108
      lavender: 15132410,
1109
      lavenderblush: 16773365,
1110
      lawngreen: 8190976,
1111
      lemonchiffon: 16775885,
1112
      lightblue: 11393254,
1113
      lightcoral: 15761536,
1114
      lightcyan: 14745599,
1115
      lightgoldenrodyellow: 16448210,
1116
      lightgray: 13882323,
1117
      lightgreen: 9498256,
1118
      lightgrey: 13882323,
1119
      lightpink: 16758465,
1120
      lightsalmon: 16752762,
1121
      lightseagreen: 2142890,
1122
      lightskyblue: 8900346,
1123
      lightslategray: 7833753,
1124
      lightslategrey: 7833753,
1125
      lightsteelblue: 11584734,
1126
      lightyellow: 16777184,
1127
      lime: 65280,
1128
      limegreen: 3329330,
1129
      linen: 16445670,
1130
      magenta: 16711935,
1131
      maroon: 8388608,
1132
      mediumaquamarine: 6737322,
1133
      mediumblue: 205,
1134
      mediumorchid: 12211667,
1135
      mediumpurple: 9662683,
1136
      mediumseagreen: 3978097,
1137
      mediumslateblue: 8087790,
1138
      mediumspringgreen: 64154,
1139
      mediumturquoise: 4772300,
1140
      mediumvioletred: 13047173,
1141
      midnightblue: 1644912,
1142
      mintcream: 16121850,
1143
      mistyrose: 16770273,
1144
      moccasin: 16770229,
1145
      navajowhite: 16768685,
1146
      navy: 128,
1147
      oldlace: 16643558,
1148
      olive: 8421376,
1149
      olivedrab: 7048739,
1150
      orange: 16753920,
1151
      orangered: 16729344,
1152
      orchid: 14315734,
1153
      palegoldenrod: 15657130,
1154
      palegreen: 10025880,
1155
      paleturquoise: 11529966,
1156
      palevioletred: 14381203,
1157
      papayawhip: 16773077,
1158
      peachpuff: 16767673,
1159
      peru: 13468991,
1160
      pink: 16761035,
1161
      plum: 14524637,
1162
      powderblue: 11591910,
1163
      purple: 8388736,
1164
      rebeccapurple: 6697881,
1165
      red: 16711680,
1166
      rosybrown: 12357519,
1167
      royalblue: 4286945,
1168
      saddlebrown: 9127187,
1169
      salmon: 16416882,
1170
      sandybrown: 16032864,
1171
      seagreen: 3050327,
1172
      seashell: 16774638,
1173
      sienna: 10506797,
1174
      silver: 12632256,
1175
      skyblue: 8900331,
1176
      slateblue: 6970061,
1177
      slategray: 7372944,
1178
      slategrey: 7372944,
1179
      snow: 16775930,
1180
      springgreen: 65407,
1181
      steelblue: 4620980,
1182
      tan: 13808780,
1183
      teal: 32896,
1184
      thistle: 14204888,
1185
      tomato: 16737095,
1186
      turquoise: 4251856,
1187
      violet: 15631086,
1188
      wheat: 16113331,
1189
      white: 16777215,
1190
      whitesmoke: 16119285,
1191
      yellow: 16776960,
1192
      yellowgreen: 10145074,
1193
    };
1194
  function Yt() {
1195
    return this.rgb().formatHex();
1196
  }
1197
  function Gt() {
1198
    return this.rgb().formatRgb();
1199
  }
1200
  function Zt(t) {
1201
    var n, e;
1202
    return (
1203
      (t = (t + '').trim().toLowerCase()),
1204
      (n = It.exec(t))
1205
        ? ((e = n[1].length),
1206
          (n = parseInt(n[1], 16)),
1207
          6 === e
1208
            ? Kt(n)
1209
            : 3 === e
1210
            ? new nn(
1211
                ((n >> 8) & 15) | ((n >> 4) & 240),
1212
                ((n >> 4) & 15) | (240 & n),
1213
                ((15 & n) << 4) | (15 & n),
1214
                1
1215
              )
1216
            : 8 === e
1217
            ? Qt(
1218
                (n >> 24) & 255,
1219
                (n >> 16) & 255,
1220
                (n >> 8) & 255,
1221
                (255 & n) / 255
1222
              )
1223
            : 4 === e
1224
            ? Qt(
1225
                ((n >> 12) & 15) | ((n >> 8) & 240),
1226
                ((n >> 8) & 15) | ((n >> 4) & 240),
1227
                ((n >> 4) & 15) | (240 & n),
1228
                (((15 & n) << 4) | (15 & n)) / 255
1229
              )
1230
            : null)
1231
        : (n = Vt.exec(t))
1232
        ? new nn(n[1], n[2], n[3], 1)
1233
        : (n = $t.exec(t))
1234
        ? new nn((255 * n[1]) / 100, (255 * n[2]) / 100, (255 * n[3]) / 100, 1)
1235
        : (n = Bt.exec(t))
1236
        ? Qt(n[1], n[2], n[3], n[4])
1237
        : (n = Ft.exec(t))
1238
        ? Qt((255 * n[1]) / 100, (255 * n[2]) / 100, (255 * n[3]) / 100, n[4])
1239
        : (n = Ut.exec(t))
1240
        ? an(n[1], n[2] / 100, n[3] / 100, 1)
1241
        : (n = Xt.exec(t))
1242
        ? an(n[1], n[2] / 100, n[3] / 100, n[4])
1243
        : Wt.hasOwnProperty(t)
1244
        ? Kt(Wt[t])
1245
        : 'transparent' === t
1246
        ? new nn(NaN, NaN, NaN, 0)
1247
        : null
1248
    );
1249
  }
1250
  function Kt(t) {
1251
    return new nn((t >> 16) & 255, (t >> 8) & 255, 255 & t, 1);
1252
  }
1253
  function Qt(t, n, e, r) {
1254
    return r <= 0 && (t = n = e = NaN), new nn(t, n, e, r);
1255
  }
1256
  function Jt(t) {
1257
    return (
1258
      t instanceof Dt || (t = Zt(t)),
1259
      t ? new nn((t = t.rgb()).r, t.g, t.b, t.opacity) : new nn()
1260
    );
1261
  }
1262
  function tn(t, n, e, r) {
1263
    return 1 === arguments.length ? Jt(t) : new nn(t, n, e, null == r ? 1 : r);
1264
  }
1265
  function nn(t, n, e, r) {
1266
    (this.r = +t), (this.g = +n), (this.b = +e), (this.opacity = +r);
1267
  }
1268
  function en() {
1269
    return '#' + on(this.r) + on(this.g) + on(this.b);
1270
  }
1271
  function rn() {
1272
    var t = this.opacity;
1273
    return (
1274
      (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t)))
1275
        ? 'rgb('
1276
        : 'rgba(') +
1277
      Math.max(0, Math.min(255, Math.round(this.r) || 0)) +
1278
      ', ' +
1279
      Math.max(0, Math.min(255, Math.round(this.g) || 0)) +
1280
      ', ' +
1281
      Math.max(0, Math.min(255, Math.round(this.b) || 0)) +
1282
      (1 === t ? ')' : ', ' + t + ')')
1283
    );
1284
  }
1285
  function on(t) {
1286
    return (
1287
      ((t = Math.max(0, Math.min(255, Math.round(t) || 0))) < 16 ? '0' : '') +
1288
      t.toString(16)
1289
    );
1290
  }
1291
  function an(t, n, e, r) {
1292
    return (
1293
      r <= 0
1294
        ? (t = n = e = NaN)
1295
        : e <= 0 || e >= 1
1296
        ? (t = n = NaN)
1297
        : n <= 0 && (t = NaN),
1298
      new sn(t, n, e, r)
1299
    );
1300
  }
1301
  function un(t) {
1302
    if (t instanceof sn) return new sn(t.h, t.s, t.l, t.opacity);
1303
    if ((t instanceof Dt || (t = Zt(t)), !t)) return new sn();
1304
    if (t instanceof sn) return t;
1305
    var n = (t = t.rgb()).r / 255,
1306
      e = t.g / 255,
1307
      r = t.b / 255,
1308
      i = Math.min(n, e, r),
1309
      o = Math.max(n, e, r),
1310
      a = NaN,
1311
      u = o - i,
1312
      s = (o + i) / 2;
1313
    return (
1314
      u
1315
        ? ((a =
1316
            n === o
1317
              ? (e - r) / u + 6 * (e < r)
1318
              : e === o
1319
              ? (r - n) / u + 2
1320
              : (n - e) / u + 4),
1321
          (u /= s < 0.5 ? o + i : 2 - o - i),
1322
          (a *= 60))
1323
        : (u = s > 0 && s < 1 ? 0 : a),
1324
      new sn(a, u, s, t.opacity)
1325
    );
1326
  }
1327
  function sn(t, n, e, r) {
1328
    (this.h = +t), (this.s = +n), (this.l = +e), (this.opacity = +r);
1329
  }
1330
  function cn(t, n, e) {
1331
    return (
1332
      255 *
1333
      (t < 60
1334
        ? n + ((e - n) * t) / 60
1335
        : t < 180
1336
        ? e
1337
        : t < 240
1338
        ? n + ((e - n) * (240 - t)) / 60
1339
        : n)
1340
    );
1341
  }
1342
  function ln(t) {
1343
    return function () {
1344
      return t;
1345
    };
1346
  }
1347
  function hn(t) {
1348
    return 1 == (t = +t)
1349
      ? fn
1350
      : function (n, e) {
1351
          return e - n
1352
            ? (function (t, n, e) {
1353
                return (
1354
                  (t = Math.pow(t, e)),
1355
                  (n = Math.pow(n, e) - t),
1356
                  (e = 1 / e),
1357
                  function (r) {
1358
                    return Math.pow(t + r * n, e);
1359
                  }
1360
                );
1361
              })(n, e, t)
1362
            : ln(isNaN(n) ? e : n);
1363
        };
1364
  }
1365
  function fn(t, n) {
1366
    var e = n - t;
1367
    return e
1368
      ? (function (t, n) {
1369
          return function (e) {
1370
            return t + e * n;
1371
          };
1372
        })(t, e)
1373
      : ln(isNaN(t) ? n : t);
1374
  }
1375
  Lt(Dt, Zt, {
1376
    copy: function (t) {
1377
      return Object.assign(new this.constructor(), this, t);
1378
    },
1379
    displayable: function () {
1380
      return this.rgb().displayable();
1381
    },
1382
    hex: Yt,
1383
    formatHex: Yt,
1384
    formatHsl: function () {
1385
      return un(this).formatHsl();
1386
    },
1387
    formatRgb: Gt,
1388
    toString: Gt,
1389
  }),
1390
    Lt(
1391
      nn,
1392
      tn,
1393
      zt(Dt, {
1394
        brighter: function (t) {
1395
          return (
1396
            (t = null == t ? 1 / 0.7 : Math.pow(1 / 0.7, t)),
1397
            new nn(this.r * t, this.g * t, this.b * t, this.opacity)
1398
          );
1399
        },
1400
        darker: function (t) {
1401
          return (
1402
            (t = null == t ? 0.7 : Math.pow(0.7, t)),
1403
            new nn(this.r * t, this.g * t, this.b * t, this.opacity)
1404
          );
1405
        },
1406
        rgb: function () {
1407
          return this;
1408
        },
1409
        displayable: function () {
1410
          return (
1411
            -0.5 <= this.r &&
1412
            this.r < 255.5 &&
1413
            -0.5 <= this.g &&
1414
            this.g < 255.5 &&
1415
            -0.5 <= this.b &&
1416
            this.b < 255.5 &&
1417
            0 <= this.opacity &&
1418
            this.opacity <= 1
1419
          );
1420
        },
1421
        hex: en,
1422
        formatHex: en,
1423
        formatRgb: rn,
1424
        toString: rn,
1425
      })
1426
    ),
1427
    Lt(
1428
      sn,
1429
      function (t, n, e, r) {
1430
        return 1 === arguments.length
1431
          ? un(t)
1432
          : new sn(t, n, e, null == r ? 1 : r);
1433
      },
1434
      zt(Dt, {
1435
        brighter: function (t) {
1436
          return (
1437
            (t = null == t ? 1 / 0.7 : Math.pow(1 / 0.7, t)),
1438
            new sn(this.h, this.s, this.l * t, this.opacity)
1439
          );
1440
        },
1441
        darker: function (t) {
1442
          return (
1443
            (t = null == t ? 0.7 : Math.pow(0.7, t)),
1444
            new sn(this.h, this.s, this.l * t, this.opacity)
1445
          );
1446
        },
1447
        rgb: function () {
1448
          var t = (this.h % 360) + 360 * (this.h < 0),
1449
            n = isNaN(t) || isNaN(this.s) ? 0 : this.s,
1450
            e = this.l,
1451
            r = e + (e < 0.5 ? e : 1 - e) * n,
1452
            i = 2 * e - r;
1453
          return new nn(
1454
            cn(t >= 240 ? t - 240 : t + 120, i, r),
1455
            cn(t, i, r),
1456
            cn(t < 120 ? t + 240 : t - 120, i, r),
1457
            this.opacity
1458
          );
1459
        },
1460
        displayable: function () {
1461
          return (
1462
            ((0 <= this.s && this.s <= 1) || isNaN(this.s)) &&
1463
            0 <= this.l &&
1464
            this.l <= 1 &&
1465
            0 <= this.opacity &&
1466
            this.opacity <= 1
1467
          );
1468
        },
1469
        formatHsl: function () {
1470
          var t = this.opacity;
1471
          return (
1472
            (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t)))
1473
              ? 'hsl('
1474
              : 'hsla(') +
1475
            (this.h || 0) +
1476
            ', ' +
1477
            100 * (this.s || 0) +
1478
            '%, ' +
1479
            100 * (this.l || 0) +
1480
            '%' +
1481
            (1 === t ? ')' : ', ' + t + ')')
1482
          );
1483
        },
1484
      })
1485
    );
1486
  var pn = (function t(n) {
1487
    var e = hn(n);
1488
    function r(t, n) {
1489
      var r = e((t = tn(t)).r, (n = tn(n)).r),
1490
        i = e(t.g, n.g),
1491
        o = e(t.b, n.b),
1492
        a = fn(t.opacity, n.opacity);
1493
      return function (n) {
1494
        return (
1495
          (t.r = r(n)), (t.g = i(n)), (t.b = o(n)), (t.opacity = a(n)), t + ''
1496
        );
1497
      };
1498
    }
1499
    return (r.gamma = t), r;
1500
  })(1);
1501
  function dn(t, n) {
1502
    n || (n = []);
1503
    var e,
1504
      r = t ? Math.min(n.length, t.length) : 0,
1505
      i = n.slice();
1506
    return function (o) {
1507
      for (e = 0; e < r; ++e) i[e] = t[e] * (1 - o) + n[e] * o;
1508
      return i;
1509
    };
1510
  }
1511
  function gn(t, n) {
1512
    var e,
1513
      r = n ? n.length : 0,
1514
      i = t ? Math.min(r, t.length) : 0,
1515
      o = new Array(i),
1516
      a = new Array(r);
1517
    for (e = 0; e < i; ++e) o[e] = bn(t[e], n[e]);
1518
    for (; e < r; ++e) a[e] = n[e];
1519
    return function (t) {
1520
      for (e = 0; e < i; ++e) a[e] = o[e](t);
1521
      return a;
1522
    };
1523
  }
1524
  function yn(t, n) {
1525
    var e = new Date();
1526
    return (
1527
      (t = +t),
1528
      (n = +n),
1529
      function (r) {
1530
        return e.setTime(t * (1 - r) + n * r), e;
1531
      }
1532
    );
1533
  }
1534
  function vn(t, n) {
1535
    return (
1536
      (t = +t),
1537
      (n = +n),
1538
      function (e) {
1539
        return t * (1 - e) + n * e;
1540
      }
1541
    );
1542
  }
1543
  function mn(t, n) {
1544
    var e,
1545
      r = {},
1546
      i = {};
1547
    for (e in ((null !== t && 'object' == typeof t) || (t = {}),
1548
    (null !== n && 'object' == typeof n) || (n = {}),
1549
    n))
1550
      e in t ? (r[e] = bn(t[e], n[e])) : (i[e] = n[e]);
1551
    return function (t) {
1552
      for (e in r) i[e] = r[e](t);
1553
      return i;
1554
    };
1555
  }
1556
  var _n = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
1557
    wn = new RegExp(_n.source, 'g');
1558
  function xn(t, n) {
1559
    var e,
1560
      r,
1561
      i,
1562
      o = (_n.lastIndex = wn.lastIndex = 0),
1563
      a = -1,
1564
      u = [],
1565
      s = [];
1566
    for (t += '', n += ''; (e = _n.exec(t)) && (r = wn.exec(n)); )
1567
      (i = r.index) > o &&
1568
        ((i = n.slice(o, i)), u[a] ? (u[a] += i) : (u[++a] = i)),
1569
        (e = e[0]) === (r = r[0])
1570
          ? u[a]
1571
            ? (u[a] += r)
1572
            : (u[++a] = r)
1573
          : ((u[++a] = null), s.push({ i: a, x: vn(e, r) })),
1574
        (o = wn.lastIndex);
1575
    return (
1576
      o < n.length && ((i = n.slice(o)), u[a] ? (u[a] += i) : (u[++a] = i)),
1577
      u.length < 2
1578
        ? s[0]
1579
          ? (function (t) {
1580
              return function (n) {
1581
                return t(n) + '';
1582
              };
1583
            })(s[0].x)
1584
          : (function (t) {
1585
              return function () {
1586
                return t;
1587
              };
1588
            })(n)
1589
        : ((n = s.length),
1590
          function (t) {
1591
            for (var e, r = 0; r < n; ++r) u[(e = s[r]).i] = e.x(t);
1592
            return u.join('');
1593
          })
1594
    );
1595
  }
1596
  function bn(t, n) {
1597
    var e,
1598
      r = typeof n;
1599
    return null == n || 'boolean' === r
1600
      ? ln(n)
1601
      : ('number' === r
1602
          ? vn
1603
          : 'string' === r
1604
          ? (e = Zt(n))
1605
            ? ((n = e), pn)
1606
            : xn
1607
          : n instanceof Zt
1608
          ? pn
1609
          : n instanceof Date
1610
          ? yn
1611
          : (function (t) {
1612
              return ArrayBuffer.isView(t) && !(t instanceof DataView);
1613
            })(n)
1614
          ? dn
1615
          : Array.isArray(n)
1616
          ? gn
1617
          : ('function' != typeof n.valueOf &&
1618
              'function' != typeof n.toString) ||
1619
            isNaN(n)
1620
          ? mn
1621
          : vn)(t, n);
1622
  }
1623
  function Mn(t, n) {
1624
    return (
1625
      (t = +t),
1626
      (n = +n),
1627
      function (e) {
1628
        return Math.round(t * (1 - e) + n * e);
1629
      }
1630
    );
1631
  }
1632
  function kn(t) {
1633
    return +t;
1634
  }
1635
  var Nn = [0, 1];
1636
  function Sn(t) {
1637
    return t;
1638
  }
1639
  function An(t, n) {
1640
    return (n -= t = +t)
1641
      ? function (e) {
1642
          return (e - t) / n;
1643
        }
1644
      : (function (t) {
1645
          return function () {
1646
            return t;
1647
          };
1648
        })(isNaN(n) ? NaN : 0.5);
1649
  }
1650
  function En(t, n, e) {
1651
    var r = t[0],
1652
      i = t[1],
1653
      o = n[0],
1654
      a = n[1];
1655
    return (
1656
      i < r ? ((r = An(i, r)), (o = e(a, o))) : ((r = An(r, i)), (o = e(o, a))),
1657
      function (t) {
1658
        return o(r(t));
1659
      }
1660
    );
1661
  }
1662
  function Pn(t, n, e) {
1663
    var r = Math.min(t.length, n.length) - 1,
1664
      i = new Array(r),
1665
      o = new Array(r),
1666
      a = -1;
1667
    for (
1668
      t[r] < t[0] && ((t = t.slice().reverse()), (n = n.slice().reverse()));
1669
      ++a < r;
1670
1671
    )
1672
      (i[a] = An(t[a], t[a + 1])), (o[a] = e(n[a], n[a + 1]));
1673
    return function (n) {
1674
      var e = Et(t, n, 1, r) - 1;
1675
      return o[e](i[e](n));
1676
    };
1677
  }
1678
  function On(t, n) {
1679
    return n
1680
      .domain(t.domain())
1681
      .range(t.range())
1682
      .interpolate(t.interpolate())
1683
      .clamp(t.clamp())
1684
      .unknown(t.unknown());
1685
  }
1686
  function jn() {
1687
    var t,
1688
      n,
1689
      e,
1690
      r,
1691
      i,
1692
      o,
1693
      a = Nn,
1694
      u = Nn,
1695
      s = bn,
1696
      c = Sn;
1697
    function l() {
1698
      var t,
1699
        n,
1700
        e,
1701
        s = Math.min(a.length, u.length);
1702
      return (
1703
        c !== Sn &&
1704
          ((t = a[0]),
1705
          (n = a[s - 1]),
1706
          t > n && ((e = t), (t = n), (n = e)),
1707
          (c = function (e) {
1708
            return Math.max(t, Math.min(n, e));
1709
          })),
1710
        (r = s > 2 ? Pn : En),
1711
        (i = o = null),
1712
        h
1713
      );
1714
    }
1715
    function h(n) {
1716
      return isNaN((n = +n)) ? e : (i || (i = r(a.map(t), u, s)))(t(c(n)));
1717
    }
1718
    return (
1719
      (h.invert = function (e) {
1720
        return c(n((o || (o = r(u, a.map(t), vn)))(e)));
1721
      }),
1722
      (h.domain = function (t) {
1723
        return arguments.length ? ((a = Array.from(t, kn)), l()) : a.slice();
1724
      }),
1725
      (h.range = function (t) {
1726
        return arguments.length ? ((u = Array.from(t)), l()) : u.slice();
1727
      }),
1728
      (h.rangeRound = function (t) {
1729
        return (u = Array.from(t)), (s = Mn), l();
1730
      }),
1731
      (h.clamp = function (t) {
1732
        return arguments.length ? ((c = !!t || Sn), l()) : c !== Sn;
1733
      }),
1734
      (h.interpolate = function (t) {
1735
        return arguments.length ? ((s = t), l()) : s;
1736
      }),
1737
      (h.unknown = function (t) {
1738
        return arguments.length ? ((e = t), h) : e;
1739
      }),
1740
      function (e, r) {
1741
        return (t = e), (n = r), l();
1742
      }
1743
    );
1744
  }
1745
  function Tn() {
1746
    return jn()(Sn, Sn);
1747
  }
1748
  function Cn(t, n) {
1749
    if (
1750
      (e = (t = n ? t.toExponential(n - 1) : t.toExponential()).indexOf('e')) <
1751
      0
1752
    )
1753
      return null;
1754
    var e,
1755
      r = t.slice(0, e);
1756
    return [r.length > 1 ? r[0] + r.slice(2) : r, +t.slice(e + 1)];
1757
  }
1758
  function Ln(t) {
1759
    return (t = Cn(Math.abs(t))) ? t[1] : NaN;
1760
  }
1761
  var zn,
1762
    Dn = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
1763
  function qn(t) {
1764
    if (!(n = Dn.exec(t))) throw new Error('invalid format: ' + t);
1765
    var n;
1766
    return new Rn({
1767
      fill: n[1],
1768
      align: n[2],
1769
      sign: n[3],
1770
      symbol: n[4],
1771
      zero: n[5],
1772
      width: n[6],
1773
      comma: n[7],
1774
      precision: n[8] && n[8].slice(1),
1775
      trim: n[9],
1776
      type: n[10],
1777
    });
1778
  }
1779
  function Rn(t) {
1780
    (this.fill = void 0 === t.fill ? ' ' : t.fill + ''),
1781
      (this.align = void 0 === t.align ? '>' : t.align + ''),
1782
      (this.sign = void 0 === t.sign ? '-' : t.sign + ''),
1783
      (this.symbol = void 0 === t.symbol ? '' : t.symbol + ''),
1784
      (this.zero = !!t.zero),
1785
      (this.width = void 0 === t.width ? void 0 : +t.width),
1786
      (this.comma = !!t.comma),
1787
      (this.precision = void 0 === t.precision ? void 0 : +t.precision),
1788
      (this.trim = !!t.trim),
1789
      (this.type = void 0 === t.type ? '' : t.type + '');
1790
  }
1791
  function Hn(t, n) {
1792
    var e = Cn(t, n);
1793
    if (!e) return t + '';
1794
    var r = e[0],
1795
      i = e[1];
1796
    return i < 0
1797
      ? '0.' + new Array(-i).join('0') + r
1798
      : r.length > i + 1
1799
      ? r.slice(0, i + 1) + '.' + r.slice(i + 1)
1800
      : r + new Array(i - r.length + 2).join('0');
1801
  }
1802
  (qn.prototype = Rn.prototype),
1803
    (Rn.prototype.toString = function () {
1804
      return (
1805
        this.fill +
1806
        this.align +
1807
        this.sign +
1808
        this.symbol +
1809
        (this.zero ? '0' : '') +
1810
        (void 0 === this.width ? '' : Math.max(1, 0 | this.width)) +
1811
        (this.comma ? ',' : '') +
1812
        (void 0 === this.precision
1813
          ? ''
1814
          : '.' + Math.max(0, 0 | this.precision)) +
1815
        (this.trim ? '~' : '') +
1816
        this.type
1817
      );
1818
    });
1819
  var In = {
1820
    '%': function (t, n) {
1821
      return (100 * t).toFixed(n);
1822
    },
1823
    b: function (t) {
1824
      return Math.round(t).toString(2);
1825
    },
1826
    c: function (t) {
1827
      return t + '';
1828
    },
1829
    d: function (t) {
1830
      return Math.round(t).toString(10);
1831
    },
1832
    e: function (t, n) {
1833
      return t.toExponential(n);
1834
    },
1835
    f: function (t, n) {
1836
      return t.toFixed(n);
1837
    },
1838
    g: function (t, n) {
1839
      return t.toPrecision(n);
1840
    },
1841
    o: function (t) {
1842
      return Math.round(t).toString(8);
1843
    },
1844
    p: function (t, n) {
1845
      return Hn(100 * t, n);
1846
    },
1847
    r: Hn,
1848
    s: function (t, n) {
1849
      var e = Cn(t, n);
1850
      if (!e) return t + '';
1851
      var r = e[0],
1852
        i = e[1],
1853
        o = i - (zn = 3 * Math.max(-8, Math.min(8, Math.floor(i / 3)))) + 1,
1854
        a = r.length;
1855
      return o === a
1856
        ? r
1857
        : o > a
1858
        ? r + new Array(o - a + 1).join('0')
1859
        : o > 0
1860
        ? r.slice(0, o) + '.' + r.slice(o)
1861
        : '0.' + new Array(1 - o).join('0') + Cn(t, Math.max(0, n + o - 1))[0];
1862
    },
1863
    X: function (t) {
1864
      return Math.round(t).toString(16).toUpperCase();
1865
    },
1866
    x: function (t) {
1867
      return Math.round(t).toString(16);
1868
    },
1869
  };
1870
  function Vn(t) {
1871
    return t;
1872
  }
1873
  var $n,
1874
    Bn,
1875
    Fn,
1876
    Un = Array.prototype.map,
1877
    Xn = [
1878
      'y',
1879
      'z',
1880
      'a',
1881
      'f',
1882
      'p',
1883
      'n',
1884
      'µ',
1885
      'm',
1886
      '',
1887
      'k',
1888
      'M',
1889
      'G',
1890
      'T',
1891
      'P',
1892
      'E',
1893
      'Z',
1894
      'Y',
1895
    ];
1896
  function Wn(t) {
1897
    var n,
1898
      e,
1899
      r =
1900
        void 0 === t.grouping || void 0 === t.thousands
1901
          ? Vn
1902
          : ((n = Un.call(t.grouping, Number)),
1903
            (e = t.thousands + ''),
1904
            function (t, r) {
1905
              for (
1906
                var i = t.length, o = [], a = 0, u = n[0], s = 0;
1907
                i > 0 &&
1908
                u > 0 &&
1909
                (s + u + 1 > r && (u = Math.max(1, r - s)),
1910
                o.push(t.substring((i -= u), i + u)),
1911
                !((s += u + 1) > r));
1912
1913
              )
1914
                u = n[(a = (a + 1) % n.length)];
1915
              return o.reverse().join(e);
1916
            }),
1917
      i = void 0 === t.currency ? '' : t.currency[0] + '',
1918
      o = void 0 === t.currency ? '' : t.currency[1] + '',
1919
      a = void 0 === t.decimal ? '.' : t.decimal + '',
1920
      u =
1921
        void 0 === t.numerals
1922
          ? Vn
1923
          : (function (t) {
1924
              return function (n) {
1925
                return n.replace(/[0-9]/g, function (n) {
1926
                  return t[+n];
1927
                });
1928
              };
1929
            })(Un.call(t.numerals, String)),
1930
      s = void 0 === t.percent ? '%' : t.percent + '',
1931
      c = void 0 === t.minus ? '-' : t.minus + '',
1932
      l = void 0 === t.nan ? 'NaN' : t.nan + '';
1933
    function h(t) {
1934
      var n = (t = qn(t)).fill,
1935
        e = t.align,
1936
        h = t.sign,
1937
        f = t.symbol,
1938
        p = t.zero,
1939
        d = t.width,
1940
        g = t.comma,
1941
        y = t.precision,
1942
        v = t.trim,
1943
        m = t.type;
1944
      'n' === m
1945
        ? ((g = !0), (m = 'g'))
1946
        : In[m] || (void 0 === y && (y = 12), (v = !0), (m = 'g')),
1947
        (p || ('0' === n && '=' === e)) && ((p = !0), (n = '0'), (e = '='));
1948
      var _ =
1949
          '$' === f
1950
            ? i
1951
            : '#' === f && /[boxX]/.test(m)
1952
            ? '0' + m.toLowerCase()
1953
            : '',
1954
        w = '$' === f ? o : /[%p]/.test(m) ? s : '',
1955
        x = In[m],
1956
        b = /[defgprs%]/.test(m);
1957
      function M(t) {
1958
        var i,
1959
          o,
1960
          s,
1961
          f = _,
1962
          M = w;
1963
        if ('c' === m) (M = x(t) + M), (t = '');
1964
        else {
1965
          var k = (t = +t) < 0 || 1 / t < 0;
1966
          if (
1967
            ((t = isNaN(t) ? l : x(Math.abs(t), y)),
1968
            v &&
1969
              (t = (function (t) {
1970
                t: for (var n, e = t.length, r = 1, i = -1; r < e; ++r)
1971
                  switch (t[r]) {
1972
                    case '.':
1973
                      i = n = r;
1974
                      break;
1975
                    case '0':
1976
                      0 === i && (i = r), (n = r);
1977
                      break;
1978
                    default:
1979
                      if (!+t[r]) break t;
1980
                      i > 0 && (i = 0);
1981
                  }
1982
                return i > 0 ? t.slice(0, i) + t.slice(n + 1) : t;
1983
              })(t)),
1984
            k && 0 == +t && '+' !== h && (k = !1),
1985
            (f =
1986
              (k ? ('(' === h ? h : c) : '-' === h || '(' === h ? '' : h) + f),
1987
            (M =
1988
              ('s' === m ? Xn[8 + zn / 3] : '') +
1989
              M +
1990
              (k && '(' === h ? ')' : '')),
1991
            b)
1992
          )
1993
            for (i = -1, o = t.length; ++i < o; )
1994
              if (48 > (s = t.charCodeAt(i)) || s > 57) {
1995
                (M = (46 === s ? a + t.slice(i + 1) : t.slice(i)) + M),
1996
                  (t = t.slice(0, i));
1997
                break;
1998
              }
1999
        }
2000
        g && !p && (t = r(t, 1 / 0));
2001
        var N = f.length + t.length + M.length,
2002
          S = N < d ? new Array(d - N + 1).join(n) : '';
2003
        switch (
2004
          (g &&
2005
            p &&
2006
            ((t = r(S + t, S.length ? d - M.length : 1 / 0)), (S = '')),
2007
          e)
2008
        ) {
2009
          case '<':
2010
            t = f + t + M + S;
2011
            break;
2012
          case '=':
2013
            t = f + S + t + M;
2014
            break;
2015
          case '^':
2016
            t = S.slice(0, (N = S.length >> 1)) + f + t + M + S.slice(N);
2017
            break;
2018
          default:
2019
            t = S + f + t + M;
2020
        }
2021
        return u(t);
2022
      }
2023
      return (
2024
        (y =
2025
          void 0 === y
2026
            ? 6
2027
            : /[gprs]/.test(m)
2028
            ? Math.max(1, Math.min(21, y))
2029
            : Math.max(0, Math.min(20, y))),
2030
        (M.toString = function () {
2031
          return t + '';
2032
        }),
2033
        M
2034
      );
2035
    }
2036
    return {
2037
      format: h,
2038
      formatPrefix: function (t, n) {
2039
        var e = h((((t = qn(t)).type = 'f'), t)),
2040
          r = 3 * Math.max(-8, Math.min(8, Math.floor(Ln(n) / 3))),
2041
          i = Math.pow(10, -r),
2042
          o = Xn[8 + r / 3];
2043
        return function (t) {
2044
          return e(i * t) + o;
2045
        };
2046
      },
2047
    };
2048
  }
2049
  function Yn(t, n, e, r) {
2050
    var i,
2051
      o = (function (t, n, e) {
2052
        var r = Math.abs(n - t) / Math.max(0, e),
2053
          i = Math.pow(10, Math.floor(Math.log(r) / Math.LN10)),
2054
          o = r / i;
2055
        return (
2056
          o >= Pt ? (i *= 10) : o >= Ot ? (i *= 5) : o >= jt && (i *= 2),
2057
          n < t ? -i : i
2058
        );
2059
      })(t, n, e);
2060
    switch ((r = qn(null == r ? ',f' : r)).type) {
2061
      case 's':
2062
        var a = Math.max(Math.abs(t), Math.abs(n));
2063
        return (
2064
          null != r.precision ||
2065
            isNaN(
2066
              (i = (function (t, n) {
2067
                return Math.max(
2068
                  0,
2069
                  3 * Math.max(-8, Math.min(8, Math.floor(Ln(n) / 3))) -
2070
                    Ln(Math.abs(t))
2071
                );
2072
              })(o, a))
2073
            ) ||
2074
            (r.precision = i),
2075
          Fn(r, a)
2076
        );
2077
      case '':
2078
      case 'e':
2079
      case 'g':
2080
      case 'p':
2081
      case 'r':
2082
        null != r.precision ||
2083
          isNaN(
2084
            (i = (function (t, n) {
2085
              return (
2086
                (t = Math.abs(t)),
2087
                (n = Math.abs(n) - t),
2088
                Math.max(0, Ln(n) - Ln(t)) + 1
2089
              );
2090
            })(o, Math.max(Math.abs(t), Math.abs(n))))
2091
          ) ||
2092
          (r.precision = i - ('e' === r.type));
2093
        break;
2094
      case 'f':
2095
      case '%':
2096
        null != r.precision ||
2097
          isNaN(
2098
            (i = (function (t) {
2099
              return Math.max(0, -Ln(Math.abs(t)));
2100
            })(o))
2101
          ) ||
2102
          (r.precision = i - 2 * ('%' === r.type));
2103
    }
2104
    return Bn(r);
2105
  }
2106
  function Gn(t) {
2107
    var n = t.domain;
2108
    return (
2109
      (t.ticks = function (t) {
2110
        var e = n();
2111
        return (function (t, n, e) {
2112
          var r,
2113
            i,
2114
            o,
2115
            a,
2116
            u = -1;
2117
          if (((e = +e), (t = +t) === (n = +n) && e > 0)) return [t];
2118
          if (
2119
            ((r = n < t) && ((i = t), (t = n), (n = i)),
2120
            0 === (a = Tt(t, n, e)) || !isFinite(a))
2121
          )
2122
            return [];
2123
          if (a > 0)
2124
            for (
2125
              t = Math.ceil(t / a),
2126
                n = Math.floor(n / a),
2127
                o = new Array((i = Math.ceil(n - t + 1)));
2128
              ++u < i;
2129
2130
            )
2131
              o[u] = (t + u) * a;
2132
          else
2133
            for (
2134
              t = Math.floor(t * a),
2135
                n = Math.ceil(n * a),
2136
                o = new Array((i = Math.ceil(t - n + 1)));
2137
              ++u < i;
2138
2139
            )
2140
              o[u] = (t - u) / a;
2141
          return r && o.reverse(), o;
2142
        })(e[0], e[e.length - 1], null == t ? 10 : t);
2143
      }),
2144
      (t.tickFormat = function (t, e) {
2145
        var r = n();
2146
        return Yn(r[0], r[r.length - 1], null == t ? 10 : t, e);
2147
      }),
2148
      (t.nice = function (e) {
2149
        null == e && (e = 10);
2150
        var r,
2151
          i = n(),
2152
          o = 0,
2153
          a = i.length - 1,
2154
          u = i[o],
2155
          s = i[a];
2156
        return (
2157
          s < u && ((r = u), (u = s), (s = r), (r = o), (o = a), (a = r)),
2158
          (r = Tt(u, s, e)) > 0
2159
            ? (r = Tt(
2160
                (u = Math.floor(u / r) * r),
2161
                (s = Math.ceil(s / r) * r),
2162
                e
2163
              ))
2164
            : r < 0 &&
2165
              (r = Tt(
2166
                (u = Math.ceil(u * r) / r),
2167
                (s = Math.floor(s * r) / r),
2168
                e
2169
              )),
2170
          r > 0
2171
            ? ((i[o] = Math.floor(u / r) * r),
2172
              (i[a] = Math.ceil(s / r) * r),
2173
              n(i))
2174
            : r < 0 &&
2175
              ((i[o] = Math.ceil(u * r) / r),
2176
              (i[a] = Math.floor(s * r) / r),
2177
              n(i)),
2178
          t
2179
        );
2180
      }),
2181
      t
2182
    );
2183
  }
2184
  function Zn() {
2185
    var t = Tn();
2186
    return (
2187
      (t.copy = function () {
2188
        return On(t, Zn());
2189
      }),
2190
      Ct.apply(t, arguments),
2191
      Gn(t)
2192
    );
2193
  }
2194
  ($n = Wn({
2195
    decimal: '.',
2196
    thousands: ',',
2197
    grouping: [3],
2198
    currency: ['$', ''],
2199
    minus: '-',
2200
  })),
2201
    (Bn = $n.format),
2202
    (Fn = $n.formatPrefix);
2203
  var Kn = Array.prototype.slice;
2204
  function Qn(t) {
2205
    return t;
2206
  }
2207
  function Jn(t) {
2208
    return 'translate(' + (t + 0.5) + ',0)';
2209
  }
2210
  function te(t) {
2211
    return 'translate(0,' + (t + 0.5) + ')';
2212
  }
2213
  function ne(t) {
2214
    return function (n) {
2215
      return +t(n);
2216
    };
2217
  }
2218
  function ee(t) {
2219
    var n = Math.max(0, t.bandwidth() - 1) / 2;
2220
    return (
2221
      t.round() && (n = Math.round(n)),
2222
      function (e) {
2223
        return +t(e) + n;
2224
      }
2225
    );
2226
  }
2227
  function re() {
2228
    return !this.__axis;
2229
  }
2230
  function ie(t, n) {
2231
    var e = [],
2232
      r = null,
2233
      i = null,
2234
      o = 6,
2235
      a = 6,
2236
      u = 3,
2237
      s = 1 === t || 4 === t ? -1 : 1,
2238
      c = 4 === t || 2 === t ? 'x' : 'y',
2239
      l = 1 === t || 3 === t ? Jn : te;
2240
    function h(h) {
2241
      var f = null == r ? (n.ticks ? n.ticks.apply(n, e) : n.domain()) : r,
2242
        p = null == i ? (n.tickFormat ? n.tickFormat.apply(n, e) : Qn) : i,
2243
        d = Math.max(o, 0) + u,
2244
        g = n.range(),
2245
        y = +g[0] + 0.5,
2246
        v = +g[g.length - 1] + 0.5,
2247
        m = (n.bandwidth ? ee : ne)(n.copy()),
2248
        _ = h.selection ? h.selection() : h,
2249
        w = _.selectAll('.domain').data([null]),
2250
        x = _.selectAll('.tick').data(f, n).order(),
2251
        b = x.exit(),
2252
        M = x.enter().append('g').attr('class', 'tick'),
2253
        k = x.select('line'),
2254
        N = x.select('text');
2255
      (w = w.merge(
2256
        w
2257
          .enter()
2258
          .insert('path', '.tick')
2259
          .attr('class', 'domain')
2260
          .attr('stroke', 'currentColor')
2261
      )),
2262
        (x = x.merge(M)),
2263
        (k = k.merge(
2264
          M.append('line')
2265
            .attr('stroke', 'currentColor')
2266
            .attr(c + '2', s * o)
2267
        )),
2268
        (N = N.merge(
2269
          M.append('text')
2270
            .attr('fill', 'currentColor')
2271
            .attr(c, s * d)
2272
            .attr('dy', 1 === t ? '0em' : 3 === t ? '0.71em' : '0.32em')
2273
        )),
2274
        h !== _ &&
2275
          ((w = w.transition(h)),
2276
          (x = x.transition(h)),
2277
          (k = k.transition(h)),
2278
          (N = N.transition(h)),
2279
          (b = b
2280
            .transition(h)
2281
            .attr('opacity', 1e-6)
2282
            .attr('transform', function (t) {
2283
              return isFinite((t = m(t)))
2284
                ? l(t)
2285
                : this.getAttribute('transform');
2286
            })),
2287
          M.attr('opacity', 1e-6).attr('transform', function (t) {
2288
            var n = this.parentNode.__axis;
2289
            return l(n && isFinite((n = n(t))) ? n : m(t));
2290
          })),
2291
        b.remove(),
2292
        w.attr(
2293
          'd',
2294
          4 === t || 2 == t
2295
            ? a
2296
              ? 'M' + s * a + ',' + y + 'H0.5V' + v + 'H' + s * a
2297
              : 'M0.5,' + y + 'V' + v
2298
            : a
2299
            ? 'M' + y + ',' + s * a + 'V0.5H' + v + 'V' + s * a
2300
            : 'M' + y + ',0.5H' + v
2301
        ),
2302
        x.attr('opacity', 1).attr('transform', function (t) {
2303
          return l(m(t));
2304
        }),
2305
        k.attr(c + '2', s * o),
2306
        N.attr(c, s * d).text(p),
2307
        _.filter(re)
2308
          .attr('fill', 'none')
2309
          .attr('font-size', 10)
2310
          .attr('font-family', 'sans-serif')
2311
          .attr('text-anchor', 2 === t ? 'start' : 4 === t ? 'end' : 'middle'),
2312
        _.each(function () {
2313
          this.__axis = m;
2314
        });
2315
    }
2316
    return (
2317
      (h.scale = function (t) {
2318
        return arguments.length ? ((n = t), h) : n;
2319
      }),
2320
      (h.ticks = function () {
2321
        return (e = Kn.call(arguments)), h;
2322
      }),
2323
      (h.tickArguments = function (t) {
2324
        return arguments.length
2325
          ? ((e = null == t ? [] : Kn.call(t)), h)
2326
          : e.slice();
2327
      }),
2328
      (h.tickValues = function (t) {
2329
        return arguments.length
2330
          ? ((r = null == t ? null : Kn.call(t)), h)
2331
          : r && r.slice();
2332
      }),
2333
      (h.tickFormat = function (t) {
2334
        return arguments.length ? ((i = t), h) : i;
2335
      }),
2336
      (h.tickSize = function (t) {
2337
        return arguments.length ? ((o = a = +t), h) : o;
2338
      }),
2339
      (h.tickSizeInner = function (t) {
2340
        return arguments.length ? ((o = +t), h) : o;
2341
      }),
2342
      (h.tickSizeOuter = function (t) {
2343
        return arguments.length ? ((a = +t), h) : a;
2344
      }),
2345
      (h.tickPadding = function (t) {
2346
        return arguments.length ? ((u = +t), h) : u;
2347
      }),
2348
      h
2349
    );
2350
  }
2351
  function oe(t) {
2352
    return ie(3, t);
2353
  }
2354
  var ae = Math.PI,
2355
    ue = 2 * ae,
2356
    se = ue - 1e-6;
2357
  function ce() {
2358
    (this._x0 = this._y0 = this._x1 = this._y1 = null), (this._ = '');
2359
  }
2360
  function le() {
2361
    return new ce();
2362
  }
2363
  function he(t) {
2364
    return function () {
2365
      return t;
2366
    };
2367
  }
2368
  function fe(t) {
2369
    this._context = t;
2370
  }
2371
  function pe(t) {
2372
    return new fe(t);
2373
  }
2374
  function de(t) {
2375
    return t[0];
2376
  }
2377
  function ge(t) {
2378
    return t[1];
2379
  }
2380
  (ce.prototype = le.prototype = {
2381
    constructor: ce,
2382
    moveTo: function (t, n) {
2383
      this._ +=
2384
        'M' + (this._x0 = this._x1 = +t) + ',' + (this._y0 = this._y1 = +n);
2385
    },
2386
    closePath: function () {
2387
      null !== this._x1 &&
2388
        ((this._x1 = this._x0), (this._y1 = this._y0), (this._ += 'Z'));
2389
    },
2390
    lineTo: function (t, n) {
2391
      this._ += 'L' + (this._x1 = +t) + ',' + (this._y1 = +n);
2392
    },
2393
    quadraticCurveTo: function (t, n, e, r) {
2394
      this._ +=
2395
        'Q' + +t + ',' + +n + ',' + (this._x1 = +e) + ',' + (this._y1 = +r);
2396
    },
2397
    bezierCurveTo: function (t, n, e, r, i, o) {
2398
      this._ +=
2399
        'C' +
2400
        +t +
2401
        ',' +
2402
        +n +
2403
        ',' +
2404
        +e +
2405
        ',' +
2406
        +r +
2407
        ',' +
2408
        (this._x1 = +i) +
2409
        ',' +
2410
        (this._y1 = +o);
2411
    },
2412
    arcTo: function (t, n, e, r, i) {
2413
      (t = +t), (n = +n), (e = +e), (r = +r), (i = +i);
2414
      var o = this._x1,
2415
        a = this._y1,
2416
        u = e - t,
2417
        s = r - n,
2418
        c = o - t,
2419
        l = a - n,
2420
        h = c * c + l * l;
2421
      if (i < 0) throw new Error('negative radius: ' + i);
2422
      if (null === this._x1)
2423
        this._ += 'M' + (this._x1 = t) + ',' + (this._y1 = n);
2424
      else if (h > 1e-6)
2425
        if (Math.abs(l * u - s * c) > 1e-6 && i) {
2426
          var f = e - o,
2427
            p = r - a,
2428
            d = u * u + s * s,
2429
            g = f * f + p * p,
2430
            y = Math.sqrt(d),
2431
            v = Math.sqrt(h),
2432
            m = i * Math.tan((ae - Math.acos((d + h - g) / (2 * y * v))) / 2),
2433
            _ = m / v,
2434
            w = m / y;
2435
          Math.abs(_ - 1) > 1e-6 &&
2436
            (this._ += 'L' + (t + _ * c) + ',' + (n + _ * l)),
2437
            (this._ +=
2438
              'A' +
2439
              i +
2440
              ',' +
2441
              i +
2442
              ',0,0,' +
2443
              +(l * f > c * p) +
2444
              ',' +
2445
              (this._x1 = t + w * u) +
2446
              ',' +
2447
              (this._y1 = n + w * s));
2448
        } else this._ += 'L' + (this._x1 = t) + ',' + (this._y1 = n);
2449
      else;
2450
    },
2451
    arc: function (t, n, e, r, i, o) {
2452
      (t = +t), (n = +n), (o = !!o);
2453
      var a = (e = +e) * Math.cos(r),
2454
        u = e * Math.sin(r),
2455
        s = t + a,
2456
        c = n + u,
2457
        l = 1 ^ o,
2458
        h = o ? r - i : i - r;
2459
      if (e < 0) throw new Error('negative radius: ' + e);
2460
      null === this._x1
2461
        ? (this._ += 'M' + s + ',' + c)
2462
        : (Math.abs(this._x1 - s) > 1e-6 || Math.abs(this._y1 - c) > 1e-6) &&
2463
          (this._ += 'L' + s + ',' + c),
2464
        e &&
2465
          (h < 0 && (h = (h % ue) + ue),
2466
          h > se
2467
            ? (this._ +=
2468
                'A' +
2469
                e +
2470
                ',' +
2471
                e +
2472
                ',0,1,' +
2473
                l +
2474
                ',' +
2475
                (t - a) +
2476
                ',' +
2477
                (n - u) +
2478
                'A' +
2479
                e +
2480
                ',' +
2481
                e +
2482
                ',0,1,' +
2483
                l +
2484
                ',' +
2485
                (this._x1 = s) +
2486
                ',' +
2487
                (this._y1 = c))
2488
            : h > 1e-6 &&
2489
              (this._ +=
2490
                'A' +
2491
                e +
2492
                ',' +
2493
                e +
2494
                ',0,' +
2495
                +(h >= ae) +
2496
                ',' +
2497
                l +
2498
                ',' +
2499
                (this._x1 = t + e * Math.cos(i)) +
2500
                ',' +
2501
                (this._y1 = n + e * Math.sin(i))));
2502
    },
2503
    rect: function (t, n, e, r) {
2504
      this._ +=
2505
        'M' +
2506
        (this._x0 = this._x1 = +t) +
2507
        ',' +
2508
        (this._y0 = this._y1 = +n) +
2509
        'h' +
2510
        +e +
2511
        'v' +
2512
        +r +
2513
        'h' +
2514
        -e +
2515
        'Z';
2516
    },
2517
    toString: function () {
2518
      return this._;
2519
    },
2520
  }),
2521
    (fe.prototype = {
2522
      areaStart: function () {
2523
        this._line = 0;
2524
      },
2525
      areaEnd: function () {
2526
        this._line = NaN;
2527
      },
2528
      lineStart: function () {
2529
        this._point = 0;
2530
      },
2531
      lineEnd: function () {
2532
        (this._line || (0 !== this._line && 1 === this._point)) &&
2533
          this._context.closePath(),
2534
          (this._line = 1 - this._line);
2535
      },
2536
      point: function (t, n) {
2537
        switch (((t = +t), (n = +n), this._point)) {
2538
          case 0:
2539
            (this._point = 1),
2540
              this._line
2541
                ? this._context.lineTo(t, n)
2542
                : this._context.moveTo(t, n);
2543
            break;
2544
          case 1:
2545
            this._point = 2;
2546
          default:
2547
            this._context.lineTo(t, n);
2548
        }
2549
      },
2550
    });
2551
  var ye = { value: function () {} };
2552
  function ve() {
2553
    for (var t, n = 0, e = arguments.length, r = {}; n < e; ++n) {
2554
      if (!(t = arguments[n] + '') || t in r || /[\s.]/.test(t))
2555
        throw new Error('illegal type: ' + t);
2556
      r[t] = [];
2557
    }
2558
    return new me(r);
2559
  }
2560
  function me(t) {
2561
    this._ = t;
2562
  }
2563
  function _e(t, n) {
2564
    return t
2565
      .trim()
2566
      .split(/^|\s+/)
2567
      .map(function (t) {
2568
        var e = '',
2569
          r = t.indexOf('.');
2570
        if (
2571
          (r >= 0 && ((e = t.slice(r + 1)), (t = t.slice(0, r))),
2572
          t && !n.hasOwnProperty(t))
2573
        )
2574
          throw new Error('unknown type: ' + t);
2575
        return { type: t, name: e };
2576
      });
2577
  }
2578
  function we(t, n) {
2579
    for (var e, r = 0, i = t.length; r < i; ++r)
2580
      if ((e = t[r]).name === n) return e.value;
2581
  }
2582
  function xe(t, n, e) {
2583
    for (var r = 0, i = t.length; r < i; ++r)
2584
      if (t[r].name === n) {
2585
        (t[r] = ye), (t = t.slice(0, r).concat(t.slice(r + 1)));
2586
        break;
2587
      }
2588
    return null != e && t.push({ name: n, value: e }), t;
2589
  }
2590
  function be() {
2591
    st.stopImmediatePropagation();
2592
  }
2593
  function Me() {
2594
    st.preventDefault(), st.stopImmediatePropagation();
2595
  }
2596
  function ke(t) {
2597
    var n = t.document.documentElement,
2598
      e = wt(t).on('dragstart.drag', Me, !0);
2599
    'onselectstart' in n
2600
      ? e.on('selectstart.drag', Me, !0)
2601
      : ((n.__noselect = n.style.MozUserSelect),
2602
        (n.style.MozUserSelect = 'none'));
2603
  }
2604
  function Ne(t) {
2605
    return function () {
2606
      return t;
2607
    };
2608
  }
2609
  function Se(t, n, e, r, i, o, a, u, s, c) {
2610
    (this.target = t),
2611
      (this.type = n),
2612
      (this.subject = e),
2613
      (this.identifier = r),
2614
      (this.active = i),
2615
      (this.x = o),
2616
      (this.y = a),
2617
      (this.dx = u),
2618
      (this.dy = s),
2619
      (this._ = c);
2620
  }
2621
  function Ae() {
2622
    return !st.ctrlKey && !st.button;
2623
  }
2624
  function Ee() {
2625
    return this.parentNode;
2626
  }
2627
  function Pe(t) {
2628
    return null == t ? { x: st.x, y: st.y } : t;
2629
  }
2630
  function Oe() {
2631
    return navigator.maxTouchPoints || 'ontouchstart' in this;
2632
  }
2633
  function je() {
2634
    var t,
2635
      n,
2636
      e,
2637
      r,
2638
      i = Ae,
2639
      o = Ee,
2640
      a = Pe,
2641
      u = Oe,
2642
      s = {},
2643
      c = ve('start', 'drag', 'end'),
2644
      l = 0,
2645
      h = 0;
2646
    function f(t) {
2647
      t.on('mousedown.drag', p)
2648
        .filter(u)
2649
        .on('touchstart.drag', y)
2650
        .on('touchmove.drag', v)
2651
        .on('touchend.drag touchcancel.drag', m)
2652
        .style('touch-action', 'none')
2653
        .style('-webkit-tap-highlight-color', 'rgba(0,0,0,0)');
2654
    }
2655
    function p() {
2656
      if (!r && i.apply(this, arguments)) {
2657
        var a = _('mouse', o.apply(this, arguments), Mt, this, arguments);
2658
        a &&
2659
          (wt(st.view).on('mousemove.drag', d, !0).on('mouseup.drag', g, !0),
2660
          ke(st.view),
2661
          be(),
2662
          (e = !1),
2663
          (t = st.clientX),
2664
          (n = st.clientY),
2665
          a('start'));
2666
      }
2667
    }
2668
    function d() {
2669
      if ((Me(), !e)) {
2670
        var r = st.clientX - t,
2671
          i = st.clientY - n;
2672
        e = r * r + i * i > h;
2673
      }
2674
      s.mouse('drag');
2675
    }
2676
    function g() {
2677
      wt(st.view).on('mousemove.drag mouseup.drag', null),
2678
        (function (t, n) {
2679
          var e = t.document.documentElement,
2680
            r = wt(t).on('dragstart.drag', null);
2681
          n &&
2682
            (r.on('click.drag', Me, !0),
2683
            setTimeout(function () {
2684
              r.on('click.drag', null);
2685
            }, 0)),
2686
            'onselectstart' in e
2687
              ? r.on('selectstart.drag', null)
2688
              : ((e.style.MozUserSelect = e.__noselect), delete e.__noselect);
2689
        })(st.view, e),
2690
        Me(),
2691
        s.mouse('end');
2692
    }
2693
    function y() {
2694
      if (i.apply(this, arguments)) {
2695
        var t,
2696
          n,
2697
          e = st.changedTouches,
2698
          r = o.apply(this, arguments),
2699
          a = e.length;
2700
        for (t = 0; t < a; ++t)
2701
          (n = _(e[t].identifier, r, kt, this, arguments)) &&
2702
            (be(), n('start'));
2703
      }
2704
    }
2705
    function v() {
2706
      var t,
2707
        n,
2708
        e = st.changedTouches,
2709
        r = e.length;
2710
      for (t = 0; t < r; ++t) (n = s[e[t].identifier]) && (Me(), n('drag'));
2711
    }
2712
    function m() {
2713
      var t,
2714
        n,
2715
        e = st.changedTouches,
2716
        i = e.length;
2717
      for (
2718
        r && clearTimeout(r),
2719
          r = setTimeout(function () {
2720
            r = null;
2721
          }, 500),
2722
          t = 0;
2723
        t < i;
2724
        ++t
2725
      )
2726
        (n = s[e[t].identifier]) && (be(), n('end'));
2727
    }
2728
    function _(t, n, e, r, i) {
2729
      var o,
2730
        u,
2731
        h,
2732
        p = e(n, t),
2733
        d = c.copy();
2734
      if (
2735
        dt(new Se(f, 'beforestart', o, t, l, p[0], p[1], 0, 0, d), function () {
2736
          return (
2737
            null != (st.subject = o = a.apply(r, i)) &&
2738
            ((u = o.x - p[0] || 0), (h = o.y - p[1] || 0), !0)
2739
          );
2740
        })
2741
      )
2742
        return function a(c) {
2743
          var g,
2744
            y = p;
2745
          switch (c) {
2746
            case 'start':
2747
              (s[t] = a), (g = l++);
2748
              break;
2749
            case 'end':
2750
              delete s[t], --l;
2751
            case 'drag':
2752
              (p = e(n, t)), (g = l);
2753
          }
2754
          dt(
2755
            new Se(
2756
              f,
2757
              c,
2758
              o,
2759
              t,
2760
              g,
2761
              p[0] + u,
2762
              p[1] + h,
2763
              p[0] - y[0],
2764
              p[1] - y[1],
2765
              d
2766
            ),
2767
            d.apply,
2768
            d,
2769
            [c, r, i]
2770
          );
2771
        };
2772
    }
2773
    return (
2774
      (f.filter = function (t) {
2775
        return arguments.length
2776
          ? ((i = 'function' == typeof t ? t : Ne(!!t)), f)
2777
          : i;
2778
      }),
2779
      (f.container = function (t) {
2780
        return arguments.length
2781
          ? ((o = 'function' == typeof t ? t : Ne(t)), f)
2782
          : o;
2783
      }),
2784
      (f.subject = function (t) {
2785
        return arguments.length
2786
          ? ((a = 'function' == typeof t ? t : Ne(t)), f)
2787
          : a;
2788
      }),
2789
      (f.touchable = function (t) {
2790
        return arguments.length
2791
          ? ((u = 'function' == typeof t ? t : Ne(!!t)), f)
2792
          : u;
2793
      }),
2794
      (f.on = function () {
2795
        var t = c.on.apply(c, arguments);
2796
        return t === c ? f : t;
2797
      }),
2798
      (f.clickDistance = function (t) {
2799
        return arguments.length ? ((h = (t = +t) * t), f) : Math.sqrt(h);
2800
      }),
2801
      f
2802
    );
2803
  }
2804
  (me.prototype = ve.prototype = {
2805
    constructor: me,
2806
    on: function (t, n) {
2807
      var e,
2808
        r = this._,
2809
        i = _e(t + '', r),
2810
        o = -1,
2811
        a = i.length;
2812
      if (!(arguments.length < 2)) {
2813
        if (null != n && 'function' != typeof n)
2814
          throw new Error('invalid callback: ' + n);
2815
        for (; ++o < a; )
2816
          if ((e = (t = i[o]).type)) r[e] = xe(r[e], t.name, n);
2817
          else if (null == n) for (e in r) r[e] = xe(r[e], t.name, null);
2818
        return this;
2819
      }
2820
      for (; ++o < a; )
2821
        if ((e = (t = i[o]).type) && (e = we(r[e], t.name))) return e;
2822
    },
2823
    copy: function () {
2824
      var t = {},
2825
        n = this._;
2826
      for (var e in n) t[e] = n[e].slice();
2827
      return new me(t);
2828
    },
2829
    call: function (t, n) {
2830
      if ((e = arguments.length - 2) > 0)
2831
        for (var e, r, i = new Array(e), o = 0; o < e; ++o)
2832
          i[o] = arguments[o + 2];
2833
      if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t);
2834
      for (o = 0, e = (r = this._[t]).length; o < e; ++o)
2835
        r[o].value.apply(n, i);
2836
    },
2837
    apply: function (t, n, e) {
2838
      if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t);
2839
      for (var r = this._[t], i = 0, o = r.length; i < o; ++i)
2840
        r[i].value.apply(n, e);
2841
    },
2842
  }),
2843
    (Se.prototype.on = function () {
2844
      var t = this._.on.apply(this._, arguments);
2845
      return t === this._ ? this : t;
2846
    });
2847
  var Te = function (t) {
2848
      return 50 * Math.sin((Math.PI / 50) * t - 0.5 * Math.PI) + 50;
2849
    },
2850
    Ce = function (t) {
2851
      return (25 * (2 * Math.asin((t - 50) / 50) + Math.PI)) / Math.PI;
2852
    },
2853
    Le = function (t) {
2854
      return t >= 80 && t <= 100;
2855
    },
2856
    ze = function (t, n) {
2857
      var e = t + 5;
2858
      return Le(n) ? -1 * e : e;
2859
    },
2860
    De = {
2861
      target: 'svg',
2862
      width: 900,
2863
      height: 300,
2864
      preview: !1,
2865
      margin: { top: 20, right: 20, bottom: 40, left: 20 },
2866
    };
2867
  return (function (n) {
2868
    !(function (t, n) {
2869
      if ('function' != typeof n && null !== n)
2870
        throw new TypeError(
2871
          'Super expression must either be null or a function'
2872
        );
2873
      (t.prototype = Object.create(n && n.prototype, {
2874
        constructor: { value: t, writable: !0, configurable: !0 },
2875
      })),
2876
        n && o(t, n);
2877
    })(l, n);
2878
    var e,
2879
      i,
2880
      u,
2881
      c = s(l);
2882
    function l(t, n) {
2883
      var e;
2884
      return (
2885
        (function (t, n) {
2886
          if (!(t instanceof n))
2887
            throw new TypeError('Cannot call a class as a function');
2888
        })(this, l),
2889
        (e = c.call(this)),
2890
        Object.assign(a(e), De, { data: t }, n),
2891
        e.init(),
2892
        e
2893
      );
2894
    }
2895
    return (
2896
      (e = l),
2897
      (i = [
2898
        {
2899
          key: 'init',
2900
          value: function () {
2901
            var t = this.width,
2902
              n = this.height,
2903
              e = this.margin,
2904
              r = this.target;
2905
            (this.chartWidth = t - e.left - e.right),
2906
              (this.chartHeight = n - e.top - e.bottom),
2907
              (this.svg = wt(r)
2908
                .attr('width', t)
2909
                .attr('height', n)
2910
                .append('g')
2911
                .attr(
2912
                  'transform',
2913
                  'translate('.concat(e.left, ', ').concat(e.top, ')')
2914
                )),
2915
              (this.xScale = Zn().domain([0, 100]).range([0, this.chartWidth])),
2916
              (this.yScale = Zn()
2917
                .domain([0, 100])
2918
                .range([this.chartHeight, 0])),
2919
              this.normalizeData();
2920
          },
2921
        },
2922
        {
2923
          key: 'normalizeData',
2924
          value: function () {
2925
            this.data = this.data.map(function (t) {
2926
              return {
2927
                color: t.color,
2928
                description: t.description,
2929
                link: t.link,
2930
                x: t.x ? t.x : 0,
2931
                y: Te(t.y ? t.y : 0),
2932
                size: t.size ? t.size : 10,
2933
              };
2934
            });
2935
          },
2936
        },
2937
        {
2938
          key: 'render',
2939
          value: function () {
2940
            var t = this;
2941
            this.renderBottomLine(5),
2942
              this.renderMainCurve(),
2943
              this.renderMiddleLine(),
2944
              this.renderFooterText();
2945
            var n,
2946
              e = this,
2947
              i = je().on('drag', function (t) {
2948
                var n = st.x;
2949
                n < 0
2950
                  ? ((n = 0),
2951
                    e.emit(
2952
                      'home',
2953
                      r(r({}, t), {}, { y: Ce(e.yScale.invert(t.y)) })
2954
                    ))
2955
                  : n > e.chartWidth &&
2956
                    ((n = e.chartWidth),
2957
                    e.emit(
2958
                      'end',
2959
                      r(
2960
                        r({}, t),
2961
                        {},
2962
                        {
2963
                          x: e.xScale.invert(e.chartWidth),
2964
                          y: Ce(e.yScale.invert(t.y)),
2965
                        }
2966
                      )
2967
                    ));
2968
                var i = e.xScale.invert(n);
2969
                (t.x = n), (t.y = e.yScale(Te(i)));
2970
                var o = Ce(e.yScale.invert(t.y)),
2971
                  a = { x: i, y: o };
2972
                wt(this).on('click', function () {
2973
                  e.emit('pointClick', r(r({}, t), a));
2974
                }),
2975
                  e.preview ||
2976
                    (wt(this)
2977
                      .attr(
2978
                        'transform',
2979
                        'translate('.concat(t.x, ', ').concat(t.y, ')')
2980
                      )
2981
                      .select('text')
2982
                      .style('text-anchor', function () {
2983
                        return Le(i) ? 'end' : 'start';
2984
                      })
2985
                      .attr('x', function (t) {
2986
                        return ze(t.size, i);
2987
                      }),
2988
                    e.emit('move', i, o),
2989
                    e.emit('moved', r(r({}, t), a)));
2990
              });
2991
            (n = this.preview
2992
              ? this.undraggablePoint()
2993
              : this.svg
2994
                  .selectAll('.hill-chart-group')
2995
                  .data(this.data)
2996
                  .enter()
2997
                  .append('g')
2998
                  .attr('class', 'hill-chart-group')
2999
                  .attr('transform', function (n) {
3000
                    return (
3001
                      (n.x = t.xScale(n.x)),
3002
                      (n.y = t.yScale(n.y)),
3003
                      'translate('.concat(n.x, ', ').concat(n.y, ')')
3004
                    );
3005
                  })
3006
                  .call(i))
3007
              .append('circle')
3008
              .attr('class', 'hill-chart-circle')
3009
              .attr('fill', function (t) {
3010
                return t.color;
3011
              })
3012
              .attr('cx', 0)
3013
              .attr('cy', 0)
3014
              .attr('r', function (t) {
3015
                return t.size;
3016
              }),
3017
              n
3018
                .append('text')
3019
                .text(function (t) {
3020
                  return t.description;
3021
                })
3022
                .attr('x', function (n) {
3023
                  return ze(n.size, t.xScale.invert(n.x));
3024
                })
3025
                .style('text-anchor', function (n) {
3026
                  return Le(t.xScale.invert(n.x)) ? 'end' : 'start';
3027
                })
3028
                .attr('y', 5);
3029
          },
3030
        },
3031
        {
3032
          key: 'undraggablePoint',
3033
          value: function () {
3034
            var t = this;
3035
            return this.svg
3036
              .selectAll('.hill-chart-group')
3037
              .data(this.data)
3038
              .enter()
3039
              .append('a')
3040
              .attr('href', function (t) {
3041
                return t.link ? t.link : '#';
3042
              })
3043
              .append('g')
3044
              .attr('class', 'hill-chart-group')
3045
              .style('cursor', 'pointer')
3046
              .attr('transform', function (n) {
3047
                return (
3048
                  (n.x = t.xScale(n.x)),
3049
                  (n.y = t.yScale(n.y)),
3050
                  'translate('.concat(n.x, ', ').concat(n.y, ')')
3051
                );
3052
              });
3053
          },
3054
        },
3055
        {
3056
          key: 'renderMainCurve',
3057
          value: function () {
3058
            var t = this;
3059
            (this.mainLineCurvePoints = (function (t, n, e) {
3060
              (t = +t),
3061
                (n = +n),
3062
                (e =
3063
                  (i = arguments.length) < 2
3064
                    ? ((n = t), (t = 0), 1)
3065
                    : i < 3
3066
                    ? 1
3067
                    : +e);
3068
              for (
3069
                var r = -1,
3070
                  i = 0 | Math.max(0, Math.ceil((n - t) / e)),
3071
                  o = new Array(i);
3072
                ++r < i;
3073
3074
              )
3075
                o[r] = t + r * e;
3076
              return o;
3077
            })(0, 100, 0.1).map(function (t) {
3078
              return { x: t, y: Te(t) };
3079
            })),
3080
              (this.line = (function () {
3081
                var t = de,
3082
                  n = ge,
3083
                  e = he(!0),
3084
                  r = null,
3085
                  i = pe,
3086
                  o = null;
3087
                function a(a) {
3088
                  var u,
3089
                    s,
3090
                    c,
3091
                    l = a.length,
3092
                    h = !1;
3093
                  for (null == r && (o = i((c = le()))), u = 0; u <= l; ++u)
3094
                    !(u < l && e((s = a[u]), u, a)) === h &&
3095
                      ((h = !h) ? o.lineStart() : o.lineEnd()),
3096
                      h && o.point(+t(s, u, a), +n(s, u, a));
3097
                  if (c) return (o = null), c + '' || null;
3098
                }
3099
                return (
3100
                  (a.x = function (n) {
3101
                    return arguments.length
3102
                      ? ((t = 'function' == typeof n ? n : he(+n)), a)
3103
                      : t;
3104
                  }),
3105
                  (a.y = function (t) {
3106
                    return arguments.length
3107
                      ? ((n = 'function' == typeof t ? t : he(+t)), a)
3108
                      : n;
3109
                  }),
3110
                  (a.defined = function (t) {
3111
                    return arguments.length
3112
                      ? ((e = 'function' == typeof t ? t : he(!!t)), a)
3113
                      : e;
3114
                  }),
3115
                  (a.curve = function (t) {
3116
                    return arguments.length
3117
                      ? ((i = t), null != r && (o = i(r)), a)
3118
                      : i;
3119
                  }),
3120
                  (a.context = function (t) {
3121
                    return arguments.length
3122
                      ? (null == t ? (r = o = null) : (o = i((r = t))), a)
3123
                      : r;
3124
                  }),
3125
                  a
3126
                );
3127
              })()
3128
                .x(function (n) {
3129
                  return t.xScale(n.x);
3130
                })
3131
                .y(function (n) {
3132
                  return t.yScale(n.y);
3133
                })),
3134
              this.svg
3135
                .append('path')
3136
                .attr('class', 'chart-hill-main-curve')
3137
                .datum(this.mainLineCurvePoints)
3138
                .attr('d', this.line);
3139
          },
3140
        },
3141
        {
3142
          key: 'renderBottomLine',
3143
          value: function () {
3144
            var t =
3145
              arguments.length > 0 && void 0 !== arguments[0]
3146
                ? arguments[0]
3147
                : 5;
3148
            (this.bottomLine = oe(this.xScale).ticks(0).tickSize(0)),
3149
              this.svg
3150
                .append('g')
3151
                .attr('class', 'hill-chart-bottom-line')
3152
                .attr(
3153
                  'transform',
3154
                  'translate(0, '.concat(this.chartHeight + t, ')')
3155
                )
3156
                .call(this.bottomLine);
3157
          },
3158
        },
3159
        {
3160
          key: 'renderMiddleLine',
3161
          value: function () {
3162
            this.svg
3163
              .append('line')
3164
              .attr('class', 'hill-chart-middle-line')
3165
              .attr('y1', this.yScale(0))
3166
              .attr('y2', this.yScale(100))
3167
              .attr('x2', this.xScale(50))
3168
              .attr('x1', this.xScale(50));
3169
          },
3170
        },
3171
        {
3172
          key: 'renderFooterText',
3173
          value: function () {
3174
            this.svg
3175
              .append('text')
3176
              .attr('class', 'hill-chart-text')
3177
              .text('Figuring things out')
3178
              .attr('x', this.xScale(25))
3179
              .attr('y', this.chartHeight + 25),
3180
              this.svg
3181
                .append('text')
3182
                .attr('class', 'hill-chart-text')
3183
                .text('Making it happen')
3184
                .attr('x', this.xScale(75))
3185
                .attr('y', this.chartHeight + 25);
3186
          },
3187
        },
3188
      ]) && t(e.prototype, i),
3189
      u && t(e, u),
3190
      l
3191
    );
3192
  })(f);
3193
});
3194

demo/hill-chart.cjs.js 1 location

@@ 1-3165 (lines=3165) @@
1
'use strict';
2
function t(t, n) {
3
  for (var e = 0; e < n.length; e++) {
4
    var r = n[e];
5
    (r.enumerable = r.enumerable || !1),
6
      (r.configurable = !0),
7
      'value' in r && (r.writable = !0),
8
      Object.defineProperty(t, r.key, r);
9
  }
10
}
11
function n(t, n, e) {
12
  return (
13
    n in t
14
      ? Object.defineProperty(t, n, {
15
          value: e,
16
          enumerable: !0,
17
          configurable: !0,
18
          writable: !0,
19
        })
20
      : (t[n] = e),
21
    t
22
  );
23
}
24
function e(t, n) {
25
  var e = Object.keys(t);
26
  if (Object.getOwnPropertySymbols) {
27
    var r = Object.getOwnPropertySymbols(t);
28
    n &&
29
      (r = r.filter(function (n) {
30
        return Object.getOwnPropertyDescriptor(t, n).enumerable;
31
      })),
32
      e.push.apply(e, r);
33
  }
34
  return e;
35
}
36
function r(t) {
37
  for (var r = 1; r < arguments.length; r++) {
38
    var i = null != arguments[r] ? arguments[r] : {};
39
    r % 2
40
      ? e(Object(i), !0).forEach(function (e) {
41
          n(t, e, i[e]);
42
        })
43
      : Object.getOwnPropertyDescriptors
44
      ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(i))
45
      : e(Object(i)).forEach(function (n) {
46
          Object.defineProperty(t, n, Object.getOwnPropertyDescriptor(i, n));
47
        });
48
  }
49
  return t;
50
}
51
function i(t) {
52
  return (i = Object.setPrototypeOf
53
    ? Object.getPrototypeOf
54
    : function (t) {
55
        return t.__proto__ || Object.getPrototypeOf(t);
56
      })(t);
57
}
58
function o(t, n) {
59
  return (o =
60
    Object.setPrototypeOf ||
61
    function (t, n) {
62
      return (t.__proto__ = n), t;
63
    })(t, n);
64
}
65
function a(t) {
66
  if (void 0 === t)
67
    throw new ReferenceError(
68
      "this hasn't been initialised - super() hasn't been called"
69
    );
70
  return t;
71
}
72
function u(t, n) {
73
  return !n || ('object' != typeof n && 'function' != typeof n) ? a(t) : n;
74
}
75
function s(t) {
76
  var n = (function () {
77
    if ('undefined' == typeof Reflect || !Reflect.construct) return !1;
78
    if (Reflect.construct.sham) return !1;
79
    if ('function' == typeof Proxy) return !0;
80
    try {
81
      return (
82
        Date.prototype.toString.call(
83
          Reflect.construct(Date, [], function () {})
84
        ),
85
        !0
86
      );
87
    } catch (t) {
88
      return !1;
89
    }
90
  })();
91
  return function () {
92
    var e,
93
      r = i(t);
94
    if (n) {
95
      var o = i(this).constructor;
96
      e = Reflect.construct(r, arguments, o);
97
    } else e = r.apply(this, arguments);
98
    return u(this, e);
99
  };
100
}
101
var c = (function () {
102
  function t(t, n) {
103
    for (var e = 0; e < n.length; e++) {
104
      var r = n[e];
105
      (r.enumerable = r.enumerable || !1),
106
        (r.configurable = !0),
107
        'value' in r && (r.writable = !0),
108
        Object.defineProperty(t, r.key, r);
109
    }
110
  }
111
  return function (n, e, r) {
112
    return e && t(n.prototype, e), r && t(n, r), n;
113
  };
114
})();
115
function l(t, n) {
116
  if (!(t instanceof n))
117
    throw new TypeError('Cannot call a class as a function');
118
}
119
var h = { emitDelay: 10, strictMode: !1 },
120
  f = (function () {
121
    function t() {
122
      var n =
123
        arguments.length <= 0 || void 0 === arguments[0] ? h : arguments[0];
124
      l(this, t);
125
      var e = void 0,
126
        r = void 0;
127
      (e = n.hasOwnProperty('emitDelay') ? n.emitDelay : h.emitDelay),
128
        (this._emitDelay = e),
129
        (r = n.hasOwnProperty('strictMode') ? n.strictMode : h.strictMode),
130
        (this._strictMode = r),
131
        (this._listeners = {}),
132
        (this.events = []);
133
    }
134
    return (
135
      c(t, [
136
        {
137
          key: '_addListenner',
138
          value: function (t, n, e) {
139
            if ('function' != typeof n)
140
              throw TypeError('listener must be a function');
141
            -1 === this.events.indexOf(t)
142
              ? ((this._listeners[t] = [{ once: e, fn: n }]),
143
                this.events.push(t))
144
              : this._listeners[t].push({ once: e, fn: n });
145
          },
146
        },
147
        {
148
          key: 'on',
149
          value: function (t, n) {
150
            this._addListenner(t, n, !1);
151
          },
152
        },
153
        {
154
          key: 'once',
155
          value: function (t, n) {
156
            this._addListenner(t, n, !0);
157
          },
158
        },
159
        {
160
          key: 'off',
161
          value: function (t, n) {
162
            var e,
163
              r,
164
              i = this,
165
              o = this.events.indexOf(t);
166
            t &&
167
              -1 !== o &&
168
              (n
169
                ? ((e = []),
170
                  (r = i._listeners[t]).forEach(function (t, r) {
171
                    t.fn === n && e.unshift(r);
172
                  }),
173
                  e.forEach(function (t) {
174
                    r.splice(t, 1);
175
                  }),
176
                  r.length || (i.events.splice(o, 1), delete i._listeners[t]))
177
                : (delete this._listeners[t], this.events.splice(o, 1)));
178
          },
179
        },
180
        {
181
          key: '_applyEvents',
182
          value: function (t, n) {
183
            var e = this._listeners[t];
184
            if (e && e.length) {
185
              var r = [];
186
              e.forEach(function (t, e) {
187
                t.fn.apply(null, n), t.once && r.unshift(e);
188
              }),
189
                r.forEach(function (t) {
190
                  e.splice(t, 1);
191
                });
192
            } else if (this._strictMode)
193
              throw 'No listeners specified for event: ' + t;
194
          },
195
        },
196
        {
197
          key: 'emit',
198
          value: function (t) {
199
            for (
200
              var n = this,
201
                e = arguments.length,
202
                r = Array(e > 1 ? e - 1 : 0),
203
                i = 1;
204
              i < e;
205
              i++
206
            )
207
              r[i - 1] = arguments[i];
208
            this._emitDelay
209
              ? setTimeout(function () {
210
                  n._applyEvents.call(n, t, r);
211
                }, this._emitDelay)
212
              : this._applyEvents(t, r);
213
          },
214
        },
215
        {
216
          key: 'emitSync',
217
          value: function (t) {
218
            for (
219
              var n = arguments.length, e = Array(n > 1 ? n - 1 : 0), r = 1;
220
              r < n;
221
              r++
222
            )
223
              e[r - 1] = arguments[r];
224
            this._applyEvents(t, e);
225
          },
226
        },
227
        {
228
          key: 'destroy',
229
          value: function () {
230
            (this._listeners = {}), (this.events = []);
231
          },
232
        },
233
      ]),
234
      t
235
    );
236
  })(),
237
  p = 'http://www.w3.org/1999/xhtml',
238
  d = {
239
    svg: 'http://www.w3.org/2000/svg',
240
    xhtml: p,
241
    xlink: 'http://www.w3.org/1999/xlink',
242
    xml: 'http://www.w3.org/XML/1998/namespace',
243
    xmlns: 'http://www.w3.org/2000/xmlns/',
244
  };
245
function g(t) {
246
  var n = (t += ''),
247
    e = n.indexOf(':');
248
  return (
249
    e >= 0 && 'xmlns' !== (n = t.slice(0, e)) && (t = t.slice(e + 1)),
250
    d.hasOwnProperty(n) ? { space: d[n], local: t } : t
251
  );
252
}
253
function y(t) {
254
  return function () {
255
    var n = this.ownerDocument,
256
      e = this.namespaceURI;
257
    return e === p && n.documentElement.namespaceURI === p
258
      ? n.createElement(t)
259
      : n.createElementNS(e, t);
260
  };
261
}
262
function v(t) {
263
  return function () {
264
    return this.ownerDocument.createElementNS(t.space, t.local);
265
  };
266
}
267
function m(t) {
268
  var n = g(t);
269
  return (n.local ? v : y)(n);
270
}
271
function _() {}
272
function w(t) {
273
  return null == t
274
    ? _
275
    : function () {
276
        return this.querySelector(t);
277
      };
278
}
279
function x() {
280
  return [];
281
}
282
function b(t) {
283
  return new Array(t.length);
284
}
285
function M(t, n) {
286
  (this.ownerDocument = t.ownerDocument),
287
    (this.namespaceURI = t.namespaceURI),
288
    (this._next = null),
289
    (this._parent = t),
290
    (this.__data__ = n);
291
}
292
M.prototype = {
293
  constructor: M,
294
  appendChild: function (t) {
295
    return this._parent.insertBefore(t, this._next);
296
  },
297
  insertBefore: function (t, n) {
298
    return this._parent.insertBefore(t, n);
299
  },
300
  querySelector: function (t) {
301
    return this._parent.querySelector(t);
302
  },
303
  querySelectorAll: function (t) {
304
    return this._parent.querySelectorAll(t);
305
  },
306
};
307
function k(t, n, e, r, i, o) {
308
  for (var a, u = 0, s = n.length, c = o.length; u < c; ++u)
309
    (a = n[u]) ? ((a.__data__ = o[u]), (r[u] = a)) : (e[u] = new M(t, o[u]));
310
  for (; u < s; ++u) (a = n[u]) && (i[u] = a);
311
}
312
function N(t, n, e, r, i, o, a) {
313
  var u,
314
    s,
315
    c,
316
    l = {},
317
    h = n.length,
318
    f = o.length,
319
    p = new Array(h);
320
  for (u = 0; u < h; ++u)
321
    (s = n[u]) &&
322
      ((p[u] = c = '$' + a.call(s, s.__data__, u, n)),
323
      c in l ? (i[u] = s) : (l[c] = s));
324
  for (u = 0; u < f; ++u)
325
    (s = l[(c = '$' + a.call(t, o[u], u, o))])
326
      ? ((r[u] = s), (s.__data__ = o[u]), (l[c] = null))
327
      : (e[u] = new M(t, o[u]));
328
  for (u = 0; u < h; ++u) (s = n[u]) && l[p[u]] === s && (i[u] = s);
329
}
330
function S(t, n) {
331
  return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN;
332
}
333
function A(t) {
334
  return function () {
335
    this.removeAttribute(t);
336
  };
337
}
338
function E(t) {
339
  return function () {
340
    this.removeAttributeNS(t.space, t.local);
341
  };
342
}
343
function P(t, n) {
344
  return function () {
345
    this.setAttribute(t, n);
346
  };
347
}
348
function O(t, n) {
349
  return function () {
350
    this.setAttributeNS(t.space, t.local, n);
351
  };
352
}
353
function j(t, n) {
354
  return function () {
355
    var e = n.apply(this, arguments);
356
    null == e ? this.removeAttribute(t) : this.setAttribute(t, e);
357
  };
358
}
359
function T(t, n) {
360
  return function () {
361
    var e = n.apply(this, arguments);
362
    null == e
363
      ? this.removeAttributeNS(t.space, t.local)
364
      : this.setAttributeNS(t.space, t.local, e);
365
  };
366
}
367
function C(t) {
368
  return (
369
    (t.ownerDocument && t.ownerDocument.defaultView) ||
370
    (t.document && t) ||
371
    t.defaultView
372
  );
373
}
374
function L(t) {
375
  return function () {
376
    this.style.removeProperty(t);
377
  };
378
}
379
function z(t, n, e) {
380
  return function () {
381
    this.style.setProperty(t, n, e);
382
  };
383
}
384
function D(t, n, e) {
385
  return function () {
386
    var r = n.apply(this, arguments);
387
    null == r ? this.style.removeProperty(t) : this.style.setProperty(t, r, e);
388
  };
389
}
390
function q(t, n) {
391
  return (
392
    t.style.getPropertyValue(n) ||
393
    C(t).getComputedStyle(t, null).getPropertyValue(n)
394
  );
395
}
396
function R(t) {
397
  return function () {
398
    delete this[t];
399
  };
400
}
401
function H(t, n) {
402
  return function () {
403
    this[t] = n;
404
  };
405
}
406
function I(t, n) {
407
  return function () {
408
    var e = n.apply(this, arguments);
409
    null == e ? delete this[t] : (this[t] = e);
410
  };
411
}
412
function V(t) {
413
  return t.trim().split(/^|\s+/);
414
}
415
function $(t) {
416
  return t.classList || new B(t);
417
}
418
function B(t) {
419
  (this._node = t), (this._names = V(t.getAttribute('class') || ''));
420
}
421
function F(t, n) {
422
  for (var e = $(t), r = -1, i = n.length; ++r < i; ) e.add(n[r]);
423
}
424
function U(t, n) {
425
  for (var e = $(t), r = -1, i = n.length; ++r < i; ) e.remove(n[r]);
426
}
427
function X(t) {
428
  return function () {
429
    F(this, t);
430
  };
431
}
432
function W(t) {
433
  return function () {
434
    U(this, t);
435
  };
436
}
437
function Y(t, n) {
438
  return function () {
439
    (n.apply(this, arguments) ? F : U)(this, t);
440
  };
441
}
442
function G() {
443
  this.textContent = '';
444
}
445
function Z(t) {
446
  return function () {
447
    this.textContent = t;
448
  };
449
}
450
function K(t) {
451
  return function () {
452
    var n = t.apply(this, arguments);
453
    this.textContent = null == n ? '' : n;
454
  };
455
}
456
function Q() {
457
  this.innerHTML = '';
458
}
459
function J(t) {
460
  return function () {
461
    this.innerHTML = t;
462
  };
463
}
464
function tt(t) {
465
  return function () {
466
    var n = t.apply(this, arguments);
467
    this.innerHTML = null == n ? '' : n;
468
  };
469
}
470
function nt() {
471
  this.nextSibling && this.parentNode.appendChild(this);
472
}
473
function et() {
474
  this.previousSibling &&
475
    this.parentNode.insertBefore(this, this.parentNode.firstChild);
476
}
477
function rt() {
478
  return null;
479
}
480
function it() {
481
  var t = this.parentNode;
482
  t && t.removeChild(this);
483
}
484
function ot() {
485
  var t = this.cloneNode(!1),
486
    n = this.parentNode;
487
  return n ? n.insertBefore(t, this.nextSibling) : t;
488
}
489
function at() {
490
  var t = this.cloneNode(!0),
491
    n = this.parentNode;
492
  return n ? n.insertBefore(t, this.nextSibling) : t;
493
}
494
B.prototype = {
495
  add: function (t) {
496
    this._names.indexOf(t) < 0 &&
497
      (this._names.push(t),
498
      this._node.setAttribute('class', this._names.join(' ')));
499
  },
500
  remove: function (t) {
501
    var n = this._names.indexOf(t);
502
    n >= 0 &&
503
      (this._names.splice(n, 1),
504
      this._node.setAttribute('class', this._names.join(' ')));
505
  },
506
  contains: function (t) {
507
    return this._names.indexOf(t) >= 0;
508
  },
509
};
510
var ut = {},
511
  st = null;
512
'undefined' != typeof document &&
513
  ('onmouseenter' in document.documentElement ||
514
    (ut = { mouseenter: 'mouseover', mouseleave: 'mouseout' }));
515
function ct(t, n, e) {
516
  return (
517
    (t = lt(t, n, e)),
518
    function (n) {
519
      var e = n.relatedTarget;
520
      (e && (e === this || 8 & e.compareDocumentPosition(this))) ||
521
        t.call(this, n);
522
    }
523
  );
524
}
525
function lt(t, n, e) {
526
  return function (r) {
527
    var i = st;
528
    st = r;
529
    try {
530
      t.call(this, this.__data__, n, e);
531
    } finally {
532
      st = i;
533
    }
534
  };
535
}
536
function ht(t) {
537
  return t
538
    .trim()
539
    .split(/^|\s+/)
540
    .map(function (t) {
541
      var n = '',
542
        e = t.indexOf('.');
543
      return (
544
        e >= 0 && ((n = t.slice(e + 1)), (t = t.slice(0, e))),
545
        { type: t, name: n }
546
      );
547
    });
548
}
549
function ft(t) {
550
  return function () {
551
    var n = this.__on;
552
    if (n) {
553
      for (var e, r = 0, i = -1, o = n.length; r < o; ++r)
554
        (e = n[r]),
555
          (t.type && e.type !== t.type) || e.name !== t.name
556
            ? (n[++i] = e)
557
            : this.removeEventListener(e.type, e.listener, e.capture);
558
      ++i ? (n.length = i) : delete this.__on;
559
    }
560
  };
561
}
562
function pt(t, n, e) {
563
  var r = ut.hasOwnProperty(t.type) ? ct : lt;
564
  return function (i, o, a) {
565
    var u,
566
      s = this.__on,
567
      c = r(n, o, a);
568
    if (s)
569
      for (var l = 0, h = s.length; l < h; ++l)
570
        if ((u = s[l]).type === t.type && u.name === t.name)
571
          return (
572
            this.removeEventListener(u.type, u.listener, u.capture),
573
            this.addEventListener(u.type, (u.listener = c), (u.capture = e)),
574
            void (u.value = n)
575
          );
576
    this.addEventListener(t.type, c, e),
577
      (u = { type: t.type, name: t.name, value: n, listener: c, capture: e }),
578
      s ? s.push(u) : (this.__on = [u]);
579
  };
580
}
581
function dt(t, n, e, r) {
582
  var i = st;
583
  (t.sourceEvent = st), (st = t);
584
  try {
585
    return n.apply(e, r);
586
  } finally {
587
    st = i;
588
  }
589
}
590
function gt(t, n, e) {
591
  var r = C(t),
592
    i = r.CustomEvent;
593
  'function' == typeof i
594
    ? (i = new i(n, e))
595
    : ((i = r.document.createEvent('Event')),
596
      e
597
        ? (i.initEvent(n, e.bubbles, e.cancelable), (i.detail = e.detail))
598
        : i.initEvent(n, !1, !1)),
599
    t.dispatchEvent(i);
600
}
601
function yt(t, n) {
602
  return function () {
603
    return gt(this, t, n);
604
  };
605
}
606
function vt(t, n) {
607
  return function () {
608
    return gt(this, t, n.apply(this, arguments));
609
  };
610
}
611
var mt = [null];
612
function _t(t, n) {
613
  (this._groups = t), (this._parents = n);
614
}
615
function wt(t) {
616
  return 'string' == typeof t
617
    ? new _t([[document.querySelector(t)]], [document.documentElement])
618
    : new _t([[t]], mt);
619
}
620
function xt() {
621
  for (var t, n = st; (t = n.sourceEvent); ) n = t;
622
  return n;
623
}
624
function bt(t, n) {
625
  var e = t.ownerSVGElement || t;
626
  if (e.createSVGPoint) {
627
    var r = e.createSVGPoint();
628
    return (
629
      (r.x = n.clientX),
630
      (r.y = n.clientY),
631
      [(r = r.matrixTransform(t.getScreenCTM().inverse())).x, r.y]
632
    );
633
  }
634
  var i = t.getBoundingClientRect();
635
  return [n.clientX - i.left - t.clientLeft, n.clientY - i.top - t.clientTop];
636
}
637
function Mt(t) {
638
  var n = xt();
639
  return n.changedTouches && (n = n.changedTouches[0]), bt(t, n);
640
}
641
function kt(t, n, e) {
642
  arguments.length < 3 && ((e = n), (n = xt().changedTouches));
643
  for (var r, i = 0, o = n ? n.length : 0; i < o; ++i)
644
    if ((r = n[i]).identifier === e) return bt(t, r);
645
  return null;
646
}
647
function Nt(t, n) {
648
  return t < n ? -1 : t > n ? 1 : t >= n ? 0 : NaN;
649
}
650
_t.prototype = function () {
651
  return new _t([[document.documentElement]], mt);
652
}.prototype = {
653
  constructor: _t,
654
  select: function (t) {
655
    'function' != typeof t && (t = w(t));
656
    for (
657
      var n = this._groups, e = n.length, r = new Array(e), i = 0;
658
      i < e;
659
      ++i
660
    )
661
      for (
662
        var o, a, u = n[i], s = u.length, c = (r[i] = new Array(s)), l = 0;
663
        l < s;
664
        ++l
665
      )
666
        (o = u[l]) &&
667
          (a = t.call(o, o.__data__, l, u)) &&
668
          ('__data__' in o && (a.__data__ = o.__data__), (c[l] = a));
669
    return new _t(r, this._parents);
670
  },
671
  selectAll: function (t) {
672
    'function' != typeof t &&
673
      (t = (function (t) {
674
        return null == t
675
          ? x
676
          : function () {
677
              return this.querySelectorAll(t);
678
            };
679
      })(t));
680
    for (var n = this._groups, e = n.length, r = [], i = [], o = 0; o < e; ++o)
681
      for (var a, u = n[o], s = u.length, c = 0; c < s; ++c)
682
        (a = u[c]) && (r.push(t.call(a, a.__data__, c, u)), i.push(a));
683
    return new _t(r, i);
684
  },
685
  filter: function (t) {
686
    'function' != typeof t &&
687
      (t = (function (t) {
688
        return function () {
689
          return this.matches(t);
690
        };
691
      })(t));
692
    for (
693
      var n = this._groups, e = n.length, r = new Array(e), i = 0;
694
      i < e;
695
      ++i
696
    )
697
      for (var o, a = n[i], u = a.length, s = (r[i] = []), c = 0; c < u; ++c)
698
        (o = a[c]) && t.call(o, o.__data__, c, a) && s.push(o);
699
    return new _t(r, this._parents);
700
  },
701
  data: function (t, n) {
702
    if (!t)
703
      return (
704
        (p = new Array(this.size())),
705
        (c = -1),
706
        this.each(function (t) {
707
          p[++c] = t;
708
        }),
709
        p
710
      );
711
    var e = n ? N : k,
712
      r = this._parents,
713
      i = this._groups;
714
    'function' != typeof t &&
715
      (t = (function (t) {
716
        return function () {
717
          return t;
718
        };
719
      })(t));
720
    for (
721
      var o = i.length,
722
        a = new Array(o),
723
        u = new Array(o),
724
        s = new Array(o),
725
        c = 0;
726
      c < o;
727
      ++c
728
    ) {
729
      var l = r[c],
730
        h = i[c],
731
        f = h.length,
732
        p = t.call(l, l && l.__data__, c, r),
733
        d = p.length,
734
        g = (u[c] = new Array(d)),
735
        y = (a[c] = new Array(d));
736
      e(l, h, g, y, (s[c] = new Array(f)), p, n);
737
      for (var v, m, _ = 0, w = 0; _ < d; ++_)
738
        if ((v = g[_])) {
739
          for (_ >= w && (w = _ + 1); !(m = y[w]) && ++w < d; );
740
          v._next = m || null;
741
        }
742
    }
743
    return ((a = new _t(a, r))._enter = u), (a._exit = s), a;
744
  },
745
  enter: function () {
746
    return new _t(this._enter || this._groups.map(b), this._parents);
747
  },
748
  exit: function () {
749
    return new _t(this._exit || this._groups.map(b), this._parents);
750
  },
751
  join: function (t, n, e) {
752
    var r = this.enter(),
753
      i = this,
754
      o = this.exit();
755
    return (
756
      (r = 'function' == typeof t ? t(r) : r.append(t + '')),
757
      null != n && (i = n(i)),
758
      null == e ? o.remove() : e(o),
759
      r && i ? r.merge(i).order() : i
760
    );
761
  },
762
  merge: function (t) {
763
    for (
764
      var n = this._groups,
765
        e = t._groups,
766
        r = n.length,
767
        i = e.length,
768
        o = Math.min(r, i),
769
        a = new Array(r),
770
        u = 0;
771
      u < o;
772
      ++u
773
    )
774
      for (
775
        var s,
776
          c = n[u],
777
          l = e[u],
778
          h = c.length,
779
          f = (a[u] = new Array(h)),
780
          p = 0;
781
        p < h;
782
        ++p
783
      )
784
        (s = c[p] || l[p]) && (f[p] = s);
785
    for (; u < r; ++u) a[u] = n[u];
786
    return new _t(a, this._parents);
787
  },
788
  order: function () {
789
    for (var t = this._groups, n = -1, e = t.length; ++n < e; )
790
      for (var r, i = t[n], o = i.length - 1, a = i[o]; --o >= 0; )
791
        (r = i[o]) &&
792
          (a &&
793
            4 ^ r.compareDocumentPosition(a) &&
794
            a.parentNode.insertBefore(r, a),
795
          (a = r));
796
    return this;
797
  },
798
  sort: function (t) {
799
    function n(n, e) {
800
      return n && e ? t(n.__data__, e.__data__) : !n - !e;
801
    }
802
    t || (t = S);
803
    for (
804
      var e = this._groups, r = e.length, i = new Array(r), o = 0;
805
      o < r;
806
      ++o
807
    ) {
808
      for (
809
        var a, u = e[o], s = u.length, c = (i[o] = new Array(s)), l = 0;
810
        l < s;
811
        ++l
812
      )
813
        (a = u[l]) && (c[l] = a);
814
      c.sort(n);
815
    }
816
    return new _t(i, this._parents).order();
817
  },
818
  call: function () {
819
    var t = arguments[0];
820
    return (arguments[0] = this), t.apply(null, arguments), this;
821
  },
822
  nodes: function () {
823
    var t = new Array(this.size()),
824
      n = -1;
825
    return (
826
      this.each(function () {
827
        t[++n] = this;
828
      }),
829
      t
830
    );
831
  },
832
  node: function () {
833
    for (var t = this._groups, n = 0, e = t.length; n < e; ++n)
834
      for (var r = t[n], i = 0, o = r.length; i < o; ++i) {
835
        var a = r[i];
836
        if (a) return a;
837
      }
838
    return null;
839
  },
840
  size: function () {
841
    var t = 0;
842
    return (
843
      this.each(function () {
844
        ++t;
845
      }),
846
      t
847
    );
848
  },
849
  empty: function () {
850
    return !this.node();
851
  },
852
  each: function (t) {
853
    for (var n = this._groups, e = 0, r = n.length; e < r; ++e)
854
      for (var i, o = n[e], a = 0, u = o.length; a < u; ++a)
855
        (i = o[a]) && t.call(i, i.__data__, a, o);
856
    return this;
857
  },
858
  attr: function (t, n) {
859
    var e = g(t);
860
    if (arguments.length < 2) {
861
      var r = this.node();
862
      return e.local ? r.getAttributeNS(e.space, e.local) : r.getAttribute(e);
863
    }
864
    return this.each(
865
      (null == n
866
        ? e.local
867
          ? E
868
          : A
869
        : 'function' == typeof n
870
        ? e.local
871
          ? T
872
          : j
873
        : e.local
874
        ? O
875
        : P)(e, n)
876
    );
877
  },
878
  style: function (t, n, e) {
879
    return arguments.length > 1
880
      ? this.each(
881
          (null == n ? L : 'function' == typeof n ? D : z)(
882
            t,
883
            n,
884
            null == e ? '' : e
885
          )
886
        )
887
      : q(this.node(), t);
888
  },
889
  property: function (t, n) {
890
    return arguments.length > 1
891
      ? this.each((null == n ? R : 'function' == typeof n ? I : H)(t, n))
892
      : this.node()[t];
893
  },
894
  classed: function (t, n) {
895
    var e = V(t + '');
896
    if (arguments.length < 2) {
897
      for (var r = $(this.node()), i = -1, o = e.length; ++i < o; )
898
        if (!r.contains(e[i])) return !1;
899
      return !0;
900
    }
901
    return this.each(('function' == typeof n ? Y : n ? X : W)(e, n));
902
  },
903
  text: function (t) {
904
    return arguments.length
905
      ? this.each(null == t ? G : ('function' == typeof t ? K : Z)(t))
906
      : this.node().textContent;
907
  },
908
  html: function (t) {
909
    return arguments.length
910
      ? this.each(null == t ? Q : ('function' == typeof t ? tt : J)(t))
911
      : this.node().innerHTML;
912
  },
913
  raise: function () {
914
    return this.each(nt);
915
  },
916
  lower: function () {
917
    return this.each(et);
918
  },
919
  append: function (t) {
920
    var n = 'function' == typeof t ? t : m(t);
921
    return this.select(function () {
922
      return this.appendChild(n.apply(this, arguments));
923
    });
924
  },
925
  insert: function (t, n) {
926
    var e = 'function' == typeof t ? t : m(t),
927
      r = null == n ? rt : 'function' == typeof n ? n : w(n);
928
    return this.select(function () {
929
      return this.insertBefore(
930
        e.apply(this, arguments),
931
        r.apply(this, arguments) || null
932
      );
933
    });
934
  },
935
  remove: function () {
936
    return this.each(it);
937
  },
938
  clone: function (t) {
939
    return this.select(t ? at : ot);
940
  },
941
  datum: function (t) {
942
    return arguments.length
943
      ? this.property('__data__', t)
944
      : this.node().__data__;
945
  },
946
  on: function (t, n, e) {
947
    var r,
948
      i,
949
      o = ht(t + ''),
950
      a = o.length;
951
    if (!(arguments.length < 2)) {
952
      for (u = n ? pt : ft, null == e && (e = !1), r = 0; r < a; ++r)
953
        this.each(u(o[r], n, e));
954
      return this;
955
    }
956
    var u = this.node().__on;
957
    if (u)
958
      for (var s, c = 0, l = u.length; c < l; ++c)
959
        for (r = 0, s = u[c]; r < a; ++r)
960
          if ((i = o[r]).type === s.type && i.name === s.name) return s.value;
961
  },
962
  dispatch: function (t, n) {
963
    return this.each(('function' == typeof n ? vt : yt)(t, n));
964
  },
965
};
966
var St,
967
  At,
968
  Et = (1 === (St = Nt).length &&
969
    ((At = St),
970
    (St = function (t, n) {
971
      return Nt(At(t), n);
972
    })),
973
  {
974
    left: function (t, n, e, r) {
975
      for (null == e && (e = 0), null == r && (r = t.length); e < r; ) {
976
        var i = (e + r) >>> 1;
977
        St(t[i], n) < 0 ? (e = i + 1) : (r = i);
978
      }
979
      return e;
980
    },
981
    right: function (t, n, e, r) {
982
      for (null == e && (e = 0), null == r && (r = t.length); e < r; ) {
983
        var i = (e + r) >>> 1;
984
        St(t[i], n) > 0 ? (r = i) : (e = i + 1);
985
      }
986
      return e;
987
    },
988
  }).right;
989
var Pt = Math.sqrt(50),
990
  Ot = Math.sqrt(10),
991
  jt = Math.sqrt(2);
992
function Tt(t, n, e) {
993
  var r = (n - t) / Math.max(0, e),
994
    i = Math.floor(Math.log(r) / Math.LN10),
995
    o = r / Math.pow(10, i);
996
  return i >= 0
997
    ? (o >= Pt ? 10 : o >= Ot ? 5 : o >= jt ? 2 : 1) * Math.pow(10, i)
998
    : -Math.pow(10, -i) / (o >= Pt ? 10 : o >= Ot ? 5 : o >= jt ? 2 : 1);
999
}
1000
function Ct(t, n) {
1001
  switch (arguments.length) {
1002
    case 0:
1003
      break;
1004
    case 1:
1005
      this.range(t);
1006
      break;
1007
    default:
1008
      this.range(n).domain(t);
1009
  }
1010
  return this;
1011
}
1012
function Lt(t, n, e) {
1013
  (t.prototype = n.prototype = e), (e.constructor = t);
1014
}
1015
function zt(t, n) {
1016
  var e = Object.create(t.prototype);
1017
  for (var r in n) e[r] = n[r];
1018
  return e;
1019
}
1020
function Dt() {}
1021
var qt = '\\s*([+-]?\\d+)\\s*',
1022
  Rt = '\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*',
1023
  Ht = '\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*',
1024
  It = /^#([0-9a-f]{3,8})$/,
1025
  Vt = new RegExp('^rgb\\(' + [qt, qt, qt] + '\\)$'),
1026
  $t = new RegExp('^rgb\\(' + [Ht, Ht, Ht] + '\\)$'),
1027
  Bt = new RegExp('^rgba\\(' + [qt, qt, qt, Rt] + '\\)$'),
1028
  Ft = new RegExp('^rgba\\(' + [Ht, Ht, Ht, Rt] + '\\)$'),
1029
  Ut = new RegExp('^hsl\\(' + [Rt, Ht, Ht] + '\\)$'),
1030
  Xt = new RegExp('^hsla\\(' + [Rt, Ht, Ht, Rt] + '\\)$'),
1031
  Wt = {
1032
    aliceblue: 15792383,
1033
    antiquewhite: 16444375,
1034
    aqua: 65535,
1035
    aquamarine: 8388564,
1036
    azure: 15794175,
1037
    beige: 16119260,
1038
    bisque: 16770244,
1039
    black: 0,
1040
    blanchedalmond: 16772045,
1041
    blue: 255,
1042
    blueviolet: 9055202,
1043
    brown: 10824234,
1044
    burlywood: 14596231,
1045
    cadetblue: 6266528,
1046
    chartreuse: 8388352,
1047
    chocolate: 13789470,
1048
    coral: 16744272,
1049
    cornflowerblue: 6591981,
1050
    cornsilk: 16775388,
1051
    crimson: 14423100,
1052
    cyan: 65535,
1053
    darkblue: 139,
1054
    darkcyan: 35723,
1055
    darkgoldenrod: 12092939,
1056
    darkgray: 11119017,
1057
    darkgreen: 25600,
1058
    darkgrey: 11119017,
1059
    darkkhaki: 12433259,
1060
    darkmagenta: 9109643,
1061
    darkolivegreen: 5597999,
1062
    darkorange: 16747520,
1063
    darkorchid: 10040012,
1064
    darkred: 9109504,
1065
    darksalmon: 15308410,
1066
    darkseagreen: 9419919,
1067
    darkslateblue: 4734347,
1068
    darkslategray: 3100495,
1069
    darkslategrey: 3100495,
1070
    darkturquoise: 52945,
1071
    darkviolet: 9699539,
1072
    deeppink: 16716947,
1073
    deepskyblue: 49151,
1074
    dimgray: 6908265,
1075
    dimgrey: 6908265,
1076
    dodgerblue: 2003199,
1077
    firebrick: 11674146,
1078
    floralwhite: 16775920,
1079
    forestgreen: 2263842,
1080
    fuchsia: 16711935,
1081
    gainsboro: 14474460,
1082
    ghostwhite: 16316671,
1083
    gold: 16766720,
1084
    goldenrod: 14329120,
1085
    gray: 8421504,
1086
    green: 32768,
1087
    greenyellow: 11403055,
1088
    grey: 8421504,
1089
    honeydew: 15794160,
1090
    hotpink: 16738740,
1091
    indianred: 13458524,
1092
    indigo: 4915330,
1093
    ivory: 16777200,
1094
    khaki: 15787660,
1095
    lavender: 15132410,
1096
    lavenderblush: 16773365,
1097
    lawngreen: 8190976,
1098
    lemonchiffon: 16775885,
1099
    lightblue: 11393254,
1100
    lightcoral: 15761536,
1101
    lightcyan: 14745599,
1102
    lightgoldenrodyellow: 16448210,
1103
    lightgray: 13882323,
1104
    lightgreen: 9498256,
1105
    lightgrey: 13882323,
1106
    lightpink: 16758465,
1107
    lightsalmon: 16752762,
1108
    lightseagreen: 2142890,
1109
    lightskyblue: 8900346,
1110
    lightslategray: 7833753,
1111
    lightslategrey: 7833753,
1112
    lightsteelblue: 11584734,
1113
    lightyellow: 16777184,
1114
    lime: 65280,
1115
    limegreen: 3329330,
1116
    linen: 16445670,
1117
    magenta: 16711935,
1118
    maroon: 8388608,
1119
    mediumaquamarine: 6737322,
1120
    mediumblue: 205,
1121
    mediumorchid: 12211667,
1122
    mediumpurple: 9662683,
1123
    mediumseagreen: 3978097,
1124
    mediumslateblue: 8087790,
1125
    mediumspringgreen: 64154,
1126
    mediumturquoise: 4772300,
1127
    mediumvioletred: 13047173,
1128
    midnightblue: 1644912,
1129
    mintcream: 16121850,
1130
    mistyrose: 16770273,
1131
    moccasin: 16770229,
1132
    navajowhite: 16768685,
1133
    navy: 128,
1134
    oldlace: 16643558,
1135
    olive: 8421376,
1136
    olivedrab: 7048739,
1137
    orange: 16753920,
1138
    orangered: 16729344,
1139
    orchid: 14315734,
1140
    palegoldenrod: 15657130,
1141
    palegreen: 10025880,
1142
    paleturquoise: 11529966,
1143
    palevioletred: 14381203,
1144
    papayawhip: 16773077,
1145
    peachpuff: 16767673,
1146
    peru: 13468991,
1147
    pink: 16761035,
1148
    plum: 14524637,
1149
    powderblue: 11591910,
1150
    purple: 8388736,
1151
    rebeccapurple: 6697881,
1152
    red: 16711680,
1153
    rosybrown: 12357519,
1154
    royalblue: 4286945,
1155
    saddlebrown: 9127187,
1156
    salmon: 16416882,
1157
    sandybrown: 16032864,
1158
    seagreen: 3050327,
1159
    seashell: 16774638,
1160
    sienna: 10506797,
1161
    silver: 12632256,
1162
    skyblue: 8900331,
1163
    slateblue: 6970061,
1164
    slategray: 7372944,
1165
    slategrey: 7372944,
1166
    snow: 16775930,
1167
    springgreen: 65407,
1168
    steelblue: 4620980,
1169
    tan: 13808780,
1170
    teal: 32896,
1171
    thistle: 14204888,
1172
    tomato: 16737095,
1173
    turquoise: 4251856,
1174
    violet: 15631086,
1175
    wheat: 16113331,
1176
    white: 16777215,
1177
    whitesmoke: 16119285,
1178
    yellow: 16776960,
1179
    yellowgreen: 10145074,
1180
  };
1181
function Yt() {
1182
  return this.rgb().formatHex();
1183
}
1184
function Gt() {
1185
  return this.rgb().formatRgb();
1186
}
1187
function Zt(t) {
1188
  var n, e;
1189
  return (
1190
    (t = (t + '').trim().toLowerCase()),
1191
    (n = It.exec(t))
1192
      ? ((e = n[1].length),
1193
        (n = parseInt(n[1], 16)),
1194
        6 === e
1195
          ? Kt(n)
1196
          : 3 === e
1197
          ? new nn(
1198
              ((n >> 8) & 15) | ((n >> 4) & 240),
1199
              ((n >> 4) & 15) | (240 & n),
1200
              ((15 & n) << 4) | (15 & n),
1201
              1
1202
            )
1203
          : 8 === e
1204
          ? Qt(
1205
              (n >> 24) & 255,
1206
              (n >> 16) & 255,
1207
              (n >> 8) & 255,
1208
              (255 & n) / 255
1209
            )
1210
          : 4 === e
1211
          ? Qt(
1212
              ((n >> 12) & 15) | ((n >> 8) & 240),
1213
              ((n >> 8) & 15) | ((n >> 4) & 240),
1214
              ((n >> 4) & 15) | (240 & n),
1215
              (((15 & n) << 4) | (15 & n)) / 255
1216
            )
1217
          : null)
1218
      : (n = Vt.exec(t))
1219
      ? new nn(n[1], n[2], n[3], 1)
1220
      : (n = $t.exec(t))
1221
      ? new nn((255 * n[1]) / 100, (255 * n[2]) / 100, (255 * n[3]) / 100, 1)
1222
      : (n = Bt.exec(t))
1223
      ? Qt(n[1], n[2], n[3], n[4])
1224
      : (n = Ft.exec(t))
1225
      ? Qt((255 * n[1]) / 100, (255 * n[2]) / 100, (255 * n[3]) / 100, n[4])
1226
      : (n = Ut.exec(t))
1227
      ? an(n[1], n[2] / 100, n[3] / 100, 1)
1228
      : (n = Xt.exec(t))
1229
      ? an(n[1], n[2] / 100, n[3] / 100, n[4])
1230
      : Wt.hasOwnProperty(t)
1231
      ? Kt(Wt[t])
1232
      : 'transparent' === t
1233
      ? new nn(NaN, NaN, NaN, 0)
1234
      : null
1235
  );
1236
}
1237
function Kt(t) {
1238
  return new nn((t >> 16) & 255, (t >> 8) & 255, 255 & t, 1);
1239
}
1240
function Qt(t, n, e, r) {
1241
  return r <= 0 && (t = n = e = NaN), new nn(t, n, e, r);
1242
}
1243
function Jt(t) {
1244
  return (
1245
    t instanceof Dt || (t = Zt(t)),
1246
    t ? new nn((t = t.rgb()).r, t.g, t.b, t.opacity) : new nn()
1247
  );
1248
}
1249
function tn(t, n, e, r) {
1250
  return 1 === arguments.length ? Jt(t) : new nn(t, n, e, null == r ? 1 : r);
1251
}
1252
function nn(t, n, e, r) {
1253
  (this.r = +t), (this.g = +n), (this.b = +e), (this.opacity = +r);
1254
}
1255
function en() {
1256
  return '#' + on(this.r) + on(this.g) + on(this.b);
1257
}
1258
function rn() {
1259
  var t = this.opacity;
1260
  return (
1261
    (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t)))
1262
      ? 'rgb('
1263
      : 'rgba(') +
1264
    Math.max(0, Math.min(255, Math.round(this.r) || 0)) +
1265
    ', ' +
1266
    Math.max(0, Math.min(255, Math.round(this.g) || 0)) +
1267
    ', ' +
1268
    Math.max(0, Math.min(255, Math.round(this.b) || 0)) +
1269
    (1 === t ? ')' : ', ' + t + ')')
1270
  );
1271
}
1272
function on(t) {
1273
  return (
1274
    ((t = Math.max(0, Math.min(255, Math.round(t) || 0))) < 16 ? '0' : '') +
1275
    t.toString(16)
1276
  );
1277
}
1278
function an(t, n, e, r) {
1279
  return (
1280
    r <= 0
1281
      ? (t = n = e = NaN)
1282
      : e <= 0 || e >= 1
1283
      ? (t = n = NaN)
1284
      : n <= 0 && (t = NaN),
1285
    new sn(t, n, e, r)
1286
  );
1287
}
1288
function un(t) {
1289
  if (t instanceof sn) return new sn(t.h, t.s, t.l, t.opacity);
1290
  if ((t instanceof Dt || (t = Zt(t)), !t)) return new sn();
1291
  if (t instanceof sn) return t;
1292
  var n = (t = t.rgb()).r / 255,
1293
    e = t.g / 255,
1294
    r = t.b / 255,
1295
    i = Math.min(n, e, r),
1296
    o = Math.max(n, e, r),
1297
    a = NaN,
1298
    u = o - i,
1299
    s = (o + i) / 2;
1300
  return (
1301
    u
1302
      ? ((a =
1303
          n === o
1304
            ? (e - r) / u + 6 * (e < r)
1305
            : e === o
1306
            ? (r - n) / u + 2
1307
            : (n - e) / u + 4),
1308
        (u /= s < 0.5 ? o + i : 2 - o - i),
1309
        (a *= 60))
1310
      : (u = s > 0 && s < 1 ? 0 : a),
1311
    new sn(a, u, s, t.opacity)
1312
  );
1313
}
1314
function sn(t, n, e, r) {
1315
  (this.h = +t), (this.s = +n), (this.l = +e), (this.opacity = +r);
1316
}
1317
function cn(t, n, e) {
1318
  return (
1319
    255 *
1320
    (t < 60
1321
      ? n + ((e - n) * t) / 60
1322
      : t < 180
1323
      ? e
1324
      : t < 240
1325
      ? n + ((e - n) * (240 - t)) / 60
1326
      : n)
1327
  );
1328
}
1329
function ln(t) {
1330
  return function () {
1331
    return t;
1332
  };
1333
}
1334
function hn(t) {
1335
  return 1 == (t = +t)
1336
    ? fn
1337
    : function (n, e) {
1338
        return e - n
1339
          ? (function (t, n, e) {
1340
              return (
1341
                (t = Math.pow(t, e)),
1342
                (n = Math.pow(n, e) - t),
1343
                (e = 1 / e),
1344
                function (r) {
1345
                  return Math.pow(t + r * n, e);
1346
                }
1347
              );
1348
            })(n, e, t)
1349
          : ln(isNaN(n) ? e : n);
1350
      };
1351
}
1352
function fn(t, n) {
1353
  var e = n - t;
1354
  return e
1355
    ? (function (t, n) {
1356
        return function (e) {
1357
          return t + e * n;
1358
        };
1359
      })(t, e)
1360
    : ln(isNaN(t) ? n : t);
1361
}
1362
Lt(Dt, Zt, {
1363
  copy: function (t) {
1364
    return Object.assign(new this.constructor(), this, t);
1365
  },
1366
  displayable: function () {
1367
    return this.rgb().displayable();
1368
  },
1369
  hex: Yt,
1370
  formatHex: Yt,
1371
  formatHsl: function () {
1372
    return un(this).formatHsl();
1373
  },
1374
  formatRgb: Gt,
1375
  toString: Gt,
1376
}),
1377
  Lt(
1378
    nn,
1379
    tn,
1380
    zt(Dt, {
1381
      brighter: function (t) {
1382
        return (
1383
          (t = null == t ? 1 / 0.7 : Math.pow(1 / 0.7, t)),
1384
          new nn(this.r * t, this.g * t, this.b * t, this.opacity)
1385
        );
1386
      },
1387
      darker: function (t) {
1388
        return (
1389
          (t = null == t ? 0.7 : Math.pow(0.7, t)),
1390
          new nn(this.r * t, this.g * t, this.b * t, this.opacity)
1391
        );
1392
      },
1393
      rgb: function () {
1394
        return this;
1395
      },
1396
      displayable: function () {
1397
        return (
1398
          -0.5 <= this.r &&
1399
          this.r < 255.5 &&
1400
          -0.5 <= this.g &&
1401
          this.g < 255.5 &&
1402
          -0.5 <= this.b &&
1403
          this.b < 255.5 &&
1404
          0 <= this.opacity &&
1405
          this.opacity <= 1
1406
        );
1407
      },
1408
      hex: en,
1409
      formatHex: en,
1410
      formatRgb: rn,
1411
      toString: rn,
1412
    })
1413
  ),
1414
  Lt(
1415
    sn,
1416
    function (t, n, e, r) {
1417
      return 1 === arguments.length
1418
        ? un(t)
1419
        : new sn(t, n, e, null == r ? 1 : r);
1420
    },
1421
    zt(Dt, {
1422
      brighter: function (t) {
1423
        return (
1424
          (t = null == t ? 1 / 0.7 : Math.pow(1 / 0.7, t)),
1425
          new sn(this.h, this.s, this.l * t, this.opacity)
1426
        );
1427
      },
1428
      darker: function (t) {
1429
        return (
1430
          (t = null == t ? 0.7 : Math.pow(0.7, t)),
1431
          new sn(this.h, this.s, this.l * t, this.opacity)
1432
        );
1433
      },
1434
      rgb: function () {
1435
        var t = (this.h % 360) + 360 * (this.h < 0),
1436
          n = isNaN(t) || isNaN(this.s) ? 0 : this.s,
1437
          e = this.l,
1438
          r = e + (e < 0.5 ? e : 1 - e) * n,
1439
          i = 2 * e - r;
1440
        return new nn(
1441
          cn(t >= 240 ? t - 240 : t + 120, i, r),
1442
          cn(t, i, r),
1443
          cn(t < 120 ? t + 240 : t - 120, i, r),
1444
          this.opacity
1445
        );
1446
      },
1447
      displayable: function () {
1448
        return (
1449
          ((0 <= this.s && this.s <= 1) || isNaN(this.s)) &&
1450
          0 <= this.l &&
1451
          this.l <= 1 &&
1452
          0 <= this.opacity &&
1453
          this.opacity <= 1
1454
        );
1455
      },
1456
      formatHsl: function () {
1457
        var t = this.opacity;
1458
        return (
1459
          (1 === (t = isNaN(t) ? 1 : Math.max(0, Math.min(1, t)))
1460
            ? 'hsl('
1461
            : 'hsla(') +
1462
          (this.h || 0) +
1463
          ', ' +
1464
          100 * (this.s || 0) +
1465
          '%, ' +
1466
          100 * (this.l || 0) +
1467
          '%' +
1468
          (1 === t ? ')' : ', ' + t + ')')
1469
        );
1470
      },
1471
    })
1472
  );
1473
var pn = (function t(n) {
1474
  var e = hn(n);
1475
  function r(t, n) {
1476
    var r = e((t = tn(t)).r, (n = tn(n)).r),
1477
      i = e(t.g, n.g),
1478
      o = e(t.b, n.b),
1479
      a = fn(t.opacity, n.opacity);
1480
    return function (n) {
1481
      return (
1482
        (t.r = r(n)), (t.g = i(n)), (t.b = o(n)), (t.opacity = a(n)), t + ''
1483
      );
1484
    };
1485
  }
1486
  return (r.gamma = t), r;
1487
})(1);
1488
function dn(t, n) {
1489
  n || (n = []);
1490
  var e,
1491
    r = t ? Math.min(n.length, t.length) : 0,
1492
    i = n.slice();
1493
  return function (o) {
1494
    for (e = 0; e < r; ++e) i[e] = t[e] * (1 - o) + n[e] * o;
1495
    return i;
1496
  };
1497
}
1498
function gn(t, n) {
1499
  var e,
1500
    r = n ? n.length : 0,
1501
    i = t ? Math.min(r, t.length) : 0,
1502
    o = new Array(i),
1503
    a = new Array(r);
1504
  for (e = 0; e < i; ++e) o[e] = bn(t[e], n[e]);
1505
  for (; e < r; ++e) a[e] = n[e];
1506
  return function (t) {
1507
    for (e = 0; e < i; ++e) a[e] = o[e](t);
1508
    return a;
1509
  };
1510
}
1511
function yn(t, n) {
1512
  var e = new Date();
1513
  return (
1514
    (t = +t),
1515
    (n = +n),
1516
    function (r) {
1517
      return e.setTime(t * (1 - r) + n * r), e;
1518
    }
1519
  );
1520
}
1521
function vn(t, n) {
1522
  return (
1523
    (t = +t),
1524
    (n = +n),
1525
    function (e) {
1526
      return t * (1 - e) + n * e;
1527
    }
1528
  );
1529
}
1530
function mn(t, n) {
1531
  var e,
1532
    r = {},
1533
    i = {};
1534
  for (e in ((null !== t && 'object' == typeof t) || (t = {}),
1535
  (null !== n && 'object' == typeof n) || (n = {}),
1536
  n))
1537
    e in t ? (r[e] = bn(t[e], n[e])) : (i[e] = n[e]);
1538
  return function (t) {
1539
    for (e in r) i[e] = r[e](t);
1540
    return i;
1541
  };
1542
}
1543
var _n = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
1544
  wn = new RegExp(_n.source, 'g');
1545
function xn(t, n) {
1546
  var e,
1547
    r,
1548
    i,
1549
    o = (_n.lastIndex = wn.lastIndex = 0),
1550
    a = -1,
1551
    u = [],
1552
    s = [];
1553
  for (t += '', n += ''; (e = _n.exec(t)) && (r = wn.exec(n)); )
1554
    (i = r.index) > o &&
1555
      ((i = n.slice(o, i)), u[a] ? (u[a] += i) : (u[++a] = i)),
1556
      (e = e[0]) === (r = r[0])
1557
        ? u[a]
1558
          ? (u[a] += r)
1559
          : (u[++a] = r)
1560
        : ((u[++a] = null), s.push({ i: a, x: vn(e, r) })),
1561
      (o = wn.lastIndex);
1562
  return (
1563
    o < n.length && ((i = n.slice(o)), u[a] ? (u[a] += i) : (u[++a] = i)),
1564
    u.length < 2
1565
      ? s[0]
1566
        ? (function (t) {
1567
            return function (n) {
1568
              return t(n) + '';
1569
            };
1570
          })(s[0].x)
1571
        : (function (t) {
1572
            return function () {
1573
              return t;
1574
            };
1575
          })(n)
1576
      : ((n = s.length),
1577
        function (t) {
1578
          for (var e, r = 0; r < n; ++r) u[(e = s[r]).i] = e.x(t);
1579
          return u.join('');
1580
        })
1581
  );
1582
}
1583
function bn(t, n) {
1584
  var e,
1585
    r = typeof n;
1586
  return null == n || 'boolean' === r
1587
    ? ln(n)
1588
    : ('number' === r
1589
        ? vn
1590
        : 'string' === r
1591
        ? (e = Zt(n))
1592
          ? ((n = e), pn)
1593
          : xn
1594
        : n instanceof Zt
1595
        ? pn
1596
        : n instanceof Date
1597
        ? yn
1598
        : (function (t) {
1599
            return ArrayBuffer.isView(t) && !(t instanceof DataView);
1600
          })(n)
1601
        ? dn
1602
        : Array.isArray(n)
1603
        ? gn
1604
        : ('function' != typeof n.valueOf && 'function' != typeof n.toString) ||
1605
          isNaN(n)
1606
        ? mn
1607
        : vn)(t, n);
1608
}
1609
function Mn(t, n) {
1610
  return (
1611
    (t = +t),
1612
    (n = +n),
1613
    function (e) {
1614
      return Math.round(t * (1 - e) + n * e);
1615
    }
1616
  );
1617
}
1618
function kn(t) {
1619
  return +t;
1620
}
1621
var Nn = [0, 1];
1622
function Sn(t) {
1623
  return t;
1624
}
1625
function An(t, n) {
1626
  return (n -= t = +t)
1627
    ? function (e) {
1628
        return (e - t) / n;
1629
      }
1630
    : (function (t) {
1631
        return function () {
1632
          return t;
1633
        };
1634
      })(isNaN(n) ? NaN : 0.5);
1635
}
1636
function En(t, n, e) {
1637
  var r = t[0],
1638
    i = t[1],
1639
    o = n[0],
1640
    a = n[1];
1641
  return (
1642
    i < r ? ((r = An(i, r)), (o = e(a, o))) : ((r = An(r, i)), (o = e(o, a))),
1643
    function (t) {
1644
      return o(r(t));
1645
    }
1646
  );
1647
}
1648
function Pn(t, n, e) {
1649
  var r = Math.min(t.length, n.length) - 1,
1650
    i = new Array(r),
1651
    o = new Array(r),
1652
    a = -1;
1653
  for (
1654
    t[r] < t[0] && ((t = t.slice().reverse()), (n = n.slice().reverse()));
1655
    ++a < r;
1656
1657
  )
1658
    (i[a] = An(t[a], t[a + 1])), (o[a] = e(n[a], n[a + 1]));
1659
  return function (n) {
1660
    var e = Et(t, n, 1, r) - 1;
1661
    return o[e](i[e](n));
1662
  };
1663
}
1664
function On(t, n) {
1665
  return n
1666
    .domain(t.domain())
1667
    .range(t.range())
1668
    .interpolate(t.interpolate())
1669
    .clamp(t.clamp())
1670
    .unknown(t.unknown());
1671
}
1672
function jn() {
1673
  var t,
1674
    n,
1675
    e,
1676
    r,
1677
    i,
1678
    o,
1679
    a = Nn,
1680
    u = Nn,
1681
    s = bn,
1682
    c = Sn;
1683
  function l() {
1684
    var t,
1685
      n,
1686
      e,
1687
      s = Math.min(a.length, u.length);
1688
    return (
1689
      c !== Sn &&
1690
        ((t = a[0]),
1691
        (n = a[s - 1]),
1692
        t > n && ((e = t), (t = n), (n = e)),
1693
        (c = function (e) {
1694
          return Math.max(t, Math.min(n, e));
1695
        })),
1696
      (r = s > 2 ? Pn : En),
1697
      (i = o = null),
1698
      h
1699
    );
1700
  }
1701
  function h(n) {
1702
    return isNaN((n = +n)) ? e : (i || (i = r(a.map(t), u, s)))(t(c(n)));
1703
  }
1704
  return (
1705
    (h.invert = function (e) {
1706
      return c(n((o || (o = r(u, a.map(t), vn)))(e)));
1707
    }),
1708
    (h.domain = function (t) {
1709
      return arguments.length ? ((a = Array.from(t, kn)), l()) : a.slice();
1710
    }),
1711
    (h.range = function (t) {
1712
      return arguments.length ? ((u = Array.from(t)), l()) : u.slice();
1713
    }),
1714
    (h.rangeRound = function (t) {
1715
      return (u = Array.from(t)), (s = Mn), l();
1716
    }),
1717
    (h.clamp = function (t) {
1718
      return arguments.length ? ((c = !!t || Sn), l()) : c !== Sn;
1719
    }),
1720
    (h.interpolate = function (t) {
1721
      return arguments.length ? ((s = t), l()) : s;
1722
    }),
1723
    (h.unknown = function (t) {
1724
      return arguments.length ? ((e = t), h) : e;
1725
    }),
1726
    function (e, r) {
1727
      return (t = e), (n = r), l();
1728
    }
1729
  );
1730
}
1731
function Tn() {
1732
  return jn()(Sn, Sn);
1733
}
1734
function Cn(t, n) {
1735
  if (
1736
    (e = (t = n ? t.toExponential(n - 1) : t.toExponential()).indexOf('e')) < 0
1737
  )
1738
    return null;
1739
  var e,
1740
    r = t.slice(0, e);
1741
  return [r.length > 1 ? r[0] + r.slice(2) : r, +t.slice(e + 1)];
1742
}
1743
function Ln(t) {
1744
  return (t = Cn(Math.abs(t))) ? t[1] : NaN;
1745
}
1746
var zn,
1747
  Dn = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
1748
function qn(t) {
1749
  if (!(n = Dn.exec(t))) throw new Error('invalid format: ' + t);
1750
  var n;
1751
  return new Rn({
1752
    fill: n[1],
1753
    align: n[2],
1754
    sign: n[3],
1755
    symbol: n[4],
1756
    zero: n[5],
1757
    width: n[6],
1758
    comma: n[7],
1759
    precision: n[8] && n[8].slice(1),
1760
    trim: n[9],
1761
    type: n[10],
1762
  });
1763
}
1764
function Rn(t) {
1765
  (this.fill = void 0 === t.fill ? ' ' : t.fill + ''),
1766
    (this.align = void 0 === t.align ? '>' : t.align + ''),
1767
    (this.sign = void 0 === t.sign ? '-' : t.sign + ''),
1768
    (this.symbol = void 0 === t.symbol ? '' : t.symbol + ''),
1769
    (this.zero = !!t.zero),
1770
    (this.width = void 0 === t.width ? void 0 : +t.width),
1771
    (this.comma = !!t.comma),
1772
    (this.precision = void 0 === t.precision ? void 0 : +t.precision),
1773
    (this.trim = !!t.trim),
1774
    (this.type = void 0 === t.type ? '' : t.type + '');
1775
}
1776
function Hn(t, n) {
1777
  var e = Cn(t, n);
1778
  if (!e) return t + '';
1779
  var r = e[0],
1780
    i = e[1];
1781
  return i < 0
1782
    ? '0.' + new Array(-i).join('0') + r
1783
    : r.length > i + 1
1784
    ? r.slice(0, i + 1) + '.' + r.slice(i + 1)
1785
    : r + new Array(i - r.length + 2).join('0');
1786
}
1787
(qn.prototype = Rn.prototype),
1788
  (Rn.prototype.toString = function () {
1789
    return (
1790
      this.fill +
1791
      this.align +
1792
      this.sign +
1793
      this.symbol +
1794
      (this.zero ? '0' : '') +
1795
      (void 0 === this.width ? '' : Math.max(1, 0 | this.width)) +
1796
      (this.comma ? ',' : '') +
1797
      (void 0 === this.precision ? '' : '.' + Math.max(0, 0 | this.precision)) +
1798
      (this.trim ? '~' : '') +
1799
      this.type
1800
    );
1801
  });
1802
var In = {
1803
  '%': function (t, n) {
1804
    return (100 * t).toFixed(n);
1805
  },
1806
  b: function (t) {
1807
    return Math.round(t).toString(2);
1808
  },
1809
  c: function (t) {
1810
    return t + '';
1811
  },
1812
  d: function (t) {
1813
    return Math.round(t).toString(10);
1814
  },
1815
  e: function (t, n) {
1816
    return t.toExponential(n);
1817
  },
1818
  f: function (t, n) {
1819
    return t.toFixed(n);
1820
  },
1821
  g: function (t, n) {
1822
    return t.toPrecision(n);
1823
  },
1824
  o: function (t) {
1825
    return Math.round(t).toString(8);
1826
  },
1827
  p: function (t, n) {
1828
    return Hn(100 * t, n);
1829
  },
1830
  r: Hn,
1831
  s: function (t, n) {
1832
    var e = Cn(t, n);
1833
    if (!e) return t + '';
1834
    var r = e[0],
1835
      i = e[1],
1836
      o = i - (zn = 3 * Math.max(-8, Math.min(8, Math.floor(i / 3)))) + 1,
1837
      a = r.length;
1838
    return o === a
1839
      ? r
1840
      : o > a
1841
      ? r + new Array(o - a + 1).join('0')
1842
      : o > 0
1843
      ? r.slice(0, o) + '.' + r.slice(o)
1844
      : '0.' + new Array(1 - o).join('0') + Cn(t, Math.max(0, n + o - 1))[0];
1845
  },
1846
  X: function (t) {
1847
    return Math.round(t).toString(16).toUpperCase();
1848
  },
1849
  x: function (t) {
1850
    return Math.round(t).toString(16);
1851
  },
1852
};
1853
function Vn(t) {
1854
  return t;
1855
}
1856
var $n,
1857
  Bn,
1858
  Fn,
1859
  Un = Array.prototype.map,
1860
  Xn = [
1861
    'y',
1862
    'z',
1863
    'a',
1864
    'f',
1865
    'p',
1866
    'n',
1867
    'µ',
1868
    'm',
1869
    '',
1870
    'k',
1871
    'M',
1872
    'G',
1873
    'T',
1874
    'P',
1875
    'E',
1876
    'Z',
1877
    'Y',
1878
  ];
1879
function Wn(t) {
1880
  var n,
1881
    e,
1882
    r =
1883
      void 0 === t.grouping || void 0 === t.thousands
1884
        ? Vn
1885
        : ((n = Un.call(t.grouping, Number)),
1886
          (e = t.thousands + ''),
1887
          function (t, r) {
1888
            for (
1889
              var i = t.length, o = [], a = 0, u = n[0], s = 0;
1890
              i > 0 &&
1891
              u > 0 &&
1892
              (s + u + 1 > r && (u = Math.max(1, r - s)),
1893
              o.push(t.substring((i -= u), i + u)),
1894
              !((s += u + 1) > r));
1895
1896
            )
1897
              u = n[(a = (a + 1) % n.length)];
1898
            return o.reverse().join(e);
1899
          }),
1900
    i = void 0 === t.currency ? '' : t.currency[0] + '',
1901
    o = void 0 === t.currency ? '' : t.currency[1] + '',
1902
    a = void 0 === t.decimal ? '.' : t.decimal + '',
1903
    u =
1904
      void 0 === t.numerals
1905
        ? Vn
1906
        : (function (t) {
1907
            return function (n) {
1908
              return n.replace(/[0-9]/g, function (n) {
1909
                return t[+n];
1910
              });
1911
            };
1912
          })(Un.call(t.numerals, String)),
1913
    s = void 0 === t.percent ? '%' : t.percent + '',
1914
    c = void 0 === t.minus ? '-' : t.minus + '',
1915
    l = void 0 === t.nan ? 'NaN' : t.nan + '';
1916
  function h(t) {
1917
    var n = (t = qn(t)).fill,
1918
      e = t.align,
1919
      h = t.sign,
1920
      f = t.symbol,
1921
      p = t.zero,
1922
      d = t.width,
1923
      g = t.comma,
1924
      y = t.precision,
1925
      v = t.trim,
1926
      m = t.type;
1927
    'n' === m
1928
      ? ((g = !0), (m = 'g'))
1929
      : In[m] || (void 0 === y && (y = 12), (v = !0), (m = 'g')),
1930
      (p || ('0' === n && '=' === e)) && ((p = !0), (n = '0'), (e = '='));
1931
    var _ =
1932
        '$' === f
1933
          ? i
1934
          : '#' === f && /[boxX]/.test(m)
1935
          ? '0' + m.toLowerCase()
1936
          : '',
1937
      w = '$' === f ? o : /[%p]/.test(m) ? s : '',
1938
      x = In[m],
1939
      b = /[defgprs%]/.test(m);
1940
    function M(t) {
1941
      var i,
1942
        o,
1943
        s,
1944
        f = _,
1945
        M = w;
1946
      if ('c' === m) (M = x(t) + M), (t = '');
1947
      else {
1948
        var k = (t = +t) < 0 || 1 / t < 0;
1949
        if (
1950
          ((t = isNaN(t) ? l : x(Math.abs(t), y)),
1951
          v &&
1952
            (t = (function (t) {
1953
              t: for (var n, e = t.length, r = 1, i = -1; r < e; ++r)
1954
                switch (t[r]) {
1955
                  case '.':
1956
                    i = n = r;
1957
                    break;
1958
                  case '0':
1959
                    0 === i && (i = r), (n = r);
1960
                    break;
1961
                  default:
1962
                    if (!+t[r]) break t;
1963
                    i > 0 && (i = 0);
1964
                }
1965
              return i > 0 ? t.slice(0, i) + t.slice(n + 1) : t;
1966
            })(t)),
1967
          k && 0 == +t && '+' !== h && (k = !1),
1968
          (f = (k ? ('(' === h ? h : c) : '-' === h || '(' === h ? '' : h) + f),
1969
          (M =
1970
            ('s' === m ? Xn[8 + zn / 3] : '') +
1971
            M +
1972
            (k && '(' === h ? ')' : '')),
1973
          b)
1974
        )
1975
          for (i = -1, o = t.length; ++i < o; )
1976
            if (48 > (s = t.charCodeAt(i)) || s > 57) {
1977
              (M = (46 === s ? a + t.slice(i + 1) : t.slice(i)) + M),
1978
                (t = t.slice(0, i));
1979
              break;
1980
            }
1981
      }
1982
      g && !p && (t = r(t, 1 / 0));
1983
      var N = f.length + t.length + M.length,
1984
        S = N < d ? new Array(d - N + 1).join(n) : '';
1985
      switch (
1986
        (g && p && ((t = r(S + t, S.length ? d - M.length : 1 / 0)), (S = '')),
1987
        e)
1988
      ) {
1989
        case '<':
1990
          t = f + t + M + S;
1991
          break;
1992
        case '=':
1993
          t = f + S + t + M;
1994
          break;
1995
        case '^':
1996
          t = S.slice(0, (N = S.length >> 1)) + f + t + M + S.slice(N);
1997
          break;
1998
        default:
1999
          t = S + f + t + M;
2000
      }
2001
      return u(t);
2002
    }
2003
    return (
2004
      (y =
2005
        void 0 === y
2006
          ? 6
2007
          : /[gprs]/.test(m)
2008
          ? Math.max(1, Math.min(21, y))
2009
          : Math.max(0, Math.min(20, y))),
2010
      (M.toString = function () {
2011
        return t + '';
2012
      }),
2013
      M
2014
    );
2015
  }
2016
  return {
2017
    format: h,
2018
    formatPrefix: function (t, n) {
2019
      var e = h((((t = qn(t)).type = 'f'), t)),
2020
        r = 3 * Math.max(-8, Math.min(8, Math.floor(Ln(n) / 3))),
2021
        i = Math.pow(10, -r),
2022
        o = Xn[8 + r / 3];
2023
      return function (t) {
2024
        return e(i * t) + o;
2025
      };
2026
    },
2027
  };
2028
}
2029
function Yn(t, n, e, r) {
2030
  var i,
2031
    o = (function (t, n, e) {
2032
      var r = Math.abs(n - t) / Math.max(0, e),
2033
        i = Math.pow(10, Math.floor(Math.log(r) / Math.LN10)),
2034
        o = r / i;
2035
      return (
2036
        o >= Pt ? (i *= 10) : o >= Ot ? (i *= 5) : o >= jt && (i *= 2),
2037
        n < t ? -i : i
2038
      );
2039
    })(t, n, e);
2040
  switch ((r = qn(null == r ? ',f' : r)).type) {
2041
    case 's':
2042
      var a = Math.max(Math.abs(t), Math.abs(n));
2043
      return (
2044
        null != r.precision ||
2045
          isNaN(
2046
            (i = (function (t, n) {
2047
              return Math.max(
2048
                0,
2049
                3 * Math.max(-8, Math.min(8, Math.floor(Ln(n) / 3))) -
2050
                  Ln(Math.abs(t))
2051
              );
2052
            })(o, a))
2053
          ) ||
2054
          (r.precision = i),
2055
        Fn(r, a)
2056
      );
2057
    case '':
2058
    case 'e':
2059
    case 'g':
2060
    case 'p':
2061
    case 'r':
2062
      null != r.precision ||
2063
        isNaN(
2064
          (i = (function (t, n) {
2065
            return (
2066
              (t = Math.abs(t)),
2067
              (n = Math.abs(n) - t),
2068
              Math.max(0, Ln(n) - Ln(t)) + 1
2069
            );
2070
          })(o, Math.max(Math.abs(t), Math.abs(n))))
2071
        ) ||
2072
        (r.precision = i - ('e' === r.type));
2073
      break;
2074
    case 'f':
2075
    case '%':
2076
      null != r.precision ||
2077
        isNaN(
2078
          (i = (function (t) {
2079
            return Math.max(0, -Ln(Math.abs(t)));
2080
          })(o))
2081
        ) ||
2082
        (r.precision = i - 2 * ('%' === r.type));
2083
  }
2084
  return Bn(r);
2085
}
2086
function Gn(t) {
2087
  var n = t.domain;
2088
  return (
2089
    (t.ticks = function (t) {
2090
      var e = n();
2091
      return (function (t, n, e) {
2092
        var r,
2093
          i,
2094
          o,
2095
          a,
2096
          u = -1;
2097
        if (((e = +e), (t = +t) === (n = +n) && e > 0)) return [t];
2098
        if (
2099
          ((r = n < t) && ((i = t), (t = n), (n = i)),
2100
          0 === (a = Tt(t, n, e)) || !isFinite(a))
2101
        )
2102
          return [];
2103
        if (a > 0)
2104
          for (
2105
            t = Math.ceil(t / a),
2106
              n = Math.floor(n / a),
2107
              o = new Array((i = Math.ceil(n - t + 1)));
2108
            ++u < i;
2109
2110
          )
2111
            o[u] = (t + u) * a;
2112
        else
2113
          for (
2114
            t = Math.floor(t * a),
2115
              n = Math.ceil(n * a),
2116
              o = new Array((i = Math.ceil(t - n + 1)));
2117
            ++u < i;
2118
2119
          )
2120
            o[u] = (t - u) / a;
2121
        return r && o.reverse(), o;
2122
      })(e[0], e[e.length - 1], null == t ? 10 : t);
2123
    }),
2124
    (t.tickFormat = function (t, e) {
2125
      var r = n();
2126
      return Yn(r[0], r[r.length - 1], null == t ? 10 : t, e);
2127
    }),
2128
    (t.nice = function (e) {
2129
      null == e && (e = 10);
2130
      var r,
2131
        i = n(),
2132
        o = 0,
2133
        a = i.length - 1,
2134
        u = i[o],
2135
        s = i[a];
2136
      return (
2137
        s < u && ((r = u), (u = s), (s = r), (r = o), (o = a), (a = r)),
2138
        (r = Tt(u, s, e)) > 0
2139
          ? (r = Tt((u = Math.floor(u / r) * r), (s = Math.ceil(s / r) * r), e))
2140
          : r < 0 &&
2141
            (r = Tt(
2142
              (u = Math.ceil(u * r) / r),
2143
              (s = Math.floor(s * r) / r),
2144
              e
2145
            )),
2146
        r > 0
2147
          ? ((i[o] = Math.floor(u / r) * r),
2148
            (i[a] = Math.ceil(s / r) * r),
2149
            n(i))
2150
          : r < 0 &&
2151
            ((i[o] = Math.ceil(u * r) / r),
2152
            (i[a] = Math.floor(s * r) / r),
2153
            n(i)),
2154
        t
2155
      );
2156
    }),
2157
    t
2158
  );
2159
}
2160
function Zn() {
2161
  var t = Tn();
2162
  return (
2163
    (t.copy = function () {
2164
      return On(t, Zn());
2165
    }),
2166
    Ct.apply(t, arguments),
2167
    Gn(t)
2168
  );
2169
}
2170
($n = Wn({
2171
  decimal: '.',
2172
  thousands: ',',
2173
  grouping: [3],
2174
  currency: ['$', ''],
2175
  minus: '-',
2176
})),
2177
  (Bn = $n.format),
2178
  (Fn = $n.formatPrefix);
2179
var Kn = Array.prototype.slice;
2180
function Qn(t) {
2181
  return t;
2182
}
2183
function Jn(t) {
2184
  return 'translate(' + (t + 0.5) + ',0)';
2185
}
2186
function te(t) {
2187
  return 'translate(0,' + (t + 0.5) + ')';
2188
}
2189
function ne(t) {
2190
  return function (n) {
2191
    return +t(n);
2192
  };
2193
}
2194
function ee(t) {
2195
  var n = Math.max(0, t.bandwidth() - 1) / 2;
2196
  return (
2197
    t.round() && (n = Math.round(n)),
2198
    function (e) {
2199
      return +t(e) + n;
2200
    }
2201
  );
2202
}
2203
function re() {
2204
  return !this.__axis;
2205
}
2206
function ie(t, n) {
2207
  var e = [],
2208
    r = null,
2209
    i = null,
2210
    o = 6,
2211
    a = 6,
2212
    u = 3,
2213
    s = 1 === t || 4 === t ? -1 : 1,
2214
    c = 4 === t || 2 === t ? 'x' : 'y',
2215
    l = 1 === t || 3 === t ? Jn : te;
2216
  function h(h) {
2217
    var f = null == r ? (n.ticks ? n.ticks.apply(n, e) : n.domain()) : r,
2218
      p = null == i ? (n.tickFormat ? n.tickFormat.apply(n, e) : Qn) : i,
2219
      d = Math.max(o, 0) + u,
2220
      g = n.range(),
2221
      y = +g[0] + 0.5,
2222
      v = +g[g.length - 1] + 0.5,
2223
      m = (n.bandwidth ? ee : ne)(n.copy()),
2224
      _ = h.selection ? h.selection() : h,
2225
      w = _.selectAll('.domain').data([null]),
2226
      x = _.selectAll('.tick').data(f, n).order(),
2227
      b = x.exit(),
2228
      M = x.enter().append('g').attr('class', 'tick'),
2229
      k = x.select('line'),
2230
      N = x.select('text');
2231
    (w = w.merge(
2232
      w
2233
        .enter()
2234
        .insert('path', '.tick')
2235
        .attr('class', 'domain')
2236
        .attr('stroke', 'currentColor')
2237
    )),
2238
      (x = x.merge(M)),
2239
      (k = k.merge(
2240
        M.append('line')
2241
          .attr('stroke', 'currentColor')
2242
          .attr(c + '2', s * o)
2243
      )),
2244
      (N = N.merge(
2245
        M.append('text')
2246
          .attr('fill', 'currentColor')
2247
          .attr(c, s * d)
2248
          .attr('dy', 1 === t ? '0em' : 3 === t ? '0.71em' : '0.32em')
2249
      )),
2250
      h !== _ &&
2251
        ((w = w.transition(h)),
2252
        (x = x.transition(h)),
2253
        (k = k.transition(h)),
2254
        (N = N.transition(h)),
2255
        (b = b
2256
          .transition(h)
2257
          .attr('opacity', 1e-6)
2258
          .attr('transform', function (t) {
2259
            return isFinite((t = m(t))) ? l(t) : this.getAttribute('transform');
2260
          })),
2261
        M.attr('opacity', 1e-6).attr('transform', function (t) {
2262
          var n = this.parentNode.__axis;
2263
          return l(n && isFinite((n = n(t))) ? n : m(t));
2264
        })),
2265
      b.remove(),
2266
      w.attr(
2267
        'd',
2268
        4 === t || 2 == t
2269
          ? a
2270
            ? 'M' + s * a + ',' + y + 'H0.5V' + v + 'H' + s * a
2271
            : 'M0.5,' + y + 'V' + v
2272
          : a
2273
          ? 'M' + y + ',' + s * a + 'V0.5H' + v + 'V' + s * a
2274
          : 'M' + y + ',0.5H' + v
2275
      ),
2276
      x.attr('opacity', 1).attr('transform', function (t) {
2277
        return l(m(t));
2278
      }),
2279
      k.attr(c + '2', s * o),
2280
      N.attr(c, s * d).text(p),
2281
      _.filter(re)
2282
        .attr('fill', 'none')
2283
        .attr('font-size', 10)
2284
        .attr('font-family', 'sans-serif')
2285
        .attr('text-anchor', 2 === t ? 'start' : 4 === t ? 'end' : 'middle'),
2286
      _.each(function () {
2287
        this.__axis = m;
2288
      });
2289
  }
2290
  return (
2291
    (h.scale = function (t) {
2292
      return arguments.length ? ((n = t), h) : n;
2293
    }),
2294
    (h.ticks = function () {
2295
      return (e = Kn.call(arguments)), h;
2296
    }),
2297
    (h.tickArguments = function (t) {
2298
      return arguments.length
2299
        ? ((e = null == t ? [] : Kn.call(t)), h)
2300
        : e.slice();
2301
    }),
2302
    (h.tickValues = function (t) {
2303
      return arguments.length
2304
        ? ((r = null == t ? null : Kn.call(t)), h)
2305
        : r && r.slice();
2306
    }),
2307
    (h.tickFormat = function (t) {
2308
      return arguments.length ? ((i = t), h) : i;
2309
    }),
2310
    (h.tickSize = function (t) {
2311
      return arguments.length ? ((o = a = +t), h) : o;
2312
    }),
2313
    (h.tickSizeInner = function (t) {
2314
      return arguments.length ? ((o = +t), h) : o;
2315
    }),
2316
    (h.tickSizeOuter = function (t) {
2317
      return arguments.length ? ((a = +t), h) : a;
2318
    }),
2319
    (h.tickPadding = function (t) {
2320
      return arguments.length ? ((u = +t), h) : u;
2321
    }),
2322
    h
2323
  );
2324
}
2325
function oe(t) {
2326
  return ie(3, t);
2327
}
2328
var ae = Math.PI,
2329
  ue = 2 * ae,
2330
  se = ue - 1e-6;
2331
function ce() {
2332
  (this._x0 = this._y0 = this._x1 = this._y1 = null), (this._ = '');
2333
}
2334
function le() {
2335
  return new ce();
2336
}
2337
function he(t) {
2338
  return function () {
2339
    return t;
2340
  };
2341
}
2342
function fe(t) {
2343
  this._context = t;
2344
}
2345
function pe(t) {
2346
  return new fe(t);
2347
}
2348
function de(t) {
2349
  return t[0];
2350
}
2351
function ge(t) {
2352
  return t[1];
2353
}
2354
(ce.prototype = le.prototype = {
2355
  constructor: ce,
2356
  moveTo: function (t, n) {
2357
    this._ +=
2358
      'M' + (this._x0 = this._x1 = +t) + ',' + (this._y0 = this._y1 = +n);
2359
  },
2360
  closePath: function () {
2361
    null !== this._x1 &&
2362
      ((this._x1 = this._x0), (this._y1 = this._y0), (this._ += 'Z'));
2363
  },
2364
  lineTo: function (t, n) {
2365
    this._ += 'L' + (this._x1 = +t) + ',' + (this._y1 = +n);
2366
  },
2367
  quadraticCurveTo: function (t, n, e, r) {
2368
    this._ +=
2369
      'Q' + +t + ',' + +n + ',' + (this._x1 = +e) + ',' + (this._y1 = +r);
2370
  },
2371
  bezierCurveTo: function (t, n, e, r, i, o) {
2372
    this._ +=
2373
      'C' +
2374
      +t +
2375
      ',' +
2376
      +n +
2377
      ',' +
2378
      +e +
2379
      ',' +
2380
      +r +
2381
      ',' +
2382
      (this._x1 = +i) +
2383
      ',' +
2384
      (this._y1 = +o);
2385
  },
2386
  arcTo: function (t, n, e, r, i) {
2387
    (t = +t), (n = +n), (e = +e), (r = +r), (i = +i);
2388
    var o = this._x1,
2389
      a = this._y1,
2390
      u = e - t,
2391
      s = r - n,
2392
      c = o - t,
2393
      l = a - n,
2394
      h = c * c + l * l;
2395
    if (i < 0) throw new Error('negative radius: ' + i);
2396
    if (null === this._x1)
2397
      this._ += 'M' + (this._x1 = t) + ',' + (this._y1 = n);
2398
    else if (h > 1e-6)
2399
      if (Math.abs(l * u - s * c) > 1e-6 && i) {
2400
        var f = e - o,
2401
          p = r - a,
2402
          d = u * u + s * s,
2403
          g = f * f + p * p,
2404
          y = Math.sqrt(d),
2405
          v = Math.sqrt(h),
2406
          m = i * Math.tan((ae - Math.acos((d + h - g) / (2 * y * v))) / 2),
2407
          _ = m / v,
2408
          w = m / y;
2409
        Math.abs(_ - 1) > 1e-6 &&
2410
          (this._ += 'L' + (t + _ * c) + ',' + (n + _ * l)),
2411
          (this._ +=
2412
            'A' +
2413
            i +
2414
            ',' +
2415
            i +
2416
            ',0,0,' +
2417
            +(l * f > c * p) +
2418
            ',' +
2419
            (this._x1 = t + w * u) +
2420
            ',' +
2421
            (this._y1 = n + w * s));
2422
      } else this._ += 'L' + (this._x1 = t) + ',' + (this._y1 = n);
2423
    else;
2424
  },
2425
  arc: function (t, n, e, r, i, o) {
2426
    (t = +t), (n = +n), (o = !!o);
2427
    var a = (e = +e) * Math.cos(r),
2428
      u = e * Math.sin(r),
2429
      s = t + a,
2430
      c = n + u,
2431
      l = 1 ^ o,
2432
      h = o ? r - i : i - r;
2433
    if (e < 0) throw new Error('negative radius: ' + e);
2434
    null === this._x1
2435
      ? (this._ += 'M' + s + ',' + c)
2436
      : (Math.abs(this._x1 - s) > 1e-6 || Math.abs(this._y1 - c) > 1e-6) &&
2437
        (this._ += 'L' + s + ',' + c),
2438
      e &&
2439
        (h < 0 && (h = (h % ue) + ue),
2440
        h > se
2441
          ? (this._ +=
2442
              'A' +
2443
              e +
2444
              ',' +
2445
              e +
2446
              ',0,1,' +
2447
              l +
2448
              ',' +
2449
              (t - a) +
2450
              ',' +
2451
              (n - u) +
2452
              'A' +
2453
              e +
2454
              ',' +
2455
              e +
2456
              ',0,1,' +
2457
              l +
2458
              ',' +
2459
              (this._x1 = s) +
2460
              ',' +
2461
              (this._y1 = c))
2462
          : h > 1e-6 &&
2463
            (this._ +=
2464
              'A' +
2465
              e +
2466
              ',' +
2467
              e +
2468
              ',0,' +
2469
              +(h >= ae) +
2470
              ',' +
2471
              l +
2472
              ',' +
2473
              (this._x1 = t + e * Math.cos(i)) +
2474
              ',' +
2475
              (this._y1 = n + e * Math.sin(i))));
2476
  },
2477
  rect: function (t, n, e, r) {
2478
    this._ +=
2479
      'M' +
2480
      (this._x0 = this._x1 = +t) +
2481
      ',' +
2482
      (this._y0 = this._y1 = +n) +
2483
      'h' +
2484
      +e +
2485
      'v' +
2486
      +r +
2487
      'h' +
2488
      -e +
2489
      'Z';
2490
  },
2491
  toString: function () {
2492
    return this._;
2493
  },
2494
}),
2495
  (fe.prototype = {
2496
    areaStart: function () {
2497
      this._line = 0;
2498
    },
2499
    areaEnd: function () {
2500
      this._line = NaN;
2501
    },
2502
    lineStart: function () {
2503
      this._point = 0;
2504
    },
2505
    lineEnd: function () {
2506
      (this._line || (0 !== this._line && 1 === this._point)) &&
2507
        this._context.closePath(),
2508
        (this._line = 1 - this._line);
2509
    },
2510
    point: function (t, n) {
2511
      switch (((t = +t), (n = +n), this._point)) {
2512
        case 0:
2513
          (this._point = 1),
2514
            this._line
2515
              ? this._context.lineTo(t, n)
2516
              : this._context.moveTo(t, n);
2517
          break;
2518
        case 1:
2519
          this._point = 2;
2520
        default:
2521
          this._context.lineTo(t, n);
2522
      }
2523
    },
2524
  });
2525
var ye = { value: function () {} };
2526
function ve() {
2527
  for (var t, n = 0, e = arguments.length, r = {}; n < e; ++n) {
2528
    if (!(t = arguments[n] + '') || t in r || /[\s.]/.test(t))
2529
      throw new Error('illegal type: ' + t);
2530
    r[t] = [];
2531
  }
2532
  return new me(r);
2533
}
2534
function me(t) {
2535
  this._ = t;
2536
}
2537
function _e(t, n) {
2538
  return t
2539
    .trim()
2540
    .split(/^|\s+/)
2541
    .map(function (t) {
2542
      var e = '',
2543
        r = t.indexOf('.');
2544
      if (
2545
        (r >= 0 && ((e = t.slice(r + 1)), (t = t.slice(0, r))),
2546
        t && !n.hasOwnProperty(t))
2547
      )
2548
        throw new Error('unknown type: ' + t);
2549
      return { type: t, name: e };
2550
    });
2551
}
2552
function we(t, n) {
2553
  for (var e, r = 0, i = t.length; r < i; ++r)
2554
    if ((e = t[r]).name === n) return e.value;
2555
}
2556
function xe(t, n, e) {
2557
  for (var r = 0, i = t.length; r < i; ++r)
2558
    if (t[r].name === n) {
2559
      (t[r] = ye), (t = t.slice(0, r).concat(t.slice(r + 1)));
2560
      break;
2561
    }
2562
  return null != e && t.push({ name: n, value: e }), t;
2563
}
2564
function be() {
2565
  st.stopImmediatePropagation();
2566
}
2567
function Me() {
2568
  st.preventDefault(), st.stopImmediatePropagation();
2569
}
2570
function ke(t) {
2571
  var n = t.document.documentElement,
2572
    e = wt(t).on('dragstart.drag', Me, !0);
2573
  'onselectstart' in n
2574
    ? e.on('selectstart.drag', Me, !0)
2575
    : ((n.__noselect = n.style.MozUserSelect),
2576
      (n.style.MozUserSelect = 'none'));
2577
}
2578
function Ne(t) {
2579
  return function () {
2580
    return t;
2581
  };
2582
}
2583
function Se(t, n, e, r, i, o, a, u, s, c) {
2584
  (this.target = t),
2585
    (this.type = n),
2586
    (this.subject = e),
2587
    (this.identifier = r),
2588
    (this.active = i),
2589
    (this.x = o),
2590
    (this.y = a),
2591
    (this.dx = u),
2592
    (this.dy = s),
2593
    (this._ = c);
2594
}
2595
function Ae() {
2596
  return !st.ctrlKey && !st.button;
2597
}
2598
function Ee() {
2599
  return this.parentNode;
2600
}
2601
function Pe(t) {
2602
  return null == t ? { x: st.x, y: st.y } : t;
2603
}
2604
function Oe() {
2605
  return navigator.maxTouchPoints || 'ontouchstart' in this;
2606
}
2607
function je() {
2608
  var t,
2609
    n,
2610
    e,
2611
    r,
2612
    i = Ae,
2613
    o = Ee,
2614
    a = Pe,
2615
    u = Oe,
2616
    s = {},
2617
    c = ve('start', 'drag', 'end'),
2618
    l = 0,
2619
    h = 0;
2620
  function f(t) {
2621
    t.on('mousedown.drag', p)
2622
      .filter(u)
2623
      .on('touchstart.drag', y)
2624
      .on('touchmove.drag', v)
2625
      .on('touchend.drag touchcancel.drag', m)
2626
      .style('touch-action', 'none')
2627
      .style('-webkit-tap-highlight-color', 'rgba(0,0,0,0)');
2628
  }
2629
  function p() {
2630
    if (!r && i.apply(this, arguments)) {
2631
      var a = _('mouse', o.apply(this, arguments), Mt, this, arguments);
2632
      a &&
2633
        (wt(st.view).on('mousemove.drag', d, !0).on('mouseup.drag', g, !0),
2634
        ke(st.view),
2635
        be(),
2636
        (e = !1),
2637
        (t = st.clientX),
2638
        (n = st.clientY),
2639
        a('start'));
2640
    }
2641
  }
2642
  function d() {
2643
    if ((Me(), !e)) {
2644
      var r = st.clientX - t,
2645
        i = st.clientY - n;
2646
      e = r * r + i * i > h;
2647
    }
2648
    s.mouse('drag');
2649
  }
2650
  function g() {
2651
    wt(st.view).on('mousemove.drag mouseup.drag', null),
2652
      (function (t, n) {
2653
        var e = t.document.documentElement,
2654
          r = wt(t).on('dragstart.drag', null);
2655
        n &&
2656
          (r.on('click.drag', Me, !0),
2657
          setTimeout(function () {
2658
            r.on('click.drag', null);
2659
          }, 0)),
2660
          'onselectstart' in e
2661
            ? r.on('selectstart.drag', null)
2662
            : ((e.style.MozUserSelect = e.__noselect), delete e.__noselect);
2663
      })(st.view, e),
2664
      Me(),
2665
      s.mouse('end');
2666
  }
2667
  function y() {
2668
    if (i.apply(this, arguments)) {
2669
      var t,
2670
        n,
2671
        e = st.changedTouches,
2672
        r = o.apply(this, arguments),
2673
        a = e.length;
2674
      for (t = 0; t < a; ++t)
2675
        (n = _(e[t].identifier, r, kt, this, arguments)) && (be(), n('start'));
2676
    }
2677
  }
2678
  function v() {
2679
    var t,
2680
      n,
2681
      e = st.changedTouches,
2682
      r = e.length;
2683
    for (t = 0; t < r; ++t) (n = s[e[t].identifier]) && (Me(), n('drag'));
2684
  }
2685
  function m() {
2686
    var t,
2687
      n,
2688
      e = st.changedTouches,
2689
      i = e.length;
2690
    for (
2691
      r && clearTimeout(r),
2692
        r = setTimeout(function () {
2693
          r = null;
2694
        }, 500),
2695
        t = 0;
2696
      t < i;
2697
      ++t
2698
    )
2699
      (n = s[e[t].identifier]) && (be(), n('end'));
2700
  }
2701
  function _(t, n, e, r, i) {
2702
    var o,
2703
      u,
2704
      h,
2705
      p = e(n, t),
2706
      d = c.copy();
2707
    if (
2708
      dt(new Se(f, 'beforestart', o, t, l, p[0], p[1], 0, 0, d), function () {
2709
        return (
2710
          null != (st.subject = o = a.apply(r, i)) &&
2711
          ((u = o.x - p[0] || 0), (h = o.y - p[1] || 0), !0)
2712
        );
2713
      })
2714
    )
2715
      return function a(c) {
2716
        var g,
2717
          y = p;
2718
        switch (c) {
2719
          case 'start':
2720
            (s[t] = a), (g = l++);
2721
            break;
2722
          case 'end':
2723
            delete s[t], --l;
2724
          case 'drag':
2725
            (p = e(n, t)), (g = l);
2726
        }
2727
        dt(
2728
          new Se(
2729
            f,
2730
            c,
2731
            o,
2732
            t,
2733
            g,
2734
            p[0] + u,
2735
            p[1] + h,
2736
            p[0] - y[0],
2737
            p[1] - y[1],
2738
            d
2739
          ),
2740
          d.apply,
2741
          d,
2742
          [c, r, i]
2743
        );
2744
      };
2745
  }
2746
  return (
2747
    (f.filter = function (t) {
2748
      return arguments.length
2749
        ? ((i = 'function' == typeof t ? t : Ne(!!t)), f)
2750
        : i;
2751
    }),
2752
    (f.container = function (t) {
2753
      return arguments.length
2754
        ? ((o = 'function' == typeof t ? t : Ne(t)), f)
2755
        : o;
2756
    }),
2757
    (f.subject = function (t) {
2758
      return arguments.length
2759
        ? ((a = 'function' == typeof t ? t : Ne(t)), f)
2760
        : a;
2761
    }),
2762
    (f.touchable = function (t) {
2763
      return arguments.length
2764
        ? ((u = 'function' == typeof t ? t : Ne(!!t)), f)
2765
        : u;
2766
    }),
2767
    (f.on = function () {
2768
      var t = c.on.apply(c, arguments);
2769
      return t === c ? f : t;
2770
    }),
2771
    (f.clickDistance = function (t) {
2772
      return arguments.length ? ((h = (t = +t) * t), f) : Math.sqrt(h);
2773
    }),
2774
    f
2775
  );
2776
}
2777
(me.prototype = ve.prototype = {
2778
  constructor: me,
2779
  on: function (t, n) {
2780
    var e,
2781
      r = this._,
2782
      i = _e(t + '', r),
2783
      o = -1,
2784
      a = i.length;
2785
    if (!(arguments.length < 2)) {
2786
      if (null != n && 'function' != typeof n)
2787
        throw new Error('invalid callback: ' + n);
2788
      for (; ++o < a; )
2789
        if ((e = (t = i[o]).type)) r[e] = xe(r[e], t.name, n);
2790
        else if (null == n) for (e in r) r[e] = xe(r[e], t.name, null);
2791
      return this;
2792
    }
2793
    for (; ++o < a; )
2794
      if ((e = (t = i[o]).type) && (e = we(r[e], t.name))) return e;
2795
  },
2796
  copy: function () {
2797
    var t = {},
2798
      n = this._;
2799
    for (var e in n) t[e] = n[e].slice();
2800
    return new me(t);
2801
  },
2802
  call: function (t, n) {
2803
    if ((e = arguments.length - 2) > 0)
2804
      for (var e, r, i = new Array(e), o = 0; o < e; ++o)
2805
        i[o] = arguments[o + 2];
2806
    if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t);
2807
    for (o = 0, e = (r = this._[t]).length; o < e; ++o) r[o].value.apply(n, i);
2808
  },
2809
  apply: function (t, n, e) {
2810
    if (!this._.hasOwnProperty(t)) throw new Error('unknown type: ' + t);
2811
    for (var r = this._[t], i = 0, o = r.length; i < o; ++i)
2812
      r[i].value.apply(n, e);
2813
  },
2814
}),
2815
  (Se.prototype.on = function () {
2816
    var t = this._.on.apply(this._, arguments);
2817
    return t === this._ ? this : t;
2818
  });
2819
var Te = function (t) {
2820
    return 50 * Math.sin((Math.PI / 50) * t - 0.5 * Math.PI) + 50;
2821
  },
2822
  Ce = function (t) {
2823
    return (25 * (2 * Math.asin((t - 50) / 50) + Math.PI)) / Math.PI;
2824
  },
2825
  Le = function (t) {
2826
    return t >= 80 && t <= 100;
2827
  },
2828
  ze = function (t, n) {
2829
    var e = t + 5;
2830
    return Le(n) ? -1 * e : e;
2831
  },
2832
  De = {
2833
    target: 'svg',
2834
    width: 900,
2835
    height: 300,
2836
    preview: !1,
2837
    margin: { top: 20, right: 20, bottom: 40, left: 20 },
2838
  },
2839
  qe = (function (n) {
2840
    !(function (t, n) {
2841
      if ('function' != typeof n && null !== n)
2842
        throw new TypeError(
2843
          'Super expression must either be null or a function'
2844
        );
2845
      (t.prototype = Object.create(n && n.prototype, {
2846
        constructor: { value: t, writable: !0, configurable: !0 },
2847
      })),
2848
        n && o(t, n);
2849
    })(l, f);
2850
    var e,
2851
      i,
2852
      u,
2853
      c = s(l);
2854
    function l(t, n) {
2855
      var e;
2856
      return (
2857
        (function (t, n) {
2858
          if (!(t instanceof n))
2859
            throw new TypeError('Cannot call a class as a function');
2860
        })(this, l),
2861
        (e = c.call(this)),
2862
        Object.assign(a(e), De, { data: t }, n),
2863
        e.init(),
2864
        e
2865
      );
2866
    }
2867
    return (
2868
      (e = l),
2869
      (i = [
2870
        {
2871
          key: 'init',
2872
          value: function () {
2873
            var t = this.width,
2874
              n = this.height,
2875
              e = this.margin,
2876
              r = this.target;
2877
            (this.chartWidth = t - e.left - e.right),
2878
              (this.chartHeight = n - e.top - e.bottom),
2879
              (this.svg = wt(r)
2880
                .attr('width', t)
2881
                .attr('height', n)
2882
                .append('g')
2883
                .attr(
2884
                  'transform',
2885
                  'translate('.concat(e.left, ', ').concat(e.top, ')')
2886
                )),
2887
              (this.xScale = Zn().domain([0, 100]).range([0, this.chartWidth])),
2888
              (this.yScale = Zn()
2889
                .domain([0, 100])
2890
                .range([this.chartHeight, 0])),
2891
              this.normalizeData();
2892
          },
2893
        },
2894
        {
2895
          key: 'normalizeData',
2896
          value: function () {
2897
            this.data = this.data.map(function (t) {
2898
              return {
2899
                color: t.color,
2900
                description: t.description,
2901
                link: t.link,
2902
                x: t.x ? t.x : 0,
2903
                y: Te(t.y ? t.y : 0),
2904
                size: t.size ? t.size : 10,
2905
              };
2906
            });
2907
          },
2908
        },
2909
        {
2910
          key: 'render',
2911
          value: function () {
2912
            var t = this;
2913
            this.renderBottomLine(5),
2914
              this.renderMainCurve(),
2915
              this.renderMiddleLine(),
2916
              this.renderFooterText();
2917
            var n,
2918
              e = this,
2919
              i = je().on('drag', function (t) {
2920
                var n = st.x;
2921
                n < 0
2922
                  ? ((n = 0),
2923
                    e.emit(
2924
                      'home',
2925
                      r(r({}, t), {}, { y: Ce(e.yScale.invert(t.y)) })
2926
                    ))
2927
                  : n > e.chartWidth &&
2928
                    ((n = e.chartWidth),
2929
                    e.emit(
2930
                      'end',
2931
                      r(
2932
                        r({}, t),
2933
                        {},
2934
                        {
2935
                          x: e.xScale.invert(e.chartWidth),
2936
                          y: Ce(e.yScale.invert(t.y)),
2937
                        }
2938
                      )
2939
                    ));
2940
                var i = e.xScale.invert(n);
2941
                (t.x = n), (t.y = e.yScale(Te(i)));
2942
                var o = Ce(e.yScale.invert(t.y)),
2943
                  a = { x: i, y: o };
2944
                wt(this).on('click', function () {
2945
                  e.emit('pointClick', r(r({}, t), a));
2946
                }),
2947
                  e.preview ||
2948
                    (wt(this)
2949
                      .attr(
2950
                        'transform',
2951
                        'translate('.concat(t.x, ', ').concat(t.y, ')')
2952
                      )
2953
                      .select('text')
2954
                      .style('text-anchor', function () {
2955
                        return Le(i) ? 'end' : 'start';
2956
                      })
2957
                      .attr('x', function (t) {
2958
                        return ze(t.size, i);
2959
                      }),
2960
                    e.emit('move', i, o),
2961
                    e.emit('moved', r(r({}, t), a)));
2962
              });
2963
            (n = this.preview
2964
              ? this.undraggablePoint()
2965
              : this.svg
2966
                  .selectAll('.hill-chart-group')
2967
                  .data(this.data)
2968
                  .enter()
2969
                  .append('g')
2970
                  .attr('class', 'hill-chart-group')
2971
                  .attr('transform', function (n) {
2972
                    return (
2973
                      (n.x = t.xScale(n.x)),
2974
                      (n.y = t.yScale(n.y)),
2975
                      'translate('.concat(n.x, ', ').concat(n.y, ')')
2976
                    );
2977
                  })
2978
                  .call(i))
2979
              .append('circle')
2980
              .attr('class', 'hill-chart-circle')
2981
              .attr('fill', function (t) {
2982
                return t.color;
2983
              })
2984
              .attr('cx', 0)
2985
              .attr('cy', 0)
2986
              .attr('r', function (t) {
2987
                return t.size;
2988
              }),
2989
              n
2990
                .append('text')
2991
                .text(function (t) {
2992
                  return t.description;
2993
                })
2994
                .attr('x', function (n) {
2995
                  return ze(n.size, t.xScale.invert(n.x));
2996
                })
2997
                .style('text-anchor', function (n) {
2998
                  return Le(t.xScale.invert(n.x)) ? 'end' : 'start';
2999
                })
3000
                .attr('y', 5);
3001
          },
3002
        },
3003
        {
3004
          key: 'undraggablePoint',
3005
          value: function () {
3006
            var t = this;
3007
            return this.svg
3008
              .selectAll('.hill-chart-group')
3009
              .data(this.data)
3010
              .enter()
3011
              .append('a')
3012
              .attr('href', function (t) {
3013
                return t.link ? t.link : '#';
3014
              })
3015
              .append('g')
3016
              .attr('class', 'hill-chart-group')
3017
              .style('cursor', 'pointer')
3018
              .attr('transform', function (n) {
3019
                return (
3020
                  (n.x = t.xScale(n.x)),
3021
                  (n.y = t.yScale(n.y)),
3022
                  'translate('.concat(n.x, ', ').concat(n.y, ')')
3023
                );
3024
              });
3025
          },
3026
        },
3027
        {
3028
          key: 'renderMainCurve',
3029
          value: function () {
3030
            var t = this;
3031
            (this.mainLineCurvePoints = (function (t, n, e) {
3032
              (t = +t),
3033
                (n = +n),
3034
                (e =
3035
                  (i = arguments.length) < 2
3036
                    ? ((n = t), (t = 0), 1)
3037
                    : i < 3
3038
                    ? 1
3039
                    : +e);
3040
              for (
3041
                var r = -1,
3042
                  i = 0 | Math.max(0, Math.ceil((n - t) / e)),
3043
                  o = new Array(i);
3044
                ++r < i;
3045
3046
              )
3047
                o[r] = t + r * e;
3048
              return o;
3049
            })(0, 100, 0.1).map(function (t) {
3050
              return { x: t, y: Te(t) };
3051
            })),
3052
              (this.line = (function () {
3053
                var t = de,
3054
                  n = ge,
3055
                  e = he(!0),
3056
                  r = null,
3057
                  i = pe,
3058
                  o = null;
3059
                function a(a) {
3060
                  var u,
3061
                    s,
3062
                    c,
3063
                    l = a.length,
3064
                    h = !1;
3065
                  for (null == r && (o = i((c = le()))), u = 0; u <= l; ++u)
3066
                    !(u < l && e((s = a[u]), u, a)) === h &&
3067
                      ((h = !h) ? o.lineStart() : o.lineEnd()),
3068
                      h && o.point(+t(s, u, a), +n(s, u, a));
3069
                  if (c) return (o = null), c + '' || null;
3070
                }
3071
                return (
3072
                  (a.x = function (n) {
3073
                    return arguments.length
3074
                      ? ((t = 'function' == typeof n ? n : he(+n)), a)
3075
                      : t;
3076
                  }),
3077
                  (a.y = function (t) {
3078
                    return arguments.length
3079
                      ? ((n = 'function' == typeof t ? t : he(+t)), a)
3080
                      : n;
3081
                  }),
3082
                  (a.defined = function (t) {
3083
                    return arguments.length
3084
                      ? ((e = 'function' == typeof t ? t : he(!!t)), a)
3085
                      : e;
3086
                  }),
3087
                  (a.curve = function (t) {
3088
                    return arguments.length
3089
                      ? ((i = t), null != r && (o = i(r)), a)
3090
                      : i;
3091
                  }),
3092
                  (a.context = function (t) {
3093
                    return arguments.length
3094
                      ? (null == t ? (r = o = null) : (o = i((r = t))), a)
3095
                      : r;
3096
                  }),
3097
                  a
3098
                );
3099
              })()
3100
                .x(function (n) {
3101
                  return t.xScale(n.x);
3102
                })
3103
                .y(function (n) {
3104
                  return t.yScale(n.y);
3105
                })),
3106
              this.svg
3107
                .append('path')
3108
                .attr('class', 'chart-hill-main-curve')
3109
                .datum(this.mainLineCurvePoints)
3110
                .attr('d', this.line);
3111
          },
3112
        },
3113
        {
3114
          key: 'renderBottomLine',
3115
          value: function () {
3116
            var t =
3117
              arguments.length > 0 && void 0 !== arguments[0]
3118
                ? arguments[0]
3119
                : 5;
3120
            (this.bottomLine = oe(this.xScale).ticks(0).tickSize(0)),
3121
              this.svg
3122
                .append('g')
3123
                .attr('class', 'hill-chart-bottom-line')
3124
                .attr(
3125
                  'transform',
3126
                  'translate(0, '.concat(this.chartHeight + t, ')')
3127
                )
3128
                .call(this.bottomLine);
3129
          },
3130
        },
3131
        {
3132
          key: 'renderMiddleLine',
3133
          value: function () {
3134
            this.svg
3135
              .append('line')
3136
              .attr('class', 'hill-chart-middle-line')
3137
              .attr('y1', this.yScale(0))
3138
              .attr('y2', this.yScale(100))
3139
              .attr('x2', this.xScale(50))
3140
              .attr('x1', this.xScale(50));
3141
          },
3142
        },
3143
        {
3144
          key: 'renderFooterText',
3145
          value: function () {
3146
            this.svg
3147
              .append('text')
3148
              .attr('class', 'hill-chart-text')
3149
              .text('Figuring things out')
3150
              .attr('x', this.xScale(25))
3151
              .attr('y', this.chartHeight + 25),
3152
              this.svg
3153
                .append('text')
3154
                .attr('class', 'hill-chart-text')
3155
                .text('Making it happen')
3156
                .attr('x', this.xScale(75))
3157
                .attr('y', this.chartHeight + 25);
3158
          },
3159
        },
3160
      ]) && t(e.prototype, i),
3161
      u && t(e, u),
3162
      l
3163
    );
3164
  })();
3165
module.exports = qe;
3166