utopia-ui 3.0.99 → 3.0.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/Profile.cjs.js +1 -1
  2. package/dist/Profile.esm.js +1 -1
  3. package/dist/TagView-2jiLvob4.js +2536 -0
  4. package/dist/TagView-2jiLvob4.js.map +1 -0
  5. package/dist/TagView-BNJqfuzN.js +2475 -0
  6. package/dist/TagView-BNJqfuzN.js.map +1 -0
  7. package/dist/TagView-Blad8hua.js +2537 -0
  8. package/dist/TagView-Blad8hua.js.map +1 -0
  9. package/dist/TagView-C30AIcCd.js +2447 -0
  10. package/dist/TagView-C30AIcCd.js.map +1 -0
  11. package/dist/TagView-C39h3s-k.js +2446 -0
  12. package/dist/TagView-C39h3s-k.js.map +1 -0
  13. package/dist/TagView-C6Dx0Dh8.js +2421 -0
  14. package/dist/TagView-C6Dx0Dh8.js.map +1 -0
  15. package/dist/TagView-C6MBSYla.js +2458 -0
  16. package/dist/TagView-C6MBSYla.js.map +1 -0
  17. package/dist/TagView-CKy_mUeP.js +2452 -0
  18. package/dist/TagView-CKy_mUeP.js.map +1 -0
  19. package/dist/TagView-Cc1KiOit.js +2448 -0
  20. package/dist/TagView-Cc1KiOit.js.map +1 -0
  21. package/dist/TagView-Cmyr_keb.js +2534 -0
  22. package/dist/TagView-Cmyr_keb.js.map +1 -0
  23. package/dist/TagView-CnC-jC7a.js +2446 -0
  24. package/dist/TagView-CnC-jC7a.js.map +1 -0
  25. package/dist/TagView-Cwbv3fc4.js +2537 -0
  26. package/dist/TagView-Cwbv3fc4.js.map +1 -0
  27. package/dist/TagView-CyuG8PpX.js +2534 -0
  28. package/dist/TagView-CyuG8PpX.js.map +1 -0
  29. package/dist/TagView-D1LJxPBD.js +2536 -0
  30. package/dist/TagView-D1LJxPBD.js.map +1 -0
  31. package/dist/TagView-D6Fb7Bnn.js +2448 -0
  32. package/dist/TagView-D6Fb7Bnn.js.map +1 -0
  33. package/dist/TagView-D7I5i9Id.js +2447 -0
  34. package/dist/TagView-D7I5i9Id.js.map +1 -0
  35. package/dist/TagView-DAccEvdL.js +2449 -0
  36. package/dist/TagView-DAccEvdL.js.map +1 -0
  37. package/dist/TagView-DBnaw5Z_.js +2534 -0
  38. package/dist/TagView-DBnaw5Z_.js.map +1 -0
  39. package/dist/TagView-DOpvHy3K.js +2546 -0
  40. package/dist/TagView-DOpvHy3K.js.map +1 -0
  41. package/dist/TagView-DVEva51q.js +2447 -0
  42. package/dist/TagView-DVEva51q.js.map +1 -0
  43. package/dist/TagView-Dj1DIwd9.js +2563 -0
  44. package/dist/TagView-Dj1DIwd9.js.map +1 -0
  45. package/dist/TagView-DkD9R8Ks.js +2555 -0
  46. package/dist/TagView-DkD9R8Ks.js.map +1 -0
  47. package/dist/TagView-Dlo9w6sj.js +2555 -0
  48. package/dist/TagView-Dlo9w6sj.js.map +1 -0
  49. package/dist/TagView-FIrKNfyW.js +2546 -0
  50. package/dist/TagView-FIrKNfyW.js.map +1 -0
  51. package/dist/TagView-OejXbaY0.js +2449 -0
  52. package/dist/TagView-OejXbaY0.js.map +1 -0
  53. package/dist/TagView-PIFUvlwR.js +2447 -0
  54. package/dist/TagView-PIFUvlwR.js.map +1 -0
  55. package/dist/TagView-VEMo7xsv.js +2535 -0
  56. package/dist/TagView-VEMo7xsv.js.map +1 -0
  57. package/dist/TagView-bKNASls5.js +2535 -0
  58. package/dist/TagView-bKNASls5.js.map +1 -0
  59. package/dist/TagView-cU-_Gn3Y.js +2446 -0
  60. package/dist/TagView-cU-_Gn3Y.js.map +1 -0
  61. package/dist/TagView-dDwQhjw4.js +2467 -0
  62. package/dist/TagView-dDwQhjw4.js.map +1 -0
  63. package/dist/TagView-fKUf2qY8.js +2540 -0
  64. package/dist/TagView-fKUf2qY8.js.map +1 -0
  65. package/dist/TagView-fh0Ok5SJ.js +2535 -0
  66. package/dist/TagView-fh0Ok5SJ.js.map +1 -0
  67. package/dist/TagView-m_oIhU7B.js +2458 -0
  68. package/dist/TagView-m_oIhU7B.js.map +1 -0
  69. package/dist/TagView-owB0HoNH.js +2535 -0
  70. package/dist/TagView-owB0HoNH.js.map +1 -0
  71. package/dist/TagView-rCv-3rVA.js +2467 -0
  72. package/dist/TagView-rCv-3rVA.js.map +1 -0
  73. package/dist/TagView-sqUMjBmG.js +2508 -0
  74. package/dist/TagView-sqUMjBmG.js.map +1 -0
  75. package/dist/index.cjs.js +12 -7
  76. package/dist/index.cjs.js.map +1 -1
  77. package/dist/index.esm.js +13 -8
  78. package/dist/index.esm.js.map +1 -1
  79. package/dist/types/src/Components/Map/Subcomponents/SelectPosition.d.ts +5 -2
  80. package/package.json +1 -1
@@ -0,0 +1,2535 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+ var reactToastify = require('react-toastify');
6
+ var require$$0 = require('leaflet');
7
+ var Markdown = require('react-markdown');
8
+ var remarkBreaks = require('remark-breaks');
9
+ var reactRouterDom = require('react-router-dom');
10
+ var SVG = require('react-inlinesvg');
11
+
12
+ function _interopNamespaceDefault(e) {
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
30
+
31
+ const ClusterRefContext = React.createContext({
32
+ clusterRef: {},
33
+ setClusterRef: () => { },
34
+ });
35
+ function useClusterRefManager() {
36
+ const [clusterRef, setClusterRef] = React.useState({});
37
+ return { clusterRef, setClusterRef };
38
+ }
39
+ const ClusterRefProvider = ({ children }) => (jsxRuntime.jsx(ClusterRefContext.Provider, { value: useClusterRefManager(), children: children }));
40
+ const useClusterRef = () => {
41
+ const { clusterRef } = React.useContext(ClusterRefContext);
42
+ return clusterRef;
43
+ };
44
+ const useSetClusterRef = () => {
45
+ const { setClusterRef } = React.useContext(ClusterRefContext);
46
+ return setClusterRef;
47
+ };
48
+
49
+ const LayerContext = React.createContext({
50
+ layers: [],
51
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
52
+ addLayer: () => { },
53
+ });
54
+ function useLayerManager(initialLayers) {
55
+ const [layers, dispatch] = React.useReducer((state, action) => {
56
+ switch (action.type) {
57
+ case 'ADD LAYER':
58
+ // eslint-disable-next-line no-case-declarations
59
+ const exist = state.find((layer) => layer.name === action.layer.name);
60
+ if (!exist) {
61
+ return [...state, action.layer];
62
+ }
63
+ else
64
+ return state;
65
+ default:
66
+ throw new Error();
67
+ }
68
+ }, initialLayers);
69
+ const addLayer = React.useCallback((layer) => {
70
+ dispatch({
71
+ type: 'ADD LAYER',
72
+ layer,
73
+ });
74
+ }, []);
75
+ return { layers, addLayer };
76
+ }
77
+ const LayersProvider = ({ initialLayers, children }) => (jsxRuntime.jsx(LayerContext.Provider, { value: useLayerManager(initialLayers), children: children }));
78
+ const useLayers = () => {
79
+ const { layers } = React.useContext(LayerContext);
80
+ return layers;
81
+ };
82
+ const useAddLayer = () => {
83
+ const { addLayer } = React.useContext(LayerContext);
84
+ return addLayer;
85
+ };
86
+
87
+ function getWindowDimensions() {
88
+ const { innerWidth: width, innerHeight: height } = window;
89
+ return {
90
+ width,
91
+ height,
92
+ };
93
+ }
94
+ function useWindowDimensions() {
95
+ const [windowDimensions, setWindowDimensions] = React.useState(getWindowDimensions());
96
+ React.useEffect(() => {
97
+ function handleResize() {
98
+ setWindowDimensions(getWindowDimensions());
99
+ }
100
+ window.addEventListener('resize', handleResize);
101
+ return () => window.removeEventListener('resize', handleResize);
102
+ }, []);
103
+ return windowDimensions;
104
+ }
105
+
106
+ const FilterContext = React.createContext({
107
+ filterTags: [],
108
+ searchPhrase: '',
109
+ visibleLayers: [],
110
+ visibleGroupTypes: [],
111
+ addFilterTag: () => { },
112
+ removeFilterTag: () => { },
113
+ resetFilterTags: () => { },
114
+ setSearchPhrase: () => { },
115
+ addVisibleLayer: () => { },
116
+ toggleVisibleLayer: () => { },
117
+ resetVisibleLayers: () => { },
118
+ isLayerVisible: () => true,
119
+ addVisibleGroupType: () => { },
120
+ toggleVisibleGroupType: () => { },
121
+ isGroupTypeVisible: () => true,
122
+ });
123
+ function useFilterManager(initialTags) {
124
+ const [filterTags, dispatchTags] = React.useReducer((state, action) => {
125
+ switch (action.type) {
126
+ case 'ADD_TAG':
127
+ const exist = state.find((tag) => tag.id === action.tag.id);
128
+ if (!exist) {
129
+ return [...state, action.tag];
130
+ }
131
+ else
132
+ return state;
133
+ case 'REMOVE_TAG':
134
+ return state.filter(({ name }) => name !== action.name);
135
+ case 'RESET_TAGS':
136
+ return initialTags;
137
+ default:
138
+ throw new Error();
139
+ }
140
+ }, initialTags);
141
+ const initialLayers = useLayers();
142
+ const navigate = reactRouterDom.useNavigate();
143
+ const windowDimensions = useWindowDimensions();
144
+ const [visibleLayers, dispatchLayers] = React.useReducer((state, action) => {
145
+ switch (action.type) {
146
+ case 'ADD_LAYER':
147
+ const exist1 = state.find((layer) => layer.name === action.layer.name);
148
+ if (!exist1) {
149
+ return [...state, action.layer];
150
+ }
151
+ else
152
+ return state;
153
+ case 'TOGGLE_LAYER':
154
+ const exist2 = state.some((layer) => layer.name === action.layer.name);
155
+ if (exist2)
156
+ return state.filter(({ name }) => name !== action.layer.name);
157
+ else
158
+ return [...state, action.layer];
159
+ case 'RESET_LAYERS':
160
+ return initialLayers;
161
+ default:
162
+ throw new Error();
163
+ }
164
+ }, initialLayers);
165
+ const allLayers = useLayers();
166
+ React.useEffect(() => {
167
+ if (allLayers.length === 0)
168
+ return;
169
+ const visibleNames = visibleLayers.map((l) => l.name);
170
+ const allNames = allLayers.map((l) => l.name);
171
+ const params = new URLSearchParams(location.search);
172
+ const allVisible = visibleNames.length === allNames.length &&
173
+ visibleNames.every((name) => allNames.includes(name));
174
+ if (allVisible) {
175
+ params.delete('layers');
176
+ }
177
+ else {
178
+ params.set('layers', visibleNames.join(','));
179
+ }
180
+ navigate(`${location.pathname}?${params.toString()}`, { replace: true });
181
+ }, [visibleLayers, allLayers, navigate]);
182
+ const [visibleGroupTypes, dispatchGroupTypes] = React.useReducer((state, action) => {
183
+ switch (action.type) {
184
+ case 'ADD_GROUP_TYPE':
185
+ const exist1 = state.find((groupType) => groupType === action.groupType);
186
+ if (!exist1) {
187
+ return [...state, action.groupType];
188
+ }
189
+ else
190
+ return state;
191
+ case 'TOGGLE_GROUP_TYPE':
192
+ const exist2 = state.some((groupType) => groupType === action.groupType);
193
+ if (exist2)
194
+ return state.filter((groupType) => groupType !== action.groupType);
195
+ else
196
+ return [...state, action.groupType];
197
+ case 'RESET_GROUP_TYPE':
198
+ return [];
199
+ default:
200
+ throw new Error();
201
+ }
202
+ }, []);
203
+ const [searchPhrase, searchPhraseSet] = React.useState('');
204
+ const addFilterTag = React.useCallback((tag) => {
205
+ const params = new URLSearchParams(location.search);
206
+ const urlTags = params.get('tags');
207
+ const decodedTags = urlTags ? decodeURIComponent(urlTags) : '';
208
+ if (!decodedTags.includes(tag.name)) {
209
+ params.set('tags', `${urlTags || ''}${urlTags ? ';' : ''}${tag.name}`);
210
+ }
211
+ if (windowDimensions.width < 786 && location.pathname.split('/').length > 2)
212
+ navigate('/' + `${params ? `?${params}` : ''}`);
213
+ else
214
+ navigate(location.pathname + `${params ? `?${params}` : ''}`);
215
+ dispatchTags({
216
+ type: 'ADD_TAG',
217
+ tag,
218
+ });
219
+ // eslint-disable-next-line react-hooks/exhaustive-deps
220
+ }, []);
221
+ const removeFilterTag = React.useCallback((name) => {
222
+ const params = new URLSearchParams(window.location.search);
223
+ const urlTags = params.get('tags');
224
+ let newUrlTags = '';
225
+ const tags = urlTags?.split(';');
226
+ if (tags?.length === 0 && urlTags?.length && urlTags.length > 0)
227
+ tags[0] = urlTags;
228
+ tags?.map((urlTag) => {
229
+ if (!(urlTag.toLocaleLowerCase() === name.toLocaleLowerCase())) {
230
+ newUrlTags = newUrlTags + `${newUrlTags === '' ? urlTag : `;${urlTag}`}`;
231
+ }
232
+ return null;
233
+ });
234
+ if (newUrlTags !== '') {
235
+ params.set('tags', `${newUrlTags}`);
236
+ navigate(location.pathname + `${params ? `?${params}` : ''}`);
237
+ }
238
+ else {
239
+ params.delete('tags');
240
+ navigate(location.pathname + `${params ? `?${params}` : ''}`);
241
+ }
242
+ dispatchTags({
243
+ type: 'REMOVE_TAG',
244
+ name,
245
+ });
246
+ // eslint-disable-next-line react-hooks/exhaustive-deps
247
+ }, []);
248
+ const resetFilterTags = React.useCallback(() => {
249
+ dispatchTags({
250
+ type: 'RESET_TAGS',
251
+ });
252
+ }, []);
253
+ const addVisibleLayer = (layer) => {
254
+ dispatchLayers({
255
+ type: 'ADD_LAYER',
256
+ layer,
257
+ });
258
+ };
259
+ const toggleVisibleLayer = (layer) => {
260
+ dispatchLayers({
261
+ type: 'TOGGLE_LAYER',
262
+ layer,
263
+ });
264
+ };
265
+ const resetVisibleLayers = React.useCallback(() => {
266
+ dispatchLayers({
267
+ type: 'RESET_LAYERS',
268
+ });
269
+ }, []);
270
+ const isLayerVisible = React.useCallback((layer) => {
271
+ return visibleLayers.some((l) => l.name === layer.name);
272
+ }, [visibleLayers]);
273
+ const addVisibleGroupType = (groupType) => {
274
+ dispatchGroupTypes({
275
+ type: 'ADD_GROUP_TYPE',
276
+ groupType,
277
+ });
278
+ };
279
+ const toggleVisibleGroupType = (groupType) => {
280
+ dispatchGroupTypes({
281
+ type: 'TOGGLE_GROUP_TYPE',
282
+ groupType,
283
+ });
284
+ };
285
+ const isGroupTypeVisible = React.useCallback((groupType) => {
286
+ return visibleGroupTypes.some((gt) => gt === groupType);
287
+ }, [visibleGroupTypes]);
288
+ const setSearchPhrase = React.useCallback((phrase) => {
289
+ searchPhraseSet(phrase);
290
+ }, []);
291
+ return {
292
+ filterTags,
293
+ addFilterTag,
294
+ removeFilterTag,
295
+ resetFilterTags,
296
+ setSearchPhrase,
297
+ searchPhrase,
298
+ visibleLayers,
299
+ toggleVisibleLayer,
300
+ resetVisibleLayers,
301
+ isLayerVisible,
302
+ addVisibleLayer,
303
+ visibleGroupTypes,
304
+ addVisibleGroupType,
305
+ toggleVisibleGroupType,
306
+ isGroupTypeVisible,
307
+ };
308
+ }
309
+ const FilterProvider = ({ initialTags, children }) => (jsxRuntime.jsx(FilterContext.Provider, { value: useFilterManager(initialTags), children: children }));
310
+ const useFilterTags = () => {
311
+ const { filterTags } = React.useContext(FilterContext);
312
+ return filterTags;
313
+ };
314
+ const useAddFilterTag = () => {
315
+ const { addFilterTag } = React.useContext(FilterContext);
316
+ return addFilterTag;
317
+ };
318
+ const useRemoveFilterTag = () => {
319
+ const { removeFilterTag } = React.useContext(FilterContext);
320
+ return removeFilterTag;
321
+ };
322
+ const useResetFilterTags = () => {
323
+ const { resetFilterTags } = React.useContext(FilterContext);
324
+ return resetFilterTags;
325
+ };
326
+ const useAddVisibleLayer = () => {
327
+ const { addVisibleLayer } = React.useContext(FilterContext);
328
+ return addVisibleLayer;
329
+ };
330
+ const useToggleVisibleLayer = () => {
331
+ const { toggleVisibleLayer } = React.useContext(FilterContext);
332
+ return toggleVisibleLayer;
333
+ };
334
+ const useIsLayerVisible = () => {
335
+ const { isLayerVisible } = React.useContext(FilterContext);
336
+ return isLayerVisible;
337
+ };
338
+ const useAddVisibleGroupType = () => {
339
+ const { addVisibleGroupType } = React.useContext(FilterContext);
340
+ return addVisibleGroupType;
341
+ };
342
+ const useToggleVisibleGroupType = () => {
343
+ const { toggleVisibleGroupType } = React.useContext(FilterContext);
344
+ return toggleVisibleGroupType;
345
+ };
346
+ const useIsGroupTypeVisible = () => {
347
+ const { isGroupTypeVisible } = React.useContext(FilterContext);
348
+ return isGroupTypeVisible;
349
+ };
350
+ const useVisibleGroupType = () => {
351
+ const { visibleGroupTypes } = React.useContext(FilterContext);
352
+ return visibleGroupTypes;
353
+ };
354
+
355
+ const ItemContext = React.createContext({
356
+ items: [],
357
+ addItem: () => { },
358
+ updateItem: () => { },
359
+ removeItem: () => { },
360
+ resetItems: () => { },
361
+ setItemsApi: () => { },
362
+ setItemsData: () => { },
363
+ allItemsLoaded: false,
364
+ });
365
+ function useItemsManager(initialItems) {
366
+ const addLayer = useAddLayer();
367
+ const [allItemsLoaded, setallItemsLoaded] = React.useState(false);
368
+ const [items, dispatch] = React.useReducer((state, action) => {
369
+ switch (action.type) {
370
+ case 'ADD':
371
+ // eslint-disable-next-line no-case-declarations
372
+ const exist = state.find((item) => item.id === action.item.id);
373
+ if (!exist) {
374
+ return [...state, action.item];
375
+ }
376
+ else
377
+ return state;
378
+ case 'UPDATE':
379
+ return state.map((item) => {
380
+ if (item.id === action.item.id) {
381
+ return action.item;
382
+ }
383
+ return item;
384
+ });
385
+ case 'REMOVE':
386
+ return state.filter((item) => item !== action.item);
387
+ case 'RESET':
388
+ return state.filter((item) => item.layer?.name !== action.layer.name);
389
+ default:
390
+ throw new Error();
391
+ }
392
+ }, initialItems);
393
+ const setItemsApi = React.useCallback(async (layer) => {
394
+ addLayer(layer);
395
+ const result = await reactToastify.toast.promise(layer.api.getItems(), {
396
+ pending: `loading ${layer.name} ...`,
397
+ success: `${layer.name} loaded`,
398
+ error: {
399
+ render({ data }) {
400
+ return `${data}`;
401
+ },
402
+ },
403
+ });
404
+ result.map((item) => {
405
+ dispatch({ type: 'ADD', item: { ...item, layer } });
406
+ return null;
407
+ });
408
+ setallItemsLoaded(true);
409
+ // eslint-disable-next-line react-hooks/exhaustive-deps
410
+ }, []);
411
+ const setItemsData = React.useCallback((layer) => {
412
+ addLayer(layer);
413
+ layer.data?.map((item) => {
414
+ dispatch({ type: 'ADD', item: { ...item, layer } });
415
+ return null;
416
+ });
417
+ setallItemsLoaded(true);
418
+ // eslint-disable-next-line react-hooks/exhaustive-deps
419
+ }, []);
420
+ const addItem = React.useCallback(async (item) => {
421
+ dispatch({
422
+ type: 'ADD',
423
+ item,
424
+ });
425
+ }, []);
426
+ const updateItem = React.useCallback(async (item) => {
427
+ dispatch({
428
+ type: 'UPDATE',
429
+ item,
430
+ });
431
+ }, []);
432
+ const removeItem = React.useCallback((item) => {
433
+ dispatch({
434
+ type: 'REMOVE',
435
+ item,
436
+ });
437
+ }, []);
438
+ const resetItems = React.useCallback((layer) => {
439
+ dispatch({
440
+ type: 'RESET',
441
+ layer,
442
+ });
443
+ }, []);
444
+ return {
445
+ items,
446
+ updateItem,
447
+ addItem,
448
+ removeItem,
449
+ resetItems,
450
+ setItemsApi,
451
+ setItemsData,
452
+ allItemsLoaded,
453
+ };
454
+ }
455
+ const ItemsProvider = ({ initialItems, children }) => (jsxRuntime.jsx(ItemContext.Provider, { value: useItemsManager(initialItems), children: children }));
456
+ const useItems = () => {
457
+ const { items } = React.useContext(ItemContext);
458
+ return items;
459
+ };
460
+ const useAddItem = () => {
461
+ const { addItem } = React.useContext(ItemContext);
462
+ return addItem;
463
+ };
464
+ const useUpdateItem = () => {
465
+ const { updateItem } = React.useContext(ItemContext);
466
+ return updateItem;
467
+ };
468
+ const useRemoveItem = () => {
469
+ const { removeItem } = React.useContext(ItemContext);
470
+ return removeItem;
471
+ };
472
+ const useSetItemsApi = () => {
473
+ const { setItemsApi } = React.useContext(ItemContext);
474
+ return setItemsApi;
475
+ };
476
+ const useSetItemsData = () => {
477
+ const { setItemsData } = React.useContext(ItemContext);
478
+ return setItemsData;
479
+ };
480
+ const useAllItemsLoaded = () => {
481
+ const { allItemsLoaded } = React.useContext(ItemContext);
482
+ return allItemsLoaded;
483
+ };
484
+
485
+ const LeafletRefsContext = React.createContext({
486
+ leafletRefs: {},
487
+ addMarker: () => { },
488
+ addPopup: () => { },
489
+ });
490
+ function useLeafletRefsManager(initialLeafletRefs) {
491
+ const [leafletRefs, dispatch] = React.useReducer((state, action) => {
492
+ switch (action.type) {
493
+ case 'ADD_MARKER':
494
+ return {
495
+ ...state,
496
+ [action.item.id]: {
497
+ ...state[action.item.id],
498
+ marker: action.marker,
499
+ item: action.item,
500
+ },
501
+ };
502
+ case 'ADD_POPUP':
503
+ return {
504
+ ...state,
505
+ [action.item.id]: { ...state[action.item.id], popup: action.popup, item: action.item },
506
+ };
507
+ default:
508
+ throw new Error();
509
+ }
510
+ }, initialLeafletRefs);
511
+ const addMarker = React.useCallback((item, marker) => {
512
+ dispatch({
513
+ type: 'ADD_MARKER',
514
+ item,
515
+ marker,
516
+ });
517
+ }, []);
518
+ const addPopup = React.useCallback((item, popup) => {
519
+ dispatch({
520
+ type: 'ADD_POPUP',
521
+ item,
522
+ popup,
523
+ });
524
+ }, []);
525
+ return { leafletRefs, addMarker, addPopup };
526
+ }
527
+ const LeafletRefsProvider = ({ initialLeafletRefs, children }) => (jsxRuntime.jsx(LeafletRefsContext.Provider, { value: useLeafletRefsManager(initialLeafletRefs), children: children }));
528
+ const useLeafletRefs = () => {
529
+ const { leafletRefs } = React.useContext(LeafletRefsContext);
530
+ return leafletRefs;
531
+ };
532
+ const useAddMarker = () => {
533
+ const { addMarker } = React.useContext(LeafletRefsContext);
534
+ return addMarker;
535
+ };
536
+ const useAddPopup = () => {
537
+ const { addPopup } = React.useContext(LeafletRefsContext);
538
+ return addPopup;
539
+ };
540
+
541
+ const AuthContext = React.createContext({
542
+ isAuthenticated: false,
543
+ user: null,
544
+ login: () => Promise.reject(Error('Unimplemented')),
545
+ register: () => Promise.reject(Error('Unimplemented')),
546
+ loading: false,
547
+ logout: () => Promise.reject(Error('Unimplemented')),
548
+ updateUser: () => Promise.reject(Error('Unimplemented')),
549
+ token: '',
550
+ requestPasswordReset: () => Promise.reject(Error('Unimplemented')),
551
+ passwordReset: () => Promise.reject(Error('Unimplemented')),
552
+ });
553
+ /**
554
+ * @category Auth
555
+ */
556
+ const AuthProvider = ({ userApi, children }) => {
557
+ const [user, setUser] = React.useState(null);
558
+ const [token, setToken] = React.useState();
559
+ const [loading, setLoading] = React.useState(false);
560
+ const isAuthenticated = !!user;
561
+ React.useEffect(() => {
562
+ setLoading(true);
563
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
564
+ loadUser();
565
+ setLoading(false);
566
+ // eslint-disable-next-line react-hooks/exhaustive-deps
567
+ }, []);
568
+ async function loadUser() {
569
+ try {
570
+ const token = await userApi.getToken();
571
+ setToken(token);
572
+ if (token) {
573
+ const me = await userApi.getUser();
574
+ setUser(me);
575
+ setLoading(false);
576
+ return me;
577
+ }
578
+ else
579
+ return undefined;
580
+ // eslint-disable-next-line no-catch-all/no-catch-all
581
+ }
582
+ catch (error) {
583
+ setLoading(false);
584
+ return undefined;
585
+ }
586
+ }
587
+ const login = async (credentials) => {
588
+ setLoading(true);
589
+ try {
590
+ const user = await userApi.login(credentials.email, credentials.password);
591
+ setToken(user?.access_token);
592
+ return await loadUser();
593
+ }
594
+ catch (error) {
595
+ setLoading(false);
596
+ throw error;
597
+ }
598
+ };
599
+ const register = async (credentials, userName) => {
600
+ setLoading(true);
601
+ try {
602
+ /* const res = */ await userApi.register(credentials.email, credentials.password, userName);
603
+ return await login(credentials);
604
+ }
605
+ catch (error) {
606
+ setLoading(false);
607
+ throw error;
608
+ }
609
+ };
610
+ const logout = async () => {
611
+ try {
612
+ await userApi.logout();
613
+ setUser(null);
614
+ }
615
+ catch (error) {
616
+ setLoading(false);
617
+ throw error;
618
+ }
619
+ };
620
+ const updateUser = async (user) => {
621
+ setLoading(true);
622
+ try {
623
+ const updatedUser = await userApi.updateUser(user);
624
+ setUser(updatedUser);
625
+ await loadUser();
626
+ setLoading(false);
627
+ return updatedUser;
628
+ }
629
+ catch (error) {
630
+ setLoading(false);
631
+ throw error;
632
+ }
633
+ };
634
+ const requestPasswordReset = async (email, resetUrl) => {
635
+ setLoading(true);
636
+ try {
637
+ await userApi.requestPasswordReset(email, resetUrl);
638
+ return setLoading(false);
639
+ }
640
+ catch (error) {
641
+ setLoading(false);
642
+ throw error;
643
+ }
644
+ };
645
+ const passwordReset = async (token, newPassword) => {
646
+ setLoading(true);
647
+ try {
648
+ await userApi.passwordReset(token, newPassword);
649
+ return setLoading(false);
650
+ }
651
+ catch (error) {
652
+ setLoading(false);
653
+ throw error;
654
+ }
655
+ };
656
+ return (jsxRuntime.jsx(AuthContext.Provider, { value: {
657
+ isAuthenticated,
658
+ user,
659
+ login,
660
+ register,
661
+ loading,
662
+ logout,
663
+ updateUser,
664
+ token,
665
+ requestPasswordReset,
666
+ passwordReset,
667
+ }, children: children }));
668
+ };
669
+ const useAuth = () => React.useContext(AuthContext);
670
+
671
+ const PermissionContext = React.createContext({
672
+ permissions: [],
673
+ setPermissionApi: () => { },
674
+ setPermissionData: () => { },
675
+ setAdminRole: () => { },
676
+ hasUserPermission: () => true,
677
+ });
678
+ function usePermissionsManager(initialPermissions) {
679
+ const [permissions, dispatch] = React.useReducer((state, action) => {
680
+ switch (action.type) {
681
+ case 'ADD':
682
+ // eslint-disable-next-line no-case-declarations
683
+ const exist = state.find((permission) => permission.id === action.permission.id);
684
+ if (!exist) {
685
+ return [...state, action.permission];
686
+ }
687
+ else
688
+ return state;
689
+ case 'REMOVE':
690
+ return state.filter(({ id }) => id !== action.id);
691
+ default:
692
+ throw new Error();
693
+ }
694
+ }, initialPermissions);
695
+ const [adminRole, setAdminRole] = React.useState(null);
696
+ const { user } = useAuth();
697
+ const setPermissionApi = React.useCallback(async (api) => {
698
+ const result = await api.getItems();
699
+ result.map((permission) => {
700
+ dispatch({ type: 'ADD', permission });
701
+ return null;
702
+ });
703
+ }, []);
704
+ const setPermissionData = React.useCallback((data) => {
705
+ data.map((permission) => {
706
+ dispatch({ type: 'ADD', permission });
707
+ return null;
708
+ });
709
+ }, []);
710
+ const hasUserPermission = React.useCallback((collectionName, action, item, layer) => {
711
+ const evaluateCondition = (condition) => {
712
+ if (condition.user_created?._eq === '$CURRENT_USER') {
713
+ return item?.user_created?.id === user?.id;
714
+ }
715
+ if (condition.public_edit?._eq === true) {
716
+ return item?.public_edit === true;
717
+ }
718
+ return false;
719
+ };
720
+ const evaluatePermissions = (permissionConditions) => {
721
+ if (!permissionConditions?._and) {
722
+ return true;
723
+ }
724
+ return permissionConditions._and.every((andCondition) => andCondition._or
725
+ ? andCondition._or.some((orCondition) => evaluateCondition(orCondition))
726
+ : evaluateCondition(andCondition));
727
+ };
728
+ if (collectionName === 'items' && action === 'create' && layer?.public_edit_items)
729
+ return true;
730
+ // Bedingung für leere Berechtigungen nur, wenn NICHT item und create
731
+ if (permissions.length === 0)
732
+ return true;
733
+ else if (user && user.role?.id === adminRole)
734
+ return true;
735
+ else {
736
+ return permissions.some((p) => p.action === action &&
737
+ p.collection === collectionName &&
738
+ ((p.policy?.name === user?.role?.name &&
739
+ (!item || evaluatePermissions(p.permissions))) ||
740
+ (p.policy?.name === '$t:public_label' &&
741
+ (layer?.public_edit_items || item?.layer?.public_edit_items) &&
742
+ (!item || evaluatePermissions(p.permissions)))));
743
+ }
744
+ }, [permissions, user, adminRole]);
745
+ return { permissions, setPermissionApi, setPermissionData, setAdminRole, hasUserPermission };
746
+ }
747
+ const PermissionsProvider = ({ initialPermissions, children, }) => (jsxRuntime.jsx(PermissionContext.Provider, { value: usePermissionsManager(initialPermissions), children: children }));
748
+ const useSetPermissionApi = () => {
749
+ const { setPermissionApi } = React.useContext(PermissionContext);
750
+ return setPermissionApi;
751
+ };
752
+ const useSetPermissionData = () => {
753
+ const { setPermissionData } = React.useContext(PermissionContext);
754
+ return setPermissionData;
755
+ };
756
+ const useHasUserPermission = () => {
757
+ const { hasUserPermission } = React.useContext(PermissionContext);
758
+ return hasUserPermission;
759
+ };
760
+ const useSetAdminRole = () => {
761
+ const { setAdminRole } = React.useContext(PermissionContext);
762
+ return setAdminRole;
763
+ };
764
+
765
+ const SelectPositionContext = React.createContext({
766
+ selectPosition: null,
767
+ setSelectPosition: () => { },
768
+ setMarkerClicked: () => { },
769
+ setMapClicked: () => { },
770
+ });
771
+ function useSelectPositionManager() {
772
+ const [selectPosition, setSelectPosition] = React.useState(null);
773
+ const [markerClicked, setMarkerClicked] = React.useState();
774
+ const [mapClicked, setMapClicked] = React.useState();
775
+ const updateItem = useUpdateItem();
776
+ const hasUserPermission = useHasUserPermission();
777
+ React.useEffect(() => {
778
+ if (selectPosition &&
779
+ markerClicked &&
780
+ 'text' in selectPosition &&
781
+ markerClicked.id !== selectPosition.id) {
782
+ itemUpdateParent({ ...selectPosition, parent: markerClicked.id });
783
+ }
784
+ // eslint-disable-next-line react-hooks/exhaustive-deps
785
+ }, [markerClicked]);
786
+ React.useEffect(() => {
787
+ if (selectPosition != null) {
788
+ // selectPosition can be null, Layer or Item
789
+ if ('menuIcon' in selectPosition) {
790
+ // if selectPosition is a Layer
791
+ mapClicked &&
792
+ mapClicked.setItemFormPopup({
793
+ layer: selectPosition,
794
+ position: mapClicked.position,
795
+ });
796
+ setSelectPosition(null);
797
+ }
798
+ if ('text' in selectPosition) {
799
+ // if selectPosition is an Item
800
+ const position = mapClicked?.position.lng &&
801
+ {
802
+ type: 'Point',
803
+ coordinates: [mapClicked.position.lng, mapClicked.position.lat],
804
+ };
805
+ position && itemUpdatePosition({ ...selectPosition, position });
806
+ setSelectPosition(null);
807
+ }
808
+ }
809
+ // eslint-disable-next-line react-hooks/exhaustive-deps
810
+ }, [mapClicked]);
811
+ const itemUpdateParent = async (updatedItem) => {
812
+ if (markerClicked?.layer?.api?.collectionName &&
813
+ hasUserPermission(markerClicked.layer.api.collectionName, 'update', markerClicked)) {
814
+ let success = false;
815
+ reactToastify.toast.loading('Updating item position');
816
+ try {
817
+ await updatedItem.layer?.api?.updateItem({
818
+ id: updatedItem.id,
819
+ parent: updatedItem.parent,
820
+ position: null,
821
+ });
822
+ success = true;
823
+ // eslint-disable-next-line no-catch-all/no-catch-all
824
+ }
825
+ catch (error) {
826
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
827
+ reactToastify.toast.error(error.toString());
828
+ }
829
+ if (success) {
830
+ await updateItem({ ...updatedItem, parent: updatedItem.parent, position: undefined });
831
+ await linkItem(updatedItem.id);
832
+ reactToastify.toast.success('Item position updated');
833
+ setSelectPosition(null);
834
+ setMarkerClicked(null);
835
+ }
836
+ }
837
+ else {
838
+ setSelectPosition(null);
839
+ reactToastify.toast.error("you don't have permission to add items to " + markerClicked?.name);
840
+ }
841
+ };
842
+ const itemUpdatePosition = async (updatedItem) => {
843
+ let success = false;
844
+ try {
845
+ await updatedItem.layer?.api?.updateItem({
846
+ id: updatedItem.id,
847
+ position: updatedItem.position,
848
+ });
849
+ success = true;
850
+ // eslint-disable-next-line no-catch-all/no-catch-all
851
+ }
852
+ catch (error) {
853
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
854
+ reactToastify.toast.error(error.toString());
855
+ }
856
+ if (success) {
857
+ updateItem(updatedItem);
858
+ reactToastify.toast.success('Item position updated');
859
+ }
860
+ };
861
+ const linkItem = async (id) => {
862
+ if (markerClicked) {
863
+ const newRelations = markerClicked.relations || [];
864
+ if (!newRelations.some((r) => r.related_items_id === id)) {
865
+ newRelations.push({ items_id: markerClicked.id, related_items_id: id });
866
+ const updatedItem = { id: markerClicked.id, relations: newRelations };
867
+ let success = false;
868
+ try {
869
+ await markerClicked.layer?.api?.updateItem(updatedItem);
870
+ success = true;
871
+ // eslint-disable-next-line no-catch-all/no-catch-all
872
+ }
873
+ catch (error) {
874
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
875
+ reactToastify.toast.error(error.toString());
876
+ }
877
+ if (success) {
878
+ updateItem({ ...markerClicked, relations: newRelations });
879
+ reactToastify.toast.success('Item linked');
880
+ }
881
+ }
882
+ }
883
+ };
884
+ return { selectPosition, setSelectPosition, setMarkerClicked, setMapClicked };
885
+ }
886
+ const SelectPositionProvider = ({ children }) => (jsxRuntime.jsx(SelectPositionContext.Provider, { value: useSelectPositionManager(), children: children }));
887
+ const useSelectPosition = () => {
888
+ const { selectPosition } = React.useContext(SelectPositionContext);
889
+ return selectPosition;
890
+ };
891
+ const useSetSelectPosition = () => {
892
+ const { setSelectPosition } = React.useContext(SelectPositionContext);
893
+ return setSelectPosition;
894
+ };
895
+ const useSetMarkerClicked = () => {
896
+ const { setMarkerClicked } = React.useContext(SelectPositionContext);
897
+ return setMarkerClicked;
898
+ };
899
+ const useSetMapClicked = () => {
900
+ const { setMapClicked } = React.useContext(SelectPositionContext);
901
+ return setMapClicked;
902
+ };
903
+
904
+ const hashTagRegex = /(#+[a-zA-Z0-9À-ÖØ-öø-ʸ_-]{1,})/g;
905
+
906
+ const TagContext = React.createContext({
907
+ tags: [],
908
+ addTag: () => { },
909
+ setTagApi: () => { },
910
+ setTagData: () => { },
911
+ getItemTags: () => [],
912
+ allTagsLoaded: false,
913
+ });
914
+ function useTagsManager(initialTags) {
915
+ const [allTagsLoaded, setallTagsLoaded] = React.useState(false);
916
+ const [tagCount, setTagCount] = React.useState(0);
917
+ const [tags, dispatch] = React.useReducer((state, action) => {
918
+ switch (action.type) {
919
+ case 'ADD':
920
+ // eslint-disable-next-line no-case-declarations
921
+ const exist = state.find((tag) => tag.name.toLocaleLowerCase() === action.tag.name.toLocaleLowerCase());
922
+ if (!exist) {
923
+ const newState = [...state, { ...action.tag }];
924
+ if (tagCount === newState.length)
925
+ setallTagsLoaded(true);
926
+ return newState;
927
+ }
928
+ else
929
+ return state;
930
+ default:
931
+ throw new Error();
932
+ }
933
+ }, initialTags);
934
+ const [api, setApi] = React.useState({});
935
+ const setTagApi = React.useCallback(async (api) => {
936
+ setApi(api);
937
+ const result = await api.getItems();
938
+ setTagCount(result.length);
939
+ if (tagCount === 0)
940
+ setallTagsLoaded(true);
941
+ if (result) {
942
+ result.map((tag) => {
943
+ // tag.name = tag.name.toLocaleLowerCase();
944
+ dispatch({ type: 'ADD', tag });
945
+ return null;
946
+ });
947
+ }
948
+ // eslint-disable-next-line react-hooks/exhaustive-deps
949
+ }, []);
950
+ const setTagData = React.useCallback((data) => {
951
+ data.map((tag) => {
952
+ // tag.name = tag.name.toLocaleLowerCase();
953
+ dispatch({ type: 'ADD', tag });
954
+ return null;
955
+ });
956
+ }, []);
957
+ const addTag = (tag) => {
958
+ dispatch({
959
+ type: 'ADD',
960
+ tag,
961
+ });
962
+ if (!tags.some((t) => t.name.toLocaleLowerCase() === tag.name.toLocaleLowerCase())) {
963
+ api.createItem && api.createItem(tag);
964
+ }
965
+ };
966
+ const getItemTags = React.useCallback((item) => {
967
+ const text = item.text;
968
+ const itemTagStrings = text?.match(hashTagRegex);
969
+ const itemTags = [];
970
+ itemTagStrings?.map((tag) => {
971
+ if (tags.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase())) {
972
+ itemTags.push(tags.find((t) => t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase()));
973
+ }
974
+ return null;
975
+ });
976
+ // Could be refactored as it occurs in multiple places
977
+ item.offers?.forEach((o) => {
978
+ const offer = tags.find((t) => t.id === o.tags_id);
979
+ offer && itemTags.push(offer);
980
+ });
981
+ item.needs?.forEach((n) => {
982
+ const need = tags.find((t) => t.id === n.tags_id);
983
+ need && itemTags.push(need);
984
+ });
985
+ return itemTags;
986
+ }, [tags]);
987
+ return { tags, addTag, setTagApi, setTagData, getItemTags, allTagsLoaded };
988
+ }
989
+ const TagsProvider = ({ initialTags, children }) => (jsxRuntime.jsx(TagContext.Provider, { value: useTagsManager(initialTags), children: children }));
990
+ const useTags = () => {
991
+ const { tags } = React.useContext(TagContext);
992
+ return tags;
993
+ };
994
+ const useAddTag = () => {
995
+ const { addTag } = React.useContext(TagContext);
996
+ return addTag;
997
+ };
998
+ const useSetTagApi = () => {
999
+ const { setTagApi } = React.useContext(TagContext);
1000
+ return setTagApi;
1001
+ };
1002
+ const useSetTagData = () => {
1003
+ const { setTagData } = React.useContext(TagContext);
1004
+ return setTagData;
1005
+ };
1006
+ const useGetItemTags = () => {
1007
+ const { getItemTags } = React.useContext(TagContext);
1008
+ return getItemTags;
1009
+ };
1010
+ const useAllTagsLoaded = () => {
1011
+ const { allTagsLoaded } = React.useContext(TagContext);
1012
+ return allTagsLoaded;
1013
+ };
1014
+
1015
+ const initialAppState = {
1016
+ assetsApi: {},
1017
+ sideBarOpen: false,
1018
+ sideBarSlim: false,
1019
+ showThemeControl: false,
1020
+ embedded: false,
1021
+ openCollectiveApiKey: '',
1022
+ };
1023
+ const AppContext = React.createContext({
1024
+ state: initialAppState,
1025
+ setAppState: () => { },
1026
+ });
1027
+ function useAppManager() {
1028
+ const [state, setState] = React.useState(initialAppState);
1029
+ const setAppState = React.useCallback((newState) => {
1030
+ setState((prevState) => ({
1031
+ ...prevState,
1032
+ ...newState,
1033
+ }));
1034
+ }, []);
1035
+ return { state, setAppState };
1036
+ }
1037
+ const AppStateProvider = ({ children }) => jsxRuntime.jsx(AppContext.Provider, { value: useAppManager(), children: children });
1038
+ const useAppState = () => {
1039
+ const { state } = React.useContext(AppContext);
1040
+ return state;
1041
+ };
1042
+ const useSetAppState = () => {
1043
+ const { setAppState } = React.useContext(AppContext);
1044
+ return setAppState;
1045
+ };
1046
+
1047
+ function decodeTag(string) {
1048
+ const formatedTag = string.replace(/_/g, '\u00A0');
1049
+ return formatedTag.charAt(0).toUpperCase() + formatedTag.slice(1);
1050
+ }
1051
+ function encodeTag(string) {
1052
+ return string.replace(/\s+/g, '_');
1053
+ }
1054
+
1055
+ var L_Control_Locate = {exports: {}};
1056
+
1057
+ /*!
1058
+ Copyright (c) 2016 Dominik Moritz
1059
+
1060
+ This file is part of the leaflet locate control. It is licensed under the MIT license.
1061
+ You can find the project at: https://github.com/domoritz/leaflet-locatecontrol
1062
+ */
1063
+
1064
+ var hasRequiredL_Control_Locate;
1065
+
1066
+ function requireL_Control_Locate () {
1067
+ if (hasRequiredL_Control_Locate) return L_Control_Locate.exports;
1068
+ hasRequiredL_Control_Locate = 1;
1069
+ (function (module, exports) {
1070
+ (function (factory, window) {
1071
+ // see https://github.com/Leaflet/Leaflet/blob/master/PLUGIN-GUIDE.md#module-loaders
1072
+ // for details on how to structure a leaflet plugin.
1073
+
1074
+ // define an AMD module that relies on 'leaflet'
1075
+ {
1076
+ if (typeof window !== "undefined" && window.L) {
1077
+ module.exports = factory(L);
1078
+ } else {
1079
+ module.exports = factory(require$$0);
1080
+ }
1081
+ }
1082
+
1083
+ // attach your plugin to the global 'L' variable
1084
+ if (typeof window !== "undefined" && window.L) {
1085
+ window.L.Control.Locate = factory(L);
1086
+ }
1087
+ })(function (L) {
1088
+ const LDomUtilApplyClassesMethod = (method, element, classNames) => {
1089
+ classNames = classNames.split(" ");
1090
+ classNames.forEach(function (className) {
1091
+ L.DomUtil[method].call(this, element, className);
1092
+ });
1093
+ };
1094
+
1095
+ const addClasses = (el, names) => LDomUtilApplyClassesMethod("addClass", el, names);
1096
+ const removeClasses = (el, names) => LDomUtilApplyClassesMethod("removeClass", el, names);
1097
+
1098
+ /**
1099
+ * Compatible with L.Circle but a true marker instead of a path
1100
+ */
1101
+ const LocationMarker = L.Marker.extend({
1102
+ initialize(latlng, options) {
1103
+ L.Util.setOptions(this, options);
1104
+ this._latlng = latlng;
1105
+ this.createIcon();
1106
+ },
1107
+
1108
+ /**
1109
+ * Create a styled circle location marker
1110
+ */
1111
+ createIcon() {
1112
+ const opt = this.options;
1113
+
1114
+ let style = "";
1115
+
1116
+ if (opt.color !== undefined) {
1117
+ style += `stroke:${opt.color};`;
1118
+ }
1119
+ if (opt.weight !== undefined) {
1120
+ style += `stroke-width:${opt.weight};`;
1121
+ }
1122
+ if (opt.fillColor !== undefined) {
1123
+ style += `fill:${opt.fillColor};`;
1124
+ }
1125
+ if (opt.fillOpacity !== undefined) {
1126
+ style += `fill-opacity:${opt.fillOpacity};`;
1127
+ }
1128
+ if (opt.opacity !== undefined) {
1129
+ style += `opacity:${opt.opacity};`;
1130
+ }
1131
+
1132
+ const icon = this._getIconSVG(opt, style);
1133
+
1134
+ this._locationIcon = L.divIcon({
1135
+ className: icon.className,
1136
+ html: icon.svg,
1137
+ iconSize: [icon.w, icon.h]
1138
+ });
1139
+
1140
+ this.setIcon(this._locationIcon);
1141
+ },
1142
+
1143
+ /**
1144
+ * Return the raw svg for the shape
1145
+ *
1146
+ * Split so can be easily overridden
1147
+ */
1148
+ _getIconSVG(options, style) {
1149
+ const r = options.radius;
1150
+ const w = options.weight;
1151
+ const s = r + w;
1152
+ const s2 = s * 2;
1153
+ const svg =
1154
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${s2}" height="${s2}" version="1.1" viewBox="-${s} -${s} ${s2} ${s2}">` +
1155
+ '<circle r="' +
1156
+ r +
1157
+ '" style="' +
1158
+ style +
1159
+ '" />' +
1160
+ "</svg>";
1161
+ return {
1162
+ className: "leaflet-control-locate-location",
1163
+ svg,
1164
+ w: s2,
1165
+ h: s2
1166
+ };
1167
+ },
1168
+
1169
+ setStyle(style) {
1170
+ L.Util.setOptions(this, style);
1171
+ this.createIcon();
1172
+ }
1173
+ });
1174
+
1175
+ const CompassMarker = LocationMarker.extend({
1176
+ initialize(latlng, heading, options) {
1177
+ L.Util.setOptions(this, options);
1178
+ this._latlng = latlng;
1179
+ this._heading = heading;
1180
+ this.createIcon();
1181
+ },
1182
+
1183
+ setHeading(heading) {
1184
+ this._heading = heading;
1185
+ },
1186
+
1187
+ /**
1188
+ * Create a styled arrow compass marker
1189
+ */
1190
+ _getIconSVG(options, style) {
1191
+ const r = options.radius;
1192
+ const w = options.width + options.weight;
1193
+ const h = (r + options.depth + options.weight) * 2;
1194
+ const path = `M0,0 l${options.width / 2},${options.depth} l-${w},0 z`;
1195
+ const svgstyle = `transform: rotate(${this._heading}deg)`;
1196
+ const svg =
1197
+ `<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" version="1.1" viewBox="-${w / 2} 0 ${w} ${h}" style="${svgstyle}">` +
1198
+ '<path d="' +
1199
+ path +
1200
+ '" style="' +
1201
+ style +
1202
+ '" />' +
1203
+ "</svg>";
1204
+ return {
1205
+ className: "leaflet-control-locate-heading",
1206
+ svg,
1207
+ w,
1208
+ h
1209
+ };
1210
+ }
1211
+ });
1212
+
1213
+ const LocateControl = L.Control.extend({
1214
+ options: {
1215
+ /** Position of the control */
1216
+ position: "topleft",
1217
+ /** The layer that the user's location should be drawn on. By default creates a new layer. */
1218
+ layer: undefined,
1219
+ /**
1220
+ * Automatically sets the map view (zoom and pan) to the user's location as it updates.
1221
+ * While the map is following the user's location, the control is in the `following` state,
1222
+ * which changes the style of the control and the circle marker.
1223
+ *
1224
+ * Possible values:
1225
+ * - false: never updates the map view when location changes.
1226
+ * - 'once': set the view when the location is first determined
1227
+ * - 'always': always updates the map view when location changes.
1228
+ * The map view follows the user's location.
1229
+ * - 'untilPan': like 'always', except stops updating the
1230
+ * view if the user has manually panned the map.
1231
+ * The map view follows the user's location until she pans.
1232
+ * - 'untilPanOrZoom': (default) like 'always', except stops updating the
1233
+ * view if the user has manually panned the map.
1234
+ * The map view follows the user's location until she pans.
1235
+ */
1236
+ setView: "untilPanOrZoom",
1237
+ /** Keep the current map zoom level when setting the view and only pan. */
1238
+ keepCurrentZoomLevel: false,
1239
+ /** After activating the plugin by clicking on the icon, zoom to the selected zoom level, even when keepCurrentZoomLevel is true. Set to 'false' to disable this feature. */
1240
+ initialZoomLevel: false,
1241
+ /**
1242
+ * This callback can be used to override the viewport tracking
1243
+ * This function should return a LatLngBounds object.
1244
+ *
1245
+ * For example to extend the viewport to ensure that a particular LatLng is visible:
1246
+ *
1247
+ * getLocationBounds: function(locationEvent) {
1248
+ * return locationEvent.bounds.extend([-33.873085, 151.219273]);
1249
+ * },
1250
+ */
1251
+ getLocationBounds(locationEvent) {
1252
+ return locationEvent.bounds;
1253
+ },
1254
+ /** Smooth pan and zoom to the location of the marker. Only works in Leaflet 1.0+. */
1255
+ flyTo: false,
1256
+ /**
1257
+ * The user location can be inside and outside the current view when the user clicks on the
1258
+ * control that is already active. Both cases can be configures separately.
1259
+ * Possible values are:
1260
+ * - 'setView': zoom and pan to the current location
1261
+ * - 'stop': stop locating and remove the location marker
1262
+ */
1263
+ clickBehavior: {
1264
+ /** What should happen if the user clicks on the control while the location is within the current view. */
1265
+ inView: "stop",
1266
+ /** What should happen if the user clicks on the control while the location is outside the current view. */
1267
+ outOfView: "setView",
1268
+ /**
1269
+ * What should happen if the user clicks on the control while the location is within the current view
1270
+ * and we could be following but are not. Defaults to a special value which inherits from 'inView';
1271
+ */
1272
+ inViewNotFollowing: "inView"
1273
+ },
1274
+ /**
1275
+ * If set, save the map bounds just before centering to the user's
1276
+ * location. When control is disabled, set the view back to the
1277
+ * bounds that were saved.
1278
+ */
1279
+ returnToPrevBounds: false,
1280
+ /**
1281
+ * Keep a cache of the location after the user deactivates the control. If set to false, the user has to wait
1282
+ * until the locate API returns a new location before they see where they are again.
1283
+ */
1284
+ cacheLocation: true,
1285
+ /** If set, a circle that shows the location accuracy is drawn. */
1286
+ drawCircle: true,
1287
+ /** If set, the marker at the users' location is drawn. */
1288
+ drawMarker: true,
1289
+ /** If set and supported then show the compass heading */
1290
+ showCompass: true,
1291
+ /** The class to be used to create the marker. For example L.CircleMarker or L.Marker */
1292
+ markerClass: LocationMarker,
1293
+ /** The class us be used to create the compass bearing arrow */
1294
+ compassClass: CompassMarker,
1295
+ /** Accuracy circle style properties. NOTE these styles should match the css animations styles */
1296
+ circleStyle: {
1297
+ className: "leaflet-control-locate-circle",
1298
+ color: "#136AEC",
1299
+ fillColor: "#136AEC",
1300
+ fillOpacity: 0.15,
1301
+ weight: 0
1302
+ },
1303
+ /** Inner marker style properties. Only works if your marker class supports `setStyle`. */
1304
+ markerStyle: {
1305
+ className: "leaflet-control-locate-marker",
1306
+ color: "#fff",
1307
+ fillColor: "#2A93EE",
1308
+ fillOpacity: 1,
1309
+ weight: 3,
1310
+ opacity: 1,
1311
+ radius: 9
1312
+ },
1313
+ /** Compass */
1314
+ compassStyle: {
1315
+ fillColor: "#2A93EE",
1316
+ fillOpacity: 1,
1317
+ weight: 0,
1318
+ color: "#fff",
1319
+ opacity: 1,
1320
+ radius: 9, // How far is the arrow is from the center of of the marker
1321
+ width: 9, // Width of the arrow
1322
+ depth: 6 // Length of the arrow
1323
+ },
1324
+ /**
1325
+ * Changes to accuracy circle and inner marker while following.
1326
+ * It is only necessary to provide the properties that should change.
1327
+ */
1328
+ followCircleStyle: {},
1329
+ followMarkerStyle: {
1330
+ // color: '#FFA500',
1331
+ // fillColor: '#FFB000'
1332
+ },
1333
+ followCompassStyle: {},
1334
+ /** The CSS class for the icon. For example fa-location-arrow or fa-map-marker */
1335
+ icon: "leaflet-control-locate-location-arrow",
1336
+ iconLoading: "leaflet-control-locate-spinner",
1337
+ /** The element to be created for icons. For example span or i */
1338
+ iconElementTag: "span",
1339
+ /** The element to be created for the text. For example small or span */
1340
+ textElementTag: "small",
1341
+ /** Padding around the accuracy circle. */
1342
+ circlePadding: [0, 0],
1343
+ /** Use metric units. */
1344
+ metric: true,
1345
+ /**
1346
+ * This callback can be used in case you would like to override button creation behavior.
1347
+ * This is useful for DOM manipulation frameworks such as angular etc.
1348
+ * This function should return an object with HtmlElement for the button (link property) and the icon (icon property).
1349
+ */
1350
+ createButtonCallback(container, options) {
1351
+ const link = L.DomUtil.create("a", "leaflet-bar-part leaflet-bar-part-single", container);
1352
+ link.title = options.strings.title;
1353
+ link.href = "#";
1354
+ link.setAttribute("role", "button");
1355
+ const icon = L.DomUtil.create(options.iconElementTag, options.icon, link);
1356
+
1357
+ if (options.strings.text !== undefined) {
1358
+ const text = L.DomUtil.create(options.textElementTag, "leaflet-locate-text", link);
1359
+ text.textContent = options.strings.text;
1360
+ link.classList.add("leaflet-locate-text-active");
1361
+ link.parentNode.style.display = "flex";
1362
+ if (options.icon.length > 0) {
1363
+ icon.classList.add("leaflet-locate-icon");
1364
+ }
1365
+ }
1366
+
1367
+ return { link, icon };
1368
+ },
1369
+ /** This event is called in case of any location error that is not a time out error. */
1370
+ onLocationError(err, control) {
1371
+ alert(err.message);
1372
+ },
1373
+ /**
1374
+ * This event is called when the user's location is outside the bounds set on the map.
1375
+ * The event is called repeatedly when the location changes.
1376
+ */
1377
+ onLocationOutsideMapBounds(control) {
1378
+ control.stop();
1379
+ alert(control.options.strings.outsideMapBoundsMsg);
1380
+ },
1381
+ /** Display a pop-up when the user click on the inner marker. */
1382
+ showPopup: true,
1383
+ strings: {
1384
+ title: "Show me where I am",
1385
+ metersUnit: "meters",
1386
+ feetUnit: "feet",
1387
+ popup: "You are within {distance} {unit} from this point",
1388
+ outsideMapBoundsMsg: "You seem located outside the boundaries of the map"
1389
+ },
1390
+ /** The default options passed to leaflets locate method. */
1391
+ locateOptions: {
1392
+ maxZoom: Infinity,
1393
+ watch: true, // if you overwrite this, visualization cannot be updated
1394
+ setView: false // have to set this to false because we have to
1395
+ // do setView manually
1396
+ }
1397
+ },
1398
+
1399
+ initialize(options) {
1400
+ // set default options if nothing is set (merge one step deep)
1401
+ for (const i in options) {
1402
+ if (typeof this.options[i] === "object") {
1403
+ L.extend(this.options[i], options[i]);
1404
+ } else {
1405
+ this.options[i] = options[i];
1406
+ }
1407
+ }
1408
+
1409
+ // extend the follow marker style and circle from the normal style
1410
+ this.options.followMarkerStyle = L.extend({}, this.options.markerStyle, this.options.followMarkerStyle);
1411
+ this.options.followCircleStyle = L.extend({}, this.options.circleStyle, this.options.followCircleStyle);
1412
+ this.options.followCompassStyle = L.extend({}, this.options.compassStyle, this.options.followCompassStyle);
1413
+ },
1414
+
1415
+ /**
1416
+ * Add control to map. Returns the container for the control.
1417
+ */
1418
+ onAdd(map) {
1419
+ const container = L.DomUtil.create("div", "leaflet-control-locate leaflet-bar leaflet-control");
1420
+ this._container = container;
1421
+ this._map = map;
1422
+ this._layer = this.options.layer || new L.LayerGroup();
1423
+ this._layer.addTo(map);
1424
+ this._event = undefined;
1425
+ this._compassHeading = null;
1426
+ this._prevBounds = null;
1427
+
1428
+ const linkAndIcon = this.options.createButtonCallback(container, this.options);
1429
+ this._link = linkAndIcon.link;
1430
+ this._icon = linkAndIcon.icon;
1431
+
1432
+ L.DomEvent.on(
1433
+ this._link,
1434
+ "click",
1435
+ function (ev) {
1436
+ L.DomEvent.stopPropagation(ev);
1437
+ L.DomEvent.preventDefault(ev);
1438
+ this._onClick();
1439
+ },
1440
+ this
1441
+ ).on(this._link, "dblclick", L.DomEvent.stopPropagation);
1442
+
1443
+ this._resetVariables();
1444
+
1445
+ this._map.on("unload", this._unload, this);
1446
+
1447
+ return container;
1448
+ },
1449
+
1450
+ /**
1451
+ * This method is called when the user clicks on the control.
1452
+ */
1453
+ _onClick() {
1454
+ this._justClicked = true;
1455
+ const wasFollowing = this._isFollowing();
1456
+ this._userPanned = false;
1457
+ this._userZoomed = false;
1458
+
1459
+ if (this._active && !this._event) {
1460
+ // click while requesting
1461
+ this.stop();
1462
+ } else if (this._active) {
1463
+ const behaviors = this.options.clickBehavior;
1464
+ let behavior = behaviors.outOfView;
1465
+ if (this._map.getBounds().contains(this._event.latlng)) {
1466
+ behavior = wasFollowing ? behaviors.inView : behaviors.inViewNotFollowing;
1467
+ }
1468
+
1469
+ // Allow inheriting from another behavior
1470
+ if (behaviors[behavior]) {
1471
+ behavior = behaviors[behavior];
1472
+ }
1473
+
1474
+ switch (behavior) {
1475
+ case "setView":
1476
+ this.setView();
1477
+ break;
1478
+ case "stop":
1479
+ this.stop();
1480
+ if (this.options.returnToPrevBounds) {
1481
+ const f = this.options.flyTo ? this._map.flyToBounds : this._map.fitBounds;
1482
+ f.bind(this._map)(this._prevBounds);
1483
+ }
1484
+ break;
1485
+ }
1486
+ } else {
1487
+ if (this.options.returnToPrevBounds) {
1488
+ this._prevBounds = this._map.getBounds();
1489
+ }
1490
+ this.start();
1491
+ }
1492
+
1493
+ this._updateContainerStyle();
1494
+ },
1495
+
1496
+ /**
1497
+ * Starts the plugin:
1498
+ * - activates the engine
1499
+ * - draws the marker (if coordinates available)
1500
+ */
1501
+ start() {
1502
+ this._activate();
1503
+
1504
+ if (this._event) {
1505
+ this._drawMarker(this._map);
1506
+
1507
+ // if we already have a location but the user clicked on the control
1508
+ if (this.options.setView) {
1509
+ this.setView();
1510
+ }
1511
+ }
1512
+ this._updateContainerStyle();
1513
+ },
1514
+
1515
+ /**
1516
+ * Stops the plugin:
1517
+ * - deactivates the engine
1518
+ * - reinitializes the button
1519
+ * - removes the marker
1520
+ */
1521
+ stop() {
1522
+ this._deactivate();
1523
+
1524
+ this._cleanClasses();
1525
+ this._resetVariables();
1526
+
1527
+ this._removeMarker();
1528
+ },
1529
+
1530
+ /**
1531
+ * Keep the control active but stop following the location
1532
+ */
1533
+ stopFollowing() {
1534
+ this._userPanned = true;
1535
+ this._updateContainerStyle();
1536
+ this._drawMarker();
1537
+ },
1538
+
1539
+ /**
1540
+ * This method launches the location engine.
1541
+ * It is called before the marker is updated,
1542
+ * event if it does not mean that the event will be ready.
1543
+ *
1544
+ * Override it if you want to add more functionalities.
1545
+ * It should set the this._active to true and do nothing if
1546
+ * this._active is true.
1547
+ */
1548
+ _activate() {
1549
+ if (this._active || !this._map) {
1550
+ return;
1551
+ }
1552
+
1553
+ this._map.locate(this.options.locateOptions);
1554
+ this._map.fire("locateactivate", this);
1555
+ this._active = true;
1556
+
1557
+ // bind event listeners
1558
+ this._map.on("locationfound", this._onLocationFound, this);
1559
+ this._map.on("locationerror", this._onLocationError, this);
1560
+ this._map.on("dragstart", this._onDrag, this);
1561
+ this._map.on("zoomstart", this._onZoom, this);
1562
+ this._map.on("zoomend", this._onZoomEnd, this);
1563
+ if (this.options.showCompass) {
1564
+ const oriAbs = "ondeviceorientationabsolute" in window;
1565
+ if (oriAbs || "ondeviceorientation" in window) {
1566
+ const _this = this;
1567
+ const deviceorientation = function () {
1568
+ L.DomEvent.on(window, oriAbs ? "deviceorientationabsolute" : "deviceorientation", _this._onDeviceOrientation, _this);
1569
+ };
1570
+ if (DeviceOrientationEvent && typeof DeviceOrientationEvent.requestPermission === "function") {
1571
+ DeviceOrientationEvent.requestPermission().then(function (permissionState) {
1572
+ if (permissionState === "granted") {
1573
+ deviceorientation();
1574
+ }
1575
+ });
1576
+ } else {
1577
+ deviceorientation();
1578
+ }
1579
+ }
1580
+ }
1581
+ },
1582
+
1583
+ /**
1584
+ * Called to stop the location engine.
1585
+ *
1586
+ * Override it to shutdown any functionalities you added on start.
1587
+ */
1588
+ _deactivate() {
1589
+ if (!this._active || !this._map) {
1590
+ return;
1591
+ }
1592
+
1593
+ this._map.stopLocate();
1594
+ this._map.fire("locatedeactivate", this);
1595
+ this._active = false;
1596
+
1597
+ if (!this.options.cacheLocation) {
1598
+ this._event = undefined;
1599
+ }
1600
+
1601
+ // unbind event listeners
1602
+ this._map.off("locationfound", this._onLocationFound, this);
1603
+ this._map.off("locationerror", this._onLocationError, this);
1604
+ this._map.off("dragstart", this._onDrag, this);
1605
+ this._map.off("zoomstart", this._onZoom, this);
1606
+ this._map.off("zoomend", this._onZoomEnd, this);
1607
+ if (this.options.showCompass) {
1608
+ this._compassHeading = null;
1609
+ if ("ondeviceorientationabsolute" in window) {
1610
+ L.DomEvent.off(window, "deviceorientationabsolute", this._onDeviceOrientation, this);
1611
+ } else if ("ondeviceorientation" in window) {
1612
+ L.DomEvent.off(window, "deviceorientation", this._onDeviceOrientation, this);
1613
+ }
1614
+ }
1615
+ },
1616
+
1617
+ /**
1618
+ * Zoom (unless we should keep the zoom level) and an to the current view.
1619
+ */
1620
+ setView() {
1621
+ this._drawMarker();
1622
+ if (this._isOutsideMapBounds()) {
1623
+ this._event = undefined; // clear the current location so we can get back into the bounds
1624
+ this.options.onLocationOutsideMapBounds(this);
1625
+ } else {
1626
+ if (this._justClicked && this.options.initialZoomLevel !== false) {
1627
+ var f = this.options.flyTo ? this._map.flyTo : this._map.setView;
1628
+ f.bind(this._map)([this._event.latitude, this._event.longitude], this.options.initialZoomLevel);
1629
+ } else if (this.options.keepCurrentZoomLevel) {
1630
+ var f = this.options.flyTo ? this._map.flyTo : this._map.panTo;
1631
+ f.bind(this._map)([this._event.latitude, this._event.longitude]);
1632
+ } else {
1633
+ var f = this.options.flyTo ? this._map.flyToBounds : this._map.fitBounds;
1634
+ // Ignore zoom events while setting the viewport as these would stop following
1635
+ this._ignoreEvent = true;
1636
+ f.bind(this._map)(this.options.getLocationBounds(this._event), {
1637
+ padding: this.options.circlePadding,
1638
+ maxZoom: this.options.initialZoomLevel || this.options.locateOptions.maxZoom
1639
+ });
1640
+ L.Util.requestAnimFrame(function () {
1641
+ // Wait until after the next animFrame because the flyTo can be async
1642
+ this._ignoreEvent = false;
1643
+ }, this);
1644
+ }
1645
+ }
1646
+ },
1647
+
1648
+ /**
1649
+ *
1650
+ */
1651
+ _drawCompass() {
1652
+ if (!this._event) {
1653
+ return;
1654
+ }
1655
+
1656
+ const latlng = this._event.latlng;
1657
+
1658
+ if (this.options.showCompass && latlng && this._compassHeading !== null) {
1659
+ const cStyle = this._isFollowing() ? this.options.followCompassStyle : this.options.compassStyle;
1660
+ if (!this._compass) {
1661
+ this._compass = new this.options.compassClass(latlng, this._compassHeading, cStyle).addTo(this._layer);
1662
+ } else {
1663
+ this._compass.setLatLng(latlng);
1664
+ this._compass.setHeading(this._compassHeading);
1665
+ // If the compassClass can be updated with setStyle, update it.
1666
+ if (this._compass.setStyle) {
1667
+ this._compass.setStyle(cStyle);
1668
+ }
1669
+ }
1670
+ //
1671
+ }
1672
+ if (this._compass && (!this.options.showCompass || this._compassHeading === null)) {
1673
+ this._compass.removeFrom(this._layer);
1674
+ this._compass = null;
1675
+ }
1676
+ },
1677
+
1678
+ /**
1679
+ * Draw the marker and accuracy circle on the map.
1680
+ *
1681
+ * Uses the event retrieved from onLocationFound from the map.
1682
+ */
1683
+ _drawMarker() {
1684
+ if (this._event.accuracy === undefined) {
1685
+ this._event.accuracy = 0;
1686
+ }
1687
+
1688
+ const radius = this._event.accuracy;
1689
+ const latlng = this._event.latlng;
1690
+
1691
+ // circle with the radius of the location's accuracy
1692
+ if (this.options.drawCircle) {
1693
+ const style = this._isFollowing() ? this.options.followCircleStyle : this.options.circleStyle;
1694
+
1695
+ if (!this._circle) {
1696
+ this._circle = L.circle(latlng, radius, style).addTo(this._layer);
1697
+ } else {
1698
+ this._circle.setLatLng(latlng).setRadius(radius).setStyle(style);
1699
+ }
1700
+ }
1701
+
1702
+ let distance;
1703
+ let unit;
1704
+ if (this.options.metric) {
1705
+ distance = radius.toFixed(0);
1706
+ unit = this.options.strings.metersUnit;
1707
+ } else {
1708
+ distance = (radius * 3.2808399).toFixed(0);
1709
+ unit = this.options.strings.feetUnit;
1710
+ }
1711
+
1712
+ // small inner marker
1713
+ if (this.options.drawMarker) {
1714
+ const mStyle = this._isFollowing() ? this.options.followMarkerStyle : this.options.markerStyle;
1715
+ if (!this._marker) {
1716
+ this._marker = new this.options.markerClass(latlng, mStyle).addTo(this._layer);
1717
+ } else {
1718
+ this._marker.setLatLng(latlng);
1719
+ // If the markerClass can be updated with setStyle, update it.
1720
+ if (this._marker.setStyle) {
1721
+ this._marker.setStyle(mStyle);
1722
+ }
1723
+ }
1724
+ }
1725
+
1726
+ this._drawCompass();
1727
+
1728
+ const t = this.options.strings.popup;
1729
+ function getPopupText() {
1730
+ if (typeof t === "string") {
1731
+ return L.Util.template(t, { distance, unit });
1732
+ } else if (typeof t === "function") {
1733
+ return t({ distance, unit });
1734
+ } else {
1735
+ return t;
1736
+ }
1737
+ }
1738
+ if (this.options.showPopup && t && this._marker) {
1739
+ this._marker.bindPopup(getPopupText())._popup.setLatLng(latlng);
1740
+ }
1741
+ if (this.options.showPopup && t && this._compass) {
1742
+ this._compass.bindPopup(getPopupText())._popup.setLatLng(latlng);
1743
+ }
1744
+ },
1745
+
1746
+ /**
1747
+ * Remove the marker from map.
1748
+ */
1749
+ _removeMarker() {
1750
+ this._layer.clearLayers();
1751
+ this._marker = undefined;
1752
+ this._circle = undefined;
1753
+ },
1754
+
1755
+ /**
1756
+ * Unload the plugin and all event listeners.
1757
+ * Kind of the opposite of onAdd.
1758
+ */
1759
+ _unload() {
1760
+ this.stop();
1761
+ this._map.off("unload", this._unload, this);
1762
+ },
1763
+
1764
+ /**
1765
+ * Sets the compass heading
1766
+ */
1767
+ _setCompassHeading(angle) {
1768
+ if (!isNaN(parseFloat(angle)) && isFinite(angle)) {
1769
+ angle = Math.round(angle);
1770
+
1771
+ this._compassHeading = angle;
1772
+ L.Util.requestAnimFrame(this._drawCompass, this);
1773
+ } else {
1774
+ this._compassHeading = null;
1775
+ }
1776
+ },
1777
+
1778
+ /**
1779
+ * If the compass fails calibration just fail safely and remove the compass
1780
+ */
1781
+ _onCompassNeedsCalibration() {
1782
+ this._setCompassHeading();
1783
+ },
1784
+
1785
+ /**
1786
+ * Process and normalise compass events
1787
+ */
1788
+ _onDeviceOrientation(e) {
1789
+ if (!this._active) {
1790
+ return;
1791
+ }
1792
+
1793
+ if (e.webkitCompassHeading) {
1794
+ // iOS
1795
+ this._setCompassHeading(e.webkitCompassHeading);
1796
+ } else if (e.absolute && e.alpha) {
1797
+ // Android
1798
+ this._setCompassHeading(360 - e.alpha);
1799
+ }
1800
+ },
1801
+
1802
+ /**
1803
+ * Calls deactivate and dispatches an error.
1804
+ */
1805
+ _onLocationError(err) {
1806
+ // ignore time out error if the location is watched
1807
+ if (err.code == 3 && this.options.locateOptions.watch) {
1808
+ return;
1809
+ }
1810
+
1811
+ this.stop();
1812
+ this.options.onLocationError(err, this);
1813
+ },
1814
+
1815
+ /**
1816
+ * Stores the received event and updates the marker.
1817
+ */
1818
+ _onLocationFound(e) {
1819
+ // no need to do anything if the location has not changed
1820
+ if (this._event && this._event.latlng.lat === e.latlng.lat && this._event.latlng.lng === e.latlng.lng && this._event.accuracy === e.accuracy) {
1821
+ return;
1822
+ }
1823
+
1824
+ if (!this._active) {
1825
+ // we may have a stray event
1826
+ return;
1827
+ }
1828
+
1829
+ this._event = e;
1830
+
1831
+ this._drawMarker();
1832
+ this._updateContainerStyle();
1833
+
1834
+ switch (this.options.setView) {
1835
+ case "once":
1836
+ if (this._justClicked) {
1837
+ this.setView();
1838
+ }
1839
+ break;
1840
+ case "untilPan":
1841
+ if (!this._userPanned) {
1842
+ this.setView();
1843
+ }
1844
+ break;
1845
+ case "untilPanOrZoom":
1846
+ if (!this._userPanned && !this._userZoomed) {
1847
+ this.setView();
1848
+ }
1849
+ break;
1850
+ case "always":
1851
+ this.setView();
1852
+ break;
1853
+ }
1854
+
1855
+ this._justClicked = false;
1856
+ },
1857
+
1858
+ /**
1859
+ * When the user drags. Need a separate event so we can bind and unbind event listeners.
1860
+ */
1861
+ _onDrag() {
1862
+ // only react to drags once we have a location
1863
+ if (this._event && !this._ignoreEvent) {
1864
+ this._userPanned = true;
1865
+ this._updateContainerStyle();
1866
+ this._drawMarker();
1867
+ }
1868
+ },
1869
+
1870
+ /**
1871
+ * When the user zooms. Need a separate event so we can bind and unbind event listeners.
1872
+ */
1873
+ _onZoom() {
1874
+ // only react to drags once we have a location
1875
+ if (this._event && !this._ignoreEvent) {
1876
+ this._userZoomed = true;
1877
+ this._updateContainerStyle();
1878
+ this._drawMarker();
1879
+ }
1880
+ },
1881
+
1882
+ /**
1883
+ * After a zoom ends update the compass and handle sideways zooms
1884
+ */
1885
+ _onZoomEnd() {
1886
+ if (this._event) {
1887
+ this._drawCompass();
1888
+ }
1889
+
1890
+ if (this._event && !this._ignoreEvent) {
1891
+ // If we have zoomed in and out and ended up sideways treat it as a pan
1892
+ if (this._marker && !this._map.getBounds().pad(-0.3).contains(this._marker.getLatLng())) {
1893
+ this._userPanned = true;
1894
+ this._updateContainerStyle();
1895
+ this._drawMarker();
1896
+ }
1897
+ }
1898
+ },
1899
+
1900
+ /**
1901
+ * Compute whether the map is following the user location with pan and zoom.
1902
+ */
1903
+ _isFollowing() {
1904
+ if (!this._active) {
1905
+ return false;
1906
+ }
1907
+
1908
+ if (this.options.setView === "always") {
1909
+ return true;
1910
+ } else if (this.options.setView === "untilPan") {
1911
+ return !this._userPanned;
1912
+ } else if (this.options.setView === "untilPanOrZoom") {
1913
+ return !this._userPanned && !this._userZoomed;
1914
+ }
1915
+ },
1916
+
1917
+ /**
1918
+ * Check if location is in map bounds
1919
+ */
1920
+ _isOutsideMapBounds() {
1921
+ if (this._event === undefined) {
1922
+ return false;
1923
+ }
1924
+ return this._map.options.maxBounds && !this._map.options.maxBounds.contains(this._event.latlng);
1925
+ },
1926
+
1927
+ /**
1928
+ * Toggles button class between following and active.
1929
+ */
1930
+ _updateContainerStyle() {
1931
+ if (!this._container) {
1932
+ return;
1933
+ }
1934
+
1935
+ if (this._active && !this._event) {
1936
+ // active but don't have a location yet
1937
+ this._setClasses("requesting");
1938
+ } else if (this._isFollowing()) {
1939
+ this._setClasses("following");
1940
+ } else if (this._active) {
1941
+ this._setClasses("active");
1942
+ } else {
1943
+ this._cleanClasses();
1944
+ }
1945
+ },
1946
+
1947
+ /**
1948
+ * Sets the CSS classes for the state.
1949
+ */
1950
+ _setClasses(state) {
1951
+ if (state == "requesting") {
1952
+ removeClasses(this._container, "active following");
1953
+ addClasses(this._container, "requesting");
1954
+
1955
+ removeClasses(this._icon, this.options.icon);
1956
+ addClasses(this._icon, this.options.iconLoading);
1957
+ } else if (state == "active") {
1958
+ removeClasses(this._container, "requesting following");
1959
+ addClasses(this._container, "active");
1960
+
1961
+ removeClasses(this._icon, this.options.iconLoading);
1962
+ addClasses(this._icon, this.options.icon);
1963
+ } else if (state == "following") {
1964
+ removeClasses(this._container, "requesting");
1965
+ addClasses(this._container, "active following");
1966
+
1967
+ removeClasses(this._icon, this.options.iconLoading);
1968
+ addClasses(this._icon, this.options.icon);
1969
+ }
1970
+ },
1971
+
1972
+ /**
1973
+ * Removes all classes from button.
1974
+ */
1975
+ _cleanClasses() {
1976
+ L.DomUtil.removeClass(this._container, "requesting");
1977
+ L.DomUtil.removeClass(this._container, "active");
1978
+ L.DomUtil.removeClass(this._container, "following");
1979
+
1980
+ removeClasses(this._icon, this.options.iconLoading);
1981
+ addClasses(this._icon, this.options.icon);
1982
+ },
1983
+
1984
+ /**
1985
+ * Reinitializes state variables.
1986
+ */
1987
+ _resetVariables() {
1988
+ // whether locate is active or not
1989
+ this._active = false;
1990
+
1991
+ // true if the control was clicked for the first time
1992
+ // we need this so we can pan and zoom once we have the location
1993
+ this._justClicked = false;
1994
+
1995
+ // true if the user has panned the map after clicking the control
1996
+ this._userPanned = false;
1997
+
1998
+ // true if the user has zoomed the map after clicking the control
1999
+ this._userZoomed = false;
2000
+ }
2001
+ });
2002
+
2003
+ L.control.locate = (options) => new L.Control.Locate(options);
2004
+
2005
+ return LocateControl;
2006
+ }, window);
2007
+ } (L_Control_Locate));
2008
+ return L_Control_Locate.exports;
2009
+ }
2010
+
2011
+ requireL_Control_Locate();
2012
+
2013
+ const urlRegex =
2014
+ // eslint-disable-next-line no-useless-escape, security/detect-unsafe-regex
2015
+ /(^| )(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,10}(:[0-9]{1,10})?(\/.*)?$/gm;
2016
+ const mailRegex = /(?<![[(])([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6})(?![\])])/gi;
2017
+ function fixUrls(message) {
2018
+ message = message.replace(urlRegex, function (url) {
2019
+ let hyperlink = url.replace(' ', '');
2020
+ if (!hyperlink.match('^https?://')) {
2021
+ hyperlink = 'https://' + hyperlink;
2022
+ }
2023
+ return hyperlink;
2024
+ });
2025
+ return message;
2026
+ }
2027
+
2028
+ /**
2029
+ * @category Map
2030
+ */
2031
+ const TextView = ({ item, itemId, text, truncate = false, rawText, }) => {
2032
+ if (item) {
2033
+ text = item.text;
2034
+ itemId = item.id;
2035
+ }
2036
+ const tags = useTags();
2037
+ const addFilterTag = useAddFilterTag();
2038
+ let innerText = '';
2039
+ let replacedText = '';
2040
+ if (rawText) {
2041
+ innerText = replacedText = rawText;
2042
+ }
2043
+ else if (text) {
2044
+ innerText = text;
2045
+ }
2046
+ if (innerText && truncate)
2047
+ innerText = truncateText(removeMarkdownKeepLinksAndParagraphs(innerText), 100);
2048
+ if (innerText)
2049
+ replacedText = fixUrls(innerText);
2050
+ if (replacedText) {
2051
+ replacedText = replacedText.replace(mailRegex, (url) => {
2052
+ return `[${url}](mailto:${url})`;
2053
+ });
2054
+ }
2055
+ if (replacedText) {
2056
+ replacedText = replacedText.replace(hashTagRegex, (match) => {
2057
+ return `[${match}](${match})`;
2058
+ });
2059
+ }
2060
+ const HashTag = ({ children, tag, itemId }) => {
2061
+ return (jsxRuntime.jsx("a", { className: 'hashtag', style: tag && {
2062
+ color: tag.color,
2063
+ }, onClick: (e) => {
2064
+ e.stopPropagation();
2065
+ addFilterTag(tag);
2066
+ }, children: decodeTag(children) }, tag ? tag.name + itemId : itemId));
2067
+ };
2068
+ const Link = ({ href, children }) => {
2069
+ // Youtube
2070
+ if (href.startsWith('https://www.youtube.com/watch?v=')) {
2071
+ const videoId = href?.split('v=')[1].split('&')[0];
2072
+ const youtubeEmbedUrl = `https://www.youtube-nocookie.com/embed/${videoId}`;
2073
+ return (jsxRuntime.jsx("iframe", { src: youtubeEmbedUrl, allow: 'fullscreen; picture-in-picture', allowFullScreen: true }));
2074
+ }
2075
+ // Rumble
2076
+ if (href.startsWith('https://rumble.com/embed/')) {
2077
+ return jsxRuntime.jsx("iframe", { src: href, allow: 'fullscreen; picture-in-picture', allowFullScreen: true });
2078
+ }
2079
+ // HashTag
2080
+ if (href.startsWith('#')) {
2081
+ const tag = tags.find((t) => t.name.toLowerCase() === decodeURI(href).slice(1).toLowerCase());
2082
+ if (tag)
2083
+ return (jsxRuntime.jsx(HashTag, { tag: tag, itemId: itemId, children: children }));
2084
+ else
2085
+ return children;
2086
+ }
2087
+ // Default: Link
2088
+ return (jsxRuntime.jsx("a", { href: href, target: '_blank', rel: 'noreferrer', children: children }));
2089
+ };
2090
+ return (jsxRuntime.jsx(Markdown, { className: 'markdown tw:text-map tw:leading-map tw:text-sm', remarkPlugins: [remarkBreaks], components: {
2091
+ a: Link,
2092
+ }, children: replacedText }));
2093
+ };
2094
+ function removeMarkdownKeepLinksAndParagraphs(text) {
2095
+ // Remove Markdown syntax using regular expressions but keep links and paragraphs
2096
+ return text
2097
+ .replace(/!\[.*?\]\(.*?\)/g, '') // Remove images
2098
+ .replace(/(`{1,3})(.*?)\1/g, '$2') // Remove inline code
2099
+ .replace(/(\*{1,2}|_{1,2})(.*?)\1/g, '$2') // Remove bold and italic
2100
+ .replace(/(#+)\s+(.*)/g, '$2') // Remove headers
2101
+ .replace(/>\s+(.*)/g, '$1') // Remove blockquotes
2102
+ .replace(/^\s*\n/gm, '\n') // Preserve empty lines
2103
+ .replace(/(\r\n|\n|\r)/gm, '\n'); // Preserve line breaks
2104
+ }
2105
+ function truncateText(text, limit) {
2106
+ if (text.length <= limit) {
2107
+ return text;
2108
+ }
2109
+ let truncated = '';
2110
+ let length = 0;
2111
+ // Split the text by paragraphs
2112
+ const paragraphs = text.split('\n');
2113
+ for (const paragraph of paragraphs) {
2114
+ if (length + paragraph.length > limit) {
2115
+ truncated += paragraph.slice(0, limit - length) + '...';
2116
+ break;
2117
+ }
2118
+ else {
2119
+ truncated += paragraph + '\n';
2120
+ length += paragraph.length;
2121
+ }
2122
+ }
2123
+ return truncated.trim();
2124
+ }
2125
+
2126
+ function EllipsisVerticalIcon({
2127
+ title,
2128
+ titleId,
2129
+ ...props
2130
+ }, svgRef) {
2131
+ return /*#__PURE__*/React__namespace.createElement("svg", Object.assign({
2132
+ xmlns: "http://www.w3.org/2000/svg",
2133
+ viewBox: "0 0 16 16",
2134
+ fill: "currentColor",
2135
+ "aria-hidden": "true",
2136
+ "data-slot": "icon",
2137
+ ref: svgRef,
2138
+ "aria-labelledby": titleId
2139
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2140
+ id: titleId
2141
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2142
+ d: "M8 2a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM8 6.5a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM9.5 12.5a1.5 1.5 0 1 0-3 0 1.5 1.5 0 0 0 3 0Z"
2143
+ }));
2144
+ }
2145
+ const ForwardRef$4 = /*#__PURE__*/ React__namespace.forwardRef(EllipsisVerticalIcon);
2146
+
2147
+ /**
2148
+ * @category Templates
2149
+ */
2150
+ function MapOverlayPage({ children, className, backdrop, card = true, }) {
2151
+ const closeScreen = () => {
2152
+ navigate(`/${window.location.search ? window.location.search : ''}`);
2153
+ };
2154
+ const navigate = reactRouterDom.useNavigate();
2155
+ const overlayRef = React.createRef();
2156
+ const backdropRef = React.createRef();
2157
+ React.useEffect(() => {
2158
+ if (overlayRef.current !== null) {
2159
+ require$$0.DomEvent.disableClickPropagation(overlayRef.current);
2160
+ require$$0.DomEvent.disableScrollPropagation(overlayRef.current);
2161
+ }
2162
+ if (backdropRef.current !== null && backdrop) {
2163
+ require$$0.DomEvent.disableClickPropagation(backdropRef.current);
2164
+ require$$0.DomEvent.disableScrollPropagation(backdropRef.current);
2165
+ }
2166
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2167
+ }, [overlayRef, backdropRef]);
2168
+ return (jsxRuntime.jsx("div", { className: `tw:absolute tw:h-full tw:w-full tw:m-auto ${backdrop ? 'tw:z-2000' : ''}`, children: jsxRuntime.jsx("div", { ref: backdropRef, className: `${backdrop ? 'tw:backdrop-brightness-75' : ''} tw:h-full tw:w-full tw:grid tw:place-items-center tw:m-auto`, children: jsxRuntime.jsxs("div", { ref: overlayRef, className: `${card ? 'tw:card tw:card-body tw:shadow-xl' : ''} tw:bg-base-100 tw:p-6 ${className ?? ''} ${backdrop ? '' : 'tw:z-2000'} tw:absolute tw:top-0 tw:bottom-0 tw:right-0 tw:left-0 tw:m-auto`, children: [children, jsxRuntime.jsx("button", { className: 'tw:btn tw:btn-sm tw:btn-circle tw:btn-ghost tw:absolute tw:right-2 tw:top-2', onClick: () => closeScreen(), children: "\u2715" })] }) }) }));
2169
+ }
2170
+
2171
+ /**
2172
+ * @category Input
2173
+ */
2174
+ function TextAreaInput({ labelTitle, dataField, labelStyle, containerStyle, inputStyle, defaultValue, placeholder, required = true, updateFormValue, }) {
2175
+ const ref = React.useRef(null);
2176
+ const [inputValue, setInputValue] = React.useState(defaultValue);
2177
+ React.useEffect(() => {
2178
+ setInputValue(defaultValue);
2179
+ }, [defaultValue]);
2180
+ const handleChange = (e) => {
2181
+ const newValue = e.target.value;
2182
+ setInputValue(newValue);
2183
+ if (updateFormValue) {
2184
+ updateFormValue(newValue);
2185
+ }
2186
+ };
2187
+ return (jsxRuntime.jsxs("div", { className: `tw:form-control tw:w-full ${containerStyle ?? ''}`, children: [labelTitle ? (jsxRuntime.jsx("label", { className: 'tw:label', children: jsxRuntime.jsx("span", { className: `tw:label-text tw:text-base-content ${labelStyle ?? ''}`, children: labelTitle }) })) : null, jsxRuntime.jsx("textarea", { required: required, ref: ref, value: inputValue, name: dataField, className: `tw:textarea tw:textarea-bordered tw:w-full tw:leading-5 ${inputStyle ?? ''}`, placeholder: placeholder ?? '', onChange: handleChange })] }));
2188
+ }
2189
+
2190
+ /**
2191
+ * @category Input
2192
+ */
2193
+ function TextInput({ labelTitle, labelStyle, type, dataField, containerStyle, inputStyle, defaultValue, placeholder, autocomplete, pattern, required = true, updateFormValue, }) {
2194
+ const [inputValue, setInputValue] = React.useState(defaultValue ?? '');
2195
+ React.useEffect(() => {
2196
+ setInputValue(defaultValue ?? '');
2197
+ }, [defaultValue]);
2198
+ const handleChange = (e) => {
2199
+ const newValue = e.target.value;
2200
+ setInputValue(newValue);
2201
+ if (updateFormValue) {
2202
+ updateFormValue(newValue);
2203
+ }
2204
+ };
2205
+ return (jsxRuntime.jsxs("div", { className: `tw:form-control ${containerStyle ?? ''}`, children: [labelTitle ? (jsxRuntime.jsx("label", { className: 'tw:label', children: jsxRuntime.jsx("span", { className: `tw:label-text tw:text-base-content ${labelStyle ?? ''}`, children: labelTitle }) })) : null, jsxRuntime.jsx("input", { required: required, pattern: pattern, type: type ?? 'text', name: dataField, value: inputValue, placeholder: placeholder ?? '', autoComplete: autocomplete, onChange: handleChange, className: `tw:input tw:input-bordered tw:w-full ${inputStyle ?? ''}` })] }));
2206
+ }
2207
+
2208
+ /**
2209
+ * @category Map
2210
+ */
2211
+ const PopupStartEndInput = ({ item, showLabels = true, labelStyle, updateStartValue, updateEndValue, }) => {
2212
+ return (jsxRuntime.jsxs("div", { className: 'tw:grid tw:grid-cols-2 tw:gap-2', children: [jsxRuntime.jsx(TextInput, { type: 'date', placeholder: 'start', dataField: 'start', inputStyle: 'tw:text-sm tw:px-2', labelTitle: showLabels ? 'Start' : '', labelStyle: labelStyle, defaultValue: item && item.start ? item.start.substring(0, 10) : '', autocomplete: 'one-time-code', updateFormValue: updateStartValue }), jsxRuntime.jsx(TextInput, { type: 'date', placeholder: 'end', dataField: 'end', inputStyle: 'tw:text-sm tw:px-2', labelTitle: showLabels ? 'End' : '', labelStyle: labelStyle, defaultValue: item && item.end ? item.end.substring(0, 10) : '', autocomplete: 'one-time-code', updateFormValue: updateEndValue })] }));
2213
+ };
2214
+
2215
+ function CalendarDaysIcon({
2216
+ title,
2217
+ titleId,
2218
+ ...props
2219
+ }, svgRef) {
2220
+ return /*#__PURE__*/React__namespace.createElement("svg", Object.assign({
2221
+ xmlns: "http://www.w3.org/2000/svg",
2222
+ viewBox: "0 0 24 24",
2223
+ fill: "currentColor",
2224
+ "aria-hidden": "true",
2225
+ "data-slot": "icon",
2226
+ ref: svgRef,
2227
+ "aria-labelledby": titleId
2228
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2229
+ id: titleId
2230
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2231
+ d: "M12.75 12.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM7.5 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM8.25 17.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM9.75 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM10.5 17.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM12 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM12.75 17.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM14.25 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM15 17.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM16.5 15.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM15 12.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0ZM16.5 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z"
2232
+ }), /*#__PURE__*/React__namespace.createElement("path", {
2233
+ fillRule: "evenodd",
2234
+ d: "M6.75 2.25A.75.75 0 0 1 7.5 3v1.5h9V3A.75.75 0 0 1 18 3v1.5h.75a3 3 0 0 1 3 3v11.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V7.5a3 3 0 0 1 3-3H6V3a.75.75 0 0 1 .75-.75Zm13.5 9a1.5 1.5 0 0 0-1.5-1.5H5.25a1.5 1.5 0 0 0-1.5 1.5v7.5a1.5 1.5 0 0 0 1.5 1.5h13.5a1.5 1.5 0 0 0 1.5-1.5v-7.5Z",
2235
+ clipRule: "evenodd"
2236
+ }));
2237
+ }
2238
+ const ForwardRef$3 = /*#__PURE__*/ React__namespace.forwardRef(CalendarDaysIcon);
2239
+
2240
+ /**
2241
+ * @category Map
2242
+ */
2243
+ const StartEndView = ({ item }) => {
2244
+ return (jsxRuntime.jsxs("div", { className: 'tw:flex tw:flex-row tw:mb-4 tw:mt-1', children: [jsxRuntime.jsxs("div", { className: 'tw:basis-2/5 tw:flex tw:flex-row', children: [jsxRuntime.jsx(ForwardRef$3, { className: 'tw:h-4 tw:w-4 tw:mr-2' }), jsxRuntime.jsx("time", { className: 'tw:align-middle', dateTime: item && item.start ? item.start.substring(0, 10) : '', children: item && item.start ? new Date(item.start).toLocaleDateString() : '' })] }), jsxRuntime.jsx("div", { className: 'tw:basis-1/5 tw:place-content-center', children: jsxRuntime.jsx("span", { children: "-" }) }), jsxRuntime.jsxs("div", { className: 'tw:basis-2/5 tw:flex tw:flex-row', children: [jsxRuntime.jsx(ForwardRef$3, { className: 'tw:h-4 tw:w-4 tw:mr-2' }), jsxRuntime.jsx("time", { className: 'tw:align-middle', dateTime: item && item.end ? item.end.substring(0, 10) : '', children: item && item.end ? new Date(item.end).toLocaleDateString() : '' })] })] }));
2245
+ };
2246
+
2247
+ function PlusIcon({
2248
+ title,
2249
+ titleId,
2250
+ ...props
2251
+ }, svgRef) {
2252
+ return /*#__PURE__*/React__namespace.createElement("svg", Object.assign({
2253
+ xmlns: "http://www.w3.org/2000/svg",
2254
+ fill: "none",
2255
+ viewBox: "0 0 24 24",
2256
+ strokeWidth: 1.5,
2257
+ stroke: "currentColor",
2258
+ "aria-hidden": "true",
2259
+ "data-slot": "icon",
2260
+ ref: svgRef,
2261
+ "aria-labelledby": titleId
2262
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2263
+ id: titleId
2264
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2265
+ strokeLinecap: "round",
2266
+ strokeLinejoin: "round",
2267
+ d: "M12 4.5v15m7.5-7.5h-15"
2268
+ }));
2269
+ }
2270
+ const ForwardRef$2 = /*#__PURE__*/ React__namespace.forwardRef(PlusIcon);
2271
+
2272
+ const goldenRatioConjugate = 0.618033988749895;
2273
+ const randomColor = () => {
2274
+ return hsvToHex((Math.random() + goldenRatioConjugate) % 1, 0.8, 0.7);
2275
+ };
2276
+ function hsvToHex(h, s, v) {
2277
+ let r, g, b;
2278
+ const i = Math.floor(h * 6);
2279
+ const f = h * 6 - i;
2280
+ const p = v * (1 - s);
2281
+ const q = v * (1 - f * s);
2282
+ const t = v * (1 - (1 - f) * s);
2283
+ switch (i % 6) {
2284
+ case 0:
2285
+ r = v;
2286
+ g = t;
2287
+ b = p;
2288
+ break;
2289
+ case 1:
2290
+ r = q;
2291
+ g = v;
2292
+ b = p;
2293
+ break;
2294
+ case 2:
2295
+ r = p;
2296
+ g = v;
2297
+ b = t;
2298
+ break;
2299
+ case 3:
2300
+ r = p;
2301
+ g = q;
2302
+ b = v;
2303
+ break;
2304
+ case 4:
2305
+ r = t;
2306
+ g = p;
2307
+ b = v;
2308
+ break;
2309
+ case 5:
2310
+ r = v;
2311
+ g = p;
2312
+ b = q;
2313
+ break;
2314
+ }
2315
+ return rgbToHex(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255));
2316
+ }
2317
+ const rgbToHex = (r, g, b) => '#' +
2318
+ [r, g, b]
2319
+ .map((x) => {
2320
+ const hex = x.toString(16);
2321
+ return hex.length === 1 ? `0${hex}` : hex;
2322
+ })
2323
+ .join('');
2324
+
2325
+ function PencilIcon({
2326
+ title,
2327
+ titleId,
2328
+ ...props
2329
+ }, svgRef) {
2330
+ return /*#__PURE__*/React__namespace.createElement("svg", Object.assign({
2331
+ xmlns: "http://www.w3.org/2000/svg",
2332
+ viewBox: "0 0 24 24",
2333
+ fill: "currentColor",
2334
+ "aria-hidden": "true",
2335
+ "data-slot": "icon",
2336
+ ref: svgRef,
2337
+ "aria-labelledby": titleId
2338
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2339
+ id: titleId
2340
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2341
+ d: "M21.731 2.269a2.625 2.625 0 0 0-3.712 0l-1.157 1.157 3.712 3.712 1.157-1.157a2.625 2.625 0 0 0 0-3.712ZM19.513 8.199l-3.712-3.712-12.15 12.15a5.25 5.25 0 0 0-1.32 2.214l-.8 2.685a.75.75 0 0 0 .933.933l2.685-.8a5.25 5.25 0 0 0 2.214-1.32L19.513 8.2Z"
2342
+ }));
2343
+ }
2344
+ const ForwardRef$1 = /*#__PURE__*/ React__namespace.forwardRef(PencilIcon);
2345
+
2346
+ function TrashIcon({
2347
+ title,
2348
+ titleId,
2349
+ ...props
2350
+ }, svgRef) {
2351
+ return /*#__PURE__*/React__namespace.createElement("svg", Object.assign({
2352
+ xmlns: "http://www.w3.org/2000/svg",
2353
+ viewBox: "0 0 24 24",
2354
+ fill: "currentColor",
2355
+ "aria-hidden": "true",
2356
+ "data-slot": "icon",
2357
+ ref: svgRef,
2358
+ "aria-labelledby": titleId
2359
+ }, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
2360
+ id: titleId
2361
+ }, title) : null, /*#__PURE__*/React__namespace.createElement("path", {
2362
+ fillRule: "evenodd",
2363
+ d: "M16.5 4.478v.227a48.816 48.816 0 0 1 3.878.512.75.75 0 1 1-.256 1.478l-.209-.035-1.005 13.07a3 3 0 0 1-2.991 2.77H8.084a3 3 0 0 1-2.991-2.77L4.087 6.66l-.209.035a.75.75 0 0 1-.256-1.478A48.567 48.567 0 0 1 7.5 4.705v-.227c0-1.564 1.213-2.9 2.816-2.951a52.662 52.662 0 0 1 3.369 0c1.603.051 2.815 1.387 2.815 2.951Zm-6.136-1.452a51.196 51.196 0 0 1 3.273 0C14.39 3.05 15 3.684 15 4.478v.113a49.488 49.488 0 0 0-6 0v-.113c0-.794.609-1.428 1.364-1.452Zm-.355 5.945a.75.75 0 1 0-1.5.058l.347 9a.75.75 0 1 0 1.499-.058l-.346-9Zm5.48.058a.75.75 0 1 0-1.498-.058l-.347 9a.75.75 0 0 0 1.5.058l.345-9Z",
2364
+ clipRule: "evenodd"
2365
+ }));
2366
+ }
2367
+ const ForwardRef = /*#__PURE__*/ React__namespace.forwardRef(TrashIcon);
2368
+
2369
+ var TargetDotSVG = 'data:image/svg+xml;base64,PHN2ZwogICAgICAgICAgICAgICAgICAgICAgICAgICAgc3Ryb2tlPSdjdXJyZW50Q29sb3InCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBmaWxsPSdjdXJyZW50Q29sb3InCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdHJva2VXaWR0aD0nMCcKICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZpZXdCb3g9JzAgMCA1MTIgNTEyJwogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2xhc3NOYW1lPSd3LTUgaC01JwogICAgICAgICAgICAgICAgICAgICAgICAgICAgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJwogICAgICAgICAgICAgICAgICAgICAgICAgID4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxwYXRoIGQ9J00yNTYgMGMxNy43IDAgMzIgMTQuMyAzMiAzMlY0Mi40YzkzLjcgMTMuOSAxNjcuNyA4OCAxODEuNiAxODEuNkg0ODBjMTcuNyAwIDMyIDE0LjMgMzIgMzJzLTE0LjMgMzItMzIgMzJINDY5LjZjLTEzLjkgOTMuNy04OCAxNjcuNy0xODEuNiAxODEuNlY0ODBjMCAxNy43LTE0LjMgMzItMzIgMzJzLTMyLTE0LjMtMzItMzJWNDY5LjZDMTMwLjMgNDU1LjcgNTYuMyAzODEuNyA0Mi40IDI4OEgzMmMtMTcuNyAwLTMyLTE0LjMtMzItMzJzMTQuMy0zMiAzMi0zMkg0Mi40QzU2LjMgMTMwLjMgMTMwLjMgNTYuMyAyMjQgNDIuNFYzMmMwLTE3LjcgMTQuMy0zMiAzMi0zMnpNMTA3LjQgMjg4YzEyLjUgNTguMyA1OC40IDEwNC4xIDExNi42IDExNi42VjM4NGMwLTE3LjcgMTQuMy0zMiAzMi0zMnMzMiAxNC4zIDMyIDMydjIwLjZjNTguMy0xMi41IDEwNC4xLTU4LjQgMTE2LjYtMTE2LjZIMzg0Yy0xNy43IDAtMzItMTQuMy0zMi0zMnMxNC4zLTMyIDMyLTMyaDIwLjZDMzkyLjEgMTY1LjcgMzQ2LjMgMTE5LjkgMjg4IDEwNy40VjEyOGMwIDE3LjctMTQuMyAzMi0zMiAzMnMtMzItMTQuMy0zMi0zMlYxMDcuNEMxNjUuNyAxMTkuOSAxMTkuOSAxNjUuNyAxMDcuNCAyMjRIMTI4YzE3LjcgMCAzMiAxNC4zIDMyIDMycy0xNC4zIDMyLTMyIDMySDEwNy40ek0yNTYgMjI0YTMyIDMyIDAgMSAxIDAgNjQgMzIgMzIgMCAxIDEgMC02NHonPjwvcGF0aD4KICAgICAgICAgICAgICAgICAgICAgICAgICA8L3N2Zz4=';
2370
+
2371
+ const isClickInsideRectangle = (e, element) => {
2372
+ const r = element.getBoundingClientRect();
2373
+ return e.clientX > r.left && e.clientX < r.right && e.clientY > r.top && e.clientY < r.bottom;
2374
+ };
2375
+ const DialogModal = ({ title, isOpened, onClose, children, showCloseButton = true, closeOnClickOutside = true, className, }) => {
2376
+ const ref = React.useRef(null);
2377
+ React.useEffect(() => {
2378
+ if (isOpened) {
2379
+ ref.current?.showModal();
2380
+ ref.current?.classList.remove('tw:hidden');
2381
+ document.body.classList.add('modal-open'); // prevent bg scroll
2382
+ }
2383
+ else {
2384
+ ref.current?.close();
2385
+ ref.current?.classList.add('tw:hidden');
2386
+ document.body.classList.remove('modal-open');
2387
+ }
2388
+ }, [isOpened]);
2389
+ if (isOpened) {
2390
+ return (jsxRuntime.jsx("dialog", { className: `${className ?? ''} card tw:shadow-xl tw:absolute tw:right-0 tw:top-0 tw:bottom-0 tw:left-0 tw:m-auto tw:transition-opacity tw:duration-300 tw:p-4 tw:max-w-xl tw:bg-base-100`, ref: ref, onCancel: onClose, onClick: (e) => ref.current && !isClickInsideRectangle(e, ref.current) && closeOnClickOutside && onClose(), children: jsxRuntime.jsxs("div", { className: 'card-body tw:p-2', children: [jsxRuntime.jsx("h2", { className: 'tw:text-2xl tw:font-semibold tw:mb-2 tw:text-center', children: title }), children, showCloseButton && (jsxRuntime.jsx("button", { className: 'btn btn-sm btn-circle btn-ghost tw:absolute tw:right-2 tw:top-2', onClick: onClose, children: "\u2715" }))] }) }));
2391
+ }
2392
+ else
2393
+ return jsxRuntime.jsx(jsxRuntime.Fragment, {});
2394
+ };
2395
+
2396
+ function HeaderView({ item, api, editCallback, deleteCallback, setPositionCallback, loading, hideMenu = false, big = false, truncateSubname = true, hideSubname = false, showAddress = false, }) {
2397
+ const [modalOpen, setModalOpen] = React.useState(false);
2398
+ const hasUserPermission = useHasUserPermission();
2399
+ const navigate = reactRouterDom.useNavigate();
2400
+ const appState = useAppState();
2401
+ const [imageLoaded, setImageLoaded] = React.useState(false);
2402
+ const avatar = item.image && appState.assetsApi.url + item.image + '?width=160&heigth=160';
2403
+ const title = item.name;
2404
+ const subtitle = item.subname;
2405
+ const [address] = React.useState('');
2406
+ const params = new URLSearchParams(window.location.search);
2407
+ const openDeleteModal = async (event) => {
2408
+ setModalOpen(true);
2409
+ event.stopPropagation();
2410
+ };
2411
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'tw:flex tw:flex-row', children: [jsxRuntime.jsx("div", { className: 'tw:grow tw:max-w-[calc(100%-60px)] }', children: jsxRuntime.jsxs("div", { className: 'flex items-center', children: [avatar && (jsxRuntime.jsx("div", { className: 'tw:avatar', children: jsxRuntime.jsxs("div", { className: `${big ? 'tw:w-20' : 'tw:w-10'} tw:inline tw:items-center tw:justify-center overflow-hidden`, children: [jsxRuntime.jsx("img", { className: 'tw:w-full tw:h-full tw:object-cover tw:rounded-full', src: avatar, alt: item.name + ' logo', onLoad: () => setImageLoaded(true), onError: () => setImageLoaded(false), style: { display: imageLoaded ? 'block' : 'none' } }), !imageLoaded && (jsxRuntime.jsx("div", { className: 'tw:w-full tw:h-full tw:bg-gray-200 tw:rounded-full' }))] }) })), jsxRuntime.jsxs("div", { className: `${avatar ? 'tw:ml-2' : ''} tw:overflow-hidden`, children: [jsxRuntime.jsx("div", { className: `${big ? 'tw:xl:text-3xl tw:text-2xl' : 'tw:text-xl'} tw:font-semibold tw:truncate`, title: title, children: title }), showAddress && address && !hideSubname && (jsxRuntime.jsx("div", { className: `tw:text-xs tw:text-gray-500 ${truncateSubname && 'tw:truncate'}`, children: address })), subtitle && !hideSubname && (jsxRuntime.jsx("div", { className: `tw:text-xs tw:opacity-50 ${truncateSubname && 'tw:truncate'}`, children: subtitle }))] })] }) }), jsxRuntime.jsx("div", { onClick: (e) => e.stopPropagation(), className: `${big ? 'tw:mt-5' : 'tw:mt-1'}`, children: (api?.deleteItem || item.layer?.api?.updateItem) &&
2412
+ (hasUserPermission(api?.collectionName, 'delete', item) ||
2413
+ hasUserPermission(api?.collectionName, 'update', item)) &&
2414
+ !hideMenu && (jsxRuntime.jsxs("div", { className: 'tw:dropdown tw:dropdown-bottom', children: [jsxRuntime.jsx("label", { tabIndex: 0, className: 'tw:bg-base-100 tw:btn tw:m-1 tw:leading-3 tw:border-none tw:min-h-0 tw:h-6', children: jsxRuntime.jsx(ForwardRef$4, { className: 'tw:h-5 tw:w-5' }) }), jsxRuntime.jsxs("ul", { tabIndex: 0, className: 'tw:dropdown-content tw:menu tw:p-2 tw:shadow tw:bg-base-100 tw:rounded-box tw:z-1000', children: [api?.updateItem &&
2415
+ hasUserPermission(api.collectionName, 'update', item) &&
2416
+ editCallback && (jsxRuntime.jsx("li", { children: jsxRuntime.jsx("a", { className: 'tw:text-base-content! tw:tooltip tw:tooltip-right tw:cursor-pointer', "data-tip": 'Edit', onClick: (e) => item.layer?.customEditLink
2417
+ ? navigate(`${item.layer.customEditLink}${item.layer.customEditParameter ? `/${item.id}${params && '?' + params}` : ''} `)
2418
+ : editCallback(e), children: jsxRuntime.jsx(ForwardRef$1, { className: 'tw:h-5 tw:w-5' }) }) })), api?.updateItem &&
2419
+ hasUserPermission(api.collectionName, 'update', item) &&
2420
+ setPositionCallback && (jsxRuntime.jsx("li", { children: jsxRuntime.jsx("a", { className: 'tw:text-base-content! tw:tooltip tw:tooltip-right tw:cursor-pointer', "data-tip": 'Set position', onClick: setPositionCallback, children: jsxRuntime.jsx(SVG, { src: TargetDotSVG, className: 'tw:w-5 tw:h-5' }) }) })), api?.deleteItem &&
2421
+ hasUserPermission(api.collectionName, 'delete', item) &&
2422
+ deleteCallback && (jsxRuntime.jsx("li", { children: jsxRuntime.jsx("a", { className: 'tw:text-error! tw:tooltip tw:tooltip-right tw:cursor-pointer', "data-tip": 'Delete', onClick: openDeleteModal, children: loading ? (jsxRuntime.jsx("span", { className: 'tw:loading tw:loading-spinner tw:loading-sm' })) : (jsxRuntime.jsx(ForwardRef, { className: 'tw:h-5 tw:w-5' })) }) }))] })] })) })] }), jsxRuntime.jsx(DialogModal, { isOpened: modalOpen, title: 'Are you sure?', showCloseButton: false, onClose: () => setModalOpen(false), children: jsxRuntime.jsxs("div", { onClick: (e) => e.stopPropagation(), children: [jsxRuntime.jsxs("span", { children: ["Do you want to delete ", jsxRuntime.jsx("b", { children: item.name }), "?"] }), jsxRuntime.jsx("div", { className: 'tw:grid', children: jsxRuntime.jsxs("div", { className: 'tw:flex tw:justify-between', children: [jsxRuntime.jsx("label", { className: 'tw:btn tw:mt-4 tw:btn-error', onClick: (e) => {
2423
+ deleteCallback(e);
2424
+ setModalOpen(false);
2425
+ }, children: "Yes" }), jsxRuntime.jsx("label", { className: 'tw:btn tw:mt-4', onClick: () => setModalOpen(false), children: "No" })] }) })] }) })] }));
2426
+ }
2427
+
2428
+ // in miliseconds
2429
+ const units = [
2430
+ { label: 'year', seconds: 31536000 },
2431
+ { label: 'month', seconds: 2592000 },
2432
+ { label: 'week', seconds: 604800 },
2433
+ { label: 'day', seconds: 86400 },
2434
+ { label: 'hour', seconds: 3600 },
2435
+ { label: 'minute', seconds: 60 },
2436
+ { label: 'second', seconds: 1 },
2437
+ ];
2438
+ const timeAgo = (date) => {
2439
+ const time = Math.floor((new Date().valueOf() - new Date(date).valueOf()) / 1000);
2440
+ const { interval, unit } = calculateTimeDifference(time);
2441
+ const suffix = interval === 1 ? '' : 's';
2442
+ return `${interval} ${unit}${suffix} ago`;
2443
+ };
2444
+ const calculateTimeDifference = (time) => {
2445
+ for (const { label, seconds } of units) {
2446
+ const interval = Math.floor(time / seconds);
2447
+ if (interval >= 1) {
2448
+ return {
2449
+ interval,
2450
+ unit: label,
2451
+ };
2452
+ }
2453
+ }
2454
+ return {
2455
+ interval: 0,
2456
+ unit: '',
2457
+ };
2458
+ };
2459
+
2460
+ const TagView = ({ tag, heighlight, onClick, count, }) => {
2461
+ return (
2462
+ // Use your imagination to render suggestions.
2463
+ jsxRuntime.jsxs("div", { onClick: onClick, className: `tw:flex tw:items-center tw:flex-row tw:rounded-2xl tw:text-white tw:p-2 tw:px-4 tw:shadow-xl card tw:mt-3 tw:mr-4 tw:cursor-pointer tw:w-fit ${heighlight ? 'tw:border-4 tw:border-base-200 tw:shadow-lg' : ''}`, style: { backgroundColor: tag.color ? tag.color : '#666' }, children: [jsxRuntime.jsx("b", { children: decodeTag(tag.name) }), count && jsxRuntime.jsxs("span", { className: 'tw:ml-2', children: ["(", count, ")"] })] }, tag.name));
2464
+ };
2465
+
2466
+ exports.AppStateProvider = AppStateProvider;
2467
+ exports.AuthProvider = AuthProvider;
2468
+ exports.ClusterRefProvider = ClusterRefProvider;
2469
+ exports.DialogModal = DialogModal;
2470
+ exports.FilterProvider = FilterProvider;
2471
+ exports.ForwardRef = ForwardRef$4;
2472
+ exports.ForwardRef$1 = ForwardRef$2;
2473
+ exports.ForwardRef$2 = ForwardRef;
2474
+ exports.HeaderView = HeaderView;
2475
+ exports.ItemsProvider = ItemsProvider;
2476
+ exports.LayersProvider = LayersProvider;
2477
+ exports.LeafletRefsProvider = LeafletRefsProvider;
2478
+ exports.MapOverlayPage = MapOverlayPage;
2479
+ exports.PermissionsProvider = PermissionsProvider;
2480
+ exports.PopupStartEndInput = PopupStartEndInput;
2481
+ exports.SelectPositionProvider = SelectPositionProvider;
2482
+ exports.StartEndView = StartEndView;
2483
+ exports.TagView = TagView;
2484
+ exports.TagsProvider = TagsProvider;
2485
+ exports.TextAreaInput = TextAreaInput;
2486
+ exports.TextInput = TextInput;
2487
+ exports.TextView = TextView;
2488
+ exports.decodeTag = decodeTag;
2489
+ exports.encodeTag = encodeTag;
2490
+ exports.hashTagRegex = hashTagRegex;
2491
+ exports.randomColor = randomColor;
2492
+ exports.timeAgo = timeAgo;
2493
+ exports.useAddFilterTag = useAddFilterTag;
2494
+ exports.useAddItem = useAddItem;
2495
+ exports.useAddMarker = useAddMarker;
2496
+ exports.useAddPopup = useAddPopup;
2497
+ exports.useAddTag = useAddTag;
2498
+ exports.useAddVisibleGroupType = useAddVisibleGroupType;
2499
+ exports.useAddVisibleLayer = useAddVisibleLayer;
2500
+ exports.useAllItemsLoaded = useAllItemsLoaded;
2501
+ exports.useAllTagsLoaded = useAllTagsLoaded;
2502
+ exports.useAppState = useAppState;
2503
+ exports.useAuth = useAuth;
2504
+ exports.useClusterRef = useClusterRef;
2505
+ exports.useFilterTags = useFilterTags;
2506
+ exports.useGetItemTags = useGetItemTags;
2507
+ exports.useHasUserPermission = useHasUserPermission;
2508
+ exports.useIsGroupTypeVisible = useIsGroupTypeVisible;
2509
+ exports.useIsLayerVisible = useIsLayerVisible;
2510
+ exports.useItems = useItems;
2511
+ exports.useLayers = useLayers;
2512
+ exports.useLeafletRefs = useLeafletRefs;
2513
+ exports.useRemoveFilterTag = useRemoveFilterTag;
2514
+ exports.useRemoveItem = useRemoveItem;
2515
+ exports.useResetFilterTags = useResetFilterTags;
2516
+ exports.useSelectPosition = useSelectPosition;
2517
+ exports.useSetAdminRole = useSetAdminRole;
2518
+ exports.useSetAppState = useSetAppState;
2519
+ exports.useSetClusterRef = useSetClusterRef;
2520
+ exports.useSetItemsApi = useSetItemsApi;
2521
+ exports.useSetItemsData = useSetItemsData;
2522
+ exports.useSetMapClicked = useSetMapClicked;
2523
+ exports.useSetMarkerClicked = useSetMarkerClicked;
2524
+ exports.useSetPermissionApi = useSetPermissionApi;
2525
+ exports.useSetPermissionData = useSetPermissionData;
2526
+ exports.useSetSelectPosition = useSetSelectPosition;
2527
+ exports.useSetTagApi = useSetTagApi;
2528
+ exports.useSetTagData = useSetTagData;
2529
+ exports.useTags = useTags;
2530
+ exports.useToggleVisibleGroupType = useToggleVisibleGroupType;
2531
+ exports.useToggleVisibleLayer = useToggleVisibleLayer;
2532
+ exports.useUpdateItem = useUpdateItem;
2533
+ exports.useVisibleGroupType = useVisibleGroupType;
2534
+ exports.useWindowDimensions = useWindowDimensions;
2535
+ //# sourceMappingURL=TagView-VEMo7xsv.js.map