@opengeoweb/warnings 12.9.1 → 12.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +6 -0
  2. package/index.esm.js +1931 -579
  3. package/package.json +17 -13
  4. package/src/lib/components/AreaObjectLoader/AreaObjectLoader.stories.d.ts +1 -1
  5. package/src/lib/components/ComponentsLookUp/ComponentsLookUp.d.ts +10 -3
  6. package/src/lib/components/DrawingTool/DrawingTool.stories.d.ts +1 -1
  7. package/src/lib/components/FilterList/ExpandableFilterChip.d.ts +0 -1
  8. package/src/lib/components/FilterList/filter-utils.d.ts +49 -4
  9. package/src/lib/components/MaritimeWarningsForm/AreaList/AreaList.d.ts +9 -0
  10. package/src/lib/components/MaritimeWarningsForm/AreaList/AreaList.spec.d.ts +1 -0
  11. package/src/lib/components/MaritimeWarningsForm/AreaList/index.d.ts +1 -0
  12. package/src/lib/components/MaritimeWarningsForm/AssignedAreas/AssignedAreas.d.ts +11 -0
  13. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.d.ts +19 -0
  14. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.spec.d.ts +2 -0
  15. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.stories.d.ts +9 -0
  16. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.d.ts +8 -0
  17. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.spec.d.ts +1 -0
  18. package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.stories.d.ts +11 -0
  19. package/src/lib/components/MaritimeWarningsForm/WarningList/WarningList.d.ts +15 -0
  20. package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListDragHandle.d.ts +2 -0
  21. package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListItem.d.ts +14 -0
  22. package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListSelect.d.ts +19 -0
  23. package/src/lib/components/MaritimeWarningsForm/WarningList/WindForceSelect.d.ts +22 -0
  24. package/src/lib/components/MaritimeWarningsForm/areas.d.ts +2 -0
  25. package/src/lib/components/MaritimeWarningsForm/index.d.ts +1 -0
  26. package/src/lib/components/MaritimeWarningsForm/options.d.ts +5 -0
  27. package/src/lib/components/MaritimeWarningsForm/types.d.ts +15 -0
  28. package/src/lib/components/MaritimeWarningsForm/useConfirmRetractDialog.d.ts +11 -0
  29. package/src/lib/components/MaritimeWarningsForm/useMaritimeWarningsFormState.d.ts +53 -0
  30. package/src/lib/components/MaritimeWarningsForm/useMaritimeWarningsFormState.spec.d.ts +1 -0
  31. package/src/lib/components/MaritimeWarningsForm/utils.d.ts +2 -0
  32. package/src/lib/components/MaritimeWarningsForm/utils.spec.d.ts +1 -0
  33. package/src/lib/components/ObjectManager/ObjectManager.stories.d.ts +17 -18
  34. package/src/lib/components/ObjectManager/ObjectManagerConnect.stories.d.ts +1 -1
  35. package/src/lib/components/PublicWarningList/NewWarningButton/NewWarningButton.stories.d.ts +1 -1
  36. package/src/lib/components/PublicWarningList/PublicWarningListConnect.stories.d.ts +2 -2
  37. package/src/lib/components/PublicWarningsForm/AreaField/AreaField.stories.d.ts +2 -3
  38. package/src/lib/components/PublicWarningsForm/DescriptionField/DescriptionField.stories.d.ts +1 -1
  39. package/src/lib/components/PublicWarningsForm/PublicWarningsForm.stories.d.ts +1 -1
  40. package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialog.d.ts +3 -3
  41. package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialog.stories.d.ts +1 -1
  42. package/src/lib/store/publicWarningForm/types.d.ts +1 -1
  43. package/src/lib/utils/sig-airmet-util.d.ts +3 -3
package/index.esm.js CHANGED
@@ -1,20 +1,20 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useDispatch, useSelector } from 'react-redux';
3
- import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, breakpoints, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove, ArrowUpCompact, ArrowDownCompact } from '@opengeoweb/theme';
3
+ import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove } from '@opengeoweb/theme';
4
4
  import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawingToolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, mapListener, layersListener, drawingToolListener, syncGroupsListener, openlayersListener, syncGroupsReducer, drawingToolReducer, uiReducer, layerReducer, mapReducer, useSetupDialog, genericSelectors, useUpdateSharedData, genericActions, selectorMemoizationOptions } from '@opengeoweb/store';
5
5
  import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, viewUtils, OpenLayersMapView, MapControls, OpenLayersZoomControl, OpenLayersLayer, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle } from '@opengeoweb/webmap-react';
6
- import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, FilterChip, FilterOption, StatusTag, LastUpdateTime, getAxiosErrorMessage, ErrorBoundary } from '@opengeoweb/shared';
6
+ import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, usePreventBrowserClose, CustomToggleButton, Filter, FilterOption, StatusTag, LastUpdateTime, getAxiosErrorMessage, ErrorBoundary } from '@opengeoweb/shared';
7
7
  import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, current, combineReducers, configureStore } from '@reduxjs/toolkit';
8
8
  import { defaultBbox } from '@opengeoweb/core';
9
9
  import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormSelect, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, errorMessages, isEmpty, ReactHookFormDateTime, isXHoursAfter, isXHoursBefore } from '@opengeoweb/form-fields';
10
- import { SA_NAMESPACE, isInstanceOfCancelSigmet, getDefaultValidFromValue, isInstanceOfCancelAirmet, getTacGeometry, getMaxPolygonPoints, getDefaultValidUntilValue, useShortTestHelpers, SigmetForm, AirmetForm, ProductAction, getConfirmationDialogCancelLabel, getConfirmationDialogButtonLabel, getConfirmationDialogContent, getConfirmationDialogTitle, isVAPhenomenon, CancelSigmetVolcanicMovements, createAirmetPostParameter, createSigmetPostParameter, prepareCancelSigmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
10
+ import { SA_NAMESPACE, isInstanceOfCancelSigmet, getDefaultValidFromValue, isInstanceOfCancelAirmet, getTacGeometry, getMaxPolygonPoints, getDefaultValidUntilValue, useShortTestHelpers, ProductAction, SigmetForm, AirmetForm, getConfirmationDialogCancelLabel, getConfirmationDialogButtonLabel, getConfirmationDialogContent, getConfirmationDialogTitle, isVAPhenomenon, CancelSigmetVolcanicMovements, createAirmetPostParameter, createSigmetPostParameter, prepareCancelSigmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
11
11
  import { LayerType, generateMapId } from '@opengeoweb/webmap';
12
12
  import { t } from 'i18next';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import * as React from 'react';
15
15
  import React__default, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
16
16
  import { useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
17
- import { styled, Box, Typography, ListItem, Paper, ListItemButton, Stack, Grid, LinearProgress, Button, MenuItem, FormHelperText, Card, CardContent, Tabs, Tab, CircularProgress, Menu, DialogTitle, DialogContent, Switch, ListItemText } from '@mui/material';
17
+ import { styled, Box, Typography, ListItem, Paper, ListItemButton, Stack, Grid, LinearProgress, Button, MenuItem, FormHelperText, Card, CardContent, Tabs, Tab, useTheme, FormControl, CircularProgress, Menu, DialogTitle, DialogContent, Switch, ListItemText } from '@mui/material';
18
18
  import { VariableSizeList } from 'react-window';
19
19
  import AutoSizer from 'react-virtualized-auto-sizer';
20
20
  import { getHeaders, handleResponse, AirmetPhenomena, SigmetPhenomena, useAuthQuery, useAuthenticationContext, optimisticUpdate, ProductStatus } from '@opengeoweb/api';
@@ -22,6 +22,7 @@ import { useQueryClient, useMutation } from '@tanstack/react-query';
22
22
  import { snackbarListener, snackbarReducer, snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
23
23
  import { useFormContext, useForm, FormProvider } from 'react-hook-form';
24
24
  import { isEqual, cloneDeep, clamp, concat, groupBy, pick } from 'lodash';
25
+ import { ReactSortable } from 'react-sortablejs';
25
26
 
26
27
  var en = {
27
28
  "drawing-tool-form-tools": "Tools",
@@ -55,6 +56,8 @@ var en = {
55
56
  "object-manager-object-selected": "object selected",
56
57
  "object-manager-share-menu": "Share object to",
57
58
  "public-warning-title": "Public Warning",
59
+ "maritime-warning-coastal-title": "Coastal Waters",
60
+ "maritime-warning-northsea-title": "North Sea Districts",
58
61
  "close-warning-dialog-title": "Close warning",
59
62
  "warning-edit-mode-title": "Switch to edit mode",
60
63
  "warning-edit-mode-description": "This warning is already in edit mode by another user and important information could get lost in the switching process.",
@@ -210,7 +213,51 @@ var en = {
210
213
  "aviation-discard-success": "{{warningType}} has been discarded!",
211
214
  "error-auth-login": "This feature is protected by authentication. Please log in to proceed",
212
215
  "cancel-warningType": "Cancel {{warningType}}",
213
- cancelling: "Cancelling"
216
+ cancelling: "Cancelling",
217
+ "maritime-new-warning": "New warning",
218
+ "maritime-add-area": "Add",
219
+ "maritime-no-area-selected": "(no area selected)",
220
+ "maritime-no-district-selected": "(no district selected)",
221
+ "maritime-backing": "Backing",
222
+ "maritime-veering": "Veering",
223
+ "maritime-no-change": "No change",
224
+ "maritime-windforce": "{{value}} Bft",
225
+ "maritime-header-direction": "Direction",
226
+ "maritime-header-direction-from": "Direction from",
227
+ "maritime-header-direction-to": "Direction to",
228
+ "maritime-header-windforce": "Bft",
229
+ "maritime-header-areas": "Areas",
230
+ "maritime-header-districts": "Districts",
231
+ "maritime-header-change": "Change",
232
+ "maritime-direction-n": "North",
233
+ "maritime-direction-nne": "North to Northeast",
234
+ "maritime-direction-ne": "Northeast",
235
+ "maritime-direction-nen": "Northeast to North",
236
+ "maritime-direction-e": "East",
237
+ "maritime-direction-ese": "East to Southeast",
238
+ "maritime-direction-se": "Southeast",
239
+ "maritime-direction-ses": "Southeast to South",
240
+ "maritime-direction-s": "South",
241
+ "maritime-direction-ssw": "South to Southwest",
242
+ "maritime-direction-sw": "Southwest",
243
+ "maritime-direction-sww": "Southwest to West",
244
+ "maritime-direction-w": "West",
245
+ "maritime-direction-wnw": "West to Northwest",
246
+ "maritime-direction-nw": "Northwest",
247
+ "maritime-direction-nwn": "Northwest to North",
248
+ "maritime-delete-button": "Delete",
249
+ "maritime-retract-warning": "Retract warning",
250
+ "maritime-no-change-of-direction": "(no change of direction)",
251
+ "maritime-retract-dialog-no-change": "(no change in direction)",
252
+ "maritime-retract-dialog-description-suffix": "will be removed",
253
+ "maritime-retract-dialog-empty-warning-description": "The warning will be retracted",
254
+ "maritime-retract-dialog-confirm": "Retract",
255
+ "maritime-retract-success": "Warning retracted successfully",
256
+ "maritime-clear-dialog-title": "Clear all",
257
+ "maritime-clear-dialog-description": "All warnings will be removed from the list",
258
+ "maritime-clear-success": "Warning list cleared successfully",
259
+ "maritime-warning-title-coastal": "Warning Maritime - Coastal Waters",
260
+ "maritime-warning-title-northsea": "Warning Maritime - North Sea Districts"
214
261
  };
215
262
  var nl = {
216
263
  "drawing-tool-form-tools": "Gereedschap",
@@ -244,6 +291,8 @@ var nl = {
244
291
  "object-manager-object-selected": "object geselecteerd",
245
292
  "object-manager-share-menu": "Object delen naar",
246
293
  "public-warning-title": "Publieke Waarschuwing",
294
+ "maritime-warning-coastal-title": "Kustgebieden",
295
+ "maritime-warning-northsea-title": "Noordzee Districten",
247
296
  "close-warning-dialog-title": "Waarschuwing sluiten",
248
297
  "warning-edit-mode-title": "Wissel naar bewerken",
249
298
  "warning-edit-mode-description": "Deze waarschuwing wordt al bewerkt door een andere gebruiker en belangrijke informatie kan verloren gaan.",
@@ -360,7 +409,50 @@ var nl = {
360
409
  "aviation-discard-success": "niet vertaald",
361
410
  "error-auth-login": "Deze functie wordt beschermd door authenticatie. Log in om verder te gaan",
362
411
  "cancel-warningType": "Annuleer {{warningType}}",
363
- cancelling: "Annuleren"
412
+ cancelling: "Annuleren",
413
+ "maritime-new-warning": "Nieuwe waarschuwing",
414
+ "maritime-add-area": "Toevoegen",
415
+ "maritime-no-area-selected": "(geen gebied geselecteerd)",
416
+ "maritime-no-district-selected": "(geen district geselecteerd)",
417
+ "maritime-backing": "Krimpend",
418
+ "maritime-veering": "Ruimend",
419
+ "maritime-no-change": "Geen wijziging",
420
+ "maritime-windforce": "{{value}} Bft",
421
+ "maritime-header-direction": "Richting",
422
+ "maritime-header-direction-from": "Richting van",
423
+ "maritime-header-direction-to": "Richting naar",
424
+ "maritime-header-windforce": "Bft",
425
+ "maritime-header-areas": "Gebieden",
426
+ "maritime-header-districts": "Districten",
427
+ "maritime-header-change": "Wijziging",
428
+ "maritime-direction-n": "Noord",
429
+ "maritime-direction-nne": "Noord tot noordoost",
430
+ "maritime-direction-ne": "Noordoost",
431
+ "maritime-direction-nen": "Noordoost tot noord",
432
+ "maritime-direction-e": "Oost",
433
+ "maritime-direction-ese": "Oost tot zuidoost",
434
+ "maritime-direction-se": "Zuidoost",
435
+ "maritime-direction-ses": "Zuidoost tot zuid",
436
+ "maritime-direction-s": "Zuid",
437
+ "maritime-direction-ssw": "Zuid tot zuidwest",
438
+ "maritime-direction-sw": "Zuidwest",
439
+ "maritime-direction-sww": "Zuidwest tot west",
440
+ "maritime-direction-w": "West",
441
+ "maritime-direction-wnw": "West tot noordwest",
442
+ "maritime-direction-nw": "Noordwest",
443
+ "maritime-direction-nwn": "Noordwest tot noord",
444
+ "maritime-delete-button": "Verwijderen",
445
+ "maritime-retract-warning": "Waarschuwing intrekken",
446
+ "maritime-retract-dialog-no-change": "(geen wijziging in richting)",
447
+ "maritime-retract-dialog-empty-warning-description": "De waarschuwing wordt verwijderd",
448
+ "maritime-retract-dialog-description-suffix": "wordt verwijderd",
449
+ "maritime-retract-dialog-confirm": "Intrekken",
450
+ "maritime-retract-success": "Waarschuwing succesvol ingetrokken",
451
+ "maritime-clear-dialog-title": "Wissen",
452
+ "maritime-clear-dialog-description": "Alle waarschuwingen worden verwijderd",
453
+ "maritime-clear-success": "Alle waarchuwingen zijn verwijderd",
454
+ "maritime-warning-title-coastal": "Maritieme Waarschuwing - Kustgebieden",
455
+ "maritime-warning-title-northsea": "Maritieme Waarschuwing - Noordzee Districten"
364
456
  };
365
457
  var fi = {
366
458
  "drawing-tool-form-tools": "Työkalut",
@@ -394,6 +486,8 @@ var fi = {
394
486
  "object-manager-object-selected": "objekti valittuna",
395
487
  "object-manager-share-menu": "Jaa objekti",
396
488
  "public-warning-title": "Julkiset varoitukset",
489
+ "maritime-warning-coastal-title": "ei käännetty",
490
+ "maritime-warning-northsea-title": "ei käännetty",
397
491
  "close-warning-dialog-title": "Sulje varoitukset",
398
492
  "warning-edit-mode-title": "Vaihda editointitilaan",
399
493
  "warning-edit-mode-description": "Tämä varoitus on jo editointitilassa toisen käyttäjän toimesta. Tärkeää tietoa saatetaan menettää, jos editointitilaa vaihdetaan.",
@@ -544,6 +638,8 @@ var no = {
544
638
  "object-manager-object-selected": "objekt er valgt",
545
639
  "object-manager-share-menu": "Del objekt med",
546
640
  "public-warning-title": "Farevarsel",
641
+ "maritime-warning-coastal-title": "ikke oversatt",
642
+ "maritime-warning-northsea-title": "ikke oversatt",
547
643
  "close-warning-dialog-title": "Lukk farevarsel",
548
644
  "warning-edit-mode-title": "Bytt til editeringsmodus",
549
645
  "warning-edit-mode-description": "Dette varselet er allerede under endring av en annen bruker. Viktig informasjon kan gå tapt ved å bytte",
@@ -669,6 +765,9 @@ var warningsTranslations = {
669
765
  no: no
670
766
  };
671
767
 
768
+ function _OverloadYield(e, d) {
769
+ this.v = e, this.k = d;
770
+ }
672
771
  function asyncGeneratorStep(n, t, e, r, o, a, c) {
673
772
  try {
674
773
  var i = n[a](c),
@@ -703,306 +802,248 @@ function _objectWithoutPropertiesLoose(r, e) {
703
802
  }
704
803
  return t;
705
804
  }
706
- function _regeneratorRuntime() {
707
- _regeneratorRuntime = function () {
708
- return e;
709
- };
710
- var t,
711
- e = {},
712
- r = Object.prototype,
713
- n = r.hasOwnProperty,
714
- o = Object.defineProperty || function (t, e, r) {
715
- t[e] = r.value;
716
- },
717
- i = "function" == typeof Symbol ? Symbol : {},
718
- a = i.iterator || "@@iterator",
719
- c = i.asyncIterator || "@@asyncIterator",
720
- u = i.toStringTag || "@@toStringTag";
721
- function define(t, e, r) {
722
- return Object.defineProperty(t, e, {
723
- value: r,
724
- enumerable: true,
725
- configurable: true,
726
- writable: true
727
- }), t[e];
728
- }
729
- try {
730
- define({}, "");
731
- } catch (t) {
732
- define = function (t, e, r) {
733
- return t[e] = r;
734
- };
735
- }
736
- function wrap(t, e, r, n) {
737
- var i = e && e.prototype instanceof Generator ? e : Generator,
738
- a = Object.create(i.prototype),
739
- c = new Context(n || []);
740
- return o(a, "_invoke", {
741
- value: makeInvokeMethod(t, r, c)
742
- }), a;
743
- }
744
- function tryCatch(t, e, r) {
745
- try {
746
- return {
747
- type: "normal",
748
- arg: t.call(e, r)
749
- };
750
- } catch (t) {
751
- return {
752
- type: "throw",
753
- arg: t
805
+ function _regenerator() {
806
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
807
+ var e,
808
+ t,
809
+ r = "function" == typeof Symbol ? Symbol : {},
810
+ n = r.iterator || "@@iterator",
811
+ o = r.toStringTag || "@@toStringTag";
812
+ function i(r, n, o, i) {
813
+ var c = n && n.prototype instanceof Generator ? n : Generator,
814
+ u = Object.create(c.prototype);
815
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
816
+ var i,
817
+ c,
818
+ u,
819
+ f = 0,
820
+ p = o || [],
821
+ y = false,
822
+ G = {
823
+ p: 0,
824
+ n: 0,
825
+ v: e,
826
+ a: d,
827
+ f: d.bind(e, 4),
828
+ d: function (t, r) {
829
+ return i = t, c = 0, u = e, G.n = r, a;
830
+ }
831
+ };
832
+ function d(r, n) {
833
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
834
+ var o,
835
+ i = p[t],
836
+ d = G.p,
837
+ l = i[2];
838
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
839
+ }
840
+ if (o || r > 1) return a;
841
+ throw y = true, n;
842
+ }
843
+ return function (o, p, l) {
844
+ if (f > 1) throw TypeError("Generator is already running");
845
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
846
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
847
+ try {
848
+ if (f = 2, i) {
849
+ if (c || (o = "next"), t = i[o]) {
850
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
851
+ if (!t.done) return t;
852
+ u = t.value, c < 2 && (c = 0);
853
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
854
+ i = e;
855
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
856
+ } catch (t) {
857
+ i = e, c = 1, u = t;
858
+ } finally {
859
+ f = 1;
860
+ }
861
+ }
862
+ return {
863
+ value: t,
864
+ done: y
865
+ };
754
866
  };
755
- }
867
+ }(r, o, i), true), u;
756
868
  }
757
- e.wrap = wrap;
758
- var h = "suspendedStart",
759
- l = "suspendedYield",
760
- f = "executing",
761
- s = "completed",
762
- y = {};
869
+ var a = {};
763
870
  function Generator() {}
764
871
  function GeneratorFunction() {}
765
872
  function GeneratorFunctionPrototype() {}
766
- var p = {};
767
- define(p, a, function () {
873
+ t = Object.getPrototypeOf;
874
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
875
+ return this;
876
+ }), t),
877
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
878
+ function f(e) {
879
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
880
+ }
881
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
768
882
  return this;
883
+ }), _regeneratorDefine(u, "toString", function () {
884
+ return "[object Generator]";
885
+ }), (_regenerator = function () {
886
+ return {
887
+ w: i,
888
+ m: f
889
+ };
890
+ })();
891
+ }
892
+ function _regeneratorAsync(n, e, r, t, o) {
893
+ var a = _regeneratorAsyncGen(n, e, r, t, o);
894
+ return a.next().then(function (n) {
895
+ return n.done ? n.value : a.next();
769
896
  });
770
- var d = Object.getPrototypeOf,
771
- v = d && d(d(values([])));
772
- v && v !== r && n.call(v, a) && (p = v);
773
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
774
- function defineIteratorMethods(t) {
775
- ["next", "throw", "return"].forEach(function (e) {
776
- define(t, e, function (t) {
777
- return this._invoke(e, t);
897
+ }
898
+ function _regeneratorAsyncGen(r, e, t, o, n) {
899
+ return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
900
+ }
901
+ function _regeneratorAsyncIterator(t, e) {
902
+ function n(r, o, i, f) {
903
+ try {
904
+ var c = t[r](o),
905
+ u = c.value;
906
+ return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
907
+ n("next", t, i, f);
908
+ }, function (t) {
909
+ n("throw", t, i, f);
910
+ }) : e.resolve(u).then(function (t) {
911
+ c.value = t, i(c);
912
+ }, function (t) {
913
+ return n("throw", t, i, f);
778
914
  });
779
- });
915
+ } catch (t) {
916
+ f(t);
917
+ }
918
+ }
919
+ var r;
920
+ this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
921
+ return this;
922
+ })), _regeneratorDefine(this, "_invoke", function (t, o, i) {
923
+ function f() {
924
+ return new e(function (e, r) {
925
+ n(t, i, e, r);
926
+ });
927
+ }
928
+ return r = r ? r.then(f, f) : f();
929
+ }, true);
930
+ }
931
+ function _regeneratorDefine(e, r, n, t) {
932
+ var i = Object.defineProperty;
933
+ try {
934
+ i({}, "", {});
935
+ } catch (e) {
936
+ i = 0;
780
937
  }
781
- function AsyncIterator(t, e) {
782
- function invoke(r, o, i, a) {
783
- var c = tryCatch(t[r], t, o);
784
- if ("throw" !== c.type) {
785
- var u = c.arg,
786
- h = u.value;
787
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
788
- invoke("next", t, i, a);
789
- }, function (t) {
790
- invoke("throw", t, i, a);
791
- }) : e.resolve(h).then(function (t) {
792
- u.value = t, i(u);
793
- }, function (t) {
794
- return invoke("throw", t, i, a);
938
+ _regeneratorDefine = function (e, r, n, t) {
939
+ if (r) i ? i(e, r, {
940
+ value: n,
941
+ enumerable: !t,
942
+ configurable: !t,
943
+ writable: !t
944
+ }) : e[r] = n;else {
945
+ function o(r, n) {
946
+ _regeneratorDefine(e, r, function (e) {
947
+ return this._invoke(r, n, e);
795
948
  });
796
949
  }
797
- a(c.arg);
798
- }
799
- var r;
800
- o(this, "_invoke", {
801
- value: function (t, n) {
802
- function callInvokeWithMethodAndArg() {
803
- return new e(function (e, r) {
804
- invoke(t, n, e, r);
805
- });
806
- }
807
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
808
- }
809
- });
810
- }
811
- function makeInvokeMethod(e, r, n) {
812
- var o = h;
813
- return function (i, a) {
814
- if (o === f) throw Error("Generator is already running");
815
- if (o === s) {
816
- if ("throw" === i) throw a;
817
- return {
818
- value: t,
819
- done: true
950
+ o("next", 0), o("throw", 1), o("return", 2);
951
+ }
952
+ }, _regeneratorDefine(e, r, n, t);
953
+ }
954
+ function _regeneratorKeys(e) {
955
+ var n = Object(e),
956
+ r = [];
957
+ for (var t in n) r.unshift(t);
958
+ return function e() {
959
+ for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = false, e;
960
+ return e.done = true, e;
961
+ };
962
+ }
963
+ function _regeneratorValues(e) {
964
+ if (null != e) {
965
+ var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
966
+ r = 0;
967
+ if (t) return t.call(e);
968
+ if ("function" == typeof e.next) return e;
969
+ if (!isNaN(e.length)) return {
970
+ next: function () {
971
+ return e && r >= e.length && (e = void 0), {
972
+ value: e && e[r++],
973
+ done: !e
820
974
  };
821
975
  }
822
- for (n.method = i, n.arg = a;;) {
823
- var c = n.delegate;
824
- if (c) {
825
- var u = maybeInvokeDelegate(c, n);
826
- if (u) {
827
- if (u === y) continue;
828
- return u;
829
- }
830
- }
831
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
832
- if (o === h) throw o = s, n.arg;
833
- n.dispatchException(n.arg);
834
- } else "return" === n.method && n.abrupt("return", n.arg);
835
- o = f;
836
- var p = tryCatch(e, r, n);
837
- if ("normal" === p.type) {
838
- if (o = n.done ? s : l, p.arg === y) continue;
839
- return {
840
- value: p.arg,
841
- done: n.done
842
- };
843
- }
844
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
845
- }
846
976
  };
847
977
  }
848
- function maybeInvokeDelegate(e, r) {
849
- var n = r.method,
850
- o = e.iterator[n];
851
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
852
- var i = tryCatch(o, e.iterator, r.arg);
853
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
854
- var a = i.arg;
855
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
856
- }
857
- function pushTryEntry(t) {
858
- var e = {
859
- tryLoc: t[0]
860
- };
861
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
862
- }
863
- function resetTryEntry(t) {
864
- var e = t.completion || {};
865
- e.type = "normal", delete e.arg, t.completion = e;
866
- }
867
- function Context(t) {
868
- this.tryEntries = [{
869
- tryLoc: "root"
870
- }], t.forEach(pushTryEntry, this), this.reset(true);
978
+ throw new TypeError(typeof e + " is not iterable");
979
+ }
980
+ function _regeneratorRuntime() {
981
+
982
+ var r = _regenerator(),
983
+ e = r.m(_regeneratorRuntime),
984
+ t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
985
+ function n(r) {
986
+ var e = "function" == typeof r && r.constructor;
987
+ return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
871
988
  }
872
- function values(e) {
873
- if (e || "" === e) {
874
- var r = e[a];
875
- if (r) return r.call(e);
876
- if ("function" == typeof e.next) return e;
877
- if (!isNaN(e.length)) {
878
- var o = -1,
879
- i = function next() {
880
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
881
- return next.value = t, next.done = true, next;
882
- };
883
- return i.next = i;
989
+ var o = {
990
+ throw: 1,
991
+ return: 2,
992
+ break: 3,
993
+ continue: 3
994
+ };
995
+ function a(r) {
996
+ var e, t;
997
+ return function (n) {
998
+ e || (e = {
999
+ stop: function () {
1000
+ return t(n.a, 2);
1001
+ },
1002
+ catch: function () {
1003
+ return n.v;
1004
+ },
1005
+ abrupt: function (r, e) {
1006
+ return t(n.a, o[r], e);
1007
+ },
1008
+ delegateYield: function (r, o, a) {
1009
+ return e.resultName = o, t(n.d, _regeneratorValues(r), a);
1010
+ },
1011
+ finish: function (r) {
1012
+ return t(n.f, r);
1013
+ }
1014
+ }, t = function (r, t, o) {
1015
+ n.p = e.prev, n.n = e.next;
1016
+ try {
1017
+ return r(t, o);
1018
+ } finally {
1019
+ e.next = n.n;
1020
+ }
1021
+ }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
1022
+ try {
1023
+ return r.call(this, e);
1024
+ } finally {
1025
+ n.p = e.prev, n.n = e.next;
884
1026
  }
885
- }
886
- throw new TypeError(typeof e + " is not iterable");
1027
+ };
887
1028
  }
888
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
889
- value: GeneratorFunctionPrototype,
890
- configurable: true
891
- }), o(GeneratorFunctionPrototype, "constructor", {
892
- value: GeneratorFunction,
893
- configurable: true
894
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
895
- var e = "function" == typeof t && t.constructor;
896
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
897
- }, e.mark = function (t) {
898
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
899
- }, e.awrap = function (t) {
1029
+ return (_regeneratorRuntime = function () {
900
1030
  return {
901
- __await: t
902
- };
903
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
904
- return this;
905
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
906
- void 0 === i && (i = Promise);
907
- var a = new AsyncIterator(wrap(t, r, n, o), i);
908
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
909
- return t.done ? t.value : a.next();
910
- });
911
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
912
- return this;
913
- }), define(g, "toString", function () {
914
- return "[object Generator]";
915
- }), e.keys = function (t) {
916
- var e = Object(t),
917
- r = [];
918
- for (var n in e) r.push(n);
919
- return r.reverse(), function next() {
920
- for (; r.length;) {
921
- var t = r.pop();
922
- if (t in e) return next.value = t, next.done = false, next;
923
- }
924
- return next.done = true, next;
1031
+ wrap: function (e, t, n, o) {
1032
+ return r.w(a(e), t, n, o && o.reverse());
1033
+ },
1034
+ isGeneratorFunction: n,
1035
+ mark: r.m,
1036
+ awrap: function (r, e) {
1037
+ return new _OverloadYield(r, e);
1038
+ },
1039
+ AsyncIterator: _regeneratorAsyncIterator,
1040
+ async: function (r, e, t, o, u) {
1041
+ return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
1042
+ },
1043
+ keys: _regeneratorKeys,
1044
+ values: _regeneratorValues
925
1045
  };
926
- }, e.values = values, Context.prototype = {
927
- constructor: Context,
928
- reset: function (e) {
929
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
930
- },
931
- stop: function () {
932
- this.done = true;
933
- var t = this.tryEntries[0].completion;
934
- if ("throw" === t.type) throw t.arg;
935
- return this.rval;
936
- },
937
- dispatchException: function (e) {
938
- if (this.done) throw e;
939
- var r = this;
940
- function handle(n, o) {
941
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
942
- }
943
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
944
- var i = this.tryEntries[o],
945
- a = i.completion;
946
- if ("root" === i.tryLoc) return handle("end");
947
- if (i.tryLoc <= this.prev) {
948
- var c = n.call(i, "catchLoc"),
949
- u = n.call(i, "finallyLoc");
950
- if (c && u) {
951
- if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
952
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
953
- } else if (c) {
954
- if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
955
- } else {
956
- if (!u) throw Error("try statement without catch or finally");
957
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
958
- }
959
- }
960
- }
961
- },
962
- abrupt: function (t, e) {
963
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
964
- var o = this.tryEntries[r];
965
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
966
- var i = o;
967
- break;
968
- }
969
- }
970
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
971
- var a = i ? i.completion : {};
972
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
973
- },
974
- complete: function (t, e) {
975
- if ("throw" === t.type) throw t.arg;
976
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
977
- },
978
- finish: function (t) {
979
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
980
- var r = this.tryEntries[e];
981
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
982
- }
983
- },
984
- catch: function (t) {
985
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
986
- var r = this.tryEntries[e];
987
- if (r.tryLoc === t) {
988
- var n = r.completion;
989
- if ("throw" === n.type) {
990
- var o = n.arg;
991
- resetTryEntry(r);
992
- }
993
- return o;
994
- }
995
- }
996
- throw Error("illegal catch attempt");
997
- },
998
- delegateYield: function (e, r, n) {
999
- return this.delegate = {
1000
- iterator: values(e),
1001
- resultName: r,
1002
- nextLoc: n
1003
- }, "next" === this.method && (this.arg = t), y;
1004
- }
1005
- }, e;
1046
+ })();
1006
1047
  }
1007
1048
 
1008
1049
  /* *
@@ -1048,9 +1089,9 @@ var drawAdapter = createEntityAdapter({
1048
1089
  return draw.drawingInstanceId;
1049
1090
  }
1050
1091
  });
1051
- var initialState$2 = drawAdapter.getInitialState();
1092
+ var initialState$3 = drawAdapter.getInitialState();
1052
1093
  var slice$2 = createSlice({
1053
- initialState: initialState$2,
1094
+ initialState: initialState$3,
1054
1095
  name: 'drawingForm',
1055
1096
  reducers: {
1056
1097
  setDrawValues: function setDrawValues(draft, action) {
@@ -1199,7 +1240,7 @@ var useCloseDrawDialog = function useCloseDrawDialog(_ref) {
1199
1240
  });
1200
1241
  var confirmDialog = useConfirmationDialog();
1201
1242
  var closeDrawDialog = /*#__PURE__*/function () {
1202
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(skipConfirmationDialog) {
1243
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(skipConfirmationDialog) {
1203
1244
  var mayProceed;
1204
1245
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1205
1246
  while (1) switch (_context.prev = _context.next) {
@@ -1371,7 +1412,7 @@ var useObjectDrawDialogAction = function useObjectDrawDialogAction(_ref5) {
1371
1412
  }));
1372
1413
  };
1373
1414
  var openObjectDialog = /*#__PURE__*/function () {
1374
- var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1415
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1375
1416
  var mayProceed;
1376
1417
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1377
1418
  while (1) switch (_context2.prev = _context2.next) {
@@ -2023,7 +2064,7 @@ var getAreaKeywords = function getAreaKeywords(auth) {
2023
2064
  }).then(handleResponse);
2024
2065
  };
2025
2066
  var saveDrawingAs = /*#__PURE__*/function () {
2026
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth, data) {
2067
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth, data) {
2027
2068
  var response;
2028
2069
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2029
2070
  while (1) switch (_context.prev = _context.next) {
@@ -2134,9 +2175,9 @@ var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
2134
2175
  * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
2135
2176
  * */
2136
2177
  var TAKEOVER_MESSAGE = 'You are no longer the editor of this warning';
2137
- var initialState$1 = {};
2178
+ var initialState$2 = {};
2138
2179
  var slice$1 = createSlice({
2139
- initialState: initialState$1,
2180
+ initialState: initialState$2,
2140
2181
  name: 'publicWarningForm',
2141
2182
  reducers: {
2142
2183
  setFormValues: function setFormValues(draft, action) {
@@ -2256,7 +2297,7 @@ var publicWarningFormListener = createListenerMiddleware();
2256
2297
  publicWarningFormListener.startListening({
2257
2298
  actionCreator: publicWarningFormActions.openPublicWarningFormDialog,
2258
2299
  effect: function () {
2259
- var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
2300
+ var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
2260
2301
  var payload, panelId;
2261
2302
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2262
2303
  while (1) switch (_context.prev = _context.next) {
@@ -2284,7 +2325,7 @@ publicWarningFormListener.startListening({
2284
2325
  publicWarningFormListener.startListening({
2285
2326
  actionCreator: uiActions.setToggleOpenDialog,
2286
2327
  effect: function () {
2287
- var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2, listenerApi) {
2328
+ var _effect2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2, listenerApi) {
2288
2329
  var payload;
2289
2330
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2290
2331
  while (1) switch (_context2.prev = _context2.next) {
@@ -2452,14 +2493,14 @@ var publicWarningsAdapter = createEntityAdapter({
2452
2493
  return warning.id;
2453
2494
  }
2454
2495
  });
2455
- var initialState = {
2496
+ var initialState$1 = {
2456
2497
  warnings: publicWarningsAdapter.getInitialState(),
2457
2498
  isLoading: true,
2458
2499
  lastUpdatedTime: '',
2459
2500
  filterState: {}
2460
2501
  };
2461
2502
  var slice = createSlice({
2462
- initialState: initialState,
2503
+ initialState: initialState$1,
2463
2504
  name: 'publicWarnings',
2464
2505
  reducers: {
2465
2506
  setWarningFilters: function setWarningFilters(draft, action) {
@@ -2964,7 +3005,7 @@ var useMutatePublicWarningEditor = function useMutatePublicWarningEditor() {
2964
3005
  }
2965
3006
  }), {
2966
3007
  onSuccess: function () {
2967
- var _onSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, _ref3) {
3008
+ var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, _ref3) {
2968
3009
  var isEditor;
2969
3010
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2970
3011
  while (1) switch (_context.prev = _context.next) {
@@ -3014,7 +3055,7 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
3014
3055
  }));
3015
3056
  },
3016
3057
  onSuccess: function () {
3017
- var _onSuccess2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, variables) {
3058
+ var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, variables) {
3018
3059
  var location, warningDetail, newId, newWarning;
3019
3060
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3020
3061
  while (1) switch (_context2.prev = _context2.next) {
@@ -3080,7 +3121,7 @@ var useMutateDeleteWarning = function useMutateDeleteWarning() {
3080
3121
  return deleteWarning(id, auth);
3081
3122
  },
3082
3123
  onSuccess: function () {
3083
- var _onSuccess3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_, variables) {
3124
+ var _onSuccess3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_, variables) {
3084
3125
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3085
3126
  while (1) switch (_context3.prev = _context3.next) {
3086
3127
  case 0:
@@ -3148,7 +3189,7 @@ var useMutateSaveOrUpdateDrawing = function useMutateSaveOrUpdateDrawing() {
3148
3189
  var queryClient = useQueryClient();
3149
3190
  return useMutation({
3150
3191
  mutationFn: function () {
3151
- var _mutationFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref6) {
3192
+ var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref6) {
3152
3193
  var data, id, headers, location, newId;
3153
3194
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
3154
3195
  while (1) switch (_context4.prev = _context4.next) {
@@ -3218,7 +3259,7 @@ var useMutateDeleteDrawing = function useMutateDeleteDrawing() {
3218
3259
  var dispatch = useDispatch();
3219
3260
  return useMutation({
3220
3261
  mutationFn: function () {
3221
- var _mutationFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) {
3262
+ var _mutationFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) {
3222
3263
  var drawingId;
3223
3264
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
3224
3265
  while (1) switch (_context5.prev = _context5.next) {
@@ -3396,7 +3437,7 @@ var ObjectManagerConnect = function ObjectManagerConnect(_ref) {
3396
3437
  }
3397
3438
  };
3398
3439
  var onClickDrawing = /*#__PURE__*/function () {
3399
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(drawing) {
3440
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(drawing) {
3400
3441
  var isActive;
3401
3442
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3402
3443
  while (1) switch (_context.prev = _context.next) {
@@ -4194,10 +4235,21 @@ var DEFAULT_WARNING_DIALOG_MIN_SIZE = {
4194
4235
  width: 264,
4195
4236
  height: 300
4196
4237
  };
4238
+ var getTitle = function getTitle(warningType, t) {
4239
+ if (warningType === 'airmet' || warningType === 'sigmet') {
4240
+ return warningType == null ? void 0 : warningType.toUpperCase();
4241
+ }
4242
+ if (warningType === 'maritimeWarningCoastal') {
4243
+ return t('maritime-warning-title-coastal');
4244
+ }
4245
+ if (warningType === 'maritimeWarningNorthSea') {
4246
+ return t('maritime-warning-title-northsea');
4247
+ }
4248
+ return t('public-warning-title');
4249
+ };
4197
4250
  var PublicWarningsFormDialog = function PublicWarningsFormDialog(_ref) {
4198
4251
  var bounds = _ref.bounds,
4199
4252
  onClose = _ref.onClose,
4200
- title = _ref.title,
4201
4253
  isOpen = _ref.isOpen,
4202
4254
  _ref$onMouseDown = _ref.onMouseDown,
4203
4255
  onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
@@ -4234,7 +4286,7 @@ var PublicWarningsFormDialog = function PublicWarningsFormDialog(_ref) {
4234
4286
  var _React$useState = React.useState(startSizeCalc),
4235
4287
  sizeInState = _React$useState[0],
4236
4288
  setSizeInState = _React$useState[1];
4237
- var fullTitle = selectedAviationProduct ? warningType == null ? void 0 : warningType.toUpperCase() : title || t('public-warning-title');
4289
+ var fullTitle = getTitle(warningType, t);
4238
4290
  var onChangeMode = function onChangeMode() {
4239
4291
  onChangeFormMode(!isReadOnly);
4240
4292
  };
@@ -4374,8 +4426,8 @@ var getAirmetTAC = function getAirmetTAC(auth, product) {
4374
4426
  body: JSON.stringify(product),
4375
4427
  method: 'POST',
4376
4428
  headers: getHeaders(auth)
4377
- }).then( /*#__PURE__*/function () {
4378
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(r) {
4429
+ }).then(/*#__PURE__*/function () {
4430
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(r) {
4379
4431
  var textData;
4380
4432
  return _regeneratorRuntime().wrap(function _callee$(_context) {
4381
4433
  while (1) switch (_context.prev = _context.next) {
@@ -4409,8 +4461,8 @@ var getSigmetTAC = function getSigmetTAC(auth, product) {
4409
4461
  body: JSON.stringify(product),
4410
4462
  method: 'POST',
4411
4463
  headers: getHeaders(auth)
4412
- }).then( /*#__PURE__*/function () {
4413
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(r) {
4464
+ }).then(/*#__PURE__*/function () {
4465
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(r) {
4414
4466
  var textData;
4415
4467
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
4416
4468
  while (1) switch (_context2.prev = _context2.next) {
@@ -4551,7 +4603,7 @@ var usePostSigmet = function usePostSigmet() {
4551
4603
  }));
4552
4604
  },
4553
4605
  onSuccess: function () {
4554
- var _onSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, variables) {
4606
+ var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, variables) {
4555
4607
  var snackbarKey, warningType;
4556
4608
  return _regeneratorRuntime().wrap(function _callee$(_context) {
4557
4609
  while (1) switch (_context.prev = _context.next) {
@@ -4612,7 +4664,7 @@ var usePostAirmet = function usePostAirmet() {
4612
4664
  }));
4613
4665
  },
4614
4666
  onSuccess: function () {
4615
- var _onSuccess2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, variables) {
4667
+ var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, variables) {
4616
4668
  var snackbarKey, warningType;
4617
4669
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
4618
4670
  while (1) switch (_context2.prev = _context2.next) {
@@ -5569,70 +5621,1346 @@ var ValidUntil = function ValidUntil(_ref) {
5569
5621
  });
5570
5622
  };
5571
5623
 
5572
- var _excluded$4 = ["IS_DRAFT", "object", "translation-select"];
5573
- var useScrollTopOnError = function useScrollTopOnError(error) {
5574
- var ref = React.useRef(null);
5575
- React.useEffect(function () {
5576
- if (error != null && error.message && ref.current) {
5577
- ref.current.scrollTop = 0;
5578
- }
5579
- }, [error]);
5580
- return ref;
5581
- };
5582
- var getEmptyPublicWarning = function getEmptyPublicWarning() {
5583
- var currentTime = new Date();
5584
- var validFromTime = dateUtils.add(currentTime, {
5585
- minutes: 15
5624
+ var AreaList = /*#__PURE__*/React__default.memo(function (_ref) {
5625
+ var areas = _ref.areas,
5626
+ selected = _ref.selected,
5627
+ disabled = _ref.disabled,
5628
+ onClickItem = _ref.onClickItem;
5629
+ return jsx(Stack, {
5630
+ "data-testid": "arealist",
5631
+ direction: "row",
5632
+ spacing: 1,
5633
+ sx: {
5634
+ display: 'block',
5635
+ '.MuiChip-root': {
5636
+ margin: 0,
5637
+ marginRight: 1,
5638
+ marginBottom: 1
5639
+ }
5640
+ },
5641
+ children: areas.map(function (area) {
5642
+ var isDisabled = disabled.includes(area.id);
5643
+ var isSelected = !isDisabled && selected.includes(area.id);
5644
+ return jsx(FilterChip, {
5645
+ id: area.id,
5646
+ label: area.label,
5647
+ isSelected: isSelected,
5648
+ isDisabled: isDisabled,
5649
+ onClick: function onClick() {
5650
+ return onClickItem == null ? void 0 : onClickItem(area.id);
5651
+ },
5652
+ size: "medium"
5653
+ }, area.id);
5654
+ })
5586
5655
  });
5587
- var validUntilTime = dateUtils.add(currentTime, {
5588
- hours: 6,
5589
- minutes: 15
5656
+ });
5657
+
5658
+ var _excluded$4 = ["title", "width", "onClick", "isSorted", "sortDirection", "sortable"];
5659
+ var sharedArrowIconStyles = {
5660
+ fontSize: '0.9rem'
5661
+ };
5662
+ var WarningListHeaderContent = function WarningListHeaderContent(_ref) {
5663
+ var title = _ref.title,
5664
+ _ref$width = _ref.width,
5665
+ width = _ref$width === void 0 ? 76 : _ref$width,
5666
+ _onClick = _ref.onClick,
5667
+ isSorted = _ref.isSorted,
5668
+ sortDirection = _ref.sortDirection,
5669
+ sortable = _ref.sortable,
5670
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
5671
+ return jsx(Grid, {
5672
+ sx: Object.assign({}, props.sx, {
5673
+ width: width,
5674
+ cursor: _onClick ? 'pointer' : 'default'
5675
+ }),
5676
+ onClick: function onClick(e) {
5677
+ e.stopPropagation(); // Ensure click only affects this column
5678
+ _onClick == null || _onClick();
5679
+ },
5680
+ children: jsxs(Box, {
5681
+ sx: {
5682
+ display: 'flex',
5683
+ alignItems: 'center',
5684
+ overflow: 'hidden',
5685
+ fontWeight: 'normal',
5686
+ textOverflow: 'ellipsis',
5687
+ fontSize: 12,
5688
+ lineHeight: 1.33,
5689
+ height: 16,
5690
+ color: 'geowebColors.captions.captionStatus.rgba'
5691
+ },
5692
+ children: [title, sortable && jsx(Box, {
5693
+ sx: {
5694
+ display: 'flex',
5695
+ alignItems: 'center',
5696
+ marginLeft: '4px',
5697
+ color: isSorted ? '#186DFF' : 'inherit'
5698
+ },
5699
+ children: isSorted && sortDirection === 'asc' ? jsx(ArrowUpCompact, {
5700
+ sx: Object.assign({}, sharedArrowIconStyles),
5701
+ "data-testid": "ArrowUpIcon"
5702
+ }) : jsx(ArrowDownCompact, {
5703
+ sx: Object.assign({}, sharedArrowIconStyles),
5704
+ "data-testid": "ArrowDownIcon"
5705
+ })
5706
+ })]
5707
+ })
5590
5708
  });
5591
- return {
5592
- id: '',
5593
- phenomenon: '',
5594
- validFrom: dateUtils.dateToString(validFromTime),
5595
- validUntil: dateUtils.dateToString(validUntilTime),
5596
- level: '',
5597
- probability: 30,
5598
- descriptionOriginal: '',
5599
- descriptionTranslation: '',
5600
- areas: []
5601
- };
5602
5709
  };
5603
- var getFormData = function getFormData(publicWarningsDetails, object) {
5604
- var data = Object.assign({
5605
- IS_DRAFT: '',
5606
- 'translation-select': ''
5607
- }, publicWarningsDetails ? Object.assign({}, getEmptyPublicWarning(), publicWarningsDetails) : getEmptyPublicWarning(), {
5608
- object: object
5710
+
5711
+ var AssignedAreas = function AssignedAreas(_ref) {
5712
+ var _sx;
5713
+ var assignedAreas = _ref.assignedAreas,
5714
+ selectedAreaIds = _ref.selectedAreaIds,
5715
+ onAddClick = _ref.onAddClick,
5716
+ onDeleteClick = _ref.onDeleteClick,
5717
+ onToggleSelectArea = _ref.onToggleSelectArea,
5718
+ _ref$shouldShowDistri = _ref.shouldShowDistricts,
5719
+ shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
5720
+ var _useWarningsTranslati = useWarningsTranslation(),
5721
+ t = _useWarningsTranslati.t;
5722
+ var assignedAreaIds = React__default.useMemo(function () {
5723
+ return new Set(assignedAreas.map(function (area) {
5724
+ return area.id;
5725
+ }));
5726
+ }, [assignedAreas]);
5727
+ // can add the selected areas when they don't appear in the assigned area list
5728
+ var canAddSelectedAreas = React__default.useMemo(function () {
5729
+ return selectedAreaIds.length > 0 && selectedAreaIds.every(function (id) {
5730
+ return !assignedAreaIds.has(id);
5731
+ });
5732
+ }, [selectedAreaIds, assignedAreaIds]);
5733
+ var theme = useTheme();
5734
+ return jsxs(Box, {
5735
+ sx: {
5736
+ display: 'flex',
5737
+ gridArea: 'areas',
5738
+ gap: 1,
5739
+ minHeight: 32,
5740
+ marginLeft: 1,
5741
+ paddingInline: 0.5,
5742
+ borderRadius: 1
5743
+ },
5744
+ style: {
5745
+ backgroundColor: canAddSelectedAreas ? theme.palette.geowebColors.cards.cardContainerMouseOver : undefined
5746
+ },
5747
+ children: [assignedAreas.length === 0 && jsx(Typography, {
5748
+ variant: "caption",
5749
+ color: "textSecondary",
5750
+ sx: {
5751
+ alignSelf: 'center'
5752
+ },
5753
+ children: shouldShowDistricts ? t('maritime-no-district-selected') : t('maritime-no-area-selected')
5754
+ }), jsx(Box, {
5755
+ sx: (_sx = {
5756
+ flexGrow: 1,
5757
+ display: 'flex',
5758
+ flexDirection: 'column',
5759
+ gap: 0.5,
5760
+ paddingBlock: 0.5,
5761
+ alignItems: 'flex-start'
5762
+ }, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
5763
+ flexWrap: 'wrap',
5764
+ flexDirection: 'row'
5765
+ }, _sx),
5766
+ children: assignedAreas.map(function (area) {
5767
+ var isSelected = selectedAreaIds.includes(area.id);
5768
+ return jsx(FilterChip, {
5769
+ size: "small",
5770
+ id: area.id,
5771
+ label: area.label,
5772
+ isSelected: isSelected,
5773
+ onClick: function onClick() {
5774
+ return onToggleSelectArea(area.id);
5775
+ },
5776
+ onClickIcon: isSelected ? function () {
5777
+ return onDeleteClick(area.id);
5778
+ } : undefined
5779
+ }, area.id);
5780
+ })
5781
+ }), jsx(AddButton, {
5782
+ show: canAddSelectedAreas,
5783
+ onClick: onAddClick
5784
+ })]
5609
5785
  });
5610
- return data;
5611
5786
  };
5612
- // tablet breakpoint - 2 padding * 2 for both sides
5613
- var containerQueryBreakpoint = "@container (min-width: " + (breakpoints.tablet - 32) + "px)";
5614
- var spinnerSx = {
5615
- width: '16px!important',
5616
- height: '16px!important',
5617
- position: 'absolute',
5618
- top: 0,
5619
- bottom: 0,
5620
- margin: 'auto',
5621
- marginLeft: 1
5787
+ var AddButton = function AddButton(_ref2) {
5788
+ var onClick = _ref2.onClick,
5789
+ show = _ref2.show;
5790
+ var _useWarningsTranslati2 = useWarningsTranslation(),
5791
+ t = _useWarningsTranslati2.t;
5792
+ return jsx(Button, {
5793
+ onClick: onClick,
5794
+ variant: "primary",
5795
+ style: {
5796
+ visibility: show ? 'visible' : 'hidden'
5797
+ },
5798
+ sx: function sx(theme) {
5799
+ return Object.assign({
5800
+ alignSelf: 'flex-start',
5801
+ height: 16,
5802
+ minWidth: 0,
5803
+ flexShrink: 0,
5804
+ marginTop: 0.5
5805
+ }, theme.typography.caption);
5806
+ },
5807
+ children: t('maritime-add-area')
5808
+ });
5622
5809
  };
5623
- var ContainerWrapper = styled('div')(function () {
5624
- return {
5625
- containerType: 'size',
5626
- height: '100%'
5627
- };
5628
- });
5629
- var ContainerFormWrapper = styled('div')(function (_ref) {
5630
- var _ref2;
5631
- var _ref$isReadOnly = _ref.isReadOnly,
5632
- isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
5633
- theme = _ref.theme;
5634
- return _ref2 = {
5635
- padding: theme.spacing(2),
5810
+
5811
+ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
5812
+ var options = _ref.options,
5813
+ value = _ref.value,
5814
+ label = _ref.label,
5815
+ _onChange = _ref.onChange,
5816
+ renderOption = _ref.renderOption,
5817
+ renderValue = _ref.renderValue,
5818
+ gridArea = _ref.gridArea,
5819
+ additionalStyling = _ref.additionalStyling,
5820
+ _ref$isDisabled = _ref.isDisabled,
5821
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
5822
+ var currentIndex = options.findIndex(function (option) {
5823
+ return option.value === value;
5824
+ });
5825
+ return jsx(FormControl, {
5826
+ style: {
5827
+ width: '100%',
5828
+ gridArea: gridArea
5829
+ },
5830
+ children: jsxs(TooltipSelect, {
5831
+ disableUnderline: true,
5832
+ tooltip: "",
5833
+ style: {
5834
+ maxWidth: '100%'
5835
+ },
5836
+ isEnabled: !isDisabled,
5837
+ disabled: isDisabled,
5838
+ value: value != null ? value : '',
5839
+ SelectDisplayProps: {
5840
+ 'aria-label': label
5841
+ },
5842
+ list: options,
5843
+ additionalStyling: additionalStyling,
5844
+ currentIndex: currentIndex > -1 ? currentIndex : undefined,
5845
+ renderValue: renderValue,
5846
+ onChange: function onChange(event) {
5847
+ _onChange(event.target.value);
5848
+ },
5849
+ onChangeMouseWheel: function onChangeMouseWheel(event) {
5850
+ _onChange(event.value);
5851
+ },
5852
+ children: [jsx(MenuItem, {
5853
+ disabled: true,
5854
+ sx: {
5855
+ display: 'none'
5856
+ }
5857
+ }), options.map(function (option, index) {
5858
+ if (renderOption) {
5859
+ return renderOption(option, index);
5860
+ }
5861
+ return jsx(MenuItem, {
5862
+ value: option.value,
5863
+ sx: function sx(theme) {
5864
+ return {
5865
+ '&.MuiMenuItem-root': Object.assign({}, theme.typography.caption)
5866
+ };
5867
+ },
5868
+ children: typeof option.label === 'function' ? option.label(t) : option.label
5869
+ }, option.value);
5870
+ })]
5871
+ })
5872
+ });
5873
+ });
5874
+
5875
+ var WindForceLevel;
5876
+ (function (WindForceLevel) {
5877
+ WindForceLevel["moderate"] = "moderate";
5878
+ WindForceLevel["severe"] = "severe";
5879
+ WindForceLevel["extreme"] = "extreme";
5880
+ })(WindForceLevel || (WindForceLevel = {}));
5881
+ var windForceStyles = {
5882
+ moderate: {
5883
+ color: '#FAE21E',
5884
+ textColor: '#051039',
5885
+ borderColor: '#FBFE02'
5886
+ },
5887
+ severe: {
5888
+ color: '#E27000',
5889
+ textColor: '#051039',
5890
+ borderColor: '#FEAE02'
5891
+ },
5892
+ extreme: {
5893
+ color: '#D62A20',
5894
+ textColor: '#ffffff',
5895
+ borderColor: '#FF0000'
5896
+ }
5897
+ };
5898
+ var WindForceSelect = function WindForceSelect(_ref) {
5899
+ var onChange = _ref.onChange,
5900
+ value = _ref.value,
5901
+ gridArea = _ref.gridArea,
5902
+ options = _ref.options;
5903
+ var warningListOptions = React__default.useMemo(function () {
5904
+ return options.map(function (option) {
5905
+ return {
5906
+ value: option.value,
5907
+ label: option.value
5908
+ };
5909
+ });
5910
+ }, [options]);
5911
+ var _useWarningsTranslati = useWarningsTranslation(),
5912
+ t = _useWarningsTranslati.t;
5913
+ var renderValue = React__default.useCallback(function (optionValue) {
5914
+ var option = options.find(function (option) {
5915
+ return option.value === optionValue;
5916
+ });
5917
+ var level = option.level;
5918
+ var colors = windForceStyles[level];
5919
+ return jsx(Box, {
5920
+ sx: {
5921
+ background: colors.color,
5922
+ color: colors.textColor,
5923
+ width: 'calc(100% + 24px)',
5924
+ padding: [1.5, 1],
5925
+ marginLeft: -1
5926
+ },
5927
+ children: optionValue
5928
+ });
5929
+ }, [options]);
5930
+ var renderOption = React__default.useCallback(function (option, index) {
5931
+ var level = options[index].level;
5932
+ var colors = windForceStyles[level];
5933
+ return jsx(MenuItem, {
5934
+ value: option.value,
5935
+ sx: function sx(theme) {
5936
+ return {
5937
+ '&.MuiMenuItem-root': Object.assign({
5938
+ padding: 1
5939
+ }, theme.typography.caption),
5940
+ '.MuiSelect-select & ': {
5941
+ marginLeft: '-8px'
5942
+ }
5943
+ };
5944
+ },
5945
+ children: jsx(Box, {
5946
+ sx: {
5947
+ background: colors.color,
5948
+ color: colors.textColor,
5949
+ width: '100%',
5950
+ padding: [1.5, 1]
5951
+ },
5952
+ children: t('maritime-windforce', {
5953
+ value: option.value
5954
+ })
5955
+ })
5956
+ }, option.value);
5957
+ }, [t, options]);
5958
+ // change the arrow color for the select when the selected option has the level "extreme"
5959
+ var option = options.find(function (option) {
5960
+ return option.value === value;
5961
+ });
5962
+ var arrowColor = (option == null ? void 0 : option.level) === WindForceLevel.extreme ? '#fff' : undefined;
5963
+ return jsx(WarningListSelect, {
5964
+ label: t('maritime-header-windforce'),
5965
+ gridArea: gridArea,
5966
+ options: warningListOptions,
5967
+ value: value,
5968
+ onChange: onChange,
5969
+ renderOption: renderOption,
5970
+ renderValue: renderValue,
5971
+ additionalStyling: {
5972
+ '& .MuiSvgIcon-root': {
5973
+ fill: arrowColor
5974
+ },
5975
+ '& .MuiSelect-standard': {
5976
+ paddingBlock: 0
5977
+ }
5978
+ }
5979
+ });
5980
+ };
5981
+
5982
+ var windDirections = [{
5983
+ value: 'NORTH',
5984
+ label: function label(t) {
5985
+ return t('maritime-direction-n');
5986
+ }
5987
+ }, {
5988
+ value: 'NORTH_TO_NORTHEAST',
5989
+ label: function label(t) {
5990
+ return t('maritime-direction-nne');
5991
+ }
5992
+ }, {
5993
+ value: 'NORTHEAST',
5994
+ label: function label(t) {
5995
+ return t('maritime-direction-ne');
5996
+ }
5997
+ }, {
5998
+ value: 'NORTHEAST_TO_NORTH',
5999
+ label: function label(t) {
6000
+ return t('maritime-direction-nen');
6001
+ }
6002
+ }, {
6003
+ value: 'EAST',
6004
+ label: function label(t) {
6005
+ return t('maritime-direction-e');
6006
+ }
6007
+ }, {
6008
+ value: 'EAST_TO_SOUTHEAST',
6009
+ label: function label(t) {
6010
+ return t('maritime-direction-ese');
6011
+ }
6012
+ }, {
6013
+ value: 'SOUTHEAST',
6014
+ label: function label(t) {
6015
+ return t('maritime-direction-se');
6016
+ }
6017
+ }, {
6018
+ value: 'SOUTHEAST_TO_SOUTH',
6019
+ label: function label(t) {
6020
+ return t('maritime-direction-ses');
6021
+ }
6022
+ }, {
6023
+ value: 'SOUTH',
6024
+ label: function label(t) {
6025
+ return t('maritime-direction-s');
6026
+ }
6027
+ }, {
6028
+ value: 'SOUTH_TO_SOUTHWEST',
6029
+ label: function label(t) {
6030
+ return t('maritime-direction-ssw');
6031
+ }
6032
+ }, {
6033
+ value: 'SOUTHWEST',
6034
+ label: function label(t) {
6035
+ return t('maritime-direction-sw');
6036
+ }
6037
+ }, {
6038
+ value: 'SOUTHWEST_TO_WEST',
6039
+ label: function label(t) {
6040
+ return t('maritime-direction-sww');
6041
+ }
6042
+ }, {
6043
+ value: 'WEST',
6044
+ label: function label(t) {
6045
+ return t('maritime-direction-w');
6046
+ }
6047
+ }, {
6048
+ value: 'WEST_TO_NORTHWEST',
6049
+ label: function label(t) {
6050
+ return t('maritime-direction-wnw');
6051
+ }
6052
+ }, {
6053
+ value: 'NORTHWEST',
6054
+ label: function label(t) {
6055
+ return t('maritime-direction-nw');
6056
+ }
6057
+ }, {
6058
+ value: 'NORTHWEST_TO_NORTH',
6059
+ label: function label(t) {
6060
+ return t('maritime-direction-nwn');
6061
+ }
6062
+ }];
6063
+ var change = [{
6064
+ value: 'NO_CHANGE',
6065
+ label: function label(t) {
6066
+ return t('maritime-no-change');
6067
+ }
6068
+ }, {
6069
+ value: 'BACKING',
6070
+ label: function label(t) {
6071
+ return t('maritime-backing');
6072
+ }
6073
+ }, {
6074
+ value: 'VEERING',
6075
+ label: function label(t) {
6076
+ return t('maritime-veering');
6077
+ }
6078
+ }];
6079
+ var windForce = [{
6080
+ level: WindForceLevel.extreme,
6081
+ value: '12'
6082
+ }, {
6083
+ level: WindForceLevel.extreme,
6084
+ value: '11'
6085
+ }, {
6086
+ level: WindForceLevel.extreme,
6087
+ value: '10'
6088
+ }, {
6089
+ level: WindForceLevel.severe,
6090
+ value: '9'
6091
+ }, {
6092
+ level: WindForceLevel.severe,
6093
+ value: '8'
6094
+ }, {
6095
+ level: WindForceLevel.moderate,
6096
+ value: '7'
6097
+ }, {
6098
+ level: WindForceLevel.moderate,
6099
+ value: '6'
6100
+ }];
6101
+
6102
+ var WarningListDragHandle = function WarningListDragHandle() {
6103
+ return jsx(CustomIconButton, {
6104
+ className: "handle",
6105
+ tabIndex: -1,
6106
+ disableTouchRipple: true,
6107
+ sx: {
6108
+ '&.handle:hover': function handleHover(theme) {
6109
+ return Object.assign({}, theme.palette.geowebColors.layerManager.dragHandleHover);
6110
+ },
6111
+ cursor: 'grab',
6112
+ marginTop: 0.5
6113
+ },
6114
+ children: jsx(DragHandle, {})
6115
+ });
6116
+ };
6117
+
6118
+ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
6119
+ var warning = _ref.warning,
6120
+ areas = _ref.areas,
6121
+ selectedAreaIds = _ref.selectedAreaIds,
6122
+ onAddClick = _ref.onAddClick,
6123
+ onRemove = _ref.onRemove,
6124
+ onChange = _ref.onChange,
6125
+ onToggleSelectArea = _ref.onToggleSelectArea,
6126
+ onRemoveArea = _ref.onRemoveArea,
6127
+ _ref$shouldShowDistri = _ref.shouldShowDistricts,
6128
+ shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
6129
+ var areasById = React__default.useMemo(function () {
6130
+ return new Map(areas.map(function (area) {
6131
+ return [area.id, area];
6132
+ }));
6133
+ }, [areas]);
6134
+ var assignedAreas = React__default.useMemo(function () {
6135
+ return warning.assignedAreaIds.map(function (areaId) {
6136
+ return areasById.get(areaId);
6137
+ }).filter(function (area) {
6138
+ return area !== undefined;
6139
+ });
6140
+ }, [warning.assignedAreaIds, areasById]);
6141
+ var _useWarningsTranslati = useWarningsTranslation(),
6142
+ t = _useWarningsTranslati.t;
6143
+ var handleChangeFromDirection = React__default.useCallback(function (value) {
6144
+ onChange(warning.id, {
6145
+ windDirectionFrom: value
6146
+ });
6147
+ }, [onChange, warning.id]);
6148
+ var handleChangeWindForce = React__default.useCallback(function (value) {
6149
+ onChange(warning.id, {
6150
+ windForce: value
6151
+ });
6152
+ }, [onChange, warning]);
6153
+ var handleChangeWindChangeType = React__default.useCallback(function (value) {
6154
+ onChange(warning.id, {
6155
+ changeType: value
6156
+ });
6157
+ if (value === 'NO_CHANGE') {
6158
+ onChange(warning.id, {
6159
+ windDirectionTo: ''
6160
+ });
6161
+ }
6162
+ }, [onChange, warning]);
6163
+ var handleChangeToDirection = React__default.useCallback(function (value) {
6164
+ onChange(warning.id, {
6165
+ windDirectionTo: value
6166
+ });
6167
+ }, [onChange, warning]);
6168
+ var handleAddClick = React__default.useCallback(function () {
6169
+ onAddClick(warning.id);
6170
+ }, [warning.id, onAddClick]);
6171
+ var shouldDisableDirTo = warning.changeType === 'NO_CHANGE';
6172
+ return jsxs(StyledItem, {
6173
+ "data-testid": "maritime-warning",
6174
+ children: [jsx(WarningListDragHandle, {}), jsx(WarningListSelect, {
6175
+ gridArea: "dirFrom",
6176
+ label: t('maritime-header-direction-from'),
6177
+ options: windDirections,
6178
+ onChange: handleChangeFromDirection,
6179
+ value: warning.windDirectionFrom
6180
+ }), jsx(WindForceSelect, {
6181
+ gridArea: "windForce",
6182
+ value: warning.windForce,
6183
+ options: windForce,
6184
+ onChange: handleChangeWindForce
6185
+ }), jsx(AssignedAreas, {
6186
+ assignedAreas: assignedAreas,
6187
+ selectedAreaIds: selectedAreaIds,
6188
+ onAddClick: handleAddClick,
6189
+ onToggleSelectArea: onToggleSelectArea,
6190
+ onDeleteClick: onRemoveArea,
6191
+ shouldShowDistricts: shouldShowDistricts
6192
+ }), jsx(WarningListSelect, {
6193
+ gridArea: "changeType",
6194
+ label: t('maritime-header-change'),
6195
+ options: change,
6196
+ onChange: handleChangeWindChangeType,
6197
+ value: warning.changeType
6198
+ }), jsx(WarningListSelect, {
6199
+ gridArea: "dirTo",
6200
+ label: t('maritime-header-direction-to'),
6201
+ options: windDirections,
6202
+ onChange: handleChangeToDirection,
6203
+ value: warning.windDirectionTo,
6204
+ isDisabled: shouldDisableDirTo
6205
+ }), jsx(CustomIconButton, {
6206
+ sx: {
6207
+ gridArea: 'delete',
6208
+ justifySelf: 'end',
6209
+ padding: 0,
6210
+ marginTop: 0.5
6211
+ },
6212
+ size: "small",
6213
+ onClick: function onClick() {
6214
+ return onRemove(warning.id);
6215
+ },
6216
+ "aria-label": t('maritime-delete-button'),
6217
+ tooltipTitle: t('maritime-retract-warning'),
6218
+ children: jsx(Delete, {})
6219
+ })]
6220
+ });
6221
+ });
6222
+ var StyledItem = styled('div')(function (_ref2) {
6223
+ var _ref3;
6224
+ var theme = _ref2.theme;
6225
+ return _ref3 = {
6226
+ marginBottom: theme.spacing(0.25),
6227
+ backgroundColor: theme.palette.geowebColors.cards.cardContainer,
6228
+ borderColor: theme.palette.geowebColors.cards.cardContainerBorder,
6229
+ borderRadius: theme.shape.borderRadius,
6230
+ borderWidth: '1px',
6231
+ borderStyle: 'solid',
6232
+ display: 'grid',
6233
+ alignItems: 'start',
6234
+ gap: theme.spacing(0.5),
6235
+ paddingInline: theme.spacing(0.25),
6236
+ // styling for small windows
6237
+ gridTemplateAreas: "\n \"drag dirFrom dirFrom windForce delete\"\n \". areas areas areas .\"\n \". changeType dirTo dirTo .\" \n ",
6238
+ gridTemplateColumns: '24px minmax(87px, 1fr) 1fr minmax(60px, 1fr) 24px'
6239
+ }, _ref3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
6240
+ gridTemplateAreas: "\n \"drag dirFrom windForce areas changeType dirTo delete\" \n ",
6241
+ gridTemplateColumns: 'var(--grid-columns)'
6242
+ }, _ref3;
6243
+ });
6244
+
6245
+ var WarningList = function WarningList(_ref) {
6246
+ var _sx;
6247
+ var warnings = _ref.warnings,
6248
+ areas = _ref.areas,
6249
+ selectedAreaIds = _ref.selectedAreaIds,
6250
+ onAddSelectedAreas = _ref.onAddSelectedAreas,
6251
+ onRemoveWarning = _ref.onRemoveWarning,
6252
+ onRemoveArea = _ref.onRemoveArea,
6253
+ onChangeWarning = _ref.onChangeWarning,
6254
+ onToggleSelectArea = _ref.onToggleSelectArea,
6255
+ onMoveWarning = _ref.onMoveWarning,
6256
+ _ref$shouldShowDistri = _ref.shouldShowDistricts,
6257
+ shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
6258
+ var _useWarningsTranslati = useWarningsTranslation(),
6259
+ t = _useWarningsTranslati.t;
6260
+ var onSort = React__default.useCallback(function (event) {
6261
+ onMoveWarning(event.oldIndex, event.newIndex);
6262
+ }, [onMoveWarning]);
6263
+ return jsxs(Box, {
6264
+ "data-testid": "warninglist",
6265
+ sx: {
6266
+ display: 'flex',
6267
+ flexDirection: 'column',
6268
+ minHeight: 0,
6269
+ '--grid-columns': '30px 150px 60px 2fr 100px 100px 1fr'
6270
+ },
6271
+ children: [jsxs(Box, {
6272
+ sx: (_sx = {
6273
+ display: 'none'
6274
+ }, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
6275
+ display: 'grid'
6276
+ }, _sx.gridTemplateColumns = 'var(--grid-columns)', _sx.gap = 0.5, _sx.paddingBlockEnd = 1, _sx.justifyItems = 'center', _sx['& > *'] = {
6277
+ width: 'auto !important'
6278
+ }, _sx),
6279
+ children: [jsx(WarningListHeaderContent, {
6280
+ title: t('maritime-header-direction'),
6281
+ sx: {
6282
+ gridColumnStart: 2
6283
+ }
6284
+ }), jsx(WarningListHeaderContent, {
6285
+ title: t('maritime-header-windforce')
6286
+ }), jsx(WarningListHeaderContent, {
6287
+ title: shouldShowDistricts ? t('maritime-header-districts') : t('maritime-header-areas')
6288
+ }), jsx(WarningListHeaderContent, {
6289
+ title: t('maritime-header-change')
6290
+ }), jsx(WarningListHeaderContent, {
6291
+ title: t('maritime-header-direction')
6292
+ })]
6293
+ }), jsx(ReactSortable, {
6294
+ tag: "div",
6295
+ list: warnings,
6296
+ onSort: onSort,
6297
+ setList: function setList() {},
6298
+ animation: 200,
6299
+ handle: ".handle",
6300
+ direction: "vertical",
6301
+ style: {
6302
+ minHeight: 0,
6303
+ overflow: 'auto'
6304
+ },
6305
+ children: warnings.map(function (warning) {
6306
+ return jsx(WarningListItem$1, {
6307
+ warning: warning,
6308
+ areas: areas,
6309
+ selectedAreaIds: selectedAreaIds,
6310
+ onToggleSelectArea: onToggleSelectArea,
6311
+ onAddClick: onAddSelectedAreas,
6312
+ onRemove: onRemoveWarning,
6313
+ onChange: onChangeWarning,
6314
+ onRemoveArea: onRemoveArea,
6315
+ shouldShowDistricts: shouldShowDistricts
6316
+ }, warning.id);
6317
+ })
6318
+ })]
6319
+ });
6320
+ };
6321
+
6322
+ /* *
6323
+ * Licensed under the Apache License, Version 2.0 (the "License");
6324
+ * you may not use this file except in compliance with the License.
6325
+ * You may obtain a copy of the License at
6326
+ *
6327
+ * http://www.apache.org/licenses/LICENSE-2.0
6328
+ *
6329
+ * Unless required by applicable law or agreed to in writing, software
6330
+ * distributed under the License is distributed on an "AS IS" BASIS,
6331
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6332
+ * See the License for the specific language governing permissions and
6333
+ * limitations under the License.
6334
+ *
6335
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6336
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
6337
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
6338
+ * */
6339
+ var unpublishedWarningId = 0;
6340
+ function createWarning() {
6341
+ unpublishedWarningId += 1;
6342
+ return {
6343
+ assignedAreaIds: [],
6344
+ id: "unpublished-warning-" + unpublishedWarningId
6345
+ };
6346
+ }
6347
+ function isPublishedWarning(warning) {
6348
+ return !warning.id.startsWith('unpublished-warning');
6349
+ }
6350
+ var initialState = {
6351
+ selectedAreaIds: [],
6352
+ warnings: [createWarning()],
6353
+ modified: false
6354
+ };
6355
+ function reducer(state, action) {
6356
+ switch (action.type) {
6357
+ case 'changeWarning':
6358
+ {
6359
+ return Object.assign({}, state, {
6360
+ warnings: state.warnings.map(function (warning) {
6361
+ if (warning.id !== action.id) {
6362
+ return warning;
6363
+ }
6364
+ return Object.assign({}, warning, action.newValues);
6365
+ }),
6366
+ modified: true
6367
+ });
6368
+ }
6369
+ case 'toggleSelectArea':
6370
+ {
6371
+ if (state.selectedAreaIds.includes(action.id)) {
6372
+ return Object.assign({}, state, {
6373
+ selectedAreaIds: state.selectedAreaIds.filter(function (areaId) {
6374
+ return areaId !== action.id;
6375
+ })
6376
+ });
6377
+ }
6378
+ return Object.assign({}, state, {
6379
+ selectedAreaIds: [].concat(state.selectedAreaIds, [action.id])
6380
+ });
6381
+ }
6382
+ case 'removeArea':
6383
+ {
6384
+ return Object.assign({}, state, {
6385
+ selectedAreaIds: state.selectedAreaIds.filter(function (areaId) {
6386
+ return areaId !== action.areaId;
6387
+ }),
6388
+ warnings: state.warnings.map(function (warning) {
6389
+ var warningHasASelectedArea = warning.assignedAreaIds.some(function (areaId) {
6390
+ return areaId === action.areaId;
6391
+ });
6392
+ if (warningHasASelectedArea) {
6393
+ return Object.assign({}, warning, {
6394
+ assignedAreaIds: warning.assignedAreaIds.filter(function (areaId) {
6395
+ return areaId !== action.areaId;
6396
+ })
6397
+ });
6398
+ }
6399
+ return warning;
6400
+ }),
6401
+ modified: true
6402
+ });
6403
+ }
6404
+ case 'newWarning':
6405
+ {
6406
+ return Object.assign({}, state, {
6407
+ warnings: [].concat(state.warnings, [createWarning()])
6408
+ });
6409
+ }
6410
+ case 'addSelectedAreasToWarning':
6411
+ {
6412
+ var selectedAreaIdsSet = new Set(state.selectedAreaIds);
6413
+ return Object.assign({}, state, {
6414
+ warnings: state.warnings.map(function (warning) {
6415
+ // remove the selected areas from other warnings
6416
+ if (warning.id !== action.id) {
6417
+ var warningHasASelectedArea = warning.assignedAreaIds.some(function (areaId) {
6418
+ return selectedAreaIdsSet.has(areaId);
6419
+ });
6420
+ // don't modify the warning if it does not have a selected area
6421
+ if (!warningHasASelectedArea) {
6422
+ return warning;
6423
+ }
6424
+ return Object.assign({}, warning, {
6425
+ assignedAreaIds: warning.assignedAreaIds.filter(function (areaId) {
6426
+ return !selectedAreaIdsSet.has(areaId);
6427
+ })
6428
+ });
6429
+ }
6430
+ // add the area to the given warning
6431
+ var newAreaIds = new Set([].concat(warning.assignedAreaIds, state.selectedAreaIds));
6432
+ return Object.assign({}, warning, {
6433
+ assignedAreaIds: Array.from(newAreaIds)
6434
+ });
6435
+ }),
6436
+ selectedAreaIds: [],
6437
+ modified: true
6438
+ });
6439
+ }
6440
+ case 'removeWarning':
6441
+ {
6442
+ var newWarnings = state.warnings.filter(function (warning) {
6443
+ return warning.id !== action.id;
6444
+ });
6445
+ return Object.assign({}, state, {
6446
+ warnings: newWarnings.length > 0 ? newWarnings : initialState.warnings,
6447
+ modified: true
6448
+ });
6449
+ }
6450
+ case 'clearWarnings':
6451
+ {
6452
+ return Object.assign({}, initialState, {
6453
+ modified: true
6454
+ });
6455
+ }
6456
+ case 'moveWarning':
6457
+ {
6458
+ var oldWarning = state.warnings[action.oldIndex];
6459
+ var _newWarnings = [].concat(state.warnings);
6460
+ _newWarnings.splice(action.oldIndex, 1);
6461
+ _newWarnings.splice(action.newIndex, 0, oldWarning);
6462
+ return Object.assign({}, state, {
6463
+ warnings: _newWarnings,
6464
+ modified: true
6465
+ });
6466
+ }
6467
+ case 'initialize':
6468
+ {
6469
+ if (action.warnings.length === 0) {
6470
+ return initialState;
6471
+ }
6472
+ return Object.assign({}, state, {
6473
+ warnings: action.warnings,
6474
+ selectedAreaIds: []
6475
+ });
6476
+ }
6477
+ default:
6478
+ {
6479
+ return state;
6480
+ }
6481
+ }
6482
+ }
6483
+ function useMaritimeWarningsFormState() {
6484
+ return React__default.useReducer(reducer, initialState);
6485
+ }
6486
+
6487
+ function useConfirmRetractDialog(_ref) {
6488
+ var areas = _ref.areas,
6489
+ warnings = _ref.warnings,
6490
+ onRemoveWarning = _ref.onRemoveWarning;
6491
+ var confirmDialog = useConfirmationDialog();
6492
+ var _useWarningsTranslati = useWarningsTranslation(),
6493
+ t = _useWarningsTranslati.t;
6494
+ var getLabelFromOption = React__default.useCallback(function (options, value) {
6495
+ var option = options.find(function (option) {
6496
+ return option.value === value;
6497
+ });
6498
+ if (!option) {
6499
+ return '';
6500
+ }
6501
+ return typeof option.label === 'function' ? option.label(t) : option.label;
6502
+ }, [t]);
6503
+ var getWarningDescription = React__default.useCallback(function (warning) {
6504
+ if (!isPublishedWarning(warning)) {
6505
+ return t('maritime-retract-dialog-empty-warning-description');
6506
+ }
6507
+ var windDirectionFromLabel = getLabelFromOption(windDirections, warning.windDirectionFrom);
6508
+ var areasById = new Map(areas.map(function (area) {
6509
+ return [area.id, area];
6510
+ }));
6511
+ var areaLabels = warning.assignedAreaIds.map(function (areaId) {
6512
+ return areasById.get(areaId).label;
6513
+ });
6514
+ var changeToLabel = warning.changeType === 'NO_CHANGE' ? t('maritime-retract-dialog-no-change') : getLabelFromOption(change, warning.changeType) + " " + getLabelFromOption(windDirections, warning.windDirectionTo);
6515
+ var warningDescription = [windDirectionFromLabel + " " + t('maritime-windforce', {
6516
+ value: warning.windForce
6517
+ })].concat(areaLabels, [changeToLabel]).join(', ');
6518
+ return warningDescription + ". " + t('maritime-retract-dialog-description-suffix');
6519
+ }, [areas, t, getLabelFromOption]);
6520
+ return {
6521
+ onRemoveWarningWithConfirmation: React__default.useCallback(/*#__PURE__*/function () {
6522
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
6523
+ var warning;
6524
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
6525
+ while (1) switch (_context.prev = _context.next) {
6526
+ case 0:
6527
+ warning = warnings.find(function (warning) {
6528
+ return warning.id === id;
6529
+ });
6530
+ _context.next = 3;
6531
+ return confirmDialog({
6532
+ title: t('maritime-retract-warning'),
6533
+ description: '',
6534
+ confirmLabel: t('maritime-retract-dialog-confirm'),
6535
+ cancelLabel: t('close-dialog-cancel'),
6536
+ content: getWarningDescription(warning)
6537
+ });
6538
+ case 3:
6539
+ onRemoveWarning(id);
6540
+ case 4:
6541
+ case "end":
6542
+ return _context.stop();
6543
+ }
6544
+ }, _callee);
6545
+ }));
6546
+ return function (_x) {
6547
+ return _ref2.apply(this, arguments);
6548
+ };
6549
+ }(), [warnings, getWarningDescription, t, confirmDialog, onRemoveWarning])
6550
+ };
6551
+ }
6552
+
6553
+ /* *
6554
+ * Licensed under the Apache License, Version 2.0 (the "License");
6555
+ * you may not use this file except in compliance with the License.
6556
+ * You may obtain a copy of the License at
6557
+ *
6558
+ * http://www.apache.org/licenses/LICENSE-2.0
6559
+ *
6560
+ * Unless required by applicable law or agreed to in writing, software
6561
+ * distributed under the License is distributed on an "AS IS" BASIS,
6562
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6563
+ * See the License for the specific language governing permissions and
6564
+ * limitations under the License.
6565
+ *
6566
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6567
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
6568
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
6569
+ * */
6570
+ var isWarningEmpty = function isWarningEmpty(item) {
6571
+ var windDirectionFrom = item.windDirectionFrom,
6572
+ windForce = item.windForce,
6573
+ changeType = item.changeType,
6574
+ windDirectionTo = item.windDirectionTo,
6575
+ assignedAreaIds = item.assignedAreaIds;
6576
+ if (assignedAreaIds.length) {
6577
+ return false;
6578
+ }
6579
+ return [windDirectionFrom, windForce, changeType, windDirectionTo].every(function (value) {
6580
+ return value === undefined || value.trim() === '';
6581
+ });
6582
+ };
6583
+ var isWarningValid = function isWarningValid(item) {
6584
+ var windDirectionFrom = item.windDirectionFrom,
6585
+ windForce = item.windForce,
6586
+ assignedAreaIds = item.assignedAreaIds,
6587
+ changeType = item.changeType,
6588
+ windDirectionTo = item.windDirectionTo;
6589
+ // Direction, windspeed and areas are required.
6590
+ if (!windDirectionFrom || !windForce || !assignedAreaIds.length) {
6591
+ return false;
6592
+ }
6593
+ // If there is a Change selected, Direction to is also required
6594
+ if (changeType && changeType !== 'NO_CHANGE') {
6595
+ return !!windDirectionTo;
6596
+ }
6597
+ return true;
6598
+ };
6599
+ var isWarningsValid = function isWarningsValid(warnings) {
6600
+ // One single empty row is allowed, if not empty it should be valid
6601
+ if (warnings.length === 1) {
6602
+ return isWarningEmpty(warnings[0]) || isWarningValid(warnings[0]);
6603
+ }
6604
+ return warnings.every(function (warning) {
6605
+ return !isWarningEmpty(warning) && isWarningValid(warning);
6606
+ });
6607
+ };
6608
+
6609
+ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
6610
+ var _sx, _sx2, _sx3;
6611
+ var areas = _ref.areas,
6612
+ selectedAreaIds = _ref.selectedAreaIds,
6613
+ modified = _ref.modified,
6614
+ warnings = _ref.warnings,
6615
+ onToggleSelectArea = _ref.onToggleSelectArea,
6616
+ onAddSelectedAreas = _ref.onAddSelectedAreas,
6617
+ onRemoveWarning = _ref.onRemoveWarning,
6618
+ onRemoveArea = _ref.onRemoveArea,
6619
+ onAddWarning = _ref.onAddWarning,
6620
+ onChangeWarning = _ref.onChangeWarning,
6621
+ onSubmit = _ref.onSubmit,
6622
+ onClear = _ref.onClear,
6623
+ onMoveWarning = _ref.onMoveWarning,
6624
+ _ref$shouldShowDistri = _ref.shouldShowDistricts,
6625
+ shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
6626
+ var _useWarningsTranslati = useWarningsTranslation(),
6627
+ t = _useWarningsTranslati.t;
6628
+ var disabledAreaIds = warnings.flatMap(function (warning) {
6629
+ return warning.assignedAreaIds;
6630
+ });
6631
+ var _useConfirmRetractDia = useConfirmRetractDialog({
6632
+ areas: areas,
6633
+ warnings: warnings,
6634
+ onRemoveWarning: onRemoveWarning
6635
+ }),
6636
+ onRemoveWarningWithConfirmation = _useConfirmRetractDia.onRemoveWarningWithConfirmation;
6637
+ var showConfirmDialog = useConfirmationDialog();
6638
+ var onClearWithConfirmation = React__default.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
6639
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
6640
+ while (1) switch (_context.prev = _context.next) {
6641
+ case 0:
6642
+ _context.next = 2;
6643
+ return showConfirmDialog({
6644
+ title: t('maritime-clear-dialog-title'),
6645
+ description: t('maritime-clear-dialog-description'),
6646
+ confirmLabel: t('warning-button-clear'),
6647
+ cancelLabel: t('close-dialog-cancel')
6648
+ });
6649
+ case 2:
6650
+ onClear();
6651
+ case 3:
6652
+ case "end":
6653
+ return _context.stop();
6654
+ }
6655
+ }, _callee);
6656
+ })), [onClear, t, showConfirmDialog]);
6657
+ var isValid = isWarningsValid(warnings);
6658
+ return jsxs(Stack, {
6659
+ direction: "column",
6660
+ spacing: 3,
6661
+ sx: (_sx = {
6662
+ height: '100%',
6663
+ containerName: 'maritime',
6664
+ containerType: 'inline-size',
6665
+ padding: 2
6666
+ }, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
6667
+ padding: 3
6668
+ }, _sx),
6669
+ children: [jsx(AreaList, {
6670
+ areas: areas,
6671
+ selected: selectedAreaIds,
6672
+ disabled: disabledAreaIds,
6673
+ onClickItem: onToggleSelectArea
6674
+ }), jsx(WarningList, {
6675
+ warnings: warnings,
6676
+ areas: areas,
6677
+ selectedAreaIds: selectedAreaIds,
6678
+ onAddSelectedAreas: onAddSelectedAreas,
6679
+ onRemoveWarning: onRemoveWarningWithConfirmation,
6680
+ onChangeWarning: onChangeWarning,
6681
+ onToggleSelectArea: onToggleSelectArea,
6682
+ onRemoveArea: onRemoveArea,
6683
+ onMoveWarning: onMoveWarning,
6684
+ shouldShowDistricts: shouldShowDistricts
6685
+ }), jsxs(Button, {
6686
+ onClick: onAddWarning,
6687
+ variant: "tertiary",
6688
+ size: "small",
6689
+ sx: {
6690
+ alignSelf: 'flex-start',
6691
+ paddingInline: 2
6692
+ },
6693
+ children: [jsx(Add, {}), t('maritime-new-warning')]
6694
+ }), jsxs(Stack, {
6695
+ spacing: 2,
6696
+ direction: "row",
6697
+ sx: (_sx2 = {}, _sx2["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
6698
+ position: 'absolute',
6699
+ bottom: 0,
6700
+ right: 0,
6701
+ padding: 3
6702
+ }, _sx2),
6703
+ children: [jsx(Button, {
6704
+ onClick: onClearWithConfirmation,
6705
+ variant: "tertiary",
6706
+ size: "small",
6707
+ sx: {
6708
+ width: '134px'
6709
+ },
6710
+ children: t('warning-button-clear')
6711
+ }), jsx(Button, {
6712
+ variant: "primary",
6713
+ size: "small",
6714
+ sx: (_sx3 = {
6715
+ width: '134px'
6716
+ }, _sx3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
6717
+ marginLeft: '24px!important'
6718
+ }, _sx3),
6719
+ disabled: !modified || !isValid,
6720
+ onClick: onSubmit,
6721
+ children: t('warning-button-publish')
6722
+ })]
6723
+ })]
6724
+ });
6725
+ };
6726
+
6727
+ var areasByDomain = {
6728
+ northSeaDistricts: [{
6729
+ id: 'DOVER',
6730
+ label: 'Dover'
6731
+ }, {
6732
+ id: 'THAMES',
6733
+ label: 'Thames'
6734
+ }, {
6735
+ id: 'HUMBER',
6736
+ label: 'Humber'
6737
+ }, {
6738
+ id: 'DOGGER',
6739
+ label: 'Dogger'
6740
+ }, {
6741
+ id: 'GERMAN_BIGHT',
6742
+ label: 'German Bight'
6743
+ }],
6744
+ coastalWaters: [{
6745
+ id: 'VLISSINGEN',
6746
+ label: 'Vlissingen'
6747
+ }, {
6748
+ id: 'ZIERIKZEE',
6749
+ label: 'Zierikzee'
6750
+ }, {
6751
+ id: 'HOEK_VAN_HOLLAND',
6752
+ label: 'Hoek van Holland'
6753
+ }, {
6754
+ id: 'IJMUIDEN',
6755
+ label: 'IJmuiden'
6756
+ }, {
6757
+ id: 'TEXEL',
6758
+ label: 'Texel'
6759
+ }, {
6760
+ id: 'HARLINGEN',
6761
+ label: 'Harlingen'
6762
+ }, {
6763
+ id: 'ROTTUM',
6764
+ label: 'Rottum'
6765
+ }, {
6766
+ id: 'DELFZIJL',
6767
+ label: 'Delfzijl'
6768
+ }, {
6769
+ id: 'IJSSELMEER',
6770
+ label: 'IJsselmeer'
6771
+ }, {
6772
+ id: 'MARKERMEER',
6773
+ label: 'Markermeer'
6774
+ }]
6775
+ };
6776
+
6777
+ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
6778
+ var domain = _ref.domain,
6779
+ onPreventCloseView = _ref.onPreventCloseView,
6780
+ onModifyForm = _ref.onModifyForm;
6781
+ var areas = areasByDomain[domain];
6782
+ var shouldShowDistricts = domain === 'northSeaDistricts';
6783
+ var _useMaritimeWarningsF = useMaritimeWarningsFormState(),
6784
+ state = _useMaritimeWarningsF[0],
6785
+ dispatch = _useMaritimeWarningsF[1];
6786
+ React__default.useEffect(function () {
6787
+ // FIXME: replace this by warnings from api
6788
+ dispatch({
6789
+ type: 'initialize',
6790
+ warnings: []
6791
+ });
6792
+ }, [dispatch, domain, areas]);
6793
+ React__default.useEffect(function () {
6794
+ onPreventCloseView == null || onPreventCloseView(state.modified);
6795
+ if (onModifyForm) {
6796
+ onModifyForm(state.modified);
6797
+ }
6798
+ // eslint-disable-next-line react-hooks/exhaustive-deps
6799
+ }, [state.modified]);
6800
+ usePreventBrowserClose(state.modified);
6801
+ var dispatchRedux = useDispatch();
6802
+ var showSnackbar = React__default.useCallback(function (message) {
6803
+ dispatchRedux(snackbarActions.openSnackbar(message));
6804
+ }, [dispatchRedux]);
6805
+ var onToggleSelectArea = React__default.useCallback(function (id) {
6806
+ React__default.startTransition(function () {
6807
+ dispatch({
6808
+ type: 'toggleSelectArea',
6809
+ id: id
6810
+ });
6811
+ });
6812
+ }, [dispatch]);
6813
+ var onAddSelectedAreas = React__default.useCallback(function (id) {
6814
+ React__default.startTransition(function () {
6815
+ dispatch({
6816
+ type: 'addSelectedAreasToWarning',
6817
+ id: id
6818
+ });
6819
+ });
6820
+ }, [dispatch]);
6821
+ var onRemoveWarning = React__default.useCallback(function (id) {
6822
+ React__default.startTransition(function () {
6823
+ dispatch({
6824
+ type: 'removeWarning',
6825
+ id: id
6826
+ });
6827
+ });
6828
+ showSnackbar({
6829
+ type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
6830
+ key: 'maritime-retract-success'
6831
+ });
6832
+ }, [dispatch, showSnackbar]);
6833
+ var onAddWarning = React__default.useCallback(function () {
6834
+ React__default.startTransition(function () {
6835
+ dispatch({
6836
+ type: 'newWarning'
6837
+ });
6838
+ });
6839
+ }, [dispatch]);
6840
+ var onChangeWarning = React__default.useCallback(function (id, newValues) {
6841
+ React__default.startTransition(function () {
6842
+ dispatch({
6843
+ type: 'changeWarning',
6844
+ id: id,
6845
+ newValues: newValues
6846
+ });
6847
+ });
6848
+ }, [dispatch]);
6849
+ var onRemoveArea = React__default.useCallback(function (areaId) {
6850
+ React__default.startTransition(function () {
6851
+ dispatch({
6852
+ type: 'removeArea',
6853
+ areaId: areaId
6854
+ });
6855
+ });
6856
+ }, [dispatch]);
6857
+ var onClear = React__default.useCallback(function () {
6858
+ React__default.startTransition(function () {
6859
+ dispatch({
6860
+ type: 'clearWarnings'
6861
+ });
6862
+ });
6863
+ showSnackbar({
6864
+ type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
6865
+ key: 'maritime-clear-success'
6866
+ });
6867
+ }, [dispatch, showSnackbar]);
6868
+ var onMoveWarning = React__default.useCallback(function (oldIndex, newIndex) {
6869
+ dispatch({
6870
+ type: 'moveWarning',
6871
+ oldIndex: oldIndex,
6872
+ newIndex: newIndex
6873
+ });
6874
+ }, [dispatch]);
6875
+ var onSubmit = React__default.useCallback(function () {
6876
+ // eslint-disable-next-line no-console
6877
+ console.log(state.warnings);
6878
+ // FIXME: add logic for submission
6879
+ }, [state]);
6880
+ return jsx(MaritimeWarningsForm, {
6881
+ areas: areas,
6882
+ selectedAreaIds: state.selectedAreaIds,
6883
+ warnings: state.warnings,
6884
+ modified: state.modified,
6885
+ onToggleSelectArea: onToggleSelectArea,
6886
+ onAddSelectedAreas: onAddSelectedAreas,
6887
+ onRemoveWarning: onRemoveWarning,
6888
+ onRemoveArea: onRemoveArea,
6889
+ onAddWarning: onAddWarning,
6890
+ onChangeWarning: onChangeWarning,
6891
+ onMoveWarning: onMoveWarning,
6892
+ onClear: onClear,
6893
+ onSubmit: onSubmit,
6894
+ shouldShowDistricts: shouldShowDistricts
6895
+ });
6896
+ };
6897
+
6898
+ var _excluded$3 = ["IS_DRAFT", "object", "translation-select"];
6899
+ var useScrollTopOnError = function useScrollTopOnError(error) {
6900
+ var ref = React.useRef(null);
6901
+ React.useEffect(function () {
6902
+ if (error != null && error.message && ref.current) {
6903
+ ref.current.scrollTop = 0;
6904
+ }
6905
+ }, [error]);
6906
+ return ref;
6907
+ };
6908
+ var getEmptyPublicWarning = function getEmptyPublicWarning() {
6909
+ var currentTime = new Date();
6910
+ var validFromTime = dateUtils.add(currentTime, {
6911
+ minutes: 15
6912
+ });
6913
+ var validUntilTime = dateUtils.add(currentTime, {
6914
+ hours: 6,
6915
+ minutes: 15
6916
+ });
6917
+ return {
6918
+ id: '',
6919
+ phenomenon: '',
6920
+ validFrom: dateUtils.dateToString(validFromTime),
6921
+ validUntil: dateUtils.dateToString(validUntilTime),
6922
+ level: '',
6923
+ probability: 30,
6924
+ descriptionOriginal: '',
6925
+ descriptionTranslation: '',
6926
+ areas: []
6927
+ };
6928
+ };
6929
+ var getFormData = function getFormData(publicWarningsDetails, object) {
6930
+ var data = Object.assign({
6931
+ IS_DRAFT: '',
6932
+ 'translation-select': ''
6933
+ }, publicWarningsDetails ? Object.assign({}, getEmptyPublicWarning(), publicWarningsDetails) : getEmptyPublicWarning(), {
6934
+ object: object
6935
+ });
6936
+ return data;
6937
+ };
6938
+ // tablet breakpoint - 2 padding * 2 for both sides
6939
+ var containerQueryBreakpoint = "@container (min-width: " + (breakpoints.tablet - 32) + "px)";
6940
+ var spinnerSx = {
6941
+ width: '16px!important',
6942
+ height: '16px!important',
6943
+ position: 'absolute',
6944
+ top: 0,
6945
+ bottom: 0,
6946
+ margin: 'auto',
6947
+ marginLeft: 1
6948
+ };
6949
+ var ContainerWrapper = styled('div')(function () {
6950
+ return {
6951
+ containerType: 'size',
6952
+ height: '100%'
6953
+ };
6954
+ });
6955
+ var ContainerFormWrapper = styled('div')(function (_ref) {
6956
+ var _ref2;
6957
+ var _ref$isReadOnly = _ref.isReadOnly,
6958
+ isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
6959
+ _ref$addPadding = _ref.addPadding,
6960
+ addPadding = _ref$addPadding === void 0 ? true : _ref$addPadding,
6961
+ theme = _ref.theme;
6962
+ return _ref2 = {
6963
+ padding: addPadding ? theme.spacing(2) : 0,
5636
6964
  height: isReadOnly ? '100%' : "calc(100% - 206px)",
5637
6965
  overflowY: 'auto'
5638
6966
  }, _ref2[containerQueryBreakpoint] = {
@@ -5666,7 +6994,7 @@ var prepareFormValues = function prepareFormValues(data) {
5666
6994
  data.IS_DRAFT;
5667
6995
  data.object;
5668
6996
  data['translation-select'];
5669
- var productToPost = _objectWithoutPropertiesLoose(data, _excluded$4);
6997
+ var productToPost = _objectWithoutPropertiesLoose(data, _excluded$3);
5670
6998
  // remove empty fields
5671
6999
  return Object.keys(productToPost).reduce(function (warningDetail, fieldName) {
5672
7000
  var key = fieldName;
@@ -5763,7 +7091,7 @@ var Form = function Form(_ref5) {
5763
7091
  var _publicWarningDetails, _publicWarningDetails2;
5764
7092
  var defaultMapPreset = _ref5.defaultMapPreset,
5765
7093
  _ref5$onSaveForm = _ref5.onSaveForm,
5766
- onSaveForm = _ref5$onSaveForm === void 0 ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7094
+ onSaveForm = _ref5$onSaveForm === void 0 ? /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5767
7095
  return _regeneratorRuntime().wrap(function _callee$(_context) {
5768
7096
  while (1) switch (_context.prev = _context.next) {
5769
7097
  case 0:
@@ -5775,7 +7103,7 @@ var Form = function Form(_ref5) {
5775
7103
  }, _callee);
5776
7104
  })) : _ref5$onSaveForm,
5777
7105
  _ref5$onPublishForm = _ref5.onPublishForm,
5778
- onPublishForm = _ref5$onPublishForm === void 0 ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
7106
+ onPublishForm = _ref5$onPublishForm === void 0 ? /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
5779
7107
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
5780
7108
  while (1) switch (_context2.prev = _context2.next) {
5781
7109
  case 0:
@@ -5791,7 +7119,7 @@ var Form = function Form(_ref5) {
5791
7119
  _ref5$onCloseForm = _ref5.onCloseForm,
5792
7120
  onCloseForm = _ref5$onCloseForm === void 0 ? function () {} : _ref5$onCloseForm,
5793
7121
  _ref5$onSaveAviationF = _ref5.onSaveAviationForm,
5794
- onSaveAviationForm = _ref5$onSaveAviationF === void 0 ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
7122
+ onSaveAviationForm = _ref5$onSaveAviationF === void 0 ? /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
5795
7123
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
5796
7124
  while (1) switch (_context3.prev = _context3.next) {
5797
7125
  case 0:
@@ -5878,8 +7206,8 @@ var Form = function Form(_ref5) {
5878
7206
  var onPressPublish = function onPressPublish() {
5879
7207
  if (!isPublishing) {
5880
7208
  toggleIsDraft(false);
5881
- void handleSubmit( /*#__PURE__*/function () {
5882
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
7209
+ void handleSubmit(/*#__PURE__*/function () {
7210
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
5883
7211
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
5884
7212
  while (1) switch (_context4.prev = _context4.next) {
5885
7213
  case 0:
@@ -5903,8 +7231,8 @@ var Form = function Form(_ref5) {
5903
7231
  var onPressSave = function onPressSave() {
5904
7232
  if (!isSaving) {
5905
7233
  toggleIsDraft(true);
5906
- void handleSubmit( /*#__PURE__*/function () {
5907
- var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
7234
+ void handleSubmit(/*#__PURE__*/function () {
7235
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
5908
7236
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
5909
7237
  while (1) switch (_context5.prev = _context5.next) {
5910
7238
  case 0:
@@ -5920,7 +7248,7 @@ var Form = function Form(_ref5) {
5920
7248
  }, _callee5);
5921
7249
  }));
5922
7250
  return function (_x2) {
5923
- return _ref10.apply(this, arguments);
7251
+ return _ref0.apply(this, arguments);
5924
7252
  };
5925
7253
  }())();
5926
7254
  }
@@ -5960,29 +7288,29 @@ var Form = function Form(_ref5) {
5960
7288
  return t('warning-button-publish');
5961
7289
  };
5962
7290
  var handleSubmitAviationProduct = /*#__PURE__*/function () {
5963
- var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(action, warningType) {
7291
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(action, warningType) {
5964
7292
  var formValues;
5965
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
5966
- while (1) switch (_context10.prev = _context10.next) {
7293
+ return _regeneratorRuntime().wrap(function _callee0$(_context0) {
7294
+ while (1) switch (_context0.prev = _context0.next) {
5967
7295
  case 0:
5968
7296
  if (!isSaving) {
5969
- _context10.next = 2;
7297
+ _context0.next = 2;
5970
7298
  break;
5971
7299
  }
5972
- return _context10.abrupt("return");
7300
+ return _context0.abrupt("return");
5973
7301
  case 2:
5974
- _context10.t0 = action;
5975
- _context10.next = _context10.t0 === ProductAction.SAVE ? 5 : _context10.t0 === ProductAction.PUBLISH ? 14 : _context10.t0 === ProductAction.CANCEL ? 17 : _context10.t0 === ProductAction.AMEND ? 19 : _context10.t0 === ProductAction.RENEW ? 21 : _context10.t0 === ProductAction.DISCARD ? 21 : _context10.t0 === ProductAction.DUPLICATE ? 21 : _context10.t0 === ProductAction.CLOSE ? 21 : 22;
7302
+ _context0.t0 = action;
7303
+ _context0.next = _context0.t0 === ProductAction.SAVE ? 5 : _context0.t0 === ProductAction.PUBLISH ? 14 : _context0.t0 === ProductAction.CANCEL ? 17 : _context0.t0 === ProductAction.AMEND ? 19 : _context0.t0 === ProductAction.RENEW ? 21 : _context0.t0 === ProductAction.DISCARD ? 21 : _context0.t0 === ProductAction.DUPLICATE ? 21 : _context0.t0 === ProductAction.CLOSE ? 21 : 22;
5976
7304
  break;
5977
7305
  case 5:
5978
7306
  toggleIsDraft(true);
5979
- _context10.next = 8;
7307
+ _context0.next = 8;
5980
7308
  return trigger();
5981
7309
  case 8:
5982
7310
  // Run validation and show messages
5983
7311
  formValues = getValues();
5984
7312
  setIsSaving(true);
5985
- _context10.next = 12;
7313
+ _context0.next = 12;
5986
7314
  return onSaveAviationForm(formValues, 'DRAFT', warningType, undefined, function (uuid) {
5987
7315
  setValue('uuid', uuid, {
5988
7316
  shouldValidate: true,
@@ -5991,16 +7319,16 @@ var Form = function Form(_ref5) {
5991
7319
  })["catch"](function () {});
5992
7320
  case 12:
5993
7321
  setIsSaving(false);
5994
- return _context10.abrupt("break", 23);
7322
+ return _context0.abrupt("break", 23);
5995
7323
  case 14:
5996
7324
  toggleIsDraft(false);
5997
- void handleSubmit( /*#__PURE__*/function () {
5998
- var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(formValues) {
7325
+ void handleSubmit(/*#__PURE__*/function () {
7326
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(formValues) {
5999
7327
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
6000
7328
  while (1) switch (_context7.prev = _context7.next) {
6001
7329
  case 0:
6002
7330
  _context7.next = 2;
6003
- return showConfirmDialog(action).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
7331
+ return showConfirmDialog(action).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
6004
7332
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
6005
7333
  while (1) switch (_context6.prev = _context6.next) {
6006
7334
  case 0:
@@ -6023,10 +7351,10 @@ var Form = function Form(_ref5) {
6023
7351
  }, _callee7);
6024
7352
  }));
6025
7353
  return function (_x5) {
6026
- return _ref12.apply(this, arguments);
7354
+ return _ref10.apply(this, arguments);
6027
7355
  };
6028
7356
  }())();
6029
- return _context10.abrupt("break", 23);
7357
+ return _context0.abrupt("break", 23);
6030
7358
  case 17:
6031
7359
  void showConfirmDialog(action).then(function () {
6032
7360
  setIsCancelling(true);
@@ -6035,15 +7363,15 @@ var Form = function Form(_ref5) {
6035
7363
  onCloseForm();
6036
7364
  });
6037
7365
  });
6038
- return _context10.abrupt("break", 23);
7366
+ return _context0.abrupt("break", 23);
6039
7367
  case 19:
6040
- void handleSubmit( /*#__PURE__*/function () {
6041
- var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(formValues) {
7368
+ void handleSubmit(/*#__PURE__*/function () {
7369
+ var _ref12 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(formValues) {
6042
7370
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
6043
7371
  while (1) switch (_context9.prev = _context9.next) {
6044
7372
  case 0:
6045
7373
  _context9.next = 2;
6046
- return showConfirmDialog(action).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
7374
+ return showConfirmDialog(action).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
6047
7375
  return _regeneratorRuntime().wrap(function _callee8$(_context8) {
6048
7376
  while (1) switch (_context8.prev = _context8.next) {
6049
7377
  case 0:
@@ -6067,22 +7395,22 @@ var Form = function Form(_ref5) {
6067
7395
  }, _callee9);
6068
7396
  }));
6069
7397
  return function (_x6) {
6070
- return _ref14.apply(this, arguments);
7398
+ return _ref12.apply(this, arguments);
6071
7399
  };
6072
7400
  }())();
6073
- return _context10.abrupt("break", 23);
7401
+ return _context0.abrupt("break", 23);
6074
7402
  case 21:
6075
- return _context10.abrupt("break", 23);
7403
+ return _context0.abrupt("break", 23);
6076
7404
  case 22:
6077
7405
  console.warn("Unhandled product action: " + action);
6078
7406
  case 23:
6079
7407
  case "end":
6080
- return _context10.stop();
7408
+ return _context0.stop();
6081
7409
  }
6082
- }, _callee10);
7410
+ }, _callee0);
6083
7411
  }));
6084
7412
  return function handleSubmitAviationProduct(_x3, _x4) {
6085
- return _ref11.apply(this, arguments);
7413
+ return _ref1.apply(this, arguments);
6086
7414
  };
6087
7415
  }();
6088
7416
  var onPressClear = function onPressClear() {
@@ -6166,22 +7494,36 @@ var Form = function Form(_ref5) {
6166
7494
  var ref = useScrollTopOnError(error);
6167
7495
  var _useProductConfig = useProductConfig(warningType),
6168
7496
  aviationConfig = _useProductConfig.data;
6169
- return jsxs(ContainerWrapper, {
6170
- children: [jsxs(ContainerFormWrapper, {
6171
- isReadOnly: isReadOnly,
6172
- ref: ref,
6173
- "data-testid": "scroll-container",
6174
- children: [errors && jsx(Box, {
6175
- sx: {
6176
- marginBottom: 2
6177
- },
6178
- children: jsx(AlertBanner, {
6179
- title: errors.title,
6180
- info: errors.errors,
6181
- shouldClose: true,
6182
- severity: error == null ? void 0 : error.severity
6183
- })
6184
- }), selectedAviationProduct ? jsx(Box, {
7497
+ var isMaritimeWarning = warningType === 'maritimeWarningCoastal' || warningType === 'maritimeWarningNorthSea';
7498
+ var getFormContent = function getFormContent() {
7499
+ // Aviation forms
7500
+ if (selectedAviationProduct) {
7501
+ if (warningType === 'sigmet') {
7502
+ return jsx(Box, {
7503
+ sx: {
7504
+ maxWidth: {
7505
+ xs: '550px',
7506
+ sm: '750px'
7507
+ },
7508
+ marginLeft: '-80px'
7509
+ },
7510
+ children: jsx(SigmetForm, {
7511
+ showMap: false,
7512
+ mode: mode,
7513
+ initialSigmet: selectedAviationProduct !== undefined && !isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
7514
+ isCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct),
7515
+ initialCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
7516
+ productConfig: aviationConfig,
7517
+ product: selectedAviationProduct,
7518
+ getTAC: function getTAC(product) {
7519
+ return fetchSigmetTAC(product);
7520
+ },
7521
+ storedGeoJSON: storedStartGeoJSON,
7522
+ storedEndGeoJSON: storedEndGeoJSON
7523
+ })
7524
+ });
7525
+ }
7526
+ return jsx(Box, {
6185
7527
  sx: {
6186
7528
  maxWidth: {
6187
7529
  xs: '550px',
@@ -6189,20 +7531,7 @@ var Form = function Form(_ref5) {
6189
7531
  },
6190
7532
  marginLeft: '-80px'
6191
7533
  },
6192
- children: warningType === 'sigmet' ? jsx(SigmetForm, {
6193
- showMap: false,
6194
- mode: mode,
6195
- initialSigmet: selectedAviationProduct !== undefined && !isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
6196
- isCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct),
6197
- initialCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
6198
- productConfig: aviationConfig,
6199
- product: selectedAviationProduct,
6200
- getTAC: function getTAC(product) {
6201
- return fetchSigmetTAC(product);
6202
- },
6203
- storedGeoJSON: storedStartGeoJSON,
6204
- storedEndGeoJSON: storedEndGeoJSON
6205
- }) : jsx(AirmetForm, {
7534
+ children: jsx(AirmetForm, {
6206
7535
  showMap: false,
6207
7536
  mode: mode,
6208
7537
  isCancelAirmet: selectedAviationProduct !== undefined && isInstanceOfCancelAirmet(selectedAviationProduct),
@@ -6215,48 +7544,87 @@ var Form = function Form(_ref5) {
6215
7544
  },
6216
7545
  storedGeoJSON: storedStartGeoJSON
6217
7546
  })
6218
- }) : jsx(ContainerGrid, {
6219
- children: jsxs(Grid, {
7547
+ });
7548
+ }
7549
+ if (warningType === 'maritimeWarningCoastal') {
7550
+ return jsx(MaritimeWarningsFormConnect, {
7551
+ domain: "coastalWaters",
7552
+ onModifyForm: onFormDirty
7553
+ });
7554
+ }
7555
+ if (warningType === 'maritimeWarningNorthSea') {
7556
+ return jsx(MaritimeWarningsFormConnect, {
7557
+ domain: "northSeaDistricts",
7558
+ onModifyForm: onFormDirty
7559
+ });
7560
+ }
7561
+ // Public warnings form
7562
+ return jsx(ContainerGrid, {
7563
+ children: jsxs(Grid, {
7564
+ size: {
7565
+ xs: 12
7566
+ },
7567
+ container: true,
7568
+ rowSpacing: 2,
7569
+ columnSpacing: 2,
7570
+ children: [jsx(Grid, {
7571
+ size: {
7572
+ xs: 12
7573
+ },
7574
+ children: jsx(Phenomenon, {
7575
+ isDisabled: areFieldsDisabled,
7576
+ isReadOnly: isReadOnly
7577
+ })
7578
+ }), jsx(Grid, {
7579
+ size: {
7580
+ xs: 12
7581
+ },
7582
+ children: jsx(AreaField, {
7583
+ onEditObject: function onEditObject() {},
7584
+ onViewObject: function onViewObject() {},
7585
+ onDeleteObject: function onDeleteObject() {},
7586
+ onAddObject: onAddObject,
7587
+ isDisabled: areFieldsDisabled || isReadOnly
7588
+ })
7589
+ }), jsx(Grid, {
7590
+ size: {
7591
+ xs: 12
7592
+ },
7593
+ children: jsx(WarningsMapView, {
7594
+ geojsonFeature: geoJSONFeature,
7595
+ defaultMapPreset: defaultMapPreset,
7596
+ isSnapshot: isSnapshot
7597
+ })
7598
+ }), jsx(Grid, {
7599
+ size: {
7600
+ xs: 12,
7601
+ sm: 6
7602
+ },
7603
+ children: jsx(ValidFrom, {
7604
+ isDisabled: areFieldsDisabled,
7605
+ isReadOnly: isReadOnly
7606
+ })
7607
+ }), jsx(Grid, {
7608
+ size: {
7609
+ xs: 12,
7610
+ sm: 6
7611
+ },
7612
+ children: jsx(ValidUntil, {
7613
+ isDisabled: areFieldsDisabled,
7614
+ isReadOnly: isReadOnly
7615
+ })
7616
+ }), jsxs(Grid, {
6220
7617
  size: {
6221
7618
  xs: 12
6222
7619
  },
6223
7620
  container: true,
6224
- rowSpacing: 2,
6225
- columnSpacing: 2,
7621
+ spacing: 2,
6226
7622
  children: [jsx(Grid, {
6227
- size: {
6228
- xs: 12
6229
- },
6230
- children: jsx(Phenomenon, {
6231
- isDisabled: areFieldsDisabled,
6232
- isReadOnly: isReadOnly
6233
- })
6234
- }), jsx(Grid, {
6235
- size: {
6236
- xs: 12
6237
- },
6238
- children: jsx(AreaField, {
6239
- onEditObject: function onEditObject() {},
6240
- onViewObject: function onViewObject() {},
6241
- onDeleteObject: function onDeleteObject() {},
6242
- onAddObject: onAddObject,
6243
- isDisabled: areFieldsDisabled || isReadOnly
6244
- })
6245
- }), jsx(Grid, {
6246
- size: {
6247
- xs: 12
6248
- },
6249
- children: jsx(WarningsMapView, {
6250
- geojsonFeature: geoJSONFeature,
6251
- defaultMapPreset: defaultMapPreset,
6252
- isSnapshot: isSnapshot
6253
- })
6254
- }), jsx(Grid, {
6255
7623
  size: {
6256
7624
  xs: 12,
6257
7625
  sm: 6
6258
7626
  },
6259
- children: jsx(ValidFrom, {
7627
+ children: jsx(LevelField, {
6260
7628
  isDisabled: areFieldsDisabled,
6261
7629
  isReadOnly: isReadOnly
6262
7630
  })
@@ -6265,56 +7633,50 @@ var Form = function Form(_ref5) {
6265
7633
  xs: 12,
6266
7634
  sm: 6
6267
7635
  },
6268
- children: jsx(ValidUntil, {
7636
+ children: jsx(ProbabilityField, {
6269
7637
  isDisabled: areFieldsDisabled,
6270
7638
  isReadOnly: isReadOnly
6271
7639
  })
6272
- }), jsxs(Grid, {
6273
- size: {
6274
- xs: 12
6275
- },
6276
- container: true,
6277
- spacing: 2,
6278
- children: [jsx(Grid, {
6279
- size: {
6280
- xs: 12,
6281
- sm: 6
6282
- },
6283
- children: jsx(LevelField, {
6284
- isDisabled: areFieldsDisabled,
6285
- isReadOnly: isReadOnly
6286
- })
6287
- }), jsx(Grid, {
6288
- size: {
6289
- xs: 12,
6290
- sm: 6
6291
- },
6292
- children: jsx(ProbabilityField, {
6293
- isDisabled: areFieldsDisabled,
6294
- isReadOnly: isReadOnly
6295
- })
6296
- })]
6297
- }), jsx(Grid, {
7640
+ })]
7641
+ }), jsx(Grid, {
7642
+ size: {
7643
+ xs: 12
7644
+ },
7645
+ container: true,
7646
+ spacing: 2,
7647
+ children: jsx(Grid, {
6298
7648
  size: {
6299
7649
  xs: 12
6300
7650
  },
6301
- container: true,
6302
- spacing: 2,
6303
- children: jsx(Grid, {
6304
- size: {
6305
- xs: 12
6306
- },
6307
- children: jsx(DescriptionField, {
6308
- isDisabled: areFieldsDisabled,
6309
- isReadOnly: isReadOnly
6310
- })
7651
+ children: jsx(DescriptionField, {
7652
+ isDisabled: areFieldsDisabled,
7653
+ isReadOnly: isReadOnly
6311
7654
  })
6312
- })]
7655
+ })
7656
+ })]
7657
+ })
7658
+ });
7659
+ };
7660
+ return jsxs(ContainerWrapper, {
7661
+ children: [jsxs(ContainerFormWrapper, {
7662
+ isReadOnly: isReadOnly,
7663
+ ref: ref,
7664
+ "data-testid": "scroll-container",
7665
+ addPadding: !isMaritimeWarning,
7666
+ children: [errors && jsx(Box, {
7667
+ sx: {
7668
+ marginBottom: 2
7669
+ },
7670
+ children: jsx(AlertBanner, {
7671
+ title: errors.title,
7672
+ info: errors.errors,
7673
+ shouldClose: true,
7674
+ severity: error == null ? void 0 : error.severity
6313
7675
  })
6314
- }), jsx(DraftFieldHelper, {}), jsx(ReactHookFormHiddenInput, {
7676
+ }), getFormContent(), jsx(DraftFieldHelper, {}), jsx(ReactHookFormHiddenInput, {
6315
7677
  name: "id"
6316
7678
  })]
6317
- }), formState !== 'cancel' && !isReadOnly && jsx(Box, {
7679
+ }), warningType !== 'maritimeWarningCoastal' && warningType !== 'maritimeWarningNorthSea' && formState !== 'cancel' && !isReadOnly && jsx(Box, {
6318
7680
  sx: {
6319
7681
  padding: '24px 10px 14px 10px',
6320
7682
  position: 'absolute',
@@ -6399,7 +7761,7 @@ var Form = function Form(_ref5) {
6399
7761
  })]
6400
7762
  })
6401
7763
  })
6402
- }), formState === 'cancel' && jsx(Box, {
7764
+ }), warningType !== 'maritimeWarningCoastal' && warningType !== 'maritimeWarningNorthSea' && formState === 'cancel' && jsx(Box, {
6403
7765
  sx: {
6404
7766
  padding: '24px 10px 14px 10px',
6405
7767
  position: 'absolute',
@@ -6551,7 +7913,7 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
6551
7913
  var isEditor = editor === (auth == null ? void 0 : auth.username) || false;
6552
7914
  var dispatch = useDispatch();
6553
7915
  var publishForm = /*#__PURE__*/function () {
6554
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(newFormValues) {
7916
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(newFormValues) {
6555
7917
  return _regeneratorRuntime().wrap(function _callee$(_context) {
6556
7918
  while (1) switch (_context.prev = _context.next) {
6557
7919
  case 0:
@@ -6596,7 +7958,7 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
6596
7958
  return selectedProduct.airmet;
6597
7959
  };
6598
7960
  var saveAviationForm = /*#__PURE__*/function () {
6599
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(productToPost, newStatus, warningType, vaSigmetMoveToFIR, setSelectedUUID) {
7961
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(productToPost, newStatus, warningType, vaSigmetMoveToFIR, setSelectedUUID) {
6600
7962
  var _result;
6601
7963
  var product, uuid, result, postProductParam, _postProductParam;
6602
7964
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -6638,7 +8000,7 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
6638
8000
  };
6639
8001
  }();
6640
8002
  var saveForm = /*#__PURE__*/function () {
6641
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(newFormValues) {
8003
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(newFormValues) {
6642
8004
  var status;
6643
8005
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
6644
8006
  while (1) switch (_context3.prev = _context3.next) {
@@ -7559,7 +8921,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
7559
8921
  }, [selectedWarning == null ? void 0 : selectedWarning.editor]);
7560
8922
  var updatePublicWarningEditor = useMutatePublicWarningEditor();
7561
8923
  var setIsEditor = /*#__PURE__*/function () {
7562
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(isReadOnly) {
8924
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(isReadOnly) {
7563
8925
  var username, updateEditor;
7564
8926
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
7565
8927
  while (1) switch (_context2.prev = _context2.next) {
@@ -7586,7 +8948,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
7586
8948
  }
7587
8949
  },
7588
8950
  onSuccess: function () {
7589
- var _onSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8951
+ var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
7590
8952
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7591
8953
  while (1) switch (_context.prev = _context.next) {
7592
8954
  case 0:
@@ -7642,7 +9004,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
7642
9004
  description: t('warning-view-mode-description'),
7643
9005
  confirmLabel: t('warning-view-mode-confirm'),
7644
9006
  cancelLabel: t('warning-dialog-cancel')
7645
- }).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
9007
+ }).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
7646
9008
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
7647
9009
  while (1) switch (_context3.prev = _context3.next) {
7648
9010
  case 0:
@@ -7659,7 +9021,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
7659
9021
  }
7660
9022
  };
7661
9023
  var closeDialog = /*#__PURE__*/function () {
7662
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
9024
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
7663
9025
  var mayProceed;
7664
9026
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
7665
9027
  while (1) switch (_context4.prev = _context4.next) {
@@ -7810,6 +9172,9 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
7810
9172
  onClick: function onClick(ref) {
7811
9173
  return setAnchorEl(ref);
7812
9174
  },
9175
+ onClickIcon: function onClickIcon(ref) {
9176
+ return setAnchorEl(ref);
9177
+ },
7813
9178
  isDisabled: isDisabled,
7814
9179
  size: "medium",
7815
9180
  actionIcon: jsxs(Grid, {
@@ -8000,14 +9365,14 @@ var FilterList = function FilterList(_ref) {
8000
9365
  });
8001
9366
  };
8002
9367
 
8003
- var _excluded$3 = ["totalWarnings", "status", "isExpanded", "onClick"];
9368
+ var _excluded$2 = ["totalWarnings", "status", "isExpanded", "onClick"];
8004
9369
  var HEADER_SIZE = 32;
8005
9370
  var WarningListItemSeperator = function WarningListItemSeperator(_ref) {
8006
9371
  var totalWarnings = _ref.totalWarnings,
8007
9372
  status = _ref.status,
8008
9373
  isExpanded = _ref.isExpanded,
8009
9374
  onClick = _ref.onClick,
8010
- props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
9375
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
8011
9376
  var _useWarningsTranslati = useWarningsTranslation(),
8012
9377
  t = _useWarningsTranslati.t;
8013
9378
  var getStatus = function getStatus(status) {
@@ -8048,7 +9413,7 @@ var WarningListItemSeperator = function WarningListItemSeperator(_ref) {
8048
9413
  }));
8049
9414
  };
8050
9415
 
8051
- var _excluded$2 = ["title", "status", "children", "width"];
9416
+ var _excluded$1 = ["title", "status", "children", "width"];
8052
9417
  var WarningListColumnContent = function WarningListColumnContent(_ref) {
8053
9418
  var _sx;
8054
9419
  var title = _ref.title,
@@ -8056,7 +9421,7 @@ var WarningListColumnContent = function WarningListColumnContent(_ref) {
8056
9421
  children = _ref.children,
8057
9422
  _ref$width = _ref.width,
8058
9423
  width = _ref$width === void 0 ? 76 : _ref$width,
8059
- props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
9424
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
8060
9425
  return jsxs(Grid, {
8061
9426
  sx: Object.assign({}, props.sx, {
8062
9427
  width: width
@@ -8233,7 +9598,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
8233
9598
  }
8234
9599
  };
8235
9600
 
8236
- var _excluded$1 = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning"];
9601
+ var _excluded = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning"];
8237
9602
  var renderLevelText = function renderLevelText(levelString) {
8238
9603
  if (!levelString) {
8239
9604
  return null;
@@ -8330,7 +9695,7 @@ var WarningListItem = function WarningListItem(_ref) {
8330
9695
  onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
8331
9696
  _ref$onActionAviation = _ref.onActionAviationWarning,
8332
9697
  onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
8333
- props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
9698
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
8334
9699
  var _useWarningsTranslati = useWarningsTranslation(),
8335
9700
  t = _useWarningsTranslati.t;
8336
9701
  var phenomenonDetails = allPhenomenaDict[warning.warningDetail.phenomenon];
@@ -8571,6 +9936,8 @@ var NewWarningButton = function NewWarningButton(_ref) {
8571
9936
  isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
8572
9937
  var _useWarningsTranslati = useWarningsTranslation(),
8573
9938
  t = _useWarningsTranslati.t;
9939
+ var config = sessionStorageProvider.getConfig();
9940
+ var showMartimeWarningOption = !!config.GW_WARNINGS_MARITIME_WARNINGS;
8574
9941
  var _React$useState = React__default.useState(null),
8575
9942
  anchorEl = _React$useState[0],
8576
9943
  setAnchorEl = _React$useState[1];
@@ -8666,64 +10033,27 @@ var NewWarningButton = function NewWarningButton(_ref) {
8666
10033
  children: jsx(ListItemText, {
8667
10034
  children: BUTTON_SIGMET
8668
10035
  })
8669
- }, "Sigmet")]
10036
+ }, "Sigmet"), showMartimeWarningOption ? jsxs(Fragment, {
10037
+ children: [jsx(MenuItem, {
10038
+ onClick: function onClick(event) {
10039
+ onCreateNewWarning('maritimeWarningCoastal', event);
10040
+ },
10041
+ children: jsx(ListItemText, {
10042
+ children: t('maritime-warning-coastal-title').toUpperCase()
10043
+ })
10044
+ }, "MaritimeWarningCoastal"), jsx(MenuItem, {
10045
+ onClick: function onClick(event) {
10046
+ onCreateNewWarning('maritimeWarningNorthSea', event);
10047
+ },
10048
+ children: jsx(ListItemText, {
10049
+ children: t('maritime-warning-northsea-title').toUpperCase()
10050
+ })
10051
+ }, "MaritimeWarningNorthSea")]
10052
+ }) : null]
8670
10053
  })]
8671
10054
  });
8672
10055
  };
8673
10056
 
8674
- var _excluded = ["title", "width", "onClick", "isSorted", "sortDirection", "sortable"];
8675
- var sharedArrowIconStyles = {
8676
- fontSize: '0.9rem'
8677
- };
8678
- var WarningListHeaderContent = function WarningListHeaderContent(_ref) {
8679
- var title = _ref.title,
8680
- _ref$width = _ref.width,
8681
- width = _ref$width === void 0 ? 76 : _ref$width,
8682
- _onClick = _ref.onClick,
8683
- isSorted = _ref.isSorted,
8684
- sortDirection = _ref.sortDirection,
8685
- sortable = _ref.sortable,
8686
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
8687
- return jsx(Grid, {
8688
- sx: Object.assign({}, props.sx, {
8689
- width: width,
8690
- cursor: _onClick ? 'pointer' : 'default'
8691
- }),
8692
- onClick: function onClick(e) {
8693
- e.stopPropagation(); // Ensure click only affects this column
8694
- _onClick == null || _onClick();
8695
- },
8696
- children: jsxs(Box, {
8697
- sx: {
8698
- display: 'flex',
8699
- alignItems: 'center',
8700
- overflow: 'hidden',
8701
- fontWeight: 'normal',
8702
- textOverflow: 'ellipsis',
8703
- fontSize: 12,
8704
- lineHeight: 1.33,
8705
- height: 16,
8706
- color: 'geowebColors.captions.captionStatus.rgba'
8707
- },
8708
- children: [title, sortable && jsx(Box, {
8709
- sx: {
8710
- display: 'flex',
8711
- alignItems: 'center',
8712
- marginLeft: '4px',
8713
- color: isSorted ? '#186DFF' : 'inherit'
8714
- },
8715
- children: isSorted && sortDirection === 'asc' ? jsx(ArrowUpCompact, {
8716
- sx: Object.assign({}, sharedArrowIconStyles),
8717
- "data-testid": "ArrowUpIcon"
8718
- }) : jsx(ArrowDownCompact, {
8719
- sx: Object.assign({}, sharedArrowIconStyles),
8720
- "data-testid": "ArrowDownIcon"
8721
- })
8722
- })]
8723
- })
8724
- });
8725
- };
8726
-
8727
10057
  var groupWarningsOnStatus = function groupWarningsOnStatus(warnings, sortState) {
8728
10058
  var key = sortState.key,
8729
10059
  direction = sortState.direction;
@@ -9368,7 +10698,7 @@ var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
9368
10698
  error = _React$useState2[0],
9369
10699
  setError = _React$useState2[1];
9370
10700
  var onSubmit = /*#__PURE__*/function () {
9371
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
10701
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9372
10702
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9373
10703
  while (1) switch (_context.prev = _context.next) {
9374
10704
  case 0:
@@ -9455,7 +10785,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
9455
10785
  });
9456
10786
  var isFormDirty = useSelector(getSelectedPublicIsFormDirty);
9457
10787
  var openPublicWarningDialog = /*#__PURE__*/function () {
9458
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(formAction, warning, warningType) {
10788
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(formAction, warning, warningType) {
9459
10789
  var mayProceed;
9460
10790
  return _regeneratorRuntime().wrap(function _callee$(_context) {
9461
10791
  while (1) switch (_context.prev = _context.next) {
@@ -9502,7 +10832,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
9502
10832
  void openPublicWarningDialog('', undefined, warningType);
9503
10833
  };
9504
10834
  var editWarning = /*#__PURE__*/function () {
9505
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(publicWarning) {
10835
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(publicWarning) {
9506
10836
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9507
10837
  while (1) switch (_context2.prev = _context2.next) {
9508
10838
  case 0:
@@ -9585,7 +10915,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
9585
10915
  var _usePostAirmet = usePostAirmet(),
9586
10916
  postAirmet = _usePostAirmet.mutateAsync;
9587
10917
  var deleteAviationProduct = /*#__PURE__*/function () {
9588
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(productToPost, newStatus, warningType) {
10918
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(productToPost, newStatus, warningType) {
9589
10919
  var uuid, _postProductParam, postProductParam, errorMessage;
9590
10920
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
9591
10921
  while (1) switch (_context3.prev = _context3.next) {
@@ -9825,7 +11155,14 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
9825
11155
 
9826
11156
  var warningListViewPreset = {
9827
11157
  componentType: 'WarningList'};
9828
- var componentsLookUp = function componentsLookUp(payload) {
11158
+ var maritimeWarningsViewPreset = {
11159
+ componentType: 'MaritimeWarnings'};
11160
+ var componentsLookUp = function componentsLookUp(payload,
11161
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11162
+ ComponentsLookUpWrapper) {
11163
+ if (ComponentsLookUpWrapper === void 0) {
11164
+ ComponentsLookUpWrapper = null;
11165
+ }
9829
11166
  var id = payload.id,
9830
11167
  componentType = payload.componentType,
9831
11168
  initialProps = payload.initialProps;
@@ -9838,6 +11175,21 @@ var componentsLookUp = function componentsLookUp(payload) {
9838
11175
  presetFilterState: initialProps.filterState
9839
11176
  })
9840
11177
  });
11178
+ case maritimeWarningsViewPreset.componentType:
11179
+ if (ComponentsLookUpWrapper) {
11180
+ return jsx(ErrorBoundary, {
11181
+ children: jsx(ComponentsLookUpWrapper, {
11182
+ component: MaritimeWarningsFormConnect,
11183
+ payload: payload,
11184
+ domain: initialProps.domain || 'northSeaDistricts'
11185
+ })
11186
+ });
11187
+ }
11188
+ return jsx(ErrorBoundary, {
11189
+ children: jsx(MaritimeWarningsFormConnect, {
11190
+ domain: initialProps.domain || 'northSeaDistricts'
11191
+ })
11192
+ });
9841
11193
  default:
9842
11194
  return null;
9843
11195
  }