d3-rails 7.0.0 → 7.8.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,54 +1,67 @@
1
- // https://d3js.org v7.0.0 Copyright 2010-2021 Mike Bostock
1
+ // https://d3js.org v7.8.5 Copyright 2010-2023 Mike Bostock
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
5
5
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.d3 = global.d3 || {}));
6
- }(this, (function (exports) { 'use strict';
6
+ })(this, (function (exports) { 'use strict';
7
7
 
8
- var version = "7.0.0";
8
+ var version = "7.8.5";
9
9
 
10
10
  function ascending$3(a, b) {
11
+ return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
12
+ }
13
+
14
+ function descending$2(a, b) {
11
15
  return a == null || b == null ? NaN
12
- : a < b ? -1
13
- : a > b ? 1
14
- : a >= b ? 0
16
+ : b < a ? -1
17
+ : b > a ? 1
18
+ : b >= a ? 0
15
19
  : NaN;
16
20
  }
17
21
 
18
22
  function bisector(f) {
19
- let delta = f;
20
- let compare = f;
21
-
22
- if (f.length === 1) {
23
+ let compare1, compare2, delta;
24
+
25
+ // If an accessor is specified, promote it to a comparator. In this case we
26
+ // can test whether the search value is (self-) comparable. We can’t do this
27
+ // for a comparator (except for specific, known comparators) because we can’t
28
+ // tell if the comparator is symmetric, and an asymmetric comparator can’t be
29
+ // used to test whether a single value is comparable.
30
+ if (f.length !== 2) {
31
+ compare1 = ascending$3;
32
+ compare2 = (d, x) => ascending$3(f(d), x);
23
33
  delta = (d, x) => f(d) - x;
24
- compare = ascendingComparator(f);
34
+ } else {
35
+ compare1 = f === ascending$3 || f === descending$2 ? f : zero$1;
36
+ compare2 = f;
37
+ delta = f;
25
38
  }
26
39
 
27
- function left(a, x, lo, hi) {
28
- if (lo == null) lo = 0;
29
- if (hi == null) hi = a.length;
30
- while (lo < hi) {
31
- const mid = (lo + hi) >>> 1;
32
- if (compare(a[mid], x) < 0) lo = mid + 1;
33
- else hi = mid;
40
+ function left(a, x, lo = 0, hi = a.length) {
41
+ if (lo < hi) {
42
+ if (compare1(x, x) !== 0) return hi;
43
+ do {
44
+ const mid = (lo + hi) >>> 1;
45
+ if (compare2(a[mid], x) < 0) lo = mid + 1;
46
+ else hi = mid;
47
+ } while (lo < hi);
34
48
  }
35
49
  return lo;
36
50
  }
37
51
 
38
- function right(a, x, lo, hi) {
39
- if (lo == null) lo = 0;
40
- if (hi == null) hi = a.length;
41
- while (lo < hi) {
42
- const mid = (lo + hi) >>> 1;
43
- if (compare(a[mid], x) > 0) hi = mid;
44
- else lo = mid + 1;
52
+ function right(a, x, lo = 0, hi = a.length) {
53
+ if (lo < hi) {
54
+ if (compare1(x, x) !== 0) return hi;
55
+ do {
56
+ const mid = (lo + hi) >>> 1;
57
+ if (compare2(a[mid], x) <= 0) lo = mid + 1;
58
+ else hi = mid;
59
+ } while (lo < hi);
45
60
  }
46
61
  return lo;
47
62
  }
48
63
 
49
- function center(a, x, lo, hi) {
50
- if (lo == null) lo = 0;
51
- if (hi == null) hi = a.length;
64
+ function center(a, x, lo = 0, hi = a.length) {
52
65
  const i = left(a, x, lo, hi - 1);
53
66
  return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
54
67
  }
@@ -56,8 +69,8 @@ function bisector(f) {
56
69
  return {left, center, right};
57
70
  }
58
71
 
59
- function ascendingComparator(f) {
60
- return (d, x) => ascending$3(f(d), x);
72
+ function zero$1() {
73
+ return 0;
61
74
  }
62
75
 
63
76
  function number$3(x) {
@@ -85,6 +98,123 @@ const ascendingBisect = bisector(ascending$3);
85
98
  const bisectRight = ascendingBisect.right;
86
99
  const bisectLeft = ascendingBisect.left;
87
100
  const bisectCenter = bisector(number$3).center;
101
+ var bisect = bisectRight;
102
+
103
+ function blur(values, r) {
104
+ if (!((r = +r) >= 0)) throw new RangeError("invalid r");
105
+ let length = values.length;
106
+ if (!((length = Math.floor(length)) >= 0)) throw new RangeError("invalid length");
107
+ if (!length || !r) return values;
108
+ const blur = blurf(r);
109
+ const temp = values.slice();
110
+ blur(values, temp, 0, length, 1);
111
+ blur(temp, values, 0, length, 1);
112
+ blur(values, temp, 0, length, 1);
113
+ return values;
114
+ }
115
+
116
+ const blur2 = Blur2(blurf);
117
+
118
+ const blurImage = Blur2(blurfImage);
119
+
120
+ function Blur2(blur) {
121
+ return function(data, rx, ry = rx) {
122
+ if (!((rx = +rx) >= 0)) throw new RangeError("invalid rx");
123
+ if (!((ry = +ry) >= 0)) throw new RangeError("invalid ry");
124
+ let {data: values, width, height} = data;
125
+ if (!((width = Math.floor(width)) >= 0)) throw new RangeError("invalid width");
126
+ if (!((height = Math.floor(height !== undefined ? height : values.length / width)) >= 0)) throw new RangeError("invalid height");
127
+ if (!width || !height || (!rx && !ry)) return data;
128
+ const blurx = rx && blur(rx);
129
+ const blury = ry && blur(ry);
130
+ const temp = values.slice();
131
+ if (blurx && blury) {
132
+ blurh(blurx, temp, values, width, height);
133
+ blurh(blurx, values, temp, width, height);
134
+ blurh(blurx, temp, values, width, height);
135
+ blurv(blury, values, temp, width, height);
136
+ blurv(blury, temp, values, width, height);
137
+ blurv(blury, values, temp, width, height);
138
+ } else if (blurx) {
139
+ blurh(blurx, values, temp, width, height);
140
+ blurh(blurx, temp, values, width, height);
141
+ blurh(blurx, values, temp, width, height);
142
+ } else if (blury) {
143
+ blurv(blury, values, temp, width, height);
144
+ blurv(blury, temp, values, width, height);
145
+ blurv(blury, values, temp, width, height);
146
+ }
147
+ return data;
148
+ };
149
+ }
150
+
151
+ function blurh(blur, T, S, w, h) {
152
+ for (let y = 0, n = w * h; y < n;) {
153
+ blur(T, S, y, y += w, 1);
154
+ }
155
+ }
156
+
157
+ function blurv(blur, T, S, w, h) {
158
+ for (let x = 0, n = w * h; x < w; ++x) {
159
+ blur(T, S, x, x + n, w);
160
+ }
161
+ }
162
+
163
+ function blurfImage(radius) {
164
+ const blur = blurf(radius);
165
+ return (T, S, start, stop, step) => {
166
+ start <<= 2, stop <<= 2, step <<= 2;
167
+ blur(T, S, start + 0, stop + 0, step);
168
+ blur(T, S, start + 1, stop + 1, step);
169
+ blur(T, S, start + 2, stop + 2, step);
170
+ blur(T, S, start + 3, stop + 3, step);
171
+ };
172
+ }
173
+
174
+ // Given a target array T, a source array S, sets each value T[i] to the average
175
+ // of {S[i - r], …, S[i], …, S[i + r]}, where r = ⌊radius⌋, start <= i < stop,
176
+ // for each i, i + step, i + 2 * step, etc., and where S[j] is clamped between
177
+ // S[start] (inclusive) and S[stop] (exclusive). If the given radius is not an
178
+ // integer, S[i - r - 1] and S[i + r + 1] are added to the sum, each weighted
179
+ // according to r - ⌊radius⌋.
180
+ function blurf(radius) {
181
+ const radius0 = Math.floor(radius);
182
+ if (radius0 === radius) return bluri(radius);
183
+ const t = radius - radius0;
184
+ const w = 2 * radius + 1;
185
+ return (T, S, start, stop, step) => { // stop must be aligned!
186
+ if (!((stop -= step) >= start)) return; // inclusive stop
187
+ let sum = radius0 * S[start];
188
+ const s0 = step * radius0;
189
+ const s1 = s0 + step;
190
+ for (let i = start, j = start + s0; i < j; i += step) {
191
+ sum += S[Math.min(stop, i)];
192
+ }
193
+ for (let i = start, j = stop; i <= j; i += step) {
194
+ sum += S[Math.min(stop, i + s0)];
195
+ T[i] = (sum + t * (S[Math.max(start, i - s1)] + S[Math.min(stop, i + s1)])) / w;
196
+ sum -= S[Math.max(start, i - s0)];
197
+ }
198
+ };
199
+ }
200
+
201
+ // Like blurf, but optimized for integer radius.
202
+ function bluri(radius) {
203
+ const w = 2 * radius + 1;
204
+ return (T, S, start, stop, step) => { // stop must be aligned!
205
+ if (!((stop -= step) >= start)) return; // inclusive stop
206
+ let sum = radius * S[start];
207
+ const s = step * radius;
208
+ for (let i = start, j = start + s; i < j; i += step) {
209
+ sum += S[Math.min(stop, i)];
210
+ }
211
+ for (let i = start, j = stop; i <= j; i += step) {
212
+ sum += S[Math.min(stop, i + s)];
213
+ T[i] = sum / w;
214
+ sum -= S[Math.max(start, i - s)];
215
+ }
216
+ };
217
+ }
88
218
 
89
219
  function count$1(values, valueof) {
90
220
  let count = 0;
@@ -146,14 +276,6 @@ function cumsum(values, valueof) {
146
276
  : v => (sum += +valueof(v, index++, values) || 0));
147
277
  }
148
278
 
149
- function descending$2(a, b) {
150
- return a == null || b == null ? NaN
151
- : b < a ? -1
152
- : b > a ? 1
153
- : b >= a ? 0
154
- : NaN;
155
- }
156
-
157
279
  function variance(values, valueof) {
158
280
  let count = 0;
159
281
  let delta;
@@ -337,7 +459,7 @@ function intern_set({_intern, _key}, value) {
337
459
  function intern_delete({_intern, _key}, value) {
338
460
  const key = _key(value);
339
461
  if (_intern.has(key)) {
340
- value = _intern.get(value);
462
+ value = _intern.get(key);
341
463
  _intern.delete(key);
342
464
  }
343
465
  return value;
@@ -421,28 +543,42 @@ function permute(source, keys) {
421
543
  function sort(values, ...F) {
422
544
  if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
423
545
  values = Array.from(values);
424
- let [f = ascending$3] = F;
425
- if (f.length === 1 || F.length > 1) {
546
+ let [f] = F;
547
+ if ((f && f.length !== 2) || F.length > 1) {
426
548
  const index = Uint32Array.from(values, (d, i) => i);
427
549
  if (F.length > 1) {
428
550
  F = F.map(f => values.map(f));
429
551
  index.sort((i, j) => {
430
552
  for (const f of F) {
431
- const c = ascending$3(f[i], f[j]);
553
+ const c = ascendingDefined(f[i], f[j]);
432
554
  if (c) return c;
433
555
  }
434
556
  });
435
557
  } else {
436
558
  f = values.map(f);
437
- index.sort((i, j) => ascending$3(f[i], f[j]));
559
+ index.sort((i, j) => ascendingDefined(f[i], f[j]));
438
560
  }
439
561
  return permute(values, index);
440
562
  }
441
- return values.sort(f);
563
+ return values.sort(compareDefined(f));
564
+ }
565
+
566
+ function compareDefined(compare = ascending$3) {
567
+ if (compare === ascending$3) return ascendingDefined;
568
+ if (typeof compare !== "function") throw new TypeError("compare is not a function");
569
+ return (a, b) => {
570
+ const x = compare(a, b);
571
+ if (x || x === 0) return x;
572
+ return (compare(b, b) === 0) - (compare(a, a) === 0);
573
+ };
574
+ }
575
+
576
+ function ascendingDefined(a, b) {
577
+ return (a == null || !(a >= a)) - (b == null || !(b >= b)) || (a < b ? -1 : a > b ? 1 : 0);
442
578
  }
443
579
 
444
580
  function groupSort(values, reduce, key) {
445
- return (reduce.length === 1
581
+ return (reduce.length !== 2
446
582
  ? sort(rollup(values, reduce, key), (([ak, av], [bk, bv]) => ascending$3(av, bv) || ascending$3(ak, bk)))
447
583
  : sort(group(values, key), (([ak, av], [bk, bv]) => reduce(av, bv) || ascending$3(ak, bk))))
448
584
  .map(([key]) => key);
@@ -453,64 +589,63 @@ var array$5 = Array.prototype;
453
589
  var slice$3 = array$5.slice;
454
590
 
455
591
  function constant$b(x) {
456
- return function() {
457
- return x;
458
- };
592
+ return () => x;
459
593
  }
460
594
 
461
- var e10 = Math.sqrt(50),
595
+ const e10 = Math.sqrt(50),
462
596
  e5 = Math.sqrt(10),
463
597
  e2 = Math.sqrt(2);
464
598
 
465
- function ticks(start, stop, count) {
466
- var reverse,
467
- i = -1,
468
- n,
469
- ticks,
470
- step;
599
+ function tickSpec(start, stop, count) {
600
+ const step = (stop - start) / Math.max(0, count),
601
+ power = Math.floor(Math.log10(step)),
602
+ error = step / Math.pow(10, power),
603
+ factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1;
604
+ let i1, i2, inc;
605
+ if (power < 0) {
606
+ inc = Math.pow(10, -power) / factor;
607
+ i1 = Math.round(start * inc);
608
+ i2 = Math.round(stop * inc);
609
+ if (i1 / inc < start) ++i1;
610
+ if (i2 / inc > stop) --i2;
611
+ inc = -inc;
612
+ } else {
613
+ inc = Math.pow(10, power) * factor;
614
+ i1 = Math.round(start / inc);
615
+ i2 = Math.round(stop / inc);
616
+ if (i1 * inc < start) ++i1;
617
+ if (i2 * inc > stop) --i2;
618
+ }
619
+ if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2);
620
+ return [i1, i2, inc];
621
+ }
471
622
 
623
+ function ticks(start, stop, count) {
472
624
  stop = +stop, start = +start, count = +count;
473
- if (start === stop && count > 0) return [start];
474
- if (reverse = stop < start) n = start, start = stop, stop = n;
475
- if ((step = tickIncrement(start, stop, count)) === 0 || !isFinite(step)) return [];
476
-
477
- if (step > 0) {
478
- let r0 = Math.round(start / step), r1 = Math.round(stop / step);
479
- if (r0 * step < start) ++r0;
480
- if (r1 * step > stop) --r1;
481
- ticks = new Array(n = r1 - r0 + 1);
482
- while (++i < n) ticks[i] = (r0 + i) * step;
625
+ if (!(count > 0)) return [];
626
+ if (start === stop) return [start];
627
+ const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count);
628
+ if (!(i2 >= i1)) return [];
629
+ const n = i2 - i1 + 1, ticks = new Array(n);
630
+ if (reverse) {
631
+ if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc;
632
+ else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc;
483
633
  } else {
484
- step = -step;
485
- let r0 = Math.round(start * step), r1 = Math.round(stop * step);
486
- if (r0 / step < start) ++r0;
487
- if (r1 / step > stop) --r1;
488
- ticks = new Array(n = r1 - r0 + 1);
489
- while (++i < n) ticks[i] = (r0 + i) / step;
634
+ if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc;
635
+ else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc;
490
636
  }
491
-
492
- if (reverse) ticks.reverse();
493
-
494
637
  return ticks;
495
638
  }
496
639
 
497
640
  function tickIncrement(start, stop, count) {
498
- var step = (stop - start) / Math.max(0, count),
499
- power = Math.floor(Math.log(step) / Math.LN10),
500
- error = step / Math.pow(10, power);
501
- return power >= 0
502
- ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power)
503
- : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
641
+ stop = +stop, start = +start, count = +count;
642
+ return tickSpec(start, stop, count)[2];
504
643
  }
505
644
 
506
645
  function tickStep(start, stop, count) {
507
- var step0 = Math.abs(stop - start) / Math.max(0, count),
508
- step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)),
509
- error = step0 / step1;
510
- if (error >= e10) step1 *= 10;
511
- else if (error >= e5) step1 *= 5;
512
- else if (error >= e2) step1 *= 2;
513
- return stop < start ? -step1 : step1;
646
+ stop = +stop, start = +start, count = +count;
647
+ const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
648
+ return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
514
649
  }
515
650
 
516
651
  function nice$1(start, stop, count) {
@@ -531,7 +666,7 @@ function nice$1(start, stop, count) {
531
666
  }
532
667
 
533
668
  function thresholdSturges(values) {
534
- return Math.ceil(Math.log(count$1(values)) / Math.LN2) + 1;
669
+ return Math.max(1, Math.ceil(Math.log(count$1(values)) / Math.LN2) + 1);
535
670
  }
536
671
 
537
672
  function bin() {
@@ -545,6 +680,7 @@ function bin() {
545
680
  var i,
546
681
  n = data.length,
547
682
  x,
683
+ step,
548
684
  values = new Array(n);
549
685
 
550
686
  for (i = 0; i < n; ++i) {
@@ -563,6 +699,11 @@ function bin() {
563
699
  if (domain === extent$1) [x0, x1] = nice$1(x0, x1, tn);
564
700
  tz = ticks(x0, x1, tn);
565
701
 
702
+ // If the domain is aligned with the first tick (which it will by
703
+ // default), then we can use quantization rather than bisection to bin
704
+ // values, which is substantially faster.
705
+ if (tz[0] <= x0) step = tickIncrement(x0, x1, tn);
706
+
566
707
  // If the last threshold is coincident with the domain’s upper bound, the
567
708
  // last bin will be zero-width. If the default domain is used, and this
568
709
  // last threshold is coincident with the maximum input value, we can
@@ -587,9 +728,11 @@ function bin() {
587
728
  }
588
729
 
589
730
  // Remove any thresholds outside the domain.
590
- var m = tz.length;
591
- while (tz[0] <= x0) tz.shift(), --m;
592
- while (tz[m - 1] > x1) tz.pop(), --m;
731
+ // Be careful not to mutate an array owned by the user!
732
+ var m = tz.length, a = 0, b = m;
733
+ while (tz[a] <= x0) ++a;
734
+ while (tz[b - 1] > x1) --b;
735
+ if (a || b < m) tz = tz.slice(a, b), m = b - a;
593
736
 
594
737
  var bins = new Array(m + 1),
595
738
  bin;
@@ -602,10 +745,26 @@ function bin() {
602
745
  }
603
746
 
604
747
  // Assign data to bins by value, ignoring any outside the domain.
605
- for (i = 0; i < n; ++i) {
606
- x = values[i];
607
- if (x != null && x0 <= x && x <= x1) {
608
- bins[bisectRight(tz, x, 0, m)].push(data[i]);
748
+ if (isFinite(step)) {
749
+ if (step > 0) {
750
+ for (i = 0; i < n; ++i) {
751
+ if ((x = values[i]) != null && x0 <= x && x <= x1) {
752
+ bins[Math.min(m, Math.floor((x - x0) / step))].push(data[i]);
753
+ }
754
+ }
755
+ } else if (step < 0) {
756
+ for (i = 0; i < n; ++i) {
757
+ if ((x = values[i]) != null && x0 <= x && x <= x1) {
758
+ const j = Math.floor((x0 - x) * step);
759
+ bins[Math.min(m, j + (tz[j] <= x))].push(data[i]); // handle off-by-one due to rounding
760
+ }
761
+ }
762
+ }
763
+ } else {
764
+ for (i = 0; i < n; ++i) {
765
+ if ((x = values[i]) != null && x0 <= x && x <= x1) {
766
+ bins[bisect(tz, x, 0, m)].push(data[i]);
767
+ }
609
768
  }
610
769
  }
611
770
 
@@ -621,7 +780,7 @@ function bin() {
621
780
  };
622
781
 
623
782
  histogram.thresholds = function(_) {
624
- return arguments.length ? (threshold = typeof _ === "function" ? _ : Array.isArray(_) ? constant$b(slice$3.call(_)) : constant$b(_), histogram) : threshold;
783
+ return arguments.length ? (threshold = typeof _ === "function" ? _ : constant$b(Array.isArray(_) ? slice$3.call(_) : _), histogram) : threshold;
625
784
  };
626
785
 
627
786
  return histogram;
@@ -648,6 +807,29 @@ function max$3(values, valueof) {
648
807
  return max;
649
808
  }
650
809
 
810
+ function maxIndex(values, valueof) {
811
+ let max;
812
+ let maxIndex = -1;
813
+ let index = -1;
814
+ if (valueof === undefined) {
815
+ for (const value of values) {
816
+ ++index;
817
+ if (value != null
818
+ && (max < value || (max === undefined && value >= value))) {
819
+ max = value, maxIndex = index;
820
+ }
821
+ }
822
+ } else {
823
+ for (let value of values) {
824
+ if ((value = valueof(value, ++index, values)) != null
825
+ && (max < value || (max === undefined && value >= value))) {
826
+ max = value, maxIndex = index;
827
+ }
828
+ }
829
+ }
830
+ return maxIndex;
831
+ }
832
+
651
833
  function min$2(values, valueof) {
652
834
  let min;
653
835
  if (valueof === undefined) {
@@ -669,9 +851,40 @@ function min$2(values, valueof) {
669
851
  return min;
670
852
  }
671
853
 
854
+ function minIndex(values, valueof) {
855
+ let min;
856
+ let minIndex = -1;
857
+ let index = -1;
858
+ if (valueof === undefined) {
859
+ for (const value of values) {
860
+ ++index;
861
+ if (value != null
862
+ && (min > value || (min === undefined && value >= value))) {
863
+ min = value, minIndex = index;
864
+ }
865
+ }
866
+ } else {
867
+ for (let value of values) {
868
+ if ((value = valueof(value, ++index, values)) != null
869
+ && (min > value || (min === undefined && value >= value))) {
870
+ min = value, minIndex = index;
871
+ }
872
+ }
873
+ }
874
+ return minIndex;
875
+ }
876
+
672
877
  // Based on https://github.com/mourner/quickselect
673
878
  // ISC license, Copyright 2018 Vladimir Agafonkin.
674
- function quickselect(array, k, left = 0, right = array.length - 1, compare = ascending$3) {
879
+ function quickselect(array, k, left = 0, right = Infinity, compare) {
880
+ k = Math.floor(k);
881
+ left = Math.floor(Math.max(0, left));
882
+ right = Math.floor(Math.min(array.length - 1, right));
883
+
884
+ if (!(left <= k && k <= right)) return array;
885
+
886
+ compare = compare === undefined ? ascendingDefined : compareDefined(compare);
887
+
675
888
  while (right > left) {
676
889
  if (right - left > 600) {
677
890
  const n = right - left + 1;
@@ -703,6 +916,7 @@ function quickselect(array, k, left = 0, right = array.length - 1, compare = asc
703
916
  if (j <= k) left = j + 1;
704
917
  if (k <= j) right = j - 1;
705
918
  }
919
+
706
920
  return array;
707
921
  }
708
922
 
@@ -712,10 +926,38 @@ function swap$1(array, i, j) {
712
926
  array[j] = t;
713
927
  }
714
928
 
929
+ function greatest(values, compare = ascending$3) {
930
+ let max;
931
+ let defined = false;
932
+ if (compare.length === 1) {
933
+ let maxValue;
934
+ for (const element of values) {
935
+ const value = compare(element);
936
+ if (defined
937
+ ? ascending$3(value, maxValue) > 0
938
+ : ascending$3(value, value) === 0) {
939
+ max = element;
940
+ maxValue = value;
941
+ defined = true;
942
+ }
943
+ }
944
+ } else {
945
+ for (const value of values) {
946
+ if (defined
947
+ ? compare(value, max) > 0
948
+ : compare(value, value) === 0) {
949
+ max = value;
950
+ defined = true;
951
+ }
952
+ }
953
+ }
954
+ return max;
955
+ }
956
+
715
957
  function quantile$1(values, p, valueof) {
716
958
  values = Float64Array.from(numbers(values, valueof));
717
- if (!(n = values.length)) return;
718
- if ((p = +p) <= 0 || n < 2) return min$2(values);
959
+ if (!(n = values.length) || isNaN(p = +p)) return;
960
+ if (p <= 0 || n < 2) return min$2(values);
719
961
  if (p >= 1) return max$3(values);
720
962
  var n,
721
963
  i = (n - 1) * p,
@@ -726,8 +968,8 @@ function quantile$1(values, p, valueof) {
726
968
  }
727
969
 
728
970
  function quantileSorted(values, p, valueof = number$3) {
729
- if (!(n = values.length)) return;
730
- if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
971
+ if (!(n = values.length) || isNaN(p = +p)) return;
972
+ if (p <= 0 || n < 2) return +valueof(values[0], 0, values);
731
973
  if (p >= 1) return +valueof(values[n - 1], n - 1, values);
732
974
  var n,
733
975
  i = (n - 1) * p,
@@ -737,35 +979,28 @@ function quantileSorted(values, p, valueof = number$3) {
737
979
  return value0 + (value1 - value0) * (i - i0);
738
980
  }
739
981
 
740
- function freedmanDiaconis(values, min, max) {
741
- return Math.ceil((max - min) / (2 * (quantile$1(values, 0.75) - quantile$1(values, 0.25)) * Math.pow(count$1(values), -1 / 3)));
982
+ function quantileIndex(values, p, valueof = number$3) {
983
+ if (isNaN(p = +p)) return;
984
+ numbers = Float64Array.from(values, (_, i) => number$3(valueof(values[i], i, values)));
985
+ if (p <= 0) return minIndex(numbers);
986
+ if (p >= 1) return maxIndex(numbers);
987
+ var numbers,
988
+ index = Uint32Array.from(values, (_, i) => i),
989
+ j = numbers.length - 1,
990
+ i = Math.floor(j * p);
991
+ quickselect(index, i, 0, j, (i, j) => ascendingDefined(numbers[i], numbers[j]));
992
+ i = greatest(index.subarray(0, i + 1), (i) => numbers[i]);
993
+ return i >= 0 ? i : -1;
742
994
  }
743
995
 
744
- function scott(values, min, max) {
745
- return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(count$1(values), -1 / 3)));
996
+ function thresholdFreedmanDiaconis(values, min, max) {
997
+ const c = count$1(values), d = quantile$1(values, 0.75) - quantile$1(values, 0.25);
998
+ return c && d ? Math.ceil((max - min) / (2 * d * Math.pow(c, -1 / 3))) : 1;
746
999
  }
747
1000
 
748
- function maxIndex(values, valueof) {
749
- let max;
750
- let maxIndex = -1;
751
- let index = -1;
752
- if (valueof === undefined) {
753
- for (const value of values) {
754
- ++index;
755
- if (value != null
756
- && (max < value || (max === undefined && value >= value))) {
757
- max = value, maxIndex = index;
758
- }
759
- }
760
- } else {
761
- for (let value of values) {
762
- if ((value = valueof(value, ++index, values)) != null
763
- && (max < value || (max === undefined && value >= value))) {
764
- max = value, maxIndex = index;
765
- }
766
- }
767
- }
768
- return maxIndex;
1001
+ function thresholdScott(values, min, max) {
1002
+ const c = count$1(values), d = deviation(values);
1003
+ return c && d ? Math.ceil((max - min) * Math.cbrt(c) / (3.49 * d)) : 1;
769
1004
  }
770
1005
 
771
1006
  function mean(values, valueof) {
@@ -792,6 +1027,10 @@ function median(values, valueof) {
792
1027
  return quantile$1(values, 0.5, valueof);
793
1028
  }
794
1029
 
1030
+ function medianIndex(values, valueof) {
1031
+ return quantileIndex(values, 0.5, valueof);
1032
+ }
1033
+
795
1034
  function* flatten(arrays) {
796
1035
  for (const array of arrays) {
797
1036
  yield* array;
@@ -802,29 +1041,6 @@ function merge(arrays) {
802
1041
  return Array.from(flatten(arrays));
803
1042
  }
804
1043
 
805
- function minIndex(values, valueof) {
806
- let min;
807
- let minIndex = -1;
808
- let index = -1;
809
- if (valueof === undefined) {
810
- for (const value of values) {
811
- ++index;
812
- if (value != null
813
- && (min > value || (min === undefined && value >= value))) {
814
- min = value, minIndex = index;
815
- }
816
- }
817
- } else {
818
- for (let value of values) {
819
- if ((value = valueof(value, ++index, values)) != null
820
- && (min > value || (min === undefined && value >= value))) {
821
- min = value, minIndex = index;
822
- }
823
- }
824
- }
825
- return minIndex;
826
- }
827
-
828
1044
  function mode(values, valueof) {
829
1045
  const counts = new InternMap();
830
1046
  if (valueof === undefined) {
@@ -868,7 +1084,7 @@ function pair(a, b) {
868
1084
  return [a, b];
869
1085
  }
870
1086
 
871
- function sequence(start, stop, step) {
1087
+ function range$2(start, stop, step) {
872
1088
  start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step;
873
1089
 
874
1090
  var i = -1,
@@ -882,6 +1098,28 @@ function sequence(start, stop, step) {
882
1098
  return range;
883
1099
  }
884
1100
 
1101
+ function rank(values, valueof = ascending$3) {
1102
+ if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");
1103
+ let V = Array.from(values);
1104
+ const R = new Float64Array(V.length);
1105
+ if (valueof.length !== 2) V = V.map(valueof), valueof = ascending$3;
1106
+ const compareIndex = (i, j) => valueof(V[i], V[j]);
1107
+ let k, r;
1108
+ values = Uint32Array.from(V, (_, i) => i);
1109
+ // Risky chaining due to Safari 14 https://github.com/d3/d3-array/issues/123
1110
+ values.sort(valueof === ascending$3 ? (i, j) => ascendingDefined(V[i], V[j]) : compareDefined(compareIndex));
1111
+ values.forEach((j, i) => {
1112
+ const c = compareIndex(j, k === undefined ? j : k);
1113
+ if (c >= 0) {
1114
+ if (k === undefined || c > 0) k = j, r = i;
1115
+ R[j] = r;
1116
+ } else {
1117
+ R[j] = NaN;
1118
+ }
1119
+ });
1120
+ return R;
1121
+ }
1122
+
885
1123
  function least(values, compare = ascending$3) {
886
1124
  let min;
887
1125
  let defined = false;
@@ -927,34 +1165,6 @@ function leastIndex(values, compare = ascending$3) {
927
1165
  return min;
928
1166
  }
929
1167
 
930
- function greatest(values, compare = ascending$3) {
931
- let max;
932
- let defined = false;
933
- if (compare.length === 1) {
934
- let maxValue;
935
- for (const element of values) {
936
- const value = compare(element);
937
- if (defined
938
- ? ascending$3(value, maxValue) > 0
939
- : ascending$3(value, value) === 0) {
940
- max = element;
941
- maxValue = value;
942
- defined = true;
943
- }
944
- }
945
- } else {
946
- for (const value of values) {
947
- if (defined
948
- ? compare(value, max) > 0
949
- : compare(value, value) === 0) {
950
- max = value;
951
- defined = true;
952
- }
953
- }
954
- }
955
- return max;
956
- }
957
-
958
1168
  function greatestIndex(values, compare = ascending$3) {
959
1169
  if (compare.length === 1) return maxIndex(values, compare);
960
1170
  let maxValue;
@@ -1089,7 +1299,7 @@ function reverse$1(values) {
1089
1299
  }
1090
1300
 
1091
1301
  function difference(values, ...others) {
1092
- values = new Set(values);
1302
+ values = new InternSet(values);
1093
1303
  for (const other of others) {
1094
1304
  for (const value of other) {
1095
1305
  values.delete(value);
@@ -1099,7 +1309,7 @@ function difference(values, ...others) {
1099
1309
  }
1100
1310
 
1101
1311
  function disjoint(values, other) {
1102
- const iterator = other[Symbol.iterator](), set = new Set();
1312
+ const iterator = other[Symbol.iterator](), set = new InternSet();
1103
1313
  for (const v of values) {
1104
1314
  if (set.has(v)) return false;
1105
1315
  let value, done;
@@ -1112,12 +1322,8 @@ function disjoint(values, other) {
1112
1322
  return true;
1113
1323
  }
1114
1324
 
1115
- function set$2(values) {
1116
- return values instanceof Set ? values : new Set(values);
1117
- }
1118
-
1119
1325
  function intersection(values, ...others) {
1120
- values = new Set(values);
1326
+ values = new InternSet(values);
1121
1327
  others = others.map(set$2);
1122
1328
  out: for (const value of values) {
1123
1329
  for (const other of others) {
@@ -1130,26 +1336,36 @@ function intersection(values, ...others) {
1130
1336
  return values;
1131
1337
  }
1132
1338
 
1339
+ function set$2(values) {
1340
+ return values instanceof InternSet ? values : new InternSet(values);
1341
+ }
1342
+
1133
1343
  function superset(values, other) {
1134
1344
  const iterator = values[Symbol.iterator](), set = new Set();
1135
1345
  for (const o of other) {
1136
- if (set.has(o)) continue;
1346
+ const io = intern(o);
1347
+ if (set.has(io)) continue;
1137
1348
  let value, done;
1138
1349
  while (({value, done} = iterator.next())) {
1139
1350
  if (done) return false;
1140
- set.add(value);
1141
- if (Object.is(o, value)) break;
1351
+ const ivalue = intern(value);
1352
+ set.add(ivalue);
1353
+ if (Object.is(io, ivalue)) break;
1142
1354
  }
1143
1355
  }
1144
1356
  return true;
1145
1357
  }
1146
1358
 
1359
+ function intern(value) {
1360
+ return value !== null && typeof value === "object" ? value.valueOf() : value;
1361
+ }
1362
+
1147
1363
  function subset(values, other) {
1148
1364
  return superset(other, values);
1149
1365
  }
1150
1366
 
1151
1367
  function union(...others) {
1152
- const set = new Set();
1368
+ const set = new InternSet();
1153
1369
  for (const other of others) {
1154
1370
  for (const o of other) {
1155
1371
  set.add(o);
@@ -2690,15 +2906,15 @@ var darker = 0.7;
2690
2906
  var brighter = 1 / darker;
2691
2907
 
2692
2908
  var reI = "\\s*([+-]?\\d+)\\s*",
2693
- reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
2694
- reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
2909
+ reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
2910
+ reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
2695
2911
  reHex = /^#([0-9a-f]{3,8})$/,
2696
- reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
2697
- reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
2698
- reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
2699
- reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
2700
- reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
2701
- reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
2912
+ reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`),
2913
+ reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`),
2914
+ reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`),
2915
+ reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`),
2916
+ reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`),
2917
+ reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
2702
2918
 
2703
2919
  var named = {
2704
2920
  aliceblue: 0xf0f8ff,
@@ -2852,14 +3068,15 @@ var named = {
2852
3068
  };
2853
3069
 
2854
3070
  define(Color, color, {
2855
- copy: function(channels) {
3071
+ copy(channels) {
2856
3072
  return Object.assign(new this.constructor, this, channels);
2857
3073
  },
2858
- displayable: function() {
3074
+ displayable() {
2859
3075
  return this.rgb().displayable();
2860
3076
  },
2861
3077
  hex: color_formatHex, // Deprecated! Use color.formatHex.
2862
3078
  formatHex: color_formatHex,
3079
+ formatHex8: color_formatHex8,
2863
3080
  formatHsl: color_formatHsl,
2864
3081
  formatRgb: color_formatRgb,
2865
3082
  toString: color_formatRgb
@@ -2869,6 +3086,10 @@ function color_formatHex() {
2869
3086
  return this.rgb().formatHex();
2870
3087
  }
2871
3088
 
3089
+ function color_formatHex8() {
3090
+ return this.rgb().formatHex8();
3091
+ }
3092
+
2872
3093
  function color_formatHsl() {
2873
3094
  return hslConvert(this).formatHsl();
2874
3095
  }
@@ -2924,18 +3145,21 @@ function Rgb(r, g, b, opacity) {
2924
3145
  }
2925
3146
 
2926
3147
  define(Rgb, rgb, extend(Color, {
2927
- brighter: function(k) {
3148
+ brighter(k) {
2928
3149
  k = k == null ? brighter : Math.pow(brighter, k);
2929
3150
  return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
2930
3151
  },
2931
- darker: function(k) {
3152
+ darker(k) {
2932
3153
  k = k == null ? darker : Math.pow(darker, k);
2933
3154
  return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
2934
3155
  },
2935
- rgb: function() {
3156
+ rgb() {
2936
3157
  return this;
2937
3158
  },
2938
- displayable: function() {
3159
+ clamp() {
3160
+ return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
3161
+ },
3162
+ displayable() {
2939
3163
  return (-0.5 <= this.r && this.r < 255.5)
2940
3164
  && (-0.5 <= this.g && this.g < 255.5)
2941
3165
  && (-0.5 <= this.b && this.b < 255.5)
@@ -2943,25 +3167,34 @@ define(Rgb, rgb, extend(Color, {
2943
3167
  },
2944
3168
  hex: rgb_formatHex, // Deprecated! Use color.formatHex.
2945
3169
  formatHex: rgb_formatHex,
3170
+ formatHex8: rgb_formatHex8,
2946
3171
  formatRgb: rgb_formatRgb,
2947
3172
  toString: rgb_formatRgb
2948
3173
  }));
2949
3174
 
2950
3175
  function rgb_formatHex() {
2951
- return "#" + hex(this.r) + hex(this.g) + hex(this.b);
3176
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
3177
+ }
3178
+
3179
+ function rgb_formatHex8() {
3180
+ return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
2952
3181
  }
2953
3182
 
2954
3183
  function rgb_formatRgb() {
2955
- var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
2956
- return (a === 1 ? "rgb(" : "rgba(")
2957
- + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
2958
- + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
2959
- + Math.max(0, Math.min(255, Math.round(this.b) || 0))
2960
- + (a === 1 ? ")" : ", " + a + ")");
3184
+ const a = clampa(this.opacity);
3185
+ return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
3186
+ }
3187
+
3188
+ function clampa(opacity) {
3189
+ return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
3190
+ }
3191
+
3192
+ function clampi(value) {
3193
+ return Math.max(0, Math.min(255, Math.round(value) || 0));
2961
3194
  }
2962
3195
 
2963
3196
  function hex(value) {
2964
- value = Math.max(0, Math.min(255, Math.round(value) || 0));
3197
+ value = clampi(value);
2965
3198
  return (value < 16 ? "0" : "") + value.toString(16);
2966
3199
  }
2967
3200
 
@@ -3010,15 +3243,15 @@ function Hsl(h, s, l, opacity) {
3010
3243
  }
3011
3244
 
3012
3245
  define(Hsl, hsl$2, extend(Color, {
3013
- brighter: function(k) {
3246
+ brighter(k) {
3014
3247
  k = k == null ? brighter : Math.pow(brighter, k);
3015
3248
  return new Hsl(this.h, this.s, this.l * k, this.opacity);
3016
3249
  },
3017
- darker: function(k) {
3250
+ darker(k) {
3018
3251
  k = k == null ? darker : Math.pow(darker, k);
3019
3252
  return new Hsl(this.h, this.s, this.l * k, this.opacity);
3020
3253
  },
3021
- rgb: function() {
3254
+ rgb() {
3022
3255
  var h = this.h % 360 + (this.h < 0) * 360,
3023
3256
  s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
3024
3257
  l = this.l,
@@ -3031,21 +3264,29 @@ define(Hsl, hsl$2, extend(Color, {
3031
3264
  this.opacity
3032
3265
  );
3033
3266
  },
3034
- displayable: function() {
3267
+ clamp() {
3268
+ return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
3269
+ },
3270
+ displayable() {
3035
3271
  return (0 <= this.s && this.s <= 1 || isNaN(this.s))
3036
3272
  && (0 <= this.l && this.l <= 1)
3037
3273
  && (0 <= this.opacity && this.opacity <= 1);
3038
3274
  },
3039
- formatHsl: function() {
3040
- var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
3041
- return (a === 1 ? "hsl(" : "hsla(")
3042
- + (this.h || 0) + ", "
3043
- + (this.s || 0) * 100 + "%, "
3044
- + (this.l || 0) * 100 + "%"
3045
- + (a === 1 ? ")" : ", " + a + ")");
3275
+ formatHsl() {
3276
+ const a = clampa(this.opacity);
3277
+ return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
3046
3278
  }
3047
3279
  }));
3048
3280
 
3281
+ function clamph(value) {
3282
+ value = (value || 0) % 360;
3283
+ return value < 0 ? value + 360 : value;
3284
+ }
3285
+
3286
+ function clampt(value) {
3287
+ return Math.max(0, Math.min(1, value || 0));
3288
+ }
3289
+
3049
3290
  /* From FvD 13.37, CSS Color Module Level 3 */
3050
3291
  function hsl2rgb(h, m1, m2) {
3051
3292
  return (h < 60 ? m1 + (m2 - m1) * h / 60
@@ -3098,13 +3339,13 @@ function Lab(l, a, b, opacity) {
3098
3339
  }
3099
3340
 
3100
3341
  define(Lab, lab$1, extend(Color, {
3101
- brighter: function(k) {
3342
+ brighter(k) {
3102
3343
  return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
3103
3344
  },
3104
- darker: function(k) {
3345
+ darker(k) {
3105
3346
  return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
3106
3347
  },
3107
- rgb: function() {
3348
+ rgb() {
3108
3349
  var y = (this.l + 16) / 116,
3109
3350
  x = isNaN(this.a) ? y : y + this.a / 500,
3110
3351
  z = isNaN(this.b) ? y : y - this.b / 200;
@@ -3166,13 +3407,13 @@ function hcl2lab(o) {
3166
3407
  }
3167
3408
 
3168
3409
  define(Hcl, hcl$2, extend(Color, {
3169
- brighter: function(k) {
3410
+ brighter(k) {
3170
3411
  return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
3171
3412
  },
3172
- darker: function(k) {
3413
+ darker(k) {
3173
3414
  return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
3174
3415
  },
3175
- rgb: function() {
3416
+ rgb() {
3176
3417
  return hcl2lab(this).rgb();
3177
3418
  }
3178
3419
  }));
@@ -3212,15 +3453,15 @@ function Cubehelix(h, s, l, opacity) {
3212
3453
  }
3213
3454
 
3214
3455
  define(Cubehelix, cubehelix$3, extend(Color, {
3215
- brighter: function(k) {
3456
+ brighter(k) {
3216
3457
  k = k == null ? brighter : Math.pow(brighter, k);
3217
3458
  return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
3218
3459
  },
3219
- darker: function(k) {
3460
+ darker(k) {
3220
3461
  k = k == null ? darker : Math.pow(darker, k);
3221
3462
  return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
3222
3463
  },
3223
- rgb: function() {
3464
+ rgb() {
3224
3465
  var h = isNaN(this.h) ? 0 : (this.h + 120) * radians$1,
3225
3466
  l = +this.l,
3226
3467
  a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
@@ -5800,39 +6041,58 @@ const pi$2 = Math.PI,
5800
6041
  epsilon$4 = 1e-6,
5801
6042
  tauEpsilon = tau$3 - epsilon$4;
5802
6043
 
5803
- function Path$1() {
5804
- this._x0 = this._y0 = // start of current subpath
5805
- this._x1 = this._y1 = null; // end of current subpath
5806
- this._ = "";
6044
+ function append$1(strings) {
6045
+ this._ += strings[0];
6046
+ for (let i = 1, n = strings.length; i < n; ++i) {
6047
+ this._ += arguments[i] + strings[i];
6048
+ }
5807
6049
  }
5808
6050
 
5809
- function path() {
5810
- return new Path$1;
6051
+ function appendRound$1(digits) {
6052
+ let d = Math.floor(digits);
6053
+ if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);
6054
+ if (d > 15) return append$1;
6055
+ const k = 10 ** d;
6056
+ return function(strings) {
6057
+ this._ += strings[0];
6058
+ for (let i = 1, n = strings.length; i < n; ++i) {
6059
+ this._ += Math.round(arguments[i] * k) / k + strings[i];
6060
+ }
6061
+ };
5811
6062
  }
5812
6063
 
5813
- Path$1.prototype = path.prototype = {
5814
- constructor: Path$1,
5815
- moveTo: function(x, y) {
5816
- this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
5817
- },
5818
- closePath: function() {
6064
+ let Path$1 = class Path {
6065
+ constructor(digits) {
6066
+ this._x0 = this._y0 = // start of current subpath
6067
+ this._x1 = this._y1 = null; // end of current subpath
6068
+ this._ = "";
6069
+ this._append = digits == null ? append$1 : appendRound$1(digits);
6070
+ }
6071
+ moveTo(x, y) {
6072
+ this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
6073
+ }
6074
+ closePath() {
5819
6075
  if (this._x1 !== null) {
5820
6076
  this._x1 = this._x0, this._y1 = this._y0;
5821
- this._ += "Z";
6077
+ this._append`Z`;
5822
6078
  }
5823
- },
5824
- lineTo: function(x, y) {
5825
- this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
5826
- },
5827
- quadraticCurveTo: function(x1, y1, x, y) {
5828
- this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
5829
- },
5830
- bezierCurveTo: function(x1, y1, x2, y2, x, y) {
5831
- this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
5832
- },
5833
- arcTo: function(x1, y1, x2, y2, r) {
6079
+ }
6080
+ lineTo(x, y) {
6081
+ this._append`L${this._x1 = +x},${this._y1 = +y}`;
6082
+ }
6083
+ quadraticCurveTo(x1, y1, x, y) {
6084
+ this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
6085
+ }
6086
+ bezierCurveTo(x1, y1, x2, y2, x, y) {
6087
+ this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
6088
+ }
6089
+ arcTo(x1, y1, x2, y2, r) {
5834
6090
  x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
5835
- var x0 = this._x1,
6091
+
6092
+ // Is the radius negative? Error.
6093
+ if (r < 0) throw new Error(`negative radius: ${r}`);
6094
+
6095
+ let x0 = this._x1,
5836
6096
  y0 = this._y1,
5837
6097
  x21 = x2 - x1,
5838
6098
  y21 = y2 - y1,
@@ -5840,12 +6100,9 @@ Path$1.prototype = path.prototype = {
5840
6100
  y01 = y0 - y1,
5841
6101
  l01_2 = x01 * x01 + y01 * y01;
5842
6102
 
5843
- // Is the radius negative? Error.
5844
- if (r < 0) throw new Error("negative radius: " + r);
5845
-
5846
6103
  // Is this path empty? Move to (x1,y1).
5847
6104
  if (this._x1 === null) {
5848
- this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
6105
+ this._append`M${this._x1 = x1},${this._y1 = y1}`;
5849
6106
  }
5850
6107
 
5851
6108
  // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
@@ -5855,12 +6112,12 @@ Path$1.prototype = path.prototype = {
5855
6112
  // Equivalently, is (x1,y1) coincident with (x2,y2)?
5856
6113
  // Or, is the radius zero? Line to (x1,y1).
5857
6114
  else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$4) || !r) {
5858
- this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
6115
+ this._append`L${this._x1 = x1},${this._y1 = y1}`;
5859
6116
  }
5860
6117
 
5861
6118
  // Otherwise, draw an arc!
5862
6119
  else {
5863
- var x20 = x2 - x0,
6120
+ let x20 = x2 - x0,
5864
6121
  y20 = y2 - y0,
5865
6122
  l21_2 = x21 * x21 + y21 * y21,
5866
6123
  l20_2 = x20 * x20 + y20 * y20,
@@ -5872,32 +6129,33 @@ Path$1.prototype = path.prototype = {
5872
6129
 
5873
6130
  // If the start tangent is not coincident with (x0,y0), line to.
5874
6131
  if (Math.abs(t01 - 1) > epsilon$4) {
5875
- this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
6132
+ this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
5876
6133
  }
5877
6134
 
5878
- this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
6135
+ this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
5879
6136
  }
5880
- },
5881
- arc: function(x, y, r, a0, a1, ccw) {
6137
+ }
6138
+ arc(x, y, r, a0, a1, ccw) {
5882
6139
  x = +x, y = +y, r = +r, ccw = !!ccw;
5883
- var dx = r * Math.cos(a0),
6140
+
6141
+ // Is the radius negative? Error.
6142
+ if (r < 0) throw new Error(`negative radius: ${r}`);
6143
+
6144
+ let dx = r * Math.cos(a0),
5884
6145
  dy = r * Math.sin(a0),
5885
6146
  x0 = x + dx,
5886
6147
  y0 = y + dy,
5887
6148
  cw = 1 ^ ccw,
5888
6149
  da = ccw ? a0 - a1 : a1 - a0;
5889
6150
 
5890
- // Is the radius negative? Error.
5891
- if (r < 0) throw new Error("negative radius: " + r);
5892
-
5893
6151
  // Is this path empty? Move to (x0,y0).
5894
6152
  if (this._x1 === null) {
5895
- this._ += "M" + x0 + "," + y0;
6153
+ this._append`M${x0},${y0}`;
5896
6154
  }
5897
6155
 
5898
6156
  // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
5899
6157
  else if (Math.abs(this._x1 - x0) > epsilon$4 || Math.abs(this._y1 - y0) > epsilon$4) {
5900
- this._ += "L" + x0 + "," + y0;
6158
+ this._append`L${x0},${y0}`;
5901
6159
  }
5902
6160
 
5903
6161
  // Is this arc empty? We’re done.
@@ -5908,22 +6166,33 @@ Path$1.prototype = path.prototype = {
5908
6166
 
5909
6167
  // Is this a complete circle? Draw two arcs to complete the circle.
5910
6168
  if (da > tauEpsilon) {
5911
- this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
6169
+ this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
5912
6170
  }
5913
6171
 
5914
6172
  // Is this arc non-empty? Draw an arc!
5915
6173
  else if (da > epsilon$4) {
5916
- this._ += "A" + r + "," + r + ",0," + (+(da >= pi$2)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
6174
+ this._append`A${r},${r},0,${+(da >= pi$2)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
5917
6175
  }
5918
- },
5919
- rect: function(x, y, w, h) {
5920
- this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
5921
- },
5922
- toString: function() {
6176
+ }
6177
+ rect(x, y, w, h) {
6178
+ this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
6179
+ }
6180
+ toString() {
5923
6181
  return this._;
5924
6182
  }
5925
6183
  };
5926
6184
 
6185
+ function path() {
6186
+ return new Path$1;
6187
+ }
6188
+
6189
+ // Allow instanceof d3.path
6190
+ path.prototype = Path$1.prototype;
6191
+
6192
+ function pathRound(digits = 3) {
6193
+ return new Path$1(+digits);
6194
+ }
6195
+
5927
6196
  var slice$2 = Array.prototype.slice;
5928
6197
 
5929
6198
  function constant$6(x) {
@@ -6127,7 +6396,7 @@ var cases = [
6127
6396
  []
6128
6397
  ];
6129
6398
 
6130
- function contours() {
6399
+ function Contours() {
6131
6400
  var dx = 1,
6132
6401
  dy = 1,
6133
6402
  threshold = thresholdSturges,
@@ -6138,8 +6407,10 @@ function contours() {
6138
6407
 
6139
6408
  // Convert number of thresholds into uniform thresholds.
6140
6409
  if (!Array.isArray(tz)) {
6141
- const e = extent$1(values), ts = tickStep(e[0], e[1], tz);
6142
- tz = ticks(Math.floor(e[0] / ts) * ts, Math.floor(e[1] / ts - 1) * ts, tz);
6410
+ const e = extent$1(values, finite);
6411
+ tz = ticks(...nice$1(e[0], e[1], tz), tz);
6412
+ while (tz[tz.length - 1] >= e[1]) tz.pop();
6413
+ while (tz[1] < e[0]) tz.shift();
6143
6414
  } else {
6144
6415
  tz = tz.slice().sort(ascending$1);
6145
6416
  }
@@ -6150,11 +6421,14 @@ function contours() {
6150
6421
  // Accumulate, smooth contour rings, assign holes to exterior rings.
6151
6422
  // Based on https://github.com/mbostock/shapefile/blob/v0.6.2/shp/polygon.js
6152
6423
  function contour(values, value) {
6424
+ const v = value == null ? NaN : +value;
6425
+ if (isNaN(v)) throw new Error(`invalid value: ${value}`);
6426
+
6153
6427
  var polygons = [],
6154
6428
  holes = [];
6155
6429
 
6156
- isorings(values, value, function(ring) {
6157
- smooth(ring, values, value);
6430
+ isorings(values, v, function(ring) {
6431
+ smooth(ring, values, v);
6158
6432
  if (area$3(ring) > 0) polygons.push([ring]);
6159
6433
  else holes.push(ring);
6160
6434
  });
@@ -6184,10 +6458,10 @@ function contours() {
6184
6458
 
6185
6459
  // Special case for the first row (y = -1, t2 = t3 = 0).
6186
6460
  x = y = -1;
6187
- t1 = values[0] >= value;
6461
+ t1 = above(values[0], value);
6188
6462
  cases[t1 << 1].forEach(stitch);
6189
6463
  while (++x < dx - 1) {
6190
- t0 = t1, t1 = values[x + 1] >= value;
6464
+ t0 = t1, t1 = above(values[x + 1], value);
6191
6465
  cases[t0 | t1 << 1].forEach(stitch);
6192
6466
  }
6193
6467
  cases[t1 << 0].forEach(stitch);
@@ -6195,12 +6469,12 @@ function contours() {
6195
6469
  // General case for the intermediate rows.
6196
6470
  while (++y < dy - 1) {
6197
6471
  x = -1;
6198
- t1 = values[y * dx + dx] >= value;
6199
- t2 = values[y * dx] >= value;
6472
+ t1 = above(values[y * dx + dx], value);
6473
+ t2 = above(values[y * dx], value);
6200
6474
  cases[t1 << 1 | t2 << 2].forEach(stitch);
6201
6475
  while (++x < dx - 1) {
6202
- t0 = t1, t1 = values[y * dx + dx + x + 1] >= value;
6203
- t3 = t2, t2 = values[y * dx + x + 1] >= value;
6476
+ t0 = t1, t1 = above(values[y * dx + dx + x + 1], value);
6477
+ t3 = t2, t2 = above(values[y * dx + x + 1], value);
6204
6478
  cases[t0 | t1 << 1 | t2 << 2 | t3 << 3].forEach(stitch);
6205
6479
  }
6206
6480
  cases[t1 | t2 << 3].forEach(stitch);
@@ -6211,7 +6485,7 @@ function contours() {
6211
6485
  t2 = values[y * dx] >= value;
6212
6486
  cases[t2 << 2].forEach(stitch);
6213
6487
  while (++x < dx - 1) {
6214
- t3 = t2, t2 = values[y * dx + x + 1] >= value;
6488
+ t3 = t2, t2 = above(values[y * dx + x + 1], value);
6215
6489
  cases[t2 << 2 | t3 << 3].forEach(stitch);
6216
6490
  }
6217
6491
  cases[t2 << 3].forEach(stitch);
@@ -6268,15 +6542,12 @@ function contours() {
6268
6542
  y = point[1],
6269
6543
  xt = x | 0,
6270
6544
  yt = y | 0,
6271
- v0,
6272
- v1 = values[yt * dx + xt];
6545
+ v1 = valid(values[yt * dx + xt]);
6273
6546
  if (x > 0 && x < dx && xt === x) {
6274
- v0 = values[yt * dx + xt - 1];
6275
- point[0] = x + (value - v0) / (v1 - v0) - 0.5;
6547
+ point[0] = smooth1(x, valid(values[yt * dx + xt - 1]), v1, value);
6276
6548
  }
6277
6549
  if (y > 0 && y < dy && yt === y) {
6278
- v0 = values[(yt - 1) * dx + xt];
6279
- point[1] = y + (value - v0) / (v1 - v0) - 0.5;
6550
+ point[1] = smooth1(y, valid(values[(yt - 1) * dx + xt]), v1, value);
6280
6551
  }
6281
6552
  });
6282
6553
  }
@@ -6301,48 +6572,27 @@ function contours() {
6301
6572
  return contours;
6302
6573
  }
6303
6574
 
6304
- // TODO Optimize edge cases.
6305
- // TODO Optimize index calculation.
6306
- // TODO Optimize arguments.
6307
- function blurX(source, target, r) {
6308
- var n = source.width,
6309
- m = source.height,
6310
- w = (r << 1) + 1;
6311
- for (var j = 0; j < m; ++j) {
6312
- for (var i = 0, sr = 0; i < n + r; ++i) {
6313
- if (i < n) {
6314
- sr += source.data[i + j * n];
6315
- }
6316
- if (i >= r) {
6317
- if (i >= w) {
6318
- sr -= source.data[i - w + j * n];
6319
- }
6320
- target.data[i - r + j * n] = sr / Math.min(i + 1, n - 1 + w - i, w);
6321
- }
6322
- }
6323
- }
6575
+ // When computing the extent, ignore infinite values (as well as invalid ones).
6576
+ function finite(x) {
6577
+ return isFinite(x) ? x : NaN;
6324
6578
  }
6325
6579
 
6326
- // TODO Optimize edge cases.
6327
- // TODO Optimize index calculation.
6328
- // TODO Optimize arguments.
6329
- function blurY(source, target, r) {
6330
- var n = source.width,
6331
- m = source.height,
6332
- w = (r << 1) + 1;
6333
- for (var i = 0; i < n; ++i) {
6334
- for (var j = 0, sr = 0; j < m + r; ++j) {
6335
- if (j < m) {
6336
- sr += source.data[i + j * n];
6337
- }
6338
- if (j >= r) {
6339
- if (j >= w) {
6340
- sr -= source.data[i + (j - w) * n];
6341
- }
6342
- target.data[i + (j - r) * n] = sr / Math.min(j + 1, m - 1 + w - j, w);
6343
- }
6344
- }
6345
- }
6580
+ // Is the (possibly invalid) x greater than or equal to the (known valid) value?
6581
+ // Treat any invalid value as below negative infinity.
6582
+ function above(x, value) {
6583
+ return x == null ? false : +x >= value;
6584
+ }
6585
+
6586
+ // During smoothing, treat any invalid value as negative infinity.
6587
+ function valid(v) {
6588
+ return v == null || isNaN(v = +v) ? -Infinity : v;
6589
+ }
6590
+
6591
+ function smooth1(x, v0, v1, value) {
6592
+ const a = value - v0;
6593
+ const b = v1 - v0;
6594
+ const d = isFinite(a) || isFinite(b) ? a / b : Math.sign(a) / Math.sign(b);
6595
+ return isNaN(d) ? x : x + d - 0.5;
6346
6596
  }
6347
6597
 
6348
6598
  function defaultX$1(d) {
@@ -6370,54 +6620,63 @@ function density() {
6370
6620
  m = (dy + o * 2) >> k, // grid height
6371
6621
  threshold = constant$5(20);
6372
6622
 
6373
- function density(data) {
6374
- var values0 = new Float32Array(n * m),
6375
- values1 = new Float32Array(n * m),
6376
- pow2k = Math.pow(2, -k);
6623
+ function grid(data) {
6624
+ var values = new Float32Array(n * m),
6625
+ pow2k = Math.pow(2, -k),
6626
+ i = -1;
6377
6627
 
6378
- data.forEach(function(d, i, data) {
6379
- var xi = (x(d, i, data) + o) * pow2k,
6628
+ for (const d of data) {
6629
+ var xi = (x(d, ++i, data) + o) * pow2k,
6380
6630
  yi = (y(d, i, data) + o) * pow2k,
6381
6631
  wi = +weight(d, i, data);
6382
- if (xi >= 0 && xi < n && yi >= 0 && yi < m) {
6632
+ if (wi && xi >= 0 && xi < n && yi >= 0 && yi < m) {
6383
6633
  var x0 = Math.floor(xi),
6384
6634
  y0 = Math.floor(yi),
6385
6635
  xt = xi - x0 - 0.5,
6386
6636
  yt = yi - y0 - 0.5;
6387
- values0[x0 + y0 * n] += (1 - xt) * (1 - yt) * wi;
6388
- values0[x0 + 1 + y0 * n] += xt * (1 - yt) * wi;
6389
- values0[x0 + 1 + (y0 + 1) * n] += xt * yt * wi;
6390
- values0[x0 + (y0 + 1) * n] += (1 - xt) * yt * wi;
6637
+ values[x0 + y0 * n] += (1 - xt) * (1 - yt) * wi;
6638
+ values[x0 + 1 + y0 * n] += xt * (1 - yt) * wi;
6639
+ values[x0 + 1 + (y0 + 1) * n] += xt * yt * wi;
6640
+ values[x0 + (y0 + 1) * n] += (1 - xt) * yt * wi;
6391
6641
  }
6392
- });
6642
+ }
6393
6643
 
6394
- // TODO Optimize.
6395
- blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k);
6396
- blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k);
6397
- blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k);
6398
- blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k);
6399
- blurX({width: n, height: m, data: values0}, {width: n, height: m, data: values1}, r >> k);
6400
- blurY({width: n, height: m, data: values1}, {width: n, height: m, data: values0}, r >> k);
6644
+ blur2({data: values, width: n, height: m}, r * pow2k);
6645
+ return values;
6646
+ }
6401
6647
 
6402
- var tz = threshold(values0);
6648
+ function density(data) {
6649
+ var values = grid(data),
6650
+ tz = threshold(values),
6651
+ pow4k = Math.pow(2, 2 * k);
6403
6652
 
6404
6653
  // Convert number of thresholds into uniform thresholds.
6405
6654
  if (!Array.isArray(tz)) {
6406
- var stop = max$3(values0);
6407
- tz = tickStep(0, stop, tz);
6408
- tz = sequence(0, Math.floor(stop / tz) * tz, tz);
6409
- tz.shift();
6655
+ tz = ticks(Number.MIN_VALUE, max$3(values) / pow4k, tz);
6410
6656
  }
6411
6657
 
6412
- return contours()
6413
- .thresholds(tz)
6658
+ return Contours()
6414
6659
  .size([n, m])
6415
- (values0)
6416
- .map(transform);
6660
+ .thresholds(tz.map(d => d * pow4k))
6661
+ (values)
6662
+ .map((c, i) => (c.value = +tz[i], transform(c)));
6417
6663
  }
6418
6664
 
6665
+ density.contours = function(data) {
6666
+ var values = grid(data),
6667
+ contours = Contours().size([n, m]),
6668
+ pow4k = Math.pow(2, 2 * k),
6669
+ contour = value => {
6670
+ value = +value;
6671
+ var c = transform(contours.contour(values, value * pow4k));
6672
+ c.value = value; // preserve exact threshold value
6673
+ return c;
6674
+ };
6675
+ Object.defineProperty(contour, "max", {get: () => max$3(values) / pow4k});
6676
+ return contour;
6677
+ };
6678
+
6419
6679
  function transform(geometry) {
6420
- geometry.value *= Math.pow(2, -2 * k); // Density in points per square pixel.
6421
6680
  geometry.coordinates.forEach(transformPolygon);
6422
6681
  return geometry;
6423
6682
  }
@@ -6475,7 +6734,7 @@ function density() {
6475
6734
  density.bandwidth = function(_) {
6476
6735
  if (!arguments.length) return Math.sqrt(r * (r + 1));
6477
6736
  if (!((_ = +_) >= 0)) throw new Error("invalid bandwidth");
6478
- return r = Math.round((Math.sqrt(4 * _ * _ + 1) - 1) / 2), resize();
6737
+ return r = (Math.sqrt(4 * _ * _ + 1) - 1) / 2, resize();
6479
6738
  };
6480
6739
 
6481
6740
  return density;
@@ -6741,8 +7000,6 @@ function orient2d(ax, ay, bx, by, cx, cy) {
6741
7000
  const detright = (ax - cx) * (by - cy);
6742
7001
  const det = detleft - detright;
6743
7002
 
6744
- if (detleft === 0 || detright === 0 || (detleft > 0) !== (detright > 0)) return det;
6745
-
6746
7003
  const detsum = Math.abs(detleft + detright);
6747
7004
  if (Math.abs(det) >= ccwerrboundA * detsum) return det;
6748
7005
 
@@ -7302,6 +7559,7 @@ class Voronoi {
7302
7559
  }
7303
7560
  _init() {
7304
7561
  const {delaunay: {points, hull, triangles}, vectors} = this;
7562
+ let bx, by; // lazily computed barycenter of the hull
7305
7563
 
7306
7564
  // Compute circumcenters.
7307
7565
  const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2);
@@ -7323,17 +7581,15 @@ class Voronoi {
7323
7581
  const ab = (dx * ey - dy * ex) * 2;
7324
7582
 
7325
7583
  if (Math.abs(ab) < 1e-9) {
7326
- // degenerate case (collinear diagram)
7327
- // almost equal points (degenerate triangle)
7328
- // the circumcenter is at the infinity, in a
7329
- // direction that is:
7330
- // 1. orthogonal to the halfedge.
7331
- let a = 1e9;
7332
- // 2. points away from the center; since the list of triangles starts
7333
- // in the center, the first point of the first triangle
7334
- // will be our reference
7335
- const r = triangles[0] * 2;
7336
- a *= Math.sign((points[r] - x1) * ey - (points[r + 1] - y1) * ex);
7584
+ // For a degenerate triangle, the circumcenter is at the infinity, in a
7585
+ // direction orthogonal to the halfedge and away from the “center” of
7586
+ // the diagram <bx, by>, defined as the hull’s barycenter.
7587
+ if (bx === undefined) {
7588
+ bx = by = 0;
7589
+ for (const i of hull) bx += points[i * 2], by += points[i * 2 + 1];
7590
+ bx /= hull.length, by /= hull.length;
7591
+ }
7592
+ const a = 1e9 * Math.sign((bx - x1) * ey - (by - y1) * ex);
7337
7593
  x = (x1 + x3) / 2 - a * ey;
7338
7594
  y = (y1 + y3) / 2 + a * ex;
7339
7595
  } else {
@@ -7442,11 +7698,10 @@ class Voronoi {
7442
7698
  // find the common edge
7443
7699
  if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) {
7444
7700
  for (let aj = 0, lj = cj.length; aj < lj; aj += 2) {
7445
- if (ci[ai] == cj[aj]
7446
- && ci[ai + 1] == cj[aj + 1]
7447
- && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj]
7448
- && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj]
7449
- ) {
7701
+ if (ci[ai] === cj[aj]
7702
+ && ci[ai + 1] === cj[aj + 1]
7703
+ && ci[(ai + 2) % li] === cj[(aj + lj - 2) % lj]
7704
+ && ci[(ai + 3) % li] === cj[(aj + lj - 1) % lj]) {
7450
7705
  yield j;
7451
7706
  break loop;
7452
7707
  }
@@ -7478,9 +7733,9 @@ class Voronoi {
7478
7733
  if (points === null) return null;
7479
7734
  const {vectors: V} = this;
7480
7735
  const v = i * 4;
7481
- return V[v] || V[v + 1]
7736
+ return this._simplify(V[v] || V[v + 1]
7482
7737
  ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3])
7483
- : this._clipFinite(i, points);
7738
+ : this._clipFinite(i, points));
7484
7739
  }
7485
7740
  _clipFinite(i, points) {
7486
7741
  const n = points.length;
@@ -7523,8 +7778,11 @@ class Voronoi {
7523
7778
  return P;
7524
7779
  }
7525
7780
  _clipSegment(x0, y0, x1, y1, c0, c1) {
7781
+ // for more robustness, always consider the segment in the same order
7782
+ const flip = c0 < c1;
7783
+ if (flip) [x0, y0, x1, y1, c0, c1] = [x1, y1, x0, y0, c1, c0];
7526
7784
  while (true) {
7527
- if (c0 === 0 && c1 === 0) return [x0, y0, x1, y1];
7785
+ if (c0 === 0 && c1 === 0) return flip ? [x1, y1, x0, y0] : [x0, y0, x1, y1];
7528
7786
  if (c0 & c1) return null;
7529
7787
  let x, y, c = c0 || c1;
7530
7788
  if (c & 0b1000) x = x0 + (x1 - x0) * (this.ymax - y0) / (y1 - y0), y = this.ymax;
@@ -7568,14 +7826,6 @@ class Voronoi {
7568
7826
  P.splice(j, 0, x, y), j += 2;
7569
7827
  }
7570
7828
  }
7571
- if (P.length > 4) {
7572
- for (let i = 0; i < P.length; i+= 2) {
7573
- const j = (i + 2) % P.length, k = (i + 4) % P.length;
7574
- if (P[i] === P[j] && P[j] === P[k]
7575
- || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1])
7576
- P.splice(j, 2), i -= 2;
7577
- }
7578
- }
7579
7829
  return j;
7580
7830
  }
7581
7831
  _project(x0, y0, vx, vy) {
@@ -7608,6 +7858,18 @@ class Voronoi {
7608
7858
  | (y < this.ymin ? 0b0100
7609
7859
  : y > this.ymax ? 0b1000 : 0b0000);
7610
7860
  }
7861
+ _simplify(P) {
7862
+ if (P && P.length > 4) {
7863
+ for (let i = 0; i < P.length; i+= 2) {
7864
+ const j = (i + 2) % P.length, k = (i + 4) % P.length;
7865
+ if (P[i] === P[j] && P[j] === P[k] || P[i + 1] === P[j + 1] && P[j + 1] === P[k + 1]) {
7866
+ P.splice(j, 2), i -= 2;
7867
+ }
7868
+ }
7869
+ if (!P.length) P = null;
7870
+ }
7871
+ return P;
7872
+ }
7611
7873
  }
7612
7874
 
7613
7875
  const tau$2 = 2 * Math.PI, pow$2 = Math.pow;
@@ -8809,13 +9071,13 @@ function link$2(links) {
8809
9071
  }
8810
9072
 
8811
9073
  // https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
8812
- const a$1 = 1664525;
8813
- const c$3 = 1013904223;
8814
- const m = 4294967296; // 2^32
9074
+ const a$2 = 1664525;
9075
+ const c$4 = 1013904223;
9076
+ const m$1 = 4294967296; // 2^32
8815
9077
 
8816
- function lcg$1() {
9078
+ function lcg$2() {
8817
9079
  let s = 1;
8818
- return () => (s = (a$1 * s + c$3) % m) / m;
9080
+ return () => (s = (a$2 * s + c$4) % m$1) / m$1;
8819
9081
  }
8820
9082
 
8821
9083
  function x$2(d) {
@@ -8839,7 +9101,7 @@ function simulation(nodes) {
8839
9101
  forces = new Map(),
8840
9102
  stepper = timer(step),
8841
9103
  event = dispatch("tick", "end"),
8842
- random = lcg$1();
9104
+ random = lcg$2();
8843
9105
 
8844
9106
  if (nodes == null) nodes = [];
8845
9107
 
@@ -9377,7 +9639,7 @@ function identity$6(x) {
9377
9639
  }
9378
9640
 
9379
9641
  var map = Array.prototype.map,
9380
- prefixes = ["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];
9642
+ prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];
9381
9643
 
9382
9644
  function formatLocale$1(locale) {
9383
9645
  var group = locale.grouping === undefined || locale.thousands === undefined ? identity$6 : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""),
@@ -9386,7 +9648,7 @@ function formatLocale$1(locale) {
9386
9648
  decimal = locale.decimal === undefined ? "." : locale.decimal + "",
9387
9649
  numerals = locale.numerals === undefined ? identity$6 : formatNumerals(map.call(locale.numerals, String)),
9388
9650
  percent = locale.percent === undefined ? "%" : locale.percent + "",
9389
- minus = locale.minus === undefined ? "\u2212" : locale.minus + "",
9651
+ minus = locale.minus === undefined ? "" : locale.minus + "",
9390
9652
  nan = locale.nan === undefined ? "NaN" : locale.nan + "";
9391
9653
 
9392
9654
  function newFormat(specifier) {
@@ -9766,22 +10028,22 @@ var lambda0$1, phi0, lambda1, phi1, // bounds
9766
10028
  ranges,
9767
10029
  range;
9768
10030
 
9769
- var boundsStream$1 = {
10031
+ var boundsStream$2 = {
9770
10032
  point: boundsPoint$1,
9771
10033
  lineStart: boundsLineStart,
9772
10034
  lineEnd: boundsLineEnd,
9773
10035
  polygonStart: function() {
9774
- boundsStream$1.point = boundsRingPoint;
9775
- boundsStream$1.lineStart = boundsRingStart;
9776
- boundsStream$1.lineEnd = boundsRingEnd;
10036
+ boundsStream$2.point = boundsRingPoint;
10037
+ boundsStream$2.lineStart = boundsRingStart;
10038
+ boundsStream$2.lineEnd = boundsRingEnd;
9777
10039
  deltaSum = new Adder();
9778
10040
  areaStream$1.polygonStart();
9779
10041
  },
9780
10042
  polygonEnd: function() {
9781
10043
  areaStream$1.polygonEnd();
9782
- boundsStream$1.point = boundsPoint$1;
9783
- boundsStream$1.lineStart = boundsLineStart;
9784
- boundsStream$1.lineEnd = boundsLineEnd;
10044
+ boundsStream$2.point = boundsPoint$1;
10045
+ boundsStream$2.lineStart = boundsLineStart;
10046
+ boundsStream$2.lineEnd = boundsLineEnd;
9785
10047
  if (areaRingSum$1 < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90);
9786
10048
  else if (deltaSum > epsilon$1) phi1 = 90;
9787
10049
  else if (deltaSum < -epsilon$1) phi0 = -90;
@@ -9848,12 +10110,12 @@ function linePoint(lambda, phi) {
9848
10110
  }
9849
10111
 
9850
10112
  function boundsLineStart() {
9851
- boundsStream$1.point = linePoint;
10113
+ boundsStream$2.point = linePoint;
9852
10114
  }
9853
10115
 
9854
10116
  function boundsLineEnd() {
9855
10117
  range[0] = lambda0$1, range[1] = lambda1;
9856
- boundsStream$1.point = boundsPoint$1;
10118
+ boundsStream$2.point = boundsPoint$1;
9857
10119
  p0 = null;
9858
10120
  }
9859
10121
 
@@ -9900,7 +10162,7 @@ function bounds(feature) {
9900
10162
 
9901
10163
  phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity);
9902
10164
  ranges = [];
9903
- geoStream(feature, boundsStream$1);
10165
+ geoStream(feature, boundsStream$2);
9904
10166
 
9905
10167
  // First, sort ranges by their minimum longitudes.
9906
10168
  if (n = ranges.length) {
@@ -10091,7 +10353,8 @@ function compose(a, b) {
10091
10353
  }
10092
10354
 
10093
10355
  function rotationIdentity(lambda, phi) {
10094
- return [abs$1(lambda) > pi$1 ? lambda + Math.round(-lambda / tau$1) * tau$1 : lambda, phi];
10356
+ if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1;
10357
+ return [lambda, phi];
10095
10358
  }
10096
10359
 
10097
10360
  rotationIdentity.invert = rotationIdentity;
@@ -10105,7 +10368,9 @@ function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
10105
10368
 
10106
10369
  function forwardRotationLambda(deltaLambda) {
10107
10370
  return function(lambda, phi) {
10108
- return lambda += deltaLambda, [lambda > pi$1 ? lambda - tau$1 : lambda < -pi$1 ? lambda + tau$1 : lambda, phi];
10371
+ lambda += deltaLambda;
10372
+ if (abs$1(lambda) > pi$1) lambda -= Math.round(lambda / tau$1) * tau$1;
10373
+ return [lambda, phi];
10109
10374
  };
10110
10375
  }
10111
10376
 
@@ -10192,7 +10457,7 @@ function circleRadius(cosRadius, point) {
10192
10457
  return ((-point[2] < 0 ? -radius : radius) + tau$1 - epsilon$1) % tau$1;
10193
10458
  }
10194
10459
 
10195
- function circle$2() {
10460
+ function circle$1() {
10196
10461
  var center = constant$3([0, 0]),
10197
10462
  radius = constant$3(90),
10198
10463
  precision = constant$3(6),
@@ -11214,12 +11479,12 @@ function contains$1(object, point) {
11214
11479
  }
11215
11480
 
11216
11481
  function graticuleX(y0, y1, dy) {
11217
- var y = sequence(y0, y1 - epsilon$1, dy).concat(y1);
11482
+ var y = range$2(y0, y1 - epsilon$1, dy).concat(y1);
11218
11483
  return function(x) { return y.map(function(y) { return [x, y]; }); };
11219
11484
  }
11220
11485
 
11221
11486
  function graticuleY(x0, x1, dx) {
11222
- var x = sequence(x0, x1 - epsilon$1, dx).concat(x1);
11487
+ var x = range$2(x0, x1 - epsilon$1, dx).concat(x1);
11223
11488
  return function(y) { return x.map(function(x) { return [x, y]; }); };
11224
11489
  }
11225
11490
 
@@ -11235,10 +11500,10 @@ function graticule() {
11235
11500
  }
11236
11501
 
11237
11502
  function lines() {
11238
- return sequence(ceil(X0 / DX) * DX, X1, DX).map(X)
11239
- .concat(sequence(ceil(Y0 / DY) * DY, Y1, DY).map(Y))
11240
- .concat(sequence(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs$1(x % DX) > epsilon$1; }).map(x))
11241
- .concat(sequence(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs$1(y % DY) > epsilon$1; }).map(y));
11503
+ return range$2(ceil(X0 / DX) * DX, X1, DX).map(X)
11504
+ .concat(range$2(ceil(Y0 / DY) * DY, Y1, DY).map(Y))
11505
+ .concat(range$2(ceil(x0 / dx) * dx, x1, dx).filter(function(x) { return abs$1(x % DX) > epsilon$1; }).map(x))
11506
+ .concat(range$2(ceil(y0 / dy) * dy, y1, dy).filter(function(y) { return abs$1(y % DY) > epsilon$1; }).map(y));
11242
11507
  }
11243
11508
 
11244
11509
  graticule.lines = function() {
@@ -11398,6 +11663,8 @@ function areaRingEnd() {
11398
11663
  areaPoint(x00$2, y00$2);
11399
11664
  }
11400
11665
 
11666
+ var pathArea = areaStream;
11667
+
11401
11668
  var x0$2 = Infinity,
11402
11669
  y0$2 = x0$2,
11403
11670
  x1 = -x0$2,
@@ -11423,6 +11690,8 @@ function boundsPoint(x, y) {
11423
11690
  if (y > y1) y1 = y;
11424
11691
  }
11425
11692
 
11693
+ var boundsStream$1 = boundsStream;
11694
+
11426
11695
  // TODO Enforce positive area for exterior, negative area for interior?
11427
11696
 
11428
11697
  var X0 = 0,
@@ -11520,6 +11789,8 @@ function centroidPointRing(x, y) {
11520
11789
  centroidPoint(x0$1 = x, y0$1 = y);
11521
11790
  }
11522
11791
 
11792
+ var pathCentroid = centroidStream;
11793
+
11523
11794
  function PathContext(context) {
11524
11795
  this._context = context;
11525
11796
  }
@@ -11603,68 +11874,98 @@ function lengthPoint(x, y) {
11603
11874
  x0 = x, y0 = y;
11604
11875
  }
11605
11876
 
11606
- function PathString() {
11607
- this._string = [];
11608
- }
11877
+ var pathMeasure = lengthStream;
11609
11878
 
11610
- PathString.prototype = {
11611
- _radius: 4.5,
11612
- _circle: circle$1(4.5),
11613
- pointRadius: function(_) {
11614
- if ((_ = +_) !== this._radius) this._radius = _, this._circle = null;
11879
+ // Simple caching for constant-radius points.
11880
+ let cacheDigits, cacheAppend, cacheRadius, cacheCircle;
11881
+
11882
+ class PathString {
11883
+ constructor(digits) {
11884
+ this._append = digits == null ? append : appendRound(digits);
11885
+ this._radius = 4.5;
11886
+ this._ = "";
11887
+ }
11888
+ pointRadius(_) {
11889
+ this._radius = +_;
11615
11890
  return this;
11616
- },
11617
- polygonStart: function() {
11891
+ }
11892
+ polygonStart() {
11618
11893
  this._line = 0;
11619
- },
11620
- polygonEnd: function() {
11894
+ }
11895
+ polygonEnd() {
11621
11896
  this._line = NaN;
11622
- },
11623
- lineStart: function() {
11897
+ }
11898
+ lineStart() {
11624
11899
  this._point = 0;
11625
- },
11626
- lineEnd: function() {
11627
- if (this._line === 0) this._string.push("Z");
11900
+ }
11901
+ lineEnd() {
11902
+ if (this._line === 0) this._ += "Z";
11628
11903
  this._point = NaN;
11629
- },
11630
- point: function(x, y) {
11904
+ }
11905
+ point(x, y) {
11631
11906
  switch (this._point) {
11632
11907
  case 0: {
11633
- this._string.push("M", x, ",", y);
11908
+ this._append`M${x},${y}`;
11634
11909
  this._point = 1;
11635
11910
  break;
11636
11911
  }
11637
11912
  case 1: {
11638
- this._string.push("L", x, ",", y);
11913
+ this._append`L${x},${y}`;
11639
11914
  break;
11640
11915
  }
11641
11916
  default: {
11642
- if (this._circle == null) this._circle = circle$1(this._radius);
11643
- this._string.push("M", x, ",", y, this._circle);
11917
+ this._append`M${x},${y}`;
11918
+ if (this._radius !== cacheRadius || this._append !== cacheAppend) {
11919
+ const r = this._radius;
11920
+ const s = this._;
11921
+ this._ = ""; // stash the old string so we can cache the circle path fragment
11922
+ this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;
11923
+ cacheRadius = r;
11924
+ cacheAppend = this._append;
11925
+ cacheCircle = this._;
11926
+ this._ = s;
11927
+ }
11928
+ this._ += cacheCircle;
11644
11929
  break;
11645
11930
  }
11646
11931
  }
11647
- },
11648
- result: function() {
11649
- if (this._string.length) {
11650
- var result = this._string.join("");
11651
- this._string = [];
11652
- return result;
11653
- } else {
11654
- return null;
11655
- }
11656
11932
  }
11657
- };
11933
+ result() {
11934
+ const result = this._;
11935
+ this._ = "";
11936
+ return result.length ? result : null;
11937
+ }
11938
+ }
11658
11939
 
11659
- function circle$1(radius) {
11660
- return "m0," + radius
11661
- + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius
11662
- + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius
11663
- + "z";
11940
+ function append(strings) {
11941
+ let i = 1;
11942
+ this._ += strings[0];
11943
+ for (const j = strings.length; i < j; ++i) {
11944
+ this._ += arguments[i] + strings[i];
11945
+ }
11946
+ }
11947
+
11948
+ function appendRound(digits) {
11949
+ const d = Math.floor(digits);
11950
+ if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`);
11951
+ if (d > 15) return append;
11952
+ if (d !== cacheDigits) {
11953
+ const k = 10 ** d;
11954
+ cacheDigits = d;
11955
+ cacheAppend = function append(strings) {
11956
+ let i = 1;
11957
+ this._ += strings[0];
11958
+ for (const j = strings.length; i < j; ++i) {
11959
+ this._ += Math.round(arguments[i] * k) / k + strings[i];
11960
+ }
11961
+ };
11962
+ }
11963
+ return cacheAppend;
11664
11964
  }
11665
11965
 
11666
11966
  function index$2(projection, context) {
11667
- var pointRadius = 4.5,
11967
+ let digits = 3,
11968
+ pointRadius = 4.5,
11668
11969
  projectionStream,
11669
11970
  contextStream;
11670
11971
 
@@ -11677,32 +11978,34 @@ function index$2(projection, context) {
11677
11978
  }
11678
11979
 
11679
11980
  path.area = function(object) {
11680
- geoStream(object, projectionStream(areaStream));
11681
- return areaStream.result();
11981
+ geoStream(object, projectionStream(pathArea));
11982
+ return pathArea.result();
11682
11983
  };
11683
11984
 
11684
11985
  path.measure = function(object) {
11685
- geoStream(object, projectionStream(lengthStream));
11686
- return lengthStream.result();
11986
+ geoStream(object, projectionStream(pathMeasure));
11987
+ return pathMeasure.result();
11687
11988
  };
11688
11989
 
11689
11990
  path.bounds = function(object) {
11690
- geoStream(object, projectionStream(boundsStream));
11691
- return boundsStream.result();
11991
+ geoStream(object, projectionStream(boundsStream$1));
11992
+ return boundsStream$1.result();
11692
11993
  };
11693
11994
 
11694
11995
  path.centroid = function(object) {
11695
- geoStream(object, projectionStream(centroidStream));
11696
- return centroidStream.result();
11996
+ geoStream(object, projectionStream(pathCentroid));
11997
+ return pathCentroid.result();
11697
11998
  };
11698
11999
 
11699
12000
  path.projection = function(_) {
11700
- return arguments.length ? (projectionStream = _ == null ? (projection = null, identity$5) : (projection = _).stream, path) : projection;
12001
+ if (!arguments.length) return projection;
12002
+ projectionStream = _ == null ? (projection = null, identity$5) : (projection = _).stream;
12003
+ return path;
11701
12004
  };
11702
12005
 
11703
12006
  path.context = function(_) {
11704
12007
  if (!arguments.length) return context;
11705
- contextStream = _ == null ? (context = null, new PathString) : new PathContext(context = _);
12008
+ contextStream = _ == null ? (context = null, new PathString(digits)) : new PathContext(context = _);
11706
12009
  if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
11707
12010
  return path;
11708
12011
  };
@@ -11713,7 +12016,19 @@ function index$2(projection, context) {
11713
12016
  return path;
11714
12017
  };
11715
12018
 
11716
- return path.projection(projection).context(context);
12019
+ path.digits = function(_) {
12020
+ if (!arguments.length) return digits;
12021
+ if (_ == null) digits = null;
12022
+ else {
12023
+ const d = Math.floor(_);
12024
+ if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
12025
+ digits = d;
12026
+ }
12027
+ if (context === null) contextStream = new PathString(digits);
12028
+ return path;
12029
+ };
12030
+
12031
+ return path.projection(projection).digits(digits).context(context);
11717
12032
  }
11718
12033
 
11719
12034
  function transform$1(methods) {
@@ -11747,8 +12062,8 @@ function fit(projection, fitBounds, object) {
11747
12062
  var clip = projection.clipExtent && projection.clipExtent();
11748
12063
  projection.scale(150).translate([0, 0]);
11749
12064
  if (clip != null) projection.clipExtent(null);
11750
- geoStream(object, projection.stream(boundsStream));
11751
- fitBounds(boundsStream.result());
12065
+ geoStream(object, projection.stream(boundsStream$1));
12066
+ fitBounds(boundsStream$1.result());
11752
12067
  if (clip != null) projection.clipExtent(clip);
11753
12068
  return projection;
11754
12069
  }
@@ -12928,19 +13243,48 @@ Node$1.prototype = hierarchy.prototype = {
12928
13243
  [Symbol.iterator]: node_iterator
12929
13244
  };
12930
13245
 
13246
+ function optional(f) {
13247
+ return f == null ? null : required(f);
13248
+ }
13249
+
13250
+ function required(f) {
13251
+ if (typeof f !== "function") throw new Error;
13252
+ return f;
13253
+ }
13254
+
13255
+ function constantZero() {
13256
+ return 0;
13257
+ }
13258
+
13259
+ function constant$2(x) {
13260
+ return function() {
13261
+ return x;
13262
+ };
13263
+ }
13264
+
13265
+ // https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
13266
+ const a$1 = 1664525;
13267
+ const c$3 = 1013904223;
13268
+ const m = 4294967296; // 2^32
13269
+
13270
+ function lcg$1() {
13271
+ let s = 1;
13272
+ return () => (s = (a$1 * s + c$3) % m) / m;
13273
+ }
13274
+
12931
13275
  function array$1(x) {
12932
13276
  return typeof x === "object" && "length" in x
12933
13277
  ? x // Array, TypedArray, NodeList, array-like
12934
13278
  : Array.from(x); // Map, Set, iterable, string, or anything else
12935
13279
  }
12936
13280
 
12937
- function shuffle(array) {
12938
- var m = array.length,
13281
+ function shuffle(array, random) {
13282
+ let m = array.length,
12939
13283
  t,
12940
13284
  i;
12941
13285
 
12942
13286
  while (m) {
12943
- i = Math.random() * m-- | 0;
13287
+ i = random() * m-- | 0;
12944
13288
  t = array[m];
12945
13289
  array[m] = array[i];
12946
13290
  array[i] = t;
@@ -12950,7 +13294,11 @@ function shuffle(array) {
12950
13294
  }
12951
13295
 
12952
13296
  function enclose(circles) {
12953
- var i = 0, n = (circles = shuffle(Array.from(circles))).length, B = [], p, e;
13297
+ return packEncloseRandom(circles, lcg$1());
13298
+ }
13299
+
13300
+ function packEncloseRandom(circles, random) {
13301
+ var i = 0, n = (circles = shuffle(Array.from(circles), random)).length, B = [], p, e;
12954
13302
 
12955
13303
  while (i < n) {
12956
13304
  p = circles[i];
@@ -13058,7 +13406,7 @@ function encloseBasis3(a, b, c) {
13058
13406
  A = xb * xb + yb * yb - 1,
13059
13407
  B = 2 * (r1 + xa * xb + ya * yb),
13060
13408
  C = xa * xa + ya * ya - r1 * r1,
13061
- r = -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);
13409
+ r = -(Math.abs(A) > 1e-6 ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);
13062
13410
  return {
13063
13411
  x: x1 + xa + xb * r,
13064
13412
  y: y1 + ya + yb * r,
@@ -13110,7 +13458,7 @@ function Node(circle) {
13110
13458
  this.previous = null;
13111
13459
  }
13112
13460
 
13113
- function packEnclose(circles) {
13461
+ function packSiblingsRandom(circles, random) {
13114
13462
  if (!(n = (circles = array$1(circles)).length)) return 0;
13115
13463
 
13116
13464
  var a, b, c, n, aa, ca, i, j, k, sj, sk;
@@ -13170,7 +13518,7 @@ function packEnclose(circles) {
13170
13518
  }
13171
13519
 
13172
13520
  // Compute the enclosing circle of the front chain.
13173
- a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a);
13521
+ a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = packEncloseRandom(a, random);
13174
13522
 
13175
13523
  // Translate the circles to put the enclosing circle around the origin.
13176
13524
  for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;
@@ -13179,29 +13527,10 @@ function packEnclose(circles) {
13179
13527
  }
13180
13528
 
13181
13529
  function siblings(circles) {
13182
- packEnclose(circles);
13530
+ packSiblingsRandom(circles, lcg$1());
13183
13531
  return circles;
13184
13532
  }
13185
13533
 
13186
- function optional(f) {
13187
- return f == null ? null : required(f);
13188
- }
13189
-
13190
- function required(f) {
13191
- if (typeof f !== "function") throw new Error;
13192
- return f;
13193
- }
13194
-
13195
- function constantZero() {
13196
- return 0;
13197
- }
13198
-
13199
- function constant$2(x) {
13200
- return function() {
13201
- return x;
13202
- };
13203
- }
13204
-
13205
13534
  function defaultRadius(d) {
13206
13535
  return Math.sqrt(d.value);
13207
13536
  }
@@ -13213,15 +13542,16 @@ function index$1() {
13213
13542
  padding = constantZero;
13214
13543
 
13215
13544
  function pack(root) {
13545
+ const random = lcg$1();
13216
13546
  root.x = dx / 2, root.y = dy / 2;
13217
13547
  if (radius) {
13218
13548
  root.eachBefore(radiusLeaf(radius))
13219
- .eachAfter(packChildren(padding, 0.5))
13549
+ .eachAfter(packChildrenRandom(padding, 0.5, random))
13220
13550
  .eachBefore(translateChild(1));
13221
13551
  } else {
13222
13552
  root.eachBefore(radiusLeaf(defaultRadius))
13223
- .eachAfter(packChildren(constantZero, 1))
13224
- .eachAfter(packChildren(padding, root.r / Math.min(dx, dy)))
13553
+ .eachAfter(packChildrenRandom(constantZero, 1, random))
13554
+ .eachAfter(packChildrenRandom(padding, root.r / Math.min(dx, dy), random))
13225
13555
  .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));
13226
13556
  }
13227
13557
  return root;
@@ -13250,7 +13580,7 @@ function radiusLeaf(radius) {
13250
13580
  };
13251
13581
  }
13252
13582
 
13253
- function packChildren(padding, k) {
13583
+ function packChildrenRandom(padding, k, random) {
13254
13584
  return function(node) {
13255
13585
  if (children = node.children) {
13256
13586
  var children,
@@ -13260,7 +13590,7 @@ function packChildren(padding, k) {
13260
13590
  e;
13261
13591
 
13262
13592
  if (r) for (i = 0; i < n; ++i) children[i].r += r;
13263
- e = packEnclose(children);
13593
+ e = packSiblingsRandom(children, random);
13264
13594
  if (r) for (i = 0; i < n; ++i) children[i].r -= r;
13265
13595
  node.r = e + r;
13266
13596
  }
@@ -13349,7 +13679,8 @@ function partition() {
13349
13679
  }
13350
13680
 
13351
13681
  var preroot = {depth: -1},
13352
- ambiguous = {};
13682
+ ambiguous = {},
13683
+ imputed = {};
13353
13684
 
13354
13685
  function defaultId(d) {
13355
13686
  return d.id;
@@ -13361,11 +13692,14 @@ function defaultParentId(d) {
13361
13692
 
13362
13693
  function stratify() {
13363
13694
  var id = defaultId,
13364
- parentId = defaultParentId;
13695
+ parentId = defaultParentId,
13696
+ path;
13365
13697
 
13366
13698
  function stratify(data) {
13367
13699
  var nodes = Array.from(data),
13368
- n = nodes.length,
13700
+ currentId = id,
13701
+ currentParentId = parentId,
13702
+ n,
13369
13703
  d,
13370
13704
  i,
13371
13705
  root,
@@ -13375,13 +13709,29 @@ function stratify() {
13375
13709
  nodeKey,
13376
13710
  nodeByKey = new Map;
13377
13711
 
13378
- for (i = 0; i < n; ++i) {
13712
+ if (path != null) {
13713
+ const I = nodes.map((d, i) => normalize$1(path(d, i, data)));
13714
+ const P = I.map(parentof);
13715
+ const S = new Set(I).add("");
13716
+ for (const i of P) {
13717
+ if (!S.has(i)) {
13718
+ S.add(i);
13719
+ I.push(i);
13720
+ P.push(parentof(i));
13721
+ nodes.push(imputed);
13722
+ }
13723
+ }
13724
+ currentId = (_, i) => I[i];
13725
+ currentParentId = (_, i) => P[i];
13726
+ }
13727
+
13728
+ for (i = 0, n = nodes.length; i < n; ++i) {
13379
13729
  d = nodes[i], node = nodes[i] = new Node$1(d);
13380
- if ((nodeId = id(d, i, data)) != null && (nodeId += "")) {
13730
+ if ((nodeId = currentId(d, i, data)) != null && (nodeId += "")) {
13381
13731
  nodeKey = node.id = nodeId;
13382
13732
  nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);
13383
13733
  }
13384
- if ((nodeId = parentId(d, i, data)) != null && (nodeId += "")) {
13734
+ if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += "")) {
13385
13735
  node.parent = nodeId;
13386
13736
  }
13387
13737
  }
@@ -13402,6 +13752,20 @@ function stratify() {
13402
13752
  }
13403
13753
 
13404
13754
  if (!root) throw new Error("no root");
13755
+
13756
+ // When imputing internal nodes, only introduce roots if needed.
13757
+ // Then replace the imputed marker data with null.
13758
+ if (path != null) {
13759
+ while (root.data === imputed && root.children.length === 1) {
13760
+ root = root.children[0], --n;
13761
+ }
13762
+ for (let i = nodes.length - 1; i >= 0; --i) {
13763
+ node = nodes[i];
13764
+ if (node.data !== imputed) break;
13765
+ node.data = null;
13766
+ }
13767
+ }
13768
+
13405
13769
  root.parent = preroot;
13406
13770
  root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);
13407
13771
  root.parent = null;
@@ -13411,16 +13775,52 @@ function stratify() {
13411
13775
  }
13412
13776
 
13413
13777
  stratify.id = function(x) {
13414
- return arguments.length ? (id = required(x), stratify) : id;
13778
+ return arguments.length ? (id = optional(x), stratify) : id;
13415
13779
  };
13416
13780
 
13417
13781
  stratify.parentId = function(x) {
13418
- return arguments.length ? (parentId = required(x), stratify) : parentId;
13782
+ return arguments.length ? (parentId = optional(x), stratify) : parentId;
13783
+ };
13784
+
13785
+ stratify.path = function(x) {
13786
+ return arguments.length ? (path = optional(x), stratify) : path;
13419
13787
  };
13420
13788
 
13421
13789
  return stratify;
13422
13790
  }
13423
13791
 
13792
+ // To normalize a path, we coerce to a string, strip the trailing slash if any
13793
+ // (as long as the trailing slash is not immediately preceded by another slash),
13794
+ // and add leading slash if missing.
13795
+ function normalize$1(path) {
13796
+ path = `${path}`;
13797
+ let i = path.length;
13798
+ if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);
13799
+ return path[0] === "/" ? path : `/${path}`;
13800
+ }
13801
+
13802
+ // Walk backwards to find the first slash that is not the leading slash, e.g.:
13803
+ // "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased
13804
+ // because the id of the root must be a truthy value.)
13805
+ function parentof(path) {
13806
+ let i = path.length;
13807
+ if (i < 2) return "";
13808
+ while (--i > 1) if (slash(path, i)) break;
13809
+ return path.slice(0, i);
13810
+ }
13811
+
13812
+ // Slashes can be escaped; to determine whether a slash is a path delimiter, we
13813
+ // count the number of preceding backslashes escaping the forward slash: an odd
13814
+ // number indicates an escaped forward slash.
13815
+ function slash(path, i) {
13816
+ if (path[i] === "/") {
13817
+ let k = 0;
13818
+ while (i > 0 && path[--i] === "\\") ++k;
13819
+ if ((k & 1) === 0) return true;
13820
+ }
13821
+ return false;
13822
+ }
13823
+
13424
13824
  function defaultSeparation(a, b) {
13425
13825
  return a.parent === b.parent ? 1 : 2;
13426
13826
  }
@@ -14467,7 +14867,7 @@ function band() {
14467
14867
  start += (stop - start - step * (n - paddingInner)) * align;
14468
14868
  bandwidth = step * (1 - paddingInner);
14469
14869
  if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
14470
- var values = sequence(n).map(function(i) { return start + step * i; });
14870
+ var values = range$2(n).map(function(i) { return start + step * i; });
14471
14871
  return ordinalRange(reverse ? values.reverse() : values);
14472
14872
  }
14473
14873
 
@@ -14595,7 +14995,7 @@ function polymap(domain, range, interpolate) {
14595
14995
  }
14596
14996
 
14597
14997
  return function(x) {
14598
- var i = bisectRight(domain, x, 1, j) - 1;
14998
+ var i = bisect(domain, x, 1, j) - 1;
14599
14999
  return r[i](d[i](x));
14600
15000
  };
14601
15001
  }
@@ -14832,28 +15232,26 @@ function pow10(x) {
14832
15232
  function powp(base) {
14833
15233
  return base === 10 ? pow10
14834
15234
  : base === Math.E ? Math.exp
14835
- : function(x) { return Math.pow(base, x); };
15235
+ : x => Math.pow(base, x);
14836
15236
  }
14837
15237
 
14838
15238
  function logp(base) {
14839
15239
  return base === Math.E ? Math.log
14840
15240
  : base === 10 && Math.log10
14841
15241
  || base === 2 && Math.log2
14842
- || (base = Math.log(base), function(x) { return Math.log(x) / base; });
15242
+ || (base = Math.log(base), x => Math.log(x) / base);
14843
15243
  }
14844
15244
 
14845
15245
  function reflect(f) {
14846
- return function(x) {
14847
- return -f(-x);
14848
- };
15246
+ return (x, k) => -f(-x, k);
14849
15247
  }
14850
15248
 
14851
15249
  function loggish(transform) {
14852
- var scale = transform(transformLog, transformExp),
14853
- domain = scale.domain,
14854
- base = 10,
14855
- logs,
14856
- pows;
15250
+ const scale = transform(transformLog, transformExp);
15251
+ const domain = scale.domain;
15252
+ let base = 10;
15253
+ let logs;
15254
+ let pows;
14857
15255
 
14858
15256
  function rescale() {
14859
15257
  logs = logp(base), pows = powp(base);
@@ -14874,34 +15272,33 @@ function loggish(transform) {
14874
15272
  return arguments.length ? (domain(_), rescale()) : domain();
14875
15273
  };
14876
15274
 
14877
- scale.ticks = function(count) {
14878
- var d = domain(),
14879
- u = d[0],
14880
- v = d[d.length - 1],
14881
- r;
15275
+ scale.ticks = count => {
15276
+ const d = domain();
15277
+ let u = d[0];
15278
+ let v = d[d.length - 1];
15279
+ const r = v < u;
14882
15280
 
14883
- if (r = v < u) i = u, u = v, v = i;
15281
+ if (r) ([u, v] = [v, u]);
14884
15282
 
14885
- var i = logs(u),
14886
- j = logs(v),
14887
- p,
14888
- k,
14889
- t,
14890
- n = count == null ? 10 : +count,
14891
- z = [];
15283
+ let i = logs(u);
15284
+ let j = logs(v);
15285
+ let k;
15286
+ let t;
15287
+ const n = count == null ? 10 : +count;
15288
+ let z = [];
14892
15289
 
14893
15290
  if (!(base % 1) && j - i < n) {
14894
15291
  i = Math.floor(i), j = Math.ceil(j);
14895
15292
  if (u > 0) for (; i <= j; ++i) {
14896
- for (k = 1, p = pows(i); k < base; ++k) {
14897
- t = p * k;
15293
+ for (k = 1; k < base; ++k) {
15294
+ t = i < 0 ? k / pows(-i) : k * pows(i);
14898
15295
  if (t < u) continue;
14899
15296
  if (t > v) break;
14900
15297
  z.push(t);
14901
15298
  }
14902
15299
  } else for (; i <= j; ++i) {
14903
- for (k = base - 1, p = pows(i); k >= 1; --k) {
14904
- t = p * k;
15300
+ for (k = base - 1; k >= 1; --k) {
15301
+ t = i > 0 ? k / pows(-i) : k * pows(i);
14905
15302
  if (t < u) continue;
14906
15303
  if (t > v) break;
14907
15304
  z.push(t);
@@ -14911,27 +15308,29 @@ function loggish(transform) {
14911
15308
  } else {
14912
15309
  z = ticks(i, j, Math.min(j - i, n)).map(pows);
14913
15310
  }
14914
-
14915
15311
  return r ? z.reverse() : z;
14916
15312
  };
14917
15313
 
14918
- scale.tickFormat = function(count, specifier) {
14919
- if (specifier == null) specifier = base === 10 ? ".0e" : ",";
14920
- if (typeof specifier !== "function") specifier = exports.format(specifier);
14921
- if (count === Infinity) return specifier;
15314
+ scale.tickFormat = (count, specifier) => {
14922
15315
  if (count == null) count = 10;
14923
- var k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
14924
- return function(d) {
14925
- var i = d / pows(Math.round(logs(d)));
15316
+ if (specifier == null) specifier = base === 10 ? "s" : ",";
15317
+ if (typeof specifier !== "function") {
15318
+ if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true;
15319
+ specifier = exports.format(specifier);
15320
+ }
15321
+ if (count === Infinity) return specifier;
15322
+ const k = Math.max(1, base * count / scale.ticks().length); // TODO fast estimate?
15323
+ return d => {
15324
+ let i = d / pows(Math.round(logs(d)));
14926
15325
  if (i * base < base - 0.5) i *= base;
14927
15326
  return i <= k ? specifier(d) : "";
14928
15327
  };
14929
15328
  };
14930
15329
 
14931
- scale.nice = function() {
15330
+ scale.nice = () => {
14932
15331
  return domain(nice(domain(), {
14933
- floor: function(x) { return pows(Math.floor(logs(x))); },
14934
- ceil: function(x) { return pows(Math.ceil(logs(x))); }
15332
+ floor: x => pows(Math.floor(logs(x))),
15333
+ ceil: x => pows(Math.ceil(logs(x)))
14935
15334
  }));
14936
15335
  };
14937
15336
 
@@ -14939,14 +15338,9 @@ function loggish(transform) {
14939
15338
  }
14940
15339
 
14941
15340
  function log() {
14942
- var scale = loggish(transformer$2()).domain([1, 10]);
14943
-
14944
- scale.copy = function() {
14945
- return copy$1(scale, log()).base(scale.base());
14946
- };
14947
-
15341
+ const scale = loggish(transformer$2()).domain([1, 10]);
15342
+ scale.copy = () => copy$1(scale, log()).base(scale.base());
14948
15343
  initRange.apply(scale, arguments);
14949
-
14950
15344
  return scale;
14951
15345
  }
14952
15346
 
@@ -15102,7 +15496,7 @@ function quantile() {
15102
15496
  }
15103
15497
 
15104
15498
  function scale(x) {
15105
- return x == null || isNaN(x = +x) ? unknown : range[bisectRight(thresholds, x)];
15499
+ return x == null || isNaN(x = +x) ? unknown : range[bisect(thresholds, x)];
15106
15500
  }
15107
15501
 
15108
15502
  scale.invertExtent = function(y) {
@@ -15152,7 +15546,7 @@ function quantize() {
15152
15546
  unknown;
15153
15547
 
15154
15548
  function scale(x) {
15155
- return x != null && x <= x ? range[bisectRight(domain, x, 0, n)] : unknown;
15549
+ return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;
15156
15550
  }
15157
15551
 
15158
15552
  function rescale() {
@@ -15203,7 +15597,7 @@ function threshold() {
15203
15597
  n = 1;
15204
15598
 
15205
15599
  function scale(x) {
15206
- return x != null && x <= x ? range[bisectRight(domain, x, 0, n)] : unknown;
15600
+ return x != null && x <= x ? range[bisect(domain, x, 0, n)] : unknown;
15207
15601
  }
15208
15602
 
15209
15603
  scale.domain = function(_) {
@@ -15233,47 +15627,46 @@ function threshold() {
15233
15627
  return initRange.apply(scale, arguments);
15234
15628
  }
15235
15629
 
15236
- var t0 = new Date,
15237
- t1 = new Date;
15630
+ const t0 = new Date, t1 = new Date;
15238
15631
 
15239
- function newInterval(floori, offseti, count, field) {
15632
+ function timeInterval(floori, offseti, count, field) {
15240
15633
 
15241
15634
  function interval(date) {
15242
15635
  return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
15243
15636
  }
15244
15637
 
15245
- interval.floor = function(date) {
15638
+ interval.floor = (date) => {
15246
15639
  return floori(date = new Date(+date)), date;
15247
15640
  };
15248
15641
 
15249
- interval.ceil = function(date) {
15642
+ interval.ceil = (date) => {
15250
15643
  return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
15251
15644
  };
15252
15645
 
15253
- interval.round = function(date) {
15254
- var d0 = interval(date),
15255
- d1 = interval.ceil(date);
15646
+ interval.round = (date) => {
15647
+ const d0 = interval(date), d1 = interval.ceil(date);
15256
15648
  return date - d0 < d1 - date ? d0 : d1;
15257
15649
  };
15258
15650
 
15259
- interval.offset = function(date, step) {
15651
+ interval.offset = (date, step) => {
15260
15652
  return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
15261
15653
  };
15262
15654
 
15263
- interval.range = function(start, stop, step) {
15264
- var range = [], previous;
15655
+ interval.range = (start, stop, step) => {
15656
+ const range = [];
15265
15657
  start = interval.ceil(start);
15266
15658
  step = step == null ? 1 : Math.floor(step);
15267
15659
  if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
15660
+ let previous;
15268
15661
  do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
15269
15662
  while (previous < start && start < stop);
15270
15663
  return range;
15271
15664
  };
15272
15665
 
15273
- interval.filter = function(test) {
15274
- return newInterval(function(date) {
15666
+ interval.filter = (test) => {
15667
+ return timeInterval((date) => {
15275
15668
  if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
15276
- }, function(date, step) {
15669
+ }, (date, step) => {
15277
15670
  if (date >= date) {
15278
15671
  if (step < 0) while (++step <= 0) {
15279
15672
  while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
@@ -15285,47 +15678,48 @@ function newInterval(floori, offseti, count, field) {
15285
15678
  };
15286
15679
 
15287
15680
  if (count) {
15288
- interval.count = function(start, end) {
15681
+ interval.count = (start, end) => {
15289
15682
  t0.setTime(+start), t1.setTime(+end);
15290
15683
  floori(t0), floori(t1);
15291
15684
  return Math.floor(count(t0, t1));
15292
15685
  };
15293
15686
 
15294
- interval.every = function(step) {
15687
+ interval.every = (step) => {
15295
15688
  step = Math.floor(step);
15296
15689
  return !isFinite(step) || !(step > 0) ? null
15297
15690
  : !(step > 1) ? interval
15298
15691
  : interval.filter(field
15299
- ? function(d) { return field(d) % step === 0; }
15300
- : function(d) { return interval.count(0, d) % step === 0; });
15692
+ ? (d) => field(d) % step === 0
15693
+ : (d) => interval.count(0, d) % step === 0);
15301
15694
  };
15302
15695
  }
15303
15696
 
15304
15697
  return interval;
15305
15698
  }
15306
15699
 
15307
- var millisecond = newInterval(function() {
15700
+ const millisecond = timeInterval(() => {
15308
15701
  // noop
15309
- }, function(date, step) {
15702
+ }, (date, step) => {
15310
15703
  date.setTime(+date + step);
15311
- }, function(start, end) {
15704
+ }, (start, end) => {
15312
15705
  return end - start;
15313
15706
  });
15314
15707
 
15315
15708
  // An optimized implementation for this simple case.
15316
- millisecond.every = function(k) {
15709
+ millisecond.every = (k) => {
15317
15710
  k = Math.floor(k);
15318
15711
  if (!isFinite(k) || !(k > 0)) return null;
15319
15712
  if (!(k > 1)) return millisecond;
15320
- return newInterval(function(date) {
15713
+ return timeInterval((date) => {
15321
15714
  date.setTime(Math.floor(date / k) * k);
15322
- }, function(date, step) {
15715
+ }, (date, step) => {
15323
15716
  date.setTime(+date + step * k);
15324
- }, function(start, end) {
15717
+ }, (start, end) => {
15325
15718
  return (end - start) / k;
15326
15719
  });
15327
15720
  };
15328
- var milliseconds = millisecond.range;
15721
+
15722
+ const milliseconds = millisecond.range;
15329
15723
 
15330
15724
  const durationSecond = 1000;
15331
15725
  const durationMinute = durationSecond * 60;
@@ -15335,203 +15729,226 @@ const durationWeek = durationDay * 7;
15335
15729
  const durationMonth = durationDay * 30;
15336
15730
  const durationYear = durationDay * 365;
15337
15731
 
15338
- var second = newInterval(function(date) {
15732
+ const second = timeInterval((date) => {
15339
15733
  date.setTime(date - date.getMilliseconds());
15340
- }, function(date, step) {
15734
+ }, (date, step) => {
15341
15735
  date.setTime(+date + step * durationSecond);
15342
- }, function(start, end) {
15736
+ }, (start, end) => {
15343
15737
  return (end - start) / durationSecond;
15344
- }, function(date) {
15738
+ }, (date) => {
15345
15739
  return date.getUTCSeconds();
15346
15740
  });
15347
- var seconds = second.range;
15348
15741
 
15349
- var minute = newInterval(function(date) {
15350
- date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
15351
- }, function(date, step) {
15742
+ const seconds = second.range;
15743
+
15744
+ const timeMinute = timeInterval((date) => {
15745
+ date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
15746
+ }, (date, step) => {
15747
+ date.setTime(+date + step * durationMinute);
15748
+ }, (start, end) => {
15749
+ return (end - start) / durationMinute;
15750
+ }, (date) => {
15751
+ return date.getMinutes();
15752
+ });
15753
+
15754
+ const timeMinutes = timeMinute.range;
15755
+
15756
+ const utcMinute = timeInterval((date) => {
15757
+ date.setUTCSeconds(0, 0);
15758
+ }, (date, step) => {
15352
15759
  date.setTime(+date + step * durationMinute);
15353
- }, function(start, end) {
15760
+ }, (start, end) => {
15354
15761
  return (end - start) / durationMinute;
15355
- }, function(date) {
15356
- return date.getMinutes();
15762
+ }, (date) => {
15763
+ return date.getUTCMinutes();
15357
15764
  });
15358
- var minutes = minute.range;
15359
15765
 
15360
- var hour = newInterval(function(date) {
15766
+ const utcMinutes = utcMinute.range;
15767
+
15768
+ const timeHour = timeInterval((date) => {
15361
15769
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
15362
- }, function(date, step) {
15770
+ }, (date, step) => {
15363
15771
  date.setTime(+date + step * durationHour);
15364
- }, function(start, end) {
15772
+ }, (start, end) => {
15365
15773
  return (end - start) / durationHour;
15366
- }, function(date) {
15774
+ }, (date) => {
15367
15775
  return date.getHours();
15368
15776
  });
15369
- var hours = hour.range;
15370
15777
 
15371
- var day = newInterval(
15778
+ const timeHours = timeHour.range;
15779
+
15780
+ const utcHour = timeInterval((date) => {
15781
+ date.setUTCMinutes(0, 0, 0);
15782
+ }, (date, step) => {
15783
+ date.setTime(+date + step * durationHour);
15784
+ }, (start, end) => {
15785
+ return (end - start) / durationHour;
15786
+ }, (date) => {
15787
+ return date.getUTCHours();
15788
+ });
15789
+
15790
+ const utcHours = utcHour.range;
15791
+
15792
+ const timeDay = timeInterval(
15372
15793
  date => date.setHours(0, 0, 0, 0),
15373
15794
  (date, step) => date.setDate(date.getDate() + step),
15374
15795
  (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
15375
15796
  date => date.getDate() - 1
15376
15797
  );
15377
- var days = day.range;
15378
15798
 
15379
- function weekday(i) {
15380
- return newInterval(function(date) {
15799
+ const timeDays = timeDay.range;
15800
+
15801
+ const utcDay = timeInterval((date) => {
15802
+ date.setUTCHours(0, 0, 0, 0);
15803
+ }, (date, step) => {
15804
+ date.setUTCDate(date.getUTCDate() + step);
15805
+ }, (start, end) => {
15806
+ return (end - start) / durationDay;
15807
+ }, (date) => {
15808
+ return date.getUTCDate() - 1;
15809
+ });
15810
+
15811
+ const utcDays = utcDay.range;
15812
+
15813
+ const unixDay = timeInterval((date) => {
15814
+ date.setUTCHours(0, 0, 0, 0);
15815
+ }, (date, step) => {
15816
+ date.setUTCDate(date.getUTCDate() + step);
15817
+ }, (start, end) => {
15818
+ return (end - start) / durationDay;
15819
+ }, (date) => {
15820
+ return Math.floor(date / durationDay);
15821
+ });
15822
+
15823
+ const unixDays = unixDay.range;
15824
+
15825
+ function timeWeekday(i) {
15826
+ return timeInterval((date) => {
15381
15827
  date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
15382
15828
  date.setHours(0, 0, 0, 0);
15383
- }, function(date, step) {
15829
+ }, (date, step) => {
15384
15830
  date.setDate(date.getDate() + step * 7);
15385
- }, function(start, end) {
15831
+ }, (start, end) => {
15386
15832
  return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
15387
15833
  });
15388
15834
  }
15389
15835
 
15390
- var sunday = weekday(0);
15391
- var monday = weekday(1);
15392
- var tuesday = weekday(2);
15393
- var wednesday = weekday(3);
15394
- var thursday = weekday(4);
15395
- var friday = weekday(5);
15396
- var saturday = weekday(6);
15836
+ const timeSunday = timeWeekday(0);
15837
+ const timeMonday = timeWeekday(1);
15838
+ const timeTuesday = timeWeekday(2);
15839
+ const timeWednesday = timeWeekday(3);
15840
+ const timeThursday = timeWeekday(4);
15841
+ const timeFriday = timeWeekday(5);
15842
+ const timeSaturday = timeWeekday(6);
15843
+
15844
+ const timeSundays = timeSunday.range;
15845
+ const timeMondays = timeMonday.range;
15846
+ const timeTuesdays = timeTuesday.range;
15847
+ const timeWednesdays = timeWednesday.range;
15848
+ const timeThursdays = timeThursday.range;
15849
+ const timeFridays = timeFriday.range;
15850
+ const timeSaturdays = timeSaturday.range;
15851
+
15852
+ function utcWeekday(i) {
15853
+ return timeInterval((date) => {
15854
+ date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
15855
+ date.setUTCHours(0, 0, 0, 0);
15856
+ }, (date, step) => {
15857
+ date.setUTCDate(date.getUTCDate() + step * 7);
15858
+ }, (start, end) => {
15859
+ return (end - start) / durationWeek;
15860
+ });
15861
+ }
15862
+
15863
+ const utcSunday = utcWeekday(0);
15864
+ const utcMonday = utcWeekday(1);
15865
+ const utcTuesday = utcWeekday(2);
15866
+ const utcWednesday = utcWeekday(3);
15867
+ const utcThursday = utcWeekday(4);
15868
+ const utcFriday = utcWeekday(5);
15869
+ const utcSaturday = utcWeekday(6);
15397
15870
 
15398
- var sundays = sunday.range;
15399
- var mondays = monday.range;
15400
- var tuesdays = tuesday.range;
15401
- var wednesdays = wednesday.range;
15402
- var thursdays = thursday.range;
15403
- var fridays = friday.range;
15404
- var saturdays = saturday.range;
15871
+ const utcSundays = utcSunday.range;
15872
+ const utcMondays = utcMonday.range;
15873
+ const utcTuesdays = utcTuesday.range;
15874
+ const utcWednesdays = utcWednesday.range;
15875
+ const utcThursdays = utcThursday.range;
15876
+ const utcFridays = utcFriday.range;
15877
+ const utcSaturdays = utcSaturday.range;
15405
15878
 
15406
- var month = newInterval(function(date) {
15879
+ const timeMonth = timeInterval((date) => {
15407
15880
  date.setDate(1);
15408
15881
  date.setHours(0, 0, 0, 0);
15409
- }, function(date, step) {
15882
+ }, (date, step) => {
15410
15883
  date.setMonth(date.getMonth() + step);
15411
- }, function(start, end) {
15884
+ }, (start, end) => {
15412
15885
  return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
15413
- }, function(date) {
15886
+ }, (date) => {
15414
15887
  return date.getMonth();
15415
15888
  });
15416
- var months = month.range;
15417
15889
 
15418
- var year = newInterval(function(date) {
15890
+ const timeMonths = timeMonth.range;
15891
+
15892
+ const utcMonth = timeInterval((date) => {
15893
+ date.setUTCDate(1);
15894
+ date.setUTCHours(0, 0, 0, 0);
15895
+ }, (date, step) => {
15896
+ date.setUTCMonth(date.getUTCMonth() + step);
15897
+ }, (start, end) => {
15898
+ return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
15899
+ }, (date) => {
15900
+ return date.getUTCMonth();
15901
+ });
15902
+
15903
+ const utcMonths = utcMonth.range;
15904
+
15905
+ const timeYear = timeInterval((date) => {
15419
15906
  date.setMonth(0, 1);
15420
15907
  date.setHours(0, 0, 0, 0);
15421
- }, function(date, step) {
15908
+ }, (date, step) => {
15422
15909
  date.setFullYear(date.getFullYear() + step);
15423
- }, function(start, end) {
15910
+ }, (start, end) => {
15424
15911
  return end.getFullYear() - start.getFullYear();
15425
- }, function(date) {
15912
+ }, (date) => {
15426
15913
  return date.getFullYear();
15427
15914
  });
15428
15915
 
15429
15916
  // An optimized implementation for this simple case.
15430
- year.every = function(k) {
15431
- return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
15917
+ timeYear.every = (k) => {
15918
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
15432
15919
  date.setFullYear(Math.floor(date.getFullYear() / k) * k);
15433
15920
  date.setMonth(0, 1);
15434
15921
  date.setHours(0, 0, 0, 0);
15435
- }, function(date, step) {
15922
+ }, (date, step) => {
15436
15923
  date.setFullYear(date.getFullYear() + step * k);
15437
15924
  });
15438
15925
  };
15439
- var years = year.range;
15440
-
15441
- var utcMinute = newInterval(function(date) {
15442
- date.setUTCSeconds(0, 0);
15443
- }, function(date, step) {
15444
- date.setTime(+date + step * durationMinute);
15445
- }, function(start, end) {
15446
- return (end - start) / durationMinute;
15447
- }, function(date) {
15448
- return date.getUTCMinutes();
15449
- });
15450
- var utcMinutes = utcMinute.range;
15451
-
15452
- var utcHour = newInterval(function(date) {
15453
- date.setUTCMinutes(0, 0, 0);
15454
- }, function(date, step) {
15455
- date.setTime(+date + step * durationHour);
15456
- }, function(start, end) {
15457
- return (end - start) / durationHour;
15458
- }, function(date) {
15459
- return date.getUTCHours();
15460
- });
15461
- var utcHours = utcHour.range;
15462
-
15463
- var utcDay = newInterval(function(date) {
15464
- date.setUTCHours(0, 0, 0, 0);
15465
- }, function(date, step) {
15466
- date.setUTCDate(date.getUTCDate() + step);
15467
- }, function(start, end) {
15468
- return (end - start) / durationDay;
15469
- }, function(date) {
15470
- return date.getUTCDate() - 1;
15471
- });
15472
- var utcDays = utcDay.range;
15473
15926
 
15474
- function utcWeekday(i) {
15475
- return newInterval(function(date) {
15476
- date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
15477
- date.setUTCHours(0, 0, 0, 0);
15478
- }, function(date, step) {
15479
- date.setUTCDate(date.getUTCDate() + step * 7);
15480
- }, function(start, end) {
15481
- return (end - start) / durationWeek;
15482
- });
15483
- }
15484
-
15485
- var utcSunday = utcWeekday(0);
15486
- var utcMonday = utcWeekday(1);
15487
- var utcTuesday = utcWeekday(2);
15488
- var utcWednesday = utcWeekday(3);
15489
- var utcThursday = utcWeekday(4);
15490
- var utcFriday = utcWeekday(5);
15491
- var utcSaturday = utcWeekday(6);
15492
-
15493
- var utcSundays = utcSunday.range;
15494
- var utcMondays = utcMonday.range;
15495
- var utcTuesdays = utcTuesday.range;
15496
- var utcWednesdays = utcWednesday.range;
15497
- var utcThursdays = utcThursday.range;
15498
- var utcFridays = utcFriday.range;
15499
- var utcSaturdays = utcSaturday.range;
15500
-
15501
- var utcMonth = newInterval(function(date) {
15502
- date.setUTCDate(1);
15503
- date.setUTCHours(0, 0, 0, 0);
15504
- }, function(date, step) {
15505
- date.setUTCMonth(date.getUTCMonth() + step);
15506
- }, function(start, end) {
15507
- return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
15508
- }, function(date) {
15509
- return date.getUTCMonth();
15510
- });
15511
- var utcMonths = utcMonth.range;
15927
+ const timeYears = timeYear.range;
15512
15928
 
15513
- var utcYear = newInterval(function(date) {
15929
+ const utcYear = timeInterval((date) => {
15514
15930
  date.setUTCMonth(0, 1);
15515
15931
  date.setUTCHours(0, 0, 0, 0);
15516
- }, function(date, step) {
15932
+ }, (date, step) => {
15517
15933
  date.setUTCFullYear(date.getUTCFullYear() + step);
15518
- }, function(start, end) {
15934
+ }, (start, end) => {
15519
15935
  return end.getUTCFullYear() - start.getUTCFullYear();
15520
- }, function(date) {
15936
+ }, (date) => {
15521
15937
  return date.getUTCFullYear();
15522
15938
  });
15523
15939
 
15524
15940
  // An optimized implementation for this simple case.
15525
- utcYear.every = function(k) {
15526
- return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : newInterval(function(date) {
15941
+ utcYear.every = (k) => {
15942
+ return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
15527
15943
  date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
15528
15944
  date.setUTCMonth(0, 1);
15529
15945
  date.setUTCHours(0, 0, 0, 0);
15530
- }, function(date, step) {
15946
+ }, (date, step) => {
15531
15947
  date.setUTCFullYear(date.getUTCFullYear() + step * k);
15532
15948
  });
15533
15949
  };
15534
- var utcYears = utcYear.range;
15950
+
15951
+ const utcYears = utcYear.range;
15535
15952
 
15536
15953
  function ticker(year, month, week, day, hour, minute) {
15537
15954
 
@@ -15576,8 +15993,8 @@ function ticker(year, month, week, day, hour, minute) {
15576
15993
  return [ticks, tickInterval];
15577
15994
  }
15578
15995
 
15579
- const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute);
15580
- const [timeTicks, timeTickInterval] = ticker(year, month, sunday, day, hour, minute);
15996
+ const [utcTicks, utcTickInterval] = ticker(utcYear, utcMonth, utcSunday, unixDay, utcHour, utcMinute);
15997
+ const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute);
15581
15998
 
15582
15999
  function localDate(d) {
15583
16000
  if (0 <= d.y && d.y < 100) {
@@ -15767,7 +16184,7 @@ function formatLocale(locale) {
15767
16184
  return function(string) {
15768
16185
  var d = newDate(1900, undefined, 1),
15769
16186
  i = parseSpecifier(d, specifier, string += "", 0),
15770
- week, day$1;
16187
+ week, day;
15771
16188
  if (i != string.length) return null;
15772
16189
 
15773
16190
  // If a UNIX timestamp is specified, return it.
@@ -15788,25 +16205,25 @@ function formatLocale(locale) {
15788
16205
  if (d.V < 1 || d.V > 53) return null;
15789
16206
  if (!("w" in d)) d.w = 1;
15790
16207
  if ("Z" in d) {
15791
- week = utcDate(newDate(d.y, 0, 1)), day$1 = week.getUTCDay();
15792
- week = day$1 > 4 || day$1 === 0 ? utcMonday.ceil(week) : utcMonday(week);
16208
+ week = utcDate(newDate(d.y, 0, 1)), day = week.getUTCDay();
16209
+ week = day > 4 || day === 0 ? utcMonday.ceil(week) : utcMonday(week);
15793
16210
  week = utcDay.offset(week, (d.V - 1) * 7);
15794
16211
  d.y = week.getUTCFullYear();
15795
16212
  d.m = week.getUTCMonth();
15796
16213
  d.d = week.getUTCDate() + (d.w + 6) % 7;
15797
16214
  } else {
15798
- week = localDate(newDate(d.y, 0, 1)), day$1 = week.getDay();
15799
- week = day$1 > 4 || day$1 === 0 ? monday.ceil(week) : monday(week);
15800
- week = day.offset(week, (d.V - 1) * 7);
16215
+ week = localDate(newDate(d.y, 0, 1)), day = week.getDay();
16216
+ week = day > 4 || day === 0 ? timeMonday.ceil(week) : timeMonday(week);
16217
+ week = timeDay.offset(week, (d.V - 1) * 7);
15801
16218
  d.y = week.getFullYear();
15802
16219
  d.m = week.getMonth();
15803
16220
  d.d = week.getDate() + (d.w + 6) % 7;
15804
16221
  }
15805
16222
  } else if ("W" in d || "U" in d) {
15806
16223
  if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;
15807
- day$1 = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
16224
+ day = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay();
15808
16225
  d.m = 0;
15809
- d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day$1 + 5) % 7 : d.w + d.U * 7 - (day$1 + 6) % 7;
16226
+ d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day + 5) % 7 : d.w + d.U * 7 - (day + 6) % 7;
15810
16227
  }
15811
16228
 
15812
16229
  // If a time zone is specified, all fields are interpreted as UTC and then
@@ -16090,7 +16507,7 @@ function formatHour12(d, p) {
16090
16507
  }
16091
16508
 
16092
16509
  function formatDayOfYear(d, p) {
16093
- return pad(1 + day.count(year(d), d), p, 3);
16510
+ return pad(1 + timeDay.count(timeYear(d), d), p, 3);
16094
16511
  }
16095
16512
 
16096
16513
  function formatMilliseconds(d, p) {
@@ -16119,17 +16536,17 @@ function formatWeekdayNumberMonday(d) {
16119
16536
  }
16120
16537
 
16121
16538
  function formatWeekNumberSunday(d, p) {
16122
- return pad(sunday.count(year(d) - 1, d), p, 2);
16539
+ return pad(timeSunday.count(timeYear(d) - 1, d), p, 2);
16123
16540
  }
16124
16541
 
16125
16542
  function dISO(d) {
16126
16543
  var day = d.getDay();
16127
- return (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
16544
+ return (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);
16128
16545
  }
16129
16546
 
16130
16547
  function formatWeekNumberISO(d, p) {
16131
16548
  d = dISO(d);
16132
- return pad(thursday.count(year(d), d) + (year(d).getDay() === 4), p, 2);
16549
+ return pad(timeThursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2);
16133
16550
  }
16134
16551
 
16135
16552
  function formatWeekdayNumberSunday(d) {
@@ -16137,7 +16554,7 @@ function formatWeekdayNumberSunday(d) {
16137
16554
  }
16138
16555
 
16139
16556
  function formatWeekNumberMonday(d, p) {
16140
- return pad(monday.count(year(d) - 1, d), p, 2);
16557
+ return pad(timeMonday.count(timeYear(d) - 1, d), p, 2);
16141
16558
  }
16142
16559
 
16143
16560
  function formatYear(d, p) {
@@ -16155,7 +16572,7 @@ function formatFullYear(d, p) {
16155
16572
 
16156
16573
  function formatFullYearISO(d, p) {
16157
16574
  var day = d.getDay();
16158
- d = (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
16575
+ d = (day >= 4 || day === 0) ? timeThursday(d) : timeThursday.ceil(d);
16159
16576
  return pad(d.getFullYear() % 10000, p, 4);
16160
16577
  }
16161
16578
 
@@ -16300,6 +16717,8 @@ var formatIso = Date.prototype.toISOString
16300
16717
  ? formatIsoNative
16301
16718
  : exports.utcFormat(isoSpecifier);
16302
16719
 
16720
+ var formatIso$1 = formatIso;
16721
+
16303
16722
  function parseIsoNative(string) {
16304
16723
  var date = new Date(string);
16305
16724
  return isNaN(date) ? null : date;
@@ -16309,6 +16728,8 @@ var parseIso = +new Date("2000-01-01T00:00:00.000Z")
16309
16728
  ? parseIsoNative
16310
16729
  : exports.utcParse(isoSpecifier);
16311
16730
 
16731
+ var parseIso$1 = parseIso;
16732
+
16312
16733
  function date(t) {
16313
16734
  return new Date(t);
16314
16735
  }
@@ -16372,7 +16793,7 @@ function calendar(ticks, tickInterval, year, month, week, day, hour, minute, sec
16372
16793
  }
16373
16794
 
16374
16795
  function time() {
16375
- return initRange.apply(calendar(timeTicks, timeTickInterval, year, month, sunday, day, hour, minute, second, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
16796
+ return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, timeSunday, timeDay, timeHour, timeMinute, second, exports.timeFormat).domain([new Date(2000, 0, 1), new Date(2000, 0, 2)]), arguments);
16376
16797
  }
16377
16798
 
16378
16799
  function utcTime() {
@@ -16484,7 +16905,7 @@ function sequentialQuantile() {
16484
16905
  interpolator = identity$3;
16485
16906
 
16486
16907
  function scale(x) {
16487
- if (x != null && !isNaN(x = +x)) return interpolator((bisectRight(domain, x, 1) - 1) / (domain.length - 1));
16908
+ if (x != null && !isNaN(x = +x)) return interpolator((bisect(domain, x, 1) - 1) / (domain.length - 1));
16488
16909
  }
16489
16910
 
16490
16911
  scale.domain = function(_) {
@@ -17049,18 +17470,18 @@ function constant$1(x) {
17049
17470
  };
17050
17471
  }
17051
17472
 
17052
- var abs = Math.abs;
17053
- var atan2 = Math.atan2;
17054
- var cos = Math.cos;
17055
- var max = Math.max;
17056
- var min = Math.min;
17057
- var sin = Math.sin;
17058
- var sqrt = Math.sqrt;
17473
+ const abs = Math.abs;
17474
+ const atan2 = Math.atan2;
17475
+ const cos = Math.cos;
17476
+ const max = Math.max;
17477
+ const min = Math.min;
17478
+ const sin = Math.sin;
17479
+ const sqrt = Math.sqrt;
17059
17480
 
17060
- var epsilon = 1e-12;
17061
- var pi = Math.PI;
17062
- var halfPi = pi / 2;
17063
- var tau = 2 * pi;
17481
+ const epsilon = 1e-12;
17482
+ const pi = Math.PI;
17483
+ const halfPi = pi / 2;
17484
+ const tau = 2 * pi;
17064
17485
 
17065
17486
  function acos(x) {
17066
17487
  return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);
@@ -17070,6 +17491,24 @@ function asin(x) {
17070
17491
  return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);
17071
17492
  }
17072
17493
 
17494
+ function withPath(shape) {
17495
+ let digits = 3;
17496
+
17497
+ shape.digits = function(_) {
17498
+ if (!arguments.length) return digits;
17499
+ if (_ == null) {
17500
+ digits = null;
17501
+ } else {
17502
+ const d = Math.floor(_);
17503
+ if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
17504
+ digits = d;
17505
+ }
17506
+ return shape;
17507
+ };
17508
+
17509
+ return () => new Path$1(digits);
17510
+ }
17511
+
17073
17512
  function arcInnerRadius(d) {
17074
17513
  return d.innerRadius;
17075
17514
  }
@@ -17150,7 +17589,8 @@ function arc() {
17150
17589
  startAngle = arcStartAngle,
17151
17590
  endAngle = arcEndAngle,
17152
17591
  padAngle = arcPadAngle,
17153
- context = null;
17592
+ context = null,
17593
+ path = withPath(arc);
17154
17594
 
17155
17595
  function arc() {
17156
17596
  var buffer,
@@ -17219,16 +17659,22 @@ function arc() {
17219
17659
  y00 = r0 * sin(a00),
17220
17660
  oc;
17221
17661
 
17222
- // Restrict the corner radius according to the sector angle.
17223
- if (da < pi && (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10))) {
17224
- var ax = x01 - oc[0],
17225
- ay = y01 - oc[1],
17226
- bx = x11 - oc[0],
17227
- by = y11 - oc[1],
17228
- kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
17229
- lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
17230
- rc0 = min(rc, (r0 - lc) / (kc - 1));
17231
- rc1 = min(rc, (r1 - lc) / (kc + 1));
17662
+ // Restrict the corner radius according to the sector angle. If this
17663
+ // intersection fails, it’s probably because the arc is too small, so
17664
+ // disable the corner radius entirely.
17665
+ if (da < pi) {
17666
+ if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
17667
+ var ax = x01 - oc[0],
17668
+ ay = y01 - oc[1],
17669
+ bx = x11 - oc[0],
17670
+ by = y11 - oc[1],
17671
+ kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
17672
+ lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
17673
+ rc0 = min(rc, (r0 - lc) / (kc - 1));
17674
+ rc1 = min(rc, (r1 - lc) / (kc + 1));
17675
+ } else {
17676
+ rc0 = rc1 = 0;
17677
+ }
17232
17678
  }
17233
17679
  }
17234
17680
 
@@ -17380,7 +17826,8 @@ function line(x$1, y$1) {
17380
17826
  var defined = constant$1(true),
17381
17827
  context = null,
17382
17828
  curve = curveLinear,
17383
- output = null;
17829
+ output = null,
17830
+ path = withPath(line);
17384
17831
 
17385
17832
  x$1 = typeof x$1 === "function" ? x$1 : (x$1 === undefined) ? x : constant$1(x$1);
17386
17833
  y$1 = typeof y$1 === "function" ? y$1 : (y$1 === undefined) ? y : constant$1(y$1);
@@ -17433,7 +17880,8 @@ function area(x0, y0, y1) {
17433
17880
  defined = constant$1(true),
17434
17881
  context = null,
17435
17882
  curve = curveLinear,
17436
- output = null;
17883
+ output = null,
17884
+ path = withPath(area);
17437
17885
 
17438
17886
  x0 = typeof x0 === "function" ? x0 : (x0 === undefined) ? x : constant$1(+x0);
17439
17887
  y0 = typeof y0 === "function" ? y0 : (y0 === undefined) ? constant$1(0) : constant$1(+y0);
@@ -17616,7 +18064,7 @@ function pie() {
17616
18064
  return pie;
17617
18065
  }
17618
18066
 
17619
- var curveRadialLinear = curveRadial$1(curveLinear);
18067
+ var curveRadialLinear = curveRadial(curveLinear);
17620
18068
 
17621
18069
  function Radial(curve) {
17622
18070
  this._curve = curve;
@@ -17640,7 +18088,7 @@ Radial.prototype = {
17640
18088
  }
17641
18089
  };
17642
18090
 
17643
- function curveRadial$1(curve) {
18091
+ function curveRadial(curve) {
17644
18092
 
17645
18093
  function radial(context) {
17646
18094
  return new Radial(curve(context));
@@ -17658,7 +18106,7 @@ function lineRadial(l) {
17658
18106
  l.radius = l.y, delete l.y;
17659
18107
 
17660
18108
  l.curve = function(_) {
17661
- return arguments.length ? c(curveRadial$1(_)) : c()._curve;
18109
+ return arguments.length ? c(curveRadial(_)) : c()._curve;
17662
18110
  };
17663
18111
 
17664
18112
  return l;
@@ -17688,7 +18136,7 @@ function areaRadial() {
17688
18136
  a.lineOuterRadius = function() { return lineRadial(y1()); }, delete a.lineY1;
17689
18137
 
17690
18138
  a.curve = function(_) {
17691
- return arguments.length ? c(curveRadial$1(_)) : c()._curve;
18139
+ return arguments.length ? c(curveRadial(_)) : c()._curve;
17692
18140
  };
17693
18141
 
17694
18142
  return a;
@@ -17698,6 +18146,80 @@ function pointRadial(x, y) {
17698
18146
  return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
17699
18147
  }
17700
18148
 
18149
+ class Bump {
18150
+ constructor(context, x) {
18151
+ this._context = context;
18152
+ this._x = x;
18153
+ }
18154
+ areaStart() {
18155
+ this._line = 0;
18156
+ }
18157
+ areaEnd() {
18158
+ this._line = NaN;
18159
+ }
18160
+ lineStart() {
18161
+ this._point = 0;
18162
+ }
18163
+ lineEnd() {
18164
+ if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
18165
+ this._line = 1 - this._line;
18166
+ }
18167
+ point(x, y) {
18168
+ x = +x, y = +y;
18169
+ switch (this._point) {
18170
+ case 0: {
18171
+ this._point = 1;
18172
+ if (this._line) this._context.lineTo(x, y);
18173
+ else this._context.moveTo(x, y);
18174
+ break;
18175
+ }
18176
+ case 1: this._point = 2; // falls through
18177
+ default: {
18178
+ if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);
18179
+ else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);
18180
+ break;
18181
+ }
18182
+ }
18183
+ this._x0 = x, this._y0 = y;
18184
+ }
18185
+ }
18186
+
18187
+ class BumpRadial {
18188
+ constructor(context) {
18189
+ this._context = context;
18190
+ }
18191
+ lineStart() {
18192
+ this._point = 0;
18193
+ }
18194
+ lineEnd() {}
18195
+ point(x, y) {
18196
+ x = +x, y = +y;
18197
+ if (this._point === 0) {
18198
+ this._point = 1;
18199
+ } else {
18200
+ const p0 = pointRadial(this._x0, this._y0);
18201
+ const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y) / 2);
18202
+ const p2 = pointRadial(x, this._y0);
18203
+ const p3 = pointRadial(x, y);
18204
+ this._context.moveTo(...p0);
18205
+ this._context.bezierCurveTo(...p1, ...p2, ...p3);
18206
+ }
18207
+ this._x0 = x, this._y0 = y;
18208
+ }
18209
+ }
18210
+
18211
+ function bumpX(context) {
18212
+ return new Bump(context, true);
18213
+ }
18214
+
18215
+ function bumpY(context) {
18216
+ return new Bump(context, false);
18217
+ }
18218
+
18219
+ function bumpRadial(context) {
18220
+ return new BumpRadial(context);
18221
+ }
18222
+
17701
18223
  function linkSource(d) {
17702
18224
  return d.source;
17703
18225
  }
@@ -17707,17 +18229,25 @@ function linkTarget(d) {
17707
18229
  }
17708
18230
 
17709
18231
  function link(curve) {
17710
- var source = linkSource,
18232
+ let source = linkSource,
17711
18233
  target = linkTarget,
17712
18234
  x$1 = x,
17713
18235
  y$1 = y,
17714
- context = null;
18236
+ context = null,
18237
+ output = null,
18238
+ path = withPath(link);
17715
18239
 
17716
18240
  function link() {
17717
- var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
17718
- if (!context) context = buffer = path();
17719
- curve(context, +x$1.apply(this, (argv[0] = s, argv)), +y$1.apply(this, argv), +x$1.apply(this, (argv[0] = t, argv)), +y$1.apply(this, argv));
17720
- if (buffer) return context = null, buffer + "" || null;
18241
+ let buffer;
18242
+ const argv = slice.call(arguments);
18243
+ const s = source.apply(this, argv);
18244
+ const t = target.apply(this, argv);
18245
+ if (context == null) output = curve(buffer = path());
18246
+ output.lineStart();
18247
+ argv[0] = s, output.point(+x$1.apply(this, argv), +y$1.apply(this, argv));
18248
+ argv[0] = t, output.point(+x$1.apply(this, argv), +y$1.apply(this, argv));
18249
+ output.lineEnd();
18250
+ if (buffer) return output = null, buffer + "" || null;
17721
18251
  }
17722
18252
 
17723
18253
  link.source = function(_) {
@@ -17737,57 +18267,54 @@ function link(curve) {
17737
18267
  };
17738
18268
 
17739
18269
  link.context = function(_) {
17740
- return arguments.length ? ((context = _ == null ? null : _), link) : context;
18270
+ return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), link) : context;
17741
18271
  };
17742
18272
 
17743
18273
  return link;
17744
18274
  }
17745
18275
 
17746
- function curveHorizontal(context, x0, y0, x1, y1) {
17747
- context.moveTo(x0, y0);
17748
- context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
17749
- }
17750
-
17751
- function curveVertical(context, x0, y0, x1, y1) {
17752
- context.moveTo(x0, y0);
17753
- context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);
17754
- }
17755
-
17756
- function curveRadial(context, x0, y0, x1, y1) {
17757
- var p0 = pointRadial(x0, y0),
17758
- p1 = pointRadial(x0, y0 = (y0 + y1) / 2),
17759
- p2 = pointRadial(x1, y0),
17760
- p3 = pointRadial(x1, y1);
17761
- context.moveTo(p0[0], p0[1]);
17762
- context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
17763
- }
17764
-
17765
18276
  function linkHorizontal() {
17766
- return link(curveHorizontal);
18277
+ return link(bumpX);
17767
18278
  }
17768
18279
 
17769
18280
  function linkVertical() {
17770
- return link(curveVertical);
18281
+ return link(bumpY);
17771
18282
  }
17772
18283
 
17773
18284
  function linkRadial() {
17774
- var l = link(curveRadial);
18285
+ const l = link(bumpRadial);
17775
18286
  l.angle = l.x, delete l.x;
17776
18287
  l.radius = l.y, delete l.y;
17777
18288
  return l;
17778
18289
  }
17779
18290
 
18291
+ const sqrt3$2 = sqrt(3);
18292
+
18293
+ var asterisk = {
18294
+ draw(context, size) {
18295
+ const r = sqrt(size + min(size / 28, 0.75)) * 0.59436;
18296
+ const t = r / 2;
18297
+ const u = t * sqrt3$2;
18298
+ context.moveTo(0, r);
18299
+ context.lineTo(0, -r);
18300
+ context.moveTo(-u, -t);
18301
+ context.lineTo(u, t);
18302
+ context.moveTo(-u, t);
18303
+ context.lineTo(u, -t);
18304
+ }
18305
+ };
18306
+
17780
18307
  var circle = {
17781
- draw: function(context, size) {
17782
- var r = Math.sqrt(size / pi);
18308
+ draw(context, size) {
18309
+ const r = sqrt(size / pi);
17783
18310
  context.moveTo(r, 0);
17784
18311
  context.arc(0, 0, r, 0, tau);
17785
18312
  }
17786
18313
  };
17787
18314
 
17788
18315
  var cross = {
17789
- draw: function(context, size) {
17790
- var r = Math.sqrt(size / 5) / 2;
18316
+ draw(context, size) {
18317
+ const r = sqrt(size / 5) / 2;
17791
18318
  context.moveTo(-3 * r, -r);
17792
18319
  context.lineTo(-r, -r);
17793
18320
  context.lineTo(-r, -3 * r);
@@ -17804,13 +18331,13 @@ var cross = {
17804
18331
  }
17805
18332
  };
17806
18333
 
17807
- var tan30 = Math.sqrt(1 / 3),
17808
- tan30_2 = tan30 * 2;
18334
+ const tan30 = sqrt(1 / 3);
18335
+ const tan30_2 = tan30 * 2;
17809
18336
 
17810
18337
  var diamond = {
17811
- draw: function(context, size) {
17812
- var y = Math.sqrt(size / tan30_2),
17813
- x = y * tan30;
18338
+ draw(context, size) {
18339
+ const y = sqrt(size / tan30_2);
18340
+ const x = y * tan30;
17814
18341
  context.moveTo(0, -y);
17815
18342
  context.lineTo(x, 0);
17816
18343
  context.lineTo(0, y);
@@ -17819,22 +18346,62 @@ var diamond = {
17819
18346
  }
17820
18347
  };
17821
18348
 
17822
- var ka = 0.89081309152928522810,
17823
- kr = Math.sin(pi / 10) / Math.sin(7 * pi / 10),
17824
- kx = Math.sin(tau / 10) * kr,
17825
- ky = -Math.cos(tau / 10) * kr;
18349
+ var diamond2 = {
18350
+ draw(context, size) {
18351
+ const r = sqrt(size) * 0.62625;
18352
+ context.moveTo(0, -r);
18353
+ context.lineTo(r, 0);
18354
+ context.lineTo(0, r);
18355
+ context.lineTo(-r, 0);
18356
+ context.closePath();
18357
+ }
18358
+ };
18359
+
18360
+ var plus = {
18361
+ draw(context, size) {
18362
+ const r = sqrt(size - min(size / 7, 2)) * 0.87559;
18363
+ context.moveTo(-r, 0);
18364
+ context.lineTo(r, 0);
18365
+ context.moveTo(0, r);
18366
+ context.lineTo(0, -r);
18367
+ }
18368
+ };
18369
+
18370
+ var square = {
18371
+ draw(context, size) {
18372
+ const w = sqrt(size);
18373
+ const x = -w / 2;
18374
+ context.rect(x, x, w, w);
18375
+ }
18376
+ };
18377
+
18378
+ var square2 = {
18379
+ draw(context, size) {
18380
+ const r = sqrt(size) * 0.4431;
18381
+ context.moveTo(r, r);
18382
+ context.lineTo(r, -r);
18383
+ context.lineTo(-r, -r);
18384
+ context.lineTo(-r, r);
18385
+ context.closePath();
18386
+ }
18387
+ };
18388
+
18389
+ const ka = 0.89081309152928522810;
18390
+ const kr = sin(pi / 10) / sin(7 * pi / 10);
18391
+ const kx = sin(tau / 10) * kr;
18392
+ const ky = -cos(tau / 10) * kr;
17826
18393
 
17827
18394
  var star = {
17828
- draw: function(context, size) {
17829
- var r = Math.sqrt(size * ka),
17830
- x = kx * r,
17831
- y = ky * r;
18395
+ draw(context, size) {
18396
+ const r = sqrt(size * ka);
18397
+ const x = kx * r;
18398
+ const y = ky * r;
17832
18399
  context.moveTo(0, -r);
17833
18400
  context.lineTo(x, y);
17834
- for (var i = 1; i < 5; ++i) {
17835
- var a = tau * i / 5,
17836
- c = Math.cos(a),
17837
- s = Math.sin(a);
18401
+ for (let i = 1; i < 5; ++i) {
18402
+ const a = tau * i / 5;
18403
+ const c = cos(a);
18404
+ const s = sin(a);
17838
18405
  context.lineTo(s * r, -c * r);
17839
18406
  context.lineTo(c * x - s * y, s * x + c * y);
17840
18407
  }
@@ -17842,40 +18409,43 @@ var star = {
17842
18409
  }
17843
18410
  };
17844
18411
 
17845
- var square = {
17846
- draw: function(context, size) {
17847
- var w = Math.sqrt(size),
17848
- x = -w / 2;
17849
- context.rect(x, x, w, w);
18412
+ const sqrt3$1 = sqrt(3);
18413
+
18414
+ var triangle = {
18415
+ draw(context, size) {
18416
+ const y = -sqrt(size / (sqrt3$1 * 3));
18417
+ context.moveTo(0, y * 2);
18418
+ context.lineTo(-sqrt3$1 * y, -y);
18419
+ context.lineTo(sqrt3$1 * y, -y);
18420
+ context.closePath();
17850
18421
  }
17851
18422
  };
17852
18423
 
17853
- var sqrt3 = Math.sqrt(3);
18424
+ const sqrt3 = sqrt(3);
17854
18425
 
17855
- var triangle = {
17856
- draw: function(context, size) {
17857
- var y = -Math.sqrt(size / (sqrt3 * 3));
17858
- context.moveTo(0, y * 2);
17859
- context.lineTo(-sqrt3 * y, -y);
17860
- context.lineTo(sqrt3 * y, -y);
18426
+ var triangle2 = {
18427
+ draw(context, size) {
18428
+ const s = sqrt(size) * 0.6824;
18429
+ const t = s / 2;
18430
+ const u = (s * sqrt3) / 2; // cos(Math.PI / 6)
18431
+ context.moveTo(0, -s);
18432
+ context.lineTo(u, t);
18433
+ context.lineTo(-u, t);
17861
18434
  context.closePath();
17862
18435
  }
17863
18436
  };
17864
18437
 
17865
- var c = -0.5,
17866
- s = Math.sqrt(3) / 2,
17867
- k = 1 / Math.sqrt(12),
17868
- a = (k / 2 + 1) * 3;
18438
+ const c = -0.5;
18439
+ const s = sqrt(3) / 2;
18440
+ const k = 1 / sqrt(12);
18441
+ const a = (k / 2 + 1) * 3;
17869
18442
 
17870
18443
  var wye = {
17871
- draw: function(context, size) {
17872
- var r = Math.sqrt(size / a),
17873
- x0 = r / 2,
17874
- y0 = r * k,
17875
- x1 = x0,
17876
- y1 = r * k + r,
17877
- x2 = -x1,
17878
- y2 = y1;
18444
+ draw(context, size) {
18445
+ const r = sqrt(size / a);
18446
+ const x0 = r / 2, y0 = r * k;
18447
+ const x1 = x0, y1 = r * k + r;
18448
+ const x2 = -x1, y2 = y1;
17879
18449
  context.moveTo(x0, y0);
17880
18450
  context.lineTo(x1, y1);
17881
18451
  context.lineTo(x2, y2);
@@ -17889,7 +18459,18 @@ var wye = {
17889
18459
  }
17890
18460
  };
17891
18461
 
17892
- var symbols = [
18462
+ var times = {
18463
+ draw(context, size) {
18464
+ const r = sqrt(size - min(size / 6, 1.7)) * 0.6189;
18465
+ context.moveTo(-r, -r);
18466
+ context.lineTo(r, r);
18467
+ context.moveTo(-r, r);
18468
+ context.lineTo(r, -r);
18469
+ }
18470
+ };
18471
+
18472
+ // These symbols are designed to be filled.
18473
+ const symbolsFill = [
17893
18474
  circle,
17894
18475
  cross,
17895
18476
  diamond,
@@ -17899,13 +18480,26 @@ var symbols = [
17899
18480
  wye
17900
18481
  ];
17901
18482
 
17902
- function symbol(type, size) {
17903
- var context = null;
18483
+ // These symbols are designed to be stroked (with a width of 1.5px and round caps).
18484
+ const symbolsStroke = [
18485
+ circle,
18486
+ plus,
18487
+ times,
18488
+ triangle2,
18489
+ asterisk,
18490
+ square2,
18491
+ diamond2
18492
+ ];
18493
+
18494
+ function Symbol$1(type, size) {
18495
+ let context = null,
18496
+ path = withPath(symbol);
18497
+
17904
18498
  type = typeof type === "function" ? type : constant$1(type || circle);
17905
18499
  size = typeof size === "function" ? size : constant$1(size === undefined ? 64 : +size);
17906
18500
 
17907
18501
  function symbol() {
17908
- var buffer;
18502
+ let buffer;
17909
18503
  if (!context) context = buffer = path();
17910
18504
  type.apply(this, arguments).draw(context, +size.apply(this, arguments));
17911
18505
  if (buffer) return context = null, buffer + "" || null;
@@ -18068,52 +18662,6 @@ function basisOpen(context) {
18068
18662
  return new BasisOpen(context);
18069
18663
  }
18070
18664
 
18071
- class Bump {
18072
- constructor(context, x) {
18073
- this._context = context;
18074
- this._x = x;
18075
- }
18076
- areaStart() {
18077
- this._line = 0;
18078
- }
18079
- areaEnd() {
18080
- this._line = NaN;
18081
- }
18082
- lineStart() {
18083
- this._point = 0;
18084
- }
18085
- lineEnd() {
18086
- if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();
18087
- this._line = 1 - this._line;
18088
- }
18089
- point(x, y) {
18090
- x = +x, y = +y;
18091
- switch (this._point) {
18092
- case 0: {
18093
- this._point = 1;
18094
- if (this._line) this._context.lineTo(x, y);
18095
- else this._context.moveTo(x, y);
18096
- break;
18097
- }
18098
- case 1: this._point = 2; // falls through
18099
- default: {
18100
- if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x) / 2, this._y0, this._x0, y, x, y);
18101
- else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y) / 2, x, this._y0, x, y);
18102
- break;
18103
- }
18104
- }
18105
- this._x0 = x, this._y0 = y;
18106
- }
18107
- }
18108
-
18109
- function bumpX(context) {
18110
- return new Bump(context, true);
18111
- }
18112
-
18113
- function bumpY(context) {
18114
- return new Bump(context, false);
18115
- }
18116
-
18117
18665
  function Bundle(context, beta) {
18118
18666
  this._basis = new Basis(context);
18119
18667
  this._beta = beta;
@@ -19507,6 +20055,7 @@ exports.FormatSpecifier = FormatSpecifier;
19507
20055
  exports.InternMap = InternMap;
19508
20056
  exports.InternSet = InternSet;
19509
20057
  exports.Node = Node$1;
20058
+ exports.Path = Path$1;
19510
20059
  exports.Voronoi = Voronoi;
19511
20060
  exports.ZoomTransform = Transform;
19512
20061
  exports.active = active;
@@ -19520,12 +20069,15 @@ exports.axisLeft = axisLeft;
19520
20069
  exports.axisRight = axisRight;
19521
20070
  exports.axisTop = axisTop;
19522
20071
  exports.bin = bin;
19523
- exports.bisect = bisectRight;
20072
+ exports.bisect = bisect;
19524
20073
  exports.bisectCenter = bisectCenter;
19525
20074
  exports.bisectLeft = bisectLeft;
19526
20075
  exports.bisectRight = bisectRight;
19527
20076
  exports.bisector = bisector;
19528
20077
  exports.blob = blob;
20078
+ exports.blur = blur;
20079
+ exports.blur2 = blur2;
20080
+ exports.blurImage = blurImage;
19529
20081
  exports.brush = brush;
19530
20082
  exports.brushSelection = brushSelection;
19531
20083
  exports.brushX = brushX;
@@ -19537,7 +20089,7 @@ exports.chordTranspose = chordTranspose;
19537
20089
  exports.cluster = cluster;
19538
20090
  exports.color = color;
19539
20091
  exports.contourDensity = density;
19540
- exports.contours = contours;
20092
+ exports.contours = Contours;
19541
20093
  exports.count = count$1;
19542
20094
  exports.create = create$1;
19543
20095
  exports.creator = creator;
@@ -19646,7 +20198,7 @@ exports.geoAzimuthalEquidistant = azimuthalEquidistant;
19646
20198
  exports.geoAzimuthalEquidistantRaw = azimuthalEquidistantRaw;
19647
20199
  exports.geoBounds = bounds;
19648
20200
  exports.geoCentroid = centroid$1;
19649
- exports.geoCircle = circle$2;
20201
+ exports.geoCircle = circle$1;
19650
20202
  exports.geoClipAntimeridian = clipAntimeridian;
19651
20203
  exports.geoClipCircle = clipCircle;
19652
20204
  exports.geoClipExtent = extent;
@@ -19766,8 +20318,8 @@ exports.interpolateZoom = interpolateZoom;
19766
20318
  exports.interrupt = interrupt;
19767
20319
  exports.intersection = intersection;
19768
20320
  exports.interval = interval;
19769
- exports.isoFormat = formatIso;
19770
- exports.isoParse = parseIso;
20321
+ exports.isoFormat = formatIso$1;
20322
+ exports.isoParse = parseIso$1;
19771
20323
  exports.json = json;
19772
20324
  exports.lab = lab$1;
19773
20325
  exports.lch = lch;
@@ -19775,6 +20327,7 @@ exports.least = least;
19775
20327
  exports.leastIndex = leastIndex;
19776
20328
  exports.line = line;
19777
20329
  exports.lineRadial = lineRadial$1;
20330
+ exports.link = link;
19778
20331
  exports.linkHorizontal = linkHorizontal;
19779
20332
  exports.linkRadial = linkRadial;
19780
20333
  exports.linkVertical = linkVertical;
@@ -19785,6 +20338,7 @@ exports.max = max$3;
19785
20338
  exports.maxIndex = maxIndex;
19786
20339
  exports.mean = mean;
19787
20340
  exports.median = median;
20341
+ exports.medianIndex = medianIndex;
19788
20342
  exports.merge = merge;
19789
20343
  exports.min = min$2;
19790
20344
  exports.minIndex = minIndex;
@@ -19799,6 +20353,7 @@ exports.packSiblings = siblings;
19799
20353
  exports.pairs = pairs;
19800
20354
  exports.partition = partition;
19801
20355
  exports.path = path;
20356
+ exports.pathRound = pathRound;
19802
20357
  exports.permute = permute;
19803
20358
  exports.pie = pie;
19804
20359
  exports.piecewise = piecewise;
@@ -19815,6 +20370,7 @@ exports.precisionPrefix = precisionPrefix;
19815
20370
  exports.precisionRound = precisionRound;
19816
20371
  exports.quadtree = quadtree;
19817
20372
  exports.quantile = quantile$1;
20373
+ exports.quantileIndex = quantileIndex;
19818
20374
  exports.quantileSorted = quantileSorted;
19819
20375
  exports.quantize = quantize$1;
19820
20376
  exports.quickselect = quickselect;
@@ -19838,7 +20394,8 @@ exports.randomPareto = pareto;
19838
20394
  exports.randomPoisson = poisson;
19839
20395
  exports.randomUniform = uniform;
19840
20396
  exports.randomWeibull = weibull;
19841
- exports.range = sequence;
20397
+ exports.range = range$2;
20398
+ exports.rank = rank;
19842
20399
  exports.reduce = reduce;
19843
20400
  exports.reverse = reverse$1;
19844
20401
  exports.rgb = rgb;
@@ -19938,58 +20495,67 @@ exports.subset = subset;
19938
20495
  exports.sum = sum$2;
19939
20496
  exports.superset = superset;
19940
20497
  exports.svg = svg;
19941
- exports.symbol = symbol;
20498
+ exports.symbol = Symbol$1;
20499
+ exports.symbolAsterisk = asterisk;
19942
20500
  exports.symbolCircle = circle;
19943
20501
  exports.symbolCross = cross;
19944
20502
  exports.symbolDiamond = diamond;
20503
+ exports.symbolDiamond2 = diamond2;
20504
+ exports.symbolPlus = plus;
19945
20505
  exports.symbolSquare = square;
20506
+ exports.symbolSquare2 = square2;
19946
20507
  exports.symbolStar = star;
20508
+ exports.symbolTimes = times;
19947
20509
  exports.symbolTriangle = triangle;
20510
+ exports.symbolTriangle2 = triangle2;
19948
20511
  exports.symbolWye = wye;
19949
- exports.symbols = symbols;
20512
+ exports.symbolX = times;
20513
+ exports.symbols = symbolsFill;
20514
+ exports.symbolsFill = symbolsFill;
20515
+ exports.symbolsStroke = symbolsStroke;
19950
20516
  exports.text = text;
19951
- exports.thresholdFreedmanDiaconis = freedmanDiaconis;
19952
- exports.thresholdScott = scott;
20517
+ exports.thresholdFreedmanDiaconis = thresholdFreedmanDiaconis;
20518
+ exports.thresholdScott = thresholdScott;
19953
20519
  exports.thresholdSturges = thresholdSturges;
19954
20520
  exports.tickFormat = tickFormat;
19955
20521
  exports.tickIncrement = tickIncrement;
19956
20522
  exports.tickStep = tickStep;
19957
20523
  exports.ticks = ticks;
19958
- exports.timeDay = day;
19959
- exports.timeDays = days;
20524
+ exports.timeDay = timeDay;
20525
+ exports.timeDays = timeDays;
19960
20526
  exports.timeFormatDefaultLocale = defaultLocale;
19961
20527
  exports.timeFormatLocale = formatLocale;
19962
- exports.timeFriday = friday;
19963
- exports.timeFridays = fridays;
19964
- exports.timeHour = hour;
19965
- exports.timeHours = hours;
19966
- exports.timeInterval = newInterval;
20528
+ exports.timeFriday = timeFriday;
20529
+ exports.timeFridays = timeFridays;
20530
+ exports.timeHour = timeHour;
20531
+ exports.timeHours = timeHours;
20532
+ exports.timeInterval = timeInterval;
19967
20533
  exports.timeMillisecond = millisecond;
19968
20534
  exports.timeMilliseconds = milliseconds;
19969
- exports.timeMinute = minute;
19970
- exports.timeMinutes = minutes;
19971
- exports.timeMonday = monday;
19972
- exports.timeMondays = mondays;
19973
- exports.timeMonth = month;
19974
- exports.timeMonths = months;
19975
- exports.timeSaturday = saturday;
19976
- exports.timeSaturdays = saturdays;
20535
+ exports.timeMinute = timeMinute;
20536
+ exports.timeMinutes = timeMinutes;
20537
+ exports.timeMonday = timeMonday;
20538
+ exports.timeMondays = timeMondays;
20539
+ exports.timeMonth = timeMonth;
20540
+ exports.timeMonths = timeMonths;
20541
+ exports.timeSaturday = timeSaturday;
20542
+ exports.timeSaturdays = timeSaturdays;
19977
20543
  exports.timeSecond = second;
19978
20544
  exports.timeSeconds = seconds;
19979
- exports.timeSunday = sunday;
19980
- exports.timeSundays = sundays;
19981
- exports.timeThursday = thursday;
19982
- exports.timeThursdays = thursdays;
20545
+ exports.timeSunday = timeSunday;
20546
+ exports.timeSundays = timeSundays;
20547
+ exports.timeThursday = timeThursday;
20548
+ exports.timeThursdays = timeThursdays;
19983
20549
  exports.timeTickInterval = timeTickInterval;
19984
20550
  exports.timeTicks = timeTicks;
19985
- exports.timeTuesday = tuesday;
19986
- exports.timeTuesdays = tuesdays;
19987
- exports.timeWednesday = wednesday;
19988
- exports.timeWednesdays = wednesdays;
19989
- exports.timeWeek = sunday;
19990
- exports.timeWeeks = sundays;
19991
- exports.timeYear = year;
19992
- exports.timeYears = years;
20551
+ exports.timeTuesday = timeTuesday;
20552
+ exports.timeTuesdays = timeTuesdays;
20553
+ exports.timeWednesday = timeWednesday;
20554
+ exports.timeWednesdays = timeWednesdays;
20555
+ exports.timeWeek = timeSunday;
20556
+ exports.timeWeeks = timeSundays;
20557
+ exports.timeYear = timeYear;
20558
+ exports.timeYears = timeYears;
19993
20559
  exports.timeout = timeout;
19994
20560
  exports.timer = timer;
19995
20561
  exports.timerFlush = timerFlush;
@@ -20012,6 +20578,8 @@ exports.tsvFormatValue = tsvFormatValue;
20012
20578
  exports.tsvParse = tsvParse;
20013
20579
  exports.tsvParseRows = tsvParseRows;
20014
20580
  exports.union = union;
20581
+ exports.unixDay = unixDay;
20582
+ exports.unixDays = unixDays;
20015
20583
  exports.utcDay = utcDay;
20016
20584
  exports.utcDays = utcDays;
20017
20585
  exports.utcFriday = utcFriday;
@@ -20053,6 +20621,4 @@ exports.zoom = zoom;
20053
20621
  exports.zoomIdentity = identity;
20054
20622
  exports.zoomTransform = transform;
20055
20623
 
20056
- Object.defineProperty(exports, '__esModule', { value: true });
20057
-
20058
- })));
20624
+ }));