@opengeoweb/store 8.4.1 → 9.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 (46) hide show
  1. package/index.esm.js +832 -1259
  2. package/package.json +2 -21
  3. package/src/hooks/index.d.ts +1 -0
  4. package/src/hooks/useSetupDialog/index.d.ts +1 -0
  5. package/src/hooks/useSetupDialog/useSetupDialog.d.ts +12 -0
  6. package/src/index.d.ts +1 -0
  7. package/src/store/coreModuleConfig.d.ts +1 -1
  8. package/src/store/drawingtool/reducer.d.ts +12 -2
  9. package/src/store/drawingtool/sagas.d.ts +1 -0
  10. package/src/store/drawingtool/selectors.d.ts +20 -0
  11. package/src/store/index.d.ts +1 -2
  12. package/src/store/mapStore/config.d.ts +1 -1
  13. package/src/store/mapStore/index.d.ts +7 -0
  14. package/src/store/mapStore/layers/reducer.d.ts +17 -3
  15. package/src/store/mapStore/layers/selectors.d.ts +5 -0
  16. package/src/store/mapStore/layers/types.d.ts +4 -0
  17. package/src/store/mapStore/map/index.d.ts +1 -1
  18. package/src/store/mapStore/map/sagas.d.ts +2 -2
  19. package/src/store/mapStore/map/utils.d.ts +1 -1
  20. package/src/store/mapStore/storeTestSettings.d.ts +1 -0
  21. package/src/store/mapStore/storeTestUtils.d.ts +5 -0
  22. package/src/store/types.d.ts +2 -2
  23. package/src/store/ui/types.d.ts +1 -0
  24. package/src/store/utils.d.ts +0 -2
  25. package/src/store/layerSelect/config.d.ts +0 -5
  26. package/src/store/layerSelect/index.d.ts +0 -4
  27. package/src/store/layerSelect/localStorage.d.ts +0 -3
  28. package/src/store/layerSelect/reducer.d.ts +0 -28
  29. package/src/store/layerSelect/reducer.spec.d.ts +0 -1
  30. package/src/store/layerSelect/sagas.d.ts +0 -10
  31. package/src/store/layerSelect/sagas.spec.d.ts +0 -1
  32. package/src/store/layerSelect/selectors.d.ts +0 -115
  33. package/src/store/layerSelect/selectors.spec.d.ts +0 -1
  34. package/src/store/layerSelect/types.d.ts +0 -88
  35. package/src/store/layerSelect/utils.d.ts +0 -6
  36. package/src/store/layerSelect/utils.spec.d.ts +0 -1
  37. package/src/store/snackbar/config.d.ts +0 -4
  38. package/src/store/snackbar/index.d.ts +0 -6
  39. package/src/store/snackbar/reducer.d.ts +0 -11
  40. package/src/store/snackbar/reducer.spec.d.ts +0 -1
  41. package/src/store/snackbar/sagas.d.ts +0 -5
  42. package/src/store/snackbar/sagas.spec.d.ts +0 -1
  43. package/src/store/snackbar/selectors.d.ts +0 -8
  44. package/src/store/snackbar/selectors.spec.d.ts +0 -1
  45. package/src/store/snackbar/types.d.ts +0 -15
  46. /package/src/{store/layerSelect/localStorage.spec.d.ts → hooks/useSetupDialog/useSetupDialog.spec.d.ts} +0 -0
package/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { webmapUtils, LayerType, webmapTestSettings, WMLayer, getCapabilities } from '@opengeoweb/webmap';
2
- import { getGeoJson, moveFeature, defaultLayers, getFeatureCollection, emptyGeoJSON } from '@opengeoweb/webmap-react';
2
+ import { getGeoJson, moveFeature, createInterSections, defaultLayers, getFeatureCollection, emptyGeoJSON, defaultIntersectionStyleProperties } from '@opengeoweb/webmap-react';
3
3
  export { defaultLayers } from '@opengeoweb/webmap-react';
4
4
  import * as React from 'react';
5
- import React__default from 'react';
5
+ import React__default, { useContext, useRef, useCallback, useDebugValue, useEffect } from 'react';
6
6
  import { ThemeWrapper, lightTheme } from '@opengeoweb/theme';
7
7
  import { withEggs } from '@opengeoweb/shared';
8
8
 
@@ -334,15 +334,6 @@ function _regeneratorRuntime() {
334
334
  }
335
335
  }, e;
336
336
  }
337
- function _typeof$1(o) {
338
- "@babel/helpers - typeof";
339
-
340
- return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
341
- return typeof o;
342
- } : function (o) {
343
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
344
- }, _typeof$1(o);
345
- }
346
337
  function _defineProperty$1(obj, key, value) {
347
338
  key = _toPropertyKey$1(key);
348
339
  if (key in obj) {
@@ -391,57 +382,6 @@ function _nonIterableSpread() {
391
382
  function _nonIterableRest() {
392
383
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
393
384
  }
394
- function _createForOfIteratorHelper(o, allowArrayLike) {
395
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
396
- if (!it) {
397
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
398
- if (it) o = it;
399
- var i = 0;
400
- var F = function () {};
401
- return {
402
- s: F,
403
- n: function () {
404
- if (i >= o.length) return {
405
- done: true
406
- };
407
- return {
408
- done: false,
409
- value: o[i++]
410
- };
411
- },
412
- e: function (e) {
413
- throw e;
414
- },
415
- f: F
416
- };
417
- }
418
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
419
- }
420
- var normalCompletion = true,
421
- didErr = false,
422
- err;
423
- return {
424
- s: function () {
425
- it = it.call(o);
426
- },
427
- n: function () {
428
- var step = it.next();
429
- normalCompletion = step.done;
430
- return step;
431
- },
432
- e: function (e) {
433
- didErr = true;
434
- err = e;
435
- },
436
- f: function () {
437
- try {
438
- if (!normalCompletion && it.return != null) it.return();
439
- } finally {
440
- if (didErr) throw err;
441
- }
442
- }
443
- };
444
- }
445
385
  function _toPrimitive$1(input, hint) {
446
386
  if (typeof input !== "object" || input === null) return input;
447
387
  var prim = input[Symbol.toPrimitive];
@@ -2856,7 +2796,7 @@ var LayerActionOrigin;
2856
2796
  LayerActionOrigin["unregisterMapSaga"] = "unregisterMapSaga";
2857
2797
  })(LayerActionOrigin || (LayerActionOrigin = {}));
2858
2798
 
2859
- var types$7 = /*#__PURE__*/Object.freeze({
2799
+ var types$5 = /*#__PURE__*/Object.freeze({
2860
2800
  __proto__: null,
2861
2801
  get LayerStatus () { return LayerStatus; },
2862
2802
  get LayerActionOrigin () { return LayerActionOrigin; }
@@ -9366,7 +9306,7 @@ var produceDraftStateSetMapDimensionFromLayerChangeDimension = function produceD
9366
9306
  */
9367
9307
  function moveArrayElements(array, oldIndex, newIndex) {
9368
9308
  var newArray = _toConsumableArray(array);
9369
- var indexNew = newIndex >= newArray.length ? newArray.length - 1 : newIndex;
9309
+ var indexNew = Math.min(newIndex, newArray.length - 1);
9370
9310
  newArray.splice(indexNew, 0, newArray.splice(oldIndex, 1)[0]);
9371
9311
  return newArray;
9372
9312
  }
@@ -9747,7 +9687,9 @@ var createLayer = function createLayer(_a) {
9747
9687
  layerType = _a$layerType === void 0 ? 'mapLayer' : _a$layerType,
9748
9688
  _a$status = _a.status,
9749
9689
  status = _a$status === void 0 ? 'default' : _a$status,
9750
- props = __rest(_a, ["id", "opacity", "acceptanceTimeInMinutes", "enabled", "layerType", "status"]);
9690
+ _a$useLatestReference = _a.useLatestReferenceTime,
9691
+ useLatestReferenceTime = _a$useLatestReference === void 0 ? true : _a$useLatestReference,
9692
+ props = __rest(_a, ["id", "opacity", "acceptanceTimeInMinutes", "enabled", "layerType", "status", "useLatestReferenceTime"]);
9751
9693
  var wmjsLayer = webmapUtils.getWMLayerById(id);
9752
9694
  var dimensions = props.dimensions || (wmjsLayer ? wmjsLayer.getDimensions() : []).map(function (dim) {
9753
9695
  return {
@@ -9763,10 +9705,11 @@ var createLayer = function createLayer(_a) {
9763
9705
  acceptanceTimeInMinutes: acceptanceTimeInMinutes,
9764
9706
  enabled: enabled,
9765
9707
  layerType: layerType,
9766
- status: status
9708
+ status: status,
9709
+ useLatestReferenceTime: useLatestReferenceTime
9767
9710
  });
9768
9711
  };
9769
- var initialState$9 = {
9712
+ var initialState$7 = {
9770
9713
  byId: {},
9771
9714
  allIds: [],
9772
9715
  availableBaseLayers: {
@@ -9774,8 +9717,8 @@ var initialState$9 = {
9774
9717
  allIds: []
9775
9718
  }
9776
9719
  };
9777
- var slice$9 = createSlice({
9778
- initialState: initialState$9,
9720
+ var slice$7 = createSlice({
9721
+ initialState: initialState$7,
9779
9722
  name: 'layerReducer',
9780
9723
  reducers: {
9781
9724
  addLayer: function addLayer(draft, action) {
@@ -10034,10 +9977,20 @@ var slice$9 = createSlice({
10034
9977
  draft.availableBaseLayers.allIds.push(layer.id);
10035
9978
  });
10036
9979
  },
10037
- onUpdateLayerInformation: function onUpdateLayerInformation(draft, action) {
9980
+ setUseLatestReferenceTime: function setUseLatestReferenceTime(draft, action) {
10038
9981
  var _action$payload14 = action.payload,
10039
- layerStyle = _action$payload14.layerStyle,
10040
- layerDimensions = _action$payload14.layerDimensions;
9982
+ id = _action$payload14.id,
9983
+ useLatestReferenceTime = _action$payload14.useLatestReferenceTime;
9984
+ var layer = draft.byId[id];
9985
+ if (!layer) {
9986
+ return;
9987
+ }
9988
+ layer.useLatestReferenceTime = useLatestReferenceTime;
9989
+ },
9990
+ onUpdateLayerInformation: function onUpdateLayerInformation(draft, action) {
9991
+ var _action$payload15 = action.payload,
9992
+ layerStyle = _action$payload15.layerStyle,
9993
+ layerDimensions = _action$payload15.layerDimensions;
10041
9994
  if (layerStyle && draft.byId[layerStyle.layerId]) {
10042
9995
  draft.byId[layerStyle.layerId].style = layerStyle === null || layerStyle === void 0 ? void 0 : layerStyle.style;
10043
9996
  }
@@ -10074,6 +10027,9 @@ var slice$9 = createSlice({
10074
10027
  return d.name === newLayerDimension.name;
10075
10028
  });
10076
10029
  if (existingDimension) {
10030
+ if (existingDimension.name === 'reference_time' && reduxLayer.useLatestReferenceTime && newLayerDimension.maxValue) {
10031
+ existingDimension.currentValue = newLayerDimension.maxValue;
10032
+ }
10077
10033
  /* If found update only minValue, maxValue and values */
10078
10034
  existingDimension.maxValue = newLayerDimension.maxValue;
10079
10035
  existingDimension.minValue = newLayerDimension.minValue;
@@ -10089,23 +10045,38 @@ var slice$9 = createSlice({
10089
10045
  });
10090
10046
  },
10091
10047
  // feature layer actions
10048
+ orderLayerToFront: function orderLayerToFront(draft, action) {
10049
+ var layerId = action.payload.layerId;
10050
+ var layerIdsWithoutNewId = draft.allIds.filter(function (existingLayerId) {
10051
+ return existingLayerId !== layerId;
10052
+ });
10053
+ if (!layerId || layerIdsWithoutNewId.length === draft.allIds.length) {
10054
+ return;
10055
+ }
10056
+ var newLayerIds = [layerId].concat(_toConsumableArray(layerIdsWithoutNewId));
10057
+ draft.allIds = newLayerIds;
10058
+ },
10059
+ // feature layer actions
10092
10060
  setSelectedFeature: function setSelectedFeature(draft, action) {
10093
- var _action$payload15 = action.payload,
10094
- layerId = _action$payload15.layerId,
10095
- selectedFeatureIndex = _action$payload15.selectedFeatureIndex;
10061
+ var _action$payload16 = action.payload,
10062
+ layerId = _action$payload16.layerId,
10063
+ selectedFeatureIndex = _action$payload16.selectedFeatureIndex;
10096
10064
  if (!draft.byId[layerId]) {
10097
10065
  return;
10098
10066
  }
10099
10067
  draft.byId[layerId].selectedFeatureIndex = selectedFeatureIndex;
10100
10068
  },
10101
10069
  updateFeature: function updateFeature(draft, action) {
10102
- var _action$payload16 = action.payload,
10103
- layerId = _action$payload16.layerId,
10104
- geojson = _action$payload16.geojson,
10105
- _action$payload16$sho = _action$payload16.shouldAllowMultipleShapes,
10106
- shouldAllowMultipleShapes = _action$payload16$sho === void 0 ? false : _action$payload16$sho,
10107
- _action$payload16$rea = _action$payload16.reason,
10108
- reason = _action$payload16$rea === void 0 ? '' : _action$payload16$rea;
10070
+ var _a, _b;
10071
+ var _action$payload17 = action.payload,
10072
+ layerId = _action$payload17.layerId,
10073
+ geojson = _action$payload17.geojson,
10074
+ _action$payload17$sho = _action$payload17.shouldAllowMultipleShapes,
10075
+ shouldAllowMultipleShapes = _action$payload17$sho === void 0 ? false : _action$payload17$sho,
10076
+ _action$payload17$rea = _action$payload17.reason,
10077
+ reason = _action$payload17$rea === void 0 ? '' : _action$payload17$rea,
10078
+ geoJSONIntersectionLayerId = _action$payload17.geoJSONIntersectionLayerId,
10079
+ geoJSONIntersectionBoundsLayerId = _action$payload17.geoJSONIntersectionBoundsLayerId;
10109
10080
  var currentLayer = draft.byId[layerId];
10110
10081
  if (!currentLayer) {
10111
10082
  return;
@@ -10122,12 +10093,22 @@ var slice$9 = createSlice({
10122
10093
  }
10123
10094
  }
10124
10095
  currentLayer.geojson = updatedGeoJSON;
10096
+ if (geoJSONIntersectionBoundsLayerId && geoJSONIntersectionLayerId) {
10097
+ var intersectionLayer = draft.byId[geoJSONIntersectionLayerId];
10098
+ var intersectionBoundsLayer = draft.byId[geoJSONIntersectionBoundsLayerId];
10099
+ if (!intersectionLayer || !intersectionBoundsLayer) {
10100
+ return;
10101
+ }
10102
+ var bounds = R$1(intersectionBoundsLayer).geojson;
10103
+ var geoJSONProperties = R$1(intersectionLayer).defaultGeoJSONProperties || ((_b = (_a = R$1(currentLayer).geojson) === null || _a === void 0 ? void 0 : _a.features[0]) === null || _b === void 0 ? void 0 : _b.properties);
10104
+ intersectionLayer.geojson = createInterSections(updatedGeoJSON, bounds, geoJSONProperties);
10105
+ }
10125
10106
  },
10126
10107
  updateFeatureProperties: function updateFeatureProperties(draft, action) {
10127
- var _action$payload17 = action.payload,
10128
- layerId = _action$payload17.layerId,
10129
- properties = _action$payload17.properties,
10130
- selectedFeatureIndex = _action$payload17.selectedFeatureIndex;
10108
+ var _action$payload18 = action.payload,
10109
+ layerId = _action$payload18.layerId,
10110
+ properties = _action$payload18.properties,
10111
+ selectedFeatureIndex = _action$payload18.selectedFeatureIndex;
10131
10112
  var currentLayer = draft.byId[layerId];
10132
10113
  if (!currentLayer) {
10133
10114
  return;
@@ -10143,10 +10124,10 @@ var slice$9 = createSlice({
10143
10124
  }
10144
10125
  },
10145
10126
  toggleFeatureMode: function toggleFeatureMode(draft, action) {
10146
- var _action$payload18 = action.payload,
10147
- layerId = _action$payload18.layerId,
10148
- isInEditMode = _action$payload18.isInEditMode,
10149
- drawMode = _action$payload18.drawMode;
10127
+ var _action$payload19 = action.payload,
10128
+ layerId = _action$payload19.layerId,
10129
+ isInEditMode = _action$payload19.isInEditMode,
10130
+ drawMode = _action$payload19.drawMode;
10150
10131
  if (!draft.byId[layerId]) {
10151
10132
  return;
10152
10133
  }
@@ -10158,10 +10139,10 @@ var slice$9 = createSlice({
10158
10139
  }
10159
10140
  },
10160
10141
  exitFeatureDrawMode: function exitFeatureDrawMode(draft, action) {
10161
- var _action$payload19 = action.payload,
10162
- layerId = _action$payload19.layerId,
10163
- shouldAllowMultipleShapes = _action$payload19.shouldAllowMultipleShapes,
10164
- reason = _action$payload19.reason;
10142
+ var _action$payload20 = action.payload,
10143
+ layerId = _action$payload20.layerId,
10144
+ shouldAllowMultipleShapes = _action$payload20.shouldAllowMultipleShapes,
10145
+ reason = _action$payload20.reason;
10165
10146
  if (!draft.byId[layerId]) {
10166
10147
  return;
10167
10148
  }
@@ -10173,9 +10154,9 @@ var slice$9 = createSlice({
10173
10154
  },
10174
10155
  extraReducers: function extraReducers(builder) {
10175
10156
  builder.addCase(setTimeSync, function (draft, action) {
10176
- var _action$payload20 = action.payload,
10177
- targetsFromAction = _action$payload20.targets,
10178
- source = _action$payload20.source;
10157
+ var _action$payload21 = action.payload,
10158
+ targetsFromAction = _action$payload21.targets,
10159
+ source = _action$payload21.source;
10179
10160
  /* Because we want backwards compatibility with the previous code, we also need to listen to the original source action */
10180
10161
  var targets = [{
10181
10162
  targetId: source.payload.sourceId,
@@ -10199,9 +10180,9 @@ var slice$9 = createSlice({
10199
10180
  * These targets can be used as payloads in new Layer actions.
10200
10181
  * These actions are here handled via the layer reducer, as it is the same logic
10201
10182
  */
10202
- var _action$payload21 = action.payload,
10203
- targets = _action$payload21.targets,
10204
- source = _action$payload21.source;
10183
+ var _action$payload22 = action.payload,
10184
+ targets = _action$payload22.targets,
10185
+ source = _action$payload22.source;
10205
10186
  var state = R$1(draft);
10206
10187
  return targets.reduce(function (prevState, target) {
10207
10188
  var action = {
@@ -10209,7 +10190,7 @@ var slice$9 = createSlice({
10209
10190
  type: source.type
10210
10191
  };
10211
10192
  /* Handle the Layer action with the same logic, using the same reducer */
10212
- return reducer$9(prevState, action);
10193
+ return reducer$7(prevState, action);
10213
10194
  }, state);
10214
10195
  }).addCase(setMapPreset, function (draft, action) {
10215
10196
  var mapId = action.payload.mapId;
@@ -10229,8 +10210,8 @@ var slice$9 = createSlice({
10229
10210
  });
10230
10211
  }
10231
10212
  });
10232
- var reducer$9 = slice$9.reducer;
10233
- var layerActions = slice$9.actions;
10213
+ var reducer$7 = slice$7.reducer;
10214
+ var layerActions = slice$7.actions;
10234
10215
 
10235
10216
  var lodash = {exports: {}};
10236
10217
 
@@ -27455,14 +27436,10 @@ var selectorMemoizationOptions = {
27455
27436
  resultEqualityCheck: lodash.exports.isEqual
27456
27437
  }
27457
27438
  };
27458
- var isUserAddedService = function isUserAddedService(scope) {
27459
- return scope === 'user';
27460
- };
27461
27439
 
27462
27440
  var utils$1 = /*#__PURE__*/Object.freeze({
27463
27441
  __proto__: null,
27464
- selectorMemoizationOptions: selectorMemoizationOptions,
27465
- isUserAddedService: isUserAddedService
27442
+ selectorMemoizationOptions: selectorMemoizationOptions
27466
27443
  });
27467
27444
 
27468
27445
  /* *
@@ -27829,8 +27806,11 @@ var getLayerIsInsideAcceptanceTime = createSelector(getAcceptanceTimeInMinutes,
27829
27806
  }
27830
27807
  return 'inside';
27831
27808
  });
27809
+ var getUseLatestReferenceTime = createSelector(getLayerById, function (layer) {
27810
+ return Boolean(layer === null || layer === void 0 ? void 0 : layer.useLatestReferenceTime);
27811
+ });
27832
27812
 
27833
- var selectors$8 = /*#__PURE__*/Object.freeze({
27813
+ var selectors$6 = /*#__PURE__*/Object.freeze({
27834
27814
  __proto__: null,
27835
27815
  getLayerById: getLayerById,
27836
27816
  getLayersById: getLayersById,
@@ -27860,7 +27840,8 @@ var selectors$8 = /*#__PURE__*/Object.freeze({
27860
27840
  getFeatureLayerGeoJSONProperties: getFeatureLayerGeoJSONProperties,
27861
27841
  getDimensionLayerIds: getDimensionLayerIds,
27862
27842
  getAcceptanceTimeInMinutes: getAcceptanceTimeInMinutes,
27863
- getLayerIsInsideAcceptanceTime: getLayerIsInsideAcceptanceTime
27843
+ getLayerIsInsideAcceptanceTime: getLayerIsInsideAcceptanceTime,
27844
+ getUseLatestReferenceTime: getUseLatestReferenceTime
27864
27845
  });
27865
27846
 
27866
27847
  /* *
@@ -27891,7 +27872,7 @@ var AnimationLength;
27891
27872
  AnimationLength[AnimationLength["Hours24"] = 1440] = "Hours24";
27892
27873
  })(AnimationLength || (AnimationLength = {}));
27893
27874
 
27894
- var types$6 = /*#__PURE__*/Object.freeze({
27875
+ var types$4 = /*#__PURE__*/Object.freeze({
27895
27876
  __proto__: null,
27896
27877
  get AnimationLength () { return AnimationLength; }
27897
27878
  });
@@ -28019,13 +28000,13 @@ var createUIDialogElement = function createUIDialogElement(_ref) {
28019
28000
  focused: false
28020
28001
  };
28021
28002
  };
28022
- var initialState$8 = {
28003
+ var initialState$6 = {
28023
28004
  order: [],
28024
28005
  dialogs: {},
28025
28006
  activeWindowId: undefined
28026
28007
  };
28027
- var slice$8 = createSlice({
28028
- initialState: initialState$8,
28008
+ var slice$6 = createSlice({
28009
+ initialState: initialState$6,
28029
28010
  name: 'uiReducer',
28030
28011
  reducers: {
28031
28012
  registerDialog: function registerDialog(draft, action) {
@@ -28117,18 +28098,9 @@ var slice$8 = createSlice({
28117
28098
  }
28118
28099
  }
28119
28100
  });
28120
- var reducer$8 = slice$8.reducer;
28121
- var uiActions = slice$8.actions;
28122
-
28123
- var addBaseLayer = layerActions.addBaseLayer,
28124
- addLayer$1 = layerActions.addLayer,
28125
- duplicateMapLayer$1 = layerActions.duplicateMapLayer,
28126
- baseLayerDelete = layerActions.baseLayerDelete,
28127
- layerChangeDimension$1 = layerActions.layerChangeDimension,
28128
- layerDelete$1 = layerActions.layerDelete,
28129
- setBaseLayers$1 = layerActions.setBaseLayers,
28130
- setLayers = layerActions.setLayers,
28131
- onUpdateLayerInformation = layerActions.onUpdateLayerInformation;
28101
+ var reducer$6 = slice$6.reducer;
28102
+ var uiActions = slice$6.actions;
28103
+
28132
28104
  /**
28133
28105
  * Checks if the layer id is already taken in one of the maps.
28134
28106
  * @param state The WebMapState
@@ -28166,12 +28138,12 @@ var createLayersWithIds = function createLayersWithIds(state, layers) {
28166
28138
  }
28167
28139
  });
28168
28140
  };
28169
- var initialState$7 = {
28141
+ var initialState$5 = {
28170
28142
  byId: {},
28171
28143
  allIds: []
28172
28144
  };
28173
- var slice$7 = createSlice({
28174
- initialState: initialState$7,
28145
+ var slice$5 = createSlice({
28146
+ initialState: initialState$5,
28175
28147
  name: 'mapReducer',
28176
28148
  reducers: {
28177
28149
  registerMap: function registerMap(draft, action) {
@@ -28472,7 +28444,7 @@ var slice$7 = createSlice({
28472
28444
  }
28473
28445
  },
28474
28446
  extraReducers: function extraReducers(builder) {
28475
- builder.addCase(addLayer$1, function (draft, action) {
28447
+ builder.addCase(layerActions.addLayer, function (draft, action) {
28476
28448
  var _action$payload27 = action.payload,
28477
28449
  layerId = _action$payload27.layerId,
28478
28450
  mapId = _action$payload27.mapId,
@@ -28494,7 +28466,7 @@ var slice$7 = createSlice({
28494
28466
  } else {
28495
28467
  draft.byId[mapId].mapLayers.unshift(layerId);
28496
28468
  }
28497
- }).addCase(duplicateMapLayer$1, function (draft, action) {
28469
+ }).addCase(layerActions.duplicateMapLayer, function (draft, action) {
28498
28470
  var _action$payload28 = action.payload,
28499
28471
  newLayerId = _action$payload28.newLayerId,
28500
28472
  mapId = _action$payload28.mapId;
@@ -28506,7 +28478,7 @@ var slice$7 = createSlice({
28506
28478
  return;
28507
28479
  }
28508
28480
  draft.byId[mapId].mapLayers.unshift(newLayerId);
28509
- }).addCase(addBaseLayer, function (draft, action) {
28481
+ }).addCase(layerActions.addBaseLayer, function (draft, action) {
28510
28482
  var _action$payload29 = action.payload,
28511
28483
  layer = _action$payload29.layer,
28512
28484
  layerId = _action$payload29.layerId,
@@ -28525,7 +28497,7 @@ var slice$7 = createSlice({
28525
28497
  if (layer.layerType === LayerType.overLayer) {
28526
28498
  draft.byId[mapId].overLayers.unshift(layerId);
28527
28499
  }
28528
- }).addCase(setLayers, function (draft, action) {
28500
+ }).addCase(layerActions.setLayers, function (draft, action) {
28529
28501
  var mapId = action.payload.mapId;
28530
28502
  var layersWithIds = createLayersWithIds(draft, action.payload.layers);
28531
28503
  var layerIds = layersWithIds.map(function (_ref) {
@@ -28565,7 +28537,7 @@ var slice$7 = createSlice({
28565
28537
  }
28566
28538
  }
28567
28539
  }
28568
- }).addCase(setBaseLayers$1, function (draft, action) {
28540
+ }).addCase(layerActions.setBaseLayers, function (draft, action) {
28569
28541
  var _action$payload30 = action.payload,
28570
28542
  layers = _action$payload30.layers,
28571
28543
  mapId = _action$payload30.mapId;
@@ -28597,7 +28569,7 @@ var slice$7 = createSlice({
28597
28569
  draft.byId[mapId].overLayers = overLayerIds;
28598
28570
  }
28599
28571
  }
28600
- }).addCase(layerDelete$1, function (draft, action) {
28572
+ }).addCase(layerActions.layerDelete, function (draft, action) {
28601
28573
  var _action$payload31 = action.payload,
28602
28574
  mapId = _action$payload31.mapId,
28603
28575
  layerId = _action$payload31.layerId;
@@ -28625,7 +28597,7 @@ var slice$7 = createSlice({
28625
28597
  map.featureLayers = map.featureLayers.filter(function (id) {
28626
28598
  return id !== layerId;
28627
28599
  });
28628
- }).addCase(baseLayerDelete, function (draft, action) {
28600
+ }).addCase(layerActions.baseLayerDelete, function (draft, action) {
28629
28601
  var _action$payload32 = action.payload,
28630
28602
  mapId = _action$payload32.mapId,
28631
28603
  layerId = _action$payload32.layerId;
@@ -28638,7 +28610,7 @@ var slice$7 = createSlice({
28638
28610
  draft.byId[mapId].overLayers = draft.byId[mapId].overLayers.filter(function (id) {
28639
28611
  return id !== layerId;
28640
28612
  });
28641
- }).addCase(layerChangeDimension$1, function (draft, action) {
28613
+ }).addCase(layerActions.layerChangeDimension, function (draft, action) {
28642
28614
  var _action$payload33 = action.payload,
28643
28615
  layerId = _action$payload33.layerId,
28644
28616
  dimension = _action$payload33.dimension;
@@ -28707,9 +28679,9 @@ var slice$7 = createSlice({
28707
28679
  type: source.type
28708
28680
  };
28709
28681
  /* Handle the Layer action with the same logic, using the same reducer */
28710
- return reducer$7(prevState, action);
28682
+ return reducer$5(prevState, action);
28711
28683
  }, draft);
28712
- }).addCase(onUpdateLayerInformation, function (draft, action) {
28684
+ }).addCase(layerActions.onUpdateLayerInformation, function (draft, action) {
28713
28685
  var mapDimensions = action.payload.mapDimensions;
28714
28686
  if (!mapDimensions) {
28715
28687
  return draft;
@@ -28753,11 +28725,11 @@ var slice$7 = createSlice({
28753
28725
  });
28754
28726
  }
28755
28727
  });
28756
- var mapActions = Object.assign(Object.assign({}, slice$7.actions), {
28728
+ var mapActions = Object.assign(Object.assign({}, slice$5.actions), {
28757
28729
  setMapPreset: setMapPreset,
28758
28730
  mapChangeDimension: mapChangeDimension
28759
28731
  });
28760
- var reducer$7 = slice$7.reducer;
28732
+ var reducer$5 = slice$5.reducer;
28761
28733
 
28762
28734
  /* *
28763
28735
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -28884,7 +28856,7 @@ var getDialogError = createSelector(getDialogDetailsByType, function (details) {
28884
28856
  return details && details.error || '';
28885
28857
  });
28886
28858
 
28887
- var selectors$7 = /*#__PURE__*/Object.freeze({
28859
+ var selectors$5 = /*#__PURE__*/Object.freeze({
28888
28860
  __proto__: null,
28889
28861
  getUiStore: getUiStore,
28890
28862
  getDialogDetailsByType: getDialogDetailsByType,
@@ -28920,6 +28892,7 @@ var DialogTypes;
28920
28892
  DialogTypes["SyncGroups"] = "syncGroups";
28921
28893
  DialogTypes["TimeSeriesSelect"] = "timeSeriesSelect";
28922
28894
  DialogTypes["TimeSeriesManager"] = "timeSeriesManager";
28895
+ DialogTypes["TimeseriesInfo"] = "timeseriesInfo";
28923
28896
  DialogTypes["KeywordFilter"] = "keywordFilter";
28924
28897
  DialogTypes["DimensionSelectEnsembleMember"] = "dimensionSelect-ensemble_member";
28925
28898
  DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
@@ -28932,7 +28905,7 @@ var DialogTypes;
28932
28905
  DialogTypes["Search"] = "search";
28933
28906
  })(DialogTypes || (DialogTypes = {}));
28934
28907
 
28935
- var types$5 = /*#__PURE__*/Object.freeze({
28908
+ var types$3 = /*#__PURE__*/Object.freeze({
28936
28909
  __proto__: null,
28937
28910
  get DialogTypes () { return DialogTypes; }
28938
28911
  });
@@ -29022,7 +28995,7 @@ var removeInPlace = function removeInPlace(inDraftArray, condition) {
29022
28995
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
29023
28996
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
29024
28997
  * */
29025
- var initialState$6 = {
28998
+ var initialState$4 = {
29026
28999
  sources: {
29027
29000
  byId: {},
29028
29001
  allIds: []
@@ -29046,8 +29019,8 @@ var initialState$6 = {
29046
29019
  }
29047
29020
  }
29048
29021
  };
29049
- var slice$6 = createSlice({
29050
- initialState: initialState$6,
29022
+ var slice$4 = createSlice({
29023
+ initialState: initialState$4,
29051
29024
  name: 'synchronizationGroupsReducer',
29052
29025
  reducers: {
29053
29026
  syncGroupAddSource: function syncGroupAddSource(draft, action) {
@@ -29176,7 +29149,7 @@ var slice$6 = createSlice({
29176
29149
  });
29177
29150
  },
29178
29151
  syncGroupClear: function syncGroupClear() {
29179
- return initialState$6;
29152
+ return initialState$4;
29180
29153
  },
29181
29154
  syncGroupSetViewState: function syncGroupSetViewState(draft, action) {
29182
29155
  var viewState = action.payload.viewState;
@@ -29235,7 +29208,7 @@ var setBboxOrTimeSync = function setBboxOrTimeSync(state, action) {
29235
29208
  });
29236
29209
  });
29237
29210
  };
29238
- var _slice$actions = slice$6.actions,
29211
+ var _slice$actions = slice$4.actions,
29239
29212
  syncGroupAddGroup = _slice$actions.syncGroupAddGroup,
29240
29213
  syncGroupAddSource = _slice$actions.syncGroupAddSource,
29241
29214
  syncGroupAddTarget = _slice$actions.syncGroupAddTarget;
@@ -29245,8 +29218,8 @@ var _slice$actions = slice$6.actions,
29245
29218
  syncGroupRemoveSource = _slice$actions.syncGroupRemoveSource,
29246
29219
  syncGroupRemoveTarget = _slice$actions.syncGroupRemoveTarget,
29247
29220
  syncGroupSetViewState = _slice$actions.syncGroupSetViewState;
29248
- var actions = slice$6.actions,
29249
- reducer$6 = slice$6.reducer;
29221
+ var actions = slice$4.actions,
29222
+ reducer$4 = slice$4.reducer;
29250
29223
 
29251
29224
  /* *
29252
29225
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -29274,7 +29247,7 @@ var SyncGroupActionOrigin;
29274
29247
  SyncGroupActionOrigin["activateLayerId"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_ACTIVELAYERIDACTION";
29275
29248
  })(SyncGroupActionOrigin || (SyncGroupActionOrigin = {}));
29276
29249
 
29277
- var types$4 = /*#__PURE__*/Object.freeze({
29250
+ var types$2 = /*#__PURE__*/Object.freeze({
29278
29251
  __proto__: null,
29279
29252
  SyncGroupTypeList: SyncGroupTypeList,
29280
29253
  get SyncGroupActionOrigin () { return SyncGroupActionOrigin; }
@@ -29416,7 +29389,7 @@ var getSyncGroupTargets = createSelector(syncGroupStore, function (store) {
29416
29389
  }, []);
29417
29390
  });
29418
29391
 
29419
- var selectors$6 = /*#__PURE__*/Object.freeze({
29392
+ var selectors$4 = /*#__PURE__*/Object.freeze({
29420
29393
  __proto__: null,
29421
29394
  syncGroupStore: syncGroupStore,
29422
29395
  getSynchronizationGroupState: getSynchronizationGroupState,
@@ -29568,7 +29541,7 @@ var getTime = createSelector(getSyncSourceBySourceId, function (store) {
29568
29541
  return store && store.payloadByType && store.payloadByType[SYNCGROUPS_TYPE_SETTIME] ? store.payloadByType[SYNCGROUPS_TYPE_SETTIME].value : null;
29569
29542
  });
29570
29543
 
29571
- var selectors$5 = /*#__PURE__*/Object.freeze({
29544
+ var selectors$3 = /*#__PURE__*/Object.freeze({
29572
29545
  __proto__: null,
29573
29546
  getSynchronizationGroupStore: getSynchronizationGroupStore,
29574
29547
  getTime: getTime
@@ -29591,7 +29564,7 @@ var selectors$5 = /*#__PURE__*/Object.freeze({
29591
29564
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
29592
29565
  * */
29593
29566
 
29594
- var types$3 = /*#__PURE__*/Object.freeze({
29567
+ var types$1 = /*#__PURE__*/Object.freeze({
29595
29568
  __proto__: null
29596
29569
  });
29597
29570
 
@@ -30343,7 +30316,7 @@ var getDockedLayerManagerSize = createSelector(getMapById, function (store) {
30343
30316
  return store ? store.dockedLayerManagerSize : 'sizeSmall';
30344
30317
  });
30345
30318
 
30346
- var selectors$4 = /*#__PURE__*/Object.freeze({
30319
+ var selectors$2 = /*#__PURE__*/Object.freeze({
30347
30320
  __proto__: null,
30348
30321
  getMapById: getMapById,
30349
30322
  getAllMapIds: getAllMapIds,
@@ -30513,12 +30486,12 @@ var mapUtils = Object.assign(Object.assign({}, utils$3), {
30513
30486
  * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
30514
30487
  * Copyright 2020 - Finnish Meteorological Institute (FMI)
30515
30488
  * */
30516
- var initialState$5 = {
30489
+ var initialState$3 = {
30517
30490
  byId: {},
30518
30491
  allIds: []
30519
30492
  };
30520
- var slice$5 = createSlice({
30521
- initialState: initialState$5,
30493
+ var slice$3 = createSlice({
30494
+ initialState: initialState$3,
30522
30495
  name: 'serviceReducer',
30523
30496
  reducers: {
30524
30497
  serviceSetLayers: function serviceSetLayers(draft, action) {
@@ -30547,8 +30520,8 @@ var slice$5 = createSlice({
30547
30520
  action) {}
30548
30521
  }
30549
30522
  });
30550
- var reducer$5 = slice$5.reducer;
30551
- var serviceActions = slice$5.actions;
30523
+ var reducer$3 = slice$3.reducer;
30524
+ var serviceActions = slice$3.actions;
30552
30525
 
30553
30526
  /* *
30554
30527
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -30650,7 +30623,7 @@ var getLayerStyles = createSelector(getLayerFromService, function (layer) {
30650
30623
  return (_a = layer === null || layer === void 0 ? void 0 : layer.styles) !== null && _a !== void 0 ? _a : [];
30651
30624
  }, selectorMemoizationOptions);
30652
30625
 
30653
- var selectors$3 = /*#__PURE__*/Object.freeze({
30626
+ var selectors$1 = /*#__PURE__*/Object.freeze({
30654
30627
  __proto__: null,
30655
30628
  getServiceIds: getServiceIds,
30656
30629
  getServices: getServices,
@@ -30677,7 +30650,7 @@ var selectors$3 = /*#__PURE__*/Object.freeze({
30677
30650
  * Copyright 2023 - Finnish Meteorological Institute (FMI)
30678
30651
  * */
30679
30652
 
30680
- var types$2 = /*#__PURE__*/Object.freeze({
30653
+ var types = /*#__PURE__*/Object.freeze({
30681
30654
  __proto__: null
30682
30655
  });
30683
30656
 
@@ -30816,6 +30789,33 @@ var WmMultiDimensionLayer2 = new WMLayer({
30816
30789
  currentValue: '2017-01-01T00:25:00Z'
30817
30790
  }]
30818
30791
  });
30792
+ var WmMultiDimensionServices = {
30793
+ serviceid_1: {
30794
+ name: 'testservicedimensions',
30795
+ serviceUrl: 'https://testservicedimensions',
30796
+ layers: [{
30797
+ name: 'netcdf_5dims',
30798
+ title: 'netcdf_5dims',
30799
+ leaf: true,
30800
+ path: []
30801
+ }]
30802
+ },
30803
+ serviceid_2: {
30804
+ name: 'testservice',
30805
+ serviceUrl: 'https://testservice',
30806
+ layers: [{
30807
+ name: 'RADNL_OPER_R___25PCPRR_L3_KNMI',
30808
+ title: 'RADNL_OPER_R___25PCPRR_L3_KNMI',
30809
+ leaf: true,
30810
+ path: []
30811
+ }, {
30812
+ name: 'LAYER_WITHOUT_TIME',
30813
+ title: 'LAYER_WITHOUT_TIME',
30814
+ leaf: true,
30815
+ path: []
30816
+ }]
30817
+ }
30818
+ };
30819
30819
 
30820
30820
  var storeTestSettings = /*#__PURE__*/Object.freeze({
30821
30821
  __proto__: null,
@@ -30824,7 +30824,8 @@ var storeTestSettings = /*#__PURE__*/Object.freeze({
30824
30824
  layerWithoutTimeDimension: layerWithoutTimeDimension,
30825
30825
  styleListForRADNLOPERR25PCPRRL3KNMILayer: styleListForRADNLOPERR25PCPRRL3KNMILayer,
30826
30826
  defaultReduxServices: defaultReduxServices,
30827
- WmMultiDimensionLayer2: WmMultiDimensionLayer2
30827
+ WmMultiDimensionLayer2: WmMultiDimensionLayer2,
30828
+ WmMultiDimensionServices: WmMultiDimensionServices
30828
30829
  });
30829
30830
 
30830
30831
  function n$4(n,e,r){if(r||2===arguments.length)for(var t,u=0,o=e.length;o>u;u++)!t&&u in e||(t||(t=[].slice.call(e,0,u)),t[u]=e[u]);return n.concat(t||[].slice.call(e))}var e$4=function(n,e){return n===e},r$3=function(){return !1},t$6=function(t,u){void 0===t&&(t=e$4),void 0===u&&(u=r$3);var o=[],c=function(n){var e=o.findIndex((function(e){return t(e.value,n)}));return [o[e],e]};return {getCount:function(n){var e=c(n)[0];return (null==e?void 0:e.count)||0},getItems:function(){return n$4([],o,!0)},add:function(n){var e=c(n)[0];e&&!u(e.value)?e.count+=1:e||o.push({value:n,count:u(n)?1/0:1});},remove:function(n){var e=c(n),r=e[0],t=e[1];r&&!u(r.value)&&(r.count>1?r.count-=1:o.splice(t,1));}}},u$3=Array.isArray,o=function(n){var e=[],r=function(n){n.forEach((function(n){u$3(n)?r(n):e.push(n);}));};return u$3(n)&&r(n),e},c$2=["enhancers","middlewares","beforeAdd","afterAdd","beforeRemove","afterRemove"],a=function(e,r,u,i){void 0===i&&(i=[]);var a,f=i.reduce((function(n,e){return c$2.forEach((function(r){var t,u=e[r];(null==u?void 0:u.length)&&(t=n[r]).push.apply(t,u);})),n}),c$2.reduce((function(n,e){return n[e]=[],n}),{})),d={getItems:(a=t$6((function(n,e){return n.id===e.id}),(function(n){return !!n.keep}))).getItems,getCount:a.getCount,add:function(n){n.forEach((function(n){return a.add(n)}));},remove:function(n){n.forEach((function(n){return a.remove(n)}));}},v=function(n){var e,r=t$6(),u=[];return {mid:function(r){return e=r,function(e){return function(r){return n.apply(void 0,u.map((function(n){return n.act})))(e)(r)}}},add:function(n){n.forEach((function(n){r.getCount(n)||u.push({mid:n,act:n(e)}),r.add(n);}));},remove:function(n){n.forEach((function(n){1===r.getCount(n)&&(u=u.filter((function(e){return n!==e.mid}))),r.remove(n);}));}}}(u),l=function(e){var r,u=t$6(),o={},c=[];return {reducer:function(n,e){void 0===n&&(n={});var t=n;return c.length&&(t=Object.assign({},n),c.forEach((function(n){return delete t[n]})),c=[]),(Object.keys(o).length?r:function(){return {}})(t,e)},add:function(n){var t=[];return n.forEach((function(n){var e=n[0],r=n[1];u.getCount(e)||(o[e]=r,t.push(e)),u.add(e);})),t.length&&(r=e(o)),t},remove:function(t){return t.forEach((function(n){var e=n[0];1===u.getCount(e)&&(delete o[e],c.push(e)),u.remove(e);})),c.length&&(r=e(o)),n$4([],c,!0)}}}(r),g=e(l.reducer,v.mid,f.enhancers,f.middlewares),s=function(n,e,r,t){var u=n.filter((function(n){return n.id}));if(u.length){var o=[],c=[],i=[],a="add"===e;u.forEach((function(n){var e,r=d.getCount(n);(a&&!r||!a&&1===r)&&(o.push(n),(null===(e=n.middlewares)||void 0===e?void 0:e.length)&&c.push.apply(c,n.middlewares),n.reducersMap&&i.push.apply(i,Object.entries(n.reducersMap)));}));var s=o.length;s&&(f[r].forEach((function(n){return n(o,g)})),o.forEach((function(n){var e;return null===(e=n[r])||void 0===e?void 0:e.call(n,g)})),l[e](i).length&&g.dispatch({type:"@@eggs/reduce"}),v[e](c)),d[e](u),s&&(f[t].forEach((function(n){return n(o,g)})),o.forEach((function(n){var e;return null===(e=n[t])||void 0===e?void 0:e.call(n,g)})));}},h=function(n){return s(n,"remove","beforeRemove","afterRemove")};return Object.assign(g,{getEggs:d.getItems,getEggCount:d.getCount,addEggs:function(e){var r=o(e);return s(r,"add","beforeAdd","afterAdd"),function(){return h(n$4([],r,!0).reverse())}},removeEggs:function(n){h(o(n));}})};
@@ -33050,9 +33051,9 @@ function takeLatest$1(patternOrChannel, worker) {
33050
33051
  return fork.apply(void 0, [takeLatest, patternOrChannel, worker].concat(args));
33051
33052
  }
33052
33053
 
33053
- var _marked$8 = /*#__PURE__*/_regeneratorRuntime().mark(updateAnimation),
33054
- _marked2$6 = /*#__PURE__*/_regeneratorRuntime().mark(handleBaseLayersSaga),
33055
- _marked3$2 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$7);
33054
+ var _marked$6 = /*#__PURE__*/_regeneratorRuntime().mark(updateAnimation),
33055
+ _marked2$4 = /*#__PURE__*/_regeneratorRuntime().mark(handleBaseLayersSaga),
33056
+ _marked3$2 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$5);
33056
33057
  // Expects start, end time as moment object and interval in minutes
33057
33058
  var generateTimeList = function generateTimeList(start, end, interval) {
33058
33059
  var timeList = [];
@@ -33221,7 +33222,7 @@ function updateAnimation(mapId, maxValue) {
33221
33222
  case "end":
33222
33223
  return _context4.stop();
33223
33224
  }
33224
- }, _marked$8);
33225
+ }, _marked$6);
33225
33226
  }
33226
33227
  function setLayerDimensionsSaga(_ref4) {
33227
33228
  var payload = _ref4.payload;
@@ -33472,7 +33473,7 @@ function handleBaseLayersSaga(mapId, baseLayers) {
33472
33473
  case "end":
33473
33474
  return _context7.stop();
33474
33475
  }
33475
- }, _marked2$6);
33476
+ }, _marked2$4);
33476
33477
  }
33477
33478
  function setMapPresetSaga(_ref6) {
33478
33479
  var payload = _ref6.payload;
@@ -33823,7 +33824,7 @@ function unregisterMapSaga(_ref7) {
33823
33824
  }, _callee7);
33824
33825
  })();
33825
33826
  }
33826
- function rootSaga$7() {
33827
+ function rootSaga$5() {
33827
33828
  return _regeneratorRuntime().wrap(function rootSaga$(_context10) {
33828
33829
  while (1) switch (_context10.prev = _context10.next) {
33829
33830
  case 0:
@@ -33854,8 +33855,8 @@ function rootSaga$7() {
33854
33855
  }, _marked3$2);
33855
33856
  }
33856
33857
 
33857
- var _marked$7 = /*#__PURE__*/_regeneratorRuntime().mark(fetchServiceSaga),
33858
- _marked2$5 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$6);
33858
+ var _marked$5 = /*#__PURE__*/_regeneratorRuntime().mark(fetchServiceSaga),
33859
+ _marked2$3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
33859
33860
  function fetchServiceSaga(service) {
33860
33861
  var layers;
33861
33862
  return _regeneratorRuntime().wrap(function fetchServiceSaga$(_context) {
@@ -33880,7 +33881,7 @@ function fetchServiceSaga(service) {
33880
33881
  case "end":
33881
33882
  return _context.stop();
33882
33883
  }
33883
- }, _marked$7, null, [[0, 8]]);
33884
+ }, _marked$5, null, [[0, 8]]);
33884
33885
  }
33885
33886
  function fetchInitialServicesSaga(_ref) {
33886
33887
  var payload = _ref.payload;
@@ -33901,7 +33902,7 @@ function fetchInitialServicesSaga(_ref) {
33901
33902
  }, _callee);
33902
33903
  })();
33903
33904
  }
33904
- function rootSaga$6() {
33905
+ function rootSaga$4() {
33905
33906
  return _regeneratorRuntime().wrap(function rootSaga$(_context3) {
33906
33907
  while (1) switch (_context3.prev = _context3.next) {
33907
33908
  case 0:
@@ -33911,7 +33912,7 @@ function rootSaga$6() {
33911
33912
  case "end":
33912
33913
  return _context3.stop();
33913
33914
  }
33914
- }, _marked2$5);
33915
+ }, _marked2$3);
33915
33916
  }
33916
33917
 
33917
33918
  // TODO: This fixes typecheck errors but maybe there is a better way to do that
@@ -33919,14 +33920,14 @@ i({
33919
33920
  extensions: [e$3()]
33920
33921
  });
33921
33922
  var mapStoreReducers = {
33922
- webmap: reducer$7,
33923
- services: reducer$5,
33924
- layers: reducer$9
33923
+ webmap: reducer$5,
33924
+ services: reducer$3,
33925
+ layers: reducer$7
33925
33926
  };
33926
33927
  var mapStoreModuleConfig = {
33927
33928
  id: 'webmap-module',
33928
33929
  reducersMap: mapStoreReducers,
33929
- sagas: [rootSaga$7, rootSaga$6]
33930
+ sagas: [rootSaga$5, rootSaga$4]
33930
33931
  };
33931
33932
 
33932
33933
  /* *
@@ -33947,618 +33948,6 @@ var mapStoreModuleConfig = {
33947
33948
  * */
33948
33949
  var mapStoreActions = Object.assign(Object.assign(Object.assign({}, layerActions), mapActions), serviceActions);
33949
33950
 
33950
- /* *
33951
- * Licensed under the Apache License, Version 2.0 (the "License");
33952
- * you may not use this file except in compliance with the License.
33953
- * You may obtain a copy of the License at
33954
- *
33955
- * http://www.apache.org/licenses/LICENSE-2.0
33956
- *
33957
- * Unless required by applicable law or agreed to in writing, software
33958
- * distributed under the License is distributed on an "AS IS" BASIS,
33959
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33960
- * See the License for the specific language governing permissions and
33961
- * limitations under the License.
33962
- *
33963
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
33964
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
33965
- * */
33966
- var FilterType;
33967
- (function (FilterType) {
33968
- FilterType["Keyword"] = "keywords";
33969
- FilterType["Group"] = "groups";
33970
- })(FilterType || (FilterType = {}));
33971
-
33972
- var types$1 = /*#__PURE__*/Object.freeze({
33973
- __proto__: null,
33974
- get FilterType () { return FilterType; }
33975
- });
33976
-
33977
- /* *
33978
- * Licensed under the Apache License, Version 2.0 (the "License");
33979
- * you may not use this file except in compliance with the License.
33980
- * You may obtain a copy of the License at
33981
- *
33982
- * http://www.apache.org/licenses/LICENSE-2.0
33983
- *
33984
- * Unless required by applicable law or agreed to in writing, software
33985
- * distributed under the License is distributed on an "AS IS" BASIS,
33986
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33987
- * See the License for the specific language governing permissions and
33988
- * limitations under the License.
33989
- *
33990
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
33991
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
33992
- * */
33993
- var getFilterId = function getFilterId(filterType, filterName) {
33994
- return "".concat(filterType, "-").concat(filterName);
33995
- };
33996
- var produceFilters = function produceFilters(filterNames, filterType, draft, layerSelectFilterAdapter) {
33997
- filterNames.forEach(function (filterName) {
33998
- var id = getFilterId(filterType, filterName);
33999
- if (!draft.filters.filters.entities[id]) {
34000
- // If this filter doesn't exit yet, add it
34001
- layerSelectFilterAdapter.addOne(draft.filters.filters, {
34002
- id: id,
34003
- name: filterName,
34004
- amount: 1,
34005
- amountVisible: 1,
34006
- checked: true,
34007
- type: filterType
34008
- });
34009
- } else {
34010
- // If it exists already, up the amounts
34011
- draft.filters.filters.entities[id].amount += 1;
34012
- draft.filters.filters.entities[id].amountVisible += 1;
34013
- }
34014
- });
34015
- };
34016
- var filterLayersFromService = function filterLayersFromService(serviceId, services, filterIds, allFiltersActive, searchString) {
34017
- var mapStoreService = services[serviceId];
34018
- if (!mapStoreService) {
34019
- return [];
34020
- }
34021
- if (searchString === '' && allFiltersActive) {
34022
- return mapStoreService.layers.filter(function (layer) {
34023
- return layer.leaf;
34024
- });
34025
- }
34026
- var searchStringArray = searchString.split(' ');
34027
- return mapStoreService.layers.filter(function (layer) {
34028
- return searchStringArray.every(function (search) {
34029
- var _a, _b, _c;
34030
- var searchLowercase = search.toLowerCase();
34031
- var layerFilterIds = layer.path.map(function (group) {
34032
- return "".concat(FilterType.Group, "-").concat(group);
34033
- }).concat(layer.keywords.map(function (keyword) {
34034
- return "".concat(FilterType.Keyword, "-").concat(keyword);
34035
- }));
34036
- var isFilterInLayer = (layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (id) {
34037
- return filterIds.includes(id);
34038
- })) || allFiltersActive;
34039
- var isSearchTextInLayerFilter = layerFilterIds === null || layerFilterIds === void 0 ? void 0 : layerFilterIds.some(function (filterId) {
34040
- return filterId.toLowerCase().includes(searchLowercase);
34041
- });
34042
- var isSearchTextInLayerName = (_a = layer.name) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(searchLowercase);
34043
- var isSearchTextInLayerText = (_b = layer.title) === null || _b === void 0 ? void 0 : _b.toLowerCase().includes(searchLowercase);
34044
- var isSearchTextInLayerAbstract = (_c = layer["abstract"]) === null || _c === void 0 ? void 0 : _c.toLowerCase().includes(searchLowercase);
34045
- var isSearchTextInServiceName = mapStoreService.name.toLowerCase().includes(searchLowercase);
34046
- var isSearchTextInLayer = isSearchTextInLayerName || isSearchTextInLayerText || isSearchTextInLayerAbstract || isSearchTextInLayerFilter || isSearchTextInServiceName;
34047
- return isFilterInLayer && isSearchTextInLayer;
34048
- });
34049
- }).filter(function (layer) {
34050
- return layer.leaf;
34051
- });
34052
- };
34053
-
34054
- var layerSelectFilterAdapter = createEntityAdapter();
34055
- var layerSelectActiveServicesAdapter = createEntityAdapter({
34056
- selectId: function selectId(service) {
34057
- return service.serviceId;
34058
- }
34059
- });
34060
- var initialServicePopupState = {
34061
- isOpen: false,
34062
- url: '',
34063
- serviceId: '',
34064
- variant: 'add'
34065
- };
34066
- var initialState$4 = {
34067
- filters: {
34068
- searchFilter: '',
34069
- activeServices: layerSelectActiveServicesAdapter.getInitialState(),
34070
- filters: layerSelectFilterAdapter.getInitialState()
34071
- },
34072
- allServicesEnabled: true,
34073
- activeLayerInfo: {
34074
- name: '',
34075
- title: '',
34076
- leaf: true,
34077
- path: [],
34078
- serviceName: ''
34079
- },
34080
- servicePopup: initialServicePopupState
34081
- };
34082
- var slice$4 = createSlice({
34083
- initialState: initialState$4,
34084
- name: DialogTypes.LayerSelect,
34085
- reducers: {
34086
- setSearchFilter: function setSearchFilter(draft, action) {
34087
- var filterText = action.payload.filterText;
34088
- draft.filters.searchFilter = filterText;
34089
- },
34090
- closeServicePopupOpen: function closeServicePopupOpen(draft) {
34091
- draft.servicePopup.isOpen = false;
34092
- },
34093
- toggleServicePopup: function toggleServicePopup(draft, action) {
34094
- var _action$payload = action.payload,
34095
- variant = _action$payload.variant,
34096
- isOpen = _action$payload.isOpen;
34097
- draft.servicePopup.isOpen = isOpen;
34098
- draft.servicePopup.url = action.payload.url ? action.payload.url : '';
34099
- draft.servicePopup.variant = variant;
34100
- draft.servicePopup.serviceId = action.payload.serviceId ? action.payload.serviceId : '';
34101
- },
34102
- layerSelectRemoveService: function layerSelectRemoveService(draft, action) {
34103
- var serviceId = action.payload.serviceId;
34104
- // 1. Find a service that is to be removed
34105
- var foundService = draft.filters.activeServices.entities[serviceId];
34106
- // 2. Go through all keywords for removed service, and decrement the amount of all found keywords
34107
- foundService.filterIds.forEach(function (filterId) {
34108
- var foundObject = draft.filters.filters.entities[filterId];
34109
- if (foundObject && foundObject.amount) {
34110
- foundObject.amount -= 1;
34111
- foundObject.amountVisible -= 1;
34112
- }
34113
- if (foundObject && foundObject.amount === 0) {
34114
- delete draft.filters.filters.entities[filterId];
34115
- draft.filters.filters.ids = draft.filters.filters.ids.filter(function (serviceId) {
34116
- return serviceId !== filterId;
34117
- });
34118
- }
34119
- });
34120
- // Finally remove object from activeServices, so if the service is added again later on, new object and keywords will be re-added
34121
- layerSelectActiveServicesAdapter.removeOne(draft.filters.activeServices, serviceId);
34122
- },
34123
- enableActiveService: function enableActiveService(draft, action) {
34124
- var activeServicesById = draft.filters.activeServices.entities;
34125
- var activeServices = lodash.exports.compact(Object.values(activeServicesById));
34126
- var countPressedServices = activeServices.filter(function (service) {
34127
- return service.enabled;
34128
- }).length;
34129
- var isAllServicesGoingToBeEnabled = countPressedServices === activeServices.length - 1;
34130
- if (isAllServicesGoingToBeEnabled) {
34131
- slice$4.caseReducers.enableAllActiveServices(draft);
34132
- return;
34133
- }
34134
- var service = activeServicesById[action.payload.serviceId];
34135
- service.enabled = true;
34136
- var _iterator = _createForOfIteratorHelper(service.filterIds),
34137
- _step;
34138
- try {
34139
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
34140
- var keyword = _step.value;
34141
- draft.filters.filters.entities[keyword].amountVisible += 1;
34142
- }
34143
- } catch (err) {
34144
- _iterator.e(err);
34145
- } finally {
34146
- _iterator.f();
34147
- }
34148
- },
34149
- enableAllActiveServices: function enableAllActiveServices(draft) {
34150
- var activeServices = draft.filters.activeServices.entities;
34151
- var servicesToTurnOn = lodash.exports.compact(Object.values(activeServices)).filter(function (service) {
34152
- return !service.enabled;
34153
- });
34154
- var updates = servicesToTurnOn.map(function (service) {
34155
- return {
34156
- id: service.serviceId,
34157
- changes: {
34158
- enabled: true
34159
- }
34160
- };
34161
- });
34162
- layerSelectActiveServicesAdapter.updateMany(draft.filters.activeServices, updates);
34163
- var keywords = servicesToTurnOn.flatMap(function (service) {
34164
- var _a;
34165
- return (_a = service.filterIds) !== null && _a !== void 0 ? _a : [];
34166
- });
34167
- var _iterator2 = _createForOfIteratorHelper(keywords),
34168
- _step2;
34169
- try {
34170
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
34171
- var keyword = _step2.value;
34172
- draft.filters.filters.entities[keyword].amountVisible += 1;
34173
- }
34174
- } catch (err) {
34175
- _iterator2.e(err);
34176
- } finally {
34177
- _iterator2.f();
34178
- }
34179
- draft.allServicesEnabled = true;
34180
- },
34181
- onlyThisServiceEnabled: function onlyThisServiceEnabled(draft, action) {
34182
- var activeServicesById = draft.filters.activeServices.entities;
34183
- var servicesToTurnOff = lodash.exports.compact(Object.values(activeServicesById)).filter(function (service) {
34184
- return service.serviceId !== action.payload.serviceId;
34185
- });
34186
- var updates = servicesToTurnOff.map(function (service) {
34187
- return {
34188
- id: service.serviceId,
34189
- changes: {
34190
- enabled: false
34191
- }
34192
- };
34193
- });
34194
- layerSelectActiveServicesAdapter.updateMany(draft.filters.activeServices, updates);
34195
- var keywords = servicesToTurnOff.flatMap(function (service) {
34196
- var _a;
34197
- return (_a = service.filterIds) !== null && _a !== void 0 ? _a : [];
34198
- });
34199
- var _iterator3 = _createForOfIteratorHelper(keywords),
34200
- _step3;
34201
- try {
34202
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
34203
- var keyword = _step3.value;
34204
- draft.filters.filters.entities[keyword].amountVisible -= 1;
34205
- }
34206
- } catch (err) {
34207
- _iterator3.e(err);
34208
- } finally {
34209
- _iterator3.f();
34210
- }
34211
- draft.allServicesEnabled = false;
34212
- },
34213
- disableActiveService: function disableActiveService(draft, action) {
34214
- var activeServicesById = draft.filters.activeServices.entities;
34215
- var countPressedServices = Object.values(activeServicesById).filter(function (service) {
34216
- return service === null || service === void 0 ? void 0 : service.enabled;
34217
- }).length;
34218
- var isAllServicesGoingToBeDisabled = countPressedServices === 1;
34219
- if (isAllServicesGoingToBeDisabled) {
34220
- slice$4.caseReducers.enableAllActiveServices(draft);
34221
- return;
34222
- }
34223
- var service = activeServicesById[action.payload.serviceId];
34224
- service.enabled = false;
34225
- var _iterator4 = _createForOfIteratorHelper(service.filterIds),
34226
- _step4;
34227
- try {
34228
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
34229
- var keyword = _step4.value;
34230
- draft.filters.filters.entities[keyword].amountVisible -= 1;
34231
- }
34232
- } catch (err) {
34233
- _iterator4.e(err);
34234
- } finally {
34235
- _iterator4.f();
34236
- }
34237
- },
34238
- toggleFilter: function toggleFilter(draft, action) {
34239
- var filterIds = action.payload.filterIds;
34240
- filterIds.forEach(function (filterId) {
34241
- draft.filters.filters.entities[filterId].checked = !draft.filters.filters.entities[filterId].checked;
34242
- });
34243
- },
34244
- enableOnlyOneFilter: function enableOnlyOneFilter(draft, action) {
34245
- var filterId = action.payload.filterId;
34246
- draft.filters.filters.ids.forEach(function (filterId) {
34247
- draft.filters.filters.entities[filterId].checked = false;
34248
- });
34249
- draft.filters.filters.entities[filterId].checked = true;
34250
- },
34251
- setActiveLayerInfo: function setActiveLayerInfo(draft, action) {
34252
- var layer = action.payload.layer;
34253
- draft.activeLayerInfo = layer;
34254
- }
34255
- },
34256
- extraReducers: function extraReducers(builder) {
34257
- builder.addCase(serviceActions.serviceSetLayers, function (draft, action) {
34258
- var _a, _b;
34259
- var _action$payload2 = action.payload,
34260
- serviceId = _action$payload2.id,
34261
- serviceUrl = _action$payload2.serviceUrl,
34262
- serviceName = _action$payload2.name,
34263
- scope = _action$payload2.scope,
34264
- _abstract = _action$payload2["abstract"],
34265
- layers = _action$payload2.layers,
34266
- isUpdating = _action$payload2.isUpdating;
34267
- if (isUpdating) {
34268
- return;
34269
- }
34270
- var keywords = layers.reduce(function (keywords, layer) {
34271
- var _a;
34272
- if (layer.leaf) {
34273
- return keywords.concat((_a = layer.keywords) !== null && _a !== void 0 ? _a : []);
34274
- }
34275
- return keywords;
34276
- }, []);
34277
- var groups = layers.reduce(function (groups, layer) {
34278
- var _a;
34279
- if (layer.leaf) {
34280
- return groups.concat((_a = layer.path) !== null && _a !== void 0 ? _a : []);
34281
- }
34282
- return groups;
34283
- }, []);
34284
- if (!((_b = (_a = draft.filters.activeServices.entities[serviceId]) === null || _a === void 0 ? void 0 : _a.filterIds) === null || _b === void 0 ? void 0 : _b.length)) {
34285
- // If the service has no filters yet, add them
34286
- produceFilters(groups, FilterType.Group, draft, layerSelectFilterAdapter);
34287
- produceFilters(keywords, FilterType.Keyword, draft, layerSelectFilterAdapter);
34288
- }
34289
- var filterIds = groups.map(function (group) {
34290
- return getFilterId(FilterType.Group, group);
34291
- }).concat(keywords.map(function (keyword) {
34292
- return getFilterId(FilterType.Keyword, keyword);
34293
- }));
34294
- draft.filters.activeServices.entities[serviceId] = {
34295
- serviceId: serviceId,
34296
- enabled: draft.allServicesEnabled,
34297
- filterIds: filterIds,
34298
- scope: scope,
34299
- serviceName: serviceName,
34300
- serviceUrl: serviceUrl,
34301
- "abstract": _abstract,
34302
- isLoading: false
34303
- };
34304
- if (!draft.filters.activeServices.ids.includes(serviceId)) {
34305
- draft.filters.activeServices.ids.push(serviceId);
34306
- }
34307
- }).addCase(serviceActions.fetchInitialServices, function (draft, action) {
34308
- var services = action.payload.services;
34309
- services.forEach(function (service) {
34310
- var serviceId = service.id,
34311
- serviceName = service.name,
34312
- serviceUrl = service.serviceUrl,
34313
- _abstract2 = service["abstract"],
34314
- scope = service.scope;
34315
- draft.filters.activeServices.entities[serviceId] = {
34316
- serviceId: serviceId,
34317
- enabled: draft.allServicesEnabled,
34318
- filterIds: [],
34319
- scope: scope,
34320
- serviceName: serviceName,
34321
- serviceUrl: serviceUrl,
34322
- "abstract": _abstract2,
34323
- isLoading: true
34324
- };
34325
- if (!draft.filters.activeServices.ids.includes(serviceId)) {
34326
- draft.filters.activeServices.ids.push(serviceId);
34327
- }
34328
- });
34329
- });
34330
- }
34331
- });
34332
- var reducer$4 = slice$4.reducer;
34333
- var layerSelectActions = slice$4.actions;
34334
-
34335
- /* *
34336
- * Licensed under the Apache License, Version 2.0 (the "License");
34337
- * you may not use this file except in compliance with the License.
34338
- * You may obtain a copy of the License at
34339
- *
34340
- * http://www.apache.org/licenses/LICENSE-2.0
34341
- *
34342
- * Unless required by applicable law or agreed to in writing, software
34343
- * distributed under the License is distributed on an "AS IS" BASIS,
34344
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34345
- * See the License for the specific language governing permissions and
34346
- * limitations under the License.
34347
- *
34348
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34349
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
34350
- * */
34351
- var layerSelectStore = function layerSelectStore(store) {
34352
- return store && store.layerSelect ? store.layerSelect : null;
34353
- };
34354
- /**
34355
- * Returns search filter string
34356
- *
34357
- * Example getSearchFilter(store);
34358
- * @param {object} store store: object - store object
34359
- * @returns {array} returnType: string
34360
- */
34361
- var getSearchFilter = createSelector(layerSelectStore, function (store) {
34362
- var _a;
34363
- return ((_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.searchFilter) || '';
34364
- });
34365
- /**
34366
- * Returns active services array
34367
- *
34368
- * Example getActiveServices(store);
34369
- * @param {object} store store: object - store object
34370
- * @returns {ActiveServiceObjectEntities} returnType: ActiveServiceObjectEntitiesobject of active services
34371
- */
34372
- // cast to usable type - selectEntities returns Dictionary<ActiveServiceObject> which is not usable inside of the code
34373
- var getActiveServices = function getActiveServices(store) {
34374
- return getActiveServicesDictionary(store);
34375
- };
34376
- var _layerSelectActiveSer = layerSelectActiveServicesAdapter.getSelectors(function (store) {
34377
- var _a, _b;
34378
- return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.activeServices) || {
34379
- entities: {},
34380
- ids: []
34381
- };
34382
- }),
34383
- getActiveServicesDictionary = _layerSelectActiveSer.selectEntities,
34384
- getActiveServiceById = _layerSelectActiveSer.selectById;
34385
- var getEnabledServiceIds = createSelector(layerSelectStore, function (store) {
34386
- var _a, _b;
34387
- var enabledServices = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices.ids.filter(function (serviceId) {
34388
- var _a, _b, _c;
34389
- return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.activeServices) === null || _b === void 0 ? void 0 : _b.entities[serviceId]) === null || _c === void 0 ? void 0 : _c.enabled;
34390
- })) !== null && _b !== void 0 ? _b : [];
34391
- return enabledServices;
34392
- }, selectorMemoizationOptions);
34393
- /**
34394
- * Returns all ids of checked keywords
34395
- *
34396
- * Example getCheckedKeywordIds(store);
34397
- * @param {object} store store: object - store object
34398
- * @returns {array} returnType: array of keyword ids that are checked
34399
- */
34400
- var getCheckedFilterIds = createSelector(layerSelectStore, function (store) {
34401
- var _a, _b, _c;
34402
- var checkedFilters = (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.ids.filter(function (filterId) {
34403
- var _a, _b, _c;
34404
- return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.checked;
34405
- })) !== null && _c !== void 0 ? _c : [];
34406
- return checkedFilters.map(function (filterId) {
34407
- var _a, _b, _c;
34408
- return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.id;
34409
- });
34410
- }, selectorMemoizationOptions);
34411
- /**
34412
- * Returns ids of all keywords
34413
- *
34414
- * Example getAllKeywordIds(store);
34415
- * @param {object} store store: object - store object
34416
- * @returns {array} returnType: array of all keyword ids
34417
- */
34418
- // cast to usable type - selectIds returns EntityId[] which is not usable inside of the code
34419
- var getAllFilterIds = function getAllFilterIds(store) {
34420
- return getAllFilterIdsEntity(store);
34421
- };
34422
- var _layerSelectFilterAda = layerSelectFilterAdapter.getSelectors(function (store) {
34423
- var _a, _b;
34424
- return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
34425
- entities: {},
34426
- ids: []
34427
- };
34428
- }),
34429
- getAllFilterIdsEntity = _layerSelectFilterAda.selectIds;
34430
- /**
34431
- * Returns all filters
34432
- *
34433
- * Example getAllFilters(store);
34434
- * @param {object} store store: object - store object
34435
- * @returns {array} returnType: array of all filters
34436
- */
34437
- var _layerSelectFilterAda2 = layerSelectFilterAdapter.getSelectors(function (store) {
34438
- var _a, _b;
34439
- return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
34440
- entities: {},
34441
- ids: []
34442
- };
34443
- }),
34444
- getAllFilters = _layerSelectFilterAda2.selectAll;
34445
- var isAllFiltersChecked = createSelector(layerSelectStore, function (store) {
34446
- var _a, _b;
34447
- return (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.ids.every(function (filterId) {
34448
- var _a, _b, _c;
34449
- return (_c = (_b = (_a = store === null || store === void 0 ? void 0 : store.filters) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.entities[filterId]) === null || _c === void 0 ? void 0 : _c.checked;
34450
- });
34451
- });
34452
- /**
34453
- * Gets a KeywordObject by its id
34454
- *
34455
- * Example: keywordObject = getKeywordObjectById(store, 'keywordId')
34456
- * @param {object} store object from which the keyword state will be extracted
34457
- * @param {string} filterId Id of the keyword
34458
- * @returns {object} object containing keyword information (id, amount, amountVisible, checked)
34459
- */
34460
- var _layerSelectFilterAda3 = layerSelectFilterAdapter.getSelectors(function (store) {
34461
- var _a, _b;
34462
- return ((_b = (_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.filters) || {
34463
- entities: {},
34464
- ids: []
34465
- };
34466
- }),
34467
- getFilterById = _layerSelectFilterAda3.selectById;
34468
- var getActiveLayerInfo = createSelector(layerSelectStore, function (store) {
34469
- return store === null || store === void 0 ? void 0 : store.activeLayerInfo;
34470
- });
34471
- /**
34472
- * Returns a filtered active layer object based on the given filter settings
34473
- * Example: layerSelectSelectors.getFilteredLayers(store, filteredSettings);
34474
- * @param {object} store store: object - object from which the service state will be extracted
34475
- * @returns {array} returnType: ActiveLayerObject - an array of all filtered activelayers
34476
- */
34477
- var getFilteredLayers = createSelector([getEnabledServiceIds, getServices, getCheckedFilterIds, isAllFiltersChecked, getSearchFilter], function (enabledServiceIds, servicesStore, checkedFilterIds, allFiltersActive, searchFilter) {
34478
- return enabledServiceIds.reduce(function (layerList, serviceId) {
34479
- return layerList.concat(filterLayersFromService(serviceId, servicesStore, checkedFilterIds, allFiltersActive, searchFilter).map(function (layer) {
34480
- return Object.assign(Object.assign({}, layer), {
34481
- serviceName: serviceId
34482
- });
34483
- }));
34484
- }, []);
34485
- }, selectorMemoizationOptions);
34486
- /**
34487
- * Returns service popup details
34488
- *
34489
- * Example getActiveServices(store, 'server-id');
34490
- * @param {object} store store: object - store object
34491
- * @returns {object} returnType: object of active service
34492
- */
34493
- var getServicePopupDetails = function getServicePopupDetails(store) {
34494
- var _a;
34495
- return ((_a = store === null || store === void 0 ? void 0 : store.layerSelect) === null || _a === void 0 ? void 0 : _a.servicePopup) || initialServicePopupState;
34496
- };
34497
-
34498
- var selectors$2 = /*#__PURE__*/Object.freeze({
34499
- __proto__: null,
34500
- getSearchFilter: getSearchFilter,
34501
- getActiveServices: getActiveServices,
34502
- getActiveServicesDictionary: getActiveServicesDictionary,
34503
- getActiveServiceById: getActiveServiceById,
34504
- getEnabledServiceIds: getEnabledServiceIds,
34505
- getCheckedFilterIds: getCheckedFilterIds,
34506
- getAllFilterIds: getAllFilterIds,
34507
- getAllFilters: getAllFilters,
34508
- isAllFiltersChecked: isAllFiltersChecked,
34509
- getFilterById: getFilterById,
34510
- getActiveLayerInfo: getActiveLayerInfo,
34511
- getFilteredLayers: getFilteredLayers,
34512
- getServicePopupDetails: getServicePopupDetails
34513
- });
34514
-
34515
- /* *
34516
- * Licensed under the Apache License, Version 2.0 (the "License");
34517
- * you may not use this file except in compliance with the License.
34518
- * You may obtain a copy of the License at
34519
- *
34520
- * http://www.apache.org/licenses/LICENSE-2.0
34521
- *
34522
- * Unless required by applicable law or agreed to in writing, software
34523
- * distributed under the License is distributed on an "AS IS" BASIS,
34524
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34525
- * See the License for the specific language governing permissions and
34526
- * limitations under the License.
34527
- *
34528
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
34529
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
34530
- * */
34531
- var getUserAddedServices = function getUserAddedServices() {
34532
- try {
34533
- var storedString = window.localStorage.getItem('userAddedServices');
34534
- var parsedData = JSON.parse(storedString);
34535
- if (parsedData && _typeof$1(parsedData) === 'object') {
34536
- return Object.entries(parsedData).reduce(function (userServices, _ref) {
34537
- var _ref2 = _slicedToArray(_ref, 2),
34538
- serviceUrl = _ref2[0],
34539
- service = _ref2[1];
34540
- return Object.assign(Object.assign({}, userServices), isNoIdService(service) ? _defineProperty$1({}, serviceUrl, Object.assign(Object.assign({}, service), {
34541
- scope: 'user'
34542
- })) : {});
34543
- }, {});
34544
- }
34545
- } catch (e) {
34546
- console.error('Unable to read services from localStorage: ', e);
34547
- }
34548
- return {};
34549
- };
34550
- var setUserAddedServices = function setUserAddedServices(services) {
34551
- try {
34552
- window.localStorage.setItem('userAddedServices', JSON.stringify(services));
34553
- } catch (e) {
34554
- console.error('Unable to write services to localStorage: ', e);
34555
- }
34556
- };
34557
- var isNoIdService = function isNoIdService(param) {
34558
- var serviceParam = param;
34559
- return !!((serviceParam === null || serviceParam === void 0 ? void 0 : serviceParam.name) && (serviceParam === null || serviceParam === void 0 ? void 0 : serviceParam.url));
34560
- };
34561
-
34562
33951
  /* *
34563
33952
  * Licensed under the Apache License, Version 2.0 (the "License");
34564
33953
  * you may not use this file except in compliance with the License.
@@ -34755,16 +34144,7 @@ var getMapBaseLayerActionsTargets = function getMapBaseLayerActionsTargets(state
34755
34144
  });
34756
34145
  };
34757
34146
 
34758
- var _marked$6 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$5);
34759
- var setBaseLayers = layerActions.setBaseLayers,
34760
- addLayer = layerActions.addLayer,
34761
- duplicateMapLayer = layerActions.duplicateMapLayer,
34762
- layerChangeDimension = layerActions.layerChangeDimension,
34763
- layerChangeEnabled = layerActions.layerChangeEnabled,
34764
- layerChangeName = layerActions.layerChangeName,
34765
- layerChangeOpacity = layerActions.layerChangeOpacity,
34766
- layerChangeStyle = layerActions.layerChangeStyle,
34767
- layerDelete = layerActions.layerDelete;
34147
+ var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$3);
34768
34148
  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$/;
34769
34149
  function setTimeSaga(_ref) {
34770
34150
  var payload = _ref.payload;
@@ -34911,7 +34291,7 @@ function duplicateMapLayerActionsSaga(_ref5) {
34911
34291
  break;
34912
34292
  }
34913
34293
  _context5.next = 10;
34914
- return put(setLayerActionSync(newPayload, targets, addLayer.type));
34294
+ return put(setLayerActionSync(newPayload, targets, layerActions.addLayer.type));
34915
34295
  case 10:
34916
34296
  case "end":
34917
34297
  return _context5.stop();
@@ -35037,7 +34417,7 @@ function mapBaseLayerActionsSaga(_ref9) {
35037
34417
  }, _callee9);
35038
34418
  })();
35039
34419
  }
35040
- function rootSaga$5() {
34420
+ function rootSaga$3() {
35041
34421
  return _regeneratorRuntime().wrap(function rootSaga$(_context10) {
35042
34422
  while (1) switch (_context10.prev = _context10.next) {
35043
34423
  case 0:
@@ -35048,28 +34428,28 @@ function rootSaga$5() {
35048
34428
  return takeLatest$1(setBbox.type, setBBoxSaga);
35049
34429
  case 4:
35050
34430
  _context10.next = 6;
35051
- return takeLatest$1(layerChangeName.type, layerActionsSaga);
34431
+ return takeLatest$1(layerActions.layerChangeName.type, layerActionsSaga);
35052
34432
  case 6:
35053
34433
  _context10.next = 8;
35054
- return takeLatest$1(layerChangeEnabled.type, layerActionsSaga);
34434
+ return takeLatest$1(layerActions.layerChangeEnabled.type, layerActionsSaga);
35055
34435
  case 8:
35056
34436
  _context10.next = 10;
35057
- return takeLatest$1(layerChangeOpacity.type, layerActionsSaga);
34437
+ return takeLatest$1(layerActions.layerChangeOpacity.type, layerActionsSaga);
35058
34438
  case 10:
35059
34439
  _context10.next = 12;
35060
- return takeLatest$1(layerChangeDimension.type, layerActionsSaga);
34440
+ return takeLatest$1(layerActions.layerChangeDimension.type, layerActionsSaga);
35061
34441
  case 12:
35062
34442
  _context10.next = 14;
35063
- return takeLatest$1(layerChangeStyle.type, layerActionsSaga);
34443
+ return takeLatest$1(layerActions.layerChangeStyle.type, layerActionsSaga);
35064
34444
  case 14:
35065
34445
  _context10.next = 16;
35066
- return takeLatest$1(layerDelete.type, deleteLayerActionsSaga);
34446
+ return takeLatest$1(layerActions.layerDelete.type, deleteLayerActionsSaga);
35067
34447
  case 16:
35068
34448
  _context10.next = 18;
35069
- return takeLatest$1(addLayer.type, addLayerActionsSaga);
34449
+ return takeLatest$1(layerActions.addLayer.type, addLayerActionsSaga);
35070
34450
  case 18:
35071
34451
  _context10.next = 20;
35072
- return takeLatest$1(duplicateMapLayer.type, duplicateMapLayerActionsSaga);
34452
+ return takeLatest$1(layerActions.duplicateMapLayer.type, duplicateMapLayerActionsSaga);
35073
34453
  case 20:
35074
34454
  _context10.next = 22;
35075
34455
  return takeLatest$1(mapActions.layerMoveLayer.type, moveLayerActionsSaga);
@@ -35078,208 +34458,14 @@ function rootSaga$5() {
35078
34458
  return takeLatest$1(mapActions.setAutoLayerId.type, setAutoLayerIdActionsSaga);
35079
34459
  case 24:
35080
34460
  _context10.next = 26;
35081
- return takeLatest$1(setBaseLayers.type, mapBaseLayerActionsSaga);
34461
+ return takeLatest$1(layerActions.setBaseLayers.type, mapBaseLayerActionsSaga);
35082
34462
  case 26:
35083
34463
  case "end":
35084
34464
  return _context10.stop();
35085
34465
  }
35086
- }, _marked$6);
35087
- }
35088
-
35089
- /* *
35090
- * Licensed under the Apache License, Version 2.0 (the "License");
35091
- * you may not use this file except in compliance with the License.
35092
- * You may obtain a copy of the License at
35093
- *
35094
- * http://www.apache.org/licenses/LICENSE-2.0
35095
- *
35096
- * Unless required by applicable law or agreed to in writing, software
35097
- * distributed under the License is distributed on an "AS IS" BASIS,
35098
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35099
- * See the License for the specific language governing permissions and
35100
- * limitations under the License.
35101
- *
35102
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35103
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
35104
- * */
35105
- var snackbarAdapter = createEntityAdapter();
35106
- var initialState$3 = snackbarAdapter.getInitialState();
35107
- var slice$3 = createSlice({
35108
- initialState: initialState$3,
35109
- name: 'snackbar',
35110
- reducers: {
35111
- // To open the snackbar call this action
35112
- openSnackbar: function openSnackbar(
35113
- // eslint-disable-next-line no-unused-vars
35114
- draft,
35115
- // eslint-disable-next-line no-unused-vars
35116
- action) {},
35117
- // triggerOpenSnackbarBySaga is triggered by the saga to open the snackbar after the current snackbars have all been closed
35118
- // DO NOT CALL THIS ACTION DIRECTLY!
35119
- triggerOpenSnackbarBySaga: function triggerOpenSnackbarBySaga(draft, action) {
35120
- var snackbarContent = action.payload.snackbarContent;
35121
- // Ensure we have an id before proceeding
35122
- if (snackbarContent.id === undefined) {
35123
- return;
35124
- }
35125
- snackbarAdapter.setOne(draft, snackbarContent);
35126
- },
35127
- closeSnackbar: function closeSnackbar(draft) {
35128
- snackbarAdapter.removeAll(draft);
35129
- }
35130
- }
35131
- });
35132
- var reducer$3 = slice$3.reducer;
35133
- var snackbarActions = slice$3.actions;
35134
-
35135
- /* *
35136
- * Licensed under the Apache License, Version 2.0 (the "License");
35137
- * you may not use this file except in compliance with the License.
35138
- * You may obtain a copy of the License at
35139
- *
35140
- * http://www.apache.org/licenses/LICENSE-2.0
35141
- *
35142
- * Unless required by applicable law or agreed to in writing, software
35143
- * distributed under the License is distributed on an "AS IS" BASIS,
35144
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35145
- * See the License for the specific language governing permissions and
35146
- * limitations under the License.
35147
- *
35148
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35149
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
35150
- * */
35151
- var getSnackbarStore = function getSnackbarStore(store) {
35152
- if (store && store.snackbar) {
35153
- return store.snackbar;
35154
- }
35155
- return null;
35156
- };
35157
- var _snackbarAdapter$getS = snackbarAdapter.getSelectors(function (state) {
35158
- var _a;
35159
- return (_a = state === null || state === void 0 ? void 0 : state.snackbar) !== null && _a !== void 0 ? _a : {
35160
- entities: {},
35161
- ids: []
35162
- };
35163
- }),
35164
- getCurrentSnackbarMessages = _snackbarAdapter$getS.selectAll;
35165
- var getFirstSnackbarMessage = createSelector(getCurrentSnackbarMessages, function (currentMessages) {
35166
- return currentMessages.length > 0 ? currentMessages[0] : undefined;
35167
- });
35168
-
35169
- var selectors$1 = /*#__PURE__*/Object.freeze({
35170
- __proto__: null,
35171
- getSnackbarStore: getSnackbarStore,
35172
- getCurrentSnackbarMessages: getCurrentSnackbarMessages,
35173
- getFirstSnackbarMessage: getFirstSnackbarMessage
35174
- });
35175
-
35176
- /* *
35177
- * Licensed under the Apache License, Version 2.0 (the "License");
35178
- * you may not use this file except in compliance with the License.
35179
- * You may obtain a copy of the License at
35180
- *
35181
- * http://www.apache.org/licenses/LICENSE-2.0
35182
- *
35183
- * Unless required by applicable law or agreed to in writing, software
35184
- * distributed under the License is distributed on an "AS IS" BASIS,
35185
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35186
- * See the License for the specific language governing permissions and
35187
- * limitations under the License.
35188
- *
35189
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35190
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
35191
- * */
35192
-
35193
- var types = /*#__PURE__*/Object.freeze({
35194
- __proto__: null
35195
- });
35196
-
35197
- var _marked$5 = /*#__PURE__*/_regeneratorRuntime().mark(openSnackbarSaga),
35198
- _marked2$4 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$4);
35199
- var hideTime = 4000;
35200
- function openSnackbarSaga(capturedAction) {
35201
- var snackbarMessage, currentSnackbarMessages, id, currentSnackbarMessagesOpen;
35202
- return _regeneratorRuntime().wrap(function openSnackbarSaga$(_context) {
35203
- while (1) switch (_context.prev = _context.next) {
35204
- case 0:
35205
- snackbarMessage = capturedAction.payload.message;
35206
- _context.next = 3;
35207
- return select(getCurrentSnackbarMessages);
35208
- case 3:
35209
- currentSnackbarMessages = _context.sent;
35210
- if (!currentSnackbarMessages.length) {
35211
- _context.next = 7;
35212
- break;
35213
- }
35214
- _context.next = 7;
35215
- return put(snackbarActions.closeSnackbar());
35216
- case 7:
35217
- // Generate a unique id
35218
- id = "snackbar".concat(Date.now().toString());
35219
- _context.next = 10;
35220
- return put(snackbarActions.triggerOpenSnackbarBySaga({
35221
- snackbarContent: {
35222
- message: snackbarMessage,
35223
- id: id
35224
- }
35225
- }));
35226
- case 10:
35227
- _context.next = 12;
35228
- return delay(hideTime);
35229
- case 12:
35230
- _context.next = 14;
35231
- return select(getCurrentSnackbarMessages);
35232
- case 14:
35233
- currentSnackbarMessagesOpen = _context.sent;
35234
- if (!currentSnackbarMessagesOpen.length) {
35235
- _context.next = 18;
35236
- break;
35237
- }
35238
- _context.next = 18;
35239
- return put(snackbarActions.closeSnackbar());
35240
- case 18:
35241
- case "end":
35242
- return _context.stop();
35243
- }
35244
- }, _marked$5);
35245
- }
35246
- function rootSaga$4() {
35247
- return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
35248
- while (1) switch (_context2.prev = _context2.next) {
35249
- case 0:
35250
- _context2.next = 2;
35251
- return takeLatest$1(snackbarActions.openSnackbar.type, openSnackbarSaga);
35252
- case 2:
35253
- case "end":
35254
- return _context2.stop();
35255
- }
35256
- }, _marked2$4);
34466
+ }, _marked$4);
35257
34467
  }
35258
34468
 
35259
- /* *
35260
- * Licensed under the Apache License, Version 2.0 (the "License");
35261
- * you may not use this file except in compliance with the License.
35262
- * You may obtain a copy of the License at
35263
- *
35264
- * http://www.apache.org/licenses/LICENSE-2.0
35265
- *
35266
- * Unless required by applicable law or agreed to in writing, software
35267
- * distributed under the License is distributed on an "AS IS" BASIS,
35268
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35269
- * See the License for the specific language governing permissions and
35270
- * limitations under the License.
35271
- *
35272
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
35273
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
35274
- * */
35275
- var snackbarModuleConfig = {
35276
- id: 'snackbar-module',
35277
- reducersMap: {
35278
- snackbar: reducer$3
35279
- },
35280
- sagas: [rootSaga$4]
35281
- };
35282
-
35283
34469
  /* *
35284
34470
  * Licensed under the Apache License, Version 2.0 (the "License");
35285
34471
  * you may not use this file except in compliance with the License.
@@ -35338,8 +34524,8 @@ var utils = /*#__PURE__*/Object.freeze({
35338
34524
  historyDict: historyDict
35339
34525
  });
35340
34526
 
35341
- var _marked$4 = /*#__PURE__*/_regeneratorRuntime().mark(navigateToUrlSaga),
35342
- _marked2$3 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$3);
34527
+ var _marked$3 = /*#__PURE__*/_regeneratorRuntime().mark(navigateToUrlSaga),
34528
+ _marked2$2 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$2);
35343
34529
  function navigateToUrlSaga(action) {
35344
34530
  var payload;
35345
34531
  return _regeneratorRuntime().wrap(function navigateToUrlSaga$(_context) {
@@ -35352,9 +34538,9 @@ function navigateToUrlSaga(action) {
35352
34538
  case "end":
35353
34539
  return _context.stop();
35354
34540
  }
35355
- }, _marked$4);
34541
+ }, _marked$3);
35356
34542
  }
35357
- function rootSaga$3() {
34543
+ function rootSaga$2() {
35358
34544
  return _regeneratorRuntime().wrap(function rootSaga$(_context2) {
35359
34545
  while (1) switch (_context2.prev = _context2.next) {
35360
34546
  case 0:
@@ -35364,7 +34550,7 @@ function rootSaga$3() {
35364
34550
  case "end":
35365
34551
  return _context2.stop();
35366
34552
  }
35367
- }, _marked2$3);
34553
+ }, _marked2$2);
35368
34554
  }
35369
34555
 
35370
34556
  /* *
@@ -35388,7 +34574,7 @@ var routerModuleConfig = {
35388
34574
  reducersMap: {
35389
34575
  router: reducer$2
35390
34576
  },
35391
- sagas: [rootSaga$3]
34577
+ sagas: [rootSaga$2]
35392
34578
  };
35393
34579
 
35394
34580
  /* *
@@ -35484,16 +34670,21 @@ var slice = createSlice({
35484
34670
  registerDrawTool: function registerDrawTool(draft, action) {
35485
34671
  var _action$payload = action.payload,
35486
34672
  drawToolId = _action$payload.drawToolId,
35487
- drawModes = _action$payload.drawModes,
34673
+ _action$payload$defau = _action$payload.defaultDrawModes,
34674
+ defaultDrawModes = _action$payload$defau === void 0 ? [] : _action$payload$defau,
35488
34675
  _action$payload$geoJS = _action$payload.geoJSONLayerId,
35489
34676
  geoJSONLayerId = _action$payload$geoJS === void 0 ? '' : _action$payload$geoJS,
34677
+ geoJSONIntersectionLayerId = _action$payload.geoJSONIntersectionLayerId,
34678
+ geoJSONIntersectionBoundsLayerId = _action$payload.geoJSONIntersectionBoundsLayerId,
35490
34679
  _action$payload$shoul = _action$payload.shouldAllowMultipleShapes,
35491
34680
  shouldAllowMultipleShapes = _action$payload$shoul === void 0 ? false : _action$payload$shoul;
35492
34681
  drawAdapter.addOne(draft, {
35493
34682
  drawToolId: drawToolId,
35494
34683
  geoJSONLayerId: geoJSONLayerId,
34684
+ geoJSONIntersectionLayerId: geoJSONIntersectionLayerId,
34685
+ geoJSONIntersectionBoundsLayerId: geoJSONIntersectionBoundsLayerId,
35495
34686
  activeDrawModeId: '',
35496
- drawModes: drawModes,
34687
+ drawModes: defaultDrawModes,
35497
34688
  shouldAllowMultipleShapes: shouldAllowMultipleShapes
35498
34689
  });
35499
34690
  },
@@ -35535,14 +34726,44 @@ var slice = createSlice({
35535
34726
  return;
35536
34727
  }
35537
34728
  drawTool.geoJSONLayerId = geoJSONLayerId;
34729
+ },
34730
+ // updates single tool mode with new values
34731
+ updateDrawToolMode: function updateDrawToolMode(draft, action) {
34732
+ var _action$payload4 = action.payload,
34733
+ drawModeId = _action$payload4.drawModeId,
34734
+ drawToolId = _action$payload4.drawToolId,
34735
+ shape = _action$payload4.shape,
34736
+ title = _action$payload4.title;
34737
+ var drawTool = draft.entities[drawToolId];
34738
+ if (!drawTool) {
34739
+ return;
34740
+ }
34741
+ var newModes = drawTool.drawModes.map(function (mode) {
34742
+ if (mode.drawModeId === drawModeId) {
34743
+ return Object.assign(Object.assign(Object.assign({}, mode), {
34744
+ shape: shape
34745
+ }), title && {
34746
+ title: title
34747
+ });
34748
+ }
34749
+ return mode;
34750
+ });
34751
+ drawTool.drawModes = newModes;
34752
+ },
34753
+ changeIntersectionBounds: function changeIntersectionBounds(
34754
+ // eslint-disable-next-line no-unused-vars
34755
+ draft,
34756
+ // eslint-disable-next-line no-unused-vars
34757
+ action) {
34758
+ // action caught in drawingTool/sagas
35538
34759
  }
35539
34760
  },
35540
34761
  extraReducers: function extraReducers(builder) {
35541
34762
  builder.addCase(layerActions.exitFeatureDrawMode, function (draft, action) {
35542
- var _action$payload4 = action.payload,
35543
- layerId = _action$payload4.layerId,
35544
- shouldAllowMultipleShapes = _action$payload4.shouldAllowMultipleShapes,
35545
- reason = _action$payload4.reason;
34763
+ var _action$payload5 = action.payload,
34764
+ layerId = _action$payload5.layerId,
34765
+ shouldAllowMultipleShapes = _action$payload5.shouldAllowMultipleShapes,
34766
+ reason = _action$payload5.reason;
35546
34767
  var drawToolId = getDrawToolByLayerId(draft, layerId);
35547
34768
  if (!drawToolId || drawToolId && !draft.entities[drawToolId]) {
35548
34769
  return;
@@ -35552,9 +34773,9 @@ var slice = createSlice({
35552
34773
  }
35553
34774
  }).addCase(layerActions.updateFeatureProperties, function (draft, action) {
35554
34775
  var _a;
35555
- var _action$payload5 = action.payload,
35556
- properties = _action$payload5.properties,
35557
- layerId = _action$payload5.layerId;
34776
+ var _action$payload6 = action.payload,
34777
+ properties = _action$payload6.properties,
34778
+ layerId = _action$payload6.layerId;
35558
34779
  var drawToolId = getDrawToolByLayerId(draft, layerId);
35559
34780
  var entity = draft.entities[drawToolId];
35560
34781
  if (drawToolId && entity !== undefined) {
@@ -35621,6 +34842,12 @@ var _drawAdapter$getSelec = drawAdapter.getSelectors(function (state) {
35621
34842
  }),
35622
34843
  selectDrawToolById = _drawAdapter$getSelec.selectById,
35623
34844
  selectAllDrawingTools = _drawAdapter$getSelec.selectAll;
34845
+ var getActiveDrawToolId = createSelector(selectAllDrawingTools, function (drawtools) {
34846
+ var activeDrawTool = drawtools === null || drawtools === void 0 ? void 0 : drawtools.find(function (drawtool) {
34847
+ return drawtool.activeDrawModeId !== '';
34848
+ });
34849
+ return (activeDrawTool === null || activeDrawTool === void 0 ? void 0 : activeDrawTool.drawToolId) || '';
34850
+ });
35624
34851
  var getDrawModeById = createSelector(selectDrawToolById, function (_store, _drawToolId, drawModeId) {
35625
34852
  return drawModeId;
35626
34853
  }, function (draw, drawModeId) {
@@ -35634,26 +34861,40 @@ var getActiveDrawModeId = createSelector(selectDrawToolById, function (drawingTo
35634
34861
  var getDrawToolGeoJSONLayerId = createSelector(selectDrawToolById, function (drawingTool) {
35635
34862
  return (drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.geoJSONLayerId) || '';
35636
34863
  });
34864
+ var getGeoJSONIntersectionLayerId = createSelector(selectDrawToolById, function (drawingTool) {
34865
+ return drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.geoJSONIntersectionLayerId;
34866
+ });
34867
+ var getGeoJSONIntersectionBoundsLayerId = createSelector(selectDrawToolById, function (drawingTool) {
34868
+ return drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.geoJSONIntersectionBoundsLayerId;
34869
+ });
34870
+ var getShouldAllowMultipleShapes = createSelector(selectDrawToolById, function (drawingTool) {
34871
+ return (drawingTool === null || drawingTool === void 0 ? void 0 : drawingTool.shouldAllowMultipleShapes) || false;
34872
+ });
35637
34873
 
35638
34874
  var selectors = /*#__PURE__*/Object.freeze({
35639
34875
  __proto__: null,
35640
34876
  getDrawingtoolStore: getDrawingtoolStore,
35641
34877
  selectDrawToolById: selectDrawToolById,
35642
34878
  selectAllDrawingTools: selectAllDrawingTools,
34879
+ getActiveDrawToolId: getActiveDrawToolId,
35643
34880
  getDrawModeById: getDrawModeById,
35644
34881
  getActiveDrawModeId: getActiveDrawModeId,
35645
- getDrawToolGeoJSONLayerId: getDrawToolGeoJSONLayerId
34882
+ getDrawToolGeoJSONLayerId: getDrawToolGeoJSONLayerId,
34883
+ getGeoJSONIntersectionLayerId: getGeoJSONIntersectionLayerId,
34884
+ getGeoJSONIntersectionBoundsLayerId: getGeoJSONIntersectionBoundsLayerId,
34885
+ getShouldAllowMultipleShapes: getShouldAllowMultipleShapes
35646
34886
  });
35647
34887
 
35648
- var _marked$3 = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
34888
+ var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
34889
+ var registerOrigin = 'drawings saga:registerDrawToolSaga';
35649
34890
  function registerDrawToolSaga(_ref) {
35650
34891
  var payload = _ref.payload;
35651
34892
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
35652
- var mapId, geoJSONLayerId, _payload$defaultGeoJS, defaultGeoJSON;
34893
+ var mapId, geoJSONLayerId, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId, _payload$defaultGeoJS, defaultGeoJSON, _payload$defaultGeoJS2, defaultGeoJSONIntersection, defaultGeoJSONIntersectionBounds, _payload$defaultGeoJS3, defaultGeoJSONIntersectionProperties, existingBoundsLayer;
35653
34894
  return _regeneratorRuntime().wrap(function _callee$(_context) {
35654
34895
  while (1) switch (_context.prev = _context.next) {
35655
34896
  case 0:
35656
- mapId = payload.mapId, geoJSONLayerId = payload.geoJSONLayerId, _payload$defaultGeoJS = payload.defaultGeoJSON, defaultGeoJSON = _payload$defaultGeoJS === void 0 ? emptyGeoJSON : _payload$defaultGeoJS; // create for every drawTool a draw layer
34897
+ mapId = payload.mapId, geoJSONLayerId = payload.geoJSONLayerId, geoJSONIntersectionLayerId = payload.geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId = payload.geoJSONIntersectionBoundsLayerId, _payload$defaultGeoJS = payload.defaultGeoJSON, defaultGeoJSON = _payload$defaultGeoJS === void 0 ? emptyGeoJSON : _payload$defaultGeoJS, _payload$defaultGeoJS2 = payload.defaultGeoJSONIntersection, defaultGeoJSONIntersection = _payload$defaultGeoJS2 === void 0 ? emptyGeoJSON : _payload$defaultGeoJS2, defaultGeoJSONIntersectionBounds = payload.defaultGeoJSONIntersectionBounds, _payload$defaultGeoJS3 = payload.defaultGeoJSONIntersectionProperties, defaultGeoJSONIntersectionProperties = _payload$defaultGeoJS3 === void 0 ? defaultIntersectionStyleProperties : _payload$defaultGeoJS3; // create for every drawTool a draw layer
35657
34898
  if (!(geoJSONLayerId && mapId)) {
35658
34899
  _context.next = 4;
35659
34900
  break;
@@ -35667,9 +34908,53 @@ function registerDrawToolSaga(_ref) {
35667
34908
  layerType: LayerType.featureLayer
35668
34909
  },
35669
34910
  layerId: geoJSONLayerId,
35670
- origin: 'drawings saga:registerDrawToolSaga'
34911
+ origin: registerOrigin
35671
34912
  }));
35672
34913
  case 4:
34914
+ if (!(geoJSONIntersectionLayerId && mapId)) {
34915
+ _context.next = 7;
34916
+ break;
34917
+ }
34918
+ _context.next = 7;
34919
+ return put(mapStoreActions.addLayer({
34920
+ mapId: mapId,
34921
+ layer: {
34922
+ geojson: defaultGeoJSONIntersection,
34923
+ layerType: LayerType.featureLayer,
34924
+ defaultGeoJSONProperties: defaultGeoJSONIntersectionProperties
34925
+ },
34926
+ layerId: geoJSONIntersectionLayerId,
34927
+ origin: registerOrigin
34928
+ }));
34929
+ case 7:
34930
+ if (!(geoJSONIntersectionBoundsLayerId && mapId)) {
34931
+ _context.next = 16;
34932
+ break;
34933
+ }
34934
+ _context.next = 10;
34935
+ return select(getLayerById, geoJSONIntersectionBoundsLayerId);
34936
+ case 10:
34937
+ existingBoundsLayer = _context.sent;
34938
+ if (existingBoundsLayer) {
34939
+ _context.next = 14;
34940
+ break;
34941
+ }
34942
+ _context.next = 14;
34943
+ return put(mapStoreActions.addLayer({
34944
+ mapId: mapId,
34945
+ layer: {
34946
+ geojson: defaultGeoJSONIntersectionBounds,
34947
+ layerType: LayerType.featureLayer
34948
+ },
34949
+ layerId: geoJSONIntersectionBoundsLayerId,
34950
+ origin: registerOrigin
34951
+ }));
34952
+ case 14:
34953
+ _context.next = 16;
34954
+ return put(layerActions.orderLayerToFront({
34955
+ layerId: geoJSONIntersectionBoundsLayerId
34956
+ }));
34957
+ case 16:
35673
34958
  case "end":
35674
34959
  return _context.stop();
35675
34960
  }
@@ -35679,7 +34964,7 @@ function registerDrawToolSaga(_ref) {
35679
34964
  function changeDrawToolSaga(_ref2) {
35680
34965
  var payload = _ref2.payload;
35681
34966
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
35682
- var _a, _b, _c, _d, drawModeId, drawToolId, _payload$shouldUpdate, shouldUpdateShape, drawingTool, shouldAllowMultipleShapes, newDrawMode, currentGeoJSONLayer, _ref3, currentGeoJSON, _ref3$selectedFeature, selectedFeatureIndex, currentSelectionType, newSelectionType, isNewToolSelected, shouldUpdateNewShape, geoJSONFeatureCollection, newGeoJSON;
34967
+ var _a, _b, _c, _d, drawModeId, drawToolId, _payload$shouldUpdate, shouldUpdateShape, drawingTool, _drawingTool$shouldAl, shouldAllowMultipleShapes, geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId, newDrawMode, currentGeoJSONLayer, _ref3, currentGeoJSON, _ref3$selectedFeature, selectedFeatureIndex, currentSelectionType, newSelectionType, isNewToolSelected, shouldUpdateNewShape, geoJSONFeatureCollection, newGeoJSON;
35683
34968
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
35684
34969
  while (1) switch (_context2.prev = _context2.next) {
35685
34970
  case 0:
@@ -35689,49 +34974,56 @@ function changeDrawToolSaga(_ref2) {
35689
34974
  return select(selectDrawToolById, drawToolId);
35690
34975
  case 4:
35691
34976
  drawingTool = _context2.sent;
35692
- shouldAllowMultipleShapes = drawingTool.shouldAllowMultipleShapes;
34977
+ _drawingTool$shouldAl = drawingTool.shouldAllowMultipleShapes, shouldAllowMultipleShapes = _drawingTool$shouldAl === void 0 ? false : _drawingTool$shouldAl, geoJSONIntersectionLayerId = drawingTool.geoJSONIntersectionLayerId, geoJSONIntersectionBoundsLayerId = drawingTool.geoJSONIntersectionBoundsLayerId;
35693
34978
  _context2.next = 8;
35694
34979
  return select(getDrawModeById, drawToolId, drawModeId);
35695
34980
  case 8:
35696
34981
  newDrawMode = _context2.sent;
35697
- if (!(newDrawMode.value === 'DELETE')) {
35698
- _context2.next = 15;
34982
+ if (!(!newDrawMode || !drawingTool.activeDrawModeId && newDrawMode.isSelectable)) {
34983
+ _context2.next = 13;
35699
34984
  break;
35700
34985
  }
35701
34986
  _context2.next = 12;
35702
- return put(layerActions.layerChangeGeojson({
35703
- layerId: drawingTool.geoJSONLayerId,
35704
- geojson: {
35705
- type: 'FeatureCollection',
35706
- features: []
35707
- }
35708
- }));
35709
- case 12:
35710
- _context2.next = 14;
35711
34987
  return put(layerActions.toggleFeatureMode({
35712
34988
  layerId: drawingTool.geoJSONLayerId,
35713
34989
  isInEditMode: false,
35714
34990
  drawMode: ''
35715
34991
  }));
35716
- case 14:
34992
+ case 12:
35717
34993
  return _context2.abrupt("return");
35718
- case 15:
35719
- if (!(!drawingTool.activeDrawModeId && newDrawMode.isSelectable)) {
34994
+ case 13:
34995
+ if (!(newDrawMode.value === 'DELETE')) {
34996
+ _context2.next = 22;
34997
+ break;
34998
+ }
34999
+ _context2.next = 16;
35000
+ return put(layerActions.layerChangeGeojson({
35001
+ layerId: drawingTool.geoJSONLayerId,
35002
+ geojson: emptyGeoJSON
35003
+ }));
35004
+ case 16:
35005
+ if (!geoJSONIntersectionLayerId) {
35720
35006
  _context2.next = 19;
35721
35007
  break;
35722
35008
  }
35723
- _context2.next = 18;
35009
+ _context2.next = 19;
35010
+ return put(layerActions.layerChangeGeojson({
35011
+ layerId: geoJSONIntersectionLayerId,
35012
+ geojson: emptyGeoJSON
35013
+ }));
35014
+ case 19:
35015
+ _context2.next = 21;
35724
35016
  return put(layerActions.toggleFeatureMode({
35725
35017
  layerId: drawingTool.geoJSONLayerId,
35726
35018
  isInEditMode: false,
35727
35019
  drawMode: ''
35728
35020
  }));
35729
- case 18:
35021
+ case 21:
35730
35022
  return _context2.abrupt("return");
35731
- case 19:
35732
- _context2.next = 21;
35023
+ case 22:
35024
+ _context2.next = 24;
35733
35025
  return select(getLayerById, drawingTool.geoJSONLayerId);
35734
- case 21:
35026
+ case 24:
35735
35027
  currentGeoJSONLayer = _context2.sent;
35736
35028
  _ref3 = currentGeoJSONLayer || {}, currentGeoJSON = _ref3.geojson, _ref3$selectedFeature = _ref3.selectedFeatureIndex, selectedFeatureIndex = _ref3$selectedFeature === void 0 ? 0 : _ref3$selectedFeature;
35737
35029
  currentSelectionType = (_b = (_a = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features[selectedFeatureIndex]) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.selectionType;
@@ -35739,7 +35031,7 @@ function changeDrawToolSaga(_ref2) {
35739
35031
  isNewToolSelected = currentSelectionType !== newSelectionType;
35740
35032
  shouldUpdateNewShape = !((_d = currentGeoJSON === null || currentGeoJSON === void 0 ? void 0 : currentGeoJSON.features) === null || _d === void 0 ? void 0 : _d.length) || shouldAllowMultipleShapes || isNewToolSelected; // don't change anything if same tool is selected again
35741
35033
  if (!(shouldUpdateNewShape && shouldUpdateShape)) {
35742
- _context2.next = 35;
35034
+ _context2.next = 38;
35743
35035
  break;
35744
35036
  }
35745
35037
  geoJSONFeatureCollection = getFeatureCollection(newDrawMode.shape, shouldAllowMultipleShapes, currentGeoJSON);
@@ -35747,53 +35039,96 @@ function changeDrawToolSaga(_ref2) {
35747
35039
  if (shouldAllowMultipleShapes) {
35748
35040
  moveFeature(currentGeoJSON, newGeoJSON, selectedFeatureIndex, '');
35749
35041
  }
35750
- _context2.next = 33;
35042
+ _context2.next = 36;
35751
35043
  return put(layerActions.setSelectedFeature({
35752
35044
  layerId: drawingTool.geoJSONLayerId,
35753
35045
  selectedFeatureIndex: newGeoJSON.features.length - 1
35754
35046
  }));
35755
- case 33:
35756
- _context2.next = 35;
35757
- return put(mapStoreActions.layerChangeGeojson({
35047
+ case 36:
35048
+ _context2.next = 38;
35049
+ return put(layerActions.updateFeature(Object.assign(Object.assign({
35758
35050
  layerId: drawingTool.geoJSONLayerId,
35759
35051
  geojson: newGeoJSON
35760
- }));
35761
- case 35:
35762
- _context2.next = 37;
35052
+ }, geoJSONIntersectionLayerId && {
35053
+ geoJSONIntersectionLayerId: geoJSONIntersectionLayerId
35054
+ }), geoJSONIntersectionBoundsLayerId && {
35055
+ geoJSONIntersectionBoundsLayerId: geoJSONIntersectionBoundsLayerId
35056
+ })));
35057
+ case 38:
35058
+ _context2.next = 40;
35763
35059
  return put(layerActions.toggleFeatureMode({
35764
35060
  layerId: drawingTool.geoJSONLayerId,
35765
- isInEditMode: true,
35061
+ isInEditMode: newDrawMode.isSelectable,
35766
35062
  drawMode: newDrawMode.value
35767
35063
  }));
35768
- case 37:
35769
- _context2.next = 42;
35064
+ case 40:
35065
+ _context2.next = 45;
35770
35066
  break;
35771
- case 39:
35772
- _context2.prev = 39;
35067
+ case 42:
35068
+ _context2.prev = 42;
35773
35069
  _context2.t0 = _context2["catch"](0);
35774
35070
  // eslint-disable-next-line no-console
35775
35071
  console.log('error changeDrawToolSaga', _context2.t0);
35776
- case 42:
35072
+ case 45:
35777
35073
  case "end":
35778
35074
  return _context2.stop();
35779
35075
  }
35780
- }, _callee2, null, [[0, 39]]);
35076
+ }, _callee2, null, [[0, 42]]);
35077
+ })();
35078
+ }
35079
+ function changeIntersectionSaga(_ref4) {
35080
+ var payload = _ref4.payload;
35081
+ return /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
35082
+ var drawToolId, geoJSON, drawtool;
35083
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
35084
+ while (1) switch (_context3.prev = _context3.next) {
35085
+ case 0:
35086
+ drawToolId = payload.drawToolId, geoJSON = payload.geoJSON;
35087
+ _context3.next = 3;
35088
+ return select(selectDrawToolById, drawToolId);
35089
+ case 3:
35090
+ drawtool = _context3.sent;
35091
+ _context3.next = 6;
35092
+ return put(layerActions.layerChangeGeojson({
35093
+ layerId: drawtool.geoJSONIntersectionBoundsLayerId,
35094
+ geojson: geoJSON
35095
+ }));
35096
+ case 6:
35097
+ _context3.next = 8;
35098
+ return put(layerActions.layerChangeGeojson({
35099
+ layerId: drawtool.geoJSONLayerId,
35100
+ geojson: emptyGeoJSON
35101
+ }));
35102
+ case 8:
35103
+ _context3.next = 10;
35104
+ return put(layerActions.layerChangeGeojson({
35105
+ layerId: drawtool.geoJSONIntersectionLayerId,
35106
+ geojson: emptyGeoJSON
35107
+ }));
35108
+ case 10:
35109
+ case "end":
35110
+ return _context3.stop();
35111
+ }
35112
+ }, _callee3);
35781
35113
  })();
35782
35114
  }
35783
35115
  function drawingSaga() {
35784
- return _regeneratorRuntime().wrap(function drawingSaga$(_context3) {
35785
- while (1) switch (_context3.prev = _context3.next) {
35116
+ return _regeneratorRuntime().wrap(function drawingSaga$(_context4) {
35117
+ while (1) switch (_context4.prev = _context4.next) {
35786
35118
  case 0:
35787
- _context3.next = 2;
35119
+ _context4.next = 2;
35788
35120
  return takeLatest$1(drawtoolActions.registerDrawTool, registerDrawToolSaga);
35789
35121
  case 2:
35790
- _context3.next = 4;
35122
+ _context4.next = 4;
35791
35123
  return takeLatest$1(drawtoolActions.changeDrawToolMode, changeDrawToolSaga);
35792
35124
  case 4:
35125
+ _context4.next = 6;
35126
+ return takeLatest$1(drawtoolActions.changeIntersectionBounds, changeIntersectionSaga);
35127
+ case 6:
35793
35128
  case "end":
35794
- return _context3.stop();
35129
+ return _context4.stop();
35795
35130
  }
35796
- }, _marked$3);
35131
+ }, _marked$2);
35797
35132
  }
35798
35133
 
35799
35134
  /* *
@@ -36059,6 +35394,56 @@ var testGeoJSON = {
36059
35394
  }
36060
35395
  }]
36061
35396
  };
35397
+ var webmapStateWithAnimationDelay = function webmapStateWithAnimationDelay(mapId, animationDelay) {
35398
+ var webmap = createWebmapState(mapId);
35399
+ // Add the dimensions to the map state
35400
+ webmap.byId[mapId].animationDelay = animationDelay;
35401
+ return webmap;
35402
+ };
35403
+ var mockStateMapWithAnimationDelayWithoutLayers = function mockStateMapWithAnimationDelayWithoutLayers(mapId) {
35404
+ return {
35405
+ webmap: webmapStateWithAnimationDelay(mapId, defaultAnimationDelayAtStart)
35406
+ };
35407
+ };
35408
+ var webmapStateWithTimeSliderSpan = function webmapStateWithTimeSliderSpan(mapId, timeSliderSpan) {
35409
+ var webmap = createWebmapState(mapId);
35410
+ // Add the span to the map state
35411
+ webmap.byId[mapId].timeSliderSpan = timeSliderSpan;
35412
+ return webmap;
35413
+ };
35414
+ var mockStateMapWithTimeSliderSpanWithoutLayers = function mockStateMapWithTimeSliderSpanWithoutLayers(mapId, timeSliderSpan) {
35415
+ return {
35416
+ webmap: webmapStateWithTimeSliderSpan(mapId, timeSliderSpan)
35417
+ };
35418
+ };
35419
+ var mockStateMapWithDimensions = function mockStateMapWithDimensions(layer, mapId) {
35420
+ return {
35421
+ webmap: webmapStateWithAddedLayer(layer.layerType, layer.id, mapId, layer.dimensions),
35422
+ services: {
35423
+ byId: WmMultiDimensionServices,
35424
+ allIds: ['serviceid_1', 'serviceid_2']
35425
+ },
35426
+ layers: createLayersState(layer.id, {
35427
+ name: layer.name,
35428
+ layerType: layer.layerType,
35429
+ mapId: mapId,
35430
+ service: layer.service,
35431
+ dimensions: layer.dimensions,
35432
+ enabled: (layer === null || layer === void 0 ? void 0 : layer.enabled) !== undefined ? layer.enabled : true
35433
+ })
35434
+ };
35435
+ };
35436
+ var webmapStateWithTimeStep = function webmapStateWithTimeStep(mapId, timeStep) {
35437
+ var webmap = createWebmapState(mapId);
35438
+ // Add the timeStep to the map state
35439
+ webmap.byId[mapId].timeStep = timeStep;
35440
+ return webmap;
35441
+ };
35442
+ var mockStateMapWithTimeStepWithoutLayers = function mockStateMapWithTimeStepWithoutLayers(mapId, timeStep) {
35443
+ return {
35444
+ webmap: webmapStateWithTimeStep(mapId, timeStep)
35445
+ };
35446
+ };
36062
35447
 
36063
35448
  var storeTestUtils = /*#__PURE__*/Object.freeze({
36064
35449
  __proto__: null,
@@ -36069,12 +35454,16 @@ var storeTestUtils = /*#__PURE__*/Object.freeze({
36069
35454
  webmapStateWithAddedLayer: webmapStateWithAddedLayer,
36070
35455
  mockStateMapWithLayer: mockStateMapWithLayer,
36071
35456
  mockStateMapWithMultipleLayers: mockStateMapWithMultipleLayers,
36072
- testGeoJSON: testGeoJSON
35457
+ testGeoJSON: testGeoJSON,
35458
+ mockStateMapWithAnimationDelayWithoutLayers: mockStateMapWithAnimationDelayWithoutLayers,
35459
+ mockStateMapWithTimeSliderSpanWithoutLayers: mockStateMapWithTimeSliderSpanWithoutLayers,
35460
+ mockStateMapWithDimensions: mockStateMapWithDimensions,
35461
+ mockStateMapWithTimeStepWithoutLayers: mockStateMapWithTimeStepWithoutLayers
36073
35462
  });
36074
35463
 
36075
- var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(updateSourceValueWhenLinkingComponentToGroupSaga),
36076
- _marked2$2 = /*#__PURE__*/_regeneratorRuntime().mark(updateViewStateSaga),
36077
- _marked3$1 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$2);
35464
+ var _marked$1 = /*#__PURE__*/_regeneratorRuntime().mark(updateSourceValueWhenLinkingComponentToGroupSaga),
35465
+ _marked2$1 = /*#__PURE__*/_regeneratorRuntime().mark(updateViewStateSaga),
35466
+ _marked3$1 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$1);
36078
35467
  function updateSourceValueWhenLinkingComponentToGroupSaga(groupId, targetToUpdate) {
36079
35468
  var group;
36080
35469
  return _regeneratorRuntime().wrap(function updateSourceValueWhenLinkingComponentToGroupSaga$(_context) {
@@ -36126,7 +35515,7 @@ function updateSourceValueWhenLinkingComponentToGroupSaga(groupId, targetToUpdat
36126
35515
  case "end":
36127
35516
  return _context.stop();
36128
35517
  }
36129
- }, _marked$2);
35518
+ }, _marked$1);
36130
35519
  }
36131
35520
  function addGroupTargetSaga(_ref) {
36132
35521
  var payload = _ref.payload;
@@ -36187,9 +35576,9 @@ function updateViewStateSaga() {
36187
35576
  case "end":
36188
35577
  return _context4.stop();
36189
35578
  }
36190
- }, _marked2$2);
35579
+ }, _marked2$1);
36191
35580
  }
36192
- function rootSaga$2() {
35581
+ function rootSaga$1() {
36193
35582
  return _regeneratorRuntime().wrap(function rootSaga$(_context5) {
36194
35583
  while (1) switch (_context5.prev = _context5.next) {
36195
35584
  case 0:
@@ -36229,187 +35618,9 @@ function rootSaga$2() {
36229
35618
  var synchronizationGroupConfig = {
36230
35619
  id: 'syncronizationGroupStore-module',
36231
35620
  reducersMap: {
36232
- syncronizationGroupStore: reducer$6
36233
- },
36234
- sagas: [rootSaga$5, rootSaga$2]
36235
- };
36236
-
36237
- var _marked$1 = /*#__PURE__*/_regeneratorRuntime().mark(layerSelectRemoveServiceSaga),
36238
- _marked2$1 = /*#__PURE__*/_regeneratorRuntime().mark(rootSaga$1);
36239
- function layerSelectCloseInfoDialogSaga(_ref) {
36240
- var type = _ref.type,
36241
- payload = _ref.payload;
36242
- return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
36243
- var togglePayload, activeMapIdPayload, isLayerInfoDialogOpen, _isLayerInfoDialogOpen, filteredLayers, dialogInfo;
36244
- return _regeneratorRuntime().wrap(function _callee$(_context) {
36245
- while (1) switch (_context.prev = _context.next) {
36246
- case 0:
36247
- _context.t0 = type;
36248
- _context.next = _context.t0 === uiActions.setToggleOpenDialog.type ? 3 : _context.t0 === uiActions.setActiveMapIdForDialog.type ? 8 : 17;
36249
- break;
36250
- case 3:
36251
- togglePayload = payload;
36252
- if (!(!togglePayload.setOpen && togglePayload.type === DialogTypes.LayerSelect)) {
36253
- _context.next = 7;
36254
- break;
36255
- }
36256
- _context.next = 7;
36257
- return put(uiActions.setToggleOpenDialog({
36258
- type: DialogTypes.LayerInfo,
36259
- setOpen: false
36260
- }));
36261
- case 7:
36262
- return _context.abrupt("break", 30);
36263
- case 8:
36264
- activeMapIdPayload = payload;
36265
- if (activeMapIdPayload.setOpen) {
36266
- _context.next = 16;
36267
- break;
36268
- }
36269
- _context.next = 12;
36270
- return select(getisDialogOpen, DialogTypes.LayerInfo);
36271
- case 12:
36272
- isLayerInfoDialogOpen = _context.sent;
36273
- if (!isLayerInfoDialogOpen) {
36274
- _context.next = 16;
36275
- break;
36276
- }
36277
- _context.next = 16;
36278
- return put(uiActions.setToggleOpenDialog({
36279
- type: DialogTypes.LayerInfo,
36280
- setOpen: false
36281
- }));
36282
- case 16:
36283
- return _context.abrupt("break", 30);
36284
- case 17:
36285
- _context.next = 19;
36286
- return select(getisDialogOpen, DialogTypes.LayerInfo);
36287
- case 19:
36288
- _isLayerInfoDialogOpen = _context.sent;
36289
- if (!_isLayerInfoDialogOpen) {
36290
- _context.next = 30;
36291
- break;
36292
- }
36293
- _context.next = 23;
36294
- return select(getFilteredLayers);
36295
- case 23:
36296
- filteredLayers = _context.sent;
36297
- _context.next = 26;
36298
- return select(getActiveLayerInfo);
36299
- case 26:
36300
- dialogInfo = _context.sent;
36301
- if (filteredLayers.map(function (layer) {
36302
- return layer.title;
36303
- }).includes(dialogInfo.title)) {
36304
- _context.next = 30;
36305
- break;
36306
- }
36307
- _context.next = 30;
36308
- return put(uiActions.setToggleOpenDialog({
36309
- type: DialogTypes.LayerInfo,
36310
- setOpen: false
36311
- }));
36312
- case 30:
36313
- case "end":
36314
- return _context.stop();
36315
- }
36316
- }, _callee);
36317
- })();
36318
- }
36319
- function layerSelectRemoveServiceSaga(capturedAction) {
36320
- var removedService, serviceId, serviceUrl, results, services, servicesEnabled;
36321
- return _regeneratorRuntime().wrap(function layerSelectRemoveServiceSaga$(_context2) {
36322
- while (1) switch (_context2.prev = _context2.next) {
36323
- case 0:
36324
- removedService = capturedAction.payload;
36325
- serviceId = removedService.serviceId, serviceUrl = removedService.serviceUrl;
36326
- _context2.next = 4;
36327
- return select(getActiveServices);
36328
- case 4:
36329
- results = _context2.sent;
36330
- services = results;
36331
- servicesEnabled = Object.values(services).find(function (service) {
36332
- return service === null || service === void 0 ? void 0 : service.enabled;
36333
- });
36334
- if (!(servicesEnabled === undefined)) {
36335
- _context2.next = 10;
36336
- break;
36337
- }
36338
- _context2.next = 10;
36339
- return all(Object.entries(services).map(function (_ref2) {
36340
- var _ref3 = _slicedToArray(_ref2, 1),
36341
- serviceId = _ref3[0];
36342
- return put(layerSelectActions.enableActiveService({
36343
- serviceId: serviceId
36344
- }));
36345
- }));
36346
- case 10:
36347
- _context2.next = 12;
36348
- return put(serviceActions.mapStoreRemoveService({
36349
- id: serviceId,
36350
- serviceUrl: serviceUrl
36351
- }));
36352
- case 12:
36353
- case "end":
36354
- return _context2.stop();
36355
- }
36356
- }, _marked$1);
36357
- }
36358
- function addServiceToLocalStorageSaga(_ref4) {
36359
- var payload = _ref4.payload;
36360
- var scope = payload.scope,
36361
- name = payload.name,
36362
- serviceUrl = payload.serviceUrl,
36363
- _abstract = payload["abstract"];
36364
- if (!isUserAddedService(scope)) {
36365
- return;
36366
- }
36367
- var localStorageServices = getUserAddedServices();
36368
- setUserAddedServices(Object.assign(Object.assign({}, localStorageServices), _defineProperty$1({}, serviceUrl, {
36369
- name: name,
36370
- url: serviceUrl,
36371
- "abstract": _abstract
36372
- })));
36373
- }
36374
- function removeServiceFromLocalStorageSaga(_ref5) {
36375
- var payload = _ref5.payload;
36376
- var serviceUrl = payload.serviceUrl;
36377
- var localStorageServices = getUserAddedServices();
36378
- if (!localStorageServices[serviceUrl]) {
36379
- return;
36380
- }
36381
- var updatedServices = Object.assign({}, localStorageServices);
36382
- delete updatedServices[serviceUrl];
36383
- setUserAddedServices(updatedServices);
36384
- }
36385
- function rootSaga$1() {
36386
- return _regeneratorRuntime().wrap(function rootSaga$(_context3) {
36387
- while (1) switch (_context3.prev = _context3.next) {
36388
- case 0:
36389
- _context3.next = 2;
36390
- return takeEvery$1(layerSelectActions.layerSelectRemoveService.type, layerSelectRemoveServiceSaga);
36391
- case 2:
36392
- _context3.next = 4;
36393
- return takeEvery$1(serviceActions.serviceSetLayers.type, addServiceToLocalStorageSaga);
36394
- case 4:
36395
- _context3.next = 6;
36396
- return takeEvery$1(serviceActions.mapStoreRemoveService.type, removeServiceFromLocalStorageSaga);
36397
- case 6:
36398
- _context3.next = 8;
36399
- return takeEvery$1([uiActions.setToggleOpenDialog.type, uiActions.setActiveMapIdForDialog.type, layerSelectActions.disableActiveService.type, layerSelectActions.toggleFilter.type, layerSelectActions.setSearchFilter.type], layerSelectCloseInfoDialogSaga);
36400
- case 8:
36401
- case "end":
36402
- return _context3.stop();
36403
- }
36404
- }, _marked2$1);
36405
- }
36406
-
36407
- var layerSelectConfig = {
36408
- id: 'layerSelect-module',
36409
- reducersMap: {
36410
- layerSelect: reducer$4
35621
+ syncronizationGroupStore: reducer$4
36411
35622
  },
36412
- sagas: [rootSaga$1]
35623
+ sagas: [rootSaga$3, rootSaga$1]
36413
35624
  };
36414
35625
 
36415
35626
  var _marked = /*#__PURE__*/_regeneratorRuntime().mark(registerMapUISaga),
@@ -36522,7 +35733,7 @@ function rootSaga() {
36522
35733
  var uiModuleConfig = {
36523
35734
  id: 'ui-module',
36524
35735
  reducersMap: {
36525
- ui: reducer$8
35736
+ ui: reducer$6
36526
35737
  },
36527
35738
  sagas: [rootSaga]
36528
35739
  };
@@ -36543,7 +35754,7 @@ var uiModuleConfig = {
36543
35754
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
36544
35755
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
36545
35756
  * */
36546
- var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModuleConfig, layerSelectConfig, snackbarModuleConfig, drawtoolModuleConfig];
35757
+ var coreModuleConfig = [mapStoreModuleConfig, synchronizationGroupConfig, uiModuleConfig, drawtoolModuleConfig];
36547
35758
 
36548
35759
  var shim = {exports: {}};
36549
35760
 
@@ -36805,6 +36016,8 @@ if (process.env.NODE_ENV === 'production') {
36805
36016
  shim.exports = useSyncExternalStoreShim_development;
36806
36017
  }
36807
36018
 
36019
+ var withSelector = {exports: {}};
36020
+
36808
36021
  var withSelector_production_min = {};
36809
36022
 
36810
36023
  /**
@@ -36984,7 +36197,11 @@ if (
36984
36197
  })();
36985
36198
  }
36986
36199
 
36987
- if (process.env.NODE_ENV === 'production') ;
36200
+ if (process.env.NODE_ENV === 'production') {
36201
+ withSelector.exports = withSelector_production_min;
36202
+ } else {
36203
+ withSelector.exports = withSelector_development;
36204
+ }
36988
36205
 
36989
36206
  var reactDom = {exports: {}};
36990
36207
 
@@ -67885,6 +67102,183 @@ function getContext() {
67885
67102
 
67886
67103
  const ReactReduxContext = /*#__PURE__*/getContext();
67887
67104
 
67105
+ /**
67106
+ * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
67107
+ * hook that you should usually not need to call directly.
67108
+ *
67109
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
67110
+ * @returns {Function} A `useReduxContext` hook bound to the specified context.
67111
+ */
67112
+ function createReduxContextHook(context = ReactReduxContext) {
67113
+ return function useReduxContext() {
67114
+ const contextValue = useContext(context);
67115
+
67116
+ if (process.env.NODE_ENV !== 'production' && !contextValue) {
67117
+ throw new Error('could not find react-redux context value; please ensure the component is wrapped in a <Provider>');
67118
+ }
67119
+
67120
+ return contextValue;
67121
+ };
67122
+ }
67123
+ /**
67124
+ * A hook to access the value of the `ReactReduxContext`. This is a low-level
67125
+ * hook that you should usually not need to call directly.
67126
+ *
67127
+ * @returns {any} the value of the `ReactReduxContext`
67128
+ *
67129
+ * @example
67130
+ *
67131
+ * import React from 'react'
67132
+ * import { useReduxContext } from 'react-redux'
67133
+ *
67134
+ * export const CounterComponent = () => {
67135
+ * const { store } = useReduxContext()
67136
+ * return <div>{store.getState()}</div>
67137
+ * }
67138
+ */
67139
+
67140
+ const useReduxContext = /*#__PURE__*/createReduxContextHook();
67141
+
67142
+ const notInitialized = () => {
67143
+ throw new Error('uSES not initialized!');
67144
+ };
67145
+
67146
+ let useSyncExternalStoreWithSelector = notInitialized;
67147
+ const initializeUseSelector = fn => {
67148
+ useSyncExternalStoreWithSelector = fn;
67149
+ };
67150
+
67151
+ const refEquality = (a, b) => a === b;
67152
+ /**
67153
+ * Hook factory, which creates a `useSelector` hook bound to a given context.
67154
+ *
67155
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
67156
+ * @returns {Function} A `useSelector` hook bound to the specified context.
67157
+ */
67158
+
67159
+
67160
+ function createSelectorHook(context = ReactReduxContext) {
67161
+ const useReduxContext$1 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
67162
+ return function useSelector(selector, equalityFnOrOptions = {}) {
67163
+ const {
67164
+ equalityFn = refEquality,
67165
+ stabilityCheck = undefined,
67166
+ noopCheck = undefined
67167
+ } = typeof equalityFnOrOptions === 'function' ? {
67168
+ equalityFn: equalityFnOrOptions
67169
+ } : equalityFnOrOptions;
67170
+
67171
+ if (process.env.NODE_ENV !== 'production') {
67172
+ if (!selector) {
67173
+ throw new Error(`You must pass a selector to useSelector`);
67174
+ }
67175
+
67176
+ if (typeof selector !== 'function') {
67177
+ throw new Error(`You must pass a function as a selector to useSelector`);
67178
+ }
67179
+
67180
+ if (typeof equalityFn !== 'function') {
67181
+ throw new Error(`You must pass a function as an equality function to useSelector`);
67182
+ }
67183
+ }
67184
+
67185
+ const {
67186
+ store,
67187
+ subscription,
67188
+ getServerState,
67189
+ stabilityCheck: globalStabilityCheck,
67190
+ noopCheck: globalNoopCheck
67191
+ } = useReduxContext$1();
67192
+ const firstRun = useRef(true);
67193
+ const wrappedSelector = useCallback({
67194
+ [selector.name](state) {
67195
+ const selected = selector(state);
67196
+
67197
+ if (process.env.NODE_ENV !== 'production') {
67198
+ const finalStabilityCheck = typeof stabilityCheck === 'undefined' ? globalStabilityCheck : stabilityCheck;
67199
+
67200
+ if (finalStabilityCheck === 'always' || finalStabilityCheck === 'once' && firstRun.current) {
67201
+ const toCompare = selector(state);
67202
+
67203
+ if (!equalityFn(selected, toCompare)) {
67204
+ let stack = undefined;
67205
+
67206
+ try {
67207
+ throw new Error();
67208
+ } catch (e) {
67209
+ ({
67210
+ stack
67211
+ } = e);
67212
+ }
67213
+
67214
+ console.warn('Selector ' + (selector.name || 'unknown') + ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' + '\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization', {
67215
+ state,
67216
+ selected,
67217
+ selected2: toCompare,
67218
+ stack
67219
+ });
67220
+ }
67221
+ }
67222
+
67223
+ const finalNoopCheck = typeof noopCheck === 'undefined' ? globalNoopCheck : noopCheck;
67224
+
67225
+ if (finalNoopCheck === 'always' || finalNoopCheck === 'once' && firstRun.current) {
67226
+ // @ts-ignore
67227
+ if (selected === state) {
67228
+ let stack = undefined;
67229
+
67230
+ try {
67231
+ throw new Error();
67232
+ } catch (e) {
67233
+ ({
67234
+ stack
67235
+ } = e);
67236
+ }
67237
+
67238
+ console.warn('Selector ' + (selector.name || 'unknown') + ' returned the root state when called. This can lead to unnecessary rerenders.' + '\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.', {
67239
+ stack
67240
+ });
67241
+ }
67242
+ }
67243
+
67244
+ if (firstRun.current) firstRun.current = false;
67245
+ }
67246
+
67247
+ return selected;
67248
+ }
67249
+
67250
+ }[selector.name], [selector, globalStabilityCheck, stabilityCheck]);
67251
+ const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store.getState, getServerState || store.getState, wrappedSelector, equalityFn);
67252
+ useDebugValue(selectedState);
67253
+ return selectedState;
67254
+ };
67255
+ }
67256
+ /**
67257
+ * A hook to access the redux store's state. This hook takes a selector function
67258
+ * as an argument. The selector is called with the store state.
67259
+ *
67260
+ * This hook takes an optional equality comparison function as the second parameter
67261
+ * that allows you to customize the way the selected state is compared to determine
67262
+ * whether the component needs to be re-rendered.
67263
+ *
67264
+ * @param {Function} selector the selector function
67265
+ * @param {Function=} equalityFn the function that will be used to determine equality
67266
+ *
67267
+ * @returns {any} the selected state
67268
+ *
67269
+ * @example
67270
+ *
67271
+ * import React from 'react'
67272
+ * import { useSelector } from 'react-redux'
67273
+ *
67274
+ * export const CounterComponent = () => {
67275
+ * const counter = useSelector(state => state.counter)
67276
+ * return <div>{counter}</div>
67277
+ * }
67278
+ */
67279
+
67280
+ const useSelector = /*#__PURE__*/createSelectorHook();
67281
+
67888
67282
  var reactIs$1 = {exports: {}};
67889
67283
 
67890
67284
  var reactIs_production_min$1 = {};
@@ -68563,7 +67957,85 @@ function Provider({
68563
67957
  }, children);
68564
67958
  }
68565
67959
 
67960
+ /**
67961
+ * Hook factory, which creates a `useStore` hook bound to a given context.
67962
+ *
67963
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
67964
+ * @returns {Function} A `useStore` hook bound to the specified context.
67965
+ */
67966
+
67967
+ function createStoreHook(context = ReactReduxContext) {
67968
+ const useReduxContext$1 = // @ts-ignore
67969
+ context === ReactReduxContext ? useReduxContext : // @ts-ignore
67970
+ createReduxContextHook(context);
67971
+ return function useStore() {
67972
+ const {
67973
+ store
67974
+ } = useReduxContext$1(); // @ts-ignore
67975
+
67976
+ return store;
67977
+ };
67978
+ }
67979
+ /**
67980
+ * A hook to access the redux store.
67981
+ *
67982
+ * @returns {any} the redux store
67983
+ *
67984
+ * @example
67985
+ *
67986
+ * import React from 'react'
67987
+ * import { useStore } from 'react-redux'
67988
+ *
67989
+ * export const ExampleComponent = () => {
67990
+ * const store = useStore()
67991
+ * return <div>{store.getState()}</div>
67992
+ * }
67993
+ */
67994
+
67995
+ const useStore = /*#__PURE__*/createStoreHook();
67996
+
67997
+ /**
67998
+ * Hook factory, which creates a `useDispatch` hook bound to a given context.
67999
+ *
68000
+ * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
68001
+ * @returns {Function} A `useDispatch` hook bound to the specified context.
68002
+ */
68003
+
68004
+ function createDispatchHook(context = ReactReduxContext) {
68005
+ const useStore$1 = // @ts-ignore
68006
+ context === ReactReduxContext ? useStore : createStoreHook(context);
68007
+ return function useDispatch() {
68008
+ const store = useStore$1(); // @ts-ignore
68009
+
68010
+ return store.dispatch;
68011
+ };
68012
+ }
68013
+ /**
68014
+ * A hook to access the redux `dispatch` function.
68015
+ *
68016
+ * @returns {any|function} redux store's `dispatch` function
68017
+ *
68018
+ * @example
68019
+ *
68020
+ * import React, { useCallback } from 'react'
68021
+ * import { useDispatch } from 'react-redux'
68022
+ *
68023
+ * export const CounterComponent = ({ value }) => {
68024
+ * const dispatch = useDispatch()
68025
+ * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
68026
+ * return (
68027
+ * <div>
68028
+ * <span>{value}</span>
68029
+ * <button onClick={increaseCounter}>Increase counter</button>
68030
+ * </div>
68031
+ * )
68032
+ * }
68033
+ */
68034
+
68035
+ const useDispatch = /*#__PURE__*/createDispatchHook();
68036
+
68566
68037
  // The primary entry point assumes we're working with standard ReactDOM/RN, but
68038
+ initializeUseSelector(withSelector.exports.useSyncExternalStoreWithSelector);
68567
68039
  // with standard React renderers (ReactDOM, React Native)
68568
68040
 
68569
68041
  setBatch(reactDom.exports.unstable_batchedUpdates);
@@ -68614,4 +68086,105 @@ var ThemeStoreProvider = function ThemeStoreProvider(_ref2) {
68614
68086
  }, children));
68615
68087
  };
68616
68088
 
68617
- export { ThemeStoreProvider, appActions, appModuleConfig, coreModuleConfig, createStore, 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, getSingularDrawtoolDrawLayerId, getUserAddedServices, initialState$6 as initialState, layerActions, reducer$9 as layerReducer, layerSelectActions, initialState$4 as layerSelectInitialState, reducer$4 as layerSelectReducer, 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, reducer$3 as snackbarReducer, rootSaga$4 as snackbarSaga, 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 };
68089
+ /* *
68090
+ * Licensed under the Apache License, Version 2.0 (the "License");
68091
+ * you may not use this file except in compliance with the License.
68092
+ * You may obtain a copy of the License at
68093
+ *
68094
+ * http://www.apache.org/licenses/LICENSE-2.0
68095
+ *
68096
+ * Unless required by applicable law or agreed to in writing, software
68097
+ * distributed under the License is distributed on an "AS IS" BASIS,
68098
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
68099
+ * See the License for the specific language governing permissions and
68100
+ * limitations under the License.
68101
+ *
68102
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
68103
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
68104
+ * */
68105
+ var useSetupDialog = function useSetupDialog(dialogType) {
68106
+ var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'app';
68107
+ var dispatch = useDispatch();
68108
+ var onCloseDialog = useCallback(function () {
68109
+ dispatch(uiActions.setToggleOpenDialog({
68110
+ type: dialogType,
68111
+ setOpen: false
68112
+ }));
68113
+ }, [dialogType, dispatch]);
68114
+ var mapId = useSelector(function (store) {
68115
+ return getDialogMapId(store, dialogType);
68116
+ });
68117
+ var isMapPresent = useSelector(function (store) {
68118
+ return getIsMapPresent(store, mapId);
68119
+ });
68120
+ // Check to ensure the currently active map is still present on screen - if not, close the dialog
68121
+ // exception for timeseries, since we dont need a map to show the timeseries view.
68122
+ useEffect(function () {
68123
+ if (mapId !== '' && !isMapPresent && !(dialogType === DialogTypes.TimeSeriesManager || dialogType === DialogTypes.TimeSeriesSelect)) {
68124
+ onCloseDialog();
68125
+ }
68126
+ }, [mapId, isMapPresent, onCloseDialog, dialogType]);
68127
+ var registerDialog = useCallback(function () {
68128
+ dispatch(uiActions.registerDialog({
68129
+ type: dialogType,
68130
+ setOpen: false,
68131
+ source: source
68132
+ }));
68133
+ }, [dialogType, dispatch, source]);
68134
+ var unregisterDialog = useCallback(function () {
68135
+ dispatch(uiActions.unregisterDialog({
68136
+ type: dialogType
68137
+ }));
68138
+ }, [dialogType, dispatch]);
68139
+ // Register this dialog in the store
68140
+ useEffect(function () {
68141
+ registerDialog();
68142
+ return function () {
68143
+ unregisterDialog();
68144
+ };
68145
+ // eslint-disable-next-line react-hooks/exhaustive-deps
68146
+ }, []);
68147
+ var uiIsOrderedOnTop = useSelector(function (store) {
68148
+ return getDialogIsOrderedOnTop(store, dialogType);
68149
+ });
68150
+ var setDialogOrder = useCallback(function () {
68151
+ if (!uiIsOrderedOnTop) {
68152
+ dispatch(uiActions.orderDialog({
68153
+ type: dialogType
68154
+ }));
68155
+ }
68156
+ }, [dialogType, dispatch, uiIsOrderedOnTop]);
68157
+ var dialogOrder = useSelector(function (store) {
68158
+ return getDialogOrder(store, dialogType);
68159
+ });
68160
+ var uiSource = useSelector(function (store) {
68161
+ return getDialogSource(store, dialogType);
68162
+ });
68163
+ var isDialogOpen = useSelector(function (store) {
68164
+ return getisDialogOpen(store, dialogType);
68165
+ });
68166
+ var uiIsLoading = useSelector(function (store) {
68167
+ return getDialogIsLoading(store, dialogType);
68168
+ });
68169
+ var uiError = useSelector(function (store) {
68170
+ return getDialogError(store, dialogType);
68171
+ });
68172
+ var setFocused = function setFocused(focused) {
68173
+ dispatch(uiActions.setDialogFocused({
68174
+ type: dialogType,
68175
+ focused: focused
68176
+ }));
68177
+ };
68178
+ return {
68179
+ setDialogOrder: setDialogOrder,
68180
+ dialogOrder: dialogOrder,
68181
+ onCloseDialog: onCloseDialog,
68182
+ uiSource: uiSource,
68183
+ isDialogOpen: isDialogOpen,
68184
+ uiIsLoading: uiIsLoading,
68185
+ uiError: uiError,
68186
+ setFocused: setFocused
68187
+ };
68188
+ };
68189
+
68190
+ export { ThemeStoreProvider, appActions, appModuleConfig, coreModuleConfig, createStore, drawtoolActions, drawtoolModuleConfig, reducer as drawtoolReducer, selectors as drawtoolSelectors, filterLayers$1 as filterLayers, genericActions, rootSaga$3 as genericSaga, selectors$3 as genericSelectors, types$1 as genericTypes, getSingularDrawtoolDrawLayerId, initialState$4 as initialState, layerActions, reducer$7 as layerReducer, selectors$6 as layerSelectors, types$5 as layerTypes, utils$2 as layerUtils, mapActions, constants$1 as mapConstants, enums as mapEnums, selectors$2 as mapSelectors, mapStoreActions, mapStoreModuleConfig, mapStoreReducers, types$4 as mapTypes, mapUtils, routerActions, routerModuleConfig, utils as routerUtils, selectorMemoizationOptions, serviceActions, selectors$1 as serviceSelectors, types as serviceTypes, storeTestSettings, storeTestUtils, utils$1 as storeUtils, constants as syncConstants, actions as syncGroupsActions, reducer$4 as syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$2 as syncGroupsTypes, types$2 as types, uiActions, uiModuleConfig, reducer$6 as uiReducer, selectors$5 as uiSelectors, types$3 as uiTypes, useSetupDialog, reducer$5 as webmapReducer };