@opengeoweb/store 7.0.0 → 8.1.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 (31) hide show
  1. package/index.esm.js +1635 -1064
  2. package/package.json +5 -4
  3. package/src/store/coreModuleConfig.d.ts +1 -1
  4. package/src/store/drawingtool/index.d.ts +3 -1
  5. package/src/store/drawingtool/reducer.d.ts +10 -9
  6. package/src/store/drawingtool/reducer.spec.d.ts +3 -2
  7. package/src/store/drawingtool/selectors.d.ts +12 -2
  8. package/src/store/drawingtool/utils.d.ts +3 -0
  9. package/src/store/generic/sagas.d.ts +1 -0
  10. package/src/store/generic/synchronizationGroups/index.d.ts +1 -1
  11. package/src/store/index.d.ts +1 -1
  12. package/src/store/mapStore/config.d.ts +5 -0
  13. package/src/store/mapStore/index.d.ts +1 -0
  14. package/src/store/mapStore/layers/reducer.d.ts +3 -1
  15. package/src/store/mapStore/layers/selectors.d.ts +13 -0
  16. package/src/store/mapStore/layers/types.d.ts +7 -1
  17. package/src/store/mapStore/map/index.d.ts +1 -0
  18. package/src/store/mapStore/map/selectors.d.ts +11 -1
  19. package/src/store/mapStore/map/types.d.ts +2 -0
  20. package/src/store/mapStore/map/utils.d.ts +1 -0
  21. package/src/store/mapStore/service/types.d.ts +2 -1
  22. package/src/store/types.d.ts +1 -2
  23. package/src/store/ui/types.d.ts +2 -1
  24. package/src/store/drawings/config.d.ts +0 -4
  25. package/src/store/drawings/index.d.ts +0 -4
  26. package/src/store/drawings/reducer.d.ts +0 -9
  27. package/src/store/drawings/selectors.d.ts +0 -3
  28. package/src/store/drawings/selectors.spec.d.ts +0 -1
  29. package/src/store/drawings/testUtils.d.ts +0 -1
  30. package/src/store/drawings/types.d.ts +0 -21
  31. /package/src/store/{drawings/reducer.spec.d.ts → drawingtool/utils.spec.d.ts} +0 -0
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) {
@@ -9243,10 +9771,24 @@ var slice$a = createSlice({
9243
9771
  draft.allIds.push(layerId);
9244
9772
  }
9245
9773
  },
9246
- layerChangeDimension: function layerChangeDimension(draft, action) {
9774
+ duplicateMapLayer: function duplicateMapLayer(draft, action) {
9247
9775
  var _action$payload2 = action.payload,
9248
- layerIdFromAction = _action$payload2.layerId,
9249
- dimension = _action$payload2.dimension;
9776
+ oldLayerId = _action$payload2.oldLayerId,
9777
+ newLayerId = _action$payload2.newLayerId,
9778
+ mapId = _action$payload2.mapId;
9779
+ var oldLayer = draft.byId[oldLayerId];
9780
+ if (oldLayer && !draft.byId[newLayerId]) {
9781
+ draft.byId[newLayerId] = createLayer(Object.assign(Object.assign({}, draft.byId[oldLayerId]), {
9782
+ id: newLayerId,
9783
+ mapId: mapId
9784
+ }));
9785
+ draft.allIds.push(newLayerId);
9786
+ }
9787
+ },
9788
+ layerChangeDimension: function layerChangeDimension(draft, action) {
9789
+ var _action$payload3 = action.payload,
9790
+ layerIdFromAction = _action$payload3.layerId,
9791
+ dimension = _action$payload3.dimension;
9250
9792
  var layerFromAction = draft.byId[layerIdFromAction];
9251
9793
  if (!layerFromAction) {
9252
9794
  return;
@@ -9255,49 +9797,49 @@ var slice$a = createSlice({
9255
9797
  produceDraftStateForAllLayersForDimensionWithinMap(draft, dimension, mapId, layerIdFromAction);
9256
9798
  },
9257
9799
  layerChangeEnabled: function layerChangeEnabled(draft, action) {
9258
- var _action$payload3 = action.payload,
9259
- layerId = _action$payload3.layerId,
9260
- enabled = _action$payload3.enabled;
9800
+ var _action$payload4 = action.payload,
9801
+ layerId = _action$payload4.layerId,
9802
+ enabled = _action$payload4.enabled;
9261
9803
  if (draft.byId[layerId]) {
9262
9804
  draft.byId[layerId].enabled = enabled;
9263
9805
  }
9264
9806
  },
9265
9807
  layerChangeOpacity: function layerChangeOpacity(draft, action) {
9266
- var _action$payload4 = action.payload,
9267
- layerId = _action$payload4.layerId,
9268
- opacity = _action$payload4.opacity;
9808
+ var _action$payload5 = action.payload,
9809
+ layerId = _action$payload5.layerId,
9810
+ opacity = _action$payload5.opacity;
9269
9811
  if (draft.byId[layerId]) {
9270
9812
  draft.byId[layerId].opacity = opacity;
9271
9813
  }
9272
9814
  },
9273
9815
  layerChangeStyle: function layerChangeStyle(draft, action) {
9274
- var _action$payload5 = action.payload,
9275
- layerId = _action$payload5.layerId,
9276
- style = _action$payload5.style;
9816
+ var _action$payload6 = action.payload,
9817
+ layerId = _action$payload6.layerId,
9818
+ style = _action$payload6.style;
9277
9819
  if (draft.byId[layerId]) {
9278
9820
  draft.byId[layerId].style = style;
9279
9821
  }
9280
9822
  },
9281
9823
  layerChangeAcceptanceTime: function layerChangeAcceptanceTime(draft, action) {
9282
- var _action$payload6 = action.payload,
9283
- layerId = _action$payload6.layerId,
9284
- acceptanceTime = _action$payload6.acceptanceTime;
9824
+ var _action$payload7 = action.payload,
9825
+ layerId = _action$payload7.layerId,
9826
+ acceptanceTime = _action$payload7.acceptanceTime;
9285
9827
  if (draft.byId[layerId]) {
9286
9828
  draft.byId[layerId].acceptanceTimeInMinutes = acceptanceTime;
9287
9829
  }
9288
9830
  },
9289
9831
  layerChangeName: function layerChangeName(draft, action) {
9290
- var _action$payload7 = action.payload,
9291
- layerId = _action$payload7.layerId,
9292
- name = _action$payload7.name;
9832
+ var _action$payload8 = action.payload,
9833
+ layerId = _action$payload8.layerId,
9834
+ name = _action$payload8.name;
9293
9835
  if (draft.byId[layerId]) {
9294
9836
  draft.byId[layerId].name = name;
9295
9837
  }
9296
9838
  },
9297
9839
  layerChangeGeojson: function layerChangeGeojson(draft, action) {
9298
- var _action$payload8 = action.payload,
9299
- layerId = _action$payload8.layerId,
9300
- geojson = _action$payload8.geojson;
9840
+ var _action$payload9 = action.payload,
9841
+ layerId = _action$payload9.layerId,
9842
+ geojson = _action$payload9.geojson;
9301
9843
  if (draft.byId[layerId]) {
9302
9844
  draft.byId[layerId].geojson = geojson;
9303
9845
  }
@@ -9330,9 +9872,9 @@ var slice$a = createSlice({
9330
9872
  }
9331
9873
  },
9332
9874
  setLayers: function setLayers(draft, action) {
9333
- var _action$payload9 = action.payload,
9334
- layers = _action$payload9.layers,
9335
- mapId = _action$payload9.mapId;
9875
+ var _action$payload10 = action.payload,
9876
+ layers = _action$payload10.layers,
9877
+ mapId = _action$payload10.mapId;
9336
9878
  if (!checkValidLayersPayload(layers, mapId)) {
9337
9879
  return;
9338
9880
  }
@@ -9362,9 +9904,9 @@ var slice$a = createSlice({
9362
9904
  });
9363
9905
  },
9364
9906
  setBaseLayers: function setBaseLayers(draft, action) {
9365
- var _action$payload10 = action.payload,
9366
- layers = _action$payload10.layers,
9367
- mapId = _action$payload10.mapId;
9907
+ var _action$payload11 = action.payload,
9908
+ layers = _action$payload11.layers,
9909
+ mapId = _action$payload11.mapId;
9368
9910
  var filtererdBaseLayers = layers.filter(function (layer) {
9369
9911
  return layer.layerType === LayerType.baseLayer || layer.layerType === LayerType.overLayer;
9370
9912
  });
@@ -9411,9 +9953,9 @@ var slice$a = createSlice({
9411
9953
  }
9412
9954
  },
9413
9955
  layerSetDimensions: function layerSetDimensions(draft, action) {
9414
- var _action$payload11 = action.payload,
9415
- dimensions = _action$payload11.dimensions,
9416
- layerId = _action$payload11.layerId;
9956
+ var _action$payload12 = action.payload,
9957
+ dimensions = _action$payload12.dimensions,
9958
+ layerId = _action$payload12.layerId;
9417
9959
  if (draft.byId[layerId]) {
9418
9960
  draft.byId[layerId].dimensions = dimensions;
9419
9961
  }
@@ -9447,9 +9989,9 @@ var slice$a = createSlice({
9447
9989
  },
9448
9990
  // Overwrites all baselayer for a certain map
9449
9991
  setAvailableBaseLayers: function setAvailableBaseLayers(draft, action) {
9450
- var _action$payload12 = action.payload,
9451
- layers = _action$payload12.layers,
9452
- mapId = _action$payload12.mapId;
9992
+ var _action$payload13 = action.payload,
9993
+ layers = _action$payload13.layers,
9994
+ mapId = _action$payload13.mapId;
9453
9995
  var state = R(draft);
9454
9996
  // remove current baselayers for passed map
9455
9997
  state.availableBaseLayers.allIds.forEach(function (layerId) {
@@ -9469,9 +10011,9 @@ var slice$a = createSlice({
9469
10011
  });
9470
10012
  },
9471
10013
  onUpdateLayerInformation: function onUpdateLayerInformation(draft, action) {
9472
- var _action$payload13 = action.payload,
9473
- layerStyle = _action$payload13.layerStyle,
9474
- layerDimensions = _action$payload13.layerDimensions;
10014
+ var _action$payload14 = action.payload,
10015
+ layerStyle = _action$payload14.layerStyle,
10016
+ layerDimensions = _action$payload14.layerDimensions;
9475
10017
  /* Set style */
9476
10018
  if (layerStyle && draft.byId[layerStyle.layerId]) {
9477
10019
  draft.byId[layerStyle.layerId].style = layerStyle === null || layerStyle === void 0 ? void 0 : layerStyle.style;
@@ -9531,20 +10073,20 @@ var slice$a = createSlice({
9531
10073
  },
9532
10074
  // feature layer actions
9533
10075
  setSelectedFeature: function setSelectedFeature(draft, action) {
9534
- var _action$payload14 = action.payload,
9535
- layerId = _action$payload14.layerId,
9536
- selectedFeatureIndex = _action$payload14.selectedFeatureIndex;
10076
+ var _action$payload15 = action.payload,
10077
+ layerId = _action$payload15.layerId,
10078
+ selectedFeatureIndex = _action$payload15.selectedFeatureIndex;
9537
10079
  if (!draft.byId[layerId]) {
9538
10080
  return;
9539
10081
  }
9540
10082
  draft.byId[layerId].selectedFeatureIndex = selectedFeatureIndex;
9541
10083
  },
9542
10084
  updateFeature: function updateFeature(draft, action) {
9543
- var _action$payload15 = action.payload,
9544
- layerId = _action$payload15.layerId,
9545
- geojson = _action$payload15.geojson,
9546
- _action$payload15$sho = _action$payload15.shouldAllowMultipleShapes,
9547
- shouldAllowMultipleShapes = _action$payload15$sho === void 0 ? false : _action$payload15$sho;
10085
+ var _action$payload16 = action.payload,
10086
+ layerId = _action$payload16.layerId,
10087
+ geojson = _action$payload16.geojson,
10088
+ _action$payload16$sho = _action$payload16.shouldAllowMultipleShapes,
10089
+ shouldAllowMultipleShapes = _action$payload16$sho === void 0 ? false : _action$payload16$sho;
9548
10090
  if (!draft.byId[layerId]) {
9549
10091
  return;
9550
10092
  }
@@ -9552,9 +10094,9 @@ var slice$a = createSlice({
9552
10094
  draft.byId[layerId].geojson = geoJSON;
9553
10095
  },
9554
10096
  updateFeatureProperties: function updateFeatureProperties(draft, action) {
9555
- var _action$payload16 = action.payload,
9556
- layerId = _action$payload16.layerId,
9557
- properties = _action$payload16.properties;
10097
+ var _action$payload17 = action.payload,
10098
+ layerId = _action$payload17.layerId,
10099
+ properties = _action$payload17.properties;
9558
10100
  var currentLayer = draft.byId[layerId];
9559
10101
  if (!currentLayer) {
9560
10102
  return;
@@ -9568,10 +10110,10 @@ var slice$a = createSlice({
9568
10110
  }
9569
10111
  },
9570
10112
  toggleFeatureMode: function toggleFeatureMode(draft, action) {
9571
- var _action$payload17 = action.payload,
9572
- layerId = _action$payload17.layerId,
9573
- isInEditMode = _action$payload17.isInEditMode,
9574
- drawMode = _action$payload17.drawMode;
10113
+ var _action$payload18 = action.payload,
10114
+ layerId = _action$payload18.layerId,
10115
+ isInEditMode = _action$payload18.isInEditMode,
10116
+ drawMode = _action$payload18.drawMode;
9575
10117
  if (!draft.byId[layerId]) {
9576
10118
  return;
9577
10119
  }
@@ -9593,9 +10135,9 @@ var slice$a = createSlice({
9593
10135
  },
9594
10136
  extraReducers: function extraReducers(builder) {
9595
10137
  builder.addCase(setTimeSync, function (draft, action) {
9596
- var _action$payload18 = action.payload,
9597
- targetsFromAction = _action$payload18.targets,
9598
- source = _action$payload18.source;
10138
+ var _action$payload19 = action.payload,
10139
+ targetsFromAction = _action$payload19.targets,
10140
+ source = _action$payload19.source;
9599
10141
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
9600
10142
  var targets = [{
9601
10143
  targetId: source.payload.sourceId,
@@ -9619,9 +10161,9 @@ var slice$a = createSlice({
9619
10161
  * These targets can be used as payloads in new Layer actions.
9620
10162
  * These actions are here handled via the layer reducer, as it is the same logic
9621
10163
  */
9622
- var _action$payload19 = action.payload,
9623
- targets = _action$payload19.targets,
9624
- source = _action$payload19.source;
10164
+ var _action$payload20 = action.payload,
10165
+ targets = _action$payload20.targets,
10166
+ source = _action$payload20.source;
9625
10167
  var state = R(draft);
9626
10168
  return targets.reduce(function (prevState, target) {
9627
10169
  var action = {
@@ -9629,7 +10171,7 @@ var slice$a = createSlice({
9629
10171
  type: source.type
9630
10172
  };
9631
10173
  /* Handle the Layer action with the same logic, using the same reducer */
9632
- return reducer$a(prevState, action);
10174
+ return reducer$9(prevState, action);
9633
10175
  }, state);
9634
10176
  }).addCase(setMapPreset, function (draft, action) {
9635
10177
  var mapId = action.payload.mapId;
@@ -9649,8 +10191,8 @@ var slice$a = createSlice({
9649
10191
  });
9650
10192
  }
9651
10193
  });
9652
- var reducer$a = slice$a.reducer;
9653
- var layerActions = slice$a.actions;
10194
+ var reducer$9 = slice$9.reducer;
10195
+ var layerActions = slice$9.actions;
9654
10196
 
9655
10197
  var lodash = {exports: {}};
9656
10198
 
@@ -27051,6 +27593,17 @@ var getLayerTimeDimension = createSelector(getLayerDimensions, function (dimensi
27051
27593
  return dimension.name === 'time';
27052
27594
  });
27053
27595
  }, selectorMemoizationOptions);
27596
+ /**
27597
+ * Returns a boolean indicating whether the layer has a time dimension
27598
+ *
27599
+ * Example: layerHasTimeDimension = getLayerHasTimeDimension(store, 'layerId_1')
27600
+ * @param {object} store store: object - object from which the layers state will be extracted
27601
+ * @param {string} layerId layerId: string - Id of the layer
27602
+ * @returns {boolean} returnType: boolean - boolean indicating whether the layer has a time dimension
27603
+ */
27604
+ var getLayerHasTimeDimension = createSelector(getLayerTimeDimension, function (timeDimension) {
27605
+ return !!timeDimension;
27606
+ }, selectorMemoizationOptions);
27054
27607
  var getLayerCurrentTime = createSelector(getLayerTimeDimension, function (dimension) {
27055
27608
  return dimension === null || dimension === void 0 ? void 0 : dimension.currentValue;
27056
27609
  }, selectorMemoizationOptions);
@@ -27234,7 +27787,7 @@ var getLayerIsInsideAcceptanceTime = createSelector(getAcceptanceTimeInMinutes,
27234
27787
  return 'inside';
27235
27788
  });
27236
27789
 
27237
- var selectors$9 = /*#__PURE__*/Object.freeze({
27790
+ var selectors$8 = /*#__PURE__*/Object.freeze({
27238
27791
  __proto__: null,
27239
27792
  getLayerById: getLayerById,
27240
27793
  getLayersById: getLayersById,
@@ -27248,6 +27801,7 @@ var selectors$9 = /*#__PURE__*/Object.freeze({
27248
27801
  getLayerDimensions: getLayerDimensions,
27249
27802
  getLayerNonTimeDimensions: getLayerNonTimeDimensions,
27250
27803
  getLayerTimeDimension: getLayerTimeDimension,
27804
+ getLayerHasTimeDimension: getLayerHasTimeDimension,
27251
27805
  getLayerCurrentTime: getLayerCurrentTime,
27252
27806
  getLayerDimension: getLayerDimension,
27253
27807
  getLayerOpacity: getLayerOpacity,
@@ -27294,7 +27848,7 @@ var AnimationLength;
27294
27848
  AnimationLength[AnimationLength["Hours24"] = 1440] = "Hours24";
27295
27849
  })(AnimationLength || (AnimationLength = {}));
27296
27850
 
27297
- var types$7 = /*#__PURE__*/Object.freeze({
27851
+ var types$6 = /*#__PURE__*/Object.freeze({
27298
27852
  __proto__: null,
27299
27853
  get AnimationLength () { return AnimationLength; }
27300
27854
  });
@@ -27422,13 +27976,13 @@ var createUIDialogElement = function createUIDialogElement(_ref) {
27422
27976
  focused: false
27423
27977
  };
27424
27978
  };
27425
- var initialState$9 = {
27979
+ var initialState$8 = {
27426
27980
  order: [],
27427
27981
  dialogs: {},
27428
27982
  activeWindowId: undefined
27429
27983
  };
27430
- var slice$9 = createSlice({
27431
- initialState: initialState$9,
27984
+ var slice$8 = createSlice({
27985
+ initialState: initialState$8,
27432
27986
  name: 'uiReducer',
27433
27987
  reducers: {
27434
27988
  registerDialog: function registerDialog(draft, action) {
@@ -27520,11 +28074,12 @@ var slice$9 = createSlice({
27520
28074
  }
27521
28075
  }
27522
28076
  });
27523
- var reducer$9 = slice$9.reducer;
27524
- var uiActions = slice$9.actions;
28077
+ var reducer$8 = slice$8.reducer;
28078
+ var uiActions = slice$8.actions;
27525
28079
 
27526
28080
  var addBaseLayer = layerActions.addBaseLayer,
27527
28081
  addLayer$1 = layerActions.addLayer,
28082
+ duplicateMapLayer$1 = layerActions.duplicateMapLayer,
27528
28083
  baseLayerDelete = layerActions.baseLayerDelete,
27529
28084
  layerChangeDimension$1 = layerActions.layerChangeDimension,
27530
28085
  layerDelete$1 = layerActions.layerDelete,
@@ -27568,12 +28123,12 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
27568
28123
  }
27569
28124
  });
27570
28125
  };
27571
- var initialState$8 = {
28126
+ var initialState$7 = {
27572
28127
  byId: {},
27573
28128
  allIds: []
27574
28129
  };
27575
- var slice$8 = createSlice({
27576
- initialState: initialState$8,
28130
+ var slice$7 = createSlice({
28131
+ initialState: initialState$7,
27577
28132
  name: 'mapReducer',
27578
28133
  reducers: {
27579
28134
  registerMap: function registerMap(draft, action) {
@@ -27896,14 +28451,26 @@ var slice$8 = createSlice({
27896
28451
  } else {
27897
28452
  draft.byId[mapId].mapLayers.unshift(layerId);
27898
28453
  }
27899
- }).addCase(addBaseLayer, function (draft, action) {
28454
+ }).addCase(duplicateMapLayer$1, function (draft, action) {
27900
28455
  var _action$payload28 = action.payload,
27901
- layer = _action$payload28.layer,
27902
- layerId = _action$payload28.layerId,
28456
+ newLayerId = _action$payload28.newLayerId,
27903
28457
  mapId = _action$payload28.mapId;
27904
28458
  if (!draft.byId[mapId]) {
27905
28459
  return;
27906
28460
  }
28461
+ if (checkIfMapLayerIdIsAlreadyTaken(draft, newLayerId)) {
28462
+ console.warn("Warning: Layer id ".concat(newLayerId, " was already taken"));
28463
+ return;
28464
+ }
28465
+ draft.byId[mapId].mapLayers.unshift(newLayerId);
28466
+ }).addCase(addBaseLayer, function (draft, action) {
28467
+ var _action$payload29 = action.payload,
28468
+ layer = _action$payload29.layer,
28469
+ layerId = _action$payload29.layerId,
28470
+ mapId = _action$payload29.mapId;
28471
+ if (!draft.byId[mapId]) {
28472
+ return;
28473
+ }
27907
28474
  if (checkIfMapLayerIdIsAlreadyTaken(draft, layerId)) {
27908
28475
  console.warn("Warning: Layer id ".concat(layerId, " was already taken"));
27909
28476
  return;
@@ -27956,9 +28523,9 @@ var slice$8 = createSlice({
27956
28523
  }
27957
28524
  }
27958
28525
  }).addCase(setBaseLayers$1, function (draft, action) {
27959
- var _action$payload29 = action.payload,
27960
- layers = _action$payload29.layers,
27961
- mapId = _action$payload29.mapId;
28526
+ var _action$payload30 = action.payload,
28527
+ layers = _action$payload30.layers,
28528
+ mapId = _action$payload30.mapId;
27962
28529
  // Split into base and overlayers
27963
28530
  var baseLayers = [];
27964
28531
  var overLayers = [];
@@ -27988,9 +28555,9 @@ var slice$8 = createSlice({
27988
28555
  }
27989
28556
  }
27990
28557
  }).addCase(layerDelete$1, function (draft, action) {
27991
- var _action$payload30 = action.payload,
27992
- mapId = _action$payload30.mapId,
27993
- layerId = _action$payload30.layerId;
28558
+ var _action$payload31 = action.payload,
28559
+ mapId = _action$payload31.mapId,
28560
+ layerId = _action$payload31.layerId;
27994
28561
  var map = draft.byId[mapId];
27995
28562
  if (!map) {
27996
28563
  return;
@@ -28016,9 +28583,9 @@ var slice$8 = createSlice({
28016
28583
  return id !== layerId;
28017
28584
  });
28018
28585
  }).addCase(baseLayerDelete, function (draft, action) {
28019
- var _action$payload31 = action.payload,
28020
- mapId = _action$payload31.mapId,
28021
- layerId = _action$payload31.layerId;
28586
+ var _action$payload32 = action.payload,
28587
+ mapId = _action$payload32.mapId,
28588
+ layerId = _action$payload32.layerId;
28022
28589
  if (!draft.byId[mapId]) {
28023
28590
  return;
28024
28591
  }
@@ -28029,14 +28596,14 @@ var slice$8 = createSlice({
28029
28596
  return id !== layerId;
28030
28597
  });
28031
28598
  }).addCase(layerChangeDimension$1, function (draft, action) {
28032
- var _action$payload32 = action.payload,
28033
- layerId = _action$payload32.layerId,
28034
- dimension = _action$payload32.dimension;
28599
+ var _action$payload33 = action.payload,
28600
+ layerId = _action$payload33.layerId,
28601
+ dimension = _action$payload33.dimension;
28035
28602
  produceDraftStateSetMapDimensionFromLayerChangeDimension(draft, layerId, dimension);
28036
28603
  }).addCase(setTimeSync, function (draft, action) {
28037
- var _action$payload33 = action.payload,
28038
- targetsFromAction = _action$payload33.targets,
28039
- source = _action$payload33.source;
28604
+ var _action$payload34 = action.payload,
28605
+ targetsFromAction = _action$payload34.targets,
28606
+ source = _action$payload34.source;
28040
28607
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
28041
28608
  var targets = [{
28042
28609
  targetId: source.payload.sourceId,
@@ -28057,9 +28624,9 @@ var slice$8 = createSlice({
28057
28624
  }
28058
28625
  });
28059
28626
  }).addCase(setBboxSync, function (draft, action) {
28060
- var _action$payload34 = action.payload,
28061
- targetsFromAction = _action$payload34.targets,
28062
- source = _action$payload34.source;
28627
+ var _action$payload35 = action.payload,
28628
+ targetsFromAction = _action$payload35.targets,
28629
+ source = _action$payload35.source;
28063
28630
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
28064
28631
  var targets = [{
28065
28632
  targetId: source.payload.sourceId,
@@ -28088,16 +28655,16 @@ var slice$8 = createSlice({
28088
28655
  * These targets can be used as payloads in new Layer actions.
28089
28656
  * These actions are here handled via the layer reducer, as it is the same logic
28090
28657
  */
28091
- var _action$payload35 = action.payload,
28092
- targets = _action$payload35.targets,
28093
- source = _action$payload35.source;
28658
+ var _action$payload36 = action.payload,
28659
+ targets = _action$payload36.targets,
28660
+ source = _action$payload36.source;
28094
28661
  return targets.reduce(function (prevState, target) {
28095
28662
  var action = {
28096
28663
  payload: target,
28097
28664
  type: source.type
28098
28665
  };
28099
28666
  /* Handle the Layer action with the same logic, using the same reducer */
28100
- return reducer$8(prevState, action);
28667
+ return reducer$7(prevState, action);
28101
28668
  }, draft);
28102
28669
  }).addCase(onUpdateLayerInformation, function (draft, action) {
28103
28670
  var mapDimensions = action.payload.mapDimensions;
@@ -28111,9 +28678,9 @@ var slice$8 = createSlice({
28111
28678
  });
28112
28679
  return draft;
28113
28680
  }).addCase(mapChangeDimension, function (draft, action) {
28114
- var _action$payload36 = action.payload,
28115
- mapId = _action$payload36.mapId,
28116
- dimensionFromAction = _action$payload36.dimension;
28681
+ var _action$payload37 = action.payload,
28682
+ mapId = _action$payload37.mapId,
28683
+ dimensionFromAction = _action$payload37.dimension;
28117
28684
  produceDraftStateSetWebMapDimension(draft, mapId, dimensionFromAction, true);
28118
28685
  }).addCase(setMapPreset, function (draft, action) {
28119
28686
  var mapId = action.payload.mapId;
@@ -28133,9 +28700,9 @@ var slice$8 = createSlice({
28133
28700
  draft.byId[mapId].animationDelay = defaultAnimationDelayAtStart;
28134
28701
  draft.byId[mapId].dockedLayerManagerSize = '';
28135
28702
  }).addCase(uiActions.registerDialog, function (draft, action) {
28136
- var _action$payload37 = action.payload,
28137
- mapId = _action$payload37.mapId,
28138
- type = _action$payload37.type;
28703
+ var _action$payload38 = action.payload,
28704
+ mapId = _action$payload38.mapId,
28705
+ type = _action$payload38.type;
28139
28706
  if (!draft.byId[mapId]) {
28140
28707
  return;
28141
28708
  }
@@ -28143,11 +28710,11 @@ var slice$8 = createSlice({
28143
28710
  });
28144
28711
  }
28145
28712
  });
28146
- var mapActions = Object.assign(Object.assign({}, slice$8.actions), {
28713
+ var mapActions = Object.assign(Object.assign({}, slice$7.actions), {
28147
28714
  setMapPreset: setMapPreset,
28148
28715
  mapChangeDimension: mapChangeDimension
28149
28716
  });
28150
- var reducer$8 = slice$8.reducer;
28717
+ var reducer$7 = slice$7.reducer;
28151
28718
 
28152
28719
  /* *
28153
28720
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -28274,7 +28841,7 @@ var getDialogError = createSelector(getDialogDetailsByType, function (details) {
28274
28841
  return details && details.error || '';
28275
28842
  });
28276
28843
 
28277
- var selectors$8 = /*#__PURE__*/Object.freeze({
28844
+ var selectors$7 = /*#__PURE__*/Object.freeze({
28278
28845
  __proto__: null,
28279
28846
  getUiStore: getUiStore,
28280
28847
  getDialogDetailsByType: getDialogDetailsByType,
@@ -28318,10 +28885,11 @@ var DialogTypes;
28318
28885
  DialogTypes["DrawingTool"] = "drawingTool";
28319
28886
  DialogTypes["DockedLayerManager"] = "dockedLayerManager";
28320
28887
  DialogTypes["DockedDrawingTool"] = "dockedDrawingTool";
28321
- DialogTypes["AreaManager"] = "areaManager";
28888
+ DialogTypes["ObjectManager"] = "objectManager";
28889
+ DialogTypes["PublicWarnings"] = "publicWarnings";
28322
28890
  })(DialogTypes || (DialogTypes = {}));
28323
28891
 
28324
- var types$6 = /*#__PURE__*/Object.freeze({
28892
+ var types$5 = /*#__PURE__*/Object.freeze({
28325
28893
  __proto__: null,
28326
28894
  get DialogTypes () { return DialogTypes; }
28327
28895
  });
@@ -28411,7 +28979,7 @@ var removeInPlace = function removeInPlace(inDraftArray, condition) {
28411
28979
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
28412
28980
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
28413
28981
  * */
28414
- var initialState$7 = {
28982
+ var initialState$6 = {
28415
28983
  sources: {
28416
28984
  byId: {},
28417
28985
  allIds: []
@@ -28435,8 +29003,8 @@ var initialState$7 = {
28435
29003
  }
28436
29004
  }
28437
29005
  };
28438
- var slice$7 = createSlice({
28439
- initialState: initialState$7,
29006
+ var slice$6 = createSlice({
29007
+ initialState: initialState$6,
28440
29008
  name: 'synchronizationGroupsReducer',
28441
29009
  reducers: {
28442
29010
  syncGroupAddSource: function syncGroupAddSource(draft, action) {
@@ -28565,7 +29133,7 @@ var slice$7 = createSlice({
28565
29133
  });
28566
29134
  },
28567
29135
  syncGroupClear: function syncGroupClear() {
28568
- return initialState$7;
29136
+ return initialState$6;
28569
29137
  },
28570
29138
  syncGroupSetViewState: function syncGroupSetViewState(draft, action) {
28571
29139
  var viewState = action.payload.viewState;
@@ -28624,7 +29192,7 @@ var setBboxOrTimeSync = function setBboxOrTimeSync(state, action) {
28624
29192
  });
28625
29193
  });
28626
29194
  };
28627
- var _slice$actions = slice$7.actions,
29195
+ var _slice$actions = slice$6.actions,
28628
29196
  syncGroupAddGroup = _slice$actions.syncGroupAddGroup,
28629
29197
  syncGroupAddSource = _slice$actions.syncGroupAddSource,
28630
29198
  syncGroupAddTarget = _slice$actions.syncGroupAddTarget;
@@ -28634,8 +29202,8 @@ var _slice$actions = slice$7.actions,
28634
29202
  syncGroupRemoveSource = _slice$actions.syncGroupRemoveSource,
28635
29203
  syncGroupRemoveTarget = _slice$actions.syncGroupRemoveTarget,
28636
29204
  syncGroupSetViewState = _slice$actions.syncGroupSetViewState;
28637
- var actions = slice$7.actions,
28638
- reducer$7 = slice$7.reducer;
29205
+ var actions = slice$6.actions,
29206
+ reducer$6 = slice$6.reducer;
28639
29207
 
28640
29208
  /* *
28641
29209
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -28663,7 +29231,7 @@ var SyncGroupActionOrigin;
28663
29231
  SyncGroupActionOrigin["activateLayerId"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_ACTIVELAYERIDACTION";
28664
29232
  })(SyncGroupActionOrigin || (SyncGroupActionOrigin = {}));
28665
29233
 
28666
- var types$5 = /*#__PURE__*/Object.freeze({
29234
+ var types$4 = /*#__PURE__*/Object.freeze({
28667
29235
  __proto__: null,
28668
29236
  SyncGroupTypeList: SyncGroupTypeList,
28669
29237
  get SyncGroupActionOrigin () { return SyncGroupActionOrigin; }
@@ -28804,7 +29372,7 @@ var getSyncGroupTargets = createSelector(syncGroupStore, function (store) {
28804
29372
  }, []);
28805
29373
  });
28806
29374
 
28807
- var selectors$7 = /*#__PURE__*/Object.freeze({
29375
+ var selectors$6 = /*#__PURE__*/Object.freeze({
28808
29376
  __proto__: null,
28809
29377
  syncGroupStore: syncGroupStore,
28810
29378
  getSynchronizationGroupState: getSynchronizationGroupState,
@@ -28956,7 +29524,7 @@ var getTime = createSelector(getSyncSourceBySourceId, function (store) {
28956
29524
  return store && store.payloadByType && store.payloadByType[SYNCGROUPS_TYPE_SETTIME] ? store.payloadByType[SYNCGROUPS_TYPE_SETTIME].value : null;
28957
29525
  });
28958
29526
 
28959
- var selectors$6 = /*#__PURE__*/Object.freeze({
29527
+ var selectors$5 = /*#__PURE__*/Object.freeze({
28960
29528
  __proto__: null,
28961
29529
  getSynchronizationGroupStore: getSynchronizationGroupStore,
28962
29530
  getTime: getTime
@@ -28979,7 +29547,7 @@ var selectors$6 = /*#__PURE__*/Object.freeze({
28979
29547
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
28980
29548
  * */
28981
29549
 
28982
- var types$4 = /*#__PURE__*/Object.freeze({
29550
+ var types$3 = /*#__PURE__*/Object.freeze({
28983
29551
  __proto__: null
28984
29552
  });
28985
29553
 
@@ -29177,6 +29745,43 @@ var getMapDimension = createSelector(getMapById, function (_store, _mapId, dimen
29177
29745
  }
29178
29746
  return undefined;
29179
29747
  }, selectorMemoizationOptions);
29748
+ var getSelectedTime = createSelector(function (store, mapId) {
29749
+ return getMapDimension(store, mapId, 'time');
29750
+ }, function (timeDimension) {
29751
+ var now = getUnixTime(new Date());
29752
+ if (!timeDimension) {
29753
+ return now;
29754
+ }
29755
+ var timeSliderTime = parseISO(timeDimension.currentValue);
29756
+ if (isValid(timeSliderTime)) {
29757
+ return getUnixTime(timeSliderTime);
29758
+ }
29759
+ return now;
29760
+ });
29761
+ var getDataLimitsFromLayers = createSelector(getMapLayers, function (layers) {
29762
+ return layers.reduce(function (_ref, layer) {
29763
+ var _ref2 = _slicedToArray(_ref, 2),
29764
+ start = _ref2[0],
29765
+ end = _ref2[1];
29766
+ var _a;
29767
+ var dimension = (_a = layer.dimensions) === null || _a === void 0 ? void 0 : _a.find(function (dimension) {
29768
+ return dimension.name === 'time';
29769
+ });
29770
+ if ((dimension === null || dimension === void 0 ? void 0 : dimension.minValue) && dimension.maxValue) {
29771
+ var lastValue = getUnixTime(new Date(dimension.maxValue));
29772
+ var firstValue = getUnixTime(new Date(dimension.minValue));
29773
+ var newLast = Math.max(lastValue, end);
29774
+ var newFirst = Math.min(firstValue, start);
29775
+ return [newFirst, newLast];
29776
+ }
29777
+ return [start, end];
29778
+ },
29779
+ /* Using the maximum 32-bit value and 0 as starting points
29780
+ * bigger values like Number.MAX_VALUE or Number.MAX_SAFE_INTEGER
29781
+ * cause weird behaviour as timestamps break at 32bit limit (year 2038)
29782
+ */
29783
+ [2147483647, 0]);
29784
+ });
29180
29785
  /**
29181
29786
  * Gets map srs
29182
29787
  *
@@ -29561,7 +30166,7 @@ var getAllUniqueDimensions = createSelector(getAllMapIds, function (store) {
29561
30166
  * @returns {object} returnType: latitude and longitude of pin
29562
30167
  */
29563
30168
  var getPinLocation = createSelector(getMapById, function (store) {
29564
- return store ? store.mapPinLocation : undefined;
30169
+ return store === null || store === void 0 ? void 0 : store.mapPinLocation;
29565
30170
  }, selectorMemoizationOptions);
29566
30171
  /**
29567
30172
  * Returns the disable map pin boolean for the current map
@@ -29604,7 +30209,7 @@ var getLegendId = createSelector(getMapById, function (store) {
29604
30209
  * @param {string} mapId mapId: string - Id of the map
29605
30210
  * @returns {MapPreset} returnType: MapPreset
29606
30211
  */
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) {
30212
+ 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
30213
  var _a;
29609
30214
  var allLayers = [].concat(_toConsumableArray(baseLayers), _toConsumableArray(overLayers), _toConsumableArray(mapLayers)).map(function (_a) {
29610
30215
  _a.mapId;
@@ -29622,7 +30227,8 @@ var getMapPreset = createSelector(getMapLayers, getMapBaseLayers, getMapOverLaye
29622
30227
  });
29623
30228
  var animationPayload = {
29624
30229
  interval: mapTimeStep,
29625
- speed: getSpeedFactor(mapAnimationDelay)
30230
+ speed: getSpeedFactor(mapAnimationDelay),
30231
+ duration: getAnimationDuration(animationEndTime, animationStartTime)
29626
30232
  };
29627
30233
  var shouldShowLegend = (_a = uiStore === null || uiStore === void 0 ? void 0 : uiStore.dialogs[legendId]) === null || _a === void 0 ? void 0 : _a.isOpen;
29628
30234
  return Object.assign({
@@ -29689,7 +30295,7 @@ var getDockedLayerManagerSize = createSelector(getMapById, function (store) {
29689
30295
  return store ? store.dockedLayerManagerSize : 'sizeSmall';
29690
30296
  });
29691
30297
 
29692
- var selectors$5 = /*#__PURE__*/Object.freeze({
30298
+ var selectors$4 = /*#__PURE__*/Object.freeze({
29693
30299
  __proto__: null,
29694
30300
  getMapById: getMapById,
29695
30301
  getAllMapIds: getAllMapIds,
@@ -29705,6 +30311,8 @@ var selectors$5 = /*#__PURE__*/Object.freeze({
29705
30311
  getMapOverLayers: getMapOverLayers,
29706
30312
  getMapDimensions: getMapDimensions,
29707
30313
  getMapDimension: getMapDimension,
30314
+ getSelectedTime: getSelectedTime,
30315
+ getDataLimitsFromLayers: getDataLimitsFromLayers,
29708
30316
  getSrs: getSrs,
29709
30317
  getBbox: getBbox,
29710
30318
  isAnimating: isAnimating,
@@ -29857,12 +30465,12 @@ var mapUtils = Object.assign(Object.assign({}, utils$3), {
29857
30465
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
29858
30466
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
29859
30467
  * */
29860
- var initialState$6 = {
30468
+ var initialState$5 = {
29861
30469
  byId: {},
29862
30470
  allIds: []
29863
30471
  };
29864
- var slice$6 = createSlice({
29865
- initialState: initialState$6,
30472
+ var slice$5 = createSlice({
30473
+ initialState: initialState$5,
29866
30474
  name: 'serviceReducer',
29867
30475
  reducers: {
29868
30476
  serviceSetLayers: function serviceSetLayers(draft, action) {
@@ -29891,8 +30499,8 @@ var slice$6 = createSlice({
29891
30499
  action) {}
29892
30500
  }
29893
30501
  });
29894
- var reducer$6 = slice$6.reducer;
29895
- var serviceActions = slice$6.actions;
30502
+ var reducer$5 = slice$5.reducer;
30503
+ var serviceActions = slice$5.actions;
29896
30504
 
29897
30505
  /* *
29898
30506
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -30004,7 +30612,7 @@ var getLayerStyles = createSelector(getLayerFromService, function (layer) {
30004
30612
  return layer && layer.styles ? layer.styles : [];
30005
30613
  }, selectorMemoizationOptions);
30006
30614
 
30007
- var selectors$4 = /*#__PURE__*/Object.freeze({
30615
+ var selectors$3 = /*#__PURE__*/Object.freeze({
30008
30616
  __proto__: null,
30009
30617
  getServiceIds: getServiceIds,
30010
30618
  getServices: getServices,
@@ -30031,7 +30639,7 @@ var selectors$4 = /*#__PURE__*/Object.freeze({
30031
30639
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
30032
30640
  * */
30033
30641
 
30034
- var types$3 = /*#__PURE__*/Object.freeze({
30642
+ var types$2 = /*#__PURE__*/Object.freeze({
30035
30643
  __proto__: null
30036
30644
  });
30037
30645
 
@@ -33272,13 +33880,14 @@ function rootSaga$6() {
33272
33880
  i({
33273
33881
  extensions: [e()]
33274
33882
  });
33883
+ var mapStoreReducers = {
33884
+ webmap: reducer$7,
33885
+ services: reducer$5,
33886
+ layers: reducer$9
33887
+ };
33275
33888
  var mapStoreModuleConfig = {
33276
33889
  id: 'webmap-module',
33277
- reducersMap: {
33278
- webmap: reducer$8,
33279
- services: reducer$6,
33280
- layers: reducer$a
33281
- },
33890
+ reducersMap: mapStoreReducers,
33282
33891
  sagas: [rootSaga$7, rootSaga$6]
33283
33892
  };
33284
33893
 
@@ -33322,7 +33931,7 @@ var FilterType;
33322
33931
  FilterType["Group"] = "groups";
33323
33932
  })(FilterType || (FilterType = {}));
33324
33933
 
33325
- var types$2 = /*#__PURE__*/Object.freeze({
33934
+ var types$1 = /*#__PURE__*/Object.freeze({
33326
33935
  __proto__: null,
33327
33936
  get FilterType () { return FilterType; }
33328
33937
  });
@@ -33412,7 +34021,7 @@ var initialServicePopupState = {
33412
34021
  serviceId: '',
33413
34022
  variant: 'add'
33414
34023
  };
33415
- var initialState$5 = {
34024
+ var initialState$4 = {
33416
34025
  filters: {
33417
34026
  searchFilter: '',
33418
34027
  activeServices: layerSelectActiveServicesAdapter.getInitialState(),
@@ -33428,8 +34037,8 @@ var initialState$5 = {
33428
34037
  },
33429
34038
  servicePopup: initialServicePopupState
33430
34039
  };
33431
- var slice$5 = createSlice({
33432
- initialState: initialState$5,
34040
+ var slice$4 = createSlice({
34041
+ initialState: initialState$4,
33433
34042
  name: DialogTypes.LayerSelect,
33434
34043
  reducers: {
33435
34044
  setSearchFilter: function setSearchFilter(draft, action) {
@@ -33603,8 +34212,8 @@ var slice$5 = createSlice({
33603
34212
  });
33604
34213
  }
33605
34214
  });
33606
- var reducer$5 = slice$5.reducer;
33607
- var layerSelectActions = slice$5.actions;
34215
+ var reducer$4 = slice$4.reducer;
34216
+ var layerSelectActions = slice$4.actions;
33608
34217
 
33609
34218
  /* *
33610
34219
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -33769,7 +34378,7 @@ var getServicePopupDetails = function getServicePopupDetails(store) {
33769
34378
  return ((_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.servicePopup) || initialServicePopupState;
33770
34379
  };
33771
34380
 
33772
- var selectors$3 = /*#__PURE__*/Object.freeze({
34381
+ var selectors$2 = /*#__PURE__*/Object.freeze({
33773
34382
  __proto__: null,
33774
34383
  getSearchFilter: getSearchFilter,
33775
34384
  getActiveServices: getActiveServices,
@@ -33846,405 +34455,565 @@ var isNoIdService = function isNoIdService(param) {
33846
34455
  * See the License for the specific language governing permissions and
33847
34456
  * limitations under the License.
33848
34457
  *
33849
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
33850
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
34458
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34459
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
33851
34460
  * */
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
- }
34461
+ /**
34462
+ * Tries to find the layerId's in the other map based on the payload of the action. It works for all layer actions.
34463
+ * @param state
34464
+ * @param mapId
34465
+ * @param targetMapId
34466
+ * @param payload
34467
+ * @returns
34468
+ */
34469
+ var getTargetLayerIdFromPayload = function getTargetLayerIdFromPayload(state, mapId, targetMapId, payload) {
34470
+ if (!payload) {
34471
+ return null;
33877
34472
  }
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;
34473
+ /* Try to find the layer for the DeleteLayerPayload, it uses layerIndex to reference the layer */
34474
+ if ('layerIndex' in payload) {
34475
+ var targetLayer = getLayerByLayerIndex(state, targetMapId, payload.layerIndex);
34476
+ return !targetLayer ? null : targetLayer.id;
34477
+ }
34478
+ /* Try to find the layer for the LayerActionsWithLayerIds, it uses layerId to reference the layer */
34479
+ if ('layerId' in payload) {
34480
+ var _targetLayer = getLayerByLayerIndex(state, targetMapId, getLayerIndexByLayerId(state, mapId, payload.layerId));
34481
+ return !_targetLayer ? null : _targetLayer.id;
33901
34482
  }
34483
+ /* This payload probably does not reference to a layerId */
33902
34484
  return null;
33903
34485
  };
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;
34486
+ /**
34487
+ * Local helper function used by getLayerDeleteActionsTargets, getLayerActionsTargets, getAddLayerActionsTargets, getTargetLayerIdFromPayload to find the targets
34488
+ * @param state
34489
+ * @param payload
34490
+ * @param actionType
34491
+ * @param sourceMapId
34492
+ * @returns The found targets
34493
+ */
34494
+ var findTargets = function findTargets(state, payload, actionType, sourceMapId) {
34495
+ var actionPayloads = [];
34496
+ var targetsInActionPayload = {};
34497
+ var syncronizationGroupStore = syncGroupStore(state);
34498
+ if (syncronizationGroupStore && payload) {
34499
+ syncronizationGroupStore.groups.allIds.forEach(function (id) {
34500
+ var syncronizationGroup = syncronizationGroupStore.groups.byId[id];
34501
+ if (actionType === syncronizationGroup.type) {
34502
+ /* Check if the source is in the target list of the synchonizationGroup */
34503
+ var source = syncronizationGroup.targets.byId[sourceMapId];
34504
+ /* If the source is part of the target list, and is linked, continue syncing the other targets */
34505
+ if (source && source.linked) {
34506
+ syncronizationGroup.targets.allIds.forEach(function (targetId) {
34507
+ var target = syncronizationGroup.targets.byId[targetId];
34508
+ if (targetId !== sourceMapId && target.linked && !targetsInActionPayload[targetId]) {
34509
+ /* Remember that we have already added this target in the action payloads, prevents adding it twice */
34510
+ targetsInActionPayload[targetId] = true;
34511
+ var otherLayerId = getTargetLayerIdFromPayload(state, sourceMapId, targetId, payload);
34512
+ actionPayloads.push({
34513
+ payload: payload,
34514
+ targetId: targetId,
34515
+ layerId: otherLayerId
34516
+ });
34517
+ }
34518
+ });
33984
34519
  }
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) {}
34520
+ }
34521
+ });
34056
34522
  }
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
34523
+ return actionPayloads;
34081
34524
  };
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);
34115
- }
34116
-
34117
- /* *
34118
- * Licensed under the Apache License, Version 2.0 (the "License");
34119
- * you may not use this file except in compliance with the License.
34120
- * You may obtain a copy of the License at
34121
- *
34122
- * http://www.apache.org/licenses/LICENSE-2.0
34123
- *
34124
- * Unless required by applicable law or agreed to in writing, software
34125
- * distributed under the License is distributed on an "AS IS" BASIS,
34126
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34127
- * See the License for the specific language governing permissions and
34128
- * limitations under the License.
34129
- *
34130
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34131
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
34132
- * */
34133
- var routerModuleConfig = {
34134
- id: 'router',
34135
- reducersMap: {
34136
- router: reducer$3
34137
- },
34138
- sagas: [rootSaga$4]
34525
+ /**
34526
+ * These targets are found for layer actions that work with a layerId like: SetLayerName, SetLayerEnabled, SetLayerOpacity, SetLayerDimension and SetLayerStyle
34527
+ * @param state
34528
+ * @param payload
34529
+ * @param actionType
34530
+ * @returns
34531
+ */
34532
+ var getLayerActionsTargets = function getLayerActionsTargets(state, payload, actionType) {
34533
+ var mapId = getMapIdFromLayerId(state, payload.layerId);
34534
+ var foundTargets = findTargets(state, payload, actionType, mapId);
34535
+ return foundTargets.map(function (target) {
34536
+ var payload = target.payload;
34537
+ return Object.assign(Object.assign({}, payload), {
34538
+ layerId: target.layerId,
34539
+ origin: SyncGroupActionOrigin.layerActions,
34540
+ mapId: payload.mapId
34541
+ });
34542
+ });
34139
34543
  };
34140
-
34141
- /* *
34142
- * Licensed under the Apache License, Version 2.0 (the "License");
34143
- * you may not use this file except in compliance with the License.
34144
- * You may obtain a copy of the License at
34145
- *
34146
- * http://www.apache.org/licenses/LICENSE-2.0
34147
- *
34148
- * Unless required by applicable law or agreed to in writing, software
34149
- * distributed under the License is distributed on an "AS IS" BASIS,
34150
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34151
- * See the License for the specific language governing permissions and
34152
- * limitations under the License.
34153
- *
34154
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34155
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
34156
- * */
34157
- var initialState$2 = {
34158
- isInitialised: false
34544
+ /**
34545
+ * These targets are found for the layer/map action AddLayer. AddLayer does not have a layerId (because it's new)
34546
+ * @param state
34547
+ * @param payload
34548
+ * @param actionType
34549
+ * @returns
34550
+ */
34551
+ var getAddLayerActionsTargets = function getAddLayerActionsTargets(state, payload, actionType) {
34552
+ var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34553
+ return foundTargets.map(function (_ref) {
34554
+ var payload = _ref.payload,
34555
+ targetId = _ref.targetId;
34556
+ var layer = payload.layer;
34557
+ layer.id;
34558
+ var layerWithoutId = __rest(layer, ["id"]);
34559
+ var layerId = webmapUtils.generateLayerId();
34560
+ return Object.assign(Object.assign({}, payload), {
34561
+ layer: layerWithoutId,
34562
+ layerId: layerId,
34563
+ mapId: targetId,
34564
+ origin: SyncGroupActionOrigin.add
34565
+ });
34566
+ });
34159
34567
  };
34160
- var slice$2 = createSlice({
34161
- initialState: initialState$2,
34162
- name: 'app',
34163
- reducers: {
34164
- initialiseApp: function initialiseApp(draft) {
34165
- draft.isInitialised = true;
34166
- }
34167
- }
34168
- });
34169
- var reducer$2 = slice$2.reducer;
34170
- var appActions = slice$2.actions;
34171
-
34172
- /* *
34173
- * Licensed under the Apache License, Version 2.0 (the "License");
34174
- * you may not use this file except in compliance with the License.
34175
- * You may obtain a copy of the License at
34176
- *
34177
- * http://www.apache.org/licenses/LICENSE-2.0
34178
- *
34179
- * Unless required by applicable law or agreed to in writing, software
34180
- * distributed under the License is distributed on an "AS IS" BASIS,
34181
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34182
- * See the License for the specific language governing permissions and
34183
- * limitations under the License.
34184
- *
34185
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34186
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
34187
- * */
34188
- var appModuleConfig = {
34189
- id: 'app-module',
34190
- reducersMap: {
34191
- app: reducer$2
34192
- }
34568
+ /**
34569
+ * These targets are found for the layer/map action DeleteLayer. The layer is already gone, so there is no layerId anymore. Using layerIndex instead.
34570
+ * @param state
34571
+ * @param payload
34572
+ * @param actionType
34573
+ * @returns
34574
+ */
34575
+ var getLayerDeleteActionsTargets = function getLayerDeleteActionsTargets(state, payload, actionType) {
34576
+ var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34577
+ return foundTargets.map(function (target) {
34578
+ return Object.assign(Object.assign({}, target.payload), {
34579
+ mapId: target.targetId,
34580
+ layerId: target.layerId,
34581
+ origin: SyncGroupActionOrigin["delete"]
34582
+ });
34583
+ });
34193
34584
  };
34194
-
34195
- /* *
34196
- * Licensed under the Apache License, Version 2.0 (the "License");
34197
- * you may not use this file except in compliance with the License.
34198
- * You may obtain a copy of the License at
34199
- *
34200
- * http://www.apache.org/licenses/LICENSE-2.0
34201
- *
34202
- * Unless required by applicable law or agreed to in writing, software
34203
- * distributed under the License is distributed on an "AS IS" BASIS,
34204
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34205
- * See the License for the specific language governing permissions and
34206
- * limitations under the License.
34207
- *
34208
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34209
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
34585
+ /**
34586
+ * These targets are found for the layer/map action MoveLayer. Here layers are referenced by newIndex and oldIndex.
34587
+ * @param state
34588
+ * @param payload
34589
+ * @param actionType
34590
+ * @returns
34591
+ */
34592
+ var getLayerMoveActionsTargets = function getLayerMoveActionsTargets(state, payload, actionType) {
34593
+ var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34594
+ return foundTargets.map(function (target) {
34595
+ return Object.assign(Object.assign({}, target.payload), {
34596
+ mapId: target.targetId,
34597
+ origin: SyncGroupActionOrigin.move
34598
+ });
34599
+ });
34600
+ };
34601
+ /**
34602
+ * These targets are found for the layer/map action SetActiveLayerId. It needs both a target mapId and layerId
34603
+ * @param state
34604
+ * @param payload
34605
+ * @param actionType
34606
+ * @returns
34607
+ */
34608
+ var getSetActiveLayerIdActionsTargets = function getSetActiveLayerIdActionsTargets(state, payload, actionType) {
34609
+ var sourceMapId = getMapIdFromLayerId(state, payload.layerId);
34610
+ var foundTargets = findTargets(state, payload, actionType, sourceMapId);
34611
+ return foundTargets.map(function (target) {
34612
+ return {
34613
+ mapId: target.targetId,
34614
+ layerId: target.layerId,
34615
+ origin: SyncGroupActionOrigin.activateLayerId
34616
+ };
34617
+ });
34618
+ };
34619
+ /**
34620
+ * These targets are found for baselayer actions that work with a mapId like: setBaseLayers
34621
+ * @param state
34622
+ * @param payload
34623
+ * @param actionType
34624
+ * @returns
34625
+ */
34626
+ var getMapBaseLayerActionsTargets = function getMapBaseLayerActionsTargets(state, payload, actionType) {
34627
+ var foundTargets = findTargets(state, payload, actionType, payload.mapId);
34628
+ return foundTargets.map(function (target) {
34629
+ return {
34630
+ layers: payload.layers.map(function (layer) {
34631
+ return Object.assign(Object.assign({}, layer), {
34632
+ id: webmapUtils.generateLayerId()
34633
+ });
34634
+ }),
34635
+ mapId: target.targetId,
34636
+ origin: SyncGroupActionOrigin.layerActions
34637
+ };
34638
+ });
34639
+ };
34640
+
34641
+ var _marked$6 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$5);
34642
+ var setBaseLayers = layerActions.setBaseLayers,
34643
+ addLayer = layerActions.addLayer,
34644
+ duplicateMapLayer = layerActions.duplicateMapLayer,
34645
+ layerChangeDimension = layerActions.layerChangeDimension,
34646
+ layerChangeEnabled = layerActions.layerChangeEnabled,
34647
+ layerChangeName = layerActions.layerChangeName,
34648
+ layerChangeOpacity = layerActions.layerChangeOpacity,
34649
+ layerChangeStyle = layerActions.layerChangeStyle,
34650
+ layerDelete = layerActions.layerDelete;
34651
+ 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$/;
34652
+ function setTimeSaga(_ref) {
34653
+ var payload = _ref.payload;
34654
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
34655
+ var value, origin, targets, groups;
34656
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
34657
+ while (1) switch (_context.prev = _context.next) {
34658
+ case 0:
34659
+ value = payload.value, origin = payload.origin;
34660
+ /* Test if the value is according to the expected time format */
34661
+ if (setTimeValidatorRexexp.test(value)) {
34662
+ _context.next = 5;
34663
+ break;
34664
+ }
34665
+ console.error("setTime value ".concat(value, " does not conform to format [YYYY-MM-DDThh:mm:ssZ]. It was triggered by ").concat(origin));
34666
+ _context.next = 13;
34667
+ break;
34668
+ case 5:
34669
+ _context.next = 7;
34670
+ return select(getTargets, payload, SYNCGROUPS_TYPE_SETTIME);
34671
+ case 7:
34672
+ targets = _context.sent;
34673
+ _context.next = 10;
34674
+ return select(getTargetGroups, payload, SYNCGROUPS_TYPE_SETTIME);
34675
+ case 10:
34676
+ groups = _context.sent;
34677
+ _context.next = 13;
34678
+ return put(setTimeSync(payload, targets, groups));
34679
+ case 13:
34680
+ case "end":
34681
+ return _context.stop();
34682
+ }
34683
+ }, _callee);
34684
+ })();
34685
+ }
34686
+ function setBBoxSaga(_ref2) {
34687
+ var payload = _ref2.payload;
34688
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
34689
+ var targets, groups;
34690
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
34691
+ while (1) switch (_context2.prev = _context2.next) {
34692
+ case 0:
34693
+ _context2.next = 2;
34694
+ return select(getTargets, payload, SYNCGROUPS_TYPE_SETBBOX);
34695
+ case 2:
34696
+ targets = _context2.sent;
34697
+ _context2.next = 5;
34698
+ return select(getTargetGroups, payload, SYNCGROUPS_TYPE_SETBBOX);
34699
+ case 5:
34700
+ groups = _context2.sent;
34701
+ _context2.next = 8;
34702
+ return put(setBboxSync(payload, targets, groups));
34703
+ case 8:
34704
+ case "end":
34705
+ return _context2.stop();
34706
+ }
34707
+ }, _callee2);
34708
+ })();
34709
+ }
34710
+ function layerActionsSaga(_ref3) {
34711
+ var payload = _ref3.payload,
34712
+ type = _ref3.type;
34713
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
34714
+ var targets;
34715
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
34716
+ while (1) switch (_context3.prev = _context3.next) {
34717
+ case 0:
34718
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34719
+ _context3.next = 2;
34720
+ break;
34721
+ }
34722
+ return _context3.abrupt("return");
34723
+ case 2:
34724
+ _context3.next = 4;
34725
+ return select(getLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34726
+ case 4:
34727
+ targets = _context3.sent;
34728
+ if (!(targets && targets.length > 0)) {
34729
+ _context3.next = 8;
34730
+ break;
34731
+ }
34732
+ _context3.next = 8;
34733
+ return put(setLayerActionSync(payload, targets, type));
34734
+ case 8:
34735
+ case "end":
34736
+ return _context3.stop();
34737
+ }
34738
+ }, _callee3);
34739
+ })();
34740
+ }
34741
+ function addLayerActionsSaga(_ref4) {
34742
+ var payload = _ref4.payload,
34743
+ type = _ref4.type;
34744
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
34745
+ var targets;
34746
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
34747
+ while (1) switch (_context4.prev = _context4.next) {
34748
+ case 0:
34749
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34750
+ _context4.next = 2;
34751
+ break;
34752
+ }
34753
+ return _context4.abrupt("return");
34754
+ case 2:
34755
+ _context4.next = 4;
34756
+ return select(getAddLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34757
+ case 4:
34758
+ targets = _context4.sent;
34759
+ if (!(targets && targets.length > 0)) {
34760
+ _context4.next = 8;
34761
+ break;
34762
+ }
34763
+ _context4.next = 8;
34764
+ return put(setLayerActionSync(payload, targets, type));
34765
+ case 8:
34766
+ case "end":
34767
+ return _context4.stop();
34768
+ }
34769
+ }, _callee4);
34770
+ })();
34771
+ }
34772
+ function duplicateMapLayerActionsSaga(_ref5) {
34773
+ var payload = _ref5.payload;
34774
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
34775
+ var sourceLayer, newPayload, targets;
34776
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
34777
+ while (1) switch (_context5.prev = _context5.next) {
34778
+ case 0:
34779
+ _context5.next = 2;
34780
+ return select(getLayerById, payload.oldLayerId);
34781
+ case 2:
34782
+ sourceLayer = _context5.sent;
34783
+ newPayload = {
34784
+ mapId: payload.mapId,
34785
+ layer: sourceLayer,
34786
+ origin: payload.origin
34787
+ };
34788
+ _context5.next = 6;
34789
+ return select(getAddLayerActionsTargets, newPayload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34790
+ case 6:
34791
+ targets = _context5.sent;
34792
+ if (!(targets && targets.length > 0)) {
34793
+ _context5.next = 10;
34794
+ break;
34795
+ }
34796
+ _context5.next = 10;
34797
+ return put(setLayerActionSync(newPayload, targets, addLayer.type));
34798
+ case 10:
34799
+ case "end":
34800
+ return _context5.stop();
34801
+ }
34802
+ }, _callee5);
34803
+ })();
34804
+ }
34805
+ function deleteLayerActionsSaga(_ref6) {
34806
+ var payload = _ref6.payload,
34807
+ type = _ref6.type;
34808
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
34809
+ var targets;
34810
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
34811
+ while (1) switch (_context6.prev = _context6.next) {
34812
+ case 0:
34813
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34814
+ _context6.next = 2;
34815
+ break;
34816
+ }
34817
+ return _context6.abrupt("return");
34818
+ case 2:
34819
+ _context6.next = 4;
34820
+ return select(getLayerDeleteActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34821
+ case 4:
34822
+ targets = _context6.sent;
34823
+ if (!(targets && targets.length > 0)) {
34824
+ _context6.next = 8;
34825
+ break;
34826
+ }
34827
+ _context6.next = 8;
34828
+ return put(setLayerActionSync(payload, targets, type));
34829
+ case 8:
34830
+ case "end":
34831
+ return _context6.stop();
34832
+ }
34833
+ }, _callee6);
34834
+ })();
34835
+ }
34836
+ function moveLayerActionsSaga(_ref7) {
34837
+ var payload = _ref7.payload,
34838
+ type = _ref7.type;
34839
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
34840
+ var targets;
34841
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
34842
+ while (1) switch (_context7.prev = _context7.next) {
34843
+ case 0:
34844
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34845
+ _context7.next = 2;
34846
+ break;
34847
+ }
34848
+ return _context7.abrupt("return");
34849
+ case 2:
34850
+ _context7.next = 4;
34851
+ return select(getLayerMoveActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34852
+ case 4:
34853
+ targets = _context7.sent;
34854
+ if (!(targets && targets.length > 0)) {
34855
+ _context7.next = 8;
34856
+ break;
34857
+ }
34858
+ _context7.next = 8;
34859
+ return put(setLayerActionSync(payload, targets, type));
34860
+ case 8:
34861
+ case "end":
34862
+ return _context7.stop();
34863
+ }
34864
+ }, _callee7);
34865
+ })();
34866
+ }
34867
+ function setAutoLayerIdActionsSaga(_ref8) {
34868
+ var payload = _ref8.payload,
34869
+ type = _ref8.type;
34870
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
34871
+ var targets;
34872
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
34873
+ while (1) switch (_context8.prev = _context8.next) {
34874
+ case 0:
34875
+ _context8.next = 2;
34876
+ return select(getSetActiveLayerIdActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34877
+ case 2:
34878
+ targets = _context8.sent;
34879
+ if (!(targets && targets.length > 0)) {
34880
+ _context8.next = 6;
34881
+ break;
34882
+ }
34883
+ _context8.next = 6;
34884
+ return put(setLayerActionSync(payload, targets, type));
34885
+ case 6:
34886
+ case "end":
34887
+ return _context8.stop();
34888
+ }
34889
+ }, _callee8);
34890
+ })();
34891
+ }
34892
+ function mapBaseLayerActionsSaga(_ref9) {
34893
+ var payload = _ref9.payload,
34894
+ type = _ref9.type;
34895
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
34896
+ var targets;
34897
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
34898
+ while (1) switch (_context9.prev = _context9.next) {
34899
+ case 0:
34900
+ if (!(payload && payload.origin === LayerActionOrigin.ReactMapViewParseLayer)) {
34901
+ _context9.next = 2;
34902
+ break;
34903
+ }
34904
+ return _context9.abrupt("return");
34905
+ case 2:
34906
+ _context9.next = 4;
34907
+ return select(getMapBaseLayerActionsTargets, payload, SYNCGROUPS_TYPE_SETLAYERACTIONS);
34908
+ case 4:
34909
+ targets = _context9.sent;
34910
+ if (!(targets && targets.length > 0)) {
34911
+ _context9.next = 8;
34912
+ break;
34913
+ }
34914
+ _context9.next = 8;
34915
+ return put(setLayerActionSync(payload, targets, type));
34916
+ case 8:
34917
+ case "end":
34918
+ return _context9.stop();
34919
+ }
34920
+ }, _callee9);
34921
+ })();
34922
+ }
34923
+ function rootSaga$5() {
34924
+ return _regeneratorRuntime().wrap(function rootSaga$(_context10) {
34925
+ while (1) switch (_context10.prev = _context10.next) {
34926
+ case 0:
34927
+ _context10.next = 2;
34928
+ return takeLatest$1(setTime.type, setTimeSaga);
34929
+ case 2:
34930
+ _context10.next = 4;
34931
+ return takeLatest$1(setBbox.type, setBBoxSaga);
34932
+ case 4:
34933
+ _context10.next = 6;
34934
+ return takeLatest$1(layerChangeName.type, layerActionsSaga);
34935
+ case 6:
34936
+ _context10.next = 8;
34937
+ return takeLatest$1(layerChangeEnabled.type, layerActionsSaga);
34938
+ case 8:
34939
+ _context10.next = 10;
34940
+ return takeLatest$1(layerChangeOpacity.type, layerActionsSaga);
34941
+ case 10:
34942
+ _context10.next = 12;
34943
+ return takeLatest$1(layerChangeDimension.type, layerActionsSaga);
34944
+ case 12:
34945
+ _context10.next = 14;
34946
+ return takeLatest$1(layerChangeStyle.type, layerActionsSaga);
34947
+ case 14:
34948
+ _context10.next = 16;
34949
+ return takeLatest$1(layerDelete.type, deleteLayerActionsSaga);
34950
+ case 16:
34951
+ _context10.next = 18;
34952
+ return takeLatest$1(addLayer.type, addLayerActionsSaga);
34953
+ case 18:
34954
+ _context10.next = 20;
34955
+ return takeLatest$1(duplicateMapLayer.type, duplicateMapLayerActionsSaga);
34956
+ case 20:
34957
+ _context10.next = 22;
34958
+ return takeLatest$1(mapActions.layerMoveLayer.type, moveLayerActionsSaga);
34959
+ case 22:
34960
+ _context10.next = 24;
34961
+ return takeLatest$1(mapActions.setAutoLayerId.type, setAutoLayerIdActionsSaga);
34962
+ case 24:
34963
+ _context10.next = 26;
34964
+ return takeLatest$1(setBaseLayers.type, mapBaseLayerActionsSaga);
34965
+ case 26:
34966
+ case "end":
34967
+ return _context10.stop();
34968
+ }
34969
+ }, _marked$6);
34970
+ }
34971
+
34972
+ /* *
34973
+ * Licensed under the Apache License, Version 2.0 (the "License");
34974
+ * you may not use this file except in compliance with the License.
34975
+ * You may obtain a copy of the License at
34976
+ *
34977
+ * http://www.apache.org/licenses/LICENSE-2.0
34978
+ *
34979
+ * Unless required by applicable law or agreed to in writing, software
34980
+ * distributed under the License is distributed on an "AS IS" BASIS,
34981
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34982
+ * See the License for the specific language governing permissions and
34983
+ * limitations under the License.
34984
+ *
34985
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34986
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
34210
34987
  * */
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',
34988
+ var snackbarAdapter = createEntityAdapter();
34989
+ var initialState$3 = snackbarAdapter.getInitialState();
34990
+ var slice$3 = createSlice({
34991
+ initialState: initialState$3,
34992
+ name: 'snackbar',
34220
34993
  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(
34994
+ // To open the snackbar call this action
34995
+ openSnackbar: function openSnackbar(
34228
34996
  // eslint-disable-next-line no-unused-vars
34229
34997
  draft,
34230
34998
  // eslint-disable-next-line no-unused-vars
34231
- 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
- });
34999
+ action) {},
35000
+ // triggerOpenSnackbarBySaga is triggered by the saga to open the snackbar after the current snackbars have all been closed
35001
+ // DO NOT CALL THIS ACTION DIRECTLY!
35002
+ triggerOpenSnackbarBySaga: function triggerOpenSnackbarBySaga(draft, action) {
35003
+ var snackbarContent = action.payload.snackbarContent;
35004
+ // Ensure we have an id before proceeding
35005
+ if (snackbarContent.id === undefined) {
35006
+ return;
35007
+ }
35008
+ snackbarAdapter.setOne(draft, snackbarContent);
35009
+ },
35010
+ closeSnackbar: function closeSnackbar(draft) {
35011
+ snackbarAdapter.removeAll(draft);
35012
+ }
34244
35013
  }
34245
35014
  });
34246
- var reducer$1 = slice$1.reducer;
34247
- var drawActions = slice$1.actions;
35015
+ var reducer$3 = slice$3.reducer;
35016
+ var snackbarActions = slice$3.actions;
34248
35017
 
34249
35018
  /* *
34250
35019
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -34259,28 +35028,32 @@ var drawActions = slice$1.actions;
34259
35028
  * See the License for the specific language governing permissions and
34260
35029
  * limitations under the License.
34261
35030
  *
34262
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34263
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
35031
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35032
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
34264
35033
  * */
34265
- var getDrawStore = function getDrawStore(store) {
34266
- if (store && store.drawings) {
34267
- return store.drawings;
35034
+ var getSnackbarStore = function getSnackbarStore(store) {
35035
+ if (store && store.snackbar) {
35036
+ return store.snackbar;
34268
35037
  }
34269
35038
  return null;
34270
35039
  };
34271
- var _drawAdapter$getSelec$1 = drawAdapter$1.getSelectors(function (state) {
35040
+ var _snackbarAdapter$getS = snackbarAdapter.getSelectors(function (state) {
34272
35041
  var _a;
34273
- return (_a = state === null || state === void 0 ? void 0 : state.drawings) !== null && _a !== void 0 ? _a : {
35042
+ return (_a = state === null || state === void 0 ? void 0 : state.snackbar) !== null && _a !== void 0 ? _a : {
34274
35043
  entities: {},
34275
35044
  ids: []
34276
35045
  };
34277
35046
  }),
34278
- selectDrawByMapId = _drawAdapter$getSelec$1.selectById;
35047
+ getCurrentSnackbarMessages = _snackbarAdapter$getS.selectAll;
35048
+ var getFirstSnackbarMessage = createSelector(getCurrentSnackbarMessages, function (currentMessages) {
35049
+ return currentMessages.length > 0 ? currentMessages[0] : undefined;
35050
+ });
34279
35051
 
34280
35052
  var selectors$1 = /*#__PURE__*/Object.freeze({
34281
35053
  __proto__: null,
34282
- getDrawStore: getDrawStore,
34283
- selectDrawByMapId: selectDrawByMapId
35054
+ getSnackbarStore: getSnackbarStore,
35055
+ getCurrentSnackbarMessages: getCurrentSnackbarMessages,
35056
+ getFirstSnackbarMessage: getFirstSnackbarMessage
34284
35057
  });
34285
35058
 
34286
35059
  /* *
@@ -34304,6 +35077,234 @@ var types = /*#__PURE__*/Object.freeze({
34304
35077
  __proto__: null
34305
35078
  });
34306
35079
 
35080
+ var _marked$5 = /*#__PURE__*/_regeneratorRuntime().mark(openSnackbarSaga),
35081
+ _marked2$4 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
35082
+ var hideTime = 4000;
35083
+ function openSnackbarSaga(capturedAction) {
35084
+ var snackbarMessage, currentSnackbarMessages, id, currentSnackbarMessagesOpen;
35085
+ return _regeneratorRuntime().wrap(function openSnackbarSaga$(_context) {
35086
+ while (1) switch (_context.prev = _context.next) {
35087
+ case 0:
35088
+ snackbarMessage = capturedAction.payload.message;
35089
+ _context.next = 3;
35090
+ return select(getCurrentSnackbarMessages);
35091
+ case 3:
35092
+ currentSnackbarMessages = _context.sent;
35093
+ if (!currentSnackbarMessages.length) {
35094
+ _context.next = 7;
35095
+ break;
35096
+ }
35097
+ _context.next = 7;
35098
+ return put(snackbarActions.closeSnackbar());
35099
+ case 7:
35100
+ // Generate a unique id
35101
+ id = "snackbar".concat(Date.now().toString());
35102
+ _context.next = 10;
35103
+ return put(snackbarActions.triggerOpenSnackbarBySaga({
35104
+ snackbarContent: {
35105
+ message: snackbarMessage,
35106
+ id: id
35107
+ }
35108
+ }));
35109
+ case 10:
35110
+ _context.next = 12;
35111
+ return delay(hideTime);
35112
+ case 12:
35113
+ _context.next = 14;
35114
+ return select(getCurrentSnackbarMessages);
35115
+ case 14:
35116
+ currentSnackbarMessagesOpen = _context.sent;
35117
+ if (!currentSnackbarMessagesOpen.length) {
35118
+ _context.next = 18;
35119
+ break;
35120
+ }
35121
+ _context.next = 18;
35122
+ return put(snackbarActions.closeSnackbar());
35123
+ case 18:
35124
+ case "end":
35125
+ return _context.stop();
35126
+ }
35127
+ }, _marked$5);
35128
+ }
35129
+ function rootSaga$4() {
35130
+ return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
35131
+ while (1) switch (_context2.prev = _context2.next) {
35132
+ case 0:
35133
+ _context2.next = 2;
35134
+ return takeLatest$1(snackbarActions.openSnackbar.type, openSnackbarSaga);
35135
+ case 2:
35136
+ case "end":
35137
+ return _context2.stop();
35138
+ }
35139
+ }, _marked2$4);
35140
+ }
35141
+
35142
+ /* *
35143
+ * Licensed under the Apache License, Version 2.0 (the "License");
35144
+ * you may not use this file except in compliance with the License.
35145
+ * You may obtain a copy of the License at
35146
+ *
35147
+ * http://www.apache.org/licenses/LICENSE-2.0
35148
+ *
35149
+ * Unless required by applicable law or agreed to in writing, software
35150
+ * distributed under the License is distributed on an "AS IS" BASIS,
35151
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35152
+ * See the License for the specific language governing permissions and
35153
+ * limitations under the License.
35154
+ *
35155
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35156
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
35157
+ * */
35158
+ var snackbarModuleConfig = {
35159
+ id: 'snackbar-module',
35160
+ reducersMap: {
35161
+ snackbar: reducer$3
35162
+ },
35163
+ sagas: [rootSaga$4]
35164
+ };
35165
+
35166
+ /* *
35167
+ * Licensed under the Apache License, Version 2.0 (the "License");
35168
+ * you may not use this file except in compliance with the License.
35169
+ * You may obtain a copy of the License at
35170
+ *
35171
+ * http://www.apache.org/licenses/LICENSE-2.0
35172
+ *
35173
+ * Unless required by applicable law or agreed to in writing, software
35174
+ * distributed under the License is distributed on an "AS IS" BASIS,
35175
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35176
+ * See the License for the specific language governing permissions and
35177
+ * limitations under the License.
35178
+ *
35179
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35180
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
35181
+ * */
35182
+ var initialState$2 = {};
35183
+ var slice$2 = createSlice({
35184
+ initialState: initialState$2,
35185
+ name: 'router',
35186
+ reducers: {
35187
+ navigateToUrl: function navigateToUrl(
35188
+ // eslint-disable-next-line no-unused-vars
35189
+ draft,
35190
+ // eslint-disable-next-line no-unused-vars
35191
+ action) {}
35192
+ }
35193
+ });
35194
+ var reducer$2 = slice$2.reducer;
35195
+ var routerActions = slice$2.actions;
35196
+
35197
+ /* *
35198
+ * Licensed under the Apache License, Version 2.0 (the "License");
35199
+ * you may not use this file except in compliance with the License.
35200
+ * You may obtain a copy of the License at
35201
+ *
35202
+ * http://www.apache.org/licenses/LICENSE-2.0
35203
+ *
35204
+ * Unless required by applicable law or agreed to in writing, software
35205
+ * distributed under the License is distributed on an "AS IS" BASIS,
35206
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35207
+ * See the License for the specific language governing permissions and
35208
+ * limitations under the License.
35209
+ *
35210
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35211
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
35212
+ * */
35213
+ // stores navigate hook method to object, so it can be used outside components
35214
+ var historyDict = {
35215
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35216
+ navigate: null
35217
+ };
35218
+
35219
+ var utils = /*#__PURE__*/Object.freeze({
35220
+ __proto__: null,
35221
+ historyDict: historyDict
35222
+ });
35223
+
35224
+ var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(navigateToUrlSaga),
35225
+ _marked2$3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$3);
35226
+ function navigateToUrlSaga(action) {
35227
+ var payload;
35228
+ return _regeneratorRuntime().wrap(function navigateToUrlSaga$(_context) {
35229
+ while (1) switch (_context.prev = _context.next) {
35230
+ case 0:
35231
+ payload = action.payload;
35232
+ _context.next = 3;
35233
+ return call(historyDict.navigate, payload.url);
35234
+ case 3:
35235
+ case "end":
35236
+ return _context.stop();
35237
+ }
35238
+ }, _marked$4);
35239
+ }
35240
+ function rootSaga$3() {
35241
+ return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
35242
+ while (1) switch (_context2.prev = _context2.next) {
35243
+ case 0:
35244
+ _context2.next = 2;
35245
+ return takeLatest$1(routerActions.navigateToUrl.type, navigateToUrlSaga);
35246
+ case 2:
35247
+ case "end":
35248
+ return _context2.stop();
35249
+ }
35250
+ }, _marked2$3);
35251
+ }
35252
+
35253
+ /* *
35254
+ * Licensed under the Apache License, Version 2.0 (the "License");
35255
+ * you may not use this file except in compliance with the License.
35256
+ * You may obtain a copy of the License at
35257
+ *
35258
+ * http://www.apache.org/licenses/LICENSE-2.0
35259
+ *
35260
+ * Unless required by applicable law or agreed to in writing, software
35261
+ * distributed under the License is distributed on an "AS IS" BASIS,
35262
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35263
+ * See the License for the specific language governing permissions and
35264
+ * limitations under the License.
35265
+ *
35266
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35267
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
35268
+ * */
35269
+ var routerModuleConfig = {
35270
+ id: 'router',
35271
+ reducersMap: {
35272
+ router: reducer$2
35273
+ },
35274
+ sagas: [rootSaga$3]
35275
+ };
35276
+
35277
+ /* *
35278
+ * Licensed under the Apache License, Version 2.0 (the "License");
35279
+ * you may not use this file except in compliance with the License.
35280
+ * You may obtain a copy of the License at
35281
+ *
35282
+ * http://www.apache.org/licenses/LICENSE-2.0
35283
+ *
35284
+ * Unless required by applicable law or agreed to in writing, software
35285
+ * distributed under the License is distributed on an "AS IS" BASIS,
35286
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35287
+ * See the License for the specific language governing permissions and
35288
+ * limitations under the License.
35289
+ *
35290
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35291
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
35292
+ * */
35293
+ var initialState$1 = {
35294
+ isInitialised: false
35295
+ };
35296
+ var slice$1 = createSlice({
35297
+ initialState: initialState$1,
35298
+ name: 'app',
35299
+ reducers: {
35300
+ initialiseApp: function initialiseApp(draft) {
35301
+ draft.isInitialised = true;
35302
+ }
35303
+ }
35304
+ });
35305
+ var reducer$1 = slice$1.reducer;
35306
+ var appActions = slice$1.actions;
35307
+
34307
35308
  /* *
34308
35309
  * Licensed under the Apache License, Version 2.0 (the "License");
34309
35310
  * you may not use this file except in compliance with the License.
@@ -34317,15 +35318,14 @@ var types = /*#__PURE__*/Object.freeze({
34317
35318
  * See the License for the specific language governing permissions and
34318
35319
  * limitations under the License.
34319
35320
  *
34320
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34321
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
35321
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35322
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
34322
35323
  * */
34323
- var drawModuleConfig = {
34324
- id: 'draw-module',
35324
+ var appModuleConfig = {
35325
+ id: 'app-module',
34325
35326
  reducersMap: {
34326
- drawings: reducer$1
34327
- },
34328
- sagas: []
35327
+ app: reducer$1
35328
+ }
34329
35329
  };
34330
35330
 
34331
35331
  /* *
@@ -34350,9 +35350,6 @@ var drawAdapter = createEntityAdapter({
34350
35350
  return draw.drawToolId;
34351
35351
  }
34352
35352
  });
34353
- var getDrawLayerId = function getDrawLayerId(drawToolId) {
34354
- return "drawlayer-".concat(drawToolId);
34355
- };
34356
35353
  var getDrawToolByLayerId = function getDrawToolByLayerId(draft, layerId) {
34357
35354
  var state = R(draft);
34358
35355
  var drawTool = state.ids.map(function (id) {
@@ -34370,14 +35367,22 @@ var slice = createSlice({
34370
35367
  registerDrawTool: function registerDrawTool(draft, action) {
34371
35368
  var _action$payload = action.payload,
34372
35369
  drawToolId = _action$payload.drawToolId,
34373
- drawModes = _action$payload.drawModes;
35370
+ drawModes = _action$payload.drawModes,
35371
+ _action$payload$geoJS = _action$payload.geoJSONLayerId,
35372
+ geoJSONLayerId = _action$payload$geoJS === void 0 ? '' : _action$payload$geoJS;
34374
35373
  drawAdapter.addOne(draft, {
34375
35374
  drawToolId: drawToolId,
34376
- geoJSONLayerId: getDrawLayerId(drawToolId),
35375
+ geoJSONLayerId: geoJSONLayerId,
34377
35376
  activeDrawModeId: '',
34378
35377
  drawModes: drawModes
34379
35378
  });
34380
35379
  },
35380
+ unregisterDrawTool: function unregisterDrawTool(draft, action) {
35381
+ var drawToolId = action.payload.drawToolId;
35382
+ if (draft.entities[drawToolId]) {
35383
+ drawAdapter.removeOne(draft, drawToolId);
35384
+ }
35385
+ },
34381
35386
  changeDrawToolMode: function changeDrawToolMode(draft, action) {
34382
35387
  var _action$payload2 = action.payload,
34383
35388
  drawModeId = _action$payload2.drawModeId,
@@ -34398,6 +35403,16 @@ var slice = createSlice({
34398
35403
  } else {
34399
35404
  drawTool.activeDrawModeId = '';
34400
35405
  }
35406
+ },
35407
+ updateGeoJSONLayerId: function updateGeoJSONLayerId(draft, action) {
35408
+ var _action$payload3 = action.payload,
35409
+ geoJSONLayerId = _action$payload3.geoJSONLayerId,
35410
+ drawToolId = _action$payload3.drawToolId;
35411
+ var drawTool = draft.entities[drawToolId];
35412
+ if (!drawTool) {
35413
+ return;
35414
+ }
35415
+ drawTool.geoJSONLayerId = geoJSONLayerId;
34401
35416
  }
34402
35417
  },
34403
35418
  extraReducers: function extraReducers(builder) {
@@ -34409,9 +35424,9 @@ var slice = createSlice({
34409
35424
  }
34410
35425
  }).addCase(layerActions.updateFeatureProperties, function (draft, action) {
34411
35426
  var _a;
34412
- var _action$payload3 = action.payload,
34413
- properties = _action$payload3.properties,
34414
- layerId = _action$payload3.layerId;
35427
+ var _action$payload4 = action.payload,
35428
+ properties = _action$payload4.properties,
35429
+ layerId = _action$payload4.layerId;
34415
35430
  var drawToolId = getDrawToolByLayerId(draft, layerId);
34416
35431
  var entity = draft.entities[drawToolId];
34417
35432
  if (drawToolId && entity !== undefined) {
@@ -34476,44 +35491,54 @@ var _drawAdapter$getSelec = drawAdapter.getSelectors(function (state) {
34476
35491
  ids: []
34477
35492
  };
34478
35493
  }),
34479
- selectDrawingToolByMapId = _drawAdapter$getSelec.selectById;
34480
- var getDrawModeById = createSelector(selectDrawingToolByMapId, function (_store, _drawToolId, drawModeId) {
35494
+ selectDrawToolById = _drawAdapter$getSelec.selectById,
35495
+ selectAllDrawingTools = _drawAdapter$getSelec.selectAll;
35496
+ var getDrawModeById = createSelector(selectDrawToolById, function (_store, _drawToolId, drawModeId) {
34481
35497
  return drawModeId;
34482
35498
  }, function (draw, drawModeId) {
34483
35499
  return draw === null || draw === void 0 ? void 0 : draw.drawModes.find(function (tool) {
34484
35500
  return tool.drawModeId === drawModeId;
34485
35501
  });
34486
35502
  });
35503
+ var getActiveDrawModeId = createSelector(selectDrawToolById, function (drawingTool) {
35504
+ return (drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.activeDrawModeId) || '';
35505
+ });
35506
+ var getDrawToolGeoJSONLayerId = createSelector(selectDrawToolById, function (drawingTool) {
35507
+ return (drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.geoJSONLayerId) || '';
35508
+ });
34487
35509
 
34488
35510
  var selectors = /*#__PURE__*/Object.freeze({
34489
35511
  __proto__: null,
34490
35512
  getDrawingtoolStore: getDrawingtoolStore,
34491
- selectDrawingToolByMapId: selectDrawingToolByMapId,
34492
- getDrawModeById: getDrawModeById
35513
+ selectDrawToolById: selectDrawToolById,
35514
+ selectAllDrawingTools: selectAllDrawingTools,
35515
+ getDrawModeById: getDrawModeById,
35516
+ getActiveDrawModeId: getActiveDrawModeId,
35517
+ getDrawToolGeoJSONLayerId: getDrawToolGeoJSONLayerId
34493
35518
  });
34494
35519
 
34495
- var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
35520
+ var _marked$3 = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
34496
35521
  function registerDrawToolSaga(_ref) {
34497
35522
  var payload = _ref.payload;
34498
35523
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
34499
- var drawToolId, mapId, drawLayerId;
35524
+ var mapId, geoJSONLayerId;
34500
35525
  return _regeneratorRuntime().wrap(function _callee$(_context) {
34501
35526
  while (1) switch (_context.prev = _context.next) {
34502
35527
  case 0:
34503
- drawToolId = payload.drawToolId, mapId = payload.mapId;
34504
- drawLayerId = getDrawLayerId(drawToolId); // create for every drawTool a draw layer
35528
+ mapId = payload.mapId, geoJSONLayerId = payload.geoJSONLayerId; // create for every drawTool a draw layer
35529
+ if (!(geoJSONLayerId && mapId)) {
35530
+ _context.next = 4;
35531
+ break;
35532
+ }
34505
35533
  _context.next = 4;
34506
35534
  return put(mapStoreActions.addLayer({
34507
35535
  mapId: mapId,
34508
35536
  layer: {
34509
35537
  // empty geoJSON
34510
- geojson: {
34511
- type: 'FeatureCollection',
34512
- features: []
34513
- },
35538
+ geojson: emptyGeoJSON,
34514
35539
  layerType: LayerType.featureLayer
34515
35540
  },
34516
- layerId: drawLayerId,
35541
+ layerId: geoJSONLayerId,
34517
35542
  origin: 'drawings saga:registerDrawToolSaga'
34518
35543
  }));
34519
35544
  case 4:
@@ -34533,7 +35558,7 @@ function changeDrawToolSaga(_ref2) {
34533
35558
  _context2.prev = 0;
34534
35559
  drawModeId = payload.drawModeId, drawToolId = payload.drawToolId;
34535
35560
  _context2.next = 4;
34536
- return select(selectDrawingToolByMapId, drawToolId);
35561
+ return select(selectDrawToolById, drawToolId);
34537
35562
  case 4:
34538
35563
  drawingTool = _context2.sent;
34539
35564
  _context2.next = 7;
@@ -34621,7 +35646,7 @@ function drawingSaga() {
34621
35646
  case "end":
34622
35647
  return _context3.stop();
34623
35648
  }
34624
- }, _marked$4);
35649
+ }, _marked$3);
34625
35650
  }
34626
35651
 
34627
35652
  /* *
@@ -34648,6 +35673,42 @@ var drawtoolModuleConfig = {
34648
35673
  sagas: [drawingSaga]
34649
35674
  };
34650
35675
 
35676
+ /* *
35677
+ * Licensed under the Apache License, Version 2.0 (the "License");
35678
+ * you may not use this file except in compliance with the License.
35679
+ * You may obtain a copy of the License at
35680
+ *
35681
+ * http://www.apache.org/licenses/LICENSE-2.0
35682
+ *
35683
+ * Unless required by applicable law or agreed to in writing, software
35684
+ * distributed under the License is distributed on an "AS IS" BASIS,
35685
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35686
+ * See the License for the specific language governing permissions and
35687
+ * limitations under the License.
35688
+ *
35689
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35690
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
35691
+ * */
35692
+ var getSingularDrawtoolDrawLayerId = function getSingularDrawtoolDrawLayerId(mapId) {
35693
+ return "drawlayer-".concat(mapId);
35694
+ };
35695
+ var getGeoJSONPropertyValue = function getGeoJSONPropertyValue(property, properties, polygonDrawMode) {
35696
+ var defaultProperties = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : defaultGeoJSONStyleProperties;
35697
+ // if a shape is set, extract the style from there
35698
+ if (properties[property] !== undefined) {
35699
+ return properties[property];
35700
+ }
35701
+ // if active polygon tool is preset, retreive style from there
35702
+ if (polygonDrawMode) {
35703
+ var polygonDrawModeProperty = polygonDrawMode.shape.type === 'Feature' && polygonDrawMode.shape.properties[property];
35704
+ if (polygonDrawModeProperty !== undefined) {
35705
+ return polygonDrawModeProperty;
35706
+ }
35707
+ }
35708
+ // otherwise get values from defaultStyle
35709
+ return defaultProperties[property];
35710
+ };
35711
+
34651
35712
  var createLayersState = function createLayersState(layerId) {
34652
35713
  var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
34653
35714
  return {
@@ -34880,496 +35941,6 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
34880
35941
  testGeoJSON: testGeoJSON
34881
35942
  });
34882
35943
 
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
35944
  var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(updateSourceValueWhenLinkingComponentToGroupSaga),
35374
35945
  _marked2$2 = /*#__PURE__*/_regeneratorRuntime().mark(updateViewStateSaga),
35375
35946
  _marked3$1 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$2);
@@ -35527,9 +36098,9 @@ function rootSaga$2() {
35527
36098
  var synchronizationGroupConfig = {
35528
36099
  id: 'syncronizationGroupStore-module',
35529
36100
  reducersMap: {
35530
- syncronizationGroupStore: reducer$7
36101
+ syncronizationGroupStore: reducer$6
35531
36102
  },
35532
- sagas: [rootSaga$3, rootSaga$2]
36103
+ sagas: [rootSaga$5, rootSaga$2]
35533
36104
  };
35534
36105
 
35535
36106
  var _marked$1 = /*#__PURE__*/_regeneratorRuntime().mark(layerSelectRemoveServiceSaga),
@@ -35707,7 +36278,7 @@ function rootSaga$1() {
35707
36278
  var layerSelectConfig = {
35708
36279
  id: 'layerSelect-module',
35709
36280
  reducersMap: {
35710
- layerSelect: reducer$5
36281
+ layerSelect: reducer$4
35711
36282
  },
35712
36283
  sagas: [rootSaga$1]
35713
36284
  };
@@ -35822,7 +36393,7 @@ function rootSaga() {
35822
36393
  var uiModuleConfig = {
35823
36394
  id: 'ui-module',
35824
36395
  reducersMap: {
35825
- ui: reducer$9
36396
+ ui: reducer$8
35826
36397
  },
35827
36398
  sagas: [rootSaga]
35828
36399
  };
@@ -35843,6 +36414,6 @@ var uiModuleConfig = {
35843
36414
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35844
36415
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
35845
36416
  * */
35846
- var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModuleConfig, layerSelectConfig, snackbarModuleConfig, drawModuleConfig, drawtoolModuleConfig];
36417
+ var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModuleConfig, layerSelectConfig, snackbarModuleConfig, drawtoolModuleConfig];
35847
36418
 
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 };
36419
+ 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, mapStoreReducers, 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 };