@nebula.js/sn-org-chart 0.13.0 → 0.16.0

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.
@@ -1,185 +1,36 @@
1
1
  /*
2
- * @nebula.js/sn-org-chart v0.13.0
3
- * Copyright (c) 2020 QlikTech International AB
2
+ * @nebula.js/sn-org-chart v0.16.0
3
+ * Copyright (c) 2022 QlikTech International AB
4
4
  * Released under the MIT license.
5
5
  */
6
6
 
7
7
  import { useElement, onTakeSnapshot, useImperativeHandle, useState, useSelections, useLayout, useEffect, useAction, useStaleLayout, useModel, useTheme, useOptions, useRect, useConstraints, useTranslator, usePromise } from '@nebula.js/stardust';
8
8
 
9
- function _typeof(obj) {
10
- "@babel/helpers - typeof";
11
-
12
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
13
- _typeof = function (obj) {
14
- return typeof obj;
15
- };
16
- } else {
17
- _typeof = function (obj) {
18
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
19
- };
20
- }
21
-
22
- return _typeof(obj);
23
- }
24
-
25
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
26
- try {
27
- var info = gen[key](arg);
28
- var value = info.value;
29
- } catch (error) {
30
- reject(error);
31
- return;
32
- }
33
-
34
- if (info.done) {
35
- resolve(value);
36
- } else {
37
- Promise.resolve(value).then(_next, _throw);
38
- }
39
- }
40
-
41
- function _asyncToGenerator(fn) {
42
- return function () {
43
- var self = this,
44
- args = arguments;
45
- return new Promise(function (resolve, reject) {
46
- var gen = fn.apply(self, args);
47
-
48
- function _next(value) {
49
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
50
- }
51
-
52
- function _throw(err) {
53
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
54
- }
55
-
56
- _next(undefined);
57
- });
58
- };
59
- }
60
-
61
- function _defineProperty(obj, key, value) {
62
- if (key in obj) {
63
- Object.defineProperty(obj, key, {
64
- value: value,
65
- enumerable: true,
66
- configurable: true,
67
- writable: true
68
- });
69
- } else {
70
- obj[key] = value;
71
- }
72
-
73
- return obj;
74
- }
75
-
76
- function ownKeys(object, enumerableOnly) {
77
- var keys = Object.keys(object);
78
-
79
- if (Object.getOwnPropertySymbols) {
80
- var symbols = Object.getOwnPropertySymbols(object);
81
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
82
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
83
- });
84
- keys.push.apply(keys, symbols);
85
- }
86
-
87
- return keys;
88
- }
89
-
90
- function _objectSpread2(target) {
91
- for (var i = 1; i < arguments.length; i++) {
92
- var source = arguments[i] != null ? arguments[i] : {};
93
-
94
- if (i % 2) {
95
- ownKeys(Object(source), true).forEach(function (key) {
96
- _defineProperty(target, key, source[key]);
97
- });
98
- } else if (Object.getOwnPropertyDescriptors) {
99
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
100
- } else {
101
- ownKeys(Object(source)).forEach(function (key) {
102
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
103
- });
104
- }
105
- }
106
-
107
- return target;
108
- }
109
-
110
- function _slicedToArray(arr, i) {
111
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
112
- }
113
-
114
- function _toConsumableArray(arr) {
115
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
116
- }
117
-
118
- function _arrayWithoutHoles(arr) {
119
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
120
- }
121
-
122
- function _arrayWithHoles(arr) {
123
- if (Array.isArray(arr)) return arr;
124
- }
125
-
126
- function _iterableToArray(iter) {
127
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
128
- }
129
-
130
- function _iterableToArrayLimit(arr, i) {
131
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
132
- var _arr = [];
133
- var _n = true;
134
- var _d = false;
135
- var _e = undefined;
136
-
137
- try {
138
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
139
- _arr.push(_s.value);
140
-
141
- if (i && _arr.length === i) break;
142
- }
143
- } catch (err) {
144
- _d = true;
145
- _e = err;
146
- } finally {
147
- try {
148
- if (!_n && _i["return"] != null) _i["return"]();
149
- } finally {
150
- if (_d) throw _e;
151
- }
152
- }
153
-
154
- return _arr;
155
- }
156
-
157
- function _unsupportedIterableToArray(o, minLen) {
158
- if (!o) return;
159
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
160
- var n = Object.prototype.toString.call(o).slice(8, -1);
161
- if (n === "Object" && o.constructor) n = o.constructor.name;
162
- if (n === "Map" || n === "Set") return Array.from(o);
163
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
164
- }
165
-
166
- function _arrayLikeToArray(arr, len) {
167
- if (len == null || len > arr.length) len = arr.length;
168
-
169
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
170
-
171
- return arr2;
172
- }
173
-
174
- function _nonIterableSpread() {
175
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
176
- }
177
-
178
- function _nonIterableRest() {
179
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
180
- }
9
+ var DEFAULTS = {
10
+ FONT_COLOR_TYPE: 'auto',
11
+ FONT_COLOR_DARK: {
12
+ index: -1,
13
+ color: '#484848'
14
+ },
15
+ FONT_COLOR_LIGHT: {
16
+ index: -1,
17
+ color: '#e6e6e6'
18
+ },
19
+ BACKGROUND_COLOR_TYPE: 'colorPicker',
20
+ BACKGROUND_COLOR: {
21
+ index: -1,
22
+ color: '#ffffff'
23
+ },
24
+ BORDER_COLOR_TYPE: 'auto',
25
+ BORDER_COLOR: {
26
+ index: -1,
27
+ color: '#737373'
28
+ },
29
+ BORDER_FULL: true,
30
+ BORDER_TOP: true
31
+ };
181
32
 
182
- var properties = {
33
+ const properties = {
183
34
  qHyperCubeDef: {
184
35
  qDimensions: [],
185
36
  qMeasures: [],
@@ -225,82 +76,21 @@ var properties = {
225
76
  * @type {object}
226
77
  */
227
78
  style: {
228
- /**
229
- * @type {object}
230
- */
231
79
  fontColor: {
232
- /**
233
- * @type {'auto'|'colorPicker'|'byExpression'}
234
- */
235
- colorType: 'auto',
236
-
237
- /**
238
- * @type {object}
239
- */
240
- color: {
241
- index: -1,
242
- color: '#484848'
243
- },
244
-
245
- /**
246
- * @type {string}
247
- */
80
+ colorType: DEFAULTS.FONT_COLOR_TYPE,
81
+ color: DEFAULTS.FONT_COLOR_DARK,
248
82
  colorExpression: ''
249
83
  },
250
-
251
- /**
252
- * @type {object}
253
- */
254
84
  backgroundColor: {
255
- /**
256
- * @type {'auto'|'colorPicker'|'byExpression'}
257
- */
258
- colorType: 'colorPicker',
259
-
260
- /**
261
- * @type {object}
262
- */
263
- color: {
264
- index: -1,
265
- color: '#ffffff'
266
- },
267
-
268
- /**
269
- * @type {string}
270
- */
85
+ colorType: DEFAULTS.BACKGROUND_COLOR_TYPE,
86
+ color: DEFAULTS.BACKGROUND_COLOR,
271
87
  colorExpression: ''
272
88
  },
273
-
274
- /**
275
- * @type {object}
276
- */
277
89
  border: {
278
- /**
279
- * @type {boolean}
280
- */
281
- top: true,
282
-
283
- /**
284
- * @type {boolean}
285
- */
286
- fullBorder: true,
287
-
288
- /**
289
- * @type {string}
290
- */
291
- colorType: 'auto',
292
-
293
- /**
294
- * @type {object}
295
- */
296
- color: {
297
- index: -1,
298
- color: '#737373'
299
- },
300
-
301
- /**
302
- * @type {string}
303
- */
90
+ top: DEFAULTS.BORDER_TOP,
91
+ fullBorder: DEFAULTS.BORDER_FULL,
92
+ colorType: DEFAULTS.BORDER_COLOR_TYPE,
93
+ color: DEFAULTS.BORDER_COLOR,
304
94
  colorExpression: ''
305
95
  }
306
96
  }
@@ -321,14 +111,14 @@ var data = {
321
111
  };
322
112
 
323
113
  function getValue(dataContainer, reference, defaultValue) {
324
- var steps = reference.split('.');
325
- var i;
114
+ const steps = reference.split('.');
115
+ let i;
326
116
 
327
117
  if (dataContainer === undefined) {
328
118
  return defaultValue;
329
119
  }
330
120
 
331
- var currentValue = dataContainer;
121
+ let currentValue = dataContainer;
332
122
 
333
123
  for (i = 0; i < steps.length; ++i) {
334
124
  if (typeof currentValue[steps[i]] === 'undefined') {
@@ -342,10 +132,10 @@ function getValue(dataContainer, reference, defaultValue) {
342
132
  }
343
133
 
344
134
  var propertyResolver = {
345
- getValue: getValue
135
+ getValue
346
136
  };
347
137
 
348
- var colorOptions = [{
138
+ const colorOptions = [{
349
139
  value: 'auto',
350
140
  translation: 'Common.Auto'
351
141
  }, {
@@ -355,7 +145,7 @@ var colorOptions = [{
355
145
  value: 'byExpression',
356
146
  translation: 'properties.colorMode.byExpression'
357
147
  }];
358
- var navigationOptions = [{
148
+ const navigationOptions = [{
359
149
  value: 'free',
360
150
  translation: 'Object.OrgChart.FreeMode'
361
151
  }, {
@@ -363,9 +153,7 @@ var navigationOptions = [{
363
153
  translation: 'Object.OrgChart.ExpandAll'
364
154
  }];
365
155
 
366
- var bordersActive = function bordersActive(data) {
367
- return propertyResolver.getValue(data, 'style.border.top') || propertyResolver.getValue(data, 'style.border.fullBorder');
368
- };
156
+ const bordersActive = data => propertyResolver.getValue(data, 'style.border.top') || propertyResolver.getValue(data, 'style.border.fullBorder');
369
157
 
370
158
  var extDef = {
371
159
  definition: {
@@ -387,8 +175,8 @@ var extDef = {
387
175
  attributes: {
388
176
  component: 'attribute-expression-reference',
389
177
  defaultValue: [],
390
- show: function show(dim, handler) {
391
- var dims = handler.getDimensions();
178
+ show: (dim, handler) => {
179
+ const dims = handler.getDimensions();
392
180
  return dims[0] === dim;
393
181
  },
394
182
  ref: 'qAttributeExpressions',
@@ -423,8 +211,8 @@ var extDef = {
423
211
  }]
424
212
  },
425
213
  desc: {
426
- show: function show(dim, handler) {
427
- var dims = handler.getDimensions();
214
+ show: (dim, handler) => {
215
+ const dims = handler.getDimensions();
428
216
  return dims[0] === dim;
429
217
  },
430
218
  component: 'text',
@@ -478,15 +266,15 @@ var extDef = {
478
266
  type: 'string',
479
267
  translation: 'Object.OrgChart.NavigationMode',
480
268
  component: 'dropdown',
269
+ defaultValue: 'free',
481
270
  options: navigationOptions
482
271
  },
483
272
  resizeOnExpand: {
484
273
  ref: 'resizeOnExpand',
485
274
  type: 'boolean',
275
+ defaultValue: false,
486
276
  translation: 'Object.OrgChart.resizeOnExpand',
487
- show: function show(data) {
488
- return propertyResolver.getValue(data, 'navigationMode') !== 'expandAll';
489
- }
277
+ show: data => propertyResolver.getValue(data, 'navigationMode') !== 'expandAll'
490
278
  }
491
279
  }
492
280
  },
@@ -498,6 +286,7 @@ var extDef = {
498
286
  type: 'string',
499
287
  translation: 'Object.OrgChart.BackgroundColor',
500
288
  component: 'dropdown',
289
+ defaultValue: DEFAULTS.BACKGROUND_COLOR_TYPE,
501
290
  options: colorOptions
502
291
  },
503
292
  colorPicker: {
@@ -506,9 +295,8 @@ var extDef = {
506
295
  ref: 'style.backgroundColor.color',
507
296
  translation: 'properties.color',
508
297
  dualOutput: true,
509
- show: function show(data) {
510
- return propertyResolver.getValue(data, 'style.backgroundColor.colorType') === 'colorPicker';
511
- }
298
+ defaultValue: DEFAULTS.BACKGROUND_COLOR,
299
+ show: data => propertyResolver.getValue(data, 'style.backgroundColor.colorType') === 'colorPicker'
512
300
  },
513
301
  colorExpression: {
514
302
  component: 'string',
@@ -516,9 +304,8 @@ var extDef = {
516
304
  ref: 'style.backgroundColor.colorExpression',
517
305
  translation: 'Common.Expression',
518
306
  expression: 'optional',
519
- show: function show(data) {
520
- return propertyResolver.getValue(data, 'style.backgroundColor.colorType') === 'byExpression';
521
- }
307
+ defaultValue: '',
308
+ show: data => propertyResolver.getValue(data, 'style.backgroundColor.colorType') === 'byExpression'
522
309
  }
523
310
  }
524
311
  },
@@ -530,6 +317,7 @@ var extDef = {
530
317
  type: 'string',
531
318
  translation: 'Object.OrgChart.FontColor',
532
319
  component: 'dropdown',
320
+ defaultValue: DEFAULTS.FONT_COLOR_TYPE,
533
321
  options: colorOptions
534
322
  },
535
323
  colorPicker: {
@@ -538,9 +326,8 @@ var extDef = {
538
326
  ref: 'style.fontColor.color',
539
327
  translation: 'properties.color',
540
328
  dualOutput: true,
541
- show: function show(data) {
542
- return propertyResolver.getValue(data, 'style.fontColor.colorType') === 'colorPicker';
543
- }
329
+ defaultValue: DEFAULTS.FONT_COLOR_DARK,
330
+ show: data => propertyResolver.getValue(data, 'style.fontColor.colorType') === 'colorPicker'
544
331
  },
545
332
  colorExpression: {
546
333
  component: 'string',
@@ -548,9 +335,8 @@ var extDef = {
548
335
  ref: 'style.fontColor.colorExpression',
549
336
  translation: 'Common.Expression',
550
337
  expression: 'optional',
551
- show: function show(data) {
552
- return propertyResolver.getValue(data, 'style.fontColor.colorType') === 'byExpression';
553
- }
338
+ defaultValue: '',
339
+ show: data => propertyResolver.getValue(data, 'style.fontColor.colorType') === 'byExpression'
554
340
  }
555
341
  }
556
342
  },
@@ -566,24 +352,22 @@ var extDef = {
566
352
  type: 'boolean',
567
353
  ref: 'style.border.top',
568
354
  translation: 'Object.OrgChart.TopBar',
569
- defaultValue: true
355
+ defaultValue: DEFAULTS.BORDER_TOP
570
356
  },
571
357
  fullBorder: {
572
358
  type: 'boolean',
573
359
  ref: 'style.border.fullBorder',
574
360
  translation: 'properties.border',
575
- defaultValue: false
361
+ defaultValue: DEFAULTS.BORDER_FULL
576
362
  },
577
363
  colorType: {
578
364
  component: 'dropdown',
579
365
  type: 'string',
580
366
  ref: 'style.border.colorType',
581
367
  translation: 'properties.border.color',
582
- defaultValue: 'auto',
368
+ defaultValue: DEFAULTS.BORDER_COLOR_TYPE,
583
369
  options: colorOptions,
584
- show: function show(data) {
585
- return bordersActive(data);
586
- }
370
+ show: data => bordersActive(data)
587
371
  },
588
372
  colorPicker: {
589
373
  component: 'color-picker',
@@ -591,9 +375,8 @@ var extDef = {
591
375
  ref: 'style.border.color',
592
376
  translation: 'properties.color',
593
377
  dualOutput: true,
594
- show: function show(data) {
595
- return bordersActive(data) && propertyResolver.getValue(data, 'style.border.colorType') === 'colorPicker';
596
- }
378
+ defaultValue: DEFAULTS.BORDER_COLOR,
379
+ show: data => bordersActive(data) && propertyResolver.getValue(data, 'style.border.colorType') === 'colorPicker'
597
380
  },
598
381
  colorExpression: {
599
382
  component: 'string',
@@ -601,9 +384,8 @@ var extDef = {
601
384
  ref: 'style.border.colorExpression',
602
385
  translation: 'Common.Expression',
603
386
  expression: 'optional',
604
- show: function show(data) {
605
- return bordersActive(data) && propertyResolver.getValue(data, 'style.border.colorType') === 'byExpression';
606
- }
387
+ defaultValue: '',
388
+ show: data => bordersActive(data) && propertyResolver.getValue(data, 'style.border.colorType') === 'byExpression'
607
389
  }
608
390
  }
609
391
  }
@@ -621,20 +403,20 @@ var extDef = {
621
403
  }
622
404
  };
623
405
 
624
- function ext()
625
- /* env */
626
- {
406
+ function
407
+ /* env */
408
+ ext() {
627
409
  return extDef;
628
410
  }
629
411
 
630
- function ascending (a, b) {
412
+ function ascending$1 (a, b) {
631
413
  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
632
414
  }
633
415
 
634
416
  function bisector (compare) {
635
417
  if (compare.length === 1) compare = ascendingComparator(compare);
636
418
  return {
637
- left: function left(a, x, lo, hi) {
419
+ left: function (a, x, lo, hi) {
638
420
  if (lo == null) lo = 0;
639
421
  if (hi == null) hi = a.length;
640
422
 
@@ -645,7 +427,7 @@ function bisector (compare) {
645
427
 
646
428
  return lo;
647
429
  },
648
- right: function right(a, x, lo, hi) {
430
+ right: function (a, x, lo, hi) {
649
431
  if (lo == null) lo = 0;
650
432
  if (hi == null) hi = a.length;
651
433
 
@@ -661,14 +443,14 @@ function bisector (compare) {
661
443
 
662
444
  function ascendingComparator(f) {
663
445
  return function (d, x) {
664
- return ascending(f(d), x);
446
+ return ascending$1(f(d), x);
665
447
  };
666
448
  }
667
449
 
668
- var ascendingBisect = bisector(ascending);
450
+ bisector(ascending$1);
669
451
 
670
452
  var noop = {
671
- value: function value() {}
453
+ value: function () {}
672
454
  };
673
455
 
674
456
  function dispatch() {
@@ -684,7 +466,7 @@ function Dispatch(_) {
684
466
  this._ = _;
685
467
  }
686
468
 
687
- function parseTypenames(typenames, types) {
469
+ function parseTypenames$1(typenames, types) {
688
470
  return typenames.trim().split(/^|\s+/).map(function (t) {
689
471
  var name = "",
690
472
  i = t.indexOf(".");
@@ -699,17 +481,15 @@ function parseTypenames(typenames, types) {
699
481
 
700
482
  Dispatch.prototype = dispatch.prototype = {
701
483
  constructor: Dispatch,
702
- on: function on(typename, callback) {
484
+ on: function (typename, callback) {
703
485
  var _ = this._,
704
- T = parseTypenames(typename + "", _),
486
+ T = parseTypenames$1(typename + "", _),
705
487
  t,
706
488
  i = -1,
707
489
  n = T.length; // If no callback was specified, return the callback of the given type and name.
708
490
 
709
491
  if (arguments.length < 2) {
710
- while (++i < n) {
711
- if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
712
- }
492
+ while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_[t], typename.name))) return t;
713
493
 
714
494
  return;
715
495
  } // If a type was specified, set the callback for the given type and name.
@@ -719,43 +499,33 @@ Dispatch.prototype = dispatch.prototype = {
719
499
  if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
720
500
 
721
501
  while (++i < n) {
722
- if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback);else if (callback == null) for (t in _) {
723
- _[t] = set(_[t], typename.name, null);
724
- }
502
+ if (t = (typename = T[i]).type) _[t] = set$1(_[t], typename.name, callback);else if (callback == null) for (t in _) _[t] = set$1(_[t], typename.name, null);
725
503
  }
726
504
 
727
505
  return this;
728
506
  },
729
- copy: function copy() {
507
+ copy: function () {
730
508
  var copy = {},
731
509
  _ = this._;
732
510
 
733
- for (var t in _) {
734
- copy[t] = _[t].slice();
735
- }
511
+ for (var t in _) copy[t] = _[t].slice();
736
512
 
737
513
  return new Dispatch(copy);
738
514
  },
739
- call: function call(type, that) {
740
- if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) {
741
- args[i] = arguments[i + 2];
742
- }
515
+ call: function (type, that) {
516
+ if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2];
743
517
  if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
744
518
 
745
- for (t = this._[type], i = 0, n = t.length; i < n; ++i) {
746
- t[i].value.apply(that, args);
747
- }
519
+ for (t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
748
520
  },
749
- apply: function apply(type, that, args) {
521
+ apply: function (type, that, args) {
750
522
  if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
751
523
 
752
- for (var t = this._[type], i = 0, n = t.length; i < n; ++i) {
753
- t[i].value.apply(that, args);
754
- }
524
+ for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
755
525
  }
756
526
  };
757
527
 
758
- function get(type, name) {
528
+ function get$1(type, name) {
759
529
  for (var i = 0, n = type.length, c; i < n; ++i) {
760
530
  if ((c = type[i]).name === name) {
761
531
  return c.value;
@@ -763,7 +533,7 @@ function get(type, name) {
763
533
  }
764
534
  }
765
535
 
766
- function set(type, name, callback) {
536
+ function set$1(type, name, callback) {
767
537
  for (var i = 0, n = type.length; i < n; ++i) {
768
538
  if (type[i].name === name) {
769
539
  type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
@@ -836,7 +606,7 @@ function selection_select (select) {
836
606
  }
837
607
  }
838
608
 
839
- return new Selection(subgroups, this._parents);
609
+ return new Selection$1(subgroups, this._parents);
840
610
  }
841
611
 
842
612
  function empty() {
@@ -861,7 +631,7 @@ function selection_selectAll (select) {
861
631
  }
862
632
  }
863
633
 
864
- return new Selection(subgroups, parents);
634
+ return new Selection$1(subgroups, parents);
865
635
  }
866
636
 
867
637
  function matcher (selector) {
@@ -881,7 +651,7 @@ function selection_filter (match) {
881
651
  }
882
652
  }
883
653
 
884
- return new Selection(subgroups, this._parents);
654
+ return new Selection$1(subgroups, this._parents);
885
655
  }
886
656
 
887
657
  function sparse (update) {
@@ -889,7 +659,7 @@ function sparse (update) {
889
659
  }
890
660
 
891
661
  function selection_enter () {
892
- return new Selection(this._enter || this._groups.map(sparse), this._parents);
662
+ return new Selection$1(this._enter || this._groups.map(sparse), this._parents);
893
663
  }
894
664
  function EnterNode(parent, datum) {
895
665
  this.ownerDocument = parent.ownerDocument;
@@ -900,21 +670,21 @@ function EnterNode(parent, datum) {
900
670
  }
901
671
  EnterNode.prototype = {
902
672
  constructor: EnterNode,
903
- appendChild: function appendChild(child) {
673
+ appendChild: function (child) {
904
674
  return this._parent.insertBefore(child, this._next);
905
675
  },
906
- insertBefore: function insertBefore(child, next) {
676
+ insertBefore: function (child, next) {
907
677
  return this._parent.insertBefore(child, next);
908
678
  },
909
- querySelector: function querySelector(selector) {
679
+ querySelector: function (selector) {
910
680
  return this._parent.querySelector(selector);
911
681
  },
912
- querySelectorAll: function querySelectorAll(selector) {
682
+ querySelectorAll: function (selector) {
913
683
  return this._parent.querySelectorAll(selector);
914
684
  }
915
685
  };
916
686
 
917
- function constant (x) {
687
+ function constant$2 (x) {
918
688
  return function () {
919
689
  return x;
920
690
  };
@@ -1004,7 +774,7 @@ function selection_data (value, key) {
1004
774
  var bind = key ? bindKey : bindIndex,
1005
775
  parents = this._parents,
1006
776
  groups = this._groups;
1007
- if (typeof value !== "function") value = constant(value);
777
+ if (typeof value !== "function") value = constant$2(value);
1008
778
 
1009
779
  for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
1010
780
  var parent = parents[j],
@@ -1023,22 +793,21 @@ function selection_data (value, key) {
1023
793
  if (previous = enterGroup[i0]) {
1024
794
  if (i0 >= i1) i1 = i0 + 1;
1025
795
 
1026
- while (!(next = updateGroup[i1]) && ++i1 < dataLength) {
1027
- }
796
+ while (!(next = updateGroup[i1]) && ++i1 < dataLength);
1028
797
 
1029
798
  previous._next = next || null;
1030
799
  }
1031
800
  }
1032
801
  }
1033
802
 
1034
- update = new Selection(update, parents);
803
+ update = new Selection$1(update, parents);
1035
804
  update._enter = enter;
1036
805
  update._exit = exit;
1037
806
  return update;
1038
807
  }
1039
808
 
1040
809
  function selection_exit () {
1041
- return new Selection(this._exit || this._groups.map(sparse), this._parents);
810
+ return new Selection$1(this._exit || this._groups.map(sparse), this._parents);
1042
811
  }
1043
812
 
1044
813
  function selection_join (onenter, onupdate, onexit) {
@@ -1064,7 +833,7 @@ function selection_merge (selection) {
1064
833
  merges[j] = groups0[j];
1065
834
  }
1066
835
 
1067
- return new Selection(merges, this._parents);
836
+ return new Selection$1(merges, this._parents);
1068
837
  }
1069
838
 
1070
839
  function selection_order () {
@@ -1081,7 +850,7 @@ function selection_order () {
1081
850
  }
1082
851
 
1083
852
  function selection_sort (compare) {
1084
- if (!compare) compare = ascending$1;
853
+ if (!compare) compare = ascending;
1085
854
 
1086
855
  function compareNode(a, b) {
1087
856
  return a && b ? compare(a.__data__, b.__data__) : !a - !b;
@@ -1097,10 +866,10 @@ function selection_sort (compare) {
1097
866
  sortgroup.sort(compareNode);
1098
867
  }
1099
868
 
1100
- return new Selection(sortgroups, this._parents).order();
869
+ return new Selection$1(sortgroups, this._parents).order();
1101
870
  }
1102
871
 
1103
- function ascending$1(a, b) {
872
+ function ascending(a, b) {
1104
873
  return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
1105
874
  }
1106
875
 
@@ -1153,38 +922,38 @@ function selection_each (callback) {
1153
922
  return this;
1154
923
  }
1155
924
 
1156
- function attrRemove(name) {
925
+ function attrRemove$1(name) {
1157
926
  return function () {
1158
927
  this.removeAttribute(name);
1159
928
  };
1160
929
  }
1161
930
 
1162
- function attrRemoveNS(fullname) {
931
+ function attrRemoveNS$1(fullname) {
1163
932
  return function () {
1164
933
  this.removeAttributeNS(fullname.space, fullname.local);
1165
934
  };
1166
935
  }
1167
936
 
1168
- function attrConstant(name, value) {
937
+ function attrConstant$1(name, value) {
1169
938
  return function () {
1170
939
  this.setAttribute(name, value);
1171
940
  };
1172
941
  }
1173
942
 
1174
- function attrConstantNS(fullname, value) {
943
+ function attrConstantNS$1(fullname, value) {
1175
944
  return function () {
1176
945
  this.setAttributeNS(fullname.space, fullname.local, value);
1177
946
  };
1178
947
  }
1179
948
 
1180
- function attrFunction(name, value) {
949
+ function attrFunction$1(name, value) {
1181
950
  return function () {
1182
951
  var v = value.apply(this, arguments);
1183
952
  if (v == null) this.removeAttribute(name);else this.setAttribute(name, v);
1184
953
  };
1185
954
  }
1186
955
 
1187
- function attrFunctionNS(fullname, value) {
956
+ function attrFunctionNS$1(fullname, value) {
1188
957
  return function () {
1189
958
  var v = value.apply(this, arguments);
1190
959
  if (v == null) this.removeAttributeNS(fullname.space, fullname.local);else this.setAttributeNS(fullname.space, fullname.local, v);
@@ -1199,28 +968,28 @@ function selection_attr (name, value) {
1199
968
  return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
1200
969
  }
1201
970
 
1202
- return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
971
+ return this.each((value == null ? fullname.local ? attrRemoveNS$1 : attrRemove$1 : typeof value === "function" ? fullname.local ? attrFunctionNS$1 : attrFunction$1 : fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, value));
1203
972
  }
1204
973
 
1205
974
  function defaultView (node) {
1206
- return node.ownerDocument && node.ownerDocument.defaultView || // node is a Node
1207
- node.document && node // node is a Window
975
+ return node.ownerDocument && node.ownerDocument.defaultView // node is a Node
976
+ || node.document && node // node is a Window
1208
977
  || node.defaultView; // node is a Document
1209
978
  }
1210
979
 
1211
- function styleRemove(name) {
980
+ function styleRemove$1(name) {
1212
981
  return function () {
1213
982
  this.style.removeProperty(name);
1214
983
  };
1215
984
  }
1216
985
 
1217
- function styleConstant(name, value, priority) {
986
+ function styleConstant$1(name, value, priority) {
1218
987
  return function () {
1219
988
  this.style.setProperty(name, value, priority);
1220
989
  };
1221
990
  }
1222
991
 
1223
- function styleFunction(name, value, priority) {
992
+ function styleFunction$1(name, value, priority) {
1224
993
  return function () {
1225
994
  var v = value.apply(this, arguments);
1226
995
  if (v == null) this.style.removeProperty(name);else this.style.setProperty(name, v, priority);
@@ -1228,7 +997,7 @@ function styleFunction(name, value, priority) {
1228
997
  }
1229
998
 
1230
999
  function selection_style (name, value, priority) {
1231
- return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
1000
+ return arguments.length > 1 ? this.each((value == null ? styleRemove$1 : typeof value === "function" ? styleFunction$1 : styleConstant$1)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
1232
1001
  }
1233
1002
  function styleValue(node, name) {
1234
1003
  return node.style.getPropertyValue(name) || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
@@ -1271,7 +1040,7 @@ function ClassList(node) {
1271
1040
  }
1272
1041
 
1273
1042
  ClassList.prototype = {
1274
- add: function add(name) {
1043
+ add: function (name) {
1275
1044
  var i = this._names.indexOf(name);
1276
1045
 
1277
1046
  if (i < 0) {
@@ -1280,7 +1049,7 @@ ClassList.prototype = {
1280
1049
  this._node.setAttribute("class", this._names.join(" "));
1281
1050
  }
1282
1051
  },
1283
- remove: function remove(name) {
1052
+ remove: function (name) {
1284
1053
  var i = this._names.indexOf(name);
1285
1054
 
1286
1055
  if (i >= 0) {
@@ -1289,7 +1058,7 @@ ClassList.prototype = {
1289
1058
  this._node.setAttribute("class", this._names.join(" "));
1290
1059
  }
1291
1060
  },
1292
- contains: function contains(name) {
1061
+ contains: function (name) {
1293
1062
  return this._names.indexOf(name) >= 0;
1294
1063
  }
1295
1064
  };
@@ -1299,9 +1068,7 @@ function classedAdd(node, names) {
1299
1068
  i = -1,
1300
1069
  n = names.length;
1301
1070
 
1302
- while (++i < n) {
1303
- list.add(names[i]);
1304
- }
1071
+ while (++i < n) list.add(names[i]);
1305
1072
  }
1306
1073
 
1307
1074
  function classedRemove(node, names) {
@@ -1309,9 +1076,7 @@ function classedRemove(node, names) {
1309
1076
  i = -1,
1310
1077
  n = names.length;
1311
1078
 
1312
- while (++i < n) {
1313
- list.remove(names[i]);
1314
- }
1079
+ while (++i < n) list.remove(names[i]);
1315
1080
  }
1316
1081
 
1317
1082
  function classedTrue(names) {
@@ -1340,9 +1105,7 @@ function selection_classed (name, value) {
1340
1105
  i = -1,
1341
1106
  n = names.length;
1342
1107
 
1343
- while (++i < n) {
1344
- if (!list.contains(names[i])) return false;
1345
- }
1108
+ while (++i < n) if (!list.contains(names[i])) return false;
1346
1109
 
1347
1110
  return true;
1348
1111
  }
@@ -1354,13 +1117,13 @@ function textRemove() {
1354
1117
  this.textContent = "";
1355
1118
  }
1356
1119
 
1357
- function textConstant(value) {
1120
+ function textConstant$1(value) {
1358
1121
  return function () {
1359
1122
  this.textContent = value;
1360
1123
  };
1361
1124
  }
1362
1125
 
1363
- function textFunction(value) {
1126
+ function textFunction$1(value) {
1364
1127
  return function () {
1365
1128
  var v = value.apply(this, arguments);
1366
1129
  this.textContent = v == null ? "" : v;
@@ -1368,7 +1131,7 @@ function textFunction(value) {
1368
1131
  }
1369
1132
 
1370
1133
  function selection_text (value) {
1371
- return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
1134
+ return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction$1 : textConstant$1)(value)) : this.node().textContent;
1372
1135
  }
1373
1136
 
1374
1137
  function htmlRemove() {
@@ -1495,7 +1258,7 @@ function contextListener(listener, index, group) {
1495
1258
  };
1496
1259
  }
1497
1260
 
1498
- function parseTypenames$1(typenames) {
1261
+ function parseTypenames(typenames) {
1499
1262
  return typenames.trim().split(/^|\s+/).map(function (t) {
1500
1263
  var name = "",
1501
1264
  i = t.indexOf(".");
@@ -1551,7 +1314,7 @@ function onAdd(typename, value, capture) {
1551
1314
  }
1552
1315
 
1553
1316
  function selection_on (typename, value, capture) {
1554
- var typenames = parseTypenames$1(typename + ""),
1317
+ var typenames = parseTypenames(typename + ""),
1555
1318
  i,
1556
1319
  n = typenames.length,
1557
1320
  t;
@@ -1572,9 +1335,7 @@ function selection_on (typename, value, capture) {
1572
1335
  on = value ? onAdd : onRemove;
1573
1336
  if (capture == null) capture = false;
1574
1337
 
1575
- for (i = 0; i < n; ++i) {
1576
- this.each(on(typenames[i], value, capture));
1577
- }
1338
+ for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
1578
1339
 
1579
1340
  return this;
1580
1341
  }
@@ -1621,17 +1382,17 @@ function selection_dispatch (type, params) {
1621
1382
  }
1622
1383
 
1623
1384
  var root = [null];
1624
- function Selection(groups, parents) {
1385
+ function Selection$1(groups, parents) {
1625
1386
  this._groups = groups;
1626
1387
  this._parents = parents;
1627
1388
  }
1628
1389
 
1629
1390
  function selection() {
1630
- return new Selection([[document.documentElement]], root);
1391
+ return new Selection$1([[document.documentElement]], root);
1631
1392
  }
1632
1393
 
1633
- Selection.prototype = selection.prototype = {
1634
- constructor: Selection,
1394
+ Selection$1.prototype = selection.prototype = {
1395
+ constructor: Selection$1,
1635
1396
  select: selection_select,
1636
1397
  selectAll: selection_selectAll,
1637
1398
  filter: selection_filter,
@@ -1666,16 +1427,14 @@ Selection.prototype = selection.prototype = {
1666
1427
  };
1667
1428
 
1668
1429
  function select (selector) {
1669
- return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
1430
+ return typeof selector === "string" ? new Selection$1([[document.querySelector(selector)]], [document.documentElement]) : new Selection$1([[selector]], root);
1670
1431
  }
1671
1432
 
1672
1433
  function sourceEvent () {
1673
1434
  var current = event$1,
1674
1435
  source;
1675
1436
 
1676
- while (source = current.sourceEvent) {
1677
- current = source;
1678
- }
1437
+ while (source = current.sourceEvent) current = source;
1679
1438
 
1680
1439
  return current;
1681
1440
  }
@@ -1712,17 +1471,17 @@ function touch (node, touches, identifier) {
1712
1471
  return null;
1713
1472
  }
1714
1473
 
1715
- function noevent () {
1474
+ function noevent$1 () {
1716
1475
  event$1.preventDefault();
1717
1476
  event$1.stopImmediatePropagation();
1718
1477
  }
1719
1478
 
1720
1479
  function dragDisable (view) {
1721
1480
  var root = view.document.documentElement,
1722
- selection = select(view).on("dragstart.drag", noevent, true);
1481
+ selection = select(view).on("dragstart.drag", noevent$1, true);
1723
1482
 
1724
1483
  if ("onselectstart" in root) {
1725
- selection.on("selectstart.drag", noevent, true);
1484
+ selection.on("selectstart.drag", noevent$1, true);
1726
1485
  } else {
1727
1486
  root.__noselect = root.style.MozUserSelect;
1728
1487
  root.style.MozUserSelect = "none";
@@ -1733,7 +1492,7 @@ function yesdrag(view, noclick) {
1733
1492
  selection = select(view).on("dragstart.drag", null);
1734
1493
 
1735
1494
  if (noclick) {
1736
- selection.on("click.drag", noevent, true);
1495
+ selection.on("click.drag", noevent$1, true);
1737
1496
  setTimeout(function () {
1738
1497
  selection.on("click.drag", null);
1739
1498
  }, 0);
@@ -1754,17 +1513,14 @@ function define (constructor, factory, prototype) {
1754
1513
  function extend(parent, definition) {
1755
1514
  var prototype = Object.create(parent.prototype);
1756
1515
 
1757
- for (var key in definition) {
1758
- prototype[key] = definition[key];
1759
- }
1516
+ for (var key in definition) prototype[key] = definition[key];
1760
1517
 
1761
1518
  return prototype;
1762
1519
  }
1763
1520
 
1764
1521
  function Color() {}
1765
- var _darker = 0.7;
1766
-
1767
- var _brighter = 1 / _darker;
1522
+ var darker = 0.7;
1523
+ var brighter = 1 / darker;
1768
1524
  var reI = "\\s*([+-]?\\d+)\\s*",
1769
1525
  reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
1770
1526
  reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
@@ -1926,10 +1682,10 @@ var named = {
1926
1682
  yellowgreen: 0x9acd32
1927
1683
  };
1928
1684
  define(Color, color, {
1929
- copy: function copy(channels) {
1685
+ copy: function (channels) {
1930
1686
  return Object.assign(new this.constructor(), this, channels);
1931
1687
  },
1932
- displayable: function displayable() {
1688
+ displayable: function () {
1933
1689
  return this.rgb().displayable();
1934
1690
  },
1935
1691
  hex: color_formatHex,
@@ -1995,18 +1751,18 @@ function Rgb(r, g, b, opacity) {
1995
1751
  this.opacity = +opacity;
1996
1752
  }
1997
1753
  define(Rgb, rgb, extend(Color, {
1998
- brighter: function brighter(k) {
1999
- k = k == null ? _brighter : Math.pow(_brighter, k);
1754
+ brighter: function (k) {
1755
+ k = k == null ? brighter : Math.pow(brighter, k);
2000
1756
  return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
2001
1757
  },
2002
- darker: function darker(k) {
2003
- k = k == null ? _darker : Math.pow(_darker, k);
1758
+ darker: function (k) {
1759
+ k = k == null ? darker : Math.pow(darker, k);
2004
1760
  return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
2005
1761
  },
2006
- rgb: function rgb() {
1762
+ rgb: function () {
2007
1763
  return this;
2008
1764
  },
2009
- displayable: function displayable() {
1765
+ displayable: function () {
2010
1766
  return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
2011
1767
  },
2012
1768
  hex: rgb_formatHex,
@@ -2073,15 +1829,15 @@ function Hsl(h, s, l, opacity) {
2073
1829
  }
2074
1830
 
2075
1831
  define(Hsl, hsl, extend(Color, {
2076
- brighter: function brighter(k) {
2077
- k = k == null ? _brighter : Math.pow(_brighter, k);
1832
+ brighter: function (k) {
1833
+ k = k == null ? brighter : Math.pow(brighter, k);
2078
1834
  return new Hsl(this.h, this.s, this.l * k, this.opacity);
2079
1835
  },
2080
- darker: function darker(k) {
2081
- k = k == null ? _darker : Math.pow(_darker, k);
1836
+ darker: function (k) {
1837
+ k = k == null ? darker : Math.pow(darker, k);
2082
1838
  return new Hsl(this.h, this.s, this.l * k, this.opacity);
2083
1839
  },
2084
- rgb: function rgb() {
1840
+ rgb: function () {
2085
1841
  var h = this.h % 360 + (this.h < 0) * 360,
2086
1842
  s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
2087
1843
  l = this.l,
@@ -2089,10 +1845,10 @@ define(Hsl, hsl, extend(Color, {
2089
1845
  m1 = 2 * l - m2;
2090
1846
  return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
2091
1847
  },
2092
- displayable: function displayable() {
1848
+ displayable: function () {
2093
1849
  return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
2094
1850
  },
2095
- formatHsl: function formatHsl() {
1851
+ formatHsl: function () {
2096
1852
  var a = this.opacity;
2097
1853
  a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
2098
1854
  return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")");
@@ -2225,16 +1981,14 @@ function interpolateString (a, b) {
2225
1981
 
2226
1982
 
2227
1983
  return s.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function (t) {
2228
- for (var i = 0, o; i < b; ++i) {
2229
- s[(o = q[i]).i] = o.x(t);
2230
- }
1984
+ for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
2231
1985
 
2232
1986
  return s.join("");
2233
1987
  });
2234
1988
  }
2235
1989
 
2236
1990
  var degrees = 180 / Math.PI;
2237
- var identity = {
1991
+ var identity$1 = {
2238
1992
  translateX: 0,
2239
1993
  translateY: 0,
2240
1994
  rotate: 0,
@@ -2260,7 +2014,7 @@ function decompose (a, b, c, d, e, f) {
2260
2014
 
2261
2015
  var cssNode, cssRoot, cssView, svgNode;
2262
2016
  function parseCss(value) {
2263
- if (value === "none") return identity;
2017
+ if (value === "none") return identity$1;
2264
2018
  if (!cssNode) cssNode = document.createElement("DIV"), cssRoot = document.documentElement, cssView = document.defaultView;
2265
2019
  cssNode.style.transform = value;
2266
2020
  value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform");
@@ -2269,10 +2023,10 @@ function parseCss(value) {
2269
2023
  return decompose(+value[0], +value[1], +value[2], +value[3], +value[4], +value[5]);
2270
2024
  }
2271
2025
  function parseSvg(value) {
2272
- if (value == null) return identity;
2026
+ if (value == null) return identity$1;
2273
2027
  if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
2274
2028
  svgNode.setAttribute("transform", value);
2275
- if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
2029
+ if (!(value = svgNode.transform.baseVal.consolidate())) return identity$1;
2276
2030
  value = value.matrix;
2277
2031
  return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
2278
2032
  }
@@ -2353,9 +2107,7 @@ function interpolateTransform(parse, pxComma, pxParen, degParen) {
2353
2107
  n = q.length,
2354
2108
  o;
2355
2109
 
2356
- while (++i < n) {
2357
- s[(o = q[i]).i] = o.x(t);
2358
- }
2110
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
2359
2111
 
2360
2112
  return s.join("");
2361
2113
  };
@@ -2400,25 +2152,25 @@ function interpolateZoom (p0, p1) {
2400
2152
  if (d2 < epsilon2) {
2401
2153
  S = Math.log(w1 / w0) / rho;
2402
2154
 
2403
- i = function i(t) {
2155
+ i = function (t) {
2404
2156
  return [ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S)];
2405
2157
  };
2406
2158
  } // General case.
2407
2159
  else {
2408
- var d1 = Math.sqrt(d2),
2409
- b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
2410
- b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
2411
- r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
2412
- r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
2413
- S = (r1 - r0) / rho;
2414
-
2415
- i = function i(t) {
2416
- var s = t * S,
2417
- coshr0 = cosh(r0),
2418
- u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
2419
- return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)];
2420
- };
2421
- }
2160
+ var d1 = Math.sqrt(d2),
2161
+ b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
2162
+ b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
2163
+ r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
2164
+ r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
2165
+ S = (r1 - r0) / rho;
2166
+
2167
+ i = function (t) {
2168
+ var s = t * S,
2169
+ coshr0 = cosh(r0),
2170
+ u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
2171
+ return [ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0)];
2172
+ };
2173
+ }
2422
2174
 
2423
2175
  i.duration = S * 1000;
2424
2176
  return i;
@@ -2426,7 +2178,7 @@ function interpolateZoom (p0, p1) {
2426
2178
 
2427
2179
  var frame = 0,
2428
2180
  // is an animation frame pending?
2429
- timeout = 0,
2181
+ timeout$1 = 0,
2430
2182
  // is a timeout pending?
2431
2183
  interval = 0,
2432
2184
  // are any timers active?
@@ -2437,8 +2189,8 @@ taskHead,
2437
2189
  clockLast = 0,
2438
2190
  clockNow = 0,
2439
2191
  clockSkew = 0,
2440
- clock = (typeof performance === "undefined" ? "undefined" : _typeof(performance)) === "object" && performance.now ? performance : Date,
2441
- setFrame = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (f) {
2192
+ clock = typeof performance === "object" && performance.now ? performance : Date,
2193
+ setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function (f) {
2442
2194
  setTimeout(f, 17);
2443
2195
  };
2444
2196
  function now() {
@@ -2454,7 +2206,7 @@ function Timer() {
2454
2206
  }
2455
2207
  Timer.prototype = timer.prototype = {
2456
2208
  constructor: Timer,
2457
- restart: function restart(callback, delay, time) {
2209
+ restart: function (callback, delay, time) {
2458
2210
  if (typeof callback !== "function") throw new TypeError("callback is not a function");
2459
2211
  time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
2460
2212
 
@@ -2467,7 +2219,7 @@ Timer.prototype = timer.prototype = {
2467
2219
  this._time = time;
2468
2220
  sleep();
2469
2221
  },
2470
- stop: function stop() {
2222
+ stop: function () {
2471
2223
  if (this._call) {
2472
2224
  this._call = null;
2473
2225
  this._time = Infinity;
@@ -2498,7 +2250,7 @@ function timerFlush() {
2498
2250
 
2499
2251
  function wake() {
2500
2252
  clockNow = (clockLast = clock.now()) + clockSkew;
2501
- frame = timeout = 0;
2253
+ frame = timeout$1 = 0;
2502
2254
 
2503
2255
  try {
2504
2256
  timerFlush();
@@ -2538,11 +2290,11 @@ function nap() {
2538
2290
  function sleep(time) {
2539
2291
  if (frame) return; // Soonest alarm already set, or will be.
2540
2292
 
2541
- if (timeout) timeout = clearTimeout(timeout);
2293
+ if (timeout$1) timeout$1 = clearTimeout(timeout$1);
2542
2294
  var delay = time - clockNow; // Strictly less than if we recomputed clockNow.
2543
2295
 
2544
2296
  if (delay > 24) {
2545
- if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
2297
+ if (time < Infinity) timeout$1 = setTimeout(wake, time - clock.now() - clockSkew);
2546
2298
  if (interval) interval = clearInterval(interval);
2547
2299
  } else {
2548
2300
  if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
@@ -2550,7 +2302,7 @@ function sleep(time) {
2550
2302
  }
2551
2303
  }
2552
2304
 
2553
- function timeout$1 (callback, delay, time) {
2305
+ function timeout (callback, delay, time) {
2554
2306
  var t = new Timer();
2555
2307
  delay = delay == null ? 0 : +delay;
2556
2308
  t.restart(function (elapsed) {
@@ -2589,16 +2341,16 @@ function schedule (node, name, id, index, group, timing) {
2589
2341
  });
2590
2342
  }
2591
2343
  function init(node, id) {
2592
- var schedule = get$1(node, id);
2344
+ var schedule = get(node, id);
2593
2345
  if (schedule.state > CREATED) throw new Error("too late; already scheduled");
2594
2346
  return schedule;
2595
2347
  }
2596
- function set$1(node, id) {
2597
- var schedule = get$1(node, id);
2348
+ function set(node, id) {
2349
+ var schedule = get(node, id);
2598
2350
  if (schedule.state > STARTED) throw new Error("too late; already running");
2599
2351
  return schedule;
2600
2352
  }
2601
- function get$1(node, id) {
2353
+ function get(node, id) {
2602
2354
  var schedule = node.__transition;
2603
2355
  if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
2604
2356
  return schedule;
@@ -2630,7 +2382,7 @@ function create(node, id, self) {
2630
2382
  // defer starting an interrupting transition until that transition has a
2631
2383
  // chance to tick (and possibly end); see d3/d3-transition#54!
2632
2384
 
2633
- if (o.state === STARTED) return timeout$1(start); // Interrupt the active transition, if any.
2385
+ if (o.state === STARTED) return timeout(start); // Interrupt the active transition, if any.
2634
2386
 
2635
2387
  if (o.state === RUNNING) {
2636
2388
  o.state = ENDED;
@@ -2639,18 +2391,18 @@ function create(node, id, self) {
2639
2391
  delete schedules[i];
2640
2392
  } // Cancel any pre-empted transitions.
2641
2393
  else if (+i < id) {
2642
- o.state = ENDED;
2643
- o.timer.stop();
2644
- o.on.call("cancel", node, node.__data__, o.index, o.group);
2645
- delete schedules[i];
2646
- }
2394
+ o.state = ENDED;
2395
+ o.timer.stop();
2396
+ o.on.call("cancel", node, node.__data__, o.index, o.group);
2397
+ delete schedules[i];
2398
+ }
2647
2399
  } // Defer the first tick to end of the current frame; see d3/d3#1576.
2648
2400
  // Note the transition may be canceled after start and before the first tick!
2649
2401
  // Note this must be scheduled before the start event; see d3/d3-transition#16!
2650
2402
  // Assuming this is successful, subsequent callbacks go straight to tick.
2651
2403
 
2652
2404
 
2653
- timeout$1(function () {
2405
+ timeout(function () {
2654
2406
  if (self.state === STARTED) {
2655
2407
  self.state = RUNNING;
2656
2408
  self.timer.restart(tick, self.delay, self.time);
@@ -2697,9 +2449,7 @@ function create(node, id, self) {
2697
2449
  self.timer.stop();
2698
2450
  delete schedules[id];
2699
2451
 
2700
- for (var i in schedules) {
2701
- return;
2702
- } // eslint-disable-line no-unused-vars
2452
+ for (var i in schedules) return; // eslint-disable-line no-unused-vars
2703
2453
 
2704
2454
 
2705
2455
  delete node.__transition;
@@ -2740,7 +2490,7 @@ function selection_interrupt (name) {
2740
2490
  function tweenRemove(id, name) {
2741
2491
  var tween0, tween1;
2742
2492
  return function () {
2743
- var schedule = set$1(this, id),
2493
+ var schedule = set(this, id),
2744
2494
  tween = schedule.tween; // If this node shared tween with the previous node,
2745
2495
  // just assign the updated shared tween and we’re done!
2746
2496
  // Otherwise, copy-on-write.
@@ -2765,7 +2515,7 @@ function tweenFunction(id, name, value) {
2765
2515
  var tween0, tween1;
2766
2516
  if (typeof value !== "function") throw new Error();
2767
2517
  return function () {
2768
- var schedule = set$1(this, id),
2518
+ var schedule = set(this, id),
2769
2519
  tween = schedule.tween; // If this node shared tween with the previous node,
2770
2520
  // just assign the updated shared tween and we’re done!
2771
2521
  // Otherwise, copy-on-write.
@@ -2795,7 +2545,7 @@ function transition_tween (name, value) {
2795
2545
  name += "";
2796
2546
 
2797
2547
  if (arguments.length < 2) {
2798
- var tween = get$1(this.node(), id).tween;
2548
+ var tween = get(this.node(), id).tween;
2799
2549
 
2800
2550
  for (var i = 0, n = tween.length, t; i < n; ++i) {
2801
2551
  if ((t = tween[i]).name === name) {
@@ -2811,11 +2561,11 @@ function transition_tween (name, value) {
2811
2561
  function tweenValue(transition, name, value) {
2812
2562
  var id = transition._id;
2813
2563
  transition.each(function () {
2814
- var schedule = set$1(this, id);
2564
+ var schedule = set(this, id);
2815
2565
  (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
2816
2566
  });
2817
2567
  return function (node) {
2818
- return get$1(node, id).value[name];
2568
+ return get(node, id).value[name];
2819
2569
  };
2820
2570
  }
2821
2571
 
@@ -2824,19 +2574,19 @@ function interpolate (a, b) {
2824
2574
  return (typeof b === "number" ? interpolateNumber : b instanceof color ? interpolateRgb : (c = color(b)) ? (b = c, interpolateRgb) : interpolateString)(a, b);
2825
2575
  }
2826
2576
 
2827
- function attrRemove$1(name) {
2577
+ function attrRemove(name) {
2828
2578
  return function () {
2829
2579
  this.removeAttribute(name);
2830
2580
  };
2831
2581
  }
2832
2582
 
2833
- function attrRemoveNS$1(fullname) {
2583
+ function attrRemoveNS(fullname) {
2834
2584
  return function () {
2835
2585
  this.removeAttributeNS(fullname.space, fullname.local);
2836
2586
  };
2837
2587
  }
2838
2588
 
2839
- function attrConstant$1(name, interpolate, value1) {
2589
+ function attrConstant(name, interpolate, value1) {
2840
2590
  var string00,
2841
2591
  string1 = value1 + "",
2842
2592
  interpolate0;
@@ -2846,7 +2596,7 @@ function attrConstant$1(name, interpolate, value1) {
2846
2596
  };
2847
2597
  }
2848
2598
 
2849
- function attrConstantNS$1(fullname, interpolate, value1) {
2599
+ function attrConstantNS(fullname, interpolate, value1) {
2850
2600
  var string00,
2851
2601
  string1 = value1 + "",
2852
2602
  interpolate0;
@@ -2856,7 +2606,7 @@ function attrConstantNS$1(fullname, interpolate, value1) {
2856
2606
  };
2857
2607
  }
2858
2608
 
2859
- function attrFunction$1(name, interpolate, value) {
2609
+ function attrFunction(name, interpolate, value) {
2860
2610
  var string00, string10, interpolate0;
2861
2611
  return function () {
2862
2612
  var string0,
@@ -2869,7 +2619,7 @@ function attrFunction$1(name, interpolate, value) {
2869
2619
  };
2870
2620
  }
2871
2621
 
2872
- function attrFunctionNS$1(fullname, interpolate, value) {
2622
+ function attrFunctionNS(fullname, interpolate, value) {
2873
2623
  var string00, string10, interpolate0;
2874
2624
  return function () {
2875
2625
  var string0,
@@ -2885,7 +2635,7 @@ function attrFunctionNS$1(fullname, interpolate, value) {
2885
2635
  function transition_attr (name, value) {
2886
2636
  var fullname = namespace(name),
2887
2637
  i = fullname === "transform" ? interpolateTransformSvg : interpolate;
2888
- return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS$1 : attrFunction$1)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS$1 : attrRemove$1)(fullname) : (fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, i, value));
2638
+ return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname) : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value));
2889
2639
  }
2890
2640
 
2891
2641
  function attrInterpolate(name, i) {
@@ -2949,36 +2699,36 @@ function delayConstant(id, value) {
2949
2699
 
2950
2700
  function transition_delay (value) {
2951
2701
  var id = this._id;
2952
- return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get$1(this.node(), id).delay;
2702
+ return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id, value)) : get(this.node(), id).delay;
2953
2703
  }
2954
2704
 
2955
2705
  function durationFunction(id, value) {
2956
2706
  return function () {
2957
- set$1(this, id).duration = +value.apply(this, arguments);
2707
+ set(this, id).duration = +value.apply(this, arguments);
2958
2708
  };
2959
2709
  }
2960
2710
 
2961
2711
  function durationConstant(id, value) {
2962
2712
  return value = +value, function () {
2963
- set$1(this, id).duration = value;
2713
+ set(this, id).duration = value;
2964
2714
  };
2965
2715
  }
2966
2716
 
2967
2717
  function transition_duration (value) {
2968
2718
  var id = this._id;
2969
- return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get$1(this.node(), id).duration;
2719
+ return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id, value)) : get(this.node(), id).duration;
2970
2720
  }
2971
2721
 
2972
2722
  function easeConstant(id, value) {
2973
2723
  if (typeof value !== "function") throw new Error();
2974
2724
  return function () {
2975
- set$1(this, id).ease = value;
2725
+ set(this, id).ease = value;
2976
2726
  };
2977
2727
  }
2978
2728
 
2979
2729
  function transition_ease (value) {
2980
2730
  var id = this._id;
2981
- return arguments.length ? this.each(easeConstant(id, value)) : get$1(this.node(), id).ease;
2731
+ return arguments.length ? this.each(easeConstant(id, value)) : get(this.node(), id).ease;
2982
2732
  }
2983
2733
 
2984
2734
  function transition_filter (match) {
@@ -3024,7 +2774,7 @@ function start(name) {
3024
2774
  function onFunction(id, name, listener) {
3025
2775
  var on0,
3026
2776
  on1,
3027
- sit = start(name) ? init : set$1;
2777
+ sit = start(name) ? init : set;
3028
2778
  return function () {
3029
2779
  var schedule = sit(this, id),
3030
2780
  on = schedule.on; // If this node shared a dispatch with the previous node,
@@ -3038,16 +2788,14 @@ function onFunction(id, name, listener) {
3038
2788
 
3039
2789
  function transition_on (name, listener) {
3040
2790
  var id = this._id;
3041
- return arguments.length < 2 ? get$1(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
2791
+ return arguments.length < 2 ? get(this.node(), id).on.on(name) : this.each(onFunction(id, name, listener));
3042
2792
  }
3043
2793
 
3044
2794
  function removeFunction(id) {
3045
2795
  return function () {
3046
2796
  var parent = this.parentNode;
3047
2797
 
3048
- for (var i in this.__transition) {
3049
- if (+i !== id) return;
3050
- }
2798
+ for (var i in this.__transition) if (+i !== id) return;
3051
2799
 
3052
2800
  if (parent) parent.removeChild(this);
3053
2801
  };
@@ -3067,7 +2815,7 @@ function transition_select (select) {
3067
2815
  if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {
3068
2816
  if ("__data__" in node) subnode.__data__ = node.__data__;
3069
2817
  subgroup[i] = subnode;
3070
- schedule(subgroup[i], name, id, i, subgroup, get$1(node, id));
2818
+ schedule(subgroup[i], name, id, i, subgroup, get(node, id));
3071
2819
  }
3072
2820
  }
3073
2821
  }
@@ -3083,7 +2831,7 @@ function transition_selectAll (select) {
3083
2831
  for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {
3084
2832
  for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
3085
2833
  if (node = group[i]) {
3086
- for (var children = select.call(node, node.__data__, i, group), child, inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) {
2834
+ for (var children = select.call(node, node.__data__, i, group), child, inherit = get(node, id), k = 0, l = children.length; k < l; ++k) {
3087
2835
  if (child = children[k]) {
3088
2836
  schedule(child, name, id, k, children, inherit);
3089
2837
  }
@@ -3098,9 +2846,9 @@ function transition_selectAll (select) {
3098
2846
  return new Transition(subgroups, parents, name, id);
3099
2847
  }
3100
2848
 
3101
- var Selection$1 = selection.prototype.constructor;
2849
+ var Selection = selection.prototype.constructor;
3102
2850
  function transition_selection () {
3103
- return new Selection$1(this._groups, this._parents);
2851
+ return new Selection(this._groups, this._parents);
3104
2852
  }
3105
2853
 
3106
2854
  function styleNull(name, interpolate) {
@@ -3112,13 +2860,13 @@ function styleNull(name, interpolate) {
3112
2860
  };
3113
2861
  }
3114
2862
 
3115
- function styleRemove$1(name) {
2863
+ function styleRemove(name) {
3116
2864
  return function () {
3117
2865
  this.style.removeProperty(name);
3118
2866
  };
3119
2867
  }
3120
2868
 
3121
- function styleConstant$1(name, interpolate, value1) {
2869
+ function styleConstant(name, interpolate, value1) {
3122
2870
  var string00,
3123
2871
  string1 = value1 + "",
3124
2872
  interpolate0;
@@ -3128,7 +2876,7 @@ function styleConstant$1(name, interpolate, value1) {
3128
2876
  };
3129
2877
  }
3130
2878
 
3131
- function styleFunction$1(name, interpolate, value) {
2879
+ function styleFunction(name, interpolate, value) {
3132
2880
  var string00, string10, interpolate0;
3133
2881
  return function () {
3134
2882
  var string0 = styleValue(this, name),
@@ -3147,9 +2895,9 @@ function styleMaybeRemove(id, name) {
3147
2895
  event = "end." + key,
3148
2896
  remove;
3149
2897
  return function () {
3150
- var schedule = set$1(this, id),
2898
+ var schedule = set(this, id),
3151
2899
  on = schedule.on,
3152
- listener = schedule.value[key] == null ? remove || (remove = styleRemove$1(name)) : undefined; // If this node shared a dispatch with the previous node,
2900
+ listener = schedule.value[key] == null ? remove || (remove = styleRemove(name)) : undefined; // If this node shared a dispatch with the previous node,
3153
2901
  // just assign the updated shared dispatch and we’re done!
3154
2902
  // Otherwise, copy-on-write.
3155
2903
 
@@ -3160,7 +2908,7 @@ function styleMaybeRemove(id, name) {
3160
2908
 
3161
2909
  function transition_style (name, value, priority) {
3162
2910
  var i = (name += "") === "transform" ? interpolateTransformCss : interpolate;
3163
- return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove$1(name)) : typeof value === "function" ? this.styleTween(name, styleFunction$1(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant$1(name, i, value), priority).on("end.style." + name, null);
2911
+ return value == null ? this.styleTween(name, styleNull(name, i)).on("end.style." + name, styleRemove(name)) : typeof value === "function" ? this.styleTween(name, styleFunction(name, i, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant(name, i, value), priority).on("end.style." + name, null);
3164
2912
  }
3165
2913
 
3166
2914
  function styleInterpolate(name, i, priority) {
@@ -3190,13 +2938,13 @@ function transition_styleTween (name, value, priority) {
3190
2938
  return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
3191
2939
  }
3192
2940
 
3193
- function textConstant$1(value) {
2941
+ function textConstant(value) {
3194
2942
  return function () {
3195
2943
  this.textContent = value;
3196
2944
  };
3197
2945
  }
3198
2946
 
3199
- function textFunction$1(value) {
2947
+ function textFunction(value) {
3200
2948
  return function () {
3201
2949
  var value1 = value(this);
3202
2950
  this.textContent = value1 == null ? "" : value1;
@@ -3204,7 +2952,7 @@ function textFunction$1(value) {
3204
2952
  }
3205
2953
 
3206
2954
  function transition_text (value) {
3207
- return this.tween("text", typeof value === "function" ? textFunction$1(tweenValue(this, "text", value)) : textConstant$1(value == null ? "" : value + ""));
2955
+ return this.tween("text", typeof value === "function" ? textFunction(tweenValue(this, "text", value)) : textConstant(value == null ? "" : value + ""));
3208
2956
  }
3209
2957
 
3210
2958
  function textInterpolate(i) {
@@ -3242,7 +2990,7 @@ function transition_transition () {
3242
2990
  for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) {
3243
2991
  for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {
3244
2992
  if (node = group[i]) {
3245
- var inherit = get$1(node, id0);
2993
+ var inherit = get(node, id0);
3246
2994
  schedule(node, name, id1, i, group, {
3247
2995
  time: inherit.time + inherit.delay + inherit.duration,
3248
2996
  delay: 0,
@@ -3267,12 +3015,12 @@ function transition_end () {
3267
3015
  value: reject
3268
3016
  },
3269
3017
  end = {
3270
- value: function value() {
3018
+ value: function () {
3271
3019
  if (--size === 0) resolve();
3272
3020
  }
3273
3021
  };
3274
3022
  that.each(function () {
3275
- var schedule = set$1(this, id),
3023
+ var schedule = set(this, id),
3276
3024
  on = schedule.on; // If this node shared a dispatch with the previous node,
3277
3025
  // just assign the updated shared dispatch and we’re done!
3278
3026
  // Otherwise, copy-on-write.
@@ -3299,14 +3047,11 @@ function Transition(groups, parents, name, id) {
3299
3047
  this._name = name;
3300
3048
  this._id = id;
3301
3049
  }
3302
- function transition(name) {
3303
- return selection().transition(name);
3304
- }
3305
3050
  function newId() {
3306
3051
  return ++id;
3307
3052
  }
3308
3053
  var selection_prototype = selection.prototype;
3309
- Transition.prototype = transition.prototype = {
3054
+ Transition.prototype = {
3310
3055
  constructor: Transition,
3311
3056
  select: transition_select,
3312
3057
  selectAll: transition_selectAll,
@@ -3388,75 +3133,61 @@ function Map() {}
3388
3133
 
3389
3134
  Map.prototype = map.prototype = {
3390
3135
  constructor: Map,
3391
- has: function has(key) {
3136
+ has: function (key) {
3392
3137
  return prefix + key in this;
3393
3138
  },
3394
- get: function get(key) {
3139
+ get: function (key) {
3395
3140
  return this[prefix + key];
3396
3141
  },
3397
- set: function set(key, value) {
3142
+ set: function (key, value) {
3398
3143
  this[prefix + key] = value;
3399
3144
  return this;
3400
3145
  },
3401
- remove: function remove(key) {
3146
+ remove: function (key) {
3402
3147
  var property = prefix + key;
3403
3148
  return property in this && delete this[property];
3404
3149
  },
3405
- clear: function clear() {
3406
- for (var property in this) {
3407
- if (property[0] === prefix) delete this[property];
3408
- }
3150
+ clear: function () {
3151
+ for (var property in this) if (property[0] === prefix) delete this[property];
3409
3152
  },
3410
- keys: function keys() {
3153
+ keys: function () {
3411
3154
  var keys = [];
3412
3155
 
3413
- for (var property in this) {
3414
- if (property[0] === prefix) keys.push(property.slice(1));
3415
- }
3156
+ for (var property in this) if (property[0] === prefix) keys.push(property.slice(1));
3416
3157
 
3417
3158
  return keys;
3418
3159
  },
3419
- values: function values() {
3160
+ values: function () {
3420
3161
  var values = [];
3421
3162
 
3422
- for (var property in this) {
3423
- if (property[0] === prefix) values.push(this[property]);
3424
- }
3163
+ for (var property in this) if (property[0] === prefix) values.push(this[property]);
3425
3164
 
3426
3165
  return values;
3427
3166
  },
3428
- entries: function entries() {
3167
+ entries: function () {
3429
3168
  var entries = [];
3430
3169
 
3431
- for (var property in this) {
3432
- if (property[0] === prefix) entries.push({
3433
- key: property.slice(1),
3434
- value: this[property]
3435
- });
3436
- }
3170
+ for (var property in this) if (property[0] === prefix) entries.push({
3171
+ key: property.slice(1),
3172
+ value: this[property]
3173
+ });
3437
3174
 
3438
3175
  return entries;
3439
3176
  },
3440
- size: function size() {
3177
+ size: function () {
3441
3178
  var size = 0;
3442
3179
 
3443
- for (var property in this) {
3444
- if (property[0] === prefix) ++size;
3445
- }
3180
+ for (var property in this) if (property[0] === prefix) ++size;
3446
3181
 
3447
3182
  return size;
3448
3183
  },
3449
- empty: function empty() {
3450
- for (var property in this) {
3451
- if (property[0] === prefix) return false;
3452
- }
3184
+ empty: function () {
3185
+ for (var property in this) if (property[0] === prefix) return false;
3453
3186
 
3454
3187
  return true;
3455
3188
  },
3456
- each: function each(f) {
3457
- for (var property in this) {
3458
- if (property[0] === prefix) f(this[property], property.slice(1), this);
3459
- }
3189
+ each: function (f) {
3190
+ for (var property in this) if (property[0] === prefix) f(this[property], property.slice(1), this);
3460
3191
  }
3461
3192
  };
3462
3193
 
@@ -3467,28 +3198,22 @@ function map(object, f) {
3467
3198
  map.set(key, value);
3468
3199
  }); // Index array by numeric index or specified key function.
3469
3200
  else if (Array.isArray(object)) {
3470
- var i = -1,
3471
- n = object.length,
3472
- o;
3473
- if (f == null) while (++i < n) {
3474
- map.set(i, object[i]);
3475
- } else while (++i < n) {
3476
- map.set(f(o = object[i], i, object), o);
3477
- }
3478
- } // Convert object to map.
3479
- else if (object) for (var key in object) {
3480
- map.set(key, object[key]);
3481
- }
3201
+ var i = -1,
3202
+ n = object.length,
3203
+ o;
3204
+ if (f == null) while (++i < n) map.set(i, object[i]);else while (++i < n) map.set(f(o = object[i], i, object), o);
3205
+ } // Convert object to map.
3206
+ else if (object) for (var key in object) map.set(key, object[key]);
3482
3207
  return map;
3483
3208
  }
3484
3209
 
3485
3210
  function Set() {}
3486
3211
 
3487
3212
  var proto = map.prototype;
3488
- Set.prototype = set$2.prototype = {
3213
+ Set.prototype = {
3489
3214
  constructor: Set,
3490
3215
  has: proto.has,
3491
- add: function add(value) {
3216
+ add: function (value) {
3492
3217
  value += "";
3493
3218
  this[prefix + value] = value;
3494
3219
  return this;
@@ -3501,31 +3226,11 @@ Set.prototype = set$2.prototype = {
3501
3226
  each: proto.each
3502
3227
  };
3503
3228
 
3504
- function set$2(object, f) {
3505
- var set = new Set(); // Copy constructor.
3506
-
3507
- if (object instanceof Set) object.each(function (value) {
3508
- set.add(value);
3509
- }); // Otherwise, assume it’s an array.
3510
- else if (object) {
3511
- var i = -1,
3512
- n = object.length;
3513
- if (f == null) while (++i < n) {
3514
- set.add(object[i]);
3515
- } else while (++i < n) {
3516
- set.add(f(object[i], i, object));
3517
- }
3518
- }
3519
- return set;
3520
- }
3521
-
3522
3229
  function count(node) {
3523
3230
  var sum = 0,
3524
3231
  children = node.children,
3525
3232
  i = children && children.length;
3526
- if (!i) sum = 1;else while (--i >= 0) {
3527
- sum += children[i].value;
3528
- }
3233
+ if (!i) sum = 1;else while (--i >= 0) sum += children[i].value;
3529
3234
  node.value = sum;
3530
3235
  }
3531
3236
 
@@ -3599,9 +3304,7 @@ function node_sum (value) {
3599
3304
  children = node.children,
3600
3305
  i = children && children.length;
3601
3306
 
3602
- while (--i >= 0) {
3603
- sum += children[i].value;
3604
- }
3307
+ while (--i >= 0) sum += children[i].value;
3605
3308
 
3606
3309
  node.value = sum;
3607
3310
  });
@@ -3739,9 +3442,7 @@ function copyData(node) {
3739
3442
  function computeHeight(node) {
3740
3443
  var height = 0;
3741
3444
 
3742
- do {
3743
- node.height = height;
3744
- } while ((node = node.parent) && node.height < ++height);
3445
+ do node.height = height; while ((node = node.parent) && node.height < ++height);
3745
3446
  }
3746
3447
  function Node(data) {
3747
3448
  this.data = data;
@@ -3884,23 +3585,23 @@ function tree () {
3884
3585
  if (nodeSize) root.eachBefore(sizeNode); // If a fixed tree size is specified, scale x and y based on the extent.
3885
3586
  // Compute the left-most, right-most, and depth-most nodes for extents.
3886
3587
  else {
3887
- var left = root,
3888
- right = root,
3889
- bottom = root;
3890
- root.eachBefore(function (node) {
3891
- if (node.x < left.x) left = node;
3892
- if (node.x > right.x) right = node;
3893
- if (node.depth > bottom.depth) bottom = node;
3894
- });
3895
- var s = left === right ? 1 : separation(left, right) / 2,
3896
- tx = s - left.x,
3897
- kx = dx / (right.x + s + tx),
3898
- ky = dy / (bottom.depth || 1);
3899
- root.eachBefore(function (node) {
3900
- node.x = (node.x + tx) * kx;
3901
- node.y = node.depth * ky;
3902
- });
3903
- }
3588
+ var left = root,
3589
+ right = root,
3590
+ bottom = root;
3591
+ root.eachBefore(function (node) {
3592
+ if (node.x < left.x) left = node;
3593
+ if (node.x > right.x) right = node;
3594
+ if (node.depth > bottom.depth) bottom = node;
3595
+ });
3596
+ var s = left === right ? 1 : separation(left, right) / 2,
3597
+ tx = s - left.x,
3598
+ kx = dx / (right.x + s + tx),
3599
+ ky = dy / (bottom.depth || 1);
3600
+ root.eachBefore(function (node) {
3601
+ node.x = (node.x + tx) * kx;
3602
+ node.y = node.depth * ky;
3603
+ });
3604
+ }
3904
3605
  return root;
3905
3606
  } // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is
3906
3607
  // applied recursively to the children of v, as well as the function
@@ -4012,7 +3713,7 @@ function tree () {
4012
3713
  return tree;
4013
3714
  }
4014
3715
 
4015
- function constant$2 (x) {
3716
+ function constant (x) {
4016
3717
  return function () {
4017
3718
  return x;
4018
3719
  };
@@ -4031,46 +3732,46 @@ function Transform(k, x, y) {
4031
3732
  }
4032
3733
  Transform.prototype = {
4033
3734
  constructor: Transform,
4034
- scale: function scale(k) {
3735
+ scale: function (k) {
4035
3736
  return k === 1 ? this : new Transform(this.k * k, this.x, this.y);
4036
3737
  },
4037
- translate: function translate(x, y) {
3738
+ translate: function (x, y) {
4038
3739
  return x === 0 & y === 0 ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
4039
3740
  },
4040
- apply: function apply(point) {
3741
+ apply: function (point) {
4041
3742
  return [point[0] * this.k + this.x, point[1] * this.k + this.y];
4042
3743
  },
4043
- applyX: function applyX(x) {
3744
+ applyX: function (x) {
4044
3745
  return x * this.k + this.x;
4045
3746
  },
4046
- applyY: function applyY(y) {
3747
+ applyY: function (y) {
4047
3748
  return y * this.k + this.y;
4048
3749
  },
4049
- invert: function invert(location) {
3750
+ invert: function (location) {
4050
3751
  return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
4051
3752
  },
4052
- invertX: function invertX(x) {
3753
+ invertX: function (x) {
4053
3754
  return (x - this.x) / this.k;
4054
3755
  },
4055
- invertY: function invertY(y) {
3756
+ invertY: function (y) {
4056
3757
  return (y - this.y) / this.k;
4057
3758
  },
4058
- rescaleX: function rescaleX(x) {
3759
+ rescaleX: function (x) {
4059
3760
  return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
4060
3761
  },
4061
- rescaleY: function rescaleY(y) {
3762
+ rescaleY: function (y) {
4062
3763
  return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
4063
3764
  },
4064
- toString: function toString() {
3765
+ toString: function () {
4065
3766
  return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
4066
3767
  }
4067
3768
  };
4068
- var identity$1 = new Transform(1, 0, 0);
3769
+ var identity = new Transform(1, 0, 0);
4069
3770
 
4070
3771
  function nopropagation() {
4071
3772
  event$1.stopImmediatePropagation();
4072
3773
  }
4073
- function noevent$1 () {
3774
+ function noevent () {
4074
3775
  event$1.preventDefault();
4075
3776
  event$1.stopImmediatePropagation();
4076
3777
  }
@@ -4097,7 +3798,7 @@ function defaultExtent() {
4097
3798
  }
4098
3799
 
4099
3800
  function defaultTransform() {
4100
- return this.__zoom || identity$1;
3801
+ return this.__zoom || identity;
4101
3802
  }
4102
3803
 
4103
3804
  function defaultWheelDelta() {
@@ -4180,7 +3881,7 @@ function zoom () {
4180
3881
  var e = extent.apply(this, arguments),
4181
3882
  t = this.__zoom,
4182
3883
  p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
4183
- return constrain(identity$1.translate(p0[0], p0[1]).scale(t.k).translate(typeof x === "function" ? -x.apply(this, arguments) : -x, typeof y === "function" ? -y.apply(this, arguments) : -y), e, translateExtent);
3884
+ return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(typeof x === "function" ? -x.apply(this, arguments) : -x, typeof y === "function" ? -y.apply(this, arguments) : -y), e, translateExtent);
4184
3885
  }, p);
4185
3886
  };
4186
3887
 
@@ -4217,10 +3918,10 @@ function zoom () {
4217
3918
  return function (t) {
4218
3919
  if (t === 1) t = b; // Avoid rounding error on end.
4219
3920
  else {
4220
- var l = i(t),
4221
- k = w / l[2];
4222
- t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
4223
- }
3921
+ var l = i(t),
3922
+ k = w / l[2];
3923
+ t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
3924
+ }
4224
3925
  g.zoom(null, t);
4225
3926
  };
4226
3927
  });
@@ -4239,7 +3940,7 @@ function zoom () {
4239
3940
  }
4240
3941
 
4241
3942
  Gesture.prototype = {
4242
- start: function start() {
3943
+ start: function () {
4243
3944
  if (++this.active === 1) {
4244
3945
  this.that.__zooming = this;
4245
3946
  this.emit("start");
@@ -4247,7 +3948,7 @@ function zoom () {
4247
3948
 
4248
3949
  return this;
4249
3950
  },
4250
- zoom: function zoom(key, transform) {
3951
+ zoom: function (key, transform) {
4251
3952
  if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]);
4252
3953
  if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]);
4253
3954
  if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]);
@@ -4255,7 +3956,7 @@ function zoom () {
4255
3956
  this.emit("zoom");
4256
3957
  return this;
4257
3958
  },
4258
- end: function end() {
3959
+ end: function () {
4259
3960
  if (--this.active === 0) {
4260
3961
  delete this.that.__zooming;
4261
3962
  this.emit("end");
@@ -4263,7 +3964,7 @@ function zoom () {
4263
3964
 
4264
3965
  return this;
4265
3966
  },
4266
- emit: function emit(type) {
3967
+ emit: function (type) {
4267
3968
  customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]);
4268
3969
  }
4269
3970
  };
@@ -4284,13 +3985,13 @@ function zoom () {
4284
3985
  clearTimeout(g.wheel);
4285
3986
  } // If this wheel event won’t trigger a transform change, ignore it.
4286
3987
  else if (t.k === k) return; // Otherwise, capture the mouse point and location at the start.
4287
- else {
4288
- g.mouse = [p, t.invert(p)];
4289
- interrupt(this);
4290
- g.start();
4291
- }
3988
+ else {
3989
+ g.mouse = [p, t.invert(p)];
3990
+ interrupt(this);
3991
+ g.start();
3992
+ }
4292
3993
 
4293
- noevent$1();
3994
+ noevent();
4294
3995
  g.wheel = setTimeout(wheelidled, wheelDelay);
4295
3996
  g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
4296
3997
 
@@ -4314,7 +4015,7 @@ function zoom () {
4314
4015
  g.start();
4315
4016
 
4316
4017
  function mousemoved() {
4317
- noevent$1();
4018
+ noevent();
4318
4019
 
4319
4020
  if (!g.moved) {
4320
4021
  var dx = event$1.clientX - x0,
@@ -4328,7 +4029,7 @@ function zoom () {
4328
4029
  function mouseupped() {
4329
4030
  v.on("mousemove.zoom mouseup.zoom", null);
4330
4031
  yesdrag(event$1.view, g.moved);
4331
- noevent$1();
4032
+ noevent();
4332
4033
  g.end();
4333
4034
  }
4334
4035
  }
@@ -4340,7 +4041,7 @@ function zoom () {
4340
4041
  p1 = t0.invert(p0),
4341
4042
  k1 = t0.k * (event$1.shiftKey ? 0.5 : 2),
4342
4043
  t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
4343
- noevent$1();
4044
+ noevent();
4344
4045
  if (duration > 0) select(this).transition().duration(duration).call(schedule, t1, p0);else select(this).call(zoom.transform, t1);
4345
4046
  }
4346
4047
 
@@ -4381,7 +4082,7 @@ function zoom () {
4381
4082
  t,
4382
4083
  p,
4383
4084
  l;
4384
- noevent$1();
4085
+ noevent();
4385
4086
  if (touchstarting) touchstarting = clearTimeout(touchstarting);
4386
4087
  g.taps = 0;
4387
4088
 
@@ -4437,19 +4138,19 @@ function zoom () {
4437
4138
  }
4438
4139
 
4439
4140
  zoom.wheelDelta = function (_) {
4440
- return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant$2(+_), zoom) : wheelDelta;
4141
+ return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant(+_), zoom) : wheelDelta;
4441
4142
  };
4442
4143
 
4443
4144
  zoom.filter = function (_) {
4444
- return arguments.length ? (filter = typeof _ === "function" ? _ : constant$2(!!_), zoom) : filter;
4145
+ return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), zoom) : filter;
4445
4146
  };
4446
4147
 
4447
4148
  zoom.touchable = function (_) {
4448
- return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$2(!!_), zoom) : touchable;
4149
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), zoom) : touchable;
4449
4150
  };
4450
4151
 
4451
4152
  zoom.extent = function (_) {
4452
- return arguments.length ? (extent = typeof _ === "function" ? _ : constant$2([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
4153
+ return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
4453
4154
  };
4454
4155
 
4455
4156
  zoom.scaleExtent = function (_) {
@@ -4484,7 +4185,7 @@ function zoom () {
4484
4185
  return zoom;
4485
4186
  }
4486
4187
 
4487
- var colorStruct = {
4188
+ const colorStruct = {
4488
4189
  aliceblue: {
4489
4190
  r: 240,
4490
4191
  g: 248,
@@ -5234,28 +4935,28 @@ var colorStruct = {
5234
4935
  };
5235
4936
 
5236
4937
  /* eslint-disable no-cond-assign */
5237
- var colorUtils = {
5238
- resolveExpression: function resolveExpression(input) {
4938
+ const colorUtils = {
4939
+ resolveExpression: input => {
5239
4940
  // rgb
5240
- var matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
4941
+ let matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
5241
4942
 
5242
4943
  if (matches) {
5243
- return "rgb(".concat(matches[1], ",").concat(matches[2], ",").concat(matches[3], ")");
4944
+ return `rgb(${matches[1]},${matches[2]},${matches[3]})`;
5244
4945
  } // rgba
5245
4946
 
5246
4947
 
5247
4948
  matches = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d(\.\d+)?)\s*\)$/i.exec(input);
5248
4949
 
5249
4950
  if (matches) {
5250
- return "rgba(".concat(matches[1], ",").concat(matches[2], ",").concat(matches[3], ",").concat(matches[4], ")");
4951
+ return `rgba(${matches[1]},${matches[2]},${matches[3]},${matches[4]})`;
5251
4952
  } // argb
5252
4953
 
5253
4954
 
5254
4955
  matches = /^argb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(input);
5255
4956
 
5256
4957
  if (matches) {
5257
- var a = Math.round(matches[1] / 2.55) / 100;
5258
- return "rgba(".concat(matches[2], ",").concat(matches[3], ",").concat(matches[4], ",").concat(a, ")");
4958
+ const a = Math.round(matches[1] / 2.55) / 100;
4959
+ return `rgba(${matches[2]},${matches[3]},${matches[4]},${a})`;
5259
4960
  } // hex
5260
4961
 
5261
4962
 
@@ -5266,44 +4967,45 @@ var colorUtils = {
5266
4967
  } // css color
5267
4968
 
5268
4969
 
5269
- var color = input && colorStruct[input.toLowerCase()];
4970
+ const color = input && colorStruct[input.toLowerCase()];
5270
4971
 
5271
4972
  if (color) {
5272
- var _a = color.a !== undefined ? color.a : 1;
5273
-
5274
- return "rgba(".concat(color.r, ",").concat(color.g, ",").concat(color.b, ",").concat(_a, ")");
4973
+ const a = color.a !== undefined ? color.a : 1;
4974
+ return `rgba(${color.r},${color.g},${color.b},${a})`;
5275
4975
  } // invalid
5276
4976
 
5277
4977
 
5278
4978
  return 'none';
5279
4979
  },
5280
- getDarkColor: function getDarkColor(color) {
5281
- var percent = 0.5;
5282
- var f;
5283
- var R;
5284
- var B;
5285
- var G;
4980
+
4981
+ getDarkColor(color) {
4982
+ const percent = 0.5;
4983
+ let f;
4984
+ let R;
4985
+ let B;
4986
+ let G;
5286
4987
 
5287
4988
  if (color.length > 7) {
5288
4989
  f = color.split(',');
5289
- var rgba = f[0].indexOf('a') !== -1;
4990
+ const rgba = f[0].indexOf('a') !== -1;
5290
4991
  R = rgba ? parseInt(f[0].slice(5), 10) : parseInt(f[0].slice(4), 10);
5291
4992
  G = parseInt(f[1], 10);
5292
4993
  B = parseInt(f[2], 10);
5293
- return "".concat((rgba ? 'rgba(' : 'rgb(') + (Math.round((0 - R) * percent) + R), ",").concat(Math.round((0 - G) * percent) + G, ",").concat(Math.round((0 - B) * percent) + B).concat(rgba ? ",".concat(f[3]) : ')');
4994
+ return `${(rgba ? 'rgba(' : 'rgb(') + (Math.round((0 - R) * percent) + R)},${Math.round((0 - G) * percent) + G},${Math.round((0 - B) * percent) + B}${rgba ? `,${f[3]}` : ')'}`;
5294
4995
  }
5295
4996
 
5296
4997
  f = parseInt(color.slice(1), 16);
5297
4998
  R = f >> 16;
5298
4999
  G = f >> 8 & 0x00ff;
5299
5000
  B = f & 0x0000ff;
5300
- return "#".concat((0x1000000 + (Math.round((0 - R) * percent) + R) * 0x10000 + (Math.round((0 - G) * percent) + G) * 0x100 + (Math.round((0 - B) * percent) + B)).toString(16).slice(1));
5001
+ return `#${(0x1000000 + (Math.round((0 - R) * percent) + R) * 0x10000 + (Math.round((0 - G) * percent) + G) * 0x100 + (Math.round((0 - B) * percent) + B)).toString(16).slice(1)}`;
5301
5002
  },
5302
- isDarkColor: function isDarkColor(color) {
5303
- var r;
5304
- var g;
5305
- var b;
5306
- var matches;
5003
+
5004
+ isDarkColor(color) {
5005
+ let r;
5006
+ let g;
5007
+ let b;
5008
+ let matches;
5307
5009
 
5308
5010
  if (matches = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(color)) {
5309
5011
  r = parseInt(matches[1], 10);
@@ -5323,17 +5025,18 @@ var colorUtils = {
5323
5025
 
5324
5026
  return 0.299 * r + 0.587 * g + 0.114 * b < 125;
5325
5027
  }
5028
+
5326
5029
  };
5327
5030
 
5328
- var pageSize = 3300;
5329
- var attributeIDs = {
5031
+ const pageSize = 3300;
5032
+ const attributeIDs = {
5330
5033
  colorByExpression: 'color',
5331
5034
  labelExpression: 'label',
5332
5035
  subLabelExpression: 'subLabel',
5333
5036
  extraLabelExpression: 'extraLabel'
5334
5037
  };
5335
- var MAX_DATA = 'max-data-limit';
5336
- var NO_ROOT = 'no_root';
5038
+ const MAX_DATA = 'max-data-limit';
5039
+ const NO_ROOT = 'no_root';
5337
5040
 
5338
5041
  function getId(row) {
5339
5042
  return row[0].qText;
@@ -5344,14 +5047,14 @@ function getParentId(row) {
5344
5047
  }
5345
5048
 
5346
5049
  function anyCycle(nodes) {
5347
- var visited = {};
5348
- var marked = {};
5050
+ const visited = {};
5051
+ const marked = {};
5349
5052
 
5350
5053
  function isCycleUtil(node) {
5351
5054
  visited[node.id] = true;
5352
5055
  marked[node.id] = true;
5353
5056
 
5354
- for (var i = 0; i < node.children.length; ++i) {
5057
+ for (let i = 0; i < node.children.length; ++i) {
5355
5058
  if (!visited[node.children[i].id] && isCycleUtil(node.children[i])) {
5356
5059
  return true;
5357
5060
  }
@@ -5365,8 +5068,8 @@ function anyCycle(nodes) {
5365
5068
  return false;
5366
5069
  }
5367
5070
 
5368
- for (var i = 0; i < nodes.length; ++i) {
5369
- var node = nodes[i];
5071
+ for (let i = 0; i < nodes.length; ++i) {
5072
+ const node = nodes[i];
5370
5073
 
5371
5074
  if (!visited[node.id] && isCycleUtil(node)) {
5372
5075
  return true;
@@ -5375,122 +5078,61 @@ function anyCycle(nodes) {
5375
5078
 
5376
5079
  return false;
5377
5080
  }
5378
- function fetchPage(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
5379
- return _fetchPage.apply(this, arguments);
5380
- }
5381
-
5382
- function _fetchPage() {
5383
- _fetchPage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dataPages, dataMatrix, model, fullHeight, currentRow, callNum, maxCalls) {
5384
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
5385
- while (1) {
5386
- switch (_context2.prev = _context2.next) {
5387
- case 0:
5388
- _context2.next = 2;
5389
- return model.getHyperCubeData('/qHyperCubeDef', [{
5390
- qTop: currentRow,
5391
- qLeft: 0,
5392
- qWidth: 3,
5393
- qHeight: pageSize
5394
- }]).then(function (data) {
5395
- dataPages.push(data[0]);
5396
- dataMatrix.push.apply(dataMatrix, _toConsumableArray(data[0].qMatrix)); // eslint-disable-next-line no-param-reassign
5397
-
5398
- currentRow += data[0].qArea.qHeight;
5399
- });
5400
-
5401
- case 2:
5402
- if (!(callNum >= maxCalls)) {
5403
- _context2.next = 4;
5404
- break;
5405
- }
5406
-
5407
- return _context2.abrupt("return", MAX_DATA);
5408
-
5409
- case 4:
5410
- if (!(fullHeight > currentRow)) {
5411
- _context2.next = 6;
5412
- break;
5413
- }
5414
-
5415
- return _context2.abrupt("return", fetchPage(dataPages, dataMatrix, model, fullHeight, currentRow, callNum + 1, maxCalls));
5416
-
5417
- case 6:
5418
- return _context2.abrupt("return", '');
5419
-
5420
- case 7:
5421
- case "end":
5422
- return _context2.stop();
5423
- }
5424
- }
5425
- }, _callee2);
5426
- }));
5427
- return _fetchPage.apply(this, arguments);
5428
- }
5429
-
5430
- var getDataMatrix = /*#__PURE__*/function () {
5431
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(layout, model) {
5432
- var dataPages, fullHeight, loadedHeight, dataMatrix, status;
5433
- return regeneratorRuntime.wrap(function _callee$(_context) {
5434
- while (1) {
5435
- switch (_context.prev = _context.next) {
5436
- case 0:
5437
- if (!layout.snapshotData) {
5438
- _context.next = 2;
5439
- break;
5440
- }
5441
-
5442
- return _context.abrupt("return", {
5443
- status: '',
5444
- dataMatrix: layout.snapshotData.dataMatrix
5445
- });
5446
-
5447
- case 2:
5448
- dataPages = layout.qHyperCube && layout.qHyperCube.qDataPages;
5449
- fullHeight = layout.qHyperCube.qSize.qcy;
5450
- loadedHeight = dataPages[0].qArea.qHeight;
5451
- dataMatrix = _toConsumableArray(dataPages[0].qMatrix);
5452
- status = ''; // If there seems to be more data, check if it is already loadad or load it
5453
-
5454
- if (!(fullHeight > loadedHeight && dataPages.length === 1 && model)) {
5455
- _context.next = 13;
5456
- break;
5457
- }
5081
+ async function fetchPage(dataPages, dataMatrix, model, fullHeight, currentRow, callNum, maxCalls) {
5082
+ await model.getHyperCubeData('/qHyperCubeDef', [{
5083
+ qTop: currentRow,
5084
+ qLeft: 0,
5085
+ qWidth: 3,
5086
+ qHeight: pageSize
5087
+ }]).then(data => {
5088
+ dataPages.push(data[0]);
5089
+ dataMatrix.push(...data[0].qMatrix); // eslint-disable-next-line no-param-reassign
5090
+
5091
+ currentRow += data[0].qArea.qHeight;
5092
+ });
5458
5093
 
5459
- _context.next = 10;
5460
- return fetchPage(layout.qHyperCube.qDataPages, dataMatrix, model, fullHeight, loadedHeight, 0, layout.rowLimit / pageSize || 10);
5094
+ if (callNum >= maxCalls) {
5095
+ return MAX_DATA;
5096
+ }
5461
5097
 
5462
- case 10:
5463
- status = _context.sent;
5464
- _context.next = 14;
5465
- break;
5098
+ if (fullHeight > currentRow) {
5099
+ // eslint-disable-next-line no-param-reassign
5100
+ return fetchPage(dataPages, dataMatrix, model, fullHeight, currentRow, callNum + 1, maxCalls);
5101
+ }
5466
5102
 
5467
- case 13:
5468
- dataPages.forEach(function (page, i) {
5469
- i > 0 ? dataMatrix.push.apply(dataMatrix, _toConsumableArray(page.qMatrix)) : '';
5470
- });
5103
+ return '';
5104
+ }
5105
+ const getDataMatrix = async (layout, model) => {
5106
+ if (layout.snapshotData) {
5107
+ return {
5108
+ status: '',
5109
+ dataMatrix: layout.snapshotData.dataMatrix
5110
+ };
5111
+ }
5471
5112
 
5472
- case 14:
5473
- return _context.abrupt("return", {
5474
- status: status,
5475
- dataMatrix: dataMatrix
5476
- });
5113
+ const dataPages = layout.qHyperCube && layout.qHyperCube.qDataPages;
5114
+ const fullHeight = layout.qHyperCube.qSize.qcy;
5115
+ const loadedHeight = dataPages[0].qArea.qHeight;
5116
+ const dataMatrix = [...dataPages[0].qMatrix];
5117
+ let status = ''; // If there seems to be more data, check if it is already loadad or load it
5477
5118
 
5478
- case 15:
5479
- case "end":
5480
- return _context.stop();
5481
- }
5482
- }
5483
- }, _callee);
5484
- }));
5119
+ if (fullHeight > loadedHeight && dataPages.length === 1 && model) {
5120
+ status = await fetchPage(layout.qHyperCube.qDataPages, dataMatrix, model, fullHeight, loadedHeight, 0, layout.rowLimit / pageSize || 10);
5121
+ } else {
5122
+ dataPages.forEach((page, i) => {
5123
+ i > 0 ? dataMatrix.push(...page.qMatrix) : '';
5124
+ });
5125
+ }
5485
5126
 
5486
- return function getDataMatrix(_x8, _x9) {
5487
- return _ref.apply(this, arguments);
5127
+ return {
5128
+ status,
5129
+ dataMatrix
5488
5130
  };
5489
- }();
5131
+ };
5490
5132
  function getAttributeIndecies(attrsInfo) {
5491
5133
  if (attrsInfo && attrsInfo.length) {
5492
- var indecies = [];
5493
- attrsInfo.forEach(function (attr, i) {
5134
+ const indecies = [];
5135
+ attrsInfo.forEach((attr, i) => {
5494
5136
  if (attributeIDs[attr.id]) {
5495
5137
  indecies.push({
5496
5138
  prop: attributeIDs[attr.id],
@@ -5504,8 +5146,8 @@ function getAttributeIndecies(attrsInfo) {
5504
5146
  return [];
5505
5147
  }
5506
5148
  function getAttributes(indecies, qAttrExps) {
5507
- var attributes = {};
5508
- indecies.forEach(function (attr) {
5149
+ const attributes = {};
5150
+ indecies.forEach(attr => {
5509
5151
  if (attr.prop === 'color') {
5510
5152
  attributes[attr.prop] = colorUtils.resolveExpression(qAttrExps.qValues[attr.index].qText);
5511
5153
  } else {
@@ -5515,10 +5157,10 @@ function getAttributes(indecies, qAttrExps) {
5515
5157
  return attributes;
5516
5158
  }
5517
5159
  function getAllTreeElemNo(node, activate) {
5518
- var idList = [];
5160
+ const idList = [];
5519
5161
 
5520
- var pushChildrenIds = function pushChildrenIds(currentNode) {
5521
- currentNode.children.forEach(function (child) {
5162
+ const pushChildrenIds = currentNode => {
5163
+ currentNode.children.forEach(child => {
5522
5164
  child.data.selected = activate;
5523
5165
  idList.push(child.data.elemNo);
5524
5166
 
@@ -5536,7 +5178,7 @@ function haveNoChildren(nodes) {
5536
5178
  return true;
5537
5179
  }
5538
5180
 
5539
- for (var i = 0; i < nodes.length; ++i) {
5181
+ for (let i = 0; i < nodes.length; ++i) {
5540
5182
  if (nodes[i].children !== undefined) {
5541
5183
  return false;
5542
5184
  }
@@ -5545,16 +5187,16 @@ function haveNoChildren(nodes) {
5545
5187
  return true;
5546
5188
  }
5547
5189
  function createNodes(matrix, attributeIndecies, status, navigationMode, translator) {
5548
- var nodeMap = {};
5549
- var allNodes = [];
5550
-
5551
- for (var i = 0; i < matrix.length; ++i) {
5552
- var row = matrix[i];
5553
- var id = getId(row);
5554
- var parentId = getParentId(row);
5555
- var node = {
5556
- id: id,
5557
- parentId: parentId,
5190
+ const nodeMap = {};
5191
+ const allNodes = [];
5192
+
5193
+ for (let i = 0; i < matrix.length; ++i) {
5194
+ const row = matrix[i];
5195
+ const id = getId(row);
5196
+ const parentId = getParentId(row);
5197
+ const node = {
5198
+ id,
5199
+ parentId,
5558
5200
  children: [],
5559
5201
  elemNo: row[0].qElemNumber,
5560
5202
  attributes: getAttributes(attributeIndecies, row[0].qAttrExps),
@@ -5565,20 +5207,21 @@ function createNodes(matrix, attributeIndecies, status, navigationMode, translat
5565
5207
  allNodes.push(node);
5566
5208
  }
5567
5209
 
5568
- var rootNodes = [];
5569
- var maxNodeWarning = false;
5210
+ const rootNodes = [];
5211
+ let maxNodeWarning = false;
5570
5212
 
5571
- for (var _i = 0; _i < allNodes.length; ++_i) {
5572
- var _node = allNodes[_i];
5573
- var parentNode = nodeMap[_node.parentId];
5574
- _node.parent = parentNode;
5213
+ for (let i = 0; i < allNodes.length; ++i) {
5214
+ const node = allNodes[i];
5215
+ const parentNode = nodeMap[node.parentId];
5216
+ node.parent = parentNode;
5575
5217
 
5576
5218
  if (parentNode) {
5577
- parentNode.children.length > 98 ? maxNodeWarning = true : parentNode.children.push(_objectSpread2({
5578
- childNumber: parentNode.children.length
5579
- }, _node));
5219
+ parentNode.children.length > 98 ? maxNodeWarning = true : parentNode.children.push({
5220
+ childNumber: parentNode.children.length,
5221
+ ...node
5222
+ });
5580
5223
  } else {
5581
- rootNodes.length > 98 ? maxNodeWarning = true : rootNodes.push(_node);
5224
+ rootNodes.length > 98 ? maxNodeWarning = true : rootNodes.push(node);
5582
5225
  }
5583
5226
  } // We might be able to use the rootnodes lenght as well
5584
5227
 
@@ -5591,7 +5234,7 @@ function createNodes(matrix, attributeIndecies, status, navigationMode, translat
5591
5234
  };
5592
5235
  }
5593
5236
 
5594
- var warn = [];
5237
+ const warn = [];
5595
5238
 
5596
5239
  if (status === MAX_DATA) {
5597
5240
  warn.push(translator.get('Object.OrgChart.MaxData'));
@@ -5615,16 +5258,16 @@ function createNodes(matrix, attributeIndecies, status, navigationMode, translat
5615
5258
 
5616
5259
 
5617
5260
  warn.push(translator.get('Object.OrgChart.DummyWarn'));
5618
- var rootNode = {
5261
+ const rootNode = {
5619
5262
  id: 'Root',
5620
5263
  name: translator.get('Object.OrgChart.DummyRoot'),
5621
5264
  isDummy: true,
5622
5265
  // Should be rendered in a specific way?
5623
- warn: warn,
5266
+ warn,
5624
5267
  children: rootNodes,
5625
- navigationMode: navigationMode
5268
+ navigationMode
5626
5269
  };
5627
- rootNodes.forEach(function (node, i) {
5270
+ rootNodes.forEach((node, i) => {
5628
5271
  // eslint-disable-next-line no-param-reassign
5629
5272
  node.parentId = 'Root'; // eslint-disable-next-line no-param-reassign
5630
5273
 
@@ -5634,87 +5277,50 @@ function createNodes(matrix, attributeIndecies, status, navigationMode, translat
5634
5277
  });
5635
5278
  return rootNode;
5636
5279
  }
5637
- function transform(_x10) {
5638
- return _transform.apply(this, arguments);
5639
- }
5640
-
5641
- function _transform() {
5642
- _transform = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref2) {
5643
- var layout, model, translator, _yield$getDataMatrix, status, dataMatrix, attributeIndecies;
5644
-
5645
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
5646
- while (1) {
5647
- switch (_context3.prev = _context3.next) {
5648
- case 0:
5649
- layout = _ref2.layout, model = _ref2.model, translator = _ref2.translator;
5650
-
5651
- if (layout.qHyperCube) {
5652
- _context3.next = 3;
5653
- break;
5654
- }
5655
-
5656
- throw new Error('Require a hypercube');
5657
-
5658
- case 3:
5659
- if (!(layout.qHyperCube.qDimensionInfo.length < 2)) {
5660
- _context3.next = 5;
5661
- break;
5662
- }
5663
-
5664
- return _context3.abrupt("return", false);
5665
-
5666
- case 5:
5667
- _context3.next = 7;
5668
- return getDataMatrix(layout, model);
5669
-
5670
- case 7:
5671
- _yield$getDataMatrix = _context3.sent;
5672
- status = _yield$getDataMatrix.status;
5673
- dataMatrix = _yield$getDataMatrix.dataMatrix;
5674
- attributeIndecies = getAttributeIndecies(layout.qHyperCube.qDimensionInfo[0].qAttrExprInfo);
5675
-
5676
- if (dataMatrix) {
5677
- _context3.next = 13;
5678
- break;
5679
- }
5280
+ async function transform({
5281
+ layout,
5282
+ model,
5283
+ translator
5284
+ }) {
5285
+ if (!layout.qHyperCube) {
5286
+ throw new Error('Require a hypercube');
5287
+ }
5680
5288
 
5681
- return _context3.abrupt("return", null);
5289
+ if (layout.qHyperCube.qDimensionInfo.length < 2) {
5290
+ return false; // throw new Error('Require at least two dimensions');
5291
+ }
5682
5292
 
5683
- case 13:
5684
- if (!(dataMatrix.length < 1)) {
5685
- _context3.next = 15;
5686
- break;
5687
- }
5293
+ const {
5294
+ status,
5295
+ dataMatrix
5296
+ } = await getDataMatrix(layout, model);
5297
+ const attributeIndecies = getAttributeIndecies(layout.qHyperCube.qDimensionInfo[0].qAttrExprInfo);
5688
5298
 
5689
- return _context3.abrupt("return", null);
5299
+ if (!dataMatrix) {
5300
+ return null;
5301
+ }
5690
5302
 
5691
- case 15:
5692
- return _context3.abrupt("return", createNodes(dataMatrix, attributeIndecies, status, layout.navigationMode, translator));
5303
+ if (dataMatrix.length < 1) {
5304
+ return null;
5305
+ }
5693
5306
 
5694
- case 16:
5695
- case "end":
5696
- return _context3.stop();
5697
- }
5698
- }
5699
- }, _callee3);
5700
- }));
5701
- return _transform.apply(this, arguments);
5307
+ return createNodes(dataMatrix, attributeIndecies, status, layout.navigationMode, translator);
5702
5308
  }
5703
5309
 
5704
- var cardPadding = 8;
5705
- var buttonMargin = 16;
5706
- var buttonHeight = 24;
5707
- var constants = {
5310
+ const cardPadding = 8;
5311
+ const buttonMargin = 16;
5312
+ const buttonHeight = 24;
5313
+ const constants = {
5708
5314
  cardWidth: 152,
5709
5315
  cardHeight: 64,
5710
5316
  widthMargin: 32,
5711
5317
  heightMargin: buttonHeight + cardPadding * 2 + buttonMargin,
5712
- buttonMargin: buttonMargin,
5318
+ buttonMargin,
5713
5319
  leafMargin: 16,
5714
- cardPadding: cardPadding,
5320
+ cardPadding,
5715
5321
  buttonWidth: 48,
5716
5322
  // TODO: might need to be dynamic
5717
- buttonHeight: buttonHeight,
5323
+ buttonHeight,
5718
5324
  rootDiameter: 20,
5719
5325
  r: 4,
5720
5326
  tooltipWidth: 240,
@@ -5723,9 +5329,11 @@ var constants = {
5723
5329
  minZoom: 0.2
5724
5330
  };
5725
5331
 
5726
- var widthTranslation = function widthTranslation(d, widthSpacing, element, axis, initialZoomState, navigationMode) {
5727
- var buttonMargin = constants.buttonMargin;
5728
- var initialX = initialZoomState && initialZoomState.initialX || 0;
5332
+ const widthTranslation = (d, widthSpacing, element, axis, initialZoomState, navigationMode) => {
5333
+ const {
5334
+ buttonMargin
5335
+ } = constants;
5336
+ const initialX = initialZoomState && initialZoomState.initialX || 0;
5729
5337
 
5730
5338
  if (navigationMode === 'expandAll') {
5731
5339
  d[axis] = d.x + initialX;
@@ -5749,10 +5357,12 @@ var widthTranslation = function widthTranslation(d, widthSpacing, element, axis,
5749
5357
 
5750
5358
  return d[axis];
5751
5359
  };
5752
- var depthTranslation = function depthTranslation(d, depthSpacing, axis, initialZoomState, navigationMode) {
5753
- var cardHeight = constants.cardHeight,
5754
- leafMargin = constants.leafMargin;
5755
- var initialY = initialZoomState && initialZoomState.initialY || 0;
5360
+ const depthTranslation = (d, depthSpacing, axis, initialZoomState, navigationMode) => {
5361
+ const {
5362
+ cardHeight,
5363
+ leafMargin
5364
+ } = constants;
5365
+ const initialY = initialZoomState && initialZoomState.initialY || 0;
5756
5366
 
5757
5367
  if (d.parent && d.parent.data.id !== 'Root' && navigationMode !== 'expandAll' && haveNoChildren(d.parent.children)) {
5758
5368
  d[axis] = d.parent.y + depthSpacing + d.data.childNumber * (cardHeight + leafMargin) + initialY;
@@ -5763,28 +5373,26 @@ var depthTranslation = function depthTranslation(d, depthSpacing, axis, initialZ
5763
5373
  return d[axis];
5764
5374
  };
5765
5375
  function position(orientation, element, initialZoomState, navigationMode) {
5766
- var widthMargin = constants.widthMargin,
5767
- heightMargin = constants.heightMargin,
5768
- cardWidth = constants.cardWidth,
5769
- cardHeight = constants.cardHeight,
5770
- cardPadding = constants.cardPadding;
5771
- var widthSpacing;
5772
- var depthSpacing;
5773
- var orientations;
5376
+ const {
5377
+ widthMargin,
5378
+ heightMargin,
5379
+ cardWidth,
5380
+ cardHeight,
5381
+ cardPadding
5382
+ } = constants;
5383
+ let widthSpacing;
5384
+ let depthSpacing;
5385
+ let orientations;
5774
5386
 
5775
5387
  switch (orientation) {
5776
5388
  case 'ttb':
5777
5389
  widthSpacing = cardWidth + widthMargin;
5778
5390
  depthSpacing = navigationMode === 'expandAll' ? cardHeight + 2 * cardPadding : cardHeight + heightMargin;
5779
5391
  orientations = {
5780
- depthSpacing: depthSpacing,
5392
+ depthSpacing,
5781
5393
  isVertical: true,
5782
- x: function x(d) {
5783
- return widthTranslation(d, widthSpacing, element, 'xActual', initialZoomState, navigationMode);
5784
- },
5785
- y: function y(d) {
5786
- return depthTranslation(d, depthSpacing, 'yActual', initialZoomState, navigationMode);
5787
- }
5394
+ x: d => widthTranslation(d, widthSpacing, element, 'xActual', initialZoomState, navigationMode),
5395
+ y: d => depthTranslation(d, depthSpacing, 'yActual', initialZoomState, navigationMode)
5788
5396
  };
5789
5397
  break;
5790
5398
  }
@@ -5792,63 +5400,88 @@ function position(orientation, element, initialZoomState, navigationMode) {
5792
5400
  return orientations;
5793
5401
  }
5794
5402
 
5795
- var encodeUtils = {
5796
- encodeTitle: function encodeTitle(input) {
5797
- var encodingDiv = document.createElement('div');
5798
- var textNode = document.createTextNode(input);
5403
+ const encodeUtils = {
5404
+ encodeTitle: input => {
5405
+ const encodingDiv = document.createElement('div');
5406
+ const textNode = document.createTextNode(input);
5799
5407
  encodingDiv.appendChild(textNode);
5800
5408
  return encodingDiv.innerHTML;
5409
+ },
5410
+ encodeCssColor: input => {
5411
+ const immune = ['#', ' ', '(', ')'];
5412
+ let encoded = '';
5413
+
5414
+ for (let i = 0; i < input.length; i++) {
5415
+ const ch = input.charAt(i);
5416
+ const cc = input.charCodeAt(i);
5417
+
5418
+ if (!ch.match(/[a-zA-Z0-9]/) && immune.indexOf(ch) < 0) {
5419
+ const hex = cc.toString(16);
5420
+ const pad = '000000'.substr(hex.length);
5421
+ encoded += `\\${pad}${hex}`;
5422
+ } else {
5423
+ encoded += ch;
5424
+ }
5425
+ }
5426
+
5427
+ return encoded;
5801
5428
  }
5802
5429
  };
5803
5430
 
5431
+ function resolveColor(color) {
5432
+ const resolvedColor = colorUtils.resolveExpression(color);
5433
+ return resolvedColor !== 'none' ? resolvedColor : encodeUtils.encodeCssColor(color);
5434
+ }
5804
5435
  function getBackgroundColor(data, cardStyling) {
5805
- var color = cardStyling.backgroundColor;
5806
-
5807
5436
  if (data.attributes && data.attributes.color) {
5808
- var resolvedColor = colorUtils.resolveExpression(data.attributes.color);
5809
- color = resolvedColor !== 'none' ? resolvedColor : color;
5437
+ const resolvedColor = colorUtils.resolveExpression(data.attributes.color);
5438
+
5439
+ if (resolvedColor !== 'none') {
5440
+ return resolvedColor;
5441
+ }
5810
5442
  }
5811
5443
 
5812
- return color;
5444
+ return resolveColor(cardStyling.backgroundColor);
5813
5445
  }
5814
5446
  function getFontColor(cardStyling, backgroundColor) {
5815
5447
  if (cardStyling.fontColor === 'default') {
5816
- return colorUtils.isDarkColor(backgroundColor) ? '#e6e6e6' : '#484848';
5448
+ return colorUtils.isDarkColor(backgroundColor) ? DEFAULTS.FONT_COLOR_LIGHT.color : DEFAULTS.FONT_COLOR_DARK.color;
5817
5449
  }
5818
5450
 
5819
5451
  return cardStyling.fontColor;
5820
5452
  }
5821
- var card = (function (data, cardStyling, selectionObj) {
5822
- var api = selectionObj.api,
5823
- state = selectionObj.state;
5824
- var isSelected = api && api.isActive() && state.indexOf(data.elemNo) !== -1;
5825
- var backgroundColor = getBackgroundColor(data, cardStyling);
5826
- var fontColor = getFontColor(cardStyling, backgroundColor);
5827
- var attributes = data.attributes || {};
5828
- var html = "<div class=\"sn-org-card-title\">".concat(encodeUtils.encodeTitle(attributes.label || data.id), "</div>");
5453
+ var card = ((data, cardStyling, selectionObj) => {
5454
+ const {
5455
+ api,
5456
+ state
5457
+ } = selectionObj;
5458
+ const isSelected = api && api.isActive() && state.indexOf(data.elemNo) !== -1;
5459
+ const backgroundColor = getBackgroundColor(data, cardStyling);
5460
+ const fontColor = resolveColor(getFontColor(cardStyling, backgroundColor));
5461
+ const attributes = data.attributes || {};
5462
+ let html = `<div class="sn-org-card-title">${encodeUtils.encodeTitle(attributes.label || data.id)}</div>`;
5829
5463
 
5830
5464
  if (attributes.subLabel) {
5831
- html += "<div class=\"sn-org-card-label\">".concat(encodeUtils.encodeTitle(attributes.subLabel), "</div>");
5465
+ html += `<div class="sn-org-card-label">${encodeUtils.encodeTitle(attributes.subLabel)}</div>`;
5832
5466
  }
5833
5467
 
5834
5468
  if (data.measure) {
5835
- var measureLabel = cardStyling.measureLabel ? "".concat(cardStyling.measureLabel, ": ") : '';
5836
- html += "<div class=\"sn-org-card-label\">".concat(encodeUtils.encodeTitle(measureLabel + data.measure), "</div>");
5469
+ const measureLabel = cardStyling.measureLabel ? `${cardStyling.measureLabel}: ` : '';
5470
+ html += `<div class="sn-org-card-label">${encodeUtils.encodeTitle(measureLabel + data.measure)}</div>`;
5837
5471
  } else if (attributes.extraLabel) {
5838
- html += "<div class=\"sn-org-card-label\">".concat(encodeUtils.encodeTitle(attributes.extraLabel), "</div>");
5472
+ html += `<div class="sn-org-card-label">${encodeUtils.encodeTitle(attributes.extraLabel)}</div>`;
5839
5473
  }
5840
5474
 
5841
- var selectedClass = api && api.isActive() ? isSelected ? ' selected' : ' not-selected' : '';
5842
- var _cardStyling$border = cardStyling.border,
5843
- _cardStyling$border$t = _cardStyling$border.top,
5844
- top = _cardStyling$border$t === void 0 ? true : _cardStyling$border$t,
5845
- fullBorder = _cardStyling$border.fullBorder,
5846
- _cardStyling$border$c = _cardStyling$border.colorType,
5847
- colorType = _cardStyling$border$c === void 0 ? 'auto' : _cardStyling$border$c;
5848
- var borderColor = colorType === 'auto' ? colorUtils.getDarkColor(backgroundColor) : cardStyling.borderColor;
5849
- var topBorder = top && !isSelected ? "3px solid ".concat(borderColor) : '';
5850
- var borderStyle = fullBorder && !isSelected ? "1px solid ".concat(borderColor) : '';
5851
- var newCardHeight = constants.cardHeight;
5475
+ const selectedClass = api && api.isActive() ? isSelected ? ' selected' : ' not-selected' : '';
5476
+ const {
5477
+ top = DEFAULTS.BORDER_TOP,
5478
+ fullBorder = DEFAULTS.BORDER_FULL,
5479
+ colorType = DEFAULTS.BORDER_COLOR_TYPE
5480
+ } = cardStyling.border;
5481
+ const borderColor = colorType === 'auto' ? colorUtils.getDarkColor(backgroundColor) : resolveColor(cardStyling.borderColor);
5482
+ const topBorder = top && !isSelected ? `3px solid ${borderColor}` : '';
5483
+ const borderStyle = fullBorder && !isSelected ? `1px solid ${borderColor}` : '';
5484
+ let newCardHeight = constants.cardHeight;
5852
5485
 
5853
5486
  if (isSelected) {
5854
5487
  newCardHeight -= 8;
@@ -5858,18 +5491,20 @@ var card = (function (data, cardStyling, selectionObj) {
5858
5491
  newCardHeight -= 3;
5859
5492
  }
5860
5493
 
5861
- return "<div class=\"sn-org-card-text".concat(selectedClass, "\" style=\"background-color:").concat(backgroundColor, ";color:").concat(fontColor, "; border:").concat(borderStyle, "; border-top:").concat(topBorder, "; height:").concat(newCardHeight, "px;\">").concat(html, "</div>");
5494
+ return `<div class="sn-org-card-text${selectedClass}" style="background-color:${backgroundColor};color:${fontColor}; border:${borderStyle}; border-top:${topBorder}; height:${newCardHeight}px;">${html}</div>`;
5862
5495
  });
5863
5496
 
5864
5497
  var selections = {
5865
- select: function select(node, selectionObj) {
5866
- var api = selectionObj.api,
5867
- state = selectionObj.state,
5868
- singleSelect = selectionObj.singleSelect,
5869
- setState = selectionObj.setState;
5498
+ select: (node, selectionObj) => {
5499
+ const {
5500
+ api,
5501
+ state,
5502
+ singleSelect,
5503
+ setState
5504
+ } = selectionObj;
5870
5505
 
5871
5506
  if (node && api) {
5872
- var newState;
5507
+ let newState;
5873
5508
 
5874
5509
  if (node.data.elemNo < 0 && node.data.elemNo !== -3) {
5875
5510
  return;
@@ -5886,9 +5521,9 @@ var selections = {
5886
5521
  newState = state.concat();
5887
5522
  }
5888
5523
 
5889
- var ind = newState.indexOf(node.data.elemNo);
5890
- var activate = ind === -1;
5891
- var linkedIds = [];
5524
+ const ind = newState.indexOf(node.data.elemNo);
5525
+ const activate = ind === -1;
5526
+ let linkedIds = [];
5892
5527
 
5893
5528
  if (!singleSelect) {
5894
5529
  linkedIds = getAllTreeElemNo(node, activate);
@@ -5896,13 +5531,13 @@ var selections = {
5896
5531
 
5897
5532
  if (!activate) {
5898
5533
  newState.splice(ind, 1);
5899
- linkedIds.forEach(function (id) {
5900
- var idInd = newState.indexOf(id);
5534
+ linkedIds.forEach(id => {
5535
+ const idInd = newState.indexOf(id);
5901
5536
  idInd !== -1 && newState.splice(idInd, 1);
5902
5537
  });
5903
5538
  } else {
5904
5539
  newState.push(node.data.elemNo);
5905
- linkedIds.forEach(function (id) {
5540
+ linkedIds.forEach(id => {
5906
5541
  if (newState.indexOf(id) === -1) {
5907
5542
  newState.push(id);
5908
5543
  }
@@ -5924,34 +5559,33 @@ var selections = {
5924
5559
  };
5925
5560
 
5926
5561
  function createTooltip(element) {
5927
- var tooltip = select(element).append('div').attr('class', 'sn-org-tooltip').on('mousedown', function () {
5562
+ const tooltip = select(element).append('div').attr('class', 'sn-org-tooltip').on('mousedown', () => {
5928
5563
  tooltip.classed('sn-org-tooltip-visible', false);
5929
5564
  });
5930
5565
  return tooltip;
5931
5566
  }
5932
5567
  function getTooltipStyle(d, containerHeight, x, y, transform) {
5933
- var cardWidth = constants.cardWidth,
5934
- tooltipPadding = constants.tooltipPadding;
5935
- var halfCardWidth = cardWidth / 2;
5936
- var yLocation = containerHeight - (y(d) * transform.zoom + transform.y - tooltipPadding);
5937
- var xLocation = x(d) * transform.zoom + transform.x + halfCardWidth * transform.zoom;
5938
- return "bottom:".concat(yLocation, "px;left:").concat(xLocation, "px;");
5568
+ const {
5569
+ cardWidth,
5570
+ tooltipPadding
5571
+ } = constants;
5572
+ const halfCardWidth = cardWidth / 2;
5573
+ const yLocation = containerHeight - (y(d) * transform.zoom + transform.y - tooltipPadding);
5574
+ const xLocation = x(d) * transform.zoom + transform.x + halfCardWidth * transform.zoom;
5575
+ return `bottom:${yLocation}px;left:${xLocation}px;`;
5939
5576
  }
5940
5577
  function getTooltipContent(d, styling) {
5941
- var label = d.data.attributes.label || d.data.id;
5942
- var subLabel = d.data.attributes.subLabel ? "".concat(d.data.attributes.subLabel, "<br />") : '';
5943
- var extraLabel = d.data.attributes.extraLabel ? "".concat(d.data.attributes.extraLabel, "<br />") : '';
5944
- var measure = d.data.measure ? "".concat(styling.measureLabel ? "".concat(styling.measureLabel, ": ") : '').concat(d.data.measure) : '';
5945
- return "<div class=\"sn-org-tooltip-inner\"><div class=\"sn-org-tooltip-header\">".concat(label, "</div>").concat(subLabel).concat(extraLabel).concat(measure, "</div>");
5946
- }
5947
- function openTooltip(tooltip, d, containerHeight, styling, x, y, transform) {
5948
- var delay = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : 250;
5578
+ const label = encodeUtils.encodeTitle(d.data.attributes.label || d.data.id);
5579
+ const subLabel = d.data.attributes.subLabel ? `${encodeUtils.encodeTitle(d.data.attributes.subLabel)}<br />` : '';
5580
+ const extraLabel = d.data.attributes.extraLabel ? `${encodeUtils.encodeTitle(d.data.attributes.extraLabel)}<br />` : '';
5581
+ const measure = encodeUtils.encodeTitle(d.data.measure ? `${styling.measureLabel ? `${styling.measureLabel}: ` : ''}${d.data.measure}` : '');
5582
+ return `<div class="sn-org-tooltip-inner"><div class="sn-org-tooltip-header">${label}</div>${subLabel}${extraLabel}${measure}</div>`;
5583
+ }
5584
+ function openTooltip(tooltip, d, containerHeight, styling, x, y, transform, delay = 250) {
5949
5585
  tooltip.active = true;
5950
- tooltip.timeout = setTimeout(function () {
5586
+ tooltip.timeout = setTimeout(() => {
5951
5587
  if (tooltip.active) {
5952
- tooltip.html(getTooltipContent(d, styling)).classed('sn-org-tooltip-visible', true).attr('style', function () {
5953
- return getTooltipStyle(d, containerHeight, x, y, transform);
5954
- });
5588
+ tooltip.html(getTooltipContent(d, styling)).classed('sn-org-tooltip-visible', true).attr('style', () => getTooltipStyle(d, containerHeight, x, y, transform));
5955
5589
  }
5956
5590
  }, delay);
5957
5591
  }
@@ -5961,22 +5595,22 @@ function closeTooltip(tooltip) {
5961
5595
  tooltip.classed('sn-org-tooltip-visible', false);
5962
5596
  }
5963
5597
 
5964
- var getSign = function getSign(d, _ref, ancestorIds) {
5965
- var topId = _ref.topId,
5966
- isExpanded = _ref.isExpanded,
5967
- expandedChildren = _ref.expandedChildren;
5968
-
5598
+ const getSign = (d, {
5599
+ topId,
5600
+ isExpanded,
5601
+ expandedChildren
5602
+ }, ancestorIds) => {
5969
5603
  if (d.data.id === topId && isExpanded || d.parent && d.parent.data.id === topId && expandedChildren.includes(d.data.id) || ancestorIds.includes(d.data.id)) {
5970
5604
  return '-';
5971
5605
  }
5972
5606
 
5973
5607
  return '+';
5974
5608
  };
5975
- var getNewState = function getNewState(d, _ref2, ancestorIds) {
5976
- var topId = _ref2.topId,
5977
- isExpanded = _ref2.isExpanded,
5978
- expandedChildren = _ref2.expandedChildren;
5979
-
5609
+ const getNewState = (d, {
5610
+ topId,
5611
+ isExpanded,
5612
+ expandedChildren
5613
+ }, ancestorIds) => {
5980
5614
  if (d.data.id === topId) {
5981
5615
  // top
5982
5616
  isExpanded = !isExpanded;
@@ -5988,11 +5622,7 @@ var getNewState = function getNewState(d, _ref2, ancestorIds) {
5988
5622
  expandedChildren = [];
5989
5623
  } else if (d.parent.data.id === topId) {
5990
5624
  // children
5991
- var expandedHaveNoChildren = d.parent.children.filter(function (sibling) {
5992
- return expandedChildren.includes(sibling.data.id);
5993
- }).every(function (n) {
5994
- return haveNoChildren(n.children);
5995
- });
5625
+ const expandedHaveNoChildren = d.parent.children.filter(sibling => expandedChildren.includes(sibling.data.id)).every(n => haveNoChildren(n.children));
5996
5626
 
5997
5627
  if (expandedChildren.includes(d.data.id)) {
5998
5628
  // Collapse if already exists in expandedChildren
@@ -6012,91 +5642,72 @@ var getNewState = function getNewState(d, _ref2, ancestorIds) {
6012
5642
  }
6013
5643
 
6014
5644
  return {
6015
- topId: topId,
6016
- isExpanded: isExpanded,
6017
- expandedChildren: expandedChildren
5645
+ topId,
5646
+ isExpanded,
5647
+ expandedChildren
6018
5648
  };
6019
5649
  };
6020
- function box(_ref3) {
6021
- var positioning = _ref3.positioning,
6022
- divBox = _ref3.divBox,
6023
- nodes = _ref3.nodes,
6024
- styling = _ref3.styling,
6025
- setExpandedCallback = _ref3.setExpandedCallback,
6026
- wrapperState = _ref3.wrapperState,
6027
- selectionObj = _ref3.selectionObj,
6028
- navigationMode = _ref3.navigationMode,
6029
- element = _ref3.element,
6030
- tooltip = _ref3.tooltip;
6031
- var x = positioning.x,
6032
- y = positioning.y;
6033
- var cardWidth = constants.cardWidth,
6034
- cardHeight = constants.cardHeight,
6035
- buttonWidth = constants.buttonWidth,
6036
- buttonHeight = constants.buttonHeight,
6037
- cardPadding = constants.cardPadding,
6038
- rootDiameter = constants.rootDiameter;
6039
- var topId = wrapperState.expandedState.topId;
6040
- var topNode = nodes.find(function (node) {
6041
- return node.data.id === topId;
6042
- });
6043
- var ancestorIds = topNode && topNode.parent ? topNode.parent.ancestors().map(function (anc) {
6044
- return anc.data.id;
6045
- }) : [];
6046
- var touchmode = document.getElementsByTagName('html')[0].classList.contains('touch-on'); // dummy root
6047
-
6048
- divBox.selectAll('.sn-org-nodes').data(nodes.filter(function (node) {
6049
- return node.parent && node.parent.data.id === 'Root';
6050
- })).enter().append('div').attr('class', 'sn-org-root').attr('style', function (d) {
6051
- return "top:".concat(y(d) - rootDiameter - cardPadding, "px;left:").concat(x(d) + (cardWidth - rootDiameter) / 2, "px");
6052
- }).attr('id', function (d) {
6053
- return d.data.id;
6054
- }); // cards
6055
-
6056
- divBox.selectAll('.sn-org-nodes').data(nodes.filter(function (node) {
6057
- return node.data.id !== 'Root';
6058
- })).enter().append('div').attr('class', 'sn-org-card').attr('style', function (d) {
6059
- return "width:".concat(cardWidth, "px;height:").concat(cardHeight, "px; top:").concat(y(d), "px;left:").concat(x(d), "px;");
6060
- }).attr('id', function (d) {
6061
- return d.data.id;
6062
- }).on('click', function (node) {
6063
- if (!wrapperState.constraints.select && node.data.id !== 'Root') {
5650
+ function box({
5651
+ positioning,
5652
+ divBox,
5653
+ nodes,
5654
+ styling,
5655
+ setExpandedCallback,
5656
+ wrapperState,
5657
+ selectionObj,
5658
+ navigationMode,
5659
+ element,
5660
+ tooltip
5661
+ }) {
5662
+ const {
5663
+ x,
5664
+ y
5665
+ } = positioning;
5666
+ const {
5667
+ cardWidth,
5668
+ cardHeight,
5669
+ buttonWidth,
5670
+ buttonHeight,
5671
+ cardPadding,
5672
+ rootDiameter
5673
+ } = constants;
5674
+ const {
5675
+ topId
5676
+ } = wrapperState.expandedState;
5677
+ const topNode = nodes.find(node => node.data.id === topId);
5678
+ const ancestorIds = topNode && topNode.parent ? topNode.parent.ancestors().map(anc => anc.data.id) : [];
5679
+ const touchmode = document.getElementsByTagName('html')[0].classList.contains('touch-on'); // dummy root
5680
+
5681
+ divBox.selectAll('.sn-org-nodes').data(nodes.filter(node => node.parent && node.parent.data.id === 'Root')).enter().append('div').attr('class', 'sn-org-root').attr('style', d => `top:${y(d) - rootDiameter - cardPadding}px;left:${x(d) + (cardWidth - rootDiameter) / 2}px`).attr('id', d => d.data.id); // cards
5682
+
5683
+ divBox.selectAll('.sn-org-nodes').data(nodes.filter(node => node.data.id !== 'Root')).enter().append('div').attr('class', 'sn-org-card').attr('style', d => `width:${cardWidth}px;height:${cardHeight}px; top:${y(d)}px;left:${x(d)}px;`).attr('id', d => d.data.id).on('click', node => {
5684
+ if (!wrapperState.constraints.active && node.data.id !== 'Root') {
6064
5685
  touchmode && openTooltip(tooltip, node, element.clientHeight, styling, x, y, wrapperState.transform, 0);
6065
5686
  selections.select(node, selectionObj);
6066
5687
  }
6067
- }).html(function (d) {
6068
- return card(d.data, styling, selectionObj);
6069
- }).on('mouseenter', function (d) {
5688
+ }).html(d => card(d.data, styling, selectionObj)).on('mouseenter', d => {
6070
5689
  if (!touchmode && !wrapperState.constraints.active && event.buttons === 0) {
6071
5690
  openTooltip(tooltip, d, element.clientHeight, styling, x, y, wrapperState.transform);
6072
5691
  }
6073
- }).on('mouseleave', function () {
5692
+ }).on('mouseleave', () => {
6074
5693
  !touchmode && closeTooltip(tooltip);
6075
- }).on('mousedown', function () {
5694
+ }).on('mousedown', () => {
6076
5695
  closeTooltip(tooltip);
6077
- }).on('touchmove', function () {
5696
+ }).on('touchmove', () => {
6078
5697
  closeTooltip(tooltip);
6079
- }).on('wheel', function () {
5698
+ }).on('wheel', () => {
6080
5699
  closeTooltip(tooltip);
6081
5700
  }); // expand/collapse
6082
5701
 
6083
5702
  if (navigationMode !== 'expandAll') {
6084
- divBox.selectAll('.sn-org-nodes').data(nodes.filter(function (node) {
6085
- return !!node.children && node.data.id !== 'Root';
6086
- })).enter().append('div').attr('class', 'sn-org-traverse').attr('style', function (d) {
6087
- return "width:".concat(buttonWidth, "px;height:").concat(buttonHeight, "px;top:").concat(y(d) + cardHeight + cardPadding, "px;left:").concat(x(d) + (cardWidth - buttonWidth) / 2, "px;");
6088
- }).attr('id', function (d) {
6089
- return "".concat(d.data.id, "-expand");
6090
- }).on('mouseenter', function () {
5703
+ divBox.selectAll('.sn-org-nodes').data(nodes.filter(node => !!node.children && node.data.id !== 'Root')).enter().append('div').attr('class', 'sn-org-traverse').attr('style', d => `width:${buttonWidth}px;height:${buttonHeight}px;top:${y(d) + cardHeight + cardPadding}px;left:${x(d) + (cardWidth - buttonWidth) / 2}px;`).attr('id', d => `${d.data.id}-expand`).on('mouseenter', () => {
6091
5704
  if (!wrapperState.constraints.active) event.target.style.cursor = 'pointer';
6092
- }).on('click', function (d) {
5705
+ }).on('click', d => {
6093
5706
  if (!wrapperState.constraints.active) {
6094
5707
  setExpandedCallback(getNewState(d, wrapperState.expandedState, ancestorIds));
6095
5708
  event.stopPropagation();
6096
5709
  }
6097
- }).html(function (d) {
6098
- return "".concat(getSign(d, wrapperState.expandedState, ancestorIds), " ").concat(d.data.children.length);
6099
- });
5710
+ }).html(d => `${getSign(d, wrapperState.expandedState, ancestorIds)} ${d.data.children.length}`);
6100
5711
  } // go up only necessary in page navigation mode
6101
5712
  // if (navigationMode !== 'free') {
6102
5713
  // divBox
@@ -6122,31 +5733,34 @@ function box(_ref3) {
6122
5733
 
6123
5734
  }
6124
5735
 
6125
- function getPoints(d, topId, _ref, navigationMode) {
6126
- var depthSpacing = _ref.depthSpacing,
6127
- isVertical = _ref.isVertical,
6128
- x = _ref.x,
6129
- y = _ref.y;
5736
+ function getPoints(d, topId, {
5737
+ depthSpacing,
5738
+ isVertical,
5739
+ x,
5740
+ y
5741
+ }, navigationMode) {
6130
5742
  // TODO: Generalize to make all directions work, currently on only ttb working
6131
- var cardWidth = constants.cardWidth,
6132
- cardHeight = constants.cardHeight,
6133
- buttonHeight = constants.buttonHeight,
6134
- cardPadding = constants.cardPadding,
6135
- buttonMargin = constants.buttonMargin;
6136
- var points = [];
6137
- var halfCard = {
5743
+ const {
5744
+ cardWidth,
5745
+ cardHeight,
5746
+ buttonHeight,
5747
+ cardPadding,
5748
+ buttonMargin
5749
+ } = constants;
5750
+ const points = [];
5751
+ const halfCard = {
6138
5752
  x: cardWidth / 2,
6139
5753
  y: cardHeight / 2
6140
5754
  };
6141
- var start = {
5755
+ const start = {
6142
5756
  x: d.xActual,
6143
5757
  y: d.yActual
6144
5758
  }; // TODO: fix so auto mode does not get a path to parent not showing
6145
5759
 
6146
5760
  if (d.parent && d.parent.data.id !== 'Root') {
6147
- var halfDepth = depthSpacing / 2;
6148
- var yOffset = navigationMode === 'expandAll' ? cardHeight : cardHeight + cardPadding + buttonHeight;
6149
- var end = {
5761
+ const halfDepth = depthSpacing / 2;
5762
+ const yOffset = navigationMode === 'expandAll' ? cardHeight : cardHeight + cardPadding + buttonHeight;
5763
+ const end = {
6150
5764
  x: x(d.parent) + halfCard.x,
6151
5765
  y: y(d.parent) + yOffset
6152
5766
  };
@@ -6247,12 +5861,14 @@ function getPoints(d, topId, _ref, navigationMode) {
6247
5861
  }
6248
5862
  function getPath(points) {
6249
5863
  // gets the path from first to last points, making turns with radius r at intermediate points
6250
- var r = constants.r;
6251
- var pathString = "M ".concat(points[0].x, " ").concat(points[0].y, " ");
6252
- var dir;
6253
-
6254
- var setDir = function setDir(i) {
6255
- var delta = {
5864
+ const {
5865
+ r
5866
+ } = constants;
5867
+ let pathString = `M ${points[0].x} ${points[0].y} `;
5868
+ let dir;
5869
+
5870
+ const setDir = i => {
5871
+ const delta = {
6256
5872
  x: points[i].x - points[i - 1].x,
6257
5873
  y: points[i].y - points[i - 1].y
6258
5874
  };
@@ -6264,46 +5880,46 @@ function getPath(points) {
6264
5880
 
6265
5881
  setDir(1);
6266
5882
 
6267
- for (var i = 1; i < points.length; ++i) {
6268
- var point = points[i];
5883
+ for (let i = 1; i < points.length; ++i) {
5884
+ const point = points[i];
6269
5885
 
6270
5886
  if (i < points.length - 1) {
6271
- pathString += "L ".concat(point.x - dir.x * r, " ").concat(point.y - dir.y * r, " ");
5887
+ pathString += `L ${point.x - dir.x * r} ${point.y - dir.y * r} `;
6272
5888
  setDir(i + 1);
6273
- pathString += "Q ".concat(point.x, " ").concat(point.y, " ").concat(point.x + dir.x * r, " ").concat(point.y + dir.y * r, " ");
5889
+ pathString += `Q ${point.x} ${point.y} ${point.x + dir.x * r} ${point.y + dir.y * r} `;
6274
5890
  } else {
6275
5891
  // Don't add curve for last point
6276
- pathString += "L ".concat(point.x, " ").concat(point.y, " ");
5892
+ pathString += `L ${point.x} ${point.y} `;
6277
5893
  }
6278
5894
  }
6279
5895
 
6280
5896
  return pathString;
6281
5897
  }
6282
5898
  function createPaths(node, positioning, topId, navigationMode) {
6283
- node.append('path').attr('class', 'sn-org-path').attr('id', function (d) {
6284
- return d.data.id;
6285
- }).attr('d', function (d) {
6286
- var path = '';
6287
- var pointSets = getPoints(d, topId, positioning, navigationMode);
6288
- pointSets.forEach(function (points) {
5899
+ node.append('path').attr('class', 'sn-org-path').attr('id', d => d.data.id).attr('d', d => {
5900
+ let path = '';
5901
+ const pointSets = getPoints(d, topId, positioning, navigationMode);
5902
+ pointSets.forEach(points => {
6289
5903
  path += getPath(points).slice(0, -1);
6290
5904
  });
6291
5905
  return path;
6292
5906
  });
6293
5907
  }
6294
5908
 
6295
- var getBBoxOfNodes = function getBBoxOfNodes(nodes) {
6296
- var cardWidth = constants.cardWidth,
6297
- cardHeight = constants.cardHeight,
6298
- buttonHeight = constants.buttonHeight,
6299
- buttonMargin = constants.buttonMargin;
6300
- var bbox = {
5909
+ const getBBoxOfNodes = nodes => {
5910
+ const {
5911
+ cardWidth,
5912
+ cardHeight,
5913
+ buttonHeight,
5914
+ buttonMargin
5915
+ } = constants;
5916
+ const bbox = {
6301
5917
  left: Infinity,
6302
5918
  top: Infinity,
6303
5919
  right: -Infinity,
6304
5920
  bottom: -Infinity
6305
5921
  };
6306
- nodes.forEach(function (node) {
5922
+ nodes.forEach(node => {
6307
5923
  bbox.left = Math.min(node.xActual, bbox.left);
6308
5924
  bbox.top = Math.min(node.yActual, bbox.top);
6309
5925
  bbox.right = Math.max(node.xActual, bbox.right);
@@ -6316,19 +5932,25 @@ var getBBoxOfNodes = function getBBoxOfNodes(nodes) {
6316
5932
  height: bbox.bottom - bbox.top + cardHeight + (buttonHeight + buttonMargin) * 2
6317
5933
  };
6318
5934
  };
6319
- var getInitialZoomState = function getInitialZoomState(bBox, element, navigationMode) {
6320
- var widthMargin = constants.widthMargin,
6321
- cardHeight = constants.cardHeight,
6322
- minZoom = constants.minZoom;
6323
- var maxZoom = navigationMode === 'expandAll' ? Infinity : constants.maxZoom;
6324
- var width = bBox.width,
6325
- height = bBox.height;
6326
- var clientHeight = element.clientHeight,
6327
- clientWidth = element.clientWidth;
6328
- var calcWidth = width + 2 * widthMargin;
6329
- var calcHeight = height + cardHeight;
6330
- var xZoom = Math.max(Math.min(calcWidth / clientWidth, maxZoom), minZoom);
6331
- var yZoom = Math.max(Math.min(calcHeight / clientHeight, maxZoom), minZoom);
5935
+ const getInitialZoomState = (bBox, element, navigationMode) => {
5936
+ const {
5937
+ widthMargin,
5938
+ cardHeight,
5939
+ minZoom
5940
+ } = constants;
5941
+ const maxZoom = navigationMode === 'expandAll' ? Infinity : constants.maxZoom;
5942
+ const {
5943
+ width,
5944
+ height
5945
+ } = bBox;
5946
+ const {
5947
+ clientHeight,
5948
+ clientWidth
5949
+ } = element;
5950
+ const calcWidth = width + 2 * widthMargin;
5951
+ const calcHeight = height + cardHeight;
5952
+ const xZoom = Math.max(Math.min(calcWidth / clientWidth, maxZoom), minZoom);
5953
+ const yZoom = Math.max(Math.min(calcHeight / clientHeight, maxZoom), minZoom);
6332
5954
 
6333
5955
  if (xZoom > yZoom) {
6334
5956
  // Zooming for x direction
@@ -6346,45 +5968,50 @@ var getInitialZoomState = function getInitialZoomState(bBox, element, navigation
6346
5968
  initialZoom: yZoom
6347
5969
  };
6348
5970
  };
6349
- var applyTransform = function applyTransform(eventTransform, svg, divBox, width, height) {
6350
- var scaleFactor = eventTransform.k;
6351
- var translation = "".concat(eventTransform.x, "px, ").concat(eventTransform.y, "px");
5971
+ const applyTransform = (eventTransform, svg, divBox, width, height) => {
5972
+ const scaleFactor = eventTransform.k;
5973
+ const translation = `${eventTransform.x}px, ${eventTransform.y}px`;
6352
5974
  svg.attr('transform', eventTransform);
6353
5975
  divBox.classed('org-disable-transition', true);
6354
5976
  svg.classed('org-disable-transition', true);
6355
- divBox.attr('style', "width:".concat(width, "px;height:").concat(height, "px; transform: translate(").concat(translation, ") scale(").concat(scaleFactor, ")"));
5977
+ divBox.attr('style', `width:${width}px;height:${height}px; transform: translate(${translation}) scale(${scaleFactor})`);
6356
5978
  };
6357
- function setZooming(_ref) {
6358
- var containerData = _ref.containerData,
6359
- setTransform = _ref.setTransform,
6360
- transformState = _ref.transformState,
6361
- wrapperState = _ref.wrapperState,
6362
- initialZoomState = _ref.initialZoomState,
6363
- navigationMode = _ref.navigationMode;
6364
- var svg = containerData.svg,
6365
- divBox = containerData.divBox,
6366
- width = containerData.width,
6367
- height = containerData.height,
6368
- zoomWrapper = containerData.zoomWrapper,
6369
- element = containerData.element,
6370
- tooltip = containerData.tooltip,
6371
- homeButton = containerData.homeButton;
6372
- var _transformState$x = transformState.x,
6373
- x = _transformState$x === void 0 ? 0 : _transformState$x,
6374
- _transformState$y = transformState.y,
6375
- y = _transformState$y === void 0 ? 0 : _transformState$y;
6376
- var minZoom = constants.minZoom,
6377
- maxZoom = constants.maxZoom;
6378
- var zoomFactor = transformState && 1 / transformState.zoom || initialZoomState.initialZoom;
6379
- var scaleFactor = navigationMode === 'expandAll' ? zoomFactor : Math.max(Math.min(maxZoom, zoomFactor), minZoom); // sends otherwise captured mouse event to handle context menu correctly in sense
6380
-
6381
- var bubbleEvent = function bubbleEvent() {
6382
- var newEvent = document.createEvent('MouseEvents');
5979
+ function setZooming({
5980
+ containerData,
5981
+ setTransform,
5982
+ transformState,
5983
+ wrapperState,
5984
+ initialZoomState,
5985
+ navigationMode
5986
+ }) {
5987
+ const {
5988
+ svg,
5989
+ divBox,
5990
+ width,
5991
+ height,
5992
+ zoomWrapper,
5993
+ element,
5994
+ tooltip,
5995
+ homeButton
5996
+ } = containerData;
5997
+ const {
5998
+ x = 0,
5999
+ y = 0
6000
+ } = transformState;
6001
+ const {
6002
+ minZoom,
6003
+ maxZoom
6004
+ } = constants;
6005
+ const zoomFactor = transformState && 1 / transformState.zoom || initialZoomState.initialZoom;
6006
+ const scaleFactor = navigationMode === 'expandAll' ? zoomFactor : Math.max(Math.min(maxZoom, zoomFactor), minZoom); // sends otherwise captured mouse event to handle context menu correctly in sense
6007
+
6008
+ const bubbleEvent = () => {
6009
+ const newEvent = document.createEvent('MouseEvents');
6383
6010
  newEvent.initEvent('mousedown', true, false);
6384
6011
  element.dispatchEvent(newEvent);
6385
6012
  };
6386
6013
 
6387
- var zoomed = function zoomed() {
6014
+ const zoomed = () => {
6388
6015
  select(homeButton).attr('class', 'sn-org-homebutton lui-fade-button lui-fade-button--large');
6389
6016
  setTransform({
6390
6017
  zoom: event$1.transform.k / scaleFactor,
@@ -6393,61 +6020,66 @@ function setZooming(_ref) {
6393
6020
  });
6394
6021
  bubbleEvent();
6395
6022
  closeTooltip(tooltip);
6396
- applyTransform(identity$1.translate(event$1.transform.x, event$1.transform.y).scale(event$1.transform.k / scaleFactor), svg, divBox, width, height);
6023
+ applyTransform(identity.translate(event$1.transform.x, event$1.transform.y).scale(event$1.transform.k / scaleFactor), svg, divBox, width, height);
6397
6024
  };
6398
6025
 
6399
- select(zoomWrapper).call(zoom().extent([[0, 0], [width, height]]).filter(function () {
6400
- return !wrapperState.constraints.active && event$1.type !== 'dblclick' && !(event$1.type === 'mousedown' && event$1.which === 3);
6401
- }).scaleExtent([navigationMode === 'expandAll' ? 0.8 : minZoom * scaleFactor, maxZoom * scaleFactor]).on('start', bubbleEvent).on('zoom', zoomed));
6026
+ select(zoomWrapper).call(zoom().extent([[0, 0], [width, height]]).filter(() => !wrapperState.constraints.active && event$1.type !== 'dblclick' && !(event$1.type === 'mousedown' && event$1.which === 3)).scaleExtent([navigationMode === 'expandAll' ? 0.8 : minZoom * scaleFactor, maxZoom * scaleFactor]).on('start', bubbleEvent).on('zoom', zoomed));
6402
6027
  setTransform({
6403
6028
  zoom: 1 / scaleFactor,
6404
- x: x,
6405
- y: y
6029
+ x,
6030
+ y
6406
6031
  });
6407
- applyTransform(identity$1.translate(x, y).scale(1 / scaleFactor), svg, divBox, width, height);
6032
+ applyTransform(identity.translate(x, y).scale(1 / scaleFactor), svg, divBox, width, height);
6408
6033
  }
6409
- var getSnapshotZoom = function getSnapshotZoom(rect, viewState, initialTransform) {
6034
+ const getSnapshotZoom = (rect, viewState, initialTransform) => {
6410
6035
  if (!viewState) {
6411
- return identity$1.translate(initialTransform.x, initialTransform.y).scale(initialTransform.zoom);
6036
+ return identity.translate(initialTransform.x, initialTransform.y).scale(initialTransform.zoom);
6412
6037
  }
6413
6038
 
6414
- var size = viewState.size;
6415
- var snapZoom = rect.width / size.w > rect.height / size.h ? rect.height / size.h : rect.width / size.w;
6416
- var newX = viewState.transform.x * snapZoom;
6417
- var newY = viewState.transform.y * snapZoom;
6418
- var newZoom = viewState.transform.zoom * snapZoom;
6419
- return identity$1.translate(newX, newY).scale(newZoom);
6039
+ const {
6040
+ size
6041
+ } = viewState;
6042
+ const snapZoom = rect.width / size.w > rect.height / size.h ? rect.height / size.h : rect.width / size.w;
6043
+ const newX = viewState.transform.x * snapZoom;
6044
+ const newY = viewState.transform.y * snapZoom;
6045
+ const newZoom = viewState.transform.zoom * snapZoom;
6046
+ return identity.translate(newX, newY).scale(newZoom);
6420
6047
  };
6421
6048
 
6422
- var singleSelectionIcon = 'M9.5,15 C9.77614237,15 10,15.2238576 10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 Z M15.5,13 C15.7761424,13 16,13.2238576 16,13.5 L16,15 C16,15.5522847 15.5522847,16 15,16 L13.5,16 C13.2238576,16 13,15.7761424 13,15.5 C13,15.2238576 13.2238576,15 13.5,15 L14.4,15 C14.7313708,15 15,14.7313708 15,14.4 L15,13.5 C15,13.2238576 15.2238576,13 15.5,13 Z M0.5,13 C0.776142375,13 1,13.2238576 1,13.5 L1,14.4 C1,14.7313708 1.26862915,15 1.6,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 0,15.5522847 0,15 L0,13.5 C0,13.2238576 0.223857625,13 0.5,13 Z M6.8,9 C6.91045695,9 7,9.08954305 7,9.2 L7,12.8 C7,12.9104569 6.91045695,13 6.8,13 L3.2,13 C3.08954305,13 3,12.9104569 3,12.8 L3,9.2 C3,9.08954305 3.08954305,9 3.2,9 L6.8,9 Z M12.8,9 C12.9104569,9 13,9.08954305 13,9.2 L13,12.8 C13,12.9104569 12.9104569,13 12.8,13 L9.2,13 C9.08954305,13 9,12.9104569 9,12.8 L9,9.2 C9,9.08954305 9.08954305,9 9.2,9 L12.8,9 Z M6,10 L4,10 L4,12 L6,12 L6,10 Z M12,10 L10,10 L10,12 L12,12 L12,10 Z M15.5,6 C15.7761424,6 16,6.22385763 16,6.5 L16,9.5 C16,9.77614237 15.7761424,10 15.5,10 C15.2238576,10 15,9.77614237 15,9.5 L15,6.5 C15,6.22385763 15.2238576,6 15.5,6 Z M0.5,6 C0.776142375,6 1,6.22385763 1,6.5 L1,9.5 C1,9.77614237 0.776142375,10 0.5,10 C0.223857625,10 0,9.77614237 0,9.5 L0,6.5 C0,6.22385763 0.223857625,6 0.5,6 Z M6.8,3 C6.91045695,3 7,3.08954305 7,3.2 L7,6.8 C7,6.91045695 6.91045695,7 6.8,7 L3.2,7 C3.08954305,7 3,6.91045695 3,6.8 L3,3.2 C3,3.08954305 3.08954305,3 3.2,3 L6.8,3 Z M12.8,3 C12.9104569,3 13,3.08954305 13,3.2 L13,6.8 C13,6.91045695 12.9104569,7 12.8,7 L9.2,7 C9.08954305,7 9,6.91045695 9,6.8 L9,3.2 C9,3.08954305 9.08954305,3 9.2,3 L12.8,3 Z M12,4 L10,4 L10,6 L12,6 L12,4 Z M2.5,5.70654635e-14 C2.77614237,5.70654635e-14 3,0.223857625 3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.6,1 C1.26862915,1 1,1.26862915 1,1.6 L1,2.5 C1,2.77614237 0.776142375,3 0.5,3 C0.223857625,3 0,2.77614237 0,2.5 L0,1 C0,0.44771525 0.44771525,5.70654635e-14 1,5.70654635e-14 L2.5,5.70654635e-14 Z M15,0 C15.5522847,0 16,0.44771525 16,1 L16,2.5 C16,2.77614237 15.7761424,3 15.5,3 C15.2238576,3 15,2.77614237 15,2.5 L15,1.6 C15,1.26862915 14.7313708,1 14.4,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 C13,0.223857625 13.2238576,0 13.5,0 L15,0 Z M9.5,5.67323966e-14 C9.77614237,5.67323966e-14 10,0.223857625 10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 C6,0.223857625 6.22385763,5.67323966e-14 6.5,5.67323966e-14 L9.5,5.67323966e-14 Z';
6423
- var homeIcon = "<span class=\"lui-fade-button__icon sn-org-home-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"20\" height=\"20\" viewBox=\"0 0 16 16\">\n <defs>\n <path id=\"home-a\" d=\"M2,7.9 L8,3.4 L14,7.9 L14,16 L12,16 L12,11.2 C12,11.0895431 11.9104569,11 11.8,11 L9.2,11 C9.08954305,11 9,11.0895431 9,11.2 L9,16 L2,16 L2,7.9 Z M7,13.8 L7,11.2 C7,11.0895431 6.91045695,11 6.8,11 L4.2,11 C4.08954305,11 4,11.0895431 4,11.2 L4,13.8 C4,13.9104569 4.08954305,14 4.2,14 L6.8,14 C6.91045695,14 7,13.9104569 7,13.8 Z M13,4.1 L16,6.5 L15,7.5 L8,2 L1,7.5 L0,6.5 L8,0 L11,2.4 L11,1 L13,1 L13,4.1 Z\"/>\n </defs>\n <use xlink:href=\"#home-a\"/>\n </svg>\n </span>";
6424
-
6425
- var filterTree = function filterTree(_ref, nodeTree, extended, navigationMode) {
6426
- var topId = _ref.topId,
6427
- isExpanded = _ref.isExpanded,
6428
- expandedChildren = _ref.expandedChildren;
6429
-
6049
+ const singleSelectionIcon = 'M9.5,15 C9.77614237,15 10,15.2238576 10,15.5 C10,15.7761424 9.77614237,16 9.5,16 L6.5,16 C6.22385763,16 6,15.7761424 6,15.5 C6,15.2238576 6.22385763,15 6.5,15 L9.5,15 Z M15.5,13 C15.7761424,13 16,13.2238576 16,13.5 L16,15 C16,15.5522847 15.5522847,16 15,16 L13.5,16 C13.2238576,16 13,15.7761424 13,15.5 C13,15.2238576 13.2238576,15 13.5,15 L14.4,15 C14.7313708,15 15,14.7313708 15,14.4 L15,13.5 C15,13.2238576 15.2238576,13 15.5,13 Z M0.5,13 C0.776142375,13 1,13.2238576 1,13.5 L1,14.4 C1,14.7313708 1.26862915,15 1.6,15 L2.5,15 C2.77614237,15 3,15.2238576 3,15.5 C3,15.7761424 2.77614237,16 2.5,16 L1,16 C0.44771525,16 0,15.5522847 0,15 L0,13.5 C0,13.2238576 0.223857625,13 0.5,13 Z M6.8,9 C6.91045695,9 7,9.08954305 7,9.2 L7,12.8 C7,12.9104569 6.91045695,13 6.8,13 L3.2,13 C3.08954305,13 3,12.9104569 3,12.8 L3,9.2 C3,9.08954305 3.08954305,9 3.2,9 L6.8,9 Z M12.8,9 C12.9104569,9 13,9.08954305 13,9.2 L13,12.8 C13,12.9104569 12.9104569,13 12.8,13 L9.2,13 C9.08954305,13 9,12.9104569 9,12.8 L9,9.2 C9,9.08954305 9.08954305,9 9.2,9 L12.8,9 Z M6,10 L4,10 L4,12 L6,12 L6,10 Z M12,10 L10,10 L10,12 L12,12 L12,10 Z M15.5,6 C15.7761424,6 16,6.22385763 16,6.5 L16,9.5 C16,9.77614237 15.7761424,10 15.5,10 C15.2238576,10 15,9.77614237 15,9.5 L15,6.5 C15,6.22385763 15.2238576,6 15.5,6 Z M0.5,6 C0.776142375,6 1,6.22385763 1,6.5 L1,9.5 C1,9.77614237 0.776142375,10 0.5,10 C0.223857625,10 0,9.77614237 0,9.5 L0,6.5 C0,6.22385763 0.223857625,6 0.5,6 Z M6.8,3 C6.91045695,3 7,3.08954305 7,3.2 L7,6.8 C7,6.91045695 6.91045695,7 6.8,7 L3.2,7 C3.08954305,7 3,6.91045695 3,6.8 L3,3.2 C3,3.08954305 3.08954305,3 3.2,3 L6.8,3 Z M12.8,3 C12.9104569,3 13,3.08954305 13,3.2 L13,6.8 C13,6.91045695 12.9104569,7 12.8,7 L9.2,7 C9.08954305,7 9,6.91045695 9,6.8 L9,3.2 C9,3.08954305 9.08954305,3 9.2,3 L12.8,3 Z M12,4 L10,4 L10,6 L12,6 L12,4 Z M2.5,5.70654635e-14 C2.77614237,5.70654635e-14 3,0.223857625 3,0.5 C3,0.776142375 2.77614237,1 2.5,1 L1.6,1 C1.26862915,1 1,1.26862915 1,1.6 L1,2.5 C1,2.77614237 0.776142375,3 0.5,3 C0.223857625,3 0,2.77614237 0,2.5 L0,1 C0,0.44771525 0.44771525,5.70654635e-14 1,5.70654635e-14 L2.5,5.70654635e-14 Z M15,0 C15.5522847,0 16,0.44771525 16,1 L16,2.5 C16,2.77614237 15.7761424,3 15.5,3 C15.2238576,3 15,2.77614237 15,2.5 L15,1.6 C15,1.26862915 14.7313708,1 14.4,1 L13.5,1 C13.2238576,1 13,0.776142375 13,0.5 C13,0.223857625 13.2238576,0 13.5,0 L15,0 Z M9.5,5.67323966e-14 C9.77614237,5.67323966e-14 10,0.223857625 10,0.5 C10,0.776142375 9.77614237,1 9.5,1 L6.5,1 C6.22385763,1 6,0.776142375 6,0.5 C6,0.223857625 6.22385763,5.67323966e-14 6.5,5.67323966e-14 L9.5,5.67323966e-14 Z';
6050
+ const homeIcon = `<span class="lui-fade-button__icon sn-org-home-icon">
6051
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="20" height="20" viewBox="0 0 16 16">
6052
+ <defs>
6053
+ <path id="home-a" d="M2,7.9 L8,3.4 L14,7.9 L14,16 L12,16 L12,11.2 C12,11.0895431 11.9104569,11 11.8,11 L9.2,11 C9.08954305,11 9,11.0895431 9,11.2 L9,16 L2,16 L2,7.9 Z M7,13.8 L7,11.2 C7,11.0895431 6.91045695,11 6.8,11 L4.2,11 C4.08954305,11 4,11.0895431 4,11.2 L4,13.8 C4,13.9104569 4.08954305,14 4.2,14 L6.8,14 C6.91045695,14 7,13.9104569 7,13.8 Z M13,4.1 L16,6.5 L15,7.5 L8,2 L1,7.5 L0,6.5 L8,0 L11,2.4 L11,1 L13,1 L13,4.1 Z"/>
6054
+ </defs>
6055
+ <use xlink:href="#home-a"/>
6056
+ </svg>
6057
+ </span>`;
6058
+
6059
+ const filterTree = ({
6060
+ topId,
6061
+ isExpanded,
6062
+ expandedChildren
6063
+ }, nodeTree, extended, navigationMode) => {
6430
6064
  if (navigationMode === 'expandAll') {
6431
6065
  return nodeTree.descendants();
6432
6066
  }
6433
6067
 
6434
- var topNode = nodeTree.descendants().find(function (node) {
6435
- return node.data.id === topId;
6436
- }) || nodeTree;
6437
- var subTree = [];
6068
+ const topNode = nodeTree.descendants().find(node => node.data.id === topId) || nodeTree;
6069
+ const subTree = [];
6438
6070
 
6439
6071
  if (isExpanded && topNode.children) {
6440
6072
  // children
6441
- topNode.children.forEach(function (child) {
6073
+ topNode.children.forEach(child => {
6442
6074
  subTree.push(child);
6443
6075
 
6444
6076
  if (child.children) {
6445
6077
  if (expandedChildren.indexOf(child.data.id) !== -1 || extended) {
6446
- child.children.forEach(function (grandChild) {
6078
+ child.children.forEach(grandChild => {
6447
6079
  subTree.push(grandChild);
6448
6080
 
6449
6081
  if (expandedChildren.indexOf(child.data.id) !== -1 && extended && grandChild.children) {
6450
- grandChild.children.forEach(function (extendedChild) {
6082
+ grandChild.children.forEach(extendedChild => {
6451
6083
  subTree.push(extendedChild);
6452
6084
  });
6453
6085
  }
@@ -6458,18 +6090,16 @@ var filterTree = function filterTree(_ref, nodeTree, extended, navigationMode) {
6458
6090
  }
6459
6091
 
6460
6092
  if (nodeTree.data.navigationMode === 'free' && topNode.parent) {
6461
- var ancestors = topNode.parent.ancestors();
6462
- var ancestorIds = ancestors.map(function (anc) {
6463
- return anc.data.id;
6464
- });
6465
- ancestors.forEach(function (ancestor) {
6093
+ const ancestors = topNode.parent.ancestors();
6094
+ const ancestorIds = ancestors.map(anc => anc.data.id);
6095
+ ancestors.forEach(ancestor => {
6466
6096
  if (extended) {
6467
- ancestor.children.forEach(function (child) {
6468
- child.children && ancestorIds.indexOf(child.data.id) === -1 && child.data.id !== topNode.data.id && subTree.unshift.apply(subTree, _toConsumableArray(child.children));
6097
+ ancestor.children.forEach(child => {
6098
+ child.children && ancestorIds.indexOf(child.data.id) === -1 && child.data.id !== topNode.data.id && subTree.unshift(...child.children);
6469
6099
  });
6470
6100
  }
6471
6101
 
6472
- subTree.unshift.apply(subTree, _toConsumableArray(ancestor.children));
6102
+ subTree.unshift(...ancestor.children);
6473
6103
 
6474
6104
  if (!ancestor.parent) {
6475
6105
  subTree.unshift(ancestor);
@@ -6481,86 +6111,93 @@ var filterTree = function filterTree(_ref, nodeTree, extended, navigationMode) {
6481
6111
 
6482
6112
  return subTree;
6483
6113
  };
6484
- var paintTree = function paintTree(_ref2) {
6485
- var containerData = _ref2.containerData,
6486
- styling = _ref2.styling,
6487
- setExpandedCallback = _ref2.setExpandedCallback,
6488
- wrapperState = _ref2.wrapperState,
6489
- selectionObj = _ref2.selectionObj,
6490
- element = _ref2.element;
6491
- var svg = containerData.svg,
6492
- divBox = containerData.divBox,
6493
- allNodes = containerData.allNodes,
6494
- positioning = containerData.positioning,
6495
- tooltip = containerData.tooltip;
6496
- var navigationMode = allNodes.data.navigationMode;
6114
+ const paintTree = ({
6115
+ containerData,
6116
+ styling,
6117
+ setExpandedCallback,
6118
+ wrapperState,
6119
+ selectionObj,
6120
+ element
6121
+ }) => {
6122
+ const {
6123
+ svg,
6124
+ divBox,
6125
+ allNodes,
6126
+ positioning,
6127
+ tooltip
6128
+ } = containerData;
6129
+ const {
6130
+ navigationMode
6131
+ } = allNodes.data;
6497
6132
  divBox.selectAll('*').remove();
6498
6133
  svg.selectAll('*').remove(); // filter the nodes the nodes
6499
6134
 
6500
- var nodes = filterTree(wrapperState.expandedState, allNodes, false, navigationMode); // Create cards and naviagation buttons
6135
+ const nodes = filterTree(wrapperState.expandedState, allNodes, false, navigationMode); // Create cards and naviagation buttons
6501
6136
 
6502
6137
  box({
6503
- positioning: positioning,
6504
- divBox: divBox,
6505
- nodes: nodes,
6506
- styling: styling,
6507
- setExpandedCallback: setExpandedCallback,
6508
- wrapperState: wrapperState,
6509
- selectionObj: selectionObj,
6510
- navigationMode: navigationMode,
6511
- element: element,
6512
- tooltip: tooltip
6138
+ positioning,
6139
+ divBox,
6140
+ nodes,
6141
+ styling,
6142
+ setExpandedCallback,
6143
+ wrapperState,
6144
+ selectionObj,
6145
+ navigationMode,
6146
+ element,
6147
+ tooltip
6513
6148
  }); // Create the lines (links) between the nodes
6514
6149
 
6515
- var node = svg.selectAll('.sn-org-paths').data(nodes).enter();
6150
+ const node = svg.selectAll('.sn-org-paths').data(nodes).enter();
6516
6151
  createPaths(node, positioning, wrapperState.expandedState.topId, navigationMode); // Scale and translate only needed when user cannot zoom
6517
6152
  // if (navigationMode !== 'free') {
6518
6153
  // transform(nodes, width, height, svg, divBox, useTransitions);
6519
6154
  // }
6520
6155
  };
6521
- var createContainer = function createContainer(_ref3) {
6522
- var element = _ref3.element,
6523
- dataTree = _ref3.dataTree,
6524
- selectionObj = _ref3.selectionObj,
6525
- wrapperState = _ref3.wrapperState,
6526
- setInitialZoom = _ref3.setInitialZoom,
6527
- setTransform = _ref3.setTransform,
6528
- setExpandedState = _ref3.setExpandedState,
6529
- viewState = _ref3.viewState,
6530
- setContainerData = _ref3.setContainerData,
6531
- layout = _ref3.layout;
6156
+ const createContainer = ({
6157
+ element,
6158
+ dataTree,
6159
+ selectionObj,
6160
+ wrapperState,
6161
+ setInitialZoom,
6162
+ setTransform,
6163
+ setExpandedState,
6164
+ viewState,
6165
+ setContainerData,
6166
+ layout
6167
+ }) => {
6532
6168
  element.innerHTML = '';
6533
6169
  element.className = 'sn-org-chart';
6534
- var navigationMode = layout.navigationMode;
6535
- var positioning = position('ttb', element, {}, navigationMode);
6536
-
6537
- var _element$getBoundingC = element.getBoundingClientRect(),
6538
- width = _element$getBoundingC.width,
6539
- height = _element$getBoundingC.height;
6540
-
6541
- var zoomWrapper = select(element).append('span').attr('class', 'sn-org-zoomwrapper').on('click', function () {
6542
- if (!wrapperState.constraints.select && (!selectionObj.api.isActive() || !selectionObj.state)) {
6170
+ const {
6171
+ navigationMode
6172
+ } = layout;
6173
+ let positioning = position('ttb', element, {}, navigationMode);
6174
+ const {
6175
+ width,
6176
+ height
6177
+ } = element.getBoundingClientRect();
6178
+ const zoomWrapper = select(element).append('span').attr('class', 'sn-org-zoomwrapper').on('click', () => {
6179
+ if (!wrapperState.constraints.active && (!selectionObj.api.isActive() || !selectionObj.state)) {
6543
6180
  selectionObj.api.begin('/qHyperCubeDef');
6544
6181
  selectionObj.setState([]);
6545
6182
  }
6546
6183
  }).node();
6547
- var svgBox = select(zoomWrapper).selectAll('svg').data([{}]).enter().append('svg').attr('class', 'sn-org-svg').attr('width', '100%').attr('height', '100%');
6548
- var divBox = select(zoomWrapper).selectAll('div').data([{}]).enter().append('div').attr('class', 'sn-org-nodes');
6549
- var homeButton = select(element).append('button').attr('class', 'sn-org-homebutton disabled').on('click', function () {
6184
+ const svgBox = select(zoomWrapper).selectAll('svg').data([{}]).enter().append('svg').attr('class', 'sn-org-svg').attr('width', '100%').attr('height', '100%');
6185
+ const divBox = select(zoomWrapper).selectAll('div').data([{}]).enter().append('div').attr('class', 'sn-org-nodes');
6186
+ const homeButton = select(element).append('button').attr('class', 'sn-org-homebutton disabled').on('click', () => {
6550
6187
  createContainer({
6551
- element: element,
6552
- dataTree: dataTree,
6553
- selectionObj: selectionObj,
6554
- wrapperState: wrapperState,
6555
- setInitialZoom: setInitialZoom,
6556
- setTransform: setTransform,
6557
- setExpandedState: setExpandedState,
6558
- viewState: viewState,
6559
- setContainerData: setContainerData,
6560
- layout: layout
6188
+ element,
6189
+ dataTree,
6190
+ selectionObj,
6191
+ wrapperState,
6192
+ setInitialZoom,
6193
+ setTransform,
6194
+ setExpandedState,
6195
+ viewState,
6196
+ setContainerData,
6197
+ layout
6561
6198
  });
6562
6199
  }).html(homeIcon).node();
6563
- var tooltip = createTooltip(element);
6200
+ const tooltip = createTooltip(element);
6564
6201
 
6565
6202
  if (dataTree.error) {
6566
6203
  select(zoomWrapper).append('div').attr('class', 'sn-org-error').html(dataTree.message);
@@ -6568,49 +6205,47 @@ var createContainer = function createContainer(_ref3) {
6568
6205
  }
6569
6206
 
6570
6207
  if (dataTree.warn && dataTree.warn.length) {
6571
- select(zoomWrapper).append('span').attr('class', 'sn-org-warning').html("*".concat(dataTree.warn.join(' ')));
6208
+ select(zoomWrapper).append('span').attr('class', 'sn-org-warning').html(`*${dataTree.warn.join(' ')}`);
6572
6209
  }
6573
6210
 
6574
- var svg = svgBox.append('g').attr('class', 'sn-org-paths'); // Here are the settings for the tree. For instance nodesize can be adjusted
6211
+ const svg = svgBox.append('g').attr('class', 'sn-org-paths'); // Here are the settings for the tree. For instance nodesize can be adjusted
6575
6212
 
6576
- var treemap = tree().size([width, height]).nodeSize([constants.cardWidth + constants.cardPadding, positioning.depthSpacing]);
6577
- var allNodes = treemap(hierarchy(dataTree));
6578
- var resetExpandedState = !wrapperState.expandedState || !allNodes.descendants().find(function (node) {
6579
- return node.data.id === wrapperState.expandedState.topId;
6580
- });
6581
- var newExpandedState = resetExpandedState ? {
6213
+ const treemap = tree().size([width, height]).nodeSize([constants.cardWidth + constants.cardPadding, positioning.depthSpacing]);
6214
+ const allNodes = treemap(hierarchy(dataTree));
6215
+ const resetExpandedState = !wrapperState.expandedState || !allNodes.descendants().find(node => node.data.id === wrapperState.expandedState.topId);
6216
+ const newExpandedState = resetExpandedState ? {
6582
6217
  topId: allNodes.data.id,
6583
6218
  isExpanded: true,
6584
6219
  expandedChildren: [],
6585
6220
  useTransitions: false
6586
6221
  } : wrapperState.expandedState;
6587
- var renderNodes = filterTree(newExpandedState, allNodes, false, navigationMode);
6588
- renderNodes.forEach(function (node) {
6222
+ const renderNodes = filterTree(newExpandedState, allNodes, false, navigationMode);
6223
+ renderNodes.forEach(node => {
6589
6224
  if (!node.xActual || !node.yActual) {
6590
6225
  positioning.x(node);
6591
6226
  positioning.y(node);
6592
6227
  }
6593
6228
  });
6594
- var bBox = getBBoxOfNodes(renderNodes);
6595
- var initialZoomState = viewState && viewState.initialZoom ? viewState.initialZoom : getInitialZoomState(bBox, element, navigationMode);
6229
+ const bBox = getBBoxOfNodes(renderNodes);
6230
+ const initialZoomState = viewState && viewState.initialZoom ? viewState.initialZoom : getInitialZoomState(bBox, element, navigationMode);
6596
6231
  setInitialZoom(initialZoomState);
6597
6232
  positioning = position('ttb', element, initialZoomState, navigationMode);
6598
6233
  setZooming({
6599
6234
  containerData: {
6600
- svg: svg,
6601
- divBox: divBox,
6602
- width: width,
6603
- height: height,
6604
- zoomWrapper: zoomWrapper,
6605
- element: element,
6606
- tooltip: tooltip,
6607
- homeButton: homeButton
6235
+ svg,
6236
+ divBox,
6237
+ width,
6238
+ height,
6239
+ zoomWrapper,
6240
+ element,
6241
+ tooltip,
6242
+ homeButton
6608
6243
  },
6609
- setTransform: setTransform,
6244
+ setTransform,
6610
6245
  transformState: viewState && viewState.transform || {},
6611
- wrapperState: wrapperState,
6612
- initialZoomState: initialZoomState,
6613
- navigationMode: navigationMode
6246
+ wrapperState,
6247
+ initialZoomState,
6248
+ navigationMode
6614
6249
  });
6615
6250
 
6616
6251
  if (resetExpandedState) {
@@ -6618,58 +6253,62 @@ var createContainer = function createContainer(_ref3) {
6618
6253
  }
6619
6254
 
6620
6255
  return setContainerData({
6621
- svg: svg,
6622
- divBox: divBox,
6623
- allNodes: allNodes,
6624
- positioning: positioning,
6625
- width: width,
6626
- height: height,
6627
- element: element,
6628
- zoomWrapper: zoomWrapper,
6629
- tooltip: tooltip,
6630
- homeButton: homeButton
6256
+ svg,
6257
+ divBox,
6258
+ allNodes,
6259
+ positioning,
6260
+ width,
6261
+ height,
6262
+ element,
6263
+ zoomWrapper,
6264
+ tooltip,
6265
+ homeButton
6631
6266
  });
6632
6267
  };
6633
6268
 
6634
- var createSnapshotData = function createSnapshotData(expandedState, allNodes, layout) {
6269
+ const createSnapshotData = (expandedState, allNodes, layout) => {
6635
6270
  if (layout.snapshotData && layout.snapshotData.dataMatrix) {
6636
6271
  // Need a check here becuase of free resize in storytelling
6637
6272
  return layout.snapshotData.dataMatrix;
6638
6273
  } // filter down to the visible nodes
6639
6274
 
6640
6275
 
6641
- var navigationMode = layout.navigationMode;
6642
- var nodes = filterTree(expandedState, allNodes, true, navigationMode);
6643
- var usedMatrix = [];
6644
- var qDataPages = layout.qHyperCube.qDataPages;
6645
- var dataMatrix = [];
6646
- qDataPages.forEach(function (page) {
6647
- dataMatrix.push.apply(dataMatrix, _toConsumableArray(page.qMatrix));
6276
+ const {
6277
+ navigationMode
6278
+ } = layout;
6279
+ const nodes = filterTree(expandedState, allNodes, true, navigationMode);
6280
+ const usedMatrix = [];
6281
+ const {
6282
+ qDataPages
6283
+ } = layout.qHyperCube;
6284
+ const dataMatrix = [];
6285
+ qDataPages.forEach(page => {
6286
+ dataMatrix.push(...page.qMatrix);
6648
6287
  });
6649
- nodes.forEach(function (n) {
6288
+ nodes.forEach(n => {
6650
6289
  if (n.data.rowNo !== undefined) {
6651
6290
  usedMatrix.push(dataMatrix[n.data.rowNo]);
6652
6291
  }
6653
6292
  });
6654
6293
  return usedMatrix;
6655
6294
  };
6656
- var createViewState = function createViewState(expandedState, transform, initialZoom, element) {
6657
- var size = {
6295
+ const createViewState = (expandedState, transform, initialZoom, element) => {
6296
+ const size = {
6658
6297
  w: element.clientWidth,
6659
6298
  h: element.clientHeight
6660
6299
  };
6661
- var vs = {
6662
- expandedState: expandedState,
6663
- transform: transform,
6664
- size: size,
6665
- initialZoom: initialZoom
6300
+ const vs = {
6301
+ expandedState,
6302
+ transform,
6303
+ size,
6304
+ initialZoom
6666
6305
  };
6667
6306
  vs.expandedState.useTransitions = false;
6668
6307
  return vs;
6669
6308
  };
6670
6309
  function snapshot(expandedState, containerData, layout, transform, initialZoom) {
6671
- var element = useElement();
6672
- onTakeSnapshot(function (snapshotLayout) {
6310
+ const element = useElement();
6311
+ onTakeSnapshot(snapshotLayout => {
6673
6312
  if (!snapshotLayout.snapshotData) {
6674
6313
  snapshotLayout.snapshotData = {};
6675
6314
  }
@@ -6680,13 +6319,12 @@ function snapshot(expandedState, containerData, layout, transform, initialZoom)
6680
6319
 
6681
6320
  snapshotLayout.snapshotData.dataMatrix = createSnapshotData(expandedState, containerData.allNodes, layout);
6682
6321
  });
6683
- useImperativeHandle(function () {
6684
- return {
6685
- getViewState: function getViewState() {
6686
- return createViewState(expandedState, transform, initialZoom, element);
6687
- }
6688
- };
6689
- });
6322
+ useImperativeHandle(() => ({
6323
+ getViewState() {
6324
+ return createViewState(expandedState, transform, initialZoom, element);
6325
+ }
6326
+
6327
+ }));
6690
6328
  }
6691
6329
 
6692
6330
  // Local translations when used outside of sense
@@ -6712,15 +6350,15 @@ var en = {
6712
6350
 
6713
6351
  function autoRegister(translator) {
6714
6352
  if (translator && translator.get && translator.add) {
6715
- var t = 'Object.OrgChart.MaxData';
6716
- var g = translator.get(t); // if translated string is different from its id
6353
+ const t = 'Object.OrgChart.MaxData';
6354
+ const g = translator.get(t); // if translated string is different from its id
6717
6355
  // assume translations already exists for current locale
6718
6356
 
6719
6357
  if (g !== t) {
6720
6358
  return;
6721
6359
  }
6722
6360
 
6723
- Object.keys(en).forEach(function (key) {
6361
+ Object.keys(en).forEach(key => {
6724
6362
  translator.add({
6725
6363
  id: key,
6726
6364
  locale: {
@@ -6732,41 +6370,33 @@ function autoRegister(translator) {
6732
6370
  }
6733
6371
 
6734
6372
  function selectionHandler(translator) {
6735
- var _useState = useState(false),
6736
- _useState2 = _slicedToArray(_useState, 2),
6737
- singleSelect = _useState2[0],
6738
- setSingleSelect = _useState2[1];
6739
-
6740
- var selectionsAPI = useSelections();
6741
- var isInSelections = !!useLayout().qSelectionInfo.qInSelections;
6742
-
6743
- var _useState3 = useState({
6373
+ const [singleSelect, setSingleSelect] = useState(false);
6374
+ const selectionsAPI = useSelections();
6375
+ const isInSelections = !!useLayout().qSelectionInfo.qInSelections;
6376
+ const [selectionObj] = useState({
6744
6377
  api: selectionsAPI,
6745
- setState: function setState(state) {
6378
+ setState: state => {
6746
6379
  selectionObj.state = state;
6747
6380
  },
6748
6381
  state: [],
6749
6382
  singleSelect: false
6750
- }),
6751
- _useState4 = _slicedToArray(_useState3, 1),
6752
- selectionObj = _useState4[0];
6753
-
6754
- useEffect(function () {
6383
+ });
6384
+ useEffect(() => {
6755
6385
  autoRegister(translator);
6756
6386
  }, [translator]);
6757
6387
 
6758
- var resetSelections = function resetSelections() {
6388
+ const resetSelections = () => {
6759
6389
  selectionObj.state = [];
6760
6390
  };
6761
6391
 
6762
- var resetSelectionsAndSingleSelect = function resetSelectionsAndSingleSelect() {
6392
+ const resetSelectionsAndSingleSelect = () => {
6763
6393
  selectionObj.state = [];
6764
6394
  setSingleSelect(false);
6765
6395
  };
6766
6396
 
6767
- useEffect(function () {
6397
+ useEffect(() => {
6768
6398
  if (!selectionObj.api) {
6769
- return function () {};
6399
+ return () => {};
6770
6400
  }
6771
6401
 
6772
6402
  selectionObj.api = selectionsAPI;
@@ -6775,42 +6405,41 @@ function selectionHandler(translator) {
6775
6405
  selectionObj.api.on('confirmed', resetSelectionsAndSingleSelect);
6776
6406
  selectionObj.api.on('cleared', resetSelections); // Return function called on unmount
6777
6407
 
6778
- return function () {
6408
+ return () => {
6779
6409
  selectionObj.api.removeListener('deactivated', resetSelections);
6780
6410
  selectionObj.api.removeListener('canceled', resetSelectionsAndSingleSelect);
6781
6411
  selectionObj.api.removeListener('confirmed', resetSelectionsAndSingleSelect);
6782
6412
  selectionObj.api.removeListener('cleared', resetSelections);
6783
6413
  };
6784
6414
  }, [selectionsAPI]);
6785
- useEffect(function () {
6415
+ useEffect(() => {
6786
6416
  selectionObj.singleSelect = singleSelect;
6787
6417
  }, [singleSelect]);
6788
- useAction(function () {
6789
- return {
6790
- action: function action() {
6791
- setSingleSelect(!singleSelect);
6792
- },
6793
- icon: {
6794
- shapes: [{
6795
- type: 'path',
6796
- attrs: {
6797
- d: singleSelectionIcon
6798
- }
6799
- }]
6800
- },
6801
- active: singleSelect,
6802
- hidden: !isInSelections,
6803
- label: translator.get('Object.OrgChart.SingleSelect')
6804
- };
6805
- }, [singleSelect, isInSelections]);
6806
- useEffect(function () {
6807
- var addKeyPress = function addKeyPress(event) {
6418
+ useAction(() => ({
6419
+ action() {
6420
+ setSingleSelect(!singleSelect);
6421
+ },
6422
+
6423
+ icon: {
6424
+ shapes: [{
6425
+ type: 'path',
6426
+ attrs: {
6427
+ d: singleSelectionIcon
6428
+ }
6429
+ }]
6430
+ },
6431
+ active: singleSelect,
6432
+ hidden: !isInSelections,
6433
+ label: translator.get('Object.OrgChart.SingleSelect')
6434
+ }), [singleSelect, isInSelections]);
6435
+ useEffect(() => {
6436
+ const addKeyPress = event => {
6808
6437
  if (event.key === 'Shift') {
6809
6438
  setSingleSelect(true);
6810
6439
  }
6811
6440
  };
6812
6441
 
6813
- var removeKeyPress = function removeKeyPress(event) {
6442
+ const removeKeyPress = event => {
6814
6443
  if (event.key === 'Shift') {
6815
6444
  setSingleSelect(false);
6816
6445
  }
@@ -6818,7 +6447,7 @@ function selectionHandler(translator) {
6818
6447
 
6819
6448
  document.addEventListener('keydown', addKeyPress);
6820
6449
  document.addEventListener('keyup', removeKeyPress);
6821
- return function () {
6450
+ return () => {
6822
6451
  document.removeEventListener('keydown', addKeyPress);
6823
6452
  document.removeEventListener('keyup', removeKeyPress);
6824
6453
  };
@@ -6827,7 +6456,7 @@ function selectionHandler(translator) {
6827
6456
  }
6828
6457
 
6829
6458
  function getColor(reference, Theme, defaultColor) {
6830
- var color;
6459
+ let color;
6831
6460
 
6832
6461
  switch (reference.colorType) {
6833
6462
  case 'byExpression':
@@ -6844,32 +6473,36 @@ function getColor(reference, Theme, defaultColor) {
6844
6473
 
6845
6474
  return color === 'none' ? defaultColor : color;
6846
6475
  }
6847
- var stylingUtils = {
6848
- cardStyling: function cardStyling(_ref) {
6849
- var Theme = _ref.Theme,
6850
- layout = _ref.layout;
6851
- var backgroundColor = getColor(layout.style.backgroundColor, Theme, '#e6e6e6');
6852
- var fontColor = getColor(layout.style.fontColor, Theme, 'default');
6853
- var measureLabel = layout.qHyperCube.qMeasureInfo.length ? layout.qHyperCube.qMeasureInfo[0].qFallbackTitle : null;
6854
- var _layout$style$border = layout.style.border,
6855
- border = _layout$style$border === void 0 ? {
6856
- colorType: 'auto'
6857
- } : _layout$style$border;
6858
- var borderColor = border.colorType !== 'auto' ? getColor(border, Theme, colorUtils.getDarkColor(backgroundColor)) : colorUtils.getDarkColor(backgroundColor);
6476
+ const stylingUtils = {
6477
+ cardStyling: ({
6478
+ Theme,
6479
+ layout
6480
+ }) => {
6481
+ const backgroundColor = getColor(layout.style.backgroundColor, Theme, DEFAULTS.BACKGROUND_COLOR.color);
6482
+ const fontColor = getColor(layout.style.fontColor, Theme, 'default');
6483
+ const measureLabel = layout.qHyperCube.qMeasureInfo.length ? layout.qHyperCube.qMeasureInfo[0].qFallbackTitle : null;
6484
+ const {
6485
+ border = {
6486
+ colorType: DEFAULTS.BORDER_COLOR_TYPE
6487
+ }
6488
+ } = layout.style;
6489
+ const borderColor = border.colorType !== 'auto' ? getColor(border, Theme, colorUtils.getDarkColor(backgroundColor)) : colorUtils.getDarkColor(backgroundColor);
6859
6490
  return {
6860
- backgroundColor: backgroundColor,
6861
- fontColor: fontColor,
6862
- measureLabel: measureLabel,
6863
- border: border,
6864
- borderColor: borderColor
6491
+ backgroundColor,
6492
+ fontColor,
6493
+ measureLabel,
6494
+ border,
6495
+ borderColor
6865
6496
  };
6866
6497
  }
6867
6498
  };
6868
6499
 
6869
- var viewStateUtil = {
6870
- getViewState: function getViewState(opts, layout) {
6500
+ const viewStateUtil = {
6501
+ getViewState: (opts, layout) => {
6871
6502
  // Get from options passed to object (used in live printing)
6872
- var viewState = opts.viewState;
6503
+ let {
6504
+ viewState
6505
+ } = opts;
6873
6506
 
6874
6507
  if (!viewState && layout.snapshotData && layout.snapshotData.viewState) {
6875
6508
  // Get from layout (used in snapshot mode)
@@ -6909,156 +6542,129 @@ function styleInject(css, ref) {
6909
6542
  }
6910
6543
  }
6911
6544
 
6912
- var css_248z = ".sn-org-chart {\n /* Tooltip arrow */\n}\n.sn-org-chart .sn-org-tooltip {\n visibility: hidden;\n opacity: 0;\n /* Unsupported in IE, so there we set width explicitly */\n width: 230px;\n width: -moz-max-content;\n width: fit-content;\n /* Position the tooltip text */\n position: absolute;\n z-index: 1;\n}\n.sn-org-chart .sn-org-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 0%;\n margin-left: -10px;\n border-width: 10px;\n border-style: solid;\n border-color: #404040 transparent transparent transparent;\n}\n.sn-org-chart .sn-org-tooltip-visible {\n opacity: 0.9;\n visibility: visible;\n}\n.sn-org-chart .sn-org-tooltip-inner {\n max-width: 240px;\n right: 50%;\n font-family: 'QlikView Sans', sans-serif;\n position: relative;\n max-height: 150px;\n background-color: #404040;\n color: #e6e6e6;\n text-align: left;\n font-size: 13px;\n line-height: 15px;\n padding: 10px 10px 10px 10px;\n border-radius: 6px;\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-word;\n overflow: hidden;\n}\n.sn-org-chart .sn-org-tooltip-inner .sn-org-tooltip-header {\n font-weight: bold;\n padding-bottom: 5px;\n}\n";
6913
- styleInject(css_248z);
6545
+ var css_248z$4 = ".sn-org-chart {\n /* Tooltip arrow */\n}\n.sn-org-chart .sn-org-tooltip {\n visibility: hidden;\n opacity: 0;\n /* Unsupported in IE, so there we set width explicitly */\n width: 230px;\n width: -moz-max-content;\n width: fit-content;\n /* Position the tooltip text */\n position: absolute;\n z-index: 1;\n}\n.sn-org-chart .sn-org-tooltip::after {\n content: '';\n position: absolute;\n top: 100%;\n left: 0%;\n margin-left: -10px;\n border-width: 10px;\n border-style: solid;\n border-color: #404040 transparent transparent transparent;\n}\n.sn-org-chart .sn-org-tooltip-visible {\n opacity: 0.9;\n visibility: visible;\n}\n.sn-org-chart .sn-org-tooltip-inner {\n max-width: 240px;\n right: 50%;\n font-family: 'QlikView Sans', sans-serif;\n position: relative;\n max-height: 150px;\n background-color: #404040;\n color: #e6e6e6;\n text-align: left;\n font-size: 13px;\n line-height: 15px;\n padding: 10px 10px 10px 10px;\n border-radius: 6px;\n overflow-wrap: break-word;\n word-wrap: break-word;\n word-break: break-word;\n overflow: hidden;\n}\n.sn-org-chart .sn-org-tooltip-inner .sn-org-tooltip-header {\n font-weight: bold;\n padding-bottom: 5px;\n}\n";
6546
+ styleInject(css_248z$4);
6914
6547
 
6915
- var css_248z$1 = ".sn-org-chart .sn-org-svg {\n position: absolute;\n /* For css only transitions, does not work in IE11 */\n}\n.sn-org-chart .sn-org-svg .sn-org-path {\n fill: none;\n stroke: #4c4c4c;\n stroke-width: 1;\n}\n.sn-org-chart .sn-org-svg .sn-org-paths:not(.org-disable-transition) {\n transform-origin: 0% 0%;\n transition-property: all;\n transition-duration: 0.5s;\n}\n";
6916
- styleInject(css_248z$1);
6548
+ var css_248z$3 = ".sn-org-chart .sn-org-svg {\n position: absolute;\n /* For css only transitions, does not work in IE11 */\n}\n.sn-org-chart .sn-org-svg .sn-org-path {\n fill: none;\n stroke: #4c4c4c;\n stroke-width: 1;\n}\n.sn-org-chart .sn-org-svg .sn-org-paths:not(.org-disable-transition) {\n transform-origin: 0% 0%;\n transition-property: all;\n transition-duration: 0.5s;\n}\n";
6549
+ styleInject(css_248z$3);
6917
6550
 
6918
6551
  var css_248z$2 = ".sn-org-chart .sn-org-warning {\n position: absolute;\n bottom: 0px;\n left: 0px;\n font-style: italic;\n font-size: 13px;\n color: #7b7a78;\n}\n.sn-org-chart .sn-org-error {\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n font-size: 1.2em;\n transform: translate(-50%, -50%);\n}\n";
6919
6552
  styleInject(css_248z$2);
6920
6553
 
6921
- var css_248z$3 = ".sn-org-chart {\n overflow: hidden;\n}\n.sn-org-chart .sn-org-nodes {\n position: absolute;\n transform-origin: 0% 0%;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n backface-visibility: hidden;\n}\n.sn-org-chart .sn-org-nodes:not(.org-disable-transition) {\n transition-property: all;\n transition-duration: 0.5s;\n}\n.sn-org-chart .sn-org-nodes .sn-org-traverse {\n position: absolute;\n background-color: white;\n font-size: 20px;\n font-weight: bold;\n border-radius: 3px;\n border: 1px solid #8c8c8c;\n text-align: center;\n line-height: 24px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-root {\n position: absolute;\n background-color: #8c8c8c;\n width: 20px;\n height: 20px;\n border-radius: 20px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card {\n position: absolute;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text {\n padding-left: 5px;\n padding-right: 5px;\n border-radius: 3px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text.selected {\n border: 4px solid black;\n border-radius: 4px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text.not-selected {\n opacity: 0.5;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-title {\n font-size: 14px;\n font-weight: bold;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-label {\n font-size: 11px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n";
6922
- styleInject(css_248z$3);
6554
+ var css_248z$1 = ".sn-org-chart {\n overflow: hidden;\n}\n.sn-org-chart .sn-org-nodes {\n position: absolute;\n transform-origin: 0% 0%;\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n backface-visibility: hidden;\n}\n.sn-org-chart .sn-org-nodes:not(.org-disable-transition) {\n transition-property: all;\n transition-duration: 0.5s;\n}\n.sn-org-chart .sn-org-nodes .sn-org-traverse {\n position: absolute;\n background-color: white;\n font-size: 20px;\n font-weight: bold;\n border-radius: 3px;\n border: 1px solid #8c8c8c;\n text-align: center;\n line-height: 24px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-root {\n position: absolute;\n background-color: #8c8c8c;\n width: 20px;\n height: 20px;\n border-radius: 20px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card {\n position: absolute;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text {\n padding-left: 5px;\n padding-right: 5px;\n border-radius: 3px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text.selected {\n border: 4px solid black;\n border-radius: 4px;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-text.not-selected {\n opacity: 0.5;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-title {\n font-size: 14px;\n font-weight: bold;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.sn-org-chart .sn-org-nodes .sn-org-card .sn-org-card-label {\n font-size: 11px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n";
6555
+ styleInject(css_248z$1);
6923
6556
 
6924
- var css_248z$4 = ".sn-org-chart .sn-org-homebutton {\n position: absolute;\n top: 20px;\n right: 20px;\n height: 20px;\n width: 20px;\n border-color: transparent;\n background-color: transparent;\n fill: rgba(89, 89, 89, 0.8);\n transition: fill 200ms ease-out;\n}\n.sn-org-chart .sn-org-homebutton:hover {\n fill: #595959;\n}\n.sn-org-chart .sn-org-homebutton.disabled {\n display: none;\n}\n";
6925
- styleInject(css_248z$4);
6557
+ var css_248z = ".sn-org-chart .sn-org-homebutton {\n position: absolute;\n top: 20px;\n right: 20px;\n height: 20px;\n width: 20px;\n border-color: transparent;\n background-color: transparent;\n fill: rgba(89, 89, 89, 0.8);\n transition: fill 200ms ease-out;\n}\n.sn-org-chart .sn-org-homebutton:hover {\n fill: #595959;\n}\n.sn-org-chart .sn-org-homebutton.disabled {\n display: none;\n}\n";
6558
+ styleInject(css_248z);
6926
6559
 
6927
6560
  function supernova(env) {
6928
6561
  return {
6929
6562
  qae: {
6930
- properties: properties,
6931
- data: data
6563
+ properties,
6564
+ data
6932
6565
  },
6933
- component: function component() {
6934
- var layout = useStaleLayout();
6935
- var model = useModel();
6936
- var element = useElement();
6937
- var Theme = useTheme();
6938
- var options = useOptions();
6939
- var rect = useRect();
6940
- var constraints = useConstraints();
6941
- var translator = useTranslator();
6942
-
6943
- var _useState = useState(null),
6944
- _useState2 = _slicedToArray(_useState, 2),
6945
- containerData = _useState2[0],
6946
- setContainerData = _useState2[1];
6947
-
6948
- var _useState3 = useState(null),
6949
- _useState4 = _slicedToArray(_useState3, 2),
6950
- styling = _useState4[0],
6951
- setStyling = _useState4[1];
6952
-
6953
- var _useState5 = useState(null),
6954
- _useState6 = _slicedToArray(_useState5, 2),
6955
- expandedState = _useState6[0],
6956
- setExpandedState = _useState6[1];
6957
-
6958
- var _useState7 = useState(null),
6959
- _useState8 = _slicedToArray(_useState7, 2),
6960
- transform$1 = _useState8[0],
6961
- setTransform = _useState8[1];
6962
-
6963
- var _useState9 = useState(null),
6964
- _useState10 = _slicedToArray(_useState9, 2),
6965
- initialZoom = _useState10[0],
6966
- setInitialZoom = _useState10[1];
6967
-
6968
- var _useState11 = useState({
6566
+ component: () => {
6567
+ const layout = useStaleLayout();
6568
+ const model = useModel();
6569
+ const element = useElement();
6570
+ const Theme = useTheme();
6571
+ const options = useOptions();
6572
+ const rect = useRect();
6573
+ const constraints = useConstraints();
6574
+ const translator = useTranslator();
6575
+ const [containerData, setContainerData] = useState(null);
6576
+ const [styling, setStyling] = useState(null);
6577
+ const [expandedState, setExpandedState] = useState(null);
6578
+ const [transform$1, setTransform] = useState(null);
6579
+ const [initialZoom, setInitialZoom] = useState(null);
6580
+ const [wrapperState] = useState({
6969
6581
  transform: {},
6970
- constraints: constraints,
6971
- expandedState: expandedState
6972
- }),
6973
- _useState12 = _slicedToArray(_useState11, 1),
6974
- wrapperState = _useState12[0];
6975
-
6976
- var selectionObj = selectionHandler(translator);
6977
- useEffect(function () {
6582
+ constraints,
6583
+ expandedState
6584
+ });
6585
+ const selectionObj = selectionHandler(translator);
6586
+ useEffect(() => {
6978
6587
  autoRegister(translator);
6979
6588
  }, [translator.language()]);
6980
- useEffect(function () {
6589
+ useEffect(() => {
6981
6590
  wrapperState.constraints = constraints;
6982
6591
  }, [constraints]);
6983
- useEffect(function () {
6592
+ useEffect(() => {
6984
6593
  wrapperState.transform = transform$1;
6985
6594
  }, [transform$1]);
6986
- useEffect(function () {
6595
+ useEffect(() => {
6987
6596
  wrapperState.expandedState = expandedState;
6988
6597
  }, [expandedState]);
6989
6598
 
6990
- var setExpandedCallback = function setExpandedCallback(newExpandedState) {
6599
+ const setExpandedCallback = newExpandedState => {
6991
6600
  newExpandedState.useTransitions = true;
6992
6601
  setExpandedState(newExpandedState);
6993
6602
  }; // Get and transform the data into a tree structure, get styling, reset active selections
6994
6603
 
6995
6604
 
6996
- var _usePromise = usePromise(function () {
6605
+ const [dataTree] = usePromise(() => {
6997
6606
  if (!layout) {
6998
6607
  return Promise.resolve();
6999
6608
  }
7000
6609
 
7001
- var viewState = viewStateUtil.getViewState(options, layout);
6610
+ const viewState = viewStateUtil.getViewState(options, layout);
7002
6611
  viewState && viewState.expandedState && setExpandedState(viewState.expandedState);
7003
6612
  viewState && viewState.transform && setTransform(viewState.transform);
7004
6613
  return transform({
7005
- layout: layout,
7006
- model: model,
7007
- translator: translator
7008
- }).then(function (transformed) {
6614
+ layout,
6615
+ model,
6616
+ translator
6617
+ }).then(transformed => {
7009
6618
  setStyling(stylingUtils.cardStyling({
7010
- Theme: Theme,
7011
- layout: layout
6619
+ Theme,
6620
+ layout
7012
6621
  }));
7013
6622
  selectionObj.setState([]); // Resolving the promise to indicate readiness for printing
7014
6623
 
7015
6624
  return transformed;
7016
6625
  });
7017
- }, [layout, model, translator.language(), Theme.name()]),
7018
- _usePromise2 = _slicedToArray(_usePromise, 1),
7019
- dataTree = _usePromise2[0]; // Create d3 elements, calculate initial zoom and sets expandedState
7020
-
6626
+ }, [layout, model, translator.language(), Theme.name()]); // Create d3 elements, calculate initial zoom and sets expandedState
7021
6627
 
7022
- var fullReload = function fullReload() {
6628
+ const fullReload = () => {
7023
6629
  if (element && dataTree) {
7024
- var viewState = viewStateUtil.getViewState(options, layout);
6630
+ const viewState = viewStateUtil.getViewState(options, layout);
7025
6631
  createContainer({
7026
- element: element,
7027
- dataTree: dataTree,
7028
- viewState: viewState,
7029
- wrapperState: wrapperState,
7030
- selectionObj: selectionObj,
7031
- setInitialZoom: setInitialZoom,
7032
- setTransform: setTransform,
7033
- setExpandedState: setExpandedState,
7034
- setContainerData: setContainerData,
7035
- layout: layout
6632
+ element,
6633
+ dataTree,
6634
+ viewState,
6635
+ wrapperState,
6636
+ selectionObj,
6637
+ setInitialZoom,
6638
+ setTransform,
6639
+ setExpandedState,
6640
+ setContainerData,
6641
+ layout
7036
6642
  });
7037
6643
  }
7038
6644
  }; // Call paintTree, currenly repaints all current nodes
7039
6645
 
7040
6646
 
7041
- var rePaint = function rePaint() {
6647
+ const rePaint = () => {
7042
6648
  if (containerData && expandedState && styling) {
7043
6649
  paintTree({
7044
- containerData: containerData,
7045
- styling: styling,
7046
- setExpandedCallback: setExpandedCallback,
7047
- wrapperState: wrapperState,
7048
- selectionObj: selectionObj,
6650
+ containerData,
6651
+ styling,
6652
+ setExpandedCallback,
6653
+ wrapperState,
6654
+ selectionObj,
7049
6655
  useTransitions: expandedState.useTransitions,
7050
- element: element
6656
+ element
7051
6657
  });
7052
6658
  }
7053
6659
  };
7054
6660
 
7055
- useEffect(function () {
6661
+ useEffect(() => {
7056
6662
  rePaint();
7057
6663
  }, [containerData, selectionObj.state]);
7058
- useEffect(function () {
6664
+ useEffect(() => {
7059
6665
  fullReload();
7060
6666
  }, [element, dataTree, constraints]);
7061
- useEffect(function () {
6667
+ useEffect(() => {
7062
6668
  if (layout.resizeOnExpand) {
7063
6669
  fullReload();
7064
6670
  } else {
@@ -7066,9 +6672,9 @@ function supernova(env) {
7066
6672
  }
7067
6673
  }, [expandedState]); // Updates snapshot when resizing
7068
6674
 
7069
- useEffect(function () {
6675
+ useEffect(() => {
7070
6676
  if (containerData && layout && layout.snapshotData) {
7071
- var snapshotZoom = getSnapshotZoom(rect, layout.snapshotData.viewState, transform$1);
6677
+ const snapshotZoom = getSnapshotZoom(rect, layout.snapshotData.viewState, transform$1);
7072
6678
  applyTransform(snapshotZoom, containerData.svg, containerData.divBox, rect.width, rect.height);
7073
6679
  }
7074
6680
  }, [rect, containerData]);
@@ -7078,4 +6684,4 @@ function supernova(env) {
7078
6684
  };
7079
6685
  }
7080
6686
 
7081
- export default supernova;
6687
+ export { supernova as default };