@daoyi/nmtl-ui 2.0.1-beta.47 → 2.0.1-beta.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/lib/components/{Autocomplete-5439ff22.js → Autocomplete-aa4a8d6c.js} +4 -2
  2. package/lib/components/Autocomplete.js +7 -6
  3. package/lib/components/Avatar.js +2 -4
  4. package/lib/components/BackTop.js +28 -1
  5. package/lib/components/BarChart.js +634 -4
  6. package/lib/components/Breadcrumbs.js +2 -4
  7. package/lib/components/{Button-63c7e9f3.js → Button-2f8f0493.js} +2 -1
  8. package/lib/components/Button.js +3 -5
  9. package/lib/components/Carousel.js +4659 -7
  10. package/lib/components/CollapseContent.js +3 -5
  11. package/lib/components/ContactModal-a44e2a42.js +10759 -0
  12. package/lib/components/ContactModal.js +14 -9
  13. package/lib/components/{Drawer-af3ed21a.js → Drawer-dd8942f1.js} +2 -2
  14. package/lib/components/Drawer.js +5 -7
  15. package/lib/components/Dropdown.js +2 -3
  16. package/lib/components/{Empty-70f040a9.js → Empty-3637b766.js} +2 -1
  17. package/lib/components/Empty.js +3 -5
  18. package/lib/components/ExportButton.js +3 -5
  19. package/lib/components/ExtraTools-55dad795.js +3479 -0
  20. package/lib/components/ExtraTools.js +6 -7
  21. package/lib/components/Filter.js +691 -5
  22. package/lib/components/Footer.js +14 -9
  23. package/lib/components/ForwardLink-4759cf99.js +105 -0
  24. package/lib/components/ForwardLink.js +9 -106
  25. package/lib/components/Header.js +10 -9
  26. package/lib/components/Image.js +7 -4
  27. package/lib/components/Input.js +2 -4
  28. package/lib/components/InputMethod.js +10861 -4
  29. package/lib/components/{KeywordSearch-224f84c1.js → KeywordSearch-2d01266e.js} +3 -2
  30. package/lib/components/KeywordSearch.js +8 -7
  31. package/lib/components/KeywordTicker.js +24 -16
  32. package/lib/components/Keywords.js +30 -5
  33. package/lib/components/Loading.js +2 -4
  34. package/lib/components/MUITheme.js +2375 -3
  35. package/lib/components/{Modal-a7591b98.js → Modal-572e17ea.js} +4 -3
  36. package/lib/components/Modal.js +5 -7
  37. package/lib/components/{MoreButton-f15ca38e.js → MoreButton-80996b5f.js} +2 -1
  38. package/lib/components/MoreButton.js +3 -5
  39. package/lib/components/Radio.js +1 -4
  40. package/lib/components/SNA.js +1416 -5
  41. package/lib/components/{Select-98a8e973.js → Select-5533b506.js} +3 -2
  42. package/lib/components/Select.js +4 -6
  43. package/lib/components/{Spin-690a3597.js → Spin-ebf79c17.js} +2 -1
  44. package/lib/components/Spin.js +3 -5
  45. package/lib/components/{Tooltip-b7eb966d.js → Tooltip-907eaa2e.js} +2 -1
  46. package/lib/components/Tooltip.js +3 -5
  47. package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
  48. package/lib/components/createSvgIcon-48da8b6e.js +576 -0
  49. package/lib/components/dataExport-d55d6fa3.js +92 -0
  50. package/lib/components/debounce-127da66c.js +355 -0
  51. package/lib/components/defaultTheme-19a14721.js +1485 -0
  52. package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
  53. package/lib/components/index-7b60a97d.js +481 -0
  54. package/lib/components/index-f491ebce.js +61 -0
  55. package/lib/components/isObjectLike-e111475d.js +190 -0
  56. package/lib/components/style-inject.es-1f59c1d0.js +28 -0
  57. package/lib/components/transform-3a04288b.js +5475 -0
  58. package/lib/utils/domToImage.js +771 -1
  59. package/lib/utils/exportXlsx.js +36 -1
  60. package/lib/utils/historyAppendSearch.js +480 -1
  61. package/package.json +1 -1
  62. package/lib/components/ContactModal-a59bc808.js +0 -924
  63. package/lib/components/ExtraTools-f10a66a8.js +0 -818
  64. package/lib/components/dataExport-f418e6fe.js +0 -56
  65. package/lib/components/vendor-851c6356.js +0 -41940
  66. package/lib/utils/vendor-3ec75cc9.js +0 -1289
@@ -1,14 +1,1425 @@
1
1
  import React__default, { useMemo, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { e as default_1, s as styleInject, c as classNames, o as ordinal, g as category10, h as simulation, l as link, m as manyBody, i as center, j as collide, x, y, r as radial, k as d3Select, z as zoom, n as drag, p as event } from './vendor-851c6356.js';
4
- import { E as ExtraTools } from './ExtraTools-f10a66a8.js';
3
+ import { c as classNames } from './index-f491ebce.js';
4
+ import { e as event, d as d3Select, a as dispatch, c as customEvent, D as DragEvent, q as quadtree, m as map, t as timer, T as Transform, i as identity, b as interrupt, o as ordinal, f as category10 } from './transform-3a04288b.js';
5
+ import { E as ExtraTools } from './ExtraTools-55dad795.js';
5
6
  import { Tooltip, IconButton } from '@material-ui/core';
7
+ import { r as requireCreateSvgIcon, i as interopRequireDefault, a as interopRequireWildcard } from './createSvgIcon-48da8b6e.js';
8
+ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
9
+ import './_rollupPluginBabelHelpers-fde6d1c6.js';
10
+ import './_commonjsHelpers-70de2c37.js';
11
+ import './Tooltip-907eaa2e.js';
12
+ import './dataExport-d55d6fa3.js';
13
+ import './defaultTheme-19a14721.js';
6
14
  import 'react-is';
7
15
  import '@material-ui/styles';
8
16
  import 'react-dom';
9
- import './_rollupPluginBabelHelpers-fde6d1c6.js';
10
- import './Tooltip-b7eb966d.js';
11
- import './dataExport-f418e6fe.js';
17
+
18
+ function sourceEvent() {
19
+ var current = event, source;
20
+ while (source = current.sourceEvent) current = source;
21
+ return current;
22
+ }
23
+
24
+ function point(node, event) {
25
+ var svg = node.ownerSVGElement || node;
26
+
27
+ if (svg.createSVGPoint) {
28
+ var point = svg.createSVGPoint();
29
+ point.x = event.clientX, point.y = event.clientY;
30
+ point = point.matrixTransform(node.getScreenCTM().inverse());
31
+ return [point.x, point.y];
32
+ }
33
+
34
+ var rect = node.getBoundingClientRect();
35
+ return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
36
+ }
37
+
38
+ function mouse(node) {
39
+ var event = sourceEvent();
40
+ if (event.changedTouches) event = event.changedTouches[0];
41
+ return point(node, event);
42
+ }
43
+
44
+ function touch(node, touches, identifier) {
45
+ if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
46
+
47
+ for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
48
+ if ((touch = touches[i]).identifier === identifier) {
49
+ return point(node, touch);
50
+ }
51
+ }
52
+
53
+ return null;
54
+ }
55
+
56
+ function nopropagation$1() {
57
+ event.stopImmediatePropagation();
58
+ }
59
+
60
+ function noevent$1() {
61
+ event.preventDefault();
62
+ event.stopImmediatePropagation();
63
+ }
64
+
65
+ function dragDisable(view) {
66
+ var root = view.document.documentElement,
67
+ selection = d3Select(view).on("dragstart.drag", noevent$1, true);
68
+ if ("onselectstart" in root) {
69
+ selection.on("selectstart.drag", noevent$1, true);
70
+ } else {
71
+ root.__noselect = root.style.MozUserSelect;
72
+ root.style.MozUserSelect = "none";
73
+ }
74
+ }
75
+
76
+ function yesdrag(view, noclick) {
77
+ var root = view.document.documentElement,
78
+ selection = d3Select(view).on("dragstart.drag", null);
79
+ if (noclick) {
80
+ selection.on("click.drag", noevent$1, true);
81
+ setTimeout(function() { selection.on("click.drag", null); }, 0);
82
+ }
83
+ if ("onselectstart" in root) {
84
+ selection.on("selectstart.drag", null);
85
+ } else {
86
+ root.style.MozUserSelect = root.__noselect;
87
+ delete root.__noselect;
88
+ }
89
+ }
90
+
91
+ function constant$2(x) {
92
+ return function() {
93
+ return x;
94
+ };
95
+ }
96
+
97
+ // Ignore right-click, since that should open the context menu.
98
+ function defaultFilter$1() {
99
+ return !event.ctrlKey && !event.button;
100
+ }
101
+
102
+ function defaultContainer() {
103
+ return this.parentNode;
104
+ }
105
+
106
+ function defaultSubject(d) {
107
+ return d == null ? {x: event.x, y: event.y} : d;
108
+ }
109
+
110
+ function defaultTouchable$1() {
111
+ return navigator.maxTouchPoints || ("ontouchstart" in this);
112
+ }
113
+
114
+ function drag() {
115
+ var filter = defaultFilter$1,
116
+ container = defaultContainer,
117
+ subject = defaultSubject,
118
+ touchable = defaultTouchable$1,
119
+ gestures = {},
120
+ listeners = dispatch("start", "drag", "end"),
121
+ active = 0,
122
+ mousedownx,
123
+ mousedowny,
124
+ mousemoving,
125
+ touchending,
126
+ clickDistance2 = 0;
127
+
128
+ function drag(selection) {
129
+ selection
130
+ .on("mousedown.drag", mousedowned)
131
+ .filter(touchable)
132
+ .on("touchstart.drag", touchstarted)
133
+ .on("touchmove.drag", touchmoved)
134
+ .on("touchend.drag touchcancel.drag", touchended)
135
+ .style("touch-action", "none")
136
+ .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
137
+ }
138
+
139
+ function mousedowned() {
140
+ if (touchending || !filter.apply(this, arguments)) return;
141
+ var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments);
142
+ if (!gesture) return;
143
+ d3Select(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
144
+ dragDisable(event.view);
145
+ nopropagation$1();
146
+ mousemoving = false;
147
+ mousedownx = event.clientX;
148
+ mousedowny = event.clientY;
149
+ gesture("start");
150
+ }
151
+
152
+ function mousemoved() {
153
+ noevent$1();
154
+ if (!mousemoving) {
155
+ var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
156
+ mousemoving = dx * dx + dy * dy > clickDistance2;
157
+ }
158
+ gestures.mouse("drag");
159
+ }
160
+
161
+ function mouseupped() {
162
+ d3Select(event.view).on("mousemove.drag mouseup.drag", null);
163
+ yesdrag(event.view, mousemoving);
164
+ noevent$1();
165
+ gestures.mouse("end");
166
+ }
167
+
168
+ function touchstarted() {
169
+ if (!filter.apply(this, arguments)) return;
170
+ var touches = event.changedTouches,
171
+ c = container.apply(this, arguments),
172
+ n = touches.length, i, gesture;
173
+
174
+ for (i = 0; i < n; ++i) {
175
+ if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {
176
+ nopropagation$1();
177
+ gesture("start");
178
+ }
179
+ }
180
+ }
181
+
182
+ function touchmoved() {
183
+ var touches = event.changedTouches,
184
+ n = touches.length, i, gesture;
185
+
186
+ for (i = 0; i < n; ++i) {
187
+ if (gesture = gestures[touches[i].identifier]) {
188
+ noevent$1();
189
+ gesture("drag");
190
+ }
191
+ }
192
+ }
193
+
194
+ function touchended() {
195
+ var touches = event.changedTouches,
196
+ n = touches.length, i, gesture;
197
+
198
+ if (touchending) clearTimeout(touchending);
199
+ touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
200
+ for (i = 0; i < n; ++i) {
201
+ if (gesture = gestures[touches[i].identifier]) {
202
+ nopropagation$1();
203
+ gesture("end");
204
+ }
205
+ }
206
+ }
207
+
208
+ function beforestart(id, container, point, that, args) {
209
+ var p = point(container, id), s, dx, dy,
210
+ sublisteners = listeners.copy();
211
+
212
+ if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
213
+ if ((event.subject = s = subject.apply(that, args)) == null) return false;
214
+ dx = s.x - p[0] || 0;
215
+ dy = s.y - p[1] || 0;
216
+ return true;
217
+ })) return;
218
+
219
+ return function gesture(type) {
220
+ var p0 = p, n;
221
+ switch (type) {
222
+ case "start": gestures[id] = gesture, n = active++; break;
223
+ case "end": delete gestures[id], --active; // nobreak
224
+ case "drag": p = point(container, id), n = active; break;
225
+ }
226
+ customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);
227
+ };
228
+ }
229
+
230
+ drag.filter = function(_) {
231
+ return arguments.length ? (filter = typeof _ === "function" ? _ : constant$2(!!_), drag) : filter;
232
+ };
233
+
234
+ drag.container = function(_) {
235
+ return arguments.length ? (container = typeof _ === "function" ? _ : constant$2(_), drag) : container;
236
+ };
237
+
238
+ drag.subject = function(_) {
239
+ return arguments.length ? (subject = typeof _ === "function" ? _ : constant$2(_), drag) : subject;
240
+ };
241
+
242
+ drag.touchable = function(_) {
243
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$2(!!_), drag) : touchable;
244
+ };
245
+
246
+ drag.on = function() {
247
+ var value = listeners.on.apply(listeners, arguments);
248
+ return value === listeners ? drag : value;
249
+ };
250
+
251
+ drag.clickDistance = function(_) {
252
+ return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
253
+ };
254
+
255
+ return drag;
256
+ }
257
+
258
+ var rho = Math.SQRT2,
259
+ rho2 = 2,
260
+ rho4 = 4,
261
+ epsilon2 = 1e-12;
262
+
263
+ function cosh(x) {
264
+ return ((x = Math.exp(x)) + 1 / x) / 2;
265
+ }
266
+
267
+ function sinh(x) {
268
+ return ((x = Math.exp(x)) - 1 / x) / 2;
269
+ }
270
+
271
+ function tanh(x) {
272
+ return ((x = Math.exp(2 * x)) - 1) / (x + 1);
273
+ }
274
+
275
+ // p0 = [ux0, uy0, w0]
276
+ // p1 = [ux1, uy1, w1]
277
+ function interpolateZoom(p0, p1) {
278
+ var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
279
+ ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
280
+ dx = ux1 - ux0,
281
+ dy = uy1 - uy0,
282
+ d2 = dx * dx + dy * dy,
283
+ i,
284
+ S;
285
+
286
+ // Special case for u0 ≅ u1.
287
+ if (d2 < epsilon2) {
288
+ S = Math.log(w1 / w0) / rho;
289
+ i = function(t) {
290
+ return [
291
+ ux0 + t * dx,
292
+ uy0 + t * dy,
293
+ w0 * Math.exp(rho * t * S)
294
+ ];
295
+ };
296
+ }
297
+
298
+ // General case.
299
+ else {
300
+ var d1 = Math.sqrt(d2),
301
+ b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
302
+ b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
303
+ r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
304
+ r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
305
+ S = (r1 - r0) / rho;
306
+ i = function(t) {
307
+ var s = t * S,
308
+ coshr0 = cosh(r0),
309
+ u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
310
+ return [
311
+ ux0 + u * dx,
312
+ uy0 + u * dy,
313
+ w0 * coshr0 / cosh(rho * s + r0)
314
+ ];
315
+ };
316
+ }
317
+
318
+ i.duration = S * 1000;
319
+
320
+ return i;
321
+ }
322
+
323
+ function center(x, y) {
324
+ var nodes;
325
+
326
+ if (x == null) x = 0;
327
+ if (y == null) y = 0;
328
+
329
+ function force() {
330
+ var i,
331
+ n = nodes.length,
332
+ node,
333
+ sx = 0,
334
+ sy = 0;
335
+
336
+ for (i = 0; i < n; ++i) {
337
+ node = nodes[i], sx += node.x, sy += node.y;
338
+ }
339
+
340
+ for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) {
341
+ node = nodes[i], node.x -= sx, node.y -= sy;
342
+ }
343
+ }
344
+
345
+ force.initialize = function(_) {
346
+ nodes = _;
347
+ };
348
+
349
+ force.x = function(_) {
350
+ return arguments.length ? (x = +_, force) : x;
351
+ };
352
+
353
+ force.y = function(_) {
354
+ return arguments.length ? (y = +_, force) : y;
355
+ };
356
+
357
+ return force;
358
+ }
359
+
360
+ function constant$1(x) {
361
+ return function() {
362
+ return x;
363
+ };
364
+ }
365
+
366
+ function jiggle() {
367
+ return (Math.random() - 0.5) * 1e-6;
368
+ }
369
+
370
+ function x$2(d) {
371
+ return d.x + d.vx;
372
+ }
373
+
374
+ function y$2(d) {
375
+ return d.y + d.vy;
376
+ }
377
+
378
+ function collide(radius) {
379
+ var nodes,
380
+ radii,
381
+ strength = 1,
382
+ iterations = 1;
383
+
384
+ if (typeof radius !== "function") radius = constant$1(radius == null ? 1 : +radius);
385
+
386
+ function force() {
387
+ var i, n = nodes.length,
388
+ tree,
389
+ node,
390
+ xi,
391
+ yi,
392
+ ri,
393
+ ri2;
394
+
395
+ for (var k = 0; k < iterations; ++k) {
396
+ tree = quadtree(nodes, x$2, y$2).visitAfter(prepare);
397
+ for (i = 0; i < n; ++i) {
398
+ node = nodes[i];
399
+ ri = radii[node.index], ri2 = ri * ri;
400
+ xi = node.x + node.vx;
401
+ yi = node.y + node.vy;
402
+ tree.visit(apply);
403
+ }
404
+ }
405
+
406
+ function apply(quad, x0, y0, x1, y1) {
407
+ var data = quad.data, rj = quad.r, r = ri + rj;
408
+ if (data) {
409
+ if (data.index > node.index) {
410
+ var x = xi - data.x - data.vx,
411
+ y = yi - data.y - data.vy,
412
+ l = x * x + y * y;
413
+ if (l < r * r) {
414
+ if (x === 0) x = jiggle(), l += x * x;
415
+ if (y === 0) y = jiggle(), l += y * y;
416
+ l = (r - (l = Math.sqrt(l))) / l * strength;
417
+ node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
418
+ node.vy += (y *= l) * r;
419
+ data.vx -= x * (r = 1 - r);
420
+ data.vy -= y * r;
421
+ }
422
+ }
423
+ return;
424
+ }
425
+ return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
426
+ }
427
+ }
428
+
429
+ function prepare(quad) {
430
+ if (quad.data) return quad.r = radii[quad.data.index];
431
+ for (var i = quad.r = 0; i < 4; ++i) {
432
+ if (quad[i] && quad[i].r > quad.r) {
433
+ quad.r = quad[i].r;
434
+ }
435
+ }
436
+ }
437
+
438
+ function initialize() {
439
+ if (!nodes) return;
440
+ var i, n = nodes.length, node;
441
+ radii = new Array(n);
442
+ for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
443
+ }
444
+
445
+ force.initialize = function(_) {
446
+ nodes = _;
447
+ initialize();
448
+ };
449
+
450
+ force.iterations = function(_) {
451
+ return arguments.length ? (iterations = +_, force) : iterations;
452
+ };
453
+
454
+ force.strength = function(_) {
455
+ return arguments.length ? (strength = +_, force) : strength;
456
+ };
457
+
458
+ force.radius = function(_) {
459
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : radius;
460
+ };
461
+
462
+ return force;
463
+ }
464
+
465
+ function index(d) {
466
+ return d.index;
467
+ }
468
+
469
+ function find(nodeById, nodeId) {
470
+ var node = nodeById.get(nodeId);
471
+ if (!node) throw new Error("missing: " + nodeId);
472
+ return node;
473
+ }
474
+
475
+ function link(links) {
476
+ var id = index,
477
+ strength = defaultStrength,
478
+ strengths,
479
+ distance = constant$1(30),
480
+ distances,
481
+ nodes,
482
+ count,
483
+ bias,
484
+ iterations = 1;
485
+
486
+ if (links == null) links = [];
487
+
488
+ function defaultStrength(link) {
489
+ return 1 / Math.min(count[link.source.index], count[link.target.index]);
490
+ }
491
+
492
+ function force(alpha) {
493
+ for (var k = 0, n = links.length; k < iterations; ++k) {
494
+ for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {
495
+ link = links[i], source = link.source, target = link.target;
496
+ x = target.x + target.vx - source.x - source.vx || jiggle();
497
+ y = target.y + target.vy - source.y - source.vy || jiggle();
498
+ l = Math.sqrt(x * x + y * y);
499
+ l = (l - distances[i]) / l * alpha * strengths[i];
500
+ x *= l, y *= l;
501
+ target.vx -= x * (b = bias[i]);
502
+ target.vy -= y * b;
503
+ source.vx += x * (b = 1 - b);
504
+ source.vy += y * b;
505
+ }
506
+ }
507
+ }
508
+
509
+ function initialize() {
510
+ if (!nodes) return;
511
+
512
+ var i,
513
+ n = nodes.length,
514
+ m = links.length,
515
+ nodeById = map(nodes, id),
516
+ link;
517
+
518
+ for (i = 0, count = new Array(n); i < m; ++i) {
519
+ link = links[i], link.index = i;
520
+ if (typeof link.source !== "object") link.source = find(nodeById, link.source);
521
+ if (typeof link.target !== "object") link.target = find(nodeById, link.target);
522
+ count[link.source.index] = (count[link.source.index] || 0) + 1;
523
+ count[link.target.index] = (count[link.target.index] || 0) + 1;
524
+ }
525
+
526
+ for (i = 0, bias = new Array(m); i < m; ++i) {
527
+ link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
528
+ }
529
+
530
+ strengths = new Array(m), initializeStrength();
531
+ distances = new Array(m), initializeDistance();
532
+ }
533
+
534
+ function initializeStrength() {
535
+ if (!nodes) return;
536
+
537
+ for (var i = 0, n = links.length; i < n; ++i) {
538
+ strengths[i] = +strength(links[i], i, links);
539
+ }
540
+ }
541
+
542
+ function initializeDistance() {
543
+ if (!nodes) return;
544
+
545
+ for (var i = 0, n = links.length; i < n; ++i) {
546
+ distances[i] = +distance(links[i], i, links);
547
+ }
548
+ }
549
+
550
+ force.initialize = function(_) {
551
+ nodes = _;
552
+ initialize();
553
+ };
554
+
555
+ force.links = function(_) {
556
+ return arguments.length ? (links = _, initialize(), force) : links;
557
+ };
558
+
559
+ force.id = function(_) {
560
+ return arguments.length ? (id = _, force) : id;
561
+ };
562
+
563
+ force.iterations = function(_) {
564
+ return arguments.length ? (iterations = +_, force) : iterations;
565
+ };
566
+
567
+ force.strength = function(_) {
568
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initializeStrength(), force) : strength;
569
+ };
570
+
571
+ force.distance = function(_) {
572
+ return arguments.length ? (distance = typeof _ === "function" ? _ : constant$1(+_), initializeDistance(), force) : distance;
573
+ };
574
+
575
+ return force;
576
+ }
577
+
578
+ function x$1(d) {
579
+ return d.x;
580
+ }
581
+
582
+ function y$1(d) {
583
+ return d.y;
584
+ }
585
+
586
+ var initialRadius = 10,
587
+ initialAngle = Math.PI * (3 - Math.sqrt(5));
588
+
589
+ function simulation(nodes) {
590
+ var simulation,
591
+ alpha = 1,
592
+ alphaMin = 0.001,
593
+ alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
594
+ alphaTarget = 0,
595
+ velocityDecay = 0.6,
596
+ forces = map(),
597
+ stepper = timer(step),
598
+ event = dispatch("tick", "end");
599
+
600
+ if (nodes == null) nodes = [];
601
+
602
+ function step() {
603
+ tick();
604
+ event.call("tick", simulation);
605
+ if (alpha < alphaMin) {
606
+ stepper.stop();
607
+ event.call("end", simulation);
608
+ }
609
+ }
610
+
611
+ function tick(iterations) {
612
+ var i, n = nodes.length, node;
613
+
614
+ if (iterations === undefined) iterations = 1;
615
+
616
+ for (var k = 0; k < iterations; ++k) {
617
+ alpha += (alphaTarget - alpha) * alphaDecay;
618
+
619
+ forces.each(function (force) {
620
+ force(alpha);
621
+ });
622
+
623
+ for (i = 0; i < n; ++i) {
624
+ node = nodes[i];
625
+ if (node.fx == null) node.x += node.vx *= velocityDecay;
626
+ else node.x = node.fx, node.vx = 0;
627
+ if (node.fy == null) node.y += node.vy *= velocityDecay;
628
+ else node.y = node.fy, node.vy = 0;
629
+ }
630
+ }
631
+
632
+ return simulation;
633
+ }
634
+
635
+ function initializeNodes() {
636
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
637
+ node = nodes[i], node.index = i;
638
+ if (node.fx != null) node.x = node.fx;
639
+ if (node.fy != null) node.y = node.fy;
640
+ if (isNaN(node.x) || isNaN(node.y)) {
641
+ var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;
642
+ node.x = radius * Math.cos(angle);
643
+ node.y = radius * Math.sin(angle);
644
+ }
645
+ if (isNaN(node.vx) || isNaN(node.vy)) {
646
+ node.vx = node.vy = 0;
647
+ }
648
+ }
649
+ }
650
+
651
+ function initializeForce(force) {
652
+ if (force.initialize) force.initialize(nodes);
653
+ return force;
654
+ }
655
+
656
+ initializeNodes();
657
+
658
+ return simulation = {
659
+ tick: tick,
660
+
661
+ restart: function() {
662
+ return stepper.restart(step), simulation;
663
+ },
664
+
665
+ stop: function() {
666
+ return stepper.stop(), simulation;
667
+ },
668
+
669
+ nodes: function(_) {
670
+ return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes;
671
+ },
672
+
673
+ alpha: function(_) {
674
+ return arguments.length ? (alpha = +_, simulation) : alpha;
675
+ },
676
+
677
+ alphaMin: function(_) {
678
+ return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
679
+ },
680
+
681
+ alphaDecay: function(_) {
682
+ return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
683
+ },
684
+
685
+ alphaTarget: function(_) {
686
+ return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
687
+ },
688
+
689
+ velocityDecay: function(_) {
690
+ return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
691
+ },
692
+
693
+ force: function(name, _) {
694
+ return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);
695
+ },
696
+
697
+ find: function(x, y, radius) {
698
+ var i = 0,
699
+ n = nodes.length,
700
+ dx,
701
+ dy,
702
+ d2,
703
+ node,
704
+ closest;
705
+
706
+ if (radius == null) radius = Infinity;
707
+ else radius *= radius;
708
+
709
+ for (i = 0; i < n; ++i) {
710
+ node = nodes[i];
711
+ dx = x - node.x;
712
+ dy = y - node.y;
713
+ d2 = dx * dx + dy * dy;
714
+ if (d2 < radius) closest = node, radius = d2;
715
+ }
716
+
717
+ return closest;
718
+ },
719
+
720
+ on: function(name, _) {
721
+ return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
722
+ }
723
+ };
724
+ }
725
+
726
+ function manyBody() {
727
+ var nodes,
728
+ node,
729
+ alpha,
730
+ strength = constant$1(-30),
731
+ strengths,
732
+ distanceMin2 = 1,
733
+ distanceMax2 = Infinity,
734
+ theta2 = 0.81;
735
+
736
+ function force(_) {
737
+ var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate);
738
+ for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
739
+ }
740
+
741
+ function initialize() {
742
+ if (!nodes) return;
743
+ var i, n = nodes.length, node;
744
+ strengths = new Array(n);
745
+ for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
746
+ }
747
+
748
+ function accumulate(quad) {
749
+ var strength = 0, q, c, weight = 0, x, y, i;
750
+
751
+ // For internal nodes, accumulate forces from child quadrants.
752
+ if (quad.length) {
753
+ for (x = y = i = 0; i < 4; ++i) {
754
+ if ((q = quad[i]) && (c = Math.abs(q.value))) {
755
+ strength += q.value, weight += c, x += c * q.x, y += c * q.y;
756
+ }
757
+ }
758
+ quad.x = x / weight;
759
+ quad.y = y / weight;
760
+ }
761
+
762
+ // For leaf nodes, accumulate forces from coincident quadrants.
763
+ else {
764
+ q = quad;
765
+ q.x = q.data.x;
766
+ q.y = q.data.y;
767
+ do strength += strengths[q.data.index];
768
+ while (q = q.next);
769
+ }
770
+
771
+ quad.value = strength;
772
+ }
773
+
774
+ function apply(quad, x1, _, x2) {
775
+ if (!quad.value) return true;
776
+
777
+ var x = quad.x - node.x,
778
+ y = quad.y - node.y,
779
+ w = x2 - x1,
780
+ l = x * x + y * y;
781
+
782
+ // Apply the Barnes-Hut approximation if possible.
783
+ // Limit forces for very close nodes; randomize direction if coincident.
784
+ if (w * w / theta2 < l) {
785
+ if (l < distanceMax2) {
786
+ if (x === 0) x = jiggle(), l += x * x;
787
+ if (y === 0) y = jiggle(), l += y * y;
788
+ if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
789
+ node.vx += x * quad.value * alpha / l;
790
+ node.vy += y * quad.value * alpha / l;
791
+ }
792
+ return true;
793
+ }
794
+
795
+ // Otherwise, process points directly.
796
+ else if (quad.length || l >= distanceMax2) return;
797
+
798
+ // Limit forces for very close nodes; randomize direction if coincident.
799
+ if (quad.data !== node || quad.next) {
800
+ if (x === 0) x = jiggle(), l += x * x;
801
+ if (y === 0) y = jiggle(), l += y * y;
802
+ if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
803
+ }
804
+
805
+ do if (quad.data !== node) {
806
+ w = strengths[quad.data.index] * alpha / l;
807
+ node.vx += x * w;
808
+ node.vy += y * w;
809
+ } while (quad = quad.next);
810
+ }
811
+
812
+ force.initialize = function(_) {
813
+ nodes = _;
814
+ initialize();
815
+ };
816
+
817
+ force.strength = function(_) {
818
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
819
+ };
820
+
821
+ force.distanceMin = function(_) {
822
+ return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
823
+ };
824
+
825
+ force.distanceMax = function(_) {
826
+ return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
827
+ };
828
+
829
+ force.theta = function(_) {
830
+ return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
831
+ };
832
+
833
+ return force;
834
+ }
835
+
836
+ function radial(radius, x, y) {
837
+ var nodes,
838
+ strength = constant$1(0.1),
839
+ strengths,
840
+ radiuses;
841
+
842
+ if (typeof radius !== "function") radius = constant$1(+radius);
843
+ if (x == null) x = 0;
844
+ if (y == null) y = 0;
845
+
846
+ function force(alpha) {
847
+ for (var i = 0, n = nodes.length; i < n; ++i) {
848
+ var node = nodes[i],
849
+ dx = node.x - x || 1e-6,
850
+ dy = node.y - y || 1e-6,
851
+ r = Math.sqrt(dx * dx + dy * dy),
852
+ k = (radiuses[i] - r) * strengths[i] * alpha / r;
853
+ node.vx += dx * k;
854
+ node.vy += dy * k;
855
+ }
856
+ }
857
+
858
+ function initialize() {
859
+ if (!nodes) return;
860
+ var i, n = nodes.length;
861
+ strengths = new Array(n);
862
+ radiuses = new Array(n);
863
+ for (i = 0; i < n; ++i) {
864
+ radiuses[i] = +radius(nodes[i], i, nodes);
865
+ strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);
866
+ }
867
+ }
868
+
869
+ force.initialize = function(_) {
870
+ nodes = _, initialize();
871
+ };
872
+
873
+ force.strength = function(_) {
874
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
875
+ };
876
+
877
+ force.radius = function(_) {
878
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : radius;
879
+ };
880
+
881
+ force.x = function(_) {
882
+ return arguments.length ? (x = +_, force) : x;
883
+ };
884
+
885
+ force.y = function(_) {
886
+ return arguments.length ? (y = +_, force) : y;
887
+ };
888
+
889
+ return force;
890
+ }
891
+
892
+ function x(x) {
893
+ var strength = constant$1(0.1),
894
+ nodes,
895
+ strengths,
896
+ xz;
897
+
898
+ if (typeof x !== "function") x = constant$1(x == null ? 0 : +x);
899
+
900
+ function force(alpha) {
901
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
902
+ node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
903
+ }
904
+ }
905
+
906
+ function initialize() {
907
+ if (!nodes) return;
908
+ var i, n = nodes.length;
909
+ strengths = new Array(n);
910
+ xz = new Array(n);
911
+ for (i = 0; i < n; ++i) {
912
+ strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
913
+ }
914
+ }
915
+
916
+ force.initialize = function(_) {
917
+ nodes = _;
918
+ initialize();
919
+ };
920
+
921
+ force.strength = function(_) {
922
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
923
+ };
924
+
925
+ force.x = function(_) {
926
+ return arguments.length ? (x = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : x;
927
+ };
928
+
929
+ return force;
930
+ }
931
+
932
+ function y(y) {
933
+ var strength = constant$1(0.1),
934
+ nodes,
935
+ strengths,
936
+ yz;
937
+
938
+ if (typeof y !== "function") y = constant$1(y == null ? 0 : +y);
939
+
940
+ function force(alpha) {
941
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
942
+ node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
943
+ }
944
+ }
945
+
946
+ function initialize() {
947
+ if (!nodes) return;
948
+ var i, n = nodes.length;
949
+ strengths = new Array(n);
950
+ yz = new Array(n);
951
+ for (i = 0; i < n; ++i) {
952
+ strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
953
+ }
954
+ }
955
+
956
+ force.initialize = function(_) {
957
+ nodes = _;
958
+ initialize();
959
+ };
960
+
961
+ force.strength = function(_) {
962
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
963
+ };
964
+
965
+ force.y = function(_) {
966
+ return arguments.length ? (y = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : y;
967
+ };
968
+
969
+ return force;
970
+ }
971
+
972
+ function constant(x) {
973
+ return function() {
974
+ return x;
975
+ };
976
+ }
977
+
978
+ function ZoomEvent(target, type, transform) {
979
+ this.target = target;
980
+ this.type = type;
981
+ this.transform = transform;
982
+ }
983
+
984
+ function nopropagation() {
985
+ event.stopImmediatePropagation();
986
+ }
987
+
988
+ function noevent() {
989
+ event.preventDefault();
990
+ event.stopImmediatePropagation();
991
+ }
992
+
993
+ // Ignore right-click, since that should open the context menu.
994
+ function defaultFilter() {
995
+ return !event.ctrlKey && !event.button;
996
+ }
997
+
998
+ function defaultExtent() {
999
+ var e = this;
1000
+ if (e instanceof SVGElement) {
1001
+ e = e.ownerSVGElement || e;
1002
+ if (e.hasAttribute("viewBox")) {
1003
+ e = e.viewBox.baseVal;
1004
+ return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
1005
+ }
1006
+ return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
1007
+ }
1008
+ return [[0, 0], [e.clientWidth, e.clientHeight]];
1009
+ }
1010
+
1011
+ function defaultTransform() {
1012
+ return this.__zoom || identity;
1013
+ }
1014
+
1015
+ function defaultWheelDelta() {
1016
+ return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002);
1017
+ }
1018
+
1019
+ function defaultTouchable() {
1020
+ return navigator.maxTouchPoints || ("ontouchstart" in this);
1021
+ }
1022
+
1023
+ function defaultConstrain(transform, extent, translateExtent) {
1024
+ var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],
1025
+ dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],
1026
+ dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],
1027
+ dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];
1028
+ return transform.translate(
1029
+ dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
1030
+ dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
1031
+ );
1032
+ }
1033
+
1034
+ function zoom() {
1035
+ var filter = defaultFilter,
1036
+ extent = defaultExtent,
1037
+ constrain = defaultConstrain,
1038
+ wheelDelta = defaultWheelDelta,
1039
+ touchable = defaultTouchable,
1040
+ scaleExtent = [0, Infinity],
1041
+ translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],
1042
+ duration = 250,
1043
+ interpolate = interpolateZoom,
1044
+ listeners = dispatch("start", "zoom", "end"),
1045
+ touchstarting,
1046
+ touchending,
1047
+ touchDelay = 500,
1048
+ wheelDelay = 150,
1049
+ clickDistance2 = 0;
1050
+
1051
+ function zoom(selection) {
1052
+ selection
1053
+ .property("__zoom", defaultTransform)
1054
+ .on("wheel.zoom", wheeled)
1055
+ .on("mousedown.zoom", mousedowned)
1056
+ .on("dblclick.zoom", dblclicked)
1057
+ .filter(touchable)
1058
+ .on("touchstart.zoom", touchstarted)
1059
+ .on("touchmove.zoom", touchmoved)
1060
+ .on("touchend.zoom touchcancel.zoom", touchended)
1061
+ .style("touch-action", "none")
1062
+ .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
1063
+ }
1064
+
1065
+ zoom.transform = function(collection, transform, point) {
1066
+ var selection = collection.selection ? collection.selection() : collection;
1067
+ selection.property("__zoom", defaultTransform);
1068
+ if (collection !== selection) {
1069
+ schedule(collection, transform, point);
1070
+ } else {
1071
+ selection.interrupt().each(function() {
1072
+ gesture(this, arguments)
1073
+ .start()
1074
+ .zoom(null, typeof transform === "function" ? transform.apply(this, arguments) : transform)
1075
+ .end();
1076
+ });
1077
+ }
1078
+ };
1079
+
1080
+ zoom.scaleBy = function(selection, k, p) {
1081
+ zoom.scaleTo(selection, function() {
1082
+ var k0 = this.__zoom.k,
1083
+ k1 = typeof k === "function" ? k.apply(this, arguments) : k;
1084
+ return k0 * k1;
1085
+ }, p);
1086
+ };
1087
+
1088
+ zoom.scaleTo = function(selection, k, p) {
1089
+ zoom.transform(selection, function() {
1090
+ var e = extent.apply(this, arguments),
1091
+ t0 = this.__zoom,
1092
+ p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p,
1093
+ p1 = t0.invert(p0),
1094
+ k1 = typeof k === "function" ? k.apply(this, arguments) : k;
1095
+ return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
1096
+ }, p);
1097
+ };
1098
+
1099
+ zoom.translateBy = function(selection, x, y) {
1100
+ zoom.transform(selection, function() {
1101
+ return constrain(this.__zoom.translate(
1102
+ typeof x === "function" ? x.apply(this, arguments) : x,
1103
+ typeof y === "function" ? y.apply(this, arguments) : y
1104
+ ), extent.apply(this, arguments), translateExtent);
1105
+ });
1106
+ };
1107
+
1108
+ zoom.translateTo = function(selection, x, y, p) {
1109
+ zoom.transform(selection, function() {
1110
+ var e = extent.apply(this, arguments),
1111
+ t = this.__zoom,
1112
+ p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
1113
+ return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(
1114
+ typeof x === "function" ? -x.apply(this, arguments) : -x,
1115
+ typeof y === "function" ? -y.apply(this, arguments) : -y
1116
+ ), e, translateExtent);
1117
+ }, p);
1118
+ };
1119
+
1120
+ function scale(transform, k) {
1121
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
1122
+ return k === transform.k ? transform : new Transform(k, transform.x, transform.y);
1123
+ }
1124
+
1125
+ function translate(transform, p0, p1) {
1126
+ var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;
1127
+ return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);
1128
+ }
1129
+
1130
+ function centroid(extent) {
1131
+ return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];
1132
+ }
1133
+
1134
+ function schedule(transition, transform, point) {
1135
+ transition
1136
+ .on("start.zoom", function() { gesture(this, arguments).start(); })
1137
+ .on("interrupt.zoom end.zoom", function() { gesture(this, arguments).end(); })
1138
+ .tween("zoom", function() {
1139
+ var that = this,
1140
+ args = arguments,
1141
+ g = gesture(that, args),
1142
+ e = extent.apply(that, args),
1143
+ p = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point,
1144
+ w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),
1145
+ a = that.__zoom,
1146
+ b = typeof transform === "function" ? transform.apply(that, args) : transform,
1147
+ i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
1148
+ return function(t) {
1149
+ if (t === 1) t = b; // Avoid rounding error on end.
1150
+ else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }
1151
+ g.zoom(null, t);
1152
+ };
1153
+ });
1154
+ }
1155
+
1156
+ function gesture(that, args, clean) {
1157
+ return (!clean && that.__zooming) || new Gesture(that, args);
1158
+ }
1159
+
1160
+ function Gesture(that, args) {
1161
+ this.that = that;
1162
+ this.args = args;
1163
+ this.active = 0;
1164
+ this.extent = extent.apply(that, args);
1165
+ this.taps = 0;
1166
+ }
1167
+
1168
+ Gesture.prototype = {
1169
+ start: function() {
1170
+ if (++this.active === 1) {
1171
+ this.that.__zooming = this;
1172
+ this.emit("start");
1173
+ }
1174
+ return this;
1175
+ },
1176
+ zoom: function(key, transform) {
1177
+ if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]);
1178
+ if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]);
1179
+ if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]);
1180
+ this.that.__zoom = transform;
1181
+ this.emit("zoom");
1182
+ return this;
1183
+ },
1184
+ end: function() {
1185
+ if (--this.active === 0) {
1186
+ delete this.that.__zooming;
1187
+ this.emit("end");
1188
+ }
1189
+ return this;
1190
+ },
1191
+ emit: function(type) {
1192
+ customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]);
1193
+ }
1194
+ };
1195
+
1196
+ function wheeled() {
1197
+ if (!filter.apply(this, arguments)) return;
1198
+ var g = gesture(this, arguments),
1199
+ t = this.__zoom,
1200
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
1201
+ p = mouse(this);
1202
+
1203
+ // If the mouse is in the same location as before, reuse it.
1204
+ // If there were recent wheel events, reset the wheel idle timeout.
1205
+ if (g.wheel) {
1206
+ if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
1207
+ g.mouse[1] = t.invert(g.mouse[0] = p);
1208
+ }
1209
+ clearTimeout(g.wheel);
1210
+ }
1211
+
1212
+ // If this wheel event won’t trigger a transform change, ignore it.
1213
+ else if (t.k === k) return;
1214
+
1215
+ // Otherwise, capture the mouse point and location at the start.
1216
+ else {
1217
+ g.mouse = [p, t.invert(p)];
1218
+ interrupt(this);
1219
+ g.start();
1220
+ }
1221
+
1222
+ noevent();
1223
+ g.wheel = setTimeout(wheelidled, wheelDelay);
1224
+ g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
1225
+
1226
+ function wheelidled() {
1227
+ g.wheel = null;
1228
+ g.end();
1229
+ }
1230
+ }
1231
+
1232
+ function mousedowned() {
1233
+ if (touchending || !filter.apply(this, arguments)) return;
1234
+ var g = gesture(this, arguments, true),
1235
+ v = d3Select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true),
1236
+ p = mouse(this),
1237
+ x0 = event.clientX,
1238
+ y0 = event.clientY;
1239
+
1240
+ dragDisable(event.view);
1241
+ nopropagation();
1242
+ g.mouse = [p, this.__zoom.invert(p)];
1243
+ interrupt(this);
1244
+ g.start();
1245
+
1246
+ function mousemoved() {
1247
+ noevent();
1248
+ if (!g.moved) {
1249
+ var dx = event.clientX - x0, dy = event.clientY - y0;
1250
+ g.moved = dx * dx + dy * dy > clickDistance2;
1251
+ }
1252
+ g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent, translateExtent));
1253
+ }
1254
+
1255
+ function mouseupped() {
1256
+ v.on("mousemove.zoom mouseup.zoom", null);
1257
+ yesdrag(event.view, g.moved);
1258
+ noevent();
1259
+ g.end();
1260
+ }
1261
+ }
1262
+
1263
+ function dblclicked() {
1264
+ if (!filter.apply(this, arguments)) return;
1265
+ var t0 = this.__zoom,
1266
+ p0 = mouse(this),
1267
+ p1 = t0.invert(p0),
1268
+ k1 = t0.k * (event.shiftKey ? 0.5 : 2),
1269
+ t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
1270
+
1271
+ noevent();
1272
+ if (duration > 0) d3Select(this).transition().duration(duration).call(schedule, t1, p0);
1273
+ else d3Select(this).call(zoom.transform, t1);
1274
+ }
1275
+
1276
+ function touchstarted() {
1277
+ if (!filter.apply(this, arguments)) return;
1278
+ var touches = event.touches,
1279
+ n = touches.length,
1280
+ g = gesture(this, arguments, event.changedTouches.length === n),
1281
+ started, i, t, p;
1282
+
1283
+ nopropagation();
1284
+ for (i = 0; i < n; ++i) {
1285
+ t = touches[i], p = touch(this, touches, t.identifier);
1286
+ p = [p, this.__zoom.invert(p), t.identifier];
1287
+ if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
1288
+ else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;
1289
+ }
1290
+
1291
+ if (touchstarting) touchstarting = clearTimeout(touchstarting);
1292
+
1293
+ if (started) {
1294
+ if (g.taps < 2) touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);
1295
+ interrupt(this);
1296
+ g.start();
1297
+ }
1298
+ }
1299
+
1300
+ function touchmoved() {
1301
+ if (!this.__zooming) return;
1302
+ var g = gesture(this, arguments),
1303
+ touches = event.changedTouches,
1304
+ n = touches.length, i, t, p, l;
1305
+
1306
+ noevent();
1307
+ if (touchstarting) touchstarting = clearTimeout(touchstarting);
1308
+ g.taps = 0;
1309
+ for (i = 0; i < n; ++i) {
1310
+ t = touches[i], p = touch(this, touches, t.identifier);
1311
+ if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;
1312
+ else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;
1313
+ }
1314
+ t = g.that.__zoom;
1315
+ if (g.touch1) {
1316
+ var p0 = g.touch0[0], l0 = g.touch0[1],
1317
+ p1 = g.touch1[0], l1 = g.touch1[1],
1318
+ dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,
1319
+ dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
1320
+ t = scale(t, Math.sqrt(dp / dl));
1321
+ p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
1322
+ l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
1323
+ }
1324
+ else if (g.touch0) p = g.touch0[0], l = g.touch0[1];
1325
+ else return;
1326
+ g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
1327
+ }
1328
+
1329
+ function touchended() {
1330
+ if (!this.__zooming) return;
1331
+ var g = gesture(this, arguments),
1332
+ touches = event.changedTouches,
1333
+ n = touches.length, i, t;
1334
+
1335
+ nopropagation();
1336
+ if (touchending) clearTimeout(touchending);
1337
+ touchending = setTimeout(function() { touchending = null; }, touchDelay);
1338
+ for (i = 0; i < n; ++i) {
1339
+ t = touches[i];
1340
+ if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;
1341
+ else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;
1342
+ }
1343
+ if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;
1344
+ if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);
1345
+ else {
1346
+ g.end();
1347
+ // If this was a dbltap, reroute to the (optional) dblclick.zoom handler.
1348
+ if (g.taps === 2) {
1349
+ var p = d3Select(this).on("dblclick.zoom");
1350
+ if (p) p.apply(this, arguments);
1351
+ }
1352
+ }
1353
+ }
1354
+
1355
+ zoom.wheelDelta = function(_) {
1356
+ return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant(+_), zoom) : wheelDelta;
1357
+ };
1358
+
1359
+ zoom.filter = function(_) {
1360
+ return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), zoom) : filter;
1361
+ };
1362
+
1363
+ zoom.touchable = function(_) {
1364
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), zoom) : touchable;
1365
+ };
1366
+
1367
+ zoom.extent = function(_) {
1368
+ return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
1369
+ };
1370
+
1371
+ zoom.scaleExtent = function(_) {
1372
+ return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
1373
+ };
1374
+
1375
+ zoom.translateExtent = function(_) {
1376
+ return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
1377
+ };
1378
+
1379
+ zoom.constrain = function(_) {
1380
+ return arguments.length ? (constrain = _, zoom) : constrain;
1381
+ };
1382
+
1383
+ zoom.duration = function(_) {
1384
+ return arguments.length ? (duration = +_, zoom) : duration;
1385
+ };
1386
+
1387
+ zoom.interpolate = function(_) {
1388
+ return arguments.length ? (interpolate = _, zoom) : interpolate;
1389
+ };
1390
+
1391
+ zoom.on = function() {
1392
+ var value = listeners.on.apply(listeners, arguments);
1393
+ return value === listeners ? zoom : value;
1394
+ };
1395
+
1396
+ zoom.clickDistance = function(_) {
1397
+ return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
1398
+ };
1399
+
1400
+ return zoom;
1401
+ }
1402
+
1403
+ var Replay = {};
1404
+
1405
+ var _interopRequireDefault = interopRequireDefault.exports;
1406
+
1407
+ var _interopRequireWildcard = interopRequireWildcard.exports;
1408
+
1409
+ Object.defineProperty(Replay, "__esModule", {
1410
+ value: true
1411
+ });
1412
+ var default_1 = Replay.default = void 0;
1413
+
1414
+ var React = _interopRequireWildcard(React__default);
1415
+
1416
+ var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
1417
+
1418
+ var _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement("path", {
1419
+ d: "M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"
1420
+ }), 'Replay');
1421
+
1422
+ default_1 = Replay.default = _default;
12
1423
 
13
1424
  const ResetBtn = _ref => {
14
1425
  let {