@powsybl/network-map-layers 3.1.0 → 3.2.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.
@@ -429,1246 +429,1499 @@ function wrap(deg) {
429
429
  return deg;
430
430
  }
431
431
  var es = {};
432
- var computeDestinationPoint$1 = {};
433
- var getLatitude$1 = {};
432
+ var computeDestinationPoint = {};
433
+ var getLatitude = {};
434
434
  var constants = {};
435
- Object.defineProperty(constants, "__esModule", { value: true });
436
- constants.areaConversion = constants.timeConversion = constants.distanceConversion = constants.altitudeKeys = constants.latitudeKeys = constants.longitudeKeys = constants.MAXLON = constants.MINLON = constants.MAXLAT = constants.MINLAT = constants.earthRadius = constants.sexagesimalPattern = void 0;
437
- var sexagesimalPattern = /^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['′]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["″]\s*)?([NEOSW]?)$/;
438
- constants.sexagesimalPattern = sexagesimalPattern;
439
- var earthRadius = 6378137;
440
- constants.earthRadius = earthRadius;
441
- var MINLAT = -90;
442
- constants.MINLAT = MINLAT;
443
- var MAXLAT = 90;
444
- constants.MAXLAT = MAXLAT;
445
- var MINLON = -180;
446
- constants.MINLON = MINLON;
447
- var MAXLON = 180;
448
- constants.MAXLON = MAXLON;
449
- var longitudeKeys = ["lng", "lon", "longitude", 0];
450
- constants.longitudeKeys = longitudeKeys;
451
- var latitudeKeys = ["lat", "latitude", 1];
452
- constants.latitudeKeys = latitudeKeys;
453
- var altitudeKeys = ["alt", "altitude", "elevation", "elev", 2];
454
- constants.altitudeKeys = altitudeKeys;
455
- var distanceConversion = { m: 1, km: 1e-3, cm: 100, mm: 1e3, mi: 1 / 1609.344, sm: 1 / 1852.216, ft: 100 / 30.48, in: 100 / 2.54, yd: 1 / 0.9144 };
456
- constants.distanceConversion = distanceConversion;
457
- var timeConversion = { m: 60, h: 3600, d: 86400 };
458
- constants.timeConversion = timeConversion;
459
- var areaConversion = { m2: 1, km2: 1e-6, ha: 1e-4, a: 0.01, ft2: 10.763911, yd2: 1.19599, in2: 1550.0031 };
460
- constants.areaConversion = areaConversion;
461
- areaConversion.sqm = areaConversion.m2;
462
- areaConversion.sqkm = areaConversion.km2;
463
- areaConversion.sqft = areaConversion.ft2;
464
- areaConversion.sqyd = areaConversion.yd2;
465
- areaConversion.sqin = areaConversion.in2;
466
- var getCoordinateKey$1 = {};
467
- Object.defineProperty(getCoordinateKey$1, "__esModule", { value: true });
468
- getCoordinateKey$1.default = void 0;
469
- var getCoordinateKey = function getCoordinateKey2(point, keysToLookup) {
470
- return keysToLookup.reduce(function(foundKey, key) {
471
- if (typeof point === "undefined" || point === null) {
472
- throw new Error("'".concat(point, "' is no valid coordinate."));
473
- }
474
- if (Object.prototype.hasOwnProperty.call(point, key) && typeof key !== "undefined" && typeof foundKey === "undefined") {
475
- foundKey = key;
476
- return key;
477
- }
478
- return foundKey;
479
- }, void 0);
480
- };
481
- var _default$D = getCoordinateKey;
482
- getCoordinateKey$1.default = _default$D;
483
- var toDecimal$1 = {};
484
- var isDecimal$1 = {};
485
- Object.defineProperty(isDecimal$1, "__esModule", { value: true });
486
- isDecimal$1.default = void 0;
487
- var isDecimal = function isDecimal2(value) {
488
- var checkedValue = value.toString().trim();
489
- if (isNaN(parseFloat(checkedValue))) {
490
- return false;
491
- }
492
- return parseFloat(checkedValue) === Number(checkedValue);
493
- };
494
- var _default$C = isDecimal;
495
- isDecimal$1.default = _default$C;
496
- var isSexagesimal$1 = {};
497
- Object.defineProperty(isSexagesimal$1, "__esModule", { value: true });
498
- isSexagesimal$1.default = void 0;
499
- var _constants$e = constants;
500
- var isSexagesimal = function isSexagesimal2(value) {
501
- return _constants$e.sexagesimalPattern.test(value.toString().trim());
502
- };
503
- var _default$B = isSexagesimal;
504
- isSexagesimal$1.default = _default$B;
505
- var sexagesimalToDecimal$1 = {};
506
- Object.defineProperty(sexagesimalToDecimal$1, "__esModule", { value: true });
507
- sexagesimalToDecimal$1.default = void 0;
508
- var _constants$d = constants;
509
- var sexagesimalToDecimal = function sexagesimalToDecimal2(sexagesimal) {
510
- var data = new RegExp(_constants$d.sexagesimalPattern).exec(sexagesimal.toString().trim());
511
- if (typeof data === "undefined" || data === null) {
512
- throw new Error("Given value is not in sexagesimal format");
513
- }
514
- var min = Number(data[2]) / 60 || 0;
515
- var sec = Number(data[4]) / 3600 || 0;
516
- var decimal = parseFloat(data[1]) + min + sec;
517
- return ["S", "W"].includes(data[7]) ? -decimal : decimal;
518
- };
519
- var _default$A = sexagesimalToDecimal;
520
- sexagesimalToDecimal$1.default = _default$A;
521
- var isValidCoordinate$1 = {};
522
- var getCoordinateKeys$1 = {};
523
- Object.defineProperty(getCoordinateKeys$1, "__esModule", { value: true });
524
- getCoordinateKeys$1.default = void 0;
525
- var _constants$c = constants;
526
- var _getCoordinateKey$2 = _interopRequireDefault$q(getCoordinateKey$1);
527
- function _interopRequireDefault$q(obj) {
528
- return obj && obj.__esModule ? obj : { default: obj };
529
- }
530
- function ownKeys$1(object, enumerableOnly) {
531
- var keys = Object.keys(object);
532
- if (Object.getOwnPropertySymbols) {
533
- var symbols = Object.getOwnPropertySymbols(object);
534
- if (enumerableOnly) symbols = symbols.filter(function(sym) {
535
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
536
- });
537
- keys.push.apply(keys, symbols);
538
- }
539
- return keys;
435
+ var hasRequiredConstants;
436
+ function requireConstants() {
437
+ if (hasRequiredConstants) return constants;
438
+ hasRequiredConstants = 1;
439
+ Object.defineProperty(constants, "__esModule", { value: true });
440
+ constants.areaConversion = constants.timeConversion = constants.distanceConversion = constants.altitudeKeys = constants.latitudeKeys = constants.longitudeKeys = constants.MAXLON = constants.MINLON = constants.MAXLAT = constants.MINLAT = constants.earthRadius = constants.sexagesimalPattern = void 0;
441
+ var sexagesimalPattern = /^([0-9]{1,3})°\s*([0-9]{1,3}(?:\.(?:[0-9]{1,}))?)['′]\s*(([0-9]{1,3}(\.([0-9]{1,}))?)["″]\s*)?([NEOSW]?)$/;
442
+ constants.sexagesimalPattern = sexagesimalPattern;
443
+ var earthRadius = 6378137;
444
+ constants.earthRadius = earthRadius;
445
+ var MINLAT = -90;
446
+ constants.MINLAT = MINLAT;
447
+ var MAXLAT = 90;
448
+ constants.MAXLAT = MAXLAT;
449
+ var MINLON = -180;
450
+ constants.MINLON = MINLON;
451
+ var MAXLON = 180;
452
+ constants.MAXLON = MAXLON;
453
+ var longitudeKeys = ["lng", "lon", "longitude", 0];
454
+ constants.longitudeKeys = longitudeKeys;
455
+ var latitudeKeys = ["lat", "latitude", 1];
456
+ constants.latitudeKeys = latitudeKeys;
457
+ var altitudeKeys = ["alt", "altitude", "elevation", "elev", 2];
458
+ constants.altitudeKeys = altitudeKeys;
459
+ var distanceConversion = { m: 1, km: 1e-3, cm: 100, mm: 1e3, mi: 1 / 1609.344, sm: 1 / 1852.216, ft: 100 / 30.48, in: 100 / 2.54, yd: 1 / 0.9144 };
460
+ constants.distanceConversion = distanceConversion;
461
+ var timeConversion = { m: 60, h: 3600, d: 86400 };
462
+ constants.timeConversion = timeConversion;
463
+ var areaConversion = { m2: 1, km2: 1e-6, ha: 1e-4, a: 0.01, ft2: 10.763911, yd2: 1.19599, in2: 1550.0031 };
464
+ constants.areaConversion = areaConversion;
465
+ areaConversion.sqm = areaConversion.m2;
466
+ areaConversion.sqkm = areaConversion.km2;
467
+ areaConversion.sqft = areaConversion.ft2;
468
+ areaConversion.sqyd = areaConversion.yd2;
469
+ areaConversion.sqin = areaConversion.in2;
470
+ return constants;
471
+ }
472
+ var getCoordinateKey = {};
473
+ var hasRequiredGetCoordinateKey;
474
+ function requireGetCoordinateKey() {
475
+ if (hasRequiredGetCoordinateKey) return getCoordinateKey;
476
+ hasRequiredGetCoordinateKey = 1;
477
+ Object.defineProperty(getCoordinateKey, "__esModule", { value: true });
478
+ getCoordinateKey.default = void 0;
479
+ var getCoordinateKey$1 = function getCoordinateKey2(point, keysToLookup) {
480
+ return keysToLookup.reduce(function(foundKey, key) {
481
+ if (typeof point === "undefined" || point === null) {
482
+ throw new Error("'".concat(point, "' is no valid coordinate."));
483
+ }
484
+ if (Object.prototype.hasOwnProperty.call(point, key) && typeof key !== "undefined" && typeof foundKey === "undefined") {
485
+ foundKey = key;
486
+ return key;
487
+ }
488
+ return foundKey;
489
+ }, void 0);
490
+ };
491
+ var _default = getCoordinateKey$1;
492
+ getCoordinateKey.default = _default;
493
+ return getCoordinateKey;
494
+ }
495
+ var toDecimal = {};
496
+ var isDecimal = {};
497
+ var hasRequiredIsDecimal;
498
+ function requireIsDecimal() {
499
+ if (hasRequiredIsDecimal) return isDecimal;
500
+ hasRequiredIsDecimal = 1;
501
+ Object.defineProperty(isDecimal, "__esModule", { value: true });
502
+ isDecimal.default = void 0;
503
+ var isDecimal$1 = function isDecimal2(value) {
504
+ var checkedValue = value.toString().trim();
505
+ if (isNaN(parseFloat(checkedValue))) {
506
+ return false;
507
+ }
508
+ return parseFloat(checkedValue) === Number(checkedValue);
509
+ };
510
+ var _default = isDecimal$1;
511
+ isDecimal.default = _default;
512
+ return isDecimal;
513
+ }
514
+ var isSexagesimal = {};
515
+ var hasRequiredIsSexagesimal;
516
+ function requireIsSexagesimal() {
517
+ if (hasRequiredIsSexagesimal) return isSexagesimal;
518
+ hasRequiredIsSexagesimal = 1;
519
+ Object.defineProperty(isSexagesimal, "__esModule", { value: true });
520
+ isSexagesimal.default = void 0;
521
+ var _constants = requireConstants();
522
+ var isSexagesimal$1 = function isSexagesimal2(value) {
523
+ return _constants.sexagesimalPattern.test(value.toString().trim());
524
+ };
525
+ var _default = isSexagesimal$1;
526
+ isSexagesimal.default = _default;
527
+ return isSexagesimal;
528
+ }
529
+ var sexagesimalToDecimal = {};
530
+ var hasRequiredSexagesimalToDecimal;
531
+ function requireSexagesimalToDecimal() {
532
+ if (hasRequiredSexagesimalToDecimal) return sexagesimalToDecimal;
533
+ hasRequiredSexagesimalToDecimal = 1;
534
+ Object.defineProperty(sexagesimalToDecimal, "__esModule", { value: true });
535
+ sexagesimalToDecimal.default = void 0;
536
+ var _constants = requireConstants();
537
+ var sexagesimalToDecimal$1 = function sexagesimalToDecimal2(sexagesimal) {
538
+ var data = new RegExp(_constants.sexagesimalPattern).exec(sexagesimal.toString().trim());
539
+ if (typeof data === "undefined" || data === null) {
540
+ throw new Error("Given value is not in sexagesimal format");
541
+ }
542
+ var min = Number(data[2]) / 60 || 0;
543
+ var sec = Number(data[4]) / 3600 || 0;
544
+ var decimal = parseFloat(data[1]) + min + sec;
545
+ return ["S", "W"].includes(data[7]) ? -decimal : decimal;
546
+ };
547
+ var _default = sexagesimalToDecimal$1;
548
+ sexagesimalToDecimal.default = _default;
549
+ return sexagesimalToDecimal;
540
550
  }
541
- function _objectSpread$1(target) {
542
- for (var i = 1; i < arguments.length; i++) {
543
- var source = arguments[i] != null ? arguments[i] : {};
544
- if (i % 2) {
545
- ownKeys$1(Object(source), true).forEach(function(key) {
546
- _defineProperty$1(target, key, source[key]);
551
+ var isValidCoordinate = {};
552
+ var getCoordinateKeys = {};
553
+ var hasRequiredGetCoordinateKeys;
554
+ function requireGetCoordinateKeys() {
555
+ if (hasRequiredGetCoordinateKeys) return getCoordinateKeys;
556
+ hasRequiredGetCoordinateKeys = 1;
557
+ Object.defineProperty(getCoordinateKeys, "__esModule", { value: true });
558
+ getCoordinateKeys.default = void 0;
559
+ var _constants = requireConstants();
560
+ var _getCoordinateKey = _interopRequireDefault(requireGetCoordinateKey());
561
+ function _interopRequireDefault(obj) {
562
+ return obj && obj.__esModule ? obj : { default: obj };
563
+ }
564
+ function ownKeys(object, enumerableOnly) {
565
+ var keys = Object.keys(object);
566
+ if (Object.getOwnPropertySymbols) {
567
+ var symbols = Object.getOwnPropertySymbols(object);
568
+ if (enumerableOnly) symbols = symbols.filter(function(sym) {
569
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
547
570
  });
548
- } else if (Object.getOwnPropertyDescriptors) {
549
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
571
+ keys.push.apply(keys, symbols);
572
+ }
573
+ return keys;
574
+ }
575
+ function _objectSpread(target) {
576
+ for (var i = 1; i < arguments.length; i++) {
577
+ var source = arguments[i] != null ? arguments[i] : {};
578
+ if (i % 2) {
579
+ ownKeys(Object(source), true).forEach(function(key) {
580
+ _defineProperty(target, key, source[key]);
581
+ });
582
+ } else if (Object.getOwnPropertyDescriptors) {
583
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
584
+ } else {
585
+ ownKeys(Object(source)).forEach(function(key) {
586
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
587
+ });
588
+ }
589
+ }
590
+ return target;
591
+ }
592
+ function _defineProperty(obj, key, value) {
593
+ if (key in obj) {
594
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
550
595
  } else {
551
- ownKeys$1(Object(source)).forEach(function(key) {
552
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
553
- });
596
+ obj[key] = value;
554
597
  }
598
+ return obj;
599
+ }
600
+ var getCoordinateKeys$1 = function getCoordinateKeys2(point) {
601
+ var keysToLookup = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { longitude: _constants.longitudeKeys, latitude: _constants.latitudeKeys, altitude: _constants.altitudeKeys };
602
+ var longitude = (0, _getCoordinateKey.default)(point, keysToLookup.longitude);
603
+ var latitude = (0, _getCoordinateKey.default)(point, keysToLookup.latitude);
604
+ var altitude = (0, _getCoordinateKey.default)(point, keysToLookup.altitude);
605
+ return _objectSpread({ latitude, longitude }, altitude ? { altitude } : {});
606
+ };
607
+ var _default = getCoordinateKeys$1;
608
+ getCoordinateKeys.default = _default;
609
+ return getCoordinateKeys;
610
+ }
611
+ var isValidLatitude = {};
612
+ var hasRequiredIsValidLatitude;
613
+ function requireIsValidLatitude() {
614
+ if (hasRequiredIsValidLatitude) return isValidLatitude;
615
+ hasRequiredIsValidLatitude = 1;
616
+ Object.defineProperty(isValidLatitude, "__esModule", { value: true });
617
+ isValidLatitude.default = void 0;
618
+ var _isDecimal = _interopRequireDefault(requireIsDecimal());
619
+ var _isSexagesimal = _interopRequireDefault(requireIsSexagesimal());
620
+ var _sexagesimalToDecimal = _interopRequireDefault(requireSexagesimalToDecimal());
621
+ var _constants = requireConstants();
622
+ function _interopRequireDefault(obj) {
623
+ return obj && obj.__esModule ? obj : { default: obj };
555
624
  }
556
- return target;
625
+ var isValidLatitude$1 = function isValidLatitude2(value) {
626
+ if ((0, _isDecimal.default)(value)) {
627
+ if (parseFloat(value) > _constants.MAXLAT || value < _constants.MINLAT) {
628
+ return false;
629
+ }
630
+ return true;
631
+ }
632
+ if ((0, _isSexagesimal.default)(value)) {
633
+ return isValidLatitude2((0, _sexagesimalToDecimal.default)(value));
634
+ }
635
+ return false;
636
+ };
637
+ var _default = isValidLatitude$1;
638
+ isValidLatitude.default = _default;
639
+ return isValidLatitude;
557
640
  }
558
- function _defineProperty$1(obj, key, value) {
559
- if (key in obj) {
560
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
561
- } else {
562
- obj[key] = value;
641
+ var isValidLongitude = {};
642
+ var hasRequiredIsValidLongitude;
643
+ function requireIsValidLongitude() {
644
+ if (hasRequiredIsValidLongitude) return isValidLongitude;
645
+ hasRequiredIsValidLongitude = 1;
646
+ Object.defineProperty(isValidLongitude, "__esModule", { value: true });
647
+ isValidLongitude.default = void 0;
648
+ var _isDecimal = _interopRequireDefault(requireIsDecimal());
649
+ var _isSexagesimal = _interopRequireDefault(requireIsSexagesimal());
650
+ var _sexagesimalToDecimal = _interopRequireDefault(requireSexagesimalToDecimal());
651
+ var _constants = requireConstants();
652
+ function _interopRequireDefault(obj) {
653
+ return obj && obj.__esModule ? obj : { default: obj };
563
654
  }
564
- return obj;
655
+ var isValidLongitude$1 = function isValidLongitude2(value) {
656
+ if ((0, _isDecimal.default)(value)) {
657
+ if (parseFloat(value) > _constants.MAXLON || value < _constants.MINLON) {
658
+ return false;
659
+ }
660
+ return true;
661
+ }
662
+ if ((0, _isSexagesimal.default)(value)) {
663
+ return isValidLongitude2((0, _sexagesimalToDecimal.default)(value));
664
+ }
665
+ return false;
666
+ };
667
+ var _default = isValidLongitude$1;
668
+ isValidLongitude.default = _default;
669
+ return isValidLongitude;
565
670
  }
566
- var getCoordinateKeys = function getCoordinateKeys2(point) {
567
- var keysToLookup = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : { longitude: _constants$c.longitudeKeys, latitude: _constants$c.latitudeKeys, altitude: _constants$c.altitudeKeys };
568
- var longitude = (0, _getCoordinateKey$2.default)(point, keysToLookup.longitude);
569
- var latitude = (0, _getCoordinateKey$2.default)(point, keysToLookup.latitude);
570
- var altitude = (0, _getCoordinateKey$2.default)(point, keysToLookup.altitude);
571
- return _objectSpread$1({ latitude, longitude }, altitude ? { altitude } : {});
572
- };
573
- var _default$z = getCoordinateKeys;
574
- getCoordinateKeys$1.default = _default$z;
575
- var isValidLatitude$1 = {};
576
- Object.defineProperty(isValidLatitude$1, "__esModule", { value: true });
577
- isValidLatitude$1.default = void 0;
578
- var _isDecimal$2 = _interopRequireDefault$p(isDecimal$1);
579
- var _isSexagesimal$2 = _interopRequireDefault$p(isSexagesimal$1);
580
- var _sexagesimalToDecimal$2 = _interopRequireDefault$p(sexagesimalToDecimal$1);
581
- var _constants$b = constants;
582
- function _interopRequireDefault$p(obj) {
583
- return obj && obj.__esModule ? obj : { default: obj };
584
- }
585
- var isValidLatitude = function isValidLatitude2(value) {
586
- if ((0, _isDecimal$2.default)(value)) {
587
- if (parseFloat(value) > _constants$b.MAXLAT || value < _constants$b.MINLAT) {
671
+ var hasRequiredIsValidCoordinate;
672
+ function requireIsValidCoordinate() {
673
+ if (hasRequiredIsValidCoordinate) return isValidCoordinate;
674
+ hasRequiredIsValidCoordinate = 1;
675
+ Object.defineProperty(isValidCoordinate, "__esModule", { value: true });
676
+ isValidCoordinate.default = void 0;
677
+ var _getCoordinateKeys2 = _interopRequireDefault(requireGetCoordinateKeys());
678
+ var _isValidLatitude = _interopRequireDefault(requireIsValidLatitude());
679
+ var _isValidLongitude = _interopRequireDefault(requireIsValidLongitude());
680
+ function _interopRequireDefault(obj) {
681
+ return obj && obj.__esModule ? obj : { default: obj };
682
+ }
683
+ var isValidCoordinate$1 = function isValidCoordinate2(point) {
684
+ var _getCoordinateKeys = (0, _getCoordinateKeys2.default)(point), latitude = _getCoordinateKeys.latitude, longitude = _getCoordinateKeys.longitude;
685
+ if (Array.isArray(point) && point.length >= 2) {
686
+ return (0, _isValidLongitude.default)(point[0]) && (0, _isValidLatitude.default)(point[1]);
687
+ }
688
+ if (typeof latitude === "undefined" || typeof longitude === "undefined") {
689
+ return false;
690
+ }
691
+ var lon = point[longitude];
692
+ var lat = point[latitude];
693
+ if (typeof lat === "undefined" || typeof lon === "undefined") {
694
+ return false;
695
+ }
696
+ if ((0, _isValidLatitude.default)(lat) === false || (0, _isValidLongitude.default)(lon) === false) {
588
697
  return false;
589
698
  }
590
699
  return true;
700
+ };
701
+ var _default = isValidCoordinate$1;
702
+ isValidCoordinate.default = _default;
703
+ return isValidCoordinate;
704
+ }
705
+ var hasRequiredToDecimal;
706
+ function requireToDecimal() {
707
+ if (hasRequiredToDecimal) return toDecimal;
708
+ hasRequiredToDecimal = 1;
709
+ Object.defineProperty(toDecimal, "__esModule", { value: true });
710
+ toDecimal.default = void 0;
711
+ var _isDecimal = _interopRequireDefault(requireIsDecimal());
712
+ var _isSexagesimal = _interopRequireDefault(requireIsSexagesimal());
713
+ var _sexagesimalToDecimal = _interopRequireDefault(requireSexagesimalToDecimal());
714
+ var _isValidCoordinate = _interopRequireDefault(requireIsValidCoordinate());
715
+ var _getCoordinateKeys = _interopRequireDefault(requireGetCoordinateKeys());
716
+ function _interopRequireDefault(obj) {
717
+ return obj && obj.__esModule ? obj : { default: obj };
591
718
  }
592
- if ((0, _isSexagesimal$2.default)(value)) {
593
- return isValidLatitude2((0, _sexagesimalToDecimal$2.default)(value));
719
+ function ownKeys(object, enumerableOnly) {
720
+ var keys = Object.keys(object);
721
+ if (Object.getOwnPropertySymbols) {
722
+ var symbols = Object.getOwnPropertySymbols(object);
723
+ if (enumerableOnly) symbols = symbols.filter(function(sym) {
724
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
725
+ });
726
+ keys.push.apply(keys, symbols);
727
+ }
728
+ return keys;
729
+ }
730
+ function _objectSpread(target) {
731
+ for (var i = 1; i < arguments.length; i++) {
732
+ var source = arguments[i] != null ? arguments[i] : {};
733
+ if (i % 2) {
734
+ ownKeys(Object(source), true).forEach(function(key) {
735
+ _defineProperty(target, key, source[key]);
736
+ });
737
+ } else if (Object.getOwnPropertyDescriptors) {
738
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
739
+ } else {
740
+ ownKeys(Object(source)).forEach(function(key) {
741
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
742
+ });
743
+ }
744
+ }
745
+ return target;
594
746
  }
595
- return false;
596
- };
597
- var _default$y = isValidLatitude;
598
- isValidLatitude$1.default = _default$y;
599
- var isValidLongitude$1 = {};
600
- Object.defineProperty(isValidLongitude$1, "__esModule", { value: true });
601
- isValidLongitude$1.default = void 0;
602
- var _isDecimal$1 = _interopRequireDefault$o(isDecimal$1);
603
- var _isSexagesimal$1 = _interopRequireDefault$o(isSexagesimal$1);
604
- var _sexagesimalToDecimal$1 = _interopRequireDefault$o(sexagesimalToDecimal$1);
605
- var _constants$a = constants;
606
- function _interopRequireDefault$o(obj) {
607
- return obj && obj.__esModule ? obj : { default: obj };
608
- }
609
- var isValidLongitude = function isValidLongitude2(value) {
610
- if ((0, _isDecimal$1.default)(value)) {
611
- if (parseFloat(value) > _constants$a.MAXLON || value < _constants$a.MINLON) {
612
- return false;
747
+ function _defineProperty(obj, key, value) {
748
+ if (key in obj) {
749
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
750
+ } else {
751
+ obj[key] = value;
613
752
  }
614
- return true;
753
+ return obj;
615
754
  }
616
- if ((0, _isSexagesimal$1.default)(value)) {
617
- return isValidLongitude2((0, _sexagesimalToDecimal$1.default)(value));
755
+ var toDecimal$1 = function toDecimal2(value) {
756
+ if ((0, _isDecimal.default)(value)) {
757
+ return Number(value);
758
+ }
759
+ if ((0, _isSexagesimal.default)(value)) {
760
+ return (0, _sexagesimalToDecimal.default)(value);
761
+ }
762
+ if ((0, _isValidCoordinate.default)(value)) {
763
+ var keys = (0, _getCoordinateKeys.default)(value);
764
+ if (Array.isArray(value)) {
765
+ return value.map(function(v, index) {
766
+ return [0, 1].includes(index) ? toDecimal2(v) : v;
767
+ });
768
+ }
769
+ return _objectSpread(_objectSpread(_objectSpread({}, value), keys.latitude && _defineProperty({}, keys.latitude, toDecimal2(value[keys.latitude]))), keys.longitude && _defineProperty({}, keys.longitude, toDecimal2(value[keys.longitude])));
770
+ }
771
+ if (Array.isArray(value)) {
772
+ return value.map(function(point) {
773
+ return (0, _isValidCoordinate.default)(point) ? toDecimal2(point) : point;
774
+ });
775
+ }
776
+ return value;
777
+ };
778
+ var _default = toDecimal$1;
779
+ toDecimal.default = _default;
780
+ return toDecimal;
781
+ }
782
+ var hasRequiredGetLatitude;
783
+ function requireGetLatitude() {
784
+ if (hasRequiredGetLatitude) return getLatitude;
785
+ hasRequiredGetLatitude = 1;
786
+ Object.defineProperty(getLatitude, "__esModule", { value: true });
787
+ getLatitude.default = void 0;
788
+ var _constants = requireConstants();
789
+ var _getCoordinateKey = _interopRequireDefault(requireGetCoordinateKey());
790
+ var _toDecimal = _interopRequireDefault(requireToDecimal());
791
+ function _interopRequireDefault(obj) {
792
+ return obj && obj.__esModule ? obj : { default: obj };
618
793
  }
619
- return false;
620
- };
621
- var _default$x = isValidLongitude;
622
- isValidLongitude$1.default = _default$x;
623
- Object.defineProperty(isValidCoordinate$1, "__esModule", { value: true });
624
- isValidCoordinate$1.default = void 0;
625
- var _getCoordinateKeys2 = _interopRequireDefault$n(getCoordinateKeys$1);
626
- var _isValidLatitude = _interopRequireDefault$n(isValidLatitude$1);
627
- var _isValidLongitude = _interopRequireDefault$n(isValidLongitude$1);
628
- function _interopRequireDefault$n(obj) {
629
- return obj && obj.__esModule ? obj : { default: obj };
630
- }
631
- var isValidCoordinate = function isValidCoordinate2(point) {
632
- var _getCoordinateKeys3 = (0, _getCoordinateKeys2.default)(point), latitude = _getCoordinateKeys3.latitude, longitude = _getCoordinateKeys3.longitude;
633
- if (Array.isArray(point) && point.length >= 2) {
634
- return (0, _isValidLongitude.default)(point[0]) && (0, _isValidLatitude.default)(point[1]);
635
- }
636
- if (typeof latitude === "undefined" || typeof longitude === "undefined") {
637
- return false;
794
+ var getLatitude$1 = function getLatitude2(point, raw) {
795
+ var latKey = (0, _getCoordinateKey.default)(point, _constants.latitudeKeys);
796
+ if (typeof latKey === "undefined" || latKey === null) {
797
+ return;
798
+ }
799
+ var value = point[latKey];
800
+ return raw === true ? value : (0, _toDecimal.default)(value);
801
+ };
802
+ var _default = getLatitude$1;
803
+ getLatitude.default = _default;
804
+ return getLatitude;
805
+ }
806
+ var getLongitude = {};
807
+ var hasRequiredGetLongitude;
808
+ function requireGetLongitude() {
809
+ if (hasRequiredGetLongitude) return getLongitude;
810
+ hasRequiredGetLongitude = 1;
811
+ Object.defineProperty(getLongitude, "__esModule", { value: true });
812
+ getLongitude.default = void 0;
813
+ var _constants = requireConstants();
814
+ var _getCoordinateKey = _interopRequireDefault(requireGetCoordinateKey());
815
+ var _toDecimal = _interopRequireDefault(requireToDecimal());
816
+ function _interopRequireDefault(obj) {
817
+ return obj && obj.__esModule ? obj : { default: obj };
638
818
  }
639
- var lon = point[longitude];
640
- var lat = point[latitude];
641
- if (typeof lat === "undefined" || typeof lon === "undefined") {
642
- return false;
819
+ var getLongitude$1 = function getLongitude2(point, raw) {
820
+ var latKey = (0, _getCoordinateKey.default)(point, _constants.longitudeKeys);
821
+ if (typeof latKey === "undefined" || latKey === null) {
822
+ return;
823
+ }
824
+ var value = point[latKey];
825
+ return raw === true ? value : (0, _toDecimal.default)(value);
826
+ };
827
+ var _default = getLongitude$1;
828
+ getLongitude.default = _default;
829
+ return getLongitude;
830
+ }
831
+ var toRad = {};
832
+ var hasRequiredToRad;
833
+ function requireToRad() {
834
+ if (hasRequiredToRad) return toRad;
835
+ hasRequiredToRad = 1;
836
+ Object.defineProperty(toRad, "__esModule", { value: true });
837
+ toRad.default = void 0;
838
+ var toRad$1 = function toRad2(value) {
839
+ return value * Math.PI / 180;
840
+ };
841
+ var _default = toRad$1;
842
+ toRad.default = _default;
843
+ return toRad;
844
+ }
845
+ var toDeg = {};
846
+ var hasRequiredToDeg;
847
+ function requireToDeg() {
848
+ if (hasRequiredToDeg) return toDeg;
849
+ hasRequiredToDeg = 1;
850
+ Object.defineProperty(toDeg, "__esModule", { value: true });
851
+ toDeg.default = void 0;
852
+ var toDeg$1 = function toDeg2(value) {
853
+ return value * 180 / Math.PI;
854
+ };
855
+ var _default = toDeg$1;
856
+ toDeg.default = _default;
857
+ return toDeg;
858
+ }
859
+ var hasRequiredComputeDestinationPoint;
860
+ function requireComputeDestinationPoint() {
861
+ if (hasRequiredComputeDestinationPoint) return computeDestinationPoint;
862
+ hasRequiredComputeDestinationPoint = 1;
863
+ Object.defineProperty(computeDestinationPoint, "__esModule", { value: true });
864
+ computeDestinationPoint.default = void 0;
865
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
866
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
867
+ var _toRad = _interopRequireDefault(requireToRad());
868
+ var _toDeg = _interopRequireDefault(requireToDeg());
869
+ var _constants = requireConstants();
870
+ function _interopRequireDefault(obj) {
871
+ return obj && obj.__esModule ? obj : { default: obj };
643
872
  }
644
- if ((0, _isValidLatitude.default)(lat) === false || (0, _isValidLongitude.default)(lon) === false) {
645
- return false;
873
+ var computeDestinationPoint$1 = function computeDestinationPoint2(start, distance, bearing) {
874
+ var radius = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 6371e3;
875
+ var lat = (0, _getLatitude.default)(start);
876
+ var lng = (0, _getLongitude.default)(start);
877
+ var delta = distance / radius;
878
+ var theta = (0, _toRad.default)(bearing);
879
+ var phi1 = (0, _toRad.default)(lat);
880
+ var lambda1 = (0, _toRad.default)(lng);
881
+ var phi2 = Math.asin(Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta));
882
+ var lambda2 = lambda1 + Math.atan2(Math.sin(theta) * Math.sin(delta) * Math.cos(phi1), Math.cos(delta) - Math.sin(phi1) * Math.sin(phi2));
883
+ var longitude = (0, _toDeg.default)(lambda2);
884
+ if (longitude < _constants.MINLON || longitude > _constants.MAXLON) {
885
+ lambda2 = (lambda2 + 3 * Math.PI) % (2 * Math.PI) - Math.PI;
886
+ longitude = (0, _toDeg.default)(lambda2);
887
+ }
888
+ return { latitude: (0, _toDeg.default)(phi2), longitude };
889
+ };
890
+ var _default = computeDestinationPoint$1;
891
+ computeDestinationPoint.default = _default;
892
+ return computeDestinationPoint;
893
+ }
894
+ var convertArea = {};
895
+ var hasRequiredConvertArea;
896
+ function requireConvertArea() {
897
+ if (hasRequiredConvertArea) return convertArea;
898
+ hasRequiredConvertArea = 1;
899
+ Object.defineProperty(convertArea, "__esModule", { value: true });
900
+ convertArea.default = void 0;
901
+ var _constants = requireConstants();
902
+ var convertArea$1 = function convertArea2(squareMeters) {
903
+ var targetUnit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "m";
904
+ var factor = _constants.areaConversion[targetUnit];
905
+ if (factor) {
906
+ return squareMeters * factor;
907
+ }
908
+ throw new Error("Invalid unit used for area conversion.");
909
+ };
910
+ var _default = convertArea$1;
911
+ convertArea.default = _default;
912
+ return convertArea;
913
+ }
914
+ var convertDistance = {};
915
+ var hasRequiredConvertDistance;
916
+ function requireConvertDistance() {
917
+ if (hasRequiredConvertDistance) return convertDistance;
918
+ hasRequiredConvertDistance = 1;
919
+ Object.defineProperty(convertDistance, "__esModule", { value: true });
920
+ convertDistance.default = void 0;
921
+ var _constants = requireConstants();
922
+ var convertDistance$1 = function convertDistance2(meters) {
923
+ var targetUnit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "m";
924
+ var factor = _constants.distanceConversion[targetUnit];
925
+ if (factor) {
926
+ return meters * factor;
927
+ }
928
+ throw new Error("Invalid unit used for distance conversion.");
929
+ };
930
+ var _default = convertDistance$1;
931
+ convertDistance.default = _default;
932
+ return convertDistance;
933
+ }
934
+ var convertSpeed = {};
935
+ var hasRequiredConvertSpeed;
936
+ function requireConvertSpeed() {
937
+ if (hasRequiredConvertSpeed) return convertSpeed;
938
+ hasRequiredConvertSpeed = 1;
939
+ Object.defineProperty(convertSpeed, "__esModule", { value: true });
940
+ convertSpeed.default = void 0;
941
+ var _constants = requireConstants();
942
+ var convertSpeed$1 = function convertSpeed2(metersPerSecond) {
943
+ var targetUnit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "kmh";
944
+ switch (targetUnit) {
945
+ case "kmh":
946
+ return metersPerSecond * _constants.timeConversion.h * _constants.distanceConversion.km;
947
+ case "mph":
948
+ return metersPerSecond * _constants.timeConversion.h * _constants.distanceConversion.mi;
949
+ default:
950
+ return metersPerSecond;
951
+ }
952
+ };
953
+ var _default = convertSpeed$1;
954
+ convertSpeed.default = _default;
955
+ return convertSpeed;
956
+ }
957
+ var decimalToSexagesimal = {};
958
+ var hasRequiredDecimalToSexagesimal;
959
+ function requireDecimalToSexagesimal() {
960
+ if (hasRequiredDecimalToSexagesimal) return decimalToSexagesimal;
961
+ hasRequiredDecimalToSexagesimal = 1;
962
+ Object.defineProperty(decimalToSexagesimal, "__esModule", { value: true });
963
+ decimalToSexagesimal.default = void 0;
964
+ function _slicedToArray(arr, i) {
965
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
966
+ }
967
+ function _nonIterableRest() {
968
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
969
+ }
970
+ function _unsupportedIterableToArray(o, minLen) {
971
+ if (!o) return;
972
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
973
+ var n = Object.prototype.toString.call(o).slice(8, -1);
974
+ if (n === "Object" && o.constructor) n = o.constructor.name;
975
+ if (n === "Map" || n === "Set") return Array.from(o);
976
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
977
+ }
978
+ function _arrayLikeToArray(arr, len) {
979
+ if (len == null || len > arr.length) len = arr.length;
980
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
981
+ arr2[i] = arr[i];
982
+ }
983
+ return arr2;
984
+ }
985
+ function _iterableToArrayLimit(arr, i) {
986
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
987
+ var _arr = [];
988
+ var _n = true;
989
+ var _d = false;
990
+ var _e = void 0;
991
+ try {
992
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
993
+ _arr.push(_s.value);
994
+ if (i && _arr.length === i) break;
995
+ }
996
+ } catch (err) {
997
+ _d = true;
998
+ _e = err;
999
+ } finally {
1000
+ try {
1001
+ if (!_n && _i["return"] != null) _i["return"]();
1002
+ } finally {
1003
+ if (_d) throw _e;
1004
+ }
1005
+ }
1006
+ return _arr;
646
1007
  }
647
- return true;
648
- };
649
- var _default$w = isValidCoordinate;
650
- isValidCoordinate$1.default = _default$w;
651
- Object.defineProperty(toDecimal$1, "__esModule", { value: true });
652
- toDecimal$1.default = void 0;
653
- var _isDecimal = _interopRequireDefault$m(isDecimal$1);
654
- var _isSexagesimal = _interopRequireDefault$m(isSexagesimal$1);
655
- var _sexagesimalToDecimal = _interopRequireDefault$m(sexagesimalToDecimal$1);
656
- var _isValidCoordinate = _interopRequireDefault$m(isValidCoordinate$1);
657
- var _getCoordinateKeys = _interopRequireDefault$m(getCoordinateKeys$1);
658
- function _interopRequireDefault$m(obj) {
659
- return obj && obj.__esModule ? obj : { default: obj };
660
- }
661
- function ownKeys(object, enumerableOnly) {
662
- var keys = Object.keys(object);
663
- if (Object.getOwnPropertySymbols) {
664
- var symbols = Object.getOwnPropertySymbols(object);
665
- if (enumerableOnly) symbols = symbols.filter(function(sym) {
666
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
667
- });
668
- keys.push.apply(keys, symbols);
1008
+ function _arrayWithHoles(arr) {
1009
+ if (Array.isArray(arr)) return arr;
669
1010
  }
670
- return keys;
1011
+ var imprecise = function imprecise2(number) {
1012
+ var decimals = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4;
1013
+ var factor = Math.pow(10, decimals);
1014
+ return Math.round(number * factor) / factor;
1015
+ };
1016
+ var decimal2sexagesimalNext = function decimal2sexagesimalNext2(decimal) {
1017
+ var _decimal$toString$spl = decimal.toString().split("."), _decimal$toString$spl2 = _slicedToArray(_decimal$toString$spl, 2), pre = _decimal$toString$spl2[0], post = _decimal$toString$spl2[1];
1018
+ var deg = Math.abs(Number(pre));
1019
+ var min0 = Number("0." + (post || 0)) * 60;
1020
+ var sec0 = min0.toString().split(".");
1021
+ var min = Math.floor(min0);
1022
+ var sec = imprecise(Number("0." + (sec0[1] || 0)) * 60).toString();
1023
+ var _sec$split = sec.split("."), _sec$split2 = _slicedToArray(_sec$split, 2), secPreDec = _sec$split2[0], _sec$split2$ = _sec$split2[1], secDec = _sec$split2$ === void 0 ? "0" : _sec$split2$;
1024
+ return deg + "° " + min.toString().padStart(2, "0") + "' " + secPreDec.padStart(2, "0") + "." + secDec.padEnd(1, "0") + '"';
1025
+ };
1026
+ var _default = decimal2sexagesimalNext;
1027
+ decimalToSexagesimal.default = _default;
1028
+ return decimalToSexagesimal;
671
1029
  }
672
- function _objectSpread(target) {
673
- for (var i = 1; i < arguments.length; i++) {
674
- var source = arguments[i] != null ? arguments[i] : {};
675
- if (i % 2) {
676
- ownKeys(Object(source), true).forEach(function(key) {
677
- _defineProperty(target, key, source[key]);
678
- });
679
- } else if (Object.getOwnPropertyDescriptors) {
680
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
681
- } else {
682
- ownKeys(Object(source)).forEach(function(key) {
683
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
684
- });
1030
+ var findNearest = {};
1031
+ var orderByDistance = {};
1032
+ var getDistance = {};
1033
+ var robustAcos = {};
1034
+ var hasRequiredRobustAcos;
1035
+ function requireRobustAcos() {
1036
+ if (hasRequiredRobustAcos) return robustAcos;
1037
+ hasRequiredRobustAcos = 1;
1038
+ Object.defineProperty(robustAcos, "__esModule", { value: true });
1039
+ robustAcos.default = void 0;
1040
+ var robustAcos$1 = function robustAcos2(value) {
1041
+ if (value > 1) {
1042
+ return 1;
1043
+ }
1044
+ if (value < -1) {
1045
+ return -1;
685
1046
  }
1047
+ return value;
1048
+ };
1049
+ var _default = robustAcos$1;
1050
+ robustAcos.default = _default;
1051
+ return robustAcos;
1052
+ }
1053
+ var hasRequiredGetDistance;
1054
+ function requireGetDistance() {
1055
+ if (hasRequiredGetDistance) return getDistance;
1056
+ hasRequiredGetDistance = 1;
1057
+ Object.defineProperty(getDistance, "__esModule", { value: true });
1058
+ getDistance.default = void 0;
1059
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1060
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1061
+ var _toRad = _interopRequireDefault(requireToRad());
1062
+ var _robustAcos = _interopRequireDefault(requireRobustAcos());
1063
+ var _constants = requireConstants();
1064
+ function _interopRequireDefault(obj) {
1065
+ return obj && obj.__esModule ? obj : { default: obj };
686
1066
  }
687
- return target;
1067
+ var getDistance$1 = function getDistance2(from, to) {
1068
+ var accuracy = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
1069
+ accuracy = typeof accuracy !== "undefined" && !isNaN(accuracy) ? accuracy : 1;
1070
+ var fromLat = (0, _getLatitude.default)(from);
1071
+ var fromLon = (0, _getLongitude.default)(from);
1072
+ var toLat = (0, _getLatitude.default)(to);
1073
+ var toLon = (0, _getLongitude.default)(to);
1074
+ var distance = Math.acos((0, _robustAcos.default)(Math.sin((0, _toRad.default)(toLat)) * Math.sin((0, _toRad.default)(fromLat)) + Math.cos((0, _toRad.default)(toLat)) * Math.cos((0, _toRad.default)(fromLat)) * Math.cos((0, _toRad.default)(fromLon) - (0, _toRad.default)(toLon)))) * _constants.earthRadius;
1075
+ return Math.round(distance / accuracy) * accuracy;
1076
+ };
1077
+ var _default = getDistance$1;
1078
+ getDistance.default = _default;
1079
+ return getDistance;
688
1080
  }
689
- function _defineProperty(obj, key, value) {
690
- if (key in obj) {
691
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
692
- } else {
693
- obj[key] = value;
1081
+ var hasRequiredOrderByDistance;
1082
+ function requireOrderByDistance() {
1083
+ if (hasRequiredOrderByDistance) return orderByDistance;
1084
+ hasRequiredOrderByDistance = 1;
1085
+ Object.defineProperty(orderByDistance, "__esModule", { value: true });
1086
+ orderByDistance.default = void 0;
1087
+ var _getDistance = _interopRequireDefault(requireGetDistance());
1088
+ function _interopRequireDefault(obj) {
1089
+ return obj && obj.__esModule ? obj : { default: obj };
694
1090
  }
695
- return obj;
1091
+ var orderByDistance$1 = function orderByDistance2(point, coords) {
1092
+ var distanceFn = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _getDistance.default;
1093
+ distanceFn = typeof distanceFn === "function" ? distanceFn : _getDistance.default;
1094
+ return coords.slice().sort(function(a, b) {
1095
+ return distanceFn(point, a) - distanceFn(point, b);
1096
+ });
1097
+ };
1098
+ var _default = orderByDistance$1;
1099
+ orderByDistance.default = _default;
1100
+ return orderByDistance;
696
1101
  }
697
- var toDecimal = function toDecimal2(value) {
698
- if ((0, _isDecimal.default)(value)) {
699
- return Number(value);
1102
+ var hasRequiredFindNearest;
1103
+ function requireFindNearest() {
1104
+ if (hasRequiredFindNearest) return findNearest;
1105
+ hasRequiredFindNearest = 1;
1106
+ Object.defineProperty(findNearest, "__esModule", { value: true });
1107
+ findNearest.default = void 0;
1108
+ var _orderByDistance = _interopRequireDefault(requireOrderByDistance());
1109
+ function _interopRequireDefault(obj) {
1110
+ return obj && obj.__esModule ? obj : { default: obj };
700
1111
  }
701
- if ((0, _isSexagesimal.default)(value)) {
702
- return (0, _sexagesimalToDecimal.default)(value);
1112
+ var findNearest$1 = function findNearest2(point, coords) {
1113
+ return (0, _orderByDistance.default)(point, coords)[0];
1114
+ };
1115
+ var _default = findNearest$1;
1116
+ findNearest.default = _default;
1117
+ return findNearest;
1118
+ }
1119
+ var getAreaOfPolygon = {};
1120
+ var hasRequiredGetAreaOfPolygon;
1121
+ function requireGetAreaOfPolygon() {
1122
+ if (hasRequiredGetAreaOfPolygon) return getAreaOfPolygon;
1123
+ hasRequiredGetAreaOfPolygon = 1;
1124
+ Object.defineProperty(getAreaOfPolygon, "__esModule", { value: true });
1125
+ getAreaOfPolygon.default = void 0;
1126
+ var _toRad = _interopRequireDefault(requireToRad());
1127
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1128
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1129
+ var _constants = requireConstants();
1130
+ function _interopRequireDefault(obj) {
1131
+ return obj && obj.__esModule ? obj : { default: obj };
703
1132
  }
704
- if ((0, _isValidCoordinate.default)(value)) {
705
- var keys = (0, _getCoordinateKeys.default)(value);
706
- if (Array.isArray(value)) {
707
- return value.map(function(v, index) {
708
- return [0, 1].includes(index) ? toDecimal2(v) : v;
709
- });
1133
+ var getAreaOfPolygon$1 = function getAreaOfPolygon2(points) {
1134
+ var area = 0;
1135
+ if (points.length > 2) {
1136
+ var lowerIndex;
1137
+ var middleIndex;
1138
+ var upperIndex;
1139
+ for (var i = 0; i < points.length; i++) {
1140
+ if (i === points.length - 2) {
1141
+ lowerIndex = points.length - 2;
1142
+ middleIndex = points.length - 1;
1143
+ upperIndex = 0;
1144
+ } else if (i === points.length - 1) {
1145
+ lowerIndex = points.length - 1;
1146
+ middleIndex = 0;
1147
+ upperIndex = 1;
1148
+ } else {
1149
+ lowerIndex = i;
1150
+ middleIndex = i + 1;
1151
+ upperIndex = i + 2;
1152
+ }
1153
+ var p1lon = (0, _getLongitude.default)(points[lowerIndex]);
1154
+ var p2lat = (0, _getLatitude.default)(points[middleIndex]);
1155
+ var p3lon = (0, _getLongitude.default)(points[upperIndex]);
1156
+ area += ((0, _toRad.default)(p3lon) - (0, _toRad.default)(p1lon)) * Math.sin((0, _toRad.default)(p2lat));
1157
+ }
1158
+ area = area * _constants.earthRadius * _constants.earthRadius / 2;
710
1159
  }
711
- return _objectSpread(_objectSpread(_objectSpread({}, value), keys.latitude && _defineProperty({}, keys.latitude, toDecimal2(value[keys.latitude]))), keys.longitude && _defineProperty({}, keys.longitude, toDecimal2(value[keys.longitude])));
712
- }
713
- if (Array.isArray(value)) {
714
- return value.map(function(point) {
715
- return (0, _isValidCoordinate.default)(point) ? toDecimal2(point) : point;
716
- });
1160
+ return Math.abs(area);
1161
+ };
1162
+ var _default = getAreaOfPolygon$1;
1163
+ getAreaOfPolygon.default = _default;
1164
+ return getAreaOfPolygon;
1165
+ }
1166
+ var getBounds = {};
1167
+ var hasRequiredGetBounds;
1168
+ function requireGetBounds() {
1169
+ if (hasRequiredGetBounds) return getBounds;
1170
+ hasRequiredGetBounds = 1;
1171
+ Object.defineProperty(getBounds, "__esModule", { value: true });
1172
+ getBounds.default = void 0;
1173
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1174
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1175
+ function _interopRequireDefault(obj) {
1176
+ return obj && obj.__esModule ? obj : { default: obj };
717
1177
  }
718
- return value;
719
- };
720
- var _default$v = toDecimal;
721
- toDecimal$1.default = _default$v;
722
- Object.defineProperty(getLatitude$1, "__esModule", { value: true });
723
- getLatitude$1.default = void 0;
724
- var _constants$9 = constants;
725
- var _getCoordinateKey$1 = _interopRequireDefault$l(getCoordinateKey$1);
726
- var _toDecimal$1 = _interopRequireDefault$l(toDecimal$1);
727
- function _interopRequireDefault$l(obj) {
728
- return obj && obj.__esModule ? obj : { default: obj };
729
- }
730
- var getLatitude = function getLatitude2(point, raw) {
731
- var latKey = (0, _getCoordinateKey$1.default)(point, _constants$9.latitudeKeys);
732
- if (typeof latKey === "undefined" || latKey === null) {
733
- return;
734
- }
735
- var value = point[latKey];
736
- return raw === true ? value : (0, _toDecimal$1.default)(value);
737
- };
738
- var _default$u = getLatitude;
739
- getLatitude$1.default = _default$u;
740
- var getLongitude$1 = {};
741
- Object.defineProperty(getLongitude$1, "__esModule", { value: true });
742
- getLongitude$1.default = void 0;
743
- var _constants$8 = constants;
744
- var _getCoordinateKey = _interopRequireDefault$k(getCoordinateKey$1);
745
- var _toDecimal = _interopRequireDefault$k(toDecimal$1);
746
- function _interopRequireDefault$k(obj) {
747
- return obj && obj.__esModule ? obj : { default: obj };
748
- }
749
- var getLongitude = function getLongitude2(point, raw) {
750
- var latKey = (0, _getCoordinateKey.default)(point, _constants$8.longitudeKeys);
751
- if (typeof latKey === "undefined" || latKey === null) {
752
- return;
753
- }
754
- var value = point[latKey];
755
- return raw === true ? value : (0, _toDecimal.default)(value);
756
- };
757
- var _default$t = getLongitude;
758
- getLongitude$1.default = _default$t;
759
- var toRad$1 = {};
760
- Object.defineProperty(toRad$1, "__esModule", { value: true });
761
- toRad$1.default = void 0;
762
- var toRad = function toRad2(value) {
763
- return value * Math.PI / 180;
764
- };
765
- var _default$s = toRad;
766
- toRad$1.default = _default$s;
767
- var toDeg$1 = {};
768
- Object.defineProperty(toDeg$1, "__esModule", { value: true });
769
- toDeg$1.default = void 0;
770
- var toDeg = function toDeg2(value) {
771
- return value * 180 / Math.PI;
772
- };
773
- var _default$r = toDeg;
774
- toDeg$1.default = _default$r;
775
- Object.defineProperty(computeDestinationPoint$1, "__esModule", { value: true });
776
- computeDestinationPoint$1.default = void 0;
777
- var _getLatitude$9 = _interopRequireDefault$j(getLatitude$1);
778
- var _getLongitude$9 = _interopRequireDefault$j(getLongitude$1);
779
- var _toRad$7 = _interopRequireDefault$j(toRad$1);
780
- var _toDeg$4 = _interopRequireDefault$j(toDeg$1);
781
- var _constants$7 = constants;
782
- function _interopRequireDefault$j(obj) {
783
- return obj && obj.__esModule ? obj : { default: obj };
784
- }
785
- var computeDestinationPoint = function computeDestinationPoint2(start, distance, bearing) {
786
- var radius = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 6371e3;
787
- var lat = (0, _getLatitude$9.default)(start);
788
- var lng = (0, _getLongitude$9.default)(start);
789
- var delta = distance / radius;
790
- var theta = (0, _toRad$7.default)(bearing);
791
- var phi1 = (0, _toRad$7.default)(lat);
792
- var lambda1 = (0, _toRad$7.default)(lng);
793
- var phi2 = Math.asin(Math.sin(phi1) * Math.cos(delta) + Math.cos(phi1) * Math.sin(delta) * Math.cos(theta));
794
- var lambda2 = lambda1 + Math.atan2(Math.sin(theta) * Math.sin(delta) * Math.cos(phi1), Math.cos(delta) - Math.sin(phi1) * Math.sin(phi2));
795
- var longitude = (0, _toDeg$4.default)(lambda2);
796
- if (longitude < _constants$7.MINLON || longitude > _constants$7.MAXLON) {
797
- lambda2 = (lambda2 + 3 * Math.PI) % (2 * Math.PI) - Math.PI;
798
- longitude = (0, _toDeg$4.default)(lambda2);
799
- }
800
- return { latitude: (0, _toDeg$4.default)(phi2), longitude };
801
- };
802
- var _default$q = computeDestinationPoint;
803
- computeDestinationPoint$1.default = _default$q;
804
- var convertArea$1 = {};
805
- Object.defineProperty(convertArea$1, "__esModule", { value: true });
806
- convertArea$1.default = void 0;
807
- var _constants$6 = constants;
808
- var convertArea = function convertArea2(squareMeters) {
809
- var targetUnit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "m";
810
- var factor = _constants$6.areaConversion[targetUnit];
811
- if (factor) {
812
- return squareMeters * factor;
813
- }
814
- throw new Error("Invalid unit used for area conversion.");
815
- };
816
- var _default$p = convertArea;
817
- convertArea$1.default = _default$p;
818
- var convertDistance$1 = {};
819
- Object.defineProperty(convertDistance$1, "__esModule", { value: true });
820
- convertDistance$1.default = void 0;
821
- var _constants$5 = constants;
822
- var convertDistance = function convertDistance2(meters) {
823
- var targetUnit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "m";
824
- var factor = _constants$5.distanceConversion[targetUnit];
825
- if (factor) {
826
- return meters * factor;
827
- }
828
- throw new Error("Invalid unit used for distance conversion.");
829
- };
830
- var _default$o = convertDistance;
831
- convertDistance$1.default = _default$o;
832
- var convertSpeed$1 = {};
833
- Object.defineProperty(convertSpeed$1, "__esModule", { value: true });
834
- convertSpeed$1.default = void 0;
835
- var _constants$4 = constants;
836
- var convertSpeed = function convertSpeed2(metersPerSecond) {
837
- var targetUnit = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "kmh";
838
- switch (targetUnit) {
839
- case "kmh":
840
- return metersPerSecond * _constants$4.timeConversion.h * _constants$4.distanceConversion.km;
841
- case "mph":
842
- return metersPerSecond * _constants$4.timeConversion.h * _constants$4.distanceConversion.mi;
843
- default:
844
- return metersPerSecond;
1178
+ var getBounds$1 = function getBounds2(points) {
1179
+ if (Array.isArray(points) === false || points.length === 0) {
1180
+ throw new Error("No points were given.");
1181
+ }
1182
+ return points.reduce(function(stats, point) {
1183
+ var latitude = (0, _getLatitude.default)(point);
1184
+ var longitude = (0, _getLongitude.default)(point);
1185
+ return { maxLat: Math.max(latitude, stats.maxLat), minLat: Math.min(latitude, stats.minLat), maxLng: Math.max(longitude, stats.maxLng), minLng: Math.min(longitude, stats.minLng) };
1186
+ }, { maxLat: -Infinity, minLat: Infinity, maxLng: -Infinity, minLng: Infinity });
1187
+ };
1188
+ var _default = getBounds$1;
1189
+ getBounds.default = _default;
1190
+ return getBounds;
1191
+ }
1192
+ var getBoundsOfDistance = {};
1193
+ var hasRequiredGetBoundsOfDistance;
1194
+ function requireGetBoundsOfDistance() {
1195
+ if (hasRequiredGetBoundsOfDistance) return getBoundsOfDistance;
1196
+ hasRequiredGetBoundsOfDistance = 1;
1197
+ Object.defineProperty(getBoundsOfDistance, "__esModule", { value: true });
1198
+ getBoundsOfDistance.default = void 0;
1199
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1200
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1201
+ var _toRad = _interopRequireDefault(requireToRad());
1202
+ var _toDeg = _interopRequireDefault(requireToDeg());
1203
+ var _constants = requireConstants();
1204
+ function _interopRequireDefault(obj) {
1205
+ return obj && obj.__esModule ? obj : { default: obj };
845
1206
  }
846
- };
847
- var _default$n = convertSpeed;
848
- convertSpeed$1.default = _default$n;
849
- var decimalToSexagesimal = {};
850
- Object.defineProperty(decimalToSexagesimal, "__esModule", { value: true });
851
- decimalToSexagesimal.default = void 0;
852
- function _slicedToArray$1(arr, i) {
853
- return _arrayWithHoles$1(arr) || _iterableToArrayLimit$1(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest$1();
854
- }
855
- function _nonIterableRest$1() {
856
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
857
- }
858
- function _unsupportedIterableToArray$1(o, minLen) {
859
- if (!o) return;
860
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
861
- var n = Object.prototype.toString.call(o).slice(8, -1);
862
- if (n === "Object" && o.constructor) n = o.constructor.name;
863
- if (n === "Map" || n === "Set") return Array.from(o);
864
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
865
- }
866
- function _arrayLikeToArray$1(arr, len) {
867
- if (len == null || len > arr.length) len = arr.length;
868
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
869
- arr2[i] = arr[i];
870
- }
871
- return arr2;
872
- }
873
- function _iterableToArrayLimit$1(arr, i) {
874
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
875
- var _arr = [];
876
- var _n = true;
877
- var _d = false;
878
- var _e = void 0;
879
- try {
880
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
881
- _arr.push(_s.value);
882
- if (i && _arr.length === i) break;
883
- }
884
- } catch (err) {
885
- _d = true;
886
- _e = err;
887
- } finally {
888
- try {
889
- if (!_n && _i["return"] != null) _i["return"]();
890
- } finally {
891
- if (_d) throw _e;
1207
+ var getBoundsOfDistance$1 = function getBoundsOfDistance2(point, distance) {
1208
+ var latitude = (0, _getLatitude.default)(point);
1209
+ var longitude = (0, _getLongitude.default)(point);
1210
+ var radLat = (0, _toRad.default)(latitude);
1211
+ var radLon = (0, _toRad.default)(longitude);
1212
+ var radDist = distance / _constants.earthRadius;
1213
+ var minLat = radLat - radDist;
1214
+ var maxLat = radLat + radDist;
1215
+ var MAX_LAT_RAD = (0, _toRad.default)(_constants.MAXLAT);
1216
+ var MIN_LAT_RAD = (0, _toRad.default)(_constants.MINLAT);
1217
+ var MAX_LON_RAD = (0, _toRad.default)(_constants.MAXLON);
1218
+ var MIN_LON_RAD = (0, _toRad.default)(_constants.MINLON);
1219
+ var minLon;
1220
+ var maxLon;
1221
+ if (minLat > MIN_LAT_RAD && maxLat < MAX_LAT_RAD) {
1222
+ var deltaLon = Math.asin(Math.sin(radDist) / Math.cos(radLat));
1223
+ minLon = radLon - deltaLon;
1224
+ if (minLon < MIN_LON_RAD) {
1225
+ minLon += Math.PI * 2;
1226
+ }
1227
+ maxLon = radLon + deltaLon;
1228
+ if (maxLon > MAX_LON_RAD) {
1229
+ maxLon -= Math.PI * 2;
1230
+ }
1231
+ } else {
1232
+ minLat = Math.max(minLat, MIN_LAT_RAD);
1233
+ maxLat = Math.min(maxLat, MAX_LAT_RAD);
1234
+ minLon = MIN_LON_RAD;
1235
+ maxLon = MAX_LON_RAD;
892
1236
  }
1237
+ return [{ latitude: (0, _toDeg.default)(minLat), longitude: (0, _toDeg.default)(minLon) }, { latitude: (0, _toDeg.default)(maxLat), longitude: (0, _toDeg.default)(maxLon) }];
1238
+ };
1239
+ var _default = getBoundsOfDistance$1;
1240
+ getBoundsOfDistance.default = _default;
1241
+ return getBoundsOfDistance;
1242
+ }
1243
+ var getCenter = {};
1244
+ var hasRequiredGetCenter;
1245
+ function requireGetCenter() {
1246
+ if (hasRequiredGetCenter) return getCenter;
1247
+ hasRequiredGetCenter = 1;
1248
+ Object.defineProperty(getCenter, "__esModule", { value: true });
1249
+ getCenter.default = void 0;
1250
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1251
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1252
+ var _toRad = _interopRequireDefault(requireToRad());
1253
+ var _toDeg = _interopRequireDefault(requireToDeg());
1254
+ function _interopRequireDefault(obj) {
1255
+ return obj && obj.__esModule ? obj : { default: obj };
893
1256
  }
894
- return _arr;
1257
+ var getCenter$1 = function getCenter2(points) {
1258
+ if (Array.isArray(points) === false || points.length === 0) {
1259
+ return false;
1260
+ }
1261
+ var numberOfPoints = points.length;
1262
+ var sum = points.reduce(function(acc, point) {
1263
+ var pointLat = (0, _toRad.default)((0, _getLatitude.default)(point));
1264
+ var pointLon = (0, _toRad.default)((0, _getLongitude.default)(point));
1265
+ return { X: acc.X + Math.cos(pointLat) * Math.cos(pointLon), Y: acc.Y + Math.cos(pointLat) * Math.sin(pointLon), Z: acc.Z + Math.sin(pointLat) };
1266
+ }, { X: 0, Y: 0, Z: 0 });
1267
+ var X = sum.X / numberOfPoints;
1268
+ var Y = sum.Y / numberOfPoints;
1269
+ var Z = sum.Z / numberOfPoints;
1270
+ return { longitude: (0, _toDeg.default)(Math.atan2(Y, X)), latitude: (0, _toDeg.default)(Math.atan2(Z, Math.sqrt(X * X + Y * Y))) };
1271
+ };
1272
+ var _default = getCenter$1;
1273
+ getCenter.default = _default;
1274
+ return getCenter;
895
1275
  }
896
- function _arrayWithHoles$1(arr) {
897
- if (Array.isArray(arr)) return arr;
1276
+ var getCenterOfBounds = {};
1277
+ var hasRequiredGetCenterOfBounds;
1278
+ function requireGetCenterOfBounds() {
1279
+ if (hasRequiredGetCenterOfBounds) return getCenterOfBounds;
1280
+ hasRequiredGetCenterOfBounds = 1;
1281
+ Object.defineProperty(getCenterOfBounds, "__esModule", { value: true });
1282
+ getCenterOfBounds.default = void 0;
1283
+ var _getBounds = _interopRequireDefault(requireGetBounds());
1284
+ function _interopRequireDefault(obj) {
1285
+ return obj && obj.__esModule ? obj : { default: obj };
1286
+ }
1287
+ var getCenterOfBounds$1 = function getCenterOfBounds2(coords) {
1288
+ var bounds = (0, _getBounds.default)(coords);
1289
+ var latitude = bounds.minLat + (bounds.maxLat - bounds.minLat) / 2;
1290
+ var longitude = bounds.minLng + (bounds.maxLng - bounds.minLng) / 2;
1291
+ return { latitude: parseFloat(latitude.toFixed(6)), longitude: parseFloat(longitude.toFixed(6)) };
1292
+ };
1293
+ var _default = getCenterOfBounds$1;
1294
+ getCenterOfBounds.default = _default;
1295
+ return getCenterOfBounds;
898
1296
  }
899
- var imprecise = function imprecise2(number) {
900
- var decimals = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 4;
901
- var factor = Math.pow(10, decimals);
902
- return Math.round(number * factor) / factor;
903
- };
904
- var decimal2sexagesimalNext = function decimal2sexagesimalNext2(decimal) {
905
- var _decimal$toString$spl = decimal.toString().split("."), _decimal$toString$spl2 = _slicedToArray$1(_decimal$toString$spl, 2), pre = _decimal$toString$spl2[0], post = _decimal$toString$spl2[1];
906
- var deg = Math.abs(Number(pre));
907
- var min0 = Number("0." + (post || 0)) * 60;
908
- var sec0 = min0.toString().split(".");
909
- var min = Math.floor(min0);
910
- var sec = imprecise(Number("0." + (sec0[1] || 0)) * 60).toString();
911
- var _sec$split = sec.split("."), _sec$split2 = _slicedToArray$1(_sec$split, 2), secPreDec = _sec$split2[0], _sec$split2$ = _sec$split2[1], secDec = _sec$split2$ === void 0 ? "0" : _sec$split2$;
912
- return deg + "° " + min.toString().padStart(2, "0") + "' " + secPreDec.padStart(2, "0") + "." + secDec.padEnd(1, "0") + '"';
913
- };
914
- var _default$m = decimal2sexagesimalNext;
915
- decimalToSexagesimal.default = _default$m;
916
- var findNearest$1 = {};
917
- var orderByDistance$1 = {};
918
- var getDistance$2 = {};
919
- var robustAcos$1 = {};
920
- Object.defineProperty(robustAcos$1, "__esModule", { value: true });
921
- robustAcos$1.default = void 0;
922
- var robustAcos = function robustAcos2(value) {
923
- if (value > 1) {
924
- return 1;
925
- }
926
- if (value < -1) {
927
- return -1;
928
- }
929
- return value;
930
- };
931
- var _default$l = robustAcos;
932
- robustAcos$1.default = _default$l;
933
- Object.defineProperty(getDistance$2, "__esModule", { value: true });
934
- getDistance$2.default = void 0;
935
- var _getLatitude$8 = _interopRequireDefault$i(getLatitude$1);
936
- var _getLongitude$8 = _interopRequireDefault$i(getLongitude$1);
937
- var _toRad$6 = _interopRequireDefault$i(toRad$1);
938
- var _robustAcos$1 = _interopRequireDefault$i(robustAcos$1);
939
- var _constants$3 = constants;
940
- function _interopRequireDefault$i(obj) {
941
- return obj && obj.__esModule ? obj : { default: obj };
942
- }
943
- var getDistance$1 = function getDistance(from, to) {
944
- var accuracy = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
945
- accuracy = typeof accuracy !== "undefined" && !isNaN(accuracy) ? accuracy : 1;
946
- var fromLat = (0, _getLatitude$8.default)(from);
947
- var fromLon = (0, _getLongitude$8.default)(from);
948
- var toLat = (0, _getLatitude$8.default)(to);
949
- var toLon = (0, _getLongitude$8.default)(to);
950
- var distance = Math.acos((0, _robustAcos$1.default)(Math.sin((0, _toRad$6.default)(toLat)) * Math.sin((0, _toRad$6.default)(fromLat)) + Math.cos((0, _toRad$6.default)(toLat)) * Math.cos((0, _toRad$6.default)(fromLat)) * Math.cos((0, _toRad$6.default)(fromLon) - (0, _toRad$6.default)(toLon)))) * _constants$3.earthRadius;
951
- return Math.round(distance / accuracy) * accuracy;
952
- };
953
- var _default$k = getDistance$1;
954
- getDistance$2.default = _default$k;
955
- Object.defineProperty(orderByDistance$1, "__esModule", { value: true });
956
- orderByDistance$1.default = void 0;
957
- var _getDistance$5 = _interopRequireDefault$h(getDistance$2);
958
- function _interopRequireDefault$h(obj) {
959
- return obj && obj.__esModule ? obj : { default: obj };
960
- }
961
- var orderByDistance = function orderByDistance2(point, coords) {
962
- var distanceFn = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _getDistance$5.default;
963
- distanceFn = typeof distanceFn === "function" ? distanceFn : _getDistance$5.default;
964
- return coords.slice().sort(function(a, b) {
965
- return distanceFn(point, a) - distanceFn(point, b);
966
- });
967
- };
968
- var _default$j = orderByDistance;
969
- orderByDistance$1.default = _default$j;
970
- Object.defineProperty(findNearest$1, "__esModule", { value: true });
971
- findNearest$1.default = void 0;
972
- var _orderByDistance = _interopRequireDefault$g(orderByDistance$1);
973
- function _interopRequireDefault$g(obj) {
974
- return obj && obj.__esModule ? obj : { default: obj };
975
- }
976
- var findNearest = function findNearest2(point, coords) {
977
- return (0, _orderByDistance.default)(point, coords)[0];
978
- };
979
- var _default$i = findNearest;
980
- findNearest$1.default = _default$i;
981
- var getAreaOfPolygon$1 = {};
982
- Object.defineProperty(getAreaOfPolygon$1, "__esModule", { value: true });
983
- getAreaOfPolygon$1.default = void 0;
984
- var _toRad$5 = _interopRequireDefault$f(toRad$1);
985
- var _getLatitude$7 = _interopRequireDefault$f(getLatitude$1);
986
- var _getLongitude$7 = _interopRequireDefault$f(getLongitude$1);
987
- var _constants$2 = constants;
988
- function _interopRequireDefault$f(obj) {
989
- return obj && obj.__esModule ? obj : { default: obj };
990
- }
991
- var getAreaOfPolygon = function getAreaOfPolygon2(points) {
992
- var area = 0;
993
- if (points.length > 2) {
994
- var lowerIndex;
995
- var middleIndex;
996
- var upperIndex;
997
- for (var i = 0; i < points.length; i++) {
998
- if (i === points.length - 2) {
999
- lowerIndex = points.length - 2;
1000
- middleIndex = points.length - 1;
1001
- upperIndex = 0;
1002
- } else if (i === points.length - 1) {
1003
- lowerIndex = points.length - 1;
1004
- middleIndex = 0;
1005
- upperIndex = 1;
1297
+ var getCompassDirection = {};
1298
+ var getRhumbLineBearing = {};
1299
+ var hasRequiredGetRhumbLineBearing;
1300
+ function requireGetRhumbLineBearing() {
1301
+ if (hasRequiredGetRhumbLineBearing) return getRhumbLineBearing;
1302
+ hasRequiredGetRhumbLineBearing = 1;
1303
+ Object.defineProperty(getRhumbLineBearing, "__esModule", { value: true });
1304
+ getRhumbLineBearing.default = void 0;
1305
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1306
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1307
+ var _toRad = _interopRequireDefault(requireToRad());
1308
+ var _toDeg = _interopRequireDefault(requireToDeg());
1309
+ function _interopRequireDefault(obj) {
1310
+ return obj && obj.__esModule ? obj : { default: obj };
1311
+ }
1312
+ var getRhumbLineBearing$1 = function getRhumbLineBearing2(origin, dest) {
1313
+ var diffLon = (0, _toRad.default)((0, _getLongitude.default)(dest)) - (0, _toRad.default)((0, _getLongitude.default)(origin));
1314
+ var diffPhi = Math.log(Math.tan((0, _toRad.default)((0, _getLatitude.default)(dest)) / 2 + Math.PI / 4) / Math.tan((0, _toRad.default)((0, _getLatitude.default)(origin)) / 2 + Math.PI / 4));
1315
+ if (Math.abs(diffLon) > Math.PI) {
1316
+ if (diffLon > 0) {
1317
+ diffLon = (Math.PI * 2 - diffLon) * -1;
1006
1318
  } else {
1007
- lowerIndex = i;
1008
- middleIndex = i + 1;
1009
- upperIndex = i + 2;
1319
+ diffLon = Math.PI * 2 + diffLon;
1010
1320
  }
1011
- var p1lon = (0, _getLongitude$7.default)(points[lowerIndex]);
1012
- var p2lat = (0, _getLatitude$7.default)(points[middleIndex]);
1013
- var p3lon = (0, _getLongitude$7.default)(points[upperIndex]);
1014
- area += ((0, _toRad$5.default)(p3lon) - (0, _toRad$5.default)(p1lon)) * Math.sin((0, _toRad$5.default)(p2lat));
1015
1321
  }
1016
- area = area * _constants$2.earthRadius * _constants$2.earthRadius / 2;
1322
+ return ((0, _toDeg.default)(Math.atan2(diffLon, diffPhi)) + 360) % 360;
1323
+ };
1324
+ var _default = getRhumbLineBearing$1;
1325
+ getRhumbLineBearing.default = _default;
1326
+ return getRhumbLineBearing;
1327
+ }
1328
+ var hasRequiredGetCompassDirection;
1329
+ function requireGetCompassDirection() {
1330
+ if (hasRequiredGetCompassDirection) return getCompassDirection;
1331
+ hasRequiredGetCompassDirection = 1;
1332
+ Object.defineProperty(getCompassDirection, "__esModule", { value: true });
1333
+ getCompassDirection.default = void 0;
1334
+ var _getRhumbLineBearing = _interopRequireDefault(requireGetRhumbLineBearing());
1335
+ function _interopRequireDefault(obj) {
1336
+ return obj && obj.__esModule ? obj : { default: obj };
1017
1337
  }
1018
- return Math.abs(area);
1019
- };
1020
- var _default$h = getAreaOfPolygon;
1021
- getAreaOfPolygon$1.default = _default$h;
1022
- var getBounds$1 = {};
1023
- Object.defineProperty(getBounds$1, "__esModule", { value: true });
1024
- getBounds$1.default = void 0;
1025
- var _getLatitude$6 = _interopRequireDefault$e(getLatitude$1);
1026
- var _getLongitude$6 = _interopRequireDefault$e(getLongitude$1);
1027
- function _interopRequireDefault$e(obj) {
1028
- return obj && obj.__esModule ? obj : { default: obj };
1029
- }
1030
- var getBounds = function getBounds2(points) {
1031
- if (Array.isArray(points) === false || points.length === 0) {
1032
- throw new Error("No points were given.");
1033
- }
1034
- return points.reduce(function(stats, point) {
1035
- var latitude = (0, _getLatitude$6.default)(point);
1036
- var longitude = (0, _getLongitude$6.default)(point);
1037
- return { maxLat: Math.max(latitude, stats.maxLat), minLat: Math.min(latitude, stats.minLat), maxLng: Math.max(longitude, stats.maxLng), minLng: Math.min(longitude, stats.minLng) };
1038
- }, { maxLat: -Infinity, minLat: Infinity, maxLng: -Infinity, minLng: Infinity });
1039
- };
1040
- var _default$g = getBounds;
1041
- getBounds$1.default = _default$g;
1042
- var getBoundsOfDistance$1 = {};
1043
- Object.defineProperty(getBoundsOfDistance$1, "__esModule", { value: true });
1044
- getBoundsOfDistance$1.default = void 0;
1045
- var _getLatitude$5 = _interopRequireDefault$d(getLatitude$1);
1046
- var _getLongitude$5 = _interopRequireDefault$d(getLongitude$1);
1047
- var _toRad$4 = _interopRequireDefault$d(toRad$1);
1048
- var _toDeg$3 = _interopRequireDefault$d(toDeg$1);
1049
- var _constants$1 = constants;
1050
- function _interopRequireDefault$d(obj) {
1051
- return obj && obj.__esModule ? obj : { default: obj };
1052
- }
1053
- var getBoundsOfDistance = function getBoundsOfDistance2(point, distance) {
1054
- var latitude = (0, _getLatitude$5.default)(point);
1055
- var longitude = (0, _getLongitude$5.default)(point);
1056
- var radLat = (0, _toRad$4.default)(latitude);
1057
- var radLon = (0, _toRad$4.default)(longitude);
1058
- var radDist = distance / _constants$1.earthRadius;
1059
- var minLat = radLat - radDist;
1060
- var maxLat = radLat + radDist;
1061
- var MAX_LAT_RAD = (0, _toRad$4.default)(_constants$1.MAXLAT);
1062
- var MIN_LAT_RAD = (0, _toRad$4.default)(_constants$1.MINLAT);
1063
- var MAX_LON_RAD = (0, _toRad$4.default)(_constants$1.MAXLON);
1064
- var MIN_LON_RAD = (0, _toRad$4.default)(_constants$1.MINLON);
1065
- var minLon;
1066
- var maxLon;
1067
- if (minLat > MIN_LAT_RAD && maxLat < MAX_LAT_RAD) {
1068
- var deltaLon = Math.asin(Math.sin(radDist) / Math.cos(radLat));
1069
- minLon = radLon - deltaLon;
1070
- if (minLon < MIN_LON_RAD) {
1071
- minLon += Math.PI * 2;
1072
- }
1073
- maxLon = radLon + deltaLon;
1074
- if (maxLon > MAX_LON_RAD) {
1075
- maxLon -= Math.PI * 2;
1338
+ var getCompassDirection$1 = function getCompassDirection2(origin, dest) {
1339
+ var bearingFn = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _getRhumbLineBearing.default;
1340
+ var bearing = typeof bearingFn === "function" ? bearingFn(origin, dest) : (0, _getRhumbLineBearing.default)(origin, dest);
1341
+ if (isNaN(bearing)) {
1342
+ throw new Error("Could not calculate bearing for given points. Check your bearing function");
1076
1343
  }
1077
- } else {
1078
- minLat = Math.max(minLat, MIN_LAT_RAD);
1079
- maxLat = Math.min(maxLat, MAX_LAT_RAD);
1080
- minLon = MIN_LON_RAD;
1081
- maxLon = MAX_LON_RAD;
1344
+ switch (Math.round(bearing / 22.5)) {
1345
+ case 1:
1346
+ return "NNE";
1347
+ case 2:
1348
+ return "NE";
1349
+ case 3:
1350
+ return "ENE";
1351
+ case 4:
1352
+ return "E";
1353
+ case 5:
1354
+ return "ESE";
1355
+ case 6:
1356
+ return "SE";
1357
+ case 7:
1358
+ return "SSE";
1359
+ case 8:
1360
+ return "S";
1361
+ case 9:
1362
+ return "SSW";
1363
+ case 10:
1364
+ return "SW";
1365
+ case 11:
1366
+ return "WSW";
1367
+ case 12:
1368
+ return "W";
1369
+ case 13:
1370
+ return "WNW";
1371
+ case 14:
1372
+ return "NW";
1373
+ case 15:
1374
+ return "NNW";
1375
+ default:
1376
+ return "N";
1377
+ }
1378
+ };
1379
+ var _default = getCompassDirection$1;
1380
+ getCompassDirection.default = _default;
1381
+ return getCompassDirection;
1382
+ }
1383
+ var getDistanceFromLine = {};
1384
+ var hasRequiredGetDistanceFromLine;
1385
+ function requireGetDistanceFromLine() {
1386
+ if (hasRequiredGetDistanceFromLine) return getDistanceFromLine;
1387
+ hasRequiredGetDistanceFromLine = 1;
1388
+ Object.defineProperty(getDistanceFromLine, "__esModule", { value: true });
1389
+ getDistanceFromLine.default = void 0;
1390
+ var _getDistance = _interopRequireDefault(requireGetDistance());
1391
+ var _robustAcos = _interopRequireDefault(requireRobustAcos());
1392
+ function _interopRequireDefault(obj) {
1393
+ return obj && obj.__esModule ? obj : { default: obj };
1082
1394
  }
1083
- return [{ latitude: (0, _toDeg$3.default)(minLat), longitude: (0, _toDeg$3.default)(minLon) }, { latitude: (0, _toDeg$3.default)(maxLat), longitude: (0, _toDeg$3.default)(maxLon) }];
1084
- };
1085
- var _default$f = getBoundsOfDistance;
1086
- getBoundsOfDistance$1.default = _default$f;
1087
- var getCenter$1 = {};
1088
- Object.defineProperty(getCenter$1, "__esModule", { value: true });
1089
- getCenter$1.default = void 0;
1090
- var _getLatitude$4 = _interopRequireDefault$c(getLatitude$1);
1091
- var _getLongitude$4 = _interopRequireDefault$c(getLongitude$1);
1092
- var _toRad$3 = _interopRequireDefault$c(toRad$1);
1093
- var _toDeg$2 = _interopRequireDefault$c(toDeg$1);
1094
- function _interopRequireDefault$c(obj) {
1095
- return obj && obj.__esModule ? obj : { default: obj };
1096
- }
1097
- var getCenter = function getCenter2(points) {
1098
- if (Array.isArray(points) === false || points.length === 0) {
1099
- return false;
1395
+ var getDistanceFromLine$1 = function getDistanceFromLine2(point, lineStart, lineEnd) {
1396
+ var accuracy = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
1397
+ var d1 = (0, _getDistance.default)(lineStart, point, accuracy);
1398
+ var d2 = (0, _getDistance.default)(point, lineEnd, accuracy);
1399
+ var d3 = (0, _getDistance.default)(lineStart, lineEnd, accuracy);
1400
+ var alpha = Math.acos((0, _robustAcos.default)((d1 * d1 + d3 * d3 - d2 * d2) / (2 * d1 * d3)));
1401
+ var beta = Math.acos((0, _robustAcos.default)((d2 * d2 + d3 * d3 - d1 * d1) / (2 * d2 * d3)));
1402
+ if (alpha > Math.PI / 2) {
1403
+ return d1;
1404
+ }
1405
+ if (beta > Math.PI / 2) {
1406
+ return d2;
1407
+ }
1408
+ return Math.sin(alpha) * d1;
1409
+ };
1410
+ var _default = getDistanceFromLine$1;
1411
+ getDistanceFromLine.default = _default;
1412
+ return getDistanceFromLine;
1413
+ }
1414
+ var getGreatCircleBearing = {};
1415
+ var hasRequiredGetGreatCircleBearing;
1416
+ function requireGetGreatCircleBearing() {
1417
+ if (hasRequiredGetGreatCircleBearing) return getGreatCircleBearing;
1418
+ hasRequiredGetGreatCircleBearing = 1;
1419
+ Object.defineProperty(getGreatCircleBearing, "__esModule", { value: true });
1420
+ getGreatCircleBearing.default = void 0;
1421
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1422
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1423
+ var _toRad = _interopRequireDefault(requireToRad());
1424
+ var _toDeg = _interopRequireDefault(requireToDeg());
1425
+ function _interopRequireDefault(obj) {
1426
+ return obj && obj.__esModule ? obj : { default: obj };
1100
1427
  }
1101
- var numberOfPoints = points.length;
1102
- var sum = points.reduce(function(acc, point) {
1103
- var pointLat = (0, _toRad$3.default)((0, _getLatitude$4.default)(point));
1104
- var pointLon = (0, _toRad$3.default)((0, _getLongitude$4.default)(point));
1105
- return { X: acc.X + Math.cos(pointLat) * Math.cos(pointLon), Y: acc.Y + Math.cos(pointLat) * Math.sin(pointLon), Z: acc.Z + Math.sin(pointLat) };
1106
- }, { X: 0, Y: 0, Z: 0 });
1107
- var X = sum.X / numberOfPoints;
1108
- var Y = sum.Y / numberOfPoints;
1109
- var Z = sum.Z / numberOfPoints;
1110
- return { longitude: (0, _toDeg$2.default)(Math.atan2(Y, X)), latitude: (0, _toDeg$2.default)(Math.atan2(Z, Math.sqrt(X * X + Y * Y))) };
1111
- };
1112
- var _default$e = getCenter;
1113
- getCenter$1.default = _default$e;
1114
- var getCenterOfBounds$1 = {};
1115
- Object.defineProperty(getCenterOfBounds$1, "__esModule", { value: true });
1116
- getCenterOfBounds$1.default = void 0;
1117
- var _getBounds = _interopRequireDefault$b(getBounds$1);
1118
- function _interopRequireDefault$b(obj) {
1119
- return obj && obj.__esModule ? obj : { default: obj };
1120
- }
1121
- var getCenterOfBounds = function getCenterOfBounds2(coords) {
1122
- var bounds = (0, _getBounds.default)(coords);
1123
- var latitude = bounds.minLat + (bounds.maxLat - bounds.minLat) / 2;
1124
- var longitude = bounds.minLng + (bounds.maxLng - bounds.minLng) / 2;
1125
- return { latitude: parseFloat(latitude.toFixed(6)), longitude: parseFloat(longitude.toFixed(6)) };
1126
- };
1127
- var _default$d = getCenterOfBounds;
1128
- getCenterOfBounds$1.default = _default$d;
1129
- var getCompassDirection$1 = {};
1130
- var getRhumbLineBearing$1 = {};
1131
- Object.defineProperty(getRhumbLineBearing$1, "__esModule", { value: true });
1132
- getRhumbLineBearing$1.default = void 0;
1133
- var _getLatitude$3 = _interopRequireDefault$a(getLatitude$1);
1134
- var _getLongitude$3 = _interopRequireDefault$a(getLongitude$1);
1135
- var _toRad$2 = _interopRequireDefault$a(toRad$1);
1136
- var _toDeg$1 = _interopRequireDefault$a(toDeg$1);
1137
- function _interopRequireDefault$a(obj) {
1138
- return obj && obj.__esModule ? obj : { default: obj };
1139
- }
1140
- var getRhumbLineBearing = function getRhumbLineBearing2(origin, dest) {
1141
- var diffLon = (0, _toRad$2.default)((0, _getLongitude$3.default)(dest)) - (0, _toRad$2.default)((0, _getLongitude$3.default)(origin));
1142
- var diffPhi = Math.log(Math.tan((0, _toRad$2.default)((0, _getLatitude$3.default)(dest)) / 2 + Math.PI / 4) / Math.tan((0, _toRad$2.default)((0, _getLatitude$3.default)(origin)) / 2 + Math.PI / 4));
1143
- if (Math.abs(diffLon) > Math.PI) {
1144
- if (diffLon > 0) {
1145
- diffLon = (Math.PI * 2 - diffLon) * -1;
1428
+ var getGreatCircleBearing$1 = function getGreatCircleBearing2(origin, dest) {
1429
+ var destLat = (0, _getLatitude.default)(dest);
1430
+ var detLon = (0, _getLongitude.default)(dest);
1431
+ var originLat = (0, _getLatitude.default)(origin);
1432
+ var originLon = (0, _getLongitude.default)(origin);
1433
+ var bearing = ((0, _toDeg.default)(Math.atan2(Math.sin((0, _toRad.default)(detLon) - (0, _toRad.default)(originLon)) * Math.cos((0, _toRad.default)(destLat)), Math.cos((0, _toRad.default)(originLat)) * Math.sin((0, _toRad.default)(destLat)) - Math.sin((0, _toRad.default)(originLat)) * Math.cos((0, _toRad.default)(destLat)) * Math.cos((0, _toRad.default)(detLon) - (0, _toRad.default)(originLon)))) + 360) % 360;
1434
+ return bearing;
1435
+ };
1436
+ var _default = getGreatCircleBearing$1;
1437
+ getGreatCircleBearing.default = _default;
1438
+ return getGreatCircleBearing;
1439
+ }
1440
+ var getPathLength = {};
1441
+ var hasRequiredGetPathLength;
1442
+ function requireGetPathLength() {
1443
+ if (hasRequiredGetPathLength) return getPathLength;
1444
+ hasRequiredGetPathLength = 1;
1445
+ Object.defineProperty(getPathLength, "__esModule", { value: true });
1446
+ getPathLength.default = void 0;
1447
+ var _getDistance = _interopRequireDefault(requireGetDistance());
1448
+ function _interopRequireDefault(obj) {
1449
+ return obj && obj.__esModule ? obj : { default: obj };
1450
+ }
1451
+ function _typeof(obj) {
1452
+ "@babel/helpers - typeof";
1453
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1454
+ _typeof = function _typeof2(obj2) {
1455
+ return typeof obj2;
1456
+ };
1146
1457
  } else {
1147
- diffLon = Math.PI * 2 + diffLon;
1458
+ _typeof = function _typeof2(obj2) {
1459
+ return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
1460
+ };
1148
1461
  }
1462
+ return _typeof(obj);
1149
1463
  }
1150
- return ((0, _toDeg$1.default)(Math.atan2(diffLon, diffPhi)) + 360) % 360;
1151
- };
1152
- var _default$c = getRhumbLineBearing;
1153
- getRhumbLineBearing$1.default = _default$c;
1154
- Object.defineProperty(getCompassDirection$1, "__esModule", { value: true });
1155
- getCompassDirection$1.default = void 0;
1156
- var _getRhumbLineBearing = _interopRequireDefault$9(getRhumbLineBearing$1);
1157
- function _interopRequireDefault$9(obj) {
1158
- return obj && obj.__esModule ? obj : { default: obj };
1159
- }
1160
- var getCompassDirection = function getCompassDirection2(origin, dest) {
1161
- var bearingFn = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _getRhumbLineBearing.default;
1162
- var bearing = typeof bearingFn === "function" ? bearingFn(origin, dest) : (0, _getRhumbLineBearing.default)(origin, dest);
1163
- if (isNaN(bearing)) {
1164
- throw new Error("Could not calculate bearing for given points. Check your bearing function");
1165
- }
1166
- switch (Math.round(bearing / 22.5)) {
1167
- case 1:
1168
- return "NNE";
1169
- case 2:
1170
- return "NE";
1171
- case 3:
1172
- return "ENE";
1173
- case 4:
1464
+ var getPathLength$1 = function getPathLength2(points) {
1465
+ var distanceFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : _getDistance.default;
1466
+ return points.reduce(function(acc, point) {
1467
+ if (_typeof(acc) === "object" && acc.last !== null) {
1468
+ acc.distance += distanceFn(point, acc.last);
1469
+ }
1470
+ acc.last = point;
1471
+ return acc;
1472
+ }, { last: null, distance: 0 }).distance;
1473
+ };
1474
+ var _default = getPathLength$1;
1475
+ getPathLength.default = _default;
1476
+ return getPathLength;
1477
+ }
1478
+ var getPreciseDistance = {};
1479
+ var hasRequiredGetPreciseDistance;
1480
+ function requireGetPreciseDistance() {
1481
+ if (hasRequiredGetPreciseDistance) return getPreciseDistance;
1482
+ hasRequiredGetPreciseDistance = 1;
1483
+ Object.defineProperty(getPreciseDistance, "__esModule", { value: true });
1484
+ getPreciseDistance.default = void 0;
1485
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1486
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1487
+ var _toRad = _interopRequireDefault(requireToRad());
1488
+ var _constants = requireConstants();
1489
+ function _interopRequireDefault(obj) {
1490
+ return obj && obj.__esModule ? obj : { default: obj };
1491
+ }
1492
+ var getDistance2 = function getDistance3(start, end) {
1493
+ var accuracy = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
1494
+ accuracy = typeof accuracy !== "undefined" && !isNaN(accuracy) ? accuracy : 1;
1495
+ var startLat = (0, _getLatitude.default)(start);
1496
+ var startLon = (0, _getLongitude.default)(start);
1497
+ var endLat = (0, _getLatitude.default)(end);
1498
+ var endLon = (0, _getLongitude.default)(end);
1499
+ var b = 6356752314245e-6;
1500
+ var ellipsoidParams = 1 / 298.257223563;
1501
+ var L = (0, _toRad.default)(endLon - startLon);
1502
+ var cosSigma;
1503
+ var sigma;
1504
+ var sinAlpha;
1505
+ var cosSqAlpha;
1506
+ var cos2SigmaM;
1507
+ var sinSigma;
1508
+ var U1 = Math.atan((1 - ellipsoidParams) * Math.tan((0, _toRad.default)(parseFloat(startLat))));
1509
+ var U2 = Math.atan((1 - ellipsoidParams) * Math.tan((0, _toRad.default)(parseFloat(endLat))));
1510
+ var sinU1 = Math.sin(U1);
1511
+ var cosU1 = Math.cos(U1);
1512
+ var sinU2 = Math.sin(U2);
1513
+ var cosU2 = Math.cos(U2);
1514
+ var lambda = L;
1515
+ var lambdaP;
1516
+ var iterLimit = 100;
1517
+ do {
1518
+ var sinLambda = Math.sin(lambda);
1519
+ var cosLambda = Math.cos(lambda);
1520
+ sinSigma = Math.sqrt(cosU2 * sinLambda * (cosU2 * sinLambda) + (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) * (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda));
1521
+ if (sinSigma === 0) {
1522
+ return 0;
1523
+ }
1524
+ cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda;
1525
+ sigma = Math.atan2(sinSigma, cosSigma);
1526
+ sinAlpha = cosU1 * cosU2 * sinLambda / sinSigma;
1527
+ cosSqAlpha = 1 - sinAlpha * sinAlpha;
1528
+ cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha;
1529
+ if (isNaN(cos2SigmaM)) {
1530
+ cos2SigmaM = 0;
1531
+ }
1532
+ var C = ellipsoidParams / 16 * cosSqAlpha * (4 + ellipsoidParams * (4 - 3 * cosSqAlpha));
1533
+ lambdaP = lambda;
1534
+ lambda = L + (1 - C) * ellipsoidParams * sinAlpha * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
1535
+ } while (Math.abs(lambda - lambdaP) > 1e-12 && --iterLimit > 0);
1536
+ if (iterLimit === 0) {
1537
+ return NaN;
1538
+ }
1539
+ var uSq = cosSqAlpha * (_constants.earthRadius * _constants.earthRadius - b * b) / (b * b);
1540
+ var A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
1541
+ var B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
1542
+ var deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) - B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
1543
+ var distance = b * A * (sigma - deltaSigma);
1544
+ return Math.round(distance / accuracy) * accuracy;
1545
+ };
1546
+ var _default = getDistance2;
1547
+ getPreciseDistance.default = _default;
1548
+ return getPreciseDistance;
1549
+ }
1550
+ var getRoughCompassDirection = {};
1551
+ var hasRequiredGetRoughCompassDirection;
1552
+ function requireGetRoughCompassDirection() {
1553
+ if (hasRequiredGetRoughCompassDirection) return getRoughCompassDirection;
1554
+ hasRequiredGetRoughCompassDirection = 1;
1555
+ Object.defineProperty(getRoughCompassDirection, "__esModule", { value: true });
1556
+ getRoughCompassDirection.default = void 0;
1557
+ var getRoughCompassDirection$1 = function getRoughCompassDirection2(exact) {
1558
+ if (/^(NNE|NE|NNW|N)$/.test(exact)) {
1559
+ return "N";
1560
+ }
1561
+ if (/^(ENE|E|ESE|SE)$/.test(exact)) {
1174
1562
  return "E";
1175
- case 5:
1176
- return "ESE";
1177
- case 6:
1178
- return "SE";
1179
- case 7:
1180
- return "SSE";
1181
- case 8:
1563
+ }
1564
+ if (/^(SSE|S|SSW|SW)$/.test(exact)) {
1182
1565
  return "S";
1183
- case 9:
1184
- return "SSW";
1185
- case 10:
1186
- return "SW";
1187
- case 11:
1188
- return "WSW";
1189
- case 12:
1566
+ }
1567
+ if (/^(WSW|W|WNW|NW)$/.test(exact)) {
1190
1568
  return "W";
1191
- case 13:
1192
- return "WNW";
1193
- case 14:
1194
- return "NW";
1195
- case 15:
1196
- return "NNW";
1197
- default:
1198
- return "N";
1199
- }
1200
- };
1201
- var _default$b = getCompassDirection;
1202
- getCompassDirection$1.default = _default$b;
1203
- var getDistanceFromLine$1 = {};
1204
- Object.defineProperty(getDistanceFromLine$1, "__esModule", { value: true });
1205
- getDistanceFromLine$1.default = void 0;
1206
- var _getDistance$4 = _interopRequireDefault$8(getDistance$2);
1207
- var _robustAcos = _interopRequireDefault$8(robustAcos$1);
1208
- function _interopRequireDefault$8(obj) {
1209
- return obj && obj.__esModule ? obj : { default: obj };
1210
- }
1211
- var getDistanceFromLine = function getDistanceFromLine2(point, lineStart, lineEnd) {
1212
- var accuracy = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 1;
1213
- var d1 = (0, _getDistance$4.default)(lineStart, point, accuracy);
1214
- var d2 = (0, _getDistance$4.default)(point, lineEnd, accuracy);
1215
- var d3 = (0, _getDistance$4.default)(lineStart, lineEnd, accuracy);
1216
- var alpha = Math.acos((0, _robustAcos.default)((d1 * d1 + d3 * d3 - d2 * d2) / (2 * d1 * d3)));
1217
- var beta = Math.acos((0, _robustAcos.default)((d2 * d2 + d3 * d3 - d1 * d1) / (2 * d2 * d3)));
1218
- if (alpha > Math.PI / 2) {
1219
- return d1;
1220
- }
1221
- if (beta > Math.PI / 2) {
1222
- return d2;
1223
- }
1224
- return Math.sin(alpha) * d1;
1225
- };
1226
- var _default$a = getDistanceFromLine;
1227
- getDistanceFromLine$1.default = _default$a;
1228
- var getGreatCircleBearing$1 = {};
1229
- Object.defineProperty(getGreatCircleBearing$1, "__esModule", { value: true });
1230
- getGreatCircleBearing$1.default = void 0;
1231
- var _getLatitude$2 = _interopRequireDefault$7(getLatitude$1);
1232
- var _getLongitude$2 = _interopRequireDefault$7(getLongitude$1);
1233
- var _toRad$1 = _interopRequireDefault$7(toRad$1);
1234
- var _toDeg = _interopRequireDefault$7(toDeg$1);
1235
- function _interopRequireDefault$7(obj) {
1236
- return obj && obj.__esModule ? obj : { default: obj };
1237
- }
1238
- var getGreatCircleBearing = function getGreatCircleBearing2(origin, dest) {
1239
- var destLat = (0, _getLatitude$2.default)(dest);
1240
- var detLon = (0, _getLongitude$2.default)(dest);
1241
- var originLat = (0, _getLatitude$2.default)(origin);
1242
- var originLon = (0, _getLongitude$2.default)(origin);
1243
- var bearing = ((0, _toDeg.default)(Math.atan2(Math.sin((0, _toRad$1.default)(detLon) - (0, _toRad$1.default)(originLon)) * Math.cos((0, _toRad$1.default)(destLat)), Math.cos((0, _toRad$1.default)(originLat)) * Math.sin((0, _toRad$1.default)(destLat)) - Math.sin((0, _toRad$1.default)(originLat)) * Math.cos((0, _toRad$1.default)(destLat)) * Math.cos((0, _toRad$1.default)(detLon) - (0, _toRad$1.default)(originLon)))) + 360) % 360;
1244
- return bearing;
1245
- };
1246
- var _default$9 = getGreatCircleBearing;
1247
- getGreatCircleBearing$1.default = _default$9;
1248
- var getPathLength$1 = {};
1249
- Object.defineProperty(getPathLength$1, "__esModule", { value: true });
1250
- getPathLength$1.default = void 0;
1251
- var _getDistance$3 = _interopRequireDefault$6(getDistance$2);
1252
- function _interopRequireDefault$6(obj) {
1253
- return obj && obj.__esModule ? obj : { default: obj };
1254
- }
1255
- function _typeof(obj) {
1256
- "@babel/helpers - typeof";
1257
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1258
- _typeof = function _typeof2(obj2) {
1259
- return typeof obj2;
1260
- };
1261
- } else {
1262
- _typeof = function _typeof2(obj2) {
1263
- return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
1264
- };
1569
+ }
1570
+ };
1571
+ var _default = getRoughCompassDirection$1;
1572
+ getRoughCompassDirection.default = _default;
1573
+ return getRoughCompassDirection;
1574
+ }
1575
+ var getSpeed = {};
1576
+ var hasRequiredGetSpeed;
1577
+ function requireGetSpeed() {
1578
+ if (hasRequiredGetSpeed) return getSpeed;
1579
+ hasRequiredGetSpeed = 1;
1580
+ Object.defineProperty(getSpeed, "__esModule", { value: true });
1581
+ getSpeed.default = void 0;
1582
+ var _getDistance = _interopRequireDefault(requireGetDistance());
1583
+ function _interopRequireDefault(obj) {
1584
+ return obj && obj.__esModule ? obj : { default: obj };
1265
1585
  }
1266
- return _typeof(obj);
1586
+ var getSpeed$1 = function getSpeed2(start, end) {
1587
+ var distanceFn = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _getDistance.default;
1588
+ var distance = distanceFn(start, end);
1589
+ var time = Number(end.time) - Number(start.time);
1590
+ var metersPerSecond = distance / time * 1e3;
1591
+ return metersPerSecond;
1592
+ };
1593
+ var _default = getSpeed$1;
1594
+ getSpeed.default = _default;
1595
+ return getSpeed;
1267
1596
  }
1268
- var getPathLength = function getPathLength2(points) {
1269
- var distanceFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : _getDistance$3.default;
1270
- return points.reduce(function(acc, point) {
1271
- if (_typeof(acc) === "object" && acc.last !== null) {
1272
- acc.distance += distanceFn(point, acc.last);
1273
- }
1274
- acc.last = point;
1275
- return acc;
1276
- }, { last: null, distance: 0 }).distance;
1277
- };
1278
- var _default$8 = getPathLength;
1279
- getPathLength$1.default = _default$8;
1280
- var getPreciseDistance = {};
1281
- Object.defineProperty(getPreciseDistance, "__esModule", { value: true });
1282
- getPreciseDistance.default = void 0;
1283
- var _getLatitude$1 = _interopRequireDefault$5(getLatitude$1);
1284
- var _getLongitude$1 = _interopRequireDefault$5(getLongitude$1);
1285
- var _toRad = _interopRequireDefault$5(toRad$1);
1286
- var _constants = constants;
1287
- function _interopRequireDefault$5(obj) {
1288
- return obj && obj.__esModule ? obj : { default: obj };
1289
- }
1290
- var getDistance2 = function getDistance3(start, end) {
1291
- var accuracy = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
1292
- accuracy = typeof accuracy !== "undefined" && !isNaN(accuracy) ? accuracy : 1;
1293
- var startLat = (0, _getLatitude$1.default)(start);
1294
- var startLon = (0, _getLongitude$1.default)(start);
1295
- var endLat = (0, _getLatitude$1.default)(end);
1296
- var endLon = (0, _getLongitude$1.default)(end);
1297
- var b = 6356752314245e-6;
1298
- var ellipsoidParams = 1 / 298.257223563;
1299
- var L = (0, _toRad.default)(endLon - startLon);
1300
- var cosSigma;
1301
- var sigma;
1302
- var sinAlpha;
1303
- var cosSqAlpha;
1304
- var cos2SigmaM;
1305
- var sinSigma;
1306
- var U1 = Math.atan((1 - ellipsoidParams) * Math.tan((0, _toRad.default)(parseFloat(startLat))));
1307
- var U2 = Math.atan((1 - ellipsoidParams) * Math.tan((0, _toRad.default)(parseFloat(endLat))));
1308
- var sinU1 = Math.sin(U1);
1309
- var cosU1 = Math.cos(U1);
1310
- var sinU2 = Math.sin(U2);
1311
- var cosU2 = Math.cos(U2);
1312
- var lambda = L;
1313
- var lambdaP;
1314
- var iterLimit = 100;
1315
- do {
1316
- var sinLambda = Math.sin(lambda);
1317
- var cosLambda = Math.cos(lambda);
1318
- sinSigma = Math.sqrt(cosU2 * sinLambda * (cosU2 * sinLambda) + (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda) * (cosU1 * sinU2 - sinU1 * cosU2 * cosLambda));
1319
- if (sinSigma === 0) {
1320
- return 0;
1321
- }
1322
- cosSigma = sinU1 * sinU2 + cosU1 * cosU2 * cosLambda;
1323
- sigma = Math.atan2(sinSigma, cosSigma);
1324
- sinAlpha = cosU1 * cosU2 * sinLambda / sinSigma;
1325
- cosSqAlpha = 1 - sinAlpha * sinAlpha;
1326
- cos2SigmaM = cosSigma - 2 * sinU1 * sinU2 / cosSqAlpha;
1327
- if (isNaN(cos2SigmaM)) {
1328
- cos2SigmaM = 0;
1329
- }
1330
- var C = ellipsoidParams / 16 * cosSqAlpha * (4 + ellipsoidParams * (4 - 3 * cosSqAlpha));
1331
- lambdaP = lambda;
1332
- lambda = L + (1 - C) * ellipsoidParams * sinAlpha * (sigma + C * sinSigma * (cos2SigmaM + C * cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM)));
1333
- } while (Math.abs(lambda - lambdaP) > 1e-12 && --iterLimit > 0);
1334
- if (iterLimit === 0) {
1335
- return NaN;
1336
- }
1337
- var uSq = cosSqAlpha * (_constants.earthRadius * _constants.earthRadius - b * b) / (b * b);
1338
- var A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
1339
- var B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
1340
- var deltaSigma = B * sinSigma * (cos2SigmaM + B / 4 * (cosSigma * (-1 + 2 * cos2SigmaM * cos2SigmaM) - B / 6 * cos2SigmaM * (-3 + 4 * sinSigma * sinSigma) * (-3 + 4 * cos2SigmaM * cos2SigmaM)));
1341
- var distance = b * A * (sigma - deltaSigma);
1342
- return Math.round(distance / accuracy) * accuracy;
1343
- };
1344
- var _default$7 = getDistance2;
1345
- getPreciseDistance.default = _default$7;
1346
- var getRoughCompassDirection$1 = {};
1347
- Object.defineProperty(getRoughCompassDirection$1, "__esModule", { value: true });
1348
- getRoughCompassDirection$1.default = void 0;
1349
- var getRoughCompassDirection = function getRoughCompassDirection2(exact) {
1350
- if (/^(NNE|NE|NNW|N)$/.test(exact)) {
1351
- return "N";
1597
+ var isPointInLine = {};
1598
+ var hasRequiredIsPointInLine;
1599
+ function requireIsPointInLine() {
1600
+ if (hasRequiredIsPointInLine) return isPointInLine;
1601
+ hasRequiredIsPointInLine = 1;
1602
+ Object.defineProperty(isPointInLine, "__esModule", { value: true });
1603
+ isPointInLine.default = void 0;
1604
+ var _getDistance = _interopRequireDefault(requireGetDistance());
1605
+ function _interopRequireDefault(obj) {
1606
+ return obj && obj.__esModule ? obj : { default: obj };
1352
1607
  }
1353
- if (/^(ENE|E|ESE|SE)$/.test(exact)) {
1354
- return "E";
1608
+ var isPointInLine$1 = function isPointInLine2(point, lineStart, lineEnd) {
1609
+ return (0, _getDistance.default)(lineStart, point) + (0, _getDistance.default)(point, lineEnd) === (0, _getDistance.default)(lineStart, lineEnd);
1610
+ };
1611
+ var _default = isPointInLine$1;
1612
+ isPointInLine.default = _default;
1613
+ return isPointInLine;
1614
+ }
1615
+ var isPointInPolygon = {};
1616
+ var hasRequiredIsPointInPolygon;
1617
+ function requireIsPointInPolygon() {
1618
+ if (hasRequiredIsPointInPolygon) return isPointInPolygon;
1619
+ hasRequiredIsPointInPolygon = 1;
1620
+ Object.defineProperty(isPointInPolygon, "__esModule", { value: true });
1621
+ isPointInPolygon.default = void 0;
1622
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1623
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1624
+ function _interopRequireDefault(obj) {
1625
+ return obj && obj.__esModule ? obj : { default: obj };
1355
1626
  }
1356
- if (/^(SSE|S|SSW|SW)$/.test(exact)) {
1357
- return "S";
1627
+ var isPointInPolygon$1 = function isPointInPolygon2(point, polygon) {
1628
+ var isInside = false;
1629
+ var totalPolys = polygon.length;
1630
+ for (var i = -1, j = totalPolys - 1; ++i < totalPolys; j = i) {
1631
+ if (((0, _getLongitude.default)(polygon[i]) <= (0, _getLongitude.default)(point) && (0, _getLongitude.default)(point) < (0, _getLongitude.default)(polygon[j]) || (0, _getLongitude.default)(polygon[j]) <= (0, _getLongitude.default)(point) && (0, _getLongitude.default)(point) < (0, _getLongitude.default)(polygon[i])) && (0, _getLatitude.default)(point) < ((0, _getLatitude.default)(polygon[j]) - (0, _getLatitude.default)(polygon[i])) * ((0, _getLongitude.default)(point) - (0, _getLongitude.default)(polygon[i])) / ((0, _getLongitude.default)(polygon[j]) - (0, _getLongitude.default)(polygon[i])) + (0, _getLatitude.default)(polygon[i])) {
1632
+ isInside = !isInside;
1633
+ }
1634
+ }
1635
+ return isInside;
1636
+ };
1637
+ var _default = isPointInPolygon$1;
1638
+ isPointInPolygon.default = _default;
1639
+ return isPointInPolygon;
1640
+ }
1641
+ var isPointNearLine = {};
1642
+ var hasRequiredIsPointNearLine;
1643
+ function requireIsPointNearLine() {
1644
+ if (hasRequiredIsPointNearLine) return isPointNearLine;
1645
+ hasRequiredIsPointNearLine = 1;
1646
+ Object.defineProperty(isPointNearLine, "__esModule", { value: true });
1647
+ isPointNearLine.default = void 0;
1648
+ var _getDistanceFromLine = _interopRequireDefault(requireGetDistanceFromLine());
1649
+ function _interopRequireDefault(obj) {
1650
+ return obj && obj.__esModule ? obj : { default: obj };
1358
1651
  }
1359
- if (/^(WSW|W|WNW|NW)$/.test(exact)) {
1360
- return "W";
1652
+ var isPointNearLine$1 = function isPointNearLine2(point, start, end, distance) {
1653
+ return (0, _getDistanceFromLine.default)(point, start, end) < distance;
1654
+ };
1655
+ var _default = isPointNearLine$1;
1656
+ isPointNearLine.default = _default;
1657
+ return isPointNearLine;
1658
+ }
1659
+ var isPointWithinRadius = {};
1660
+ var hasRequiredIsPointWithinRadius;
1661
+ function requireIsPointWithinRadius() {
1662
+ if (hasRequiredIsPointWithinRadius) return isPointWithinRadius;
1663
+ hasRequiredIsPointWithinRadius = 1;
1664
+ Object.defineProperty(isPointWithinRadius, "__esModule", { value: true });
1665
+ isPointWithinRadius.default = void 0;
1666
+ var _getDistance = _interopRequireDefault(requireGetDistance());
1667
+ function _interopRequireDefault(obj) {
1668
+ return obj && obj.__esModule ? obj : { default: obj };
1361
1669
  }
1362
- };
1363
- var _default$6 = getRoughCompassDirection;
1364
- getRoughCompassDirection$1.default = _default$6;
1365
- var getSpeed$1 = {};
1366
- Object.defineProperty(getSpeed$1, "__esModule", { value: true });
1367
- getSpeed$1.default = void 0;
1368
- var _getDistance$2 = _interopRequireDefault$4(getDistance$2);
1369
- function _interopRequireDefault$4(obj) {
1370
- return obj && obj.__esModule ? obj : { default: obj };
1371
- }
1372
- var getSpeed = function getSpeed2(start, end) {
1373
- var distanceFn = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _getDistance$2.default;
1374
- var distance = distanceFn(start, end);
1375
- var time = Number(end.time) - Number(start.time);
1376
- var metersPerSecond = distance / time * 1e3;
1377
- return metersPerSecond;
1378
- };
1379
- var _default$5 = getSpeed;
1380
- getSpeed$1.default = _default$5;
1381
- var isPointInLine$1 = {};
1382
- Object.defineProperty(isPointInLine$1, "__esModule", { value: true });
1383
- isPointInLine$1.default = void 0;
1384
- var _getDistance$1 = _interopRequireDefault$3(getDistance$2);
1385
- function _interopRequireDefault$3(obj) {
1386
- return obj && obj.__esModule ? obj : { default: obj };
1387
- }
1388
- var isPointInLine = function isPointInLine2(point, lineStart, lineEnd) {
1389
- return (0, _getDistance$1.default)(lineStart, point) + (0, _getDistance$1.default)(point, lineEnd) === (0, _getDistance$1.default)(lineStart, lineEnd);
1390
- };
1391
- var _default$4 = isPointInLine;
1392
- isPointInLine$1.default = _default$4;
1393
- var isPointInPolygon$1 = {};
1394
- Object.defineProperty(isPointInPolygon$1, "__esModule", { value: true });
1395
- isPointInPolygon$1.default = void 0;
1396
- var _getLatitude = _interopRequireDefault$2(getLatitude$1);
1397
- var _getLongitude = _interopRequireDefault$2(getLongitude$1);
1398
- function _interopRequireDefault$2(obj) {
1399
- return obj && obj.__esModule ? obj : { default: obj };
1400
- }
1401
- var isPointInPolygon = function isPointInPolygon2(point, polygon) {
1402
- var isInside = false;
1403
- var totalPolys = polygon.length;
1404
- for (var i = -1, j = totalPolys - 1; ++i < totalPolys; j = i) {
1405
- if (((0, _getLongitude.default)(polygon[i]) <= (0, _getLongitude.default)(point) && (0, _getLongitude.default)(point) < (0, _getLongitude.default)(polygon[j]) || (0, _getLongitude.default)(polygon[j]) <= (0, _getLongitude.default)(point) && (0, _getLongitude.default)(point) < (0, _getLongitude.default)(polygon[i])) && (0, _getLatitude.default)(point) < ((0, _getLatitude.default)(polygon[j]) - (0, _getLatitude.default)(polygon[i])) * ((0, _getLongitude.default)(point) - (0, _getLongitude.default)(polygon[i])) / ((0, _getLongitude.default)(polygon[j]) - (0, _getLongitude.default)(polygon[i])) + (0, _getLatitude.default)(polygon[i])) {
1406
- isInside = !isInside;
1407
- }
1408
- }
1409
- return isInside;
1410
- };
1411
- var _default$3 = isPointInPolygon;
1412
- isPointInPolygon$1.default = _default$3;
1413
- var isPointNearLine$1 = {};
1414
- Object.defineProperty(isPointNearLine$1, "__esModule", { value: true });
1415
- isPointNearLine$1.default = void 0;
1416
- var _getDistanceFromLine = _interopRequireDefault$1(getDistanceFromLine$1);
1417
- function _interopRequireDefault$1(obj) {
1418
- return obj && obj.__esModule ? obj : { default: obj };
1419
- }
1420
- var isPointNearLine = function isPointNearLine2(point, start, end, distance) {
1421
- return (0, _getDistanceFromLine.default)(point, start, end) < distance;
1422
- };
1423
- var _default$2 = isPointNearLine;
1424
- isPointNearLine$1.default = _default$2;
1425
- var isPointWithinRadius$1 = {};
1426
- Object.defineProperty(isPointWithinRadius$1, "__esModule", { value: true });
1427
- isPointWithinRadius$1.default = void 0;
1428
- var _getDistance = _interopRequireDefault(getDistance$2);
1429
- function _interopRequireDefault(obj) {
1430
- return obj && obj.__esModule ? obj : { default: obj };
1431
- }
1432
- var isPointWithinRadius = function isPointWithinRadius2(point, center, radius) {
1433
- var accuracy = 0.01;
1434
- return (0, _getDistance.default)(point, center, accuracy) < radius;
1435
- };
1436
- var _default$1 = isPointWithinRadius;
1437
- isPointWithinRadius$1.default = _default$1;
1438
- var wktToPolygon$1 = {};
1439
- Object.defineProperty(wktToPolygon$1, "__esModule", { value: true });
1440
- wktToPolygon$1.default = void 0;
1441
- function _slicedToArray(arr, i) {
1442
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
1443
- }
1444
- function _nonIterableRest() {
1445
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1446
- }
1447
- function _unsupportedIterableToArray(o, minLen) {
1448
- if (!o) return;
1449
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1450
- var n = Object.prototype.toString.call(o).slice(8, -1);
1451
- if (n === "Object" && o.constructor) n = o.constructor.name;
1452
- if (n === "Map" || n === "Set") return Array.from(o);
1453
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1454
- }
1455
- function _arrayLikeToArray(arr, len) {
1456
- if (len == null || len > arr.length) len = arr.length;
1457
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
1458
- arr2[i] = arr[i];
1459
- }
1460
- return arr2;
1461
- }
1462
- function _iterableToArrayLimit(arr, i) {
1463
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
1464
- var _arr = [];
1465
- var _n = true;
1466
- var _d = false;
1467
- var _e = void 0;
1468
- try {
1469
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1470
- _arr.push(_s.value);
1471
- if (i && _arr.length === i) break;
1472
- }
1473
- } catch (err) {
1474
- _d = true;
1475
- _e = err;
1476
- } finally {
1670
+ var isPointWithinRadius$1 = function isPointWithinRadius2(point, center, radius) {
1671
+ var accuracy = 0.01;
1672
+ return (0, _getDistance.default)(point, center, accuracy) < radius;
1673
+ };
1674
+ var _default = isPointWithinRadius$1;
1675
+ isPointWithinRadius.default = _default;
1676
+ return isPointWithinRadius;
1677
+ }
1678
+ var wktToPolygon = {};
1679
+ var hasRequiredWktToPolygon;
1680
+ function requireWktToPolygon() {
1681
+ if (hasRequiredWktToPolygon) return wktToPolygon;
1682
+ hasRequiredWktToPolygon = 1;
1683
+ Object.defineProperty(wktToPolygon, "__esModule", { value: true });
1684
+ wktToPolygon.default = void 0;
1685
+ function _slicedToArray(arr, i) {
1686
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
1687
+ }
1688
+ function _nonIterableRest() {
1689
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1690
+ }
1691
+ function _unsupportedIterableToArray(o, minLen) {
1692
+ if (!o) return;
1693
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
1694
+ var n = Object.prototype.toString.call(o).slice(8, -1);
1695
+ if (n === "Object" && o.constructor) n = o.constructor.name;
1696
+ if (n === "Map" || n === "Set") return Array.from(o);
1697
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
1698
+ }
1699
+ function _arrayLikeToArray(arr, len) {
1700
+ if (len == null || len > arr.length) len = arr.length;
1701
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
1702
+ arr2[i] = arr[i];
1703
+ }
1704
+ return arr2;
1705
+ }
1706
+ function _iterableToArrayLimit(arr, i) {
1707
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
1708
+ var _arr = [];
1709
+ var _n = true;
1710
+ var _d = false;
1711
+ var _e = void 0;
1477
1712
  try {
1478
- if (!_n && _i["return"] != null) _i["return"]();
1713
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
1714
+ _arr.push(_s.value);
1715
+ if (i && _arr.length === i) break;
1716
+ }
1717
+ } catch (err) {
1718
+ _d = true;
1719
+ _e = err;
1479
1720
  } finally {
1480
- if (_d) throw _e;
1721
+ try {
1722
+ if (!_n && _i["return"] != null) _i["return"]();
1723
+ } finally {
1724
+ if (_d) throw _e;
1725
+ }
1481
1726
  }
1727
+ return _arr;
1482
1728
  }
1483
- return _arr;
1484
- }
1485
- function _arrayWithHoles(arr) {
1486
- if (Array.isArray(arr)) return arr;
1487
- }
1488
- var wktToPolygon = function wktToPolygon2(wkt) {
1489
- if (!wkt.startsWith("POLYGON")) {
1490
- throw new Error("Invalid wkt.");
1729
+ function _arrayWithHoles(arr) {
1730
+ if (Array.isArray(arr)) return arr;
1491
1731
  }
1492
- var coordsText = wkt.slice(wkt.indexOf("(") + 2, wkt.indexOf(")")).split(", ");
1493
- var polygon = coordsText.map(function(coordText) {
1494
- var _coordText$split = coordText.split(" "), _coordText$split2 = _slicedToArray(_coordText$split, 2), longitude = _coordText$split2[0], latitude = _coordText$split2[1];
1495
- return { longitude: parseFloat(longitude), latitude: parseFloat(latitude) };
1496
- });
1497
- return polygon;
1498
- };
1499
- var _default = wktToPolygon;
1500
- wktToPolygon$1.default = _default;
1501
- (function(exports$1) {
1502
- Object.defineProperty(exports$1, "__esModule", { value: true });
1503
- var _exportNames = { computeDestinationPoint: true, convertArea: true, convertDistance: true, convertSpeed: true, decimalToSexagesimal: true, findNearest: true, getAreaOfPolygon: true, getBounds: true, getBoundsOfDistance: true, getCenter: true, getCenterOfBounds: true, getCompassDirection: true, getCoordinateKey: true, getCoordinateKeys: true, getDistance: true, getDistanceFromLine: true, getGreatCircleBearing: true, getLatitude: true, getLongitude: true, getPathLength: true, getPreciseDistance: true, getRhumbLineBearing: true, getRoughCompassDirection: true, getSpeed: true, isDecimal: true, isPointInLine: true, isPointInPolygon: true, isPointNearLine: true, isPointWithinRadius: true, isSexagesimal: true, isValidCoordinate: true, isValidLatitude: true, isValidLongitude: true, orderByDistance: true, sexagesimalToDecimal: true, toDecimal: true, toRad: true, toDeg: true, wktToPolygon: true };
1504
- Object.defineProperty(exports$1, "computeDestinationPoint", { enumerable: true, get: function get() {
1505
- return _computeDestinationPoint.default;
1506
- } });
1507
- Object.defineProperty(exports$1, "convertArea", { enumerable: true, get: function get() {
1508
- return _convertArea.default;
1509
- } });
1510
- Object.defineProperty(exports$1, "convertDistance", { enumerable: true, get: function get() {
1511
- return _convertDistance.default;
1512
- } });
1513
- Object.defineProperty(exports$1, "convertSpeed", { enumerable: true, get: function get() {
1514
- return _convertSpeed.default;
1515
- } });
1516
- Object.defineProperty(exports$1, "decimalToSexagesimal", { enumerable: true, get: function get() {
1517
- return _decimalToSexagesimal.default;
1518
- } });
1519
- Object.defineProperty(exports$1, "findNearest", { enumerable: true, get: function get() {
1520
- return _findNearest.default;
1521
- } });
1522
- Object.defineProperty(exports$1, "getAreaOfPolygon", { enumerable: true, get: function get() {
1523
- return _getAreaOfPolygon.default;
1524
- } });
1525
- Object.defineProperty(exports$1, "getBounds", { enumerable: true, get: function get() {
1526
- return _getBounds2.default;
1527
- } });
1528
- Object.defineProperty(exports$1, "getBoundsOfDistance", { enumerable: true, get: function get() {
1529
- return _getBoundsOfDistance.default;
1530
- } });
1531
- Object.defineProperty(exports$1, "getCenter", { enumerable: true, get: function get() {
1532
- return _getCenter.default;
1533
- } });
1534
- Object.defineProperty(exports$1, "getCenterOfBounds", { enumerable: true, get: function get() {
1535
- return _getCenterOfBounds.default;
1536
- } });
1537
- Object.defineProperty(exports$1, "getCompassDirection", { enumerable: true, get: function get() {
1538
- return _getCompassDirection.default;
1539
- } });
1540
- Object.defineProperty(exports$1, "getCoordinateKey", { enumerable: true, get: function get() {
1541
- return _getCoordinateKey2.default;
1542
- } });
1543
- Object.defineProperty(exports$1, "getCoordinateKeys", { enumerable: true, get: function get() {
1544
- return _getCoordinateKeys3.default;
1545
- } });
1546
- Object.defineProperty(exports$1, "getDistance", { enumerable: true, get: function get() {
1547
- return _getDistance2.default;
1548
- } });
1549
- Object.defineProperty(exports$1, "getDistanceFromLine", { enumerable: true, get: function get() {
1550
- return _getDistanceFromLine2.default;
1551
- } });
1552
- Object.defineProperty(exports$1, "getGreatCircleBearing", { enumerable: true, get: function get() {
1553
- return _getGreatCircleBearing.default;
1554
- } });
1555
- Object.defineProperty(exports$1, "getLatitude", { enumerable: true, get: function get() {
1556
- return _getLatitude2.default;
1557
- } });
1558
- Object.defineProperty(exports$1, "getLongitude", { enumerable: true, get: function get() {
1559
- return _getLongitude2.default;
1560
- } });
1561
- Object.defineProperty(exports$1, "getPathLength", { enumerable: true, get: function get() {
1562
- return _getPathLength.default;
1563
- } });
1564
- Object.defineProperty(exports$1, "getPreciseDistance", { enumerable: true, get: function get() {
1565
- return _getPreciseDistance.default;
1566
- } });
1567
- Object.defineProperty(exports$1, "getRhumbLineBearing", { enumerable: true, get: function get() {
1568
- return _getRhumbLineBearing2.default;
1569
- } });
1570
- Object.defineProperty(exports$1, "getRoughCompassDirection", { enumerable: true, get: function get() {
1571
- return _getRoughCompassDirection.default;
1572
- } });
1573
- Object.defineProperty(exports$1, "getSpeed", { enumerable: true, get: function get() {
1574
- return _getSpeed.default;
1575
- } });
1576
- Object.defineProperty(exports$1, "isDecimal", { enumerable: true, get: function get() {
1577
- return _isDecimal2.default;
1578
- } });
1579
- Object.defineProperty(exports$1, "isPointInLine", { enumerable: true, get: function get() {
1580
- return _isPointInLine.default;
1581
- } });
1582
- Object.defineProperty(exports$1, "isPointInPolygon", { enumerable: true, get: function get() {
1583
- return _isPointInPolygon.default;
1584
- } });
1585
- Object.defineProperty(exports$1, "isPointNearLine", { enumerable: true, get: function get() {
1586
- return _isPointNearLine.default;
1587
- } });
1588
- Object.defineProperty(exports$1, "isPointWithinRadius", { enumerable: true, get: function get() {
1589
- return _isPointWithinRadius.default;
1590
- } });
1591
- Object.defineProperty(exports$1, "isSexagesimal", { enumerable: true, get: function get() {
1592
- return _isSexagesimal2.default;
1593
- } });
1594
- Object.defineProperty(exports$1, "isValidCoordinate", { enumerable: true, get: function get() {
1595
- return _isValidCoordinate2.default;
1596
- } });
1597
- Object.defineProperty(exports$1, "isValidLatitude", { enumerable: true, get: function get() {
1598
- return _isValidLatitude2.default;
1599
- } });
1600
- Object.defineProperty(exports$1, "isValidLongitude", { enumerable: true, get: function get() {
1601
- return _isValidLongitude2.default;
1602
- } });
1603
- Object.defineProperty(exports$1, "orderByDistance", { enumerable: true, get: function get() {
1604
- return _orderByDistance2.default;
1605
- } });
1606
- Object.defineProperty(exports$1, "sexagesimalToDecimal", { enumerable: true, get: function get() {
1607
- return _sexagesimalToDecimal2.default;
1608
- } });
1609
- Object.defineProperty(exports$1, "toDecimal", { enumerable: true, get: function get() {
1610
- return _toDecimal2.default;
1611
- } });
1612
- Object.defineProperty(exports$1, "toRad", { enumerable: true, get: function get() {
1613
- return _toRad2.default;
1614
- } });
1615
- Object.defineProperty(exports$1, "toDeg", { enumerable: true, get: function get() {
1616
- return _toDeg2.default;
1617
- } });
1618
- Object.defineProperty(exports$1, "wktToPolygon", { enumerable: true, get: function get() {
1619
- return _wktToPolygon.default;
1620
- } });
1621
- var _computeDestinationPoint = _interopRequireDefault2(computeDestinationPoint$1);
1622
- var _convertArea = _interopRequireDefault2(convertArea$1);
1623
- var _convertDistance = _interopRequireDefault2(convertDistance$1);
1624
- var _convertSpeed = _interopRequireDefault2(convertSpeed$1);
1625
- var _decimalToSexagesimal = _interopRequireDefault2(decimalToSexagesimal);
1626
- var _findNearest = _interopRequireDefault2(findNearest$1);
1627
- var _getAreaOfPolygon = _interopRequireDefault2(getAreaOfPolygon$1);
1628
- var _getBounds2 = _interopRequireDefault2(getBounds$1);
1629
- var _getBoundsOfDistance = _interopRequireDefault2(getBoundsOfDistance$1);
1630
- var _getCenter = _interopRequireDefault2(getCenter$1);
1631
- var _getCenterOfBounds = _interopRequireDefault2(getCenterOfBounds$1);
1632
- var _getCompassDirection = _interopRequireDefault2(getCompassDirection$1);
1633
- var _getCoordinateKey2 = _interopRequireDefault2(getCoordinateKey$1);
1634
- var _getCoordinateKeys3 = _interopRequireDefault2(getCoordinateKeys$1);
1635
- var _getDistance2 = _interopRequireDefault2(getDistance$2);
1636
- var _getDistanceFromLine2 = _interopRequireDefault2(getDistanceFromLine$1);
1637
- var _getGreatCircleBearing = _interopRequireDefault2(getGreatCircleBearing$1);
1638
- var _getLatitude2 = _interopRequireDefault2(getLatitude$1);
1639
- var _getLongitude2 = _interopRequireDefault2(getLongitude$1);
1640
- var _getPathLength = _interopRequireDefault2(getPathLength$1);
1641
- var _getPreciseDistance = _interopRequireDefault2(getPreciseDistance);
1642
- var _getRhumbLineBearing2 = _interopRequireDefault2(getRhumbLineBearing$1);
1643
- var _getRoughCompassDirection = _interopRequireDefault2(getRoughCompassDirection$1);
1644
- var _getSpeed = _interopRequireDefault2(getSpeed$1);
1645
- var _isDecimal2 = _interopRequireDefault2(isDecimal$1);
1646
- var _isPointInLine = _interopRequireDefault2(isPointInLine$1);
1647
- var _isPointInPolygon = _interopRequireDefault2(isPointInPolygon$1);
1648
- var _isPointNearLine = _interopRequireDefault2(isPointNearLine$1);
1649
- var _isPointWithinRadius = _interopRequireDefault2(isPointWithinRadius$1);
1650
- var _isSexagesimal2 = _interopRequireDefault2(isSexagesimal$1);
1651
- var _isValidCoordinate2 = _interopRequireDefault2(isValidCoordinate$1);
1652
- var _isValidLatitude2 = _interopRequireDefault2(isValidLatitude$1);
1653
- var _isValidLongitude2 = _interopRequireDefault2(isValidLongitude$1);
1654
- var _orderByDistance2 = _interopRequireDefault2(orderByDistance$1);
1655
- var _sexagesimalToDecimal2 = _interopRequireDefault2(sexagesimalToDecimal$1);
1656
- var _toDecimal2 = _interopRequireDefault2(toDecimal$1);
1657
- var _toRad2 = _interopRequireDefault2(toRad$1);
1658
- var _toDeg2 = _interopRequireDefault2(toDeg$1);
1659
- var _wktToPolygon = _interopRequireDefault2(wktToPolygon$1);
1660
- var _constants2 = constants;
1661
- Object.keys(_constants2).forEach(function(key) {
1662
- if (key === "default" || key === "__esModule") return;
1663
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
1664
- Object.defineProperty(exports$1, key, { enumerable: true, get: function get() {
1665
- return _constants2[key];
1732
+ var wktToPolygon$1 = function wktToPolygon2(wkt) {
1733
+ if (!wkt.startsWith("POLYGON")) {
1734
+ throw new Error("Invalid wkt.");
1735
+ }
1736
+ var coordsText = wkt.slice(wkt.indexOf("(") + 2, wkt.indexOf(")")).split(", ");
1737
+ var polygon = coordsText.map(function(coordText) {
1738
+ var _coordText$split = coordText.split(" "), _coordText$split2 = _slicedToArray(_coordText$split, 2), longitude = _coordText$split2[0], latitude = _coordText$split2[1];
1739
+ return { longitude: parseFloat(longitude), latitude: parseFloat(latitude) };
1740
+ });
1741
+ return polygon;
1742
+ };
1743
+ var _default = wktToPolygon$1;
1744
+ wktToPolygon.default = _default;
1745
+ return wktToPolygon;
1746
+ }
1747
+ var hasRequiredEs;
1748
+ function requireEs() {
1749
+ if (hasRequiredEs) return es;
1750
+ hasRequiredEs = 1;
1751
+ (function(exports$1) {
1752
+ Object.defineProperty(exports$1, "__esModule", { value: true });
1753
+ var _exportNames = { computeDestinationPoint: true, convertArea: true, convertDistance: true, convertSpeed: true, decimalToSexagesimal: true, findNearest: true, getAreaOfPolygon: true, getBounds: true, getBoundsOfDistance: true, getCenter: true, getCenterOfBounds: true, getCompassDirection: true, getCoordinateKey: true, getCoordinateKeys: true, getDistance: true, getDistanceFromLine: true, getGreatCircleBearing: true, getLatitude: true, getLongitude: true, getPathLength: true, getPreciseDistance: true, getRhumbLineBearing: true, getRoughCompassDirection: true, getSpeed: true, isDecimal: true, isPointInLine: true, isPointInPolygon: true, isPointNearLine: true, isPointWithinRadius: true, isSexagesimal: true, isValidCoordinate: true, isValidLatitude: true, isValidLongitude: true, orderByDistance: true, sexagesimalToDecimal: true, toDecimal: true, toRad: true, toDeg: true, wktToPolygon: true };
1754
+ Object.defineProperty(exports$1, "computeDestinationPoint", { enumerable: true, get: function get() {
1755
+ return _computeDestinationPoint.default;
1666
1756
  } });
1667
- });
1668
- function _interopRequireDefault2(obj) {
1669
- return obj && obj.__esModule ? obj : { default: obj };
1670
- }
1671
- })(es);
1757
+ Object.defineProperty(exports$1, "convertArea", { enumerable: true, get: function get() {
1758
+ return _convertArea.default;
1759
+ } });
1760
+ Object.defineProperty(exports$1, "convertDistance", { enumerable: true, get: function get() {
1761
+ return _convertDistance.default;
1762
+ } });
1763
+ Object.defineProperty(exports$1, "convertSpeed", { enumerable: true, get: function get() {
1764
+ return _convertSpeed.default;
1765
+ } });
1766
+ Object.defineProperty(exports$1, "decimalToSexagesimal", { enumerable: true, get: function get() {
1767
+ return _decimalToSexagesimal.default;
1768
+ } });
1769
+ Object.defineProperty(exports$1, "findNearest", { enumerable: true, get: function get() {
1770
+ return _findNearest.default;
1771
+ } });
1772
+ Object.defineProperty(exports$1, "getAreaOfPolygon", { enumerable: true, get: function get() {
1773
+ return _getAreaOfPolygon.default;
1774
+ } });
1775
+ Object.defineProperty(exports$1, "getBounds", { enumerable: true, get: function get() {
1776
+ return _getBounds.default;
1777
+ } });
1778
+ Object.defineProperty(exports$1, "getBoundsOfDistance", { enumerable: true, get: function get() {
1779
+ return _getBoundsOfDistance.default;
1780
+ } });
1781
+ Object.defineProperty(exports$1, "getCenter", { enumerable: true, get: function get() {
1782
+ return _getCenter.default;
1783
+ } });
1784
+ Object.defineProperty(exports$1, "getCenterOfBounds", { enumerable: true, get: function get() {
1785
+ return _getCenterOfBounds.default;
1786
+ } });
1787
+ Object.defineProperty(exports$1, "getCompassDirection", { enumerable: true, get: function get() {
1788
+ return _getCompassDirection.default;
1789
+ } });
1790
+ Object.defineProperty(exports$1, "getCoordinateKey", { enumerable: true, get: function get() {
1791
+ return _getCoordinateKey.default;
1792
+ } });
1793
+ Object.defineProperty(exports$1, "getCoordinateKeys", { enumerable: true, get: function get() {
1794
+ return _getCoordinateKeys.default;
1795
+ } });
1796
+ Object.defineProperty(exports$1, "getDistance", { enumerable: true, get: function get() {
1797
+ return _getDistance.default;
1798
+ } });
1799
+ Object.defineProperty(exports$1, "getDistanceFromLine", { enumerable: true, get: function get() {
1800
+ return _getDistanceFromLine.default;
1801
+ } });
1802
+ Object.defineProperty(exports$1, "getGreatCircleBearing", { enumerable: true, get: function get() {
1803
+ return _getGreatCircleBearing.default;
1804
+ } });
1805
+ Object.defineProperty(exports$1, "getLatitude", { enumerable: true, get: function get() {
1806
+ return _getLatitude.default;
1807
+ } });
1808
+ Object.defineProperty(exports$1, "getLongitude", { enumerable: true, get: function get() {
1809
+ return _getLongitude.default;
1810
+ } });
1811
+ Object.defineProperty(exports$1, "getPathLength", { enumerable: true, get: function get() {
1812
+ return _getPathLength.default;
1813
+ } });
1814
+ Object.defineProperty(exports$1, "getPreciseDistance", { enumerable: true, get: function get() {
1815
+ return _getPreciseDistance.default;
1816
+ } });
1817
+ Object.defineProperty(exports$1, "getRhumbLineBearing", { enumerable: true, get: function get() {
1818
+ return _getRhumbLineBearing.default;
1819
+ } });
1820
+ Object.defineProperty(exports$1, "getRoughCompassDirection", { enumerable: true, get: function get() {
1821
+ return _getRoughCompassDirection.default;
1822
+ } });
1823
+ Object.defineProperty(exports$1, "getSpeed", { enumerable: true, get: function get() {
1824
+ return _getSpeed.default;
1825
+ } });
1826
+ Object.defineProperty(exports$1, "isDecimal", { enumerable: true, get: function get() {
1827
+ return _isDecimal.default;
1828
+ } });
1829
+ Object.defineProperty(exports$1, "isPointInLine", { enumerable: true, get: function get() {
1830
+ return _isPointInLine.default;
1831
+ } });
1832
+ Object.defineProperty(exports$1, "isPointInPolygon", { enumerable: true, get: function get() {
1833
+ return _isPointInPolygon.default;
1834
+ } });
1835
+ Object.defineProperty(exports$1, "isPointNearLine", { enumerable: true, get: function get() {
1836
+ return _isPointNearLine.default;
1837
+ } });
1838
+ Object.defineProperty(exports$1, "isPointWithinRadius", { enumerable: true, get: function get() {
1839
+ return _isPointWithinRadius.default;
1840
+ } });
1841
+ Object.defineProperty(exports$1, "isSexagesimal", { enumerable: true, get: function get() {
1842
+ return _isSexagesimal.default;
1843
+ } });
1844
+ Object.defineProperty(exports$1, "isValidCoordinate", { enumerable: true, get: function get() {
1845
+ return _isValidCoordinate.default;
1846
+ } });
1847
+ Object.defineProperty(exports$1, "isValidLatitude", { enumerable: true, get: function get() {
1848
+ return _isValidLatitude.default;
1849
+ } });
1850
+ Object.defineProperty(exports$1, "isValidLongitude", { enumerable: true, get: function get() {
1851
+ return _isValidLongitude.default;
1852
+ } });
1853
+ Object.defineProperty(exports$1, "orderByDistance", { enumerable: true, get: function get() {
1854
+ return _orderByDistance.default;
1855
+ } });
1856
+ Object.defineProperty(exports$1, "sexagesimalToDecimal", { enumerable: true, get: function get() {
1857
+ return _sexagesimalToDecimal.default;
1858
+ } });
1859
+ Object.defineProperty(exports$1, "toDecimal", { enumerable: true, get: function get() {
1860
+ return _toDecimal.default;
1861
+ } });
1862
+ Object.defineProperty(exports$1, "toRad", { enumerable: true, get: function get() {
1863
+ return _toRad.default;
1864
+ } });
1865
+ Object.defineProperty(exports$1, "toDeg", { enumerable: true, get: function get() {
1866
+ return _toDeg.default;
1867
+ } });
1868
+ Object.defineProperty(exports$1, "wktToPolygon", { enumerable: true, get: function get() {
1869
+ return _wktToPolygon.default;
1870
+ } });
1871
+ var _computeDestinationPoint = _interopRequireDefault(requireComputeDestinationPoint());
1872
+ var _convertArea = _interopRequireDefault(requireConvertArea());
1873
+ var _convertDistance = _interopRequireDefault(requireConvertDistance());
1874
+ var _convertSpeed = _interopRequireDefault(requireConvertSpeed());
1875
+ var _decimalToSexagesimal = _interopRequireDefault(requireDecimalToSexagesimal());
1876
+ var _findNearest = _interopRequireDefault(requireFindNearest());
1877
+ var _getAreaOfPolygon = _interopRequireDefault(requireGetAreaOfPolygon());
1878
+ var _getBounds = _interopRequireDefault(requireGetBounds());
1879
+ var _getBoundsOfDistance = _interopRequireDefault(requireGetBoundsOfDistance());
1880
+ var _getCenter = _interopRequireDefault(requireGetCenter());
1881
+ var _getCenterOfBounds = _interopRequireDefault(requireGetCenterOfBounds());
1882
+ var _getCompassDirection = _interopRequireDefault(requireGetCompassDirection());
1883
+ var _getCoordinateKey = _interopRequireDefault(requireGetCoordinateKey());
1884
+ var _getCoordinateKeys = _interopRequireDefault(requireGetCoordinateKeys());
1885
+ var _getDistance = _interopRequireDefault(requireGetDistance());
1886
+ var _getDistanceFromLine = _interopRequireDefault(requireGetDistanceFromLine());
1887
+ var _getGreatCircleBearing = _interopRequireDefault(requireGetGreatCircleBearing());
1888
+ var _getLatitude = _interopRequireDefault(requireGetLatitude());
1889
+ var _getLongitude = _interopRequireDefault(requireGetLongitude());
1890
+ var _getPathLength = _interopRequireDefault(requireGetPathLength());
1891
+ var _getPreciseDistance = _interopRequireDefault(requireGetPreciseDistance());
1892
+ var _getRhumbLineBearing = _interopRequireDefault(requireGetRhumbLineBearing());
1893
+ var _getRoughCompassDirection = _interopRequireDefault(requireGetRoughCompassDirection());
1894
+ var _getSpeed = _interopRequireDefault(requireGetSpeed());
1895
+ var _isDecimal = _interopRequireDefault(requireIsDecimal());
1896
+ var _isPointInLine = _interopRequireDefault(requireIsPointInLine());
1897
+ var _isPointInPolygon = _interopRequireDefault(requireIsPointInPolygon());
1898
+ var _isPointNearLine = _interopRequireDefault(requireIsPointNearLine());
1899
+ var _isPointWithinRadius = _interopRequireDefault(requireIsPointWithinRadius());
1900
+ var _isSexagesimal = _interopRequireDefault(requireIsSexagesimal());
1901
+ var _isValidCoordinate = _interopRequireDefault(requireIsValidCoordinate());
1902
+ var _isValidLatitude = _interopRequireDefault(requireIsValidLatitude());
1903
+ var _isValidLongitude = _interopRequireDefault(requireIsValidLongitude());
1904
+ var _orderByDistance = _interopRequireDefault(requireOrderByDistance());
1905
+ var _sexagesimalToDecimal = _interopRequireDefault(requireSexagesimalToDecimal());
1906
+ var _toDecimal = _interopRequireDefault(requireToDecimal());
1907
+ var _toRad = _interopRequireDefault(requireToRad());
1908
+ var _toDeg = _interopRequireDefault(requireToDeg());
1909
+ var _wktToPolygon = _interopRequireDefault(requireWktToPolygon());
1910
+ var _constants = requireConstants();
1911
+ Object.keys(_constants).forEach(function(key) {
1912
+ if (key === "default" || key === "__esModule") return;
1913
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
1914
+ Object.defineProperty(exports$1, key, { enumerable: true, get: function get() {
1915
+ return _constants[key];
1916
+ } });
1917
+ });
1918
+ function _interopRequireDefault(obj) {
1919
+ return obj && obj.__esModule ? obj : { default: obj };
1920
+ }
1921
+ })(es);
1922
+ return es;
1923
+ }
1924
+ var esExports = requireEs();
1672
1925
  const vs = `#version 300 es
1673
1926
  #define SHADER_NAME "arrow-layer-vertex-shader"
1674
1927
 
@@ -1899,7 +2152,7 @@ void main(void ) {
1899
2152
  }
1900
2153
  }
1901
2154
  `;
1902
- const fs = '#version 300 es\n#define SHADER_NAME "arrow-layer-fragment-shader"\nprecision highp float;\n\n/**\n * Copyright (c) 2022, RTE (http://www.rte-france.com)\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nflat in vec4 vFillColor;\nflat in float shouldDiscard;\nout vec4 fragmentColor;\n\nvoid main(void) {\n if (shouldDiscard > 0.0) {\n discard;\n }\n fragmentColor = vFillColor;\n}\n';
2155
+ const fs = '#version 300 es\n#define SHADER_NAME "arrow-layer-fragment-shader"\nprecision highp float;\n\n/**\n * Copyright (c) 2022, RTE (http://www.rte-france.com)\n * This Source Code Form is subject to the terms of the Mozilla Public\n * License, v. 2.0. If a copy of the MPL was not distributed with this\n * file, You can obtain one at http://mozilla.org/MPL/2.0/.\n */\n\nflat in vec4 vFillColor;\nflat in float shouldDiscard;\nout vec4 fragmentColor;\n\nvoid main(void ) {\n if (shouldDiscard > 0.0) {\n discard;\n }\n fragmentColor = vFillColor;\n}\n';
1903
2156
  const DEFAULT_COLOR = [0, 0, 0, 255];
1904
2157
  const MAX_LINE_POINT_COUNT = 2 ** 15;
1905
2158
  var ArrowDirection = /* @__PURE__ */ ((ArrowDirection2) => {
@@ -2403,17 +2656,17 @@ class GeoData {
2403
2656
  const angle = this.getMapAngle(goodSegment.segment[0], goodSegment.segment[1]);
2404
2657
  const neededOffset = this.getLabelOffset(angle, 20, arrowDirection);
2405
2658
  const position = {
2406
- position: es.computeDestinationPoint(goodSegment.segment[0], remainingDistance, angle),
2659
+ position: esExports.computeDestinationPoint(goodSegment.segment[0], remainingDistance, angle),
2407
2660
  angle,
2408
2661
  offset: neededOffset
2409
2662
  };
2410
- position.position = es.computeDestinationPoint(
2663
+ position.position = esExports.computeDestinationPoint(
2411
2664
  position.position,
2412
2665
  distanceBetweenLines * lineParallelIndex,
2413
2666
  lineAngle + 90
2414
2667
  );
2415
2668
  if (cumulativeDistances.length === 2) {
2416
- position.position = es.computeDestinationPoint(
2669
+ position.position = esExports.computeDestinationPoint(
2417
2670
  position.position,
2418
2671
  -distanceBetweenLines * proximityFactor,
2419
2672
  lineAngle
@@ -2428,7 +2681,7 @@ class GeoData {
2428
2681
  labelDistanceInSegment = remainingDistance;
2429
2682
  }
2430
2683
  const labelPercentage = labelDistanceInSegment / segmentDistance;
2431
- position.position = es.computeDestinationPoint(
2684
+ position.position = esExports.computeDestinationPoint(
2432
2685
  position.position,
2433
2686
  distanceBetweenLines * labelPercentage,
2434
2687
  proximityAngle
@@ -2459,8 +2712,8 @@ class GeoData {
2459
2712
  }
2460
2713
  //returns the angle between point1 and point2 in degrees [0-360)
2461
2714
  getMapAngle(point1, point2) {
2462
- let angle = es.getRhumbLineBearing(point1, point2);
2463
- const angle2 = es.getGreatCircleBearing(point1, point2);
2715
+ let angle = esExports.getRhumbLineBearing(point1, point2);
2716
+ const angle2 = esExports.getGreatCircleBearing(point1, point2);
2464
2717
  const coeff = 0.1;
2465
2718
  angle = coeff * angle + (1 - coeff) * angle2;
2466
2719
  return angle;
@@ -2740,7 +2993,7 @@ function getLineLoadingZoneColor(zone) {
2740
2993
  } else if (zone === 3) {
2741
2994
  return [255, 0, 0];
2742
2995
  } else {
2743
- throw new Error("Unsupported line loading zone: " + zone);
2996
+ throw new Error(`Unsupported line loading zone: ${zone}`);
2744
2997
  }
2745
2998
  }
2746
2999
  function getLineColor(line, nominalVoltageColor, props, lineConnection) {
@@ -2977,7 +3230,7 @@ const _LineLayer = class _LineLayer extends core.CompositeLayer {
2977
3230
  (_a = compositeData2.lines) == null ? void 0 : _a.forEach((line) => {
2978
3231
  var _a2, _b;
2979
3232
  const lineStatus = linesStatus.get(line.id);
2980
- if (lineStatus !== void 0 && lineStatus.operatingStatus !== void 0 && lineStatus.operatingStatus !== "IN_OPERATION") {
3233
+ if ((lineStatus == null ? void 0 : lineStatus.operatingStatus) !== void 0 && lineStatus.operatingStatus !== "IN_OPERATION") {
2981
3234
  const lineData = (_a2 = compositeData2.lineMap) == null ? void 0 : _a2.get(line.id);
2982
3235
  const coordinatesIcon = props.geoData.labelDisplayPosition(
2983
3236
  // @ts-expect-error TODO: manage undefined case
@@ -3027,7 +3280,7 @@ const _LineLayer = class _LineLayer extends core.CompositeLayer {
3027
3280
  ];
3028
3281
  }
3029
3282
  const directLinePositions = props.geoData.getLinePositions(props.network, line, false);
3030
- const directLineDistance = es.getDistance(
3283
+ const directLineDistance = esExports.getDistance(
3031
3284
  {
3032
3285
  latitude: directLinePositions[0][1],
3033
3286
  longitude: directLinePositions[0][0]
@@ -3123,7 +3376,7 @@ const _LineLayer = class _LineLayer extends core.CompositeLayer {
3123
3376
  );
3124
3377
  }
3125
3378
  getProximityFactor(firstPosition, secondPosition) {
3126
- let factor = es.getDistance(firstPosition, secondPosition) / (3 * this.props.distanceBetweenLines);
3379
+ let factor = esExports.getDistance(firstPosition, secondPosition) / (3 * this.props.distanceBetweenLines);
3127
3380
  if (factor > 1) {
3128
3381
  factor = 1;
3129
3382
  }
@@ -3318,7 +3571,7 @@ const _LineLayer = class _LineLayer extends core.CompositeLayer {
3318
3571
  // @ts-expect-error TODO: manage undefined case
3319
3572
  getProximityFactor: (line) => line.proximityFactorEnd,
3320
3573
  // @ts-expect-error TODO: manage undefined case
3321
- getLineParallelIndex: (line) => -line.parallelIndex,
3574
+ getLineParallelIndex: (line) => -1 * line.parallelIndex,
3322
3575
  // @ts-expect-error TODO: manage undefined case
3323
3576
  getLineAngle: (line) => line.angleEnd + Math.PI,
3324
3577
  getDistanceBetweenLines: this.props.distanceBetweenLines,