@opengeoweb/soundings 19.1.1 → 19.3.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.
package/dist/index.esm.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { Stack, Box, Tooltip, Typography, styled, Card, IconButton, Menu, ListSubheader, MenuItem, LinearProgress, List as List$1, ListItem, ListItemIcon, Checkbox, ListItemText, Grid, ListItemButton, Switch, ToggleButtonGroup, ToggleButton } from '@mui/material';
3
3
  import { range, isEqual } from 'lodash';
4
- import React, { useMemo, useRef, useEffect, useState, Fragment as Fragment$1, useCallback } from 'react';
4
+ import React, { useMemo, useRef, useEffect, useId, useState, Fragment as Fragment$1, useCallback } from 'react';
5
5
  import { useDispatch, useSelector, shallowEqual } from 'react-redux';
6
- import { dateUtils, referenceTimeUtils, safelyInitI18nForTestsAndStories, sharedTranslations, SHARED_NAMESPACE, SwitchButton, CustomToggleButton, CustomSlider, AlertBanner, ToolContainerDraggable, StyledSelect, SearchField, CustomAccordion } from '@opengeoweb/shared';
7
- import { selectorMemoizationOptions, uiSelectors, uiTypes, uiActions, genericActions, useRegisterFeatureSyncSource, genericSelectors, useSyncgroupTimeState, mapSelectors, mapActions, useUpdateFeatureSyncLayers, useSetupDialog, layerActions, storeReducerMap, storeMiddlewares } from '@opengeoweb/store';
6
+ import { dateUtils, referenceTimeUtils, safelyInitI18nForTestsAndStories, sharedTranslations, SHARED_NAMESPACE, SwitchButton, CustomToggleButton, CustomSlider, AlertBanner, ToolContainerDraggable, TooltipSelect, AlertIcon, useResizeObserver, SearchField, CustomAccordion } from '@opengeoweb/shared';
7
+ import { selectorMemoizationOptions, uiSelectors, uiTypes, uiActions, genericActions, useRegisterFeatureSyncSource, genericSelectors, useSyncgroupTimeState, mapSelectors, mapActions, useUpdateFeatureSyncLayers, layerActions, useSetupDialog, storeReducerMap, storeMiddlewares } from '@opengeoweb/store';
8
8
  import { Layers, Sources, Location, Equalizer, ArrowDropDownDown, DragHandle, Close, Visibility, VisibilityOff } from '@opengeoweb/theme';
9
9
  import { ParseISOTimeRangeDuration, parseISO8601IntervalToDateInterval, handleDateUtilsISOString, webmapUtils } from '@opengeoweb/webmap';
10
10
  import { MapFeatureClass } from '@opengeoweb/webmap-react';
11
11
  import * as d3 from 'd3';
12
- import { useQueries } from '@tanstack/react-query';
12
+ import { queryOptions, useQueryClient, useQueries } from '@tanstack/react-query';
13
13
  import { withJsonFormat, getHeaders, handleResponse } from '@opengeoweb/api';
14
14
  import { createSlice, createSelector, combineReducers, configureStore } from '@reduxjs/toolkit';
15
15
  import i18n from 'i18next';
@@ -139,6 +139,8 @@ var REFERENCE_PRESSURE = 1000 * 100; // 1000hPa = 100000Pa
139
139
  var EARTH_MEAN_RADIUS = 6371; // [km]
140
140
  var MAX_PROXIMITY_RADIUS = 100; // [km]
141
141
  var SAME_POINT_DISTANCE_KM = 0.05;
142
+ var SOUNDINGS_CONTAINER_BREAKPOINT_PX = '600px';
143
+ var SOUNDINGS_CONTAINER_NAME = 'soundings-container';
142
144
 
143
145
  /* *
144
146
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -717,13 +719,13 @@ var SoundingsLegend = function SoundingsLegend(_ref) {
717
719
  return jsx(Stack, {
718
720
  direction: "row",
719
721
  spacing: 1,
720
- useFlexGap: true,
721
722
  sx: {
722
723
  justifyContent: 'center',
723
724
  flexWrap: 'wrap',
724
725
  paddingLeft: 2,
725
726
  paddingTop: 0.5
726
727
  },
728
+ useFlexGap: true,
727
729
  children: sourceSelections.map(function (source, index) {
728
730
  var resolvedInstanceId = sourceResolvedInstanceIds == null ? void 0 : sourceResolvedInstanceIds[source.collectionId];
729
731
  var title = getLegendTitle(source, resolvedInstanceId);
@@ -985,62 +987,92 @@ var getCollectionLocations = /*#__PURE__*/function () {
985
987
  return _ref.apply(this, arguments);
986
988
  };
987
989
  }();
988
- var getCollectionInstances = /*#__PURE__*/function () {
989
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(collectionId, baseUrl) {
990
+ var getInstanceLocations = /*#__PURE__*/function () {
991
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(collectionId, instanceId, baseUrl) {
990
992
  return _regenerator().w(function (_context2) {
991
993
  while (1) switch (_context2.n) {
992
994
  case 0:
993
- return _context2.a(2, fetch(withJsonFormat(baseUrl + "/collections/" + collectionId + "/instances"), {
995
+ return _context2.a(2, fetch(withJsonFormat(baseUrl + "/collections/" + collectionId + "/instances/" + instanceId + "/locations"), {
994
996
  headers: getHeaders()
995
997
  }).then(handleResponse));
996
998
  }
997
999
  }, _callee2);
998
1000
  }));
999
- return function getCollectionInstances(_x3, _x4) {
1001
+ return function getInstanceLocations(_x3, _x4, _x5) {
1000
1002
  return _ref2.apply(this, arguments);
1001
1003
  };
1002
1004
  }();
1003
- var getCollectionDetails = /*#__PURE__*/function () {
1005
+ var getCollectionInstances = /*#__PURE__*/function () {
1004
1006
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(collectionId, baseUrl) {
1005
1007
  return _regenerator().w(function (_context3) {
1006
1008
  while (1) switch (_context3.n) {
1007
1009
  case 0:
1008
- return _context3.a(2, fetch(withJsonFormat(baseUrl + "/collections/" + collectionId), {
1010
+ return _context3.a(2, fetch(withJsonFormat(baseUrl + "/collections/" + collectionId + "/instances"), {
1009
1011
  headers: getHeaders()
1010
1012
  }).then(handleResponse));
1011
1013
  }
1012
1014
  }, _callee3);
1013
1015
  }));
1014
- return function getCollectionDetails(_x5, _x6) {
1016
+ return function getCollectionInstances(_x6, _x7) {
1015
1017
  return _ref3.apply(this, arguments);
1016
1018
  };
1017
1019
  }();
1018
- var getEdrCollectionForLocation = /*#__PURE__*/function () {
1019
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(collectionId, baseUrl, instanceId, locationId, parameters, datetime, verticalRange) {
1020
- var url;
1020
+ var getCollectionDetails = /*#__PURE__*/function () {
1021
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(collectionId, baseUrl) {
1021
1022
  return _regenerator().w(function (_context4) {
1022
1023
  while (1) switch (_context4.n) {
1024
+ case 0:
1025
+ return _context4.a(2, fetch(withJsonFormat(baseUrl + "/collections/" + collectionId), {
1026
+ headers: getHeaders()
1027
+ }).then(handleResponse));
1028
+ }
1029
+ }, _callee4);
1030
+ }));
1031
+ return function getCollectionDetails(_x8, _x9) {
1032
+ return _ref4.apply(this, arguments);
1033
+ };
1034
+ }();
1035
+ var getInstanceDetails = /*#__PURE__*/function () {
1036
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(collectionId, instanceId, baseUrl) {
1037
+ return _regenerator().w(function (_context5) {
1038
+ while (1) switch (_context5.n) {
1039
+ case 0:
1040
+ return _context5.a(2, fetch(withJsonFormat(baseUrl + "/collections/" + collectionId + "/instances/" + instanceId), {
1041
+ headers: getHeaders()
1042
+ }).then(handleResponse));
1043
+ }
1044
+ }, _callee5);
1045
+ }));
1046
+ return function getInstanceDetails(_x0, _x1, _x10) {
1047
+ return _ref5.apply(this, arguments);
1048
+ };
1049
+ }();
1050
+ var getEdrCollectionForLocation = /*#__PURE__*/function () {
1051
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(collectionId, baseUrl, instanceId, locationId, parameters, datetime, verticalRange) {
1052
+ var url;
1053
+ return _regenerator().w(function (_context6) {
1054
+ while (1) switch (_context6.n) {
1023
1055
  case 0:
1024
1056
  url = new URL(baseUrl + "/collections/" + collectionId + (instanceId ? "/instances/" + instanceId : '') + "/locations/" + locationId);
1025
1057
  url.searchParams.append('parameter-name', parameters.join(','));
1026
1058
  url.searchParams.append('datetime', datetime);
1027
1059
  url.searchParams.append('z', verticalRange);
1028
1060
  url.searchParams.append('f', 'CoverageJSON');
1029
- return _context4.a(2, fetch(url.toString(), {
1061
+ return _context6.a(2, fetch(url.toString(), {
1030
1062
  headers: getHeaders()
1031
1063
  }).then(handleResponse));
1032
1064
  }
1033
- }, _callee4);
1065
+ }, _callee6);
1034
1066
  }));
1035
- return function getEdrCollectionForLocation(_x7, _x8, _x9, _x0, _x1, _x10, _x11) {
1036
- return _ref4.apply(this, arguments);
1067
+ return function getEdrCollectionForLocation(_x11, _x12, _x13, _x14, _x15, _x16, _x17) {
1068
+ return _ref6.apply(this, arguments);
1037
1069
  };
1038
1070
  }();
1039
1071
  var getEdrCollectionForPosition = /*#__PURE__*/function () {
1040
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(collectionId, baseUrl, instanceId, coordinates, parameters, datetime, verticalRange) {
1072
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(collectionId, baseUrl, instanceId, coordinates, parameters, datetime, verticalRange) {
1041
1073
  var url;
1042
- return _regenerator().w(function (_context5) {
1043
- while (1) switch (_context5.n) {
1074
+ return _regenerator().w(function (_context7) {
1075
+ while (1) switch (_context7.n) {
1044
1076
  case 0:
1045
1077
  url = new URL(baseUrl + "/collections/" + collectionId + (instanceId ? "/instances/" + instanceId : '') + "/position");
1046
1078
  url.searchParams.append('coords', "POINT(" + coordinates[0] + " " + coordinates[1] + ")");
@@ -1050,14 +1082,14 @@ var getEdrCollectionForPosition = /*#__PURE__*/function () {
1050
1082
  url.searchParams.append('z', verticalRange);
1051
1083
  }
1052
1084
  url.searchParams.append('f', 'CoverageJSON');
1053
- return _context5.a(2, fetch(url.toString(), {
1085
+ return _context7.a(2, fetch(url.toString(), {
1054
1086
  headers: getHeaders()
1055
1087
  }).then(handleResponse));
1056
1088
  }
1057
- }, _callee5);
1089
+ }, _callee7);
1058
1090
  }));
1059
- return function getEdrCollectionForPosition(_x12, _x13, _x14, _x15, _x16, _x17, _x18) {
1060
- return _ref5.apply(this, arguments);
1091
+ return function getEdrCollectionForPosition(_x18, _x19, _x20, _x21, _x22, _x23, _x24) {
1092
+ return _ref7.apply(this, arguments);
1061
1093
  };
1062
1094
  }();
1063
1095
  /**
@@ -1066,10 +1098,10 @@ var getEdrCollectionForPosition = /*#__PURE__*/function () {
1066
1098
  * Returns a CoverageCollection with coverages for each grid point within the radius.
1067
1099
  */
1068
1100
  var getEdrCollectionForRadius = /*#__PURE__*/function () {
1069
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(collectionId, baseUrl, instanceId, centerCoordinates, radiusKm, parameters, datetime, verticalRange) {
1101
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(collectionId, baseUrl, instanceId, centerCoordinates, radiusKm, parameters, datetime, verticalRange) {
1070
1102
  var url;
1071
- return _regenerator().w(function (_context6) {
1072
- while (1) switch (_context6.n) {
1103
+ return _regenerator().w(function (_context8) {
1104
+ while (1) switch (_context8.n) {
1073
1105
  case 0:
1074
1106
  url = new URL(baseUrl + "/collections/" + collectionId + (instanceId ? "/instances/" + instanceId : '') + "/radius");
1075
1107
  url.searchParams.append('coords', "POINT(" + centerCoordinates[0] + " " + centerCoordinates[1] + ")");
@@ -1082,17 +1114,40 @@ var getEdrCollectionForRadius = /*#__PURE__*/function () {
1082
1114
  url.searchParams.append('z', verticalRange);
1083
1115
  }
1084
1116
  url.searchParams.append('f', 'CoverageJSON');
1085
- return _context6.a(2, fetch(url.toString(), {
1117
+ return _context8.a(2, fetch(url.toString(), {
1086
1118
  headers: getHeaders()
1087
1119
  }).then(handleResponse));
1088
1120
  }
1089
- }, _callee6);
1121
+ }, _callee8);
1090
1122
  }));
1091
- return function getEdrCollectionForRadius(_x19, _x20, _x21, _x22, _x23, _x24, _x25, _x26) {
1092
- return _ref6.apply(this, arguments);
1123
+ return function getEdrCollectionForRadius(_x25, _x26, _x27, _x28, _x29, _x30, _x31, _x32) {
1124
+ return _ref8.apply(this, arguments);
1093
1125
  };
1094
1126
  }();
1095
1127
 
1128
+ var soundingsQueryOptions = {
1129
+ getCollectionInstances: function getCollectionInstances$1(collectionId, url) {
1130
+ return queryOptions({
1131
+ queryKey: ['edr-soundings-instances', collectionId, url],
1132
+ queryFn: function () {
1133
+ var _queryFn = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
1134
+ return _regenerator().w(function (_context) {
1135
+ while (1) switch (_context.n) {
1136
+ case 0:
1137
+ return _context.a(2, getCollectionInstances(collectionId, url));
1138
+ }
1139
+ }, _callee);
1140
+ }));
1141
+ function queryFn() {
1142
+ return _queryFn.apply(this, arguments);
1143
+ }
1144
+ return queryFn;
1145
+ }(),
1146
+ refetchInterval: 5 * 60 * 1000
1147
+ });
1148
+ }
1149
+ };
1150
+
1096
1151
  var epsilon = 0.622; // Ratio of molecular weights of water vapour and dry air
1097
1152
  var e0 = 611.2; // Reference vapor pressure [Pa]
1098
1153
  var aConstant = 17.67;
@@ -1464,7 +1519,7 @@ var constructQueryParams = function constructQueryParams(collectionId, baseUrl,
1464
1519
  }
1465
1520
  // POSITION call
1466
1521
  return {
1467
- queryKey: ['edr-soundings-for-position', collectionId, location.join(), parameters.join(), datetime, verticalRange],
1522
+ queryKey: ['edr-soundings-for-position', collectionId, instanceId || '', location.join(), parameters.join(), datetime, verticalRange],
1468
1523
  queryFn: function () {
1469
1524
  var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
1470
1525
  var rawData, parsedData;
@@ -1610,28 +1665,12 @@ var useResolvedSourceSelections = function useResolvedSourceSelections(sources)
1610
1665
  var collectionId = _ref2.collectionId,
1611
1666
  url = _ref2.url,
1612
1667
  instanceId = _ref2.instanceId;
1613
- return {
1614
- queryKey: ['edr-soundings-instances', collectionId],
1615
- queryFn: function () {
1616
- var _queryFn3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
1617
- return _regenerator().w(function (_context3) {
1618
- while (1) switch (_context3.n) {
1619
- case 0:
1620
- return _context3.a(2, getCollectionInstances(collectionId, url));
1621
- }
1622
- }, _callee3);
1623
- }));
1624
- function queryFn() {
1625
- return _queryFn3.apply(this, arguments);
1626
- }
1627
- return queryFn;
1628
- }(),
1668
+ return Object.assign({}, soundingsQueryOptions.getCollectionInstances(collectionId, url), {
1629
1669
  enabled: referenceTimeUtils.isRelativeReferenceTime(instanceId),
1630
- refetchInterval: 5 * 60 * 1000,
1631
1670
  select: function select(data) {
1632
1671
  return data.instances;
1633
1672
  }
1634
- };
1673
+ });
1635
1674
  });
1636
1675
  }, [sources]);
1637
1676
  var instancesBySource = useQueries({
@@ -1669,36 +1708,48 @@ var useTimesteps = function useTimesteps(sourceSelections) {
1669
1708
  instanceId = _ref3.instanceId,
1670
1709
  url = _ref3.url;
1671
1710
  return {
1672
- queryKey: ['edr-soundings-instances', collectionId],
1711
+ queryKey: ['edr-soundings-instance', collectionId, instanceId || ''],
1673
1712
  queryFn: function () {
1674
- var _queryFn4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
1675
- var _data, data;
1676
- return _regenerator().w(function (_context4) {
1677
- while (1) switch (_context4.n) {
1713
+ var _queryFn3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
1714
+ var _instanceData$extent, instanceData, timeExtentValues, allInstancesData, collectionData;
1715
+ return _regenerator().w(function (_context3) {
1716
+ while (1) switch (_context3.n) {
1678
1717
  case 0:
1679
1718
  if (!(instanceId && instanceId !== '')) {
1680
- _context4.n = 2;
1719
+ _context3.n = 4;
1681
1720
  break;
1682
1721
  }
1683
- _context4.n = 1;
1684
- return getCollectionInstances(collectionId, url);
1722
+ _context3.n = 1;
1723
+ return getInstanceDetails(collectionId, instanceId, url);
1685
1724
  case 1:
1686
- _data = _context4.v;
1687
- return _context4.a(2, _data);
1725
+ instanceData = _context3.v;
1726
+ timeExtentValues = instanceData == null || (_instanceData$extent = instanceData.extent) == null || (_instanceData$extent = _instanceData$extent.temporal) == null ? void 0 : _instanceData$extent.values;
1727
+ if (timeExtentValues) {
1728
+ _context3.n = 3;
1729
+ break;
1730
+ }
1731
+ _context3.n = 2;
1732
+ return getCollectionInstances(collectionId, url);
1688
1733
  case 2:
1689
- _context4.n = 3;
1690
- return getCollectionDetails(collectionId, url);
1734
+ allInstancesData = _context3.v;
1735
+ return _context3.a(2, allInstancesData);
1691
1736
  case 3:
1692
- data = _context4.v;
1693
- return _context4.a(2, data);
1737
+ return _context3.a(2, instanceData);
1738
+ case 4:
1739
+ _context3.n = 5;
1740
+ return getCollectionDetails(collectionId, url);
1741
+ case 5:
1742
+ collectionData = _context3.v;
1743
+ return _context3.a(2, collectionData);
1694
1744
  }
1695
- }, _callee4);
1745
+ }, _callee3);
1696
1746
  }));
1697
1747
  function queryFn() {
1698
- return _queryFn4.apply(this, arguments);
1748
+ return _queryFn3.apply(this, arguments);
1699
1749
  }
1700
1750
  return queryFn;
1701
1751
  }(),
1752
+ enabled: !referenceTimeUtils.isRelativeReferenceTime(instanceId),
1702
1753
  select: function select(data) {
1703
1754
  if (data.instances !== undefined) {
1704
1755
  var instance = data.instances.find(function (instance) {
@@ -1755,21 +1806,21 @@ var useGetCollectionsInstances = function useGetCollectionsInstances(collections
1755
1806
  return {
1756
1807
  queryKey: ['edr-soundings-collection-details', id, url],
1757
1808
  queryFn: function () {
1758
- var _queryFn5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
1809
+ var _queryFn4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
1759
1810
  var data;
1760
- return _regenerator().w(function (_context5) {
1761
- while (1) switch (_context5.n) {
1811
+ return _regenerator().w(function (_context4) {
1812
+ while (1) switch (_context4.n) {
1762
1813
  case 0:
1763
- _context5.n = 1;
1814
+ _context4.n = 1;
1764
1815
  return getCollectionDetails(id, url);
1765
1816
  case 1:
1766
- data = _context5.v;
1767
- return _context5.a(2, data);
1817
+ data = _context4.v;
1818
+ return _context4.a(2, data);
1768
1819
  }
1769
- }, _callee5);
1820
+ }, _callee4);
1770
1821
  }));
1771
1822
  function queryFn() {
1772
- return _queryFn5.apply(this, arguments);
1823
+ return _queryFn4.apply(this, arguments);
1773
1824
  }
1774
1825
  return queryFn;
1775
1826
  }(),
@@ -1806,29 +1857,29 @@ var useGetCollectionsInstances = function useGetCollectionsInstances(collections
1806
1857
  return {
1807
1858
  queryKey: ['edr-soundings-instances', id, resultsCollection.data],
1808
1859
  queryFn: function () {
1809
- var _queryFn6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
1860
+ var _queryFn5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
1810
1861
  var data;
1811
- return _regenerator().w(function (_context6) {
1812
- while (1) switch (_context6.n) {
1862
+ return _regenerator().w(function (_context5) {
1863
+ while (1) switch (_context5.n) {
1813
1864
  case 0:
1814
1865
  if (!resultsCollection.data[index]) {
1815
- _context6.n = 2;
1866
+ _context5.n = 2;
1816
1867
  break;
1817
1868
  }
1818
- _context6.n = 1;
1869
+ _context5.n = 1;
1819
1870
  return getCollectionInstances(id, url);
1820
1871
  case 1:
1821
- data = _context6.v;
1822
- return _context6.a(2, data);
1872
+ data = _context5.v;
1873
+ return _context5.a(2, data);
1823
1874
  case 2:
1824
- return _context6.a(2, {
1875
+ return _context5.a(2, {
1825
1876
  instances: []
1826
1877
  });
1827
1878
  }
1828
- }, _callee6);
1879
+ }, _callee5);
1829
1880
  }));
1830
1881
  function queryFn() {
1831
- return _queryFn6.apply(this, arguments);
1882
+ return _queryFn5.apply(this, arguments);
1832
1883
  }
1833
1884
  return queryFn;
1834
1885
  }(),
@@ -1873,37 +1924,76 @@ var useGetCollectionsInstances = function useGetCollectionsInstances(collections
1873
1924
  data: dataWithCollectionInfo
1874
1925
  });
1875
1926
  };
1876
- var useGetCollectionLocations = function useGetCollectionLocations(collections, enabled) {
1927
+ var useGetLocations = function useGetLocations(collections, enabled) {
1928
+ var queryClient = useQueryClient();
1877
1929
  var edrQueries = useMemo(function () {
1878
1930
  return collections == null ? void 0 : collections.map(function (collection) {
1931
+ var _collection$instanceI;
1879
1932
  return {
1880
- queryKey: ['edr-locations', collection.id],
1933
+ queryKey: ['edr-locations', collection.id, collection.url, (_collection$instanceI = collection.instanceId) != null ? _collection$instanceI : ''],
1881
1934
  queryFn: function () {
1882
- var _queryFn7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
1883
- var locations;
1884
- return _regenerator().w(function (_context7) {
1885
- while (1) switch (_context7.n) {
1935
+ var _queryFn6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
1936
+ var resolvedInstanceId, instances, resolved, locationsExplicitlyUnsupported, _locations, locations;
1937
+ return _regenerator().w(function (_context6) {
1938
+ while (1) switch (_context6.p = _context6.n) {
1886
1939
  case 0:
1887
- _context7.n = 1;
1940
+ resolvedInstanceId = collection.instanceId;
1941
+ if (!(resolvedInstanceId && referenceTimeUtils.isRelativeReferenceTime(resolvedInstanceId))) {
1942
+ _context6.n = 4;
1943
+ break;
1944
+ }
1945
+ _context6.p = 1;
1946
+ _context6.n = 2;
1947
+ return queryClient.fetchQuery(soundingsQueryOptions.getCollectionInstances(collection.id, collection.url));
1948
+ case 2:
1949
+ instances = _context6.v;
1950
+ resolved = referenceTimeUtils.resolveReferenceTimeInstance(instances.instances, resolvedInstanceId); // Skip instance-level only when data_queries is present but explicitly excludes locations — if data_queries is absent, try instance-level anyway
1951
+ locationsExplicitlyUnsupported = (resolved == null ? void 0 : resolved.data_queries) !== undefined && !resolved.data_queries.locations;
1952
+ resolvedInstanceId = locationsExplicitlyUnsupported ? undefined : resolved == null ? void 0 : resolved.id;
1953
+ _context6.n = 4;
1954
+ break;
1955
+ case 3:
1956
+ _context6.p = 3;
1957
+ _context6.v;
1958
+ resolvedInstanceId = undefined;
1959
+ case 4:
1960
+ if (!resolvedInstanceId) {
1961
+ _context6.n = 8;
1962
+ break;
1963
+ }
1964
+ _context6.p = 5;
1965
+ _context6.n = 6;
1966
+ return getInstanceLocations(collection.id, resolvedInstanceId, collection.url);
1967
+ case 6:
1968
+ _locations = _context6.v;
1969
+ return _context6.a(2, Object.assign({}, _locations, {
1970
+ id: collection.id,
1971
+ name: collection.name
1972
+ }));
1973
+ case 7:
1974
+ _context6.p = 7;
1975
+ _context6.v;
1976
+ case 8:
1977
+ _context6.n = 9;
1888
1978
  return getCollectionLocations(collection.id, collection.url);
1889
- case 1:
1890
- locations = _context7.v;
1891
- return _context7.a(2, Object.assign({}, locations, {
1979
+ case 9:
1980
+ locations = _context6.v;
1981
+ return _context6.a(2, Object.assign({}, locations, {
1892
1982
  id: collection.id,
1893
1983
  name: collection.name
1894
1984
  }));
1895
1985
  }
1896
- }, _callee7);
1986
+ }, _callee6, null, [[5, 7], [1, 3]]);
1897
1987
  }));
1898
1988
  function queryFn() {
1899
- return _queryFn7.apply(this, arguments);
1989
+ return _queryFn6.apply(this, arguments);
1900
1990
  }
1901
1991
  return queryFn;
1902
1992
  }(),
1903
1993
  enabled: enabled
1904
1994
  };
1905
1995
  });
1906
- }, [collections, enabled]);
1996
+ }, [collections, enabled, queryClient]);
1907
1997
  return useQueries({
1908
1998
  queries: edrQueries,
1909
1999
  combine: function combine(results) {
@@ -1945,48 +2035,48 @@ var useCheckPositionQuerySupportBySource = function useCheckPositionQuerySupport
1945
2035
  return {
1946
2036
  queryKey: ['edr-position-support', collectionId, instanceId || ''],
1947
2037
  queryFn: function () {
1948
- var _queryFn8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
2038
+ var _queryFn7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
1949
2039
  var _details$data_queries, _instance$data_querie, instances, instance, details;
1950
- return _regenerator().w(function (_context8) {
1951
- while (1) switch (_context8.p = _context8.n) {
2040
+ return _regenerator().w(function (_context7) {
2041
+ while (1) switch (_context7.p = _context7.n) {
1952
2042
  case 0:
1953
- _context8.p = 0;
2043
+ _context7.p = 0;
1954
2044
  if (!instanceId) {
1955
- _context8.n = 2;
2045
+ _context7.n = 2;
1956
2046
  break;
1957
2047
  }
1958
- _context8.n = 1;
2048
+ _context7.n = 1;
1959
2049
  return getCollectionInstances(collectionId, url);
1960
2050
  case 1:
1961
- instances = _context8.v;
2051
+ instances = _context7.v;
1962
2052
  instance = instances.instances.find(function (i) {
1963
2053
  return i.id === instanceId;
1964
2054
  });
1965
- return _context8.a(2, {
2055
+ return _context7.a(2, {
1966
2056
  collectionId: collectionId,
1967
2057
  supported: !!(instance != null && (_instance$data_querie = instance.data_queries) != null && _instance$data_querie.position)
1968
2058
  });
1969
2059
  case 2:
1970
- _context8.n = 3;
2060
+ _context7.n = 3;
1971
2061
  return getCollectionDetails(collectionId, url);
1972
2062
  case 3:
1973
- details = _context8.v;
1974
- return _context8.a(2, {
2063
+ details = _context7.v;
2064
+ return _context7.a(2, {
1975
2065
  collectionId: collectionId,
1976
2066
  supported: !!(details != null && (_details$data_queries = details.data_queries) != null && _details$data_queries.position)
1977
2067
  });
1978
2068
  case 4:
1979
- _context8.p = 4;
1980
- _context8.v;
1981
- return _context8.a(2, {
2069
+ _context7.p = 4;
2070
+ _context7.v;
2071
+ return _context7.a(2, {
1982
2072
  collectionId: collectionId,
1983
2073
  supported: false
1984
2074
  });
1985
2075
  }
1986
- }, _callee8, null, [[0, 4]]);
2076
+ }, _callee7, null, [[0, 4]]);
1987
2077
  }));
1988
2078
  function queryFn() {
1989
- return _queryFn8.apply(this, arguments);
2079
+ return _queryFn7.apply(this, arguments);
1990
2080
  }
1991
2081
  return queryFn;
1992
2082
  }(),
@@ -2035,48 +2125,48 @@ var useCheckRadiusQuerySupportBySource = function useCheckRadiusQuerySupportBySo
2035
2125
  return {
2036
2126
  queryKey: ['edr-radius-support', collectionId, instanceId || ''],
2037
2127
  queryFn: function () {
2038
- var _queryFn9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
2128
+ var _queryFn8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
2039
2129
  var _details$data_queries2, _instance$data_querie2, instances, instance, details;
2040
- return _regenerator().w(function (_context9) {
2041
- while (1) switch (_context9.p = _context9.n) {
2130
+ return _regenerator().w(function (_context8) {
2131
+ while (1) switch (_context8.p = _context8.n) {
2042
2132
  case 0:
2043
- _context9.p = 0;
2133
+ _context8.p = 0;
2044
2134
  if (!instanceId) {
2045
- _context9.n = 2;
2135
+ _context8.n = 2;
2046
2136
  break;
2047
2137
  }
2048
- _context9.n = 1;
2138
+ _context8.n = 1;
2049
2139
  return getCollectionInstances(collectionId, url);
2050
2140
  case 1:
2051
- instances = _context9.v;
2141
+ instances = _context8.v;
2052
2142
  instance = instances.instances.find(function (i) {
2053
2143
  return i.id === instanceId;
2054
2144
  });
2055
- return _context9.a(2, {
2145
+ return _context8.a(2, {
2056
2146
  collectionId: collectionId,
2057
2147
  supported: !!(instance != null && (_instance$data_querie2 = instance.data_queries) != null && _instance$data_querie2.radius)
2058
2148
  });
2059
2149
  case 2:
2060
- _context9.n = 3;
2150
+ _context8.n = 3;
2061
2151
  return getCollectionDetails(collectionId, url);
2062
2152
  case 3:
2063
- details = _context9.v;
2064
- return _context9.a(2, {
2153
+ details = _context8.v;
2154
+ return _context8.a(2, {
2065
2155
  collectionId: collectionId,
2066
2156
  supported: !!(details != null && (_details$data_queries2 = details.data_queries) != null && _details$data_queries2.radius)
2067
2157
  });
2068
2158
  case 4:
2069
- _context9.p = 4;
2070
- _context9.v;
2071
- return _context9.a(2, {
2159
+ _context8.p = 4;
2160
+ _context8.v;
2161
+ return _context8.a(2, {
2072
2162
  collectionId: collectionId,
2073
2163
  supported: false
2074
2164
  });
2075
2165
  }
2076
- }, _callee9, null, [[0, 4]]);
2166
+ }, _callee8, null, [[0, 4]]);
2077
2167
  }));
2078
2168
  function queryFn() {
2079
- return _queryFn9.apply(this, arguments);
2169
+ return _queryFn8.apply(this, arguments);
2080
2170
  }
2081
2171
  return queryFn;
2082
2172
  }(),
@@ -2133,20 +2223,20 @@ var useGridPointsFromRadius = function useGridPointsFromRadius(sources, radiusSu
2133
2223
  return {
2134
2224
  queryKey: ['edr-grid-points-disabled', collectionId],
2135
2225
  queryFn: function () {
2136
- var _queryFn0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
2137
- return _regenerator().w(function (_context0) {
2138
- while (1) switch (_context0.n) {
2226
+ var _queryFn9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
2227
+ return _regenerator().w(function (_context9) {
2228
+ while (1) switch (_context9.n) {
2139
2229
  case 0:
2140
- return _context0.a(2, {
2230
+ return _context9.a(2, {
2141
2231
  sourceId: collectionId,
2142
2232
  gridPoint: undefined,
2143
2233
  allGridPoints: []
2144
2234
  });
2145
2235
  }
2146
- }, _callee0);
2236
+ }, _callee9);
2147
2237
  }));
2148
2238
  function queryFn() {
2149
- return _queryFn0.apply(this, arguments);
2239
+ return _queryFn9.apply(this, arguments);
2150
2240
  }
2151
2241
  return queryFn;
2152
2242
  }(),
@@ -2171,22 +2261,22 @@ var useGridPointsFromRadius = function useGridPointsFromRadius(sources, radiusSu
2171
2261
  return {
2172
2262
  queryKey: ['edr-grid-points-radius', collectionId, instanceId || '', centerCoordinates.join(','), radiusKm.toString(), datetime],
2173
2263
  queryFn: function () {
2174
- var _queryFn1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
2264
+ var _queryFn0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
2175
2265
  var minimalParameters, minimalVerticalRange, rawData, allGridPoints, nearestPoint, minSquaredDistance;
2176
- return _regenerator().w(function (_context1) {
2177
- while (1) switch (_context1.p = _context1.n) {
2266
+ return _regenerator().w(function (_context0) {
2267
+ while (1) switch (_context0.p = _context0.n) {
2178
2268
  case 0:
2179
2269
  if (supportsRadius) {
2180
- _context1.n = 1;
2270
+ _context0.n = 1;
2181
2271
  break;
2182
2272
  }
2183
- return _context1.a(2, {
2273
+ return _context0.a(2, {
2184
2274
  sourceId: collectionId,
2185
2275
  gridPoint: undefined,
2186
2276
  allGridPoints: []
2187
2277
  });
2188
2278
  case 1:
2189
- _context1.p = 1;
2279
+ _context0.p = 1;
2190
2280
  // Optimization: Only request a single parameter to minimize data transfer
2191
2281
  // We only need the grid point coordinates, not the actual sounding data
2192
2282
  minimalParameters = parameters.slice(0, 1); // Just one parameter
@@ -2194,10 +2284,10 @@ var useGridPointsFromRadius = function useGridPointsFromRadius(sources, radiusSu
2194
2284
  // (Don't hardcode '1000' as that only works for pressure-level sources,
2195
2285
  // not for hybrid/model-level sources which use levels 1-65)
2196
2286
  minimalVerticalRange = '';
2197
- _context1.n = 2;
2287
+ _context0.n = 2;
2198
2288
  return getEdrCollectionForRadius(collectionId, url, instanceId, centerCoordinates, radiusKm, minimalParameters, datetime, minimalVerticalRange);
2199
2289
  case 2:
2200
- rawData = _context1.v;
2290
+ rawData = _context0.v;
2201
2291
  allGridPoints = extractGridPointsFromCoverage(rawData); // Find the nearest grid point to the center coordinates
2202
2292
  minSquaredDistance = Infinity;
2203
2293
  allGridPoints.forEach(function (point) {
@@ -2212,24 +2302,24 @@ var useGridPointsFromRadius = function useGridPointsFromRadius(sources, radiusSu
2212
2302
  nearestPoint = point;
2213
2303
  }
2214
2304
  });
2215
- return _context1.a(2, {
2305
+ return _context0.a(2, {
2216
2306
  sourceId: collectionId,
2217
2307
  gridPoint: nearestPoint,
2218
2308
  allGridPoints: allGridPoints
2219
2309
  });
2220
2310
  case 3:
2221
- _context1.p = 3;
2222
- _context1.v;
2223
- return _context1.a(2, {
2311
+ _context0.p = 3;
2312
+ _context0.v;
2313
+ return _context0.a(2, {
2224
2314
  sourceId: collectionId,
2225
2315
  gridPoint: undefined,
2226
2316
  allGridPoints: []
2227
2317
  });
2228
2318
  }
2229
- }, _callee1, null, [[1, 3]]);
2319
+ }, _callee0, null, [[1, 3]]);
2230
2320
  }));
2231
2321
  function queryFn() {
2232
- return _queryFn1.apply(this, arguments);
2322
+ return _queryFn0.apply(this, arguments);
2233
2323
  }
2234
2324
  return queryFn;
2235
2325
  }(),
@@ -3007,12 +3097,13 @@ var useSoundingsTranslation = function useSoundingsTranslation() {
3007
3097
  };
3008
3098
 
3009
3099
  var SoundingsMarkersSwitch = function SoundingsMarkersSwitch(_ref) {
3100
+ var _sx;
3010
3101
  var shouldHideMarkers = _ref.shouldHideMarkers,
3011
3102
  toggleMarkers = _ref.toggleMarkers;
3012
3103
  var _useSoundingsTranslat = useSoundingsTranslation(),
3013
3104
  t = _useSoundingsTranslat.t;
3014
3105
  return jsxs(Box, {
3015
- sx: {
3106
+ sx: (_sx = {
3016
3107
  display: 'flex',
3017
3108
  flexWrap: 'wrap',
3018
3109
  alignItems: 'flex-start',
@@ -3028,14 +3119,13 @@ var SoundingsMarkersSwitch = function SoundingsMarkersSwitch(_ref) {
3028
3119
  },
3029
3120
  '.markers-label': {
3030
3121
  display: 'none'
3031
- },
3032
- '@container soundings-container (min-width: 560px)': {
3033
- minWidth: '146px',
3034
- '.markers-label, .switch-button label': {
3035
- display: 'initial'
3036
- }
3037
3122
  }
3038
- },
3123
+ }, _sx["@container " + SOUNDINGS_CONTAINER_NAME + " (min-width: " + SOUNDINGS_CONTAINER_BREAKPOINT_PX + ")"] = {
3124
+ minWidth: '146px',
3125
+ '.markers-label, .switch-button label': {
3126
+ display: 'initial'
3127
+ }
3128
+ }, _sx),
3039
3129
  children: [jsx(Typography, {
3040
3130
  className: "markers-label",
3041
3131
  sx: {
@@ -3060,6 +3150,7 @@ var SoundingsMarkersSwitch = function SoundingsMarkersSwitch(_ref) {
3060
3150
  });
3061
3151
  };
3062
3152
 
3153
+ var _styled;
3063
3154
  var _excluded = ["icon", "shortText", "longText"];
3064
3155
  var SoundingsTopRowButtonUnstyled = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
3065
3156
  var icon = _ref.icon,
@@ -3078,30 +3169,27 @@ var SoundingsTopRowButtonUnstyled = /*#__PURE__*/React.forwardRef(function (_ref
3078
3169
  })]
3079
3170
  }));
3080
3171
  });
3081
- var SoundingsTopRowButton = styled(SoundingsTopRowButtonUnstyled)({
3082
- height: '10px !important',
3083
- '@container soundings-container (width < 560px)': {
3084
- maxWidth: '90px',
3085
- '& .longText': {
3086
- display: 'none'
3087
- },
3088
- '& svg': {
3089
- marginRight: '0 !important'
3090
- }
3091
- },
3092
- '@container soundings-container (width >= 560px)': {
3093
- width: '130px',
3094
- '& .shortText': {
3095
- display: 'none'
3096
- }
3172
+ var SoundingsTopRowButton = styled(SoundingsTopRowButtonUnstyled)((_styled = {
3173
+ height: '10px !important'
3174
+ }, _styled["@container " + SOUNDINGS_CONTAINER_NAME + " (width < " + SOUNDINGS_CONTAINER_BREAKPOINT_PX + ")"] = {
3175
+ maxWidth: '90px',
3176
+ '& .longText': {
3177
+ display: 'none'
3097
3178
  },
3098
- '& span': {
3099
- fontSize: '9pt',
3100
- whiteSpace: 'nowrap',
3101
- textOverflow: 'ellipsis',
3102
- overflow: 'hidden'
3179
+ '& svg': {
3180
+ marginRight: '0 !important'
3103
3181
  }
3104
- });
3182
+ }, _styled["@container " + SOUNDINGS_CONTAINER_NAME + " (min-width: " + SOUNDINGS_CONTAINER_BREAKPOINT_PX + ")"] = {
3183
+ width: '130px',
3184
+ '& .shortText': {
3185
+ display: 'none'
3186
+ }
3187
+ }, _styled['& span'] = {
3188
+ fontSize: '9pt',
3189
+ whiteSpace: 'nowrap',
3190
+ textOverflow: 'ellipsis',
3191
+ overflow: 'hidden'
3192
+ }, _styled));
3105
3193
 
3106
3194
  var MenuOptions;
3107
3195
  (function (MenuOptions) {
@@ -3111,6 +3199,7 @@ var MenuOptions;
3111
3199
  MenuOptions["profileData"] = "profileData";
3112
3200
  })(MenuOptions || (MenuOptions = {}));
3113
3201
  var SoundingsMenuBar = function SoundingsMenuBar(_ref) {
3202
+ var _sx;
3114
3203
  var handleClick = _ref.handleClick,
3115
3204
  isOpen = _ref.isOpen,
3116
3205
  _ref$selectedSourcesA = _ref.selectedSourcesAmount,
@@ -3122,9 +3211,12 @@ var SoundingsMenuBar = function SoundingsMenuBar(_ref) {
3122
3211
  return jsxs(Stack, {
3123
3212
  direction: "row",
3124
3213
  spacing: 1,
3125
- sx: {
3126
- marginBottom: '4px'
3127
- },
3214
+ sx: (_sx = {
3215
+ marginBottom: '4px',
3216
+ overflowX: 'auto'
3217
+ }, _sx["@container " + SOUNDINGS_CONTAINER_NAME + " (min-width: " + SOUNDINGS_CONTAINER_BREAKPOINT_PX + ")"] = {
3218
+ overflowX: 'initial'
3219
+ }, _sx),
3128
3220
  children: [jsx(SoundingsTopRowButton, {
3129
3221
  "data-testid": "soundingsManagerButton",
3130
3222
  icon: jsx(Layers, {}),
@@ -3903,13 +3995,13 @@ var getLegendItem = function getLegendItem(color, text) {
3903
3995
  var HodographLegend = function HodographLegend() {
3904
3996
  return jsxs(Stack, {
3905
3997
  direction: "column",
3906
- useFlexGap: true,
3907
3998
  sx: {
3908
3999
  justifyContent: 'center',
3909
4000
  flexWrap: 'wrap',
3910
4001
  paddingLeft: 2,
3911
4002
  paddingTop: 0.5
3912
4003
  },
4004
+ useFlexGap: true,
3913
4005
  children: [getLegendItem(HODOGRAPH_COLORS[0], '0 - 1 km'), getLegendItem(HODOGRAPH_COLORS[1], '1 - 3 km'), getLegendItem(HODOGRAPH_COLORS[2], '3 - 6 km'), getLegendItem(HODOGRAPH_COLORS[3], '6 - 9 km'), getLegendItem(HODOGRAPH_COLORS[4], '9 - 19 km')]
3914
4006
  });
3915
4007
  };
@@ -4712,6 +4804,8 @@ var Soundings = function Soundings(_ref) {
4712
4804
  showTooltip = _ref$showTooltip === void 0 ? true : _ref$showTooltip,
4713
4805
  _ref$diagramType = _ref.diagramType,
4714
4806
  diagramType = _ref$diagramType === void 0 ? 'SKEWT' : _ref$diagramType;
4807
+ var instanceId = useId().replace(/:/g, '_');
4808
+ var scopedGraphId = d3GraphId + "-" + instanceId;
4715
4809
  var svgRef = useRef(null);
4716
4810
  var canvasRef = useRef(null);
4717
4811
  var pressureRef = useRef(null);
@@ -4741,7 +4835,7 @@ var Soundings = function Soundings(_ref) {
4741
4835
  height: height,
4742
4836
  margin: margin,
4743
4837
  diagramType: diagramType,
4744
- d3GraphId: d3GraphId
4838
+ d3GraphId: scopedGraphId
4745
4839
  });
4746
4840
  var svgRectangle = svgRef.current.getBoundingClientRect();
4747
4841
  svgRectRef.current = svgRectangle;
@@ -4773,7 +4867,7 @@ var Soundings = function Soundings(_ref) {
4773
4867
  minPressure: minPressure,
4774
4868
  maxPressure: maxPressure,
4775
4869
  svg: svg,
4776
- d3GraphId: d3GraphId
4870
+ d3GraphId: scopedGraphId
4777
4871
  });
4778
4872
  data.forEach(function (features, index) {
4779
4873
  var color = SOUNDING_COLORS[index] || SOUNDING_COLORS[0];
@@ -4815,7 +4909,7 @@ var Soundings = function Soundings(_ref) {
4815
4909
  return function () {
4816
4910
  d3.select(svgRefCur).selectAll('*').remove();
4817
4911
  };
4818
- }, [data, diagramType, width, height, d3GraphId, margin]);
4912
+ }, [data, diagramType, width, height, scopedGraphId, margin]);
4819
4913
  useEffect(function () {
4820
4914
  var _svgRectRef$current;
4821
4915
  if (!showTooltip || !svgRef.current) {
@@ -5832,10 +5926,10 @@ var SoundingsProfileDataTable = function SoundingsProfileDataTable(_ref2) {
5832
5926
  py: 4
5833
5927
  },
5834
5928
  children: jsx(Typography, {
5835
- variant: "body2",
5836
5929
  sx: {
5837
5930
  color: 'text.secondary'
5838
5931
  },
5932
+ variant: "body2",
5839
5933
  children: t('no-sounding-data-available')
5840
5934
  })
5841
5935
  }) : jsx(Box, {
@@ -5857,7 +5951,9 @@ var SoundingsProfileDataTable = function SoundingsProfileDataTable(_ref2) {
5857
5951
  },
5858
5952
  style: {
5859
5953
  height: '100%',
5860
- width: '100%'
5954
+ width: '100%',
5955
+ minWidth: tableMinWidth,
5956
+ overflowX: 'hidden'
5861
5957
  }
5862
5958
  })
5863
5959
  })]
@@ -6185,6 +6281,9 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6185
6281
  var locationSelections = useSelector(function (state) {
6186
6282
  return getLocationSelections(state, viewId);
6187
6283
  }, shallowEqual);
6284
+ var soundingsCollections = useSelector(function (state) {
6285
+ return getSoundingsCollections(state);
6286
+ });
6188
6287
  var diagramType = useSelector(function (state) {
6189
6288
  return getDiagramType(state, viewId);
6190
6289
  });
@@ -6197,6 +6296,9 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6197
6296
  var selectedMapIds = useSelector(function (state) {
6198
6297
  return genericSelectors.getLinkedTargetIds(state, viewId);
6199
6298
  }, shallowEqual);
6299
+ var ownedFeatureLayerIds = useSelector(function (state) {
6300
+ return genericSelectors.selectFeatureSyncLayerIdsForPanel(state, viewId);
6301
+ }, shallowEqual);
6200
6302
  var linkedPanelIdsByMapId = useSelector(function (state) {
6201
6303
  return Object.fromEntries(selectedMapIds.map(function (mapId) {
6202
6304
  return [mapId, genericSelectors.selectLinkedPanelIdsForMap(state, mapId)];
@@ -6243,23 +6345,23 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6243
6345
  // Ref for reading selectedMapPin in effects without causing dependency loops
6244
6346
  var selectedMapPinRef = React.useRef(selectedMapPin);
6245
6347
  selectedMapPinRef.current = selectedMapPin;
6246
- // Get map bbox and SRS for zoom-dependent overlap prevention
6247
- var mapBbox = useSelector(function (state) {
6248
- return mapSelectors.getBbox(state, firstLinkedMapId);
6249
- }, shallowEqual);
6250
- var mapSrs = useSelector(function (state) {
6251
- return mapSelectors.getSrs(state, firstLinkedMapId);
6252
- });
6253
6348
  var collectionsRef = React.useRef(undefined);
6254
6349
  var collections = useMemo(function () {
6350
+ // Only use instanceId for location fetching when the preset configures it, so collection-level sources (e.g. harmonie) are not affected
6351
+ var presetMap = new Map(soundingsCollections.map(function (collection) {
6352
+ return [collection.id, collection];
6353
+ }));
6255
6354
  var newCollections = sourceSelections.map(function (_ref2) {
6355
+ var _presetMap$get;
6256
6356
  var collectionId = _ref2.collectionId,
6257
6357
  url = _ref2.url,
6258
- name = _ref2.name;
6358
+ name = _ref2.name,
6359
+ instanceId = _ref2.instanceId;
6259
6360
  return {
6260
6361
  id: collectionId,
6261
6362
  url: url,
6262
- name: name || collectionId
6363
+ name: name || collectionId,
6364
+ instanceId: ((_presetMap$get = presetMap.get(collectionId)) == null ? void 0 : _presetMap$get.instanceId) !== undefined ? instanceId : undefined
6263
6365
  };
6264
6366
  });
6265
6367
  if (isEqual(newCollections, collectionsRef.current)) {
@@ -6267,9 +6369,9 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6267
6369
  }
6268
6370
  collectionsRef.current = newCollections;
6269
6371
  return newCollections;
6270
- }, [sourceSelections]);
6271
- var _useGetCollectionLoca = useGetCollectionLocations(collections, true),
6272
- rawLocationData = _useGetCollectionLoca.data;
6372
+ }, [sourceSelections, soundingsCollections]);
6373
+ var _useGetLocations = useGetLocations(collections, true),
6374
+ rawLocationData = _useGetLocations.data;
6273
6375
  var _useCheckPositionQuer = useCheckPositionQuerySupportBySource(resolvedSourceSelections),
6274
6376
  positionQuerySupportBySource = _useCheckPositionQuer.data;
6275
6377
  var _useCheckRadiusQueryS = useCheckRadiusQuerySupportBySource(resolvedSourceSelections),
@@ -6290,10 +6392,11 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6290
6392
  sourceSelections.forEach(function (source) {
6291
6393
  var selection = locationSelections == null ? void 0 : locationSelections[source.collectionId];
6292
6394
  if (typeof selection === 'string') {
6395
+ var _sourceLocations$feat;
6293
6396
  var sourceLocations = locationData == null ? void 0 : locationData.find(function (service) {
6294
6397
  return service.id === source.collectionId;
6295
6398
  });
6296
- var feature = sourceLocations == null ? void 0 : sourceLocations.features.find(function (feature) {
6399
+ var feature = sourceLocations == null || (_sourceLocations$feat = sourceLocations.features) == null ? void 0 : _sourceLocations$feat.find(function (feature) {
6297
6400
  return feature.id === selection;
6298
6401
  });
6299
6402
  if ((feature == null ? void 0 : feature.geometry.type) === 'Point') {
@@ -6308,6 +6411,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6308
6411
  var sourceLocationNames = useMemo(function () {
6309
6412
  var result = {};
6310
6413
  sourceSelections.forEach(function (source) {
6414
+ var _sourceLocations$feat2;
6311
6415
  var selection = locationSelections == null ? void 0 : locationSelections[source.collectionId];
6312
6416
  if (typeof selection !== 'string') {
6313
6417
  return;
@@ -6315,7 +6419,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6315
6419
  var sourceLocations = locationData == null ? void 0 : locationData.find(function (service) {
6316
6420
  return service.id === source.collectionId;
6317
6421
  });
6318
- var feature = sourceLocations == null ? void 0 : sourceLocations.features.find(function (feature) {
6422
+ var feature = sourceLocations == null || (_sourceLocations$feat2 = sourceLocations.features) == null ? void 0 : _sourceLocations$feat2.find(function (feature) {
6319
6423
  return feature.id === selection;
6320
6424
  });
6321
6425
  var name = feature == null ? void 0 : feature.properties.name;
@@ -6369,7 +6473,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6369
6473
  var locationFeatures = (locationData || []).flatMap(function (_ref3) {
6370
6474
  var serviceId = _ref3.id,
6371
6475
  features = _ref3.features;
6372
- return features.map(function (feature) {
6476
+ return (features != null ? features : []).map(function (feature) {
6373
6477
  // Check if this feature is highlighted by its source (for sources without position support)
6374
6478
  var isHighlightedBySource = highlightedFeaturesBySource[serviceId] === feature.id;
6375
6479
  // Get the source index to determine color (same color as sounding diagram)
@@ -6485,54 +6589,20 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6485
6589
  });
6486
6590
  // Small fixed offset for markers sharing same grid position (~200m)
6487
6591
  var SOURCE_OVERLAP_OFFSET_DEG = 0.002;
6488
- // Calculate zoom-dependent minimum separation from clicked marker
6489
- // Handle different map projections for bbox interpretation
6490
- var MARKER_DIAMETER_PIXELS = 5; // Small separation - only push when very close to clicked marker
6491
- var ASSUMED_MAP_WIDTH_PIXELS = 800;
6492
- var MIN_CLICKED_SEPARATION_DEG = 0.005; // Minimum ~500m
6493
- var minClickedSeparationDeg = MIN_CLICKED_SEPARATION_DEG;
6494
- if ((mapBbox == null ? void 0 : mapBbox.right) != null && (mapBbox == null ? void 0 : mapBbox.left) != null) {
6495
- var bboxExtent = mapBbox.right - mapBbox.left;
6496
- var extentDeg;
6497
- // Convert bbox extent to degrees based on map projection
6498
- if (mapSrs === 'EPSG:4326') {
6499
- // Geographic projection - bbox already in degrees
6500
- extentDeg = bboxExtent;
6501
- } else if (mapSrs === 'EPSG:3857') {
6502
- // Web Mercator - convert meters to degrees
6503
- var WEB_MERCATOR_MAX = 20037508.34; // Half of Earth's circumference in meters
6504
- extentDeg = bboxExtent * 180 / WEB_MERCATOR_MAX;
6505
- } else if (Math.abs(bboxExtent) > 360) {
6506
- // Other projections: use heuristic based on magnitude
6507
- // If extent > 360, assume it's in meters/similar units
6508
- // Likely meters - use Web Mercator conversion as approximation
6509
- var _WEB_MERCATOR_MAX = 20037508.34;
6510
- extentDeg = bboxExtent * 180 / _WEB_MERCATOR_MAX;
6511
- } else {
6512
- // Likely already in degrees or degree-like units
6513
- extentDeg = bboxExtent;
6514
- }
6515
- minClickedSeparationDeg = Math.max(MIN_CLICKED_SEPARATION_DEG, extentDeg / ASSUMED_MAP_WIDTH_PIXELS * MARKER_DIAMETER_PIXELS);
6516
- }
6517
- var clickedLon = targetLocation[0],
6518
- clickedLat = targetLocation[1];
6519
- // Place markers at their true geographic positions with two adjustments:
6520
- // 1. Offset if multiple sources share the same grid point
6521
- // 2. Push away from clicked marker if too close (zoom-dependent)
6592
+ // Place markers at their true geographic positions.
6593
+ // The only adjustment is a small fixed offset when multiple sources share the same grid point.
6522
6594
  return gridPoints.map(function (item) {
6523
6595
  var source = item.source,
6524
6596
  sourceIndex = item.sourceIndex,
6525
6597
  gridPoint = item.gridPoint;
6526
6598
  var baseLon = gridPoint[0],
6527
6599
  baseLat = gridPoint[1];
6528
- // Step 1: Handle source overlap (multiple sources at same grid position)
6529
6600
  var key = baseLon.toFixed(6) + "," + baseLat.toFixed(6);
6530
6601
  var group = positionGroups.get(key) || [];
6531
6602
  var lon = baseLon;
6532
6603
  var lat = baseLat;
6533
6604
  if (group.length > 1) {
6534
6605
  // Multiple sources share this grid point - offset in circle around it
6535
- // Direction is based on index (arbitrary but consistent)
6536
6606
  var indexInGroup = group.findIndex(function (gr) {
6537
6607
  return gr.sourceIndex === sourceIndex;
6538
6608
  });
@@ -6540,25 +6610,6 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6540
6610
  lon = baseLon + SOURCE_OVERLAP_OFFSET_DEG * Math.cos(offsetAngle);
6541
6611
  lat = baseLat + SOURCE_OVERLAP_OFFSET_DEG * Math.sin(offsetAngle);
6542
6612
  }
6543
- // Step 2: Check overlap with clicked marker
6544
- // Account for longitude convergence at higher latitudes (1° lon = cos(lat) * 1° lat in distance)
6545
- var meanLat = (lat + clickedLat) / 2;
6546
- var cosLat = Math.cos(meanLat * Math.PI / 180);
6547
- var deltaLon = lon - clickedLon;
6548
- var deltaLat = lat - clickedLat;
6549
- // Scale longitude difference by cos(lat) for accurate distance
6550
- var scaledDeltaLon = deltaLon * cosLat;
6551
- var distanceToClicked = Math.sqrt(scaledDeltaLon * scaledDeltaLon + deltaLat * deltaLat);
6552
- if (distanceToClicked < minClickedSeparationDeg) {
6553
- // Too close to clicked marker - push outward preserving direction
6554
- // Direction is from clicked point to marker's current position (in scaled coordinates)
6555
- var directionAngle = distanceToClicked > 0.0001 ? Math.atan2(deltaLat, scaledDeltaLon) :
6556
- // If exactly on clicked point, use direction to original grid point
6557
- Math.atan2(baseLat - clickedLat, (baseLon - clickedLon) * cosLat);
6558
- // When applying offset, divide lon component by cos(lat) to get correct degree offset
6559
- lon = clickedLon + minClickedSeparationDeg * Math.cos(directionAngle) / cosLat;
6560
- lat = clickedLat + minClickedSeparationDeg * Math.sin(directionAngle);
6561
- }
6562
6613
  return {
6563
6614
  type: 'Feature',
6564
6615
  geometry: {
@@ -6575,7 +6626,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6575
6626
  }
6576
6627
  };
6577
6628
  });
6578
- }, [isFreePositionClick, targetLocation, gridPointData, sourceSelections, shouldHideLocationMarkers, mapBbox, mapSrs]);
6629
+ }, [isFreePositionClick, targetLocation, gridPointData, sourceSelections, shouldHideLocationMarkers]);
6579
6630
  // Combine location features with grid point features for dispatch to map
6580
6631
  var combinedGeoJson = useMemo(function () {
6581
6632
  if (gridPointFeatures.length === 0) {
@@ -6619,7 +6670,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6619
6670
  var allNearestFeatures = [];
6620
6671
  sourceSelections.forEach(function (source) {
6621
6672
  if (source.collectionId && targetLocation) {
6622
- var _sourceData$features, _positionQuerySupport;
6673
+ var _sourceData$features, _positionQuerySupport, _radiusQuerySupportBy, _gridPointData$source;
6623
6674
  // Get features owned by this source
6624
6675
  var sourceData = locationData == null ? void 0 : locationData.find(function (service) {
6625
6676
  return service.id === source.collectionId;
@@ -6638,17 +6689,29 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6638
6689
  // Detect if user clicked directly on a location marker owned by this source
6639
6690
  // A direct click means selectedFeature has an id that matches a feature owned by this source
6640
6691
  var isDirectClickOnOwnedMarker = !!(currentSelectedFeature != null && currentSelectedFeature.id) && (nearestOwnedFeature == null ? void 0 : nearestOwnedFeature.id) === (currentSelectedFeature == null ? void 0 : currentSelectedFeature.id);
6692
+ // When clicking a free position, snap to the nearest grid point from the radius query
6693
+ // so the sounding data comes from an actual model grid point rather than an arbitrary coordinate.
6694
+ var supportsRadius = (_radiusQuerySupportBy = radiusQuerySupportBySource[source.collectionId]) != null ? _radiusQuerySupportBy : false;
6695
+ var isGridPointMarkerClick = typeof (currentMapPin == null ? void 0 : currentMapPin.id) === 'string' && currentMapPin.id.startsWith('grid-point-');
6696
+ var isLocalFreePositionClick = !(currentSelectedFeature != null && currentSelectedFeature.id) || isGridPointMarkerClick;
6697
+ var gridPoint = isLocalFreePositionClick && supportsRadius ? gridPointData == null || (_gridPointData$source = gridPointData[source.collectionId]) == null ? void 0 : _gridPointData$source.gridPoint : undefined;
6698
+ var radiusPending = isLocalFreePositionClick && supportsRadius && !(gridPointData != null && gridPointData[source.collectionId]);
6641
6699
  // Determine the location to use:
6642
6700
  // 1. If user clicked directly on a marker owned by this source: use that marker's ID (location query)
6643
- // 2. If position query is supported AND not a direct click: use exact clicked coordinates (position query)
6701
+ // 2. If position query is supported AND not a direct click: use nearest grid point coordinates
6702
+ // if available (from radius query), otherwise fall back to exact clicked coordinates
6644
6703
  // 3. If position query is NOT supported: fall back to nearest location marker (location query)
6645
6704
  var newLocation = locationSelectionsRef.current[source.collectionId];
6646
6705
  if (isDirectClickOnOwnedMarker && nearestOwnedFeature) {
6647
6706
  // Direct click on marker - use location query with marker ID
6648
6707
  newLocation = nearestOwnedFeature.id;
6649
6708
  } else if (supportsPosition && targetLocation) {
6650
- // Use position query with exact coordinates
6651
- newLocation = targetLocation;
6709
+ if (radiusPending) {
6710
+ // Radius query in flight — defer until gridPointData arrives
6711
+ return;
6712
+ }
6713
+ // Snap to nearest grid point when available, otherwise use exact clicked coordinates
6714
+ newLocation = gridPoint != null ? gridPoint : targetLocation;
6652
6715
  } else if (nearestOwnedFeature) {
6653
6716
  // Fall back to location query with nearest marker
6654
6717
  newLocation = nearestOwnedFeature.id;
@@ -6689,7 +6752,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6689
6752
  isProcessingLocationUpdateRef.current = false;
6690
6753
  }, 0);
6691
6754
  // Note: selectedFeature and selectedMapPin are read from refs to avoid dependency cycles
6692
- }, [dispatch, locationData, positionQuerySupportBySource, targetLocation, sourceSelections, viewId, updateHighlightedFeaturesBySource]);
6755
+ }, [dispatch, locationData, positionQuerySupportBySource, radiusQuerySupportBySource, gridPointData, targetLocation, sourceSelections, viewId, updateHighlightedFeaturesBySource]);
6693
6756
  // Effect 2 was removed - it was redundant with effect 1 which handles all cases
6694
6757
  // (with or without selectedFeature, falls back to targetLocation if no nearby feature)
6695
6758
  useEffect(function () {
@@ -6732,7 +6795,8 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6732
6795
  return;
6733
6796
  }
6734
6797
  if (typeof selectedLocation === 'string') {
6735
- var foundFeature = serviceData.features.find(function (feature) {
6798
+ var _serviceData$features;
6799
+ var foundFeature = (_serviceData$features = serviceData.features) == null ? void 0 : _serviceData$features.find(function (feature) {
6736
6800
  return feature.id === selectedLocation;
6737
6801
  });
6738
6802
  if ((foundFeature == null ? void 0 : foundFeature.geometry.type) === 'Point') {
@@ -6769,29 +6833,35 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6769
6833
  });
6770
6834
  }
6771
6835
  if (featureNeedsUpdate) {
6772
- dispatch(genericActions.addFeatureSyncState({
6773
- panelId: viewId,
6774
- data: {
6775
- selectedFeatureId: selectedLocation
6776
- }
6777
- }));
6836
+ ownedFeatureLayerIds.forEach(function (layerId) {
6837
+ dispatch(layerActions.setSelectedFeatures({
6838
+ layerId: layerId,
6839
+ selectedFeatureIds: [selectedLocation]
6840
+ }));
6841
+ });
6778
6842
  }
6779
6843
  }
6780
6844
  } else if (Array.isArray(selectedLocation)) {
6781
6845
  var _lon = selectedLocation[0],
6782
6846
  _lat = selectedLocation[1];
6783
6847
  var _currentMapPin = selectedMapPinRef.current;
6784
- var needsUpdate = (_currentMapPin == null ? void 0 : _currentMapPin.lon) !== _lon || (_currentMapPin == null ? void 0 : _currentMapPin.lat) !== _lat;
6785
- if (needsUpdate) {
6786
- selectedMapIds.forEach(function (mapId) {
6787
- dispatch(mapActions.setMapPinLocation({
6788
- mapId: mapId,
6789
- mapPinLocation: {
6790
- lon: _lon,
6791
- lat: _lat
6792
- }
6793
- }));
6794
- });
6848
+ // When locationSelections was snapped to a grid point (differs from the clicked
6849
+ // position), keep the map pin at the clicked position so targetLocation stays at the
6850
+ // click and the legend can compute a meaningful distance to the data origin.
6851
+ var isGridPointSnap = targetLocationRef.current !== undefined && !isEqual(selectedLocation, targetLocationRef.current);
6852
+ if (!isGridPointSnap) {
6853
+ var needsUpdate = (_currentMapPin == null ? void 0 : _currentMapPin.lon) !== _lon || (_currentMapPin == null ? void 0 : _currentMapPin.lat) !== _lat;
6854
+ if (needsUpdate) {
6855
+ selectedMapIds.forEach(function (mapId) {
6856
+ dispatch(mapActions.setMapPinLocation({
6857
+ mapId: mapId,
6858
+ mapPinLocation: {
6859
+ lon: _lon,
6860
+ lat: _lat
6861
+ }
6862
+ }));
6863
+ });
6864
+ }
6795
6865
  }
6796
6866
  }
6797
6867
  });
@@ -6799,7 +6869,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6799
6869
  setTimeout(function () {
6800
6870
  isProcessingLocationUpdateRef.current = false;
6801
6871
  }, 0);
6802
- }, [locationData, locationSelections, sourceSelections, selectedMapIds, dispatch, viewId, updateHighlightedFeaturesBySource
6872
+ }, [locationData, locationSelections, sourceSelections, selectedMapIds, ownedFeatureLayerIds, dispatch, viewId, updateHighlightedFeaturesBySource
6803
6873
  // Note: highlightedFeaturesBySource intentionally excluded - we use highlightedFeaturesBySourceRef.current
6804
6874
  // inside this effect, and including the state would cause infinite loops since we call
6805
6875
  // updateHighlightedFeaturesBySource within the effect
@@ -6848,7 +6918,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6848
6918
  backgroundColor: 'geowebColors.background.surfaceApp',
6849
6919
  position: 'relative',
6850
6920
  containerType: 'inline-size',
6851
- containerName: 'soundings-container'
6921
+ containerName: SOUNDINGS_CONTAINER_NAME
6852
6922
  },
6853
6923
  children: [jsx(Box, {
6854
6924
  sx: {
@@ -6954,6 +7024,7 @@ var SoundingsConnect = function SoundingsConnect(_ref) {
6954
7024
  });
6955
7025
  };
6956
7026
 
7027
+ var defaultInstanceId = 'latest-0';
6957
7028
  var extractVerticalRange = function extractVerticalRange(collection, selectedInstanceId) {
6958
7029
  return getVerticalRangeFromInstance(collection.instances.find(function (instance) {
6959
7030
  return instance.id === selectedInstanceId;
@@ -6980,7 +7051,11 @@ var SoundingsSourceMenu = function SoundingsSourceMenu(_ref) {
6980
7051
  order = _ref$order === void 0 ? 0 : _ref$order,
6981
7052
  _ref$isLoading = _ref.isLoading,
6982
7053
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
6983
- error = _ref.error;
7054
+ error = _ref.error,
7055
+ _ref$startSize = _ref.startSize,
7056
+ startSize = _ref$startSize === void 0 ? {
7057
+ width: 320
7058
+ } : _ref$startSize;
6984
7059
  var _useSoundingsTranslat = useSoundingsTranslation(),
6985
7060
  t = _useSoundingsTranslat.t;
6986
7061
  return jsxs(ToolContainerDraggable, {
@@ -6995,9 +7070,7 @@ var SoundingsSourceMenu = function SoundingsSourceMenu(_ref) {
6995
7070
  top: 40,
6996
7071
  left: 50
6997
7072
  },
6998
- startSize: {
6999
- width: 320
7000
- },
7073
+ startSize: startSize,
7001
7074
  title: t('sources'),
7002
7075
  children: [!!isLoading && jsx(LinearProgress, {
7003
7076
  sx: {
@@ -7012,14 +7085,16 @@ var SoundingsSourceMenu = function SoundingsSourceMenu(_ref) {
7012
7085
  pr: 1
7013
7086
  },
7014
7087
  children: soundingsCollections && soundingsCollections.length > 0 ? soundingsCollections.map(function (collection) {
7015
- var _collection$instances;
7016
7088
  var _ref2 = sourceSelections[collection.id] || {},
7017
7089
  isChecked = _ref2.isChecked,
7018
7090
  instanceId = _ref2.instanceId,
7019
7091
  url = _ref2.url;
7020
7092
  var sourceUrl = url || collection.url;
7021
7093
  var hasInstances = collection.instances.length > 0;
7022
- var selectedInstanceId = instanceId || ((_collection$instances = collection.instances[0]) == null ? void 0 : _collection$instances.id) || undefined;
7094
+ var selectedInstanceId = hasInstances ? instanceId || defaultInstanceId : undefined;
7095
+ var hasNonExistingInstanceId = selectedInstanceId && !referenceTimeUtils.isRelativeReferenceTime(selectedInstanceId) && !collection.instances.some(function (instance) {
7096
+ return instance.id === selectedInstanceId;
7097
+ });
7023
7098
  return jsxs(ListItem, {
7024
7099
  disablePadding: true,
7025
7100
  children: [jsx(ListItemIcon, {
@@ -7039,7 +7114,7 @@ var SoundingsSourceMenu = function SoundingsSourceMenu(_ref) {
7039
7114
  });
7040
7115
  }
7041
7116
  })
7042
- }), jsxs(StyledSelect, {
7117
+ }), jsxs(TooltipSelect, {
7043
7118
  additionalStyling: {
7044
7119
  width: 'calc(100% - 42px)'
7045
7120
  },
@@ -7054,31 +7129,54 @@ var SoundingsSourceMenu = function SoundingsSourceMenu(_ref) {
7054
7129
  });
7055
7130
  },
7056
7131
  renderValue: function renderValue(value) {
7057
- return jsx(Box, {
7132
+ return jsxs(Box, {
7058
7133
  sx: {
7059
- textOverflow: 'ellipsis',
7060
- overflow: 'hidden'
7134
+ display: 'flex',
7135
+ alignItems: 'center',
7136
+ width: '100%',
7137
+ gap: 1
7061
7138
  },
7062
- children: jsxs(Box, {
7139
+ children: [jsx(Box, {
7063
7140
  sx: {
7064
- display: 'flex'
7141
+ flex: '4 1 0',
7142
+ minWidth: 0,
7143
+ textOverflow: 'ellipsis',
7144
+ overflow: 'hidden',
7145
+ whiteSpace: 'nowrap'
7146
+ },
7147
+ children: collection.name
7148
+ }), jsxs(Box, {
7149
+ sx: {
7150
+ flex: '1 1 0',
7151
+ minWidth: 0,
7152
+ display: 'flex',
7153
+ alignItems: 'center',
7154
+ justifyContent: 'space-between',
7155
+ gap: 0.5
7065
7156
  },
7066
7157
  children: [jsx(Box, {
7067
7158
  sx: {
7068
- minWidth: 200
7069
- },
7070
- children: collection.name
7071
- }), jsx(Box, {
7072
- sx: {
7159
+ minWidth: 0,
7073
7160
  textOverflow: 'ellipsis',
7074
- overflow: 'hidden'
7161
+ overflow: 'hidden',
7162
+ whiteSpace: 'nowrap'
7075
7163
  },
7076
7164
  children: getSelectedDisplayValue(value)
7077
- })]
7078
- })
7165
+ }), hasNonExistingInstanceId ? jsx(Box, {
7166
+ sx: {
7167
+ '& .MuiSvgIcon-root': {
7168
+ fill: 'currentcolor!important'
7169
+ }
7170
+ },
7171
+ children: jsx(AlertIcon, {
7172
+ severity: "error"
7173
+ })
7174
+ }) : null]
7175
+ })]
7079
7176
  });
7080
7177
  },
7081
7178
  skipLocalStyling: false,
7179
+ tooltip: collection.name + ": " + getSelectedDisplayValue(selectedInstanceId || t('noInstancesAvailable')),
7082
7180
  value: selectedInstanceId || t('noInstancesAvailable'),
7083
7181
  children: [!hasInstances && jsx(MenuItem, {
7084
7182
  disabled: true,
@@ -7093,10 +7191,12 @@ var SoundingsSourceMenu = function SoundingsSourceMenu(_ref) {
7093
7191
  value: option.token,
7094
7192
  children: option.label
7095
7193
  }, option.token);
7096
- }), collection.instances.map(function (instance) {
7097
- return jsx(MenuItem, {
7194
+ }), referenceTimeUtils.extendCollectionInstances(collection.instances, selectedInstanceId).map(function (instance, currentIndex) {
7195
+ return jsxs(MenuItem, {
7098
7196
  value: instance.id,
7099
- children: getDisplayValue(instance.id)
7197
+ children: [getDisplayValue(instance.id), currentIndex === collection.instances.length && jsx(AlertIcon, {
7198
+ severity: "error"
7199
+ })]
7100
7200
  }, instance.id);
7101
7201
  })]
7102
7202
  })]
@@ -7240,6 +7340,7 @@ var LocationsMenu = function LocationsMenu(_ref2) {
7240
7340
  setSearchFilter = _useState[1];
7241
7341
  var _useSoundingsTranslat = useSoundingsTranslation(),
7242
7342
  t = _useSoundingsTranslat.t;
7343
+ var listContainerRef = useRef(null);
7243
7344
  var filteredResults = useMemo(function () {
7244
7345
  return services == null ? void 0 : services.map(function (service) {
7245
7346
  var filteredFeatures = service.features ? service.features.filter(function (feature) {
@@ -7251,6 +7352,7 @@ var LocationsMenu = function LocationsMenu(_ref2) {
7251
7352
  });
7252
7353
  });
7253
7354
  }, [services, searchFilter]);
7355
+ var heightObserver = useResizeObserver(listContainerRef, filteredResults);
7254
7356
  var isChecked = function isChecked(sourceId, locationId) {
7255
7357
  return selectedLocations[sourceId] === locationId;
7256
7358
  };
@@ -7283,58 +7385,65 @@ var LocationsMenu = function LocationsMenu(_ref2) {
7283
7385
  margin: 1
7284
7386
  },
7285
7387
  children: t('locations-menu-warning')
7286
- }) : jsxs(Grid, {
7287
- container: true,
7288
- children: [jsx(Box, {
7289
- sx: {
7290
- width: '100%',
7291
- padding: 1,
7292
- position: 'sticky',
7293
- top: 0,
7294
- zIndex: 1,
7295
- backgroundColor: 'geowebColors.background.surfaceApp'
7296
- },
7297
- children: jsx(SearchField, {
7298
- searchFilter: searchFilter,
7299
- setSearchFilter: setSearchFilter,
7300
- small: true
7301
- })
7302
- }), filteredResults.map(function (service) {
7303
- return jsx(Fragment$1, {
7304
- children: jsx(CustomAccordion, {
7305
- amountOfItems: service.features.length,
7306
- defaultExpanded: false,
7307
- sx: {
7308
- width: '100%',
7309
- margin: '0 8px 2px 8px',
7310
- '.MuiAccordionDetails-root': {
7311
- padding: 0
7312
- },
7313
- '.MuiAccordionSummary-root': {
7314
- minHeight: '40px'
7315
- },
7316
- '.MuiAccordionSummary-content': {
7317
- paddingLeft: 3
7318
- }
7319
- },
7320
- title: service.name,
7321
- children: jsx(List, {
7322
- rowComponent: RowComponent,
7323
- rowCount: service.features.length,
7324
- rowHeight: 40,
7325
- rowProps: {
7326
- service: service,
7327
- isChecked: isChecked,
7328
- updateSelectedLocation: updateSelectedLocation
7388
+ }) : jsx(Box, {
7389
+ ref: listContainerRef,
7390
+ sx: {
7391
+ width: '100%',
7392
+ height: '100%'
7393
+ },
7394
+ children: jsxs(Grid, {
7395
+ container: true,
7396
+ children: [jsx(Box, {
7397
+ sx: {
7398
+ width: '100%',
7399
+ padding: 1,
7400
+ position: 'sticky',
7401
+ top: 0,
7402
+ zIndex: 1,
7403
+ backgroundColor: 'geowebColors.background.surfaceApp'
7404
+ },
7405
+ children: jsx(SearchField, {
7406
+ searchFilter: searchFilter,
7407
+ setSearchFilter: setSearchFilter,
7408
+ small: true
7409
+ })
7410
+ }), filteredResults.map(function (service) {
7411
+ return jsx(Fragment$1, {
7412
+ children: jsx(CustomAccordion, {
7413
+ amountOfItems: service.features.length,
7414
+ defaultExpanded: false,
7415
+ sx: {
7416
+ width: '100%',
7417
+ margin: '0 8px 2px 8px',
7418
+ '.MuiAccordionDetails-root': {
7419
+ padding: 0
7420
+ },
7421
+ '.MuiAccordionSummary-root': {
7422
+ minHeight: '40px'
7423
+ },
7424
+ '.MuiAccordionSummary-content': {
7425
+ paddingLeft: 3
7426
+ }
7329
7427
  },
7330
- style: {
7331
- height: 320,
7332
- width: '100%'
7333
- }
7428
+ title: service.name,
7429
+ children: jsx(List, {
7430
+ rowComponent: RowComponent,
7431
+ rowCount: service.features.length,
7432
+ rowHeight: 40,
7433
+ rowProps: {
7434
+ service: service,
7435
+ isChecked: isChecked,
7436
+ updateSelectedLocation: updateSelectedLocation
7437
+ },
7438
+ style: {
7439
+ height: heightObserver,
7440
+ width: '100%'
7441
+ }
7442
+ })
7334
7443
  })
7335
- })
7336
- }, service.id);
7337
- })]
7444
+ }, service.id);
7445
+ })]
7446
+ })
7338
7447
  })]
7339
7448
  });
7340
7449
  };
@@ -7374,10 +7483,10 @@ var LocationsMenuConnect = function LocationsMenuConnect(_ref) {
7374
7483
  dispatch(soundingsActions.setSoundingsCollections(soundingsCollections));
7375
7484
  }
7376
7485
  }, [dispatch, soundingsCollections]);
7377
- var _useGetCollectionLoca = useGetCollectionLocations(collections, isDialogOpen),
7378
- data = _useGetCollectionLoca.data,
7379
- isPending = _useGetCollectionLoca.isPending,
7380
- error = _useGetCollectionLoca.error;
7486
+ var _useGetLocations = useGetLocations(collections, isDialogOpen),
7487
+ data = _useGetLocations.data,
7488
+ isPending = _useGetLocations.isPending,
7489
+ error = _useGetLocations.error;
7381
7490
  var services = useMemo(function () {
7382
7491
  return (data == null ? void 0 : data.filter(function (service) {
7383
7492
  return selectedSourceIds.includes(service.id);