@opengeoweb/warnings 6.0.2 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +3534 -2
- package/package.json +6 -6
- package/src/index.d.ts +3 -1
- package/src/lib/components/AreaManager/AreaManager.d.ts +2 -1
- package/src/lib/components/AreaManager/Drawings.d.ts +2 -1
- package/src/lib/components/AreaManager/Drawings.spec.d.ts +1 -0
- package/src/lib/components/WarningsModuleProvider/WarningsModuleProvider.d.ts +7 -0
- package/src/lib/components/WarningsModuleProvider/index.d.ts +1 -0
- package/src/lib/store/config.d.ts +1 -1
- package/src/lib/utils/api.d.ts +4 -0
- package/src/lib/utils/api.spec.d.ts +1 -0
package/index.esm.js
CHANGED
|
@@ -1,3 +1,3531 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default, { useContext, useRef, useCallback, useDebugValue, Fragment, useState, useEffect } from 'react';
|
|
3
|
+
import 'react-dom';
|
|
4
|
+
import { Polygons, Edit, Delete } from '@opengeoweb/theme';
|
|
5
|
+
import { uiTypes, uiSelectors, uiActions, layerSelectors, drawSelectors, mapStoreActions, drawActions, snackbarActions } from '@opengeoweb/store';
|
|
6
|
+
import { MapControlButton, useSetupDialog } from '@opengeoweb/core';
|
|
7
|
+
import { dateUtils, ToggleMenu, ToolContainerDraggable, calculateDialogSizeAndPosition } from '@opengeoweb/shared';
|
|
8
|
+
import { List, Typography, ListItem, MenuItem, ListItemText, Paper, ListItemButton, Box, Stack } from '@mui/material';
|
|
9
|
+
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
10
|
+
|
|
11
|
+
var shim = {exports: {}};
|
|
12
|
+
|
|
13
|
+
var useSyncExternalStoreShim_production_min = {};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @license React
|
|
17
|
+
* use-sync-external-store-shim.production.min.js
|
|
18
|
+
*
|
|
19
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
20
|
+
*
|
|
21
|
+
* This source code is licensed under the MIT license found in the
|
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
|
23
|
+
*/
|
|
24
|
+
var e$2=React__default;function h$3(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var k$2="function"===typeof Object.is?Object.is:h$3,l$2=e$2.useState,m$2=e$2.useEffect,n$3=e$2.useLayoutEffect,p$3=e$2.useDebugValue;function q$3(a,b){var d=b(),f=l$2({inst:{value:d,getSnapshot:b}}),c=f[0].inst,g=f[1];n$3(function(){c.value=d;c.getSnapshot=b;r$2(c)&&g({inst:c});},[a,d,b]);m$2(function(){r$2(c)&&g({inst:c});return a(function(){r$2(c)&&g({inst:c});})},[a]);p$3(d);return d}
|
|
25
|
+
function r$2(a){var b=a.getSnapshot;a=a.value;try{var d=b();return !k$2(a,d)}catch(f){return !0}}function t$3(a,b){return b()}var u$2="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?t$3:q$3;useSyncExternalStoreShim_production_min.useSyncExternalStore=void 0!==e$2.useSyncExternalStore?e$2.useSyncExternalStore:u$2;
|
|
26
|
+
|
|
27
|
+
var useSyncExternalStoreShim_development = {};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @license React
|
|
31
|
+
* use-sync-external-store-shim.development.js
|
|
32
|
+
*
|
|
33
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the MIT license found in the
|
|
36
|
+
* LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
if (process.env.NODE_ENV !== "production") {
|
|
40
|
+
(function() {
|
|
41
|
+
|
|
42
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
43
|
+
if (
|
|
44
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
45
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
46
|
+
'function'
|
|
47
|
+
) {
|
|
48
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
49
|
+
}
|
|
50
|
+
var React = React__default;
|
|
51
|
+
|
|
52
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
53
|
+
|
|
54
|
+
function error(format) {
|
|
55
|
+
{
|
|
56
|
+
{
|
|
57
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
58
|
+
args[_key2 - 1] = arguments[_key2];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
printWarning('error', format, args);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function printWarning(level, format, args) {
|
|
67
|
+
// When changing this logic, you might want to also
|
|
68
|
+
// update consoleWithStackDev.www.js as well.
|
|
69
|
+
{
|
|
70
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
71
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
72
|
+
|
|
73
|
+
if (stack !== '') {
|
|
74
|
+
format += '%s';
|
|
75
|
+
args = args.concat([stack]);
|
|
76
|
+
} // eslint-disable-next-line react-internal/safe-string-coercion
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
var argsWithFormat = args.map(function (item) {
|
|
80
|
+
return String(item);
|
|
81
|
+
}); // Careful: RN currently depends on this prefix
|
|
82
|
+
|
|
83
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
84
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
85
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
86
|
+
|
|
87
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
93
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
94
|
+
*/
|
|
95
|
+
function is(x, y) {
|
|
96
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
97
|
+
;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
101
|
+
|
|
102
|
+
// dispatch for CommonJS interop named imports.
|
|
103
|
+
|
|
104
|
+
var useState = React.useState,
|
|
105
|
+
useEffect = React.useEffect,
|
|
106
|
+
useLayoutEffect = React.useLayoutEffect,
|
|
107
|
+
useDebugValue = React.useDebugValue;
|
|
108
|
+
var didWarnOld18Alpha = false;
|
|
109
|
+
var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works
|
|
110
|
+
// because of a very particular set of implementation details and assumptions
|
|
111
|
+
// -- change any one of them and it will break. The most important assumption
|
|
112
|
+
// is that updates are always synchronous, because concurrent rendering is
|
|
113
|
+
// only available in versions of React that also have a built-in
|
|
114
|
+
// useSyncExternalStore API. And we only use this shim when the built-in API
|
|
115
|
+
// does not exist.
|
|
116
|
+
//
|
|
117
|
+
// Do not assume that the clever hacks used by this hook also work in general.
|
|
118
|
+
// The point of this shim is to replace the need for hacks by other libraries.
|
|
119
|
+
|
|
120
|
+
function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
121
|
+
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
122
|
+
// will need to track that themselves and return the correct value
|
|
123
|
+
// from `getSnapshot`.
|
|
124
|
+
getServerSnapshot) {
|
|
125
|
+
{
|
|
126
|
+
if (!didWarnOld18Alpha) {
|
|
127
|
+
if (React.startTransition !== undefined) {
|
|
128
|
+
didWarnOld18Alpha = true;
|
|
129
|
+
|
|
130
|
+
error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.');
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
} // Read the current snapshot from the store on every render. Again, this
|
|
134
|
+
// breaks the rules of React, and only works here because of specific
|
|
135
|
+
// implementation details, most importantly that updates are
|
|
136
|
+
// always synchronous.
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
var value = getSnapshot();
|
|
140
|
+
|
|
141
|
+
{
|
|
142
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
143
|
+
var cachedValue = getSnapshot();
|
|
144
|
+
|
|
145
|
+
if (!objectIs(value, cachedValue)) {
|
|
146
|
+
error('The result of getSnapshot should be cached to avoid an infinite loop');
|
|
147
|
+
|
|
148
|
+
didWarnUncachedGetSnapshot = true;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} // Because updates are synchronous, we don't queue them. Instead we force a
|
|
152
|
+
// re-render whenever the subscribed state changes by updating an some
|
|
153
|
+
// arbitrary useState hook. Then, during render, we call getSnapshot to read
|
|
154
|
+
// the current value.
|
|
155
|
+
//
|
|
156
|
+
// Because we don't actually use the state returned by the useState hook, we
|
|
157
|
+
// can save a bit of memory by storing other stuff in that slot.
|
|
158
|
+
//
|
|
159
|
+
// To implement the early bailout, we need to track some things on a mutable
|
|
160
|
+
// object. Usually, we would put that in a useRef hook, but we can stash it in
|
|
161
|
+
// our useState hook instead.
|
|
162
|
+
//
|
|
163
|
+
// To force a re-render, we call forceUpdate({inst}). That works because the
|
|
164
|
+
// new object always fails an equality check.
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
var _useState = useState({
|
|
168
|
+
inst: {
|
|
169
|
+
value: value,
|
|
170
|
+
getSnapshot: getSnapshot
|
|
171
|
+
}
|
|
172
|
+
}),
|
|
173
|
+
inst = _useState[0].inst,
|
|
174
|
+
forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated
|
|
175
|
+
// in the layout phase so we can access it during the tearing check that
|
|
176
|
+
// happens on subscribe.
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
useLayoutEffect(function () {
|
|
180
|
+
inst.value = value;
|
|
181
|
+
inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the
|
|
182
|
+
// commit phase if there was an interleaved mutation. In concurrent mode
|
|
183
|
+
// this can happen all the time, but even in synchronous mode, an earlier
|
|
184
|
+
// effect may have mutated the store.
|
|
185
|
+
|
|
186
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
187
|
+
// Force a re-render.
|
|
188
|
+
forceUpdate({
|
|
189
|
+
inst: inst
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}, [subscribe, value, getSnapshot]);
|
|
193
|
+
useEffect(function () {
|
|
194
|
+
// Check for changes right before subscribing. Subsequent changes will be
|
|
195
|
+
// detected in the subscription handler.
|
|
196
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
197
|
+
// Force a re-render.
|
|
198
|
+
forceUpdate({
|
|
199
|
+
inst: inst
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
var handleStoreChange = function () {
|
|
204
|
+
// TODO: Because there is no cross-renderer API for batching updates, it's
|
|
205
|
+
// up to the consumer of this library to wrap their subscription event
|
|
206
|
+
// with unstable_batchedUpdates. Should we try to detect when this isn't
|
|
207
|
+
// the case and print a warning in development?
|
|
208
|
+
// The store changed. Check if the snapshot changed since the last time we
|
|
209
|
+
// read from the store.
|
|
210
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
211
|
+
// Force a re-render.
|
|
212
|
+
forceUpdate({
|
|
213
|
+
inst: inst
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
}; // Subscribe to the store and return a clean-up function.
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
return subscribe(handleStoreChange);
|
|
220
|
+
}, [subscribe]);
|
|
221
|
+
useDebugValue(value);
|
|
222
|
+
return value;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function checkIfSnapshotChanged(inst) {
|
|
226
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
227
|
+
var prevValue = inst.value;
|
|
228
|
+
|
|
229
|
+
try {
|
|
230
|
+
var nextValue = latestGetSnapshot();
|
|
231
|
+
return !objectIs(prevValue, nextValue);
|
|
232
|
+
} catch (error) {
|
|
233
|
+
return true;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
238
|
+
// Note: The shim does not use getServerSnapshot, because pre-18 versions of
|
|
239
|
+
// React do not expose a way to check if we're hydrating. So users of the shim
|
|
240
|
+
// will need to track that themselves and return the correct value
|
|
241
|
+
// from `getSnapshot`.
|
|
242
|
+
return getSnapshot();
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
|
|
246
|
+
|
|
247
|
+
var isServerEnvironment = !canUseDOM;
|
|
248
|
+
|
|
249
|
+
var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
250
|
+
var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim;
|
|
251
|
+
|
|
252
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
253
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
254
|
+
if (
|
|
255
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
256
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
257
|
+
'function'
|
|
258
|
+
) {
|
|
259
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
})();
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (process.env.NODE_ENV === 'production') {
|
|
266
|
+
shim.exports = useSyncExternalStoreShim_production_min;
|
|
267
|
+
} else {
|
|
268
|
+
shim.exports = useSyncExternalStoreShim_development;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
var withSelector = {exports: {}};
|
|
272
|
+
|
|
273
|
+
var withSelector_production_min = {};
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @license React
|
|
277
|
+
* use-sync-external-store-shim/with-selector.production.min.js
|
|
278
|
+
*
|
|
279
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
280
|
+
*
|
|
281
|
+
* This source code is licensed under the MIT license found in the
|
|
282
|
+
* LICENSE file in the root directory of this source tree.
|
|
283
|
+
*/
|
|
284
|
+
var h$2=React__default,n$2=shim.exports;function p$2(a,b){return a===b&&(0!==a||1/a===1/b)||a!==a&&b!==b}var q$2="function"===typeof Object.is?Object.is:p$2,r$1=n$2.useSyncExternalStore,t$2=h$2.useRef,u$1=h$2.useEffect,v$2=h$2.useMemo,w$1=h$2.useDebugValue;
|
|
285
|
+
withSelector_production_min.useSyncExternalStoreWithSelector=function(a,b,e,l,g){var c=t$2(null);if(null===c.current){var f={hasValue:!1,value:null};c.current=f;}else f=c.current;c=v$2(function(){function a(a){if(!c){c=!0;d=a;a=l(a);if(void 0!==g&&f.hasValue){var b=f.value;if(g(b,a))return k=b}return k=a}b=k;if(q$2(d,a))return b;var e=l(a);if(void 0!==g&&g(b,e))return b;d=a;return k=e}var c=!1,d,k,m=void 0===e?null:e;return [function(){return a(b())},null===m?void 0:function(){return a(m())}]},[b,e,l,g]);var d=r$1(a,c[0],c[1]);
|
|
286
|
+
u$1(function(){f.hasValue=!0;f.value=d;},[d]);w$1(d);return d};
|
|
287
|
+
|
|
288
|
+
var withSelector_development = {};
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @license React
|
|
292
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
293
|
+
*
|
|
294
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
295
|
+
*
|
|
296
|
+
* This source code is licensed under the MIT license found in the
|
|
297
|
+
* LICENSE file in the root directory of this source tree.
|
|
298
|
+
*/
|
|
299
|
+
|
|
300
|
+
if (process.env.NODE_ENV !== "production") {
|
|
301
|
+
(function() {
|
|
302
|
+
|
|
303
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
304
|
+
if (
|
|
305
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
306
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart ===
|
|
307
|
+
'function'
|
|
308
|
+
) {
|
|
309
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
310
|
+
}
|
|
311
|
+
var React = React__default;
|
|
312
|
+
var shim$1 = shim.exports;
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
316
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
317
|
+
*/
|
|
318
|
+
function is(x, y) {
|
|
319
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
|
|
320
|
+
;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
var objectIs = typeof Object.is === 'function' ? Object.is : is;
|
|
324
|
+
|
|
325
|
+
var useSyncExternalStore = shim$1.useSyncExternalStore;
|
|
326
|
+
|
|
327
|
+
// for CommonJS interop.
|
|
328
|
+
|
|
329
|
+
var useRef = React.useRef,
|
|
330
|
+
useEffect = React.useEffect,
|
|
331
|
+
useMemo = React.useMemo,
|
|
332
|
+
useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments.
|
|
333
|
+
|
|
334
|
+
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
335
|
+
// Use this to track the rendered snapshot.
|
|
336
|
+
var instRef = useRef(null);
|
|
337
|
+
var inst;
|
|
338
|
+
|
|
339
|
+
if (instRef.current === null) {
|
|
340
|
+
inst = {
|
|
341
|
+
hasValue: false,
|
|
342
|
+
value: null
|
|
343
|
+
};
|
|
344
|
+
instRef.current = inst;
|
|
345
|
+
} else {
|
|
346
|
+
inst = instRef.current;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
var _useMemo = useMemo(function () {
|
|
350
|
+
// Track the memoized state using closure variables that are local to this
|
|
351
|
+
// memoized instance of a getSnapshot function. Intentionally not using a
|
|
352
|
+
// useRef hook, because that state would be shared across all concurrent
|
|
353
|
+
// copies of the hook/component.
|
|
354
|
+
var hasMemo = false;
|
|
355
|
+
var memoizedSnapshot;
|
|
356
|
+
var memoizedSelection;
|
|
357
|
+
|
|
358
|
+
var memoizedSelector = function (nextSnapshot) {
|
|
359
|
+
if (!hasMemo) {
|
|
360
|
+
// The first time the hook is called, there is no memoized result.
|
|
361
|
+
hasMemo = true;
|
|
362
|
+
memoizedSnapshot = nextSnapshot;
|
|
363
|
+
|
|
364
|
+
var _nextSelection = selector(nextSnapshot);
|
|
365
|
+
|
|
366
|
+
if (isEqual !== undefined) {
|
|
367
|
+
// Even if the selector has changed, the currently rendered selection
|
|
368
|
+
// may be equal to the new selection. We should attempt to reuse the
|
|
369
|
+
// current value if possible, to preserve downstream memoizations.
|
|
370
|
+
if (inst.hasValue) {
|
|
371
|
+
var currentSelection = inst.value;
|
|
372
|
+
|
|
373
|
+
if (isEqual(currentSelection, _nextSelection)) {
|
|
374
|
+
memoizedSelection = currentSelection;
|
|
375
|
+
return currentSelection;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
memoizedSelection = _nextSelection;
|
|
381
|
+
return _nextSelection;
|
|
382
|
+
} // We may be able to reuse the previous invocation's result.
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
// We may be able to reuse the previous invocation's result.
|
|
386
|
+
var prevSnapshot = memoizedSnapshot;
|
|
387
|
+
var prevSelection = memoizedSelection;
|
|
388
|
+
|
|
389
|
+
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
390
|
+
// The snapshot is the same as last time. Reuse the previous selection.
|
|
391
|
+
return prevSelection;
|
|
392
|
+
} // The snapshot has changed, so we need to compute a new selection.
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
// The snapshot has changed, so we need to compute a new selection.
|
|
396
|
+
var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data
|
|
397
|
+
// has changed. If it hasn't, return the previous selection. That signals
|
|
398
|
+
// to React that the selections are conceptually equal, and we can bail
|
|
399
|
+
// out of rendering.
|
|
400
|
+
|
|
401
|
+
// If a custom isEqual function is provided, use that to check if the data
|
|
402
|
+
// has changed. If it hasn't, return the previous selection. That signals
|
|
403
|
+
// to React that the selections are conceptually equal, and we can bail
|
|
404
|
+
// out of rendering.
|
|
405
|
+
if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) {
|
|
406
|
+
return prevSelection;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
memoizedSnapshot = nextSnapshot;
|
|
410
|
+
memoizedSelection = nextSelection;
|
|
411
|
+
return nextSelection;
|
|
412
|
+
}; // Assigning this to a constant so that Flow knows it can't change.
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
// Assigning this to a constant so that Flow knows it can't change.
|
|
416
|
+
var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot;
|
|
417
|
+
|
|
418
|
+
var getSnapshotWithSelector = function () {
|
|
419
|
+
return memoizedSelector(getSnapshot());
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () {
|
|
423
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
424
|
+
};
|
|
425
|
+
return [getSnapshotWithSelector, getServerSnapshotWithSelector];
|
|
426
|
+
}, [getSnapshot, getServerSnapshot, selector, isEqual]),
|
|
427
|
+
getSelection = _useMemo[0],
|
|
428
|
+
getServerSelection = _useMemo[1];
|
|
429
|
+
|
|
430
|
+
var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
431
|
+
useEffect(function () {
|
|
432
|
+
inst.hasValue = true;
|
|
433
|
+
inst.value = value;
|
|
434
|
+
}, [value]);
|
|
435
|
+
useDebugValue(value);
|
|
436
|
+
return value;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
|
|
440
|
+
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
|
|
441
|
+
if (
|
|
442
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
|
|
443
|
+
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop ===
|
|
444
|
+
'function'
|
|
445
|
+
) {
|
|
446
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
})();
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (process.env.NODE_ENV === 'production') {
|
|
453
|
+
withSelector.exports = withSelector_production_min;
|
|
454
|
+
} else {
|
|
455
|
+
withSelector.exports = withSelector_development;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const ContextKey = Symbol.for(`react-redux-context`);
|
|
459
|
+
const gT = typeof globalThis !== "undefined" ? globalThis :
|
|
460
|
+
/* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
|
|
461
|
+
{};
|
|
462
|
+
|
|
463
|
+
function getContext() {
|
|
464
|
+
var _gT$ContextKey;
|
|
465
|
+
|
|
466
|
+
if (!React.createContext) return {};
|
|
467
|
+
const contextMap = (_gT$ContextKey = gT[ContextKey]) != null ? _gT$ContextKey : gT[ContextKey] = new Map();
|
|
468
|
+
let realContext = contextMap.get(React.createContext);
|
|
469
|
+
|
|
470
|
+
if (!realContext) {
|
|
471
|
+
realContext = React.createContext(null);
|
|
472
|
+
|
|
473
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
474
|
+
realContext.displayName = 'ReactRedux';
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
contextMap.set(React.createContext, realContext);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
return realContext;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
const ReactReduxContext = /*#__PURE__*/getContext();
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level
|
|
487
|
+
* hook that you should usually not need to call directly.
|
|
488
|
+
*
|
|
489
|
+
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
|
|
490
|
+
* @returns {Function} A `useReduxContext` hook bound to the specified context.
|
|
491
|
+
*/
|
|
492
|
+
function createReduxContextHook(context = ReactReduxContext) {
|
|
493
|
+
return function useReduxContext() {
|
|
494
|
+
const contextValue = useContext(context);
|
|
495
|
+
|
|
496
|
+
if (process.env.NODE_ENV !== 'production' && !contextValue) {
|
|
497
|
+
throw new Error('could not find react-redux context value; please ensure the component is wrapped in a <Provider>');
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
return contextValue;
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
/**
|
|
504
|
+
* A hook to access the value of the `ReactReduxContext`. This is a low-level
|
|
505
|
+
* hook that you should usually not need to call directly.
|
|
506
|
+
*
|
|
507
|
+
* @returns {any} the value of the `ReactReduxContext`
|
|
508
|
+
*
|
|
509
|
+
* @example
|
|
510
|
+
*
|
|
511
|
+
* import React from 'react'
|
|
512
|
+
* import { useReduxContext } from 'react-redux'
|
|
513
|
+
*
|
|
514
|
+
* export const CounterComponent = () => {
|
|
515
|
+
* const { store } = useReduxContext()
|
|
516
|
+
* return <div>{store.getState()}</div>
|
|
517
|
+
* }
|
|
518
|
+
*/
|
|
519
|
+
|
|
520
|
+
const useReduxContext = /*#__PURE__*/createReduxContextHook();
|
|
521
|
+
|
|
522
|
+
const notInitialized = () => {
|
|
523
|
+
throw new Error('uSES not initialized!');
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
let useSyncExternalStoreWithSelector = notInitialized;
|
|
527
|
+
const initializeUseSelector = fn => {
|
|
528
|
+
useSyncExternalStoreWithSelector = fn;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
const refEquality = (a, b) => a === b;
|
|
532
|
+
/**
|
|
533
|
+
* Hook factory, which creates a `useSelector` hook bound to a given context.
|
|
534
|
+
*
|
|
535
|
+
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
|
|
536
|
+
* @returns {Function} A `useSelector` hook bound to the specified context.
|
|
537
|
+
*/
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
function createSelectorHook(context = ReactReduxContext) {
|
|
541
|
+
const useReduxContext$1 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
|
|
542
|
+
return function useSelector(selector, equalityFnOrOptions = {}) {
|
|
543
|
+
const {
|
|
544
|
+
equalityFn = refEquality,
|
|
545
|
+
stabilityCheck = undefined,
|
|
546
|
+
noopCheck = undefined
|
|
547
|
+
} = typeof equalityFnOrOptions === 'function' ? {
|
|
548
|
+
equalityFn: equalityFnOrOptions
|
|
549
|
+
} : equalityFnOrOptions;
|
|
550
|
+
|
|
551
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
552
|
+
if (!selector) {
|
|
553
|
+
throw new Error(`You must pass a selector to useSelector`);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
if (typeof selector !== 'function') {
|
|
557
|
+
throw new Error(`You must pass a function as a selector to useSelector`);
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
if (typeof equalityFn !== 'function') {
|
|
561
|
+
throw new Error(`You must pass a function as an equality function to useSelector`);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
const {
|
|
566
|
+
store,
|
|
567
|
+
subscription,
|
|
568
|
+
getServerState,
|
|
569
|
+
stabilityCheck: globalStabilityCheck,
|
|
570
|
+
noopCheck: globalNoopCheck
|
|
571
|
+
} = useReduxContext$1();
|
|
572
|
+
const firstRun = useRef(true);
|
|
573
|
+
const wrappedSelector = useCallback({
|
|
574
|
+
[selector.name](state) {
|
|
575
|
+
const selected = selector(state);
|
|
576
|
+
|
|
577
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
578
|
+
const finalStabilityCheck = typeof stabilityCheck === 'undefined' ? globalStabilityCheck : stabilityCheck;
|
|
579
|
+
|
|
580
|
+
if (finalStabilityCheck === 'always' || finalStabilityCheck === 'once' && firstRun.current) {
|
|
581
|
+
const toCompare = selector(state);
|
|
582
|
+
|
|
583
|
+
if (!equalityFn(selected, toCompare)) {
|
|
584
|
+
console.warn('Selector ' + (selector.name || 'unknown') + ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' + '\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization', {
|
|
585
|
+
state,
|
|
586
|
+
selected,
|
|
587
|
+
selected2: toCompare
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
const finalNoopCheck = typeof noopCheck === 'undefined' ? globalNoopCheck : noopCheck;
|
|
593
|
+
|
|
594
|
+
if (finalNoopCheck === 'always' || finalNoopCheck === 'once' && firstRun.current) {
|
|
595
|
+
// @ts-ignore
|
|
596
|
+
if (selected === state) {
|
|
597
|
+
console.warn('Selector ' + (selector.name || 'unknown') + ' returned the root state when called. This can lead to unnecessary rerenders.' + '\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.');
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
if (firstRun.current) firstRun.current = false;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
return selected;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
}[selector.name], [selector, globalStabilityCheck, stabilityCheck]);
|
|
608
|
+
const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store.getState, getServerState || store.getState, wrappedSelector, equalityFn);
|
|
609
|
+
useDebugValue(selectedState);
|
|
610
|
+
return selectedState;
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* A hook to access the redux store's state. This hook takes a selector function
|
|
615
|
+
* as an argument. The selector is called with the store state.
|
|
616
|
+
*
|
|
617
|
+
* This hook takes an optional equality comparison function as the second parameter
|
|
618
|
+
* that allows you to customize the way the selected state is compared to determine
|
|
619
|
+
* whether the component needs to be re-rendered.
|
|
620
|
+
*
|
|
621
|
+
* @param {Function} selector the selector function
|
|
622
|
+
* @param {Function=} equalityFn the function that will be used to determine equality
|
|
623
|
+
*
|
|
624
|
+
* @returns {any} the selected state
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
*
|
|
628
|
+
* import React from 'react'
|
|
629
|
+
* import { useSelector } from 'react-redux'
|
|
630
|
+
*
|
|
631
|
+
* export const CounterComponent = () => {
|
|
632
|
+
* const counter = useSelector(state => state.counter)
|
|
633
|
+
* return <div>{counter}</div>
|
|
634
|
+
* }
|
|
635
|
+
*/
|
|
636
|
+
|
|
637
|
+
const useSelector = /*#__PURE__*/createSelectorHook();
|
|
638
|
+
|
|
639
|
+
var reactIs$1 = {exports: {}};
|
|
640
|
+
|
|
641
|
+
var reactIs_production_min$1 = {};
|
|
642
|
+
|
|
643
|
+
/** @license React v16.13.1
|
|
644
|
+
* react-is.production.min.js
|
|
645
|
+
*
|
|
646
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
647
|
+
*
|
|
648
|
+
* This source code is licensed under the MIT license found in the
|
|
649
|
+
* LICENSE file in the root directory of this source tree.
|
|
650
|
+
*/
|
|
651
|
+
var b$1="function"===typeof Symbol&&Symbol.for,c$1=b$1?Symbol.for("react.element"):60103,d$1=b$1?Symbol.for("react.portal"):60106,e$1=b$1?Symbol.for("react.fragment"):60107,f$1=b$1?Symbol.for("react.strict_mode"):60108,g$1=b$1?Symbol.for("react.profiler"):60114,h$1=b$1?Symbol.for("react.provider"):60109,k$1=b$1?Symbol.for("react.context"):60110,l$1=b$1?Symbol.for("react.async_mode"):60111,m$1=b$1?Symbol.for("react.concurrent_mode"):60111,n$1=b$1?Symbol.for("react.forward_ref"):60112,p$1=b$1?Symbol.for("react.suspense"):60113,q$1=b$1?
|
|
652
|
+
Symbol.for("react.suspense_list"):60120,r=b$1?Symbol.for("react.memo"):60115,t$1=b$1?Symbol.for("react.lazy"):60116,v$1=b$1?Symbol.for("react.block"):60121,w=b$1?Symbol.for("react.fundamental"):60117,x=b$1?Symbol.for("react.responder"):60118,y=b$1?Symbol.for("react.scope"):60119;
|
|
653
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c$1:switch(a=a.type,a){case l$1:case m$1:case e$1:case g$1:case f$1:case p$1:return a;default:switch(a=a&&a.$$typeof,a){case k$1:case n$1:case t$1:case r:case h$1:return a;default:return u}}case d$1:return u}}}function A(a){return z(a)===m$1}reactIs_production_min$1.AsyncMode=l$1;reactIs_production_min$1.ConcurrentMode=m$1;reactIs_production_min$1.ContextConsumer=k$1;reactIs_production_min$1.ContextProvider=h$1;reactIs_production_min$1.Element=c$1;reactIs_production_min$1.ForwardRef=n$1;reactIs_production_min$1.Fragment=e$1;reactIs_production_min$1.Lazy=t$1;reactIs_production_min$1.Memo=r;reactIs_production_min$1.Portal=d$1;
|
|
654
|
+
reactIs_production_min$1.Profiler=g$1;reactIs_production_min$1.StrictMode=f$1;reactIs_production_min$1.Suspense=p$1;reactIs_production_min$1.isAsyncMode=function(a){return A(a)||z(a)===l$1};reactIs_production_min$1.isConcurrentMode=A;reactIs_production_min$1.isContextConsumer=function(a){return z(a)===k$1};reactIs_production_min$1.isContextProvider=function(a){return z(a)===h$1};reactIs_production_min$1.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c$1};reactIs_production_min$1.isForwardRef=function(a){return z(a)===n$1};reactIs_production_min$1.isFragment=function(a){return z(a)===e$1};reactIs_production_min$1.isLazy=function(a){return z(a)===t$1};
|
|
655
|
+
reactIs_production_min$1.isMemo=function(a){return z(a)===r};reactIs_production_min$1.isPortal=function(a){return z(a)===d$1};reactIs_production_min$1.isProfiler=function(a){return z(a)===g$1};reactIs_production_min$1.isStrictMode=function(a){return z(a)===f$1};reactIs_production_min$1.isSuspense=function(a){return z(a)===p$1};
|
|
656
|
+
reactIs_production_min$1.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e$1||a===m$1||a===g$1||a===f$1||a===p$1||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t$1||a.$$typeof===r||a.$$typeof===h$1||a.$$typeof===k$1||a.$$typeof===n$1||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v$1)};reactIs_production_min$1.typeOf=z;
|
|
657
|
+
|
|
658
|
+
var reactIs_development$1 = {};
|
|
659
|
+
|
|
660
|
+
/** @license React v16.13.1
|
|
661
|
+
* react-is.development.js
|
|
662
|
+
*
|
|
663
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
664
|
+
*
|
|
665
|
+
* This source code is licensed under the MIT license found in the
|
|
666
|
+
* LICENSE file in the root directory of this source tree.
|
|
667
|
+
*/
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
if (process.env.NODE_ENV !== "production") {
|
|
672
|
+
(function() {
|
|
673
|
+
|
|
674
|
+
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
675
|
+
// nor polyfill, then a plain number is used for performance.
|
|
676
|
+
var hasSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
677
|
+
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
678
|
+
var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
|
|
679
|
+
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
|
|
680
|
+
var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
|
|
681
|
+
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
682
|
+
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
683
|
+
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
684
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
685
|
+
|
|
686
|
+
var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
|
|
687
|
+
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
688
|
+
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
689
|
+
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
690
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
691
|
+
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
692
|
+
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
693
|
+
var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
|
|
694
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
695
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
696
|
+
var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;
|
|
697
|
+
|
|
698
|
+
function isValidElementType(type) {
|
|
699
|
+
return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
700
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
function typeOf(object) {
|
|
704
|
+
if (typeof object === 'object' && object !== null) {
|
|
705
|
+
var $$typeof = object.$$typeof;
|
|
706
|
+
|
|
707
|
+
switch ($$typeof) {
|
|
708
|
+
case REACT_ELEMENT_TYPE:
|
|
709
|
+
var type = object.type;
|
|
710
|
+
|
|
711
|
+
switch (type) {
|
|
712
|
+
case REACT_ASYNC_MODE_TYPE:
|
|
713
|
+
case REACT_CONCURRENT_MODE_TYPE:
|
|
714
|
+
case REACT_FRAGMENT_TYPE:
|
|
715
|
+
case REACT_PROFILER_TYPE:
|
|
716
|
+
case REACT_STRICT_MODE_TYPE:
|
|
717
|
+
case REACT_SUSPENSE_TYPE:
|
|
718
|
+
return type;
|
|
719
|
+
|
|
720
|
+
default:
|
|
721
|
+
var $$typeofType = type && type.$$typeof;
|
|
722
|
+
|
|
723
|
+
switch ($$typeofType) {
|
|
724
|
+
case REACT_CONTEXT_TYPE:
|
|
725
|
+
case REACT_FORWARD_REF_TYPE:
|
|
726
|
+
case REACT_LAZY_TYPE:
|
|
727
|
+
case REACT_MEMO_TYPE:
|
|
728
|
+
case REACT_PROVIDER_TYPE:
|
|
729
|
+
return $$typeofType;
|
|
730
|
+
|
|
731
|
+
default:
|
|
732
|
+
return $$typeof;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
case REACT_PORTAL_TYPE:
|
|
738
|
+
return $$typeof;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
return undefined;
|
|
743
|
+
} // AsyncMode is deprecated along with isAsyncMode
|
|
744
|
+
|
|
745
|
+
var AsyncMode = REACT_ASYNC_MODE_TYPE;
|
|
746
|
+
var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
747
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
748
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
749
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
750
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
751
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
752
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
753
|
+
var Memo = REACT_MEMO_TYPE;
|
|
754
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
755
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
756
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
757
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
758
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
|
|
759
|
+
|
|
760
|
+
function isAsyncMode(object) {
|
|
761
|
+
{
|
|
762
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
763
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
764
|
+
|
|
765
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
|
|
770
|
+
}
|
|
771
|
+
function isConcurrentMode(object) {
|
|
772
|
+
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
|
|
773
|
+
}
|
|
774
|
+
function isContextConsumer(object) {
|
|
775
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
776
|
+
}
|
|
777
|
+
function isContextProvider(object) {
|
|
778
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
779
|
+
}
|
|
780
|
+
function isElement(object) {
|
|
781
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
782
|
+
}
|
|
783
|
+
function isForwardRef(object) {
|
|
784
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
785
|
+
}
|
|
786
|
+
function isFragment(object) {
|
|
787
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
788
|
+
}
|
|
789
|
+
function isLazy(object) {
|
|
790
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
791
|
+
}
|
|
792
|
+
function isMemo(object) {
|
|
793
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
794
|
+
}
|
|
795
|
+
function isPortal(object) {
|
|
796
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
797
|
+
}
|
|
798
|
+
function isProfiler(object) {
|
|
799
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
800
|
+
}
|
|
801
|
+
function isStrictMode(object) {
|
|
802
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
803
|
+
}
|
|
804
|
+
function isSuspense(object) {
|
|
805
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
reactIs_development$1.AsyncMode = AsyncMode;
|
|
809
|
+
reactIs_development$1.ConcurrentMode = ConcurrentMode;
|
|
810
|
+
reactIs_development$1.ContextConsumer = ContextConsumer;
|
|
811
|
+
reactIs_development$1.ContextProvider = ContextProvider;
|
|
812
|
+
reactIs_development$1.Element = Element;
|
|
813
|
+
reactIs_development$1.ForwardRef = ForwardRef;
|
|
814
|
+
reactIs_development$1.Fragment = Fragment;
|
|
815
|
+
reactIs_development$1.Lazy = Lazy;
|
|
816
|
+
reactIs_development$1.Memo = Memo;
|
|
817
|
+
reactIs_development$1.Portal = Portal;
|
|
818
|
+
reactIs_development$1.Profiler = Profiler;
|
|
819
|
+
reactIs_development$1.StrictMode = StrictMode;
|
|
820
|
+
reactIs_development$1.Suspense = Suspense;
|
|
821
|
+
reactIs_development$1.isAsyncMode = isAsyncMode;
|
|
822
|
+
reactIs_development$1.isConcurrentMode = isConcurrentMode;
|
|
823
|
+
reactIs_development$1.isContextConsumer = isContextConsumer;
|
|
824
|
+
reactIs_development$1.isContextProvider = isContextProvider;
|
|
825
|
+
reactIs_development$1.isElement = isElement;
|
|
826
|
+
reactIs_development$1.isForwardRef = isForwardRef;
|
|
827
|
+
reactIs_development$1.isFragment = isFragment;
|
|
828
|
+
reactIs_development$1.isLazy = isLazy;
|
|
829
|
+
reactIs_development$1.isMemo = isMemo;
|
|
830
|
+
reactIs_development$1.isPortal = isPortal;
|
|
831
|
+
reactIs_development$1.isProfiler = isProfiler;
|
|
832
|
+
reactIs_development$1.isStrictMode = isStrictMode;
|
|
833
|
+
reactIs_development$1.isSuspense = isSuspense;
|
|
834
|
+
reactIs_development$1.isValidElementType = isValidElementType;
|
|
835
|
+
reactIs_development$1.typeOf = typeOf;
|
|
836
|
+
})();
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
if (process.env.NODE_ENV === 'production') {
|
|
840
|
+
reactIs$1.exports = reactIs_production_min$1;
|
|
841
|
+
} else {
|
|
842
|
+
reactIs$1.exports = reactIs_development$1;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
var reactIs = reactIs$1.exports;
|
|
846
|
+
var FORWARD_REF_STATICS = {
|
|
847
|
+
'$$typeof': true,
|
|
848
|
+
render: true,
|
|
849
|
+
defaultProps: true,
|
|
850
|
+
displayName: true,
|
|
851
|
+
propTypes: true
|
|
852
|
+
};
|
|
853
|
+
var MEMO_STATICS = {
|
|
854
|
+
'$$typeof': true,
|
|
855
|
+
compare: true,
|
|
856
|
+
defaultProps: true,
|
|
857
|
+
displayName: true,
|
|
858
|
+
propTypes: true,
|
|
859
|
+
type: true
|
|
860
|
+
};
|
|
861
|
+
var TYPE_STATICS = {};
|
|
862
|
+
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
|
|
863
|
+
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
|
|
864
|
+
|
|
865
|
+
var reactIs_production_min = {};
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* @license React
|
|
869
|
+
* react-is.production.min.js
|
|
870
|
+
*
|
|
871
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
872
|
+
*
|
|
873
|
+
* This source code is licensed under the MIT license found in the
|
|
874
|
+
* LICENSE file in the root directory of this source tree.
|
|
875
|
+
*/
|
|
876
|
+
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
877
|
+
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
|
|
878
|
+
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return !1};reactIs_production_min.isConcurrentMode=function(){return !1};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
|
|
879
|
+
reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
|
|
880
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};reactIs_production_min.typeOf=v;
|
|
881
|
+
|
|
882
|
+
var reactIs_development = {};
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* @license React
|
|
886
|
+
* react-is.development.js
|
|
887
|
+
*
|
|
888
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
889
|
+
*
|
|
890
|
+
* This source code is licensed under the MIT license found in the
|
|
891
|
+
* LICENSE file in the root directory of this source tree.
|
|
892
|
+
*/
|
|
893
|
+
|
|
894
|
+
if (process.env.NODE_ENV !== "production") {
|
|
895
|
+
(function() {
|
|
896
|
+
|
|
897
|
+
// ATTENTION
|
|
898
|
+
// When adding new symbols to this file,
|
|
899
|
+
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
|
|
900
|
+
// The Symbol used to tag the ReactElement-like types.
|
|
901
|
+
var REACT_ELEMENT_TYPE = Symbol.for('react.element');
|
|
902
|
+
var REACT_PORTAL_TYPE = Symbol.for('react.portal');
|
|
903
|
+
var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
|
|
904
|
+
var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
|
|
905
|
+
var REACT_PROFILER_TYPE = Symbol.for('react.profiler');
|
|
906
|
+
var REACT_PROVIDER_TYPE = Symbol.for('react.provider');
|
|
907
|
+
var REACT_CONTEXT_TYPE = Symbol.for('react.context');
|
|
908
|
+
var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context');
|
|
909
|
+
var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
|
|
910
|
+
var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
|
|
911
|
+
var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');
|
|
912
|
+
var REACT_MEMO_TYPE = Symbol.for('react.memo');
|
|
913
|
+
var REACT_LAZY_TYPE = Symbol.for('react.lazy');
|
|
914
|
+
var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen');
|
|
915
|
+
|
|
916
|
+
// -----------------------------------------------------------------------------
|
|
917
|
+
|
|
918
|
+
var enableScopeAPI = false; // Experimental Create Event Handle API.
|
|
919
|
+
var enableCacheElement = false;
|
|
920
|
+
var enableTransitionTracing = false; // No known bugs, but needs performance testing
|
|
921
|
+
|
|
922
|
+
var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber
|
|
923
|
+
// stuff. Intended to enable React core members to more easily debug scheduling
|
|
924
|
+
// issues in DEV builds.
|
|
925
|
+
|
|
926
|
+
var enableDebugTracing = false; // Track which Fiber(s) schedule render work.
|
|
927
|
+
|
|
928
|
+
var REACT_MODULE_REFERENCE;
|
|
929
|
+
|
|
930
|
+
{
|
|
931
|
+
REACT_MODULE_REFERENCE = Symbol.for('react.module.reference');
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
function isValidElementType(type) {
|
|
935
|
+
if (typeof type === 'string' || typeof type === 'function') {
|
|
936
|
+
return true;
|
|
937
|
+
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) {
|
|
941
|
+
return true;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
if (typeof type === 'object' && type !== null) {
|
|
945
|
+
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
|
|
946
|
+
// types supported by any Flight configuration anywhere since
|
|
947
|
+
// we don't know which Flight build this will end up being used
|
|
948
|
+
// with.
|
|
949
|
+
type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) {
|
|
950
|
+
return true;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
return false;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
function typeOf(object) {
|
|
958
|
+
if (typeof object === 'object' && object !== null) {
|
|
959
|
+
var $$typeof = object.$$typeof;
|
|
960
|
+
|
|
961
|
+
switch ($$typeof) {
|
|
962
|
+
case REACT_ELEMENT_TYPE:
|
|
963
|
+
var type = object.type;
|
|
964
|
+
|
|
965
|
+
switch (type) {
|
|
966
|
+
case REACT_FRAGMENT_TYPE:
|
|
967
|
+
case REACT_PROFILER_TYPE:
|
|
968
|
+
case REACT_STRICT_MODE_TYPE:
|
|
969
|
+
case REACT_SUSPENSE_TYPE:
|
|
970
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
971
|
+
return type;
|
|
972
|
+
|
|
973
|
+
default:
|
|
974
|
+
var $$typeofType = type && type.$$typeof;
|
|
975
|
+
|
|
976
|
+
switch ($$typeofType) {
|
|
977
|
+
case REACT_SERVER_CONTEXT_TYPE:
|
|
978
|
+
case REACT_CONTEXT_TYPE:
|
|
979
|
+
case REACT_FORWARD_REF_TYPE:
|
|
980
|
+
case REACT_LAZY_TYPE:
|
|
981
|
+
case REACT_MEMO_TYPE:
|
|
982
|
+
case REACT_PROVIDER_TYPE:
|
|
983
|
+
return $$typeofType;
|
|
984
|
+
|
|
985
|
+
default:
|
|
986
|
+
return $$typeof;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
case REACT_PORTAL_TYPE:
|
|
992
|
+
return $$typeof;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
return undefined;
|
|
997
|
+
}
|
|
998
|
+
var ContextConsumer = REACT_CONTEXT_TYPE;
|
|
999
|
+
var ContextProvider = REACT_PROVIDER_TYPE;
|
|
1000
|
+
var Element = REACT_ELEMENT_TYPE;
|
|
1001
|
+
var ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
1002
|
+
var Fragment = REACT_FRAGMENT_TYPE;
|
|
1003
|
+
var Lazy = REACT_LAZY_TYPE;
|
|
1004
|
+
var Memo = REACT_MEMO_TYPE;
|
|
1005
|
+
var Portal = REACT_PORTAL_TYPE;
|
|
1006
|
+
var Profiler = REACT_PROFILER_TYPE;
|
|
1007
|
+
var StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1008
|
+
var Suspense = REACT_SUSPENSE_TYPE;
|
|
1009
|
+
var SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
1010
|
+
var hasWarnedAboutDeprecatedIsAsyncMode = false;
|
|
1011
|
+
var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated
|
|
1012
|
+
|
|
1013
|
+
function isAsyncMode(object) {
|
|
1014
|
+
{
|
|
1015
|
+
if (!hasWarnedAboutDeprecatedIsAsyncMode) {
|
|
1016
|
+
hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1017
|
+
|
|
1018
|
+
console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
function isConcurrentMode(object) {
|
|
1025
|
+
{
|
|
1026
|
+
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
|
|
1027
|
+
hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint
|
|
1028
|
+
|
|
1029
|
+
console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.');
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1035
|
+
function isContextConsumer(object) {
|
|
1036
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
1037
|
+
}
|
|
1038
|
+
function isContextProvider(object) {
|
|
1039
|
+
return typeOf(object) === REACT_PROVIDER_TYPE;
|
|
1040
|
+
}
|
|
1041
|
+
function isElement(object) {
|
|
1042
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
1043
|
+
}
|
|
1044
|
+
function isForwardRef(object) {
|
|
1045
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
1046
|
+
}
|
|
1047
|
+
function isFragment(object) {
|
|
1048
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
1049
|
+
}
|
|
1050
|
+
function isLazy(object) {
|
|
1051
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
1052
|
+
}
|
|
1053
|
+
function isMemo(object) {
|
|
1054
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
1055
|
+
}
|
|
1056
|
+
function isPortal(object) {
|
|
1057
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
1058
|
+
}
|
|
1059
|
+
function isProfiler(object) {
|
|
1060
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
1061
|
+
}
|
|
1062
|
+
function isStrictMode(object) {
|
|
1063
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
1064
|
+
}
|
|
1065
|
+
function isSuspense(object) {
|
|
1066
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
1067
|
+
}
|
|
1068
|
+
function isSuspenseList(object) {
|
|
1069
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
reactIs_development.ContextConsumer = ContextConsumer;
|
|
1073
|
+
reactIs_development.ContextProvider = ContextProvider;
|
|
1074
|
+
reactIs_development.Element = Element;
|
|
1075
|
+
reactIs_development.ForwardRef = ForwardRef;
|
|
1076
|
+
reactIs_development.Fragment = Fragment;
|
|
1077
|
+
reactIs_development.Lazy = Lazy;
|
|
1078
|
+
reactIs_development.Memo = Memo;
|
|
1079
|
+
reactIs_development.Portal = Portal;
|
|
1080
|
+
reactIs_development.Profiler = Profiler;
|
|
1081
|
+
reactIs_development.StrictMode = StrictMode;
|
|
1082
|
+
reactIs_development.Suspense = Suspense;
|
|
1083
|
+
reactIs_development.SuspenseList = SuspenseList;
|
|
1084
|
+
reactIs_development.isAsyncMode = isAsyncMode;
|
|
1085
|
+
reactIs_development.isConcurrentMode = isConcurrentMode;
|
|
1086
|
+
reactIs_development.isContextConsumer = isContextConsumer;
|
|
1087
|
+
reactIs_development.isContextProvider = isContextProvider;
|
|
1088
|
+
reactIs_development.isElement = isElement;
|
|
1089
|
+
reactIs_development.isForwardRef = isForwardRef;
|
|
1090
|
+
reactIs_development.isFragment = isFragment;
|
|
1091
|
+
reactIs_development.isLazy = isLazy;
|
|
1092
|
+
reactIs_development.isMemo = isMemo;
|
|
1093
|
+
reactIs_development.isPortal = isPortal;
|
|
1094
|
+
reactIs_development.isProfiler = isProfiler;
|
|
1095
|
+
reactIs_development.isStrictMode = isStrictMode;
|
|
1096
|
+
reactIs_development.isSuspense = isSuspense;
|
|
1097
|
+
reactIs_development.isSuspenseList = isSuspenseList;
|
|
1098
|
+
reactIs_development.isValidElementType = isValidElementType;
|
|
1099
|
+
reactIs_development.typeOf = typeOf;
|
|
1100
|
+
})();
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
if (process.env.NODE_ENV === 'production') ;
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* Hook factory, which creates a `useStore` hook bound to a given context.
|
|
1107
|
+
*
|
|
1108
|
+
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
|
|
1109
|
+
* @returns {Function} A `useStore` hook bound to the specified context.
|
|
1110
|
+
*/
|
|
1111
|
+
|
|
1112
|
+
function createStoreHook(context = ReactReduxContext) {
|
|
1113
|
+
const useReduxContext$1 = // @ts-ignore
|
|
1114
|
+
context === ReactReduxContext ? useReduxContext : // @ts-ignore
|
|
1115
|
+
createReduxContextHook(context);
|
|
1116
|
+
return function useStore() {
|
|
1117
|
+
const {
|
|
1118
|
+
store
|
|
1119
|
+
} = useReduxContext$1(); // @ts-ignore
|
|
1120
|
+
|
|
1121
|
+
return store;
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* A hook to access the redux store.
|
|
1126
|
+
*
|
|
1127
|
+
* @returns {any} the redux store
|
|
1128
|
+
*
|
|
1129
|
+
* @example
|
|
1130
|
+
*
|
|
1131
|
+
* import React from 'react'
|
|
1132
|
+
* import { useStore } from 'react-redux'
|
|
1133
|
+
*
|
|
1134
|
+
* export const ExampleComponent = () => {
|
|
1135
|
+
* const store = useStore()
|
|
1136
|
+
* return <div>{store.getState()}</div>
|
|
1137
|
+
* }
|
|
1138
|
+
*/
|
|
1139
|
+
|
|
1140
|
+
const useStore = /*#__PURE__*/createStoreHook();
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Hook factory, which creates a `useDispatch` hook bound to a given context.
|
|
1144
|
+
*
|
|
1145
|
+
* @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`.
|
|
1146
|
+
* @returns {Function} A `useDispatch` hook bound to the specified context.
|
|
1147
|
+
*/
|
|
1148
|
+
|
|
1149
|
+
function createDispatchHook(context = ReactReduxContext) {
|
|
1150
|
+
const useStore$1 = // @ts-ignore
|
|
1151
|
+
context === ReactReduxContext ? useStore : createStoreHook(context);
|
|
1152
|
+
return function useDispatch() {
|
|
1153
|
+
const store = useStore$1(); // @ts-ignore
|
|
1154
|
+
|
|
1155
|
+
return store.dispatch;
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
/**
|
|
1159
|
+
* A hook to access the redux `dispatch` function.
|
|
1160
|
+
*
|
|
1161
|
+
* @returns {any|function} redux store's `dispatch` function
|
|
1162
|
+
*
|
|
1163
|
+
* @example
|
|
1164
|
+
*
|
|
1165
|
+
* import React, { useCallback } from 'react'
|
|
1166
|
+
* import { useDispatch } from 'react-redux'
|
|
1167
|
+
*
|
|
1168
|
+
* export const CounterComponent = ({ value }) => {
|
|
1169
|
+
* const dispatch = useDispatch()
|
|
1170
|
+
* const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), [])
|
|
1171
|
+
* return (
|
|
1172
|
+
* <div>
|
|
1173
|
+
* <span>{value}</span>
|
|
1174
|
+
* <button onClick={increaseCounter}>Increase counter</button>
|
|
1175
|
+
* </div>
|
|
1176
|
+
* )
|
|
1177
|
+
* }
|
|
1178
|
+
*/
|
|
1179
|
+
|
|
1180
|
+
const useDispatch = /*#__PURE__*/createDispatchHook();
|
|
1181
|
+
|
|
1182
|
+
// The primary entry point assumes we're working with standard ReactDOM/RN, but
|
|
1183
|
+
initializeUseSelector(withSelector.exports.useSyncExternalStoreWithSelector);
|
|
1184
|
+
|
|
1185
|
+
/* *
|
|
1186
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1187
|
+
* you may not use this file except in compliance with the License.
|
|
1188
|
+
* You may obtain a copy of the License at
|
|
1189
|
+
*
|
|
1190
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1191
|
+
*
|
|
1192
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1193
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1194
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1195
|
+
* See the License for the specific language governing permissions and
|
|
1196
|
+
* limitations under the License.
|
|
1197
|
+
*
|
|
1198
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1199
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1200
|
+
* */
|
|
1201
|
+
var dialogType$1 = uiTypes.DialogTypes.AreaManager;
|
|
1202
|
+
var AreaManagerMapButtonConnect = function AreaManagerMapButtonConnect(_ref) {
|
|
1203
|
+
var mapId = _ref.mapId,
|
|
1204
|
+
_ref$source = _ref.source,
|
|
1205
|
+
source = _ref$source === void 0 ? 'app' : _ref$source;
|
|
1206
|
+
var dispatch = useDispatch();
|
|
1207
|
+
var mapIdForCurrentlyOpenDialog = useSelector(function (store) {
|
|
1208
|
+
return uiSelectors.getDialogMapId(store, dialogType$1);
|
|
1209
|
+
});
|
|
1210
|
+
var dialogIsOpen = useSelector(function (store) {
|
|
1211
|
+
return uiSelectors.getisDialogOpen(store, dialogType$1);
|
|
1212
|
+
});
|
|
1213
|
+
return /*#__PURE__*/React__default.createElement(MapControlButton, {
|
|
1214
|
+
"aria-label": "Area Manager Button for ".concat(mapId),
|
|
1215
|
+
title: "Area Manager",
|
|
1216
|
+
onClick: function onClick() {
|
|
1217
|
+
var openDialogForAnotherMap = mapIdForCurrentlyOpenDialog !== mapId;
|
|
1218
|
+
var shouldOpen = openDialogForAnotherMap || !dialogIsOpen;
|
|
1219
|
+
dispatch(uiActions.setActiveMapIdForDialog({
|
|
1220
|
+
type: dialogType$1,
|
|
1221
|
+
mapId: mapId,
|
|
1222
|
+
setOpen: shouldOpen,
|
|
1223
|
+
source: source
|
|
1224
|
+
}));
|
|
1225
|
+
},
|
|
1226
|
+
isActive: mapIdForCurrentlyOpenDialog === mapId && dialogIsOpen
|
|
1227
|
+
}, /*#__PURE__*/React__default.createElement(Polygons, null));
|
|
1228
|
+
};
|
|
1229
|
+
|
|
1230
|
+
function _iterableToArrayLimit(arr, i) {
|
|
1231
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1232
|
+
if (null != _i) {
|
|
1233
|
+
var _s,
|
|
1234
|
+
_e,
|
|
1235
|
+
_x,
|
|
1236
|
+
_r,
|
|
1237
|
+
_arr = [],
|
|
1238
|
+
_n = !0,
|
|
1239
|
+
_d = !1;
|
|
1240
|
+
try {
|
|
1241
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
1242
|
+
if (Object(_i) !== _i) return;
|
|
1243
|
+
_n = !1;
|
|
1244
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
1245
|
+
} catch (err) {
|
|
1246
|
+
_d = !0, _e = err;
|
|
1247
|
+
} finally {
|
|
1248
|
+
try {
|
|
1249
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
1250
|
+
} finally {
|
|
1251
|
+
if (_d) throw _e;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
return _arr;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
function _regeneratorRuntime() {
|
|
1258
|
+
_regeneratorRuntime = function () {
|
|
1259
|
+
return exports;
|
|
1260
|
+
};
|
|
1261
|
+
var exports = {},
|
|
1262
|
+
Op = Object.prototype,
|
|
1263
|
+
hasOwn = Op.hasOwnProperty,
|
|
1264
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
1265
|
+
obj[key] = desc.value;
|
|
1266
|
+
},
|
|
1267
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
1268
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
1269
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
1270
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1271
|
+
function define(obj, key, value) {
|
|
1272
|
+
return Object.defineProperty(obj, key, {
|
|
1273
|
+
value: value,
|
|
1274
|
+
enumerable: !0,
|
|
1275
|
+
configurable: !0,
|
|
1276
|
+
writable: !0
|
|
1277
|
+
}), obj[key];
|
|
1278
|
+
}
|
|
1279
|
+
try {
|
|
1280
|
+
define({}, "");
|
|
1281
|
+
} catch (err) {
|
|
1282
|
+
define = function (obj, key, value) {
|
|
1283
|
+
return obj[key] = value;
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1287
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
1288
|
+
generator = Object.create(protoGenerator.prototype),
|
|
1289
|
+
context = new Context(tryLocsList || []);
|
|
1290
|
+
return defineProperty(generator, "_invoke", {
|
|
1291
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
1292
|
+
}), generator;
|
|
1293
|
+
}
|
|
1294
|
+
function tryCatch(fn, obj, arg) {
|
|
1295
|
+
try {
|
|
1296
|
+
return {
|
|
1297
|
+
type: "normal",
|
|
1298
|
+
arg: fn.call(obj, arg)
|
|
1299
|
+
};
|
|
1300
|
+
} catch (err) {
|
|
1301
|
+
return {
|
|
1302
|
+
type: "throw",
|
|
1303
|
+
arg: err
|
|
1304
|
+
};
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
exports.wrap = wrap;
|
|
1308
|
+
var ContinueSentinel = {};
|
|
1309
|
+
function Generator() {}
|
|
1310
|
+
function GeneratorFunction() {}
|
|
1311
|
+
function GeneratorFunctionPrototype() {}
|
|
1312
|
+
var IteratorPrototype = {};
|
|
1313
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1314
|
+
return this;
|
|
1315
|
+
});
|
|
1316
|
+
var getProto = Object.getPrototypeOf,
|
|
1317
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1318
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
1319
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1320
|
+
function defineIteratorMethods(prototype) {
|
|
1321
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
1322
|
+
define(prototype, method, function (arg) {
|
|
1323
|
+
return this._invoke(method, arg);
|
|
1324
|
+
});
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
1328
|
+
function invoke(method, arg, resolve, reject) {
|
|
1329
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
1330
|
+
if ("throw" !== record.type) {
|
|
1331
|
+
var result = record.arg,
|
|
1332
|
+
value = result.value;
|
|
1333
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1334
|
+
invoke("next", value, resolve, reject);
|
|
1335
|
+
}, function (err) {
|
|
1336
|
+
invoke("throw", err, resolve, reject);
|
|
1337
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
1338
|
+
result.value = unwrapped, resolve(result);
|
|
1339
|
+
}, function (error) {
|
|
1340
|
+
return invoke("throw", error, resolve, reject);
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
reject(record.arg);
|
|
1344
|
+
}
|
|
1345
|
+
var previousPromise;
|
|
1346
|
+
defineProperty(this, "_invoke", {
|
|
1347
|
+
value: function (method, arg) {
|
|
1348
|
+
function callInvokeWithMethodAndArg() {
|
|
1349
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
1350
|
+
invoke(method, arg, resolve, reject);
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
1358
|
+
var state = "suspendedStart";
|
|
1359
|
+
return function (method, arg) {
|
|
1360
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
1361
|
+
if ("completed" === state) {
|
|
1362
|
+
if ("throw" === method) throw arg;
|
|
1363
|
+
return {
|
|
1364
|
+
value: void 0,
|
|
1365
|
+
done: !0
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
for (context.method = method, context.arg = arg;;) {
|
|
1369
|
+
var delegate = context.delegate;
|
|
1370
|
+
if (delegate) {
|
|
1371
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1372
|
+
if (delegateResult) {
|
|
1373
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
1374
|
+
return delegateResult;
|
|
1375
|
+
}
|
|
1376
|
+
}
|
|
1377
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1378
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1379
|
+
context.dispatchException(context.arg);
|
|
1380
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1381
|
+
state = "executing";
|
|
1382
|
+
var record = tryCatch(innerFn, self, context);
|
|
1383
|
+
if ("normal" === record.type) {
|
|
1384
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
1385
|
+
return {
|
|
1386
|
+
value: record.arg,
|
|
1387
|
+
done: context.done
|
|
1388
|
+
};
|
|
1389
|
+
}
|
|
1390
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
1391
|
+
}
|
|
1392
|
+
};
|
|
1393
|
+
}
|
|
1394
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
1395
|
+
var methodName = context.method,
|
|
1396
|
+
method = delegate.iterator[methodName];
|
|
1397
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
1398
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1399
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
1400
|
+
var info = record.arg;
|
|
1401
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
1402
|
+
}
|
|
1403
|
+
function pushTryEntry(locs) {
|
|
1404
|
+
var entry = {
|
|
1405
|
+
tryLoc: locs[0]
|
|
1406
|
+
};
|
|
1407
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
1408
|
+
}
|
|
1409
|
+
function resetTryEntry(entry) {
|
|
1410
|
+
var record = entry.completion || {};
|
|
1411
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
1412
|
+
}
|
|
1413
|
+
function Context(tryLocsList) {
|
|
1414
|
+
this.tryEntries = [{
|
|
1415
|
+
tryLoc: "root"
|
|
1416
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
1417
|
+
}
|
|
1418
|
+
function values(iterable) {
|
|
1419
|
+
if (iterable || "" === iterable) {
|
|
1420
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
1421
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
1422
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
1423
|
+
if (!isNaN(iterable.length)) {
|
|
1424
|
+
var i = -1,
|
|
1425
|
+
next = function next() {
|
|
1426
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1427
|
+
return next.value = undefined, next.done = !0, next;
|
|
1428
|
+
};
|
|
1429
|
+
return next.next = next;
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
throw new TypeError(typeof iterable + " is not iterable");
|
|
1433
|
+
}
|
|
1434
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
1435
|
+
value: GeneratorFunctionPrototype,
|
|
1436
|
+
configurable: !0
|
|
1437
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
1438
|
+
value: GeneratorFunction,
|
|
1439
|
+
configurable: !0
|
|
1440
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
1441
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
1442
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
1443
|
+
}, exports.mark = function (genFun) {
|
|
1444
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
1445
|
+
}, exports.awrap = function (arg) {
|
|
1446
|
+
return {
|
|
1447
|
+
__await: arg
|
|
1448
|
+
};
|
|
1449
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
1450
|
+
return this;
|
|
1451
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1452
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
1453
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
1454
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
1455
|
+
return result.done ? result.value : iter.next();
|
|
1456
|
+
});
|
|
1457
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
1458
|
+
return this;
|
|
1459
|
+
}), define(Gp, "toString", function () {
|
|
1460
|
+
return "[object Generator]";
|
|
1461
|
+
}), exports.keys = function (val) {
|
|
1462
|
+
var object = Object(val),
|
|
1463
|
+
keys = [];
|
|
1464
|
+
for (var key in object) keys.push(key);
|
|
1465
|
+
return keys.reverse(), function next() {
|
|
1466
|
+
for (; keys.length;) {
|
|
1467
|
+
var key = keys.pop();
|
|
1468
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
1469
|
+
}
|
|
1470
|
+
return next.done = !0, next;
|
|
1471
|
+
};
|
|
1472
|
+
}, exports.values = values, Context.prototype = {
|
|
1473
|
+
constructor: Context,
|
|
1474
|
+
reset: function (skipTempReset) {
|
|
1475
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
1476
|
+
},
|
|
1477
|
+
stop: function () {
|
|
1478
|
+
this.done = !0;
|
|
1479
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
1480
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
1481
|
+
return this.rval;
|
|
1482
|
+
},
|
|
1483
|
+
dispatchException: function (exception) {
|
|
1484
|
+
if (this.done) throw exception;
|
|
1485
|
+
var context = this;
|
|
1486
|
+
function handle(loc, caught) {
|
|
1487
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
1488
|
+
}
|
|
1489
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1490
|
+
var entry = this.tryEntries[i],
|
|
1491
|
+
record = entry.completion;
|
|
1492
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
1493
|
+
if (entry.tryLoc <= this.prev) {
|
|
1494
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
1495
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1496
|
+
if (hasCatch && hasFinally) {
|
|
1497
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1498
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1499
|
+
} else if (hasCatch) {
|
|
1500
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1501
|
+
} else {
|
|
1502
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
1503
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1508
|
+
abrupt: function (type, arg) {
|
|
1509
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1510
|
+
var entry = this.tryEntries[i];
|
|
1511
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1512
|
+
var finallyEntry = entry;
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
1517
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1518
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
1519
|
+
},
|
|
1520
|
+
complete: function (record, afterLoc) {
|
|
1521
|
+
if ("throw" === record.type) throw record.arg;
|
|
1522
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
1523
|
+
},
|
|
1524
|
+
finish: function (finallyLoc) {
|
|
1525
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1526
|
+
var entry = this.tryEntries[i];
|
|
1527
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
1528
|
+
}
|
|
1529
|
+
},
|
|
1530
|
+
catch: function (tryLoc) {
|
|
1531
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1532
|
+
var entry = this.tryEntries[i];
|
|
1533
|
+
if (entry.tryLoc === tryLoc) {
|
|
1534
|
+
var record = entry.completion;
|
|
1535
|
+
if ("throw" === record.type) {
|
|
1536
|
+
var thrown = record.arg;
|
|
1537
|
+
resetTryEntry(entry);
|
|
1538
|
+
}
|
|
1539
|
+
return thrown;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
throw new Error("illegal catch attempt");
|
|
1543
|
+
},
|
|
1544
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
1545
|
+
return this.delegate = {
|
|
1546
|
+
iterator: values(iterable),
|
|
1547
|
+
resultName: resultName,
|
|
1548
|
+
nextLoc: nextLoc
|
|
1549
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
1550
|
+
}
|
|
1551
|
+
}, exports;
|
|
1552
|
+
}
|
|
1553
|
+
function _slicedToArray(arr, i) {
|
|
1554
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
1555
|
+
}
|
|
1556
|
+
function _arrayWithHoles(arr) {
|
|
1557
|
+
if (Array.isArray(arr)) return arr;
|
|
1558
|
+
}
|
|
1559
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
1560
|
+
if (!o) return;
|
|
1561
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1562
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1563
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1564
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1565
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1566
|
+
}
|
|
1567
|
+
function _arrayLikeToArray(arr, len) {
|
|
1568
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1569
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1570
|
+
return arr2;
|
|
1571
|
+
}
|
|
1572
|
+
function _nonIterableRest() {
|
|
1573
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
/******************************************************************************
|
|
1577
|
+
Copyright (c) Microsoft Corporation.
|
|
1578
|
+
|
|
1579
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
1580
|
+
purpose with or without fee is hereby granted.
|
|
1581
|
+
|
|
1582
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1583
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1584
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1585
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1586
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1587
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1588
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
1589
|
+
***************************************************************************** */
|
|
1590
|
+
|
|
1591
|
+
function __rest(s, e) {
|
|
1592
|
+
var t = {};
|
|
1593
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1594
|
+
t[p] = s[p];
|
|
1595
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1596
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1597
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1598
|
+
t[p[i]] = s[p[i]];
|
|
1599
|
+
}
|
|
1600
|
+
return t;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
1604
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1605
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1606
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1607
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1608
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1609
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
|
|
1613
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1614
|
+
var e = new Error(message);
|
|
1615
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1616
|
+
};
|
|
1617
|
+
|
|
1618
|
+
/* *
|
|
1619
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1620
|
+
* you may not use this file except in compliance with the License.
|
|
1621
|
+
* You may obtain a copy of the License at
|
|
1622
|
+
*
|
|
1623
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1624
|
+
*
|
|
1625
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1626
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1627
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1628
|
+
* See the License for the specific language governing permissions and
|
|
1629
|
+
* limitations under the License.
|
|
1630
|
+
*
|
|
1631
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1632
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1633
|
+
* */
|
|
1634
|
+
var Drawings = function Drawings(_ref) {
|
|
1635
|
+
var drawings = _ref.drawings,
|
|
1636
|
+
onClickDrawing = _ref.onClickDrawing,
|
|
1637
|
+
onClickEdit = _ref.onClickEdit,
|
|
1638
|
+
activeDrawing = _ref.activeDrawing;
|
|
1639
|
+
var lastHeaderRef = React__default.useRef('');
|
|
1640
|
+
return /*#__PURE__*/React__default.createElement(List, null, drawings.map(function (drawing) {
|
|
1641
|
+
var drawingDate = dateUtils.isoStringToDate(drawing.lastUpdatedTime);
|
|
1642
|
+
var header = dateUtils.dateToString(drawingDate, 'EEEE, MMMM dd', true);
|
|
1643
|
+
var isNewDay = lastHeaderRef.current !== header;
|
|
1644
|
+
lastHeaderRef.current = header;
|
|
1645
|
+
return /*#__PURE__*/React__default.createElement(Fragment, {
|
|
1646
|
+
key: drawing.id
|
|
1647
|
+
}, isNewDay && /*#__PURE__*/React__default.createElement(Typography, {
|
|
1648
|
+
sx: {
|
|
1649
|
+
paddingLeft: '20px'
|
|
1650
|
+
},
|
|
1651
|
+
variant: "caption"
|
|
1652
|
+
}, header), /*#__PURE__*/React__default.createElement(ListItem, {
|
|
1653
|
+
disablePadding: true,
|
|
1654
|
+
secondaryAction: /*#__PURE__*/React__default.createElement(ToggleMenu, {
|
|
1655
|
+
menuTitle: "Area options",
|
|
1656
|
+
tooltipTitle: "Area options",
|
|
1657
|
+
menuPosition: "bottom",
|
|
1658
|
+
"aria-label": "Options"
|
|
1659
|
+
}, /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
1660
|
+
onClick: function onClick() {
|
|
1661
|
+
return onClickEdit(drawing.id);
|
|
1662
|
+
}
|
|
1663
|
+
}, /*#__PURE__*/React__default.createElement(ListItemText, null, "Edit"), /*#__PURE__*/React__default.createElement(Edit, null)), /*#__PURE__*/React__default.createElement(MenuItem, null, /*#__PURE__*/React__default.createElement(ListItemText, null, "Delete"), " ", /*#__PURE__*/React__default.createElement(Delete, null)))
|
|
1664
|
+
}, /*#__PURE__*/React__default.createElement(Paper, {
|
|
1665
|
+
elevation: 1,
|
|
1666
|
+
sx: {
|
|
1667
|
+
width: '100%',
|
|
1668
|
+
margin: 0.5,
|
|
1669
|
+
backgroundColor: 'geowebColors.background.surface'
|
|
1670
|
+
}
|
|
1671
|
+
}, /*#__PURE__*/React__default.createElement(ListItemButton, {
|
|
1672
|
+
onClick: function onClick() {
|
|
1673
|
+
onClickDrawing(drawing);
|
|
1674
|
+
}
|
|
1675
|
+
}, activeDrawing === drawing.id && /*#__PURE__*/React__default.createElement(Box, {
|
|
1676
|
+
sx: {
|
|
1677
|
+
backgroundColor: 'geowebColors.captions.captionInformation.color',
|
|
1678
|
+
width: '4px',
|
|
1679
|
+
height: '100%',
|
|
1680
|
+
position: 'absolute',
|
|
1681
|
+
left: 0
|
|
1682
|
+
},
|
|
1683
|
+
className: "active"
|
|
1684
|
+
}), /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
1685
|
+
variant: "caption"
|
|
1686
|
+
}, drawing.name), /*#__PURE__*/React__default.createElement(Typography, {
|
|
1687
|
+
variant: "body2"
|
|
1688
|
+
}, dateUtils.dateToString(drawingDate, 'dd/MM/yyyy HH:ss', true), ' ', "UTC"))))));
|
|
1689
|
+
}));
|
|
1690
|
+
};
|
|
1691
|
+
|
|
1692
|
+
var calculateStartSize = function calculateStartSize(minSize, prefSize, startPosition) {
|
|
1693
|
+
var _calculateDialogSizeA = calculateDialogSizeAndPosition(),
|
|
1694
|
+
calcWidth = _calculateDialogSizeA.width,
|
|
1695
|
+
calcHeight = _calculateDialogSizeA.height;
|
|
1696
|
+
return {
|
|
1697
|
+
width: Math.max(minSize.width, Math.min(prefSize.width, calcWidth)),
|
|
1698
|
+
height: Math.max(minSize.height, Math.min(prefSize.height, calcHeight - startPosition.top))
|
|
1699
|
+
};
|
|
1700
|
+
};
|
|
1701
|
+
var DEFAULT_AREA_MANAGER_SIZE = {
|
|
1702
|
+
width: 320,
|
|
1703
|
+
height: 542
|
|
1704
|
+
};
|
|
1705
|
+
var DEFAULT_AREA_MANAGER_POSITION = {
|
|
1706
|
+
top: 120,
|
|
1707
|
+
left: 50
|
|
1708
|
+
};
|
|
1709
|
+
var DEFAULT_AREA_MANAGER_MIN_SIZE = {
|
|
1710
|
+
width: 160,
|
|
1711
|
+
height: 300
|
|
1712
|
+
};
|
|
1713
|
+
var AreaManager = function AreaManager(_ref) {
|
|
1714
|
+
var bounds = _ref.bounds,
|
|
1715
|
+
onClose = _ref.onClose,
|
|
1716
|
+
_ref$title = _ref.title,
|
|
1717
|
+
title = _ref$title === void 0 ? 'Area Manager' : _ref$title,
|
|
1718
|
+
isOpen = _ref.isOpen,
|
|
1719
|
+
_ref$onMouseDown = _ref.onMouseDown,
|
|
1720
|
+
onMouseDown = _ref$onMouseDown === void 0 ? function () {} : _ref$onMouseDown,
|
|
1721
|
+
_ref$order = _ref.order,
|
|
1722
|
+
order = _ref$order === void 0 ? 0 : _ref$order,
|
|
1723
|
+
_ref$source = _ref.source,
|
|
1724
|
+
source = _ref$source === void 0 ? 'app' : _ref$source,
|
|
1725
|
+
_ref$size = _ref.size,
|
|
1726
|
+
size = _ref$size === void 0 ? DEFAULT_AREA_MANAGER_SIZE : _ref$size,
|
|
1727
|
+
_ref$startPosition = _ref.startPosition,
|
|
1728
|
+
startPosition = _ref$startPosition === void 0 ? DEFAULT_AREA_MANAGER_POSITION : _ref$startPosition,
|
|
1729
|
+
_ref$setFocused = _ref.setFocused,
|
|
1730
|
+
setFocused = _ref$setFocused === void 0 ? function () {} : _ref$setFocused,
|
|
1731
|
+
_ref$headerSize = _ref.headerSize,
|
|
1732
|
+
headerSize = _ref$headerSize === void 0 ? 'xs' : _ref$headerSize,
|
|
1733
|
+
drawingListItems = _ref.drawingListItems,
|
|
1734
|
+
_ref$onClickDrawing = _ref.onClickDrawing,
|
|
1735
|
+
onClickDrawing = _ref$onClickDrawing === void 0 ? function () {} : _ref$onClickDrawing,
|
|
1736
|
+
_ref$onUnMount = _ref.onUnMount,
|
|
1737
|
+
onUnMount = _ref$onUnMount === void 0 ? function () {} : _ref$onUnMount,
|
|
1738
|
+
_ref$onEditDrawing = _ref.onEditDrawing,
|
|
1739
|
+
onEditDrawing = _ref$onEditDrawing === void 0 ? function () {} : _ref$onEditDrawing,
|
|
1740
|
+
_ref$activeDrawingId = _ref.activeDrawingId,
|
|
1741
|
+
activeDrawingId = _ref$activeDrawingId === void 0 ? '' : _ref$activeDrawingId;
|
|
1742
|
+
var minSize = DEFAULT_AREA_MANAGER_MIN_SIZE;
|
|
1743
|
+
var startSizeCalc = calculateStartSize(minSize, size, startPosition);
|
|
1744
|
+
var _React$useState = React.useState(startSizeCalc),
|
|
1745
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1746
|
+
sizeInState = _React$useState2[0],
|
|
1747
|
+
setSizeInState = _React$useState2[1];
|
|
1748
|
+
React.useEffect(function () {
|
|
1749
|
+
return function () {
|
|
1750
|
+
onUnMount();
|
|
1751
|
+
};
|
|
1752
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1753
|
+
}, []);
|
|
1754
|
+
return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
|
|
1755
|
+
title: title,
|
|
1756
|
+
startSize: sizeInState,
|
|
1757
|
+
minWidth: minSize.width,
|
|
1758
|
+
minHeight: minSize.height,
|
|
1759
|
+
startPosition: startPosition,
|
|
1760
|
+
isOpen: isOpen,
|
|
1761
|
+
onClose: onClose,
|
|
1762
|
+
headerSize: headerSize,
|
|
1763
|
+
bounds: bounds,
|
|
1764
|
+
onMouseDown: onMouseDown,
|
|
1765
|
+
onFocus: function onFocus() {
|
|
1766
|
+
return setFocused(true);
|
|
1767
|
+
},
|
|
1768
|
+
onBlur: function onBlur() {
|
|
1769
|
+
return setFocused(false);
|
|
1770
|
+
},
|
|
1771
|
+
order: order,
|
|
1772
|
+
source: source,
|
|
1773
|
+
onResizeStop: function onResizeStop(_event, _direction, node) {
|
|
1774
|
+
var width = node.offsetWidth,
|
|
1775
|
+
height = node.offsetHeight;
|
|
1776
|
+
setSizeInState({
|
|
1777
|
+
width: width,
|
|
1778
|
+
height: height
|
|
1779
|
+
});
|
|
1780
|
+
},
|
|
1781
|
+
onDragEnd: function onDragEnd(_position, dragSize) {
|
|
1782
|
+
if (dragSize !== sizeInState) {
|
|
1783
|
+
setSizeInState(dragSize);
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
}, /*#__PURE__*/React.createElement(Drawings, {
|
|
1787
|
+
drawings: drawingListItems,
|
|
1788
|
+
onClickDrawing: onClickDrawing,
|
|
1789
|
+
onClickEdit: onEditDrawing,
|
|
1790
|
+
activeDrawing: activeDrawingId
|
|
1791
|
+
}));
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1794
|
+
/* *
|
|
1795
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1796
|
+
* you may not use this file except in compliance with the License.
|
|
1797
|
+
* You may obtain a copy of the License at
|
|
1798
|
+
*
|
|
1799
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1800
|
+
*
|
|
1801
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1802
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1803
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1804
|
+
* See the License for the specific language governing permissions and
|
|
1805
|
+
* limitations under the License.
|
|
1806
|
+
*
|
|
1807
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1808
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1809
|
+
* */
|
|
1810
|
+
var API_NAME = 'warnings';
|
|
1811
|
+
var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
|
|
1812
|
+
return {
|
|
1813
|
+
getDrawings: function getDrawings() {
|
|
1814
|
+
return axiosInstance.get('/drawings');
|
|
1815
|
+
},
|
|
1816
|
+
getDrawingDetails: function getDrawingDetails(drawingId) {
|
|
1817
|
+
return axiosInstance.get("/drawings/".concat(drawingId));
|
|
1818
|
+
},
|
|
1819
|
+
updateDrawing: function updateDrawing(drawingId, data) {
|
|
1820
|
+
return axiosInstance.put("/drawings/".concat(drawingId, "/"), data);
|
|
1821
|
+
},
|
|
1822
|
+
saveDrawingAs: function saveDrawingAs(data) {
|
|
1823
|
+
return axiosInstance.post("/drawings/", data);
|
|
1824
|
+
},
|
|
1825
|
+
deleteDrawing: function deleteDrawing(drawingId) {
|
|
1826
|
+
return axiosInstance["delete"]("/drawings/".concat(drawingId));
|
|
1827
|
+
}
|
|
1828
|
+
};
|
|
1829
|
+
};
|
|
1830
|
+
var getWarningsApi = function getWarningsApi() {
|
|
1831
|
+
return getApi(API_NAME);
|
|
1832
|
+
};
|
|
1833
|
+
var createApi$1 = function createApi(props) {
|
|
1834
|
+
var authInstance = createApiInstance(props);
|
|
1835
|
+
var nonAuthInstance = createNonAuthApiInstance(props);
|
|
1836
|
+
return getApiRoutes$1(props.auth ? authInstance : nonAuthInstance);
|
|
1837
|
+
};
|
|
1838
|
+
|
|
1839
|
+
var dialogType = uiTypes.DialogTypes.AreaManager;
|
|
1840
|
+
var AreaManagerConnect = function AreaManagerConnect(_ref) {
|
|
1841
|
+
var bounds = _ref.bounds,
|
|
1842
|
+
_ref$source = _ref.source,
|
|
1843
|
+
source = _ref$source === void 0 ? 'app' : _ref$source;
|
|
1844
|
+
var _useSetupDialog = useSetupDialog(dialogType, source),
|
|
1845
|
+
dialogOrder = _useSetupDialog.dialogOrder,
|
|
1846
|
+
setDialogOrder = _useSetupDialog.setDialogOrder,
|
|
1847
|
+
onCloseDialog = _useSetupDialog.onCloseDialog,
|
|
1848
|
+
isDialogOpen = _useSetupDialog.isDialogOpen,
|
|
1849
|
+
uiSource = _useSetupDialog.uiSource,
|
|
1850
|
+
setFocused = _useSetupDialog.setFocused;
|
|
1851
|
+
var warningsApi = getWarningsApi();
|
|
1852
|
+
var dispatch = useDispatch();
|
|
1853
|
+
var mapId = useSelector(function (store) {
|
|
1854
|
+
return uiSelectors.getDialogMapId(store, dialogType);
|
|
1855
|
+
});
|
|
1856
|
+
var geoJSONLayerId = "".concat(mapId, "-geosjon");
|
|
1857
|
+
var currentLayer = useSelector(function (store) {
|
|
1858
|
+
return layerSelectors.getLayerById(store, geoJSONLayerId);
|
|
1859
|
+
});
|
|
1860
|
+
var currrentDrawing = useSelector(function (store) {
|
|
1861
|
+
return drawSelectors.selectDrawByMapId(store, mapId);
|
|
1862
|
+
});
|
|
1863
|
+
var activeDrawingId = (currrentDrawing === null || currrentDrawing === void 0 ? void 0 : currrentDrawing.id) || '';
|
|
1864
|
+
var _useState = useState([]),
|
|
1865
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1866
|
+
drawings = _useState2[0],
|
|
1867
|
+
setDrawings = _useState2[1];
|
|
1868
|
+
useEffect(function () {
|
|
1869
|
+
warningsApi.getDrawings().then(function (response) {
|
|
1870
|
+
setDrawings(response.data);
|
|
1871
|
+
});
|
|
1872
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1873
|
+
}, []);
|
|
1874
|
+
var deleteGeoJSONLayer = function deleteGeoJSONLayer() {
|
|
1875
|
+
dispatch(mapStoreActions.layerDelete({
|
|
1876
|
+
layerId: geoJSONLayerId,
|
|
1877
|
+
mapId: mapId,
|
|
1878
|
+
layerIndex: 0
|
|
1879
|
+
}));
|
|
1880
|
+
};
|
|
1881
|
+
var showGeoJSONLayer = function showGeoJSONLayer(drawing) {
|
|
1882
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1883
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1884
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1885
|
+
case 0:
|
|
1886
|
+
if (!currentLayer) {
|
|
1887
|
+
dispatch(mapStoreActions.addLayer({
|
|
1888
|
+
mapId: mapId,
|
|
1889
|
+
layer: {
|
|
1890
|
+
geojson: drawing.area
|
|
1891
|
+
},
|
|
1892
|
+
layerId: geoJSONLayerId,
|
|
1893
|
+
origin: 'warnings-lib'
|
|
1894
|
+
}));
|
|
1895
|
+
} else {
|
|
1896
|
+
dispatch(mapStoreActions.layerChangeGeojson({
|
|
1897
|
+
layerId: geoJSONLayerId,
|
|
1898
|
+
geojson: drawing.area
|
|
1899
|
+
}));
|
|
1900
|
+
}
|
|
1901
|
+
case 1:
|
|
1902
|
+
case "end":
|
|
1903
|
+
return _context.stop();
|
|
1904
|
+
}
|
|
1905
|
+
}, _callee);
|
|
1906
|
+
}));
|
|
1907
|
+
};
|
|
1908
|
+
var onClickDrawing = function onClickDrawing(drawing) {
|
|
1909
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1910
|
+
var isActive;
|
|
1911
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1912
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1913
|
+
case 0:
|
|
1914
|
+
isActive = drawing.id === (currrentDrawing === null || currrentDrawing === void 0 ? void 0 : currrentDrawing.id);
|
|
1915
|
+
dispatch(drawActions.setDrawValues({
|
|
1916
|
+
area: drawing.area,
|
|
1917
|
+
areaName: drawing.name,
|
|
1918
|
+
mapId: mapId,
|
|
1919
|
+
id: !isActive ? drawing.id : ''
|
|
1920
|
+
}));
|
|
1921
|
+
if (isActive) {
|
|
1922
|
+
deleteGeoJSONLayer();
|
|
1923
|
+
} else {
|
|
1924
|
+
showGeoJSONLayer(drawing);
|
|
1925
|
+
}
|
|
1926
|
+
case 3:
|
|
1927
|
+
case "end":
|
|
1928
|
+
return _context2.stop();
|
|
1929
|
+
}
|
|
1930
|
+
}, _callee2);
|
|
1931
|
+
}));
|
|
1932
|
+
};
|
|
1933
|
+
var openDrawTools = function openDrawTools(drawingId) {
|
|
1934
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
1935
|
+
var _yield$warningsApi$ge, data;
|
|
1936
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1937
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1938
|
+
case 0:
|
|
1939
|
+
_context3.prev = 0;
|
|
1940
|
+
_context3.next = 3;
|
|
1941
|
+
return warningsApi.getDrawingDetails(drawingId);
|
|
1942
|
+
case 3:
|
|
1943
|
+
_yield$warningsApi$ge = _context3.sent;
|
|
1944
|
+
data = _yield$warningsApi$ge.data;
|
|
1945
|
+
// update draw tool values
|
|
1946
|
+
dispatch(drawActions.setDrawValues({
|
|
1947
|
+
area: data.area,
|
|
1948
|
+
areaName: data.name,
|
|
1949
|
+
mapId: mapId,
|
|
1950
|
+
id: drawingId
|
|
1951
|
+
}));
|
|
1952
|
+
// open draw dialog
|
|
1953
|
+
dispatch(uiActions.setActiveMapIdForDialog({
|
|
1954
|
+
type: "".concat(uiTypes.DialogTypes.DockedDrawingTool, "-").concat(mapId),
|
|
1955
|
+
mapId: mapId,
|
|
1956
|
+
setOpen: true,
|
|
1957
|
+
source: source
|
|
1958
|
+
}));
|
|
1959
|
+
_context3.next = 11;
|
|
1960
|
+
break;
|
|
1961
|
+
case 9:
|
|
1962
|
+
_context3.prev = 9;
|
|
1963
|
+
_context3.t0 = _context3["catch"](0);
|
|
1964
|
+
case 11:
|
|
1965
|
+
case "end":
|
|
1966
|
+
return _context3.stop();
|
|
1967
|
+
}
|
|
1968
|
+
}, _callee3, null, [[0, 9]]);
|
|
1969
|
+
}));
|
|
1970
|
+
};
|
|
1971
|
+
var onEditDrawing = function onEditDrawing(drawingId) {
|
|
1972
|
+
// delete current redux layers
|
|
1973
|
+
deleteGeoJSONLayer();
|
|
1974
|
+
onCloseDialog();
|
|
1975
|
+
openDrawTools(drawingId);
|
|
1976
|
+
};
|
|
1977
|
+
var onClose = function onClose() {
|
|
1978
|
+
onCloseDialog();
|
|
1979
|
+
};
|
|
1980
|
+
var onHideAreaManager = function onHideAreaManager() {
|
|
1981
|
+
deleteGeoJSONLayer();
|
|
1982
|
+
};
|
|
1983
|
+
if (!isDialogOpen) {
|
|
1984
|
+
return null;
|
|
1985
|
+
}
|
|
1986
|
+
return /*#__PURE__*/React__default.createElement(AreaManager, {
|
|
1987
|
+
title: "Area Manager for ".concat(mapId),
|
|
1988
|
+
bounds: bounds,
|
|
1989
|
+
isOpen: isDialogOpen,
|
|
1990
|
+
onClose: onClose,
|
|
1991
|
+
onMouseDown: setDialogOrder,
|
|
1992
|
+
order: dialogOrder,
|
|
1993
|
+
source: uiSource,
|
|
1994
|
+
setFocused: setFocused,
|
|
1995
|
+
headerSize: "xs",
|
|
1996
|
+
startPosition: {
|
|
1997
|
+
top: 104,
|
|
1998
|
+
left: 50
|
|
1999
|
+
},
|
|
2000
|
+
drawingListItems: drawings,
|
|
2001
|
+
onClickDrawing: onClickDrawing,
|
|
2002
|
+
onUnMount: onHideAreaManager,
|
|
2003
|
+
onEditDrawing: onEditDrawing,
|
|
2004
|
+
activeDrawingId: activeDrawingId
|
|
2005
|
+
});
|
|
2006
|
+
};
|
|
2007
|
+
|
|
2008
|
+
var drawingList = [
|
|
2009
|
+
{
|
|
2010
|
+
id: "923723984872338768743",
|
|
2011
|
+
name: "Drawing area 101",
|
|
2012
|
+
lastUpdatedTime: "2022-06-01T12:34:27Z",
|
|
2013
|
+
scope: "user",
|
|
2014
|
+
area: {
|
|
2015
|
+
type: "FeatureCollection",
|
|
2016
|
+
features: [
|
|
2017
|
+
{
|
|
2018
|
+
type: "Feature",
|
|
2019
|
+
properties: {
|
|
2020
|
+
fill: "#ff7800",
|
|
2021
|
+
"fill-opacity": 0.2,
|
|
2022
|
+
stroke: "#ff7800",
|
|
2023
|
+
"stroke-width": 2,
|
|
2024
|
+
"stroke-opacity": 1,
|
|
2025
|
+
selectionType: "poly"
|
|
2026
|
+
},
|
|
2027
|
+
geometry: {
|
|
2028
|
+
type: "Polygon",
|
|
2029
|
+
coordinates: [
|
|
2030
|
+
[
|
|
2031
|
+
[
|
|
2032
|
+
3.357673379394467,
|
|
2033
|
+
54.021903403974555
|
|
2034
|
+
],
|
|
2035
|
+
[
|
|
2036
|
+
6.600428193305415,
|
|
2037
|
+
54.583753881732186
|
|
2038
|
+
],
|
|
2039
|
+
[
|
|
2040
|
+
6.642909697417786,
|
|
2041
|
+
50.7929736738295
|
|
2042
|
+
],
|
|
2043
|
+
[
|
|
2044
|
+
3.357673379394467,
|
|
2045
|
+
54.021903403974555
|
|
2046
|
+
]
|
|
2047
|
+
]
|
|
2048
|
+
]
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
]
|
|
2052
|
+
}
|
|
2053
|
+
},
|
|
2054
|
+
{
|
|
2055
|
+
id: "934834893283",
|
|
2056
|
+
name: "Area 89",
|
|
2057
|
+
lastUpdatedTime: "2022-05-26T12:34:27Z",
|
|
2058
|
+
scope: "user",
|
|
2059
|
+
area: {
|
|
2060
|
+
type: "FeatureCollection",
|
|
2061
|
+
features: [
|
|
2062
|
+
{
|
|
2063
|
+
type: "Feature",
|
|
2064
|
+
properties: {
|
|
2065
|
+
fill: "#ff7800",
|
|
2066
|
+
"fill-opacity": 0.2,
|
|
2067
|
+
stroke: "#ff7800",
|
|
2068
|
+
"stroke-width": 2,
|
|
2069
|
+
"stroke-opacity": 1,
|
|
2070
|
+
selectionType: "poly"
|
|
2071
|
+
},
|
|
2072
|
+
geometry: {
|
|
2073
|
+
type: "Polygon",
|
|
2074
|
+
coordinates: [
|
|
2075
|
+
[
|
|
2076
|
+
[
|
|
2077
|
+
3.3151918752820957,
|
|
2078
|
+
52.58351427721301
|
|
2079
|
+
],
|
|
2080
|
+
[
|
|
2081
|
+
4.433871483574519,
|
|
2082
|
+
54.33682382687621
|
|
2083
|
+
],
|
|
2084
|
+
[
|
|
2085
|
+
6.6287491960469955,
|
|
2086
|
+
54.20451802569423
|
|
2087
|
+
],
|
|
2088
|
+
[
|
|
2089
|
+
5.580872094608522,
|
|
2090
|
+
54.063477378446876
|
|
2091
|
+
],
|
|
2092
|
+
[
|
|
2093
|
+
5.014452039776916,
|
|
2094
|
+
53.08821448043569
|
|
2095
|
+
],
|
|
2096
|
+
[
|
|
2097
|
+
5.184378056226398,
|
|
2098
|
+
50.69440676773111
|
|
2099
|
+
],
|
|
2100
|
+
[
|
|
2101
|
+
4.263945467125037,
|
|
2102
|
+
52.367886565469774
|
|
2103
|
+
],
|
|
2104
|
+
[
|
|
2105
|
+
3.4851178917315777,
|
|
2106
|
+
52.116433206467654
|
|
2107
|
+
],
|
|
2108
|
+
[
|
|
2109
|
+
3.3151918752820957,
|
|
2110
|
+
52.58351427721301
|
|
2111
|
+
]
|
|
2112
|
+
]
|
|
2113
|
+
]
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
]
|
|
2117
|
+
}
|
|
2118
|
+
},
|
|
2119
|
+
{
|
|
2120
|
+
id: "345346456345",
|
|
2121
|
+
name: "Area 88",
|
|
2122
|
+
lastUpdatedTime: "2022-05-26T12:34:27Z",
|
|
2123
|
+
scope: "user",
|
|
2124
|
+
area: {
|
|
2125
|
+
type: "FeatureCollection",
|
|
2126
|
+
features: [
|
|
2127
|
+
{
|
|
2128
|
+
type: "Feature",
|
|
2129
|
+
properties: {
|
|
2130
|
+
fill: "#ff7800",
|
|
2131
|
+
"fill-opacity": 0.2,
|
|
2132
|
+
stroke: "#ff7800",
|
|
2133
|
+
"stroke-width": 2,
|
|
2134
|
+
"stroke-opacity": 1,
|
|
2135
|
+
selectionType: "poly"
|
|
2136
|
+
},
|
|
2137
|
+
geometry: {
|
|
2138
|
+
type: "Polygon",
|
|
2139
|
+
coordinates: [
|
|
2140
|
+
[
|
|
2141
|
+
[
|
|
2142
|
+
10.481821619038993,
|
|
2143
|
+
58.535200764136974
|
|
2144
|
+
],
|
|
2145
|
+
[
|
|
2146
|
+
8.640758193817074,
|
|
2147
|
+
60.346399887508504
|
|
2148
|
+
],
|
|
2149
|
+
[
|
|
2150
|
+
13.391889613744592,
|
|
2151
|
+
67.5974266962731
|
|
2152
|
+
],
|
|
2153
|
+
[
|
|
2154
|
+
16.658292464944765,
|
|
2155
|
+
66.50937700061121
|
|
2156
|
+
],
|
|
2157
|
+
[
|
|
2158
|
+
10.481821619038993,
|
|
2159
|
+
58.535200764136974
|
|
2160
|
+
]
|
|
2161
|
+
]
|
|
2162
|
+
]
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
]
|
|
2166
|
+
}
|
|
2167
|
+
},
|
|
2168
|
+
{
|
|
2169
|
+
id: "4556657",
|
|
2170
|
+
name: "Draw from Bernard 01",
|
|
2171
|
+
lastUpdatedTime: "2022-05-26T12:34:27Z",
|
|
2172
|
+
scope: "user",
|
|
2173
|
+
area: {
|
|
2174
|
+
type: "FeatureCollection",
|
|
2175
|
+
features: [
|
|
2176
|
+
{
|
|
2177
|
+
type: "Feature",
|
|
2178
|
+
properties: {
|
|
2179
|
+
fill: "#ff7800",
|
|
2180
|
+
"fill-opacity": 0.2,
|
|
2181
|
+
stroke: "#ff7800",
|
|
2182
|
+
"stroke-width": 2,
|
|
2183
|
+
"stroke-opacity": 1,
|
|
2184
|
+
selectionType: "poly"
|
|
2185
|
+
},
|
|
2186
|
+
geometry: {
|
|
2187
|
+
type: "Polygon",
|
|
2188
|
+
coordinates: [
|
|
2189
|
+
[
|
|
2190
|
+
[
|
|
2191
|
+
20.93431074287952,
|
|
2192
|
+
62.25647725012774
|
|
2193
|
+
],
|
|
2194
|
+
[
|
|
2195
|
+
31.030465010225495,
|
|
2196
|
+
63.81786602783593
|
|
2197
|
+
],
|
|
2198
|
+
[
|
|
2199
|
+
31.030465010225495,
|
|
2200
|
+
62.777202248150076
|
|
2201
|
+
],
|
|
2202
|
+
[
|
|
2203
|
+
27.348338159781672,
|
|
2204
|
+
60.58061892723374
|
|
2205
|
+
],
|
|
2206
|
+
[
|
|
2207
|
+
23.369265595592385,
|
|
2208
|
+
59.99189262957603
|
|
2209
|
+
],
|
|
2210
|
+
[
|
|
2211
|
+
21.409423884872282,
|
|
2212
|
+
60.69709580628983
|
|
2213
|
+
],
|
|
2214
|
+
[
|
|
2215
|
+
20.93431074287952,
|
|
2216
|
+
62.25647725012774
|
|
2217
|
+
]
|
|
2218
|
+
]
|
|
2219
|
+
]
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
]
|
|
2223
|
+
}
|
|
2224
|
+
},
|
|
2225
|
+
{
|
|
2226
|
+
id: "23435656567",
|
|
2227
|
+
name: "Test drawing",
|
|
2228
|
+
lastUpdatedTime: "2022-05-24T12:34:27Z",
|
|
2229
|
+
scope: "user",
|
|
2230
|
+
area: {
|
|
2231
|
+
type: "FeatureCollection",
|
|
2232
|
+
features: [
|
|
2233
|
+
{
|
|
2234
|
+
type: "Feature",
|
|
2235
|
+
properties: {
|
|
2236
|
+
fill: "#ff7800",
|
|
2237
|
+
"fill-opacity": 0.2,
|
|
2238
|
+
stroke: "#ff7800",
|
|
2239
|
+
"stroke-width": 2,
|
|
2240
|
+
"stroke-opacity": 1,
|
|
2241
|
+
selectionType: "poly"
|
|
2242
|
+
},
|
|
2243
|
+
geometry: {
|
|
2244
|
+
type: "Polygon",
|
|
2245
|
+
coordinates: [
|
|
2246
|
+
[
|
|
2247
|
+
[
|
|
2248
|
+
20.93431074287952,
|
|
2249
|
+
69.36114032013387
|
|
2250
|
+
],
|
|
2251
|
+
[
|
|
2252
|
+
22.715985025352346,
|
|
2253
|
+
68.74546806467802
|
|
2254
|
+
],
|
|
2255
|
+
[
|
|
2256
|
+
24.972772449817917,
|
|
2257
|
+
68.50738411845781
|
|
2258
|
+
],
|
|
2259
|
+
[
|
|
2260
|
+
27.88284044452352,
|
|
2261
|
+
70.08148816575513
|
|
2262
|
+
],
|
|
2263
|
+
[
|
|
2264
|
+
29.18940158500359,
|
|
2265
|
+
69.6315632353234
|
|
2266
|
+
],
|
|
2267
|
+
[
|
|
2268
|
+
29.902071297992713,
|
|
2269
|
+
67.55211547473719
|
|
2270
|
+
],
|
|
2271
|
+
[
|
|
2272
|
+
24.141324451330597,
|
|
2273
|
+
65.64245127864648
|
|
2274
|
+
],
|
|
2275
|
+
[
|
|
2276
|
+
20.93431074287952,
|
|
2277
|
+
69.36114032013387
|
|
2278
|
+
]
|
|
2279
|
+
]
|
|
2280
|
+
]
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
]
|
|
2284
|
+
}
|
|
2285
|
+
},
|
|
2286
|
+
{
|
|
2287
|
+
id: "34536467568",
|
|
2288
|
+
name: "Sigmet drawing 22-05",
|
|
2289
|
+
lastUpdatedTime: "2022-05-22T12:34:27Z",
|
|
2290
|
+
scope: "user",
|
|
2291
|
+
area: {
|
|
2292
|
+
type: "FeatureCollection",
|
|
2293
|
+
features: [
|
|
2294
|
+
{
|
|
2295
|
+
type: "Feature",
|
|
2296
|
+
properties: {
|
|
2297
|
+
fill: "#ff7800",
|
|
2298
|
+
"fill-opacity": 0.2,
|
|
2299
|
+
stroke: "#ff7800",
|
|
2300
|
+
"stroke-width": 2,
|
|
2301
|
+
"stroke-opacity": 1,
|
|
2302
|
+
selectionType: "poly"
|
|
2303
|
+
},
|
|
2304
|
+
geometry: {
|
|
2305
|
+
type: "Polygon",
|
|
2306
|
+
coordinates: [
|
|
2307
|
+
[
|
|
2308
|
+
[
|
|
2309
|
+
9.412817049555295,
|
|
2310
|
+
59.99189262957603
|
|
2311
|
+
],
|
|
2312
|
+
[
|
|
2313
|
+
10.897545618282647,
|
|
2314
|
+
60.0215811509381
|
|
2315
|
+
],
|
|
2316
|
+
[
|
|
2317
|
+
11.253880474777208,
|
|
2318
|
+
58.87454186571334
|
|
2319
|
+
],
|
|
2320
|
+
[
|
|
2321
|
+
9.65037362055167,
|
|
2322
|
+
58.87454186571334
|
|
2323
|
+
],
|
|
2324
|
+
[
|
|
2325
|
+
9.412817049555295,
|
|
2326
|
+
59.99189262957603
|
|
2327
|
+
]
|
|
2328
|
+
]
|
|
2329
|
+
]
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
]
|
|
2333
|
+
}
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
id: "4556789789345345",
|
|
2337
|
+
name: "Area 55",
|
|
2338
|
+
lastUpdatedTime: "2022-05-21T12:34:27Z",
|
|
2339
|
+
scope: "user",
|
|
2340
|
+
area: {
|
|
2341
|
+
type: "FeatureCollection",
|
|
2342
|
+
features: [
|
|
2343
|
+
{
|
|
2344
|
+
type: "Feature",
|
|
2345
|
+
properties: {
|
|
2346
|
+
fill: "#ff7800",
|
|
2347
|
+
"fill-opacity": 0.2,
|
|
2348
|
+
stroke: "#ff7800",
|
|
2349
|
+
"stroke-width": 2,
|
|
2350
|
+
"stroke-opacity": 1,
|
|
2351
|
+
selectionType: "poly"
|
|
2352
|
+
},
|
|
2353
|
+
geometry: {
|
|
2354
|
+
type: "Polygon",
|
|
2355
|
+
coordinates: [
|
|
2356
|
+
[
|
|
2357
|
+
[
|
|
2358
|
+
5.13958073010762,
|
|
2359
|
+
52.378706353966585
|
|
2360
|
+
],
|
|
2361
|
+
[
|
|
2362
|
+
5.641217196283798,
|
|
2363
|
+
52.61090322290158
|
|
2364
|
+
],
|
|
2365
|
+
[
|
|
2366
|
+
5.847369168684968,
|
|
2367
|
+
52.57750901498518
|
|
2368
|
+
],
|
|
2369
|
+
[
|
|
2370
|
+
5.806138774204734,
|
|
2371
|
+
52.42272955304427
|
|
2372
|
+
],
|
|
2373
|
+
[
|
|
2374
|
+
5.545012942496586,
|
|
2375
|
+
52.35562905080307
|
|
2376
|
+
],
|
|
2377
|
+
[
|
|
2378
|
+
5.507218414223038,
|
|
2379
|
+
52.26950740893074
|
|
2380
|
+
],
|
|
2381
|
+
[
|
|
2382
|
+
5.393834829402396,
|
|
2383
|
+
52.27791689754497
|
|
2384
|
+
],
|
|
2385
|
+
[
|
|
2386
|
+
5.270143645961694,
|
|
2387
|
+
52.330440060249835
|
|
2388
|
+
],
|
|
2389
|
+
[
|
|
2390
|
+
5.167067659761109,
|
|
2391
|
+
52.33673865324146
|
|
2392
|
+
],
|
|
2393
|
+
[
|
|
2394
|
+
5.13958073010762,
|
|
2395
|
+
52.378706353966585
|
|
2396
|
+
]
|
|
2397
|
+
]
|
|
2398
|
+
]
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
]
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
];
|
|
2405
|
+
|
|
2406
|
+
var drawingsListFullContent = [
|
|
2407
|
+
{
|
|
2408
|
+
id: "923723984872338768743",
|
|
2409
|
+
name: "Drawing area 101",
|
|
2410
|
+
lastUpdatedTime: "2022-06-01T12:34:27Z",
|
|
2411
|
+
scope: "user",
|
|
2412
|
+
username: "Dwight Schrute",
|
|
2413
|
+
area: {
|
|
2414
|
+
type: "FeatureCollection",
|
|
2415
|
+
features: [
|
|
2416
|
+
{
|
|
2417
|
+
type: "Feature",
|
|
2418
|
+
properties: {
|
|
2419
|
+
fill: "#ff7800",
|
|
2420
|
+
"fill-opacity": 0.2,
|
|
2421
|
+
stroke: "#ff7800",
|
|
2422
|
+
"stroke-width": 2,
|
|
2423
|
+
"stroke-opacity": 1,
|
|
2424
|
+
selectionType: "poly"
|
|
2425
|
+
},
|
|
2426
|
+
geometry: {
|
|
2427
|
+
type: "Polygon",
|
|
2428
|
+
coordinates: [
|
|
2429
|
+
[
|
|
2430
|
+
[
|
|
2431
|
+
3.357673379394467,
|
|
2432
|
+
54.021903403974555
|
|
2433
|
+
],
|
|
2434
|
+
[
|
|
2435
|
+
6.600428193305415,
|
|
2436
|
+
54.583753881732186
|
|
2437
|
+
],
|
|
2438
|
+
[
|
|
2439
|
+
6.642909697417786,
|
|
2440
|
+
50.7929736738295
|
|
2441
|
+
],
|
|
2442
|
+
[
|
|
2443
|
+
3.357673379394467,
|
|
2444
|
+
54.021903403974555
|
|
2445
|
+
]
|
|
2446
|
+
]
|
|
2447
|
+
]
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
]
|
|
2451
|
+
}
|
|
2452
|
+
},
|
|
2453
|
+
{
|
|
2454
|
+
id: "934834893283",
|
|
2455
|
+
name: "Area 89",
|
|
2456
|
+
lastUpdatedTime: "2022-05-31T12:34:27Z",
|
|
2457
|
+
scope: "user",
|
|
2458
|
+
username: "Dwight Schrute",
|
|
2459
|
+
area: {
|
|
2460
|
+
type: "FeatureCollection",
|
|
2461
|
+
features: [
|
|
2462
|
+
{
|
|
2463
|
+
type: "Feature",
|
|
2464
|
+
properties: {
|
|
2465
|
+
fill: "#ff7800",
|
|
2466
|
+
"fill-opacity": 0.2,
|
|
2467
|
+
stroke: "#ff7800",
|
|
2468
|
+
"stroke-width": 2,
|
|
2469
|
+
"stroke-opacity": 1,
|
|
2470
|
+
selectionType: "poly"
|
|
2471
|
+
},
|
|
2472
|
+
geometry: {
|
|
2473
|
+
type: "Polygon",
|
|
2474
|
+
coordinates: [
|
|
2475
|
+
[
|
|
2476
|
+
[
|
|
2477
|
+
3.3151918752820957,
|
|
2478
|
+
52.58351427721301
|
|
2479
|
+
],
|
|
2480
|
+
[
|
|
2481
|
+
4.433871483574519,
|
|
2482
|
+
54.33682382687621
|
|
2483
|
+
],
|
|
2484
|
+
[
|
|
2485
|
+
6.6287491960469955,
|
|
2486
|
+
54.20451802569423
|
|
2487
|
+
],
|
|
2488
|
+
[
|
|
2489
|
+
5.580872094608522,
|
|
2490
|
+
54.063477378446876
|
|
2491
|
+
],
|
|
2492
|
+
[
|
|
2493
|
+
5.014452039776916,
|
|
2494
|
+
53.08821448043569
|
|
2495
|
+
],
|
|
2496
|
+
[
|
|
2497
|
+
5.184378056226398,
|
|
2498
|
+
50.69440676773111
|
|
2499
|
+
],
|
|
2500
|
+
[
|
|
2501
|
+
4.263945467125037,
|
|
2502
|
+
52.367886565469774
|
|
2503
|
+
],
|
|
2504
|
+
[
|
|
2505
|
+
3.4851178917315777,
|
|
2506
|
+
52.116433206467654
|
|
2507
|
+
],
|
|
2508
|
+
[
|
|
2509
|
+
3.3151918752820957,
|
|
2510
|
+
52.58351427721301
|
|
2511
|
+
]
|
|
2512
|
+
]
|
|
2513
|
+
]
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
]
|
|
2517
|
+
}
|
|
2518
|
+
},
|
|
2519
|
+
{
|
|
2520
|
+
id: "345346456345",
|
|
2521
|
+
name: "Area 88",
|
|
2522
|
+
lastUpdatedTime: "2022-05-26T12:34:27Z",
|
|
2523
|
+
scope: "user",
|
|
2524
|
+
username: "Dwight Schrute",
|
|
2525
|
+
area: {
|
|
2526
|
+
type: "FeatureCollection",
|
|
2527
|
+
features: [
|
|
2528
|
+
{
|
|
2529
|
+
type: "Feature",
|
|
2530
|
+
properties: {
|
|
2531
|
+
fill: "#ff7800",
|
|
2532
|
+
"fill-opacity": 0.2,
|
|
2533
|
+
stroke: "#ff7800",
|
|
2534
|
+
"stroke-width": 2,
|
|
2535
|
+
"stroke-opacity": 1,
|
|
2536
|
+
selectionType: "poly"
|
|
2537
|
+
},
|
|
2538
|
+
geometry: {
|
|
2539
|
+
type: "Polygon",
|
|
2540
|
+
coordinates: [
|
|
2541
|
+
[
|
|
2542
|
+
[
|
|
2543
|
+
10.481821619038993,
|
|
2544
|
+
58.535200764136974
|
|
2545
|
+
],
|
|
2546
|
+
[
|
|
2547
|
+
8.640758193817074,
|
|
2548
|
+
60.346399887508504
|
|
2549
|
+
],
|
|
2550
|
+
[
|
|
2551
|
+
13.391889613744592,
|
|
2552
|
+
67.5974266962731
|
|
2553
|
+
],
|
|
2554
|
+
[
|
|
2555
|
+
16.658292464944765,
|
|
2556
|
+
66.50937700061121
|
|
2557
|
+
],
|
|
2558
|
+
[
|
|
2559
|
+
10.481821619038993,
|
|
2560
|
+
58.535200764136974
|
|
2561
|
+
]
|
|
2562
|
+
]
|
|
2563
|
+
]
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
]
|
|
2567
|
+
}
|
|
2568
|
+
},
|
|
2569
|
+
{
|
|
2570
|
+
id: "4556657",
|
|
2571
|
+
name: "Draw from Bernard 01",
|
|
2572
|
+
lastUpdatedTime: "2022-05-25T12:34:27Z",
|
|
2573
|
+
scope: "user",
|
|
2574
|
+
username: "Dwight Schrute",
|
|
2575
|
+
area: {
|
|
2576
|
+
type: "FeatureCollection",
|
|
2577
|
+
features: [
|
|
2578
|
+
{
|
|
2579
|
+
type: "Feature",
|
|
2580
|
+
properties: {
|
|
2581
|
+
fill: "#ff7800",
|
|
2582
|
+
"fill-opacity": 0.2,
|
|
2583
|
+
stroke: "#ff7800",
|
|
2584
|
+
"stroke-width": 2,
|
|
2585
|
+
"stroke-opacity": 1,
|
|
2586
|
+
selectionType: "poly"
|
|
2587
|
+
},
|
|
2588
|
+
geometry: {
|
|
2589
|
+
type: "Polygon",
|
|
2590
|
+
coordinates: [
|
|
2591
|
+
[
|
|
2592
|
+
[
|
|
2593
|
+
20.93431074287952,
|
|
2594
|
+
62.25647725012774
|
|
2595
|
+
],
|
|
2596
|
+
[
|
|
2597
|
+
31.030465010225495,
|
|
2598
|
+
63.81786602783593
|
|
2599
|
+
],
|
|
2600
|
+
[
|
|
2601
|
+
31.030465010225495,
|
|
2602
|
+
62.777202248150076
|
|
2603
|
+
],
|
|
2604
|
+
[
|
|
2605
|
+
27.348338159781672,
|
|
2606
|
+
60.58061892723374
|
|
2607
|
+
],
|
|
2608
|
+
[
|
|
2609
|
+
23.369265595592385,
|
|
2610
|
+
59.99189262957603
|
|
2611
|
+
],
|
|
2612
|
+
[
|
|
2613
|
+
21.409423884872282,
|
|
2614
|
+
60.69709580628983
|
|
2615
|
+
],
|
|
2616
|
+
[
|
|
2617
|
+
20.93431074287952,
|
|
2618
|
+
62.25647725012774
|
|
2619
|
+
]
|
|
2620
|
+
]
|
|
2621
|
+
]
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
]
|
|
2625
|
+
}
|
|
2626
|
+
},
|
|
2627
|
+
{
|
|
2628
|
+
id: "23435656567",
|
|
2629
|
+
name: "Test drawing",
|
|
2630
|
+
lastUpdatedTime: "2022-05-24T12:34:27Z",
|
|
2631
|
+
scope: "user",
|
|
2632
|
+
username: "Dwight Schrute",
|
|
2633
|
+
area: {
|
|
2634
|
+
type: "FeatureCollection",
|
|
2635
|
+
features: [
|
|
2636
|
+
{
|
|
2637
|
+
type: "Feature",
|
|
2638
|
+
properties: {
|
|
2639
|
+
fill: "#ff7800",
|
|
2640
|
+
"fill-opacity": 0.2,
|
|
2641
|
+
stroke: "#ff7800",
|
|
2642
|
+
"stroke-width": 2,
|
|
2643
|
+
"stroke-opacity": 1,
|
|
2644
|
+
selectionType: "poly"
|
|
2645
|
+
},
|
|
2646
|
+
geometry: {
|
|
2647
|
+
type: "Polygon",
|
|
2648
|
+
coordinates: [
|
|
2649
|
+
[
|
|
2650
|
+
[
|
|
2651
|
+
20.93431074287952,
|
|
2652
|
+
69.36114032013387
|
|
2653
|
+
],
|
|
2654
|
+
[
|
|
2655
|
+
22.715985025352346,
|
|
2656
|
+
68.74546806467802
|
|
2657
|
+
],
|
|
2658
|
+
[
|
|
2659
|
+
24.972772449817917,
|
|
2660
|
+
68.50738411845781
|
|
2661
|
+
],
|
|
2662
|
+
[
|
|
2663
|
+
27.88284044452352,
|
|
2664
|
+
70.08148816575513
|
|
2665
|
+
],
|
|
2666
|
+
[
|
|
2667
|
+
29.18940158500359,
|
|
2668
|
+
69.6315632353234
|
|
2669
|
+
],
|
|
2670
|
+
[
|
|
2671
|
+
29.902071297992713,
|
|
2672
|
+
67.55211547473719
|
|
2673
|
+
],
|
|
2674
|
+
[
|
|
2675
|
+
24.141324451330597,
|
|
2676
|
+
65.64245127864648
|
|
2677
|
+
],
|
|
2678
|
+
[
|
|
2679
|
+
20.93431074287952,
|
|
2680
|
+
69.36114032013387
|
|
2681
|
+
]
|
|
2682
|
+
]
|
|
2683
|
+
]
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
]
|
|
2687
|
+
}
|
|
2688
|
+
},
|
|
2689
|
+
{
|
|
2690
|
+
id: "34536467568",
|
|
2691
|
+
name: "Sigmet drawing 22-05",
|
|
2692
|
+
lastUpdatedTime: "2022-05-22T12:34:27Z",
|
|
2693
|
+
scope: "user",
|
|
2694
|
+
username: "Dwight Schrute",
|
|
2695
|
+
area: {
|
|
2696
|
+
type: "FeatureCollection",
|
|
2697
|
+
features: [
|
|
2698
|
+
{
|
|
2699
|
+
type: "Feature",
|
|
2700
|
+
properties: {
|
|
2701
|
+
fill: "#ff7800",
|
|
2702
|
+
"fill-opacity": 0.2,
|
|
2703
|
+
stroke: "#ff7800",
|
|
2704
|
+
"stroke-width": 2,
|
|
2705
|
+
"stroke-opacity": 1,
|
|
2706
|
+
selectionType: "poly"
|
|
2707
|
+
},
|
|
2708
|
+
geometry: {
|
|
2709
|
+
type: "Polygon",
|
|
2710
|
+
coordinates: [
|
|
2711
|
+
[
|
|
2712
|
+
[
|
|
2713
|
+
9.412817049555295,
|
|
2714
|
+
59.99189262957603
|
|
2715
|
+
],
|
|
2716
|
+
[
|
|
2717
|
+
10.897545618282647,
|
|
2718
|
+
60.0215811509381
|
|
2719
|
+
],
|
|
2720
|
+
[
|
|
2721
|
+
11.253880474777208,
|
|
2722
|
+
58.87454186571334
|
|
2723
|
+
],
|
|
2724
|
+
[
|
|
2725
|
+
9.65037362055167,
|
|
2726
|
+
58.87454186571334
|
|
2727
|
+
],
|
|
2728
|
+
[
|
|
2729
|
+
9.412817049555295,
|
|
2730
|
+
59.99189262957603
|
|
2731
|
+
]
|
|
2732
|
+
]
|
|
2733
|
+
]
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2736
|
+
]
|
|
2737
|
+
}
|
|
2738
|
+
},
|
|
2739
|
+
{
|
|
2740
|
+
id: "4556789789345345",
|
|
2741
|
+
name: "Area 55",
|
|
2742
|
+
lastUpdatedTime: "2022-05-21T12:34:27Z",
|
|
2743
|
+
scope: "user",
|
|
2744
|
+
username: "Dwight Schrute",
|
|
2745
|
+
area: {
|
|
2746
|
+
type: "FeatureCollection",
|
|
2747
|
+
features: [
|
|
2748
|
+
{
|
|
2749
|
+
type: "Feature",
|
|
2750
|
+
properties: {
|
|
2751
|
+
fill: "#ff7800",
|
|
2752
|
+
"fill-opacity": 0.2,
|
|
2753
|
+
stroke: "#ff7800",
|
|
2754
|
+
"stroke-width": 2,
|
|
2755
|
+
"stroke-opacity": 1,
|
|
2756
|
+
selectionType: "poly"
|
|
2757
|
+
},
|
|
2758
|
+
geometry: {
|
|
2759
|
+
type: "Polygon",
|
|
2760
|
+
coordinates: [
|
|
2761
|
+
[
|
|
2762
|
+
[
|
|
2763
|
+
5.13958073010762,
|
|
2764
|
+
52.378706353966585
|
|
2765
|
+
],
|
|
2766
|
+
[
|
|
2767
|
+
5.641217196283798,
|
|
2768
|
+
52.61090322290158
|
|
2769
|
+
],
|
|
2770
|
+
[
|
|
2771
|
+
5.847369168684968,
|
|
2772
|
+
52.57750901498518
|
|
2773
|
+
],
|
|
2774
|
+
[
|
|
2775
|
+
5.806138774204734,
|
|
2776
|
+
52.42272955304427
|
|
2777
|
+
],
|
|
2778
|
+
[
|
|
2779
|
+
5.545012942496586,
|
|
2780
|
+
52.35562905080307
|
|
2781
|
+
],
|
|
2782
|
+
[
|
|
2783
|
+
5.507218414223038,
|
|
2784
|
+
52.26950740893074
|
|
2785
|
+
],
|
|
2786
|
+
[
|
|
2787
|
+
5.393834829402396,
|
|
2788
|
+
52.27791689754497
|
|
2789
|
+
],
|
|
2790
|
+
[
|
|
2791
|
+
5.270143645961694,
|
|
2792
|
+
52.330440060249835
|
|
2793
|
+
],
|
|
2794
|
+
[
|
|
2795
|
+
5.167067659761109,
|
|
2796
|
+
52.33673865324146
|
|
2797
|
+
],
|
|
2798
|
+
[
|
|
2799
|
+
5.13958073010762,
|
|
2800
|
+
52.378706353966585
|
|
2801
|
+
]
|
|
2802
|
+
]
|
|
2803
|
+
]
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
]
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
];
|
|
2810
|
+
|
|
2811
|
+
/* *
|
|
2812
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2813
|
+
* you may not use this file except in compliance with the License.
|
|
2814
|
+
* You may obtain a copy of the License at
|
|
2815
|
+
*
|
|
2816
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2817
|
+
*
|
|
2818
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2819
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2820
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2821
|
+
* See the License for the specific language governing permissions and
|
|
2822
|
+
* limitations under the License.
|
|
2823
|
+
*
|
|
2824
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2825
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2826
|
+
* */
|
|
2827
|
+
var ERROR_NOT_FOUND = 'Request failed with status code 400';
|
|
2828
|
+
var extractDrawingDetailsFromJSON = function extractDrawingDetailsFromJSON(drawingId) {
|
|
2829
|
+
return drawingsListFullContent.find(function (element) {
|
|
2830
|
+
return element.id === drawingId;
|
|
2831
|
+
});
|
|
2832
|
+
};
|
|
2833
|
+
var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
2834
|
+
return {
|
|
2835
|
+
// drawings
|
|
2836
|
+
getDrawings: function getDrawings() {
|
|
2837
|
+
return axiosInstance.get('/drawings').then(function () {
|
|
2838
|
+
var data = drawingList;
|
|
2839
|
+
return {
|
|
2840
|
+
data: data
|
|
2841
|
+
};
|
|
2842
|
+
});
|
|
2843
|
+
},
|
|
2844
|
+
getDrawingDetails: function getDrawingDetails(drawingId) {
|
|
2845
|
+
return axiosInstance.get("/drawings/".concat(drawingId)).then(function () {
|
|
2846
|
+
if (!extractDrawingDetailsFromJSON(drawingId)) {
|
|
2847
|
+
throw new Error(ERROR_NOT_FOUND);
|
|
2848
|
+
}
|
|
2849
|
+
return {
|
|
2850
|
+
data: extractDrawingDetailsFromJSON(drawingId)
|
|
2851
|
+
};
|
|
2852
|
+
});
|
|
2853
|
+
},
|
|
2854
|
+
updateDrawing: function updateDrawing(drawingId, data) {
|
|
2855
|
+
// eslint-disable-next-line no-console
|
|
2856
|
+
console.log('api: save drawing', drawingId, data);
|
|
2857
|
+
return axiosInstance.put("/drawings/".concat(drawingId, "/"), data);
|
|
2858
|
+
},
|
|
2859
|
+
saveDrawingAs: function saveDrawingAs(data) {
|
|
2860
|
+
// eslint-disable-next-line no-console
|
|
2861
|
+
console.log('api: save drawing as', data);
|
|
2862
|
+
return axiosInstance.post("/drawings/", data).then(function () {
|
|
2863
|
+
return 'new-drawing-id';
|
|
2864
|
+
});
|
|
2865
|
+
},
|
|
2866
|
+
deleteDrawing: function deleteDrawing(drawingId) {
|
|
2867
|
+
// eslint-disable-next-line no-console
|
|
2868
|
+
console.log('api: delete drawing', drawingId);
|
|
2869
|
+
return axiosInstance["delete"]("/drawings/".concat(drawingId));
|
|
2870
|
+
}
|
|
2871
|
+
};
|
|
2872
|
+
};
|
|
2873
|
+
// used in storybook
|
|
2874
|
+
var createApi = function createApi() {
|
|
2875
|
+
var instance = createFakeApiInstance();
|
|
2876
|
+
return getApiRoutes(instance);
|
|
2877
|
+
};
|
|
2878
|
+
|
|
2879
|
+
/* *
|
|
2880
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2881
|
+
* you may not use this file except in compliance with the License.
|
|
2882
|
+
* You may obtain a copy of the License at
|
|
2883
|
+
*
|
|
2884
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2885
|
+
*
|
|
2886
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2887
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2888
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2889
|
+
* See the License for the specific language governing permissions and
|
|
2890
|
+
* limitations under the License.
|
|
2891
|
+
*
|
|
2892
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2893
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2894
|
+
* */
|
|
2895
|
+
var WarningsModuleProvider = function WarningsModuleProvider(_ref) {
|
|
2896
|
+
var config = _ref.config,
|
|
2897
|
+
auth = _ref.auth,
|
|
2898
|
+
onSetAuth = _ref.onSetAuth,
|
|
2899
|
+
children = _ref.children;
|
|
2900
|
+
return /*#__PURE__*/React.createElement(ApiProvider, {
|
|
2901
|
+
config: config,
|
|
2902
|
+
auth: auth,
|
|
2903
|
+
onSetAuth: onSetAuth,
|
|
2904
|
+
createApi: config !== undefined ? createApi$1 : createApi,
|
|
2905
|
+
name: API_NAME
|
|
2906
|
+
}, children);
|
|
2907
|
+
};
|
|
2908
|
+
|
|
2909
|
+
var createSymbol = function createSymbol(name) {
|
|
2910
|
+
return "@@redux-saga/" + name;
|
|
2911
|
+
};
|
|
2912
|
+
|
|
2913
|
+
var CANCEL$1 =
|
|
2914
|
+
/*#__PURE__*/
|
|
2915
|
+
createSymbol('CANCEL_PROMISE');
|
|
2916
|
+
var IO =
|
|
2917
|
+
/*#__PURE__*/
|
|
2918
|
+
createSymbol('IO');
|
|
2919
|
+
var MULTICAST =
|
|
2920
|
+
/*#__PURE__*/
|
|
2921
|
+
createSymbol('MULTICAST');
|
|
2922
|
+
var SELF_CANCELLATION =
|
|
2923
|
+
/*#__PURE__*/
|
|
2924
|
+
createSymbol('SELF_CANCELLATION');
|
|
2925
|
+
var TASK =
|
|
2926
|
+
/*#__PURE__*/
|
|
2927
|
+
createSymbol('TASK');
|
|
2928
|
+
|
|
2929
|
+
var undef = function undef(v) {
|
|
2930
|
+
return v === null || v === undefined;
|
|
2931
|
+
};
|
|
2932
|
+
var notUndef = function notUndef(v) {
|
|
2933
|
+
return v !== null && v !== undefined;
|
|
2934
|
+
};
|
|
2935
|
+
var func = function func(f) {
|
|
2936
|
+
return typeof f === 'function';
|
|
2937
|
+
};
|
|
2938
|
+
var string = function string(s) {
|
|
2939
|
+
return typeof s === 'string';
|
|
2940
|
+
};
|
|
2941
|
+
var array = Array.isArray;
|
|
2942
|
+
var object = function object(obj) {
|
|
2943
|
+
return obj && !array(obj) && typeof obj === 'object';
|
|
2944
|
+
};
|
|
2945
|
+
var task = function task(t) {
|
|
2946
|
+
return t && t[TASK];
|
|
2947
|
+
};
|
|
2948
|
+
var pattern = function pattern(pat) {
|
|
2949
|
+
return pat && (string(pat) || symbol(pat) || func(pat) || array(pat) && pat.every(pattern));
|
|
2950
|
+
};
|
|
2951
|
+
var channel = function channel(ch) {
|
|
2952
|
+
return ch && func(ch.take) && func(ch.close);
|
|
2953
|
+
};
|
|
2954
|
+
var stringableFunc = function stringableFunc(f) {
|
|
2955
|
+
return func(f) && f.hasOwnProperty('toString');
|
|
2956
|
+
};
|
|
2957
|
+
var symbol = function symbol(sym) {
|
|
2958
|
+
return Boolean(sym) && typeof Symbol === 'function' && sym.constructor === Symbol && sym !== Symbol.prototype;
|
|
2959
|
+
};
|
|
2960
|
+
var multicast = function multicast(ch) {
|
|
2961
|
+
return channel(ch) && ch[MULTICAST];
|
|
2962
|
+
};
|
|
2963
|
+
var effect = function effect(eff) {
|
|
2964
|
+
return eff && eff[IO];
|
|
2965
|
+
};
|
|
2966
|
+
|
|
2967
|
+
var MAX_SIGNED_INT = 2147483647;
|
|
2968
|
+
function delayP(ms, val) {
|
|
2969
|
+
if (val === void 0) {
|
|
2970
|
+
val = true;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#maximum_delay_value
|
|
2974
|
+
if (process.env.NODE_ENV !== 'production' && ms > MAX_SIGNED_INT) {
|
|
2975
|
+
throw new Error('delay only supports a maximum value of ' + MAX_SIGNED_INT + 'ms');
|
|
2976
|
+
}
|
|
2977
|
+
|
|
2978
|
+
var timeoutId;
|
|
2979
|
+
var promise = new Promise(function (resolve) {
|
|
2980
|
+
timeoutId = setTimeout(resolve, Math.min(MAX_SIGNED_INT, ms), val);
|
|
2981
|
+
});
|
|
2982
|
+
|
|
2983
|
+
promise[CANCEL$1] = function () {
|
|
2984
|
+
clearTimeout(timeoutId);
|
|
2985
|
+
};
|
|
2986
|
+
|
|
2987
|
+
return promise;
|
|
2988
|
+
}
|
|
2989
|
+
|
|
2990
|
+
if (process.env.NODE_ENV !== 'production' && typeof Proxy !== 'undefined') ;
|
|
2991
|
+
var identity = function identity(v) {
|
|
2992
|
+
return v;
|
|
2993
|
+
};
|
|
2994
|
+
function check(value, predicate, error) {
|
|
2995
|
+
if (!predicate(value)) {
|
|
2996
|
+
throw new Error(error);
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
|
|
3000
|
+
var kThrow = function kThrow(err) {
|
|
3001
|
+
throw err;
|
|
3002
|
+
};
|
|
3003
|
+
|
|
3004
|
+
var kReturn = function kReturn(value) {
|
|
3005
|
+
return {
|
|
3006
|
+
value: value,
|
|
3007
|
+
done: true
|
|
3008
|
+
};
|
|
3009
|
+
};
|
|
3010
|
+
|
|
3011
|
+
function makeIterator(next, thro, name) {
|
|
3012
|
+
if (thro === void 0) {
|
|
3013
|
+
thro = kThrow;
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
if (name === void 0) {
|
|
3017
|
+
name = 'iterator';
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
var iterator = {
|
|
3021
|
+
meta: {
|
|
3022
|
+
name: name
|
|
3023
|
+
},
|
|
3024
|
+
next: next,
|
|
3025
|
+
throw: thro,
|
|
3026
|
+
return: kReturn,
|
|
3027
|
+
isSagaIterator: true
|
|
3028
|
+
};
|
|
3029
|
+
|
|
3030
|
+
if (typeof Symbol !== 'undefined') {
|
|
3031
|
+
iterator[Symbol.iterator] = function () {
|
|
3032
|
+
return iterator;
|
|
3033
|
+
};
|
|
3034
|
+
}
|
|
3035
|
+
|
|
3036
|
+
return iterator;
|
|
3037
|
+
}
|
|
3038
|
+
|
|
3039
|
+
var TAKE = 'TAKE';
|
|
3040
|
+
var PUT = 'PUT';
|
|
3041
|
+
var CALL = 'CALL';
|
|
3042
|
+
var FORK = 'FORK';
|
|
3043
|
+
var CANCEL = 'CANCEL';
|
|
3044
|
+
var SELECT = 'SELECT';
|
|
3045
|
+
|
|
3046
|
+
var TEST_HINT = '\n(HINT: if you are getting these errors in tests, consider using createMockTask from @redux-saga/testing-utils)';
|
|
3047
|
+
|
|
3048
|
+
var makeEffect = function makeEffect(type, payload) {
|
|
3049
|
+
var _ref;
|
|
3050
|
+
|
|
3051
|
+
return _ref = {}, _ref[IO] = true, _ref.combinator = false, _ref.type = type, _ref.payload = payload, _ref;
|
|
3052
|
+
};
|
|
3053
|
+
function take(patternOrChannel, multicastPattern) {
|
|
3054
|
+
if (patternOrChannel === void 0) {
|
|
3055
|
+
patternOrChannel = '*';
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
if (process.env.NODE_ENV !== 'production' && arguments.length) {
|
|
3059
|
+
check(arguments[0], notUndef, 'take(patternOrChannel): patternOrChannel is undefined');
|
|
3060
|
+
}
|
|
3061
|
+
|
|
3062
|
+
if (pattern(patternOrChannel)) {
|
|
3063
|
+
if (notUndef(multicastPattern)) {
|
|
3064
|
+
/* eslint-disable no-console */
|
|
3065
|
+
console.warn("take(pattern) takes one argument but two were provided. Consider passing an array for listening to several action types");
|
|
3066
|
+
}
|
|
3067
|
+
|
|
3068
|
+
return makeEffect(TAKE, {
|
|
3069
|
+
pattern: patternOrChannel
|
|
3070
|
+
});
|
|
3071
|
+
}
|
|
3072
|
+
|
|
3073
|
+
if (multicast(patternOrChannel) && notUndef(multicastPattern) && pattern(multicastPattern)) {
|
|
3074
|
+
return makeEffect(TAKE, {
|
|
3075
|
+
channel: patternOrChannel,
|
|
3076
|
+
pattern: multicastPattern
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
|
|
3080
|
+
if (channel(patternOrChannel)) {
|
|
3081
|
+
if (notUndef(multicastPattern)) {
|
|
3082
|
+
/* eslint-disable no-console */
|
|
3083
|
+
console.warn("take(channel) takes one argument but two were provided. Second argument is ignored.");
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3086
|
+
return makeEffect(TAKE, {
|
|
3087
|
+
channel: patternOrChannel
|
|
3088
|
+
});
|
|
3089
|
+
}
|
|
3090
|
+
|
|
3091
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3092
|
+
throw new Error("take(patternOrChannel): argument " + patternOrChannel + " is not valid channel or a valid pattern");
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
function put(channel$1, action) {
|
|
3096
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3097
|
+
if (arguments.length > 1) {
|
|
3098
|
+
check(channel$1, notUndef, 'put(channel, action): argument channel is undefined');
|
|
3099
|
+
check(channel$1, channel, "put(channel, action): argument " + channel$1 + " is not a valid channel");
|
|
3100
|
+
check(action, notUndef, 'put(channel, action): argument action is undefined');
|
|
3101
|
+
} else {
|
|
3102
|
+
check(channel$1, notUndef, 'put(action): argument action is undefined');
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
|
|
3106
|
+
if (undef(action)) {
|
|
3107
|
+
action = channel$1; // `undefined` instead of `null` to make default parameter work
|
|
3108
|
+
|
|
3109
|
+
channel$1 = undefined;
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
return makeEffect(PUT, {
|
|
3113
|
+
channel: channel$1,
|
|
3114
|
+
action: action
|
|
3115
|
+
});
|
|
3116
|
+
}
|
|
3117
|
+
|
|
3118
|
+
var validateFnDescriptor = function validateFnDescriptor(effectName, fnDescriptor) {
|
|
3119
|
+
check(fnDescriptor, notUndef, effectName + ": argument fn is undefined or null");
|
|
3120
|
+
|
|
3121
|
+
if (func(fnDescriptor)) {
|
|
3122
|
+
return;
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
var context = null;
|
|
3126
|
+
var fn;
|
|
3127
|
+
|
|
3128
|
+
if (array(fnDescriptor)) {
|
|
3129
|
+
context = fnDescriptor[0];
|
|
3130
|
+
fn = fnDescriptor[1];
|
|
3131
|
+
check(fn, notUndef, effectName + ": argument of type [context, fn] has undefined or null `fn`");
|
|
3132
|
+
} else if (object(fnDescriptor)) {
|
|
3133
|
+
context = fnDescriptor.context;
|
|
3134
|
+
fn = fnDescriptor.fn;
|
|
3135
|
+
check(fn, notUndef, effectName + ": argument of type {context, fn} has undefined or null `fn`");
|
|
3136
|
+
} else {
|
|
3137
|
+
check(fnDescriptor, func, effectName + ": argument fn is not function");
|
|
3138
|
+
return;
|
|
3139
|
+
}
|
|
3140
|
+
|
|
3141
|
+
if (context && string(fn)) {
|
|
3142
|
+
check(context[fn], func, effectName + ": context arguments has no such method - \"" + fn + "\"");
|
|
3143
|
+
return;
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
check(fn, func, effectName + ": unpacked fn argument (from [context, fn] or {context, fn}) is not a function");
|
|
3147
|
+
};
|
|
3148
|
+
|
|
3149
|
+
function getFnCallDescriptor(fnDescriptor, args) {
|
|
3150
|
+
var context = null;
|
|
3151
|
+
var fn;
|
|
3152
|
+
|
|
3153
|
+
if (func(fnDescriptor)) {
|
|
3154
|
+
fn = fnDescriptor;
|
|
3155
|
+
} else {
|
|
3156
|
+
if (array(fnDescriptor)) {
|
|
3157
|
+
context = fnDescriptor[0];
|
|
3158
|
+
fn = fnDescriptor[1];
|
|
3159
|
+
} else {
|
|
3160
|
+
context = fnDescriptor.context;
|
|
3161
|
+
fn = fnDescriptor.fn;
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
if (context && string(fn) && func(context[fn])) {
|
|
3165
|
+
fn = context[fn];
|
|
3166
|
+
}
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
return {
|
|
3170
|
+
context: context,
|
|
3171
|
+
fn: fn,
|
|
3172
|
+
args: args
|
|
3173
|
+
};
|
|
3174
|
+
}
|
|
3175
|
+
|
|
3176
|
+
var isNotDelayEffect = function isNotDelayEffect(fn) {
|
|
3177
|
+
return fn !== delay;
|
|
3178
|
+
};
|
|
3179
|
+
|
|
3180
|
+
function call(fnDescriptor) {
|
|
3181
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
3182
|
+
args[_key - 1] = arguments[_key];
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3186
|
+
var arg0 = typeof args[0] === 'number' ? args[0] : 'ms';
|
|
3187
|
+
check(fnDescriptor, isNotDelayEffect, "instead of writing `yield call(delay, " + arg0 + ")` where delay is an effect from `redux-saga/effects` you should write `yield delay(" + arg0 + ")`");
|
|
3188
|
+
validateFnDescriptor('call', fnDescriptor);
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3191
|
+
return makeEffect(CALL, getFnCallDescriptor(fnDescriptor, args));
|
|
3192
|
+
}
|
|
3193
|
+
function fork(fnDescriptor) {
|
|
3194
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3195
|
+
validateFnDescriptor('fork', fnDescriptor);
|
|
3196
|
+
check(fnDescriptor, function (arg) {
|
|
3197
|
+
return !effect(arg);
|
|
3198
|
+
}, 'fork: argument must not be an effect');
|
|
3199
|
+
}
|
|
3200
|
+
|
|
3201
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
3202
|
+
args[_key3 - 1] = arguments[_key3];
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
return makeEffect(FORK, getFnCallDescriptor(fnDescriptor, args));
|
|
3206
|
+
}
|
|
3207
|
+
function cancel(taskOrTasks) {
|
|
3208
|
+
if (taskOrTasks === void 0) {
|
|
3209
|
+
taskOrTasks = SELF_CANCELLATION;
|
|
3210
|
+
}
|
|
3211
|
+
|
|
3212
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3213
|
+
if (arguments.length > 1) {
|
|
3214
|
+
throw new Error('cancel(...tasks) is not supported any more. Please use cancel([...tasks]) to cancel multiple tasks.');
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3217
|
+
if (array(taskOrTasks)) {
|
|
3218
|
+
taskOrTasks.forEach(function (t) {
|
|
3219
|
+
check(t, task, "cancel([...tasks]): argument " + t + " is not a valid Task object " + TEST_HINT);
|
|
3220
|
+
});
|
|
3221
|
+
} else if (taskOrTasks !== SELF_CANCELLATION && notUndef(taskOrTasks)) {
|
|
3222
|
+
check(taskOrTasks, task, "cancel(task): argument " + taskOrTasks + " is not a valid Task object " + TEST_HINT);
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
|
|
3226
|
+
return makeEffect(CANCEL, taskOrTasks);
|
|
3227
|
+
}
|
|
3228
|
+
function select(selector) {
|
|
3229
|
+
if (selector === void 0) {
|
|
3230
|
+
selector = identity;
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
|
|
3234
|
+
args[_key5 - 1] = arguments[_key5];
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
if (process.env.NODE_ENV !== 'production' && arguments.length) {
|
|
3238
|
+
check(arguments[0], notUndef, 'select(selector, [...]): argument selector is undefined');
|
|
3239
|
+
check(selector, func, "select(selector, [...]): argument " + selector + " is not a function");
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3242
|
+
return makeEffect(SELECT, {
|
|
3243
|
+
selector: selector,
|
|
3244
|
+
args: args
|
|
3245
|
+
});
|
|
3246
|
+
}
|
|
3247
|
+
var delay =
|
|
3248
|
+
/*#__PURE__*/
|
|
3249
|
+
call.bind(null, delayP);
|
|
3250
|
+
|
|
3251
|
+
var done = function done(value) {
|
|
3252
|
+
return {
|
|
3253
|
+
done: true,
|
|
3254
|
+
value: value
|
|
3255
|
+
};
|
|
3256
|
+
};
|
|
3257
|
+
|
|
3258
|
+
var qEnd = {};
|
|
3259
|
+
function safeName(patternOrChannel) {
|
|
3260
|
+
if (channel(patternOrChannel)) {
|
|
3261
|
+
return 'channel';
|
|
3262
|
+
}
|
|
3263
|
+
|
|
3264
|
+
if (stringableFunc(patternOrChannel)) {
|
|
3265
|
+
return String(patternOrChannel);
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
if (func(patternOrChannel)) {
|
|
3269
|
+
return patternOrChannel.name;
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
return String(patternOrChannel);
|
|
3273
|
+
}
|
|
3274
|
+
function fsmIterator(fsm, startState, name) {
|
|
3275
|
+
var stateUpdater,
|
|
3276
|
+
errorState,
|
|
3277
|
+
effect,
|
|
3278
|
+
nextState = startState;
|
|
3279
|
+
|
|
3280
|
+
function next(arg, error) {
|
|
3281
|
+
if (nextState === qEnd) {
|
|
3282
|
+
return done(arg);
|
|
3283
|
+
}
|
|
3284
|
+
|
|
3285
|
+
if (error && !errorState) {
|
|
3286
|
+
nextState = qEnd;
|
|
3287
|
+
throw error;
|
|
3288
|
+
} else {
|
|
3289
|
+
stateUpdater && stateUpdater(arg);
|
|
3290
|
+
var currentState = error ? fsm[errorState](error) : fsm[nextState]();
|
|
3291
|
+
nextState = currentState.nextState;
|
|
3292
|
+
effect = currentState.effect;
|
|
3293
|
+
stateUpdater = currentState.stateUpdater;
|
|
3294
|
+
errorState = currentState.errorState;
|
|
3295
|
+
return nextState === qEnd ? done(arg) : effect;
|
|
3296
|
+
}
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3299
|
+
return makeIterator(next, function (error) {
|
|
3300
|
+
return next(null, error);
|
|
3301
|
+
}, name);
|
|
3302
|
+
}
|
|
3303
|
+
|
|
3304
|
+
function takeLatest(patternOrChannel, worker) {
|
|
3305
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
3306
|
+
args[_key - 2] = arguments[_key];
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
var yTake = {
|
|
3310
|
+
done: false,
|
|
3311
|
+
value: take(patternOrChannel)
|
|
3312
|
+
};
|
|
3313
|
+
|
|
3314
|
+
var yFork = function yFork(ac) {
|
|
3315
|
+
return {
|
|
3316
|
+
done: false,
|
|
3317
|
+
value: fork.apply(void 0, [worker].concat(args, [ac]))
|
|
3318
|
+
};
|
|
3319
|
+
};
|
|
3320
|
+
|
|
3321
|
+
var yCancel = function yCancel(task) {
|
|
3322
|
+
return {
|
|
3323
|
+
done: false,
|
|
3324
|
+
value: cancel(task)
|
|
3325
|
+
};
|
|
3326
|
+
};
|
|
3327
|
+
|
|
3328
|
+
var task, action;
|
|
3329
|
+
|
|
3330
|
+
var setTask = function setTask(t) {
|
|
3331
|
+
return task = t;
|
|
3332
|
+
};
|
|
3333
|
+
|
|
3334
|
+
var setAction = function setAction(ac) {
|
|
3335
|
+
return action = ac;
|
|
3336
|
+
};
|
|
3337
|
+
|
|
3338
|
+
return fsmIterator({
|
|
3339
|
+
q1: function q1() {
|
|
3340
|
+
return {
|
|
3341
|
+
nextState: 'q2',
|
|
3342
|
+
effect: yTake,
|
|
3343
|
+
stateUpdater: setAction
|
|
3344
|
+
};
|
|
3345
|
+
},
|
|
3346
|
+
q2: function q2() {
|
|
3347
|
+
return task ? {
|
|
3348
|
+
nextState: 'q3',
|
|
3349
|
+
effect: yCancel(task)
|
|
3350
|
+
} : {
|
|
3351
|
+
nextState: 'q1',
|
|
3352
|
+
effect: yFork(action),
|
|
3353
|
+
stateUpdater: setTask
|
|
3354
|
+
};
|
|
3355
|
+
},
|
|
3356
|
+
q3: function q3() {
|
|
3357
|
+
return {
|
|
3358
|
+
nextState: 'q1',
|
|
3359
|
+
effect: yFork(action),
|
|
3360
|
+
stateUpdater: setTask
|
|
3361
|
+
};
|
|
3362
|
+
}
|
|
3363
|
+
}, 'q1', "takeLatest(" + safeName(patternOrChannel) + ", " + worker.name + ")");
|
|
3364
|
+
}
|
|
3365
|
+
|
|
3366
|
+
var validateTakeEffect = function validateTakeEffect(fn, patternOrChannel, worker) {
|
|
3367
|
+
check(patternOrChannel, notUndef, fn.name + " requires a pattern or channel");
|
|
3368
|
+
check(worker, notUndef, fn.name + " requires a saga parameter");
|
|
3369
|
+
};
|
|
3370
|
+
function takeLatest$1(patternOrChannel, worker) {
|
|
3371
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
3372
|
+
validateTakeEffect(takeLatest$1, patternOrChannel, worker);
|
|
3373
|
+
}
|
|
3374
|
+
|
|
3375
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
3376
|
+
args[_key2 - 2] = arguments[_key2];
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
return fork.apply(void 0, [takeLatest, patternOrChannel, worker].concat(args));
|
|
3380
|
+
}
|
|
3381
|
+
|
|
3382
|
+
var _marked = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
|
|
3383
|
+
var SUBMIT_ERROR = 'Something went wrong saving a drawing';
|
|
3384
|
+
var getSnackbarMessage = function getSnackbarMessage(areaName, id) {
|
|
3385
|
+
return "Drawing ".concat(areaName, " has been ").concat(id ? 'updated' : 'saved', "!");
|
|
3386
|
+
};
|
|
3387
|
+
function onOpenUiDialogSaga(_ref) {
|
|
3388
|
+
var payload = _ref.payload;
|
|
3389
|
+
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
3390
|
+
var type, mapId, drawUiType, areaManagerUiType, isDrawingOpen, isAreaManagerOpen;
|
|
3391
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
3392
|
+
while (1) switch (_context.prev = _context.next) {
|
|
3393
|
+
case 0:
|
|
3394
|
+
type = payload.type, mapId = payload.mapId;
|
|
3395
|
+
drawUiType = "".concat(uiTypes.DialogTypes.DockedDrawingTool, "-").concat(mapId);
|
|
3396
|
+
areaManagerUiType = uiTypes.DialogTypes.AreaManager;
|
|
3397
|
+
if (!(type === areaManagerUiType)) {
|
|
3398
|
+
_context.next = 10;
|
|
3399
|
+
break;
|
|
3400
|
+
}
|
|
3401
|
+
_context.next = 6;
|
|
3402
|
+
return select(uiSelectors.getisDialogOpen, drawUiType);
|
|
3403
|
+
case 6:
|
|
3404
|
+
isDrawingOpen = _context.sent;
|
|
3405
|
+
if (!isDrawingOpen) {
|
|
3406
|
+
_context.next = 10;
|
|
3407
|
+
break;
|
|
3408
|
+
}
|
|
3409
|
+
_context.next = 10;
|
|
3410
|
+
return put(uiActions.setToggleOpenDialog(Object.assign(Object.assign({}, payload), {
|
|
3411
|
+
type: drawUiType,
|
|
3412
|
+
setOpen: false
|
|
3413
|
+
})));
|
|
3414
|
+
case 10:
|
|
3415
|
+
if (!(type === drawUiType)) {
|
|
3416
|
+
_context.next = 17;
|
|
3417
|
+
break;
|
|
3418
|
+
}
|
|
3419
|
+
_context.next = 13;
|
|
3420
|
+
return select(uiSelectors.getisDialogOpen, areaManagerUiType);
|
|
3421
|
+
case 13:
|
|
3422
|
+
isAreaManagerOpen = _context.sent;
|
|
3423
|
+
if (!isAreaManagerOpen) {
|
|
3424
|
+
_context.next = 17;
|
|
3425
|
+
break;
|
|
3426
|
+
}
|
|
3427
|
+
_context.next = 17;
|
|
3428
|
+
return put(uiActions.setToggleOpenDialog(Object.assign(Object.assign({}, payload), {
|
|
3429
|
+
type: areaManagerUiType,
|
|
3430
|
+
setOpen: false
|
|
3431
|
+
})));
|
|
3432
|
+
case 17:
|
|
3433
|
+
case "end":
|
|
3434
|
+
return _context.stop();
|
|
3435
|
+
}
|
|
3436
|
+
}, _callee);
|
|
3437
|
+
})();
|
|
3438
|
+
}
|
|
3439
|
+
function submitDrawValuesSaga(_ref2) {
|
|
3440
|
+
var payload = _ref2.payload;
|
|
3441
|
+
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
3442
|
+
var mapId, id, formValues, dialogType, warningsApi, newID;
|
|
3443
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3444
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
3445
|
+
case 0:
|
|
3446
|
+
mapId = payload.mapId, id = payload.id, formValues = __rest(payload, ["mapId", "id"]);
|
|
3447
|
+
dialogType = "".concat(uiTypes.DialogTypes.DockedDrawingTool, "-").concat(mapId);
|
|
3448
|
+
_context2.prev = 2;
|
|
3449
|
+
_context2.next = 5;
|
|
3450
|
+
return put(uiActions.toggleIsLoadingDialog({
|
|
3451
|
+
isLoading: true,
|
|
3452
|
+
type: dialogType
|
|
3453
|
+
}));
|
|
3454
|
+
case 5:
|
|
3455
|
+
_context2.next = 7;
|
|
3456
|
+
return call(getWarningsApi);
|
|
3457
|
+
case 7:
|
|
3458
|
+
warningsApi = _context2.sent;
|
|
3459
|
+
if (id) {
|
|
3460
|
+
_context2.next = 16;
|
|
3461
|
+
break;
|
|
3462
|
+
}
|
|
3463
|
+
_context2.next = 11;
|
|
3464
|
+
return call(warningsApi.saveDrawingAs, formValues);
|
|
3465
|
+
case 11:
|
|
3466
|
+
newID = _context2.sent;
|
|
3467
|
+
_context2.next = 14;
|
|
3468
|
+
return put(drawActions.setDrawValues(Object.assign({
|
|
3469
|
+
mapId: mapId,
|
|
3470
|
+
id: newID
|
|
3471
|
+
}, formValues)));
|
|
3472
|
+
case 14:
|
|
3473
|
+
_context2.next = 18;
|
|
3474
|
+
break;
|
|
3475
|
+
case 16:
|
|
3476
|
+
_context2.next = 18;
|
|
3477
|
+
return call(warningsApi.updateDrawing, id, formValues);
|
|
3478
|
+
case 18:
|
|
3479
|
+
_context2.next = 20;
|
|
3480
|
+
return put(snackbarActions.openSnackbar({
|
|
3481
|
+
message: getSnackbarMessage(formValues.areaName, id)
|
|
3482
|
+
}));
|
|
3483
|
+
case 20:
|
|
3484
|
+
_context2.next = 22;
|
|
3485
|
+
return put(uiActions.toggleIsLoadingDialog({
|
|
3486
|
+
isLoading: false,
|
|
3487
|
+
type: dialogType
|
|
3488
|
+
}));
|
|
3489
|
+
case 22:
|
|
3490
|
+
_context2.next = 30;
|
|
3491
|
+
break;
|
|
3492
|
+
case 24:
|
|
3493
|
+
_context2.prev = 24;
|
|
3494
|
+
_context2.t0 = _context2["catch"](2);
|
|
3495
|
+
_context2.next = 28;
|
|
3496
|
+
return put(uiActions.toggleIsLoadingDialog({
|
|
3497
|
+
isLoading: false,
|
|
3498
|
+
type: dialogType
|
|
3499
|
+
}));
|
|
3500
|
+
case 28:
|
|
3501
|
+
_context2.next = 30;
|
|
3502
|
+
return put(uiActions.setErrorDialog({
|
|
3503
|
+
type: dialogType,
|
|
3504
|
+
error: SUBMIT_ERROR
|
|
3505
|
+
}));
|
|
3506
|
+
case 30:
|
|
3507
|
+
case "end":
|
|
3508
|
+
return _context2.stop();
|
|
3509
|
+
}
|
|
3510
|
+
}, _callee2, null, [[2, 24]]);
|
|
3511
|
+
})();
|
|
3512
|
+
}
|
|
3513
|
+
function drawingSaga() {
|
|
3514
|
+
return _regeneratorRuntime().wrap(function drawingSaga$(_context3) {
|
|
3515
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
3516
|
+
case 0:
|
|
3517
|
+
_context3.next = 2;
|
|
3518
|
+
return takeLatest$1(uiActions.setActiveMapIdForDialog, onOpenUiDialogSaga);
|
|
3519
|
+
case 2:
|
|
3520
|
+
_context3.next = 4;
|
|
3521
|
+
return takeLatest$1(drawActions.submitDrawValues, submitDrawValuesSaga);
|
|
3522
|
+
case 4:
|
|
3523
|
+
case "end":
|
|
3524
|
+
return _context3.stop();
|
|
3525
|
+
}
|
|
3526
|
+
}, _marked);
|
|
3527
|
+
}
|
|
3528
|
+
|
|
1
3529
|
/* *
|
|
2
3530
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
3531
|
* you may not use this file except in compliance with the License.
|
|
@@ -14,6 +3542,10 @@
|
|
|
14
3542
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
15
3543
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
16
3544
|
* */
|
|
17
|
-
var
|
|
3545
|
+
var drawingModuleConfig = {
|
|
3546
|
+
id: 'drawing-module',
|
|
3547
|
+
reducersMap: {},
|
|
3548
|
+
sagas: [drawingSaga]
|
|
3549
|
+
};
|
|
18
3550
|
|
|
19
|
-
export {
|
|
3551
|
+
export { AreaManagerConnect, AreaManagerMapButtonConnect, WarningsModuleProvider, drawingModuleConfig };
|