@evergis/react 3.1.1 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/components/ErrorBoundary/index.d.ts +12 -0
  2. package/dist/components/ErrorBoundary/styled.d.ts +1 -0
  3. package/dist/components/ErrorBoundary/types.d.ts +7 -0
  4. package/dist/components/Map/Map.d.ts +5 -0
  5. package/dist/components/Map/components/BuildingsLayer/BuildingsLayer.d.ts +3 -0
  6. package/dist/components/Map/components/BuildingsLayer/index.d.ts +2 -0
  7. package/dist/components/Map/components/BuildingsLayer/types.d.ts +4 -0
  8. package/dist/components/Map/components/Layer/Layer.d.ts +3 -0
  9. package/dist/components/Map/components/Layer/RasterLayer.d.ts +3 -0
  10. package/dist/components/Map/components/Layer/VectorLayer.d.ts +3 -0
  11. package/dist/components/Map/components/Layer/constants.d.ts +137 -0
  12. package/dist/components/Map/components/Layer/index.d.ts +2 -0
  13. package/dist/components/Map/components/Layer/types.d.ts +12 -0
  14. package/dist/components/Map/components/Layer/utils/getClientStyleItemPrefixSuffix.d.ts +3 -0
  15. package/dist/components/Map/components/index.d.ts +2 -0
  16. package/dist/components/Map/index.d.ts +3 -0
  17. package/dist/components/Map/styled.d.ts +4 -0
  18. package/dist/components/Map/types.d.ts +10 -0
  19. package/dist/components/MapContext/MapContext.d.ts +2 -0
  20. package/dist/components/MapContext/MapProvider.d.ts +3 -0
  21. package/dist/components/MapContext/index.d.ts +3 -0
  22. package/dist/components/MapContext/types.d.ts +138 -0
  23. package/dist/components/ResizablePanel/ResizablePanel.d.ts +3 -0
  24. package/dist/components/ResizablePanel/index.d.ts +2 -0
  25. package/dist/components/ResizablePanel/styled.d.ts +11 -0
  26. package/dist/components/ResizablePanel/types.d.ts +14 -0
  27. package/dist/components/ServerNotificationsContext/ServerNotificationsContext.d.ts +2 -0
  28. package/dist/components/ServerNotificationsContext/ServerNotificationsProvider.d.ts +3 -0
  29. package/dist/components/ServerNotificationsContext/index.d.ts +3 -0
  30. package/dist/components/ServerNotificationsContext/types.d.ts +12 -0
  31. package/dist/components/index.d.ts +5 -0
  32. package/dist/core/classification/findAttributeInExpression.d.ts +2 -0
  33. package/dist/core/classification/getActualExtrusionHeight.d.ts +2 -0
  34. package/dist/core/classification/index.d.ts +3 -0
  35. package/dist/core/classification/parseClientStyle.d.ts +2 -0
  36. package/dist/core/feature/convertSpToTurfFeature.d.ts +3 -0
  37. package/dist/core/feature/index.d.ts +1 -0
  38. package/dist/core/geometrySelection/drawModeToGeometrySelectionType.d.ts +3 -0
  39. package/dist/core/geometrySelection/getGeometrySelectionTurfFeature.d.ts +3 -0
  40. package/dist/core/geometrySelection/index.d.ts +2 -0
  41. package/dist/core/index.d.ts +4 -0
  42. package/dist/core/types/index.d.ts +2 -0
  43. package/dist/core/types/map.d.ts +5 -0
  44. package/dist/core/types/styling.d.ts +15 -0
  45. package/dist/hooks/index.d.ts +3 -0
  46. package/dist/hooks/map/index.d.ts +22 -0
  47. package/dist/hooks/map/useCurrentSelectedFeature.d.ts +2 -0
  48. package/dist/hooks/map/useEditingFeature.d.ts +1 -0
  49. package/dist/hooks/map/useEwktGeometry.d.ts +1 -0
  50. package/dist/hooks/map/useGeometryEditor.d.ts +2 -0
  51. package/dist/hooks/map/useGeometrySelection.d.ts +2 -0
  52. package/dist/hooks/map/useGeometrySelectionBuffer.d.ts +1 -0
  53. package/dist/hooks/map/useMapContext.d.ts +1 -0
  54. package/dist/hooks/map/useMapDraw/customModes.d.ts +2 -0
  55. package/dist/hooks/map/useMapDraw/customStyles.d.ts +58 -0
  56. package/dist/hooks/map/useMapDraw/index.d.ts +1 -0
  57. package/dist/hooks/map/useRedrawLayer.d.ts +1 -0
  58. package/dist/hooks/map/useSelectFeaturesCount.d.ts +1 -0
  59. package/dist/hooks/map/useSelectFeaturesCurrentIndex.d.ts +1 -0
  60. package/dist/hooks/map/useSelectFeaturesGeometryMasking.d.ts +1 -0
  61. package/dist/hooks/map/useSelectFeaturesInitialized.d.ts +1 -0
  62. package/dist/hooks/map/useSelectFeaturesLayerName.d.ts +1 -0
  63. package/dist/hooks/map/useSelectFeaturesPagination.d.ts +4 -0
  64. package/dist/hooks/map/useSelectFeaturesStatisticsActive.d.ts +1 -0
  65. package/dist/hooks/map/useSelectFeaturesTotalCounts.d.ts +1 -0
  66. package/dist/hooks/map/useSelectedFeatures.d.ts +2 -0
  67. package/dist/hooks/map/useUpdateCurrentFeature.d.ts +2 -0
  68. package/dist/hooks/map/useZoomToFeatures.d.ts +2 -0
  69. package/dist/hooks/map/useZoomToLayer.d.ts +7 -0
  70. package/dist/hooks/map/useZoomToPoint.d.ts +1 -0
  71. package/dist/hooks/serverNotifications/index.d.ts +2 -0
  72. package/dist/hooks/serverNotifications/useServerNotifications.d.ts +2 -0
  73. package/dist/hooks/serverNotifications/useServerNotificationsContext.d.ts +1 -0
  74. package/dist/hooks/useResizer.d.ts +28 -0
  75. package/dist/hooks/useToggle.d.ts +1 -1
  76. package/dist/index.d.ts +1 -0
  77. package/dist/jest.config.d.ts +11 -0
  78. package/dist/react.cjs.development.js +1653 -5
  79. package/dist/react.cjs.development.js.map +1 -1
  80. package/dist/react.cjs.production.min.js +1 -1
  81. package/dist/react.cjs.production.min.js.map +1 -1
  82. package/dist/react.esm.js +1624 -6
  83. package/dist/react.esm.js.map +1 -1
  84. package/dist/utils/date.d.ts +2 -2
  85. package/dist/utils/geometryToWkt.d.ts +2 -0
  86. package/dist/utils/index.d.ts +1 -0
  87. package/package.json +30 -23
@@ -2,13 +2,497 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var react = require('react');
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var React = require('react');
8
+ var React__default = _interopDefault(React);
9
+ var styled = require('styled-components');
10
+ var styled__default = _interopDefault(styled);
11
+ var MapGL = require('react-map-gl/mapbox');
12
+ var MapGL__default = _interopDefault(MapGL);
13
+ require('@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css');
14
+ var findAnd = require('find-and');
15
+ var lodash = require('lodash');
6
16
  var dateFns = require('date-fns');
17
+ var wkt = require('wkt');
18
+ var MapboxDraw = _interopDefault(require('@mapbox/mapbox-gl-draw'));
19
+ var turf = require('@turf/turf');
20
+ var api = require('@evergis/api');
21
+ var signalr = require('@microsoft/signalr');
22
+ require('mapbox-gl/dist/mapbox-gl.css');
7
23
 
8
- const useToggle = initial => {
9
- const [state, setState] = react.useState(initial !== undefined ? initial : false);
10
- const toggle = react.useCallback(() => setState(!state), [state]);
11
- return [state, toggle, setState];
24
+ function _classCallCheck(instance, Constructor) {
25
+ if (!(instance instanceof Constructor)) {
26
+ throw new TypeError("Cannot call a class as a function");
27
+ }
28
+ }
29
+
30
+ function _defineProperties(target, props) {
31
+ for (var i = 0; i < props.length; i++) {
32
+ var descriptor = props[i];
33
+ descriptor.enumerable = descriptor.enumerable || false;
34
+ descriptor.configurable = true;
35
+ if ("value" in descriptor) descriptor.writable = true;
36
+ Object.defineProperty(target, descriptor.key, descriptor);
37
+ }
38
+ }
39
+
40
+ function _createClass(Constructor, protoProps, staticProps) {
41
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
42
+ if (staticProps) _defineProperties(Constructor, staticProps);
43
+ return Constructor;
44
+ }
45
+
46
+ function _extends() {
47
+ _extends = Object.assign || function (target) {
48
+ for (var i = 1; i < arguments.length; i++) {
49
+ var source = arguments[i];
50
+
51
+ for (var key in source) {
52
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
53
+ target[key] = source[key];
54
+ }
55
+ }
56
+ }
57
+
58
+ return target;
59
+ };
60
+
61
+ return _extends.apply(this, arguments);
62
+ }
63
+
64
+ function _inherits(subClass, superClass) {
65
+ if (typeof superClass !== "function" && superClass !== null) {
66
+ throw new TypeError("Super expression must either be null or a function");
67
+ }
68
+
69
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
70
+ constructor: {
71
+ value: subClass,
72
+ writable: true,
73
+ configurable: true
74
+ }
75
+ });
76
+ if (superClass) _setPrototypeOf(subClass, superClass);
77
+ }
78
+
79
+ function _getPrototypeOf(o) {
80
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
81
+ return o.__proto__ || Object.getPrototypeOf(o);
82
+ };
83
+ return _getPrototypeOf(o);
84
+ }
85
+
86
+ function _setPrototypeOf(o, p) {
87
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
88
+ o.__proto__ = p;
89
+ return o;
90
+ };
91
+
92
+ return _setPrototypeOf(o, p);
93
+ }
94
+
95
+ function _objectWithoutPropertiesLoose(source, excluded) {
96
+ if (source == null) return {};
97
+ var target = {};
98
+ var sourceKeys = Object.keys(source);
99
+ var key, i;
100
+
101
+ for (i = 0; i < sourceKeys.length; i++) {
102
+ key = sourceKeys[i];
103
+ if (excluded.indexOf(key) >= 0) continue;
104
+ target[key] = source[key];
105
+ }
106
+
107
+ return target;
108
+ }
109
+
110
+ function _assertThisInitialized(self) {
111
+ if (self === void 0) {
112
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
113
+ }
114
+
115
+ return self;
116
+ }
117
+
118
+ function _possibleConstructorReturn(self, call) {
119
+ if (call && (typeof call === "object" || typeof call === "function")) {
120
+ return call;
121
+ }
122
+
123
+ return _assertThisInitialized(self);
124
+ }
125
+
126
+ function _taggedTemplateLiteralLoose(strings, raw) {
127
+ if (!raw) {
128
+ raw = strings.slice(0);
129
+ }
130
+
131
+ strings.raw = raw;
132
+ return strings;
133
+ }
134
+
135
+ var _templateObject;
136
+ const ErrorBoundaryContainer = /*#__PURE__*/styled__default.div(_templateObject || (_templateObject = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100vh;\n"])));
137
+
138
+ function _callSuper(_this, derived, args) {
139
+ function isNativeReflectConstruct() {
140
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
141
+ if (Reflect.construct.sham) return false;
142
+ if (typeof Proxy === "function") return true;
143
+
144
+ try {
145
+ return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
146
+ } catch (e) {
147
+ return false;
148
+ }
149
+ }
150
+
151
+ derived = _getPrototypeOf(derived);
152
+ return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
153
+ }
154
+ let ErrorBoundary = /*#__PURE__*/function (_Component) {
155
+ function ErrorBoundary() {
156
+ var _this2;
157
+
158
+ _classCallCheck(this, ErrorBoundary);
159
+
160
+ _this2 = _callSuper(this, ErrorBoundary, arguments);
161
+ _this2.state = {
162
+ hasError: false
163
+ };
164
+ return _this2;
165
+ }
166
+
167
+ _inherits(ErrorBoundary, _Component);
168
+
169
+ return _createClass(ErrorBoundary, [{
170
+ key: "componentDidCatch",
171
+ value: function componentDidCatch(error) {
172
+ // eslint-disable-next-line no-console
173
+ console.error(error);
174
+ }
175
+ }, {
176
+ key: "render",
177
+ value: function render() {
178
+ const {
179
+ children,
180
+ errorContents
181
+ } = this.props;
182
+ const {
183
+ hasError
184
+ } = this.state;
185
+ return !hasError ? React__default.createElement(React__default.Fragment, null, children) : React__default.createElement(ErrorBoundaryContainer, null, errorContents);
186
+ }
187
+ }], [{
188
+ key: "getDerivedStateFromError",
189
+ value: function getDerivedStateFromError() {
190
+ return {
191
+ hasError: true
192
+ };
193
+ }
194
+ }]);
195
+ }(React.Component);
196
+
197
+ var _templateObject$1;
198
+ const MapWrapper = /*#__PURE__*/styled__default.div(_templateObject$1 || (_templateObject$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: relative;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n z-index: ", ";\n\n .mapbox-gl-draw_trash {\n display: none;\n }\n\n .mapboxgl-ctrl-logo {\n display: none;\n }\n\n .mapboxgl-ctrl.mapboxgl-ctrl-attrib {\n display: none;\n }\n\n .mapboxgl-ctrl-geocoder.mapboxgl-ctrl {\n width: 350px;\n }\n"])), (_ref) => {
199
+ let {
200
+ $zIndex
201
+ } = _ref;
202
+ return $zIndex != null ? $zIndex : 1;
203
+ });
204
+
205
+ const useMapContext = () => {
206
+ return React.useContext(MapContext);
207
+ };
208
+
209
+ const useCurrentSelectedFeature = () => {
210
+ const {
211
+ selectFeatures
212
+ } = useMapContext();
213
+ return React.useMemo(() => {
214
+ var _selectFeatures$featu;
215
+
216
+ return (_selectFeatures$featu = selectFeatures.features) == null || (_selectFeatures$featu = _selectFeatures$featu[selectFeatures.layerName]) == null ? void 0 : _selectFeatures$featu.find(item => item.id === selectFeatures.currentId);
217
+ }, [selectFeatures]);
218
+ };
219
+
220
+ const MapContext = /*#__PURE__*/React.createContext({});
221
+
222
+ (function (BaseMapTheme) {
223
+ BaseMapTheme["Light"] = "light";
224
+ BaseMapTheme["Dark"] = "dark";
225
+ })(exports.BaseMapTheme || (exports.BaseMapTheme = {}));
226
+
227
+ (function (GeometrySelectionTypes) {
228
+ GeometrySelectionTypes["Point"] = "select_point";
229
+ GeometrySelectionTypes["Line"] = "select_line";
230
+ GeometrySelectionTypes["Circle"] = "select_circle";
231
+ GeometrySelectionTypes["Rect"] = "select_rect";
232
+ GeometrySelectionTypes["Polygon"] = "select_polygon";
233
+ GeometrySelectionTypes["Zones"] = "zones_selection";
234
+ GeometrySelectionTypes["Coordinates"] = "xy";
235
+ GeometrySelectionTypes["Route"] = "selection_route";
236
+ })(exports.GeometrySelectionTypes || (exports.GeometrySelectionTypes = {}));
237
+
238
+ (function (GeometrySelectionToolTypes) {
239
+ GeometrySelectionToolTypes["Replace"] = "Replace";
240
+ GeometrySelectionToolTypes["Unite"] = "Unite";
241
+ GeometrySelectionToolTypes["Crop"] = "Crop";
242
+ GeometrySelectionToolTypes["Edit"] = "Edit";
243
+ })(exports.GeometrySelectionToolTypes || (exports.GeometrySelectionToolTypes = {}));
244
+
245
+ (function (GeometrySelectionZoneTypes) {
246
+ GeometrySelectionZoneTypes["Walking"] = "Walking";
247
+ GeometrySelectionZoneTypes["Car"] = "Car";
248
+ })(exports.GeometrySelectionZoneTypes || (exports.GeometrySelectionZoneTypes = {}));
249
+
250
+ (function (GeometrySelectionRouteTypes) {
251
+ GeometrySelectionRouteTypes["Walking"] = "Walking";
252
+ GeometrySelectionRouteTypes["Car"] = "Car";
253
+ })(exports.GeometrySelectionRouteTypes || (exports.GeometrySelectionRouteTypes = {}));
254
+
255
+ (function (GeometryEditorMode) {
256
+ GeometryEditorMode[GeometryEditorMode["Create"] = 0] = "Create";
257
+ GeometryEditorMode[GeometryEditorMode["Edit"] = 1] = "Edit";
258
+ GeometryEditorMode[GeometryEditorMode["Transform"] = 2] = "Transform";
259
+ GeometryEditorMode[GeometryEditorMode["Expand"] = 3] = "Expand";
260
+ GeometryEditorMode[GeometryEditorMode["Unite"] = 4] = "Unite";
261
+ GeometryEditorMode[GeometryEditorMode["Subtract"] = 5] = "Subtract";
262
+ })(exports.GeometryEditorMode || (exports.GeometryEditorMode = {}));
263
+
264
+ const initialGeometrySelection = {
265
+ active: true,
266
+ loading: false,
267
+ type: exports.GeometrySelectionTypes.Point,
268
+ currentTool: exports.GeometrySelectionToolTypes.Replace,
269
+ history: {
270
+ features: [],
271
+ zones: [],
272
+ step: -1
273
+ },
274
+ editHistory: {
275
+ features: [],
276
+ step: -1
277
+ },
278
+ isBuffer: false,
279
+ settings: {
280
+ zoneDuration: 60,
281
+ zoneType: exports.GeometrySelectionZoneTypes.Walking,
282
+ routeType: exports.GeometrySelectionRouteTypes.Walking,
283
+ bufferRadius: "",
284
+ bufferMultiplier: "1",
285
+ bufferInclude: true,
286
+ selectOutside: false
287
+ }
288
+ };
289
+ const initialGeometryEditor = {
290
+ active: false
291
+ };
292
+ const initialSelectFeatures = {
293
+ initialized: false,
294
+ layerName: undefined,
295
+ currentId: null,
296
+ selectionOffset: 0,
297
+ features: {},
298
+ totalCounts: {},
299
+ statisticsActive: false,
300
+ geometryMasking: false
301
+ };
302
+ const MapProvider = (_ref) => {
303
+ let {
304
+ basemapItems,
305
+ defaultBasemap,
306
+ children
307
+ } = _ref;
308
+ const map = React.useRef();
309
+ const draw = React.useRef();
310
+ const [loaded, setLoaded] = React.useState(false);
311
+ const [basemapName, setBasemapName] = React.useState(defaultBasemap);
312
+ const [globeProjection, setGlobeProjection] = React.useState(false);
313
+ const [geometrySelection, setGeometrySelection] = React.useState(initialGeometrySelection);
314
+ const [geometryEditor, setGeometryEditor] = React.useState(initialGeometryEditor);
315
+ const [selectFeatures, setSelectFeatures] = React.useState(initialSelectFeatures);
316
+ const resetGeometrySelection = React.useCallback(() => {
317
+ setGeometrySelection(initialGeometrySelection);
318
+ }, []);
319
+ const resetGeometryEditor = React.useCallback(() => {
320
+ setGeometryEditor(initialGeometryEditor);
321
+ }, []);
322
+ const setNextFeature = React.useCallback(() => {
323
+ setSelectFeatures(state => {
324
+ var _features$layerName, _features$layerName2, _features$layerName3;
325
+
326
+ const {
327
+ layerName,
328
+ features,
329
+ currentId
330
+ } = state;
331
+ const currentIndex = features == null || (_features$layerName = features[layerName]) == null ? void 0 : _features$layerName.findIndex(item => item.id === currentId);
332
+
333
+ if (currentIndex === (features == null || (_features$layerName2 = features[layerName]) == null ? void 0 : _features$layerName2.length) - 1) {
334
+ return state;
335
+ }
336
+
337
+ const nextId = features == null || (_features$layerName3 = features[layerName]) == null || (_features$layerName3 = _features$layerName3[currentIndex + 1]) == null ? void 0 : _features$layerName3.id;
338
+ return _extends({}, state, {
339
+ currentId: nextId
340
+ });
341
+ });
342
+ }, []);
343
+ const setPrevFeature = React.useCallback(() => {
344
+ setSelectFeatures(state => {
345
+ var _features$layerName4, _features$layerName5;
346
+
347
+ const {
348
+ layerName,
349
+ features,
350
+ currentId
351
+ } = state;
352
+ const currentIndex = features == null || (_features$layerName4 = features[layerName]) == null ? void 0 : _features$layerName4.findIndex(item => item.id === currentId);
353
+
354
+ if (currentIndex === 0) {
355
+ return state;
356
+ }
357
+
358
+ const prevId = features == null || (_features$layerName5 = features[layerName]) == null || (_features$layerName5 = _features$layerName5[currentIndex - 1]) == null ? void 0 : _features$layerName5.id;
359
+ return _extends({}, state, {
360
+ currentId: prevId
361
+ });
362
+ });
363
+ }, []);
364
+ const setSelectedFeatures = React.useCallback((payload, currentId, offset) => {
365
+ setSelectFeatures(state => {
366
+ var _features$firstNotNul;
367
+
368
+ const features = payload != null ? payload : {};
369
+ const firstNotNullLayerName = Object.keys(features).find(key => features[key].length > 0);
370
+ const featureIdsToSelect = (_features$firstNotNul = features[firstNotNullLayerName]) == null ? void 0 : _features$firstNotNul.map((_ref2) => {
371
+ let {
372
+ id
373
+ } = _ref2;
374
+ return id;
375
+ });
376
+ return _extends({}, state, {
377
+ features,
378
+ layerName: firstNotNullLayerName,
379
+ currentId: currentId != null ? currentId : featureIdsToSelect == null ? void 0 : featureIdsToSelect[0],
380
+ selectionOffset: offset
381
+ });
382
+ });
383
+ }, []);
384
+ const setSelectedFeaturesTotalCounts = React.useCallback(payload => {
385
+ setSelectFeatures(state => _extends({}, state, {
386
+ totalCounts: payload
387
+ }));
388
+ }, []);
389
+ const setSelectFeaturesInitialized = React.useCallback(payload => {
390
+ setSelectFeatures(state => _extends({}, state, {
391
+ initialized: payload
392
+ }));
393
+ }, []);
394
+ const setSelectFeaturesLayerName = React.useCallback(payload => {
395
+ setSelectFeatures(state => {
396
+ var _state$features;
397
+
398
+ return _extends({}, state, {
399
+ layerName: payload,
400
+ currentId: (_state$features = state.features) == null || (_state$features = _state$features[payload]) == null || (_state$features = _state$features[0]) == null ? void 0 : _state$features.id,
401
+ selectionOffset: 0
402
+ });
403
+ });
404
+ }, []);
405
+ const setSelectFeaturesStatisticsActive = React.useCallback(payload => {
406
+ setSelectFeatures(state => _extends({}, state, {
407
+ statisticsActive: payload
408
+ }));
409
+ }, []);
410
+ const setSelectFeaturesGeometryMasking = React.useCallback(payload => {
411
+ setSelectFeatures(state => _extends({}, state, {
412
+ geometryMasking: payload
413
+ }));
414
+ }, []);
415
+ const updateCurrentFeature = React.useCallback(payload => {
416
+ setSelectFeatures(state => {
417
+ var _state$features$state, _state$features2;
418
+
419
+ return _extends({}, state, {
420
+ features: _extends({}, state.features, {
421
+ [state.layerName]: findAnd.changeProps((_state$features$state = (_state$features2 = state.features) == null ? void 0 : _state$features2[state.layerName]) != null ? _state$features$state : [], {
422
+ id: state.currentId
423
+ }, payload)
424
+ })
425
+ });
426
+ });
427
+ }, []);
428
+ const resetSelectedFeatures = React.useCallback(() => {
429
+ setSelectFeatures(initialSelectFeatures);
430
+ }, []);
431
+ return React__default.createElement(MapContext.Provider, {
432
+ value: {
433
+ map,
434
+ draw,
435
+ loaded,
436
+ setLoaded,
437
+ basemapItems,
438
+ basemapName,
439
+ setBasemapName,
440
+ defaultBasemap,
441
+ globeProjection,
442
+ setGlobeProjection,
443
+ geometrySelection,
444
+ setGeometrySelection,
445
+ resetGeometrySelection,
446
+ geometryEditor,
447
+ setGeometryEditor,
448
+ resetGeometryEditor,
449
+ selectFeatures,
450
+ setNextFeature,
451
+ setPrevFeature,
452
+ setSelectedFeatures,
453
+ setSelectedFeaturesTotalCounts,
454
+ setSelectFeaturesInitialized,
455
+ setSelectFeaturesLayerName,
456
+ setSelectFeaturesStatisticsActive,
457
+ setSelectFeaturesGeometryMasking,
458
+ updateCurrentFeature,
459
+ resetSelectedFeatures
460
+ }
461
+ }, children);
462
+ };
463
+
464
+ const useGeometryEditor = () => {
465
+ const {
466
+ geometryEditor,
467
+ setGeometryEditor
468
+ } = useMapContext();
469
+ const update = React.useCallback(newState => {
470
+ setGeometryEditor(prevState => _extends({}, prevState, newState));
471
+ }, [setGeometryEditor]);
472
+ return [geometryEditor, update];
473
+ };
474
+
475
+ const useEditingFeature = () => {
476
+ const [{
477
+ layerName,
478
+ active,
479
+ mode
480
+ }] = useGeometryEditor();
481
+ const currentSelectedFeature = useCurrentSelectedFeature();
482
+ return React.useMemo(() => {
483
+ return active && (mode === exports.GeometryEditorMode.Edit && layerName === (currentSelectedFeature == null ? void 0 : currentSelectedFeature.layer) || mode === exports.GeometryEditorMode.Create);
484
+ }, [active, currentSelectedFeature, layerName, mode]);
485
+ };
486
+
487
+ const useGeometrySelection = () => {
488
+ const {
489
+ geometrySelection,
490
+ setGeometrySelection
491
+ } = useMapContext();
492
+ const updateGeometrySelection = React.useCallback(newState => {
493
+ setGeometrySelection(prevState => _extends({}, prevState, newState));
494
+ }, [setGeometrySelection]);
495
+ return [geometrySelection, updateGeometrySelection];
12
496
  };
13
497
 
14
498
  const NO_CONTENT_VALUE = "—";
@@ -53,16 +537,1180 @@ const formatDate = function formatDate(date, _temp) {
53
537
  return defaultValue.toString();
54
538
  };
55
539
 
540
+ const geometryToWkt = function geometryToWkt(features) {
541
+ if (features === void 0) {
542
+ features = [];
543
+ }
544
+
545
+ if (features.length === 0) {
546
+ return "";
547
+ }
548
+
549
+ return wkt.stringify(features[0]);
550
+ };
551
+
56
552
  const isNumeric = number => !isNaN(parseFloat(number)) && isFinite(number);
57
553
 
58
554
  function isObject(value) {
59
555
  return typeof value === "object" && value !== null && !Array.isArray(value);
60
556
  }
61
557
 
558
+ const useEwktGeometry = () => {
559
+ const [{
560
+ history,
561
+ type
562
+ }] = useGeometrySelection();
563
+ return React.useMemo(() => {
564
+ var _history$zones$histor, _history$zones$histor2;
565
+
566
+ if (history.step === -1) {
567
+ return "";
568
+ }
569
+
570
+ return type === exports.GeometrySelectionTypes.Zones ? !lodash.isEmpty((_history$zones$histor = history.zones[history.step]) == null ? void 0 : _history$zones$histor[0]) ? "SRID=3857;" + geometryToWkt((_history$zones$histor2 = history.zones[history.step]) == null ? void 0 : _history$zones$histor2[0]) : "SRID=3857;" + geometryToWkt(history.features[history.step]) : "SRID=3857;" + geometryToWkt(history.features[history.step]);
571
+ }, [history.features, history.step, history.zones, type]);
572
+ };
573
+
574
+ const useGeometrySelectionBuffer = () => {
575
+ const [{
576
+ settings: {
577
+ bufferRadius,
578
+ bufferMultiplier
579
+ },
580
+ isBuffer
581
+ }] = useGeometrySelection();
582
+ return React.useMemo(() => {
583
+ if (!isBuffer || !bufferRadius) {
584
+ return undefined;
585
+ }
586
+
587
+ return Number((+bufferRadius || 0) * +bufferMultiplier).toFixed(2);
588
+ }, [isBuffer, bufferRadius, bufferMultiplier]);
589
+ };
590
+
591
+ const customModes = MapboxDraw.modes;
592
+ const StaticMode = {};
593
+
594
+ StaticMode.onSetup = function () {
595
+ this.setActionableState(undefined);
596
+ return {};
597
+ };
598
+
599
+ StaticMode.toDisplayFeatures = function (state, geojson, display) {
600
+ display(geojson);
601
+ };
602
+
603
+ customModes.static = StaticMode;
604
+
605
+ const customStyles = [{
606
+ id: "gl-draw-point",
607
+ type: "circle",
608
+ filter: ["all", ["==", "$type", "Point"]],
609
+ paint: {
610
+ "circle-radius": 5,
611
+ "circle-color": "#D20C0C",
612
+ "circle-stroke-color": "#FFFFFF",
613
+ "circle-stroke-width": 3,
614
+ "circle-stroke-opacity": 0.3
615
+ }
616
+ }, {
617
+ id: "highlight-inactive-points",
618
+ type: "circle",
619
+ filter: ["all", ["==", "$type", "Point"], ["==", "meta", "feature"], ["==", "active", "false"]],
620
+ paint: {
621
+ "circle-radius": 5,
622
+ "circle-color": "#D20C0C",
623
+ "circle-stroke-color": "#FFFFFF",
624
+ "circle-stroke-width": 3,
625
+ "circle-stroke-opacity": 0.3
626
+ }
627
+ }, {
628
+ id: "highlight-active-points",
629
+ type: "circle",
630
+ filter: ["all", ["==", "$type", "Point"], ["==", "meta", "feature"], ["==", "active", "true"]],
631
+ paint: {
632
+ "circle-radius": 3,
633
+ "circle-color": "#fbb03b",
634
+ "circle-stroke-color": "#FFFFFF",
635
+ "circle-stroke-width": 1,
636
+ "circle-stroke-opacity": 0.3
637
+ }
638
+ }, {
639
+ id: "gl-draw-polygon-fill-static",
640
+ type: "fill",
641
+ filter: ["all", ["==", "$type", "Polygon"]],
642
+ paint: {
643
+ "fill-color": "#D20C0C",
644
+ "fill-outline-color": "#D20C0C",
645
+ "fill-opacity": 0.1
646
+ }
647
+ }, {
648
+ id: "gl-draw-line",
649
+ type: "line",
650
+ filter: ["all", ["==", "$type", "LineString"]],
651
+ layout: {
652
+ "line-cap": "round",
653
+ "line-join": "round"
654
+ },
655
+ paint: {
656
+ "line-color": "#D20C0C",
657
+ "line-dasharray": [0.2, 2],
658
+ "line-width": 2
659
+ }
660
+ }, {
661
+ id: "gl-draw-polygon-fill",
662
+ type: "fill",
663
+ filter: ["all", ["==", "$type", "Polygon"]],
664
+ paint: {
665
+ "fill-color": "#D20C0C",
666
+ "fill-outline-color": "#D20C0C",
667
+ "fill-opacity": 0.1
668
+ }
669
+ }, {
670
+ id: "gl-draw-polygon-midpoint",
671
+ type: "circle",
672
+ filter: ["all", ["==", "$type", "Point"], ["==", "meta", "midpoint"]],
673
+ paint: {
674
+ "circle-radius": 3,
675
+ "circle-color": "#fbb03b",
676
+ "circle-stroke-color": "#FFFFFF",
677
+ "circle-stroke-width": 1,
678
+ "circle-stroke-opacity": 0.3
679
+ }
680
+ }, {
681
+ id: "gl-draw-polygon-stroke-active",
682
+ type: "line",
683
+ filter: ["all", ["==", "$type", "Polygon"]],
684
+ layout: {
685
+ "line-cap": "round",
686
+ "line-join": "round"
687
+ },
688
+ paint: {
689
+ "line-color": "#D20C0C",
690
+ "line-dasharray": [0.2, 2],
691
+ "line-width": 2
692
+ }
693
+ }, {
694
+ id: "gl-draw-polygon-and-line-vertex-active",
695
+ type: "circle",
696
+ filter: ["all", ["==", "meta", "vertex"], ["==", "$type", "Point"]],
697
+ paint: {
698
+ "circle-radius": 3,
699
+ "circle-color": "#D20C0C",
700
+ "circle-stroke-color": "#FFFFFF",
701
+ "circle-stroke-width": 3,
702
+ "circle-stroke-opacity": 0.3
703
+ }
704
+ }];
705
+
706
+ const draw = /*#__PURE__*/new MapboxDraw({
707
+ displayControlsDefault: false,
708
+ styles: customStyles,
709
+ modes: customModes,
710
+ defaultMode: "draw_point",
711
+ controls: {
712
+ trash: true
713
+ }
714
+ });
715
+ const useMapDraw = function useMapDraw(triggerDeps) {
716
+ if (triggerDeps === void 0) {
717
+ triggerDeps = [];
718
+ }
719
+
720
+ const {
721
+ map,
722
+ draw: drawContext,
723
+ loaded,
724
+ basemapName
725
+ } = useMapContext();
726
+ React.useEffect(() => {
727
+ if (!loaded || !map.current) {
728
+ return;
729
+ }
730
+
731
+ drawContext.current = draw;
732
+ map.current.addControl(drawContext.current);
733
+ }, [loaded]); // eslint-disable-line
734
+
735
+ React.useEffect(() => {
736
+ if (map.current && map.current.hasControl(drawContext.current)) {
737
+ map.current.removeControl(drawContext.current);
738
+ map.current.addControl(drawContext.current);
739
+ }
740
+ }, [basemapName, ...triggerDeps]); // eslint-disable-line
741
+ };
742
+
743
+ const useRedrawLayer = () => {
744
+ const {
745
+ map
746
+ } = useMapContext();
747
+ return React.useCallback(layerName => {
748
+ const layerTileSource = map.current.getSource(layerName);
749
+ layerTileSource.setTiles(layerTileSource.tiles);
750
+ }, [map]);
751
+ };
752
+
753
+ const useSelectedFeatures = () => {
754
+ var _selectFeatures$featu;
755
+
756
+ const {
757
+ selectFeatures,
758
+ setSelectedFeatures
759
+ } = useMapContext();
760
+ const updatSelectedFeatures = React.useCallback(features => {
761
+ setSelectedFeatures(features);
762
+ }, [setSelectedFeatures]);
763
+ return [(_selectFeatures$featu = selectFeatures.features) != null ? _selectFeatures$featu : {}, updatSelectedFeatures];
764
+ };
765
+
766
+ const useSelectFeaturesCount = () => {
767
+ const {
768
+ selectFeatures
769
+ } = useMapContext();
770
+ return React.useMemo(() => {
771
+ var _selectFeatures$featu, _selectFeatures$featu2;
772
+
773
+ return (_selectFeatures$featu = (_selectFeatures$featu2 = selectFeatures.features) == null || (_selectFeatures$featu2 = _selectFeatures$featu2[selectFeatures.layerName]) == null ? void 0 : _selectFeatures$featu2.length) != null ? _selectFeatures$featu : 0;
774
+ }, [selectFeatures]);
775
+ };
776
+
777
+ const useSelectFeaturesCurrentIndex = () => {
778
+ const {
779
+ selectFeatures
780
+ } = useMapContext();
781
+ return React.useMemo(() => {
782
+ var _selectFeatures$featu, _selectFeatures$featu2;
783
+
784
+ return (_selectFeatures$featu = selectFeatures.features) != null && (_selectFeatures$featu = _selectFeatures$featu[selectFeatures.layerName]) != null && _selectFeatures$featu.length ? (_selectFeatures$featu2 = selectFeatures.features) == null || (_selectFeatures$featu2 = _selectFeatures$featu2[selectFeatures.layerName]) == null ? void 0 : _selectFeatures$featu2.findIndex(feature => feature.id === selectFeatures.currentId) : -1;
785
+ }, [selectFeatures]);
786
+ };
787
+
788
+ const useSelectFeaturesGeometryMasking = () => {
789
+ const {
790
+ selectFeatures,
791
+ setSelectFeaturesGeometryMasking
792
+ } = useMapContext();
793
+ const update = React.useCallback(state => {
794
+ setSelectFeaturesGeometryMasking(state);
795
+ }, [setSelectFeaturesGeometryMasking]);
796
+ return [selectFeatures.geometryMasking, update];
797
+ };
798
+
799
+ const useSelectFeaturesInitialized = () => {
800
+ const {
801
+ selectFeatures,
802
+ setSelectFeaturesInitialized
803
+ } = useMapContext();
804
+ const update = React.useCallback(state => {
805
+ setSelectFeaturesInitialized(state);
806
+ }, [setSelectFeaturesInitialized]);
807
+ return [selectFeatures.initialized, update];
808
+ };
809
+
810
+ const useSelectFeaturesLayerName = () => {
811
+ const {
812
+ selectFeatures,
813
+ setSelectFeaturesLayerName
814
+ } = useMapContext();
815
+ const update = React.useCallback(name => {
816
+ setSelectFeaturesLayerName(name);
817
+ }, [setSelectFeaturesLayerName]);
818
+ return [selectFeatures.layerName, update];
819
+ };
820
+
821
+ const useSelectFeaturesPagination = () => {
822
+ const {
823
+ setNextFeature,
824
+ setPrevFeature
825
+ } = useMapContext();
826
+ const onNext = React.useCallback(() => {
827
+ setNextFeature();
828
+ }, [setNextFeature]);
829
+ const onPrev = React.useCallback(() => {
830
+ setPrevFeature();
831
+ }, [setPrevFeature]);
832
+ return {
833
+ onNext,
834
+ onPrev
835
+ };
836
+ };
837
+
838
+ const useSelectFeaturesStatisticsActive = () => {
839
+ const {
840
+ selectFeatures,
841
+ setSelectFeaturesStatisticsActive
842
+ } = useMapContext();
843
+ const update = React.useCallback(state => {
844
+ setSelectFeaturesStatisticsActive(state);
845
+ }, [setSelectFeaturesStatisticsActive]);
846
+ return [selectFeatures.statisticsActive, update];
847
+ };
848
+
849
+ const useSelectFeaturesTotalCounts = () => {
850
+ var _selectFeatures$total;
851
+
852
+ const {
853
+ selectFeatures,
854
+ setSelectedFeaturesTotalCounts
855
+ } = useMapContext();
856
+ const update = React.useCallback(totalCounts => {
857
+ setSelectedFeaturesTotalCounts(totalCounts);
858
+ }, [setSelectedFeaturesTotalCounts]);
859
+ return [(_selectFeatures$total = selectFeatures.totalCounts) != null ? _selectFeatures$total : {}, update];
860
+ };
861
+
862
+ const useUpdateCurrentFeature = () => {
863
+ const {
864
+ updateCurrentFeature
865
+ } = useMapContext();
866
+ return React.useCallback(values => {
867
+ updateCurrentFeature(values);
868
+ }, [updateCurrentFeature]);
869
+ };
870
+
871
+ const findAttributeInExpression = expression => {
872
+ if (Array.isArray(expression) && expression.length === 2 && expression[0] === "get") {
873
+ return [expression[1]];
874
+ }
875
+
876
+ return expression.reduce((acc, curr) => {
877
+ if (!Array.isArray(curr)) {
878
+ return acc;
879
+ }
880
+
881
+ if (curr[0] === "get") {
882
+ return [...new Set([...acc, curr[1]])];
883
+ }
884
+
885
+ return [...new Set([...acc, ...findAttributeInExpression(curr)])];
886
+ }, []);
887
+ };
888
+
889
+ const getActualExtrusionHeight = paint => {
890
+ return Array.isArray(paint == null ? void 0 : paint["fill-extrusion-height"]) && (paint == null ? void 0 : paint["fill-extrusion-height"][0]) === "+" ? paint == null ? void 0 : paint["fill-extrusion-height"][1] : paint == null ? void 0 : paint["fill-extrusion-height"];
891
+ };
892
+
893
+ const parseClientStyle = style => {
894
+ var _style$items;
895
+
896
+ if (!style) {
897
+ return [];
898
+ }
899
+
900
+ return style == null || (_style$items = style.items) == null ? void 0 : _style$items.reduce((acc, curr) => {
901
+ var _Object$entries;
902
+
903
+ if (!curr.paint || lodash.isEmpty(curr.paint)) {
904
+ return acc;
905
+ }
906
+
907
+ return (_Object$entries = Object.entries(curr.paint)) == null ? void 0 : _Object$entries.reduce((paintAcc, _ref) => {
908
+ let [, value] = _ref;
909
+
910
+ if (!Array.isArray(value)) {
911
+ return paintAcc;
912
+ }
913
+
914
+ return [...new Set([...paintAcc, ...findAttributeInExpression(value)])];
915
+ }, []);
916
+ }, []);
917
+ };
918
+
919
+ const convertSpToTurfFeature = geometry => {
920
+ if (!geometry) {
921
+ return;
922
+ }
923
+
924
+ switch (geometry.type) {
925
+ case api.GeometryType.Point:
926
+ return turf.point(geometry.coordinates);
927
+
928
+ case api.GeometryType.Multipoint:
929
+ return turf.multiPoint(geometry.coordinates);
930
+
931
+ case api.GeometryType.Polyline:
932
+ return turf.multiLineString(geometry.coordinates);
933
+
934
+ case api.GeometryType.Polygon:
935
+ case api.GeometryType.Envelope:
936
+ return turf.polygon(geometry.coordinates);
937
+ }
938
+ };
939
+
940
+ const drawModeToGeometrySelectionType = mode => {
941
+ switch (mode) {
942
+ case "draw_point":
943
+ return exports.GeometrySelectionTypes.Point;
944
+
945
+ case "draw_polygon":
946
+ return exports.GeometrySelectionTypes.Polygon;
947
+
948
+ case "draw_line_string":
949
+ return exports.GeometrySelectionTypes.Line;
950
+
951
+ default:
952
+ return exports.GeometrySelectionTypes.Point;
953
+ }
954
+ };
955
+
956
+ const getGeometrySelectionTurfFeature = (coordinates, selectionType, toWgs) => {
957
+ if (toWgs) {
958
+ switch (selectionType) {
959
+ case exports.GeometrySelectionTypes.Point:
960
+ return turf.toWgs84(turf.point(coordinates));
961
+
962
+ case exports.GeometrySelectionTypes.Polygon:
963
+ return turf.toWgs84(turf.polygon(coordinates));
964
+
965
+ case exports.GeometrySelectionTypes.Line:
966
+ return turf.toWgs84(turf.lineString(coordinates));
967
+ }
968
+ }
969
+
970
+ switch (selectionType) {
971
+ case exports.GeometrySelectionTypes.Point:
972
+ return turf.toMercator(turf.point(coordinates));
973
+
974
+ case exports.GeometrySelectionTypes.Polygon:
975
+ return turf.toMercator(turf.polygon(coordinates));
976
+
977
+ case exports.GeometrySelectionTypes.Line:
978
+ return turf.toMercator(turf.lineString(coordinates));
979
+ }
980
+ };
981
+
982
+ const useZoomToFeatures = () => {
983
+ const {
984
+ map
985
+ } = useMapContext();
986
+ return React.useCallback((features, padding) => {
987
+ if (!features) {
988
+ return;
989
+ }
990
+
991
+ const currentFeatureCenter = turf.bbox({
992
+ type: "FeatureCollection",
993
+ features: features.map(feature => convertSpToTurfFeature(feature.geometry))
994
+ });
995
+ map.current.fitBounds(currentFeatureCenter, {
996
+ padding: padding != null ? padding : 150
997
+ });
998
+ }, [map]);
999
+ };
1000
+
1001
+ const DEFAULT_PADDING = 50;
1002
+ const useZoomToLayer = () => {
1003
+ const {
1004
+ map
1005
+ } = useMapContext();
1006
+ return React.useCallback(async (bulkExtent, options) => {
1007
+ var _options$padding;
1008
+
1009
+ if (!bulkExtent || !bulkExtent.overall) {
1010
+ return;
1011
+ }
1012
+
1013
+ map.current.fitBounds([...bulkExtent.overall.coordinates[0], ...bulkExtent.overall.coordinates[1]], {
1014
+ padding: (_options$padding = options == null ? void 0 : options.padding) != null ? _options$padding : DEFAULT_PADDING
1015
+ });
1016
+ }, [map]);
1017
+ };
1018
+
1019
+ const useZoomToPoint = () => {
1020
+ const {
1021
+ map
1022
+ } = useMapContext();
1023
+ return React.useCallback((options, callback) => {
1024
+ if (map.current) {
1025
+ if (callback) {
1026
+ map.current.once("moveend", () => {
1027
+ callback();
1028
+ });
1029
+ }
1030
+
1031
+ map.current.flyTo(options);
1032
+ } else {
1033
+ callback == null || callback();
1034
+ }
1035
+ }, [map]);
1036
+ };
1037
+
1038
+ const useServerNotifications = (url, initialized) => {
1039
+ const hubConnection = React.useRef(null);
1040
+ const [connection, setConnection] = React.useState(null);
1041
+ React.useEffect(() => {
1042
+ if (!initialized) {
1043
+ return;
1044
+ }
1045
+
1046
+ hubConnection.current = new signalr.HubConnectionBuilder().withUrl(url, {
1047
+ withCredentials: true
1048
+ }).configureLogging(signalr.LogLevel.Information).build();
1049
+ hubConnection.current.start().then(() => console.info("Серверные нотификации подключены")).catch(err => console.info("Ошибка:", err)).finally(() => setConnection(hubConnection.current));
1050
+ }, [initialized]); // eslint-disable-line
1051
+
1052
+ React.useEffect(() => {
1053
+ if (!connection || connection.state !== "Connected") {
1054
+ return;
1055
+ }
1056
+
1057
+ connection.invoke("SubscribeNotifications", []).then(() => console.info("Подписка `SubscribeNotifications` оформлена")).catch(err => console.info("Ошибка подписки `SubscribeNotifications`:", err));
1058
+ }, [connection]);
1059
+ return connection;
1060
+ };
1061
+
1062
+ const ServerNotificationsContext = /*#__PURE__*/React.createContext({});
1063
+
1064
+ const useServerNotificationsContext = () => {
1065
+ return React.useContext(ServerNotificationsContext);
1066
+ };
1067
+
1068
+ (function (VerticalPosition) {
1069
+ VerticalPosition["Top"] = "top";
1070
+ VerticalPosition["Bottom"] = "bottom";
1071
+ })(exports.VerticalPosition || (exports.VerticalPosition = {}));
1072
+
1073
+ (function (HorizontalPosition) {
1074
+ HorizontalPosition["Left"] = "left";
1075
+ HorizontalPosition["Right"] = "right";
1076
+ })(exports.HorizontalPosition || (exports.HorizontalPosition = {}));
1077
+
1078
+ const useResizer = (_ref) => {
1079
+ let {
1080
+ handleVerticalPosition,
1081
+ handleHorizontalPosition,
1082
+ minWidth = Number.MIN_SAFE_INTEGER,
1083
+ maxWidth = Number.MAX_SAFE_INTEGER,
1084
+ horizontal = true,
1085
+ minHeight = Number.MIN_SAFE_INTEGER,
1086
+ maxHeight = Number.MAX_SAFE_INTEGER,
1087
+ vertical = true,
1088
+ useResize = false,
1089
+ onResize,
1090
+ onResizeEnd,
1091
+ onResizeStart
1092
+ } = _ref;
1093
+ const containerRef = React.useRef();
1094
+ const verticalHandleRef = React.useRef();
1095
+ const horizontalHandleRef = React.useRef();
1096
+ const updateSizes = React.useCallback((width, height) => {
1097
+ var _horizontalHandleRef$, _verticalHandleRef$cu;
1098
+
1099
+ let newWidth = width;
1100
+ let newHeight = height;
1101
+
1102
+ if (horizontal && newWidth < minWidth) {
1103
+ newWidth = minWidth;
1104
+ }
1105
+
1106
+ if (horizontal && newWidth > Math.min(window.innerWidth - ((_horizontalHandleRef$ = horizontalHandleRef.current) == null ? void 0 : _horizontalHandleRef$.clientWidth), maxWidth)) {
1107
+ newWidth = maxWidth;
1108
+ }
1109
+
1110
+ if (vertical && newHeight < minHeight) {
1111
+ newHeight = minHeight;
1112
+ }
1113
+
1114
+ if (vertical && newHeight > Math.min(window.innerHeight - ((_verticalHandleRef$cu = verticalHandleRef.current) == null ? void 0 : _verticalHandleRef$cu.clientHeight), maxHeight)) {
1115
+ newHeight = maxHeight;
1116
+ }
1117
+
1118
+ if (horizontal) {
1119
+ requestAnimationFrame(() => {
1120
+ if (!lodash.isNil(containerRef.current)) {
1121
+ containerRef.current.style.width = newWidth + "px";
1122
+ }
1123
+ });
1124
+ }
1125
+
1126
+ if (vertical) {
1127
+ requestAnimationFrame(() => {
1128
+ if (!lodash.isNil(containerRef.current)) {
1129
+ containerRef.current.style.height = newHeight + "px";
1130
+ }
1131
+ });
1132
+ }
1133
+
1134
+ onResize == null || onResize(newWidth, newHeight);
1135
+ }, [minWidth, maxWidth, minHeight, maxHeight, horizontal, vertical]);
1136
+ const onPointerMove = React.useCallback(pointerMoveEvent => {
1137
+ var _containerRef$current, _containerRef$current2, _containerRef$current3;
1138
+
1139
+ const {
1140
+ x,
1141
+ y
1142
+ } = (_containerRef$current = containerRef.current) == null ? void 0 : _containerRef$current.getBoundingClientRect();
1143
+ const reverseHorizontal = handleHorizontalPosition === exports.HorizontalPosition.Right;
1144
+ const reverseVertical = handleVerticalPosition === exports.VerticalPosition.Bottom;
1145
+ const newWidth = reverseHorizontal ? pointerMoveEvent.pageX - x : ((_containerRef$current2 = containerRef.current) == null ? void 0 : _containerRef$current2.offsetWidth) + x - pointerMoveEvent.pageX;
1146
+ const newHeight = reverseVertical ? pointerMoveEvent.pageY - y : ((_containerRef$current3 = containerRef.current) == null ? void 0 : _containerRef$current3.offsetHeight) + y - pointerMoveEvent.pageY;
1147
+ document.body.style.userSelect = "none";
1148
+ updateSizes(newWidth, newHeight);
1149
+ }, [updateSizes]);
1150
+ const onPointerDown = React.useCallback(() => {
1151
+ const onPointerUp = () => {
1152
+ document.body.style.userSelect = "initial";
1153
+ document.body.removeEventListener("pointermove", onPointerMove);
1154
+
1155
+ if (!lodash.isNil(containerRef.current)) {
1156
+ onResizeEnd == null || onResizeEnd(containerRef.current.offsetWidth, containerRef.current.offsetHeight);
1157
+ }
1158
+ };
1159
+
1160
+ if (!lodash.isNil(containerRef.current)) {
1161
+ onResizeStart == null || onResizeStart(containerRef.current.offsetWidth, containerRef.current.offsetHeight);
1162
+ }
1163
+
1164
+ document.body.addEventListener("pointermove", onPointerMove);
1165
+ document.body.addEventListener("pointerup", onPointerUp, {
1166
+ once: true
1167
+ });
1168
+ }, [onPointerMove]); // eslint-disable-line
1169
+
1170
+ React.useLayoutEffect(() => {
1171
+ if (useResize && !lodash.isNil(containerRef.current)) {
1172
+ updateSizes(containerRef.current.offsetWidth, containerRef.current.offsetHeight);
1173
+ }
1174
+ }, [updateSizes, useResize]);
1175
+ return {
1176
+ containerRef,
1177
+ verticalHandleRef,
1178
+ horizontalHandleRef,
1179
+ onPointerDown
1180
+ };
1181
+ };
1182
+
1183
+ const useToggle = initial => {
1184
+ const [state, setState] = React.useState(initial !== undefined ? initial : false);
1185
+ const toggle = React.useCallback(() => setState(!state), [state]);
1186
+ return [state, toggle, setState];
1187
+ };
1188
+
1189
+ const _excluded = ["zIndex", "lowerSiblings", "upperSiblings", "drawTriggerDeps", "onError", "children"];
1190
+ const Map = (_ref) => {
1191
+ let {
1192
+ zIndex,
1193
+ lowerSiblings,
1194
+ upperSiblings,
1195
+ drawTriggerDeps,
1196
+ onError,
1197
+ children
1198
+ } = _ref,
1199
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
1200
+
1201
+ const {
1202
+ map,
1203
+ setLoaded
1204
+ } = useMapContext();
1205
+ useMapDraw(drawTriggerDeps);
1206
+ return React__default.createElement(MapWrapper, {
1207
+ "$zIndex": zIndex
1208
+ }, lowerSiblings, React__default.createElement(MapGL__default, Object.assign({}, rest, {
1209
+ renderWorldCopies: true,
1210
+ antialias: true,
1211
+ doubleClickZoom: false,
1212
+ cursor: "default",
1213
+ onLoad: e => {
1214
+ map.current = e.target;
1215
+ map.current.on("error", onError);
1216
+ setLoaded(true);
1217
+ }
1218
+ }), children), upperSiblings);
1219
+ };
1220
+
1221
+ const BuildingsLayer = (_ref) => {
1222
+ let {
1223
+ beforeId,
1224
+ transparent
1225
+ } = _ref;
1226
+ return React__default.createElement(MapGL.Layer, {
1227
+ id: "mapbox-3d-buildings",
1228
+ source: "composite",
1229
+ "source-layer": "building",
1230
+ filter: ["==", "extrude", "true"],
1231
+ type: "fill-extrusion",
1232
+ minzoom: 15,
1233
+ beforeId: beforeId,
1234
+ paint: {
1235
+ "fill-extrusion-color": "#aaaaaa",
1236
+ "fill-extrusion-height": ["interpolate", ["linear"], ["zoom"], 15, 0, 15.05, ["get", "height"]],
1237
+ "fill-extrusion-base": ["interpolate", ["linear"], ["zoom"], 15, 0, 15.05, ["get", "min_height"]],
1238
+ "fill-extrusion-opacity": transparent ? 0 : 0.5
1239
+ }
1240
+ });
1241
+ };
1242
+
1243
+ const RasterLayer = (_ref) => {
1244
+ let {
1245
+ layer,
1246
+ tileUrl,
1247
+ visible,
1248
+ beforeId
1249
+ } = _ref;
1250
+
1251
+ if (!layer) {
1252
+ return null;
1253
+ }
1254
+
1255
+ return React__default.createElement(MapGL.Source, {
1256
+ id: layer.name,
1257
+ type: "raster",
1258
+ tiles: [tileUrl]
1259
+ }, React__default.createElement(MapGL.Layer, {
1260
+ id: layer.name,
1261
+ type: "raster",
1262
+ "source-layer": "default",
1263
+ beforeId: beforeId,
1264
+ layout: {
1265
+ visibility: visible ? "visible" : "none"
1266
+ }
1267
+ }));
1268
+ };
1269
+
1270
+ const DEFAULT_COLOR = "#00ffff";
1271
+ const DEFAULT_OPACITY = 0.5;
1272
+ const DEFAULT_SIZE = 4;
1273
+ const DEFAULT_LINE_WIDTH = 1;
1274
+ const DEFAULT_CIRCLE_PAINT = {
1275
+ "circle-radius": DEFAULT_SIZE,
1276
+ "circle-color": DEFAULT_COLOR,
1277
+ "circle-opacity": DEFAULT_OPACITY,
1278
+ "circle-stroke-width": 0,
1279
+ "circle-stroke-color": DEFAULT_COLOR,
1280
+ "circle-stroke-opacity": DEFAULT_OPACITY
1281
+ };
1282
+ const DEFAULT_FILL_PAINT = {
1283
+ "fill-color": DEFAULT_COLOR,
1284
+ "fill-opacity": DEFAULT_OPACITY
1285
+ };
1286
+ const DEFAULT_FILL_EXTRUSION_PAINT = {
1287
+ "fill-extrusion-base": 0,
1288
+ "fill-extrusion-vertical-gradient": true,
1289
+ "fill-extrusion-color": DEFAULT_COLOR,
1290
+ "fill-extrusion-opacity": DEFAULT_OPACITY,
1291
+ "fill-extrusion-height": 0
1292
+ };
1293
+ const DEFAULT_LINE_PAINT = {
1294
+ "line-color": DEFAULT_COLOR,
1295
+ "line-width": DEFAULT_LINE_WIDTH,
1296
+ "line-opacity": DEFAULT_OPACITY
1297
+ };
1298
+
1299
+ const getClientStyleItemPrefixSuffix = (geometryType, type) => {
1300
+ switch (geometryType) {
1301
+ case api.GeometryType.Point:
1302
+ return ["point-layer-", ""];
1303
+
1304
+ case api.GeometryType.Polyline:
1305
+ return ["polyline-layer-", ""];
1306
+
1307
+ case api.GeometryType.Polygon:
1308
+ switch (type) {
1309
+ case "line":
1310
+ return ["polygon-stroke-layer-", "-stroke"];
1311
+
1312
+ case "fill-extrusion":
1313
+ return ["polygon-extrusion-layer-", "-extrusion"];
1314
+
1315
+ default:
1316
+ return ["polygon-layer-", ""];
1317
+ }
1318
+
1319
+ default:
1320
+ return ["", ""];
1321
+ }
1322
+ };
1323
+
1324
+ const VectorLayer = (_ref) => {
1325
+ var _layer$configuration;
1326
+
1327
+ let {
1328
+ layer,
1329
+ tileUrl,
1330
+ visible,
1331
+ beforeId,
1332
+ getLayerTempStyle,
1333
+ onMount = () => null
1334
+ } = _ref;
1335
+ const clientStyle = layer == null || (_layer$configuration = layer.configuration) == null ? void 0 : _layer$configuration.clientStyle;
1336
+ const {
1337
+ idAttribute,
1338
+ geometryType
1339
+ } = layer.layerDefinition || {};
1340
+ const renderLayerByGeometryType = React.useCallback(() => {
1341
+ var _getLayerTempStyle, _getLayerTempStyle2, _getLayerTempStyle3, _getLayerTempStyle4, _getLayerTempStyle5, _getLayerTempStyle6, _getLayerTempStyle7, _getLayerTempStyle8, _getLayerTempStyle9, _getLayerTempStyle10, _getLayerTempStyle11, _getLayerTempStyle12, _getLayerTempStyle13, _getLayerTempStyle14;
1342
+
1343
+ const visibility = visible ? "visible" : "none";
1344
+
1345
+ switch (geometryType) {
1346
+ case api.GeometryType.Point:
1347
+ return React__default.createElement(MapGL.Layer, {
1348
+ id: layer.name,
1349
+ type: "circle",
1350
+ "source-layer": "default",
1351
+ beforeId: beforeId,
1352
+ layout: _extends({}, getLayerTempStyle == null || (_getLayerTempStyle = getLayerTempStyle(layer.name, "circle")) == null ? void 0 : _getLayerTempStyle.layout, {
1353
+ visibility
1354
+ }),
1355
+ paint: _extends({}, DEFAULT_CIRCLE_PAINT, getLayerTempStyle == null || (_getLayerTempStyle2 = getLayerTempStyle(layer.name, "circle")) == null ? void 0 : _getLayerTempStyle2.paint)
1356
+ });
1357
+
1358
+ case api.GeometryType.Polygon:
1359
+ return [React__default.createElement(MapGL.Layer, {
1360
+ key: "polygon-layer-" + layer.name,
1361
+ id: layer.name,
1362
+ type: "fill",
1363
+ "source-layer": "default",
1364
+ beforeId: beforeId,
1365
+ layout: _extends({}, getLayerTempStyle == null || (_getLayerTempStyle3 = getLayerTempStyle(layer.name, "fill")) == null ? void 0 : _getLayerTempStyle3.layout, {
1366
+ visibility: visible && (getLayerTempStyle == null || (_getLayerTempStyle4 = getLayerTempStyle(layer.name, "fill-extrusion")) == null || (_getLayerTempStyle4 = _getLayerTempStyle4.settings) == null || (_getLayerTempStyle4 = _getLayerTempStyle4.fill) == null ? void 0 : _getLayerTempStyle4.showBottomSurface) !== false && Boolean(getActualExtrusionHeight(_extends({}, DEFAULT_FILL_EXTRUSION_PAINT, getLayerTempStyle == null || (_getLayerTempStyle5 = getLayerTempStyle(layer.name, "fill-extrusion")) == null ? void 0 : _getLayerTempStyle5.paint))) ? "visible" : "none"
1367
+ }),
1368
+ paint: _extends({}, DEFAULT_FILL_PAINT, getLayerTempStyle == null || (_getLayerTempStyle6 = getLayerTempStyle(layer.name, "fill")) == null ? void 0 : _getLayerTempStyle6.paint)
1369
+ }), React__default.createElement(MapGL.Layer, {
1370
+ key: "polygon-stroke-layer-" + layer.name,
1371
+ id: layer.name + "-stroke",
1372
+ type: "line",
1373
+ "source-layer": "default",
1374
+ beforeId: beforeId,
1375
+ layout: _extends({}, getLayerTempStyle == null || (_getLayerTempStyle7 = getLayerTempStyle(layer.name, "line")) == null ? void 0 : _getLayerTempStyle7.layout, {
1376
+ visibility: visible && (getLayerTempStyle == null || (_getLayerTempStyle8 = getLayerTempStyle(layer.name, "fill-extrusion")) == null || (_getLayerTempStyle8 = _getLayerTempStyle8.settings) == null || (_getLayerTempStyle8 = _getLayerTempStyle8.fill) == null ? void 0 : _getLayerTempStyle8.showBottomSurface) !== false && Boolean(getActualExtrusionHeight(_extends({}, DEFAULT_FILL_EXTRUSION_PAINT, getLayerTempStyle == null || (_getLayerTempStyle9 = getLayerTempStyle(layer.name, "fill-extrusion")) == null ? void 0 : _getLayerTempStyle9.paint))) ? "visible" : "none"
1377
+ }),
1378
+ paint: _extends({}, DEFAULT_LINE_PAINT, getLayerTempStyle == null || (_getLayerTempStyle10 = getLayerTempStyle(layer.name, "line")) == null ? void 0 : _getLayerTempStyle10.paint)
1379
+ }), React__default.createElement(MapGL.Layer, {
1380
+ key: "polygon-extrusion-layer-" + layer.name,
1381
+ id: layer.name + "-extrusion",
1382
+ type: "fill-extrusion",
1383
+ "source-layer": "default",
1384
+ beforeId: beforeId,
1385
+ minzoom: 0,
1386
+ maxzoom: 23,
1387
+ layout: _extends({}, getLayerTempStyle == null || (_getLayerTempStyle11 = getLayerTempStyle(layer.name, "fill-extrusion")) == null ? void 0 : _getLayerTempStyle11.layout, {
1388
+ visibility
1389
+ }),
1390
+ paint: _extends({}, DEFAULT_FILL_EXTRUSION_PAINT, getLayerTempStyle == null || (_getLayerTempStyle12 = getLayerTempStyle(layer.name, "fill-extrusion")) == null ? void 0 : _getLayerTempStyle12.paint)
1391
+ })];
1392
+
1393
+ case api.GeometryType.Polyline:
1394
+ return React__default.createElement(MapGL.Layer, {
1395
+ id: layer.name,
1396
+ type: "line",
1397
+ "source-layer": "default",
1398
+ beforeId: beforeId,
1399
+ layout: _extends({}, getLayerTempStyle == null || (_getLayerTempStyle13 = getLayerTempStyle(layer.name, "line")) == null ? void 0 : _getLayerTempStyle13.layout, {
1400
+ visibility
1401
+ }),
1402
+ paint: _extends({}, DEFAULT_LINE_PAINT, getLayerTempStyle == null || (_getLayerTempStyle14 = getLayerTempStyle(layer.name, "line")) == null ? void 0 : _getLayerTempStyle14.paint)
1403
+ });
1404
+
1405
+ default:
1406
+ return null;
1407
+ }
1408
+ }, [geometryType, layer, beforeId, getLayerTempStyle, visible]);
1409
+ const renderClientStyle = React.useCallback(() => {
1410
+ return clientStyle.items.map(mockItem => {
1411
+ var _clientStyle$items, _getLayerTempStyle15, _getLayerTempStyle16, _currentSettings$fill, _currentSettings$fill2, _clientStyle$minzoom, _clientStyle$maxzoom, _getLayerTempStyle17, _getLayerTempStyle18;
1412
+
1413
+ const prefixSuffix = getClientStyleItemPrefixSuffix(geometryType, mockItem.type);
1414
+ const isExtrusionItem = mockItem.type === "fill-extrusion";
1415
+ const isPolygonPart = clientStyle.items.some(item => item.type === "fill-extrusion") && (mockItem.type === "fill" || mockItem.type === "line");
1416
+ const fillExtrusionPaint = isPolygonPart || isExtrusionItem ? _extends({}, (_clientStyle$items = clientStyle.items) == null || (_clientStyle$items = _clientStyle$items.find(item => item.type === "fill-extrusion")) == null ? void 0 : _clientStyle$items.paint, getLayerTempStyle == null || (_getLayerTempStyle15 = getLayerTempStyle(layer.name, "fill-extrusion")) == null ? void 0 : _getLayerTempStyle15.paint) : undefined;
1417
+
1418
+ const currentSettings = _extends({}, clientStyle == null ? void 0 : clientStyle.settings, getLayerTempStyle == null || (_getLayerTempStyle16 = getLayerTempStyle(layer.name, mockItem.type)) == null ? void 0 : _getLayerTempStyle16.settings);
1419
+
1420
+ const processedExtrusionHeight = getActualExtrusionHeight(fillExtrusionPaint);
1421
+ const hasExtrusion = Boolean(processedExtrusionHeight);
1422
+ const visibility = visible && (isExtrusionItem && hasExtrusion || !isPolygonPart && !isExtrusionItem || isPolygonPart && (!hasExtrusion || ((_currentSettings$fill = currentSettings == null || (_currentSettings$fill2 = currentSettings.fill) == null ? void 0 : _currentSettings$fill2.showBottomSurface) != null ? _currentSettings$fill : true))) ? "visible" : "none";
1423
+ return React__default.createElement(MapGL.Layer, {
1424
+ key: "" + prefixSuffix[0] + layer.name,
1425
+ id: "" + layer.name + prefixSuffix[1],
1426
+ type: mockItem.type,
1427
+ "source-layer": "default",
1428
+ beforeId: beforeId,
1429
+ minzoom: (_clientStyle$minzoom = clientStyle == null ? void 0 : clientStyle.minzoom) != null ? _clientStyle$minzoom : 0,
1430
+ maxzoom: (_clientStyle$maxzoom = clientStyle == null ? void 0 : clientStyle.maxzoom) != null ? _clientStyle$maxzoom : 23,
1431
+ layout: _extends({}, mockItem.layout, getLayerTempStyle == null || (_getLayerTempStyle17 = getLayerTempStyle(layer.name, mockItem.type)) == null ? void 0 : _getLayerTempStyle17.layout, {
1432
+ visibility
1433
+ }),
1434
+ paint: _extends({}, mockItem.paint, getLayerTempStyle == null || (_getLayerTempStyle18 = getLayerTempStyle(layer.name, mockItem.type)) == null ? void 0 : _getLayerTempStyle18.paint)
1435
+ });
1436
+ });
1437
+ }, [beforeId, clientStyle, geometryType, layer.name, visible, getLayerTempStyle]);
1438
+ React.useEffect(onMount, [layer.name]); // eslint-disable-line
1439
+
1440
+ if (!layer) {
1441
+ return null;
1442
+ }
1443
+
1444
+ return React__default.createElement(MapGL.Source, {
1445
+ promoteId: idAttribute,
1446
+ id: layer.name,
1447
+ type: "vector",
1448
+ tiles: [tileUrl]
1449
+ }, clientStyle != null && clientStyle.items ? renderClientStyle() : renderLayerByGeometryType());
1450
+ };
1451
+
1452
+ const Layer = (_ref) => {
1453
+ let {
1454
+ layer,
1455
+ layerType,
1456
+ visible,
1457
+ beforeId,
1458
+ tileUrl,
1459
+ onMount = () => null
1460
+ } = _ref;
1461
+ React.useEffect(onMount, [layer.name]); // eslint-disable-line
1462
+
1463
+ if (!layer) {
1464
+ return null;
1465
+ }
1466
+
1467
+ if (layerType === "RasterTileLayer") {
1468
+ return React__default.createElement(RasterLayer, {
1469
+ layer: layer,
1470
+ tileUrl: tileUrl,
1471
+ visible: visible,
1472
+ beforeId: beforeId,
1473
+ onMount: onMount
1474
+ });
1475
+ }
1476
+
1477
+ return React__default.createElement(VectorLayer, {
1478
+ layer: layer,
1479
+ tileUrl: tileUrl,
1480
+ visible: visible,
1481
+ beforeId: beforeId,
1482
+ onMount: onMount
1483
+ });
1484
+ };
1485
+
1486
+ var _templateObject$2, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15;
1487
+ const ResizablePanelContainer = /*#__PURE__*/styled__default.div(_templateObject$2 || (_templateObject$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n position: relative;\n\n ", "\n\n ", "\n\n ", "\n ", "\n ", "\n ", "\n ", "\n"])), (_ref) => {
1488
+ let {
1489
+ horizontal,
1490
+ vertical
1491
+ } = _ref;
1492
+ return horizontal && !vertical ? styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n height: 100%;\n "]))) : !horizontal && vertical ? styled.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n width: 100%;\n "]))) : "";
1493
+ }, (_ref2) => {
1494
+ let {
1495
+ horizontal,
1496
+ vertical
1497
+ } = _ref2;
1498
+ return styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n will-change: ", ";\n "])), [horizontal && "width", vertical && "height"].filter(Boolean).join(","));
1499
+ }, (_ref3) => {
1500
+ let {
1501
+ maxHeight
1502
+ } = _ref3;
1503
+ return maxHeight && styled.css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n max-height: ", "px;\n "])), maxHeight);
1504
+ }, (_ref4) => {
1505
+ let {
1506
+ minHeight
1507
+ } = _ref4;
1508
+ return minHeight && styled.css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n min-height: ", "px;\n "])), minHeight);
1509
+ }, (_ref5) => {
1510
+ let {
1511
+ maxWidth
1512
+ } = _ref5;
1513
+ return maxWidth && styled.css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n max-width: ", "px;\n "])), maxWidth);
1514
+ }, (_ref6) => {
1515
+ let {
1516
+ height
1517
+ } = _ref6;
1518
+ return height && styled.css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n height: ", ";\n "])), height);
1519
+ }, (_ref7) => {
1520
+ let {
1521
+ width
1522
+ } = _ref7;
1523
+ return width && styled.css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n width: ", ";\n "])), width);
1524
+ });
1525
+ const getHandlePositionProps = (position, palette) => {
1526
+ switch (position) {
1527
+ case exports.HorizontalPosition.Left:
1528
+ return styled.css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n height: 100%;\n border-left: 2px solid ", ";\n top: 0;\n left: 0;\n cursor: ew-resize;\n "])), palette.elementDeep);
1529
+
1530
+ case exports.HorizontalPosition.Right:
1531
+ return styled.css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n height: 100%;\n border-right: 2px solid ", ";\n top: 0;\n right: 0;\n cursor: ew-resize;\n "])), palette.elementDeep);
1532
+
1533
+ case exports.VerticalPosition.Top:
1534
+ return styled.css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteralLoose(["\n width: 100%;\n border-top: 2px solid ", ";\n top: 0;\n left: 0;\n cursor: ns-resize;\n "])), palette.elementDeep);
1535
+
1536
+ case exports.VerticalPosition.Bottom:
1537
+ return styled.css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteralLoose(["\n width: 100%;\n border-bottom: 2px solid ", ";\n bottom: 0;\n left: 0;\n cursor: ns-resize;\n "])), palette.elementDeep);
1538
+
1539
+ default:
1540
+ return styled.css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteralLoose(["\n width: 100%;\n border-top: 2px solid ", ";\n top: 0;\n left: 0;\n "])), palette.elementDeep);
1541
+ }
1542
+ };
1543
+ const PanelDragHandle = /*#__PURE__*/styled__default.div(_templateObject15 || (_templateObject15 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n position: absolute;\n box-sizing: border-box;\n z-index: 3;\n\n padding: 0.25rem;\n pointer-events: ", ";\n transition: border-color 150ms cubic-bezier(0.2, 1, 0.6, 1);\n\n &:hover {\n border-color: ", ";\n }\n\n ", "\n"])), (_ref8) => {
1544
+ let {
1545
+ disabled
1546
+ } = _ref8;
1547
+ return disabled && "none";
1548
+ }, (_ref9) => {
1549
+ let {
1550
+ theme: {
1551
+ palette
1552
+ }
1553
+ } = _ref9;
1554
+ return palette.primary;
1555
+ }, (_ref10) => {
1556
+ let {
1557
+ position,
1558
+ theme: {
1559
+ palette
1560
+ }
1561
+ } = _ref10;
1562
+ return getHandlePositionProps(position, palette);
1563
+ });
1564
+
1565
+ const _excluded$1 = ["className", "handleClassName", "width", "height", "disabled", "handleVerticalPosition", "handleHorizontalPosition", "Handle", "children"];
1566
+ const ResizablePanel = (_ref) => {
1567
+ let {
1568
+ className,
1569
+ handleClassName,
1570
+ width,
1571
+ height,
1572
+ disabled,
1573
+ handleVerticalPosition = exports.VerticalPosition.Top,
1574
+ handleHorizontalPosition = exports.HorizontalPosition.Left,
1575
+ children
1576
+ } = _ref,
1577
+ resizeProps = _objectWithoutPropertiesLoose(_ref, _excluded$1);
1578
+
1579
+ const resizerProps = React.useMemo(() => _extends({}, resizeProps, {
1580
+ handleVerticalPosition,
1581
+ handleHorizontalPosition
1582
+ }), [resizeProps, handleVerticalPosition, handleHorizontalPosition]);
1583
+ const {
1584
+ containerRef,
1585
+ verticalHandleRef,
1586
+ horizontalHandleRef,
1587
+ onPointerDown
1588
+ } = useResizer(resizerProps);
1589
+ const {
1590
+ vertical,
1591
+ horizontal
1592
+ } = resizeProps;
1593
+ return React__default.createElement(ResizablePanelContainer, {
1594
+ ref: containerRef,
1595
+ width: width,
1596
+ height: height,
1597
+ style: disabled ? {
1598
+ height: "auto"
1599
+ } : undefined,
1600
+ className: className
1601
+ }, vertical && React__default.createElement(PanelDragHandle, {
1602
+ ref: verticalHandleRef,
1603
+ position: handleVerticalPosition,
1604
+ disabled: disabled,
1605
+ className: handleClassName,
1606
+ onPointerDown: onPointerDown
1607
+ }), horizontal && React__default.createElement(PanelDragHandle, {
1608
+ ref: horizontalHandleRef,
1609
+ position: handleHorizontalPosition,
1610
+ disabled: disabled,
1611
+ className: handleClassName,
1612
+ onPointerDown: onPointerDown
1613
+ }), children);
1614
+ };
1615
+
1616
+ const ServerNotificationsProvider = (_ref) => {
1617
+ let {
1618
+ url,
1619
+ initialized,
1620
+ children
1621
+ } = _ref;
1622
+ const connection = useServerNotifications(url, initialized);
1623
+ const addSubscription = React.useCallback(async payload => {
1624
+ if (!connection || connection.state !== "Connected" || !payload) {
1625
+ return;
1626
+ }
1627
+
1628
+ try {
1629
+ const id = await connection.invoke("AddSubscription", payload);
1630
+ console.info("Подписка добавлена, id:", id);
1631
+ return id;
1632
+ } catch (err) {
1633
+ console.info("Ошибка добавления подписки:", err);
1634
+ return Promise.resolve(null);
1635
+ }
1636
+ }, [connection]);
1637
+ const updateSubscription = React.useCallback(async (id, payload) => {
1638
+ if (!connection || connection.state !== "Connected" || !id || !payload) {
1639
+ return;
1640
+ }
1641
+
1642
+ try {
1643
+ await connection.invoke("UpdateSubscription", id, payload);
1644
+ } catch (err) {
1645
+ console.info("\u041E\u0448\u0438\u0431\u043A\u0430 \u043E\u0431\u043D\u043E\u0432\u043B\u0435\u043D\u0438\u044F \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0438 " + id + ":", err);
1646
+ }
1647
+ }, [connection]);
1648
+ const unsubscribeById = React.useCallback(async id => {
1649
+ if (!connection || connection.state !== "Connected" || !id) {
1650
+ return;
1651
+ }
1652
+
1653
+ try {
1654
+ await connection.invoke("Unsubscribe", [id]);
1655
+ } catch (err) {
1656
+ console.info("\u041E\u0448\u0438\u0431\u043A\u0430 \u043E\u0442\u043F\u0438\u0441\u043A\u0438 \u043F\u043E " + id + ":", err);
1657
+ }
1658
+ }, [connection]);
1659
+ return React__default.createElement(ServerNotificationsContext.Provider, {
1660
+ value: {
1661
+ connection,
1662
+ addSubscription,
1663
+ updateSubscription,
1664
+ unsubscribeById
1665
+ }
1666
+ }, children);
1667
+ };
1668
+
1669
+ exports.BuildingsLayer = BuildingsLayer;
1670
+ exports.ErrorBoundary = ErrorBoundary;
1671
+ exports.Layer = Layer;
1672
+ exports.Map = Map;
1673
+ exports.MapContext = MapContext;
1674
+ exports.MapProvider = MapProvider;
62
1675
  exports.NO_CONTENT_VALUE = NO_CONTENT_VALUE;
1676
+ exports.ResizablePanel = ResizablePanel;
1677
+ exports.ServerNotificationsContext = ServerNotificationsContext;
1678
+ exports.ServerNotificationsProvider = ServerNotificationsProvider;
1679
+ exports.convertSpToTurfFeature = convertSpToTurfFeature;
1680
+ exports.drawModeToGeometrySelectionType = drawModeToGeometrySelectionType;
1681
+ exports.findAttributeInExpression = findAttributeInExpression;
63
1682
  exports.formatDate = formatDate;
1683
+ exports.geometryToWkt = geometryToWkt;
1684
+ exports.getActualExtrusionHeight = getActualExtrusionHeight;
64
1685
  exports.getDate = getDate;
1686
+ exports.getGeometrySelectionTurfFeature = getGeometrySelectionTurfFeature;
65
1687
  exports.isNumeric = isNumeric;
66
1688
  exports.isObject = isObject;
1689
+ exports.parseClientStyle = parseClientStyle;
1690
+ exports.useCurrentSelectedFeature = useCurrentSelectedFeature;
1691
+ exports.useEditingFeature = useEditingFeature;
1692
+ exports.useEwktGeometry = useEwktGeometry;
1693
+ exports.useGeometryEditor = useGeometryEditor;
1694
+ exports.useGeometrySelection = useGeometrySelection;
1695
+ exports.useGeometrySelectionBuffer = useGeometrySelectionBuffer;
1696
+ exports.useMapContext = useMapContext;
1697
+ exports.useMapDraw = useMapDraw;
1698
+ exports.useRedrawLayer = useRedrawLayer;
1699
+ exports.useResizer = useResizer;
1700
+ exports.useSelectFeaturesCount = useSelectFeaturesCount;
1701
+ exports.useSelectFeaturesCurrentIndex = useSelectFeaturesCurrentIndex;
1702
+ exports.useSelectFeaturesGeometryMasking = useSelectFeaturesGeometryMasking;
1703
+ exports.useSelectFeaturesInitialized = useSelectFeaturesInitialized;
1704
+ exports.useSelectFeaturesLayerName = useSelectFeaturesLayerName;
1705
+ exports.useSelectFeaturesPagination = useSelectFeaturesPagination;
1706
+ exports.useSelectFeaturesStatisticsActive = useSelectFeaturesStatisticsActive;
1707
+ exports.useSelectFeaturesTotalCounts = useSelectFeaturesTotalCounts;
1708
+ exports.useSelectedFeatures = useSelectedFeatures;
1709
+ exports.useServerNotifications = useServerNotifications;
1710
+ exports.useServerNotificationsContext = useServerNotificationsContext;
67
1711
  exports.useToggle = useToggle;
1712
+ exports.useUpdateCurrentFeature = useUpdateCurrentFeature;
1713
+ exports.useZoomToFeatures = useZoomToFeatures;
1714
+ exports.useZoomToLayer = useZoomToLayer;
1715
+ exports.useZoomToPoint = useZoomToPoint;
68
1716
  //# sourceMappingURL=react.cjs.development.js.map