@opengeoweb/sigmet-airmet 1.2.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import { ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormNumberField,
8
8
  import { useApiContext, useApi, createApiInstance } from '@opengeoweb/api';
9
9
  import produce, { produce as produce$1 } from 'immer';
10
10
  import { useDispatch, useSelector, shallowEqual } from 'react-redux';
11
- import { mapTypes, mapSelectors, generateMapId, generateLayerId, mapActions, MapViewConnect, MapViewLayer } from '@opengeoweb/core';
11
+ import { mapTypes, mapSelectors, generateMapId, generateTimesliderId, SyncGroups, generateLayerId, mapActions, publicLayers, MapControls, LayerManagerMapButtonConnect, MapViewConnect, MapViewLayer, TimeSliderConnect } from '@opengeoweb/core';
12
12
  import * as turf from '@turf/turf';
13
13
  import { polygonToLineString, booleanClockwise, rewind } from '@turf/turf';
14
14
  import { useDraftFormHelpers, useIsMounted, StatusTag, AlertBanner, usePreventBrowserClose, useConfirmationDialog, isAxiosError, getAxiosErrorMessage, ConfirmationServiceProvider, usePoller } from '@opengeoweb/shared';
@@ -17,103 +17,107 @@ import moment from 'moment';
17
17
  import { debounce } from 'lodash';
18
18
  import { Skeleton } from '@material-ui/lab';
19
19
 
20
- /*! *****************************************************************************
21
- Copyright (c) Microsoft Corporation.
22
-
23
- Permission to use, copy, modify, and/or distribute this software for any
24
- purpose with or without fee is hereby granted.
25
-
26
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
27
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
28
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
29
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
30
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
31
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
32
- PERFORMANCE OF THIS SOFTWARE.
33
- ***************************************************************************** */
34
-
35
- var __assign = function() {
36
- __assign = Object.assign || function __assign(t) {
37
- for (var s, i = 1, n = arguments.length; i < n; i++) {
38
- s = arguments[i];
39
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
40
- }
41
- return t;
42
- };
43
- return __assign.apply(this, arguments);
44
- };
45
-
46
- function __rest(s, e) {
47
- var t = {};
48
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
49
- t[p] = s[p];
50
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
51
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
52
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
53
- t[p[i]] = s[p[i]];
54
- }
55
- return t;
56
- }
57
-
58
- function __awaiter(thisArg, _arguments, P, generator) {
59
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
60
- return new (P || (P = Promise))(function (resolve, reject) {
61
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
62
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
63
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
64
- step((generator = generator.apply(thisArg, _arguments || [])).next());
65
- });
66
- }
67
-
68
- function __generator(thisArg, body) {
69
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
70
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
71
- function verb(n) { return function (v) { return step([n, v]); }; }
72
- function step(op) {
73
- if (f) throw new TypeError("Generator is already executing.");
74
- while (_) try {
75
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
76
- if (y = 0, t) op = [op[0] & 2, t.value];
77
- switch (op[0]) {
78
- case 0: case 1: t = op; break;
79
- case 4: _.label++; return { value: op[1], done: false };
80
- case 5: _.label++; y = op[1]; op = [0]; continue;
81
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
82
- default:
83
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
84
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
85
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
86
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
87
- if (t[2]) _.ops.pop();
88
- _.trys.pop(); continue;
89
- }
90
- op = body.call(thisArg, _);
91
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
92
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
93
- }
94
- }
95
-
96
- function __read(o, n) {
97
- var m = typeof Symbol === "function" && o[Symbol.iterator];
98
- if (!m) return o;
99
- var i = m.call(o), r, ar = [], e;
100
- try {
101
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
102
- }
103
- catch (error) { e = { error: error }; }
104
- finally {
105
- try {
106
- if (r && !r.done && (m = i["return"])) m.call(i);
107
- }
108
- finally { if (e) throw e.error; }
109
- }
110
- return ar;
111
- }
112
-
113
- function __spreadArray(to, from) {
114
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
115
- to[j] = from[i];
116
- return to;
20
+ function _typeof(obj) {
21
+ "@babel/helpers - typeof";
22
+
23
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
24
+ _typeof = function (obj) {
25
+ return typeof obj;
26
+ };
27
+ } else {
28
+ _typeof = function (obj) {
29
+ return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
30
+ };
31
+ }
32
+
33
+ return _typeof(obj);
34
+ }
35
+
36
+ function _defineProperty(obj, key, value) {
37
+ if (key in obj) {
38
+ Object.defineProperty(obj, key, {
39
+ value: value,
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true
43
+ });
44
+ } else {
45
+ obj[key] = value;
46
+ }
47
+
48
+ return obj;
49
+ }
50
+
51
+ function _slicedToArray(arr, i) {
52
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
53
+ }
54
+
55
+ function _toConsumableArray(arr) {
56
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
57
+ }
58
+
59
+ function _arrayWithoutHoles(arr) {
60
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
61
+ }
62
+
63
+ function _arrayWithHoles(arr) {
64
+ if (Array.isArray(arr)) return arr;
65
+ }
66
+
67
+ function _iterableToArray(iter) {
68
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
69
+ }
70
+
71
+ function _iterableToArrayLimit(arr, i) {
72
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
73
+ var _arr = [];
74
+ var _n = true;
75
+ var _d = false;
76
+ var _e = undefined;
77
+
78
+ try {
79
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
80
+ _arr.push(_s.value);
81
+
82
+ if (i && _arr.length === i) break;
83
+ }
84
+ } catch (err) {
85
+ _d = true;
86
+ _e = err;
87
+ } finally {
88
+ try {
89
+ if (!_n && _i["return"] != null) _i["return"]();
90
+ } finally {
91
+ if (_d) throw _e;
92
+ }
93
+ }
94
+
95
+ return _arr;
96
+ }
97
+
98
+ function _unsupportedIterableToArray(o, minLen) {
99
+ if (!o) return;
100
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
101
+ var n = Object.prototype.toString.call(o).slice(8, -1);
102
+ if (n === "Object" && o.constructor) n = o.constructor.name;
103
+ if (n === "Map" || n === "Set") return Array.from(o);
104
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
105
+ }
106
+
107
+ function _arrayLikeToArray(arr, len) {
108
+ if (len == null || len > arr.length) len = arr.length;
109
+
110
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
111
+
112
+ return arr2;
113
+ }
114
+
115
+ function _nonIterableSpread() {
116
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
117
+ }
118
+
119
+ function _nonIterableRest() {
120
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
117
121
  }
118
122
 
119
123
  var srsAndBboxDefault = {
@@ -125,34 +129,6 @@ var srsAndBboxDefault = {
125
129
  },
126
130
  srs: 'EPSG:3857'
127
131
  };
128
- var baseLayer = {
129
- name: 'WorldMap_Light_Grey_Canvas',
130
- title: 'WorldMap_Light_Grey_Canvas',
131
- type: 'twms',
132
- layerType: mapTypes.LayerType.baseLayer,
133
- enabled: true
134
- };
135
- var countryBorders = {
136
- service: 'https://geoservices.knmi.nl/wms?DATASET=baselayers&',
137
- name: 'countryborders',
138
- format: 'image/png',
139
- layerType: mapTypes.LayerType.overLayer,
140
- enabled: true
141
- };
142
- var northSeaPlatforms = {
143
- service: 'https://adaguc-server-geoweb.geoweb.knmi.cloud/adagucserver?dataset=OVL-sigmetairmet',
144
- name: 'northseastations',
145
- format: 'image/png',
146
- layerType: mapTypes.LayerType.overLayer,
147
- enabled: true
148
- };
149
- var majorAirportsEHAA = {
150
- service: 'https://adaguc-server-geoweb.geoweb.knmi.cloud/adagucserver?dataset=OVL-sigmetairmet',
151
- name: 'airports',
152
- format: 'image/png',
153
- layerType: mapTypes.LayerType.overLayer,
154
- enabled: true
155
- };
156
132
  var featurePropsStart = {
157
133
  stroke: '#f24a00',
158
134
  'stroke-width': 1.5,
@@ -199,7 +175,7 @@ var emptyPolygonGeoJSONStart = {
199
175
  type: 'FeatureCollection',
200
176
  features: [{
201
177
  type: 'Feature',
202
- properties: __assign(__assign({}, featurePropsUnStyled), {
178
+ properties: Object.assign(Object.assign({}, featurePropsUnStyled), {
203
179
  selectionType: 'poly'
204
180
  }),
205
181
  geometry: {
@@ -212,7 +188,7 @@ var emptyPolygonGeoJSONEnd = {
212
188
  type: 'FeatureCollection',
213
189
  features: [{
214
190
  type: 'Feature',
215
- properties: __assign(__assign({}, featurePropsUnStyled), {
191
+ properties: Object.assign(Object.assign({}, featurePropsUnStyled), {
216
192
  selectionType: 'poly'
217
193
  }),
218
194
  geometry: {
@@ -225,7 +201,7 @@ var emptyBoxGeoJSONStart = {
225
201
  type: 'FeatureCollection',
226
202
  features: [{
227
203
  type: 'Feature',
228
- properties: __assign({
204
+ properties: Object.assign({
229
205
  _adaguctype: 'box',
230
206
  selectionType: 'box'
231
207
  }, featurePropsUnStyled),
@@ -239,7 +215,7 @@ var emptyBoxGeoJSONEnd = {
239
215
  type: 'FeatureCollection',
240
216
  features: [{
241
217
  type: 'Feature',
242
- properties: __assign({
218
+ properties: Object.assign({
243
219
  _adaguctype: 'box',
244
220
  selectionType: 'box'
245
221
  }, featurePropsUnStyled),
@@ -253,7 +229,7 @@ var emptyPointsGeojsonStart = {
253
229
  type: 'FeatureCollection',
254
230
  features: [{
255
231
  type: 'Feature',
256
- properties: __assign(__assign({}, featurePropsUnStyled), {
232
+ properties: Object.assign(Object.assign({}, featurePropsUnStyled), {
257
233
  selectionType: 'point'
258
234
  }),
259
235
  geometry: {
@@ -266,7 +242,7 @@ var emptyPointsGeojsonEnd = {
266
242
  type: 'FeatureCollection',
267
243
  features: [{
268
244
  type: 'Feature',
269
- properties: __assign(__assign({}, featurePropsUnStyled), {
245
+ properties: Object.assign(Object.assign({}, featurePropsUnStyled), {
270
246
  selectionType: 'point'
271
247
  }),
272
248
  geometry: {
@@ -459,6 +435,59 @@ var StartOrEndDrawing;
459
435
  StartOrEndDrawing["end"] = "end";
460
436
  })(StartOrEndDrawing || (StartOrEndDrawing = {}));
461
437
 
438
+ /* *
439
+ * Licensed under the Apache License, Version 2.0 (the "License");
440
+ * you may not use this file except in compliance with the License.
441
+ * You may obtain a copy of the License at
442
+ *
443
+ * http://www.apache.org/licenses/LICENSE-2.0
444
+ *
445
+ * Unless required by applicable law or agreed to in writing, software
446
+ * distributed under the License is distributed on an "AS IS" BASIS,
447
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
448
+ * See the License for the specific language governing permissions and
449
+ * limitations under the License.
450
+ *
451
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
452
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
453
+ * */
454
+ var adagucBaseUrl = 'https://adaguc-server-geoweb.geoweb.knmi.cloud/adagucserver';
455
+ var KNMIGeoWebSigmetAirmetOverlays = {
456
+ name: 'SigmetAirmetOverlays',
457
+ url: "".concat(adagucBaseUrl, "?dataset=OVL-sigmetairmet"),
458
+ id: 'sigmetairmetoverlays'
459
+ };
460
+ var northSeaPlatforms = {
461
+ service: KNMIGeoWebSigmetAirmetOverlays.url,
462
+ name: 'northseastations',
463
+ format: 'image/png',
464
+ layerType: mapTypes.LayerType.overLayer,
465
+ enabled: true
466
+ };
467
+ var majorAirportsEHAA = {
468
+ service: KNMIGeoWebSigmetAirmetOverlays.url,
469
+ name: 'airports',
470
+ format: 'image/png',
471
+ layerType: mapTypes.LayerType.overLayer,
472
+ enabled: true
473
+ };
474
+
475
+ /* *
476
+ * Licensed under the Apache License, Version 2.0 (the "License");
477
+ * you may not use this file except in compliance with the License.
478
+ * You may obtain a copy of the License at
479
+ *
480
+ * http://www.apache.org/licenses/LICENSE-2.0
481
+ *
482
+ * Unless required by applicable law or agreed to in writing, software
483
+ * distributed under the License is distributed on an "AS IS" BASIS,
484
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
485
+ * See the License for the specific language governing permissions and
486
+ * limitations under the License.
487
+ *
488
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
489
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
490
+ * */
462
491
  var allowOneGeoJSONFeature = function allowOneGeoJSONFeature(mode, geojson) {
463
492
  switch (mode) {
464
493
  case MapDrawMode.BOX:
@@ -472,39 +501,50 @@ var allowOneGeoJSONFeature = function allowOneGeoJSONFeature(mode, geojson) {
472
501
  }
473
502
  };
474
503
 
475
- var MapViewGeoJson = function MapViewGeoJson(_a) {
476
- var geoJSONs = _a.geoJSONs,
477
- _b = _a.setLayerGeoJSONs,
478
- setLayerGeoJSONs = _b === void 0 ? function () {} : _b,
479
- _c = _a.layerDrawModes,
480
- layerDrawModes = _c === void 0 ? {
504
+ var MapViewGeoJson = function MapViewGeoJson(_ref) {
505
+ var geoJSONs = _ref.geoJSONs,
506
+ _ref$setLayerGeoJSONs = _ref.setLayerGeoJSONs,
507
+ setLayerGeoJSONs = _ref$setLayerGeoJSONs === void 0 ? function () {} : _ref$setLayerGeoJSONs,
508
+ _ref$layerDrawModes = _ref.layerDrawModes,
509
+ layerDrawModes = _ref$layerDrawModes === void 0 ? {
481
510
  start: null,
482
511
  end: null
483
- } : _c,
484
- _d = _a.drawMode,
485
- drawMode = _d === void 0 ? {
512
+ } : _ref$layerDrawModes,
513
+ _ref$drawMode = _ref.drawMode,
514
+ drawMode = _ref$drawMode === void 0 ? {
486
515
  start: null,
487
516
  end: null
488
- } : _d,
489
- _e = _a.setDrawMode,
490
- setDrawMode = _e === void 0 ? function () {} : _e,
491
- _f = _a.exitDrawModeCallbackStart,
492
- exitDrawModeCallbackStart = _f === void 0 ? function () {} : _f,
493
- _g = _a.exitDrawModeCallbackEnd,
494
- exitDrawModeCallbackEnd = _g === void 0 ? function () {} : _g;
517
+ } : _ref$drawMode,
518
+ _ref$setDrawMode = _ref.setDrawMode,
519
+ setDrawMode = _ref$setDrawMode === void 0 ? function () {} : _ref$setDrawMode,
520
+ _ref$exitDrawModeCall = _ref.exitDrawModeCallbackStart,
521
+ exitDrawModeCallbackStart = _ref$exitDrawModeCall === void 0 ? function () {} : _ref$exitDrawModeCall,
522
+ _ref$exitDrawModeCall2 = _ref.exitDrawModeCallbackEnd,
523
+ exitDrawModeCallbackEnd = _ref$exitDrawModeCall2 === void 0 ? function () {} : _ref$exitDrawModeCall2;
495
524
  var dispatch = useDispatch();
525
+ var firstMap = useSelector(function (store) {
526
+ return mapSelectors.getFirstMap(store);
527
+ }, shallowEqual);
528
+ var firstMapId = firstMap && firstMap.id ? firstMap.id : null;
496
529
  var mapLayers = useSelector(function (store) {
497
- return mapSelectors.getMapLayers(store, 'main-map');
530
+ return mapSelectors.getMapLayers(store, firstMapId);
498
531
  }, shallowEqual);
499
532
  var mapDimensions = useSelector(function (store) {
500
- return mapSelectors.getMapDimensions(store, 'main-map');
533
+ return mapSelectors.getMapDimensions(store, firstMapId);
501
534
  }, shallowEqual);
502
- var mapId = React.useRef("sigmet-" + generateMapId()).current;
535
+ var mapId = React.useRef("sigmet-".concat(generateMapId())).current;
536
+ var timesliderId = React.useRef("sigmet-".concat(generateTimesliderId())).current;
537
+ var syncGroupAddGroup = React.useCallback(function (payload) {
538
+ return dispatch(SyncGroups.actions.syncGroupAddGroup(payload));
539
+ }, [dispatch]);
540
+ var syncGroupAddTarget = React.useCallback(function (payload) {
541
+ return dispatch(SyncGroups.actions.syncGroupAddTarget(payload));
542
+ }, [dispatch]);
503
543
  React.useEffect(function () {
504
544
  if (mapLayers && mapLayers.length) {
505
545
  // use maplayers, but change layerId and current mapId
506
546
  var layers = mapLayers.map(function (layer) {
507
- return __assign(__assign({}, layer), {
547
+ return Object.assign(Object.assign({}, layer), {
508
548
  id: generateLayerId(),
509
549
  mapId: mapId
510
550
  });
@@ -525,41 +565,58 @@ var MapViewGeoJson = function MapViewGeoJson(_a) {
525
565
 
526
566
  dispatch(mapActions.setBaseLayers({
527
567
  mapId: mapId,
528
- layers: [__assign(__assign({}, baseLayer), {
529
- id: "baselayer-" + mapId
530
- }), __assign(__assign({}, countryBorders), {
531
- id: "countryborders-" + mapId
532
- }), __assign(__assign({}, northSeaPlatforms), {
533
- id: "northseaplatforms-" + mapId
534
- }), __assign(__assign({}, majorAirportsEHAA), {
535
- id: "majorairportsehaa-" + mapId
568
+ layers: [Object.assign(Object.assign({}, publicLayers.baseLayerGrey), {
569
+ id: "baselayer-".concat(mapId)
570
+ }), Object.assign(Object.assign({}, publicLayers.overLayer), {
571
+ id: "countryborders-".concat(mapId)
572
+ }), Object.assign(Object.assign({}, northSeaPlatforms), {
573
+ id: "northseaplatforms-".concat(mapId)
574
+ }), Object.assign(Object.assign({}, majorAirportsEHAA), {
575
+ id: "majorairportsehaa-".concat(mapId)
536
576
  })]
537
577
  }));
538
578
  dispatch(mapActions.setBbox({
539
579
  mapId: mapId,
540
580
  bbox: srsAndBboxDefault.bbox,
541
581
  srs: srsAndBboxDefault.srs
542
- })); // eslint-disable-next-line react-hooks/exhaustive-deps
582
+ }));
583
+ syncGroupAddGroup({
584
+ groupId: 'Time_SigmetAirmet',
585
+ title: 'Group 1 for sigmet/airmet map',
586
+ type: SyncGroups.constants.SYNCGROUPS_TYPE_SETTIME
587
+ });
588
+ syncGroupAddTarget({
589
+ groupId: 'Time_SigmetAirmet',
590
+ targetId: mapId
591
+ });
592
+ syncGroupAddTarget({
593
+ groupId: 'Time_SigmetAirmet',
594
+ targetId: timesliderId
595
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
543
596
  }, []);
544
597
  return /*#__PURE__*/React.createElement("div", {
545
598
  style: {
546
- height: '100%'
599
+ position: 'relative',
600
+ height: '99%'
547
601
  },
548
602
  "data-testid": "MapView"
549
- }, /*#__PURE__*/React.createElement(MapViewConnect, {
603
+ }, /*#__PURE__*/React.createElement(MapControls, null, /*#__PURE__*/React.createElement(LayerManagerMapButtonConnect, {
604
+ source: "module",
605
+ mapId: mapId
606
+ })), /*#__PURE__*/React.createElement(MapViewConnect, {
550
607
  mapId: mapId
551
608
  }, /*#__PURE__*/React.createElement(MapViewLayer, {
552
- id: "geojsonlayer-fir-" + mapId,
609
+ id: "geojsonlayer-fir-".concat(mapId),
553
610
  isInEditMode: false,
554
611
  geojson: geoJSONs.fir
555
612
  }), /*#__PURE__*/React.createElement(MapViewLayer, {
556
- id: "geojsonlayer-end-" + mapId,
613
+ id: "geojsonlayer-end-".concat(mapId),
557
614
  isInEditMode: drawMode.end !== null && layerDrawModes.end !== null,
558
615
  geojson: geoJSONs.end,
559
616
  drawMode: layerDrawModes.end,
560
617
  updateGeojson: function updateGeojson(geojson) {
561
618
  var end = allowOneGeoJSONFeature(layerDrawModes.end, geojson);
562
- setLayerGeoJSONs(__assign(__assign({}, geoJSONs), {
619
+ setLayerGeoJSONs(Object.assign(Object.assign({}, geoJSONs), {
563
620
  end: end
564
621
  }));
565
622
  },
@@ -572,13 +629,13 @@ var MapViewGeoJson = function MapViewGeoJson(_a) {
572
629
  },
573
630
  featureNrToEdit: 0
574
631
  }), /*#__PURE__*/React.createElement(MapViewLayer, {
575
- id: "geojsonlayer-start-" + mapId,
632
+ id: "geojsonlayer-start-".concat(mapId),
576
633
  isInEditMode: drawMode.start !== null && layerDrawModes.start !== null,
577
634
  geojson: geoJSONs.start,
578
635
  drawMode: layerDrawModes.start,
579
636
  updateGeojson: function updateGeojson(geojson) {
580
637
  var start = allowOneGeoJSONFeature(layerDrawModes.start, geojson);
581
- setLayerGeoJSONs(__assign(__assign({}, geoJSONs), {
638
+ setLayerGeoJSONs(Object.assign(Object.assign({}, geoJSONs), {
582
639
  start: start
583
640
  }));
584
641
  },
@@ -591,13 +648,24 @@ var MapViewGeoJson = function MapViewGeoJson(_a) {
591
648
  },
592
649
  featureNrToEdit: 0
593
650
  }), /*#__PURE__*/React.createElement(MapViewLayer, {
594
- id: "geojsonlayer-intersection-end-" + mapId,
651
+ id: "geojsonlayer-intersection-end-".concat(mapId),
595
652
  isInEditMode: false,
596
653
  geojson: geoJSONs.intersectionEnd
597
654
  }), /*#__PURE__*/React.createElement(MapViewLayer, {
598
- id: "geojsonlayer-intersection-start-" + mapId,
655
+ id: "geojsonlayer-intersection-start-".concat(mapId),
599
656
  isInEditMode: false,
600
657
  geojson: geoJSONs.intersectionStart
658
+ })), /*#__PURE__*/React.createElement("div", {
659
+ style: {
660
+ position: 'absolute',
661
+ left: '0',
662
+ bottom: '0',
663
+ zIndex: 1000,
664
+ width: '100%'
665
+ }
666
+ }, /*#__PURE__*/React.createElement(TimeSliderConnect, {
667
+ sourceId: timesliderId,
668
+ mapId: mapId
601
669
  })));
602
670
  };
603
671
 
@@ -819,10 +887,8 @@ var addFeatureProperties = function addFeatureProperties(geojson, featurePropert
819
887
  });
820
888
  };
821
889
 
822
- var useDrawMode = function useDrawMode(initialGeometry) {
823
- if (initialGeometry === void 0) {
824
- initialGeometry = null;
825
- }
890
+ var useDrawMode = function useDrawMode() {
891
+ var initialGeometry = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
826
892
 
827
893
  var getInitialLayerDrawModes = function getInitialLayerDrawModes(startorEnd) {
828
894
  return initialGeometry && initialGeometry[startorEnd] ? getDrawModeFromSelectionType(initialGeometry[startorEnd].features[0].properties.selectionType) : null;
@@ -830,25 +896,27 @@ var useDrawMode = function useDrawMode(initialGeometry) {
830
896
  /* For the radio buttons */
831
897
 
832
898
 
833
- var _a = __read(React.useState({
899
+ var _React$useState = React.useState({
834
900
  start: null,
835
901
  end: null
836
- }), 2),
837
- drawMode = _a[0],
838
- setDrawMode = _a[1];
902
+ }),
903
+ _React$useState2 = _slicedToArray(_React$useState, 2),
904
+ drawMode = _React$useState2[0],
905
+ setDrawMode = _React$useState2[1];
839
906
  /* Drawmode for the layers */
840
907
 
841
908
 
842
- var _b = __read(React.useState({
909
+ var _React$useState3 = React.useState({
843
910
  start: getInitialLayerDrawModes('start'),
844
911
  end: getInitialLayerDrawModes('end')
845
- }), 2),
846
- layerDrawModes = _b[0],
847
- setLayersDrawModes = _b[1];
912
+ }),
913
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
914
+ layerDrawModes = _React$useState4[0],
915
+ setLayersDrawModes = _React$useState4[1];
848
916
  /* GeoJSONs for the layers */
849
917
 
850
918
 
851
- var _c = __read(React.useState(function () {
919
+ var _React$useState5 = React.useState(function () {
852
920
  return {
853
921
  start: addFeatureProperties(initialGeometry && initialGeometry.start, featurePropsStart),
854
922
  end: addFeatureProperties(initialGeometry && initialGeometry.end, featurePropsEnd),
@@ -856,9 +924,10 @@ var useDrawMode = function useDrawMode(initialGeometry) {
856
924
  intersectionEnd: addFeatureProperties(initialGeometry && initialGeometry.intersectionEnd, featurePropsIntersectionEnd),
857
925
  fir: addFeatureProperties(getFir(), featurePropsFIR)
858
926
  };
859
- }), 2),
860
- geoJSONs = _c[0],
861
- setLayerGeoJSONs = _c[1];
927
+ }),
928
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
929
+ geoJSONs = _React$useState6[0],
930
+ setLayerGeoJSONs = _React$useState6[1];
862
931
  /**
863
932
  *
864
933
  * @param mapDrawMode Can be 'POINT' | 'BOX' | 'POLYGON' | 'FIR' | 'DELETE'
@@ -867,8 +936,7 @@ var useDrawMode = function useDrawMode(initialGeometry) {
867
936
 
868
937
 
869
938
  var setDrawModeType = function setDrawModeType(mapDrawMode, startOrEnd, updateCallback) {
870
- var newGeoJSONDrawMode = __assign({}, layerDrawModes);
871
-
939
+ var newGeoJSONDrawMode = Object.assign({}, layerDrawModes);
872
940
  var featureStyleProperties = startOrEnd === StartOrEndDrawing.start ? featurePropsStart : featurePropsEnd;
873
941
  /* Switch on the mapdrawmode type for either start or end */
874
942
 
@@ -903,17 +971,19 @@ var useDrawMode = function useDrawMode(initialGeometry) {
903
971
  case MapDrawMode.FIR:
904
972
  {
905
973
  newGeoJSONDrawMode[startOrEnd] = mapDrawMode;
906
- var cleanGeoJSON = produce(geoJSONs, function (draft) {
907
- draft[startOrEnd] = addFeatureProperties(getFir(), __assign(__assign({}, featureStyleProperties), {
974
+
975
+ var _cleanGeoJSON = produce(geoJSONs, function (draft) {
976
+ draft[startOrEnd] = addFeatureProperties(getFir(), Object.assign(Object.assign({}, featureStyleProperties), {
908
977
  selectionType: 'fir'
909
978
  }));
910
979
  });
980
+
911
981
  setDrawMode({
912
982
  start: null,
913
983
  end: null
914
984
  });
915
985
  setLayersDrawModes(newGeoJSONDrawMode);
916
- var intersections = createInterSections(cleanGeoJSON);
986
+ var intersections = createInterSections(_cleanGeoJSON);
917
987
  setLayerGeoJSONs(intersections);
918
988
  if (updateCallback) updateCallback(intersections);
919
989
  break;
@@ -923,8 +993,7 @@ var useDrawMode = function useDrawMode(initialGeometry) {
923
993
 
924
994
  case MapDrawMode.DELETE:
925
995
  {
926
- var newDrawMode = __assign({}, drawMode);
927
-
996
+ var newDrawMode = Object.assign({}, drawMode);
928
997
  newDrawMode[startOrEnd] = null;
929
998
  setDrawMode(newDrawMode);
930
999
 
@@ -932,23 +1001,27 @@ var useDrawMode = function useDrawMode(initialGeometry) {
932
1001
  case MapDrawMode.POINT:
933
1002
  case MapDrawMode.BOX:
934
1003
  {
935
- var cleanGeoJSON = produce(geoJSONs, function (draft) {
1004
+ var _cleanGeoJSON2 = produce(geoJSONs, function (draft) {
936
1005
  draft[startOrEnd] = addFeatureProperties(geoJSONTemplate[newGeoJSONDrawMode[startOrEnd]][startOrEnd], featureStyleProperties);
937
1006
  });
938
- var intersections = createInterSections(cleanGeoJSON);
939
- setLayerGeoJSONs(intersections);
940
- if (updateCallback) updateCallback(intersections);
1007
+
1008
+ var _intersections = createInterSections(_cleanGeoJSON2);
1009
+
1010
+ setLayerGeoJSONs(_intersections);
1011
+ if (updateCallback) updateCallback(_intersections);
941
1012
  break;
942
1013
  }
943
1014
 
944
1015
  default:
945
1016
  {
946
- var cleanGeoJSON = produce(geoJSONs, function (draft) {
1017
+ var _cleanGeoJSON3 = produce(geoJSONs, function (draft) {
947
1018
  draft[startOrEnd] = addFeatureProperties(geoJSONTemplate['POLYGON'][startOrEnd], featureStyleProperties);
948
1019
  });
949
- var intersections = createInterSections(cleanGeoJSON);
950
- setLayerGeoJSONs(intersections);
951
- if (updateCallback) updateCallback(intersections);
1020
+
1021
+ var _intersections2 = createInterSections(_cleanGeoJSON3);
1022
+
1023
+ setLayerGeoJSONs(_intersections2);
1024
+ if (updateCallback) updateCallback(_intersections2);
952
1025
  break;
953
1026
  }
954
1027
  }
@@ -1081,14 +1154,51 @@ var useStyles$6 = makeStyles({
1081
1154
  }
1082
1155
  });
1083
1156
 
1157
+ /*! *****************************************************************************
1158
+ Copyright (c) Microsoft Corporation.
1159
+
1160
+ Permission to use, copy, modify, and/or distribute this software for any
1161
+ purpose with or without fee is hereby granted.
1162
+
1163
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1164
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1165
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1166
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1167
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1168
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1169
+ PERFORMANCE OF THIS SOFTWARE.
1170
+ ***************************************************************************** */
1171
+
1172
+ function __rest(s, e) {
1173
+ var t = {};
1174
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1175
+ t[p] = s[p];
1176
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1177
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1178
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1179
+ t[p[i]] = s[p[i]];
1180
+ }
1181
+ return t;
1182
+ }
1183
+
1184
+ function __awaiter(thisArg, _arguments, P, generator) {
1185
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1186
+ return new (P || (P = Promise))(function (resolve, reject) {
1187
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1188
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1189
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1190
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1191
+ });
1192
+ }
1193
+
1084
1194
  var RadioButtonAndLabel = function RadioButtonAndLabel(props) {
1085
1195
  var value = props.value,
1086
1196
  label = props.label,
1087
- _a = props.disabled,
1088
- disabled = _a === void 0 ? true : _a,
1197
+ _props$disabled = props.disabled,
1198
+ disabled = _props$disabled === void 0 ? true : _props$disabled,
1089
1199
  restProps = __rest(props, ["value", "label", "disabled"]);
1090
1200
 
1091
- return /*#__PURE__*/React__default.createElement(FormControlLabel, __assign({
1201
+ return /*#__PURE__*/React__default.createElement(FormControlLabel, Object.assign({
1092
1202
  style: {
1093
1203
  pointerEvents: 'none'
1094
1204
  },
@@ -1120,11 +1230,16 @@ var RadioButtonAndLabel = function RadioButtonAndLabel(props) {
1120
1230
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
1121
1231
  * */
1122
1232
 
1123
- var Change = function Change(_a) {
1124
- var isDisabled = _a.isDisabled,
1125
- isReadOnly = _a.isReadOnly;
1126
- var watch = useFormContext().watch;
1127
- var isRequired = useDraftFormHelpers().isRequired;
1233
+ var Change = function Change(_ref) {
1234
+ var isDisabled = _ref.isDisabled,
1235
+ isReadOnly = _ref.isReadOnly;
1236
+
1237
+ var _useFormContext = useFormContext(),
1238
+ watch = _useFormContext.watch;
1239
+
1240
+ var _useDraftFormHelpers = useDraftFormHelpers(),
1241
+ isRequired = _useDraftFormHelpers.isRequired;
1242
+
1128
1243
  var classes = useStyles$6();
1129
1244
  return /*#__PURE__*/React__default.createElement(Grid, {
1130
1245
  item: true,
@@ -1172,18 +1287,34 @@ var Change = function Change(_a) {
1172
1287
  })))));
1173
1288
  };
1174
1289
 
1290
+ /* *
1291
+ * Licensed under the Apache License, Version 2.0 (the "License");
1292
+ * you may not use this file except in compliance with the License.
1293
+ * You may obtain a copy of the License at
1294
+ *
1295
+ * http://www.apache.org/licenses/LICENSE-2.0
1296
+ *
1297
+ * Unless required by applicable law or agreed to in writing, software
1298
+ * distributed under the License is distributed on an "AS IS" BASIS,
1299
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1300
+ * See the License for the specific language governing permissions and
1301
+ * limitations under the License.
1302
+ *
1303
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
1304
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
1305
+ * */
1175
1306
  var RegionDraw = function RegionDraw(props) {
1176
- return /*#__PURE__*/React__default.createElement(SvgIcon, __assign({}, props), /*#__PURE__*/React__default.createElement("path", {
1307
+ return /*#__PURE__*/React__default.createElement(SvgIcon, Object.assign({}, props), /*#__PURE__*/React__default.createElement("path", {
1177
1308
  d: "M6,2 L6,2.999 L10,2.999 L10,2 L14,2 L14,2.999 L18,2.999 L18,2 L22,2 L22,6 L20.999,6 L20.999,10 L22,10 L22,14 L20.999,14 L20.999,18 L22,18 L22,22 L18,22 L18,20.999 L14,20.999 L14,22 L10,22 L10,20.999 L6,20.999 L6,22 L2,22 L2,18 L2.999,18 L2.999,14 L2,14 L2,10 L2.999,10 L2.999,6 L2,6 L2,2 L6,2 Z M10,4.999 L6,4.999 L6,6 L4.999,6 L4.999,10 L6,10 L6,14 L4.999,14 L4.999,18 L6,18 L6,18.999 L10,18.999 L10,18 L14,18 L14,18.999 L18,18.999 L18,18 L18.999,18 L18.999,14 L18,14 L18,10 L18.999,10 L18.999,6 L18,6 L18,4.999 L14,4.999 L14,6 L10,6 L10,4.999 Z"
1178
1309
  }));
1179
1310
  };
1180
1311
  var PolygonDraw = function PolygonDraw(props) {
1181
- return /*#__PURE__*/React__default.createElement(SvgIcon, __assign({}, props), /*#__PURE__*/React__default.createElement("path", {
1312
+ return /*#__PURE__*/React__default.createElement(SvgIcon, Object.assign({}, props), /*#__PURE__*/React__default.createElement("path", {
1182
1313
  d: "M14,1 L14,4.113 L12.0044614,2.2 L11.994,5.221 L4.039,19 L5,19 L5,23 L1,23 L1,19 L2.307,19 L10.389,5 L10,5 L10,1 L14,1 Z M13.0044614,4.62000715 L23.2887637,14.4827842 L18.3738381,14.8752125 L20.4451897,19.755011 L18.7229079,20.4860763 L16.6515563,15.6062777 L12.9550728,18.8691758 L13.0044614,4.62000715 Z"
1183
1314
  }));
1184
1315
  };
1185
1316
  var FIRDraw = function FIRDraw(props) {
1186
- return /*#__PURE__*/React__default.createElement(SvgIcon, __assign({}, props), /*#__PURE__*/React__default.createElement("g", {
1317
+ return /*#__PURE__*/React__default.createElement(SvgIcon, Object.assign({}, props), /*#__PURE__*/React__default.createElement("g", {
1187
1318
  stroke: "none",
1188
1319
  strokeWidth: "1",
1189
1320
  fill: "none",
@@ -1234,11 +1365,11 @@ var useStyles$5 = makeStyles({
1234
1365
  }
1235
1366
  });
1236
1367
 
1237
- var DrawTools = function DrawTools(_a) {
1238
- var _b = _a.type,
1239
- type = _b === void 0 ? '' : _b,
1240
- drawMode = _a.drawMode,
1241
- setDrawMode = _a.setDrawMode;
1368
+ var DrawTools = function DrawTools(_ref) {
1369
+ var _ref$type = _ref.type,
1370
+ type = _ref$type === void 0 ? '' : _ref$type,
1371
+ drawMode = _ref.drawMode,
1372
+ setDrawMode = _ref.setDrawMode;
1242
1373
  var classes = useStyles$5();
1243
1374
  return /*#__PURE__*/React__default.createElement(Grid, {
1244
1375
  item: true,
@@ -1249,7 +1380,7 @@ var DrawTools = function DrawTools(_a) {
1249
1380
  }, /*#__PURE__*/React__default.createElement(Grid, {
1250
1381
  item: true
1251
1382
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
1252
- title: "Drop a point as " + type + " position"
1383
+ title: "Drop a point as ".concat(type, " position")
1253
1384
  }, /*#__PURE__*/React__default.createElement(Radio, {
1254
1385
  icon: /*#__PURE__*/React__default.createElement(LocationOn, {
1255
1386
  className: classes.drawButtons
@@ -1266,7 +1397,7 @@ var DrawTools = function DrawTools(_a) {
1266
1397
  }))), /*#__PURE__*/React__default.createElement(Grid, {
1267
1398
  item: true
1268
1399
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
1269
- title: "Draw a box as " + type + " position"
1400
+ title: "Draw a box as ".concat(type, " position")
1270
1401
  }, /*#__PURE__*/React__default.createElement(Radio, {
1271
1402
  icon: /*#__PURE__*/React__default.createElement(RegionDraw, {
1272
1403
  className: classes.drawButtons
@@ -1282,7 +1413,7 @@ var DrawTools = function DrawTools(_a) {
1282
1413
  }))), /*#__PURE__*/React__default.createElement(Grid, {
1283
1414
  item: true
1284
1415
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
1285
- title: "Draw a shape as " + type + " position"
1416
+ title: "Draw a shape as ".concat(type, " position")
1286
1417
  }, /*#__PURE__*/React__default.createElement(Radio, {
1287
1418
  icon: /*#__PURE__*/React__default.createElement(PolygonDraw, {
1288
1419
  className: classes.drawButtons
@@ -1298,7 +1429,7 @@ var DrawTools = function DrawTools(_a) {
1298
1429
  }))), /*#__PURE__*/React__default.createElement(Grid, {
1299
1430
  item: true
1300
1431
  }, /*#__PURE__*/React__default.createElement(Tooltip, {
1301
- title: "Set FIR as " + type + " position"
1432
+ title: "Set FIR as ".concat(type, " position")
1302
1433
  }, /*#__PURE__*/React__default.createElement(Radio, {
1303
1434
  icon: /*#__PURE__*/React__default.createElement(FIRDraw, {
1304
1435
  className: classes.drawButtons
@@ -1330,30 +1461,12 @@ var DrawTools = function DrawTools(_a) {
1330
1461
  }))));
1331
1462
  };
1332
1463
 
1333
- function _typeof(obj) {
1334
- "@babel/helpers - typeof";
1335
-
1336
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
1337
- _typeof = function (obj) {
1338
- return typeof obj;
1339
- };
1340
- } else {
1341
- _typeof = function (obj) {
1342
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
1343
- };
1344
- }
1345
-
1346
- return _typeof(obj);
1347
- }
1348
-
1349
1464
  var getHoursBeforeValidity = function getHoursBeforeValidity(phenomenon, fir, config) {
1350
1465
  if (!fir) return 4;
1351
- var _a = config.firareas[fir],
1352
- hoursbeforevalidity = _a.hoursbeforevalidity,
1353
-
1354
- /* eslint-disable @typescript-eslint/naming-convention */
1355
- va_hoursbeforevalidity = _a.va_hoursbeforevalidity,
1356
- tc_hoursbeforevalidity = _a.tc_hoursbeforevalidity;
1466
+ var _config$firareas$fir = config.firareas[fir],
1467
+ hoursbeforevalidity = _config$firareas$fir.hoursbeforevalidity,
1468
+ va_hoursbeforevalidity = _config$firareas$fir.va_hoursbeforevalidity,
1469
+ tc_hoursbeforevalidity = _config$firareas$fir.tc_hoursbeforevalidity;
1357
1470
 
1358
1471
  switch (phenomenon) {
1359
1472
  // Tropical Cyclone
@@ -1370,12 +1483,10 @@ var getHoursBeforeValidity = function getHoursBeforeValidity(phenomenon, fir, co
1370
1483
  };
1371
1484
  var getMaxHoursOfValidity = function getMaxHoursOfValidity(phenomenon, fir, config) {
1372
1485
  if (!fir) return 4;
1373
- var _a = config.firareas[fir],
1374
- maxhoursofvalidity = _a.maxhoursofvalidity,
1375
-
1376
- /* eslint-disable @typescript-eslint/naming-convention */
1377
- va_maxhoursofvalidity = _a.va_maxhoursofvalidity,
1378
- tc_maxhoursofvalidity = _a.tc_maxhoursofvalidity;
1486
+ var _config$firareas$fir2 = config.firareas[fir],
1487
+ maxhoursofvalidity = _config$firareas$fir2.maxhoursofvalidity,
1488
+ va_maxhoursofvalidity = _config$firareas$fir2.va_maxhoursofvalidity,
1489
+ tc_maxhoursofvalidity = _config$firareas$fir2.tc_maxhoursofvalidity;
1379
1490
 
1380
1491
  switch (phenomenon) {
1381
1492
  // Tropical Cyclone
@@ -1506,10 +1617,8 @@ var useProductSettings = function useProductSettings(productConfig) {
1506
1617
  };
1507
1618
  });
1508
1619
  var allowedUnits = Object.keys(firData).reduce(function (list, key) {
1509
- var _a;
1510
-
1511
1620
  if (firData[key].units) {
1512
- return __assign(__assign({}, list), (_a = {}, _a[key] = firData[key].units, _a));
1621
+ return Object.assign(Object.assign({}, list), _defineProperty({}, key, firData[key].units));
1513
1622
  }
1514
1623
 
1515
1624
  return list;
@@ -1539,19 +1648,19 @@ var getDialogtitle = function getDialogtitle(product, productType) {
1539
1648
  var productName = productType.toUpperCase();
1540
1649
 
1541
1650
  if (product === null) {
1542
- return "New " + productName;
1651
+ return "New ".concat(productName);
1543
1652
  }
1544
1653
 
1545
1654
  if (!isInstanceOfCancelSigmetOrAirmet(product)) {
1546
1655
  var phenomenon = productType === 'sigmet' ? SigmetPhenomena[product.phenomenon] : AirmetPhenomena[product.phenomenon];
1547
- return productName + " " + phenomenon + " - " + (product.status === 'DRAFT' ? 'saved as draft' : ProductStatusDescription[product.status]);
1656
+ return "".concat(productName, " ").concat(phenomenon, " - ").concat(product.status === 'DRAFT' ? 'saved as draft' : ProductStatusDescription[product.status]);
1548
1657
  }
1549
1658
 
1550
1659
  if (isInstanceOfCancelSigmet(product)) {
1551
- return productName + " Cancels " + product.cancelsSigmetSequenceId;
1660
+ return "".concat(productName, " Cancels ").concat(product.cancelsSigmetSequenceId);
1552
1661
  }
1553
1662
 
1554
- return productName + " Cancels " + product.cancelsAirmetSequenceId;
1663
+ return "".concat(productName, " Cancels ").concat(product.cancelsAirmetSequenceId);
1555
1664
  };
1556
1665
  var getProductFormMode = function getProductFormMode(canBeOptions, productListItem) {
1557
1666
  if (productListItem === null) return 'new';
@@ -1604,22 +1713,20 @@ var hasValue = function hasValue(value) {
1604
1713
  };
1605
1714
  var removeEmptyNumberFieldValues = function removeEmptyNumberFieldValues(product) {
1606
1715
  return Object.keys(product).reduce(function (list, key) {
1607
- var _a, _b;
1608
-
1609
1716
  var value = product[key]; // check if nested object has value
1610
1717
 
1611
1718
  if (_typeof(value) === 'object' && value !== null && value !== undefined) {
1612
1719
  var hasNaNValue = Object.keys(value).reduce(function (total, valKey) {
1613
1720
  return !hasValue(value[valKey]) || total;
1614
1721
  }, false);
1615
- return __assign(__assign({}, list), !hasNaNValue && (_a = {}, _a[key] = value, _a));
1722
+ return Object.assign(Object.assign({}, list), !hasNaNValue && _defineProperty({}, key, value));
1616
1723
  }
1617
1724
 
1618
- return __assign(__assign({}, list), hasValue(value) && (_b = {}, _b[key] = value, _b));
1725
+ return Object.assign(Object.assign({}, list), hasValue(value) && _defineProperty({}, key, value));
1619
1726
  }, {});
1620
1727
  };
1621
1728
  var createSigmetPostParameter = function createSigmetPostParameter(sigmetToPost, newStatus, previousUuid) {
1622
- var sigmetIncludingUuid = previousUuid !== null ? __assign(__assign({}, sigmetToPost), {
1729
+ var sigmetIncludingUuid = previousUuid !== null ? Object.assign(Object.assign({}, sigmetToPost), {
1623
1730
  uuid: previousUuid
1624
1731
  }) : sigmetToPost; // Do not send empty numbered fields to the BE to prevent errors
1625
1732
 
@@ -1630,7 +1737,7 @@ var createSigmetPostParameter = function createSigmetPostParameter(sigmetToPost,
1630
1737
  };
1631
1738
  };
1632
1739
  var createAirmetPostParameter = function createAirmetPostParameter(airmetToPost, newStatus, previousUuid) {
1633
- var airmetIncludingUuid = previousUuid !== null ? __assign(__assign({}, airmetToPost), {
1740
+ var airmetIncludingUuid = previousUuid !== null ? Object.assign(Object.assign({}, airmetToPost), {
1634
1741
  uuid: previousUuid
1635
1742
  }) : airmetToPost; // Do not send empty numbered fields to the BE to prevent errors
1636
1743
 
@@ -1642,24 +1749,24 @@ var createAirmetPostParameter = function createAirmetPostParameter(airmetToPost,
1642
1749
  };
1643
1750
  var getConfirmationDialogTitle = function getConfirmationDialogTitle(action, productType) {
1644
1751
  var product = productType.toUpperCase();
1645
- if (action === 'CLOSED') return "Close " + product;
1646
- if (action === 'DISCARDED') return "Discard " + product;
1752
+ if (action === 'CLOSED') return "Close ".concat(product);
1753
+ if (action === 'DISCARDED') return "Discard ".concat(product);
1647
1754
  if (action === 'PUBLISHED') return 'Publish';
1648
- return "Cancel " + product;
1755
+ return "Cancel ".concat(product);
1649
1756
  };
1650
1757
  var getConfirmationDialogContent = function getConfirmationDialogContent(action, productType) {
1651
1758
  var product = productType.toUpperCase();
1652
- if (action === 'DISCARDED') return "Are you sure you would like to discard this " + product + "? Its properties will be lost";
1759
+ if (action === 'DISCARDED') return "Are you sure you would like to discard this ".concat(product, "? Its properties will be lost");
1653
1760
  if (action === 'CLOSED') return 'Do you want to save any changes made?';
1654
- if (action === 'PUBLISHED') return "Are you sure you want to publish this " + product + "?";
1655
- return "Are you sure you want to cancel this " + product + "?";
1761
+ if (action === 'PUBLISHED') return "Are you sure you want to publish this ".concat(product, "?");
1762
+ return "Are you sure you want to cancel this ".concat(product, "?");
1656
1763
  };
1657
1764
  var getConfirmationDialogButtonLabel = function getConfirmationDialogButtonLabel(action, productType) {
1658
1765
  var product = productType.toUpperCase();
1659
1766
 
1660
1767
  switch (action) {
1661
1768
  case 'DISCARDED':
1662
- return "Discard " + product;
1769
+ return "Discard ".concat(product);
1663
1770
 
1664
1771
  case 'PUBLISHED':
1665
1772
  return 'Publish';
@@ -1682,11 +1789,11 @@ var getConfirmationDialogCancelLabel = function getConfirmationDialogCancelLabel
1682
1789
  };
1683
1790
  var getProductIssueDate = function getProductIssueDate(initialProduct, initialCancelProduct) {
1684
1791
  if (initialProduct !== null && (initialProduct.status === 'PUBLISHED' || initialProduct.status === 'EXPIRED') && initialProduct.issueDate) {
1685
- return moment.utc(initialProduct.issueDate).format('YYYY/MM/DD HH:mm') + " UTC";
1792
+ return "".concat(moment.utc(initialProduct.issueDate).format('YYYY/MM/DD HH:mm'), " UTC");
1686
1793
  }
1687
1794
 
1688
1795
  if (initialCancelProduct !== null && initialCancelProduct.issueDate) {
1689
- return moment.utc(initialCancelProduct.issueDate).format('YYYY/MM/DD HH:mm') + " UTC";
1796
+ return "".concat(moment.utc(initialCancelProduct.issueDate).format('YYYY/MM/DD HH:mm'), " UTC");
1690
1797
  }
1691
1798
 
1692
1799
  return '(Not published)';
@@ -1694,12 +1801,10 @@ var getProductIssueDate = function getProductIssueDate(initialProduct, initialCa
1694
1801
 
1695
1802
  var extractUnitsToShow = function extractUnitsToShow(allowedUnits, unitType) {
1696
1803
  return Object.keys(allowedUnits).reduce(function (list, key) {
1697
- var _a;
1698
-
1699
1804
  var unit = allowedUnits[key];
1700
1805
 
1701
1806
  if (unitType[unit]) {
1702
- return __assign(__assign({}, list), (_a = {}, _a[unit] = unitType[unit], _a));
1807
+ return Object.assign(Object.assign({}, list), _defineProperty({}, unit, unitType[unit]));
1703
1808
  }
1704
1809
 
1705
1810
  return list;
@@ -1858,27 +1963,32 @@ var _validateLevelUnitCombinations = function validateLevelUnitCombinations(leve
1858
1963
  return true;
1859
1964
  };
1860
1965
 
1861
- var Levels = function Levels(_a) {
1862
- var isDisabled = _a.isDisabled,
1863
- isReadOnly = _a.isReadOnly,
1864
- _b = _a.onChange,
1865
- _onChange = _b === void 0 ? function () {
1966
+ var Levels = function Levels(_ref) {
1967
+ var isDisabled = _ref.isDisabled,
1968
+ isReadOnly = _ref.isReadOnly,
1969
+ _ref$onChange = _ref.onChange,
1970
+ _onChange = _ref$onChange === void 0 ? function () {
1866
1971
  return null;
1867
- } : _b,
1868
- productType = _a.productType;
1869
-
1870
- var _c = useFormContext(),
1871
- watch = _c.watch,
1872
- setValue = _c.setValue,
1873
- trigger = _c.trigger,
1874
- getValues = _c.getValues,
1875
- reset = _c.reset,
1876
- clearErrors = _c.clearErrors;
1877
-
1878
- var isRequired = useDraftFormHelpers().isRequired;
1972
+ } : _ref$onChange,
1973
+ productType = _ref.productType;
1974
+
1975
+ var _useFormContext = useFormContext(),
1976
+ watch = _useFormContext.watch,
1977
+ setValue = _useFormContext.setValue,
1978
+ trigger = _useFormContext.trigger,
1979
+ getValues = _useFormContext.getValues,
1980
+ reset = _useFormContext.reset,
1981
+ clearErrors = _useFormContext.clearErrors;
1982
+
1983
+ var _useDraftFormHelpers = useDraftFormHelpers(),
1984
+ isRequired = _useDraftFormHelpers.isRequired;
1985
+
1879
1986
  var classes = useStyles$6();
1880
1987
  var config = productType === 'sigmet' ? sigmetConfig : airmetConfig;
1881
- var allowedUnits = useProductSettings(config).allowedUnits;
1988
+
1989
+ var _useProductSettings = useProductSettings(config),
1990
+ allowedUnits = _useProductSettings.allowedUnits;
1991
+
1882
1992
  var selectedFIR = watch('locationIndicatorATSR'); // Get allowed level units based on selected FIR - if no FIR selected, allow all default units
1883
1993
 
1884
1994
  var allowedLevelUnitsForFir = getAllowedUnits(selectedFIR, allowedUnits, 'level_unit', LevelUnits);
@@ -1913,7 +2023,7 @@ var Levels = function Levels(_a) {
1913
2023
  onChange: function onChange() {
1914
2024
  // Reset default value for the level value to '' so when it rerenders it uses this empty default value
1915
2025
  var currentValues = getValues();
1916
- reset(__assign(__assign({}, currentValues), {
2026
+ reset(Object.assign(Object.assign({}, currentValues), {
1917
2027
  level: {
1918
2028
  unit: 'FL',
1919
2029
  value: ''
@@ -1993,16 +2103,19 @@ var Levels = function Levels(_a) {
1993
2103
  isRequired: isRequired,
1994
2104
  isInteger: isInteger,
1995
2105
  max: function max(value) {
1996
- // The max level depends on the unit
1997
- return isValidMax(value, getMaxLevelValue(getValues('level.unit'), productType)) || "The maximum level in " + LevelUnits[getValues('level.unit')] + " is " + getMaxLevelValue(getValues('level.unit'), productType);
2106
+ return (// The max level depends on the unit
2107
+ isValidMax(value, getMaxLevelValue(getValues('level.unit'), productType)) || "The maximum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMaxLevelValue(getValues('level.unit'), productType))
2108
+ );
1998
2109
  },
1999
2110
  min: function min(value) {
2000
- // The min level depends on the unit
2001
- return isValidMin(value, getMinLevelValue(getValues('level.unit'))) || "The minimum level in " + LevelUnits[getValues('level.unit')] + " is " + getMinLevelValue(getValues('level.unit'));
2111
+ return (// The min level depends on the unit
2112
+ isValidMin(value, getMinLevelValue(getValues('level.unit'))) || "The minimum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMinLevelValue(getValues('level.unit')))
2113
+ );
2002
2114
  },
2003
2115
  validateLevels: function validateLevels(value) {
2004
- // level step depends on the unit
2005
- return _validateLevels(value, getValues('level.unit'));
2116
+ return (// level step depends on the unit
2117
+ _validateLevels(value, getValues('level.unit'))
2118
+ );
2006
2119
  }
2007
2120
  }
2008
2121
  },
@@ -2031,8 +2144,9 @@ var Levels = function Levels(_a) {
2031
2144
  validate: {
2032
2145
  isRequired: isRequired,
2033
2146
  validateLevelUnitCombinations: function validateLevelUnitCombinations(value) {
2034
- // level step depends on the unit
2035
- return _validateLevelUnitCombinations(value, watch('levelInfoMode') === 'BETW_SFC' ? 'SFC' : getValues('lowerLevel.unit')) === true;
2147
+ return (// level step depends on the unit
2148
+ _validateLevelUnitCombinations(value, watch('levelInfoMode') === 'BETW_SFC' ? 'SFC' : getValues('lowerLevel.unit')) === true
2149
+ );
2036
2150
  }
2037
2151
  }
2038
2152
  },
@@ -2040,7 +2154,7 @@ var Levels = function Levels(_a) {
2040
2154
  disabled: isDisabled,
2041
2155
  defaultValue: 'FL',
2042
2156
  onChange: function onChange() {
2043
- trigger(__spreadArray(__spreadArray(__spreadArray([], __read(getValues('level.value') || getValues('level.value') === 0 ? ['level.value'] : [])), __read(getValues('lowerLevel.value') || getValues('lowerLevel.value') === 0 ? ['lowerLevel.value'] : [])), ['lowerLevel.unit']));
2157
+ trigger([].concat(_toConsumableArray(getValues('level.value') || getValues('level.value') === 0 ? ['level.value'] : []), _toConsumableArray(getValues('lowerLevel.value') || getValues('lowerLevel.value') === 0 ? ['lowerLevel.value'] : []), ['lowerLevel.unit']));
2044
2158
 
2045
2159
  _onChange();
2046
2160
  }
@@ -2061,16 +2175,19 @@ var Levels = function Levels(_a) {
2061
2175
  isRequired: isRequired,
2062
2176
  isInteger: isInteger,
2063
2177
  max: function max(value) {
2064
- // The max level depends on the unit
2065
- return isValidMax(value, getMaxLevelValue(getValues('level.unit'), productType)) || "The maximum level in " + LevelUnits[getValues('level.unit')] + " is " + getMaxLevelValue(getValues('level.unit'), productType);
2178
+ return (// The max level depends on the unit
2179
+ isValidMax(value, getMaxLevelValue(getValues('level.unit'), productType)) || "The maximum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMaxLevelValue(getValues('level.unit'), productType))
2180
+ );
2066
2181
  },
2067
2182
  min: function min(value) {
2068
- // The min level depends on the unit
2069
- return isValidMin(value, getMinLevelValue(getValues('level.unit'))) || "The minimum level in " + LevelUnits[getValues('level.unit')] + " is " + getMinLevelValue(getValues('level.unit'));
2183
+ return (// The min level depends on the unit
2184
+ isValidMin(value, getMinLevelValue(getValues('level.unit'))) || "The minimum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMinLevelValue(getValues('level.unit')))
2185
+ );
2070
2186
  },
2071
2187
  validateLevels: function validateLevels(value) {
2072
- // level step depends on the unit
2073
- return _validateLevels(value, getValues('level.unit'));
2188
+ return (// level step depends on the unit
2189
+ _validateLevels(value, getValues('level.unit'))
2190
+ );
2074
2191
  }
2075
2192
  }
2076
2193
  },
@@ -2111,8 +2228,9 @@ var Levels = function Levels(_a) {
2111
2228
  validate: {
2112
2229
  isRequired: isRequired,
2113
2230
  validateLevelUnitCombinations: function validateLevelUnitCombinations(value) {
2114
- // level step depends on the unit
2115
- return _validateLevelUnitCombinations(getValues('level.unit'), value);
2231
+ return (// level step depends on the unit
2232
+ _validateLevelUnitCombinations(getValues('level.unit'), value)
2233
+ );
2116
2234
  }
2117
2235
  }
2118
2236
  },
@@ -2144,20 +2262,24 @@ var Levels = function Levels(_a) {
2144
2262
  isRequired: isRequired,
2145
2263
  isInteger: isInteger,
2146
2264
  max: function max(value) {
2147
- // The max level depends on the unit
2148
- return isValidMax(value, getMaxLevelValue(getValues('lowerLevel.unit'), productType)) || "The maximum level in " + LevelUnits[getValues('lowerLevel.unit')] + " is " + getMaxLevelValue(getValues('lowerLevel.unit'), productType);
2265
+ return (// The max level depends on the unit
2266
+ isValidMax(value, getMaxLevelValue(getValues('lowerLevel.unit'), productType)) || "The maximum level in ".concat(LevelUnits[getValues('lowerLevel.unit')], " is ").concat(getMaxLevelValue(getValues('lowerLevel.unit'), productType))
2267
+ );
2149
2268
  },
2150
2269
  min: function min(value) {
2151
- // The min level depends on the unit
2152
- return isValidMin(value, getMinLevelValue(getValues('lowerLevel.unit'))) || "The minimum level in " + LevelUnits[getValues('lowerLevel.unit')] + " is " + getMinLevelValue(getValues('lowerLevel.unit'));
2270
+ return (// The min level depends on the unit
2271
+ isValidMin(value, getMinLevelValue(getValues('lowerLevel.unit'))) || "The minimum level in ".concat(LevelUnits[getValues('lowerLevel.unit')], " is ").concat(getMinLevelValue(getValues('lowerLevel.unit')))
2272
+ );
2153
2273
  },
2154
2274
  isLevelLower: function isLevelLower$1(value) {
2155
- // The lower level needs to be smaller than upper level
2156
- return isLevelLower(value, getValues('lowerLevel.unit'), getValues('level.value'), getValues('level.unit'));
2275
+ return (// The lower level needs to be smaller than upper level
2276
+ isLevelLower(value, getValues('lowerLevel.unit'), getValues('level.value'), getValues('level.unit'))
2277
+ );
2157
2278
  },
2158
2279
  validateLevels: function validateLevels(value) {
2159
- // level step depends on the unit
2160
- return _validateLevels(value, getValues('lowerLevel.unit'));
2280
+ return (// level step depends on the unit
2281
+ _validateLevels(value, getValues('lowerLevel.unit'))
2282
+ );
2161
2283
  }
2162
2284
  }
2163
2285
  },
@@ -2224,16 +2346,19 @@ var Levels = function Levels(_a) {
2224
2346
  isRequired: isRequired,
2225
2347
  isInteger: isInteger,
2226
2348
  max: function max(value) {
2227
- // The max level depends on the unit
2228
- return isValidMax(value, getMaxLevelValue(getValues('level.unit'), productType)) || "The maximum level in " + LevelUnits[getValues('level.unit')] + " is " + getMaxLevelValue(getValues('level.unit'), productType);
2349
+ return (// The max level depends on the unit
2350
+ isValidMax(value, getMaxLevelValue(getValues('level.unit'), productType)) || "The maximum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMaxLevelValue(getValues('level.unit'), productType))
2351
+ );
2229
2352
  },
2230
2353
  min: function min(value) {
2231
- // The min level depends on the unit
2232
- return isValidMin(value, getMinLevelValue(getValues('level.unit'))) || "The minimum level in " + LevelUnits[getValues('level.unit')] + " is " + getMinLevelValue(getValues('level.unit'));
2354
+ return (// The min level depends on the unit
2355
+ isValidMin(value, getMinLevelValue(getValues('level.unit'))) || "The minimum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMinLevelValue(getValues('level.unit')))
2356
+ );
2233
2357
  },
2234
2358
  validateLevels: function validateLevels(value) {
2235
- // level step depends on the unit
2236
- return _validateLevels(value, getValues('level.unit'));
2359
+ return (// level step depends on the unit
2360
+ _validateLevels(value, getValues('level.unit'))
2361
+ );
2237
2362
  }
2238
2363
  }
2239
2364
  },
@@ -2259,16 +2384,18 @@ var Levels = function Levels(_a) {
2259
2384
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2260
2385
  * */
2261
2386
 
2262
- var ObservationForecast = function ObservationForecast(_a) {
2263
- var isDisabled = _a.isDisabled,
2264
- isReadOnly = _a.isReadOnly;
2387
+ var ObservationForecast = function ObservationForecast(_ref) {
2388
+ var isDisabled = _ref.isDisabled,
2389
+ isReadOnly = _ref.isReadOnly;
2390
+
2391
+ var _useFormContext = useFormContext(),
2392
+ watch = _useFormContext.watch,
2393
+ trigger = _useFormContext.trigger,
2394
+ getValues = _useFormContext.getValues;
2265
2395
 
2266
- var _b = useFormContext(),
2267
- watch = _b.watch,
2268
- trigger = _b.trigger,
2269
- getValues = _b.getValues;
2396
+ var _useDraftFormHelpers = useDraftFormHelpers(),
2397
+ isRequired = _useDraftFormHelpers.isRequired;
2270
2398
 
2271
- var isRequired = useDraftFormHelpers().isRequired;
2272
2399
  return /*#__PURE__*/React__default.createElement(Grid, {
2273
2400
  item: true,
2274
2401
  container: true,
@@ -2327,15 +2454,18 @@ var ObservationForecast = function ObservationForecast(_a) {
2327
2454
  * */
2328
2455
  var ForecastTimeValidation = 'Forecast time should lie between the valid start and valid end time';
2329
2456
 
2330
- var ObservationForecastTime = function ObservationForecastTime(_a) {
2331
- var isDisabled = _a.isDisabled,
2332
- isReadOnly = _a.isReadOnly,
2333
- helperText = _a.helperText,
2334
- _b = _a.onChange,
2335
- onChange = _b === void 0 ? function () {
2457
+ var ObservationForecastTime = function ObservationForecastTime(_ref) {
2458
+ var isDisabled = _ref.isDisabled,
2459
+ isReadOnly = _ref.isReadOnly,
2460
+ helperText = _ref.helperText,
2461
+ _ref$onChange = _ref.onChange,
2462
+ onChange = _ref$onChange === void 0 ? function () {
2336
2463
  return null;
2337
- } : _b;
2338
- var watch = useFormContext().watch;
2464
+ } : _ref$onChange;
2465
+
2466
+ var _useFormContext = useFormContext(),
2467
+ watch = _useFormContext.watch;
2468
+
2339
2469
  var classes = useStyles$6();
2340
2470
  return (!isReadOnly || watch('observationOrForecastTime') !== null) && /*#__PURE__*/React__default.createElement(Grid, {
2341
2471
  item: true,
@@ -2375,18 +2505,18 @@ var ObservationForecastTime = function ObservationForecastTime(_a) {
2375
2505
  })));
2376
2506
  };
2377
2507
 
2378
- var Phenomenon = function Phenomenon(_a) {
2379
- var productType = _a.productType,
2380
- isDisabled = _a.isDisabled,
2381
- _b = _a.onChange,
2382
- _onChange = _b === void 0 ? function () {
2508
+ var Phenomenon = function Phenomenon(_ref) {
2509
+ var productType = _ref.productType,
2510
+ isDisabled = _ref.isDisabled,
2511
+ _ref$onChange = _ref.onChange,
2512
+ _onChange = _ref$onChange === void 0 ? function () {
2383
2513
  return null;
2384
- } : _b;
2514
+ } : _ref$onChange;
2385
2515
 
2386
- var _c = useFormContext(),
2387
- getValues = _c.getValues,
2388
- setValue = _c.setValue,
2389
- trigger = _c.trigger;
2516
+ var _useFormContext = useFormContext(),
2517
+ getValues = _useFormContext.getValues,
2518
+ setValue = _useFormContext.setValue,
2519
+ trigger = _useFormContext.trigger;
2390
2520
 
2391
2521
  var classes = useStyles$6();
2392
2522
  var phenomenaList = productType === 'sigmet' ? SigmetPhenomena : AirmetPhenomena;
@@ -2433,7 +2563,7 @@ var Phenomenon = function Phenomenon(_a) {
2433
2563
 
2434
2564
  _onChange();
2435
2565
 
2436
- return trigger(__spreadArray(__spreadArray([], __read(getValues('validDateStart') ? ['validDateStart'] : [])), __read(getValues('validDateEnd') ? ['validDateEnd'] : [])));
2566
+ return trigger([].concat(_toConsumableArray(getValues('validDateStart') ? ['validDateStart'] : []), _toConsumableArray(getValues('validDateEnd') ? ['validDateEnd'] : [])));
2437
2567
  },
2438
2568
  autoFocus: true
2439
2569
  }, Object.keys(phenomenaList).map(function (key) {
@@ -2466,19 +2596,21 @@ var exitDrawModeMessage = 'Press ESC to exit draw mode';
2466
2596
  var maxFeaturePointsMessage = 'Intersection of the drawn polygon with the FIR-boundary has more than 6 individual points. Check if the TAC in the preview corresponds to the intended area.';
2467
2597
  var multiIntersectionsMessage = 'The drawn polygon has multiple intersections with the FIR-boundary. The drawn polygon will be used for the TAC-code.';
2468
2598
 
2469
- var StartGeometry = function StartGeometry(_a) {
2470
- var _b = _a.isReadOnly,
2471
- isReadOnly = _b === void 0 ? false : _b,
2472
- drawMode = _a.drawMode,
2473
- geoJSONs = _a.geoJSONs,
2474
- setDrawModeType = _a.setDrawModeType;
2599
+ var StartGeometry = function StartGeometry(_ref) {
2600
+ var _ref$isReadOnly = _ref.isReadOnly,
2601
+ isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
2602
+ drawMode = _ref.drawMode,
2603
+ geoJSONs = _ref.geoJSONs,
2604
+ setDrawModeType = _ref.setDrawModeType;
2475
2605
  var classes = useStyles$6();
2476
2606
 
2477
- var _c = useFormContext(),
2478
- errors = _c.errors,
2479
- watch = _c.watch;
2607
+ var _useFormContext = useFormContext(),
2608
+ errors = _useFormContext.errors,
2609
+ watch = _useFormContext.watch;
2610
+
2611
+ var _useDraftFormHelpers = useDraftFormHelpers(),
2612
+ isDraft = _useDraftFormHelpers.isDraft;
2480
2613
 
2481
- var isDraft = useDraftFormHelpers().isDraft;
2482
2614
  return !isReadOnly && /*#__PURE__*/React__default.createElement(Grid, {
2483
2615
  item: true,
2484
2616
  container: true,
@@ -2598,34 +2730,37 @@ var getMinMovementSpeedValue = function getMinMovementSpeedValue(unit) {
2598
2730
  }
2599
2731
  };
2600
2732
 
2601
- var Progress = function Progress(_a) {
2602
- var productType = _a.productType,
2603
- drawMode = _a.drawMode,
2604
- _b = _a.isDisabled,
2605
- isDisabled = _b === void 0 ? false : _b,
2606
- _c = _a.isReadOnly,
2607
- isReadOnly = _c === void 0 ? false : _c,
2608
- geoJSONs = _a.geoJSONs,
2609
- setDrawModeType = _a.setDrawModeType,
2610
- _d = _a.onChange,
2611
- _onChange = _d === void 0 ? function () {
2733
+ var Progress = function Progress(_ref) {
2734
+ var productType = _ref.productType,
2735
+ drawMode = _ref.drawMode,
2736
+ _ref$isDisabled = _ref.isDisabled,
2737
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
2738
+ _ref$isReadOnly = _ref.isReadOnly,
2739
+ isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
2740
+ geoJSONs = _ref.geoJSONs,
2741
+ setDrawModeType = _ref.setDrawModeType,
2742
+ _ref$onChange = _ref.onChange,
2743
+ _onChange = _ref$onChange === void 0 ? function () {
2612
2744
  return null;
2613
- } : _d;
2745
+ } : _ref$onChange;
2614
2746
 
2615
2747
  var classes = useStyles$6();
2616
2748
 
2617
- var _e = useFormContext(),
2618
- watch = _e.watch,
2619
- getValues = _e.getValues,
2620
- trigger = _e.trigger,
2621
- errors = _e.errors;
2749
+ var _useFormContext = useFormContext(),
2750
+ watch = _useFormContext.watch,
2751
+ getValues = _useFormContext.getValues,
2752
+ trigger = _useFormContext.trigger,
2753
+ errors = _useFormContext.errors;
2622
2754
 
2623
- var _f = useDraftFormHelpers(),
2624
- isRequired = _f.isRequired,
2625
- isDraft = _f.isDraft;
2755
+ var _useDraftFormHelpers = useDraftFormHelpers(),
2756
+ isRequired = _useDraftFormHelpers.isRequired,
2757
+ isDraft = _useDraftFormHelpers.isDraft;
2626
2758
 
2627
2759
  var config = productType === 'sigmet' ? sigmetConfig : airmetConfig;
2628
- var allowedUnits = useProductSettings(config).allowedUnits;
2760
+
2761
+ var _useProductSettings = useProductSettings(config),
2762
+ allowedUnits = _useProductSettings.allowedUnits;
2763
+
2629
2764
  var movementType = watch('movementType');
2630
2765
  var selectedFIR = watch('locationIndicatorATSR'); // Get allowed movement units based on selected FIR - if no FIR selected, allow all units
2631
2766
 
@@ -2741,16 +2876,19 @@ var Progress = function Progress(_a) {
2741
2876
  isRequired: isRequired,
2742
2877
  isInteger: isInteger,
2743
2878
  min: function min(value) {
2744
- // The max level depends on the unit
2745
- return isValidMin(value, getMinMovementSpeedValue(getValues('movementUnit'))) || "The minimum level in " + MovementUnit[getValues('movementUnit')] + " is " + getMinMovementSpeedValue(getValues('movementUnit'));
2879
+ return (// The max level depends on the unit
2880
+ isValidMin(value, getMinMovementSpeedValue(getValues('movementUnit'))) || "The minimum level in ".concat(MovementUnit[getValues('movementUnit')], " is ").concat(getMinMovementSpeedValue(getValues('movementUnit')))
2881
+ );
2746
2882
  },
2747
2883
  max: function max(value) {
2748
- // The max level depends on the unit
2749
- return isValidMax(value, getMaxMovementSpeedValue(getValues('movementUnit'))) || "The maximum level in " + MovementUnit[getValues('movementUnit')] + " is " + getMaxMovementSpeedValue(getValues('movementUnit'));
2884
+ return (// The max level depends on the unit
2885
+ isValidMax(value, getMaxMovementSpeedValue(getValues('movementUnit'))) || "The maximum level in ".concat(MovementUnit[getValues('movementUnit')], " is ").concat(getMaxMovementSpeedValue(getValues('movementUnit')))
2886
+ );
2750
2887
  },
2751
2888
  validateMovementSteps: function validateMovementSteps(value) {
2752
- // movement step depends on the unit
2753
- return _validateMovementSteps(value, getValues('movementUnit'));
2889
+ return (// movement step depends on the unit
2890
+ _validateMovementSteps(value, getValues('movementUnit'))
2891
+ );
2754
2892
  }
2755
2893
  }
2756
2894
  },
@@ -2828,18 +2966,23 @@ var Progress = function Progress(_a) {
2828
2966
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2829
2967
  * */
2830
2968
 
2831
- var SelectFIR = function SelectFIR(_a) {
2832
- var productType = _a.productType,
2833
- isDisabled = _a.isDisabled;
2969
+ var SelectFIR = function SelectFIR(_ref) {
2970
+ var productType = _ref.productType,
2971
+ isDisabled = _ref.isDisabled;
2834
2972
  var classes = useStyles$6();
2835
- var setValue = useFormContext().setValue;
2836
- var isRequired = useDraftFormHelpers().isRequired;
2973
+
2974
+ var _useFormContext = useFormContext(),
2975
+ setValue = _useFormContext.setValue;
2976
+
2977
+ var _useDraftFormHelpers = useDraftFormHelpers(),
2978
+ isRequired = _useDraftFormHelpers.isRequired;
2979
+
2837
2980
  var config = productType === 'sigmet' ? sigmetConfig : airmetConfig;
2838
2981
 
2839
- var _b = useProductSettings(config),
2840
- defaultATSR = _b.defaultATSR,
2841
- optionsFIR = _b.optionsFIR,
2842
- allFIRS = _b.allFIRS;
2982
+ var _useProductSettings = useProductSettings(config),
2983
+ defaultATSR = _useProductSettings.defaultATSR,
2984
+ optionsFIR = _useProductSettings.optionsFIR,
2985
+ allFIRS = _useProductSettings.allFIRS;
2843
2986
 
2844
2987
  return /*#__PURE__*/React__default.createElement(Grid, {
2845
2988
  item: true,
@@ -2874,7 +3017,7 @@ var SelectFIR = function SelectFIR(_a) {
2874
3017
  }
2875
3018
  }, optionsFIR.map(function (fir) {
2876
3019
  return /*#__PURE__*/React__default.createElement(MenuItem, {
2877
- key: fir.ATSR + "-" + fir.FIR,
3020
+ key: "".concat(fir.ATSR, "-").concat(fir.FIR),
2878
3021
  value: fir.ATSR
2879
3022
  }, fir.FIR);
2880
3023
  })), /*#__PURE__*/React__default.createElement(ReactHookFormHiddenInput, {
@@ -2909,11 +3052,16 @@ var SelectFIR = function SelectFIR(_a) {
2909
3052
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
2910
3053
  * */
2911
3054
 
2912
- var Type = function Type(_a) {
2913
- var isReadOnly = _a.isReadOnly,
2914
- isDisabled = _a.isDisabled;
2915
- var watch = useFormContext().watch;
2916
- var isRequired = useDraftFormHelpers().isRequired;
3055
+ var Type = function Type(_ref) {
3056
+ var isReadOnly = _ref.isReadOnly,
3057
+ isDisabled = _ref.isDisabled;
3058
+
3059
+ var _useFormContext = useFormContext(),
3060
+ watch = _useFormContext.watch;
3061
+
3062
+ var _useDraftFormHelpers = useDraftFormHelpers(),
3063
+ isRequired = _useDraftFormHelpers.isRequired;
3064
+
2917
3065
  var classes = useStyles$6();
2918
3066
  return /*#__PURE__*/React__default.createElement(Grid, {
2919
3067
  item: true,
@@ -2980,20 +3128,23 @@ var Type = function Type(_a) {
2980
3128
  * */
2981
3129
  var VALID_FROM_TIME_DELAY_IN_MINUTES = 30;
2982
3130
 
2983
- var ValidFrom = function ValidFrom(_a) {
2984
- var productType = _a.productType,
2985
- isDisabled = _a.isDisabled,
2986
- _b = _a.onChange,
2987
- _onChange = _b === void 0 ? function () {
3131
+ var ValidFrom = function ValidFrom(_ref) {
3132
+ var productType = _ref.productType,
3133
+ isDisabled = _ref.isDisabled,
3134
+ _ref$onChange = _ref.onChange,
3135
+ _onChange = _ref$onChange === void 0 ? function () {
2988
3136
  return null;
2989
- } : _b;
3137
+ } : _ref$onChange;
2990
3138
 
2991
- var _c = useFormContext(),
2992
- getValues = _c.getValues,
2993
- trigger = _c.trigger;
3139
+ var _useFormContext = useFormContext(),
3140
+ getValues = _useFormContext.getValues,
3141
+ trigger = _useFormContext.trigger;
2994
3142
 
2995
3143
  var classes = useStyles$6();
2996
- var isRequired = useDraftFormHelpers().isRequired;
3144
+
3145
+ var _useDraftFormHelpers = useDraftFormHelpers(),
3146
+ isRequired = _useDraftFormHelpers.isRequired;
3147
+
2997
3148
  var config = productType === 'sigmet' ? sigmetConfig : airmetConfig;
2998
3149
  return /*#__PURE__*/React__default.createElement(Grid, {
2999
3150
  item: true,
@@ -3026,7 +3177,7 @@ var ValidFrom = function ValidFrom(_a) {
3026
3177
  },
3027
3178
  // The current time can be no more than 4 hours before the validity start (12 for VA/TC SIGMET)
3028
3179
  isCurrentTimeXHoursBeforeValue: function isCurrentTimeXHoursBeforeValue(value) {
3029
- return isXHoursBefore(moment.utc().format(), value, getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), config)) || "Valid from time can be no more than " + getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), config) + " hours after current time";
3180
+ return isXHoursBefore(moment.utc().format(), value, getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), config)) || "Valid from time can be no more than ".concat(getHoursBeforeValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), config), " hours after current time");
3030
3181
  }
3031
3182
  }
3032
3183
  },
@@ -3065,23 +3216,30 @@ var ValidFrom = function ValidFrom(_a) {
3065
3216
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
3066
3217
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
3067
3218
  * */
3219
+ var DEFAULT_VALID_TIME_SIGMET = 3;
3220
+ var DEFAULT_VALID_TIME_AIRMET = 1;
3221
+ var getDefaultHoursValid = function getDefaultHoursValid(productType) {
3222
+ return productType === 'sigmet' ? DEFAULT_VALID_TIME_SIGMET : DEFAULT_VALID_TIME_AIRMET;
3223
+ };
3068
3224
 
3069
- var ValidUntil = function ValidUntil(_a) {
3070
- var productType = _a.productType,
3071
- isDisabled = _a.isDisabled,
3072
- _b = _a.onChange,
3073
- _onChange = _b === void 0 ? function () {
3225
+ var ValidUntil = function ValidUntil(_ref) {
3226
+ var productType = _ref.productType,
3227
+ isDisabled = _ref.isDisabled,
3228
+ _ref$onChange = _ref.onChange,
3229
+ _onChange = _ref$onChange === void 0 ? function () {
3074
3230
  return null;
3075
- } : _b;
3231
+ } : _ref$onChange;
3232
+
3233
+ var _useFormContext = useFormContext(),
3234
+ getValues = _useFormContext.getValues,
3235
+ trigger = _useFormContext.trigger;
3076
3236
 
3077
- var _c = useFormContext(),
3078
- getValues = _c.getValues,
3079
- trigger = _c.trigger;
3237
+ var _useDraftFormHelpers = useDraftFormHelpers(),
3238
+ isRequired = _useDraftFormHelpers.isRequired;
3080
3239
 
3081
- var isRequired = useDraftFormHelpers().isRequired;
3082
3240
  var classes = useStyles$6();
3083
3241
  var config = productType === 'sigmet' ? sigmetConfig : airmetConfig;
3084
- var defaultHoursValid = productType === 'sigmet' ? 3 : 1;
3242
+ var defaultHoursValid = getDefaultHoursValid(productType);
3085
3243
  return /*#__PURE__*/React__default.createElement(Grid, {
3086
3244
  item: true,
3087
3245
  container: true,
@@ -3113,7 +3271,7 @@ var ValidUntil = function ValidUntil(_a) {
3113
3271
  },
3114
3272
  // Validity end can be no more than 4 hours after validity start (6 for VA/TC SIGMET)
3115
3273
  isXHoursAfter: function isXHoursAfter$1(value) {
3116
- return isXHoursAfter(value, getValues('validDateStart'), getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), config)) || "Valid until time can be no more than " + getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), config) + " hours after Valid from time";
3274
+ return isXHoursAfter(value, getValues('validDateStart'), getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), config)) || "Valid until time can be no more than ".concat(getMaxHoursOfValidity(getValues('phenomenon'), getValues('locationIndicatorATSR'), config), " hours after Valid from time");
3117
3275
  }
3118
3276
  }
3119
3277
  },
@@ -3152,15 +3310,15 @@ var ValidUntil = function ValidUntil(_a) {
3152
3310
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
3153
3311
  * */
3154
3312
 
3155
- var VolcanicFields = function VolcanicFields(_a) {
3156
- var isDisabled = _a.isDisabled,
3157
- isReadOnly = _a.isReadOnly,
3158
- helperText = _a.helperText;
3313
+ var VolcanicFields = function VolcanicFields(_ref) {
3314
+ var isDisabled = _ref.isDisabled,
3315
+ isReadOnly = _ref.isReadOnly,
3316
+ helperText = _ref.helperText;
3159
3317
 
3160
- var _b = useFormContext(),
3161
- watch = _b.watch,
3162
- trigger = _b.trigger,
3163
- getValues = _b.getValues;
3318
+ var _useFormContext = useFormContext(),
3319
+ watch = _useFormContext.watch,
3320
+ trigger = _useFormContext.trigger,
3321
+ getValues = _useFormContext.getValues;
3164
3322
 
3165
3323
  var classes = useStyles$6();
3166
3324
  return /*#__PURE__*/React__default.createElement(Grid, {
@@ -3270,15 +3428,18 @@ var validateSurfaceVisibility = function validateSurfaceVisibility(value) {
3270
3428
  return intVisibility % 50 === 0 || invalidSurfaceVisibilityTill750StepsMessage;
3271
3429
  };
3272
3430
 
3273
- var SurfaceVisibility = function SurfaceVisibility(_a) {
3274
- var isDisabled = _a.isDisabled,
3275
- _b = _a.onChange,
3276
- _onChange = _b === void 0 ? function () {
3431
+ var SurfaceVisibility = function SurfaceVisibility(_ref) {
3432
+ var isDisabled = _ref.isDisabled,
3433
+ _ref$onChange = _ref.onChange,
3434
+ _onChange = _ref$onChange === void 0 ? function () {
3277
3435
  return null;
3278
- } : _b;
3436
+ } : _ref$onChange;
3279
3437
 
3280
3438
  var classes = useStyles$6();
3281
- var isRequired = useDraftFormHelpers().isRequired;
3439
+
3440
+ var _useDraftFormHelpers = useDraftFormHelpers(),
3441
+ isRequired = _useDraftFormHelpers.isRequired;
3442
+
3282
3443
  return /*#__PURE__*/React__default.createElement(Grid, {
3283
3444
  item: true,
3284
3445
  container: true,
@@ -3367,21 +3528,26 @@ var validateSurfaceWindDirection = function validateSurfaceWindDirection(value)
3367
3528
  return intVisibility % 10 === 0 || invalidSurfaceWindDirectionStepsMessage;
3368
3529
  };
3369
3530
 
3370
- var SurfaceWind = function SurfaceWind(_a) {
3371
- var isDisabled = _a.isDisabled,
3372
- _b = _a.onChange,
3373
- _onChange = _b === void 0 ? function () {
3531
+ var SurfaceWind = function SurfaceWind(_ref) {
3532
+ var isDisabled = _ref.isDisabled,
3533
+ _ref$onChange = _ref.onChange,
3534
+ _onChange = _ref$onChange === void 0 ? function () {
3374
3535
  return null;
3375
- } : _b;
3536
+ } : _ref$onChange;
3376
3537
 
3377
- var _c = useFormContext(),
3378
- trigger = _c.trigger,
3379
- getValues = _c.getValues,
3380
- watch = _c.watch;
3538
+ var _useFormContext = useFormContext(),
3539
+ trigger = _useFormContext.trigger,
3540
+ getValues = _useFormContext.getValues,
3541
+ watch = _useFormContext.watch;
3542
+
3543
+ var _useDraftFormHelpers = useDraftFormHelpers(),
3544
+ isRequired = _useDraftFormHelpers.isRequired;
3381
3545
 
3382
- var isRequired = useDraftFormHelpers().isRequired;
3383
3546
  var classes = useStyles$6();
3384
- var allowedUnits = useProductSettings(airmetConfig).allowedUnits;
3547
+
3548
+ var _useProductSettings = useProductSettings(airmetConfig),
3549
+ allowedUnits = _useProductSettings.allowedUnits;
3550
+
3385
3551
  var selectedFIR = watch('locationIndicatorATSR'); // Get allowed speed units based on selected FIR - if no FIR selected, allow all units
3386
3552
 
3387
3553
  var allowedWindUnitsForFir = getAllowedUnits(selectedFIR, allowedUnits, 'surfacewind_unit', WindUnit);
@@ -3465,12 +3631,14 @@ var SurfaceWind = function SurfaceWind(_a) {
3465
3631
  isRequired: isRequired,
3466
3632
  isInteger: isInteger,
3467
3633
  min: function min(value) {
3468
- // The min level depends on the unit
3469
- return isValidMin(value, getMinWindSpeedValue(getValues('windUnit'))) || "The minimum wind speed in " + WindUnit[getValues('windUnit')] + " is " + getMinWindSpeedValue(getValues('windUnit'));
3634
+ return (// The min level depends on the unit
3635
+ isValidMin(value, getMinWindSpeedValue(getValues('windUnit'))) || "The minimum wind speed in ".concat(WindUnit[getValues('windUnit')], " is ").concat(getMinWindSpeedValue(getValues('windUnit')))
3636
+ );
3470
3637
  },
3471
3638
  max: function max(value) {
3472
- // The max level depends on the unit
3473
- return isValidMax(value, getMaxWindSpeedValue(getValues('windUnit'))) || "The maximum wind speed in " + WindUnit[getValues('windUnit')] + " is " + getMaxWindSpeedValue(getValues('windUnit'));
3639
+ return (// The max level depends on the unit
3640
+ isValidMax(value, getMaxWindSpeedValue(getValues('windUnit'))) || "The maximum wind speed in ".concat(WindUnit[getValues('windUnit')], " is ").concat(getMaxWindSpeedValue(getValues('windUnit')))
3641
+ );
3474
3642
  }
3475
3643
  }
3476
3644
  },
@@ -3517,23 +3685,28 @@ var validateRoundedStep = function validateRoundedStep(value, unit) {
3517
3685
  return invalidUnitMessage;
3518
3686
  };
3519
3687
 
3520
- var CloudLevels = function CloudLevels(_a) {
3521
- var isDisabled = _a.isDisabled,
3522
- isReadOnly = _a.isReadOnly,
3523
- _b = _a.onChange,
3524
- _onChange = _b === void 0 ? function () {
3688
+ var CloudLevels = function CloudLevels(_ref) {
3689
+ var isDisabled = _ref.isDisabled,
3690
+ isReadOnly = _ref.isReadOnly,
3691
+ _ref$onChange = _ref.onChange,
3692
+ _onChange = _ref$onChange === void 0 ? function () {
3525
3693
  return null;
3526
- } : _b;
3694
+ } : _ref$onChange;
3527
3695
 
3528
- var _c = useFormContext(),
3529
- watch = _c.watch,
3530
- setValue = _c.setValue,
3531
- trigger = _c.trigger,
3532
- getValues = _c.getValues;
3696
+ var _useFormContext = useFormContext(),
3697
+ watch = _useFormContext.watch,
3698
+ setValue = _useFormContext.setValue,
3699
+ trigger = _useFormContext.trigger,
3700
+ getValues = _useFormContext.getValues;
3701
+
3702
+ var _useDraftFormHelpers = useDraftFormHelpers(),
3703
+ isRequired = _useDraftFormHelpers.isRequired;
3533
3704
 
3534
- var isRequired = useDraftFormHelpers().isRequired;
3535
3705
  var classes = useStyles$6();
3536
- var allowedUnits = useProductSettings(airmetConfig).allowedUnits;
3706
+
3707
+ var _useProductSettings = useProductSettings(airmetConfig),
3708
+ allowedUnits = _useProductSettings.allowedUnits;
3709
+
3537
3710
  var selectedFIR = watch('locationIndicatorATSR'); // Get allowed cloud level units based on selected FIR - if no FIR selected, allow all default units
3538
3711
 
3539
3712
  var allowedCloudLevelUnitsForFir = getAllowedUnits(selectedFIR, allowedUnits, 'cloud_level_unit', CloudLevelUnits);
@@ -3650,12 +3823,14 @@ var CloudLevels = function CloudLevels(_a) {
3650
3823
  isRequired: isRequired,
3651
3824
  isInteger: isInteger,
3652
3825
  min: function min(value) {
3653
- // The min level depends on the unit
3654
- return isValidMin(value, getMinCloudLevelValue(getValues('cloudLevel.unit'))) || "The minimum level in " + CloudLevelUnits[getValues('cloudLevel.unit')] + " is " + getMinCloudLevelValue(getValues('cloudLevel.unit'));
3826
+ return (// The min level depends on the unit
3827
+ isValidMin(value, getMinCloudLevelValue(getValues('cloudLevel.unit'))) || "The minimum level in ".concat(CloudLevelUnits[getValues('cloudLevel.unit')], " is ").concat(getMinCloudLevelValue(getValues('cloudLevel.unit')))
3828
+ );
3655
3829
  },
3656
3830
  max: function max(value) {
3657
- // The max level depends on the unit
3658
- return isValidMax(value, getMaxCloudLevelValue(getValues('cloudLevel.unit'))) || "The maximum level in " + CloudLevelUnits[getValues('cloudLevel.unit')] + " is " + getMaxCloudLevelValue(getValues('cloudLevel.unit'));
3831
+ return (// The max level depends on the unit
3832
+ isValidMax(value, getMaxCloudLevelValue(getValues('cloudLevel.unit'))) || "The maximum level in ".concat(CloudLevelUnits[getValues('cloudLevel.unit')], " is ").concat(getMaxCloudLevelValue(getValues('cloudLevel.unit')))
3833
+ );
3659
3834
  },
3660
3835
  step: function step(value) {
3661
3836
  return validateRoundedStep(value, getValues('cloudLevel.unit'));
@@ -3755,16 +3930,19 @@ var CloudLevels = function CloudLevels(_a) {
3755
3930
  isRequired: isRequired,
3756
3931
  isInteger: isInteger,
3757
3932
  min: function min(value) {
3758
- // The min level depends on the unit
3759
- return isValidMin(value, getMinCloudLowerLevelValue(getValues('cloudLowerLevel.unit'))) || "The minimum level in " + CloudLevelUnits[getValues('cloudLowerLevel.unit')] + " is " + getMinCloudLowerLevelValue(getValues('cloudLowerLevel.unit'));
3933
+ return (// The min level depends on the unit
3934
+ isValidMin(value, getMinCloudLowerLevelValue(getValues('cloudLowerLevel.unit'))) || "The minimum level in ".concat(CloudLevelUnits[getValues('cloudLowerLevel.unit')], " is ").concat(getMinCloudLowerLevelValue(getValues('cloudLowerLevel.unit')))
3935
+ );
3760
3936
  },
3761
3937
  max: function max(value) {
3762
- // The max level depends on the unit
3763
- return isValidMax(value, getMaxCloudLowerLevelValue(getValues('cloudLowerLevel.unit'))) || "The maximum level in " + CloudLevelUnits[getValues('cloudLowerLevel.unit')] + " is " + getMaxCloudLowerLevelValue(getValues('cloudLowerLevel.unit'));
3938
+ return (// The max level depends on the unit
3939
+ isValidMax(value, getMaxCloudLowerLevelValue(getValues('cloudLowerLevel.unit'))) || "The maximum level in ".concat(CloudLevelUnits[getValues('cloudLowerLevel.unit')], " is ").concat(getMaxCloudLowerLevelValue(getValues('cloudLowerLevel.unit')))
3940
+ );
3764
3941
  },
3765
3942
  isLevelLower: function isLevelLower$1(value) {
3766
- // The lower level needs to be smaller than upper level
3767
- return isLevelLower(value, getValues('cloudLowerLevel.unit'), getValues('cloudLevel.value'), getValues('cloudLevel.unit'));
3943
+ return (// The lower level needs to be smaller than upper level
3944
+ isLevelLower(value, getValues('cloudLowerLevel.unit'), getValues('cloudLevel.value'), getValues('cloudLevel.unit'))
3945
+ );
3768
3946
  },
3769
3947
  step: function step(value) {
3770
3948
  return validateRoundedStep(value, getValues('cloudLowerLevel.unit'));
@@ -3806,53 +3984,50 @@ var shouldRetrieveTAC = function shouldRetrieveTAC(product) {
3806
3984
  return false;
3807
3985
  };
3808
3986
  var useTAC = function useTAC(initialProduct, getTAC) {
3809
- var _a = __read(React__default.useState(noTAC), 2),
3810
- TAC = _a[0],
3811
- setTAC = _a[1];
3987
+ var _React$useState = React__default.useState(noTAC),
3988
+ _React$useState2 = _slicedToArray(_React$useState, 2),
3989
+ TAC = _React$useState2[0],
3990
+ setTAC = _React$useState2[1];
3812
3991
 
3813
- var isMounted = useIsMounted().isMounted;
3992
+ var _useIsMounted = useIsMounted(),
3993
+ isMounted = _useIsMounted.isMounted;
3814
3994
 
3815
3995
  var retrieveTAC = function retrieveTAC(product) {
3816
- return __awaiter(void 0, void 0, void 0, function () {
3996
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
3817
3997
  var result;
3818
- return __generator(this, function (_a) {
3819
- switch (_a.label) {
3820
- case 0:
3821
- _a.trys.push([0, 2,, 3]);
3822
-
3823
- return [4
3824
- /*yield*/
3825
- , getTAC(product)];
3826
-
3827
- case 1:
3828
- result = _a.sent();
3829
-
3830
- if (isMounted.current) {
3831
- setTAC(result.data);
3832
- }
3833
-
3834
- return [3
3835
- /*break*/
3836
- , 3];
3998
+ return regeneratorRuntime.wrap(function _callee$(_context) {
3999
+ while (1) {
4000
+ switch (_context.prev = _context.next) {
4001
+ case 0:
4002
+ _context.prev = 0;
4003
+ _context.next = 3;
4004
+ return getTAC(product);
4005
+
4006
+ case 3:
4007
+ result = _context.sent;
4008
+
4009
+ if (isMounted.current) {
4010
+ setTAC(result.data);
4011
+ }
3837
4012
 
3838
- case 2:
3839
- _a.sent();
4013
+ _context.next = 10;
4014
+ break;
3840
4015
 
3841
- if (isMounted.current) {
3842
- setTAC(noTAC);
3843
- }
4016
+ case 7:
4017
+ _context.prev = 7;
4018
+ _context.t0 = _context["catch"](0);
3844
4019
 
3845
- return [3
3846
- /*break*/
3847
- , 3];
4020
+ if (isMounted.current) {
4021
+ setTAC(noTAC);
4022
+ }
3848
4023
 
3849
- case 3:
3850
- return [2
3851
- /*return*/
3852
- ];
4024
+ case 10:
4025
+ case "end":
4026
+ return _context.stop();
4027
+ }
3853
4028
  }
3854
- });
3855
- });
4029
+ }, _callee, null, [[0, 7]]);
4030
+ }));
3856
4031
  };
3857
4032
 
3858
4033
  React__default.useEffect(function () {
@@ -3875,8 +4050,8 @@ var useTAC = function useTAC(initialProduct, getTAC) {
3875
4050
  return [TAC, delayedQuery];
3876
4051
  };
3877
4052
 
3878
- var ProductFormTAC = function ProductFormTAC(_a) {
3879
- var tac = _a.tac;
4053
+ var ProductFormTAC = function ProductFormTAC(_ref) {
4054
+ var tac = _ref.tac;
3880
4055
  var classes = useStyles$4();
3881
4056
  var tacLines = tac.split('\n');
3882
4057
  return /*#__PURE__*/React__default.createElement(Typography, {
@@ -3893,33 +4068,37 @@ var ProductFormTAC = function ProductFormTAC(_a) {
3893
4068
  }));
3894
4069
  };
3895
4070
 
3896
- var SigmetForm = function SigmetForm(_a) {
3897
- var mode = _a.mode,
3898
- _b = _a.isCancelSigmet,
3899
- isCancelSigmet = _b === void 0 ? false : _b,
3900
- _c = _a.initialSigmet,
3901
- initialSigmet = _c === void 0 ? null : _c,
3902
- _d = _a.initialCancelSigmet,
3903
- initialCancelSigmet = _d === void 0 ? null : _d;
4071
+ var SigmetForm = function SigmetForm(_ref) {
4072
+ var mode = _ref.mode,
4073
+ _ref$isCancelSigmet = _ref.isCancelSigmet,
4074
+ isCancelSigmet = _ref$isCancelSigmet === void 0 ? false : _ref$isCancelSigmet,
4075
+ _ref$initialSigmet = _ref.initialSigmet,
4076
+ initialSigmet = _ref$initialSigmet === void 0 ? null : _ref$initialSigmet,
4077
+ _ref$initialCancelSig = _ref.initialCancelSigmet,
4078
+ initialCancelSigmet = _ref$initialCancelSig === void 0 ? null : _ref$initialCancelSig;
3904
4079
  var classes = useStyles$6();
3905
- var api = useApiContext().api;
3906
4080
 
3907
- var _e = useFormContext(),
3908
- watch = _e.watch,
3909
- setValue = _e.setValue,
3910
- handleSubmit = _e.handleSubmit,
3911
- getValues = _e.getValues;
4081
+ var _useApiContext = useApiContext(),
4082
+ api = _useApiContext.api;
4083
+
4084
+ var _useFormContext = useFormContext(),
4085
+ watch = _useFormContext.watch,
4086
+ setValue = _useFormContext.setValue,
4087
+ handleSubmit = _useFormContext.handleSubmit,
4088
+ getValues = _useFormContext.getValues;
3912
4089
 
3913
- var _f = __read(React__default.useState(mode === 'view'), 2),
3914
- isDisabled = _f[0],
3915
- setIsDisabled = _f[1];
4090
+ var _React$useState = React__default.useState(mode === 'view'),
4091
+ _React$useState2 = _slicedToArray(_React$useState, 2),
4092
+ isDisabled = _React$useState2[0],
4093
+ setIsDisabled = _React$useState2[1];
3916
4094
 
3917
4095
  var isReadOnly = mode === 'view';
3918
4096
  var helperText = isDisabled ? '' : 'Optional';
3919
4097
 
3920
- var _g = __read(useTAC(initialSigmet !== null ? initialSigmet : initialCancelSigmet, api.getSigmetTAC), 2),
3921
- tac = _g[0],
3922
- updateTac = _g[1];
4098
+ var _useTAC = useTAC(initialSigmet !== null ? initialSigmet : initialCancelSigmet, api.getSigmetTAC),
4099
+ _useTAC2 = _slicedToArray(_useTAC, 2),
4100
+ tac = _useTAC2[0],
4101
+ updateTac = _useTAC2[1];
3923
4102
 
3924
4103
  var onChangeForm = function onChangeForm() {
3925
4104
  updateTac(getValues());
@@ -3933,13 +4112,13 @@ var SigmetForm = function SigmetForm(_a) {
3933
4112
  intersectionEnd: initialSigmet.endGeometryIntersect
3934
4113
  } : null;
3935
4114
 
3936
- var _h = useDrawMode(initialGeometry),
3937
- drawMode = _h.drawMode,
3938
- setDrawMode = _h.setDrawMode,
3939
- layerDrawModes = _h.layerDrawModes,
3940
- geoJSONs = _h.geoJSONs,
3941
- _setLayerGeoJSONs = _h.setLayerGeoJSONs,
3942
- _setDrawModeType = _h.setDrawModeType;
4115
+ var _useDrawMode = useDrawMode(initialGeometry),
4116
+ drawMode = _useDrawMode.drawMode,
4117
+ setDrawMode = _useDrawMode.setDrawMode,
4118
+ layerDrawModes = _useDrawMode.layerDrawModes,
4119
+ geoJSONs = _useDrawMode.geoJSONs,
4120
+ _setLayerGeoJSONs = _useDrawMode.setLayerGeoJSONs,
4121
+ _setDrawModeType = _useDrawMode.setDrawModeType;
3943
4122
 
3944
4123
  var updateStartDrawing = function updateStartDrawing(mapGeoJSONS) {
3945
4124
  var baseGeoJSON = mapGeoJSONS || geoJSONs;
@@ -4157,35 +4336,39 @@ var SigmetForm = function SigmetForm(_a) {
4157
4336
  }))))));
4158
4337
  };
4159
4338
 
4160
- var AirmetForm = function AirmetForm(_a) {
4161
- var mode = _a.mode,
4162
- _b = _a.isCancelAirmet,
4163
- isCancelAirmet = _b === void 0 ? false : _b,
4164
- _c = _a.initialAirmet,
4165
- initialAirmet = _c === void 0 ? null : _c,
4166
- _d = _a.initialCancelAirmet,
4167
- initialCancelAirmet = _d === void 0 ? null : _d;
4339
+ var AirmetForm = function AirmetForm(_ref) {
4340
+ var mode = _ref.mode,
4341
+ _ref$isCancelAirmet = _ref.isCancelAirmet,
4342
+ isCancelAirmet = _ref$isCancelAirmet === void 0 ? false : _ref$isCancelAirmet,
4343
+ _ref$initialAirmet = _ref.initialAirmet,
4344
+ initialAirmet = _ref$initialAirmet === void 0 ? null : _ref$initialAirmet,
4345
+ _ref$initialCancelAir = _ref.initialCancelAirmet,
4346
+ initialCancelAirmet = _ref$initialCancelAir === void 0 ? null : _ref$initialCancelAir;
4168
4347
  var classes = useStyles$6();
4169
- var api = useApiContext().api;
4170
4348
 
4171
- var _e = useFormContext(),
4172
- watch = _e.watch,
4173
- setValue = _e.setValue,
4174
- handleSubmit = _e.handleSubmit,
4175
- getValues = _e.getValues;
4349
+ var _useApiContext = useApiContext(),
4350
+ api = _useApiContext.api;
4351
+
4352
+ var _useFormContext = useFormContext(),
4353
+ watch = _useFormContext.watch,
4354
+ setValue = _useFormContext.setValue,
4355
+ handleSubmit = _useFormContext.handleSubmit,
4356
+ getValues = _useFormContext.getValues;
4176
4357
 
4177
4358
  var phenomenon = watch('phenomenon');
4178
4359
 
4179
- var _f = __read(React__default.useState(mode === 'view'), 2),
4180
- isDisabled = _f[0],
4181
- setIsDisabled = _f[1];
4360
+ var _React$useState = React__default.useState(mode === 'view'),
4361
+ _React$useState2 = _slicedToArray(_React$useState, 2),
4362
+ isDisabled = _React$useState2[0],
4363
+ setIsDisabled = _React$useState2[1];
4182
4364
 
4183
4365
  var isReadOnly = mode === 'view';
4184
4366
  var helperText = isDisabled ? '' : 'Optional';
4185
4367
 
4186
- var _g = __read(useTAC(initialAirmet !== null ? initialAirmet : initialCancelAirmet, api.getAirmetTAC), 2),
4187
- tac = _g[0],
4188
- updateTac = _g[1];
4368
+ var _useTAC = useTAC(initialAirmet !== null ? initialAirmet : initialCancelAirmet, api.getAirmetTAC),
4369
+ _useTAC2 = _slicedToArray(_useTAC, 2),
4370
+ tac = _useTAC2[0],
4371
+ updateTac = _useTAC2[1];
4189
4372
 
4190
4373
  var onChangeForm = function onChangeForm() {
4191
4374
  updateTac(getValues());
@@ -4196,13 +4379,13 @@ var AirmetForm = function AirmetForm(_a) {
4196
4379
  intersectionStart: initialAirmet.startGeometryIntersect
4197
4380
  } : null;
4198
4381
 
4199
- var _h = useDrawMode(initialGeometry),
4200
- drawMode = _h.drawMode,
4201
- setDrawMode = _h.setDrawMode,
4202
- layerDrawModes = _h.layerDrawModes,
4203
- geoJSONs = _h.geoJSONs,
4204
- _setLayerGeoJSONs = _h.setLayerGeoJSONs,
4205
- _setDrawModeType = _h.setDrawModeType;
4382
+ var _useDrawMode = useDrawMode(initialGeometry),
4383
+ drawMode = _useDrawMode.drawMode,
4384
+ setDrawMode = _useDrawMode.setDrawMode,
4385
+ layerDrawModes = _useDrawMode.layerDrawModes,
4386
+ geoJSONs = _useDrawMode.geoJSONs,
4387
+ _setLayerGeoJSONs = _useDrawMode.setLayerGeoJSONs,
4388
+ _setDrawModeType = _useDrawMode.setDrawModeType;
4206
4389
 
4207
4390
  var updateStartDrawing = function updateStartDrawing(mapGeoJSONS) {
4208
4391
  var baseGeoJSON = mapGeoJSONS || geoJSONs;
@@ -4407,8 +4590,8 @@ var ContentDialog = function ContentDialog(_a) {
4407
4590
  children = _a.children,
4408
4591
  options = _a.options,
4409
4592
  onClose = _a.onClose,
4410
- _b = _a.alertBanner,
4411
- alertBanner = _b === void 0 ? null : _b,
4593
+ _a$alertBanner = _a.alertBanner,
4594
+ alertBanner = _a$alertBanner === void 0 ? null : _a$alertBanner,
4412
4595
  other = __rest(_a, ["open", "toggleDialogStatus", "title", "children", "options", "onClose", "alertBanner"]);
4413
4596
 
4414
4597
  var classes = useStyles$3();
@@ -4421,7 +4604,7 @@ var ContentDialog = function ContentDialog(_a) {
4421
4604
  }
4422
4605
  };
4423
4606
 
4424
- return /*#__PURE__*/React.createElement(Dialog, __assign({
4607
+ return /*#__PURE__*/React.createElement(Dialog, Object.assign({
4425
4608
  "data-testid": "contentDialog",
4426
4609
  open: open,
4427
4610
  onClose: handleClose,
@@ -4483,21 +4666,19 @@ var getActiveStatus = function getActiveStatus(product, className) {
4483
4666
  });
4484
4667
  };
4485
4668
 
4486
- var getStatusTagList = function getStatusTagList(product, cancelsSeqId) {
4487
- if (cancelsSeqId === void 0) {
4488
- cancelsSeqId = null;
4489
- }
4669
+ var getStatusTagList = function getStatusTagList(product) {
4670
+ var cancelsSeqId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
4490
4671
 
4491
4672
  if (cancelsSeqId !== null) {
4492
4673
  return /*#__PURE__*/React__default.createElement(StatusTag, {
4493
- content: "cancels " + cancelsSeqId,
4674
+ content: "cancels ".concat(cancelsSeqId),
4494
4675
  color: "red"
4495
4676
  });
4496
4677
  }
4497
4678
 
4498
4679
  if (product.status === 'CANCELLED') {
4499
4680
  return /*#__PURE__*/React__default.createElement(StatusTag, {
4500
- content: "cancelled " + product.sequence,
4681
+ content: "cancelled ".concat(product.sequence),
4501
4682
  color: "red"
4502
4683
  });
4503
4684
  }
@@ -4556,19 +4737,24 @@ var formatValidTime = function formatValidTime(startDate, endDate, format) {
4556
4737
  return '-';
4557
4738
  }
4558
4739
 
4559
- return moment.utc(startDate).format('DD MMM YYYY, HH:mm') + " - " + moment.utc(endDate).format(format) + " UTC";
4740
+ return "".concat(moment.utc(startDate).format('DD MMM YYYY, HH:mm'), " - ").concat(moment.utc(endDate).format(format), " UTC");
4560
4741
  };
4561
4742
 
4562
- var ProductListRow = function ProductListRow(_a) {
4563
- var product = _a.product,
4564
- productType = _a.productType;
4743
+ var ProductListRow = function ProductListRow(_ref) {
4744
+ var product = _ref.product,
4745
+ productType = _ref.productType;
4565
4746
  var classes = useStyles$2();
4566
- var api = useApiContext().api;
4567
- var isMounted = useIsMounted().isMounted;
4568
4747
 
4569
- var _b = __read(React__default.useState(''), 2),
4570
- TAC = _b[0],
4571
- setTAC = _b[1];
4748
+ var _useApiContext = useApiContext(),
4749
+ api = _useApiContext.api;
4750
+
4751
+ var _useIsMounted = useIsMounted(),
4752
+ isMounted = _useIsMounted.isMounted;
4753
+
4754
+ var _React$useState = React__default.useState(''),
4755
+ _React$useState2 = _slicedToArray(_React$useState, 2),
4756
+ TAC = _React$useState2[0],
4757
+ setTAC = _React$useState2[1];
4572
4758
 
4573
4759
  var apiCall = productType === 'sigmet' ? api.getSigmetTAC : api.getAirmetTAC;
4574
4760
  React__default.useEffect(function () {
@@ -4644,7 +4830,7 @@ var ProductListRow = function ProductListRow(_a) {
4644
4830
  variant: "subtitle2",
4645
4831
  className: classes.font,
4646
4832
  "data-testid": "issueTime"
4647
- }, product.issueDate ? moment.utc(product.issueDate).format('DD MMM YYYY, HH:mm') + " UTC" : '(Not published)')), /*#__PURE__*/React__default.createElement(Grid, {
4833
+ }, product.issueDate ? "".concat(moment.utc(product.issueDate).format('DD MMM YYYY, HH:mm'), " UTC") : '(Not published)')), /*#__PURE__*/React__default.createElement(Grid, {
4648
4834
  item: true,
4649
4835
  xs: 12,
4650
4836
  sm: 8,
@@ -4702,13 +4888,13 @@ var useStyles$1 = makeStyles({
4702
4888
  }
4703
4889
  });
4704
4890
 
4705
- var ProductList = function ProductList(_a) {
4706
- var productType = _a.productType,
4707
- productList = _a.productList,
4708
- isLoading = _a.isLoading,
4709
- error = _a.error,
4710
- onClickProductRow = _a.onClickProductRow,
4711
- onClickNewProduct = _a.onClickNewProduct;
4891
+ var ProductList = function ProductList(_ref) {
4892
+ var productType = _ref.productType,
4893
+ productList = _ref.productList,
4894
+ isLoading = _ref.isLoading,
4895
+ error = _ref.error,
4896
+ onClickProductRow = _ref.onClickProductRow,
4897
+ onClickNewProduct = _ref.onClickNewProduct;
4712
4898
  var classes = useStyles$1();
4713
4899
  return /*#__PURE__*/React__default.createElement(Grid, {
4714
4900
  container: true,
@@ -4739,7 +4925,7 @@ var ProductList = function ProductList(_a) {
4739
4925
  onClick: function onClick() {
4740
4926
  onClickProductRow(productListItem);
4741
4927
  },
4742
- key: product.sequence && product.issueDate ? product.sequence + "-" + product.issueDate : "draft-" + index,
4928
+ key: product.sequence && product.issueDate ? "".concat(product.sequence, "-").concat(product.issueDate) : "draft-".concat(index),
4743
4929
  className: classes.listItem
4744
4930
  }, /*#__PURE__*/React__default.createElement(ProductListRow, {
4745
4931
  product: product,
@@ -4768,10 +4954,15 @@ var ProductList = function ProductList(_a) {
4768
4954
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4769
4955
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
4770
4956
  * */
4771
- var CancelSigmetVolcanicMovements = function CancelSigmetVolcanicMovements(_a) {
4772
- var sigmet = _a.sigmet;
4773
- var allFIRS = useProductSettings(sigmetConfig).allFIRS;
4774
- var isRequired = useDraftFormHelpers().isRequired;
4957
+ var CancelSigmetVolcanicMovements = function CancelSigmetVolcanicMovements(_ref) {
4958
+ var sigmet = _ref.sigmet;
4959
+
4960
+ var _useProductSettings = useProductSettings(sigmetConfig),
4961
+ allFIRS = _useProductSettings.allFIRS;
4962
+
4963
+ var _useDraftFormHelpers = useDraftFormHelpers(),
4964
+ isRequired = _useDraftFormHelpers.isRequired;
4965
+
4775
4966
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography, {
4776
4967
  variant: "body1"
4777
4968
  }, "Use the FIR to indicate the direction the Volcanic Ash is moving to:"), /*#__PURE__*/React__default.createElement(ReactHookFormRadioGroup, {
@@ -4815,52 +5006,58 @@ var prepareCancelSigmet = function prepareCancelSigmet(sigmet, movement) {
4815
5006
  return sigmet;
4816
5007
  }
4817
5008
 
4818
- return __assign(__assign({}, sigmet), {
5009
+ return Object.assign(Object.assign({}, sigmet), {
4819
5010
  vaSigmetMoveToFIR: movement
4820
5011
  });
4821
5012
  };
4822
5013
 
4823
- var ProductFormDialogContent = function ProductFormDialogContent(_a) {
4824
- var isOpen = _a.isOpen,
4825
- toggleDialogStatus = _a.toggleDialogStatus,
4826
- mode = _a.mode,
4827
- productType = _a.productType,
4828
- productCanBe = _a.productCanBe,
4829
- product = _a.product;
5014
+ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
5015
+ var isOpen = _ref.isOpen,
5016
+ toggleDialogStatus = _ref.toggleDialogStatus,
5017
+ mode = _ref.mode,
5018
+ productType = _ref.productType,
5019
+ productCanBe = _ref.productCanBe,
5020
+ product = _ref.product;
4830
5021
  var classes = useStyles();
4831
- var api = useApiContext().api;
5022
+
5023
+ var _useApiContext = useApiContext(),
5024
+ api = _useApiContext.api;
5025
+
4832
5026
  var apiCall = productType === 'sigmet' ? api.postSigmet : api.postAirmet;
4833
5027
 
4834
- var _b = useFormContext(),
4835
- handleSubmit = _b.handleSubmit,
4836
- reset = _b.reset,
4837
- formState = _b.formState,
4838
- watch = _b.watch;
5028
+ var _useFormContext = useFormContext(),
5029
+ handleSubmit = _useFormContext.handleSubmit,
5030
+ reset = _useFormContext.reset,
5031
+ formState = _useFormContext.formState,
5032
+ watch = _useFormContext.watch;
4839
5033
 
4840
5034
  var isDirty = formState.isDirty;
4841
5035
 
4842
- var _c = useDraftFormHelpers(),
4843
- toggleIsDraft = _c.toggleIsDraft,
4844
- DraftFieldHelper = _c.DraftFieldHelper;
5036
+ var _useDraftFormHelpers = useDraftFormHelpers(),
5037
+ toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
5038
+ DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
4845
5039
 
4846
5040
  usePreventBrowserClose(isDirty);
4847
5041
  var confirmationDialog = useConfirmationDialog();
4848
5042
 
4849
- var _d = __read(React.useState(false), 2),
4850
- showLoader = _d[0],
4851
- setLoader = _d[1];
5043
+ var _React$useState = React.useState(false),
5044
+ _React$useState2 = _slicedToArray(_React$useState, 2),
5045
+ showLoader = _React$useState2[0],
5046
+ setLoader = _React$useState2[1];
4852
5047
 
4853
- var _e = __read(React.useState(false), 2),
4854
- errorStoreMessage = _e[0],
4855
- setErrorStoreMessage = _e[1];
5048
+ var _React$useState3 = React.useState(false),
5049
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
5050
+ errorStoreMessage = _React$useState4[0],
5051
+ setErrorStoreMessage = _React$useState4[1];
4856
5052
 
4857
- var _f = __read(React.useState(''), 2),
4858
- errorStoreMessageText = _f[0],
4859
- setErrorStoreMessageText = _f[1];
5053
+ var _React$useState5 = React.useState(''),
5054
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
5055
+ errorStoreMessageText = _React$useState6[0],
5056
+ setErrorStoreMessageText = _React$useState6[1];
4860
5057
 
4861
5058
  React.useEffect(function () {
4862
5059
  // set the values of the newly selected product
4863
- reset(product !== null ? __assign({}, product) : {});
5060
+ reset(product !== null ? Object.assign({}, product) : {});
4864
5061
  return function () {
4865
5062
  // reset form on unmount
4866
5063
  reset({});
@@ -4989,7 +5186,10 @@ var ProductFormDialogContent = function ProductFormDialogContent(_a) {
4989
5186
  title: "An error has occurred while saving, please try again",
4990
5187
  info: errorStoreMessageText
4991
5188
  }) : null,
4992
- options: getProductFormLifecycleButtons(productCanBe, onProductButtonPress)
5189
+ options: getProductFormLifecycleButtons(productCanBe, onProductButtonPress),
5190
+ style: {
5191
+ zIndex: 1000
5192
+ }
4993
5193
  }, productType === 'sigmet' ? /*#__PURE__*/React.createElement(SigmetForm, {
4994
5194
  mode: mode,
4995
5195
  isCancelSigmet: product !== null && isInstanceOfCancelSigmet(product),
@@ -5025,13 +5225,25 @@ var ProductFormDialogContent = function ProductFormDialogContent(_a) {
5025
5225
  * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5026
5226
  * Copyright 2021 - Finnish Meteorological Institute (FMI)
5027
5227
  * */
5028
- var ProductFormDialog = function ProductFormDialog(_a) {
5029
- var isOpen = _a.isOpen,
5030
- productType = _a.productType,
5031
- toggleDialogStatus = _a.toggleDialogStatus,
5032
- _b = _a.productListItem,
5033
- productListItem = _b === void 0 ? null : _b; // Show the right options for a new sigmet/airmet not coming from the BE
5228
+ var prepareProductValues = function prepareProductValues(product, productType) {
5229
+ // Ensure there is a valid start/end date
5230
+ if (!isInstanceOfCancelSigmetOrAirmet(product) && (!product.validDateStart || !product.validDateEnd)) {
5231
+ var defaultHoursValid = getDefaultHoursValid(productType);
5232
+ return Object.assign({
5233
+ validDateStart: moment.utc().add(VALID_FROM_TIME_DELAY_IN_MINUTES, 'minutes').format('YYYY-MM-DDTHH:mm:ss[Z]'),
5234
+ validDateEnd: moment.utc().add(defaultHoursValid, 'hour').add(VALID_FROM_TIME_DELAY_IN_MINUTES, 'minutes').format('YYYY-MM-DDTHH:mm:ss[Z]')
5235
+ }, product);
5236
+ }
5034
5237
 
5238
+ return product;
5239
+ };
5240
+ var ProductFormDialog = function ProductFormDialog(_ref) {
5241
+ var isOpen = _ref.isOpen,
5242
+ productType = _ref.productType,
5243
+ toggleDialogStatus = _ref.toggleDialogStatus,
5244
+ _ref$productListItem = _ref.productListItem,
5245
+ productListItem = _ref$productListItem === void 0 ? null : _ref$productListItem;
5246
+ // Show the right options for a new sigmet/airmet not coming from the BE
5035
5247
  var productCanBe = productListItem !== null ? productListItem.canbe : ['DRAFTED', 'DISCARDED', 'PUBLISHED']; // Determine mode of form based on canbe properties
5036
5248
 
5037
5249
  var mode = getProductFormMode(productCanBe, productListItem);
@@ -5047,7 +5259,7 @@ var ProductFormDialog = function ProductFormDialog(_a) {
5047
5259
  toggleDialogStatus: toggleDialogStatus,
5048
5260
  mode: mode,
5049
5261
  productCanBe: productCanBe,
5050
- product: productListItem !== null ? productListItem[productType] : null,
5262
+ product: productListItem !== null ? prepareProductValues(productListItem[productType], productType) : null,
5051
5263
  productType: productType
5052
5264
  })));
5053
5265
  };
@@ -5062,24 +5274,28 @@ var ProductFormDialog = function ProductFormDialog(_a) {
5062
5274
  * ```<ApiProvider baseURL="http://test.com" appURL="http://app.com" auth={auth} onSetAuth={onSetAuth} createApi={api.createApi} authTokenUrl="url/tokenrefresh"> <MetInfoWrapper productType="sigmet"/> </ApiProvider>```
5063
5275
  */
5064
5276
 
5065
- var MetInfoWrapper = function MetInfoWrapper(_a) {
5066
- var productType = _a.productType;
5067
- var api = useApiContext().api;
5277
+ var MetInfoWrapper = function MetInfoWrapper(_ref) {
5278
+ var productType = _ref.productType;
5068
5279
 
5069
- var _b = __read(React__default.useState(false), 2),
5070
- isFormDialogOpen = _b[0],
5071
- setIsFormDialogOpen = _b[1];
5280
+ var _useApiContext = useApiContext(),
5281
+ api = _useApiContext.api;
5072
5282
 
5073
- var _c = __read(React__default.useState(null), 2),
5074
- selectedProduct = _c[0],
5075
- setSelectedProduct = _c[1]; // Retrieve list of products
5283
+ var _React$useState = React__default.useState(false),
5284
+ _React$useState2 = _slicedToArray(_React$useState, 2),
5285
+ isFormDialogOpen = _React$useState2[0],
5286
+ setIsFormDialogOpen = _React$useState2[1];
5076
5287
 
5288
+ var _React$useState3 = React__default.useState(null),
5289
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
5290
+ selectedProduct = _React$useState4[0],
5291
+ setSelectedProduct = _React$useState4[1]; // Retrieve list of products
5077
5292
 
5078
- var _d = useApi(productType === 'sigmet' ? api.getSigmetList : api.getAirmetList),
5079
- errorList = _d.error,
5080
- isLoadingList = _d.isLoading,
5081
- productList = _d.result,
5082
- fetchNewProductList = _d.fetchApiData;
5293
+
5294
+ var _useApi = useApi(productType === 'sigmet' ? api.getSigmetList : api.getAirmetList),
5295
+ errorList = _useApi.error,
5296
+ isLoadingList = _useApi.isLoading,
5297
+ productList = _useApi.result,
5298
+ fetchNewProductList = _useApi.fetchApiData;
5083
5299
 
5084
5300
  var getNewProductList = function getNewProductList() {
5085
5301
  fetchNewProductList({});
@@ -5127,27 +5343,43 @@ var MetInfoWrapper = function MetInfoWrapper(_a) {
5127
5343
  }));
5128
5344
  };
5129
5345
 
5130
- var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl) {
5131
- var axiosInstance = createApiInstance(url, appUrl, auth, setAuth, authTokenUrl);
5346
+ /* *
5347
+ * Licensed under the Apache License, Version 2.0 (the "License");
5348
+ * you may not use this file except in compliance with the License.
5349
+ * You may obtain a copy of the License at
5350
+ *
5351
+ * http://www.apache.org/licenses/LICENSE-2.0
5352
+ *
5353
+ * Unless required by applicable law or agreed to in writing, software
5354
+ * distributed under the License is distributed on an "AS IS" BASIS,
5355
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5356
+ * See the License for the specific language governing permissions and
5357
+ * limitations under the License.
5358
+ *
5359
+ * Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
5360
+ * Copyright 2021 - Finnish Meteorological Institute (FMI)
5361
+ * */
5362
+ var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
5363
+ var axiosInstance = createApiInstance(url, appUrl, auth, setAuth, authTokenUrl, authClientId);
5132
5364
  return {
5133
5365
  // api data
5134
5366
  getSigmetList: function getSigmetList() {
5135
5367
  return axiosInstance.get('/sigmetlist');
5136
5368
  },
5137
5369
  postSigmet: function postSigmet(formData) {
5138
- return axiosInstance.post('/sigmet', __assign({}, formData));
5370
+ return axiosInstance.post('/sigmet', Object.assign({}, formData));
5139
5371
  },
5140
5372
  getSigmetTAC: function getSigmetTAC(sigmetData) {
5141
- return axiosInstance.post('/sigmet2tac', __assign({}, sigmetData));
5373
+ return axiosInstance.post('/sigmet2tac', Object.assign({}, sigmetData));
5142
5374
  },
5143
5375
  postAirmet: function postAirmet(formData) {
5144
- return axiosInstance.post('/airmet', __assign({}, formData));
5376
+ return axiosInstance.post('/airmet', Object.assign({}, formData));
5145
5377
  },
5146
5378
  getAirmetList: function getAirmetList() {
5147
5379
  return axiosInstance.get('/airmetlist');
5148
5380
  },
5149
5381
  getAirmetTAC: function getAirmetTAC(sigmetData) {
5150
- return axiosInstance.post('/airmet2tac', __assign({}, sigmetData));
5382
+ return axiosInstance.post('/airmet2tac', Object.assign({}, sigmetData));
5151
5383
  }
5152
5384
  };
5153
5385
  };