@splunk/react-visualizations 25.7.1 → 25.8.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.
Files changed (49) hide show
  1. package/Area.js +30 -56
  2. package/Area.js.map +1 -1
  3. package/Bar.js +26 -52
  4. package/Bar.js.map +1 -1
  5. package/Bubble.js +28 -54
  6. package/Bubble.js.map +1 -1
  7. package/Column.js +35 -62
  8. package/Column.js.map +1 -1
  9. package/FillerGauge.js +0 -2
  10. package/FillerGauge.js.map +1 -1
  11. package/GeoJsonChoropleth.js +89 -451
  12. package/GeoJsonChoropleth.js.map +1 -1
  13. package/Line.js +30 -56
  14. package/Line.js.map +1 -1
  15. package/MarkerGauge.js +0 -2
  16. package/MarkerGauge.js.map +1 -1
  17. package/Pie.js +23 -43
  18. package/Pie.js.map +1 -1
  19. package/Punchcard.js +3 -6
  20. package/Punchcard.js.map +1 -1
  21. package/Scatter.js +26 -52
  22. package/Scatter.js.map +1 -1
  23. package/SingleValue.js +13 -29
  24. package/SingleValue.js.map +1 -1
  25. package/SingleValueIcon.js +13 -30
  26. package/SingleValueIcon.js.map +1 -1
  27. package/SingleValueRadial.js +134 -182
  28. package/SingleValueRadial.js.map +1 -1
  29. package/SvgChoropleth.js +21 -69
  30. package/SvgChoropleth.js.map +1 -1
  31. package/SvgChoroplethDynamic.js +2 -11
  32. package/SvgChoroplethDynamic.js.map +1 -1
  33. package/common/Charting.js +36 -118
  34. package/common/Charting.js.map +1 -1
  35. package/common/ChartingApi.js +5 -15
  36. package/common/ChartingApi.js.map +1 -1
  37. package/common/EventsDoc.js +20 -61
  38. package/common/EventsDoc.js.map +1 -1
  39. package/common/OptionsDoc.js +5 -11
  40. package/common/OptionsDoc.js.map +1 -1
  41. package/common/props.js +0 -3
  42. package/common/props.js.map +1 -1
  43. package/package.json +9 -9
  44. package/utils/numberUtils.js +4 -4
  45. package/utils/numberUtils.js.map +1 -1
  46. package/utils/propUtils.js +2 -2
  47. package/utils/propUtils.js.map +1 -1
  48. package/utils/seriesUtils.js +0 -1
  49. package/utils/seriesUtils.js.map +1 -1
@@ -192,9 +192,7 @@ Object.defineProperty(exports, "__esModule", {
192
192
  value: true
193
193
  });
194
194
  exports.isSpaceCompatible = exports.calculatedTargetBounds = exports.visibleSourceBounds = exports.flipBounds = exports.logicalSpace = exports.geoSpace = exports.screenSpace = void 0;
195
-
196
195
  var lodash_1 = __webpack_require__(21);
197
-
198
196
  exports.screenSpace = {
199
197
  x: {
200
198
  unit: 'pixel'
@@ -219,7 +217,6 @@ exports.logicalSpace = {
219
217
  unit: null
220
218
  }
221
219
  };
222
-
223
220
  var flipBounds = function flipBounds(bounds, flipAxis) {
224
221
  var result = lodash_1.cloneDeep(bounds);
225
222
  flipAxis.forEach(function (axis) {
@@ -228,9 +225,7 @@ var flipBounds = function flipBounds(bounds, flipAxis) {
228
225
  });
229
226
  return result;
230
227
  };
231
-
232
228
  exports.flipBounds = flipBounds;
233
-
234
229
  var visibleSourceBounds = function visibleSourceBounds(transformation, targetBounds) {
235
230
  var minTargetCoordinates = lodash_1.mapValues(targetBounds, function (interval) {
236
231
  return interval.min;
@@ -249,7 +244,6 @@ var visibleSourceBounds = function visibleSourceBounds(transformation, targetBou
249
244
  });
250
245
  return result;
251
246
  };
252
-
253
247
  exports.visibleSourceBounds = visibleSourceBounds;
254
248
  /**
255
249
  * TODO: this is a suboptimal function name. It should be called transformBoundingBox. It's also a very
@@ -258,7 +252,6 @@ exports.visibleSourceBounds = visibleSourceBounds;
258
252
  * @param {Bounds} sourceBounds
259
253
  * @returns {Bounds}
260
254
  */
261
-
262
255
  var calculatedTargetBounds = function calculateTargetBounds(transformation, sourceBounds) {
263
256
  var minSourceCoordinates = lodash_1.mapValues(sourceBounds, function (interval) {
264
257
  return interval.min;
@@ -277,13 +270,10 @@ var calculatedTargetBounds = function calculateTargetBounds(transformation, sour
277
270
  });
278
271
  return result;
279
272
  };
280
-
281
273
  exports.calculatedTargetBounds = calculatedTargetBounds;
282
-
283
274
  function isSpaceCompatible(s1, s2) {
284
275
  return lodash_1.isEqual(s1, s2);
285
276
  }
286
-
287
277
  exports.isSpaceCompatible = isSpaceCompatible;
288
278
 
289
279
  /***/ }),
@@ -298,31 +288,20 @@ exports.isSpaceCompatible = isSpaceCompatible;
298
288
 
299
289
 
300
290
  var _classCallCheck = __webpack_require__(17);
301
-
302
291
  var _createClass = __webpack_require__(16);
303
-
304
292
  var _inherits = __webpack_require__(23);
305
-
306
293
  var _possibleConstructorReturn = __webpack_require__(24);
307
-
308
294
  var _getPrototypeOf = __webpack_require__(25);
309
-
310
295
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
311
-
312
296
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
313
-
314
297
  Object.defineProperty(exports, "__esModule", {
315
298
  value: true
316
299
  });
317
300
  exports.DATA_ATTRIBUTE = void 0;
318
301
  /* eslint-disable no-param-reassign */
319
-
320
302
  var React = __webpack_require__(1);
321
-
322
303
  var lodash_1 = __webpack_require__(21);
323
-
324
304
  var styled_components_1 = __webpack_require__(7);
325
-
326
305
  exports.DATA_ATTRIBUTE = 'data-value';
327
306
  var StyledSvgChoropleth = styled_components_1.default.div.withConfig({
328
307
  displayName: "SvgChoropleth__StyledSvgChoropleth",
@@ -330,24 +309,17 @@ var StyledSvgChoropleth = styled_components_1.default.div.withConfig({
330
309
  })(["display:flex;flex-direction:column;position:relative;background-color:", ";"], function (props) {
331
310
  return props.backgroundColor;
332
311
  });
333
-
334
312
  var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
335
313
  _inherits(SvgChoropleth, _React$Component);
336
-
337
314
  var _super = _createSuper(SvgChoropleth);
338
-
339
315
  function SvgChoropleth(props) {
340
316
  var _this;
341
-
342
317
  _classCallCheck(this, SvgChoropleth);
343
-
344
318
  _this = _super.call(this, props);
345
319
  _this.containerRef = React.createRef();
346
320
  _this.highlightedCountry = null;
347
-
348
321
  _this.getLocalCoords = function (clientX, clientY) {
349
322
  var rect = _this.containerRef.current.getBoundingClientRect();
350
-
351
323
  var physX = rect.left;
352
324
  var physY = rect.top;
353
325
  return {
@@ -355,40 +327,31 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
355
327
  y: clientY - physY
356
328
  };
357
329
  };
358
-
359
330
  _this.handleMapClick = function (event) {
360
331
  var clientX = event.clientX,
361
- clientY = event.clientY;
362
-
332
+ clientY = event.clientY;
363
333
  var pos = _this.getLocalCoords(clientX, clientY);
364
-
365
334
  var _this$props = _this.props,
366
- featureCollection = _this$props.featureCollection,
367
- onClick = _this$props.onClick;
335
+ featureCollection = _this$props.featureCollection,
336
+ onClick = _this$props.onClick;
368
337
  var clickedCoords = featureCollection.transformation.transformBack(pos);
369
338
  var feature = event.target;
370
339
  var wholeFeature = feature.id ? feature : feature.parentNode;
371
-
372
340
  if (onClick) {
373
341
  onClick(clickedCoords, wholeFeature.id);
374
342
  }
375
343
  };
376
-
377
344
  _this.handleFeatureEnter = function (ev) {
378
345
  var feature = ev.target;
379
-
380
346
  if (!feature.id && !feature.ownerSVGElement) {
381
347
  return;
382
348
  }
383
-
384
- var wholeFeature = feature.id ? feature : feature.parentNode; // remove the highlighted country IF we are entering a different country
385
-
349
+ var wholeFeature = feature.id ? feature : feature.parentNode;
350
+ // remove the highlighted country IF we are entering a different country
386
351
  if (_this.highlightedCountry && wholeFeature.id !== _this.highlightedCountry.id) {
387
352
  _this.unHighlightCountry();
388
353
  }
389
-
390
354
  _this.highlightCountry(wholeFeature);
391
-
392
355
  if (_this.props.onFeatureHover) {
393
356
  _this.props.onFeatureHover({
394
357
  featureId: wholeFeature.id,
@@ -397,24 +360,19 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
397
360
  });
398
361
  }
399
362
  };
400
-
401
363
  _this.handleFeatureLeave = function (ev) {
402
364
  var feature = ev.target;
403
-
404
365
  if (!feature.id && !feature.ownerSVGElement) {
405
366
  return;
406
- } // 'wholeFeature' means the SVG <g> (group) of multipolygon features
407
-
408
-
409
- var wholeFeature = feature.id ? feature : feature.parentNode; // handling feature leaving should always only deal with the highlighted feature
410
-
367
+ }
368
+ // 'wholeFeature' means the SVG <g> (group) of multipolygon features
369
+ var wholeFeature = feature.id ? feature : feature.parentNode;
370
+ // handling feature leaving should always only deal with the highlighted feature
411
371
  if (wholeFeature !== _this.highlightedCountry) {
412
372
  return;
413
373
  }
414
-
415
- _this.unHighlightCountry(); // wholeFeature.style.stroke = this.lastFeatureStroke;
416
-
417
-
374
+ _this.unHighlightCountry();
375
+ // wholeFeature.style.stroke = this.lastFeatureStroke;
418
376
  if (_this.props.onFeatureHover) {
419
377
  _this.props.onFeatureHover({
420
378
  featureId: null,
@@ -423,33 +381,28 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
423
381
  });
424
382
  }
425
383
  };
426
-
427
384
  _this.registerSvg = function (el) {
428
385
  if (!el) return;
429
386
  _this.svgDom = el;
430
387
  var _this$props2 = _this.props,
431
- _this$props2$selector = _this$props2.selector,
432
- selector = _this$props2$selector === void 0 ? '.feature' : _this$props2$selector,
433
- strokeColor = _this$props2.strokeColor,
434
- fillColor = _this$props2.fillColor;
388
+ _this$props2$selector = _this$props2.selector,
389
+ selector = _this$props2$selector === void 0 ? '.feature' : _this$props2$selector,
390
+ strokeColor = _this$props2.strokeColor,
391
+ fillColor = _this$props2.fillColor;
435
392
  _this.svgDom.onmouseover = _this.handleFeatureEnter;
436
393
  _this.svgDom.onmouseout = _this.handleFeatureLeave;
437
-
438
394
  _this.svgDom.querySelectorAll(selector).forEach(function (node) {
439
395
  node.style.stroke = strokeColor;
440
396
  node.style.fill = fillColor;
441
397
  });
442
-
443
398
  _this.updateSvg(_this.props);
444
399
  };
445
-
446
400
  var featureCollection = props.featureCollection;
447
401
  _this.state = {
448
402
  svgNode: featureCollection.getSvgNode(_this.registerSvg)
449
403
  };
450
404
  return _this;
451
405
  }
452
-
453
406
  _createClass(SvgChoropleth, [{
454
407
  key: "shouldComponentUpdate",
455
408
  value: function shouldComponentUpdate(nextProps, nextState) {
@@ -469,8 +422,8 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
469
422
  this.updateSvg(this.props);
470
423
  }
471
424
  }
472
- } // allows a provided alias like 'US-CA' to get mapped to 'California' which is the element id for the SVG shape
473
-
425
+ }
426
+ // allows a provided alias like 'US-CA' to get mapped to 'California' which is the element id for the SVG shape
474
427
  }, {
475
428
  key: "getFeatureId",
476
429
  value: function getFeatureId(alias) {
@@ -484,7 +437,6 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
484
437
  * So the highlight for South Africa will not cover up Lesotho.
485
438
  * @param {SVGElement} el
486
439
  */
487
-
488
440
  }, {
489
441
  key: "highlightCountry",
490
442
  value: function highlightCountry(el) {
@@ -506,31 +458,25 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
506
458
  if (this.highlightedCountry) {
507
459
  this.svgDom.removeChild(this.highlightedCountry);
508
460
  }
509
-
510
461
  this.highlightedCountry = null;
511
462
  }
512
463
  }, {
513
464
  key: "updateSvg",
514
465
  value: function updateSvg(props) {
515
466
  var _this2 = this;
516
-
517
467
  if (!this.svgDom) {
518
468
  return;
519
469
  }
520
-
521
470
  var _props$selector = props.selector,
522
- selector = _props$selector === void 0 ? '.feature' : _props$selector,
523
- fillColor = props.fillColor,
524
- data = props.data;
525
-
471
+ selector = _props$selector === void 0 ? '.feature' : _props$selector,
472
+ fillColor = props.fillColor,
473
+ data = props.data;
526
474
  if (!data) {
527
475
  return;
528
476
  }
529
-
530
477
  var dataHashMap = {};
531
478
  data.featureIDs.forEach(function (alias, index) {
532
479
  var featureId = _this2.getFeatureId(alias);
533
-
534
480
  dataHashMap[featureId] = {
535
481
  fill: data.fill[index],
536
482
  value: data.values[index]
@@ -540,7 +486,6 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
540
486
  var nodeData = dataHashMap[node.id];
541
487
  node.style.fill = lodash_1.get(nodeData, 'fill') || fillColor;
542
488
  var value = lodash_1.get(nodeData, 'value');
543
-
544
489
  if (value) {
545
490
  node.setAttribute(exports.DATA_ATTRIBUTE, value);
546
491
  } else {
@@ -552,8 +497,7 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
552
497
  key: "render",
553
498
  value: function render() {
554
499
  var _this$props$backgroun = this.props.backgroundColor,
555
- backgroundColor = _this$props$backgroun === void 0 ? 'transparent' : _this$props$backgroun; // note: for some reason, onclick event can't be triggered on dashboard. So change it to onMouseDown
556
-
500
+ backgroundColor = _this$props$backgroun === void 0 ? 'transparent' : _this$props$backgroun; // note: for some reason, onclick event can't be triggered on dashboard. So change it to onMouseDown
557
501
  return React.createElement(StyledSvgChoropleth, {
558
502
  "data-test": "styled-svg-choropleth",
559
503
  backgroundColor: backgroundColor,
@@ -562,10 +506,8 @@ var SvgChoropleth = /*#__PURE__*/function (_React$Component) {
562
506
  }, this.state.svgNode);
563
507
  }
564
508
  }]);
565
-
566
509
  return SvgChoropleth;
567
510
  }(React.Component);
568
-
569
511
  exports.default = SvgChoropleth;
570
512
 
571
513
  /***/ }),
@@ -576,39 +518,29 @@ exports.default = SvgChoropleth;
576
518
 
577
519
 
578
520
  var _classCallCheck = __webpack_require__(17);
579
-
580
521
  var _createClass = __webpack_require__(16);
581
-
582
522
  Object.defineProperty(exports, "__esModule", {
583
523
  value: true
584
524
  });
585
-
586
525
  var ICoordinateTransformation_1 = __webpack_require__(31);
587
-
588
526
  var TransformationChain_1 = __webpack_require__(39);
589
-
590
527
  var CoordinateTransformation = /*#__PURE__*/function () {
591
528
  function CoordinateTransformation(sourceSpace, targetSpace) {
592
529
  _classCallCheck(this, CoordinateTransformation);
593
-
594
530
  this.sourceSpace = sourceSpace;
595
531
  this.targetSpace = targetSpace;
596
532
  }
597
-
598
533
  _createClass(CoordinateTransformation, [{
599
534
  key: "appendTransformation",
600
535
  value: function appendTransformation(transformation) {
601
536
  if (!ICoordinateTransformation_1.isSpaceCompatible(this.targetSpace, transformation.sourceSpace)) {
602
537
  throw new Error(CoordinateTransformation.INCOMPATIBLE_SPACES_ERROR);
603
538
  }
604
-
605
539
  return new TransformationChain_1.default([this, transformation]);
606
540
  }
607
541
  }]);
608
-
609
542
  return CoordinateTransformation;
610
543
  }();
611
-
612
544
  exports.default = CoordinateTransformation;
613
545
  CoordinateTransformation.INCOMPATIBLE_SPACES_ERROR = "incompatible transformation (appended source space doesn't match chain's output space)";
614
546
 
@@ -626,33 +558,25 @@ module.exports = require("@babel/runtime/helpers/slicedToArray");
626
558
 
627
559
 
628
560
  var _toConsumableArray = __webpack_require__(5);
629
-
630
561
  var _classCallCheck = __webpack_require__(17);
631
-
632
562
  var _createClass = __webpack_require__(16);
633
-
634
563
  Object.defineProperty(exports, "__esModule", {
635
564
  value: true
636
565
  });
637
-
638
566
  var lodash_1 = __webpack_require__(21);
639
-
640
567
  var TransformationChain = /*#__PURE__*/function () {
641
568
  function TransformationChain(transformations) {
642
569
  _classCallCheck(this, TransformationChain);
643
-
644
570
  this.transformations = _toConsumableArray(transformations);
645
571
  this.sourceSpace = transformations[0].sourceSpace;
646
572
  this.targetSpace = lodash_1.last(transformations).targetSpace;
647
573
  }
648
-
649
574
  _createClass(TransformationChain, [{
650
575
  key: "appendTransformation",
651
576
  value: function appendTransformation(transformation) {
652
577
  if (!lodash_1.isEqual(transformation.sourceSpace, lodash_1.last(this.transformations).targetSpace)) {
653
578
  throw new Error("Can't chain transformations with incompatible spaces \n ".concat(JSON.stringify(lodash_1.last(this.transformations).targetSpace), " -> ").concat(JSON.stringify(transformation.sourceSpace)));
654
579
  }
655
-
656
580
  return new TransformationChain([].concat(_toConsumableArray(this.transformations), [transformation]));
657
581
  }
658
582
  }, {
@@ -668,18 +592,14 @@ var TransformationChain = /*#__PURE__*/function () {
668
592
  key: "transformBack",
669
593
  value: function transformBack(physicalCoords) {
670
594
  var currentCoords = physicalCoords;
671
-
672
595
  for (var idx = this.transformations.length - 1; idx >= 0; idx -= 1) {
673
596
  currentCoords = this.transformations[idx].transformBack(currentCoords);
674
597
  }
675
-
676
598
  return currentCoords;
677
599
  }
678
600
  }]);
679
-
680
601
  return TransformationChain;
681
602
  }();
682
-
683
603
  exports.default = TransformationChain;
684
604
 
685
605
  /***/ }),
@@ -690,18 +610,14 @@ exports.default = TransformationChain;
690
610
 
691
611
 
692
612
  var _classCallCheck = __webpack_require__(17);
693
-
694
613
  var _createClass = __webpack_require__(16);
695
-
696
614
  Object.defineProperty(exports, "__esModule", {
697
615
  value: true
698
616
  });
699
-
700
617
  var BoundsUtils = /*#__PURE__*/function () {
701
618
  function BoundsUtils() {
702
619
  _classCallCheck(this, BoundsUtils);
703
620
  }
704
-
705
621
  _createClass(BoundsUtils, null, [{
706
622
  key: "contains",
707
623
  value:
@@ -720,12 +636,11 @@ var BoundsUtils = /*#__PURE__*/function () {
720
636
  * @param {Bounds} bounds Interval keys must be 'lat' and 'long'
721
637
  * @returns {number[]} formatted in single array as [long.min, lat.min, long.max, lat.max]
722
638
  */
723
-
724
639
  }, {
725
640
  key: "toTurfBBox",
726
641
  value: function toTurfBBox(bounds) {
727
642
  var long = bounds.long,
728
- lat = bounds.lat;
643
+ lat = bounds.lat;
729
644
  return [long.min, lat.min, long.max, lat.max];
730
645
  }
731
646
  /**
@@ -734,7 +649,6 @@ var BoundsUtils = /*#__PURE__*/function () {
734
649
  * @param {number} v
735
650
  * @returns {boolean}
736
651
  */
737
-
738
652
  }, {
739
653
  key: "within",
740
654
  value: function within(interval, v) {
@@ -745,7 +659,6 @@ var BoundsUtils = /*#__PURE__*/function () {
745
659
  * @param {Interval} interval
746
660
  * @returns {number}
747
661
  */
748
-
749
662
  }, {
750
663
  key: "distance",
751
664
  value: function distance(interval) {
@@ -757,17 +670,15 @@ var BoundsUtils = /*#__PURE__*/function () {
757
670
  * @param {Bounds} must use 'x' and 'y' axis and assumes x and y are screen-oriented with zero,zero being the top left
758
671
  * @returns {object}
759
672
  */
760
-
761
673
  }, {
762
674
  key: "logicalBoundsToCssStyle",
763
675
  value: function logicalBoundsToCssStyle(logicalBounds) {
764
676
  if (!logicalBounds) {
765
677
  return {};
766
678
  }
767
-
768
679
  var xInterval = logicalBounds.x;
769
- var yInterval = logicalBounds.y; // use GeoJsonFeatureGrpup f's Bounds to create a CSS inline style to position the inset using a div
770
-
680
+ var yInterval = logicalBounds.y;
681
+ // use GeoJsonFeatureGrpup f's Bounds to create a CSS inline style to position the inset using a div
771
682
  return {
772
683
  position: 'absolute',
773
684
  top: yInterval.min,
@@ -784,10 +695,8 @@ var BoundsUtils = /*#__PURE__*/function () {
784
695
  return BoundsUtils.within(bounds[axis], dp[axis]);
785
696
  }
786
697
  }]);
787
-
788
698
  return BoundsUtils;
789
699
  }();
790
-
791
700
  exports.default = BoundsUtils;
792
701
 
793
702
  /***/ }),
@@ -808,65 +717,42 @@ exports.default = BoundsUtils;
808
717
 
809
718
 
810
719
  var _createClass = __webpack_require__(16);
811
-
812
720
  var _assertThisInitialized = __webpack_require__(52);
813
-
814
721
  var _inherits = __webpack_require__(23);
815
-
816
722
  var _possibleConstructorReturn = __webpack_require__(24);
817
-
818
723
  var _getPrototypeOf = __webpack_require__(25);
819
-
820
724
  var _classCallCheck = __webpack_require__(17);
821
-
822
725
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
823
-
824
726
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
825
-
826
727
  Object.defineProperty(exports, "__esModule", {
827
728
  value: true
828
729
  });
829
730
  exports.createFeatureCollections = exports.valueText = exports.estimateTextWidth = exports.round2 = exports.LABEL_FONT_SIZE = void 0;
830
731
  /* eslint-disable max-classes-per-file */
831
-
832
732
  var React = __webpack_require__(1);
833
-
834
733
  var styled_components_1 = __webpack_require__(7);
835
-
836
734
  var lodash_1 = __webpack_require__(21);
837
-
838
735
  var pick_1 = __webpack_require__(29);
839
-
840
736
  var variables_1 = __webpack_require__(22);
841
-
842
737
  var SanitizeProps_1 = __webpack_require__(3);
843
-
844
738
  var SvgChoropleth_1 = __webpack_require__(36);
845
-
846
739
  var GeoJsonFeatureCollection_1 = __webpack_require__(53);
847
-
848
740
  var BoundsUtils_1 = __webpack_require__(40);
849
-
850
741
  exports.LABEL_FONT_SIZE = 14;
851
-
852
742
  var round2 = function round2(value) {
853
743
  return Math.round(value * 100) / 100;
854
744
  };
855
-
856
- exports.round2 = round2; // todo: maybe can refactor to use `computeTextSize` in @splunk/visualizations-shared/domUtils.js
857
-
745
+ exports.round2 = round2;
746
+ // todo: maybe can refactor to use `computeTextSize` in @splunk/visualizations-shared/domUtils.js
858
747
  var estimateTextWidth = function estimateTextWidth(text, fontsize) {
859
748
  if (text == null) {
860
749
  return 0;
861
750
  }
862
-
863
751
  var avgLowerCaseWidth = 0.55 * fontsize;
864
752
  var avgUpperCaseWidth = 0.7 * fontsize;
865
753
  var length = 0;
866
-
867
754
  for (var pos = 0; pos < text.length; pos += 1) {
868
755
  var c = text.charAt(pos);
869
-
870
756
  if (lodash_1.includes('Iij.,;:!lt/', c)) {
871
757
  length += 0.2 * fontsize;
872
758
  } else if (c === '_') {
@@ -875,38 +761,31 @@ var estimateTextWidth = function estimateTextWidth(text, fontsize) {
875
761
  length += c === c.toUpperCase() ? avgUpperCaseWidth : avgLowerCaseWidth;
876
762
  }
877
763
  }
878
-
879
764
  return length;
880
765
  };
881
-
882
- exports.estimateTextWidth = estimateTextWidth; // todo: maybe can refactor to use `formatNumber` in ../utils/numberUtils
883
-
766
+ exports.estimateTextWidth = estimateTextWidth;
767
+ // todo: maybe can refactor to use `formatNumber` in ../utils/numberUtils
884
768
  var valueText = function valueText(value) {
885
769
  if (value === 0) {
886
770
  return '0';
887
771
  }
888
-
889
772
  if (typeof value === 'string') {
890
773
  return value;
891
774
  }
892
-
893
775
  var magnitude = Math.floor(Math.log10(Math.abs(value)) / 3);
894
776
  var divisor = Math.pow(10, 3 * magnitude);
895
777
  var suffixList = ['', 'k', 'm', 'bn', 'tn', 'qn'];
896
778
  var suffix = magnitude < 0 ? "/".concat(suffixList[-magnitude]) : suffixList[magnitude];
897
779
  return "".concat(exports.round2(value / divisor)).concat(suffix);
898
780
  };
899
-
900
781
  exports.valueText = valueText;
901
-
902
782
  function createFeatureCollections(props) {
903
783
  var sourceBounds = props.sourceBounds,
904
- logicalBounds = props.logicalBounds,
905
- projection = props.projection,
906
- geoJson = props.geoJson,
907
- geoFeatureGroups = props.geoFeatureGroups;
784
+ logicalBounds = props.logicalBounds,
785
+ projection = props.projection,
786
+ geoJson = props.geoJson,
787
+ geoFeatureGroups = props.geoFeatureGroups;
908
788
  var featureCollections = [];
909
-
910
789
  if (geoFeatureGroups) {
911
790
  geoFeatureGroups.forEach(function (g) {
912
791
  featureCollections.push(new GeoJsonFeatureCollection_1.default("".concat(props.name, ".").concat(g.name), logicalBounds, projection, geoJson, g, sourceBounds));
@@ -914,16 +793,12 @@ function createFeatureCollections(props) {
914
793
  } else {
915
794
  featureCollections.push(new GeoJsonFeatureCollection_1.default(props.name, logicalBounds, projection, geoJson, undefined, sourceBounds));
916
795
  }
917
-
918
796
  return featureCollections;
919
797
  }
920
-
921
798
  exports.createFeatureCollections = createFeatureCollections;
922
-
923
799
  var TTArgType = function TTArgType() {
924
800
  _classCallCheck(this, TTArgType);
925
801
  };
926
-
927
802
  var TooltipBubble = styled_components_1.default.div.attrs(function () {
928
803
  return {
929
804
  key: 'bubble'
@@ -935,8 +810,8 @@ var TooltipBubble = styled_components_1.default.div.attrs(function () {
935
810
  enterprise: {
936
811
  light: variables_1.default.white,
937
812
  dark: '#27292e' // enterpriseBackgroundColor
938
-
939
813
  },
814
+
940
815
  prisma: variables_1.default.backgroundColorPopup
941
816
  }), function (props) {
942
817
  return props.maxTextWidth;
@@ -955,8 +830,8 @@ var TooltipLabel = styled_components_1.default.div.attrs(function () {
955
830
  // unfortunately cannot access variables.textGray directly colors since variables are theme-aware
956
831
  light: 'rgba(0, 0, 0, 0.65)',
957
832
  dark: 'rgba(255, 255, 255, 0.7)' // equivalent to enterprise.textGray
958
-
959
833
  },
834
+
960
835
  prisma: variables_1.default.contentColorDefault
961
836
  }));
962
837
  var ArrowDown = styled_components_1.default.div.withConfig({
@@ -966,8 +841,8 @@ var ArrowDown = styled_components_1.default.div.withConfig({
966
841
  enterprise: {
967
842
  light: variables_1.default.white,
968
843
  dark: '#27292e' // enterpriseBackgroundColor
969
-
970
844
  },
845
+
971
846
  prisma: variables_1.default.backgroundColorPopup
972
847
  }));
973
848
  var TooltipValue = styled_components_1.default.div.attrs(function () {
@@ -982,8 +857,8 @@ var TooltipValue = styled_components_1.default.div.attrs(function () {
982
857
  // unfortunately cannot access variables.textGray directly colors since variables are theme-aware
983
858
  light: '#2c2c2c',
984
859
  dark: 'rgba(255, 255, 255, 0.98)' // equivalent to enterprise.textGray
985
-
986
860
  },
861
+
987
862
  prisma: variables_1.default.contentColorActive
988
863
  }));
989
864
  var GeoJsonChoroplethContainer = styled_components_1.default.div.attrs(function () {
@@ -1002,13 +877,12 @@ var GeoJsonChoroplethContainer = styled_components_1.default.div.attrs(function
1002
877
  prisma: variables_1.default.backgroundColorSidebar
1003
878
  });
1004
879
  });
1005
-
1006
880
  var ToolTip = function ToolTip(arg) {
1007
881
  var reference = arg.reference,
1008
- left = arg.left,
1009
- top = arg.top,
1010
- label = arg.label,
1011
- value = arg.value;
882
+ left = arg.left,
883
+ top = arg.top,
884
+ label = arg.label,
885
+ value = arg.value;
1012
886
  var maxTextWidth = Math.max(exports.estimateTextWidth(label, exports.LABEL_FONT_SIZE), exports.estimateTextWidth(value, exports.LABEL_FONT_SIZE)) + 10;
1013
887
  return React.createElement("div", {
1014
888
  key: "tooltip",
@@ -1037,17 +911,12 @@ var ToolTip = function ToolTip(arg) {
1037
911
  maxTextWidth: maxTextWidth
1038
912
  }, " ", label, " "), React.createElement(TooltipValue, null, exports.valueText(value))), React.createElement(ArrowDown, null)));
1039
913
  };
1040
-
1041
914
  var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
1042
915
  _inherits(GeoJsonChoropleth, _React$Component);
1043
-
1044
916
  var _super = _createSuper(GeoJsonChoropleth);
1045
-
1046
917
  function GeoJsonChoropleth(props) {
1047
918
  var _this;
1048
-
1049
919
  _classCallCheck(this, GeoJsonChoropleth);
1050
-
1051
920
  _this = _super.call(this, props);
1052
921
  _this.containerRef = React.createRef();
1053
922
  _this.toolTipRef = React.createRef();
@@ -1063,16 +932,14 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
1063
932
  _this.handleFeatureHover = _this.handleFeatureHover.bind(_assertThisInitialized(_this));
1064
933
  return _this;
1065
934
  }
1066
-
1067
935
  _createClass(GeoJsonChoropleth, [{
1068
936
  key: "componentDidUpdate",
1069
937
  value: function componentDidUpdate(prevProps) {
1070
938
  var _this$props = this.props,
1071
- sourceBounds = _this$props.sourceBounds,
1072
- logicalBounds = _this$props.logicalBounds,
1073
- projection = _this$props.projection,
1074
- geoJson = _this$props.geoJson;
1075
-
939
+ sourceBounds = _this$props.sourceBounds,
940
+ logicalBounds = _this$props.logicalBounds,
941
+ projection = _this$props.projection,
942
+ geoJson = _this$props.geoJson;
1076
943
  if (prevProps.geoJson !== geoJson || prevProps.sourceBounds !== sourceBounds || prevProps.logicalBounds !== logicalBounds || prevProps.projection !== projection) {
1077
944
  // eslint-disable-next-line react/no-did-update-set-state
1078
945
  this.setState({
@@ -1084,7 +951,6 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
1084
951
  key: "handleMouseMove",
1085
952
  value: function handleMouseMove(ev) {
1086
953
  this.cursorPos = this.getLocalCoords(ev.clientX, ev.clientY);
1087
-
1088
954
  if (this.toolTipRef.current) {
1089
955
  this.toolTipRef.current.style.left = "".concat(this.cursorPos.x, "px");
1090
956
  this.toolTipRef.current.style.top = "".concat(this.cursorPos.y, "px");
@@ -1094,9 +960,8 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
1094
960
  key: "handleFeatureHover",
1095
961
  value: function handleFeatureHover(_ref) {
1096
962
  var featureId = _ref.featureId,
1097
- value = _ref.value,
1098
- label = _ref.label;
1099
-
963
+ value = _ref.value,
964
+ label = _ref.label;
1100
965
  if (featureId) {
1101
966
  this.setState({
1102
967
  toolTip: {
@@ -1109,9 +974,7 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
1109
974
  toolTip: null
1110
975
  });
1111
976
  }
1112
-
1113
977
  var externalHandler = this.props.onFeatureHover;
1114
-
1115
978
  if (externalHandler) {
1116
979
  externalHandler(featureId);
1117
980
  }
@@ -1133,11 +996,9 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
1133
996
  key: "render",
1134
997
  value: function render() {
1135
998
  var _this2 = this;
1136
-
1137
999
  var children = [];
1138
1000
  var relevantProps = lodash_1.omit(this.props, ['sourceBounds', 'logicalBounds', 'projection']);
1139
1001
  var toolTip = this.state.toolTip; // create one child SvgChoropleth for each GeoJsonFeatureCollection
1140
-
1141
1002
  this.state.featureCollections.forEach(function (f) {
1142
1003
  var props = Object.assign(Object.assign({}, relevantProps), {
1143
1004
  onFeatureHover: _this2.handleFeatureHover,
@@ -1146,11 +1007,9 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
1146
1007
  var svgChoropleth = React.createElement(SvgChoropleth_1.default, props);
1147
1008
  var style = {};
1148
1009
  var logicalBounds = lodash_1.get(f, ['group', 'logicalBounds']);
1149
-
1150
1010
  if (logicalBounds) {
1151
1011
  style = BoundsUtils_1.default.logicalBoundsToCssStyle(logicalBounds);
1152
1012
  }
1153
-
1154
1013
  children.push(React.createElement('div', {
1155
1014
  key: f.name,
1156
1015
  style: style
@@ -1169,10 +1028,8 @@ var GeoJsonChoropleth = /*#__PURE__*/function (_React$Component) {
1169
1028
  }));
1170
1029
  }
1171
1030
  }]);
1172
-
1173
1031
  return GeoJsonChoropleth;
1174
1032
  }(React.Component);
1175
-
1176
1033
  exports.default = SanitizeProps_1.withSanitizedProps(GeoJsonChoropleth);
1177
1034
 
1178
1035
  /***/ }),
@@ -1189,58 +1046,40 @@ module.exports = require("@babel/runtime/helpers/assertThisInitialized");
1189
1046
 
1190
1047
 
1191
1048
  var _classCallCheck = __webpack_require__(17);
1192
-
1193
1049
  var _createClass = __webpack_require__(16);
1194
-
1195
1050
  var _slicedToArray = __webpack_require__(38);
1196
-
1197
1051
  Object.defineProperty(exports, "__esModule", {
1198
1052
  value: true
1199
1053
  });
1200
1054
  exports.renderGeoJsonFeature = exports.polygon = exports.ring = exports.pickLogicalBnds = exports.DEFAULT_LOGICAL_BOUNDS = exports.featureGroupMatcher = exports.MATCH_ALL_FEATUREGROUP_MATCHER = void 0;
1201
-
1202
1055
  var lodash_1 = __webpack_require__(21);
1203
-
1204
1056
  var bbox_clip_1 = __webpack_require__(54);
1205
-
1206
1057
  var MercatorTransformation_1 = __webpack_require__(55);
1207
-
1208
1058
  var GeometryStreamSVGRenderer_1 = __webpack_require__(56);
1209
-
1210
1059
  var ICoordinateTransformation_1 = __webpack_require__(31);
1211
-
1212
1060
  var LinearTransformation_1 = __webpack_require__(61);
1213
-
1214
1061
  var TransformationChain_1 = __webpack_require__(39);
1215
-
1216
- var BoundsUtils_1 = __webpack_require__(40); // eslint-disable-next-line @typescript-eslint/no-unused-vars
1217
-
1218
-
1062
+ var BoundsUtils_1 = __webpack_require__(40);
1063
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1219
1064
  var MATCH_ALL_FEATUREGROUP_MATCHER = function MATCH_ALL_FEATUREGROUP_MATCHER(feature) {
1220
1065
  return true;
1221
1066
  };
1222
-
1223
1067
  exports.MATCH_ALL_FEATUREGROUP_MATCHER = MATCH_ALL_FEATUREGROUP_MATCHER;
1224
-
1225
1068
  function featureGroupMatcher(g) {
1226
1069
  if (!g || !g.featureMatcher || !g.featureMatcher.regex || !g.featureMatcher.property) {
1227
1070
  // if no matcher things defined, then we are not filtering features, and therefore should match all
1228
1071
  // eslint-disable-next-line
1229
1072
  return exports.MATCH_ALL_FEATUREGROUP_MATCHER;
1230
1073
  }
1231
-
1232
1074
  var matcher = new RegExp(g.featureMatcher.regex);
1233
1075
  return function (feature) {
1234
1076
  var val = lodash_1.get(feature, ['properties', g.featureMatcher.property]);
1235
-
1236
1077
  if (!val) {
1237
1078
  return false;
1238
1079
  }
1239
-
1240
1080
  return matcher.test(val);
1241
1081
  };
1242
1082
  }
1243
-
1244
1083
  exports.featureGroupMatcher = featureGroupMatcher;
1245
1084
  exports.DEFAULT_LOGICAL_BOUNDS = {
1246
1085
  x: {
@@ -1254,30 +1093,23 @@ exports.DEFAULT_LOGICAL_BOUNDS = {
1254
1093
  }; // default logical bounds
1255
1094
  // same as with sourceBounds, logical bound can be global or local to the FeatureGroup. They also need to have defaults
1256
1095
  // which are provided here.
1257
-
1258
1096
  function pickLogicalBnds(globalLogicalBnds, g) {
1259
1097
  if (g && g.logicalBounds) {
1260
1098
  return g.logicalBounds;
1261
1099
  }
1262
-
1263
1100
  if (globalLogicalBnds) {
1264
1101
  return globalLogicalBnds;
1265
1102
  }
1266
-
1267
1103
  return exports.DEFAULT_LOGICAL_BOUNDS;
1268
1104
  }
1269
-
1270
1105
  exports.pickLogicalBnds = pickLogicalBnds;
1271
-
1272
1106
  function ring(coords, renderer, bounds, props) {
1273
1107
  // polygon coords is array of number array
1274
1108
  renderer.beginNode('polygon', props);
1275
-
1276
1109
  for (var i = 0; i < coords.length; i += 1) {
1277
1110
  var _coords$i = _slicedToArray(coords[i], 2),
1278
- long = _coords$i[0],
1279
- lat = _coords$i[1];
1280
-
1111
+ long = _coords$i[0],
1112
+ lat = _coords$i[1];
1281
1113
  if (bounds && !BoundsUtils_1.default.contains(bounds, {
1282
1114
  long: long
1283
1115
  }, {
@@ -1295,48 +1127,38 @@ function ring(coords, renderer, bounds, props) {
1295
1127
  lat: lat
1296
1128
  });
1297
1129
  }
1298
-
1299
1130
  renderer.endNode();
1300
1131
  }
1301
-
1302
1132
  exports.ring = ring;
1303
-
1304
1133
  function polygon(coords, renderer, bounds) {
1305
1134
  // polygon coords is array of number array
1306
1135
  for (var poly = 0; poly < coords.length; poly += 1) {
1307
1136
  ring(coords[poly], renderer, bounds);
1308
1137
  }
1309
1138
  }
1310
-
1311
1139
  exports.polygon = polygon;
1312
-
1313
1140
  function renderGeoJsonFeature(feature, renderer, bounds) {
1314
1141
  var bbox = bounds ? BoundsUtils_1.default.toTurfBBox(bounds) : undefined;
1315
1142
  var type = feature.geometry.type;
1316
-
1317
1143
  if (lodash_1.get(feature, ['properties', 'name']) === 'Antarctica') {
1318
1144
  // skip shapes that cannot be mercator projected
1319
1145
  // no-op
1320
1146
  return;
1321
- } // demo hack...
1322
-
1323
-
1147
+ }
1148
+ // demo hack...
1324
1149
  var props = feature.properties;
1325
-
1326
1150
  if (props.iso_3166_2) {
1327
1151
  props.id = props.iso_3166_2;
1328
1152
  } else {
1329
1153
  props.id = props.name;
1330
1154
  }
1331
-
1332
- props.className = 'feature'; // end demo hack
1333
-
1155
+ props.className = 'feature';
1156
+ // end demo hack
1334
1157
  switch (type) {
1335
1158
  case 'MultiPolygon':
1336
1159
  {
1337
1160
  renderer.beginNode('g', props); // svg has groups ('g') but no polygon
1338
1161
  // eslint-disable-next-line no-param-reassign
1339
-
1340
1162
  feature = bbox ? bbox_clip_1.default(feature, bbox) : feature;
1341
1163
  var multis = lodash_1.get(feature, ['geometry', 'coordinates']);
1342
1164
  multis.forEach(function (multi) {
@@ -1345,7 +1167,6 @@ function renderGeoJsonFeature(feature, renderer, bounds) {
1345
1167
  renderer.endNode();
1346
1168
  break;
1347
1169
  }
1348
-
1349
1170
  case 'Polygon':
1350
1171
  {
1351
1172
  // eslint-disable-next-line no-param-reassign
@@ -1356,16 +1177,13 @@ function renderGeoJsonFeature(feature, renderer, bounds) {
1356
1177
  });
1357
1178
  break;
1358
1179
  }
1359
-
1360
1180
  default:
1361
1181
  {
1362
1182
  throw new Error("Unsupported geojson type: ".concat(type));
1363
1183
  }
1364
1184
  }
1365
1185
  }
1366
-
1367
1186
  exports.renderGeoJsonFeature = renderGeoJsonFeature;
1368
-
1369
1187
  function computeBounds(geoJson, matcher) {
1370
1188
  // replace the renderer with one that is configured only to compute logicalBounds (for performance)
1371
1189
  var boundsComputer = new GeometryStreamSVGRenderer_1.GeometryStreamSVGRenderer();
@@ -1376,10 +1194,9 @@ function computeBounds(geoJson, matcher) {
1376
1194
  }
1377
1195
  });
1378
1196
  return boundsComputer.getBounds();
1379
- } // the source bounds can be provided globally for all feature groups, or they can be provided within a FeatureGroup
1197
+ }
1198
+ // the source bounds can be provided globally for all feature groups, or they can be provided within a FeatureGroup
1380
1199
  // or they can be omitted entirely which means they must be computed by parsing the geoJson
1381
-
1382
-
1383
1200
  function pickSrcBnds(geoJson, g, globalSrcBnds, featureMatcher) {
1384
1201
  if (g && g.sourceBounds) {
1385
1202
  return g.sourceBounds; // return FeatureGroup "local" sourceBounds if they exist.
@@ -1387,22 +1204,17 @@ function pickSrcBnds(geoJson, g, globalSrcBnds, featureMatcher) {
1387
1204
 
1388
1205
  if (globalSrcBnds) {
1389
1206
  return globalSrcBnds; // return global bounds if they exist
1390
- } // ...'auto' compute the source bounds from the data.
1391
-
1392
-
1207
+ }
1208
+ // ...'auto' compute the source bounds from the data.
1393
1209
  var b = computeBounds(geoJson, featureMatcher); // automatically compute sourceBounds if not provided
1394
-
1395
1210
  if (!b) {
1396
1211
  throw new Error("Could not determine bounds for geoFeatureGroup name='".concat(this.name, "' (no features matched)"));
1397
1212
  }
1398
-
1399
1213
  return b;
1400
1214
  }
1401
-
1402
1215
  var GeoJsonFeatureCollection = /*#__PURE__*/function () {
1403
1216
  function GeoJsonFeatureCollection(name, globalLogicalBnds, projectionType, geoJson, g, globalSrcBounds) {
1404
1217
  _classCallCheck(this, GeoJsonFeatureCollection);
1405
-
1406
1218
  this.name = name;
1407
1219
  this.projectionType = projectionType || 'mercator';
1408
1220
  this.geoJson = geoJson;
@@ -1413,41 +1225,33 @@ var GeoJsonFeatureCollection = /*#__PURE__*/function () {
1413
1225
  var minLat = this.sourceBounds.lat.min;
1414
1226
  var maxLat = this.sourceBounds.lat.max;
1415
1227
  var projection;
1416
-
1417
1228
  switch (projectionType) {
1418
1229
  case 'equirectangular':
1419
1230
  projection = new GeometryStreamSVGRenderer_1.IdentityTransform();
1420
1231
  break;
1421
-
1422
1232
  case 'mercator':
1423
1233
  if (Math.abs(minLat) > 85 || Math.abs(maxLat) > 85) {
1424
1234
  throw new Error("Invalid latitude boundaries for mercator projection : ".concat(minLat, "/").concat(maxLat));
1425
1235
  }
1426
-
1427
1236
  projection = new MercatorTransformation_1.MercatorTransformation();
1428
1237
  break;
1429
-
1430
1238
  default:
1431
1239
  {
1432
1240
  throw new Error("Unsupported projection: ".concat(projectionType));
1433
1241
  }
1434
1242
  }
1435
-
1436
1243
  var projectedBounds = ICoordinateTransformation_1.calculatedTargetBounds(projection, this.sourceBounds);
1437
1244
  var scaleTransformation = new LinearTransformation_1.default(ICoordinateTransformation_1.logicalSpace, ICoordinateTransformation_1.logicalSpace, ICoordinateTransformation_1.flipBounds(projectedBounds, ['y']), this.logicalBounds, null, true);
1438
1245
  this.transformation = new TransformationChain_1.default([projection, scaleTransformation]);
1439
1246
  }
1440
-
1441
1247
  _createClass(GeoJsonFeatureCollection, [{
1442
1248
  key: "contains",
1443
1249
  value: function contains(x, y) {
1444
1250
  var bounds = lodash_1.get(this.group, ['logicalBounds']);
1445
-
1446
1251
  if (!bounds) {
1447
1252
  return true;
1448
- } // return whether or not the x,y mouse screen location is inside this feature collection
1449
-
1450
-
1253
+ }
1254
+ // return whether or not the x,y mouse screen location is inside this feature collection
1451
1255
  return BoundsUtils_1.default.contains(bounds, {
1452
1256
  x: x
1453
1257
  }, {
@@ -1458,7 +1262,6 @@ var GeoJsonFeatureCollection = /*#__PURE__*/function () {
1458
1262
  key: "getSvgNode",
1459
1263
  value: function getSvgNode(ref) {
1460
1264
  var _this = this;
1461
-
1462
1265
  var features = this.geoJson.features;
1463
1266
  var renderer = new GeometryStreamSVGRenderer_1.GeometryStreamSVGRenderer(this.transformation);
1464
1267
  renderer.beginNode('svg', {
@@ -1480,13 +1283,10 @@ var GeoJsonFeatureCollection = /*#__PURE__*/function () {
1480
1283
  if (!this.aliases) {
1481
1284
  this.aliases = GeoJsonFeatureCollection.makeAliasMap(this.geoJson.features); // memoize
1482
1285
  }
1483
-
1484
1286
  var aliases = this.aliases;
1485
-
1486
1287
  if (aliases) {
1487
1288
  return aliases.get(alias.toLocaleLowerCase()) || alias;
1488
1289
  }
1489
-
1490
1290
  return alias;
1491
1291
  }
1492
1292
  }], [{
@@ -1495,21 +1295,20 @@ var GeoJsonFeatureCollection = /*#__PURE__*/function () {
1495
1295
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1496
1296
  return features.reduce(function (aliases, feature) {
1497
1297
  var geoJsonProperties = feature.properties;
1498
- var name = geoJsonProperties.iso_3166_2; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1499
-
1298
+ var name = geoJsonProperties.iso_3166_2;
1299
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1500
1300
  Object.keys(geoJsonProperties).forEach(function (k) {
1501
1301
  if (k !== name) {
1502
1302
  aliases.set(geoJsonProperties[k].toLowerCase(), name); // alias all the other properies to the name property
1503
1303
  }
1504
1304
  });
1305
+
1505
1306
  return aliases;
1506
1307
  }, new Map());
1507
1308
  }
1508
1309
  }]);
1509
-
1510
1310
  return GeoJsonFeatureCollection;
1511
1311
  }();
1512
-
1513
1312
  exports.default = GeoJsonFeatureCollection;
1514
1313
 
1515
1314
  /***/ }),
@@ -1526,46 +1325,32 @@ module.exports = require("@turf/bbox-clip");
1526
1325
 
1527
1326
 
1528
1327
  var _classCallCheck = __webpack_require__(17);
1529
-
1530
1328
  var _createClass = __webpack_require__(16);
1531
-
1532
1329
  var _inherits = __webpack_require__(23);
1533
-
1534
1330
  var _possibleConstructorReturn = __webpack_require__(24);
1535
-
1536
1331
  var _getPrototypeOf = __webpack_require__(25);
1537
-
1538
1332
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1539
-
1540
1333
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1541
-
1542
1334
  Object.defineProperty(exports, "__esModule", {
1543
1335
  value: true
1544
1336
  });
1545
1337
  exports.MercatorTransformation = void 0;
1546
1338
  /* eslint-disable class-methods-use-this */
1547
-
1548
1339
  var ICoordinateTransformation_1 = __webpack_require__(31);
1549
-
1550
- var CoordinateTransformation_1 = __webpack_require__(37); // transform converts degrees to an x,y mercator map whose units are radians. InverseTransform goes from radians on the x,y map back to degrees.
1551
-
1552
-
1340
+ var CoordinateTransformation_1 = __webpack_require__(37);
1341
+ // transform converts degrees to an x,y mercator map whose units are radians. InverseTransform goes from radians on the x,y map back to degrees.
1553
1342
  var MercatorTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
1554
1343
  _inherits(MercatorTransformation, _CoordinateTransforma);
1555
-
1556
1344
  var _super = _createSuper(MercatorTransformation);
1557
-
1558
1345
  function MercatorTransformation() {
1559
1346
  _classCallCheck(this, MercatorTransformation);
1560
-
1561
1347
  return _super.call(this, ICoordinateTransformation_1.geoSpace, ICoordinateTransformation_1.logicalSpace);
1562
1348
  }
1563
-
1564
1349
  _createClass(MercatorTransformation, [{
1565
1350
  key: "transformBack",
1566
1351
  value: function transformBack(coord) {
1567
1352
  var x = coord.x,
1568
- y = coord.y;
1353
+ y = coord.y;
1569
1354
  return {
1570
1355
  long: x * 180 / Math.PI,
1571
1356
  lat: (2 * Math.atan(Math.exp(y)) - Math.PI / 2) * 180 / Math.PI
@@ -1575,38 +1360,31 @@ var MercatorTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
1575
1360
  key: "transform",
1576
1361
  value: function transform(coord) {
1577
1362
  var lat = coord.lat,
1578
- long = coord.long;
1579
-
1363
+ long = coord.long;
1580
1364
  if (long > 180) {
1581
1365
  console.warn("Mercator projection: Truncating illegal longitude to 180: long");
1582
1366
  long = 180;
1583
1367
  }
1584
-
1585
1368
  if (long < -180) {
1586
1369
  console.warn("Mercator projection: Truncating illegal longitude to -180: long");
1587
1370
  long = -180;
1588
1371
  }
1589
-
1590
1372
  if (lat > 85) {
1591
1373
  console.warn("Mercator projection: Truncating illegal latitude to 85: lat");
1592
1374
  lat = 85;
1593
1375
  }
1594
-
1595
1376
  if (lat < -85) {
1596
1377
  console.warn("Mercator projection: Truncating illegal latitude to -85: lat");
1597
1378
  lat = -85;
1598
1379
  }
1599
-
1600
1380
  return {
1601
1381
  x: Math.PI * long / 180,
1602
1382
  y: Math.log(Math.tan(Math.PI / 4 + lat / 180 * Math.PI / 2))
1603
1383
  };
1604
1384
  }
1605
1385
  }]);
1606
-
1607
1386
  return MercatorTransformation;
1608
1387
  }(CoordinateTransformation_1.default);
1609
-
1610
1388
  exports.MercatorTransformation = MercatorTransformation;
1611
1389
 
1612
1390
  /***/ }),
@@ -1617,47 +1395,30 @@ exports.MercatorTransformation = MercatorTransformation;
1617
1395
 
1618
1396
 
1619
1397
  var _get = __webpack_require__(57);
1620
-
1621
1398
  var _classCallCheck = __webpack_require__(17);
1622
-
1623
1399
  var _createClass = __webpack_require__(16);
1624
-
1625
1400
  var _inherits = __webpack_require__(23);
1626
-
1627
1401
  var _possibleConstructorReturn = __webpack_require__(24);
1628
-
1629
1402
  var _getPrototypeOf = __webpack_require__(25);
1630
-
1631
1403
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
1632
-
1633
1404
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1634
-
1635
1405
  Object.defineProperty(exports, "__esModule", {
1636
1406
  value: true
1637
1407
  });
1638
1408
  exports.GeometryStreamSVGRenderer = exports.IdentityTransform = void 0;
1639
-
1640
1409
  var ICoordinateTransformation_1 = __webpack_require__(31);
1641
-
1642
1410
  var CoordinateTransformation_1 = __webpack_require__(37);
1643
-
1644
1411
  var BoundsCollector_1 = __webpack_require__(58);
1645
-
1646
- var NodeTreeReactGenerator_1 = __webpack_require__(59); // fixme TODO: should the identity transform really have different source and target spaces? That's a bit confusing
1412
+ var NodeTreeReactGenerator_1 = __webpack_require__(59);
1413
+ // fixme TODO: should the identity transform really have different source and target spaces? That's a bit confusing
1647
1414
  // as one would expect the identity transform could be inserted anywhere in a TransformationChain
1648
-
1649
-
1650
1415
  var IdentityTransform = /*#__PURE__*/function (_CoordinateTransforma) {
1651
1416
  _inherits(IdentityTransform, _CoordinateTransforma);
1652
-
1653
1417
  var _super = _createSuper(IdentityTransform);
1654
-
1655
1418
  function IdentityTransform() {
1656
1419
  _classCallCheck(this, IdentityTransform);
1657
-
1658
1420
  return _super.call(this, ICoordinateTransformation_1.geoSpace, ICoordinateTransformation_1.logicalSpace);
1659
1421
  }
1660
-
1661
1422
  _createClass(IdentityTransform, [{
1662
1423
  key: "transform",
1663
1424
  value: function transform(sourceCoords) {
@@ -1675,74 +1436,55 @@ var IdentityTransform = /*#__PURE__*/function (_CoordinateTransforma) {
1675
1436
  };
1676
1437
  }
1677
1438
  }]);
1678
-
1679
1439
  return IdentityTransform;
1680
1440
  }(CoordinateTransformation_1.default);
1681
-
1682
1441
  exports.IdentityTransform = IdentityTransform;
1683
-
1684
1442
  var GeometryStreamSVGRenderer = /*#__PURE__*/function (_NodeTreeReactGenerat) {
1685
1443
  _inherits(GeometryStreamSVGRenderer, _NodeTreeReactGenerat);
1686
-
1687
1444
  var _super2 = _createSuper(GeometryStreamSVGRenderer);
1688
-
1689
1445
  function GeometryStreamSVGRenderer(transformer) {
1690
1446
  var _this;
1691
-
1692
1447
  _classCallCheck(this, GeometryStreamSVGRenderer);
1693
-
1694
1448
  _this = _super2.call(this);
1695
1449
  _this.transformer = new IdentityTransform();
1696
1450
  _this.computeBoundsOnly = false;
1697
1451
  _this.boundsCollector = new BoundsCollector_1.default();
1698
-
1699
1452
  if (transformer) {
1700
1453
  _this.transformer = transformer;
1701
1454
  }
1702
-
1703
1455
  return _this;
1704
1456
  }
1705
-
1706
1457
  _createClass(GeometryStreamSVGRenderer, [{
1707
1458
  key: "addPoint",
1708
1459
  value: function addPoint(p) {
1709
1460
  this.boundsCollector.addPoint(p);
1710
-
1711
1461
  if (this.computeBoundsOnly) {
1712
1462
  return;
1713
1463
  }
1714
-
1715
1464
  var el = _get(_getPrototypeOf(GeometryStreamSVGRenderer.prototype), "peek", this).call(this);
1716
-
1717
1465
  var points = el.attributes.points;
1718
-
1719
1466
  if (points) {
1720
1467
  el.attributes.points += ' ';
1721
1468
  } else {
1722
1469
  el.attributes.points = ''; // initialize
1723
1470
  }
1724
-
1725
1471
  var _this$transformer$tra = this.transformer.transform(p),
1726
- x = _this$transformer$tra.x,
1727
- y = _this$transformer$tra.y;
1472
+ x = _this$transformer$tra.x,
1473
+ y = _this$transformer$tra.y;
1728
1474
  /*
1729
1475
  if(!x || !y){
1730
1476
  throw new Error("DataPoint did not contain an x and y coordinate (cannot be rendered to SVG).: " + JSON.stringify(p));
1731
1477
  }
1732
1478
  */
1733
-
1734
-
1735
1479
  el.attributes.points += "".concat(x, ",").concat(y); // FIXME TODO probably should not look for hard coded x and y in DataPoint
1736
1480
  }
1737
1481
  }, {
1738
1482
  key: "beginNode",
1739
1483
  value: function beginNode(name) {
1740
1484
  var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1741
-
1742
1485
  if (this.computeBoundsOnly) {
1743
1486
  return;
1744
1487
  }
1745
-
1746
1488
  _get(_getPrototypeOf(GeometryStreamSVGRenderer.prototype), "beginNode", this).call(this, name, attributes);
1747
1489
  }
1748
1490
  }, {
@@ -1751,10 +1493,9 @@ var GeometryStreamSVGRenderer = /*#__PURE__*/function (_NodeTreeReactGenerat) {
1751
1493
  if (this.computeBoundsOnly) {
1752
1494
  return;
1753
1495
  }
1754
-
1755
1496
  _get(_getPrototypeOf(GeometryStreamSVGRenderer.prototype), "endNode", this).call(this);
1756
- } // automatically compute the logicalBounds based on the points that were added. This is 'auto' style of bounding box.
1757
-
1497
+ }
1498
+ // automatically compute the logicalBounds based on the points that were added. This is 'auto' style of bounding box.
1758
1499
  }, {
1759
1500
  key: "getBounds",
1760
1501
  value: function getBounds() {
@@ -1764,14 +1505,11 @@ var GeometryStreamSVGRenderer = /*#__PURE__*/function (_NodeTreeReactGenerat) {
1764
1505
  key: "clear",
1765
1506
  value: function clear() {
1766
1507
  _get(_getPrototypeOf(GeometryStreamSVGRenderer.prototype), "clear", this).call(this);
1767
-
1768
1508
  this.boundsCollector = new BoundsCollector_1.default();
1769
1509
  }
1770
1510
  }]);
1771
-
1772
1511
  return GeometryStreamSVGRenderer;
1773
1512
  }(NodeTreeReactGenerator_1.NodeTreeReactGenerator);
1774
-
1775
1513
  exports.GeometryStreamSVGRenderer = GeometryStreamSVGRenderer;
1776
1514
 
1777
1515
  /***/ }),
@@ -1788,35 +1526,28 @@ module.exports = require("@babel/runtime/helpers/get");
1788
1526
 
1789
1527
 
1790
1528
  var _classCallCheck = __webpack_require__(17);
1791
-
1792
1529
  var _createClass = __webpack_require__(16);
1793
-
1794
1530
  Object.defineProperty(exports, "__esModule", {
1795
1531
  value: true
1796
1532
  });
1797
-
1798
1533
  var BoundsCollector = /*#__PURE__*/function () {
1799
1534
  function BoundsCollector() {
1800
1535
  _classCallCheck(this, BoundsCollector);
1801
-
1802
1536
  this.intervals = {};
1803
1537
  }
1804
-
1805
1538
  _createClass(BoundsCollector, [{
1806
1539
  key: "getBounds",
1807
1540
  value: function getBounds() {
1808
1541
  return Object.keys(this.intervals).length > 0 ? this.intervals : undefined;
1809
- } // expand the Bounds if the added point is outside the Bounds.
1542
+ }
1543
+ // expand the Bounds if the added point is outside the Bounds.
1810
1544
  // Since we don't know what they axes will be for a given DataPoint
1811
-
1812
1545
  }, {
1813
1546
  key: "addPoint",
1814
1547
  value: function addPoint(p) {
1815
1548
  var _this = this;
1816
-
1817
1549
  Object.keys(p).forEach(function (axis) {
1818
1550
  var interval = _this.intervals[axis];
1819
-
1820
1551
  if (!interval) {
1821
1552
  interval = {
1822
1553
  min: p[axis],
@@ -1824,21 +1555,17 @@ var BoundsCollector = /*#__PURE__*/function () {
1824
1555
  };
1825
1556
  _this.intervals[axis] = interval;
1826
1557
  }
1827
-
1828
1558
  if (p[axis] < interval.min) {
1829
1559
  interval.min = p[axis];
1830
1560
  }
1831
-
1832
1561
  if (p[axis] > interval.max) {
1833
1562
  interval.max = p[axis];
1834
1563
  }
1835
1564
  });
1836
1565
  }
1837
1566
  }]);
1838
-
1839
1567
  return BoundsCollector;
1840
1568
  }();
1841
-
1842
1569
  exports.default = BoundsCollector;
1843
1570
 
1844
1571
  /***/ }),
@@ -1849,30 +1576,21 @@ exports.default = BoundsCollector;
1849
1576
 
1850
1577
 
1851
1578
  var _slicedToArray = __webpack_require__(38);
1852
-
1853
1579
  var _classCallCheck = __webpack_require__(17);
1854
-
1855
1580
  var _createClass = __webpack_require__(16);
1856
-
1857
1581
  Object.defineProperty(exports, "__esModule", {
1858
1582
  value: true
1859
1583
  });
1860
1584
  exports.NodeTreeReactGenerator = exports.ElementStructure = void 0;
1861
1585
  /* eslint-disable max-classes-per-file */
1862
-
1863
1586
  /* eslint-disable no-underscore-dangle */
1864
-
1865
1587
  /* eslint-disable no-param-reassign */
1866
-
1867
- var React = __webpack_require__(1); // eslint-disable-next-line import/order
1868
-
1869
-
1588
+ var React = __webpack_require__(1);
1589
+ // eslint-disable-next-line import/order
1870
1590
  var camelCase = __webpack_require__(60);
1871
1591
  /**
1872
1592
  * This class represents the structure of a React element.
1873
1593
  */
1874
-
1875
-
1876
1594
  var ElementStructure = /*#__PURE__*/function () {
1877
1595
  /**
1878
1596
  * @constructor
@@ -1883,23 +1601,19 @@ var ElementStructure = /*#__PURE__*/function () {
1883
1601
  function ElementStructure(name) {
1884
1602
  var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1885
1603
  var textContent = arguments.length > 2 ? arguments[2] : undefined;
1886
-
1887
1604
  _classCallCheck(this, ElementStructure);
1888
-
1889
1605
  this.attributes = {};
1890
1606
  this.children = [];
1891
1607
  this.name = name;
1892
1608
  this.attributes = ElementStructure.processStyleAttributes(attributes);
1893
1609
  this.textContent = textContent;
1894
1610
  }
1895
-
1896
1611
  _createClass(ElementStructure, null, [{
1897
1612
  key: "processStyleAttributes",
1898
1613
  value: function processStyleAttributes(a) {
1899
1614
  if (a.style) {
1900
1615
  a.style = ElementStructure.parseStyle(a.style);
1901
1616
  }
1902
-
1903
1617
  return a;
1904
1618
  }
1905
1619
  /**
@@ -1908,37 +1622,31 @@ var ElementStructure = /*#__PURE__*/function () {
1908
1622
  * @param {string} style
1909
1623
  * @returns {object}
1910
1624
  */
1911
-
1912
1625
  }, {
1913
1626
  key: "parseStyle",
1914
1627
  value: function parseStyle(style) {
1915
- var o = {}; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1916
-
1628
+ var o = {};
1629
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1917
1630
  style.split(';').forEach(function (s) {
1918
1631
  var _s$split = s.split(':'),
1919
- _s$split2 = _slicedToArray(_s$split, 2),
1920
- k = _s$split2[0],
1921
- v = _s$split2[1];
1922
-
1632
+ _s$split2 = _slicedToArray(_s$split, 2),
1633
+ k = _s$split2[0],
1634
+ v = _s$split2[1];
1923
1635
  o[camelCase(k)] = v;
1924
1636
  });
1925
1637
  return o;
1926
1638
  }
1927
1639
  }]);
1928
-
1929
1640
  return ElementStructure;
1930
1641
  }();
1931
-
1932
1642
  exports.ElementStructure = ElementStructure;
1933
1643
  /**
1934
1644
  * This class is used to build up a node tree. The node tree is turned into a ReactNode when the root node of the
1935
1645
  * tree is closed (aka the closing tag).
1936
1646
  */
1937
-
1938
1647
  var NodeTreeReactGenerator = /*#__PURE__*/function () {
1939
1648
  function NodeTreeReactGenerator() {
1940
1649
  _classCallCheck(this, NodeTreeReactGenerator);
1941
-
1942
1650
  this._stack = [];
1943
1651
  }
1944
1652
  /**
@@ -1947,8 +1655,6 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
1947
1655
  * @param {object} attributes - the element's attributes
1948
1656
  * @param {string} textContent - optional text content for a node
1949
1657
  */
1950
-
1951
-
1952
1658
  _createClass(NodeTreeReactGenerator, [{
1953
1659
  key: "beginNode",
1954
1660
  value: function beginNode(name) {
@@ -1956,8 +1662,8 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
1956
1662
  var textContent = arguments.length > 2 ? arguments[2] : undefined;
1957
1663
  var attrCopy = {
1958
1664
  key: Math.random()
1959
- }; // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1960
-
1665
+ };
1666
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
1961
1667
  Object.keys(attributes).forEach(function (k) {
1962
1668
  if (k.startsWith('data-')) {
1963
1669
  attrCopy[k] = attributes[k];
@@ -1965,7 +1671,6 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
1965
1671
  attrCopy[camelCase(k)] = attributes[k];
1966
1672
  }
1967
1673
  });
1968
-
1969
1674
  this._stack.push(new ElementStructure(name, attrCopy, textContent));
1970
1675
  }
1971
1676
  /**
@@ -1973,19 +1678,16 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
1973
1678
  * child nodes tracked by the parent's ElementStructure. If the tag being closed is the root node, then the _root
1974
1679
  * is set and we are done, having created the ReactNode representing the entire tree.
1975
1680
  */
1976
-
1977
1681
  }, {
1978
1682
  key: "endNode",
1979
1683
  value: function endNode() {
1980
1684
  var popped = this._stack.pop();
1981
-
1982
1685
  var name = popped.name,
1983
- attributes = popped.attributes,
1984
- children = popped.children,
1985
- textContent = popped.textContent;
1686
+ attributes = popped.attributes,
1687
+ children = popped.children,
1688
+ textContent = popped.textContent;
1986
1689
  var el = this.peek();
1987
1690
  var reactNode = null;
1988
-
1989
1691
  if (children.length === 0) {
1990
1692
  if (textContent) {
1991
1693
  reactNode = React.createElement(name, attributes, textContent);
@@ -1996,14 +1698,11 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
1996
1698
  if (textContent) {
1997
1699
  throw new Error("textContent can't be mixed with children on node ".concat(name));
1998
1700
  }
1999
-
2000
1701
  reactNode = React.createElement(name, attributes, children);
2001
1702
  }
2002
-
2003
1703
  if (this.decorator) {
2004
1704
  reactNode = this.decorator(reactNode);
2005
1705
  }
2006
-
2007
1706
  if (el) {
2008
1707
  el.children.push(reactNode);
2009
1708
  } else {
@@ -2016,27 +1715,23 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
2016
1715
  if (this._stack.length === 0) {
2017
1716
  return null;
2018
1717
  }
2019
-
2020
1718
  return this._stack[this._stack.length - 1];
2021
1719
  }
2022
1720
  /**
2023
1721
  * Returns the ReactNode representing the entire tree, or throws Error if tree is not fully processed.
2024
1722
  * @returns {React.ReactElement}
2025
1723
  */
2026
-
2027
1724
  }, {
2028
1725
  key: "getRoot",
2029
1726
  value: function getRoot() {
2030
1727
  if (this._root) {
2031
1728
  return this._root;
2032
1729
  }
2033
-
2034
1730
  throw new Error("Can't compute ReactElement until root node has been closed. Node stack: ".concat(this._stack));
2035
1731
  }
2036
1732
  /**
2037
1733
  * Clears internal structures so this instance can be used to process a new tree.
2038
1734
  */
2039
-
2040
1735
  }, {
2041
1736
  key: "clear",
2042
1737
  value: function clear() {
@@ -2046,17 +1741,14 @@ var NodeTreeReactGenerator = /*#__PURE__*/function () {
2046
1741
  /**
2047
1742
  * Allows the current tag and all its children to be erased.
2048
1743
  */
2049
-
2050
1744
  }, {
2051
1745
  key: "cancelNode",
2052
1746
  value: function cancelNode() {
2053
1747
  this._stack.pop();
2054
1748
  }
2055
1749
  }]);
2056
-
2057
1750
  return NodeTreeReactGenerator;
2058
1751
  }();
2059
-
2060
1752
  exports.NodeTreeReactGenerator = NodeTreeReactGenerator;
2061
1753
 
2062
1754
  /***/ }),
@@ -2073,44 +1765,30 @@ module.exports = require("lodash/camelCase");
2073
1765
 
2074
1766
 
2075
1767
  var _classCallCheck = __webpack_require__(17);
2076
-
2077
1768
  var _createClass = __webpack_require__(16);
2078
-
2079
1769
  var _inherits = __webpack_require__(23);
2080
-
2081
1770
  var _possibleConstructorReturn = __webpack_require__(24);
2082
-
2083
1771
  var _getPrototypeOf = __webpack_require__(25);
2084
-
2085
1772
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
2086
-
2087
1773
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
2088
-
2089
1774
  Object.defineProperty(exports, "__esModule", {
2090
1775
  value: true
2091
1776
  });
2092
1777
  exports.createBoundsInfo = void 0;
2093
-
2094
1778
  var lodash_1 = __webpack_require__(21);
2095
-
2096
1779
  var Scale_1 = __webpack_require__(62);
2097
-
2098
1780
  var CoordinateTransformation_1 = __webpack_require__(37);
2099
-
2100
1781
  var sign = Math.sign || function (n) {
2101
1782
  if (n < 0) return -1;
2102
1783
  if (n > 0) return 1;
2103
1784
  return 0;
2104
1785
  };
2105
-
2106
1786
  var signedDistance = function distance(interval) {
2107
1787
  return interval.max - interval.min;
2108
1788
  };
2109
-
2110
1789
  var direction = function direction(interval) {
2111
1790
  return sign(interval.max - interval.min);
2112
1791
  };
2113
-
2114
1792
  var createBoundsInfo = function createBoundsInfo(sourceBounds, transformation) {
2115
1793
  return {
2116
1794
  sourceBounds: sourceBounds,
@@ -2119,21 +1797,14 @@ var createBoundsInfo = function createBoundsInfo(sourceBounds, transformation) {
2119
1797
  })
2120
1798
  };
2121
1799
  };
2122
-
2123
1800
  exports.createBoundsInfo = createBoundsInfo;
2124
-
2125
1801
  var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2126
1802
  _inherits(LinearTransformation, _CoordinateTransforma);
2127
-
2128
1803
  var _super = _createSuper(LinearTransformation);
2129
-
2130
1804
  function LinearTransformation(sourceDimensions, targetDimensions, sourceBounds, targetBounds, mapping) {
2131
1805
  var _this;
2132
-
2133
1806
  var preserveAspectRatio = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
2134
-
2135
1807
  _classCallCheck(this, LinearTransformation);
2136
-
2137
1808
  _this = _super.call(this, sourceDimensions, targetDimensions);
2138
1809
  _this.targetCoordinate = {};
2139
1810
  _this.sourceCoordinate = {};
@@ -2145,36 +1816,29 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2145
1816
  _this.targetCoordinate[sourceCoordinate] = targetCoordinate;
2146
1817
  _this.sourceCoordinate[targetCoordinate] = sourceCoordinate;
2147
1818
  });
2148
-
2149
1819
  if (sourceBounds && targetBounds) {
2150
1820
  _this.fit(sourceBounds, targetBounds);
2151
1821
  }
2152
-
2153
1822
  return _this;
2154
1823
  }
2155
-
2156
1824
  _createClass(LinearTransformation, [{
2157
1825
  key: "fit",
2158
1826
  value: function fit(sourceRanges, targetRanges) {
2159
1827
  if (this.preserveAspectRatio) {
2160
1828
  return this.fitUndistorted(sourceRanges, targetRanges);
2161
1829
  }
2162
-
2163
1830
  return this.fitIndependently(sourceRanges, targetRanges);
2164
1831
  }
2165
1832
  }, {
2166
1833
  key: "fitUndistorted",
2167
1834
  value: function fitUndistorted(sourceRanges, targetRanges) {
2168
1835
  var _this2 = this;
2169
-
2170
1836
  var minScale = Number.MAX_VALUE;
2171
1837
  Object.keys(sourceRanges).forEach(function (dimension) {
2172
1838
  var targetDimension = _this2.targetCoordinate[dimension];
2173
-
2174
1839
  if (!targetRanges[targetDimension]) {
2175
1840
  throw new Error("Missing targetRanges for dimension ".concat(targetDimension));
2176
1841
  }
2177
-
2178
1842
  var range = sourceRanges[dimension];
2179
1843
  var sourceDistance = Math.abs(range.max - range.min);
2180
1844
  var targetBounds = Scale_1.toInterval(targetRanges[targetDimension]);
@@ -2182,7 +1846,6 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2182
1846
  });
2183
1847
  Object.keys(sourceRanges).forEach(function (dimension) {
2184
1848
  var targetDimension = _this2.targetCoordinate[dimension];
2185
-
2186
1849
  _this2.scales[dimension].update(minScale * direction(Scale_1.toInterval(sourceRanges[targetDimension])), sourceRanges[dimension].min);
2187
1850
  });
2188
1851
  return this;
@@ -2191,14 +1854,11 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2191
1854
  key: "fitIndependently",
2192
1855
  value: function fitIndependently(sourceRanges, targetRanges) {
2193
1856
  var _this3 = this;
2194
-
2195
1857
  Object.keys(sourceRanges).forEach(function (dimension) {
2196
1858
  var targetDimension = _this3.targetCoordinate[dimension];
2197
-
2198
1859
  if (!targetRanges[targetDimension]) {
2199
1860
  throw new Error("Missing parameter targetRanges for dimension ".concat(dimension));
2200
1861
  }
2201
-
2202
1862
  _this3.scales[dimension].fit(sourceRanges[dimension], targetRanges[targetDimension]);
2203
1863
  });
2204
1864
  return this;
@@ -2207,9 +1867,9 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2207
1867
  key: "transform",
2208
1868
  value: function transform(sourcePoint) {
2209
1869
  var _this4 = this;
2210
-
2211
1870
  var result = {};
2212
- Object.keys(this.sourceSpace).forEach( // TODO: move to explicit return
1871
+ Object.keys(this.sourceSpace).forEach(
1872
+ // TODO: move to explicit return
2213
1873
  // eslint-disable-next-line no-return-assign
2214
1874
  function (dimension) {
2215
1875
  return result[_this4.targetCoordinate[dimension]] = _this4.scales[dimension].source2Target(sourcePoint[dimension]);
@@ -2220,7 +1880,6 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2220
1880
  key: "transformBack",
2221
1881
  value: function transformBack(targetPoint) {
2222
1882
  var _this5 = this;
2223
-
2224
1883
  var result = {};
2225
1884
  Object.keys(this.targetSpace).forEach(function (coordinate) {
2226
1885
  var sourceCoordinate = _this5.sourceCoordinate[coordinate];
@@ -2242,13 +1901,11 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2242
1901
  key: "zoomAroundTarget",
2243
1902
  value: function zoomAroundTarget(targetCenter, factor, minScale, maxScale) {
2244
1903
  var _this6 = this;
2245
-
2246
1904
  var currentScale = this.scales.x.scaleFactor;
2247
1905
  var newScale = Math.min(maxScale || Number.MAX_VALUE, Math.max(currentScale * factor, minScale || 0));
2248
1906
  var sourceCenter = this.transformBack(targetCenter);
2249
1907
  ['x', 'y'].forEach(function (axis) {
2250
1908
  var dimension = _this6.sourceCoordinate[axis];
2251
-
2252
1909
  _this6.scales[dimension].zoomAroundSource(sourceCenter[dimension], newScale);
2253
1910
  });
2254
1911
  return this;
@@ -2257,10 +1914,8 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2257
1914
  key: "moveTargetWindowBy",
2258
1915
  value: function moveTargetWindowBy(delta) {
2259
1916
  var _this7 = this;
2260
-
2261
1917
  ['x', 'y'].forEach(function (axis) {
2262
1918
  var dimension = _this7.sourceCoordinate[axis];
2263
-
2264
1919
  if (delta[axis] != null) {
2265
1920
  _this7.scales[dimension].moveTargetBy(delta[axis]);
2266
1921
  }
@@ -2275,10 +1930,8 @@ var LinearTransformation = /*#__PURE__*/function (_CoordinateTransforma) {
2275
1930
  return "translate(".concat(dx, "px, ").concat(dy, "px) scale(").concat(this.scales.x.scaleFactor, ")");
2276
1931
  }
2277
1932
  }]);
2278
-
2279
1933
  return LinearTransformation;
2280
1934
  }(CoordinateTransformation_1.default);
2281
-
2282
1935
  exports.default = LinearTransformation;
2283
1936
 
2284
1937
  /***/ }),
@@ -2289,35 +1942,27 @@ exports.default = LinearTransformation;
2289
1942
 
2290
1943
 
2291
1944
  var _classCallCheck = __webpack_require__(17);
2292
-
2293
1945
  var _createClass = __webpack_require__(16);
2294
-
2295
1946
  Object.defineProperty(exports, "__esModule", {
2296
1947
  value: true
2297
1948
  });
2298
1949
  exports.Scale = exports.toInterval = void 0;
2299
-
2300
1950
  var isInterval = function isInterval(object) {
2301
1951
  return object.min != null && object.max != null;
2302
1952
  };
2303
-
2304
1953
  var toInterval = function toInterval(object) {
2305
1954
  if (isInterval(object)) {
2306
1955
  return object;
2307
1956
  }
2308
-
2309
1957
  return {
2310
1958
  min: 0,
2311
1959
  max: object
2312
1960
  };
2313
1961
  };
2314
-
2315
1962
  exports.toInterval = toInterval;
2316
-
2317
1963
  var Scale = /*#__PURE__*/function () {
2318
1964
  function Scale() {
2319
1965
  _classCallCheck(this, Scale);
2320
-
2321
1966
  this.offset = 0;
2322
1967
  this.scaleFactor = 1;
2323
1968
  }
@@ -2327,8 +1972,6 @@ var Scale = /*#__PURE__*/function () {
2327
1972
  * @param {number} targetStart The source coordinate for which the target coordinate is 0
2328
1973
  * @return {this}
2329
1974
  */
2330
-
2331
-
2332
1975
  _createClass(Scale, [{
2333
1976
  key: "update",
2334
1977
  value: function update(scaleFactor, targetStart) {
@@ -2352,7 +1995,6 @@ var Scale = /*#__PURE__*/function () {
2352
1995
  * @param {Interval} sourceRange
2353
1996
  * @param {Interval | number} targetRange
2354
1997
  */
2355
-
2356
1998
  }, {
2357
1999
  key: "fit",
2358
2000
  value: function fit(sourceRange, targetRange) {
@@ -2368,7 +2010,6 @@ var Scale = /*#__PURE__*/function () {
2368
2010
  * @param {number} sourceCenter
2369
2011
  * @param {number} newScale
2370
2012
  */
2371
-
2372
2013
  }, {
2373
2014
  key: "zoomAroundSource",
2374
2015
  value: function zoomAroundSource(sourceCenter, newScale) {
@@ -2379,17 +2020,14 @@ var Scale = /*#__PURE__*/function () {
2379
2020
  * moves the target range by the specified amount in target coordinates
2380
2021
  * @param {number} deltaTarget
2381
2022
  */
2382
-
2383
2023
  }, {
2384
2024
  key: "moveTargetBy",
2385
2025
  value: function moveTargetBy(deltaTarget) {
2386
2026
  this.offset += deltaTarget / this.scaleFactor;
2387
2027
  }
2388
2028
  }]);
2389
-
2390
2029
  return Scale;
2391
2030
  }();
2392
-
2393
2031
  exports.Scale = Scale;
2394
2032
 
2395
2033
  /***/ })