@opengeoweb/store 14.4.0 → 14.5.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 (54) hide show
  1. package/index.esm.js +2188 -2205
  2. package/package.json +6 -6
  3. package/src/store/drawingTool/listener.d.ts +2 -2
  4. package/src/store/drawingTool/reducer.d.ts +2 -2
  5. package/src/store/drawingTool/reducer.spec.d.ts +1 -1
  6. package/src/store/generic/actions.d.ts +1 -1
  7. package/src/store/generic/hooks.d.ts +1 -1
  8. package/src/store/generic/index.d.ts +1 -1
  9. package/src/store/generic/listener.d.ts +1 -1
  10. package/src/store/generic/loadingIndicator/reducer.d.ts +2 -2
  11. package/src/store/generic/loadingIndicator/selectors.d.ts +1 -1
  12. package/src/store/generic/loadingIndicator/types.d.ts +1 -1
  13. package/src/store/generic/syncGroups/__mocks__/mockState.d.ts +1 -1
  14. package/src/store/generic/syncGroups/listener.d.ts +1 -1
  15. package/src/store/generic/syncGroups/reducer.d.ts +2 -2
  16. package/src/store/generic/syncGroups/selector.d.ts +2 -2
  17. package/src/store/generic/syncGroups/selectors.d.ts +1 -1
  18. package/src/store/generic/syncGroups/types.d.ts +5 -4
  19. package/src/store/generic/syncGroups/utils.d.ts +4 -4
  20. package/src/store/generic/synchronizationActions/types.d.ts +2 -2
  21. package/src/store/generic/types.d.ts +2 -2
  22. package/src/store/map/layer/listeners.d.ts +1 -1
  23. package/src/store/map/layer/reducer.d.ts +3 -3
  24. package/src/store/map/layer/selectors.d.ts +2 -1
  25. package/src/store/map/layer/types.d.ts +6 -6
  26. package/src/store/map/layer/utils.d.ts +2 -2
  27. package/src/store/map/map/actions.d.ts +1 -1
  28. package/src/store/map/map/filterLayers.d.ts +1 -1
  29. package/src/store/map/map/listener.d.ts +2 -2
  30. package/src/store/map/map/metronomeListener.d.ts +1 -1
  31. package/src/store/map/map/olMapListenerAnimationUtils.d.ts +3 -3
  32. package/src/store/map/map/reducer.d.ts +4 -4
  33. package/src/store/map/map/replaceLayerIdsToEnsureUniqueLayerIdsInStore.d.ts +1 -1
  34. package/src/store/map/map/selectors.d.ts +3 -3
  35. package/src/store/map/map/types.d.ts +4 -4
  36. package/src/store/map/map/utils.d.ts +5 -5
  37. package/src/store/map/service/WMS111GetCapabilitiesGeoServicesRADAR.d.ts +2 -2
  38. package/src/store/map/service/index.d.ts +1 -1
  39. package/src/store/map/service/listener.d.ts +2 -2
  40. package/src/store/map/service/localStorage.d.ts +1 -1
  41. package/src/store/map/service/reducer.d.ts +3 -3
  42. package/src/store/map/service/selectors.d.ts +2 -2
  43. package/src/store/map/service/types.d.ts +2 -2
  44. package/src/store/map/storeTestSettings.d.ts +3 -2
  45. package/src/store/map/storeTestUtils.d.ts +3 -3
  46. package/src/store/map/types.d.ts +4 -4
  47. package/src/store/mapStore/openlayers/listener.d.ts +1 -1
  48. package/src/store/router/listener.d.ts +1 -1
  49. package/src/store/router/reducer.d.ts +3 -3
  50. package/src/store/router/utils.d.ts +1 -1
  51. package/src/store/ui/reducer.d.ts +2 -2
  52. package/src/store/ui/selectors.d.ts +1 -1
  53. package/src/store/ui/types.d.ts +1 -0
  54. package/src/store/unifyReducerMaps.d.ts +1 -1
package/index.esm.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { createSlice, createSelector, createAction, createListenerMiddleware, isAnyOf, createEntityAdapter, combineReducers, configureStore } from '@reduxjs/toolkit';
2
- import { isEqual, isEmpty, merge, compact } from 'lodash';
3
- import { dateUtils, PROJECTION, defaultDelay } from '@opengeoweb/shared';
2
+ import { isEqual, merge, isEmpty, compact } from 'lodash';
4
3
  import { webmapUtils, parseISO8601IntervalToDateInterval, LayerType, handleDateUtilsISOString, webmapTestSettings, WMLayer, getWMLayerById, WMInvalidDateValues, isProjectionSupported, queryWMSLayers } from '@opengeoweb/webmap';
4
+ import { dateUtils, PROJECTION, defaultDelay } from '@opengeoweb/shared';
5
5
  import { secondsPerPxFromCanvasWidth, defaultTimeSpan, defaultSecondsPerPx, defaultAnimationDelayAtStart, defaultTimeStep, roundWithTimeStep, getSpeedDelay } from '@opengeoweb/time-slider';
6
6
  import { produce } from 'immer';
7
7
  import { getLastEmptyFeatureIndex, getGeoJson, moveFeature, createInterSections, defaultLayers, emptyGeoJSON, defaultIntersectionStyleProperties, addSelectionTypeToGeoJSON, getFeatureCollection } from '@opengeoweb/webmap-react';
8
8
  export { defaultLayers } from '@opengeoweb/webmap-react';
9
+ import { center } from '@turf/turf';
10
+ import { useEffect, useCallback } from 'react';
9
11
  import { useSelector, useDispatch } from 'react-redux';
10
- import { useCallback, useEffect } from 'react';
11
- import * as turf from '@turf/turf';
12
12
  import { metronome } from '@opengeoweb/metronome';
13
13
  import { View, Observable } from 'ol';
14
14
  import { boundingExtent, getCenter } from 'ol/extent';
@@ -709,28 +709,6 @@ var selectors$7 = /*#__PURE__*/Object.freeze({
709
709
  getServices: getServices
710
710
  });
711
711
 
712
- /* *
713
- * Licensed under the Apache License, Version 2.0 (the "License");
714
- * you may not use this file except in compliance with the License.
715
- * You may obtain a copy of the License at
716
- *
717
- * http://www.apache.org/licenses/LICENSE-2.0
718
- *
719
- * Unless required by applicable law or agreed to in writing, software
720
- * distributed under the License is distributed on an "AS IS" BASIS,
721
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
722
- * See the License for the specific language governing permissions and
723
- * limitations under the License.
724
- *
725
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
726
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
727
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
728
- * */
729
-
730
- var types$5 = /*#__PURE__*/Object.freeze({
731
- __proto__: null
732
- });
733
-
734
712
  /* *
735
713
  * Licensed under the Apache License, Version 2.0 (the "License");
736
714
  * you may not use this file except in compliance with the License.
@@ -779,6 +757,90 @@ var isNoIdService = function isNoIdService(param) {
779
757
  return !!(serviceParam !== null && serviceParam !== void 0 && serviceParam.name && serviceParam !== null && serviceParam !== void 0 && serviceParam.url);
780
758
  };
781
759
 
760
+ var replaceLayerIdsToEnsureUniqueLayerIdsInStore = function replaceLayerIdsToEnsureUniqueLayerIdsInStore(layerIds) {
761
+ var layers = layerIds.layers,
762
+ autoTimeStepLayerId = layerIds.autoTimeStepLayerId,
763
+ autoUpdateLayerId = layerIds.autoUpdateLayerId;
764
+ var layerIdIsSameForTimestepAndUpdate = autoTimeStepLayerId && autoTimeStepLayerId === autoUpdateLayerId;
765
+ if (layerIdIsSameForTimestepAndUpdate) {
766
+ var newAutoLayerId = webmapUtils.generateLayerId();
767
+ return {
768
+ layers: replaceLayerIds(layers, autoTimeStepLayerId, newAutoLayerId),
769
+ autoTimeStepLayerId: newAutoLayerId,
770
+ autoUpdateLayerId: newAutoLayerId
771
+ };
772
+ }
773
+ var autoTimeStepLayerIdNew = autoTimeStepLayerId && webmapUtils.generateLayerId();
774
+ var autoUpdateLayerIdNew = autoUpdateLayerId && webmapUtils.generateLayerId();
775
+ var timestepAndUpdateLayerIdsAreProvided = autoTimeStepLayerId && autoUpdateLayerId;
776
+ if (timestepAndUpdateLayerIdsAreProvided) {
777
+ var autoTimeStepLayerIndex = layers.findIndex(function (layer) {
778
+ return layer.id === autoTimeStepLayerId;
779
+ });
780
+ var autoUpdateLayerIndex = layers.findIndex(function (layer) {
781
+ return layer.id === autoUpdateLayerId;
782
+ });
783
+ var _layersWithNewIds = layers.map(function (layer, index) {
784
+ if (layer.id && index === autoTimeStepLayerIndex) {
785
+ return _objectSpread2(_objectSpread2({}, layer), {}, {
786
+ id: autoTimeStepLayerIdNew
787
+ });
788
+ }
789
+ if (layer.id && index === autoUpdateLayerIndex) {
790
+ return _objectSpread2(_objectSpread2({}, layer), {}, {
791
+ id: autoUpdateLayerIdNew
792
+ });
793
+ }
794
+ return _objectSpread2(_objectSpread2({}, layer), {}, {
795
+ id: webmapUtils.generateLayerId()
796
+ });
797
+ });
798
+ return {
799
+ layers: _layersWithNewIds,
800
+ autoTimeStepLayerId: autoTimeStepLayerIdNew,
801
+ autoUpdateLayerId: autoUpdateLayerIdNew
802
+ };
803
+ }
804
+ if (autoTimeStepLayerIdNew) {
805
+ return {
806
+ layers: replaceLayerIds(layers, autoTimeStepLayerId, autoTimeStepLayerIdNew),
807
+ autoTimeStepLayerId: autoTimeStepLayerIdNew
808
+ };
809
+ }
810
+ if (autoUpdateLayerIdNew) {
811
+ return {
812
+ layers: replaceLayerIds(layers, autoUpdateLayerId, autoUpdateLayerIdNew),
813
+ autoUpdateLayerId: autoUpdateLayerIdNew
814
+ };
815
+ }
816
+ // The code below is executed if neither auto timestep
817
+ // nor auto update layer id was provided
818
+ var layersWithNewIds = layers.map(function (layer) {
819
+ return _objectSpread2(_objectSpread2({}, layer), {}, {
820
+ id: webmapUtils.generateLayerId()
821
+ });
822
+ });
823
+ return {
824
+ layers: layersWithNewIds
825
+ };
826
+ };
827
+ function replaceLayerIds(layers, autoLayerIdOld, autoLayerIdNew) {
828
+ var autoLayerIndex = layers.findIndex(function (layer) {
829
+ return layer.id === autoLayerIdOld;
830
+ });
831
+ var layersWithNewIds = layers.map(function (layer, index) {
832
+ if (layer.id && index === autoLayerIndex) {
833
+ return _objectSpread2(_objectSpread2({}, layer), {}, {
834
+ id: autoLayerIdNew
835
+ });
836
+ }
837
+ return _objectSpread2(_objectSpread2({}, layer), {}, {
838
+ id: webmapUtils.generateLayerId()
839
+ });
840
+ });
841
+ return layersWithNewIds;
842
+ }
843
+
782
844
  /* *
783
845
  * Licensed under the Apache License, Version 2.0 (the "License");
784
846
  * you may not use this file except in compliance with the License.
@@ -808,7 +870,7 @@ var AnimationLength;
808
870
  AnimationLength[AnimationLength["Hours24"] = 1440] = "Hours24";
809
871
  })(AnimationLength || (AnimationLength = {}));
810
872
 
811
- var types$4 = /*#__PURE__*/Object.freeze({
873
+ var types$3 = /*#__PURE__*/Object.freeze({
812
874
  __proto__: null,
813
875
  get AnimationLength () { return AnimationLength; }
814
876
  });
@@ -1131,7 +1193,7 @@ var generateAnimationList = function generateAnimationList(unixAnimationStart, u
1131
1193
  * @returns An array of ISO8601 intervals
1132
1194
  */
1133
1195
  var parseTimeDimToISO8601Interval = function parseTimeDimToISO8601Interval(timeInterval) {
1134
- if (!timeInterval || !timeInterval.includes('/')) {
1196
+ if (!(timeInterval !== null && timeInterval !== void 0 && timeInterval.includes('/'))) {
1135
1197
  return [];
1136
1198
  }
1137
1199
  var intervalList = timeInterval.split(',').map(function (interval) {
@@ -1181,89 +1243,30 @@ var utils$2 = /*#__PURE__*/Object.freeze({
1181
1243
  produceTimeSliderTimeSpan: produceTimeSliderTimeSpan
1182
1244
  });
1183
1245
 
1184
- var replaceLayerIdsToEnsureUniqueLayerIdsInStore = function replaceLayerIdsToEnsureUniqueLayerIdsInStore(layerIds) {
1185
- var layers = layerIds.layers,
1186
- autoTimeStepLayerId = layerIds.autoTimeStepLayerId,
1187
- autoUpdateLayerId = layerIds.autoUpdateLayerId;
1188
- var layerIdIsSameForTimestepAndUpdate = autoTimeStepLayerId && autoTimeStepLayerId === autoUpdateLayerId;
1189
- if (layerIdIsSameForTimestepAndUpdate) {
1190
- var newAutoLayerId = webmapUtils.generateLayerId();
1191
- return {
1192
- layers: replaceLayerIds(layers, autoTimeStepLayerId, newAutoLayerId),
1193
- autoTimeStepLayerId: newAutoLayerId,
1194
- autoUpdateLayerId: newAutoLayerId
1195
- };
1196
- }
1197
- var autoTimeStepLayerIdNew = autoTimeStepLayerId && webmapUtils.generateLayerId();
1198
- var autoUpdateLayerIdNew = autoUpdateLayerId && webmapUtils.generateLayerId();
1199
- var timestepAndUpdateLayerIdsAreProvided = autoTimeStepLayerId && autoUpdateLayerId;
1200
- if (timestepAndUpdateLayerIdsAreProvided) {
1201
- var autoTimeStepLayerIndex = layers.findIndex(function (layer) {
1202
- return layer.id === autoTimeStepLayerId;
1203
- });
1204
- var autoUpdateLayerIndex = layers.findIndex(function (layer) {
1205
- return layer.id === autoUpdateLayerId;
1206
- });
1207
- var _layersWithNewIds = layers.map(function (layer, index) {
1208
- if (layer.id && index === autoTimeStepLayerIndex) {
1209
- return _objectSpread2(_objectSpread2({}, layer), {}, {
1210
- id: autoTimeStepLayerIdNew
1211
- });
1212
- }
1213
- if (layer.id && index === autoUpdateLayerIndex) {
1214
- return _objectSpread2(_objectSpread2({}, layer), {}, {
1215
- id: autoUpdateLayerIdNew
1216
- });
1217
- }
1218
- return _objectSpread2(_objectSpread2({}, layer), {}, {
1219
- id: webmapUtils.generateLayerId()
1220
- });
1221
- });
1222
- return {
1223
- layers: _layersWithNewIds,
1224
- autoTimeStepLayerId: autoTimeStepLayerIdNew,
1225
- autoUpdateLayerId: autoUpdateLayerIdNew
1226
- };
1227
- }
1228
- if (autoTimeStepLayerIdNew) {
1229
- return {
1230
- layers: replaceLayerIds(layers, autoTimeStepLayerId, autoTimeStepLayerIdNew),
1231
- autoTimeStepLayerId: autoTimeStepLayerIdNew
1232
- };
1233
- }
1234
- if (autoUpdateLayerIdNew) {
1235
- return {
1236
- layers: replaceLayerIds(layers, autoUpdateLayerId, autoUpdateLayerIdNew),
1237
- autoUpdateLayerId: autoUpdateLayerIdNew
1238
- };
1239
- }
1240
- // The code below is executed if neither auto timestep
1241
- // nor auto update layer id was provided
1242
- var layersWithNewIds = layers.map(function (layer) {
1243
- return _objectSpread2(_objectSpread2({}, layer), {}, {
1244
- id: webmapUtils.generateLayerId()
1245
- });
1246
- });
1247
- return {
1248
- layers: layersWithNewIds
1249
- };
1250
- };
1251
- function replaceLayerIds(layers, autoLayerIdOld, autoLayerIdNew) {
1252
- var autoLayerIndex = layers.findIndex(function (layer) {
1253
- return layer.id === autoLayerIdOld;
1254
- });
1255
- var layersWithNewIds = layers.map(function (layer, index) {
1256
- if (layer.id && index === autoLayerIndex) {
1257
- return _objectSpread2(_objectSpread2({}, layer), {}, {
1258
- id: autoLayerIdNew
1259
- });
1260
- }
1261
- return _objectSpread2(_objectSpread2({}, layer), {}, {
1262
- id: webmapUtils.generateLayerId()
1263
- });
1264
- });
1265
- return layersWithNewIds;
1266
- }
1246
+ /* *
1247
+ * Licensed under the Apache License, Version 2.0 (the "License");
1248
+ * you may not use this file except in compliance with the License.
1249
+ * You may obtain a copy of the License at
1250
+ *
1251
+ * http://www.apache.org/licenses/LICENSE-2.0
1252
+ *
1253
+ * Unless required by applicable law or agreed to in writing, software
1254
+ * distributed under the License is distributed on an "AS IS" BASIS,
1255
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1256
+ * See the License for the specific language governing permissions and
1257
+ * limitations under the License.
1258
+ *
1259
+ * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1260
+ * Copyright 2022 - Finnish Meteorological Institute (FMI)
1261
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1262
+ * */
1263
+ /**
1264
+ * These actions causes circular dependency if they are defined in the reducer.ts file.
1265
+ * Therefor they are instead added to this file
1266
+ * https://redux-toolkit.js.org/usage/usage-guide#exporting-and-using-slices
1267
+ */
1268
+ var mapChangeDimension = createAction('MAP_CHANGE_DIMENSION');
1269
+ var setMapPreset = createAction('SET_MAP_PRESET');
1267
1270
 
1268
1271
  /* *
1269
1272
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -1366,48 +1369,148 @@ var setLayerActionSync = createAction('GENERIC_SYNC_SETLAYERACTIONS', function (
1366
1369
  };
1367
1370
  });
1368
1371
 
1369
- /* *
1370
- * Licensed under the Apache License, Version 2.0 (the "License");
1371
- * you may not use this file except in compliance with the License.
1372
- * You may obtain a copy of the License at
1373
- *
1374
- * http://www.apache.org/licenses/LICENSE-2.0
1375
- *
1376
- * Unless required by applicable law or agreed to in writing, software
1377
- * distributed under the License is distributed on an "AS IS" BASIS,
1378
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1379
- * See the License for the specific language governing permissions and
1380
- * limitations under the License.
1381
- *
1382
- * Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1383
- * Copyright 2022 - Finnish Meteorological Institute (FMI)
1384
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1385
- * */
1386
- /**
1387
- * These actions causes circular dependency if they are defined in the reducer.ts file.
1388
- * Therefor they are instead added to this file
1389
- * https://redux-toolkit.js.org/usage/usage-guide#exporting-and-using-slices
1390
- */
1391
- var mapChangeDimension = createAction('MAP_CHANGE_DIMENSION');
1392
- var setMapPreset = createAction('SET_MAP_PRESET');
1393
-
1394
- /* *
1395
- * Licensed under the Apache License, Version 2.0 (the "License");
1396
- * you may not use this file except in compliance with the License.
1397
- * You may obtain a copy of the License at
1398
- *
1399
- * http://www.apache.org/licenses/LICENSE-2.0
1400
- *
1401
- * Unless required by applicable law or agreed to in writing, software
1402
- * distributed under the License is distributed on an "AS IS" BASIS,
1403
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1404
- * See the License for the specific language governing permissions and
1405
- * limitations under the License.
1406
- *
1407
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1408
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
1409
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1410
- * */
1372
+ var moveToTop = function moveToTop(list, element) {
1373
+ var filteredList = list.filter(function (item) {
1374
+ return item !== element;
1375
+ });
1376
+ var newOrder = [element].concat(_toConsumableArray(filteredList));
1377
+ return newOrder;
1378
+ };
1379
+ var createUIDialogElement = function createUIDialogElement(_ref) {
1380
+ var activeMapId = _ref.activeMapId,
1381
+ type = _ref.type,
1382
+ setOpen = _ref.setOpen,
1383
+ _ref$source = _ref.source,
1384
+ source = _ref$source === void 0 ? 'app' : _ref$source,
1385
+ sourcePanelId = _ref.sourcePanelId;
1386
+ return {
1387
+ activeMapId: activeMapId,
1388
+ isOpen: setOpen,
1389
+ type: type,
1390
+ source: source,
1391
+ isLoading: false,
1392
+ error: undefined,
1393
+ sourcePanelId: sourcePanelId
1394
+ };
1395
+ };
1396
+ var initialState$6 = {
1397
+ order: [],
1398
+ dialogs: {},
1399
+ activeWindowId: undefined
1400
+ };
1401
+ var slice$7 = createSlice({
1402
+ initialState: initialState$6,
1403
+ name: 'uiReducer',
1404
+ reducers: {
1405
+ registerDialog: function registerDialog(draft, action) {
1406
+ var type = action.payload.type;
1407
+ var activeMapId = action.payload.mapId ? action.payload.mapId : '';
1408
+ var setOpen = action.payload.setOpen ? action.payload.setOpen : false;
1409
+ var source = action.payload.source ? action.payload.source : 'app';
1410
+ if (!Object.keys(draft.dialogs).includes(type)) {
1411
+ draft.dialogs[type] = createUIDialogElement({
1412
+ activeMapId: activeMapId,
1413
+ type: type,
1414
+ setOpen: setOpen,
1415
+ source: source
1416
+ });
1417
+ }
1418
+ // register dialog to order
1419
+ if (!draft.order.includes(type)) {
1420
+ draft.order.push(type);
1421
+ }
1422
+ },
1423
+ unregisterDialog: function unregisterDialog(draft, action) {
1424
+ var type = action.payload.type;
1425
+ if (draft.dialogs[type]) {
1426
+ delete draft.dialogs[type];
1427
+ draft.order = draft.order.filter(function (item) {
1428
+ return item !== type;
1429
+ });
1430
+ }
1431
+ },
1432
+ setActiveMapIdForDialog: function setActiveMapIdForDialog(draft, action) {
1433
+ var _action$payload = action.payload,
1434
+ type = _action$payload.type,
1435
+ mapId = _action$payload.mapId,
1436
+ source = _action$payload.source;
1437
+ if (!draft.dialogs[type]) {
1438
+ return;
1439
+ }
1440
+ var isOpen = action.payload.setOpen !== undefined ? action.payload.setOpen : draft.dialogs[type].isOpen;
1441
+ draft.dialogs[type].activeMapId = mapId;
1442
+ draft.dialogs[type].isOpen = isOpen;
1443
+ draft.dialogs[type].source = source;
1444
+ if (isOpen) {
1445
+ draft.order = moveToTop(draft.order, type);
1446
+ }
1447
+ },
1448
+ setToggleOpenDialog: function setToggleOpenDialog(draft, action) {
1449
+ var _action$payload2 = action.payload,
1450
+ type = _action$payload2.type,
1451
+ setOpen = _action$payload2.setOpen,
1452
+ sourcePanelId = _action$payload2.sourcePanelId;
1453
+ if (!draft.dialogs[type]) {
1454
+ return;
1455
+ }
1456
+ draft.dialogs[type].isOpen = setOpen;
1457
+ if (sourcePanelId) {
1458
+ draft.dialogs[type].sourcePanelId = sourcePanelId;
1459
+ }
1460
+ if (setOpen) {
1461
+ draft.order = moveToTop(draft.order, type);
1462
+ }
1463
+ },
1464
+ orderDialog: function orderDialog(draft, action) {
1465
+ var type = action.payload.type;
1466
+ draft.order = moveToTop(draft.order, type);
1467
+ },
1468
+ setActiveWindowId: function setActiveWindowId(draft, action) {
1469
+ var activeWindowId = action.payload.activeWindowId;
1470
+ draft.activeWindowId = activeWindowId;
1471
+ },
1472
+ toggleIsLoadingDialog: function toggleIsLoadingDialog(draft, action) {
1473
+ var _action$payload3 = action.payload,
1474
+ isLoading = _action$payload3.isLoading,
1475
+ type = _action$payload3.type;
1476
+ draft.dialogs[type].isLoading = isLoading;
1477
+ },
1478
+ setErrorDialog: function setErrorDialog(draft, action) {
1479
+ var _action$payload4 = action.payload,
1480
+ error = _action$payload4.error,
1481
+ type = _action$payload4.type;
1482
+ draft.dialogs[type].error = error;
1483
+ },
1484
+ closeDialogsForMapId: function closeDialogsForMapId(draft, action) {
1485
+ var mapId = action.payload.mapId;
1486
+ Object.keys(draft.dialogs).forEach(function (key) {
1487
+ if (draft.dialogs[key].activeMapId === mapId) {
1488
+ draft.dialogs[key].isOpen = false;
1489
+ }
1490
+ });
1491
+ }
1492
+ }
1493
+ });
1494
+ var uiReducer = slice$7.reducer,
1495
+ uiActions = slice$7.actions;
1496
+
1497
+ /* *
1498
+ * Licensed under the Apache License, Version 2.0 (the "License");
1499
+ * you may not use this file except in compliance with the License.
1500
+ * You may obtain a copy of the License at
1501
+ *
1502
+ * http://www.apache.org/licenses/LICENSE-2.0
1503
+ *
1504
+ * Unless required by applicable law or agreed to in writing, software
1505
+ * distributed under the License is distributed on an "AS IS" BASIS,
1506
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1507
+ * See the License for the specific language governing permissions and
1508
+ * limitations under the License.
1509
+ *
1510
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1511
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
1512
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
1513
+ * */
1411
1514
  var LayerStatus;
1412
1515
  (function (LayerStatus) {
1413
1516
  LayerStatus["default"] = "default";
@@ -1424,7 +1527,7 @@ var LayerActionOrigin;
1424
1527
  LayerActionOrigin["dataExplorer"] = "dataExplorer";
1425
1528
  })(LayerActionOrigin || (LayerActionOrigin = {}));
1426
1529
 
1427
- var types$3 = /*#__PURE__*/Object.freeze({
1530
+ var types$2 = /*#__PURE__*/Object.freeze({
1428
1531
  __proto__: null,
1429
1532
  get LayerActionOrigin () { return LayerActionOrigin; },
1430
1533
  get LayerStatus () { return LayerStatus; }
@@ -1643,7 +1746,7 @@ var createLayer = function createLayer(_ref) {
1643
1746
  useLatestReferenceTime: useLatestReferenceTime
1644
1747
  });
1645
1748
  };
1646
- var initialState$6 = {
1749
+ var initialState$5 = {
1647
1750
  byId: {},
1648
1751
  allIds: [],
1649
1752
  availableBaseLayers: {
@@ -1651,8 +1754,8 @@ var initialState$6 = {
1651
1754
  allIds: []
1652
1755
  }
1653
1756
  };
1654
- var slice$7 = createSlice({
1655
- initialState: initialState$6,
1757
+ var slice$6 = createSlice({
1758
+ initialState: initialState$5,
1656
1759
  name: 'layerReducer',
1657
1760
  reducers: {
1658
1761
  addLayer: function addLayer(draft, action) {
@@ -2103,6 +2206,7 @@ var slice$7 = createSlice({
2103
2206
  }
2104
2207
  },
2105
2208
  updateFeatureProperties: function updateFeatureProperties(draft, action) {
2209
+ var _currentLayer$geojson2;
2106
2210
  var _action$payload18 = action.payload,
2107
2211
  layerId = _action$payload18.layerId,
2108
2212
  properties = _action$payload18.properties,
@@ -2111,7 +2215,7 @@ var slice$7 = createSlice({
2111
2215
  if (!currentLayer) {
2112
2216
  return;
2113
2217
  }
2114
- if (currentLayer.geojson && currentLayer.geojson.features.length) {
2218
+ if ((_currentLayer$geojson2 = currentLayer.geojson) !== null && _currentLayer$geojson2 !== void 0 && _currentLayer$geojson2.features.length) {
2115
2219
  currentLayer.geojson.features.forEach(function (_, index) {
2116
2220
  if (selectedFeatureIndex === undefined || selectedFeatureIndex === index) {
2117
2221
  Object.keys(properties).forEach(function (key) {
@@ -2249,199 +2353,74 @@ var slice$7 = createSlice({
2249
2353
  });
2250
2354
  }
2251
2355
  });
2252
- var layerReducer = slice$7.reducer,
2253
- layerActions = slice$7.actions;
2356
+ var layerReducer = slice$6.reducer,
2357
+ layerActions = slice$6.actions;
2254
2358
 
2255
- var moveToTop = function moveToTop(list, element) {
2256
- var filteredList = list.filter(function (item) {
2257
- return item !== element;
2359
+ /**
2360
+ * Checks if the layer id is already taken in one of the maps.
2361
+ * @param state The WebMapState
2362
+ * @param layerIdToCheck The layerId to check
2363
+ * @returns true if the layerId is already taken somewhere else.
2364
+ */
2365
+ var checkIfMapLayerIdIsAlreadyTaken = function checkIfMapLayerIdIsAlreadyTaken(state, layerId) {
2366
+ return state.allIds.some(function (mapId) {
2367
+ var map = state.byId[mapId];
2368
+ var doesLayeridExist = function doesLayeridExist(layers) {
2369
+ return layers === null || layers === void 0 ? void 0 : layers.some(function (id) {
2370
+ return id === layerId;
2371
+ });
2372
+ };
2373
+ return doesLayeridExist(map.mapLayers) || doesLayeridExist(map.overLayers) || doesLayeridExist(map.baseLayers) || doesLayeridExist(map.featureLayers);
2258
2374
  });
2259
- var newOrder = [element].concat(_toConsumableArray(filteredList));
2260
- return newOrder;
2261
2375
  };
2262
- var createUIDialogElement = function createUIDialogElement(_ref) {
2263
- var activeMapId = _ref.activeMapId,
2264
- type = _ref.type,
2265
- setOpen = _ref.setOpen,
2266
- _ref$source = _ref.source,
2267
- source = _ref$source === void 0 ? 'app' : _ref$source,
2268
- sourcePanelId = _ref.sourcePanelId;
2269
- return {
2270
- activeMapId: activeMapId,
2271
- isOpen: setOpen,
2272
- type: type,
2273
- source: source,
2274
- isLoading: false,
2275
- error: undefined,
2276
- sourcePanelId: sourcePanelId
2277
- };
2376
+ /**
2377
+ * Addes id's to the layer object. All layers need to have an id for referring.
2378
+ * @param layers
2379
+ */
2380
+ var createLayersWithIds = function createLayersWithIds(state, layers) {
2381
+ if (!layers) {
2382
+ return layers;
2383
+ }
2384
+ return produce(layers, function (draft) {
2385
+ var _iterator = _createForOfIteratorHelper(draft),
2386
+ _step;
2387
+ try {
2388
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2389
+ var layer = _step.value;
2390
+ if (!layer.id) {
2391
+ console.warn("Warning: Layer id was not provided");
2392
+ }
2393
+ }
2394
+ } catch (err) {
2395
+ _iterator.e(err);
2396
+ } finally {
2397
+ _iterator.f();
2398
+ }
2399
+ });
2278
2400
  };
2279
- var initialState$5 = {
2280
- order: [],
2281
- dialogs: {},
2282
- activeWindowId: undefined
2401
+ var initialState$4 = {
2402
+ byId: {},
2403
+ allIds: []
2283
2404
  };
2284
- var slice$6 = createSlice({
2285
- initialState: initialState$5,
2286
- name: 'uiReducer',
2405
+ var slice$5 = createSlice({
2406
+ initialState: initialState$4,
2407
+ name: 'mapReducer',
2287
2408
  reducers: {
2288
- registerDialog: function registerDialog(draft, action) {
2289
- var type = action.payload.type;
2290
- var activeMapId = action.payload.mapId ? action.payload.mapId : '';
2291
- var setOpen = action.payload.setOpen ? action.payload.setOpen : false;
2292
- var source = action.payload.source ? action.payload.source : 'app';
2293
- if (!Object.keys(draft.dialogs).includes(type)) {
2294
- draft.dialogs[type] = createUIDialogElement({
2295
- activeMapId: activeMapId,
2296
- type: type,
2297
- setOpen: setOpen,
2298
- source: source
2409
+ registerMap: function registerMap(draft, action) {
2410
+ var mapId = action.payload.mapId;
2411
+ if (!draft.allIds.includes(mapId)) {
2412
+ draft.byId[mapId] = createMap({
2413
+ id: mapId
2299
2414
  });
2300
- }
2301
- // register dialog to order
2302
- if (!draft.order.includes(type)) {
2303
- draft.order.push(type);
2415
+ draft.allIds.push(mapId);
2304
2416
  }
2305
2417
  },
2306
- unregisterDialog: function unregisterDialog(draft, action) {
2307
- var type = action.payload.type;
2308
- if (draft.dialogs[type]) {
2309
- delete draft.dialogs[type];
2310
- draft.order = draft.order.filter(function (item) {
2311
- return item !== type;
2312
- });
2313
- }
2314
- },
2315
- setActiveMapIdForDialog: function setActiveMapIdForDialog(draft, action) {
2316
- var _action$payload = action.payload,
2317
- type = _action$payload.type,
2318
- mapId = _action$payload.mapId,
2319
- source = _action$payload.source;
2320
- if (!draft.dialogs[type]) {
2321
- return;
2322
- }
2323
- var isOpen = action.payload.setOpen !== undefined ? action.payload.setOpen : draft.dialogs[type].isOpen;
2324
- draft.dialogs[type].activeMapId = mapId;
2325
- draft.dialogs[type].isOpen = isOpen;
2326
- draft.dialogs[type].source = source;
2327
- if (isOpen) {
2328
- draft.order = moveToTop(draft.order, type);
2329
- }
2330
- },
2331
- setToggleOpenDialog: function setToggleOpenDialog(draft, action) {
2332
- var _action$payload2 = action.payload,
2333
- type = _action$payload2.type,
2334
- setOpen = _action$payload2.setOpen,
2335
- sourcePanelId = _action$payload2.sourcePanelId;
2336
- if (!draft.dialogs[type]) {
2337
- return;
2338
- }
2339
- draft.dialogs[type].isOpen = setOpen;
2340
- if (sourcePanelId) {
2341
- draft.dialogs[type].sourcePanelId = sourcePanelId;
2342
- }
2343
- if (setOpen) {
2344
- draft.order = moveToTop(draft.order, type);
2345
- }
2346
- },
2347
- orderDialog: function orderDialog(draft, action) {
2348
- var type = action.payload.type;
2349
- draft.order = moveToTop(draft.order, type);
2350
- },
2351
- setActiveWindowId: function setActiveWindowId(draft, action) {
2352
- var activeWindowId = action.payload.activeWindowId;
2353
- draft.activeWindowId = activeWindowId;
2354
- },
2355
- toggleIsLoadingDialog: function toggleIsLoadingDialog(draft, action) {
2356
- var _action$payload3 = action.payload,
2357
- isLoading = _action$payload3.isLoading,
2358
- type = _action$payload3.type;
2359
- draft.dialogs[type].isLoading = isLoading;
2360
- },
2361
- setErrorDialog: function setErrorDialog(draft, action) {
2362
- var _action$payload4 = action.payload,
2363
- error = _action$payload4.error,
2364
- type = _action$payload4.type;
2365
- draft.dialogs[type].error = error;
2366
- },
2367
- closeDialogsForMapId: function closeDialogsForMapId(draft, action) {
2368
- var mapId = action.payload.mapId;
2369
- Object.keys(draft.dialogs).forEach(function (key) {
2370
- if (draft.dialogs[key].activeMapId === mapId) {
2371
- draft.dialogs[key].isOpen = false;
2372
- }
2373
- });
2374
- }
2375
- }
2376
- });
2377
- var uiReducer = slice$6.reducer,
2378
- uiActions = slice$6.actions;
2379
-
2380
- /**
2381
- * Checks if the layer id is already taken in one of the maps.
2382
- * @param state The WebMapState
2383
- * @param layerIdToCheck The layerId to check
2384
- * @returns true if the layerId is already taken somewhere else.
2385
- */
2386
- var checkIfMapLayerIdIsAlreadyTaken = function checkIfMapLayerIdIsAlreadyTaken(state, layerId) {
2387
- return state.allIds.some(function (mapId) {
2388
- var map = state.byId[mapId];
2389
- var doesLayeridExist = function doesLayeridExist(layers) {
2390
- return layers && layers.some(function (id) {
2391
- return id === layerId;
2392
- });
2393
- };
2394
- return doesLayeridExist(map.mapLayers) || doesLayeridExist(map.overLayers) || doesLayeridExist(map.baseLayers) || doesLayeridExist(map.featureLayers);
2395
- });
2396
- };
2397
- /**
2398
- * Addes id's to the layer object. All layers need to have an id for referring.
2399
- * @param layers
2400
- */
2401
- var createLayersWithIds = function createLayersWithIds(state, layers) {
2402
- if (!layers) {
2403
- return layers;
2404
- }
2405
- return produce(layers, function (draft) {
2406
- var _iterator = _createForOfIteratorHelper(draft),
2407
- _step;
2408
- try {
2409
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
2410
- var layer = _step.value;
2411
- if (!layer.id) {
2412
- console.warn("Warning: Layer id was not provided");
2413
- }
2414
- }
2415
- } catch (err) {
2416
- _iterator.e(err);
2417
- } finally {
2418
- _iterator.f();
2419
- }
2420
- });
2421
- };
2422
- var initialState$4 = {
2423
- byId: {},
2424
- allIds: []
2425
- };
2426
- var slice$5 = createSlice({
2427
- initialState: initialState$4,
2428
- name: 'mapReducer',
2429
- reducers: {
2430
- registerMap: function registerMap(draft, action) {
2431
- var mapId = action.payload.mapId;
2432
- if (!draft.allIds.includes(mapId)) {
2433
- draft.byId[mapId] = createMap({
2434
- id: mapId
2435
- });
2436
- draft.allIds.push(mapId);
2437
- }
2438
- },
2439
- unregisterMap: function unregisterMap(draft, action) {
2440
- var mapId = action.payload.mapId;
2441
- var mapIndex = draft.allIds.indexOf(mapId);
2442
- if (mapIndex !== -1) {
2443
- delete draft.byId[mapId];
2444
- draft.allIds.splice(mapIndex, 1);
2418
+ unregisterMap: function unregisterMap(draft, action) {
2419
+ var mapId = action.payload.mapId;
2420
+ var mapIndex = draft.allIds.indexOf(mapId);
2421
+ if (mapIndex !== -1) {
2422
+ delete draft.byId[mapId];
2423
+ draft.allIds.splice(mapIndex, 1);
2445
2424
  }
2446
2425
  },
2447
2426
  setStepBackwardOrForward: function setStepBackwardOrForward(_draft, _action) {},
@@ -3051,551 +3030,538 @@ var mapActions = _objectSpread2(_objectSpread2({}, slice$5.actions), {}, {
3051
3030
  });
3052
3031
  var mapReducer = slice$5.reducer;
3053
3032
 
3054
- var layerStore = function layerStore(store) {
3055
- return store === null || store === void 0 ? void 0 : store.layers;
3056
- };
3057
- /**
3058
- * Gets a layer from the layers part of the store by its Id
3033
+ /* *
3034
+ * Licensed under the Apache License, Version 2.0 (the "License");
3035
+ * you may not use this file except in compliance with the License.
3036
+ * You may obtain a copy of the License at
3059
3037
  *
3060
- * Example: layer = getLayerById(store, 'layerId')
3061
- * @param {object} store object from which the layer state will be extracted
3062
- * @param {string} layerId Id of the layer
3063
- * @returns {object} object containing layer information (service, name, style, enabled etc.)
3064
- */
3065
- var getLayerById = createSelector([layerStore, function (layerStore, layerId) {
3066
- return layerId;
3067
- }], function (layerState, layerId) {
3068
- return layerState && layerState.byId && layerState.byId[layerId];
3069
- }, selectorMemoizationOptions);
3070
- /**
3071
- * Determines if layer is present
3038
+ * http://www.apache.org/licenses/LICENSE-2.0
3072
3039
  *
3073
- * @param {object} store store: object - store object
3074
- * @param {string} layerId layerId: string - Id of the layer
3075
- * @returns {boolean} returnType:boolean - true if layer is present
3076
- */
3077
- var getIsLayerPresent = createSelector(getLayerById, function (layer) {
3078
- return !!layer;
3079
- }, selectorMemoizationOptions);
3080
- /**
3081
- * Gets a layer from the layers part of the store by its Id, but without the time dimension. (All other dimensions are still included)
3040
+ * Unless required by applicable law or agreed to in writing, software
3041
+ * distributed under the License is distributed on an "AS IS" BASIS,
3042
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3043
+ * See the License for the specific language governing permissions and
3044
+ * limitations under the License.
3082
3045
  *
3083
- * Example: layer = getLayerByIdWithoutTimeDimension(store, 'layerId')
3084
- * @param {object} store object from which the layer state will be extracted
3085
- * @param {string} layerId Id of the layer
3086
- * @returns {object} object containing layer information (service, name, style, enabled etc.)
3087
- */
3088
- var getLayerByIdWithoutTimeDimension = createSelector([layerStore, function (layerStore, layerId) {
3089
- return layerId;
3090
- }], function (layerState, layerId) {
3091
- var layer = layerState && layerState.byId && layerState.byId[layerId];
3092
- return layer ? produce(layer, function (draftLayer) {
3093
- draftLayer.dimensions = filterNonTimeDimensions(draftLayer.dimensions || []);
3094
- return draftLayer;
3095
- }) : undefined;
3096
- }, selectorMemoizationOptions);
3097
- /**
3098
- * Retrieves all layers indexed by layerId
3046
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3047
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
3048
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
3049
+ * */
3050
+ var IS_LEGEND_OPEN_BY_DEFAULT = false;
3051
+ var SECONDS_IN_DAY = 86400;
3052
+ var SECONDS_IN_HOUR = 3600;
3053
+
3054
+ /* *
3055
+ * Licensed under the Apache License, Version 2.0 (the "License");
3056
+ * you may not use this file except in compliance with the License.
3057
+ * You may obtain a copy of the License at
3099
3058
  *
3100
- * Example: layers = getLayersById(store)
3101
- * @param {object} store store: object - object from which the layers state will be extracted
3102
- * @returns {object} returnType: object - an object of all layers containing layer information (service, name, style, enabled etc.) indexed by layerId
3103
- */
3104
- var getLayersById = createSelector(layerStore, function (store) {
3105
- var _store$byId;
3106
- return (_store$byId = store === null || store === void 0 ? void 0 : store.byId) !== null && _store$byId !== void 0 ? _store$byId : null;
3107
- }, selectorMemoizationOptions);
3108
- /**
3109
- * Retrieves all layerIds
3059
+ * http://www.apache.org/licenses/LICENSE-2.0
3110
3060
  *
3111
- * Example: layerIds = getLayersIds(store)
3112
- * @param {object} store store: object - object from which the layers state will be extracted
3113
- * @returns {array} returnType: array - an array of all layerIds
3114
- */
3115
- var getLayersIds = createSelector(layerStore, function (store) {
3116
- return store ? store.allIds : [];
3117
- }, selectorMemoizationOptions);
3118
- /**
3119
- * Retrieves all layers (including base layers and overlayers)
3061
+ * Unless required by applicable law or agreed to in writing, software
3062
+ * distributed under the License is distributed on an "AS IS" BASIS,
3063
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3064
+ * See the License for the specific language governing permissions and
3065
+ * limitations under the License.
3120
3066
  *
3121
- * Example: layers = getAllLayers(store)
3122
- * @param {object} store store: object - object from which the layers state will be extracted
3123
- * @returns {array} returnType: array - an array of all layers containing layer information (service, name, style, enabled etc.)
3124
- */
3125
- var getAllLayers = createSelector(getLayersIds, getLayersById, function (ids, layers) {
3126
- return ids.map(function (layerId) {
3127
- return layers[layerId];
3128
- });
3129
- }, selectorMemoizationOptions);
3130
- /**
3131
- * Retrieves all layers (including base layers and overlayers) for the given mapId
3067
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3068
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
3069
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3070
+ * */
3071
+ /* Type constants */
3072
+ var SYNCGROUPS_TYPE_SETTIME = 'SYNCGROUPS_TYPE_SETTIME';
3073
+ var SYNCGROUPS_TYPE_SETBBOX = 'SYNCGROUPS_TYPE_SETBBOX';
3074
+ var SYNCGROUPS_TYPE_SETLAYERACTIONS = 'SYNCGROUPS_TYPE_SETLAYERACTIONS';
3075
+ var SYNCGROUPS_SET_VIEW_STATE = 'SYNCGROUPS_SET_VIEW_STATE';
3076
+
3077
+ var constants$2 = /*#__PURE__*/Object.freeze({
3078
+ __proto__: null,
3079
+ SYNCGROUPS_SET_VIEW_STATE: SYNCGROUPS_SET_VIEW_STATE,
3080
+ SYNCGROUPS_TYPE_SETBBOX: SYNCGROUPS_TYPE_SETBBOX,
3081
+ SYNCGROUPS_TYPE_SETLAYERACTIONS: SYNCGROUPS_TYPE_SETLAYERACTIONS,
3082
+ SYNCGROUPS_TYPE_SETTIME: SYNCGROUPS_TYPE_SETTIME
3083
+ });
3084
+
3085
+ /* *
3086
+ * Licensed under the Apache License, Version 2.0 (the "License");
3087
+ * you may not use this file except in compliance with the License.
3088
+ * You may obtain a copy of the License at
3132
3089
  *
3133
- * Example: layers = getLayersByMapId(store, mapId)
3134
- * @param {object} store store: object - object from which the layers state will be extracted
3135
- * @param {string} mapId mapId: string - mapId
3136
- * @returns {array} returnType: ReduxLayer[] - an array of all layers containing layer information (service, name, style, enabled etc.)
3137
- */
3138
- var getLayersByMapId = createSelector(getAllLayers, function (_store, _mapId) {
3139
- return _mapId;
3140
- }, function (layers, mapId) {
3141
- return layers.filter(function (layer) {
3142
- return layer.mapId === mapId;
3143
- });
3144
- }, selectorMemoizationOptions);
3145
- /**
3146
- * Retrieves all layers that aren't base layers and aren't overlayers
3147
- *
3148
- * Example: layers = getLayers(store)
3149
- * @param {object} store store: object - object from which the layers state will be extracted
3150
- * @returns {array} returnType: array - an array of all non-baselayers containing layer information (service, name, style, enabled etc.)
3151
- */
3152
- var getLayers = createSelector(getAllLayers, function (layers) {
3153
- return layers.filter(function (layer) {
3154
- return layer.layerType !== LayerType.baseLayer && layer.layerType !== LayerType.overLayer;
3155
- });
3156
- }, selectorMemoizationOptions);
3157
- /**
3158
- * Retrieves all baselayers
3159
- *
3160
- * Example: layers = getBaseLayers(store)
3161
- * @param {object} store store: object - object from which the layers state will be extracted
3162
- * @returns {array} returnType: array - an array of all baselayers containing layer information (service, name, style, enabled etc.)
3163
- */
3164
- var getBaseLayers = createSelector(getAllLayers, function (layers) {
3165
- return layers.filter(function (layer) {
3166
- return layer.layerType === LayerType.baseLayer;
3167
- });
3168
- }, selectorMemoizationOptions);
3169
- /**
3170
- * Retrieves all overLayers
3171
- *
3172
- * Example: layers = getOverLayers(store)
3173
- * @param {object} store store: object - object from which the layers state will be extracted
3174
- * @returns {array} returnType: array - an array of all overLayers containing layer information (service, name, style, enabled etc.)
3175
- */
3176
- var getOverLayers = createSelector(getAllLayers, function (layers) {
3177
- return layers.filter(function (layer) {
3178
- return layer.layerType === LayerType.overLayer;
3179
- });
3180
- }, selectorMemoizationOptions);
3181
- /**
3182
- * Retrieves all featureLayers
3183
- *
3184
- * Example: layers = getFeatureLayers(store)
3185
- * @param {object} store store: object - object from which the layers state will be extracted
3186
- * @returns {array} returnType: array - an array of all featureLayers
3187
- */
3188
- var getFeatureLayers = createSelector(getAllLayers, function (layers) {
3189
- return layers.filter(function (layer) {
3190
- return layer.layerType === LayerType.featureLayer;
3191
- });
3192
- }, selectorMemoizationOptions);
3193
- /**
3194
- * Gets dimensions of the passed layer
3195
- *
3196
- * Example: layerDimensions = getLayerDimensions(store, 'layerId_1')
3197
- * @param {object} store store: object - object from which the layers state will be extracted
3198
- * @param {string} layerId layerId: string - Id of the layer
3199
- * @returns {array} returnType: Dimension[] - array containing layer dimensions
3200
- */
3201
- var getLayerDimensions = createSelector(getLayerById, function (layer) {
3202
- var _layer$dimensions;
3203
- return (_layer$dimensions = layer === null || layer === void 0 ? void 0 : layer.dimensions) !== null && _layer$dimensions !== void 0 ? _layer$dimensions : [];
3204
- }, selectorMemoizationOptions);
3205
- /**
3206
- * Gets dimensions of the passed layer, excluding the time dimension
3207
- *
3208
- * Example: layerNonTimeDimensions = getLayerNonTimeDimensions(store, 'layerId_1')
3209
- * @param {object} store store: object - object from which the layers state will be extracted
3210
- * @param {string} layerId layerId: string - Id of the layer
3211
- * @returns {array} returnType: Dimension[] - array containing layer dimensions, excluding the time dimension
3212
- */
3213
- var getLayerNonTimeDimensions = createSelector(getLayerDimensions, function (dimensions) {
3214
- return filterNonTimeDimensions(dimensions);
3215
- }, selectorMemoizationOptions);
3216
- /**
3217
- * Gets time dimension of the passed layer
3218
- *
3219
- * Example: timeDimension = getLayerTimeDimension(store, 'layerId_1')
3220
- * @param {object} store store: object - object from which the layers state will be extracted
3221
- * @param {string} layerId layerId: string - Id of the layer
3222
- * @returns {object} returnType: object - object of layer time dimension
3223
- */
3224
- var getLayerTimeDimension = createSelector(getLayerDimensions, function (dimensions) {
3225
- return dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dimension) {
3226
- return dimension.name === 'time';
3227
- });
3228
- }, selectorMemoizationOptions);
3229
- /**
3230
- * Returns a boolean indicating whether the layer has a time dimension
3231
- *
3232
- * Example: layerHasTimeDimension = getLayerHasTimeDimension(store, 'layerId_1')
3233
- * @param {object} store store: object - object from which the layers state will be extracted
3234
- * @param {string} layerId layerId: string - Id of the layer
3235
- * @returns {boolean} returnType: boolean - boolean indicating whether the layer has a time dimension
3236
- */
3237
- var getLayerHasTimeDimension = createSelector(getLayerTimeDimension, function (timeDimension) {
3238
- return !!timeDimension;
3239
- }, selectorMemoizationOptions);
3240
- var getLayerCurrentTime = createSelector(getLayerTimeDimension, function (dimension) {
3241
- return dimension === null || dimension === void 0 ? void 0 : dimension.currentValue;
3242
- }, selectorMemoizationOptions);
3243
- /**
3244
- * Gets specified dimension of the passed layer
3245
- *
3246
- * Example: dimension = getLayerDimension(store, 'layerId_1', 'elevation')
3247
- * @param {object} store store: object - object from which the layers state will be extracted
3248
- * @param {string} layerId layerId: string - Id of the layer
3249
- * @param {string} dimensionName dimensionName: string - name of dimension you want to retrieve the dimension data for
3250
- * @returns {object} returnType: object - object of layer dimension
3251
- */
3252
- var getLayerDimension = createSelector(getLayerDimensions, function (_store, _layerId, dimensionName) {
3253
- return dimensionName;
3254
- }, function (dimensions, dimensionName) {
3255
- return dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dimension) {
3256
- return dimension.name === dimensionName;
3257
- });
3258
- }, selectorMemoizationOptions);
3259
- /**
3260
- * Gets opacity of the passed layer
3261
- *
3262
- * Example: layerOpacity = getLayerOpacity(store, 'layerId_1')
3263
- * @param {object} store store: object - object from which the layers state will be extracted
3264
- * @param {string} layerId layerId: string - Id of the layer
3265
- * @returns {number} returnType: number - opacity as a number (between 0 and 1)
3266
- */
3267
- var getLayerOpacity = createSelector(getLayerById, function (layer) {
3268
- return layer && layer.opacity ? layer.opacity : 0;
3269
- }, selectorMemoizationOptions);
3270
- /**
3271
- * Gets whether a layer is enabled or disabled
3272
- *
3273
- * Example: isLayerEnabled = getLayerEnabled(store, 'layerId_1')
3274
- * @param {object} store store: object - object from which the layers state will be extracted
3275
- * @param {string} layerId layerId: string - Id of the layer
3276
- * @returns {boolean} returnType: boolean - true if enabled, false if disabled
3277
- */
3278
- var getLayerEnabled = createSelector(getLayerById, function (layer) {
3279
- return Boolean(layer === null || layer === void 0 ? void 0 : layer.enabled);
3280
- }, selectorMemoizationOptions);
3281
- /**
3282
- * Gets layer name
3283
- *
3284
- * Example: layerName = getLayerName(store, 'layerId_1')
3285
- * @param {object} store store: object - object from which the layers state will be extracted
3286
- * @param {string} layerId layerId: string - Id of the layer
3287
- * @returns {string} returnType: string - layer name
3288
- */
3289
- var getLayerName = createSelector(getLayerById, function (layer) {
3290
- if (!layer) {
3291
- return '';
3292
- }
3293
- if (layer.layerType === LayerType.edrFeatureLayer && layer.options && layer.options.parameterNames.length) {
3294
- return layer.options.parameterNames[0];
3295
- }
3296
- return (layer === null || layer === void 0 ? void 0 : layer.name) || '';
3297
- }, selectorMemoizationOptions);
3298
- /**
3299
- * Gets layer service
3090
+ * http://www.apache.org/licenses/LICENSE-2.0
3300
3091
  *
3301
- * Example: layerService = getLayerService(store, 'layerId_1')
3302
- * @param {object} store store: object - object from which the layers state will be extracted
3303
- * @param {string} layerId layerId: string - Id of the layer
3304
- * @returns {string} returnType: string - layer service
3305
- */
3306
- var getLayerService = createSelector(getLayerById, function (layer) {
3307
- var _layer$service;
3308
- return (_layer$service = layer === null || layer === void 0 ? void 0 : layer.service) !== null && _layer$service !== void 0 ? _layer$service : '';
3309
- }, selectorMemoizationOptions);
3310
- /**
3311
- * Gets selected style of the passed layer
3092
+ * Unless required by applicable law or agreed to in writing, software
3093
+ * distributed under the License is distributed on an "AS IS" BASIS,
3094
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3095
+ * See the License for the specific language governing permissions and
3096
+ * limitations under the License.
3312
3097
  *
3313
- * Example: layerStyle = getLayerStyle(store, 'layerId_1')
3314
- * @param {object} store store: object - object from which the layers state will be extracted
3315
- * @param {string} layerId layerId: string - Id of the layer
3316
- * @returns {string} returnType: string - style that is currently selected
3317
- */
3318
- var getLayerStyle = createSelector(getLayerById, function (layer) {
3319
- return layer && layer.style ? layer.style : '';
3320
- }, selectorMemoizationOptions);
3098
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3099
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
3100
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3101
+ * */
3321
3102
  /**
3322
- * Gets layer status
3103
+ * The removeInPlace() method modifies an array in place, by removing elements that pass the test implemented by the provided function.
3323
3104
  *
3324
- * Example: layerService = getLayerStatus(store, 'layerId_1')
3325
- * @param {object} store store: object - object from which the layers state will be extracted
3326
- * @param {string} layerId layerId: string - Id of the layer
3327
- * @returns {string} returnType: LayerStatus
3328
- */
3329
- var getLayerStatus = createSelector(getLayerById, function (layer) {
3330
- return layer && layer.status ? layer.status : LayerStatus["default"];
3331
- }, selectorMemoizationOptions);
3332
- /**
3333
- * Gets all available base layers for a map
3105
+ * NOTE: This should only be used on draft properties as provided by the immer produce library, as modifying elements in place is bad practice on non draft variables.
3334
3106
  *
3335
- * Example: availableBaseLayers = getAvailableBaseLayersForMap(store)
3336
- * @param {object} store store: object - object from which the layer state will be extracted
3337
- * @param {string} mapId mapId: string - Id of the map we want to retrieve the available baselayers for
3338
- * @returns {array} returnType: array - array containing all available base layers
3107
+ * @param inDraftArray The draft array to filter, will be modified in place.
3108
+ * @param condition Function to check each element in the array
3339
3109
  */
3340
- var getAvailableBaseLayersForMap = createSelector(layerStore, function (_store, _mapId) {
3341
- return _mapId;
3342
- }, function (layerStore, mapId) {
3343
- if (layerStore && layerStore.availableBaseLayers) {
3344
- var availableBaseLayers = layerStore.availableBaseLayers;
3345
- return availableBaseLayers.allIds.reduce(function (list, layerId) {
3346
- if (availableBaseLayers.byId[layerId].mapId === mapId) {
3347
- return list.concat(availableBaseLayers.byId[layerId]);
3110
+ var removeInPlace = function removeInPlace(inDraftArray, condition) {
3111
+ var index = 0;
3112
+ inDraftArray.forEach(function (e, i) {
3113
+ if (!condition(e)) {
3114
+ if (i !== index) {
3115
+ // eslint-disable-next-line no-param-reassign
3116
+ inDraftArray[index] = e;
3348
3117
  }
3349
- return list;
3350
- }, []);
3351
- }
3352
- return [];
3353
- }, selectorMemoizationOptions);
3354
- /**
3355
- * Returns the selected geojson feature for the given layer
3356
- *
3357
- * Example const selectedFeature = getSelectedFeature(store, 'layerId1')
3358
- * @param {object} store store: object - store object
3359
- * @param {string} mapId layerId: string - Id of the layer
3360
- * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
3361
- */
3362
- var getSelectedFeatureIndex = createSelector(getLayerById, function (layer) {
3363
- return layer === null || layer === void 0 ? void 0 : layer.selectedFeatureIndex;
3364
- }, selectorMemoizationOptions);
3365
- /**
3366
- * Returns the layer is in edit mode
3367
- *
3368
- * Example const isLayerInEditMode = getIsLayerInEditMode(store, 'layerId1')
3369
- * @param {object} store store: object - store object
3370
- * @param {string} mapId layerId: string - Id of the layer
3371
- * @returns {number} isLayerInEditMode: boolean - isInEditMode
3372
- */
3373
- var getIsLayerInEditMode = createSelector(getLayerById, function (layer) {
3374
- return (layer === null || layer === void 0 ? void 0 : layer.isInEditMode) || false;
3375
- }, selectorMemoizationOptions);
3376
- var getFeatureLayerGeoJSON = createSelector(getLayerById, function (layer) {
3377
- return (layer === null || layer === void 0 ? void 0 : layer.geojson) || undefined;
3378
- }, selectorMemoizationOptions);
3379
- var getHasFeatureLayerGeoJSON = createSelector(getFeatureLayerGeoJSON, function (geojson) {
3380
- return !!geojson;
3381
- }, selectorMemoizationOptions);
3382
- var getFeatureLayerGeoJSONProperties = createSelector(getLayerById, getSelectedFeatureIndex, function (layer) {
3383
- var _layer$geojson;
3384
- var selecteFeatureIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3385
- return (layer === null || layer === void 0 || (_layer$geojson = layer.geojson) === null || _layer$geojson === void 0 || (_layer$geojson = _layer$geojson.features[selecteFeatureIndex]) === null || _layer$geojson === void 0 ? void 0 : _layer$geojson.properties) || {};
3386
- }, selectorMemoizationOptions);
3387
- /**
3388
- * Gets layerIds that contain passed dimension
3389
- *
3390
- * Example: dimension = getDimensionLayerIds(store, 'elevation')
3391
- * @param {object} store store: object - object from which the layers state will be extracted
3392
- * @param {string} dimensionName dimensionName: string - name of dimension you want to retrieve the dimension data for
3393
- * @returns {string[]} returnType: string[] - layerIds
3394
- */
3395
- var getDimensionLayerIds = createSelector(getLayersIds, getLayersById, function (_store, dimensionName) {
3396
- return dimensionName;
3397
- }, function (layerIds, layers, dimensionName) {
3398
- return layerIds.reduce(function (list, layerId) {
3399
- var layer = layers[layerId];
3400
- var dimensions = layer !== null && layer !== void 0 && layer.dimensions ? layer.dimensions : [];
3401
- if (dimensions.find(function (dimension) {
3402
- return dimension.name === dimensionName;
3403
- })) {
3404
- return list.concat(layerId);
3118
+ index += 1;
3405
3119
  }
3406
- return list;
3407
- }, []);
3408
- }, selectorMemoizationOptions);
3409
- var getAcceptanceTimeInMinutes = createSelector(getLayerById, function (layer) {
3410
- return layer === null || layer === void 0 ? void 0 : layer.acceptanceTimeInMinutes;
3411
- }, selectorMemoizationOptions);
3412
- var getLayerIsInsideAcceptanceTime = createSelector(getAcceptanceTimeInMinutes, getLayerCurrentTime, function (state, _layerId, mapId) {
3413
- var _state$webmap;
3414
- return (_state$webmap = state.webmap) === null || _state$webmap === void 0 || (_state$webmap = _state$webmap.byId[mapId]) === null || _state$webmap === void 0 || (_state$webmap = _state$webmap.dimensions) === null || _state$webmap === void 0 || (_state$webmap = _state$webmap.find(function (dimension) {
3415
- return dimension.name === 'time';
3416
- })) === null || _state$webmap === void 0 ? void 0 : _state$webmap.currentValue;
3417
- }, function (acceptanceTimeInMinutes, layerCurrentTime, mapCurrentTime) {
3418
- if (!mapCurrentTime || !layerCurrentTime) {
3419
- return 'equal';
3420
- }
3421
- var mapTime = new Date(mapCurrentTime).getTime();
3422
- var layerTime = new Date(layerCurrentTime).getTime();
3423
- if (mapTime === layerTime) {
3424
- return 'equal';
3425
- }
3426
- if (acceptanceTimeInMinutes !== undefined) {
3427
- var millisecondsBetween = mapTime - layerTime;
3428
- var acceptanceTimeInMilliseconds = acceptanceTimeInMinutes * 60000;
3429
- if (Math.abs(millisecondsBetween) > acceptanceTimeInMilliseconds) {
3430
- return 'outside';
3120
+ });
3121
+ // eslint-disable-next-line no-param-reassign
3122
+ inDraftArray.length = index;
3123
+ };
3124
+
3125
+ var initialState$3 = {
3126
+ sources: {
3127
+ byId: {},
3128
+ allIds: []
3129
+ },
3130
+ groups: {
3131
+ byId: {},
3132
+ allIds: []
3133
+ },
3134
+ viewState: {
3135
+ timeslider: {
3136
+ groups: [],
3137
+ sourcesById: []
3138
+ },
3139
+ zoompane: {
3140
+ groups: [],
3141
+ sourcesById: []
3142
+ },
3143
+ level: {
3144
+ groups: [],
3145
+ sourcesById: []
3146
+ }
3147
+ },
3148
+ linkedState: {
3149
+ links: {},
3150
+ sharedData: {}
3151
+ },
3152
+ isTimeScrollingEnabled: false
3153
+ };
3154
+ var slice$4 = createSlice({
3155
+ initialState: initialState$3,
3156
+ name: 'synchronizationGroupsReducer',
3157
+ reducers: {
3158
+ /** Sets the links map.
3159
+ * This is used to override the links when changing workspaces.
3160
+ * @param draft sync state
3161
+ * @param {Record<string, string[]>} action.newLinks the new links object
3162
+ */
3163
+ setLinkedMap: function setLinkedMap(draft, action) {
3164
+ var newLinks = action.payload.newLinks;
3165
+ draft.linkedState.links = newLinks;
3166
+ },
3167
+ /** Updates the links map.
3168
+ * This is used to update the links when operating the link menu.
3169
+ * @param draft sync state
3170
+ * @param {string} action.panelId id of the panel updating it's links
3171
+ * @param {string[]} action.mapIds the new linked maps
3172
+ */
3173
+ updateLinkedMap: function updateLinkedMap(draft, action) {
3174
+ var _action$payload = action.payload,
3175
+ panelId = _action$payload.panelId,
3176
+ mapIds = _action$payload.mapIds;
3177
+ draft.linkedState.links[panelId] = mapIds;
3178
+ },
3179
+ removeLinkedMap: function removeLinkedMap(draft, action) {
3180
+ var panelId = action.payload;
3181
+ // Remove panelId from sources
3182
+ delete draft.sources.byId[panelId];
3183
+ removeInPlace(draft.sources.allIds, function (_id) {
3184
+ return _id === panelId;
3185
+ });
3186
+ // Remove panelId from any arrays in linkedState
3187
+ delete draft.linkedState.links[panelId];
3188
+ delete draft.linkedState.sharedData[panelId];
3189
+ Object.keys(draft.linkedState.links).forEach(function (key) {
3190
+ var arr = draft.linkedState.links[key];
3191
+ removeInPlace(arr, function (_id) {
3192
+ return _id === panelId;
3193
+ });
3194
+ });
3195
+ // Remove panelId from groups
3196
+ Object.keys(draft.groups.byId).forEach(function (groupId) {
3197
+ var group = draft.groups.byId[groupId];
3198
+ delete group.targets.byId[panelId];
3199
+ removeInPlace(group.targets.allIds, function (_id) {
3200
+ return _id === panelId;
3201
+ });
3202
+ });
3203
+ },
3204
+ addSharedData: function addSharedData(draft, action) {
3205
+ var _action$payload2 = action.payload,
3206
+ panelId = _action$payload2.panelId,
3207
+ data = _action$payload2.data;
3208
+ draft.linkedState.sharedData[panelId] = _objectSpread2(_objectSpread2({}, draft.linkedState.sharedData[panelId]), data);
3209
+ },
3210
+ deleteSharedData: function deleteSharedData(draft, action) {
3211
+ var panelId = action.payload.panelId;
3212
+ delete draft.linkedState.sharedData[panelId];
3213
+ },
3214
+ syncGroupAddSource: function syncGroupAddSource(draft, action) {
3215
+ var _action$payload3 = action.payload,
3216
+ id = _action$payload3.id,
3217
+ payloadType = _action$payload3.type,
3218
+ defaultPayload = _action$payload3.defaultPayload;
3219
+ if (!draft.sources.byId[id]) {
3220
+ draft.sources.byId[id] = {
3221
+ types: payloadType,
3222
+ payloadByType: {
3223
+ SYNCGROUPS_TYPE_SETTIME: defaultPayload,
3224
+ SYNCGROUPS_TYPE_SETBBOX: defaultPayload,
3225
+ SYNCGROUPS_TYPE_SETLAYERACTIONS: defaultPayload
3226
+ }
3227
+ };
3228
+ draft.sources.allIds.push(id);
3229
+ }
3230
+ /* Now try to initialize with the correct values from the state */
3231
+ draft.groups.allIds.forEach(function (groupId) {
3232
+ var syncronizationGroup = draft.groups.byId[groupId];
3233
+ /* Check if the source is in the target list of the synchonizationGroup */
3234
+ var source = syncronizationGroup.targets.byId[id];
3235
+ var type = syncronizationGroup.type;
3236
+ /* If the source is part of the target list, and is linked, continue syncing the other targets */
3237
+ if (source !== null && source !== void 0 && source.linked) {
3238
+ var _syncronizationGroup$;
3239
+ draft.sources.byId[id].payloadByType[type] = ((_syncronizationGroup$ = syncronizationGroup.payloadByType) === null || _syncronizationGroup$ === void 0 ? void 0 : _syncronizationGroup$[type]) || defaultPayload;
3240
+ }
3241
+ });
3242
+ },
3243
+ syncGroupRemoveSource: function syncGroupRemoveSource(draft, action) {
3244
+ var id = action.payload.id;
3245
+ if (draft.sources.byId[id]) {
3246
+ delete draft.sources.byId[id];
3247
+ removeInPlace(draft.sources.allIds, function (_id) {
3248
+ return _id === id;
3249
+ });
3250
+ }
3251
+ },
3252
+ syncGroupAddTarget: function syncGroupAddTarget(draft, action) {
3253
+ var _synchronizationGroup;
3254
+ var _action$payload4 = action.payload,
3255
+ groupId = _action$payload4.groupId,
3256
+ targetId = _action$payload4.targetId,
3257
+ linked = _action$payload4.linked;
3258
+ var synchronizationGroup = draft.groups.byId[groupId];
3259
+ if (!synchronizationGroup) {
3260
+ console.warn("SYNCGROUPS_ADD_TARGET: Group ".concat(groupId, " does not exist."));
3261
+ return;
3262
+ }
3263
+ if (!targetId) {
3264
+ console.warn("SYNCGROUPS_ADD_TARGET: targetId is not defined.");
3265
+ return;
3266
+ }
3267
+ if (synchronizationGroup.targets.allIds.includes(targetId)) {
3268
+ return;
3269
+ }
3270
+ var isSourceLinked = (_synchronizationGroup = synchronizationGroup.targets.byId[targetId]) === null || _synchronizationGroup === void 0 ? void 0 : _synchronizationGroup.linked;
3271
+ synchronizationGroup.targets.allIds.push(targetId);
3272
+ synchronizationGroup.targets.byId[targetId] = {
3273
+ linked: linked !== false
3274
+ };
3275
+ if (isSourceLinked) {
3276
+ var type = synchronizationGroup.type;
3277
+ draft.sources.byId[targetId].payloadByType[type] = synchronizationGroup.payloadByType[type];
3278
+ }
3279
+ },
3280
+ syncGroupRemoveTarget: function syncGroupRemoveTarget(draft, action) {
3281
+ var _action$payload5 = action.payload,
3282
+ groupId = _action$payload5.groupId,
3283
+ targetId = _action$payload5.targetId;
3284
+ if (!draft.groups.byId[groupId]) {
3285
+ return;
3286
+ }
3287
+ if (!draft.groups.byId[groupId].targets.allIds.includes(targetId)) {
3288
+ return;
3289
+ }
3290
+ delete draft.groups.byId[groupId].targets.byId[targetId];
3291
+ removeInPlace(draft.groups.byId[groupId].targets.allIds, function (_id) {
3292
+ return _id === targetId;
3293
+ });
3294
+ },
3295
+ syncGroupLinkTarget: function syncGroupLinkTarget(draft, action) {
3296
+ var _draft$groups$byId$gr;
3297
+ var _action$payload6 = action.payload,
3298
+ groupId = _action$payload6.groupId,
3299
+ targetId = _action$payload6.targetId,
3300
+ linked = _action$payload6.linked;
3301
+ if (!((_draft$groups$byId$gr = draft.groups.byId[groupId]) !== null && _draft$groups$byId$gr !== void 0 && _draft$groups$byId$gr.targets.byId[targetId])) {
3302
+ return;
3303
+ }
3304
+ draft.groups.byId[groupId].targets.byId[targetId].linked = linked;
3305
+ },
3306
+ syncGroupAddGroup: function syncGroupAddGroup(draft, action) {
3307
+ var _action$payload7 = action.payload,
3308
+ groupId = _action$payload7.groupId,
3309
+ type = _action$payload7.type,
3310
+ title = _action$payload7.title;
3311
+ if (draft.groups.byId[groupId]) {
3312
+ return;
3313
+ }
3314
+ draft.groups.byId[groupId] = {
3315
+ title: title,
3316
+ type: type,
3317
+ payloadByType: {
3318
+ SYNCGROUPS_TYPE_SETTIME: null,
3319
+ SYNCGROUPS_TYPE_SETBBOX: null
3320
+ },
3321
+ targets: {
3322
+ allIds: [],
3323
+ byId: {}
3324
+ }
3325
+ };
3326
+ draft.groups.allIds.push(groupId);
3327
+ },
3328
+ syncGroupRemoveGroup: function syncGroupRemoveGroup(draft, action) {
3329
+ var groupId = action.payload.groupId;
3330
+ if (!draft.groups.byId[groupId]) {
3331
+ return;
3332
+ }
3333
+ delete draft.groups.byId[groupId];
3334
+ removeInPlace(draft.groups.allIds, function (_groupId) {
3335
+ return _groupId === groupId;
3336
+ });
3337
+ },
3338
+ syncGroupClear: function syncGroupClear() {
3339
+ return initialState$3;
3340
+ },
3341
+ syncGroupSetViewState: function syncGroupSetViewState(draft, action) {
3342
+ var viewState = action.payload.viewState;
3343
+ draft.viewState = viewState;
3344
+ },
3345
+ syncGroupToggleIsTimeScrollingEnabled: function syncGroupToggleIsTimeScrollingEnabled(draft, action) {
3346
+ draft.isTimeScrollingEnabled = action.payload.isTimeScrollingEnabled;
3431
3347
  }
3348
+ },
3349
+ extraReducers: function extraReducers(builder) {
3350
+ builder.addCase(setTimeSync, function (draft, action) {
3351
+ return void setBboxOrTimeSync(draft, action);
3352
+ }).addCase(setBboxSync, function (draft, action) {
3353
+ return void setBboxOrTimeSync(draft, action);
3354
+ });
3432
3355
  }
3433
- return 'inside';
3434
- }, selectorMemoizationOptions);
3435
- var getUseLatestReferenceTime = createSelector(getLayerById, function (layer) {
3436
- return Boolean(layer === null || layer === void 0 ? void 0 : layer.useLatestReferenceTime);
3437
- }, selectorMemoizationOptions);
3438
- /**
3439
- * Returns the timestep for this layerId in seconds, or undefined if it has no time dimension or timeinterval.
3440
- */
3441
- var getTimeStepForLayerId = createSelector(getLayerTimeDimension, function (timeDimension) {
3442
- if (!timeDimension) {
3443
- return undefined;
3356
+ });
3357
+ var getPayLoadKey = function getPayLoadKey(type) {
3358
+ switch (type) {
3359
+ case setTimeSync.type:
3360
+ return SYNCGROUPS_TYPE_SETTIME;
3361
+ case setBboxSync.type:
3362
+ return SYNCGROUPS_TYPE_SETBBOX;
3363
+ default:
3364
+ return null;
3444
3365
  }
3445
- var values = timeDimension.values,
3446
- currentValue = timeDimension.currentValue,
3447
- _timeDimension$timeIn = timeDimension.timeInterval,
3448
- timeInterval = _timeDimension$timeIn === void 0 ? {} : _timeDimension$timeIn;
3449
- if (!values || !currentValue) {
3450
- return isEmpty(timeInterval) ? undefined : getTimeStepFromDataInterval(timeInterval);
3366
+ };
3367
+ var mergePayloadInToState = function mergePayloadInToState(draftSource, payloadKey, payload) {
3368
+ if (!draftSource) {
3369
+ // Do nothing if draftSource is undefined/null
3370
+ return;
3451
3371
  }
3452
- var iso8601Intervals = parseTimeDimToISO8601Interval(values);
3453
- var _iterator = _createForOfIteratorHelper(iso8601Intervals),
3454
- _step;
3455
- try {
3456
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
3457
- var _step$value = _step.value,
3458
- startTime = _step$value.startTime,
3459
- endTime = _step$value.endTime,
3460
- duration = _step$value.duration;
3461
- if (dateUtils.isWithinInterval(currentValue, {
3462
- start: startTime,
3463
- end: endTime
3464
- })) {
3465
- var parsedInterval = parseISO8601IntervalToDateInterval(duration);
3466
- return getTimeStepFromDataInterval(parsedInterval);
3467
- }
3372
+ if (!draftSource.payloadByType) {
3373
+ draftSource.payloadByType = {};
3374
+ draftSource.payloadByType[payloadKey] = payload;
3375
+ return;
3376
+ }
3377
+ draftSource.payloadByType[payloadKey] = merge(draftSource.payloadByType[payloadKey], payload);
3378
+ };
3379
+ var setBboxOrTimeSync = function setBboxOrTimeSync(draft, action) {
3380
+ var _action$payload8 = action.payload,
3381
+ targets = _action$payload8.targets,
3382
+ source = _action$payload8.source,
3383
+ groups = _action$payload8.groups;
3384
+ if (source) {
3385
+ var payloadKey = getPayLoadKey(action.type);
3386
+ if (!source.payload || !payloadKey) {
3387
+ console.warn('Wrong sync action: ', action);
3388
+ return;
3468
3389
  }
3469
- } catch (err) {
3470
- _iterator.e(err);
3471
- } finally {
3472
- _iterator.f();
3390
+ mergePayloadInToState(draft.sources.byId[source.payload.sourceId], payloadKey, source.payload);
3391
+ /* Update all targets */
3392
+ targets.forEach(function (target) {
3393
+ mergePayloadInToState(draft.sources.byId[target.targetId], payloadKey, source.payload);
3394
+ });
3395
+ /* Set the value in the group */
3396
+ groups.forEach(function (group) {
3397
+ mergePayloadInToState(draft.groups.byId[group], payloadKey, source.payload);
3398
+ });
3473
3399
  }
3474
- return getTimeStepFromDataInterval(timeInterval);
3475
- }, selectorMemoizationOptions);
3476
- var getActiveLayerInfo = createSelector(layerStore, function (store) {
3477
- return store === null || store === void 0 ? void 0 : store.activeLayerInfo;
3478
- });
3479
- var getLayerType = createSelector(getLayerById, function (layer) {
3480
- var _layer$layerType;
3481
- return (_layer$layerType = layer === null || layer === void 0 ? void 0 : layer.layerType) !== null && _layer$layerType !== void 0 ? _layer$layerType : 'mapLayer';
3482
- }, selectorMemoizationOptions);
3483
- var getLayerOptions = createSelector(getLayerById, function (layer) {
3484
- return layer === null || layer === void 0 ? void 0 : layer.options;
3485
- }, selectorMemoizationOptions);
3400
+ };
3401
+ var _slice$actions = slice$4.actions,
3402
+ syncGroupAddGroup = _slice$actions.syncGroupAddGroup;
3403
+ _slice$actions.syncGroupAddSource;
3404
+ var syncGroupAddTarget = _slice$actions.syncGroupAddTarget;
3405
+ _slice$actions.syncGroupClear;
3406
+ _slice$actions.syncGroupLinkTarget;
3407
+ _slice$actions.syncGroupRemoveGroup;
3408
+ _slice$actions.syncGroupRemoveSource;
3409
+ _slice$actions.syncGroupRemoveTarget;
3410
+ _slice$actions.syncGroupSetViewState;
3411
+ var syncGroupsReducer = slice$4.reducer,
3412
+ syncGroupsActions = slice$4.actions;
3413
+
3414
+ var syncGroupStore = function syncGroupStore(store) {
3415
+ return store.syncGroups || null;
3416
+ };
3486
3417
  /**
3487
- * Gets all overlayers for a given mapId
3488
- * Example: overlayers = getOverlayersForMapId(store, 'mapId123')
3489
- * @param {CoreAppStore} store - The Redux store from which the layers state will be extracted.
3490
- * @param {string} mapId - The ID of the map for which to retrieve the overlayers.
3491
- * @returns {Array<{ id: string; name: string }>} - An array of overlayers containing layer information (id and name).
3418
+ * Gets synchronization group state
3419
+ *
3420
+ * Example: synchronizationGroupState = getSynchronizationGroupState(store)
3421
+ * @param {object} store store: object - Store object
3422
+ * @returns {object} returnType: SynchronizationGroupState
3492
3423
  */
3493
- var getOverlayersForMapId = createSelector([layerStore, function (_store, mapId) {
3494
- return mapId;
3495
- }], function (store, mapId) {
3496
- var overLayers = [];
3497
- (store === null || store === void 0 ? void 0 : store.byId) && Object.values(store.byId).forEach(function (layer) {
3498
- if (layer.layerType === LayerType.overLayer && layer.mapId === mapId) {
3499
- overLayers.push({
3500
- id: layer.id || '',
3501
- name: layer.name || ''
3424
+ var getSynchronizationGroupState = function getSynchronizationGroupState(store) {
3425
+ var state = syncGroupStore(store);
3426
+ return state || null;
3427
+ };
3428
+ var getSynchronizationGroup = createSelector([syncGroupStore, function (syncGroupStore, id) {
3429
+ return id;
3430
+ }], function (syncGroupState, id) {
3431
+ return syncGroupState.groups.byId[id];
3432
+ }, selectorMemoizationOptions);
3433
+ var getSynchronizationGroupSource = createSelector([syncGroupStore, function (syncGroupStore, id) {
3434
+ return id;
3435
+ }], function (syncGroupState, id) {
3436
+ return syncGroupState.sources.byId[id];
3437
+ }, selectorMemoizationOptions);
3438
+ var getTargets = createSelector([syncGroupStore, function (syncGroupStore, payload) {
3439
+ return payload;
3440
+ }, function (syncGroupStore, payload, actionType) {
3441
+ return actionType;
3442
+ }], function (syncGroups, payload, actionType) {
3443
+ var actionPayloads = [];
3444
+ var targetsInActionPayload = {};
3445
+ if (syncGroups && payload) {
3446
+ /* Backwards compatibility, if there are no groups, connect everything */
3447
+ if (syncGroups.groups.allIds.length === 0) {
3448
+ syncGroups.sources.allIds.forEach(function (targetId) {
3449
+ // Only add if should react to this action
3450
+ if (syncGroups.sources.byId[targetId].types.includes(actionType)) {
3451
+ /* Remember that we have already added this target in the action payloads, prevents adding it twice */
3452
+ targetsInActionPayload[targetId] = true;
3453
+ /* Compose the payload */
3454
+ var newPayload = _objectSpread2({
3455
+ targetId: targetId
3456
+ }, payload);
3457
+ actionPayloads.push(newPayload);
3458
+ }
3502
3459
  });
3503
3460
  }
3504
- });
3505
- return overLayers;
3461
+ syncGroups.groups.allIds.forEach(function (id) {
3462
+ var syncronizationGroup = syncGroups.groups.byId[id];
3463
+ if (actionType === syncronizationGroup.type) {
3464
+ /* Check if the source is in the target list of the synchonizationGroup */
3465
+ var source = syncronizationGroup.targets.byId[payload.sourceId];
3466
+ /* If the source is part of the target list, and is linked, continue syncing the other targets */
3467
+ if (source !== null && source !== void 0 && source.linked) {
3468
+ syncronizationGroup.targets.allIds.forEach(function (targetId) {
3469
+ var target = syncronizationGroup.targets.byId[targetId];
3470
+ if (target.linked && !targetsInActionPayload[targetId]) {
3471
+ /* Remember that we have already added this target in the action payloads, prevents adding it twice */
3472
+ targetsInActionPayload[targetId] = true;
3473
+ /* Compose the payload */
3474
+ var newPayload = _objectSpread2({
3475
+ targetId: targetId
3476
+ }, payload);
3477
+ actionPayloads.push(newPayload);
3478
+ }
3479
+ });
3480
+ }
3481
+ }
3482
+ });
3483
+ }
3484
+ return actionPayloads;
3506
3485
  }, selectorMemoizationOptions);
3507
- /**
3508
- * Gets the layer title from the service store using the layerId
3509
- *
3510
- * Example: layerTitle = getLayerTitleFromService(store, 'layerId_1')
3511
- * @param {object} store store: object - object from which the layers state will be extracted
3512
- * @param {string} layerId layerId: string - Id of the layer
3513
- * @returns {string} returnType: string - string containing layer title
3514
- */
3515
- var getLayerTitleFromService = createSelector(function (store) {
3516
- return store;
3517
- }, getLayerService, getLayerName, function (store, service, name) {
3518
- return getLayerTitle(store, service, name);
3486
+ var getTargetGroups = createSelector([syncGroupStore, function (syncGroupStore, payload) {
3487
+ return payload;
3488
+ }, function (syncGroupStore, payload, actionType) {
3489
+ return actionType;
3490
+ }], function (syncGroups, payload, actionType) {
3491
+ var groups = syncGroups.groups.allIds.reduce(function (list, groupId) {
3492
+ var syncronizationGroup = syncGroups.groups.byId[groupId];
3493
+ if (actionType === syncronizationGroup.type) {
3494
+ /* Check if the source is in the target list of the synchronizationGroup */
3495
+ var source = syncronizationGroup.targets.byId[payload.sourceId];
3496
+ /* If the source is part of the target list, and is linked, continue syncin the other targets */
3497
+ if (source !== null && source !== void 0 && source.linked) {
3498
+ return list.concat(groupId);
3499
+ }
3500
+ }
3501
+ return list;
3502
+ }, []);
3503
+ return groups;
3519
3504
  }, selectorMemoizationOptions);
3520
- /**
3521
- * Gets layer displayname. For EDR layers with multiple parameters, the collectionId is used as displayname. Otherwise the layer title from the service is used.
3522
- *
3523
- * Example: layerName = getLayerDisplayName(store, 'layerId_1')
3524
- * @param {object} store store: object - object from which the layers state will be extracted
3525
- * @param {string} layerId layerId: string - Id of the layer
3526
- * @returns {string} returnType: string - layer displayname
3527
- */
3528
- var getLayerDisplayName = createSelector(getLayerType, getLayerOptions, getLayerTitleFromService, getLayerName, function (layerType, layerOptions, layerTitle, layerName) {
3529
- if (layerType === LayerType.edrFeatureLayer && layerOptions) {
3530
- return (layerOptions === null || layerOptions === void 0 ? void 0 : layerOptions.parameterNames.length) > 1 && layerOptions.collectionId ? layerOptions.collectionId : layerTitle || layerName;
3531
- }
3532
- return layerTitle || layerName;
3505
+ var getSourceId = createSelector([syncGroupStore, function (syncGroupStore, sourceId) {
3506
+ return sourceId;
3507
+ }], function (syncGroupState, sourceId) {
3508
+ return typeof sourceId === 'string' ? sourceId : sourceId.sourceId;
3533
3509
  }, selectorMemoizationOptions);
3534
- /**
3535
- * Gets the layer missing status. A layer is missing if it is not found in the service store or if its status is 'error'.
3536
- *
3537
- * Example: isLayerMissing = getIsLayerMissing(store, 'layerId_1')
3538
- * @param {object} store store: object - object from which the layers state will be extracted
3539
- * @param {string} layerId layerId: string - Id of the layer
3540
- * @returns {boolean} returnType: boolean - true if layer is missing
3541
- */
3542
- var getIsLayerMissing = createSelector(function (store) {
3543
- return store;
3544
- }, getLayerService, getLayerName, getLayerStatus, getLayerType, function (store, service, name, status, type) {
3545
- if (type === LayerType.featureLayer) {
3546
- return false;
3510
+ var getAllTargetGroupsForSource = createSelector([syncGroupStore, getSourceId], function (syncGroupStore, sourceId) {
3511
+ if (syncGroupStore !== null && syncGroupStore !== void 0 && syncGroupStore.groups) {
3512
+ return syncGroupStore.groups.allIds.reduce(function (linkedSyncGroupIds, groupId) {
3513
+ var syncronizationGroup = syncGroupStore.groups.byId[groupId];
3514
+ var source = syncronizationGroup.targets.byId[sourceId];
3515
+ /* If the source is part of the target list, and is linked, continue syncin the other targets */
3516
+ if (source !== null && source !== void 0 && source.linked) {
3517
+ return linkedSyncGroupIds.concat(groupId);
3518
+ }
3519
+ return linkedSyncGroupIds;
3520
+ }, []);
3547
3521
  }
3548
- var layer = getLayerFromService(store, service, name);
3549
- return !layer || status === LayerStatus.error;
3522
+ return [];
3550
3523
  }, selectorMemoizationOptions);
3551
- var getIsLayerSelectable = createSelector(getLayerById, function (layer) {
3552
- return Boolean(layer === null || layer === void 0 ? void 0 : layer.isSelectable);
3524
+ var syncGroupGetViewState = createSelector(syncGroupStore, function (store) {
3525
+ return store === null || store === void 0 ? void 0 : store.viewState;
3553
3526
  }, selectorMemoizationOptions);
3554
-
3555
- var selectors$6 = /*#__PURE__*/Object.freeze({
3556
- __proto__: null,
3557
- getAcceptanceTimeInMinutes: getAcceptanceTimeInMinutes,
3558
- getActiveLayerInfo: getActiveLayerInfo,
3559
- getAllLayers: getAllLayers,
3560
- getAvailableBaseLayersForMap: getAvailableBaseLayersForMap,
3561
- getBaseLayers: getBaseLayers,
3562
- getDimensionLayerIds: getDimensionLayerIds,
3563
- getFeatureLayerGeoJSON: getFeatureLayerGeoJSON,
3564
- getFeatureLayerGeoJSONProperties: getFeatureLayerGeoJSONProperties,
3565
- getFeatureLayers: getFeatureLayers,
3566
- getHasFeatureLayerGeoJSON: getHasFeatureLayerGeoJSON,
3567
- getIsLayerInEditMode: getIsLayerInEditMode,
3568
- getIsLayerMissing: getIsLayerMissing,
3569
- getIsLayerPresent: getIsLayerPresent,
3570
- getIsLayerSelectable: getIsLayerSelectable,
3571
- getLayerById: getLayerById,
3572
- getLayerByIdWithoutTimeDimension: getLayerByIdWithoutTimeDimension,
3573
- getLayerCurrentTime: getLayerCurrentTime,
3574
- getLayerDimension: getLayerDimension,
3575
- getLayerDimensions: getLayerDimensions,
3576
- getLayerDisplayName: getLayerDisplayName,
3577
- getLayerEnabled: getLayerEnabled,
3578
- getLayerHasTimeDimension: getLayerHasTimeDimension,
3579
- getLayerIsInsideAcceptanceTime: getLayerIsInsideAcceptanceTime,
3580
- getLayerName: getLayerName,
3581
- getLayerNonTimeDimensions: getLayerNonTimeDimensions,
3582
- getLayerOpacity: getLayerOpacity,
3583
- getLayerOptions: getLayerOptions,
3584
- getLayerService: getLayerService,
3585
- getLayerStatus: getLayerStatus,
3586
- getLayerStyle: getLayerStyle,
3587
- getLayerTimeDimension: getLayerTimeDimension,
3588
- getLayerTitleFromService: getLayerTitleFromService,
3589
- getLayerType: getLayerType,
3590
- getLayers: getLayers,
3591
- getLayersById: getLayersById,
3592
- getLayersByMapId: getLayersByMapId,
3593
- getLayersIds: getLayersIds,
3594
- getOverLayers: getOverLayers,
3595
- getOverlayersForMapId: getOverlayersForMapId,
3596
- getSelectedFeatureIndex: getSelectedFeatureIndex,
3597
- getTimeStepForLayerId: getTimeStepForLayerId,
3598
- getUseLatestReferenceTime: getUseLatestReferenceTime
3527
+ var isTimeScrollingEnabled = function isTimeScrollingEnabled(store) {
3528
+ var state = syncGroupStore(store);
3529
+ return state ? state.isTimeScrollingEnabled : false;
3530
+ };
3531
+ var getSyncedMapIdsForTimeslider = createSelector(syncGroupStore, function (store) {
3532
+ var _store$viewState$time, _store$viewState$time2;
3533
+ return (_store$viewState$time = (_store$viewState$time2 = store.viewState.timeslider.groups[0]) === null || _store$viewState$time2 === void 0 ? void 0 : _store$viewState$time2.selected) !== null && _store$viewState$time !== void 0 ? _store$viewState$time : [];
3534
+ }, selectorMemoizationOptions);
3535
+ var getSyncGroupTargets = createSelector(syncGroupStore, function (store) {
3536
+ if (!(store !== null && store !== void 0 && store.groups)) {
3537
+ return [];
3538
+ }
3539
+ return store.groups.allIds.reduce(function (targets, groupId) {
3540
+ var group = store.groups.byId[groupId];
3541
+ return targets.concat(group.targets.allIds.map(function (targetId) {
3542
+ return {
3543
+ groupId: groupId,
3544
+ targetId: targetId,
3545
+ linked: group.targets.byId[targetId].linked
3546
+ };
3547
+ }));
3548
+ }, []);
3549
+ }, selectorMemoizationOptions);
3550
+
3551
+ var selectors$6 = /*#__PURE__*/Object.freeze({
3552
+ __proto__: null,
3553
+ getAllTargetGroupsForSource: getAllTargetGroupsForSource,
3554
+ getSourceId: getSourceId,
3555
+ getSyncGroupTargets: getSyncGroupTargets,
3556
+ getSyncedMapIdsForTimeslider: getSyncedMapIdsForTimeslider,
3557
+ getSynchronizationGroup: getSynchronizationGroup,
3558
+ getSynchronizationGroupSource: getSynchronizationGroupSource,
3559
+ getSynchronizationGroupState: getSynchronizationGroupState,
3560
+ getTargetGroups: getTargetGroups,
3561
+ getTargets: getTargets,
3562
+ isTimeScrollingEnabled: isTimeScrollingEnabled,
3563
+ syncGroupGetViewState: syncGroupGetViewState,
3564
+ syncGroupStore: syncGroupStore
3599
3565
  });
3600
3566
 
3601
3567
  /* *
@@ -3611,305 +3577,423 @@ var selectors$6 = /*#__PURE__*/Object.freeze({
3611
3577
  * See the License for the specific language governing permissions and
3612
3578
  * limitations under the License.
3613
3579
  *
3614
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3615
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
3580
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3581
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
3616
3582
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3617
3583
  * */
3618
- var useAppSelector$1 = useSelector;
3619
- var getUiStore = function getUiStore(store) {
3620
- if (store && store.ui) {
3621
- return store.ui;
3584
+ var emptyState = {
3585
+ timeslider: {
3586
+ groups: [],
3587
+ sourcesById: []
3588
+ },
3589
+ zoompane: {
3590
+ groups: [],
3591
+ sourcesById: []
3592
+ },
3593
+ level: {
3594
+ groups: [],
3595
+ sourcesById: []
3622
3596
  }
3623
- return null;
3624
3597
  };
3625
- /**
3626
- * Gets the active map Id and wether a dialog is open or closed
3627
- *
3628
- * Example: getDialogDetailsByType(store, 'legend')
3629
- * @param {object} store store object from which the ui state wll be extracted
3630
- * @param {string} dialogType type of the dialog
3631
- * @returns {array} [string, boolean] first element gives the active map id, second element whether the dialog is open
3632
- */
3633
- var getDialogDetailsByType = function getDialogDetailsByType(store, dialogType) {
3634
- if (store && store.ui && store.ui.dialogs && store.ui.dialogs[dialogType]) {
3635
- return store.ui.dialogs[dialogType];
3636
- }
3637
- return null;
3598
+ var groupTypes = [{
3599
+ title: 'Timeslider',
3600
+ syncType: 'SYNCGROUPS_TYPE_SETTIME',
3601
+ groupType: 'timeslider'
3602
+ }, {
3603
+ title: 'Zoompane',
3604
+ syncType: 'SYNCGROUPS_TYPE_SETBBOX',
3605
+ groupType: 'zoompane'
3606
+ }];
3607
+ /*
3608
+ _____ Creates viewState _____
3609
+ - Runs Each time viewState is created:
3610
+ - Fill arrays inside initialState with objects containing new values from Redux
3611
+ */
3612
+ var createSyncGroupViewState = function createSyncGroupViewState(groups, sources) {
3613
+ var initialState = produce(emptyState, function (draft) {
3614
+ /*
3615
+ _____ 1. Fill groups _____
3616
+ 1. Goes through all groups by ID
3617
+ 2. Collects original timeslider or zoompane values into an array
3618
+ 3. Sorts and adds selected sources to ViewState based on ID type
3619
+ */
3620
+ Object.keys(groups.byId).forEach(function (id) {
3621
+ var _groupTypes$find;
3622
+ var groupType = (_groupTypes$find = groupTypes.find(function (object) {
3623
+ return object.syncType === groups.byId[id].type;
3624
+ })) === null || _groupTypes$find === void 0 ? void 0 : _groupTypes$find.groupType;
3625
+ if (groupType) {
3626
+ draft[groupType].groups.push({
3627
+ id: id,
3628
+ selected: groups.byId[id].targets.allIds
3629
+ });
3630
+ }
3631
+ });
3632
+ /*
3633
+ _____ 2. Fill sourcesById _____
3634
+ 1. Loop though sources and add source to each group type
3635
+ */
3636
+ Object.keys(sources.byId).forEach(function (id) {
3637
+ groupTypes.forEach(function (_ref) {
3638
+ var syncType = _ref.syncType,
3639
+ groupType = _ref.groupType;
3640
+ if (sources.byId[id].types.includes(syncType)) {
3641
+ draft[groupType].sourcesById.push({
3642
+ id: id,
3643
+ name: id
3644
+ });
3645
+ }
3646
+ });
3647
+ });
3648
+ });
3649
+ return initialState;
3638
3650
  };
3639
- /**
3640
- * For a given ui component: gets wether the dialog is open or closed
3651
+ var groups = function groups(store) {
3652
+ return store.syncGroups.groups;
3653
+ };
3654
+ var sources = function sources(store) {
3655
+ return store.syncGroups.sources;
3656
+ };
3657
+ var createSyncGroupViewStateSelector = createSelector(groups, sources, createSyncGroupViewState);
3658
+
3659
+ var selector = /*#__PURE__*/Object.freeze({
3660
+ __proto__: null,
3661
+ createSyncGroupViewState: createSyncGroupViewState,
3662
+ createSyncGroupViewStateSelector: createSyncGroupViewStateSelector,
3663
+ groupTypes: groupTypes
3664
+ });
3665
+
3666
+ var syncGroupsListener = createListenerMiddleware();
3667
+ syncGroupsListener.startListening({
3668
+ matcher: isAnyOf(syncGroupsActions.syncGroupAddTarget, syncGroupsActions.syncGroupLinkTarget),
3669
+ effect: function () {
3670
+ var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
3671
+ var payload, groupId, linked, targetToUpdate, group;
3672
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3673
+ while (1) switch (_context.prev = _context.next) {
3674
+ case 0:
3675
+ payload = _ref.payload;
3676
+ listenerApi.cancelActiveListeners();
3677
+ groupId = payload.groupId, linked = payload.linked, targetToUpdate = payload.targetId;
3678
+ group = getSynchronizationGroup(listenerApi.getState(), groupId);
3679
+ if (!(!linked && group)) {
3680
+ _context.next = 17;
3681
+ break;
3682
+ }
3683
+ _context.t0 = group.type;
3684
+ _context.next = _context.t0 === SYNCGROUPS_TYPE_SETTIME ? 8 : _context.t0 === SYNCGROUPS_TYPE_SETBBOX ? 12 : 16;
3685
+ break;
3686
+ case 8:
3687
+ if (group.payloadByType[SYNCGROUPS_TYPE_SETTIME]) {
3688
+ _context.next = 10;
3689
+ break;
3690
+ }
3691
+ return _context.abrupt("return");
3692
+ case 10:
3693
+ listenerApi.dispatch(setTimeSync(group.payloadByType[SYNCGROUPS_TYPE_SETTIME], [{
3694
+ targetId: targetToUpdate,
3695
+ value: group.payloadByType[SYNCGROUPS_TYPE_SETTIME].value
3696
+ }], [groupId]));
3697
+ return _context.abrupt("break", 17);
3698
+ case 12:
3699
+ if (group.payloadByType[SYNCGROUPS_TYPE_SETBBOX]) {
3700
+ _context.next = 14;
3701
+ break;
3702
+ }
3703
+ return _context.abrupt("return");
3704
+ case 14:
3705
+ listenerApi.dispatch(setBboxSync(group.payloadByType[SYNCGROUPS_TYPE_SETBBOX], [{
3706
+ targetId: targetToUpdate,
3707
+ bbox: group.payloadByType[SYNCGROUPS_TYPE_SETBBOX].bbox,
3708
+ srs: group.payloadByType[SYNCGROUPS_TYPE_SETBBOX].srs
3709
+ }], [groupId]));
3710
+ return _context.abrupt("break", 17);
3711
+ case 16:
3712
+ return _context.abrupt("break", 17);
3713
+ case 17:
3714
+ case "end":
3715
+ return _context.stop();
3716
+ }
3717
+ }, _callee);
3718
+ }));
3719
+ function effect(_x, _x2) {
3720
+ return _effect.apply(this, arguments);
3721
+ }
3722
+ return effect;
3723
+ }()
3724
+ });
3725
+ syncGroupsListener.startListening({
3726
+ matcher: isAnyOf(syncGroupsActions.syncGroupAddGroup, syncGroupsActions.syncGroupRemoveGroup, syncGroupsActions.syncGroupAddSource, syncGroupsActions.syncGroupRemoveSource, syncGroupsActions.syncGroupAddTarget, syncGroupsActions.syncGroupRemoveTarget, syncGroupsActions.syncGroupLinkTarget),
3727
+ effect: function () {
3728
+ var _effect2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, listenerApi) {
3729
+ var viewState;
3730
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3731
+ while (1) switch (_context2.prev = _context2.next) {
3732
+ case 0:
3733
+ listenerApi.cancelActiveListeners();
3734
+ viewState = createSyncGroupViewStateSelector(listenerApi.getState());
3735
+ listenerApi.dispatch(syncGroupsActions.syncGroupSetViewState({
3736
+ viewState: viewState
3737
+ }));
3738
+ case 3:
3739
+ case "end":
3740
+ return _context2.stop();
3741
+ }
3742
+ }, _callee2);
3743
+ }));
3744
+ function effect(_x3, _x4) {
3745
+ return _effect2.apply(this, arguments);
3746
+ }
3747
+ return effect;
3748
+ }()
3749
+ });
3750
+
3751
+ /* *
3752
+ * Licensed under the Apache License, Version 2.0 (the "License");
3753
+ * you may not use this file except in compliance with the License.
3754
+ * You may obtain a copy of the License at
3641
3755
  *
3642
- * @param {object} store store object from which the ui state wll be extracted
3643
- * @param {string} dialogType type of the dialog
3644
- * @returns {boolean} returnType: boolean
3645
- */
3646
- var getisDialogOpen = createSelector(getDialogDetailsByType, function (details) {
3647
- if (details) {
3648
- return details.isOpen;
3649
- }
3650
- return false;
3651
- }, selectorMemoizationOptions);
3652
- /**
3653
- *For a given ui component: gets the active map Id
3756
+ * http://www.apache.org/licenses/LICENSE-2.0
3757
+ *
3758
+ * Unless required by applicable law or agreed to in writing, software
3759
+ * distributed under the License is distributed on an "AS IS" BASIS,
3760
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3761
+ * See the License for the specific language governing permissions and
3762
+ * limitations under the License.
3763
+ *
3764
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3765
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
3766
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3767
+ * */
3768
+ var SyncGroupTypeList = [SYNCGROUPS_TYPE_SETBBOX, SYNCGROUPS_TYPE_SETTIME];
3769
+ var SyncGroupActionOrigin;
3770
+ (function (SyncGroupActionOrigin) {
3771
+ SyncGroupActionOrigin["delete"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_DELETEACTION";
3772
+ SyncGroupActionOrigin["layerActions"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_LAYERACTIONS";
3773
+ SyncGroupActionOrigin["move"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_MOVEACTION";
3774
+ SyncGroupActionOrigin["add"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_ADDACTION";
3775
+ SyncGroupActionOrigin["autoLayerId"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_AUTOLAYERIDACTION";
3776
+ })(SyncGroupActionOrigin || (SyncGroupActionOrigin = {}));
3777
+
3778
+ var types$1 = /*#__PURE__*/Object.freeze({
3779
+ __proto__: null,
3780
+ get SyncGroupActionOrigin () { return SyncGroupActionOrigin; },
3781
+ SyncGroupTypeList: SyncGroupTypeList
3782
+ });
3783
+
3784
+ /* *
3785
+ * Licensed under the Apache License, Version 2.0 (the "License");
3786
+ * you may not use this file except in compliance with the License.
3787
+ * You may obtain a copy of the License at
3654
3788
  *
3655
- * @param {object} store store object from which the ui state wll be extracted
3656
- * @param {string} dialogType type of the dialog
3657
- * @returns {string} returnType: string - the active map id
3658
- */
3659
- var getDialogMapId = createSelector(getDialogDetailsByType, function (details) {
3660
- if (details) {
3661
- return details.activeMapId;
3662
- }
3663
- return '';
3664
- }, selectorMemoizationOptions);
3665
- /**
3666
- *For a given ui component: gets the order of visible dialog
3789
+ * http://www.apache.org/licenses/LICENSE-2.0
3667
3790
  *
3668
- * @param {object} store store object from which the ui state wll be extracted
3669
- * @param {DialogType} dialogType type of the dialog
3670
- * @returns {number} the higher the order number the higher the zIndex
3671
- */
3672
- var getDialogOrder = function getDialogOrder(store, dialogType) {
3673
- if (store && store.ui && store.ui.order) {
3674
- var order = store.ui.order;
3675
- var visibleOrder = order.filter(function (orderedDialogType) {
3676
- var _store$ui$dialogs$ord;
3677
- return (_store$ui$dialogs$ord = store.ui.dialogs[orderedDialogType]) === null || _store$ui$dialogs$ord === void 0 ? void 0 : _store$ui$dialogs$ord.isOpen;
3678
- });
3679
- if (!visibleOrder.includes(dialogType)) {
3680
- return 0;
3681
- }
3682
- return visibleOrder.length - visibleOrder.indexOf(dialogType);
3683
- }
3684
- return 0;
3791
+ * Unless required by applicable law or agreed to in writing, software
3792
+ * distributed under the License is distributed on an "AS IS" BASIS,
3793
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3794
+ * See the License for the specific language governing permissions and
3795
+ * limitations under the License.
3796
+ *
3797
+ * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3798
+ * Copyright 2020 - Finnish Meteorological Institute (FMI)
3799
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3800
+ * */
3801
+ var synchronizationGroupStore = function synchronizationGroupStore(store) {
3802
+ return store !== null && store !== void 0 && store.syncGroups ? store.syncGroups : null;
3803
+ };
3804
+ var getSynchronizationGroupStore = function getSynchronizationGroupStore(store) {
3805
+ return store !== null && store !== void 0 && store.syncGroups ? store.syncGroups : null;
3685
3806
  };
3686
3807
  /**
3687
- *For a given ui component: returns if ordered on top
3688
- *
3689
- * @param {object} store store object from which the ui state wll be extracted
3690
- * @param {DialogType} dialogType type of the dialog
3691
- * @returns {boolean}
3808
+ * Returns the synchronization source by id
3809
+ * @param store The app store
3810
+ * @param id The source id to find
3692
3811
  */
3693
- var getDialogIsOrderedOnTop = function getDialogIsOrderedOnTop(store, dialogType) {
3694
- if (store && store.ui && store.ui.order) {
3695
- var order = store.ui.order;
3696
- return order.includes(dialogType) && order.indexOf(dialogType) === 0;
3812
+ var getSyncSourceBySourceId = function getSyncSourceBySourceId(state, id) {
3813
+ if (state !== null && state !== void 0 && state.sources) {
3814
+ var sources = state.sources;
3815
+ if (sources.byId[id]) {
3816
+ return sources.byId[id];
3817
+ }
3697
3818
  }
3698
- return false;
3819
+ return null;
3699
3820
  };
3700
- var getDialogSource = createSelector(getDialogDetailsByType, function (details) {
3701
- if (details && details.source) {
3702
- return details.source;
3703
- }
3704
- return 'app';
3705
- }, selectorMemoizationOptions);
3706
- /**
3707
- * Get the active window that should receive keyboard shortcuts
3708
- *
3709
- * Example: getActiveWindowId(store)
3710
- * @param {object} store store object from which the window state will be extracted
3711
- * @returns {string} active window id
3712
- */
3713
- var getActiveWindowId = createSelector(getUiStore, function (store) {
3714
- return store === null || store === void 0 ? void 0 : store.activeWindowId;
3715
- }, selectorMemoizationOptions);
3716
- /**
3717
- * Gets the panelId of which the dialog is opened from
3718
- *
3719
- * Example: getSourcePanelId(store, 'publicWarnings')
3720
- * @param {object} store store object from which the panelId state will be extracted
3721
- * @returns {string} the dialog type
3722
- */
3723
- var getSourcePanelId = createSelector(function (store, dialogType) {
3724
- var _store$ui;
3725
- return (_store$ui = store.ui) === null || _store$ui === void 0 ? void 0 : _store$ui.dialogs[dialogType];
3726
- }, function (dialog) {
3727
- return (dialog === null || dialog === void 0 ? void 0 : dialog.sourcePanelId) || '';
3728
- }, selectorMemoizationOptions);
3729
- /**
3730
- * Gets if this is the active window
3731
- *
3732
- * Example: getIsActiveWindowId(store, viewId)
3733
- * @param {object} store store object from which the window state will be extracted
3734
- * @returns {string} active window id
3735
- */
3736
- var getIsActiveWindowId = createSelector(getUiStore, function (_store, viewId) {
3737
- return viewId;
3738
- }, function (store, viewId) {
3739
- return viewId === (store === null || store === void 0 ? void 0 : store.activeWindowId);
3821
+ var getTime = createSelector(getSyncSourceBySourceId, function (store) {
3822
+ var _store$payloadByType;
3823
+ return store !== null && store !== void 0 && (_store$payloadByType = store.payloadByType) !== null && _store$payloadByType !== void 0 && _store$payloadByType[SYNCGROUPS_TYPE_SETTIME] ? store.payloadByType[SYNCGROUPS_TYPE_SETTIME].value : null;
3740
3824
  }, selectorMemoizationOptions);
3741
- var getDialogIsLoading = createSelector(getDialogDetailsByType, function (details) {
3742
- return details && details.isLoading || false;
3825
+ var selectLinkedState = createSelector(synchronizationGroupStore, function (syncState) {
3826
+ return (syncState === null || syncState === void 0 ? void 0 : syncState.linkedState) || {
3827
+ links: {},
3828
+ sharedData: {}
3829
+ };
3830
+ });
3831
+ var getLinkedMaps = createSelector([selectLinkedState, function (store, panelId) {
3832
+ return panelId;
3833
+ }], function (linkedState, panelId) {
3834
+ return panelId && linkedState.links[panelId] || [];
3743
3835
  }, selectorMemoizationOptions);
3744
- var getDialogError = createSelector(getDialogDetailsByType, function (details) {
3745
- return details && details.error || '';
3836
+ var getLinkedFeatureProviders = createSelector(function (linkedState) {
3837
+ return linkedState;
3838
+ }, function (linkedState, props) {
3839
+ return props.mapId;
3840
+ }, function (linkedState, mapId) {
3841
+ return linkedState ? Object.keys(linkedState.links).filter(function (panelId) {
3842
+ return linkedState.links[panelId].includes(mapId);
3843
+ }) : [];
3844
+ });
3845
+ var selectSharedData = createSelector([selectLinkedState, function (store, panelId) {
3846
+ return panelId;
3847
+ }], function (linkedState, panelId) {
3848
+ var sharedDataForPanel = linkedState.sharedData[panelId];
3849
+ return sharedDataForPanel || {};
3746
3850
  }, selectorMemoizationOptions);
3747
- var getUiDialogsByActiveMapId = function getUiDialogsByActiveMapId(store, mapId) {
3748
- if (store && store.ui && store.ui.order) {
3749
- var foundDialogsIds = store.ui.order.filter(function (id) {
3750
- var _store$ui2;
3751
- return ((_store$ui2 = store.ui) === null || _store$ui2 === void 0 || (_store$ui2 = _store$ui2.dialogs[id]) === null || _store$ui2 === void 0 ? void 0 : _store$ui2.activeMapId) === mapId;
3752
- });
3753
- var foundDialogs = foundDialogsIds.reduce(function (list, id) {
3754
- var _store$ui3;
3755
- var dialog = (_store$ui3 = store.ui) === null || _store$ui3 === void 0 ? void 0 : _store$ui3.dialogs[id];
3756
- if (dialog) {
3757
- return list.concat(dialog);
3758
- }
3759
- return list;
3760
- }, []);
3761
- return foundDialogs.length ? foundDialogs : [];
3851
+ var selectLinkedPanelId = createSelector([selectLinkedState, function (_, mapViewId) {
3852
+ return mapViewId;
3853
+ }], function (linkedState, mapViewId) {
3854
+ if (!(linkedState !== null && linkedState !== void 0 && linkedState.links)) {
3855
+ return undefined;
3762
3856
  }
3763
- return [];
3764
- };
3765
-
3766
- var selectors$5 = /*#__PURE__*/Object.freeze({
3767
- __proto__: null,
3768
- getActiveWindowId: getActiveWindowId,
3769
- getDialogDetailsByType: getDialogDetailsByType,
3770
- getDialogError: getDialogError,
3771
- getDialogIsLoading: getDialogIsLoading,
3772
- getDialogIsOrderedOnTop: getDialogIsOrderedOnTop,
3773
- getDialogMapId: getDialogMapId,
3774
- getDialogOrder: getDialogOrder,
3775
- getDialogSource: getDialogSource,
3776
- getIsActiveWindowId: getIsActiveWindowId,
3777
- getSourcePanelId: getSourcePanelId,
3778
- getUiDialogsByActiveMapId: getUiDialogsByActiveMapId,
3779
- getUiStore: getUiStore,
3780
- getisDialogOpen: getisDialogOpen,
3781
- useAppSelector: useAppSelector$1
3857
+ // Find the panelId where mapView(s) is linked
3858
+ var panelId = Object.keys(linkedState.links).find(function (panelId) {
3859
+ var _linkedState$links$pa;
3860
+ return (_linkedState$links$pa = linkedState.links[panelId]) === null || _linkedState$links$pa === void 0 ? void 0 : _linkedState$links$pa.includes(mapViewId);
3861
+ });
3862
+ return panelId;
3863
+ });
3864
+ var selectMapViewsForPanelId = createSelector([function (linkedState, panelId) {
3865
+ return linkedState.links[panelId];
3866
+ }], function (mapViews) {
3867
+ if (!mapViews) {
3868
+ return undefined;
3869
+ }
3870
+ return mapViews;
3871
+ });
3872
+ var selectLinkedFeatures = createSelector([function (linkedState) {
3873
+ return linkedState;
3874
+ }, getLinkedFeatureProviders], function (linkedState, featureProviders) {
3875
+ var features = featureProviders.flatMap(function (providerId) {
3876
+ var _linkedState$sharedDa, _linkedState$sharedDa2;
3877
+ return (_linkedState$sharedDa = linkedState === null || linkedState === void 0 || (_linkedState$sharedDa2 = linkedState.sharedData) === null || _linkedState$sharedDa2 === void 0 || (_linkedState$sharedDa2 = _linkedState$sharedDa2[providerId]) === null || _linkedState$sharedDa2 === void 0 ? void 0 : _linkedState$sharedDa2.features) !== null && _linkedState$sharedDa !== void 0 ? _linkedState$sharedDa : [];
3878
+ });
3879
+ return features.filter(function (feature) {
3880
+ return feature !== undefined;
3881
+ });
3882
+ });
3883
+ var selectLinkedFormFeatures = createSelector([function (linkedState) {
3884
+ return linkedState;
3885
+ }, getLinkedFeatureProviders], function (linkedState, featureProviders) {
3886
+ var features = featureProviders.flatMap(function (providerId) {
3887
+ var _linkedState$sharedDa3, _linkedState$sharedDa4;
3888
+ return (_linkedState$sharedDa3 = linkedState === null || linkedState === void 0 || (_linkedState$sharedDa4 = linkedState.sharedData) === null || _linkedState$sharedDa4 === void 0 || (_linkedState$sharedDa4 = _linkedState$sharedDa4[providerId]) === null || _linkedState$sharedDa4 === void 0 ? void 0 : _linkedState$sharedDa4.formFeatures) !== null && _linkedState$sharedDa3 !== void 0 ? _linkedState$sharedDa3 : [];
3889
+ });
3890
+ return features.filter(function (feature) {
3891
+ return feature !== undefined;
3892
+ });
3893
+ });
3894
+ var getSelectedFeature = createSelector([
3895
+ // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
3896
+ function (state, mapId) {
3897
+ var _state$linkedState;
3898
+ return (_state$linkedState = state.linkedState) === null || _state$linkedState === void 0 ? void 0 : _state$linkedState.sharedData[mapId];
3899
+ }], function (sharedData) {
3900
+ var _features$;
3901
+ if (!sharedData) {
3902
+ return null;
3903
+ }
3904
+ var features = sharedData.features,
3905
+ selectedFeatureId = sharedData.selectedFeatureId;
3906
+ if (!features || !selectedFeatureId) {
3907
+ return null;
3908
+ }
3909
+ var selectedFeature = (_features$ = features[0]) === null || _features$ === void 0 ? void 0 : _features$.geoJSON.features.find(function (feature) {
3910
+ return feature.id === selectedFeatureId;
3911
+ });
3912
+ if (selectedFeature && selectedFeature.geometry.type === 'Point') {
3913
+ var _selectedFeature$prop, _selectedFeature$prop2, _selectedFeature$prop3;
3914
+ var coordinates = selectedFeature.geometry.coordinates;
3915
+ return {
3916
+ lat: coordinates[1],
3917
+ lon: coordinates[0],
3918
+ id: selectedFeature.id,
3919
+ name: (_selectedFeature$prop = selectedFeature.properties) === null || _selectedFeature$prop === void 0 ? void 0 : _selectedFeature$prop.name,
3920
+ occurrences: (_selectedFeature$prop2 = selectedFeature.properties) === null || _selectedFeature$prop2 === void 0 ? void 0 : _selectedFeature$prop2.occurrences,
3921
+ serviceId: (_selectedFeature$prop3 = selectedFeature.properties) === null || _selectedFeature$prop3 === void 0 ? void 0 : _selectedFeature$prop3.serviceId
3922
+ };
3923
+ }
3924
+ if (selectedFeature) {
3925
+ var _selectedFeature$prop4, _selectedFeature$prop5;
3926
+ var center$1 = center(selectedFeature);
3927
+ return {
3928
+ lat: center$1.geometry.coordinates[1],
3929
+ lon: center$1.geometry.coordinates[0],
3930
+ id: selectedFeature.id,
3931
+ name: (_selectedFeature$prop4 = selectedFeature.properties) === null || _selectedFeature$prop4 === void 0 ? void 0 : _selectedFeature$prop4.name,
3932
+ occurrences: (_selectedFeature$prop5 = selectedFeature.properties) === null || _selectedFeature$prop5 === void 0 ? void 0 : _selectedFeature$prop5.occurrences
3933
+ };
3934
+ }
3935
+ return null;
3936
+ });
3937
+ var getSelectedFeatureAsGeoJSON = createSelector([function (state, mapId) {
3938
+ var _state$linkedState2;
3939
+ return (_state$linkedState2 = state.linkedState) === null || _state$linkedState2 === void 0 ? void 0 : _state$linkedState2.sharedData[mapId];
3940
+ }], function (sharedData) {
3941
+ var _features$2;
3942
+ if (!sharedData) {
3943
+ return null;
3944
+ }
3945
+ var features = sharedData.features,
3946
+ selectedFeatureId = sharedData.selectedFeatureId;
3947
+ if (!features || !selectedFeatureId) {
3948
+ return null;
3949
+ }
3950
+ var selectedFeature = (_features$2 = features[0]) === null || _features$2 === void 0 ? void 0 : _features$2.geoJSON.features.find(function (feature) {
3951
+ return feature.id === selectedFeatureId;
3952
+ });
3953
+ return selectedFeature;
3782
3954
  });
3783
3955
 
3784
- /* *
3785
- * Licensed under the Apache License, Version 2.0 (the "License");
3786
- * you may not use this file except in compliance with the License.
3787
- * You may obtain a copy of the License at
3788
- *
3789
- * http://www.apache.org/licenses/LICENSE-2.0
3790
- *
3791
- * Unless required by applicable law or agreed to in writing, software
3792
- * distributed under the License is distributed on an "AS IS" BASIS,
3793
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3794
- * See the License for the specific language governing permissions and
3795
- * limitations under the License.
3796
- *
3797
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3798
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
3799
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3800
- * */
3801
- var DialogTypes;
3802
- (function (DialogTypes) {
3803
- DialogTypes["LayerInfo"] = "layerInfo";
3804
- DialogTypes["SyncGroups"] = "syncGroups";
3805
- DialogTypes["TimeSeriesSelect"] = "timeSeriesSelect";
3806
- DialogTypes["TimeSeriesManager"] = "timeSeriesManager";
3807
- DialogTypes["TimeSeriesInfo"] = "timeSeriesInfo";
3808
- DialogTypes["TimeSeriesLocationInfo"] = "timeSeriesLocationInfo";
3809
- DialogTypes["KeywordFilter"] = "keywordFilter";
3810
- DialogTypes["DimensionSelectEnsembleMember"] = "dimensionSelect-ensemble_member";
3811
- DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
3812
- DialogTypes["LayerManager"] = "layerManager";
3813
- DialogTypes["LayerSelect"] = "layerSelect";
3814
- DialogTypes["DrawingTool"] = "drawingTool";
3815
- DialogTypes["DockedLayerManager"] = "dockedLayerManager";
3816
- DialogTypes["ObjectManager"] = "objectManager";
3817
- DialogTypes["PublicWarnings"] = "publicWarnings";
3818
- DialogTypes["Search"] = "search";
3819
- DialogTypes["AreaObjectLoader"] = "areaObjectLoader";
3820
- DialogTypes["DataExplorer"] = "dataExplorer";
3821
- DialogTypes["DataExplorerInfo"] = "dataExplorerInfo";
3822
- DialogTypes["SelectedFeatures"] = "selectedFeatures";
3823
- DialogTypes["SoundingsSources"] = "soundingsSources";
3824
- DialogTypes["SoundingsLocations"] = "soundingsLocations";
3825
- DialogTypes["TimeseriesLocations"] = "timeseriesLocations";
3826
- })(DialogTypes || (DialogTypes = {}));
3827
-
3828
- var types$2 = /*#__PURE__*/Object.freeze({
3956
+ var selectors$5 = /*#__PURE__*/Object.freeze({
3829
3957
  __proto__: null,
3830
- get DialogTypes () { return DialogTypes; }
3958
+ getLinkedMaps: getLinkedMaps,
3959
+ getSelectedFeature: getSelectedFeature,
3960
+ getSelectedFeatureAsGeoJSON: getSelectedFeatureAsGeoJSON,
3961
+ getSynchronizationGroupStore: getSynchronizationGroupStore,
3962
+ getTime: getTime,
3963
+ selectLinkedFeatures: selectLinkedFeatures,
3964
+ selectLinkedFormFeatures: selectLinkedFormFeatures,
3965
+ selectLinkedPanelId: selectLinkedPanelId,
3966
+ selectMapViewsForPanelId: selectMapViewsForPanelId,
3967
+ selectSharedData: selectSharedData
3831
3968
  });
3832
3969
 
3833
- /* *
3834
- * Licensed under the Apache License, Version 2.0 (the "License");
3835
- * you may not use this file except in compliance with the License.
3836
- * You may obtain a copy of the License at
3837
- *
3838
- * http://www.apache.org/licenses/LICENSE-2.0
3839
- *
3840
- * Unless required by applicable law or agreed to in writing, software
3841
- * distributed under the License is distributed on an "AS IS" BASIS,
3842
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3843
- * See the License for the specific language governing permissions and
3844
- * limitations under the License.
3845
- *
3846
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3847
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
3848
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3849
- * */
3850
- var useSetupDialog = function useSetupDialog(dialogType) {
3851
- var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'app';
3970
+ var useUpdateSharedData = function useUpdateSharedData(data, panelId) {
3971
+ var sharedData = useSelector(function (state) {
3972
+ return selectSharedData(state, panelId);
3973
+ });
3974
+ var linkedMaps = useSelector(function (state) {
3975
+ return getLinkedMaps(state, panelId);
3976
+ });
3852
3977
  var dispatch = useDispatch();
3853
- var onCloseDialog = useCallback(function () {
3854
- dispatch(uiActions.setToggleOpenDialog({
3855
- type: dialogType,
3856
- setOpen: false
3857
- }));
3858
- }, [dialogType, dispatch]);
3859
- var registerDialog = useCallback(function () {
3860
- dispatch(uiActions.registerDialog({
3861
- type: dialogType,
3862
- setOpen: false,
3863
- source: source
3864
- }));
3865
- }, [dialogType, dispatch, source]);
3866
- var unregisterDialog = useCallback(function () {
3867
- dispatch(uiActions.unregisterDialog({
3868
- type: dialogType
3869
- }));
3870
- }, [dialogType, dispatch]);
3871
- // Register this dialog in the store
3872
3978
  useEffect(function () {
3873
- registerDialog();
3874
- return function () {
3875
- unregisterDialog();
3876
- };
3877
- // eslint-disable-next-line react-hooks/exhaustive-deps
3878
- }, []);
3879
- var uiIsOrderedOnTop = useAppSelector$1(function (store) {
3880
- return getDialogIsOrderedOnTop(store, dialogType);
3881
- });
3882
- var setDialogOrder = useCallback(function () {
3883
- if (!uiIsOrderedOnTop) {
3884
- dispatch(uiActions.orderDialog({
3885
- type: dialogType
3979
+ var diff = _objectSpread2(_objectSpread2({}, sharedData), data);
3980
+ if (panelId && (linkedMaps === null || linkedMaps === void 0 ? void 0 : linkedMaps.length) > 0 && !isEqual(diff, sharedData)) {
3981
+ dispatch(syncGroupsActions.addSharedData({
3982
+ panelId: panelId,
3983
+ data: data
3886
3984
  }));
3887
3985
  }
3888
- }, [dialogType, dispatch, uiIsOrderedOnTop]);
3889
- var dialogOrder = useAppSelector$1(function (store) {
3890
- return getDialogOrder(store, dialogType);
3891
- });
3892
- var uiSource = useAppSelector$1(function (store) {
3893
- return getDialogSource(store, dialogType);
3894
- });
3895
- var isDialogOpen = useAppSelector$1(function (store) {
3896
- return getisDialogOpen(store, dialogType);
3897
- });
3898
- var uiIsLoading = useAppSelector$1(function (store) {
3899
- return getDialogIsLoading(store, dialogType);
3900
- });
3901
- var uiError = useAppSelector$1(function (store) {
3902
- return getDialogError(store, dialogType);
3903
- });
3904
- return {
3905
- setDialogOrder: setDialogOrder,
3906
- dialogOrder: dialogOrder,
3907
- onCloseDialog: onCloseDialog,
3908
- uiSource: uiSource,
3909
- isDialogOpen: isDialogOpen,
3910
- uiIsLoading: uiIsLoading,
3911
- uiError: uiError
3912
- };
3986
+ }, [panelId, linkedMaps, data, sharedData, dispatch]);
3987
+ useEffect(function () {
3988
+ return function () {
3989
+ if (panelId) {
3990
+ dispatch(syncGroupsActions.deleteSharedData({
3991
+ panelId: panelId
3992
+ }));
3993
+ }
3994
+ };
3995
+ }, [dispatch, panelId]);
3996
+ return sharedData;
3913
3997
  };
3914
3998
 
3915
3999
  /* *
@@ -3925,22 +4009,15 @@ var useSetupDialog = function useSetupDialog(dialogType) {
3925
4009
  * See the License for the specific language governing permissions and
3926
4010
  * limitations under the License.
3927
4011
  *
3928
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3929
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
4012
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4013
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
3930
4014
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3931
4015
  * */
3932
- /* Type constants */
3933
- var SYNCGROUPS_TYPE_SETTIME = 'SYNCGROUPS_TYPE_SETTIME';
3934
- var SYNCGROUPS_TYPE_SETBBOX = 'SYNCGROUPS_TYPE_SETBBOX';
3935
- var SYNCGROUPS_TYPE_SETLAYERACTIONS = 'SYNCGROUPS_TYPE_SETLAYERACTIONS';
3936
- var SYNCGROUPS_SET_VIEW_STATE = 'SYNCGROUPS_SET_VIEW_STATE';
4016
+ var ANY_EDR_SERVICE = 'any_edr';
3937
4017
 
3938
- var constants$2 = /*#__PURE__*/Object.freeze({
4018
+ var constants$1 = /*#__PURE__*/Object.freeze({
3939
4019
  __proto__: null,
3940
- SYNCGROUPS_SET_VIEW_STATE: SYNCGROUPS_SET_VIEW_STATE,
3941
- SYNCGROUPS_TYPE_SETBBOX: SYNCGROUPS_TYPE_SETBBOX,
3942
- SYNCGROUPS_TYPE_SETLAYERACTIONS: SYNCGROUPS_TYPE_SETLAYERACTIONS,
3943
- SYNCGROUPS_TYPE_SETTIME: SYNCGROUPS_TYPE_SETTIME
4020
+ ANY_EDR_SERVICE: ANY_EDR_SERVICE
3944
4021
  });
3945
4022
 
3946
4023
  /* *
@@ -3956,655 +4033,314 @@ var constants$2 = /*#__PURE__*/Object.freeze({
3956
4033
  * See the License for the specific language governing permissions and
3957
4034
  * limitations under the License.
3958
4035
  *
3959
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3960
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
4036
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4037
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
3961
4038
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
3962
4039
  * */
3963
- /**
3964
- * The removeInPlace() method modifies an array in place, by removing elements that pass the test implemented by the provided function.
3965
- *
3966
- * NOTE: This should only be used on draft properties as provided by the immer produce library, as modifying elements in place is bad practice on non draft variables.
3967
- *
3968
- * @param inDraftArray The draft array to filter, will be modified in place.
3969
- * @param condition Function to check each element in the array
3970
- */
3971
- var removeInPlace = function removeInPlace(inDraftArray, condition) {
3972
- var index = 0;
3973
- inDraftArray.forEach(function (e, i) {
3974
- if (!condition(e)) {
3975
- if (i !== index) {
3976
- // eslint-disable-next-line no-param-reassign
3977
- inDraftArray[index] = e;
3978
- }
3979
- index += 1;
3980
- }
3981
- });
3982
- // eslint-disable-next-line no-param-reassign
3983
- inDraftArray.length = index;
3984
- };
3985
-
3986
- var initialState$3 = {
3987
- sources: {
3988
- byId: {},
3989
- allIds: []
3990
- },
3991
- groups: {
3992
- byId: {},
3993
- allIds: []
3994
- },
3995
- viewState: {
3996
- timeslider: {
3997
- groups: [],
3998
- sourcesById: []
3999
- },
4000
- zoompane: {
4001
- groups: [],
4002
- sourcesById: []
4003
- },
4004
- level: {
4005
- groups: [],
4006
- sourcesById: []
4007
- }
4008
- },
4009
- linkedState: {
4010
- links: {},
4011
- sharedData: {}
4012
- },
4013
- isTimeScrollingEnabled: false
4014
- };
4015
- var slice$4 = createSlice({
4016
- initialState: initialState$3,
4017
- name: 'synchronizationGroupsReducer',
4018
- reducers: {
4019
- /** Sets the links map.
4020
- * This is used to override the links when changing workspaces.
4021
- * @param draft sync state
4022
- * @param {Record<string, string[]>} action.newLinks the new links object
4023
- */
4024
- setLinkedMap: function setLinkedMap(draft, action) {
4025
- var newLinks = action.payload.newLinks;
4026
- draft.linkedState.links = newLinks;
4027
- },
4028
- /** Updates the links map.
4029
- * This is used to update the links when operating the link menu.
4030
- * @param draft sync state
4031
- * @param {string} action.panelId id of the panel updating it's links
4032
- * @param {string[]} action.mapIds the new linked maps
4033
- */
4034
- updateLinkedMap: function updateLinkedMap(draft, action) {
4040
+ var loadingIndicatorAdapter = createEntityAdapter();
4041
+ var initLoadingIndicatorStateForId = function initLoadingIndicatorStateForId(draft, id) {
4042
+ if (!draft.entities[id]) {
4043
+ loadingIndicatorAdapter.addOne(draft, {
4044
+ id: id,
4045
+ getMapLoadingPercentage: 100,
4046
+ isGetCapabilitiesLoading: false,
4047
+ isEDRLoading: false
4048
+ });
4049
+ }
4050
+ };
4051
+ var slice$3 = createSlice({
4052
+ initialState: loadingIndicatorAdapter.getInitialState(),
4053
+ name: 'loadingIndicatorReducer',
4054
+ reducers: {
4055
+ setGetMapIsLoading: function setGetMapIsLoading(draft, action) {
4035
4056
  var _action$payload = action.payload,
4036
- panelId = _action$payload.panelId,
4037
- mapIds = _action$payload.mapIds;
4038
- draft.linkedState.links[panelId] = mapIds;
4039
- },
4040
- removeLinkedMap: function removeLinkedMap(draft, action) {
4041
- var panelId = action.payload;
4042
- // Remove panelId from sources
4043
- delete draft.sources.byId[panelId];
4044
- removeInPlace(draft.sources.allIds, function (_id) {
4045
- return _id === panelId;
4046
- });
4047
- // Remove panelId from any arrays in linkedState
4048
- delete draft.linkedState.links[panelId];
4049
- delete draft.linkedState.sharedData[panelId];
4050
- Object.keys(draft.linkedState.links).forEach(function (key) {
4051
- var arr = draft.linkedState.links[key];
4052
- removeInPlace(arr, function (_id) {
4053
- return _id === panelId;
4054
- });
4055
- });
4056
- // Remove panelId from groups
4057
- Object.keys(draft.groups.byId).forEach(function (groupId) {
4058
- var group = draft.groups.byId[groupId];
4059
- delete group.targets.byId[panelId];
4060
- removeInPlace(group.targets.allIds, function (_id) {
4061
- return _id === panelId;
4062
- });
4063
- });
4057
+ id = _action$payload.id,
4058
+ getMapLoadingPercentage = _action$payload.getMapLoadingPercentage;
4059
+ initLoadingIndicatorStateForId(draft, id);
4060
+ draft.entities[id].getMapLoadingPercentage = getMapLoadingPercentage;
4064
4061
  },
4065
- addSharedData: function addSharedData(draft, action) {
4062
+ setGetCapabilitiesIsLoading: function setGetCapabilitiesIsLoading(draft, action) {
4066
4063
  var _action$payload2 = action.payload,
4067
- panelId = _action$payload2.panelId,
4068
- data = _action$payload2.data;
4069
- draft.linkedState.sharedData[panelId] = _objectSpread2(_objectSpread2({}, draft.linkedState.sharedData[panelId]), data);
4070
- },
4071
- deleteSharedData: function deleteSharedData(draft, action) {
4072
- var panelId = action.payload.panelId;
4073
- delete draft.linkedState.sharedData[panelId];
4064
+ id = _action$payload2.id,
4065
+ isGetCapabilitiesLoading = _action$payload2.isGetCapabilitiesLoading;
4066
+ initLoadingIndicatorStateForId(draft, id);
4067
+ draft.entities[id].isGetCapabilitiesLoading = isGetCapabilitiesLoading;
4074
4068
  },
4075
- syncGroupAddSource: function syncGroupAddSource(draft, action) {
4069
+ setEDRIsLoading: function setEDRIsLoading(draft, action) {
4076
4070
  var _action$payload3 = action.payload,
4077
4071
  id = _action$payload3.id,
4078
- payloadType = _action$payload3.type,
4079
- defaultPayload = _action$payload3.defaultPayload;
4080
- if (!draft.sources.byId[id]) {
4081
- draft.sources.byId[id] = {
4082
- types: payloadType,
4083
- payloadByType: {
4084
- SYNCGROUPS_TYPE_SETTIME: defaultPayload,
4085
- SYNCGROUPS_TYPE_SETBBOX: defaultPayload,
4086
- SYNCGROUPS_TYPE_SETLAYERACTIONS: defaultPayload
4087
- }
4088
- };
4089
- draft.sources.allIds.push(id);
4090
- }
4091
- /* Now try to initialize with the correct values from the state */
4092
- draft.groups.allIds.forEach(function (groupId) {
4093
- var syncronizationGroup = draft.groups.byId[groupId];
4094
- /* Check if the source is in the target list of the synchonizationGroup */
4095
- var source = syncronizationGroup.targets.byId[id];
4096
- var type = syncronizationGroup.type;
4097
- /* If the source is part of the target list, and is linked, continue syncing the other targets */
4098
- if (source && source.linked) {
4099
- draft.sources.byId[id].payloadByType[type] = syncronizationGroup.payloadByType && syncronizationGroup.payloadByType[type] || defaultPayload;
4100
- }
4101
- });
4102
- },
4103
- syncGroupRemoveSource: function syncGroupRemoveSource(draft, action) {
4104
- var id = action.payload.id;
4105
- if (draft.sources.byId[id]) {
4106
- delete draft.sources.byId[id];
4107
- removeInPlace(draft.sources.allIds, function (_id) {
4108
- return _id === id;
4109
- });
4110
- }
4111
- },
4112
- syncGroupAddTarget: function syncGroupAddTarget(draft, action) {
4113
- var _synchronizationGroup;
4114
- var _action$payload4 = action.payload,
4115
- groupId = _action$payload4.groupId,
4116
- targetId = _action$payload4.targetId,
4117
- linked = _action$payload4.linked;
4118
- var synchronizationGroup = draft.groups.byId[groupId];
4119
- if (!synchronizationGroup) {
4120
- console.warn("SYNCGROUPS_ADD_TARGET: Group ".concat(groupId, " does not exist."));
4121
- return;
4122
- }
4123
- if (!targetId) {
4124
- console.warn("SYNCGROUPS_ADD_TARGET: targetId is not defined.");
4125
- return;
4126
- }
4127
- if (synchronizationGroup.targets.allIds.includes(targetId)) {
4128
- return;
4129
- }
4130
- var isSourceLinked = (_synchronizationGroup = synchronizationGroup.targets.byId[targetId]) === null || _synchronizationGroup === void 0 ? void 0 : _synchronizationGroup.linked;
4131
- synchronizationGroup.targets.allIds.push(targetId);
4132
- synchronizationGroup.targets.byId[targetId] = {
4133
- linked: linked !== false
4134
- };
4135
- if (isSourceLinked) {
4136
- var type = synchronizationGroup.type;
4137
- draft.sources.byId[targetId].payloadByType[type] = synchronizationGroup.payloadByType[type];
4138
- }
4139
- },
4140
- syncGroupRemoveTarget: function syncGroupRemoveTarget(draft, action) {
4141
- var _action$payload5 = action.payload,
4142
- groupId = _action$payload5.groupId,
4143
- targetId = _action$payload5.targetId;
4144
- if (!draft.groups.byId[groupId]) {
4145
- return;
4146
- }
4147
- if (!draft.groups.byId[groupId].targets.allIds.includes(targetId)) {
4148
- return;
4149
- }
4150
- delete draft.groups.byId[groupId].targets.byId[targetId];
4151
- removeInPlace(draft.groups.byId[groupId].targets.allIds, function (_id) {
4152
- return _id === targetId;
4153
- });
4154
- },
4155
- syncGroupLinkTarget: function syncGroupLinkTarget(draft, action) {
4156
- var _action$payload6 = action.payload,
4157
- groupId = _action$payload6.groupId,
4158
- targetId = _action$payload6.targetId,
4159
- linked = _action$payload6.linked;
4160
- if (!draft.groups.byId[groupId] || !draft.groups.byId[groupId].targets.byId[targetId]) {
4161
- return;
4162
- }
4163
- draft.groups.byId[groupId].targets.byId[targetId].linked = linked;
4164
- },
4165
- syncGroupAddGroup: function syncGroupAddGroup(draft, action) {
4166
- var _action$payload7 = action.payload,
4167
- groupId = _action$payload7.groupId,
4168
- type = _action$payload7.type,
4169
- title = _action$payload7.title;
4170
- if (draft.groups.byId[groupId]) {
4171
- return;
4172
- }
4173
- draft.groups.byId[groupId] = {
4174
- title: title,
4175
- type: type,
4176
- payloadByType: {
4177
- SYNCGROUPS_TYPE_SETTIME: null,
4178
- SYNCGROUPS_TYPE_SETBBOX: null
4179
- },
4180
- targets: {
4181
- allIds: [],
4182
- byId: {}
4183
- }
4184
- };
4185
- draft.groups.allIds.push(groupId);
4186
- },
4187
- syncGroupRemoveGroup: function syncGroupRemoveGroup(draft, action) {
4188
- var groupId = action.payload.groupId;
4189
- if (!draft.groups.byId[groupId]) {
4190
- return;
4072
+ isEDRLoading = _action$payload3.isEDRLoading;
4073
+ initLoadingIndicatorStateForId(draft, id);
4074
+ // When one EDR is loading with a known id (panelId), do not set the any ANY_EDR_SERVICE as the panelId is known.
4075
+ if (isEDRLoading && id === ANY_EDR_SERVICE && draft.ids.some(function (id) {
4076
+ var _draft$entities$id;
4077
+ return (_draft$entities$id = draft.entities[id]) === null || _draft$entities$id === void 0 ? void 0 : _draft$entities$id.isEDRLoading;
4078
+ })) {
4079
+ draft.entities[id].isEDRLoading = false;
4080
+ } else {
4081
+ draft.entities[id].isEDRLoading = isEDRLoading;
4191
4082
  }
4192
- delete draft.groups.byId[groupId];
4193
- removeInPlace(draft.groups.allIds, function (_groupId) {
4194
- return _groupId === groupId;
4195
- });
4196
- },
4197
- syncGroupClear: function syncGroupClear() {
4198
- return initialState$3;
4199
- },
4200
- syncGroupSetViewState: function syncGroupSetViewState(draft, action) {
4201
- var viewState = action.payload.viewState;
4202
- draft.viewState = viewState;
4203
- },
4204
- syncGroupToggleIsTimeScrollingEnabled: function syncGroupToggleIsTimeScrollingEnabled(draft, action) {
4205
- draft.isTimeScrollingEnabled = action.payload.isTimeScrollingEnabled;
4206
4083
  }
4207
4084
  },
4208
4085
  extraReducers: function extraReducers(builder) {
4209
- builder.addCase(setTimeSync, function (draft, action) {
4210
- return setBboxOrTimeSync(draft, action);
4211
- }).addCase(setBboxSync, function (draft, action) {
4212
- return setBboxOrTimeSync(draft, action);
4086
+ builder.addCase(mapActions.unregisterMap, function (draft, action) {
4087
+ var mapId = action.payload.mapId;
4088
+ if (draft.entities[mapId]) {
4089
+ loadingIndicatorAdapter.removeOne(draft, mapId);
4090
+ }
4213
4091
  });
4214
4092
  }
4215
4093
  });
4216
- var getPayLoadKey = function getPayLoadKey(type) {
4217
- switch (type) {
4218
- case setTimeSync.type:
4219
- return SYNCGROUPS_TYPE_SETTIME;
4220
- case setBboxSync.type:
4221
- return SYNCGROUPS_TYPE_SETBBOX;
4222
- default:
4223
- return null;
4224
- }
4225
- };
4226
- var mergePayloadInToState = function mergePayloadInToState(draftSource, payloadKey, payload) {
4227
- if (!draftSource) {
4228
- // Do nothing if draftSource is undefined/null
4229
- return;
4230
- }
4231
- if (!draftSource.payloadByType) {
4232
- draftSource.payloadByType = {};
4233
- draftSource.payloadByType[payloadKey] = payload;
4234
- return;
4094
+ var loadingIndicatorActions = slice$3.actions,
4095
+ loadingIndicatorReducer = slice$3.reducer;
4096
+
4097
+ /* *
4098
+ * Licensed under the Apache License, Version 2.0 (the "License");
4099
+ * you may not use this file except in compliance with the License.
4100
+ * You may obtain a copy of the License at
4101
+ *
4102
+ * http://www.apache.org/licenses/LICENSE-2.0
4103
+ *
4104
+ * Unless required by applicable law or agreed to in writing, software
4105
+ * distributed under the License is distributed on an "AS IS" BASIS,
4106
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4107
+ * See the License for the specific language governing permissions and
4108
+ * limitations under the License.
4109
+ *
4110
+ * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4111
+ * Copyright 2024 - Finnish Meteorological Institute (FMI)
4112
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4113
+ * */
4114
+ var EMPTY_LOADING_INDICATOR = {
4115
+ entities: {},
4116
+ ids: []
4117
+ };
4118
+ var _loadingIndicatorAdap = loadingIndicatorAdapter.getSelectors(function (state) {
4119
+ var _state$loadingIndicat;
4120
+ return (_state$loadingIndicat = state === null || state === void 0 ? void 0 : state.loadingIndicator) !== null && _state$loadingIndicat !== void 0 ? _state$loadingIndicat : EMPTY_LOADING_INDICATOR;
4121
+ }),
4122
+ selectLoadingIndicatorById = _loadingIndicatorAdap.selectById;
4123
+ var getMapLoadingPercentage = createSelector(selectLoadingIndicatorById, function (loadingIndicator) {
4124
+ return loadingIndicator ? loadingIndicator === null || loadingIndicator === void 0 ? void 0 : loadingIndicator.getMapLoadingPercentage : 100;
4125
+ }, selectorMemoizationOptions);
4126
+ var isGetMapLoading = createSelector(getMapLoadingPercentage, function (percentage) {
4127
+ return percentage !== 100;
4128
+ }, selectorMemoizationOptions);
4129
+ var isGetCapabilitiesLoading = createSelector(selectLoadingIndicatorById, function (loadingIndicator) {
4130
+ return (loadingIndicator === null || loadingIndicator === void 0 ? void 0 : loadingIndicator.isGetCapabilitiesLoading) || false;
4131
+ }, selectorMemoizationOptions);
4132
+ var isAnyEdrTypeLoading = function isAnyEdrTypeLoading(loadingIndicator) {
4133
+ return (loadingIndicator === null || loadingIndicator === void 0 ? void 0 : loadingIndicator.isEDRLoading) || false;
4134
+ };
4135
+ var isEDRLoading = createSelector(selectLoadingIndicatorById, isAnyEdrTypeLoading, selectorMemoizationOptions);
4136
+ var isAnyEDRLoading = createSelector([function (store) {
4137
+ return selectLoadingIndicatorById(store, ANY_EDR_SERVICE);
4138
+ }], isAnyEdrTypeLoading, selectorMemoizationOptions);
4139
+ var isLoading = createSelector([isGetMapLoading, isGetCapabilitiesLoading, isEDRLoading, isAnyEDRLoading], function (isGetMapLoading, isGetCapabilitiesLoading, isEDRRLoading, isAnyEDRLoading) {
4140
+ return isGetMapLoading || isGetCapabilitiesLoading || isEDRRLoading || isAnyEDRLoading;
4141
+ }, selectorMemoizationOptions);
4142
+
4143
+ var selectors$4 = /*#__PURE__*/Object.freeze({
4144
+ __proto__: null,
4145
+ getMapLoadingPercentage: getMapLoadingPercentage,
4146
+ isEDRLoading: isEDRLoading,
4147
+ isGetCapabilitiesLoading: isGetCapabilitiesLoading,
4148
+ isGetMapLoading: isGetMapLoading,
4149
+ isLoading: isLoading,
4150
+ selectLoadingIndicatorById: selectLoadingIndicatorById
4151
+ });
4152
+
4153
+ var genericActions = _objectSpread2(_objectSpread2({}, syncGroupsActions), {}, {
4154
+ initialSyncState: initialState$3,
4155
+ setTime: setTime,
4156
+ setBbox: setBbox
4157
+ });
4158
+
4159
+ /* *
4160
+ * Licensed under the Apache License, Version 2.0 (the "License");
4161
+ * you may not use this file except in compliance with the License.
4162
+ * You may obtain a copy of the License at
4163
+ *
4164
+ * http://www.apache.org/licenses/LICENSE-2.0
4165
+ *
4166
+ * Unless required by applicable law or agreed to in writing, software
4167
+ * distributed under the License is distributed on an "AS IS" BASIS,
4168
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4169
+ * See the License for the specific language governing permissions and
4170
+ * limitations under the License.
4171
+ *
4172
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4173
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
4174
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4175
+ * */
4176
+ var useAppSelector$1 = useSelector;
4177
+ var getUiStore = function getUiStore(store) {
4178
+ if (store !== null && store !== void 0 && store.ui) {
4179
+ return store.ui;
4235
4180
  }
4236
- draftSource.payloadByType[payloadKey] = merge(draftSource.payloadByType[payloadKey], payload);
4181
+ return null;
4237
4182
  };
4238
- var setBboxOrTimeSync = function setBboxOrTimeSync(draft, action) {
4239
- var _action$payload8 = action.payload,
4240
- targets = _action$payload8.targets,
4241
- source = _action$payload8.source,
4242
- groups = _action$payload8.groups;
4243
- if (source) {
4244
- var payloadKey = getPayLoadKey(action.type);
4245
- if (!source.payload || !payloadKey) {
4246
- console.warn('Wrong sync action: ', action);
4247
- return;
4248
- }
4249
- mergePayloadInToState(draft.sources.byId[source.payload.sourceId], payloadKey, source.payload);
4250
- /* Update all targets */
4251
- targets.forEach(function (target) {
4252
- mergePayloadInToState(draft.sources.byId[target.targetId], payloadKey, source.payload);
4253
- });
4254
- /* Set the value in the group */
4255
- groups.forEach(function (group) {
4256
- mergePayloadInToState(draft.groups.byId[group], payloadKey, source.payload);
4257
- });
4183
+ /**
4184
+ * Gets the active map Id and wether a dialog is open or closed
4185
+ *
4186
+ * Example: getDialogDetailsByType(store, 'legend')
4187
+ * @param {object} store store object from which the ui state wll be extracted
4188
+ * @param {string} dialogType type of the dialog
4189
+ * @returns {array} [string, boolean] first element gives the active map id, second element whether the dialog is open
4190
+ */
4191
+ var getDialogDetailsByType = function getDialogDetailsByType(store, dialogType) {
4192
+ var _store$ui;
4193
+ if (store !== null && store !== void 0 && (_store$ui = store.ui) !== null && _store$ui !== void 0 && (_store$ui = _store$ui.dialogs) !== null && _store$ui !== void 0 && _store$ui[dialogType]) {
4194
+ return store.ui.dialogs[dialogType];
4258
4195
  }
4259
- };
4260
- var _slice$actions = slice$4.actions,
4261
- syncGroupAddGroup = _slice$actions.syncGroupAddGroup;
4262
- _slice$actions.syncGroupAddSource;
4263
- var syncGroupAddTarget = _slice$actions.syncGroupAddTarget;
4264
- _slice$actions.syncGroupClear;
4265
- _slice$actions.syncGroupLinkTarget;
4266
- _slice$actions.syncGroupRemoveGroup;
4267
- _slice$actions.syncGroupRemoveSource;
4268
- _slice$actions.syncGroupRemoveTarget;
4269
- _slice$actions.syncGroupSetViewState;
4270
- var syncGroupsReducer = slice$4.reducer,
4271
- syncGroupsActions = slice$4.actions;
4272
-
4273
- var syncGroupStore = function syncGroupStore(store) {
4274
- return store.syncGroups || null;
4196
+ return null;
4275
4197
  };
4276
4198
  /**
4277
- * Gets synchronization group state
4199
+ * For a given ui component: gets wether the dialog is open or closed
4278
4200
  *
4279
- * Example: synchronizationGroupState = getSynchronizationGroupState(store)
4280
- * @param {object} store store: object - Store object
4281
- * @returns {object} returnType: SynchronizationGroupState
4201
+ * @param {object} store store object from which the ui state wll be extracted
4202
+ * @param {string} dialogType type of the dialog
4203
+ * @returns {boolean} returnType: boolean
4282
4204
  */
4283
- var getSynchronizationGroupState = function getSynchronizationGroupState(store) {
4284
- var state = syncGroupStore(store);
4285
- return state || null;
4286
- };
4287
- var getSynchronizationGroup = createSelector([syncGroupStore, function (syncGroupStore, id) {
4288
- return id;
4289
- }], function (syncGroupState, id) {
4290
- return syncGroupState.groups.byId[id];
4291
- }, selectorMemoizationOptions);
4292
- var getSynchronizationGroupSource = createSelector([syncGroupStore, function (syncGroupStore, id) {
4293
- return id;
4294
- }], function (syncGroupState, id) {
4295
- return syncGroupState.sources.byId[id];
4205
+ var getisDialogOpen = createSelector(getDialogDetailsByType, function (details) {
4206
+ if (details) {
4207
+ return details.isOpen;
4208
+ }
4209
+ return false;
4296
4210
  }, selectorMemoizationOptions);
4297
- var getTargets = createSelector([syncGroupStore, function (syncGroupStore, payload) {
4298
- return payload;
4299
- }, function (syncGroupStore, payload, actionType) {
4300
- return actionType;
4301
- }], function (syncGroups, payload, actionType) {
4302
- var actionPayloads = [];
4303
- var targetsInActionPayload = {};
4304
- if (syncGroups && payload) {
4305
- /* Backwards compatibility, if there are no groups, connect everything */
4306
- if (syncGroups.groups.allIds.length === 0) {
4307
- syncGroups.sources.allIds.forEach(function (targetId) {
4308
- // Only add if should react to this action
4309
- if (syncGroups.sources.byId[targetId].types.includes(actionType)) {
4310
- /* Remember that we have already added this target in the action payloads, prevents adding it twice */
4311
- targetsInActionPayload[targetId] = true;
4312
- /* Compose the payload */
4313
- var newPayload = _objectSpread2({
4314
- targetId: targetId
4315
- }, payload);
4316
- actionPayloads.push(newPayload);
4317
- }
4318
- });
4319
- }
4320
- syncGroups.groups.allIds.forEach(function (id) {
4321
- var syncronizationGroup = syncGroups.groups.byId[id];
4322
- if (actionType === syncronizationGroup.type) {
4323
- /* Check if the source is in the target list of the synchonizationGroup */
4324
- var source = syncronizationGroup.targets.byId[payload.sourceId];
4325
- /* If the source is part of the target list, and is linked, continue syncing the other targets */
4326
- if (source && source.linked) {
4327
- syncronizationGroup.targets.allIds.forEach(function (targetId) {
4328
- var target = syncronizationGroup.targets.byId[targetId];
4329
- if (target.linked && !targetsInActionPayload[targetId]) {
4330
- /* Remember that we have already added this target in the action payloads, prevents adding it twice */
4331
- targetsInActionPayload[targetId] = true;
4332
- /* Compose the payload */
4333
- var newPayload = _objectSpread2({
4334
- targetId: targetId
4335
- }, payload);
4336
- actionPayloads.push(newPayload);
4337
- }
4338
- });
4339
- }
4340
- }
4341
- });
4211
+ /**
4212
+ *For a given ui component: gets the active map Id
4213
+ *
4214
+ * @param {object} store store object from which the ui state wll be extracted
4215
+ * @param {string} dialogType type of the dialog
4216
+ * @returns {string} returnType: string - the active map id
4217
+ */
4218
+ var getDialogMapId = createSelector(getDialogDetailsByType, function (details) {
4219
+ if (details) {
4220
+ return details.activeMapId;
4342
4221
  }
4343
- return actionPayloads;
4222
+ return '';
4344
4223
  }, selectorMemoizationOptions);
4345
- var getTargetGroups = createSelector([syncGroupStore, function (syncGroupStore, payload) {
4346
- return payload;
4347
- }, function (syncGroupStore, payload, actionType) {
4348
- return actionType;
4349
- }], function (syncGroups, payload, actionType) {
4350
- var groups = syncGroups.groups.allIds.reduce(function (list, groupId) {
4351
- var syncronizationGroup = syncGroups.groups.byId[groupId];
4352
- if (actionType === syncronizationGroup.type) {
4353
- /* Check if the source is in the target list of the synchronizationGroup */
4354
- var source = syncronizationGroup.targets.byId[payload.sourceId];
4355
- /* If the source is part of the target list, and is linked, continue syncin the other targets */
4356
- if (source && source.linked) {
4357
- return list.concat(groupId);
4358
- }
4224
+ /**
4225
+ *For a given ui component: gets the order of visible dialog
4226
+ *
4227
+ * @param {object} store store object from which the ui state wll be extracted
4228
+ * @param {DialogType} dialogType type of the dialog
4229
+ * @returns {number} the higher the order number the higher the zIndex
4230
+ */
4231
+ var getDialogOrder = function getDialogOrder(store, dialogType) {
4232
+ var _store$ui2;
4233
+ if (store !== null && store !== void 0 && (_store$ui2 = store.ui) !== null && _store$ui2 !== void 0 && _store$ui2.order) {
4234
+ var order = store.ui.order;
4235
+ var visibleOrder = order.filter(function (orderedDialogType) {
4236
+ var _store$ui$dialogs$ord;
4237
+ return (_store$ui$dialogs$ord = store.ui.dialogs[orderedDialogType]) === null || _store$ui$dialogs$ord === void 0 ? void 0 : _store$ui$dialogs$ord.isOpen;
4238
+ });
4239
+ if (!visibleOrder.includes(dialogType)) {
4240
+ return 0;
4359
4241
  }
4360
- return list;
4361
- }, []);
4362
- return groups;
4363
- }, selectorMemoizationOptions);
4364
- var getSourceId = createSelector([syncGroupStore, function (syncGroupStore, sourceId) {
4365
- return sourceId;
4366
- }], function (syncGroupState, sourceId) {
4367
- return typeof sourceId === 'string' ? sourceId : sourceId.sourceId;
4368
- }, selectorMemoizationOptions);
4369
- var getAllTargetGroupsForSource = createSelector([syncGroupStore, getSourceId], function (syncGroupStore, sourceId) {
4370
- if (syncGroupStore !== null && syncGroupStore !== void 0 && syncGroupStore.groups) {
4371
- return syncGroupStore.groups.allIds.reduce(function (linkedSyncGroupIds, groupId) {
4372
- var syncronizationGroup = syncGroupStore.groups.byId[groupId];
4373
- var source = syncronizationGroup.targets.byId[sourceId];
4374
- /* If the source is part of the target list, and is linked, continue syncin the other targets */
4375
- if (source && source.linked) {
4376
- return linkedSyncGroupIds.concat(groupId);
4377
- }
4378
- return linkedSyncGroupIds;
4379
- }, []);
4242
+ return visibleOrder.length - visibleOrder.indexOf(dialogType);
4380
4243
  }
4381
- return [];
4382
- }, selectorMemoizationOptions);
4383
- var syncGroupGetViewState = createSelector(syncGroupStore, function (store) {
4384
- return store && store.viewState;
4385
- }, selectorMemoizationOptions);
4386
- var isTimeScrollingEnabled = function isTimeScrollingEnabled(store) {
4387
- var state = syncGroupStore(store);
4388
- return state ? state.isTimeScrollingEnabled : false;
4244
+ return 0;
4389
4245
  };
4390
- var getSyncedMapIdsForTimeslider = createSelector(syncGroupStore, function (store) {
4391
- var _store$viewState$time, _store$viewState$time2;
4392
- return (_store$viewState$time = (_store$viewState$time2 = store.viewState.timeslider.groups[0]) === null || _store$viewState$time2 === void 0 ? void 0 : _store$viewState$time2.selected) !== null && _store$viewState$time !== void 0 ? _store$viewState$time : [];
4393
- }, selectorMemoizationOptions);
4394
- var getSyncGroupTargets = createSelector(syncGroupStore, function (store) {
4395
- if (!store || !store.groups) {
4396
- return [];
4246
+ /**
4247
+ *For a given ui component: returns if ordered on top
4248
+ *
4249
+ * @param {object} store store object from which the ui state wll be extracted
4250
+ * @param {DialogType} dialogType type of the dialog
4251
+ * @returns {boolean}
4252
+ */
4253
+ var getDialogIsOrderedOnTop = function getDialogIsOrderedOnTop(store, dialogType) {
4254
+ var _store$ui3;
4255
+ if (store !== null && store !== void 0 && (_store$ui3 = store.ui) !== null && _store$ui3 !== void 0 && _store$ui3.order) {
4256
+ var order = store.ui.order;
4257
+ return order.includes(dialogType) && order.indexOf(dialogType) === 0;
4258
+ }
4259
+ return false;
4260
+ };
4261
+ var getDialogSource = createSelector(getDialogDetailsByType, function (details) {
4262
+ if (details !== null && details !== void 0 && details.source) {
4263
+ return details.source;
4397
4264
  }
4398
- return store.groups.allIds.reduce(function (targets, groupId) {
4399
- var group = store.groups.byId[groupId];
4400
- return targets.concat(group.targets.allIds.map(function (targetId) {
4401
- return {
4402
- groupId: groupId,
4403
- targetId: targetId,
4404
- linked: group.targets.byId[targetId].linked
4405
- };
4406
- }));
4407
- }, []);
4265
+ return 'app';
4408
4266
  }, selectorMemoizationOptions);
4409
-
4410
- var selectors$4 = /*#__PURE__*/Object.freeze({
4411
- __proto__: null,
4412
- getAllTargetGroupsForSource: getAllTargetGroupsForSource,
4413
- getSourceId: getSourceId,
4414
- getSyncGroupTargets: getSyncGroupTargets,
4415
- getSyncedMapIdsForTimeslider: getSyncedMapIdsForTimeslider,
4416
- getSynchronizationGroup: getSynchronizationGroup,
4417
- getSynchronizationGroupSource: getSynchronizationGroupSource,
4418
- getSynchronizationGroupState: getSynchronizationGroupState,
4419
- getTargetGroups: getTargetGroups,
4420
- getTargets: getTargets,
4421
- isTimeScrollingEnabled: isTimeScrollingEnabled,
4422
- syncGroupGetViewState: syncGroupGetViewState,
4423
- syncGroupStore: syncGroupStore
4424
- });
4425
-
4426
- /* *
4427
- * Licensed under the Apache License, Version 2.0 (the "License");
4428
- * you may not use this file except in compliance with the License.
4429
- * You may obtain a copy of the License at
4267
+ /**
4268
+ * Get the active window that should receive keyboard shortcuts
4430
4269
  *
4431
- * http://www.apache.org/licenses/LICENSE-2.0
4270
+ * Example: getActiveWindowId(store)
4271
+ * @param {object} store store object from which the window state will be extracted
4272
+ * @returns {string} active window id
4273
+ */
4274
+ var getActiveWindowId = createSelector(getUiStore, function (store) {
4275
+ return store === null || store === void 0 ? void 0 : store.activeWindowId;
4276
+ }, selectorMemoizationOptions);
4277
+ /**
4278
+ * Gets the panelId of which the dialog is opened from
4432
4279
  *
4433
- * Unless required by applicable law or agreed to in writing, software
4434
- * distributed under the License is distributed on an "AS IS" BASIS,
4435
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4436
- * See the License for the specific language governing permissions and
4437
- * limitations under the License.
4280
+ * Example: getSourcePanelId(store, 'publicWarnings')
4281
+ * @param {object} store store object from which the panelId state will be extracted
4282
+ * @returns {string} the dialog type
4283
+ */
4284
+ var getSourcePanelId = createSelector(function (store, dialogType) {
4285
+ var _store$ui4;
4286
+ return (_store$ui4 = store.ui) === null || _store$ui4 === void 0 ? void 0 : _store$ui4.dialogs[dialogType];
4287
+ }, function (dialog) {
4288
+ return (dialog === null || dialog === void 0 ? void 0 : dialog.sourcePanelId) || '';
4289
+ }, selectorMemoizationOptions);
4290
+ /**
4291
+ * Gets if this is the active window
4438
4292
  *
4439
- * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4440
- * Copyright 2021 - Finnish Meteorological Institute (FMI)
4441
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4442
- * */
4443
- var emptyState = {
4444
- timeslider: {
4445
- groups: [],
4446
- sourcesById: []
4447
- },
4448
- zoompane: {
4449
- groups: [],
4450
- sourcesById: []
4451
- },
4452
- level: {
4453
- groups: [],
4454
- sourcesById: []
4455
- }
4456
- };
4457
- var groupTypes = [{
4458
- title: 'Timeslider',
4459
- syncType: 'SYNCGROUPS_TYPE_SETTIME',
4460
- groupType: 'timeslider'
4461
- }, {
4462
- title: 'Zoompane',
4463
- syncType: 'SYNCGROUPS_TYPE_SETBBOX',
4464
- groupType: 'zoompane'
4465
- }];
4466
- /*
4467
- _____ Creates viewState _____
4468
- - Runs Each time viewState is created:
4469
- - Fill arrays inside initialState with objects containing new values from Redux
4470
- */
4471
- var createSyncGroupViewState = function createSyncGroupViewState(groups, sources) {
4472
- var initialState = produce(emptyState, function (draft) {
4473
- /*
4474
- _____ 1. Fill groups _____
4475
- 1. Goes through all groups by ID
4476
- 2. Collects original timeslider or zoompane values into an array
4477
- 3. Sorts and adds selected sources to ViewState based on ID type
4478
- */
4479
- Object.keys(groups.byId).forEach(function (id) {
4480
- var _groupTypes$find;
4481
- var groupType = (_groupTypes$find = groupTypes.find(function (object) {
4482
- return object.syncType === groups.byId[id].type;
4483
- })) === null || _groupTypes$find === void 0 ? void 0 : _groupTypes$find.groupType;
4484
- if (groupType) {
4485
- draft[groupType].groups.push({
4486
- id: id,
4487
- selected: groups.byId[id].targets.allIds
4488
- });
4489
- }
4490
- });
4491
- /*
4492
- _____ 2. Fill sourcesById _____
4493
- 1. Loop though sources and add source to each group type
4494
- */
4495
- Object.keys(sources.byId).forEach(function (id) {
4496
- groupTypes.forEach(function (_ref) {
4497
- var syncType = _ref.syncType,
4498
- groupType = _ref.groupType;
4499
- if (sources.byId[id].types.includes(syncType)) {
4500
- draft[groupType].sourcesById.push({
4501
- id: id,
4502
- name: id
4503
- });
4504
- }
4505
- });
4293
+ * Example: getIsActiveWindowId(store, viewId)
4294
+ * @param {object} store store object from which the window state will be extracted
4295
+ * @returns {string} active window id
4296
+ */
4297
+ var getIsActiveWindowId = createSelector(getUiStore, function (_store, viewId) {
4298
+ return viewId;
4299
+ }, function (store, viewId) {
4300
+ return viewId === (store === null || store === void 0 ? void 0 : store.activeWindowId);
4301
+ }, selectorMemoizationOptions);
4302
+ var getDialogIsLoading = createSelector(getDialogDetailsByType, function (details) {
4303
+ return (details === null || details === void 0 ? void 0 : details.isLoading) || false;
4304
+ }, selectorMemoizationOptions);
4305
+ var getDialogError = createSelector(getDialogDetailsByType, function (details) {
4306
+ return (details === null || details === void 0 ? void 0 : details.error) || '';
4307
+ }, selectorMemoizationOptions);
4308
+ var getUiDialogsByActiveMapId = function getUiDialogsByActiveMapId(store, mapId) {
4309
+ var _store$ui5;
4310
+ if (store !== null && store !== void 0 && (_store$ui5 = store.ui) !== null && _store$ui5 !== void 0 && _store$ui5.order) {
4311
+ var foundDialogsIds = store.ui.order.filter(function (id) {
4312
+ var _store$ui6;
4313
+ return ((_store$ui6 = store.ui) === null || _store$ui6 === void 0 || (_store$ui6 = _store$ui6.dialogs[id]) === null || _store$ui6 === void 0 ? void 0 : _store$ui6.activeMapId) === mapId;
4506
4314
  });
4507
- });
4508
- return initialState;
4509
- };
4510
- var groups = function groups(store) {
4511
- return store.syncGroups.groups;
4512
- };
4513
- var sources = function sources(store) {
4514
- return store.syncGroups.sources;
4315
+ var foundDialogs = foundDialogsIds.reduce(function (list, id) {
4316
+ var _store$ui7;
4317
+ var dialog = (_store$ui7 = store.ui) === null || _store$ui7 === void 0 ? void 0 : _store$ui7.dialogs[id];
4318
+ if (dialog) {
4319
+ return list.concat(dialog);
4320
+ }
4321
+ return list;
4322
+ }, []);
4323
+ return foundDialogs.length ? foundDialogs : [];
4324
+ }
4325
+ return [];
4515
4326
  };
4516
- var createSyncGroupViewStateSelector = createSelector(groups, sources, createSyncGroupViewState);
4517
4327
 
4518
- var selector = /*#__PURE__*/Object.freeze({
4328
+ var selectors$3 = /*#__PURE__*/Object.freeze({
4519
4329
  __proto__: null,
4520
- createSyncGroupViewState: createSyncGroupViewState,
4521
- createSyncGroupViewStateSelector: createSyncGroupViewStateSelector,
4522
- groupTypes: groupTypes
4523
- });
4524
-
4525
- var syncGroupsListener = createListenerMiddleware();
4526
- syncGroupsListener.startListening({
4527
- matcher: isAnyOf(syncGroupsActions.syncGroupAddTarget, syncGroupsActions.syncGroupLinkTarget),
4528
- effect: function () {
4529
- var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
4530
- var payload, groupId, linked, targetToUpdate, group;
4531
- return _regeneratorRuntime().wrap(function _callee$(_context) {
4532
- while (1) switch (_context.prev = _context.next) {
4533
- case 0:
4534
- payload = _ref.payload;
4535
- listenerApi.cancelActiveListeners();
4536
- groupId = payload.groupId, linked = payload.linked, targetToUpdate = payload.targetId;
4537
- group = getSynchronizationGroup(listenerApi.getState(), groupId);
4538
- if (!(!linked && group)) {
4539
- _context.next = 17;
4540
- break;
4541
- }
4542
- _context.t0 = group.type;
4543
- _context.next = _context.t0 === SYNCGROUPS_TYPE_SETTIME ? 8 : _context.t0 === SYNCGROUPS_TYPE_SETBBOX ? 12 : 16;
4544
- break;
4545
- case 8:
4546
- if (group.payloadByType[SYNCGROUPS_TYPE_SETTIME]) {
4547
- _context.next = 10;
4548
- break;
4549
- }
4550
- return _context.abrupt("return");
4551
- case 10:
4552
- listenerApi.dispatch(setTimeSync(group.payloadByType[SYNCGROUPS_TYPE_SETTIME], [{
4553
- targetId: targetToUpdate,
4554
- value: group.payloadByType[SYNCGROUPS_TYPE_SETTIME].value
4555
- }], [groupId]));
4556
- return _context.abrupt("break", 17);
4557
- case 12:
4558
- if (group.payloadByType[SYNCGROUPS_TYPE_SETBBOX]) {
4559
- _context.next = 14;
4560
- break;
4561
- }
4562
- return _context.abrupt("return");
4563
- case 14:
4564
- listenerApi.dispatch(setBboxSync(group.payloadByType[SYNCGROUPS_TYPE_SETBBOX], [{
4565
- targetId: targetToUpdate,
4566
- bbox: group.payloadByType[SYNCGROUPS_TYPE_SETBBOX].bbox,
4567
- srs: group.payloadByType[SYNCGROUPS_TYPE_SETBBOX].srs
4568
- }], [groupId]));
4569
- return _context.abrupt("break", 17);
4570
- case 16:
4571
- return _context.abrupt("break", 17);
4572
- case 17:
4573
- case "end":
4574
- return _context.stop();
4575
- }
4576
- }, _callee);
4577
- }));
4578
- function effect(_x, _x2) {
4579
- return _effect.apply(this, arguments);
4580
- }
4581
- return effect;
4582
- }()
4583
- });
4584
- syncGroupsListener.startListening({
4585
- matcher: isAnyOf(syncGroupsActions.syncGroupAddGroup, syncGroupsActions.syncGroupRemoveGroup, syncGroupsActions.syncGroupAddSource, syncGroupsActions.syncGroupRemoveSource, syncGroupsActions.syncGroupAddTarget, syncGroupsActions.syncGroupRemoveTarget, syncGroupsActions.syncGroupLinkTarget),
4586
- effect: function () {
4587
- var _effect2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, listenerApi) {
4588
- var viewState;
4589
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
4590
- while (1) switch (_context2.prev = _context2.next) {
4591
- case 0:
4592
- listenerApi.cancelActiveListeners();
4593
- viewState = createSyncGroupViewStateSelector(listenerApi.getState());
4594
- listenerApi.dispatch(syncGroupsActions.syncGroupSetViewState({
4595
- viewState: viewState
4596
- }));
4597
- case 3:
4598
- case "end":
4599
- return _context2.stop();
4600
- }
4601
- }, _callee2);
4602
- }));
4603
- function effect(_x3, _x4) {
4604
- return _effect2.apply(this, arguments);
4605
- }
4606
- return effect;
4607
- }()
4330
+ getActiveWindowId: getActiveWindowId,
4331
+ getDialogDetailsByType: getDialogDetailsByType,
4332
+ getDialogError: getDialogError,
4333
+ getDialogIsLoading: getDialogIsLoading,
4334
+ getDialogIsOrderedOnTop: getDialogIsOrderedOnTop,
4335
+ getDialogMapId: getDialogMapId,
4336
+ getDialogOrder: getDialogOrder,
4337
+ getDialogSource: getDialogSource,
4338
+ getIsActiveWindowId: getIsActiveWindowId,
4339
+ getSourcePanelId: getSourcePanelId,
4340
+ getUiDialogsByActiveMapId: getUiDialogsByActiveMapId,
4341
+ getUiStore: getUiStore,
4342
+ getisDialogOpen: getisDialogOpen,
4343
+ useAppSelector: useAppSelector$1
4608
4344
  });
4609
4345
 
4610
4346
  /* *
@@ -4620,24 +4356,41 @@ syncGroupsListener.startListening({
4620
4356
  * See the License for the specific language governing permissions and
4621
4357
  * limitations under the License.
4622
4358
  *
4623
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4624
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
4359
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4360
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
4625
4361
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4626
4362
  * */
4627
- var SyncGroupTypeList = [SYNCGROUPS_TYPE_SETBBOX, SYNCGROUPS_TYPE_SETTIME];
4628
- var SyncGroupActionOrigin;
4629
- (function (SyncGroupActionOrigin) {
4630
- SyncGroupActionOrigin["delete"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_DELETEACTION";
4631
- SyncGroupActionOrigin["layerActions"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_LAYERACTIONS";
4632
- SyncGroupActionOrigin["move"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_MOVEACTION";
4633
- SyncGroupActionOrigin["add"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_ADDACTION";
4634
- SyncGroupActionOrigin["autoLayerId"] = "ORIGIN_GENERIC_SYNCHRONIZATIONGROUP_UTILS_AUTOLAYERIDACTION";
4635
- })(SyncGroupActionOrigin || (SyncGroupActionOrigin = {}));
4363
+ var DialogTypes;
4364
+ (function (DialogTypes) {
4365
+ DialogTypes["LayerInfo"] = "layerInfo";
4366
+ DialogTypes["SyncGroups"] = "syncGroups";
4367
+ DialogTypes["TimeSeriesSelect"] = "timeSeriesSelect";
4368
+ DialogTypes["TimeSeriesManager"] = "timeSeriesManager";
4369
+ DialogTypes["TimeSeriesInfo"] = "timeSeriesInfo";
4370
+ DialogTypes["TimeSeriesLocationInfo"] = "timeSeriesLocationInfo";
4371
+ DialogTypes["KeywordFilter"] = "keywordFilter";
4372
+ DialogTypes["DimensionSelectEnsembleMember"] = "dimensionSelect-ensemble_member";
4373
+ DialogTypes["DimensionSelectElevation"] = "dimensionSelect-elevation";
4374
+ DialogTypes["LayerManager"] = "layerManager";
4375
+ DialogTypes["LayerSelect"] = "layerSelect";
4376
+ DialogTypes["DrawingTool"] = "drawingTool";
4377
+ DialogTypes["DockedLayerManager"] = "dockedLayerManager";
4378
+ DialogTypes["ObjectManager"] = "objectManager";
4379
+ DialogTypes["PublicWarnings"] = "publicWarnings";
4380
+ DialogTypes["Search"] = "search";
4381
+ DialogTypes["AreaObjectLoader"] = "areaObjectLoader";
4382
+ DialogTypes["DataExplorer"] = "dataExplorer";
4383
+ DialogTypes["DataExplorerInfo"] = "dataExplorerInfo";
4384
+ DialogTypes["SelectedFeatures"] = "selectedFeatures";
4385
+ DialogTypes["SoundingsSources"] = "soundingsSources";
4386
+ DialogTypes["SoundingsLocations"] = "soundingsLocations";
4387
+ DialogTypes["SoundingsManager"] = "soundingsManager";
4388
+ DialogTypes["TimeseriesLocations"] = "timeseriesLocations";
4389
+ })(DialogTypes || (DialogTypes = {}));
4636
4390
 
4637
- var types$1 = /*#__PURE__*/Object.freeze({
4391
+ var types = /*#__PURE__*/Object.freeze({
4638
4392
  __proto__: null,
4639
- get SyncGroupActionOrigin () { return SyncGroupActionOrigin; },
4640
- SyncGroupTypeList: SyncGroupTypeList
4393
+ get DialogTypes () { return DialogTypes; }
4641
4394
  });
4642
4395
 
4643
4396
  /* *
@@ -4645,421 +4398,636 @@ var types$1 = /*#__PURE__*/Object.freeze({
4645
4398
  * you may not use this file except in compliance with the License.
4646
4399
  * You may obtain a copy of the License at
4647
4400
  *
4648
- * http://www.apache.org/licenses/LICENSE-2.0
4401
+ * http://www.apache.org/licenses/LICENSE-2.0
4402
+ *
4403
+ * Unless required by applicable law or agreed to in writing, software
4404
+ * distributed under the License is distributed on an "AS IS" BASIS,
4405
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4406
+ * See the License for the specific language governing permissions and
4407
+ * limitations under the License.
4408
+ *
4409
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4410
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
4411
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4412
+ * */
4413
+ var useSetupDialog = function useSetupDialog(dialogType) {
4414
+ var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'app';
4415
+ var dispatch = useDispatch();
4416
+ var onCloseDialog = useCallback(function () {
4417
+ dispatch(uiActions.setToggleOpenDialog({
4418
+ type: dialogType,
4419
+ setOpen: false
4420
+ }));
4421
+ }, [dialogType, dispatch]);
4422
+ var registerDialog = useCallback(function () {
4423
+ dispatch(uiActions.registerDialog({
4424
+ type: dialogType,
4425
+ setOpen: false,
4426
+ source: source
4427
+ }));
4428
+ }, [dialogType, dispatch, source]);
4429
+ var unregisterDialog = useCallback(function () {
4430
+ dispatch(uiActions.unregisterDialog({
4431
+ type: dialogType
4432
+ }));
4433
+ }, [dialogType, dispatch]);
4434
+ // Register this dialog in the store
4435
+ useEffect(function () {
4436
+ registerDialog();
4437
+ return function () {
4438
+ unregisterDialog();
4439
+ };
4440
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4441
+ }, []);
4442
+ var uiIsOrderedOnTop = useAppSelector$1(function (store) {
4443
+ return getDialogIsOrderedOnTop(store, dialogType);
4444
+ });
4445
+ var setDialogOrder = useCallback(function () {
4446
+ if (!uiIsOrderedOnTop) {
4447
+ dispatch(uiActions.orderDialog({
4448
+ type: dialogType
4449
+ }));
4450
+ }
4451
+ }, [dialogType, dispatch, uiIsOrderedOnTop]);
4452
+ var dialogOrder = useAppSelector$1(function (store) {
4453
+ return getDialogOrder(store, dialogType);
4454
+ });
4455
+ var uiSource = useAppSelector$1(function (store) {
4456
+ return getDialogSource(store, dialogType);
4457
+ });
4458
+ var isDialogOpen = useAppSelector$1(function (store) {
4459
+ return getisDialogOpen(store, dialogType);
4460
+ });
4461
+ var uiIsLoading = useAppSelector$1(function (store) {
4462
+ return getDialogIsLoading(store, dialogType);
4463
+ });
4464
+ var uiError = useAppSelector$1(function (store) {
4465
+ return getDialogError(store, dialogType);
4466
+ });
4467
+ return {
4468
+ setDialogOrder: setDialogOrder,
4469
+ dialogOrder: dialogOrder,
4470
+ onCloseDialog: onCloseDialog,
4471
+ uiSource: uiSource,
4472
+ isDialogOpen: isDialogOpen,
4473
+ uiIsLoading: uiIsLoading,
4474
+ uiError: uiError
4475
+ };
4476
+ };
4477
+
4478
+ var layerStore = function layerStore(store) {
4479
+ return store === null || store === void 0 ? void 0 : store.layers;
4480
+ };
4481
+ /**
4482
+ * Gets a layer from the layers part of the store by its Id
4483
+ *
4484
+ * Example: layer = getLayerById(store, 'layerId')
4485
+ * @param {object} store object from which the layer state will be extracted
4486
+ * @param {string} layerId Id of the layer
4487
+ * @returns {object} object containing layer information (service, name, style, enabled etc.)
4488
+ */
4489
+ var getLayerById = createSelector([layerStore, function (layerStore, layerId) {
4490
+ return layerId;
4491
+ }], function (layerState, layerId) {
4492
+ var _layerState$byId;
4493
+ return layerState === null || layerState === void 0 || (_layerState$byId = layerState.byId) === null || _layerState$byId === void 0 ? void 0 : _layerState$byId[layerId];
4494
+ }, selectorMemoizationOptions);
4495
+ /**
4496
+ * Determines if layer is present
4497
+ *
4498
+ * @param {object} store store: object - store object
4499
+ * @param {string} layerId layerId: string - Id of the layer
4500
+ * @returns {boolean} returnType:boolean - true if layer is present
4501
+ */
4502
+ var getIsLayerPresent = createSelector(getLayerById, function (layer) {
4503
+ return !!layer;
4504
+ }, selectorMemoizationOptions);
4505
+ /**
4506
+ * Gets a layer from the layers part of the store by its Id, but without the time dimension. (All other dimensions are still included)
4507
+ *
4508
+ * Example: layer = getLayerByIdWithoutTimeDimension(store, 'layerId')
4509
+ * @param {object} store object from which the layer state will be extracted
4510
+ * @param {string} layerId Id of the layer
4511
+ * @returns {object} object containing layer information (service, name, style, enabled etc.)
4512
+ */
4513
+ var getLayerByIdWithoutTimeDimension = createSelector([layerStore, function (layerStore, layerId) {
4514
+ return layerId;
4515
+ }], function (layerState, layerId) {
4516
+ var _layerState$byId2;
4517
+ var layer = layerState === null || layerState === void 0 || (_layerState$byId2 = layerState.byId) === null || _layerState$byId2 === void 0 ? void 0 : _layerState$byId2[layerId];
4518
+ return layer ? produce(layer, function (draftLayer) {
4519
+ draftLayer.dimensions = filterNonTimeDimensions(draftLayer.dimensions || []);
4520
+ return draftLayer;
4521
+ }) : undefined;
4522
+ }, selectorMemoizationOptions);
4523
+ /**
4524
+ * Retrieves all layers indexed by layerId
4525
+ *
4526
+ * Example: layers = getLayersById(store)
4527
+ * @param {object} store store: object - object from which the layers state will be extracted
4528
+ * @returns {object} returnType: object - an object of all layers containing layer information (service, name, style, enabled etc.) indexed by layerId
4529
+ */
4530
+ var getLayersById = createSelector(layerStore, function (store) {
4531
+ var _store$byId;
4532
+ return (_store$byId = store === null || store === void 0 ? void 0 : store.byId) !== null && _store$byId !== void 0 ? _store$byId : null;
4533
+ }, selectorMemoizationOptions);
4534
+ /**
4535
+ * Retrieves all layerIds
4536
+ *
4537
+ * Example: layerIds = getLayersIds(store)
4538
+ * @param {object} store store: object - object from which the layers state will be extracted
4539
+ * @returns {array} returnType: array - an array of all layerIds
4540
+ */
4541
+ var getLayersIds = createSelector(layerStore, function (store) {
4542
+ return store ? store.allIds : [];
4543
+ }, selectorMemoizationOptions);
4544
+ /**
4545
+ * Retrieves all layers (including base layers and overlayers)
4546
+ *
4547
+ * Example: layers = getAllLayers(store)
4548
+ * @param {object} store store: object - object from which the layers state will be extracted
4549
+ * @returns {array} returnType: array - an array of all layers containing layer information (service, name, style, enabled etc.)
4550
+ */
4551
+ var getAllLayers = createSelector(getLayersIds, getLayersById, function (ids, layers) {
4552
+ return ids.map(function (layerId) {
4553
+ return layers[layerId];
4554
+ });
4555
+ }, selectorMemoizationOptions);
4556
+ /**
4557
+ * Retrieves all layers (including base layers and overlayers) for the given mapId
4558
+ *
4559
+ * Example: layers = getLayersByMapId(store, mapId)
4560
+ * @param {object} store store: object - object from which the layers state will be extracted
4561
+ * @param {string} mapId mapId: string - mapId
4562
+ * @returns {array} returnType: ReduxLayer[] - an array of all layers containing layer information (service, name, style, enabled etc.)
4563
+ */
4564
+ var getLayersByMapId = createSelector(getAllLayers, function (_store, _mapId) {
4565
+ return _mapId;
4566
+ }, function (layers, mapId) {
4567
+ return layers.filter(function (layer) {
4568
+ return layer.mapId === mapId;
4569
+ });
4570
+ }, selectorMemoizationOptions);
4571
+ /**
4572
+ * Retrieves all layers that aren't base layers and aren't overlayers
4573
+ *
4574
+ * Example: layers = getLayers(store)
4575
+ * @param {object} store store: object - object from which the layers state will be extracted
4576
+ * @returns {array} returnType: array - an array of all non-baselayers containing layer information (service, name, style, enabled etc.)
4577
+ */
4578
+ var getLayers = createSelector(getAllLayers, function (layers) {
4579
+ return layers.filter(function (layer) {
4580
+ return layer.layerType !== LayerType.baseLayer && layer.layerType !== LayerType.overLayer;
4581
+ });
4582
+ }, selectorMemoizationOptions);
4583
+ /**
4584
+ * Retrieves all baselayers
4585
+ *
4586
+ * Example: layers = getBaseLayers(store)
4587
+ * @param {object} store store: object - object from which the layers state will be extracted
4588
+ * @returns {array} returnType: array - an array of all baselayers containing layer information (service, name, style, enabled etc.)
4589
+ */
4590
+ var getBaseLayers = createSelector(getAllLayers, function (layers) {
4591
+ return layers.filter(function (layer) {
4592
+ return layer.layerType === LayerType.baseLayer;
4593
+ });
4594
+ }, selectorMemoizationOptions);
4595
+ /**
4596
+ * Retrieves all overLayers
4597
+ *
4598
+ * Example: layers = getOverLayers(store)
4599
+ * @param {object} store store: object - object from which the layers state will be extracted
4600
+ * @returns {array} returnType: array - an array of all overLayers containing layer information (service, name, style, enabled etc.)
4601
+ */
4602
+ var getOverLayers = createSelector(getAllLayers, function (layers) {
4603
+ return layers.filter(function (layer) {
4604
+ return layer.layerType === LayerType.overLayer;
4605
+ });
4606
+ }, selectorMemoizationOptions);
4607
+ /**
4608
+ * Retrieves all featureLayers
4609
+ *
4610
+ * Example: layers = getFeatureLayers(store)
4611
+ * @param {object} store store: object - object from which the layers state will be extracted
4612
+ * @returns {array} returnType: array - an array of all featureLayers
4613
+ */
4614
+ var getFeatureLayers = createSelector(getAllLayers, function (layers) {
4615
+ return layers.filter(function (layer) {
4616
+ return layer.layerType === LayerType.featureLayer;
4617
+ });
4618
+ }, selectorMemoizationOptions);
4619
+ /**
4620
+ * Gets dimensions of the passed layer
4649
4621
  *
4650
- * Unless required by applicable law or agreed to in writing, software
4651
- * distributed under the License is distributed on an "AS IS" BASIS,
4652
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4653
- * See the License for the specific language governing permissions and
4654
- * limitations under the License.
4622
+ * Example: layerDimensions = getLayerDimensions(store, 'layerId_1')
4623
+ * @param {object} store store: object - object from which the layers state will be extracted
4624
+ * @param {string} layerId layerId: string - Id of the layer
4625
+ * @returns {array} returnType: Dimension[] - array containing layer dimensions
4626
+ */
4627
+ var getLayerDimensions = createSelector(getLayerById, function (layer) {
4628
+ var _layer$dimensions;
4629
+ return (_layer$dimensions = layer === null || layer === void 0 ? void 0 : layer.dimensions) !== null && _layer$dimensions !== void 0 ? _layer$dimensions : [];
4630
+ }, selectorMemoizationOptions);
4631
+ /**
4632
+ * Gets dimensions of the passed layer, excluding the time dimension
4655
4633
  *
4656
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4657
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
4658
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4659
- * */
4660
- var synchronizationGroupStore = function synchronizationGroupStore(store) {
4661
- return store && store.syncGroups ? store.syncGroups : null;
4662
- };
4663
- var getSynchronizationGroupStore = function getSynchronizationGroupStore(store) {
4664
- return store && store.syncGroups ? store.syncGroups : null;
4665
- };
4634
+ * Example: layerNonTimeDimensions = getLayerNonTimeDimensions(store, 'layerId_1')
4635
+ * @param {object} store store: object - object from which the layers state will be extracted
4636
+ * @param {string} layerId layerId: string - Id of the layer
4637
+ * @returns {array} returnType: Dimension[] - array containing layer dimensions, excluding the time dimension
4638
+ */
4639
+ var getLayerNonTimeDimensions = createSelector(getLayerDimensions, function (dimensions) {
4640
+ return filterNonTimeDimensions(dimensions);
4641
+ }, selectorMemoizationOptions);
4666
4642
  /**
4667
- * Returns the synchronization source by id
4668
- * @param store The app store
4669
- * @param id The source id to find
4643
+ * Gets time dimension of the passed layer
4644
+ *
4645
+ * Example: timeDimension = getLayerTimeDimension(store, 'layerId_1')
4646
+ * @param {object} store store: object - object from which the layers state will be extracted
4647
+ * @param {string} layerId layerId: string - Id of the layer
4648
+ * @returns {object} returnType: object - object of layer time dimension
4670
4649
  */
4671
- var getSyncSourceBySourceId = function getSyncSourceBySourceId(state, id) {
4672
- if (state && state.sources) {
4673
- var sources = state.sources;
4674
- if (sources.byId[id]) {
4675
- return sources.byId[id];
4676
- }
4677
- }
4678
- return null;
4679
- };
4680
- var getTime = createSelector(getSyncSourceBySourceId, function (store) {
4681
- return store && store.payloadByType && store.payloadByType[SYNCGROUPS_TYPE_SETTIME] ? store.payloadByType[SYNCGROUPS_TYPE_SETTIME].value : null;
4650
+ var getLayerTimeDimension = createSelector(getLayerDimensions, function (dimensions) {
4651
+ return dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dimension) {
4652
+ return dimension.name === 'time';
4653
+ });
4682
4654
  }, selectorMemoizationOptions);
4683
- var selectLinkedState = createSelector(synchronizationGroupStore, function (syncState) {
4684
- return (syncState === null || syncState === void 0 ? void 0 : syncState.linkedState) || {
4685
- links: {},
4686
- sharedData: {}
4687
- };
4688
- });
4689
- var getLinkedMaps = createSelector([selectLinkedState, function (store, panelId) {
4690
- return panelId;
4691
- }], function (linkedState, panelId) {
4692
- return panelId && linkedState.links[panelId] || [];
4655
+ /**
4656
+ * Returns a boolean indicating whether the layer has a time dimension
4657
+ *
4658
+ * Example: layerHasTimeDimension = getLayerHasTimeDimension(store, 'layerId_1')
4659
+ * @param {object} store store: object - object from which the layers state will be extracted
4660
+ * @param {string} layerId layerId: string - Id of the layer
4661
+ * @returns {boolean} returnType: boolean - boolean indicating whether the layer has a time dimension
4662
+ */
4663
+ var getLayerHasTimeDimension = createSelector(getLayerTimeDimension, function (timeDimension) {
4664
+ return !!timeDimension;
4693
4665
  }, selectorMemoizationOptions);
4694
- var getLinkedFeatureProviders = createSelector(function (linkedState) {
4695
- return linkedState;
4696
- }, function (linkedState, props) {
4697
- return props.mapId;
4698
- }, function (linkedState, mapId) {
4699
- return linkedState ? Object.keys(linkedState.links).filter(function (panelId) {
4700
- return linkedState.links[panelId].includes(mapId);
4701
- }) : [];
4702
- });
4703
- var selectSharedData = createSelector([selectLinkedState, function (store, panelId) {
4704
- return panelId;
4705
- }], function (linkedState, panelId) {
4706
- var sharedDataForPanel = linkedState.sharedData[panelId];
4707
- return sharedDataForPanel || {};
4666
+ var getLayerCurrentTime = createSelector(getLayerTimeDimension, function (dimension) {
4667
+ return dimension === null || dimension === void 0 ? void 0 : dimension.currentValue;
4708
4668
  }, selectorMemoizationOptions);
4709
- var selectLinkedPanelId = createSelector([selectLinkedState, function (_, mapViewId) {
4710
- return mapViewId;
4711
- }], function (linkedState, mapViewId) {
4712
- if (!linkedState || !linkedState.links) {
4713
- return undefined;
4714
- }
4715
- // Find the panelId where mapView(s) is linked
4716
- var panelId = Object.keys(linkedState.links).find(function (panelId) {
4717
- var _linkedState$links$pa;
4718
- return (_linkedState$links$pa = linkedState.links[panelId]) === null || _linkedState$links$pa === void 0 ? void 0 : _linkedState$links$pa.includes(mapViewId);
4719
- });
4720
- return panelId;
4721
- });
4722
- var selectMapViewsForPanelId = createSelector([function (linkedState, panelId) {
4723
- return linkedState.links[panelId];
4724
- }], function (mapViews) {
4725
- if (!mapViews) {
4726
- return undefined;
4727
- }
4728
- return mapViews;
4729
- });
4730
- var selectLinkedFeatures = createSelector([function (linkedState) {
4731
- return linkedState;
4732
- }, getLinkedFeatureProviders], function (linkedState, featureProviders) {
4733
- var features = featureProviders.flatMap(function (providerId) {
4734
- var _linkedState$sharedDa, _linkedState$sharedDa2;
4735
- return (_linkedState$sharedDa = linkedState === null || linkedState === void 0 || (_linkedState$sharedDa2 = linkedState.sharedData) === null || _linkedState$sharedDa2 === void 0 || (_linkedState$sharedDa2 = _linkedState$sharedDa2[providerId]) === null || _linkedState$sharedDa2 === void 0 ? void 0 : _linkedState$sharedDa2.features) !== null && _linkedState$sharedDa !== void 0 ? _linkedState$sharedDa : [];
4736
- });
4737
- return features.filter(function (feature) {
4738
- return feature !== undefined;
4739
- });
4740
- });
4741
- var selectLinkedFormFeatures = createSelector([function (linkedState) {
4742
- return linkedState;
4743
- }, getLinkedFeatureProviders], function (linkedState, featureProviders) {
4744
- var features = featureProviders.flatMap(function (providerId) {
4745
- var _linkedState$sharedDa3, _linkedState$sharedDa4;
4746
- return (_linkedState$sharedDa3 = linkedState === null || linkedState === void 0 || (_linkedState$sharedDa4 = linkedState.sharedData) === null || _linkedState$sharedDa4 === void 0 || (_linkedState$sharedDa4 = _linkedState$sharedDa4[providerId]) === null || _linkedState$sharedDa4 === void 0 ? void 0 : _linkedState$sharedDa4.formFeatures) !== null && _linkedState$sharedDa3 !== void 0 ? _linkedState$sharedDa3 : [];
4747
- });
4748
- return features.filter(function (feature) {
4749
- return feature !== undefined;
4750
- });
4751
- });
4752
- var getSelectedFeature = createSelector([
4753
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
4754
- function (state, mapId) {
4755
- var _state$linkedState;
4756
- return (_state$linkedState = state.linkedState) === null || _state$linkedState === void 0 ? void 0 : _state$linkedState.sharedData[mapId];
4757
- }], function (sharedData) {
4758
- var _features$;
4759
- if (!sharedData) {
4760
- return null;
4761
- }
4762
- var features = sharedData.features,
4763
- selectedFeatureId = sharedData.selectedFeatureId;
4764
- if (!features || !selectedFeatureId) {
4765
- return null;
4766
- }
4767
- var selectedFeature = (_features$ = features[0]) === null || _features$ === void 0 ? void 0 : _features$.geoJSON.features.find(function (feature) {
4768
- return feature.id === selectedFeatureId;
4769
- });
4770
- if (selectedFeature && selectedFeature.geometry.type === 'Point') {
4771
- var _selectedFeature$prop, _selectedFeature$prop2, _selectedFeature$prop3;
4772
- var coordinates = selectedFeature.geometry.coordinates;
4773
- return {
4774
- lat: coordinates[1],
4775
- lon: coordinates[0],
4776
- id: selectedFeature.id,
4777
- name: (_selectedFeature$prop = selectedFeature.properties) === null || _selectedFeature$prop === void 0 ? void 0 : _selectedFeature$prop.name,
4778
- occurrences: (_selectedFeature$prop2 = selectedFeature.properties) === null || _selectedFeature$prop2 === void 0 ? void 0 : _selectedFeature$prop2.occurrences,
4779
- serviceId: (_selectedFeature$prop3 = selectedFeature.properties) === null || _selectedFeature$prop3 === void 0 ? void 0 : _selectedFeature$prop3.serviceId
4780
- };
4781
- }
4782
- if (selectedFeature) {
4783
- var _selectedFeature$prop4, _selectedFeature$prop5;
4784
- var center = turf.center(selectedFeature);
4785
- return {
4786
- lat: center.geometry.coordinates[1],
4787
- lon: center.geometry.coordinates[0],
4788
- id: selectedFeature.id,
4789
- name: (_selectedFeature$prop4 = selectedFeature.properties) === null || _selectedFeature$prop4 === void 0 ? void 0 : _selectedFeature$prop4.name,
4790
- occurrences: (_selectedFeature$prop5 = selectedFeature.properties) === null || _selectedFeature$prop5 === void 0 ? void 0 : _selectedFeature$prop5.occurrences
4791
- };
4792
- }
4793
- return null;
4794
- });
4795
- var getSelectedFeatureAsGeoJSON = createSelector([function (state, mapId) {
4796
- var _state$linkedState2;
4797
- return (_state$linkedState2 = state.linkedState) === null || _state$linkedState2 === void 0 ? void 0 : _state$linkedState2.sharedData[mapId];
4798
- }], function (sharedData) {
4799
- var _features$2;
4800
- if (!sharedData) {
4801
- return null;
4802
- }
4803
- var features = sharedData.features,
4804
- selectedFeatureId = sharedData.selectedFeatureId;
4805
- if (!features || !selectedFeatureId) {
4806
- return null;
4807
- }
4808
- var selectedFeature = (_features$2 = features[0]) === null || _features$2 === void 0 ? void 0 : _features$2.geoJSON.features.find(function (feature) {
4809
- return feature.id === selectedFeatureId;
4810
- });
4811
- return selectedFeature;
4812
- });
4813
-
4814
- var selectors$3 = /*#__PURE__*/Object.freeze({
4815
- __proto__: null,
4816
- getLinkedMaps: getLinkedMaps,
4817
- getSelectedFeature: getSelectedFeature,
4818
- getSelectedFeatureAsGeoJSON: getSelectedFeatureAsGeoJSON,
4819
- getSynchronizationGroupStore: getSynchronizationGroupStore,
4820
- getTime: getTime,
4821
- selectLinkedFeatures: selectLinkedFeatures,
4822
- selectLinkedFormFeatures: selectLinkedFormFeatures,
4823
- selectLinkedPanelId: selectLinkedPanelId,
4824
- selectMapViewsForPanelId: selectMapViewsForPanelId,
4825
- selectSharedData: selectSharedData
4826
- });
4827
-
4828
- var useUpdateSharedData = function useUpdateSharedData(data, panelId) {
4829
- var sharedData = useSelector(function (state) {
4830
- return selectSharedData(state, panelId);
4831
- });
4832
- var linkedMaps = useSelector(function (state) {
4833
- return getLinkedMaps(state, panelId);
4834
- });
4835
- var dispatch = useDispatch();
4836
- useEffect(function () {
4837
- var diff = _objectSpread2(_objectSpread2({}, sharedData), data);
4838
- if (panelId && (linkedMaps === null || linkedMaps === void 0 ? void 0 : linkedMaps.length) > 0 && !isEqual(diff, sharedData)) {
4839
- dispatch(syncGroupsActions.addSharedData({
4840
- panelId: panelId,
4841
- data: data
4842
- }));
4843
- }
4844
- }, [panelId, linkedMaps, data, sharedData, dispatch]);
4845
- useEffect(function () {
4846
- return function () {
4847
- if (panelId) {
4848
- dispatch(syncGroupsActions.deleteSharedData({
4849
- panelId: panelId
4850
- }));
4851
- }
4852
- };
4853
- }, [dispatch, panelId]);
4854
- return sharedData;
4855
- };
4856
-
4857
- /* *
4858
- * Licensed under the Apache License, Version 2.0 (the "License");
4859
- * you may not use this file except in compliance with the License.
4860
- * You may obtain a copy of the License at
4669
+ /**
4670
+ * Gets specified dimension of the passed layer
4671
+ *
4672
+ * Example: dimension = getLayerDimension(store, 'layerId_1', 'elevation')
4673
+ * @param {object} store store: object - object from which the layers state will be extracted
4674
+ * @param {string} layerId layerId: string - Id of the layer
4675
+ * @param {string} dimensionName dimensionName: string - name of dimension you want to retrieve the dimension data for
4676
+ * @returns {object} returnType: object - object of layer dimension
4677
+ */
4678
+ var getLayerDimension = createSelector(getLayerDimensions, function (_store, _layerId, dimensionName) {
4679
+ return dimensionName;
4680
+ }, function (dimensions, dimensionName) {
4681
+ return dimensions === null || dimensions === void 0 ? void 0 : dimensions.find(function (dimension) {
4682
+ return dimension.name === dimensionName;
4683
+ });
4684
+ }, selectorMemoizationOptions);
4685
+ /**
4686
+ * Gets opacity of the passed layer
4861
4687
  *
4862
- * http://www.apache.org/licenses/LICENSE-2.0
4688
+ * Example: layerOpacity = getLayerOpacity(store, 'layerId_1')
4689
+ * @param {object} store store: object - object from which the layers state will be extracted
4690
+ * @param {string} layerId layerId: string - Id of the layer
4691
+ * @returns {number} returnType: number - opacity as a number (between 0 and 1)
4692
+ */
4693
+ var getLayerOpacity = createSelector(getLayerById, function (layer) {
4694
+ return layer !== null && layer !== void 0 && layer.opacity ? layer.opacity : 0;
4695
+ }, selectorMemoizationOptions);
4696
+ /**
4697
+ * Gets whether a layer is enabled or disabled
4863
4698
  *
4864
- * Unless required by applicable law or agreed to in writing, software
4865
- * distributed under the License is distributed on an "AS IS" BASIS,
4866
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4867
- * See the License for the specific language governing permissions and
4868
- * limitations under the License.
4699
+ * Example: isLayerEnabled = getLayerEnabled(store, 'layerId_1')
4700
+ * @param {object} store store: object - object from which the layers state will be extracted
4701
+ * @param {string} layerId layerId: string - Id of the layer
4702
+ * @returns {boolean} returnType: boolean - true if enabled, false if disabled
4703
+ */
4704
+ var getLayerEnabled = createSelector(getLayerById, function (layer) {
4705
+ return Boolean(layer === null || layer === void 0 ? void 0 : layer.enabled);
4706
+ }, selectorMemoizationOptions);
4707
+ /**
4708
+ * Gets layer name
4869
4709
  *
4870
- * Copyright 2020 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4871
- * Copyright 2020 - Finnish Meteorological Institute (FMI)
4872
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4873
- * */
4874
-
4875
- var types = /*#__PURE__*/Object.freeze({
4876
- __proto__: null
4877
- });
4878
-
4879
- /* *
4880
- * Licensed under the Apache License, Version 2.0 (the "License");
4881
- * you may not use this file except in compliance with the License.
4882
- * You may obtain a copy of the License at
4710
+ * Example: layerName = getLayerName(store, 'layerId_1')
4711
+ * @param {object} store store: object - object from which the layers state will be extracted
4712
+ * @param {string} layerId layerId: string - Id of the layer
4713
+ * @returns {string} returnType: string - layer name
4714
+ */
4715
+ var getLayerName = createSelector(getLayerById, function (layer) {
4716
+ var _layer$options;
4717
+ if (!layer) {
4718
+ return '';
4719
+ }
4720
+ if (layer.layerType === LayerType.edrFeatureLayer && (_layer$options = layer.options) !== null && _layer$options !== void 0 && _layer$options.parameterNames.length) {
4721
+ return layer.options.parameterNames[0];
4722
+ }
4723
+ return (layer === null || layer === void 0 ? void 0 : layer.name) || '';
4724
+ }, selectorMemoizationOptions);
4725
+ /**
4726
+ * Gets layer service
4883
4727
  *
4884
- * http://www.apache.org/licenses/LICENSE-2.0
4728
+ * Example: layerService = getLayerService(store, 'layerId_1')
4729
+ * @param {object} store store: object - object from which the layers state will be extracted
4730
+ * @param {string} layerId layerId: string - Id of the layer
4731
+ * @returns {string} returnType: string - layer service
4732
+ */
4733
+ var getLayerService = createSelector(getLayerById, function (layer) {
4734
+ var _layer$service;
4735
+ return (_layer$service = layer === null || layer === void 0 ? void 0 : layer.service) !== null && _layer$service !== void 0 ? _layer$service : '';
4736
+ }, selectorMemoizationOptions);
4737
+ /**
4738
+ * Gets selected style of the passed layer
4885
4739
  *
4886
- * Unless required by applicable law or agreed to in writing, software
4887
- * distributed under the License is distributed on an "AS IS" BASIS,
4888
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4889
- * See the License for the specific language governing permissions and
4890
- * limitations under the License.
4740
+ * Example: layerStyle = getLayerStyle(store, 'layerId_1')
4741
+ * @param {object} store store: object - object from which the layers state will be extracted
4742
+ * @param {string} layerId layerId: string - Id of the layer
4743
+ * @returns {string} returnType: string - style that is currently selected
4744
+ */
4745
+ var getLayerStyle = createSelector(getLayerById, function (layer) {
4746
+ return layer !== null && layer !== void 0 && layer.style ? layer.style : '';
4747
+ }, selectorMemoizationOptions);
4748
+ /**
4749
+ * Gets layer status
4891
4750
  *
4892
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4893
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
4894
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4895
- * */
4896
- var ANY_EDR_SERVICE = 'any_edr';
4897
-
4898
- var constants$1 = /*#__PURE__*/Object.freeze({
4899
- __proto__: null,
4900
- ANY_EDR_SERVICE: ANY_EDR_SERVICE
4901
- });
4902
-
4903
- /* *
4904
- * Licensed under the Apache License, Version 2.0 (the "License");
4905
- * you may not use this file except in compliance with the License.
4906
- * You may obtain a copy of the License at
4751
+ * Example: layerService = getLayerStatus(store, 'layerId_1')
4752
+ * @param {object} store store: object - object from which the layers state will be extracted
4753
+ * @param {string} layerId layerId: string - Id of the layer
4754
+ * @returns {string} returnType: LayerStatus
4755
+ */
4756
+ var getLayerStatus = createSelector(getLayerById, function (layer) {
4757
+ return layer !== null && layer !== void 0 && layer.status ? layer.status : LayerStatus["default"];
4758
+ }, selectorMemoizationOptions);
4759
+ /**
4760
+ * Gets all available base layers for a map
4907
4761
  *
4908
- * http://www.apache.org/licenses/LICENSE-2.0
4762
+ * Example: availableBaseLayers = getAvailableBaseLayersForMap(store)
4763
+ * @param {object} store store: object - object from which the layer state will be extracted
4764
+ * @param {string} mapId mapId: string - Id of the map we want to retrieve the available baselayers for
4765
+ * @returns {array} returnType: array - array containing all available base layers
4766
+ */
4767
+ var getAvailableBaseLayersForMap = createSelector(layerStore, function (_store, _mapId) {
4768
+ return _mapId;
4769
+ }, function (layerStore, mapId) {
4770
+ if (layerStore !== null && layerStore !== void 0 && layerStore.availableBaseLayers) {
4771
+ var availableBaseLayers = layerStore.availableBaseLayers;
4772
+ return availableBaseLayers.allIds.reduce(function (list, layerId) {
4773
+ if (availableBaseLayers.byId[layerId].mapId === mapId) {
4774
+ return list.concat(availableBaseLayers.byId[layerId]);
4775
+ }
4776
+ return list;
4777
+ }, []);
4778
+ }
4779
+ return [];
4780
+ }, selectorMemoizationOptions);
4781
+ /**
4782
+ * Returns the selected geojson feature for the given layer
4909
4783
  *
4910
- * Unless required by applicable law or agreed to in writing, software
4911
- * distributed under the License is distributed on an "AS IS" BASIS,
4912
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4913
- * See the License for the specific language governing permissions and
4914
- * limitations under the License.
4784
+ * Example const selectedFeature = getSelectedFeature(store, 'layerId1')
4785
+ * @param {object} store store: object - store object
4786
+ * @param {string} mapId layerId: string - Id of the layer
4787
+ * @returns {number} selectedFeatureIndex: the index of the selected geojson feature
4788
+ */
4789
+ var getSelectedFeatureIndex = createSelector(getLayerById, function (layer) {
4790
+ return layer === null || layer === void 0 ? void 0 : layer.selectedFeatureIndex;
4791
+ }, selectorMemoizationOptions);
4792
+ /**
4793
+ * Returns the layer is in edit mode
4915
4794
  *
4916
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4917
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
4918
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4919
- * */
4920
- var loadingIndicatorAdapter = createEntityAdapter();
4921
- var initLoadingIndicatorStateForId = function initLoadingIndicatorStateForId(draft, id) {
4922
- if (!draft.entities[id]) {
4923
- loadingIndicatorAdapter.addOne(draft, {
4924
- id: id,
4925
- getMapLoadingPercentage: 100,
4926
- isGetCapabilitiesLoading: false,
4927
- isEDRLoading: false
4928
- });
4795
+ * Example const isLayerInEditMode = getIsLayerInEditMode(store, 'layerId1')
4796
+ * @param {object} store store: object - store object
4797
+ * @param {string} mapId layerId: string - Id of the layer
4798
+ * @returns {number} isLayerInEditMode: boolean - isInEditMode
4799
+ */
4800
+ var getIsLayerInEditMode = createSelector(getLayerById, function (layer) {
4801
+ return (layer === null || layer === void 0 ? void 0 : layer.isInEditMode) || false;
4802
+ }, selectorMemoizationOptions);
4803
+ var getFeatureLayerGeoJSON = createSelector(getLayerById, function (layer) {
4804
+ return (layer === null || layer === void 0 ? void 0 : layer.geojson) || undefined;
4805
+ }, selectorMemoizationOptions);
4806
+ var getHasFeatureLayerGeoJSON = createSelector(getFeatureLayerGeoJSON, function (geojson) {
4807
+ return !!geojson;
4808
+ }, selectorMemoizationOptions);
4809
+ var getFeatureLayerGeoJSONProperties = createSelector(getLayerById, getSelectedFeatureIndex, function (layer) {
4810
+ var _layer$geojson;
4811
+ var selecteFeatureIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
4812
+ return (layer === null || layer === void 0 || (_layer$geojson = layer.geojson) === null || _layer$geojson === void 0 || (_layer$geojson = _layer$geojson.features[selecteFeatureIndex]) === null || _layer$geojson === void 0 ? void 0 : _layer$geojson.properties) || {};
4813
+ }, selectorMemoizationOptions);
4814
+ /**
4815
+ * Gets layerIds that contain passed dimension
4816
+ *
4817
+ * Example: dimension = getDimensionLayerIds(store, 'elevation')
4818
+ * @param {object} store store: object - object from which the layers state will be extracted
4819
+ * @param {string} dimensionName dimensionName: string - name of dimension you want to retrieve the dimension data for
4820
+ * @returns {string[]} returnType: string[] - layerIds
4821
+ */
4822
+ var getDimensionLayerIds = createSelector(getLayersIds, getLayersById, function (_store, dimensionName) {
4823
+ return dimensionName;
4824
+ }, function (layerIds, layers, dimensionName) {
4825
+ return layerIds.reduce(function (list, layerId) {
4826
+ var layer = layers[layerId];
4827
+ var dimensions = layer !== null && layer !== void 0 && layer.dimensions ? layer.dimensions : [];
4828
+ if (dimensions.find(function (dimension) {
4829
+ return dimension.name === dimensionName;
4830
+ })) {
4831
+ return list.concat(layerId);
4832
+ }
4833
+ return list;
4834
+ }, []);
4835
+ }, selectorMemoizationOptions);
4836
+ var getAcceptanceTimeInMinutes = createSelector(getLayerById, function (layer) {
4837
+ return layer === null || layer === void 0 ? void 0 : layer.acceptanceTimeInMinutes;
4838
+ }, selectorMemoizationOptions);
4839
+ var getLayerIsInsideAcceptanceTime = createSelector(getAcceptanceTimeInMinutes, getLayerCurrentTime, function (state, _layerId, mapId) {
4840
+ var _state$webmap;
4841
+ return (_state$webmap = state.webmap) === null || _state$webmap === void 0 || (_state$webmap = _state$webmap.byId[mapId]) === null || _state$webmap === void 0 || (_state$webmap = _state$webmap.dimensions) === null || _state$webmap === void 0 || (_state$webmap = _state$webmap.find(function (dimension) {
4842
+ return dimension.name === 'time';
4843
+ })) === null || _state$webmap === void 0 ? void 0 : _state$webmap.currentValue;
4844
+ }, function (acceptanceTimeInMinutes, layerCurrentTime, mapCurrentTime) {
4845
+ if (!mapCurrentTime || !layerCurrentTime) {
4846
+ return 'equal';
4929
4847
  }
4930
- };
4931
- var slice$3 = createSlice({
4932
- initialState: loadingIndicatorAdapter.getInitialState(),
4933
- name: 'loadingIndicatorReducer',
4934
- reducers: {
4935
- setGetMapIsLoading: function setGetMapIsLoading(draft, action) {
4936
- var _action$payload = action.payload,
4937
- id = _action$payload.id,
4938
- getMapLoadingPercentage = _action$payload.getMapLoadingPercentage;
4939
- initLoadingIndicatorStateForId(draft, id);
4940
- draft.entities[id].getMapLoadingPercentage = getMapLoadingPercentage;
4941
- },
4942
- setGetCapabilitiesIsLoading: function setGetCapabilitiesIsLoading(draft, action) {
4943
- var _action$payload2 = action.payload,
4944
- id = _action$payload2.id,
4945
- isGetCapabilitiesLoading = _action$payload2.isGetCapabilitiesLoading;
4946
- initLoadingIndicatorStateForId(draft, id);
4947
- draft.entities[id].isGetCapabilitiesLoading = isGetCapabilitiesLoading;
4948
- },
4949
- setEDRIsLoading: function setEDRIsLoading(draft, action) {
4950
- var _action$payload3 = action.payload,
4951
- id = _action$payload3.id,
4952
- isEDRLoading = _action$payload3.isEDRLoading;
4953
- initLoadingIndicatorStateForId(draft, id);
4954
- // When one EDR is loading with a known id (panelId), do not set the any ANY_EDR_SERVICE as the panelId is known.
4955
- if (isEDRLoading && id === ANY_EDR_SERVICE && draft.ids.some(function (id) {
4956
- var _draft$entities$id;
4957
- return (_draft$entities$id = draft.entities[id]) === null || _draft$entities$id === void 0 ? void 0 : _draft$entities$id.isEDRLoading;
4848
+ var mapTime = new Date(mapCurrentTime).getTime();
4849
+ var layerTime = new Date(layerCurrentTime).getTime();
4850
+ if (mapTime === layerTime) {
4851
+ return 'equal';
4852
+ }
4853
+ if (acceptanceTimeInMinutes !== undefined) {
4854
+ var millisecondsBetween = mapTime - layerTime;
4855
+ var acceptanceTimeInMilliseconds = acceptanceTimeInMinutes * 60000;
4856
+ if (Math.abs(millisecondsBetween) > acceptanceTimeInMilliseconds) {
4857
+ return 'outside';
4858
+ }
4859
+ }
4860
+ return 'inside';
4861
+ }, selectorMemoizationOptions);
4862
+ var getUseLatestReferenceTime = createSelector(getLayerById, function (layer) {
4863
+ return Boolean(layer === null || layer === void 0 ? void 0 : layer.useLatestReferenceTime);
4864
+ }, selectorMemoizationOptions);
4865
+ /**
4866
+ * Returns the timestep for this layerId in seconds, or undefined if it has no time dimension or timeinterval.
4867
+ */
4868
+ var getTimeStepForLayerId = createSelector(getLayerTimeDimension, function (timeDimension) {
4869
+ if (!timeDimension) {
4870
+ return undefined;
4871
+ }
4872
+ var values = timeDimension.values,
4873
+ currentValue = timeDimension.currentValue,
4874
+ _timeDimension$timeIn = timeDimension.timeInterval,
4875
+ timeInterval = _timeDimension$timeIn === void 0 ? {} : _timeDimension$timeIn;
4876
+ if (!values || !currentValue) {
4877
+ return isEmpty(timeInterval) ? undefined : getTimeStepFromDataInterval(timeInterval);
4878
+ }
4879
+ var iso8601Intervals = parseTimeDimToISO8601Interval(values);
4880
+ var _iterator = _createForOfIteratorHelper(iso8601Intervals),
4881
+ _step;
4882
+ try {
4883
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
4884
+ var _step$value = _step.value,
4885
+ startTime = _step$value.startTime,
4886
+ endTime = _step$value.endTime,
4887
+ duration = _step$value.duration;
4888
+ if (dateUtils.isWithinInterval(currentValue, {
4889
+ start: startTime,
4890
+ end: endTime
4958
4891
  })) {
4959
- draft.entities[id].isEDRLoading = false;
4960
- } else {
4961
- draft.entities[id].isEDRLoading = isEDRLoading;
4892
+ var parsedInterval = parseISO8601IntervalToDateInterval(duration);
4893
+ return getTimeStepFromDataInterval(parsedInterval);
4962
4894
  }
4963
4895
  }
4964
- },
4965
- extraReducers: function extraReducers(builder) {
4966
- builder.addCase(mapActions.unregisterMap, function (draft, action) {
4967
- var mapId = action.payload.mapId;
4968
- if (draft.entities[mapId]) {
4969
- loadingIndicatorAdapter.removeOne(draft, mapId);
4970
- }
4971
- });
4896
+ } catch (err) {
4897
+ _iterator.e(err);
4898
+ } finally {
4899
+ _iterator.f();
4972
4900
  }
4901
+ return getTimeStepFromDataInterval(timeInterval);
4902
+ }, selectorMemoizationOptions);
4903
+ var getActiveLayerInfo = createSelector(layerStore, function (store) {
4904
+ return store === null || store === void 0 ? void 0 : store.activeLayerInfo;
4973
4905
  });
4974
- var loadingIndicatorActions = slice$3.actions,
4975
- loadingIndicatorReducer = slice$3.reducer;
4976
-
4977
- /* *
4978
- * Licensed under the Apache License, Version 2.0 (the "License");
4979
- * you may not use this file except in compliance with the License.
4980
- * You may obtain a copy of the License at
4981
- *
4982
- * http://www.apache.org/licenses/LICENSE-2.0
4983
- *
4984
- * Unless required by applicable law or agreed to in writing, software
4985
- * distributed under the License is distributed on an "AS IS" BASIS,
4986
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4987
- * See the License for the specific language governing permissions and
4988
- * limitations under the License.
4906
+ var getLayerType = createSelector(getLayerById, function (layer) {
4907
+ var _layer$layerType;
4908
+ return (_layer$layerType = layer === null || layer === void 0 ? void 0 : layer.layerType) !== null && _layer$layerType !== void 0 ? _layer$layerType : 'mapLayer';
4909
+ }, selectorMemoizationOptions);
4910
+ var getLayerOptions = createSelector(getLayerById, function (layer) {
4911
+ return layer === null || layer === void 0 ? void 0 : layer.options;
4912
+ }, selectorMemoizationOptions);
4913
+ /**
4914
+ * Gets all overlayers for a given mapId
4915
+ * Example: overlayers = getOverlayersForMapId(store, 'mapId123')
4916
+ * @param {CoreAppStore} store - The Redux store from which the layers state will be extracted.
4917
+ * @param {string} mapId - The ID of the map for which to retrieve the overlayers.
4918
+ * @returns {Array<{ id: string; name: string }>} - An array of overlayers containing layer information (id and name).
4919
+ */
4920
+ var getOverlayersForMapId = createSelector([layerStore, function (_store, mapId) {
4921
+ return mapId;
4922
+ }], function (store, mapId) {
4923
+ var overLayers = [];
4924
+ (store === null || store === void 0 ? void 0 : store.byId) && Object.values(store.byId).forEach(function (layer) {
4925
+ if (layer.layerType === LayerType.overLayer && layer.mapId === mapId) {
4926
+ overLayers.push({
4927
+ id: layer.id || '',
4928
+ name: layer.name || ''
4929
+ });
4930
+ }
4931
+ });
4932
+ return overLayers;
4933
+ }, selectorMemoizationOptions);
4934
+ /**
4935
+ * Gets the layer title from the service store using the layerId
4989
4936
  *
4990
- * Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4991
- * Copyright 2024 - Finnish Meteorological Institute (FMI)
4992
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
4993
- * */
4994
- var EMPTY_LOADING_INDICATOR = {
4995
- entities: {},
4996
- ids: []
4997
- };
4998
- var _loadingIndicatorAdap = loadingIndicatorAdapter.getSelectors(function (state) {
4999
- var _state$loadingIndicat;
5000
- return (_state$loadingIndicat = state === null || state === void 0 ? void 0 : state.loadingIndicator) !== null && _state$loadingIndicat !== void 0 ? _state$loadingIndicat : EMPTY_LOADING_INDICATOR;
5001
- }),
5002
- selectLoadingIndicatorById = _loadingIndicatorAdap.selectById;
5003
- var getMapLoadingPercentage = createSelector(selectLoadingIndicatorById, function (loadingIndicator) {
5004
- return loadingIndicator ? loadingIndicator === null || loadingIndicator === void 0 ? void 0 : loadingIndicator.getMapLoadingPercentage : 100;
4937
+ * Example: layerTitle = getLayerTitleFromService(store, 'layerId_1')
4938
+ * @param {object} store store: object - object from which the layers state will be extracted
4939
+ * @param {string} layerId layerId: string - Id of the layer
4940
+ * @returns {string} returnType: string - string containing layer title
4941
+ */
4942
+ var getLayerTitleFromService = createSelector(function (store) {
4943
+ return store;
4944
+ }, getLayerService, getLayerName, function (store, service, name) {
4945
+ return getLayerTitle(store, service, name);
5005
4946
  }, selectorMemoizationOptions);
5006
- var isGetMapLoading = createSelector(getMapLoadingPercentage, function (percentage) {
5007
- return percentage !== 100;
4947
+ /**
4948
+ * Gets layer displayname. For EDR layers with multiple parameters, the collectionId is used as displayname. Otherwise the layer title from the service is used.
4949
+ *
4950
+ * Example: layerName = getLayerDisplayName(store, 'layerId_1')
4951
+ * @param {object} store store: object - object from which the layers state will be extracted
4952
+ * @param {string} layerId layerId: string - Id of the layer
4953
+ * @returns {string} returnType: string - layer displayname
4954
+ */
4955
+ var getLayerDisplayName = createSelector(getLayerType, getLayerOptions, getLayerTitleFromService, getLayerName, function (layerType, layerOptions, layerTitle, layerName) {
4956
+ if (layerType === LayerType.edrFeatureLayer && layerOptions) {
4957
+ return (layerOptions === null || layerOptions === void 0 ? void 0 : layerOptions.parameterNames.length) > 1 && layerOptions.collectionId ? layerOptions.collectionId : layerTitle || layerName;
4958
+ }
4959
+ return layerTitle || layerName;
5008
4960
  }, selectorMemoizationOptions);
5009
- var isGetCapabilitiesLoading = createSelector(selectLoadingIndicatorById, function (loadingIndicator) {
5010
- return (loadingIndicator === null || loadingIndicator === void 0 ? void 0 : loadingIndicator.isGetCapabilitiesLoading) || false;
4961
+ /**
4962
+ * Gets the layer missing status. A layer is missing if it is not found in the service store or if its status is 'error'.
4963
+ *
4964
+ * Example: isLayerMissing = getIsLayerMissing(store, 'layerId_1')
4965
+ * @param {object} store store: object - object from which the layers state will be extracted
4966
+ * @param {string} layerId layerId: string - Id of the layer
4967
+ * @returns {boolean} returnType: boolean - true if layer is missing
4968
+ */
4969
+ var getIsLayerMissing = createSelector(function (store) {
4970
+ return store;
4971
+ }, getLayerService, getLayerName, getLayerStatus, getLayerType, function (store, service, name, status, type) {
4972
+ if (type === LayerType.featureLayer || type === LayerType.stacGeoTIFFLayer) {
4973
+ return false;
4974
+ }
4975
+ var layer = getLayerFromService(store, service, name);
4976
+ return !layer || status === LayerStatus.error;
5011
4977
  }, selectorMemoizationOptions);
5012
- var isAnyEdrTypeLoading = function isAnyEdrTypeLoading(loadingIndicator) {
5013
- return (loadingIndicator === null || loadingIndicator === void 0 ? void 0 : loadingIndicator.isEDRLoading) || false;
5014
- };
5015
- var isEDRLoading = createSelector(selectLoadingIndicatorById, isAnyEdrTypeLoading, selectorMemoizationOptions);
5016
- var isAnyEDRLoading = createSelector([function (store) {
5017
- return selectLoadingIndicatorById(store, ANY_EDR_SERVICE);
5018
- }], isAnyEdrTypeLoading, selectorMemoizationOptions);
5019
- var isLoading = createSelector([isGetMapLoading, isGetCapabilitiesLoading, isEDRLoading, isAnyEDRLoading], function (isGetMapLoading, isGetCapabilitiesLoading, isEDRRLoading, isAnyEDRLoading) {
5020
- return isGetMapLoading || isGetCapabilitiesLoading || isEDRRLoading || isAnyEDRLoading;
4978
+ var getIsLayerSelectable = createSelector(getLayerById, function (layer) {
4979
+ return Boolean(layer === null || layer === void 0 ? void 0 : layer.isSelectable);
5021
4980
  }, selectorMemoizationOptions);
5022
4981
 
5023
4982
  var selectors$2 = /*#__PURE__*/Object.freeze({
5024
4983
  __proto__: null,
5025
- getMapLoadingPercentage: getMapLoadingPercentage,
5026
- isEDRLoading: isEDRLoading,
5027
- isGetCapabilitiesLoading: isGetCapabilitiesLoading,
5028
- isGetMapLoading: isGetMapLoading,
5029
- isLoading: isLoading,
5030
- selectLoadingIndicatorById: selectLoadingIndicatorById
5031
- });
5032
-
5033
- var genericActions = _objectSpread2(_objectSpread2({}, syncGroupsActions), {}, {
5034
- initialSyncState: initialState$3,
5035
- setTime: setTime,
5036
- setBbox: setBbox
4984
+ getAcceptanceTimeInMinutes: getAcceptanceTimeInMinutes,
4985
+ getActiveLayerInfo: getActiveLayerInfo,
4986
+ getAllLayers: getAllLayers,
4987
+ getAvailableBaseLayersForMap: getAvailableBaseLayersForMap,
4988
+ getBaseLayers: getBaseLayers,
4989
+ getDimensionLayerIds: getDimensionLayerIds,
4990
+ getFeatureLayerGeoJSON: getFeatureLayerGeoJSON,
4991
+ getFeatureLayerGeoJSONProperties: getFeatureLayerGeoJSONProperties,
4992
+ getFeatureLayers: getFeatureLayers,
4993
+ getHasFeatureLayerGeoJSON: getHasFeatureLayerGeoJSON,
4994
+ getIsLayerInEditMode: getIsLayerInEditMode,
4995
+ getIsLayerMissing: getIsLayerMissing,
4996
+ getIsLayerPresent: getIsLayerPresent,
4997
+ getIsLayerSelectable: getIsLayerSelectable,
4998
+ getLayerById: getLayerById,
4999
+ getLayerByIdWithoutTimeDimension: getLayerByIdWithoutTimeDimension,
5000
+ getLayerCurrentTime: getLayerCurrentTime,
5001
+ getLayerDimension: getLayerDimension,
5002
+ getLayerDimensions: getLayerDimensions,
5003
+ getLayerDisplayName: getLayerDisplayName,
5004
+ getLayerEnabled: getLayerEnabled,
5005
+ getLayerHasTimeDimension: getLayerHasTimeDimension,
5006
+ getLayerIsInsideAcceptanceTime: getLayerIsInsideAcceptanceTime,
5007
+ getLayerName: getLayerName,
5008
+ getLayerNonTimeDimensions: getLayerNonTimeDimensions,
5009
+ getLayerOpacity: getLayerOpacity,
5010
+ getLayerOptions: getLayerOptions,
5011
+ getLayerService: getLayerService,
5012
+ getLayerStatus: getLayerStatus,
5013
+ getLayerStyle: getLayerStyle,
5014
+ getLayerTimeDimension: getLayerTimeDimension,
5015
+ getLayerTitleFromService: getLayerTitleFromService,
5016
+ getLayerType: getLayerType,
5017
+ getLayers: getLayers,
5018
+ getLayersById: getLayersById,
5019
+ getLayersByMapId: getLayersByMapId,
5020
+ getLayersIds: getLayersIds,
5021
+ getOverLayers: getOverLayers,
5022
+ getOverlayersForMapId: getOverlayersForMapId,
5023
+ getSelectedFeatureIndex: getSelectedFeatureIndex,
5024
+ getTimeStepForLayerId: getTimeStepForLayerId,
5025
+ getUseLatestReferenceTime: getUseLatestReferenceTime
5037
5026
  });
5038
5027
 
5039
- /* *
5040
- * Licensed under the Apache License, Version 2.0 (the "License");
5041
- * you may not use this file except in compliance with the License.
5042
- * You may obtain a copy of the License at
5043
- *
5044
- * http://www.apache.org/licenses/LICENSE-2.0
5045
- *
5046
- * Unless required by applicable law or agreed to in writing, software
5047
- * distributed under the License is distributed on an "AS IS" BASIS,
5048
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5049
- * See the License for the specific language governing permissions and
5050
- * limitations under the License.
5051
- *
5052
- * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5053
- * Copyright 2025 - Finnish Meteorological Institute (FMI)
5054
- * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
5055
- * */
5056
- var IS_LEGEND_OPEN_BY_DEFAULT = false;
5057
- var SECONDS_IN_DAY = 86400;
5058
- var SECONDS_IN_HOUR = 3600;
5059
-
5060
5028
  var _excluded$2 = ["mapId"];
5061
5029
  var getMapStore = function getMapStore(store) {
5062
- return store && store.webmap;
5030
+ return store === null || store === void 0 ? void 0 : store.webmap;
5063
5031
  };
5064
5032
  /**
5065
5033
  * Gets the map state by mapId
@@ -5074,7 +5042,7 @@ var getMapById = function getMapById(store, mapId) {
5074
5042
  return (_getMapStore = getMapStore(store)) === null || _getMapStore === void 0 ? void 0 : _getMapStore.byId[mapId];
5075
5043
  };
5076
5044
  var getAllMapsByIds = createSelector(getMapStore, function (mapState) {
5077
- return mapState && mapState.byId ? mapState && mapState.byId : {};
5045
+ return mapState !== null && mapState !== void 0 && mapState.byId ? mapState === null || mapState === void 0 ? void 0 : mapState.byId : {};
5078
5046
  }, selectorMemoizationOptions);
5079
5047
  /**
5080
5048
  * Gets all mapIds
@@ -5084,7 +5052,7 @@ var getAllMapsByIds = createSelector(getMapStore, function (mapState) {
5084
5052
  * @returns {array} array containing all map ids
5085
5053
  */
5086
5054
  var getAllMapIds = createSelector(getMapStore, function (mapState) {
5087
- return mapState && mapState.allIds ? mapState.allIds : [];
5055
+ return mapState !== null && mapState !== void 0 && mapState.allIds ? mapState.allIds : [];
5088
5056
  }, selectorMemoizationOptions);
5089
5057
  /**
5090
5058
  * Gets the map state of the first map in the store
@@ -5175,7 +5143,7 @@ var getMapLayersWithoutDimensionCurrentValue = createSelector(getLayerIds, getLa
5175
5143
  * @returns {array} returnType: array - array containing an array of baselayers ids
5176
5144
  */
5177
5145
  var getMapBaseLayersIds = createSelector(getMapById, function (store) {
5178
- return store && store.baseLayers ? store.baseLayers : [];
5146
+ return store !== null && store !== void 0 && store.baseLayers ? store.baseLayers : [];
5179
5147
  }, selectorMemoizationOptions);
5180
5148
  /**
5181
5149
  * Gets all baselayers for a map
@@ -5252,7 +5220,7 @@ var getMapDimension = createSelector([getMapById, function (_store, mapId) {
5252
5220
  }, function (_store, _mapId, dimensionName) {
5253
5221
  return dimensionName;
5254
5222
  }], function (mapState, _mapId, dimensionName) {
5255
- if (mapState && mapState.dimensions) {
5223
+ if (mapState !== null && mapState !== void 0 && mapState.dimensions) {
5256
5224
  return mapState.dimensions.find(function (dim) {
5257
5225
  return dim.name === dimensionName;
5258
5226
  });
@@ -5270,7 +5238,7 @@ var getSelectedTime = createSelector(function (store, mapId) {
5270
5238
  return getMapDimension(store, mapId, 'time');
5271
5239
  }, function (timeDimension) {
5272
5240
  var now = dateUtils.unix(new Date());
5273
- if (!timeDimension || !timeDimension.currentValue) {
5241
+ if (!(timeDimension !== null && timeDimension !== void 0 && timeDimension.currentValue)) {
5274
5242
  return now;
5275
5243
  }
5276
5244
  var timeSliderTime = dateUtils.parseISO(timeDimension.currentValue);
@@ -5351,7 +5319,8 @@ var linkedMapAnimationInfo = createSelector(getMapStore, getSynchronizationGroup
5351
5319
  id: (mapState === null || mapState === void 0 ? void 0 : mapState.id) || ''
5352
5320
  };
5353
5321
  syncStore === null || syncStore === void 0 || syncStore.groups.allIds.forEach(function (groupId) {
5354
- if (syncStore.groups.byId[groupId].targets.byId[animationInfo.id] && syncStore.groups.byId[groupId].targets.byId[animationInfo.id].linked) {
5322
+ var _syncStore$groups$byI;
5323
+ if ((_syncStore$groups$byI = syncStore.groups.byId[groupId].targets.byId[animationInfo.id]) !== null && _syncStore$groups$byI !== void 0 && _syncStore$groups$byI.linked) {
5355
5324
  syncStore.groups.byId[groupId].targets.allIds.forEach(function (id) {
5356
5325
  var _mapStore$byId$id;
5357
5326
  if ((mapStore === null || mapStore === void 0 || (_mapStore$byId$id = mapStore.byId[id]) === null || _mapStore$byId$id === void 0 ? void 0 : _mapStore$byId$id.isAnimating) === true) {
@@ -5686,7 +5655,7 @@ var getAllUniqueDimensions = createSelector(getAllMapIds, function (store) {
5686
5655
  return mapIds.reduce(function (list, mapId) {
5687
5656
  var mapDimensions = getMapDimensions(store, mapId);
5688
5657
  var uniqueMapDims = mapDimensions.reduce(function (array, dimension) {
5689
- if (dimension && dimension.name && array.indexOf(dimension.name) === -1) {
5658
+ if (dimension !== null && dimension !== void 0 && dimension.name && !array.includes(dimension.name)) {
5690
5659
  return array.concat(dimension.name);
5691
5660
  }
5692
5661
  return array;
@@ -5887,7 +5856,8 @@ var getTimeSliderInitialProps = function getTimeSliderInitialProps(store, panelI
5887
5856
  */
5888
5857
  var getMapLayerIdsEnabled = createSelector(getLayerIds, getLayersById, function (mapLayerIds, layers) {
5889
5858
  return mapLayerIds.reduce(function (list, layerId) {
5890
- if (layers[layerId] && layers[layerId].enabled) {
5859
+ var _layers$layerId;
5860
+ if ((_layers$layerId = layers[layerId]) !== null && _layers$layerId !== void 0 && _layers$layerId.enabled) {
5891
5861
  return list.concat(layerId);
5892
5862
  }
5893
5863
  return list;
@@ -5991,7 +5961,7 @@ var getAnimationRange = createSelector(getLayersById, getAutoTimeStepLayerId, ge
5991
5961
  * @returns {MapPreset | undefined} returnType: MapPreset
5992
5962
  */
5993
5963
  var getdefaultMapSettings = createSelector(getMapStore, function (state) {
5994
- return state && state.defaultMapSettings;
5964
+ return state === null || state === void 0 ? void 0 : state.defaultMapSettings;
5995
5965
  }, selectorMemoizationOptions);
5996
5966
  /**
5997
5967
  * Gets the layers of intialViewMapPreset from webmap state
@@ -6000,7 +5970,7 @@ var getdefaultMapSettings = createSelector(getMapStore, function (state) {
6000
5970
  * @returns {Layer[] | undefined} returnType: Layer[]
6001
5971
  */
6002
5972
  var getdefaultMapSettingsLayers = createSelector(getdefaultMapSettings, function (state) {
6003
- return state && state.layers;
5973
+ return state === null || state === void 0 ? void 0 : state.layers;
6004
5974
  }, selectorMemoizationOptions);
6005
5975
  /**
6006
5976
  * Gets the selected overlayer from webmap state
@@ -6126,7 +6096,7 @@ var filterLayers = function filterLayers() {
6126
6096
  overLayers: overLayers
6127
6097
  };
6128
6098
  }
6129
- if (layer.layerType === LayerType.mapLayer || layer.layerType === LayerType.edrFeatureLayer) {
6099
+ if (layer.layerType === LayerType.mapLayer || layer.layerType === LayerType.wmtsMapLayer || layer.layerType === LayerType.edrFeatureLayer || layer.layerType === LayerType.stacGeoTIFFLayer) {
6130
6100
  return {
6131
6101
  mapLayers: mapLayers.concat(parsedLayer),
6132
6102
  baseLayers: baseLayers,
@@ -6396,7 +6366,7 @@ var findTargets = function findTargets(state, payload, actionType, sourceMapId)
6396
6366
  /* Check if the source is in the target list of the synchonizationGroup */
6397
6367
  var source = syncronizationGroup.targets.byId[sourceMapId];
6398
6368
  /* If the source is part of the target list, and is linked, continue syncing the other targets */
6399
- if (source && source.linked) {
6369
+ if (source !== null && source !== void 0 && source.linked) {
6400
6370
  syncronizationGroup.targets.allIds.forEach(function (targetId) {
6401
6371
  var target = syncronizationGroup.targets.byId[targetId];
6402
6372
  if (targetId !== sourceMapId && target.linked && !targetsInActionPayload[targetId]) {
@@ -6973,7 +6943,7 @@ var isNextStepAvailable = function isNextStepAvailable(reduxLayers, nextTimeStri
6973
6943
  };
6974
6944
  });
6975
6945
  var nextStepIsAvailable = isThereSomethingNotAvailable.filter(function (step) {
6976
- return step.status === true;
6946
+ return step.status;
6977
6947
  }).length === wmLayers.length;
6978
6948
  return nextStepIsAvailable;
6979
6949
  };
@@ -7144,7 +7114,7 @@ mapListener.startListening({
7144
7114
  });
7145
7115
  var updateAnimation = function updateAnimation(mapId, maxValue, listenerApi) {
7146
7116
  var shouldEndtimeOverride$1 = shouldEndtimeOverride(listenerApi.getState(), mapId);
7147
- if (shouldEndtimeOverride$1 === true) {
7117
+ if (shouldEndtimeOverride$1) {
7148
7118
  return;
7149
7119
  }
7150
7120
  var animationStart = getAnimationStartTime(listenerApi.getState(), mapId);
@@ -7414,8 +7384,8 @@ mapListener.startListening({
7414
7384
  srs: proj.srs
7415
7385
  }));
7416
7386
  case 21:
7417
- animationLength = animationPayload && animationPayload.duration;
7418
- animationEndTime = animationPayload && animationPayload.endTime && isAnimationEndTimeValid(animationPayload.endTime) && animationPayload.endTime;
7387
+ animationLength = animationPayload === null || animationPayload === void 0 ? void 0 : animationPayload.duration;
7388
+ animationEndTime = (animationPayload === null || animationPayload === void 0 ? void 0 : animationPayload.endTime) && isAnimationEndTimeValid(animationPayload.endTime) && animationPayload.endTime;
7419
7389
  shouldEndtimeOverride = animationPayload ? animationPayload.shouldEndtimeOverride : false;
7420
7390
  if (shouldEndtimeOverride) {
7421
7391
  // auto update
@@ -7465,7 +7435,7 @@ mapListener.startListening({
7465
7435
  }));
7466
7436
  }
7467
7437
  // sets timestep by interval of animationPayload
7468
- interval = animationPayload && animationPayload.interval;
7438
+ interval = animationPayload === null || animationPayload === void 0 ? void 0 : animationPayload.interval;
7469
7439
  if (interval) {
7470
7440
  listenerApi.dispatch(mapActions.setTimeStep({
7471
7441
  mapId: mapId,
@@ -7526,7 +7496,7 @@ mapListener.startListening({
7526
7496
  }
7527
7497
  }
7528
7498
  // sets animationDelay by speed of animationPayload
7529
- if (animationPayload && animationPayload.speed) {
7499
+ if (animationPayload !== null && animationPayload !== void 0 && animationPayload.speed) {
7530
7500
  listenerApi.dispatch(mapActions.setAnimationDelay({
7531
7501
  mapId: mapId,
7532
7502
  animationDelay: getSpeedDelay(animationPayload.speed)
@@ -7534,7 +7504,7 @@ mapListener.startListening({
7534
7504
  }
7535
7505
  // turn animation on
7536
7506
  if (shouldAnimate === true) {
7537
- duration = animationPayload && animationPayload.duration ? animationPayload.duration : 5 * 60; // set to default of 5 hours
7507
+ duration = animationPayload !== null && animationPayload !== void 0 && animationPayload.duration ? animationPayload.duration : 5 * 60; // set to default of 5 hours
7538
7508
  _animationEnd = shouldEndtimeOverride && animationEndTime ? getAnimationEndTime(listenerApi.getState(), mapId) : dateUtils.dateToString(dateUtils.utc(), dateFormat);
7539
7509
  animationStart = shouldEndtimeOverride && animationLength ? getAnimationStartTime(listenerApi.getState(), mapId) : dateUtils.dateToString(dateUtils.sub(dateUtils.utc(_animationEnd), {
7540
7510
  minutes: duration
@@ -7790,7 +7760,7 @@ var getGroupForMap = function getGroupForMap(mapId, state) {
7790
7760
  var syncGroupState = getSynchronizationGroupState(state);
7791
7761
  return syncGroupState.groups.allIds.find(function (id) {
7792
7762
  var group = syncGroupState.groups.byId[id];
7793
- return group.type === SYNCGROUPS_TYPE_SETBBOX && group.targets.allIds.indexOf(mapId) !== -1;
7763
+ return group.type === SYNCGROUPS_TYPE_SETBBOX && group.targets.allIds.includes(mapId);
7794
7764
  });
7795
7765
  };
7796
7766
  // This is fired when the preset is set up and when the projection is changed
@@ -7819,15 +7789,14 @@ openlayersListener.startListening({
7819
7789
  var viewPortHeight = (mapElement === null || mapElement === void 0 ? void 0 : mapElement.clientHeight) || ((_window$visualViewpor2 = window.visualViewport) === null || _window$visualViewpor2 === void 0 ? void 0 : _window$visualViewpor2.height) || 1024;
7820
7790
  view.setViewportSize([viewPortWidth, viewPortHeight]);
7821
7791
  view.fit(extent);
7822
- // Also: if this map is part of a group and the srs has changed => change group view
7792
+ // Also: if this map is part of a group => change group view
7823
7793
  var mapSyncGroup = getGroupForMap(mapId, listenerApi.getState());
7824
7794
  if (!mapSyncGroup) {
7825
7795
  return;
7826
7796
  }
7827
7797
  var groupView = getViewObjectForSyncGroup(mapSyncGroup);
7828
- if (!groupView.view.isDef() || groupView.view.getProjection().getCode() !== srs) {
7829
- groupView.setView(copyView(view));
7830
- }
7798
+ // Always update groupView to keep bbox extent in sync
7799
+ groupView.setView(copyView(view));
7831
7800
  }
7832
7801
  });
7833
7802
  // This is fired when the map view is updated (regardless of if the map is in a group or not)
@@ -7916,37 +7885,50 @@ var fetchService = /*#__PURE__*/function () {
7916
7885
  };
7917
7886
  }();
7918
7887
  var fetchInitialServices = /*#__PURE__*/function () {
7919
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(payload, listenerApi) {
7920
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7921
- while (1) switch (_context2.prev = _context2.next) {
7888
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(payload, listenerApi) {
7889
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
7890
+ while (1) switch (_context3.prev = _context3.next) {
7922
7891
  case 0:
7923
- if (!(!payload || !payload.services)) {
7924
- _context2.next = 2;
7892
+ if (payload !== null && payload !== void 0 && payload.services) {
7893
+ _context3.next = 2;
7925
7894
  break;
7926
7895
  }
7927
- return _context2.abrupt("return");
7896
+ return _context3.abrupt("return");
7928
7897
  case 2:
7929
- _context2.prev = 2;
7930
- _context2.next = 5;
7931
- return Promise.all(payload.services.map(function (_ref3) {
7932
- var url = _ref3.url,
7933
- service = _objectWithoutProperties(_ref3, _excluded);
7934
- return fetchService(_objectSpread2(_objectSpread2({}, service), {}, {
7935
- serviceUrl: url
7936
- }), listenerApi);
7937
- }));
7898
+ _context3.prev = 2;
7899
+ _context3.next = 5;
7900
+ return Promise.all(payload.services.map(/*#__PURE__*/function () {
7901
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
7902
+ var url, service;
7903
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7904
+ while (1) switch (_context2.prev = _context2.next) {
7905
+ case 0:
7906
+ url = _ref3.url, service = _objectWithoutProperties(_ref3, _excluded);
7907
+ return _context2.abrupt("return", fetchService(_objectSpread2(_objectSpread2({}, service), {}, {
7908
+ serviceUrl: url
7909
+ }), listenerApi));
7910
+ case 2:
7911
+ case "end":
7912
+ return _context2.stop();
7913
+ }
7914
+ }, _callee2);
7915
+ }));
7916
+ return function (_x5) {
7917
+ return _ref4.apply(this, arguments);
7918
+ };
7919
+ }()));
7938
7920
  case 5:
7939
- _context2.next = 10;
7921
+ _context3.next = 10;
7940
7922
  break;
7941
7923
  case 7:
7942
- _context2.prev = 7;
7943
- _context2.t0 = _context2["catch"](2);
7944
- console.warn(_context2.t0);
7924
+ _context3.prev = 7;
7925
+ _context3.t0 = _context3["catch"](2);
7926
+ console.warn(_context3.t0);
7945
7927
  case 10:
7946
7928
  case "end":
7947
- return _context2.stop();
7929
+ return _context3.stop();
7948
7930
  }
7949
- }, _callee2, null, [[2, 7]]);
7931
+ }, _callee3, null, [[2, 7]]);
7950
7932
  }));
7951
7933
  return function fetchInitialServices(_x3, _x4) {
7952
7934
  return _ref2.apply(this, arguments);
@@ -7955,22 +7937,22 @@ var fetchInitialServices = /*#__PURE__*/function () {
7955
7937
  serviceListener.startListening({
7956
7938
  actionCreator: serviceActions.fetchInitialServices,
7957
7939
  effect: function () {
7958
- var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4, listenerApi) {
7940
+ var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5, listenerApi) {
7959
7941
  var payload;
7960
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
7961
- while (1) switch (_context3.prev = _context3.next) {
7942
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
7943
+ while (1) switch (_context4.prev = _context4.next) {
7962
7944
  case 0:
7963
- payload = _ref4.payload;
7945
+ payload = _ref5.payload;
7964
7946
  listenerApi.cancelActiveListeners();
7965
- _context3.next = 4;
7947
+ _context4.next = 4;
7966
7948
  return fetchInitialServices(payload, listenerApi);
7967
7949
  case 4:
7968
7950
  case "end":
7969
- return _context3.stop();
7951
+ return _context4.stop();
7970
7952
  }
7971
- }, _callee3);
7953
+ }, _callee4);
7972
7954
  }));
7973
- function effect(_x5, _x6) {
7955
+ function effect(_x6, _x7) {
7974
7956
  return _effect.apply(this, arguments);
7975
7957
  }
7976
7958
  return effect;
@@ -8038,13 +8020,14 @@ routerListener.startListening({
8038
8020
  actionCreator: routerActions.navigateToUrl,
8039
8021
  effect: function () {
8040
8022
  var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
8023
+ var _historyDict$navigate;
8041
8024
  var payload;
8042
8025
  return _regeneratorRuntime().wrap(function _callee$(_context) {
8043
8026
  while (1) switch (_context.prev = _context.next) {
8044
8027
  case 0:
8045
8028
  payload = _ref.payload;
8046
8029
  listenerApi.cancelActiveListeners();
8047
- historyDict.navigate && historyDict.navigate(payload.url);
8030
+ (_historyDict$navigate = historyDict.navigate) === null || _historyDict$navigate === void 0 || _historyDict$navigate.call(historyDict, payload.url);
8048
8031
  case 3:
8049
8032
  case "end":
8050
8033
  return _context.stop();
@@ -8234,7 +8217,7 @@ var drawingToolReducer = slice$1.reducer,
8234
8217
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
8235
8218
  * */
8236
8219
  var getDrawingtoolStore = function getDrawingtoolStore(store) {
8237
- if (store && store.drawingtools) {
8220
+ if (store !== null && store !== void 0 && store.drawingtools) {
8238
8221
  return store.drawingtools;
8239
8222
  }
8240
8223
  return null;
@@ -8790,7 +8773,7 @@ var createMapDimensionsState = function createMapDimensionsState(dimensions) {
8790
8773
  var webmapStateWithAddedLayer = function webmapStateWithAddedLayer(layerType, layerId, mapId, dimensions) {
8791
8774
  var webmap = createWebmapState(mapId);
8792
8775
  // Add the dimensions to the map state
8793
- if (dimensions && dimensions.length) {
8776
+ if (dimensions !== null && dimensions !== void 0 && dimensions.length) {
8794
8777
  dimensions.forEach(function (dimension) {
8795
8778
  webmap.byId[mapId].dimensions.push(dimension);
8796
8779
  });
@@ -9276,4 +9259,4 @@ var configureOpenGeoWebStore = function configureOpenGeoWebStore() {
9276
9259
  });
9277
9260
  };
9278
9261
 
9279
- export { IS_LEGEND_OPEN_BY_DEFAULT, SECONDS_IN_DAY, SECONDS_IN_HOUR, commonActions, commonListener, commonReducers, commonSelectors, configureOpenGeoWebStore, createMockStore, createViewObjectForNewMap, drawingToolActions, drawingToolListener, drawingToolReducer, selectors as drawingToolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$3 as genericSelectors, types as genericTypes, getSingularDrawtoolDrawLayerId, getUserAddedServices, getViewObjectForMapId, getViewObjectForSyncGroup, initialState$3 as initialState, layerActions, layerReducer, selectors$6 as layerSelectors, types$3 as layerTypes, utils$1 as layerUtils, layersListener, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$2 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, mapReducer, selectors$1 as mapSelectors, types$4 as mapTypes, mapUtils, metronomeListener, openlayersListener, routerActions, routerListener, routerReducer, utils as routerUtils, selectorMemoizationOptions, serviceActions, serviceListener, serviceReducer, selectors$7 as serviceSelectors, types$5 as serviceTypes, setUserAddedServices, storeMiddlewares, storeReducerMap, storeTestSettings, storeTestUtils, utils$3 as storeUtils, constants$2 as syncConstants, syncGroupsActions, syncGroupsListener, syncGroupsReducer, selector as syncGroupsSelector, selectors$4 as syncGroupsSelectors, types$1 as syncGroupsTypes, types$1 as types, uiActions, uiReducer, selectors$5 as uiSelectors, types$2 as uiTypes, unifyReducerMaps, useSetupDialog, useUpdateSharedData };
9262
+ export { IS_LEGEND_OPEN_BY_DEFAULT, SECONDS_IN_DAY, SECONDS_IN_HOUR, commonActions, commonListener, commonReducers, commonSelectors, configureOpenGeoWebStore, createMockStore, createViewObjectForNewMap, drawingToolActions, drawingToolListener, drawingToolReducer, selectors as drawingToolSelectors, filterLayers$1 as filterLayers, genericActions, genericListener, selectors$5 as genericSelectors, getSingularDrawtoolDrawLayerId, getUserAddedServices, getViewObjectForMapId, getViewObjectForSyncGroup, initialState$3 as initialState, layerActions, layerReducer, selectors$2 as layerSelectors, types$2 as layerTypes, utils$1 as layerUtils, layersListener, constants as linkComponentTypesConstants, loadingIndicatorActions, constants$1 as loadingIndicatorConstants, loadingIndicatorReducer, selectors$4 as loadingIndicatorSelectors, mapActions, enums as mapEnums, mapListener, mapReducer, selectors$1 as mapSelectors, types$3 as mapTypes, mapUtils, metronomeListener, openlayersListener, routerActions, routerListener, routerReducer, utils as routerUtils, selectorMemoizationOptions, serviceActions, serviceListener, serviceReducer, selectors$7 as serviceSelectors, setUserAddedServices, storeMiddlewares, storeReducerMap, storeTestSettings, storeTestUtils, utils$3 as storeUtils, constants$2 as syncConstants, syncGroupsActions, syncGroupsListener, syncGroupsReducer, selector as syncGroupsSelector, selectors$6 as syncGroupsSelectors, types$1 as syncGroupsTypes, types$1 as types, uiActions, uiReducer, selectors$3 as uiSelectors, types as uiTypes, unifyReducerMaps, useSetupDialog, useUpdateSharedData };