@opengeoweb/store 7.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/README.md +0 -0
  2. package/index.esm.d.ts +0 -0
  3. package/index.esm.js +1408 -915
  4. package/package.json +5 -4
  5. package/src/index.d.ts +0 -0
  6. package/src/store/app/config.d.ts +0 -0
  7. package/src/store/app/index.d.ts +0 -0
  8. package/src/store/app/reducer.d.ts +0 -0
  9. package/src/store/app/reducer.spec.d.ts +0 -0
  10. package/src/store/app/types.d.ts +0 -0
  11. package/src/store/coreModuleConfig.d.ts +1 -1
  12. package/src/store/drawingtool/config.d.ts +0 -0
  13. package/src/store/drawingtool/index.d.ts +3 -1
  14. package/src/store/drawingtool/reducer.d.ts +10 -9
  15. package/src/store/drawingtool/reducer.spec.d.ts +3 -2
  16. package/src/store/drawingtool/sagas.d.ts +0 -0
  17. package/src/store/drawingtool/sagas.spec.d.ts +0 -0
  18. package/src/store/drawingtool/selectors.d.ts +12 -2
  19. package/src/store/drawingtool/selectors.spec.d.ts +0 -0
  20. package/src/store/drawingtool/testUtils.d.ts +0 -0
  21. package/src/store/drawingtool/utils.d.ts +3 -0
  22. package/src/store/{drawings/reducer.spec.d.ts → drawingtool/utils.spec.d.ts} +0 -0
  23. package/src/store/generic/actions.d.ts +0 -0
  24. package/src/store/generic/config.d.ts +0 -0
  25. package/src/store/generic/index.d.ts +0 -0
  26. package/src/store/generic/sagas.d.ts +0 -0
  27. package/src/store/generic/sagas.spec.d.ts +0 -0
  28. package/src/store/generic/selectors.d.ts +0 -0
  29. package/src/store/generic/selectors.spec.d.ts +0 -0
  30. package/src/store/generic/synchronizationActions/actions.d.ts +0 -0
  31. package/src/store/generic/synchronizationActions/types.d.ts +0 -0
  32. package/src/store/generic/synchronizationGroups/__mocks__/mockState.d.ts +0 -0
  33. package/src/store/generic/synchronizationGroups/constants.d.ts +0 -0
  34. package/src/store/generic/synchronizationGroups/index.d.ts +1 -1
  35. package/src/store/generic/synchronizationGroups/reducer.d.ts +0 -0
  36. package/src/store/generic/synchronizationGroups/reducer.spec.d.ts +0 -0
  37. package/src/store/generic/synchronizationGroups/sagas.d.ts +0 -0
  38. package/src/store/generic/synchronizationGroups/sagas.spec.d.ts +0 -0
  39. package/src/store/generic/synchronizationGroups/selector.d.ts +0 -0
  40. package/src/store/generic/synchronizationGroups/selectors.d.ts +0 -0
  41. package/src/store/generic/synchronizationGroups/selectors.spec.d.ts +0 -0
  42. package/src/store/generic/synchronizationGroups/types.d.ts +0 -0
  43. package/src/store/generic/synchronizationGroups/utils.d.ts +0 -0
  44. package/src/store/generic/synchronizationGroups/utils.spec.d.ts +0 -0
  45. package/src/store/generic/types.d.ts +0 -0
  46. package/src/store/generic/utils.d.ts +0 -0
  47. package/src/store/generic/utils.spec.d.ts +0 -0
  48. package/src/store/index.d.ts +1 -1
  49. package/src/store/layerSelect/config.d.ts +0 -0
  50. package/src/store/layerSelect/index.d.ts +0 -0
  51. package/src/store/layerSelect/localStorage.d.ts +0 -0
  52. package/src/store/layerSelect/localStorage.spec.d.ts +0 -0
  53. package/src/store/layerSelect/reducer.d.ts +0 -0
  54. package/src/store/layerSelect/reducer.spec.d.ts +0 -0
  55. package/src/store/layerSelect/sagas.d.ts +0 -0
  56. package/src/store/layerSelect/sagas.spec.d.ts +0 -0
  57. package/src/store/layerSelect/selectors.d.ts +0 -0
  58. package/src/store/layerSelect/selectors.spec.d.ts +0 -0
  59. package/src/store/layerSelect/types.d.ts +0 -0
  60. package/src/store/layerSelect/utils.d.ts +0 -0
  61. package/src/store/layerSelect/utils.spec.d.ts +0 -0
  62. package/src/store/mapStore/config.d.ts +0 -0
  63. package/src/store/mapStore/index.d.ts +0 -0
  64. package/src/store/mapStore/layers/index.d.ts +0 -0
  65. package/src/store/mapStore/layers/reducer.d.ts +0 -0
  66. package/src/store/mapStore/layers/reducer.spec.d.ts +0 -0
  67. package/src/store/mapStore/layers/selectors.d.ts +0 -0
  68. package/src/store/mapStore/layers/selectors.spec.d.ts +0 -0
  69. package/src/store/mapStore/layers/types.d.ts +0 -0
  70. package/src/store/mapStore/layers/utils.d.ts +0 -0
  71. package/src/store/mapStore/layers/utils.spec.d.ts +0 -0
  72. package/src/store/mapStore/map/actions.d.ts +0 -0
  73. package/src/store/mapStore/map/constants.d.ts +0 -0
  74. package/src/store/mapStore/map/enums.d.ts +0 -0
  75. package/src/store/mapStore/map/filterLayers.d.ts +0 -0
  76. package/src/store/mapStore/map/filterLayers.spec.d.ts +0 -0
  77. package/src/store/mapStore/map/index.d.ts +1 -0
  78. package/src/store/mapStore/map/reducer.d.ts +0 -0
  79. package/src/store/mapStore/map/reducer.spec.d.ts +0 -0
  80. package/src/store/mapStore/map/replaceLayerIdsToEnsureUniqueLayerIdsInStore.d.ts +0 -0
  81. package/src/store/mapStore/map/replaceLayerIdsToEnsureUniqueLayerIdsInStore.spec.d.ts +0 -0
  82. package/src/store/mapStore/map/sagas.d.ts +0 -0
  83. package/src/store/mapStore/map/sagas.spec.d.ts +0 -0
  84. package/src/store/mapStore/map/selectors.d.ts +11 -1
  85. package/src/store/mapStore/map/selectors.spec.d.ts +0 -0
  86. package/src/store/mapStore/map/types.d.ts +2 -0
  87. package/src/store/mapStore/map/utils.d.ts +1 -0
  88. package/src/store/mapStore/map/utils.spec.d.ts +0 -0
  89. package/src/store/mapStore/service/WMS111GetCapabilitiesGeoServicesRADAR.d.ts +0 -0
  90. package/src/store/mapStore/service/index.d.ts +0 -0
  91. package/src/store/mapStore/service/reducer.d.ts +0 -0
  92. package/src/store/mapStore/service/reducer.spec.d.ts +0 -0
  93. package/src/store/mapStore/service/sagas.d.ts +0 -0
  94. package/src/store/mapStore/service/sagas.spec.d.ts +0 -0
  95. package/src/store/mapStore/service/selectors.d.ts +0 -0
  96. package/src/store/mapStore/service/selectors.spec.d.ts +0 -0
  97. package/src/store/mapStore/service/types.d.ts +2 -1
  98. package/src/store/mapStore/storeTestSettings.d.ts +0 -0
  99. package/src/store/mapStore/storeTestUtils.d.ts +0 -0
  100. package/src/store/mapStore/types.d.ts +0 -0
  101. package/src/store/router/config.d.ts +0 -0
  102. package/src/store/router/index.d.ts +0 -0
  103. package/src/store/router/reducer.d.ts +0 -0
  104. package/src/store/router/reducer.spec.d.ts +0 -0
  105. package/src/store/router/sagas.d.ts +0 -0
  106. package/src/store/router/sagas.spec.d.ts +0 -0
  107. package/src/store/router/types.d.ts +0 -0
  108. package/src/store/router/utils.d.ts +0 -0
  109. package/src/store/snackbar/config.d.ts +0 -0
  110. package/src/store/snackbar/index.d.ts +0 -0
  111. package/src/store/snackbar/reducer.d.ts +0 -0
  112. package/src/store/snackbar/reducer.spec.d.ts +0 -0
  113. package/src/store/snackbar/sagas.d.ts +0 -0
  114. package/src/store/snackbar/sagas.spec.d.ts +0 -0
  115. package/src/store/snackbar/selectors.d.ts +0 -0
  116. package/src/store/snackbar/selectors.spec.d.ts +0 -0
  117. package/src/store/snackbar/types.d.ts +0 -0
  118. package/src/store/types.d.ts +1 -2
  119. package/src/store/ui/config.d.ts +0 -0
  120. package/src/store/ui/index.d.ts +0 -0
  121. package/src/store/ui/reducer.d.ts +0 -0
  122. package/src/store/ui/reducer.spec.d.ts +0 -0
  123. package/src/store/ui/sagas.d.ts +0 -0
  124. package/src/store/ui/sagas.test.d.ts +0 -0
  125. package/src/store/ui/selectors.d.ts +0 -0
  126. package/src/store/ui/selectors.spec.d.ts +0 -0
  127. package/src/store/ui/types.d.ts +1 -1
  128. package/src/store/utils.d.ts +0 -0
  129. package/src/store/drawings/config.d.ts +0 -4
  130. package/src/store/drawings/index.d.ts +0 -4
  131. package/src/store/drawings/reducer.d.ts +0 -9
  132. package/src/store/drawings/selectors.d.ts +0 -3
  133. package/src/store/drawings/selectors.spec.d.ts +0 -1
  134. package/src/store/drawings/testUtils.d.ts +0 -1
  135. package/src/store/drawings/types.d.ts +0 -21
package/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { webmapUtils, LayerType, webmapTestSettings, WMLayer, getCapabilities } from '@opengeoweb/webmap';
2
- import { defaultLayers } from '@opengeoweb/webmap-react';
2
+ import { defaultLayers, emptyGeoJSON, defaultGeoJSONStyleProperties } from '@opengeoweb/webmap-react';
3
3
  export { defaultLayers } from '@opengeoweb/webmap-react';
4
4
 
5
5
  function _iterableToArrayLimit(r, l) {
@@ -617,7 +617,7 @@ function miniKindOf(val) {
617
617
  }
618
618
 
619
619
  if (Array.isArray(val)) return 'array';
620
- if (isDate(val)) return 'date';
620
+ if (isDate$1(val)) return 'date';
621
621
  if (isError(val)) return 'error';
622
622
  var constructorName = ctorName(val);
623
623
 
@@ -643,7 +643,7 @@ function isError(val) {
643
643
  return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
644
644
  }
645
645
 
646
- function isDate(val) {
646
+ function isDate$1(val) {
647
647
  if (val instanceof Date) return true;
648
648
  return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
649
649
  }
@@ -2814,7 +2814,7 @@ var LayerActionOrigin;
2814
2814
  LayerActionOrigin["unregisterMapSaga"] = "unregisterMapSaga";
2815
2815
  })(LayerActionOrigin || (LayerActionOrigin = {}));
2816
2816
 
2817
- var types$8 = /*#__PURE__*/Object.freeze({
2817
+ var types$7 = /*#__PURE__*/Object.freeze({
2818
2818
  __proto__: null,
2819
2819
  get LayerStatus () { return LayerStatus; },
2820
2820
  get LayerActionOrigin () { return LayerActionOrigin; }
@@ -8509,6 +8509,530 @@ var moment$1 = {exports: {}};
8509
8509
 
8510
8510
  var moment = moment$1.exports;
8511
8511
 
8512
+ function toInteger(dirtyNumber) {
8513
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
8514
+ return NaN;
8515
+ }
8516
+ var number = Number(dirtyNumber);
8517
+ if (isNaN(number)) {
8518
+ return number;
8519
+ }
8520
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
8521
+ }
8522
+
8523
+ function requiredArgs(required, args) {
8524
+ if (args.length < required) {
8525
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
8526
+ }
8527
+ }
8528
+
8529
+ /**
8530
+ * @name toDate
8531
+ * @category Common Helpers
8532
+ * @summary Convert the given argument to an instance of Date.
8533
+ *
8534
+ * @description
8535
+ * Convert the given argument to an instance of Date.
8536
+ *
8537
+ * If the argument is an instance of Date, the function returns its clone.
8538
+ *
8539
+ * If the argument is a number, it is treated as a timestamp.
8540
+ *
8541
+ * If the argument is none of the above, the function returns Invalid Date.
8542
+ *
8543
+ * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
8544
+ *
8545
+ * @param {Date|Number} argument - the value to convert
8546
+ * @returns {Date} the parsed date in the local time zone
8547
+ * @throws {TypeError} 1 argument required
8548
+ *
8549
+ * @example
8550
+ * // Clone the date:
8551
+ * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
8552
+ * //=> Tue Feb 11 2014 11:30:30
8553
+ *
8554
+ * @example
8555
+ * // Convert the timestamp to date:
8556
+ * const result = toDate(1392098430000)
8557
+ * //=> Tue Feb 11 2014 11:30:30
8558
+ */
8559
+ function toDate(argument) {
8560
+ requiredArgs(1, arguments);
8561
+ var argStr = Object.prototype.toString.call(argument);
8562
+
8563
+ // Clone the date
8564
+ if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
8565
+ // Prevent the date to lose the milliseconds when passed to new Date() in IE10
8566
+ return new Date(argument.getTime());
8567
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
8568
+ return new Date(argument);
8569
+ } else {
8570
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
8571
+ // eslint-disable-next-line no-console
8572
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
8573
+ // eslint-disable-next-line no-console
8574
+ console.warn(new Error().stack);
8575
+ }
8576
+ return new Date(NaN);
8577
+ }
8578
+ }
8579
+
8580
+ /**
8581
+ * Days in 1 week.
8582
+ *
8583
+ * @name daysInWeek
8584
+ * @constant
8585
+ * @type {number}
8586
+ * @default
8587
+ */
8588
+
8589
+ /**
8590
+ * Milliseconds in 1 minute
8591
+ *
8592
+ * @name millisecondsInMinute
8593
+ * @constant
8594
+ * @type {number}
8595
+ * @default
8596
+ */
8597
+ var millisecondsInMinute = 60000;
8598
+
8599
+ /**
8600
+ * Milliseconds in 1 hour
8601
+ *
8602
+ * @name millisecondsInHour
8603
+ * @constant
8604
+ * @type {number}
8605
+ * @default
8606
+ */
8607
+ var millisecondsInHour = 3600000;
8608
+
8609
+ /**
8610
+ * @name isDate
8611
+ * @category Common Helpers
8612
+ * @summary Is the given value a date?
8613
+ *
8614
+ * @description
8615
+ * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
8616
+ *
8617
+ * @param {*} value - the value to check
8618
+ * @returns {boolean} true if the given value is a date
8619
+ * @throws {TypeError} 1 arguments required
8620
+ *
8621
+ * @example
8622
+ * // For a valid date:
8623
+ * const result = isDate(new Date())
8624
+ * //=> true
8625
+ *
8626
+ * @example
8627
+ * // For an invalid date:
8628
+ * const result = isDate(new Date(NaN))
8629
+ * //=> true
8630
+ *
8631
+ * @example
8632
+ * // For some value:
8633
+ * const result = isDate('2014-02-31')
8634
+ * //=> false
8635
+ *
8636
+ * @example
8637
+ * // For an object:
8638
+ * const result = isDate({})
8639
+ * //=> false
8640
+ */
8641
+ function isDate(value) {
8642
+ requiredArgs(1, arguments);
8643
+ return value instanceof Date || _typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
8644
+ }
8645
+
8646
+ /**
8647
+ * @name isValid
8648
+ * @category Common Helpers
8649
+ * @summary Is the given date valid?
8650
+ *
8651
+ * @description
8652
+ * Returns false if argument is Invalid Date and true otherwise.
8653
+ * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
8654
+ * Invalid Date is a Date, whose time value is NaN.
8655
+ *
8656
+ * Time value of Date: http://es5.github.io/#x15.9.1.1
8657
+ *
8658
+ * @param {*} date - the date to check
8659
+ * @returns {Boolean} the date is valid
8660
+ * @throws {TypeError} 1 argument required
8661
+ *
8662
+ * @example
8663
+ * // For the valid date:
8664
+ * const result = isValid(new Date(2014, 1, 31))
8665
+ * //=> true
8666
+ *
8667
+ * @example
8668
+ * // For the value, convertable into a date:
8669
+ * const result = isValid(1393804800000)
8670
+ * //=> true
8671
+ *
8672
+ * @example
8673
+ * // For the invalid date:
8674
+ * const result = isValid(new Date(''))
8675
+ * //=> false
8676
+ */
8677
+ function isValid(dirtyDate) {
8678
+ requiredArgs(1, arguments);
8679
+ if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
8680
+ return false;
8681
+ }
8682
+ var date = toDate(dirtyDate);
8683
+ return !isNaN(Number(date));
8684
+ }
8685
+
8686
+ /**
8687
+ * @name differenceInMilliseconds
8688
+ * @category Millisecond Helpers
8689
+ * @summary Get the number of milliseconds between the given dates.
8690
+ *
8691
+ * @description
8692
+ * Get the number of milliseconds between the given dates.
8693
+ *
8694
+ * @param {Date|Number} dateLeft - the later date
8695
+ * @param {Date|Number} dateRight - the earlier date
8696
+ * @returns {Number} the number of milliseconds
8697
+ * @throws {TypeError} 2 arguments required
8698
+ *
8699
+ * @example
8700
+ * // How many milliseconds are between
8701
+ * // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
8702
+ * const result = differenceInMilliseconds(
8703
+ * new Date(2014, 6, 2, 12, 30, 21, 700),
8704
+ * new Date(2014, 6, 2, 12, 30, 20, 600)
8705
+ * )
8706
+ * //=> 1100
8707
+ */
8708
+ function differenceInMilliseconds(dateLeft, dateRight) {
8709
+ requiredArgs(2, arguments);
8710
+ return toDate(dateLeft).getTime() - toDate(dateRight).getTime();
8711
+ }
8712
+
8713
+ var roundingMap = {
8714
+ ceil: Math.ceil,
8715
+ round: Math.round,
8716
+ floor: Math.floor,
8717
+ trunc: function trunc(value) {
8718
+ return value < 0 ? Math.ceil(value) : Math.floor(value);
8719
+ } // Math.trunc is not supported by IE
8720
+ };
8721
+
8722
+ var defaultRoundingMethod = 'trunc';
8723
+ function getRoundingMethod(method) {
8724
+ return method ? roundingMap[method] : roundingMap[defaultRoundingMethod];
8725
+ }
8726
+
8727
+ /**
8728
+ * @name differenceInMinutes
8729
+ * @category Minute Helpers
8730
+ * @summary Get the number of minutes between the given dates.
8731
+ *
8732
+ * @description
8733
+ * Get the signed number of full (rounded towards 0) minutes between the given dates.
8734
+ *
8735
+ * @param {Date|Number} dateLeft - the later date
8736
+ * @param {Date|Number} dateRight - the earlier date
8737
+ * @param {Object} [options] - an object with options.
8738
+ * @param {String} [options.roundingMethod='trunc'] - a rounding method (`ceil`, `floor`, `round` or `trunc`)
8739
+ * @returns {Number} the number of minutes
8740
+ * @throws {TypeError} 2 arguments required
8741
+ *
8742
+ * @example
8743
+ * // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?
8744
+ * const result = differenceInMinutes(
8745
+ * new Date(2014, 6, 2, 12, 20, 0),
8746
+ * new Date(2014, 6, 2, 12, 7, 59)
8747
+ * )
8748
+ * //=> 12
8749
+ *
8750
+ * @example
8751
+ * // How many minutes are between 10:01:59 and 10:00:00
8752
+ * const result = differenceInMinutes(
8753
+ * new Date(2000, 0, 1, 10, 0, 0),
8754
+ * new Date(2000, 0, 1, 10, 1, 59)
8755
+ * )
8756
+ * //=> -1
8757
+ */
8758
+ function differenceInMinutes(dateLeft, dateRight, options) {
8759
+ requiredArgs(2, arguments);
8760
+ var diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
8761
+ return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
8762
+ }
8763
+
8764
+ /**
8765
+ * @name getTime
8766
+ * @category Timestamp Helpers
8767
+ * @summary Get the milliseconds timestamp of the given date.
8768
+ *
8769
+ * @description
8770
+ * Get the milliseconds timestamp of the given date.
8771
+ *
8772
+ * @param {Date|Number} date - the given date
8773
+ * @returns {Number} the timestamp
8774
+ * @throws {TypeError} 1 argument required
8775
+ *
8776
+ * @example
8777
+ * // Get the timestamp of 29 February 2012 11:45:05.123:
8778
+ * const result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))
8779
+ * //=> 1330515905123
8780
+ */
8781
+ function getTime$1(dirtyDate) {
8782
+ requiredArgs(1, arguments);
8783
+ var date = toDate(dirtyDate);
8784
+ var timestamp = date.getTime();
8785
+ return timestamp;
8786
+ }
8787
+
8788
+ /**
8789
+ * @name getUnixTime
8790
+ * @category Timestamp Helpers
8791
+ * @summary Get the seconds timestamp of the given date.
8792
+ *
8793
+ * @description
8794
+ * Get the seconds timestamp of the given date.
8795
+ *
8796
+ * @param {Date|Number} date - the given date
8797
+ * @returns {Number} the timestamp
8798
+ * @throws {TypeError} 1 argument required
8799
+ *
8800
+ * @example
8801
+ * // Get the timestamp of 29 February 2012 11:45:05 CET:
8802
+ * const result = getUnixTime(new Date(2012, 1, 29, 11, 45, 5))
8803
+ * //=> 1330512305
8804
+ */
8805
+ function getUnixTime(dirtyDate) {
8806
+ requiredArgs(1, arguments);
8807
+ return Math.floor(getTime$1(dirtyDate) / 1000);
8808
+ }
8809
+
8810
+ /**
8811
+ * @name parseISO
8812
+ * @category Common Helpers
8813
+ * @summary Parse ISO string
8814
+ *
8815
+ * @description
8816
+ * Parse the given string in ISO 8601 format and return an instance of Date.
8817
+ *
8818
+ * Function accepts complete ISO 8601 formats as well as partial implementations.
8819
+ * ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
8820
+ *
8821
+ * If the argument isn't a string, the function cannot parse the string or
8822
+ * the values are invalid, it returns Invalid Date.
8823
+ *
8824
+ * @param {String} argument - the value to convert
8825
+ * @param {Object} [options] - an object with options.
8826
+ * @param {0|1|2} [options.additionalDigits=2] - the additional number of digits in the extended year format
8827
+ * @returns {Date} the parsed date in the local time zone
8828
+ * @throws {TypeError} 1 argument required
8829
+ * @throws {RangeError} `options.additionalDigits` must be 0, 1 or 2
8830
+ *
8831
+ * @example
8832
+ * // Convert string '2014-02-11T11:30:30' to date:
8833
+ * const result = parseISO('2014-02-11T11:30:30')
8834
+ * //=> Tue Feb 11 2014 11:30:30
8835
+ *
8836
+ * @example
8837
+ * // Convert string '+02014101' to date,
8838
+ * // if the additional number of digits in the extended year format is 1:
8839
+ * const result = parseISO('+02014101', { additionalDigits: 1 })
8840
+ * //=> Fri Apr 11 2014 00:00:00
8841
+ */
8842
+ function parseISO(argument, options) {
8843
+ var _options$additionalDi;
8844
+ requiredArgs(1, arguments);
8845
+ var additionalDigits = toInteger((_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2);
8846
+ if (additionalDigits !== 2 && additionalDigits !== 1 && additionalDigits !== 0) {
8847
+ throw new RangeError('additionalDigits must be 0, 1 or 2');
8848
+ }
8849
+ if (!(typeof argument === 'string' || Object.prototype.toString.call(argument) === '[object String]')) {
8850
+ return new Date(NaN);
8851
+ }
8852
+ var dateStrings = splitDateString(argument);
8853
+ var date;
8854
+ if (dateStrings.date) {
8855
+ var parseYearResult = parseYear(dateStrings.date, additionalDigits);
8856
+ date = parseDate(parseYearResult.restDateString, parseYearResult.year);
8857
+ }
8858
+ if (!date || isNaN(date.getTime())) {
8859
+ return new Date(NaN);
8860
+ }
8861
+ var timestamp = date.getTime();
8862
+ var time = 0;
8863
+ var offset;
8864
+ if (dateStrings.time) {
8865
+ time = parseTime(dateStrings.time);
8866
+ if (isNaN(time)) {
8867
+ return new Date(NaN);
8868
+ }
8869
+ }
8870
+ if (dateStrings.timezone) {
8871
+ offset = parseTimezone(dateStrings.timezone);
8872
+ if (isNaN(offset)) {
8873
+ return new Date(NaN);
8874
+ }
8875
+ } else {
8876
+ var dirtyDate = new Date(timestamp + time);
8877
+ // js parsed string assuming it's in UTC timezone
8878
+ // but we need it to be parsed in our timezone
8879
+ // so we use utc values to build date in our timezone.
8880
+ // Year values from 0 to 99 map to the years 1900 to 1999
8881
+ // so set year explicitly with setFullYear.
8882
+ var result = new Date(0);
8883
+ result.setFullYear(dirtyDate.getUTCFullYear(), dirtyDate.getUTCMonth(), dirtyDate.getUTCDate());
8884
+ result.setHours(dirtyDate.getUTCHours(), dirtyDate.getUTCMinutes(), dirtyDate.getUTCSeconds(), dirtyDate.getUTCMilliseconds());
8885
+ return result;
8886
+ }
8887
+ return new Date(timestamp + time + offset);
8888
+ }
8889
+ var patterns = {
8890
+ dateTimeDelimiter: /[T ]/,
8891
+ timeZoneDelimiter: /[Z ]/i,
8892
+ timezone: /([Z+-].*)$/
8893
+ };
8894
+ var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
8895
+ var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
8896
+ var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
8897
+ function splitDateString(dateString) {
8898
+ var dateStrings = {};
8899
+ var array = dateString.split(patterns.dateTimeDelimiter);
8900
+ var timeString;
8901
+
8902
+ // The regex match should only return at maximum two array elements.
8903
+ // [date], [time], or [date, time].
8904
+ if (array.length > 2) {
8905
+ return dateStrings;
8906
+ }
8907
+ if (/:/.test(array[0])) {
8908
+ timeString = array[0];
8909
+ } else {
8910
+ dateStrings.date = array[0];
8911
+ timeString = array[1];
8912
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
8913
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
8914
+ timeString = dateString.substr(dateStrings.date.length, dateString.length);
8915
+ }
8916
+ }
8917
+ if (timeString) {
8918
+ var token = patterns.timezone.exec(timeString);
8919
+ if (token) {
8920
+ dateStrings.time = timeString.replace(token[1], '');
8921
+ dateStrings.timezone = token[1];
8922
+ } else {
8923
+ dateStrings.time = timeString;
8924
+ }
8925
+ }
8926
+ return dateStrings;
8927
+ }
8928
+ function parseYear(dateString, additionalDigits) {
8929
+ var regex = new RegExp('^(?:(\\d{4}|[+-]\\d{' + (4 + additionalDigits) + '})|(\\d{2}|[+-]\\d{' + (2 + additionalDigits) + '})$)');
8930
+ var captures = dateString.match(regex);
8931
+ // Invalid ISO-formatted year
8932
+ if (!captures) return {
8933
+ year: NaN,
8934
+ restDateString: ''
8935
+ };
8936
+ var year = captures[1] ? parseInt(captures[1]) : null;
8937
+ var century = captures[2] ? parseInt(captures[2]) : null;
8938
+
8939
+ // either year or century is null, not both
8940
+ return {
8941
+ year: century === null ? year : century * 100,
8942
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
8943
+ };
8944
+ }
8945
+ function parseDate(dateString, year) {
8946
+ // Invalid ISO-formatted year
8947
+ if (year === null) return new Date(NaN);
8948
+ var captures = dateString.match(dateRegex);
8949
+ // Invalid ISO-formatted string
8950
+ if (!captures) return new Date(NaN);
8951
+ var isWeekDate = !!captures[4];
8952
+ var dayOfYear = parseDateUnit(captures[1]);
8953
+ var month = parseDateUnit(captures[2]) - 1;
8954
+ var day = parseDateUnit(captures[3]);
8955
+ var week = parseDateUnit(captures[4]);
8956
+ var dayOfWeek = parseDateUnit(captures[5]) - 1;
8957
+ if (isWeekDate) {
8958
+ if (!validateWeekDate(year, week, dayOfWeek)) {
8959
+ return new Date(NaN);
8960
+ }
8961
+ return dayOfISOWeekYear(year, week, dayOfWeek);
8962
+ } else {
8963
+ var date = new Date(0);
8964
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
8965
+ return new Date(NaN);
8966
+ }
8967
+ date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
8968
+ return date;
8969
+ }
8970
+ }
8971
+ function parseDateUnit(value) {
8972
+ return value ? parseInt(value) : 1;
8973
+ }
8974
+ function parseTime(timeString) {
8975
+ var captures = timeString.match(timeRegex);
8976
+ if (!captures) return NaN; // Invalid ISO-formatted time
8977
+
8978
+ var hours = parseTimeUnit(captures[1]);
8979
+ var minutes = parseTimeUnit(captures[2]);
8980
+ var seconds = parseTimeUnit(captures[3]);
8981
+ if (!validateTime(hours, minutes, seconds)) {
8982
+ return NaN;
8983
+ }
8984
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
8985
+ }
8986
+ function parseTimeUnit(value) {
8987
+ return value && parseFloat(value.replace(',', '.')) || 0;
8988
+ }
8989
+ function parseTimezone(timezoneString) {
8990
+ if (timezoneString === 'Z') return 0;
8991
+ var captures = timezoneString.match(timezoneRegex);
8992
+ if (!captures) return 0;
8993
+ var sign = captures[1] === '+' ? -1 : 1;
8994
+ var hours = parseInt(captures[2]);
8995
+ var minutes = captures[3] && parseInt(captures[3]) || 0;
8996
+ if (!validateTimezone(hours, minutes)) {
8997
+ return NaN;
8998
+ }
8999
+ return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
9000
+ }
9001
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
9002
+ var date = new Date(0);
9003
+ date.setUTCFullYear(isoWeekYear, 0, 4);
9004
+ var fourthOfJanuaryDay = date.getUTCDay() || 7;
9005
+ var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
9006
+ date.setUTCDate(date.getUTCDate() + diff);
9007
+ return date;
9008
+ }
9009
+
9010
+ // Validation functions
9011
+
9012
+ // February is null to handle the leap year (using ||)
9013
+ var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
9014
+ function isLeapYearIndex(year) {
9015
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
9016
+ }
9017
+ function validateDate(year, month, date) {
9018
+ return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
9019
+ }
9020
+ function validateDayOfYearDate(year, dayOfYear) {
9021
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
9022
+ }
9023
+ function validateWeekDate(_year, week, day) {
9024
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
9025
+ }
9026
+ function validateTime(hours, minutes, seconds) {
9027
+ if (hours === 24) {
9028
+ return minutes === 0 && seconds === 0;
9029
+ }
9030
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
9031
+ }
9032
+ function validateTimezone(_hours, minutes) {
9033
+ return minutes >= 0 && minutes <= 59;
9034
+ }
9035
+
8512
9036
  /* *
8513
9037
  * Licensed under the Apache License, Version 2.0 (the "License");
8514
9038
  * you may not use this file except in compliance with the License.
@@ -8838,6 +9362,9 @@ var getActiveLayerTimeStep = function getActiveLayerTimeStep(timeDimension) {
8838
9362
  var getSpeedFactor = function getSpeedFactor(speedDelay) {
8839
9363
  return defaultDelay / speedDelay;
8840
9364
  };
9365
+ var getAnimationDuration = function getAnimationDuration(animationEndTime, animationStartTime) {
9366
+ return animationEndTime && animationStartTime ? differenceInMinutes(new Date(animationEndTime), new Date(animationStartTime)) : 0;
9367
+ };
8841
9368
  /**
8842
9369
  * Returns speed delay for given speedFactor. For options, see defined above in "speedFactors"
8843
9370
  */
@@ -8891,6 +9418,7 @@ var utils$3 = /*#__PURE__*/Object.freeze({
8891
9418
  getTimeStepFromDataInterval: getTimeStepFromDataInterval,
8892
9419
  getActiveLayerTimeStep: getActiveLayerTimeStep,
8893
9420
  getSpeedFactor: getSpeedFactor,
9421
+ getAnimationDuration: getAnimationDuration,
8894
9422
  getSpeedDelay: getSpeedDelay,
8895
9423
  roundWithTimeStep: roundWithTimeStep,
8896
9424
  secondsPerPxToScale: secondsPerPxToScale,
@@ -9214,7 +9742,7 @@ var createLayer = function createLayer(_a) {
9214
9742
  status: status
9215
9743
  });
9216
9744
  };
9217
- var initialState$a = {
9745
+ var initialState$9 = {
9218
9746
  byId: {},
9219
9747
  allIds: [],
9220
9748
  availableBaseLayers: {
@@ -9222,8 +9750,8 @@ var initialState$a = {
9222
9750
  allIds: []
9223
9751
  }
9224
9752
  };
9225
- var slice$a = createSlice({
9226
- initialState: initialState$a,
9753
+ var slice$9 = createSlice({
9754
+ initialState: initialState$9,
9227
9755
  name: 'layerReducer',
9228
9756
  reducers: {
9229
9757
  addLayer: function addLayer(draft, action) {
@@ -9629,7 +10157,7 @@ var slice$a = createSlice({
9629
10157
  type: source.type
9630
10158
  };
9631
10159
  /* Handle the Layer action with the same logic, using the same reducer */
9632
- return reducer$a(prevState, action);
10160
+ return reducer$9(prevState, action);
9633
10161
  }, state);
9634
10162
  }).addCase(setMapPreset, function (draft, action) {
9635
10163
  var mapId = action.payload.mapId;
@@ -9649,8 +10177,8 @@ var slice$a = createSlice({
9649
10177
  });
9650
10178
  }
9651
10179
  });
9652
- var reducer$a = slice$a.reducer;
9653
- var layerActions = slice$a.actions;
10180
+ var reducer$9 = slice$9.reducer;
10181
+ var layerActions = slice$9.actions;
9654
10182
 
9655
10183
  var lodash = {exports: {}};
9656
10184
 
@@ -27234,7 +27762,7 @@ var getLayerIsInsideAcceptanceTime = createSelector(getAcceptanceTimeInMinutes,
27234
27762
  return 'inside';
27235
27763
  });
27236
27764
 
27237
- var selectors$9 = /*#__PURE__*/Object.freeze({
27765
+ var selectors$8 = /*#__PURE__*/Object.freeze({
27238
27766
  __proto__: null,
27239
27767
  getLayerById: getLayerById,
27240
27768
  getLayersById: getLayersById,
@@ -27294,7 +27822,7 @@ var AnimationLength;
27294
27822
  AnimationLength[AnimationLength["Hours24"] = 1440] = "Hours24";
27295
27823
  })(AnimationLength || (AnimationLength = {}));
27296
27824
 
27297
- var types$7 = /*#__PURE__*/Object.freeze({
27825
+ var types$6 = /*#__PURE__*/Object.freeze({
27298
27826
  __proto__: null,
27299
27827
  get AnimationLength () { return AnimationLength; }
27300
27828
  });
@@ -27422,13 +27950,13 @@ var createUIDialogElement = function createUIDialogElement(_ref) {
27422
27950
  focused: false
27423
27951
  };
27424
27952
  };
27425
- var initialState$9 = {
27953
+ var initialState$8 = {
27426
27954
  order: [],
27427
27955
  dialogs: {},
27428
27956
  activeWindowId: undefined
27429
27957
  };
27430
- var slice$9 = createSlice({
27431
- initialState: initialState$9,
27958
+ var slice$8 = createSlice({
27959
+ initialState: initialState$8,
27432
27960
  name: 'uiReducer',
27433
27961
  reducers: {
27434
27962
  registerDialog: function registerDialog(draft, action) {
@@ -27520,8 +28048,8 @@ var slice$9 = createSlice({
27520
28048
  }
27521
28049
  }
27522
28050
  });
27523
- var reducer$9 = slice$9.reducer;
27524
- var uiActions = slice$9.actions;
28051
+ var reducer$8 = slice$8.reducer;
28052
+ var uiActions = slice$8.actions;
27525
28053
 
27526
28054
  var addBaseLayer = layerActions.addBaseLayer,
27527
28055
  addLayer$1 = layerActions.addLayer,
@@ -27568,12 +28096,12 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
27568
28096
  }
27569
28097
  });
27570
28098
  };
27571
- var initialState$8 = {
28099
+ var initialState$7 = {
27572
28100
  byId: {},
27573
28101
  allIds: []
27574
28102
  };
27575
- var slice$8 = createSlice({
27576
- initialState: initialState$8,
28103
+ var slice$7 = createSlice({
28104
+ initialState: initialState$7,
27577
28105
  name: 'mapReducer',
27578
28106
  reducers: {
27579
28107
  registerMap: function registerMap(draft, action) {
@@ -28097,7 +28625,7 @@ var slice$8 = createSlice({
28097
28625
  type: source.type
28098
28626
  };
28099
28627
  /* Handle the Layer action with the same logic, using the same reducer */
28100
- return reducer$8(prevState, action);
28628
+ return reducer$7(prevState, action);
28101
28629
  }, draft);
28102
28630
  }).addCase(onUpdateLayerInformation, function (draft, action) {
28103
28631
  var mapDimensions = action.payload.mapDimensions;
@@ -28143,11 +28671,11 @@ var slice$8 = createSlice({
28143
28671
  });
28144
28672
  }
28145
28673
  });
28146
- var mapActions = Object.assign(Object.assign({}, slice$8.actions), {
28674
+ var mapActions = Object.assign(Object.assign({}, slice$7.actions), {
28147
28675
  setMapPreset: setMapPreset,
28148
28676
  mapChangeDimension: mapChangeDimension
28149
28677
  });
28150
- var reducer$8 = slice$8.reducer;
28678
+ var reducer$7 = slice$7.reducer;
28151
28679
 
28152
28680
  /* *
28153
28681
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -28274,7 +28802,7 @@ var getDialogError = createSelector(getDialogDetailsByType, function (details) {
28274
28802
  return details && details.error || '';
28275
28803
  });
28276
28804
 
28277
- var selectors$8 = /*#__PURE__*/Object.freeze({
28805
+ var selectors$7 = /*#__PURE__*/Object.freeze({
28278
28806
  __proto__: null,
28279
28807
  getUiStore: getUiStore,
28280
28808
  getDialogDetailsByType: getDialogDetailsByType,
@@ -28318,10 +28846,10 @@ var DialogTypes;
28318
28846
  DialogTypes["DrawingTool"] = "drawingTool";
28319
28847
  DialogTypes["DockedLayerManager"] = "dockedLayerManager";
28320
28848
  DialogTypes["DockedDrawingTool"] = "dockedDrawingTool";
28321
- DialogTypes["AreaManager"] = "areaManager";
28849
+ DialogTypes["ObjectManager"] = "objectManager";
28322
28850
  })(DialogTypes || (DialogTypes = {}));
28323
28851
 
28324
- var types$6 = /*#__PURE__*/Object.freeze({
28852
+ var types$5 = /*#__PURE__*/Object.freeze({
28325
28853
  __proto__: null,
28326
28854
  get DialogTypes () { return DialogTypes; }
28327
28855
  });
@@ -28411,7 +28939,7 @@ var removeInPlace = function removeInPlace(inDraftArray, condition) {
28411
28939
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
28412
28940
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
28413
28941
  * */
28414
- var initialState$7 = {
28942
+ var initialState$6 = {
28415
28943
  sources: {
28416
28944
  byId: {},
28417
28945
  allIds: []
@@ -28435,8 +28963,8 @@ var initialState$7 = {
28435
28963
  }
28436
28964
  }
28437
28965
  };
28438
- var slice$7 = createSlice({
28439
- initialState: initialState$7,
28966
+ var slice$6 = createSlice({
28967
+ initialState: initialState$6,
28440
28968
  name: 'synchronizationGroupsReducer',
28441
28969
  reducers: {
28442
28970
  syncGroupAddSource: function syncGroupAddSource(draft, action) {
@@ -28565,7 +29093,7 @@ var slice$7 = createSlice({
28565
29093
  });
28566
29094
  },
28567
29095
  syncGroupClear: function syncGroupClear() {
28568
- return initialState$7;
29096
+ return initialState$6;
28569
29097
  },
28570
29098
  syncGroupSetViewState: function syncGroupSetViewState(draft, action) {
28571
29099
  var viewState = action.payload.viewState;
@@ -28624,7 +29152,7 @@ var setBboxOrTimeSync = function setBboxOrTimeSync(state, action) {
28624
29152
  });
28625
29153
  });
28626
29154
  };
28627
- var _slice$actions = slice$7.actions,
29155
+ var _slice$actions = slice$6.actions,
28628
29156
  syncGroupAddGroup = _slice$actions.syncGroupAddGroup,
28629
29157
  syncGroupAddSource = _slice$actions.syncGroupAddSource,
28630
29158
  syncGroupAddTarget = _slice$actions.syncGroupAddTarget;
@@ -28634,8 +29162,8 @@ var _slice$actions = slice$7.actions,
28634
29162
  syncGroupRemoveSource = _slice$actions.syncGroupRemoveSource,
28635
29163
  syncGroupRemoveTarget = _slice$actions.syncGroupRemoveTarget,
28636
29164
  syncGroupSetViewState = _slice$actions.syncGroupSetViewState;
28637
- var actions = slice$7.actions,
28638
- reducer$7 = slice$7.reducer;
29165
+ var actions = slice$6.actions,
29166
+ reducer$6 = slice$6.reducer;
28639
29167
 
28640
29168
  /* *
28641
29169
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -28663,7 +29191,7 @@ var SyncGroupActionOrigin;
28663
29191
  SyncGroupActionOrigin["activateLayerId"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_ACTIVELAYERIDACTION";
28664
29192
  })(SyncGroupActionOrigin || (SyncGroupActionOrigin = {}));
28665
29193
 
28666
- var types$5 = /*#__PURE__*/Object.freeze({
29194
+ var types$4 = /*#__PURE__*/Object.freeze({
28667
29195
  __proto__: null,
28668
29196
  SyncGroupTypeList: SyncGroupTypeList,
28669
29197
  get SyncGroupActionOrigin () { return SyncGroupActionOrigin; }
@@ -28804,7 +29332,7 @@ var getSyncGroupTargets = createSelector(syncGroupStore, function (store) {
28804
29332
  }, []);
28805
29333
  });
28806
29334
 
28807
- var selectors$7 = /*#__PURE__*/Object.freeze({
29335
+ var selectors$6 = /*#__PURE__*/Object.freeze({
28808
29336
  __proto__: null,
28809
29337
  syncGroupStore: syncGroupStore,
28810
29338
  getSynchronizationGroupState: getSynchronizationGroupState,
@@ -28956,7 +29484,7 @@ var getTime = createSelector(getSyncSourceBySourceId, function (store) {
28956
29484
  return store && store.payloadByType && store.payloadByType[SYNCGROUPS_TYPE_SETTIME] ? store.payloadByType[SYNCGROUPS_TYPE_SETTIME].value : null;
28957
29485
  });
28958
29486
 
28959
- var selectors$6 = /*#__PURE__*/Object.freeze({
29487
+ var selectors$5 = /*#__PURE__*/Object.freeze({
28960
29488
  __proto__: null,
28961
29489
  getSynchronizationGroupStore: getSynchronizationGroupStore,
28962
29490
  getTime: getTime
@@ -28979,7 +29507,7 @@ var selectors$6 = /*#__PURE__*/Object.freeze({
28979
29507
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
28980
29508
  * */
28981
29509
 
28982
- var types$4 = /*#__PURE__*/Object.freeze({
29510
+ var types$3 = /*#__PURE__*/Object.freeze({
28983
29511
  __proto__: null
28984
29512
  });
28985
29513
 
@@ -29177,6 +29705,43 @@ var getMapDimension = createSelector(getMapById, function (_store, _mapId, dimen
29177
29705
  }
29178
29706
  return undefined;
29179
29707
  }, selectorMemoizationOptions);
29708
+ var getSelectedTime = createSelector(function (store, mapId) {
29709
+ return getMapDimension(store, mapId, 'time');
29710
+ }, function (timeDimension) {
29711
+ var now = getUnixTime(new Date());
29712
+ if (!timeDimension) {
29713
+ return now;
29714
+ }
29715
+ var timeSliderTime = parseISO(timeDimension.currentValue);
29716
+ if (isValid(timeSliderTime)) {
29717
+ return getUnixTime(timeSliderTime);
29718
+ }
29719
+ return now;
29720
+ });
29721
+ var getDataLimitsFromLayers = createSelector(getMapLayers, function (layers) {
29722
+ return layers.reduce(function (_ref, layer) {
29723
+ var _ref2 = _slicedToArray(_ref, 2),
29724
+ start = _ref2[0],
29725
+ end = _ref2[1];
29726
+ var _a;
29727
+ var dimension = (_a = layer.dimensions) === null || _a === void 0 ? void 0 : _a.find(function (dimension) {
29728
+ return dimension.name === 'time';
29729
+ });
29730
+ if ((dimension === null || dimension === void 0 ? void 0 : dimension.minValue) && dimension.maxValue) {
29731
+ var lastValue = getUnixTime(new Date(dimension.maxValue));
29732
+ var firstValue = getUnixTime(new Date(dimension.minValue));
29733
+ var newLast = Math.max(lastValue, end);
29734
+ var newFirst = Math.min(firstValue, start);
29735
+ return [newFirst, newLast];
29736
+ }
29737
+ return [start, end];
29738
+ },
29739
+ /* Using the maximum 32-bit value and 0 as starting points
29740
+ * bigger values like Number.MAX_VALUE or Number.MAX_SAFE_INTEGER
29741
+ * cause weird behaviour as timestamps break at 32bit limit (year 2038)
29742
+ */
29743
+ [2147483647, 0]);
29744
+ });
29180
29745
  /**
29181
29746
  * Gets map srs
29182
29747
  *
@@ -29604,7 +30169,7 @@ var getLegendId = createSelector(getMapById, function (store) {
29604
30169
  * @param {string} mapId mapId: string - Id of the map
29605
30170
  * @returns {MapPreset} returnType: MapPreset
29606
30171
  */
29607
- var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLayers, getBbox, getSrs, getActiveLayerId, getAutoTimeStepLayerId, getAutoUpdateLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, getDisplayMapPin, isZoomControlsVisible, getMapTimeStep, getMapAnimationDelay, isTimestepAuto, getLegendId, getUiStore, function (mapLayers, baseLayers, overLayers, bbox, srs, activeLayerId, autoUpdateLayerId, autoTimeStepLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, displayMapPin, isZoomControlsVisible, mapTimeStep, mapAnimationDelay, isTimestepAuto, legendId, uiStore) {
30172
+ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLayers, getBbox, getSrs, getActiveLayerId, getAutoTimeStepLayerId, getAutoUpdateLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, getDisplayMapPin, isZoomControlsVisible, getMapTimeStep, getMapAnimationDelay, getAnimationStartTime, getAnimationEndTime$1, isTimestepAuto, getLegendId, getUiStore, function (mapLayers, baseLayers, overLayers, bbox, srs, activeLayerId, autoUpdateLayerId, autoTimeStepLayerId, isAnimating, isAutoUpdating, isTimeSliderVisible, displayMapPin, isZoomControlsVisible, mapTimeStep, mapAnimationDelay, animationStartTime, animationEndTime, isTimestepAuto, legendId, uiStore) {
29608
30173
  var _a;
29609
30174
  var allLayers = [].concat(_toConsumableArray(baseLayers), _toConsumableArray(overLayers), _toConsumableArray(mapLayers)).map(function (_a) {
29610
30175
  _a.mapId;
@@ -29622,7 +30187,8 @@ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLaye
29622
30187
  });
29623
30188
  var animationPayload = {
29624
30189
  interval: mapTimeStep,
29625
- speed: getSpeedFactor(mapAnimationDelay)
30190
+ speed: getSpeedFactor(mapAnimationDelay),
30191
+ duration: getAnimationDuration(animationEndTime, animationStartTime)
29626
30192
  };
29627
30193
  var shouldShowLegend = (_a = uiStore === null || uiStore === void 0 ? void 0 : uiStore.dialogs[legendId]) === null || _a === void 0 ? void 0 : _a.isOpen;
29628
30194
  return Object.assign({
@@ -29689,7 +30255,7 @@ var getDockedLayerManagerSize = createSelector(getMapById, function (store) {
29689
30255
  return store ? store.dockedLayerManagerSize : 'sizeSmall';
29690
30256
  });
29691
30257
 
29692
- var selectors$5 = /*#__PURE__*/Object.freeze({
30258
+ var selectors$4 = /*#__PURE__*/Object.freeze({
29693
30259
  __proto__: null,
29694
30260
  getMapById: getMapById,
29695
30261
  getAllMapIds: getAllMapIds,
@@ -29705,6 +30271,8 @@ var selectors$5 = /*#__PURE__*/Object.freeze({
29705
30271
  getMapOverLayers: getMapOverLayers,
29706
30272
  getMapDimensions: getMapDimensions,
29707
30273
  getMapDimension: getMapDimension,
30274
+ getSelectedTime: getSelectedTime,
30275
+ getDataLimitsFromLayers: getDataLimitsFromLayers,
29708
30276
  getSrs: getSrs,
29709
30277
  getBbox: getBbox,
29710
30278
  isAnimating: isAnimating,
@@ -29857,12 +30425,12 @@ var mapUtils = Object.assign(Object.assign({}, utils$3), {
29857
30425
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
29858
30426
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
29859
30427
  * */
29860
- var initialState$6 = {
30428
+ var initialState$5 = {
29861
30429
  byId: {},
29862
30430
  allIds: []
29863
30431
  };
29864
- var slice$6 = createSlice({
29865
- initialState: initialState$6,
30432
+ var slice$5 = createSlice({
30433
+ initialState: initialState$5,
29866
30434
  name: 'serviceReducer',
29867
30435
  reducers: {
29868
30436
  serviceSetLayers: function serviceSetLayers(draft, action) {
@@ -29891,8 +30459,8 @@ var slice$6 = createSlice({
29891
30459
  action) {}
29892
30460
  }
29893
30461
  });
29894
- var reducer$6 = slice$6.reducer;
29895
- var serviceActions = slice$6.actions;
30462
+ var reducer$5 = slice$5.reducer;
30463
+ var serviceActions = slice$5.actions;
29896
30464
 
29897
30465
  /* *
29898
30466
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -30004,7 +30572,7 @@ var getLayerStyles = createSelector(getLayerFromService, function (layer) {
30004
30572
  return layer && layer.styles ? layer.styles : [];
30005
30573
  }, selectorMemoizationOptions);
30006
30574
 
30007
- var selectors$4 = /*#__PURE__*/Object.freeze({
30575
+ var selectors$3 = /*#__PURE__*/Object.freeze({
30008
30576
  __proto__: null,
30009
30577
  getServiceIds: getServiceIds,
30010
30578
  getServices: getServices,
@@ -30031,7 +30599,7 @@ var selectors$4 = /*#__PURE__*/Object.freeze({
30031
30599
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
30032
30600
  * */
30033
30601
 
30034
- var types$3 = /*#__PURE__*/Object.freeze({
30602
+ var types$2 = /*#__PURE__*/Object.freeze({
30035
30603
  __proto__: null
30036
30604
  });
30037
30605
 
@@ -33275,9 +33843,9 @@ i({
33275
33843
  var mapStoreModuleConfig = {
33276
33844
  id: 'webmap-module',
33277
33845
  reducersMap: {
33278
- webmap: reducer$8,
33279
- services: reducer$6,
33280
- layers: reducer$a
33846
+ webmap: reducer$7,
33847
+ services: reducer$5,
33848
+ layers: reducer$9
33281
33849
  },
33282
33850
  sagas: [rootSaga$7, rootSaga$6]
33283
33851
  };
@@ -33322,7 +33890,7 @@ var FilterType;
33322
33890
  FilterType["Group"] = "groups";
33323
33891
  })(FilterType || (FilterType = {}));
33324
33892
 
33325
- var types$2 = /*#__PURE__*/Object.freeze({
33893
+ var types$1 = /*#__PURE__*/Object.freeze({
33326
33894
  __proto__: null,
33327
33895
  get FilterType () { return FilterType; }
33328
33896
  });
@@ -33412,7 +33980,7 @@ var initialServicePopupState = {
33412
33980
  serviceId: '',
33413
33981
  variant: 'add'
33414
33982
  };
33415
- var initialState$5 = {
33983
+ var initialState$4 = {
33416
33984
  filters: {
33417
33985
  searchFilter: '',
33418
33986
  activeServices: layerSelectActiveServicesAdapter.getInitialState(),
@@ -33428,8 +33996,8 @@ var initialState$5 = {
33428
33996
  },
33429
33997
  servicePopup: initialServicePopupState
33430
33998
  };
33431
- var slice$5 = createSlice({
33432
- initialState: initialState$5,
33999
+ var slice$4 = createSlice({
34000
+ initialState: initialState$4,
33433
34001
  name: DialogTypes.LayerSelect,
33434
34002
  reducers: {
33435
34003
  setSearchFilter: function setSearchFilter(draft, action) {
@@ -33603,8 +34171,8 @@ var slice$5 = createSlice({
33603
34171
  });
33604
34172
  }
33605
34173
  });
33606
- var reducer$5 = slice$5.reducer;
33607
- var layerSelectActions = slice$5.actions;
34174
+ var reducer$4 = slice$4.reducer;
34175
+ var layerSelectActions = slice$4.actions;
33608
34176
 
33609
34177
  /* *
33610
34178
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -33769,7 +34337,7 @@ var getServicePopupDetails = function getServicePopupDetails(store) {
33769
34337
  return ((_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.servicePopup) || initialServicePopupState;
33770
34338
  };
33771
34339
 
33772
- var selectors$3 = /*#__PURE__*/Object.freeze({
34340
+ var selectors$2 = /*#__PURE__*/Object.freeze({
33773
34341
  __proto__: null,
33774
34342
  getSearchFilter: getSearchFilter,
33775
34343
  getActiveServices: getActiveServices,
@@ -33846,272 +34414,481 @@ var isNoIdService = function isNoIdService(param) {
33846
34414
  * See the License for the specific language governing permissions and
33847
34415
  * limitations under the License.
33848
34416
  *
33849
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
33850
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
34417
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34418
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
33851
34419
  * */
33852
- var snackbarAdapter = createEntityAdapter();
33853
- var initialState$4 = snackbarAdapter.getInitialState();
33854
- var slice$4 = createSlice({
33855
- initialState: initialState$4,
33856
- name: 'snackbar',
33857
- reducers: {
33858
- // To open the snackbar call this action
33859
- openSnackbar: function openSnackbar(
33860
- // eslint-disable-next-line no-unused-vars
33861
- draft,
33862
- // eslint-disable-next-line no-unused-vars
33863
- action) {},
33864
- // triggerOpenSnackbarBySaga is triggered by the saga to open the snackbar after the current snackbars have all been closed
33865
- // DO NOT CALL THIS ACTION DIRECTLY!
33866
- triggerOpenSnackbarBySaga: function triggerOpenSnackbarBySaga(draft, action) {
33867
- var snackbarContent = action.payload.snackbarContent;
33868
- // Ensure we have an id before proceeding
33869
- if (snackbarContent.id === undefined) {
33870
- return;
33871
- }
33872
- snackbarAdapter.setOne(draft, snackbarContent);
33873
- },
33874
- closeSnackbar: function closeSnackbar(draft) {
33875
- snackbarAdapter.removeAll(draft);
33876
- }
34420
+ /**
34421
+ * Tries to find the layerId's in the other map based on the payload of the action. It works for all layer actions.
34422
+ * @param state
34423
+ * @param mapId
34424
+ * @param targetMapId
34425
+ * @param payload
34426
+ * @returns
34427
+ */
34428
+ var getTargetLayerIdFromPayload = function getTargetLayerIdFromPayload(state, mapId, targetMapId, payload) {
34429
+ if (!payload) {
34430
+ return null;
33877
34431
  }
33878
- });
33879
- var reducer$4 = slice$4.reducer;
33880
- var snackbarActions = slice$4.actions;
33881
-
33882
- /* *
33883
- * Licensed under the Apache License, Version 2.0 (the "License");
33884
- * you may not use this file except in compliance with the License.
33885
- * You may obtain a copy of the License at
33886
- *
33887
- * http://www.apache.org/licenses/LICENSE-2.0
33888
- *
33889
- * Unless required by applicable law or agreed to in writing, software
33890
- * distributed under the License is distributed on an "AS IS" BASIS,
33891
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33892
- * See the License for the specific language governing permissions and
33893
- * limitations under the License.
33894
- *
33895
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
33896
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
33897
- * */
33898
- var getSnackbarStore = function getSnackbarStore(store) {
33899
- if (store && store.snackbar) {
33900
- return store.snackbar;
34432
+ /* Try to find the layer for the DeleteLayerPayload, it uses layerIndex to reference the layer */
34433
+ if ('layerIndex' in payload) {
34434
+ var targetLayer = getLayerByLayerIndex(state, targetMapId, payload.layerIndex);
34435
+ return !targetLayer ? null : targetLayer.id;
34436
+ }
34437
+ /* Try to find the layer for the LayerActionsWithLayerIds, it uses layerId to reference the layer */
34438
+ if ('layerId' in payload) {
34439
+ var _targetLayer = getLayerByLayerIndex(state, targetMapId, getLayerIndexByLayerId(state, mapId, payload.layerId));
34440
+ return !_targetLayer ? null : _targetLayer.id;
33901
34441
  }
34442
+ /* This payload probably does not reference to a layerId */
33902
34443
  return null;
33903
34444
  };
33904
- var _snackbarAdapter$getS = snackbarAdapter.getSelectors(function (state) {
33905
- var _a;
33906
- return (_a = state === null || state === void 0 ? void 0 : state.snackbar) !== null && _a !== void 0 ? _a : {
33907
- entities: {},
33908
- ids: []
33909
- };
33910
- }),
33911
- getCurrentSnackbarMessages = _snackbarAdapter$getS.selectAll;
33912
- var getFirstSnackbarMessage = createSelector(getCurrentSnackbarMessages, function (currentMessages) {
33913
- return currentMessages.length > 0 ? currentMessages[0] : undefined;
33914
- });
33915
-
33916
- var selectors$2 = /*#__PURE__*/Object.freeze({
33917
- __proto__: null,
33918
- getSnackbarStore: getSnackbarStore,
33919
- getCurrentSnackbarMessages: getCurrentSnackbarMessages,
33920
- getFirstSnackbarMessage: getFirstSnackbarMessage
33921
- });
33922
-
33923
- /* *
33924
- * Licensed under the Apache License, Version 2.0 (the "License");
33925
- * you may not use this file except in compliance with the License.
33926
- * You may obtain a copy of the License at
33927
- *
33928
- * http://www.apache.org/licenses/LICENSE-2.0
33929
- *
33930
- * Unless required by applicable law or agreed to in writing, software
33931
- * distributed under the License is distributed on an "AS IS" BASIS,
33932
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33933
- * See the License for the specific language governing permissions and
33934
- * limitations under the License.
33935
- *
33936
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
33937
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
33938
- * */
33939
-
33940
- var types$1 = /*#__PURE__*/Object.freeze({
33941
- __proto__: null
33942
- });
33943
-
33944
- var _marked$6 = /*#__PURE__*/_regeneratorRuntime().mark(openSnackbarSaga),
33945
- _marked2$4 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$5);
33946
- var hideTime = 4000;
33947
- function openSnackbarSaga(capturedAction) {
33948
- var snackbarMessage, currentSnackbarMessages, id, currentSnackbarMessagesOpen;
33949
- return _regeneratorRuntime().wrap(function openSnackbarSaga$(_context) {
33950
- while (1) switch (_context.prev = _context.next) {
33951
- case 0:
33952
- snackbarMessage = capturedAction.payload.message;
33953
- _context.next = 3;
33954
- return select(getCurrentSnackbarMessages);
33955
- case 3:
33956
- currentSnackbarMessages = _context.sent;
33957
- if (!currentSnackbarMessages.length) {
33958
- _context.next = 7;
33959
- break;
33960
- }
33961
- _context.next = 7;
33962
- return put(snackbarActions.closeSnackbar());
33963
- case 7:
33964
- // Generate a unique id
33965
- id = "snackbar".concat(Date.now().toString());
33966
- _context.next = 10;
33967
- return put(snackbarActions.triggerOpenSnackbarBySaga({
33968
- snackbarContent: {
33969
- message: snackbarMessage,
33970
- id: id
33971
- }
33972
- }));
33973
- case 10:
33974
- _context.next = 12;
33975
- return delay(hideTime);
33976
- case 12:
33977
- _context.next = 14;
33978
- return select(getCurrentSnackbarMessages);
33979
- case 14:
33980
- currentSnackbarMessagesOpen = _context.sent;
33981
- if (!currentSnackbarMessagesOpen.length) {
33982
- _context.next = 18;
33983
- break;
34445
+ /**
34446
+ * Local helper function used by getLayerDeleteActionsTargets, getLayerActionsTargets, getAddLayerActionsTargets, getTargetLayerIdFromPayload to find the targets
34447
+ * @param state
34448
+ * @param payload
34449
+ * @param actionType
34450
+ * @param sourceMapId
34451
+ * @returns The found targets
34452
+ */
34453
+ var findTargets = function findTargets(state, payload, actionType, sourceMapId) {
34454
+ var actionPayloads = [];
34455
+ var targetsInActionPayload = {};
34456
+ var syncronizationGroupStore = syncGroupStore(state);
34457
+ if (syncronizationGroupStore && payload) {
34458
+ syncronizationGroupStore.groups.allIds.forEach(function (id) {
34459
+ var syncronizationGroup = syncronizationGroupStore.groups.byId[id];
34460
+ if (actionType === syncronizationGroup.type) {
34461
+ /* Check if the source is in the target list of the synchonizationGroup */
34462
+ var source = syncronizationGroup.targets.byId[sourceMapId];
34463
+ /* If the source is part of the target list, and is linked, continue syncing the other targets */
34464
+ if (source && source.linked) {
34465
+ syncronizationGroup.targets.allIds.forEach(function (targetId) {
34466
+ var target = syncronizationGroup.targets.byId[targetId];
34467
+ if (targetId !== sourceMapId && target.linked && !targetsInActionPayload[targetId]) {
34468
+ /* Remember that we have already added this target in the action payloads, prevents adding it twice */
34469
+ targetsInActionPayload[targetId] = true;
34470
+ var otherLayerId = getTargetLayerIdFromPayload(state, sourceMapId, targetId, payload);
34471
+ actionPayloads.push({
34472
+ payload: payload,
34473
+ targetId: targetId,
34474
+ layerId: otherLayerId
34475
+ });
34476
+ }
34477
+ });
33984
34478
  }
33985
- _context.next = 18;
33986
- return put(snackbarActions.closeSnackbar());
33987
- case 18:
33988
- case "end":
33989
- return _context.stop();
33990
- }
33991
- }, _marked$6);
33992
- }
33993
- function rootSaga$5() {
33994
- return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
33995
- while (1) switch (_context2.prev = _context2.next) {
33996
- case 0:
33997
- _context2.next = 2;
33998
- return takeLatest$1(snackbarActions.openSnackbar.type, openSnackbarSaga);
33999
- case 2:
34000
- case "end":
34001
- return _context2.stop();
34002
- }
34003
- }, _marked2$4);
34004
- }
34005
-
34006
- /* *
34007
- * Licensed under the Apache License, Version 2.0 (the "License");
34008
- * you may not use this file except in compliance with the License.
34009
- * You may obtain a copy of the License at
34010
- *
34011
- * http://www.apache.org/licenses/LICENSE-2.0
34012
- *
34013
- * Unless required by applicable law or agreed to in writing, software
34014
- * distributed under the License is distributed on an "AS IS" BASIS,
34015
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34016
- * See the License for the specific language governing permissions and
34017
- * limitations under the License.
34018
- *
34019
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34020
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
34021
- * */
34022
- var snackbarModuleConfig = {
34023
- id: 'snackbar-module',
34024
- reducersMap: {
34025
- snackbar: reducer$4
34026
- },
34027
- sagas: [rootSaga$5]
34028
- };
34029
-
34030
- /* *
34031
- * Licensed under the Apache License, Version 2.0 (the "License");
34032
- * you may not use this file except in compliance with the License.
34033
- * You may obtain a copy of the License at
34034
- *
34035
- * http://www.apache.org/licenses/LICENSE-2.0
34036
- *
34037
- * Unless required by applicable law or agreed to in writing, software
34038
- * distributed under the License is distributed on an "AS IS" BASIS,
34039
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34040
- * See the License for the specific language governing permissions and
34041
- * limitations under the License.
34042
- *
34043
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34044
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
34045
- * */
34046
- var initialState$3 = {};
34047
- var slice$3 = createSlice({
34048
- initialState: initialState$3,
34049
- name: 'router',
34050
- reducers: {
34051
- navigateToUrl: function navigateToUrl(
34052
- // eslint-disable-next-line no-unused-vars
34053
- draft,
34054
- // eslint-disable-next-line no-unused-vars
34055
- action) {}
34479
+ }
34480
+ });
34056
34481
  }
34057
- });
34058
- var reducer$3 = slice$3.reducer;
34059
- var routerActions = slice$3.actions;
34060
-
34061
- /* *
34062
- * Licensed under the Apache License, Version 2.0 (the "License");
34063
- * you may not use this file except in compliance with the License.
34064
- * You may obtain a copy of the License at
34065
- *
34066
- * http://www.apache.org/licenses/LICENSE-2.0
34067
- *
34068
- * Unless required by applicable law or agreed to in writing, software
34069
- * distributed under the License is distributed on an "AS IS" BASIS,
34070
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34071
- * See the License for the specific language governing permissions and
34072
- * limitations under the License.
34073
- *
34074
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34075
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
34076
- * */
34077
- // stores navigate hook method to object, so it can be used outside components
34078
- var historyDict = {
34079
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
34080
- navigate: null
34482
+ return actionPayloads;
34081
34483
  };
34082
-
34083
- var utils = /*#__PURE__*/Object.freeze({
34084
- __proto__: null,
34085
- historyDict: historyDict
34086
- });
34087
-
34088
- var _marked$5 = /*#__PURE__*/_regeneratorRuntime().mark(navigateToUrlSaga),
34089
- _marked2$3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
34090
- function navigateToUrlSaga(action) {
34091
- var payload;
34092
- return _regeneratorRuntime().wrap(function navigateToUrlSaga$(_context) {
34093
- while (1) switch (_context.prev = _context.next) {
34094
- case 0:
34095
- payload = action.payload;
34096
- _context.next = 3;
34097
- return call(historyDict.navigate, payload.url);
34098
- case 3:
34099
- case "end":
34100
- return _context.stop();
34101
- }
34102
- }, _marked$5);
34103
- }
34104
- function rootSaga$4() {
34105
- return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
34106
- while (1) switch (_context2.prev = _context2.next) {
34107
- case 0:
34108
- _context2.next = 2;
34109
- return takeLatest$1(routerActions.navigateToUrl.type, navigateToUrlSaga);
34110
- case 2:
34111
- case "end":
34112
- return _context2.stop();
34113
- }
34114
- }, _marked2$3);
34484
+ /**
34485
+ * These targets are found for layer actions that work with a layerId like: SetLayerName, SetLayerEnabled, SetLayerOpacity, SetLayerDimension and SetLayerStyle
34486
+ * @param state
34487
+ * @param payload
34488
+ * @param actionType
34489
+ * @returns
34490
+ */
34491
+ var getLayerActionsTargets = function getLayerActionsTargets(state, payload, actionType) {
34492
+ var mapId = getMapIdFromLayerId(state, payload.layerId);
34493
+ var foundTargets = findTargets(state, payload, actionType, mapId);
34494
+ return foundTargets.map(function (target) {
34495
+ var payload = target.payload;
34496
+ return Object.assign(Object.assign({}, payload), {
34497
+ layerId: target.layerId,
34498
+ origin: SyncGroupActionOrigin.layerActions,
34499
+ mapId: payload.mapId
34500
+ });
34501
+ });
34502
+ };
34503
+ /**
34504
+ * These targets are found for the layer/map action AddLayer. AddLayer does not have a layerId (because it's new)
34505
+ * @param state
34506
+ * @param payload
34507
+ * @param actionType
34508
+ * @returns
34509
+ */
34510
+ var getAddLayerActionsTargets = function getAddLayerActionsTargets(state, payload, actionType) {
34511
+ var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34512
+ return foundTargets.map(function (_ref) {
34513
+ var payload = _ref.payload,
34514
+ targetId = _ref.targetId;
34515
+ var layer = payload.layer;
34516
+ layer.id;
34517
+ var layerWithoutId = __rest(layer, ["id"]);
34518
+ var layerId = webmapUtils.generateLayerId();
34519
+ return Object.assign(Object.assign({}, payload), {
34520
+ layer: layerWithoutId,
34521
+ layerId: layerId,
34522
+ mapId: targetId,
34523
+ origin: SyncGroupActionOrigin.add
34524
+ });
34525
+ });
34526
+ };
34527
+ /**
34528
+ * These targets are found for the layer/map action DeleteLayer. The layer is already gone, so there is no layerId anymore. Using layerIndex instead.
34529
+ * @param state
34530
+ * @param payload
34531
+ * @param actionType
34532
+ * @returns
34533
+ */
34534
+ var getLayerDeleteActionsTargets = function getLayerDeleteActionsTargets(state, payload, actionType) {
34535
+ var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34536
+ return foundTargets.map(function (target) {
34537
+ return Object.assign(Object.assign({}, target.payload), {
34538
+ mapId: target.targetId,
34539
+ layerId: target.layerId,
34540
+ origin: SyncGroupActionOrigin["delete"]
34541
+ });
34542
+ });
34543
+ };
34544
+ /**
34545
+ * These targets are found for the layer/map action MoveLayer. Here layers are referenced by newIndex and oldIndex.
34546
+ * @param state
34547
+ * @param payload
34548
+ * @param actionType
34549
+ * @returns
34550
+ */
34551
+ var getLayerMoveActionsTargets = function getLayerMoveActionsTargets(state, payload, actionType) {
34552
+ var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34553
+ return foundTargets.map(function (target) {
34554
+ return Object.assign(Object.assign({}, target.payload), {
34555
+ mapId: target.targetId,
34556
+ origin: SyncGroupActionOrigin.move
34557
+ });
34558
+ });
34559
+ };
34560
+ /**
34561
+ * These targets are found for the layer/map action SetActiveLayerId. It needs both a target mapId and layerId
34562
+ * @param state
34563
+ * @param payload
34564
+ * @param actionType
34565
+ * @returns
34566
+ */
34567
+ var getSetActiveLayerIdActionsTargets = function getSetActiveLayerIdActionsTargets(state, payload, actionType) {
34568
+ var sourceMapId = getMapIdFromLayerId(state, payload.layerId);
34569
+ var foundTargets = findTargets(state, payload, actionType, sourceMapId);
34570
+ return foundTargets.map(function (target) {
34571
+ return {
34572
+ mapId: target.targetId,
34573
+ layerId: target.layerId,
34574
+ origin: SyncGroupActionOrigin.activateLayerId
34575
+ };
34576
+ });
34577
+ };
34578
+ /**
34579
+ * These targets are found for baselayer actions that work with a mapId like: setBaseLayers
34580
+ * @param state
34581
+ * @param payload
34582
+ * @param actionType
34583
+ * @returns
34584
+ */
34585
+ var getMapBaseLayerActionsTargets = function getMapBaseLayerActionsTargets(state, payload, actionType) {
34586
+ var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34587
+ return foundTargets.map(function (target) {
34588
+ return {
34589
+ layers: payload.layers.map(function (layer) {
34590
+ return Object.assign(Object.assign({}, layer), {
34591
+ id: webmapUtils.generateLayerId()
34592
+ });
34593
+ }),
34594
+ mapId: target.targetId,
34595
+ origin: SyncGroupActionOrigin.layerActions
34596
+ };
34597
+ });
34598
+ };
34599
+
34600
+ var _marked$6 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$5);
34601
+ var setBaseLayers = layerActions.setBaseLayers,
34602
+ addLayer = layerActions.addLayer,
34603
+ layerChangeDimension = layerActions.layerChangeDimension,
34604
+ layerChangeEnabled = layerActions.layerChangeEnabled,
34605
+ layerChangeName = layerActions.layerChangeName,
34606
+ layerChangeOpacity = layerActions.layerChangeOpacity,
34607
+ layerChangeStyle = layerActions.layerChangeStyle,
34608
+ layerDelete = layerActions.layerDelete;
34609
+ var setTimeValidatorRexexp = /^(19|20)\d\d-(0[1-9]|1[012])-([012]\d|3[01])T([01]\d|2[0-3]):([0-5]\d):([0-5]\d)Z$/;
34610
+ function setTimeSaga(_ref) {
34611
+ var payload = _ref.payload;
34612
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
34613
+ var value, origin, targets, groups;
34614
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
34615
+ while (1) switch (_context.prev = _context.next) {
34616
+ case 0:
34617
+ value = payload.value, origin = payload.origin;
34618
+ /* Test if the value is according to the expected time format */
34619
+ if (setTimeValidatorRexexp.test(value)) {
34620
+ _context.next = 5;
34621
+ break;
34622
+ }
34623
+ console.error("setTime value ".concat(value, " does not conform to format [YYYY-MM-DDThh:mm:ssZ]. It was triggered by ").concat(origin));
34624
+ _context.next = 13;
34625
+ break;
34626
+ case 5:
34627
+ _context.next = 7;
34628
+ return select(getTargets, payload, SYNCGROUPS_TYPE_SETTIME);
34629
+ case 7:
34630
+ targets = _context.sent;
34631
+ _context.next = 10;
34632
+ return select(getTargetGroups, payload, SYNCGROUPS_TYPE_SETTIME);
34633
+ case 10:
34634
+ groups = _context.sent;
34635
+ _context.next = 13;
34636
+ return put(setTimeSync(payload, targets, groups));
34637
+ case 13:
34638
+ case "end":
34639
+ return _context.stop();
34640
+ }
34641
+ }, _callee);
34642
+ })();
34643
+ }
34644
+ function setBBoxSaga(_ref2) {
34645
+ var payload = _ref2.payload;
34646
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
34647
+ var targets, groups;
34648
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34649
+ while (1) switch (_context2.prev = _context2.next) {
34650
+ case 0:
34651
+ _context2.next = 2;
34652
+ return select(getTargets, payload, SYNCGROUPS_TYPE_SETBBOX);
34653
+ case 2:
34654
+ targets = _context2.sent;
34655
+ _context2.next = 5;
34656
+ return select(getTargetGroups, payload, SYNCGROUPS_TYPE_SETBBOX);
34657
+ case 5:
34658
+ groups = _context2.sent;
34659
+ _context2.next = 8;
34660
+ return put(setBboxSync(payload, targets, groups));
34661
+ case 8:
34662
+ case "end":
34663
+ return _context2.stop();
34664
+ }
34665
+ }, _callee2);
34666
+ })();
34667
+ }
34668
+ function layerActionsSaga(_ref3) {
34669
+ var payload = _ref3.payload,
34670
+ type = _ref3.type;
34671
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
34672
+ var targets;
34673
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
34674
+ while (1) switch (_context3.prev = _context3.next) {
34675
+ case 0:
34676
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34677
+ _context3.next = 2;
34678
+ break;
34679
+ }
34680
+ return _context3.abrupt("return");
34681
+ case 2:
34682
+ _context3.next = 4;
34683
+ return select(getLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34684
+ case 4:
34685
+ targets = _context3.sent;
34686
+ if (!(targets && targets.length > 0)) {
34687
+ _context3.next = 8;
34688
+ break;
34689
+ }
34690
+ _context3.next = 8;
34691
+ return put(setLayerActionSync(payload, targets, type));
34692
+ case 8:
34693
+ case "end":
34694
+ return _context3.stop();
34695
+ }
34696
+ }, _callee3);
34697
+ })();
34698
+ }
34699
+ function addLayerActionsSaga(_ref4) {
34700
+ var payload = _ref4.payload,
34701
+ type = _ref4.type;
34702
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
34703
+ var targets;
34704
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
34705
+ while (1) switch (_context4.prev = _context4.next) {
34706
+ case 0:
34707
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34708
+ _context4.next = 2;
34709
+ break;
34710
+ }
34711
+ return _context4.abrupt("return");
34712
+ case 2:
34713
+ _context4.next = 4;
34714
+ return select(getAddLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34715
+ case 4:
34716
+ targets = _context4.sent;
34717
+ if (!(targets && targets.length > 0)) {
34718
+ _context4.next = 8;
34719
+ break;
34720
+ }
34721
+ _context4.next = 8;
34722
+ return put(setLayerActionSync(payload, targets, type));
34723
+ case 8:
34724
+ case "end":
34725
+ return _context4.stop();
34726
+ }
34727
+ }, _callee4);
34728
+ })();
34729
+ }
34730
+ function deleteLayerActionsSaga(_ref5) {
34731
+ var payload = _ref5.payload,
34732
+ type = _ref5.type;
34733
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
34734
+ var targets;
34735
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
34736
+ while (1) switch (_context5.prev = _context5.next) {
34737
+ case 0:
34738
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34739
+ _context5.next = 2;
34740
+ break;
34741
+ }
34742
+ return _context5.abrupt("return");
34743
+ case 2:
34744
+ _context5.next = 4;
34745
+ return select(getLayerDeleteActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34746
+ case 4:
34747
+ targets = _context5.sent;
34748
+ if (!(targets && targets.length > 0)) {
34749
+ _context5.next = 8;
34750
+ break;
34751
+ }
34752
+ _context5.next = 8;
34753
+ return put(setLayerActionSync(payload, targets, type));
34754
+ case 8:
34755
+ case "end":
34756
+ return _context5.stop();
34757
+ }
34758
+ }, _callee5);
34759
+ })();
34760
+ }
34761
+ function moveLayerActionsSaga(_ref6) {
34762
+ var payload = _ref6.payload,
34763
+ type = _ref6.type;
34764
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
34765
+ var targets;
34766
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
34767
+ while (1) switch (_context6.prev = _context6.next) {
34768
+ case 0:
34769
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34770
+ _context6.next = 2;
34771
+ break;
34772
+ }
34773
+ return _context6.abrupt("return");
34774
+ case 2:
34775
+ _context6.next = 4;
34776
+ return select(getLayerMoveActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34777
+ case 4:
34778
+ targets = _context6.sent;
34779
+ if (!(targets && targets.length > 0)) {
34780
+ _context6.next = 8;
34781
+ break;
34782
+ }
34783
+ _context6.next = 8;
34784
+ return put(setLayerActionSync(payload, targets, type));
34785
+ case 8:
34786
+ case "end":
34787
+ return _context6.stop();
34788
+ }
34789
+ }, _callee6);
34790
+ })();
34791
+ }
34792
+ function setAutoLayerIdActionsSaga(_ref7) {
34793
+ var payload = _ref7.payload,
34794
+ type = _ref7.type;
34795
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
34796
+ var targets;
34797
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
34798
+ while (1) switch (_context7.prev = _context7.next) {
34799
+ case 0:
34800
+ _context7.next = 2;
34801
+ return select(getSetActiveLayerIdActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34802
+ case 2:
34803
+ targets = _context7.sent;
34804
+ if (!(targets && targets.length > 0)) {
34805
+ _context7.next = 6;
34806
+ break;
34807
+ }
34808
+ _context7.next = 6;
34809
+ return put(setLayerActionSync(payload, targets, type));
34810
+ case 6:
34811
+ case "end":
34812
+ return _context7.stop();
34813
+ }
34814
+ }, _callee7);
34815
+ })();
34816
+ }
34817
+ function mapBaseLayerActionsSaga(_ref8) {
34818
+ var payload = _ref8.payload,
34819
+ type = _ref8.type;
34820
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
34821
+ var targets;
34822
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
34823
+ while (1) switch (_context8.prev = _context8.next) {
34824
+ case 0:
34825
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34826
+ _context8.next = 2;
34827
+ break;
34828
+ }
34829
+ return _context8.abrupt("return");
34830
+ case 2:
34831
+ _context8.next = 4;
34832
+ return select(getMapBaseLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34833
+ case 4:
34834
+ targets = _context8.sent;
34835
+ if (!(targets && targets.length > 0)) {
34836
+ _context8.next = 8;
34837
+ break;
34838
+ }
34839
+ _context8.next = 8;
34840
+ return put(setLayerActionSync(payload, targets, type));
34841
+ case 8:
34842
+ case "end":
34843
+ return _context8.stop();
34844
+ }
34845
+ }, _callee8);
34846
+ })();
34847
+ }
34848
+ function rootSaga$5() {
34849
+ return _regeneratorRuntime().wrap(function rootSaga$(_context9) {
34850
+ while (1) switch (_context9.prev = _context9.next) {
34851
+ case 0:
34852
+ _context9.next = 2;
34853
+ return takeLatest$1(setTime.type, setTimeSaga);
34854
+ case 2:
34855
+ _context9.next = 4;
34856
+ return takeLatest$1(setBbox.type, setBBoxSaga);
34857
+ case 4:
34858
+ _context9.next = 6;
34859
+ return takeLatest$1(layerChangeName.type, layerActionsSaga);
34860
+ case 6:
34861
+ _context9.next = 8;
34862
+ return takeLatest$1(layerChangeEnabled.type, layerActionsSaga);
34863
+ case 8:
34864
+ _context9.next = 10;
34865
+ return takeLatest$1(layerChangeOpacity.type, layerActionsSaga);
34866
+ case 10:
34867
+ _context9.next = 12;
34868
+ return takeLatest$1(layerChangeDimension.type, layerActionsSaga);
34869
+ case 12:
34870
+ _context9.next = 14;
34871
+ return takeLatest$1(layerChangeStyle.type, layerActionsSaga);
34872
+ case 14:
34873
+ _context9.next = 16;
34874
+ return takeLatest$1(layerDelete.type, deleteLayerActionsSaga);
34875
+ case 16:
34876
+ _context9.next = 18;
34877
+ return takeLatest$1(addLayer.type, addLayerActionsSaga);
34878
+ case 18:
34879
+ _context9.next = 20;
34880
+ return takeLatest$1(mapActions.layerMoveLayer.type, moveLayerActionsSaga);
34881
+ case 20:
34882
+ _context9.next = 22;
34883
+ return takeLatest$1(mapActions.setAutoLayerId.type, setAutoLayerIdActionsSaga);
34884
+ case 22:
34885
+ _context9.next = 24;
34886
+ return takeLatest$1(setBaseLayers.type, mapBaseLayerActionsSaga);
34887
+ case 24:
34888
+ case "end":
34889
+ return _context9.stop();
34890
+ }
34891
+ }, _marked$6);
34115
34892
  }
34116
34893
 
34117
34894
  /* *
@@ -34127,16 +34904,38 @@ function rootSaga$4() {
34127
34904
  * See the License for the specific language governing permissions and
34128
34905
  * limitations under the License.
34129
34906
  *
34130
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34131
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
34907
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34908
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
34132
34909
  * */
34133
- var routerModuleConfig = {
34134
- id: 'router',
34135
- reducersMap: {
34136
- router: reducer$3
34137
- },
34138
- sagas: [rootSaga$4]
34139
- };
34910
+ var snackbarAdapter = createEntityAdapter();
34911
+ var initialState$3 = snackbarAdapter.getInitialState();
34912
+ var slice$3 = createSlice({
34913
+ initialState: initialState$3,
34914
+ name: 'snackbar',
34915
+ reducers: {
34916
+ // To open the snackbar call this action
34917
+ openSnackbar: function openSnackbar(
34918
+ // eslint-disable-next-line no-unused-vars
34919
+ draft,
34920
+ // eslint-disable-next-line no-unused-vars
34921
+ action) {},
34922
+ // triggerOpenSnackbarBySaga is triggered by the saga to open the snackbar after the current snackbars have all been closed
34923
+ // DO NOT CALL THIS ACTION DIRECTLY!
34924
+ triggerOpenSnackbarBySaga: function triggerOpenSnackbarBySaga(draft, action) {
34925
+ var snackbarContent = action.payload.snackbarContent;
34926
+ // Ensure we have an id before proceeding
34927
+ if (snackbarContent.id === undefined) {
34928
+ return;
34929
+ }
34930
+ snackbarAdapter.setOne(draft, snackbarContent);
34931
+ },
34932
+ closeSnackbar: function closeSnackbar(draft) {
34933
+ snackbarAdapter.removeAll(draft);
34934
+ }
34935
+ }
34936
+ });
34937
+ var reducer$3 = slice$3.reducer;
34938
+ var snackbarActions = slice$3.actions;
34140
34939
 
34141
34940
  /* *
34142
34941
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34154,20 +34953,30 @@ var routerModuleConfig = {
34154
34953
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34155
34954
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
34156
34955
  * */
34157
- var initialState$2 = {
34158
- isInitialised: false
34159
- };
34160
- var slice$2 = createSlice({
34161
- initialState: initialState$2,
34162
- name: 'app',
34163
- reducers: {
34164
- initialiseApp: function initialiseApp(draft) {
34165
- draft.isInitialised = true;
34166
- }
34956
+ var getSnackbarStore = function getSnackbarStore(store) {
34957
+ if (store && store.snackbar) {
34958
+ return store.snackbar;
34167
34959
  }
34960
+ return null;
34961
+ };
34962
+ var _snackbarAdapter$getS = snackbarAdapter.getSelectors(function (state) {
34963
+ var _a;
34964
+ return (_a = state === null || state === void 0 ? void 0 : state.snackbar) !== null && _a !== void 0 ? _a : {
34965
+ entities: {},
34966
+ ids: []
34967
+ };
34968
+ }),
34969
+ getCurrentSnackbarMessages = _snackbarAdapter$getS.selectAll;
34970
+ var getFirstSnackbarMessage = createSelector(getCurrentSnackbarMessages, function (currentMessages) {
34971
+ return currentMessages.length > 0 ? currentMessages[0] : undefined;
34972
+ });
34973
+
34974
+ var selectors$1 = /*#__PURE__*/Object.freeze({
34975
+ __proto__: null,
34976
+ getSnackbarStore: getSnackbarStore,
34977
+ getCurrentSnackbarMessages: getCurrentSnackbarMessages,
34978
+ getFirstSnackbarMessage: getFirstSnackbarMessage
34168
34979
  });
34169
- var reducer$2 = slice$2.reducer;
34170
- var appActions = slice$2.actions;
34171
34980
 
34172
34981
  /* *
34173
34982
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34185,11 +34994,95 @@ var appActions = slice$2.actions;
34185
34994
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34186
34995
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
34187
34996
  * */
34188
- var appModuleConfig = {
34189
- id: 'app-module',
34997
+
34998
+ var types = /*#__PURE__*/Object.freeze({
34999
+ __proto__: null
35000
+ });
35001
+
35002
+ var _marked$5 = /*#__PURE__*/_regeneratorRuntime().mark(openSnackbarSaga),
35003
+ _marked2$4 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
35004
+ var hideTime = 4000;
35005
+ function openSnackbarSaga(capturedAction) {
35006
+ var snackbarMessage, currentSnackbarMessages, id, currentSnackbarMessagesOpen;
35007
+ return _regeneratorRuntime().wrap(function openSnackbarSaga$(_context) {
35008
+ while (1) switch (_context.prev = _context.next) {
35009
+ case 0:
35010
+ snackbarMessage = capturedAction.payload.message;
35011
+ _context.next = 3;
35012
+ return select(getCurrentSnackbarMessages);
35013
+ case 3:
35014
+ currentSnackbarMessages = _context.sent;
35015
+ if (!currentSnackbarMessages.length) {
35016
+ _context.next = 7;
35017
+ break;
35018
+ }
35019
+ _context.next = 7;
35020
+ return put(snackbarActions.closeSnackbar());
35021
+ case 7:
35022
+ // Generate a unique id
35023
+ id = "snackbar".concat(Date.now().toString());
35024
+ _context.next = 10;
35025
+ return put(snackbarActions.triggerOpenSnackbarBySaga({
35026
+ snackbarContent: {
35027
+ message: snackbarMessage,
35028
+ id: id
35029
+ }
35030
+ }));
35031
+ case 10:
35032
+ _context.next = 12;
35033
+ return delay(hideTime);
35034
+ case 12:
35035
+ _context.next = 14;
35036
+ return select(getCurrentSnackbarMessages);
35037
+ case 14:
35038
+ currentSnackbarMessagesOpen = _context.sent;
35039
+ if (!currentSnackbarMessagesOpen.length) {
35040
+ _context.next = 18;
35041
+ break;
35042
+ }
35043
+ _context.next = 18;
35044
+ return put(snackbarActions.closeSnackbar());
35045
+ case 18:
35046
+ case "end":
35047
+ return _context.stop();
35048
+ }
35049
+ }, _marked$5);
35050
+ }
35051
+ function rootSaga$4() {
35052
+ return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
35053
+ while (1) switch (_context2.prev = _context2.next) {
35054
+ case 0:
35055
+ _context2.next = 2;
35056
+ return takeLatest$1(snackbarActions.openSnackbar.type, openSnackbarSaga);
35057
+ case 2:
35058
+ case "end":
35059
+ return _context2.stop();
35060
+ }
35061
+ }, _marked2$4);
35062
+ }
35063
+
35064
+ /* *
35065
+ * Licensed under the Apache License, Version 2.0 (the "License");
35066
+ * you may not use this file except in compliance with the License.
35067
+ * You may obtain a copy of the License at
35068
+ *
35069
+ * http://www.apache.org/licenses/LICENSE-2.0
35070
+ *
35071
+ * Unless required by applicable law or agreed to in writing, software
35072
+ * distributed under the License is distributed on an "AS IS" BASIS,
35073
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35074
+ * See the License for the specific language governing permissions and
35075
+ * limitations under the License.
35076
+ *
35077
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35078
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
35079
+ * */
35080
+ var snackbarModuleConfig = {
35081
+ id: 'snackbar-module',
34190
35082
  reducersMap: {
34191
- app: reducer$2
34192
- }
35083
+ snackbar: reducer$3
35084
+ },
35085
+ sagas: [rootSaga$4]
34193
35086
  };
34194
35087
 
34195
35088
  /* *
@@ -34208,43 +35101,20 @@ var appModuleConfig = {
34208
35101
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34209
35102
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
34210
35103
  * */
34211
- var drawAdapter$1 = createEntityAdapter({
34212
- selectId: function selectId(draw) {
34213
- return draw.mapId;
34214
- }
34215
- });
34216
- var initialState$1 = drawAdapter$1.getInitialState();
34217
- var slice$1 = createSlice({
34218
- initialState: initialState$1,
34219
- name: 'draw',
35104
+ var initialState$2 = {};
35105
+ var slice$2 = createSlice({
35106
+ initialState: initialState$2,
35107
+ name: 'router',
34220
35108
  reducers: {
34221
- setDrawValues: function setDrawValues(draft, action) {
34222
- if (draft.entities[action.payload.mapId]) {
34223
- drawAdapter$1.setOne(draft, action.payload);
34224
- }
34225
- },
34226
- // action caught in drawings/saga
34227
- submitDrawValues: function submitDrawValues(
35109
+ navigateToUrl: function navigateToUrl(
34228
35110
  // eslint-disable-next-line no-unused-vars
34229
35111
  draft,
34230
35112
  // eslint-disable-next-line no-unused-vars
34231
35113
  action) {}
34232
- },
34233
- extraReducers: function extraReducers(builder) {
34234
- builder.addCase(mapActions.registerMap, function (draft, action) {
34235
- drawAdapter$1.addOne(draft, {
34236
- mapId: action.payload.mapId,
34237
- area: undefined,
34238
- areaName: '',
34239
- id: ''
34240
- });
34241
- }).addCase(mapActions.unregisterMap, function (draft, action) {
34242
- drawAdapter$1.removeOne(draft, action.payload.mapId);
34243
- });
34244
35114
  }
34245
35115
  });
34246
- var reducer$1 = slice$1.reducer;
34247
- var drawActions = slice$1.actions;
35116
+ var reducer$2 = slice$2.reducer;
35117
+ var routerActions = slice$2.actions;
34248
35118
 
34249
35119
  /* *
34250
35120
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34262,27 +35132,70 @@ var drawActions = slice$1.actions;
34262
35132
  * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34263
35133
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
34264
35134
  * */
34265
- var getDrawStore = function getDrawStore(store) {
34266
- if (store && store.drawings) {
34267
- return store.drawings;
34268
- }
34269
- return null;
35135
+ // stores navigate hook method to object, so it can be used outside components
35136
+ var historyDict = {
35137
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35138
+ navigate: null
34270
35139
  };
34271
- var _drawAdapter$getSelec$1 = drawAdapter$1.getSelectors(function (state) {
34272
- var _a;
34273
- return (_a = state === null || state === void 0 ? void 0 : state.drawings) !== null && _a !== void 0 ? _a : {
34274
- entities: {},
34275
- ids: []
34276
- };
34277
- }),
34278
- selectDrawByMapId = _drawAdapter$getSelec$1.selectById;
34279
35140
 
34280
- var selectors$1 = /*#__PURE__*/Object.freeze({
35141
+ var utils = /*#__PURE__*/Object.freeze({
34281
35142
  __proto__: null,
34282
- getDrawStore: getDrawStore,
34283
- selectDrawByMapId: selectDrawByMapId
35143
+ historyDict: historyDict
34284
35144
  });
34285
35145
 
35146
+ var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(navigateToUrlSaga),
35147
+ _marked2$3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$3);
35148
+ function navigateToUrlSaga(action) {
35149
+ var payload;
35150
+ return _regeneratorRuntime().wrap(function navigateToUrlSaga$(_context) {
35151
+ while (1) switch (_context.prev = _context.next) {
35152
+ case 0:
35153
+ payload = action.payload;
35154
+ _context.next = 3;
35155
+ return call(historyDict.navigate, payload.url);
35156
+ case 3:
35157
+ case "end":
35158
+ return _context.stop();
35159
+ }
35160
+ }, _marked$4);
35161
+ }
35162
+ function rootSaga$3() {
35163
+ return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
35164
+ while (1) switch (_context2.prev = _context2.next) {
35165
+ case 0:
35166
+ _context2.next = 2;
35167
+ return takeLatest$1(routerActions.navigateToUrl.type, navigateToUrlSaga);
35168
+ case 2:
35169
+ case "end":
35170
+ return _context2.stop();
35171
+ }
35172
+ }, _marked2$3);
35173
+ }
35174
+
35175
+ /* *
35176
+ * Licensed under the Apache License, Version 2.0 (the "License");
35177
+ * you may not use this file except in compliance with the License.
35178
+ * You may obtain a copy of the License at
35179
+ *
35180
+ * http://www.apache.org/licenses/LICENSE-2.0
35181
+ *
35182
+ * Unless required by applicable law or agreed to in writing, software
35183
+ * distributed under the License is distributed on an "AS IS" BASIS,
35184
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35185
+ * See the License for the specific language governing permissions and
35186
+ * limitations under the License.
35187
+ *
35188
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35189
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
35190
+ * */
35191
+ var routerModuleConfig = {
35192
+ id: 'router',
35193
+ reducersMap: {
35194
+ router: reducer$2
35195
+ },
35196
+ sagas: [rootSaga$3]
35197
+ };
35198
+
34286
35199
  /* *
34287
35200
  * Licensed under the Apache License, Version 2.0 (the "License");
34288
35201
  * you may not use this file except in compliance with the License.
@@ -34299,10 +35212,20 @@ var selectors$1 = /*#__PURE__*/Object.freeze({
34299
35212
  * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34300
35213
  * Copyright 2022 - Finnish Meteorological Institute (FMI)
34301
35214
  * */
34302
-
34303
- var types = /*#__PURE__*/Object.freeze({
34304
- __proto__: null
35215
+ var initialState$1 = {
35216
+ isInitialised: false
35217
+ };
35218
+ var slice$1 = createSlice({
35219
+ initialState: initialState$1,
35220
+ name: 'app',
35221
+ reducers: {
35222
+ initialiseApp: function initialiseApp(draft) {
35223
+ draft.isInitialised = true;
35224
+ }
35225
+ }
34305
35226
  });
35227
+ var reducer$1 = slice$1.reducer;
35228
+ var appActions = slice$1.actions;
34306
35229
 
34307
35230
  /* *
34308
35231
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34317,15 +35240,14 @@ var types = /*#__PURE__*/Object.freeze({
34317
35240
  * See the License for the specific language governing permissions and
34318
35241
  * limitations under the License.
34319
35242
  *
34320
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34321
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
35243
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35244
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
34322
35245
  * */
34323
- var drawModuleConfig = {
34324
- id: 'draw-module',
35246
+ var appModuleConfig = {
35247
+ id: 'app-module',
34325
35248
  reducersMap: {
34326
- drawings: reducer$1
34327
- },
34328
- sagas: []
35249
+ app: reducer$1
35250
+ }
34329
35251
  };
34330
35252
 
34331
35253
  /* *
@@ -34350,9 +35272,6 @@ var drawAdapter = createEntityAdapter({
34350
35272
  return draw.drawToolId;
34351
35273
  }
34352
35274
  });
34353
- var getDrawLayerId = function getDrawLayerId(drawToolId) {
34354
- return "drawlayer-".concat(drawToolId);
34355
- };
34356
35275
  var getDrawToolByLayerId = function getDrawToolByLayerId(draft, layerId) {
34357
35276
  var state = R(draft);
34358
35277
  var drawTool = state.ids.map(function (id) {
@@ -34370,14 +35289,22 @@ var slice = createSlice({
34370
35289
  registerDrawTool: function registerDrawTool(draft, action) {
34371
35290
  var _action$payload = action.payload,
34372
35291
  drawToolId = _action$payload.drawToolId,
34373
- drawModes = _action$payload.drawModes;
35292
+ drawModes = _action$payload.drawModes,
35293
+ _action$payload$geoJS = _action$payload.geoJSONLayerId,
35294
+ geoJSONLayerId = _action$payload$geoJS === void 0 ? '' : _action$payload$geoJS;
34374
35295
  drawAdapter.addOne(draft, {
34375
35296
  drawToolId: drawToolId,
34376
- geoJSONLayerId: getDrawLayerId(drawToolId),
35297
+ geoJSONLayerId: geoJSONLayerId,
34377
35298
  activeDrawModeId: '',
34378
35299
  drawModes: drawModes
34379
35300
  });
34380
35301
  },
35302
+ unregisterDrawTool: function unregisterDrawTool(draft, action) {
35303
+ var drawToolId = action.payload.drawToolId;
35304
+ if (draft.entities[drawToolId]) {
35305
+ drawAdapter.removeOne(draft, drawToolId);
35306
+ }
35307
+ },
34381
35308
  changeDrawToolMode: function changeDrawToolMode(draft, action) {
34382
35309
  var _action$payload2 = action.payload,
34383
35310
  drawModeId = _action$payload2.drawModeId,
@@ -34398,6 +35325,16 @@ var slice = createSlice({
34398
35325
  } else {
34399
35326
  drawTool.activeDrawModeId = '';
34400
35327
  }
35328
+ },
35329
+ updateGeoJSONLayerId: function updateGeoJSONLayerId(draft, action) {
35330
+ var _action$payload3 = action.payload,
35331
+ geoJSONLayerId = _action$payload3.geoJSONLayerId,
35332
+ drawToolId = _action$payload3.drawToolId;
35333
+ var drawTool = draft.entities[drawToolId];
35334
+ if (!drawTool) {
35335
+ return;
35336
+ }
35337
+ drawTool.geoJSONLayerId = geoJSONLayerId;
34401
35338
  }
34402
35339
  },
34403
35340
  extraReducers: function extraReducers(builder) {
@@ -34409,9 +35346,9 @@ var slice = createSlice({
34409
35346
  }
34410
35347
  }).addCase(layerActions.updateFeatureProperties, function (draft, action) {
34411
35348
  var _a;
34412
- var _action$payload3 = action.payload,
34413
- properties = _action$payload3.properties,
34414
- layerId = _action$payload3.layerId;
35349
+ var _action$payload4 = action.payload,
35350
+ properties = _action$payload4.properties,
35351
+ layerId = _action$payload4.layerId;
34415
35352
  var drawToolId = getDrawToolByLayerId(draft, layerId);
34416
35353
  var entity = draft.entities[drawToolId];
34417
35354
  if (drawToolId && entity !== undefined) {
@@ -34476,44 +35413,54 @@ var _drawAdapter$getSelec = drawAdapter.getSelectors(function (state) {
34476
35413
  ids: []
34477
35414
  };
34478
35415
  }),
34479
- selectDrawingToolByMapId = _drawAdapter$getSelec.selectById;
34480
- var getDrawModeById = createSelector(selectDrawingToolByMapId, function (_store, _drawToolId, drawModeId) {
35416
+ selectDrawToolById = _drawAdapter$getSelec.selectById,
35417
+ selectAllDrawingTools = _drawAdapter$getSelec.selectAll;
35418
+ var getDrawModeById = createSelector(selectDrawToolById, function (_store, _drawToolId, drawModeId) {
34481
35419
  return drawModeId;
34482
35420
  }, function (draw, drawModeId) {
34483
35421
  return draw === null || draw === void 0 ? void 0 : draw.drawModes.find(function (tool) {
34484
35422
  return tool.drawModeId === drawModeId;
34485
35423
  });
34486
35424
  });
35425
+ var getActiveDrawModeId = createSelector(selectDrawToolById, function (drawingTool) {
35426
+ return (drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.activeDrawModeId) || '';
35427
+ });
35428
+ var getDrawToolGeoJSONLayerId = createSelector(selectDrawToolById, function (drawingTool) {
35429
+ return (drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.geoJSONLayerId) || '';
35430
+ });
34487
35431
 
34488
35432
  var selectors = /*#__PURE__*/Object.freeze({
34489
35433
  __proto__: null,
34490
35434
  getDrawingtoolStore: getDrawingtoolStore,
34491
- selectDrawingToolByMapId: selectDrawingToolByMapId,
34492
- getDrawModeById: getDrawModeById
35435
+ selectDrawToolById: selectDrawToolById,
35436
+ selectAllDrawingTools: selectAllDrawingTools,
35437
+ getDrawModeById: getDrawModeById,
35438
+ getActiveDrawModeId: getActiveDrawModeId,
35439
+ getDrawToolGeoJSONLayerId: getDrawToolGeoJSONLayerId
34493
35440
  });
34494
35441
 
34495
- var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
35442
+ var _marked$3 = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
34496
35443
  function registerDrawToolSaga(_ref) {
34497
35444
  var payload = _ref.payload;
34498
35445
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
34499
- var drawToolId, mapId, drawLayerId;
35446
+ var mapId, geoJSONLayerId;
34500
35447
  return _regeneratorRuntime().wrap(function _callee$(_context) {
34501
35448
  while (1) switch (_context.prev = _context.next) {
34502
35449
  case 0:
34503
- drawToolId = payload.drawToolId, mapId = payload.mapId;
34504
- drawLayerId = getDrawLayerId(drawToolId); // create for every drawTool a draw layer
35450
+ mapId = payload.mapId, geoJSONLayerId = payload.geoJSONLayerId; // create for every drawTool a draw layer
35451
+ if (!(geoJSONLayerId && mapId)) {
35452
+ _context.next = 4;
35453
+ break;
35454
+ }
34505
35455
  _context.next = 4;
34506
35456
  return put(mapStoreActions.addLayer({
34507
35457
  mapId: mapId,
34508
35458
  layer: {
34509
35459
  // empty geoJSON
34510
- geojson: {
34511
- type: 'FeatureCollection',
34512
- features: []
34513
- },
35460
+ geojson: emptyGeoJSON,
34514
35461
  layerType: LayerType.featureLayer
34515
35462
  },
34516
- layerId: drawLayerId,
35463
+ layerId: geoJSONLayerId,
34517
35464
  origin: 'drawings saga:registerDrawToolSaga'
34518
35465
  }));
34519
35466
  case 4:
@@ -34533,7 +35480,7 @@ function changeDrawToolSaga(_ref2) {
34533
35480
  _context2.prev = 0;
34534
35481
  drawModeId = payload.drawModeId, drawToolId = payload.drawToolId;
34535
35482
  _context2.next = 4;
34536
- return select(selectDrawingToolByMapId, drawToolId);
35483
+ return select(selectDrawToolById, drawToolId);
34537
35484
  case 4:
34538
35485
  drawingTool = _context2.sent;
34539
35486
  _context2.next = 7;
@@ -34621,7 +35568,7 @@ function drawingSaga() {
34621
35568
  case "end":
34622
35569
  return _context3.stop();
34623
35570
  }
34624
- }, _marked$4);
35571
+ }, _marked$3);
34625
35572
  }
34626
35573
 
34627
35574
  /* *
@@ -34648,6 +35595,42 @@ var drawtoolModuleConfig = {
34648
35595
  sagas: [drawingSaga]
34649
35596
  };
34650
35597
 
35598
+ /* *
35599
+ * Licensed under the Apache License, Version 2.0 (the "License");
35600
+ * you may not use this file except in compliance with the License.
35601
+ * You may obtain a copy of the License at
35602
+ *
35603
+ * http://www.apache.org/licenses/LICENSE-2.0
35604
+ *
35605
+ * Unless required by applicable law or agreed to in writing, software
35606
+ * distributed under the License is distributed on an "AS IS" BASIS,
35607
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35608
+ * See the License for the specific language governing permissions and
35609
+ * limitations under the License.
35610
+ *
35611
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35612
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
35613
+ * */
35614
+ var getSingularDrawtoolDrawLayerId = function getSingularDrawtoolDrawLayerId(mapId) {
35615
+ return "drawlayer-".concat(mapId);
35616
+ };
35617
+ var getGeoJSONPropertyValue = function getGeoJSONPropertyValue(property, properties, polygonDrawMode) {
35618
+ var defaultProperties = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultGeoJSONStyleProperties;
35619
+ // if a shape is set, extract the style from there
35620
+ if (properties[property]) {
35621
+ return properties[property];
35622
+ }
35623
+ // if active polygon tool is preset, retreive style from there
35624
+ if (polygonDrawMode) {
35625
+ var polygonDrawModeProperty = polygonDrawMode.shape.type === 'Feature' && polygonDrawMode.shape.properties[property];
35626
+ if (polygonDrawModeProperty) {
35627
+ return polygonDrawModeProperty;
35628
+ }
35629
+ }
35630
+ // otherwise get values from defaultStyle
35631
+ return defaultProperties[property];
35632
+ };
35633
+
34651
35634
  var createLayersState = function createLayersState(layerId) {
34652
35635
  var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34653
35636
  return {
@@ -34880,496 +35863,6 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
34880
35863
  testGeoJSON: testGeoJSON
34881
35864
  });
34882
35865
 
34883
- /* *
34884
- * Licensed under the Apache License, Version 2.0 (the "License");
34885
- * you may not use this file except in compliance with the License.
34886
- * You may obtain a copy of the License at
34887
- *
34888
- * http://www.apache.org/licenses/LICENSE-2.0
34889
- *
34890
- * Unless required by applicable law or agreed to in writing, software
34891
- * distributed under the License is distributed on an "AS IS" BASIS,
34892
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34893
- * See the License for the specific language governing permissions and
34894
- * limitations under the License.
34895
- *
34896
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34897
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
34898
- * */
34899
- /**
34900
- * Tries to find the layerId's in the other map based on the payload of the action. It works for all layer actions.
34901
- * @param state
34902
- * @param mapId
34903
- * @param targetMapId
34904
- * @param payload
34905
- * @returns
34906
- */
34907
- var getTargetLayerIdFromPayload = function getTargetLayerIdFromPayload(state, mapId, targetMapId, payload) {
34908
- if (!payload) {
34909
- return null;
34910
- }
34911
- /* Try to find the layer for the DeleteLayerPayload, it uses layerIndex to reference the layer */
34912
- if ('layerIndex' in payload) {
34913
- var targetLayer = getLayerByLayerIndex(state, targetMapId, payload.layerIndex);
34914
- return !targetLayer ? null : targetLayer.id;
34915
- }
34916
- /* Try to find the layer for the LayerActionsWithLayerIds, it uses layerId to reference the layer */
34917
- if ('layerId' in payload) {
34918
- var _targetLayer = getLayerByLayerIndex(state, targetMapId, getLayerIndexByLayerId(state, mapId, payload.layerId));
34919
- return !_targetLayer ? null : _targetLayer.id;
34920
- }
34921
- /* This payload probably does not reference to a layerId */
34922
- return null;
34923
- };
34924
- /**
34925
- * Local helper function used by getLayerDeleteActionsTargets, getLayerActionsTargets, getAddLayerActionsTargets, getTargetLayerIdFromPayload to find the targets
34926
- * @param state
34927
- * @param payload
34928
- * @param actionType
34929
- * @param sourceMapId
34930
- * @returns The found targets
34931
- */
34932
- var findTargets = function findTargets(state, payload, actionType, sourceMapId) {
34933
- var actionPayloads = [];
34934
- var targetsInActionPayload = {};
34935
- var syncronizationGroupStore = syncGroupStore(state);
34936
- if (syncronizationGroupStore && payload) {
34937
- syncronizationGroupStore.groups.allIds.forEach(function (id) {
34938
- var syncronizationGroup = syncronizationGroupStore.groups.byId[id];
34939
- if (actionType === syncronizationGroup.type) {
34940
- /* Check if the source is in the target list of the synchonizationGroup */
34941
- var source = syncronizationGroup.targets.byId[sourceMapId];
34942
- /* If the source is part of the target list, and is linked, continue syncing the other targets */
34943
- if (source && source.linked) {
34944
- syncronizationGroup.targets.allIds.forEach(function (targetId) {
34945
- var target = syncronizationGroup.targets.byId[targetId];
34946
- if (targetId !== sourceMapId && target.linked && !targetsInActionPayload[targetId]) {
34947
- /* Remember that we have already added this target in the action payloads, prevents adding it twice */
34948
- targetsInActionPayload[targetId] = true;
34949
- var otherLayerId = getTargetLayerIdFromPayload(state, sourceMapId, targetId, payload);
34950
- actionPayloads.push({
34951
- payload: payload,
34952
- targetId: targetId,
34953
- layerId: otherLayerId
34954
- });
34955
- }
34956
- });
34957
- }
34958
- }
34959
- });
34960
- }
34961
- return actionPayloads;
34962
- };
34963
- /**
34964
- * These targets are found for layer actions that work with a layerId like: SetLayerName, SetLayerEnabled, SetLayerOpacity, SetLayerDimension and SetLayerStyle
34965
- * @param state
34966
- * @param payload
34967
- * @param actionType
34968
- * @returns
34969
- */
34970
- var getLayerActionsTargets = function getLayerActionsTargets(state, payload, actionType) {
34971
- var mapId = getMapIdFromLayerId(state, payload.layerId);
34972
- var foundTargets = findTargets(state, payload, actionType, mapId);
34973
- return foundTargets.map(function (target) {
34974
- var payload = target.payload;
34975
- return Object.assign(Object.assign({}, payload), {
34976
- layerId: target.layerId,
34977
- origin: SyncGroupActionOrigin.layerActions,
34978
- mapId: payload.mapId
34979
- });
34980
- });
34981
- };
34982
- /**
34983
- * These targets are found for the layer/map action AddLayer. AddLayer does not have a layerId (because it's new)
34984
- * @param state
34985
- * @param payload
34986
- * @param actionType
34987
- * @returns
34988
- */
34989
- var getAddLayerActionsTargets = function getAddLayerActionsTargets(state, payload, actionType) {
34990
- var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34991
- return foundTargets.map(function (_ref) {
34992
- var payload = _ref.payload,
34993
- targetId = _ref.targetId;
34994
- var layer = payload.layer;
34995
- layer.id;
34996
- var layerWithoutId = __rest(layer, ["id"]);
34997
- var layerId = webmapUtils.generateLayerId();
34998
- return Object.assign(Object.assign({}, payload), {
34999
- layer: layerWithoutId,
35000
- layerId: layerId,
35001
- mapId: targetId,
35002
- origin: SyncGroupActionOrigin.add
35003
- });
35004
- });
35005
- };
35006
- /**
35007
- * These targets are found for the layer/map action DeleteLayer. The layer is already gone, so there is no layerId anymore. Using layerIndex instead.
35008
- * @param state
35009
- * @param payload
35010
- * @param actionType
35011
- * @returns
35012
- */
35013
- var getLayerDeleteActionsTargets = function getLayerDeleteActionsTargets(state, payload, actionType) {
35014
- var foundTargets = findTargets(state, payload, actionType, payload.mapId);
35015
- return foundTargets.map(function (target) {
35016
- return Object.assign(Object.assign({}, target.payload), {
35017
- mapId: target.targetId,
35018
- layerId: target.layerId,
35019
- origin: SyncGroupActionOrigin["delete"]
35020
- });
35021
- });
35022
- };
35023
- /**
35024
- * These targets are found for the layer/map action MoveLayer. Here layers are referenced by newIndex and oldIndex.
35025
- * @param state
35026
- * @param payload
35027
- * @param actionType
35028
- * @returns
35029
- */
35030
- var getLayerMoveActionsTargets = function getLayerMoveActionsTargets(state, payload, actionType) {
35031
- var foundTargets = findTargets(state, payload, actionType, payload.mapId);
35032
- return foundTargets.map(function (target) {
35033
- return Object.assign(Object.assign({}, target.payload), {
35034
- mapId: target.targetId,
35035
- origin: SyncGroupActionOrigin.move
35036
- });
35037
- });
35038
- };
35039
- /**
35040
- * These targets are found for the layer/map action SetActiveLayerId. It needs both a target mapId and layerId
35041
- * @param state
35042
- * @param payload
35043
- * @param actionType
35044
- * @returns
35045
- */
35046
- var getSetActiveLayerIdActionsTargets = function getSetActiveLayerIdActionsTargets(state, payload, actionType) {
35047
- var sourceMapId = getMapIdFromLayerId(state, payload.layerId);
35048
- var foundTargets = findTargets(state, payload, actionType, sourceMapId);
35049
- return foundTargets.map(function (target) {
35050
- return {
35051
- mapId: target.targetId,
35052
- layerId: target.layerId,
35053
- origin: SyncGroupActionOrigin.activateLayerId
35054
- };
35055
- });
35056
- };
35057
- /**
35058
- * These targets are found for baselayer actions that work with a mapId like: setBaseLayers
35059
- * @param state
35060
- * @param payload
35061
- * @param actionType
35062
- * @returns
35063
- */
35064
- var getMapBaseLayerActionsTargets = function getMapBaseLayerActionsTargets(state, payload, actionType) {
35065
- var foundTargets = findTargets(state, payload, actionType, payload.mapId);
35066
- return foundTargets.map(function (target) {
35067
- return {
35068
- layers: payload.layers.map(function (layer) {
35069
- return Object.assign(Object.assign({}, layer), {
35070
- id: webmapUtils.generateLayerId()
35071
- });
35072
- }),
35073
- mapId: target.targetId,
35074
- origin: SyncGroupActionOrigin.layerActions
35075
- };
35076
- });
35077
- };
35078
-
35079
- var _marked$3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$3);
35080
- var setBaseLayers = layerActions.setBaseLayers,
35081
- addLayer = layerActions.addLayer,
35082
- layerChangeDimension = layerActions.layerChangeDimension,
35083
- layerChangeEnabled = layerActions.layerChangeEnabled,
35084
- layerChangeName = layerActions.layerChangeName,
35085
- layerChangeOpacity = layerActions.layerChangeOpacity,
35086
- layerChangeStyle = layerActions.layerChangeStyle,
35087
- layerDelete = layerActions.layerDelete;
35088
- var setTimeValidatorRexexp = /^(19|20)\d\d-(0[1-9]|1[012])-([012]\d|3[01])T([01]\d|2[0-3]):([0-5]\d):([0-5]\d)Z$/;
35089
- function setTimeSaga(_ref) {
35090
- var payload = _ref.payload;
35091
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
35092
- var value, origin, targets, groups;
35093
- return _regeneratorRuntime().wrap(function _callee$(_context) {
35094
- while (1) switch (_context.prev = _context.next) {
35095
- case 0:
35096
- value = payload.value, origin = payload.origin;
35097
- /* Test if the value is according to the expected time format */
35098
- if (setTimeValidatorRexexp.test(value)) {
35099
- _context.next = 5;
35100
- break;
35101
- }
35102
- console.error("setTime value ".concat(value, " does not conform to format [YYYY-MM-DDThh:mm:ssZ]. It was triggered by ").concat(origin));
35103
- _context.next = 13;
35104
- break;
35105
- case 5:
35106
- _context.next = 7;
35107
- return select(getTargets, payload, SYNCGROUPS_TYPE_SETTIME);
35108
- case 7:
35109
- targets = _context.sent;
35110
- _context.next = 10;
35111
- return select(getTargetGroups, payload, SYNCGROUPS_TYPE_SETTIME);
35112
- case 10:
35113
- groups = _context.sent;
35114
- _context.next = 13;
35115
- return put(setTimeSync(payload, targets, groups));
35116
- case 13:
35117
- case "end":
35118
- return _context.stop();
35119
- }
35120
- }, _callee);
35121
- })();
35122
- }
35123
- function setBBoxSaga(_ref2) {
35124
- var payload = _ref2.payload;
35125
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
35126
- var targets, groups;
35127
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
35128
- while (1) switch (_context2.prev = _context2.next) {
35129
- case 0:
35130
- _context2.next = 2;
35131
- return select(getTargets, payload, SYNCGROUPS_TYPE_SETBBOX);
35132
- case 2:
35133
- targets = _context2.sent;
35134
- _context2.next = 5;
35135
- return select(getTargetGroups, payload, SYNCGROUPS_TYPE_SETBBOX);
35136
- case 5:
35137
- groups = _context2.sent;
35138
- _context2.next = 8;
35139
- return put(setBboxSync(payload, targets, groups));
35140
- case 8:
35141
- case "end":
35142
- return _context2.stop();
35143
- }
35144
- }, _callee2);
35145
- })();
35146
- }
35147
- function layerActionsSaga(_ref3) {
35148
- var payload = _ref3.payload,
35149
- type = _ref3.type;
35150
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
35151
- var targets;
35152
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
35153
- while (1) switch (_context3.prev = _context3.next) {
35154
- case 0:
35155
- if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
35156
- _context3.next = 2;
35157
- break;
35158
- }
35159
- return _context3.abrupt("return");
35160
- case 2:
35161
- _context3.next = 4;
35162
- return select(getLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
35163
- case 4:
35164
- targets = _context3.sent;
35165
- if (!(targets && targets.length > 0)) {
35166
- _context3.next = 8;
35167
- break;
35168
- }
35169
- _context3.next = 8;
35170
- return put(setLayerActionSync(payload, targets, type));
35171
- case 8:
35172
- case "end":
35173
- return _context3.stop();
35174
- }
35175
- }, _callee3);
35176
- })();
35177
- }
35178
- function addLayerActionsSaga(_ref4) {
35179
- var payload = _ref4.payload,
35180
- type = _ref4.type;
35181
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
35182
- var targets;
35183
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
35184
- while (1) switch (_context4.prev = _context4.next) {
35185
- case 0:
35186
- if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
35187
- _context4.next = 2;
35188
- break;
35189
- }
35190
- return _context4.abrupt("return");
35191
- case 2:
35192
- _context4.next = 4;
35193
- return select(getAddLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
35194
- case 4:
35195
- targets = _context4.sent;
35196
- if (!(targets && targets.length > 0)) {
35197
- _context4.next = 8;
35198
- break;
35199
- }
35200
- _context4.next = 8;
35201
- return put(setLayerActionSync(payload, targets, type));
35202
- case 8:
35203
- case "end":
35204
- return _context4.stop();
35205
- }
35206
- }, _callee4);
35207
- })();
35208
- }
35209
- function deleteLayerActionsSaga(_ref5) {
35210
- var payload = _ref5.payload,
35211
- type = _ref5.type;
35212
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
35213
- var targets;
35214
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
35215
- while (1) switch (_context5.prev = _context5.next) {
35216
- case 0:
35217
- if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
35218
- _context5.next = 2;
35219
- break;
35220
- }
35221
- return _context5.abrupt("return");
35222
- case 2:
35223
- _context5.next = 4;
35224
- return select(getLayerDeleteActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
35225
- case 4:
35226
- targets = _context5.sent;
35227
- if (!(targets && targets.length > 0)) {
35228
- _context5.next = 8;
35229
- break;
35230
- }
35231
- _context5.next = 8;
35232
- return put(setLayerActionSync(payload, targets, type));
35233
- case 8:
35234
- case "end":
35235
- return _context5.stop();
35236
- }
35237
- }, _callee5);
35238
- })();
35239
- }
35240
- function moveLayerActionsSaga(_ref6) {
35241
- var payload = _ref6.payload,
35242
- type = _ref6.type;
35243
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
35244
- var targets;
35245
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
35246
- while (1) switch (_context6.prev = _context6.next) {
35247
- case 0:
35248
- if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
35249
- _context6.next = 2;
35250
- break;
35251
- }
35252
- return _context6.abrupt("return");
35253
- case 2:
35254
- _context6.next = 4;
35255
- return select(getLayerMoveActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
35256
- case 4:
35257
- targets = _context6.sent;
35258
- if (!(targets && targets.length > 0)) {
35259
- _context6.next = 8;
35260
- break;
35261
- }
35262
- _context6.next = 8;
35263
- return put(setLayerActionSync(payload, targets, type));
35264
- case 8:
35265
- case "end":
35266
- return _context6.stop();
35267
- }
35268
- }, _callee6);
35269
- })();
35270
- }
35271
- function setAutoLayerIdActionsSaga(_ref7) {
35272
- var payload = _ref7.payload,
35273
- type = _ref7.type;
35274
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
35275
- var targets;
35276
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
35277
- while (1) switch (_context7.prev = _context7.next) {
35278
- case 0:
35279
- _context7.next = 2;
35280
- return select(getSetActiveLayerIdActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
35281
- case 2:
35282
- targets = _context7.sent;
35283
- if (!(targets && targets.length > 0)) {
35284
- _context7.next = 6;
35285
- break;
35286
- }
35287
- _context7.next = 6;
35288
- return put(setLayerActionSync(payload, targets, type));
35289
- case 6:
35290
- case "end":
35291
- return _context7.stop();
35292
- }
35293
- }, _callee7);
35294
- })();
35295
- }
35296
- function mapBaseLayerActionsSaga(_ref8) {
35297
- var payload = _ref8.payload,
35298
- type = _ref8.type;
35299
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
35300
- var targets;
35301
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
35302
- while (1) switch (_context8.prev = _context8.next) {
35303
- case 0:
35304
- if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
35305
- _context8.next = 2;
35306
- break;
35307
- }
35308
- return _context8.abrupt("return");
35309
- case 2:
35310
- _context8.next = 4;
35311
- return select(getMapBaseLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
35312
- case 4:
35313
- targets = _context8.sent;
35314
- if (!(targets && targets.length > 0)) {
35315
- _context8.next = 8;
35316
- break;
35317
- }
35318
- _context8.next = 8;
35319
- return put(setLayerActionSync(payload, targets, type));
35320
- case 8:
35321
- case "end":
35322
- return _context8.stop();
35323
- }
35324
- }, _callee8);
35325
- })();
35326
- }
35327
- function rootSaga$3() {
35328
- return _regeneratorRuntime().wrap(function rootSaga$(_context9) {
35329
- while (1) switch (_context9.prev = _context9.next) {
35330
- case 0:
35331
- _context9.next = 2;
35332
- return takeLatest$1(setTime.type, setTimeSaga);
35333
- case 2:
35334
- _context9.next = 4;
35335
- return takeLatest$1(setBbox.type, setBBoxSaga);
35336
- case 4:
35337
- _context9.next = 6;
35338
- return takeLatest$1(layerChangeName.type, layerActionsSaga);
35339
- case 6:
35340
- _context9.next = 8;
35341
- return takeLatest$1(layerChangeEnabled.type, layerActionsSaga);
35342
- case 8:
35343
- _context9.next = 10;
35344
- return takeLatest$1(layerChangeOpacity.type, layerActionsSaga);
35345
- case 10:
35346
- _context9.next = 12;
35347
- return takeLatest$1(layerChangeDimension.type, layerActionsSaga);
35348
- case 12:
35349
- _context9.next = 14;
35350
- return takeLatest$1(layerChangeStyle.type, layerActionsSaga);
35351
- case 14:
35352
- _context9.next = 16;
35353
- return takeLatest$1(layerDelete.type, deleteLayerActionsSaga);
35354
- case 16:
35355
- _context9.next = 18;
35356
- return takeLatest$1(addLayer.type, addLayerActionsSaga);
35357
- case 18:
35358
- _context9.next = 20;
35359
- return takeLatest$1(mapActions.layerMoveLayer.type, moveLayerActionsSaga);
35360
- case 20:
35361
- _context9.next = 22;
35362
- return takeLatest$1(mapActions.setAutoLayerId.type, setAutoLayerIdActionsSaga);
35363
- case 22:
35364
- _context9.next = 24;
35365
- return takeLatest$1(setBaseLayers.type, mapBaseLayerActionsSaga);
35366
- case 24:
35367
- case "end":
35368
- return _context9.stop();
35369
- }
35370
- }, _marked$3);
35371
- }
35372
-
35373
35866
  var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(updateSourceValueWhenLinkingComponentToGroupSaga),
35374
35867
  _marked2$2 = /*#__PURE__*/_regeneratorRuntime().mark(updateViewStateSaga),
35375
35868
  _marked3$1 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$2);
@@ -35527,9 +36020,9 @@ function rootSaga$2() {
35527
36020
  var synchronizationGroupConfig = {
35528
36021
  id: 'syncronizationGroupStore-module',
35529
36022
  reducersMap: {
35530
- syncronizationGroupStore: reducer$7
36023
+ syncronizationGroupStore: reducer$6
35531
36024
  },
35532
- sagas: [rootSaga$3, rootSaga$2]
36025
+ sagas: [rootSaga$5, rootSaga$2]
35533
36026
  };
35534
36027
 
35535
36028
  var _marked$1 = /*#__PURE__*/_regeneratorRuntime().mark(layerSelectRemoveServiceSaga),
@@ -35707,7 +36200,7 @@ function rootSaga$1() {
35707
36200
  var layerSelectConfig = {
35708
36201
  id: 'layerSelect-module',
35709
36202
  reducersMap: {
35710
- layerSelect: reducer$5
36203
+ layerSelect: reducer$4
35711
36204
  },
35712
36205
  sagas: [rootSaga$1]
35713
36206
  };
@@ -35822,7 +36315,7 @@ function rootSaga() {
35822
36315
  var uiModuleConfig = {
35823
36316
  id: 'ui-module',
35824
36317
  reducersMap: {
35825
- ui: reducer$9
36318
+ ui: reducer$8
35826
36319
  },
35827
36320
  sagas: [rootSaga]
35828
36321
  };
@@ -35843,6 +36336,6 @@ var uiModuleConfig = {
35843
36336
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35844
36337
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
35845
36338
  * */
35846
- var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModuleConfig, layerSelectConfig, snackbarModuleConfig, drawModuleConfig, drawtoolModuleConfig];
36339
+ var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModuleConfig, layerSelectConfig, snackbarModuleConfig, drawtoolModuleConfig];
35847
36340
 
35848
- export { appActions, appModuleConfig, coreModuleConfig, drawActions, drawModuleConfig, selectors$1 as drawSelectors, types as drawTypes, drawtoolActions, drawtoolModuleConfig, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, selectors$6 as genericSelectors, types$4 as genericTypes, getUserAddedServices, initialState$7 as initialState, layerActions, reducer$a as layerReducer, layerSelectActions, initialState$5 as layerSelectInitialState, selectors$3 as layerSelectSelectors, types$2 as layerSelectTypes, selectors$9 as layerSelectors, types$8 as layerTypes, utils$2 as layerUtils, mapActions, constants$1 as mapConstants, enums as mapEnums, selectors$5 as mapSelectors, mapStoreActions, mapStoreModuleConfig, types$7 as mapTypes, mapUtils, routerActions, routerModuleConfig, utils as routerUtils, serviceActions, selectors$4 as serviceSelectors, types$3 as serviceTypes, setUserAddedServices, snackbarActions, snackbarModuleConfig, selectors$2 as snackbarSelectors, types$1 as snackbarTypes, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants as syncConstants, actions as syncGroupsActions, selector as syncGroupsSelector, selectors$7 as syncGroupsSelectors, types$5 as syncGroupsTypes, types$5 as types, uiActions, uiModuleConfig, reducer$9 as uiReducer, selectors$8 as uiSelectors, types$6 as uiTypes, reducer$8 as webmapReducer };
36341
+ export { appActions, appModuleConfig, coreModuleConfig, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, rootSaga$5 as genericSaga, selectors$5 as genericSelectors, types$3 as genericTypes, getGeoJSONPropertyValue, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$6 as initialState, layerActions, reducer$9 as layerReducer, layerSelectActions, initialState$4 as layerSelectInitialState, selectors$2 as layerSelectSelectors, types$1 as layerSelectTypes, selectors$8 as layerSelectors, types$7 as layerTypes, utils$2 as layerUtils, mapActions, constants$1 as mapConstants, enums as mapEnums, selectors$4 as mapSelectors, mapStoreActions, mapStoreModuleConfig, types$6 as mapTypes, mapUtils, routerActions, routerModuleConfig, utils as routerUtils, serviceActions, selectors$3 as serviceSelectors, types$2 as serviceTypes, setUserAddedServices, snackbarActions, snackbarModuleConfig, selectors$1 as snackbarSelectors, types as snackbarTypes, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants as syncConstants, actions as syncGroupsActions, reducer$6 as syncGroupsReducer, selector as syncGroupsSelector, selectors$6 as syncGroupsSelectors, types$4 as syncGroupsTypes, types$4 as types, uiActions, uiModuleConfig, reducer$8 as uiReducer, selectors$7 as uiSelectors, types$5 as uiTypes, reducer$7 as webmapReducer };