@classic-homes/maps-react 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,2466 @@
1
+ 'use strict';
2
+
3
+ var React6 = require('react');
4
+ var clsx = require('clsx');
5
+ var tailwindMerge = require('tailwind-merge');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var maplibregl = require('maplibre-gl');
8
+ require('maplibre-gl/dist/maplibre-gl.css');
9
+ require('@classic-homes/maps-core/styles/controls.css');
10
+ var mapsCore = require('@classic-homes/maps-core');
11
+ var ReactDOM = require('react-dom');
12
+ var classVarianceAuthority = require('class-variance-authority');
13
+
14
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
+
16
+ function _interopNamespace(e) {
17
+ if (e && e.__esModule) return e;
18
+ var n = Object.create(null);
19
+ if (e) {
20
+ Object.keys(e).forEach(function (k) {
21
+ if (k !== 'default') {
22
+ var d = Object.getOwnPropertyDescriptor(e, k);
23
+ Object.defineProperty(n, k, d.get ? d : {
24
+ enumerable: true,
25
+ get: function () { return e[k]; }
26
+ });
27
+ }
28
+ });
29
+ }
30
+ n.default = e;
31
+ return Object.freeze(n);
32
+ }
33
+
34
+ var React6__namespace = /*#__PURE__*/_interopNamespace(React6);
35
+ var maplibregl__default = /*#__PURE__*/_interopDefault(maplibregl);
36
+ var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
37
+
38
+ // src/components/base/MapContainer.tsx
39
+ function cn(...inputs) {
40
+ return tailwindMerge.twMerge(clsx.clsx(inputs));
41
+ }
42
+ var MapSkeleton = React6__namespace.forwardRef(
43
+ ({ height = 400, className, ...props }, ref) => {
44
+ const heightStyle = typeof height === "number" ? `${height}px` : height;
45
+ return /* @__PURE__ */ jsxRuntime.jsxs(
46
+ "div",
47
+ {
48
+ ref,
49
+ className: cn("relative animate-pulse rounded-lg border border-border bg-muted", className),
50
+ style: { height: heightStyle },
51
+ role: "progressbar",
52
+ "aria-label": "Loading map",
53
+ "aria-busy": "true",
54
+ ...props,
55
+ children: [
56
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-2 text-muted-foreground", children: [
57
+ /* @__PURE__ */ jsxRuntime.jsxs(
58
+ "svg",
59
+ {
60
+ className: "h-8 w-8 animate-spin",
61
+ xmlns: "http://www.w3.org/2000/svg",
62
+ fill: "none",
63
+ viewBox: "0 0 24 24",
64
+ children: [
65
+ /* @__PURE__ */ jsxRuntime.jsx(
66
+ "circle",
67
+ {
68
+ className: "opacity-25",
69
+ cx: "12",
70
+ cy: "12",
71
+ r: "10",
72
+ stroke: "currentColor",
73
+ strokeWidth: "4"
74
+ }
75
+ ),
76
+ /* @__PURE__ */ jsxRuntime.jsx(
77
+ "path",
78
+ {
79
+ className: "opacity-75",
80
+ fill: "currentColor",
81
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
82
+ }
83
+ )
84
+ ]
85
+ }
86
+ ),
87
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: "Loading map..." })
88
+ ] }) }),
89
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-4 grid grid-cols-4 grid-rows-4 gap-1 opacity-20", children: Array.from({ length: 16 }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "rounded bg-muted-foreground/20" }, i)) })
90
+ ]
91
+ }
92
+ );
93
+ }
94
+ );
95
+ MapSkeleton.displayName = "MapSkeleton";
96
+ var MapError = React6__namespace.forwardRef(
97
+ ({ message = "Failed to load map", height = 400, onRetry, className, ...props }, ref) => {
98
+ const heightStyle = typeof height === "number" ? `${height}px` : height;
99
+ return /* @__PURE__ */ jsxRuntime.jsx(
100
+ "div",
101
+ {
102
+ ref,
103
+ className: cn(
104
+ "flex flex-col items-center justify-center rounded-lg border border-destructive/50 bg-destructive/5",
105
+ className
106
+ ),
107
+ style: { height: heightStyle },
108
+ role: "alert",
109
+ "aria-live": "polite",
110
+ ...props,
111
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
112
+ /* @__PURE__ */ jsxRuntime.jsx(
113
+ "svg",
114
+ {
115
+ className: "h-10 w-10 text-destructive",
116
+ xmlns: "http://www.w3.org/2000/svg",
117
+ fill: "none",
118
+ viewBox: "0 0 24 24",
119
+ stroke: "currentColor",
120
+ strokeWidth: 2,
121
+ "aria-hidden": "true",
122
+ children: /* @__PURE__ */ jsxRuntime.jsx(
123
+ "path",
124
+ {
125
+ strokeLinecap: "round",
126
+ strokeLinejoin: "round",
127
+ d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
128
+ }
129
+ )
130
+ }
131
+ ),
132
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
133
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium text-destructive", children: message }),
134
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Check your connection and try again" })
135
+ ] }),
136
+ onRetry && /* @__PURE__ */ jsxRuntime.jsx(
137
+ "button",
138
+ {
139
+ onClick: onRetry,
140
+ className: "mt-2 rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
141
+ children: "Retry"
142
+ }
143
+ )
144
+ ] })
145
+ }
146
+ );
147
+ }
148
+ );
149
+ MapError.displayName = "MapError";
150
+ var MapEmpty = React6__namespace.forwardRef(
151
+ ({ message = "No map data to display", height = 400, className, ...props }, ref) => {
152
+ const heightStyle = typeof height === "number" ? `${height}px` : height;
153
+ return /* @__PURE__ */ jsxRuntime.jsx(
154
+ "div",
155
+ {
156
+ ref,
157
+ className: cn(
158
+ "flex flex-col items-center justify-center rounded-lg border border-border bg-muted/50",
159
+ className
160
+ ),
161
+ style: { height: heightStyle },
162
+ role: "status",
163
+ "aria-label": message,
164
+ ...props,
165
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 text-center", children: [
166
+ /* @__PURE__ */ jsxRuntime.jsx(
167
+ "svg",
168
+ {
169
+ className: "h-10 w-10 text-muted-foreground",
170
+ xmlns: "http://www.w3.org/2000/svg",
171
+ fill: "none",
172
+ viewBox: "0 0 24 24",
173
+ stroke: "currentColor",
174
+ strokeWidth: 1.5,
175
+ "aria-hidden": "true",
176
+ children: /* @__PURE__ */ jsxRuntime.jsx(
177
+ "path",
178
+ {
179
+ strokeLinecap: "round",
180
+ strokeLinejoin: "round",
181
+ d: "M9 6.75V15m6-6v8.25m.503 3.498l4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-1.006l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 00-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628 1.006l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0z"
182
+ }
183
+ )
184
+ }
185
+ ),
186
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: message })
187
+ ] })
188
+ }
189
+ );
190
+ }
191
+ );
192
+ MapEmpty.displayName = "MapEmpty";
193
+ var MapContainer = React6__namespace.forwardRef(
194
+ ({
195
+ title,
196
+ description,
197
+ height = 400,
198
+ width = "100%",
199
+ loading,
200
+ error,
201
+ empty,
202
+ emptyMessage,
203
+ onRetry,
204
+ className,
205
+ wrapperClassName,
206
+ children,
207
+ ...props
208
+ }, ref) => {
209
+ const heightStyle = typeof height === "number" ? `${height}px` : height;
210
+ const widthStyle = typeof width === "number" ? `${width}px` : width;
211
+ if (loading) {
212
+ return /* @__PURE__ */ jsxRuntime.jsx(MapSkeleton, { height, className: wrapperClassName });
213
+ }
214
+ if (error) {
215
+ return /* @__PURE__ */ jsxRuntime.jsx(MapError, { message: error, height, onRetry, className: wrapperClassName });
216
+ }
217
+ if (empty) {
218
+ return /* @__PURE__ */ jsxRuntime.jsx(MapEmpty, { message: emptyMessage, height, className: wrapperClassName });
219
+ }
220
+ const descriptionId = description ? `${title.replace(/\s+/g, "-")}-desc` : void 0;
221
+ return /* @__PURE__ */ jsxRuntime.jsxs(
222
+ "div",
223
+ {
224
+ ref,
225
+ role: "application",
226
+ "aria-label": title,
227
+ "aria-describedby": descriptionId,
228
+ "data-testid": "map-container",
229
+ className: cn("relative overflow-hidden rounded-lg border border-border", wrapperClassName),
230
+ style: { width: widthStyle, height: heightStyle },
231
+ ...props,
232
+ children: [
233
+ description && /* @__PURE__ */ jsxRuntime.jsx("span", { id: descriptionId, className: "sr-only", children: description }),
234
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("relative h-full w-full", className), children })
235
+ ]
236
+ }
237
+ );
238
+ }
239
+ );
240
+ MapContainer.displayName = "MapContainer";
241
+ function useMapTheme(preference = "auto") {
242
+ const [isDark, setIsDark] = React6.useState(false);
243
+ const updateTheme = React6.useCallback(() => {
244
+ if (preference !== "auto") {
245
+ setIsDark(preference === "dark");
246
+ return;
247
+ }
248
+ if (typeof document !== "undefined") {
249
+ const hasDarkClass = document.documentElement.classList.contains("dark");
250
+ setIsDark(hasDarkClass);
251
+ }
252
+ }, [preference]);
253
+ React6.useEffect(() => {
254
+ updateTheme();
255
+ if (preference !== "auto" || typeof document === "undefined") return;
256
+ const observer = new MutationObserver((mutations) => {
257
+ mutations.forEach((mutation) => {
258
+ if (mutation.type === "attributes" && mutation.attributeName === "class") {
259
+ updateTheme();
260
+ }
261
+ });
262
+ });
263
+ observer.observe(document.documentElement, {
264
+ attributes: true,
265
+ attributeFilter: ["class"]
266
+ });
267
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
268
+ const handleMediaChange = () => updateTheme();
269
+ mediaQuery.addEventListener("change", handleMediaChange);
270
+ return () => {
271
+ observer.disconnect();
272
+ mediaQuery.removeEventListener("change", handleMediaChange);
273
+ };
274
+ }, [preference, updateTheme]);
275
+ return {
276
+ themeName: isDark ? mapsCore.THEME_DARK : mapsCore.THEME_LIGHT,
277
+ theme: isDark ? mapsCore.darkTheme : mapsCore.lightTheme,
278
+ style: isDark ? mapsCore.darkBasicStyle : mapsCore.lightBasicStyle,
279
+ isDark
280
+ };
281
+ }
282
+ function useReducedMotion() {
283
+ const [prefersReducedMotion2, setPrefersReducedMotion] = React6.useState(false);
284
+ React6.useEffect(() => {
285
+ if (typeof window === "undefined") return;
286
+ const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
287
+ setPrefersReducedMotion(mediaQuery.matches);
288
+ const handleChange = (event) => {
289
+ setPrefersReducedMotion(event.matches);
290
+ };
291
+ mediaQuery.addEventListener("change", handleChange);
292
+ return () => {
293
+ mediaQuery.removeEventListener("change", handleChange);
294
+ };
295
+ }, []);
296
+ return prefersReducedMotion2;
297
+ }
298
+ var MapContext = React6__namespace.createContext({
299
+ map: null,
300
+ loaded: false,
301
+ controlOffsets: {}
302
+ });
303
+ function useMap() {
304
+ const context = React6__namespace.useContext(MapContext);
305
+ if (!context) {
306
+ throw new Error("useMap must be used within a Map component");
307
+ }
308
+ return context;
309
+ }
310
+ function useMapInstance() {
311
+ const { map, loaded } = useMap();
312
+ return loaded ? map : null;
313
+ }
314
+ var Map = React6__namespace.forwardRef(
315
+ ({
316
+ // Base props
317
+ title,
318
+ description,
319
+ width,
320
+ height = 400,
321
+ loading,
322
+ error,
323
+ emptyMessage,
324
+ theme: themePref = "auto",
325
+ animation = true,
326
+ className,
327
+ children,
328
+ // Map props
329
+ style: customStyle,
330
+ center = [0, 0],
331
+ zoom = 2,
332
+ bearing = 0,
333
+ pitch = 0,
334
+ bounds,
335
+ boundsPadding,
336
+ minZoom,
337
+ maxZoom,
338
+ maxBounds,
339
+ interactive = true,
340
+ scrollZoom = true,
341
+ dragPan = true,
342
+ dragRotate = true,
343
+ doubleClickZoom = true,
344
+ touchZoomRotate = true,
345
+ keyboard = true,
346
+ attributionControl = true,
347
+ customAttribution,
348
+ navigationControl = true,
349
+ navigationControlPosition = "top-right",
350
+ scaleControl = false,
351
+ scaleControlPosition = "bottom-left",
352
+ fullscreenControl = false,
353
+ fullscreenControlPosition = "top-right",
354
+ geolocateControl = false,
355
+ geolocateControlPosition = "top-right",
356
+ // Callbacks
357
+ onLoad,
358
+ onClick,
359
+ onDblClick,
360
+ onContextMenu,
361
+ onMouseMove,
362
+ onMove,
363
+ onMoveStart,
364
+ onMoveEnd,
365
+ onZoom,
366
+ onError
367
+ }, ref) => {
368
+ const containerRef = React6__namespace.useRef(null);
369
+ const mapRef = React6__namespace.useRef(null);
370
+ const [mapLoaded, setMapLoaded] = React6__namespace.useState(false);
371
+ const [mapError, setMapError] = React6__namespace.useState(null);
372
+ const customControlRegistryRef = React6__namespace.useRef({
373
+ "top-left": [],
374
+ "top-right": [],
375
+ "bottom-left": [],
376
+ "bottom-right": []
377
+ });
378
+ const [, forceUpdate] = React6__namespace.useReducer((x) => x + 1, 0);
379
+ const prefersReducedMotion2 = useReducedMotion();
380
+ const { style: themeStyle } = useMapTheme(themePref);
381
+ const mapStyle = customStyle || themeStyle;
382
+ const controlOffsets = React6__namespace.useMemo(() => {
383
+ const offsets = {
384
+ "top-left": 0,
385
+ "top-right": 0,
386
+ "bottom-left": 0,
387
+ "bottom-right": 0
388
+ };
389
+ if (navigationControl) {
390
+ offsets[navigationControlPosition] += 100;
391
+ }
392
+ if (scaleControl) {
393
+ offsets[scaleControlPosition] += 28;
394
+ }
395
+ if (fullscreenControl) {
396
+ offsets[fullscreenControlPosition] += 38;
397
+ }
398
+ if (geolocateControl) {
399
+ offsets[geolocateControlPosition] += 38;
400
+ }
401
+ return offsets;
402
+ }, [
403
+ navigationControl,
404
+ navigationControlPosition,
405
+ scaleControl,
406
+ scaleControlPosition,
407
+ fullscreenControl,
408
+ fullscreenControlPosition,
409
+ geolocateControl,
410
+ geolocateControlPosition
411
+ ]);
412
+ const registerControl = React6__namespace.useCallback(
413
+ (id, position, height2) => {
414
+ const registry = customControlRegistryRef.current;
415
+ const positionControls = registry[position] || [];
416
+ const existingIndex = positionControls.findIndex((c) => c.id === id);
417
+ if (existingIndex >= 0) {
418
+ positionControls[existingIndex].height = height2;
419
+ } else {
420
+ positionControls.push({ id, height: height2 });
421
+ forceUpdate();
422
+ }
423
+ registry[position] = positionControls;
424
+ let offset = 0;
425
+ for (const control of positionControls) {
426
+ if (control.id === id) break;
427
+ offset += control.height + 8;
428
+ }
429
+ return offset;
430
+ },
431
+ []
432
+ );
433
+ const unregisterControl = React6__namespace.useCallback((id, position) => {
434
+ const registry = customControlRegistryRef.current;
435
+ const positionControls = registry[position] || [];
436
+ registry[position] = positionControls.filter((c) => c.id !== id);
437
+ forceUpdate();
438
+ }, []);
439
+ const getCustomControlOffset = React6__namespace.useCallback((id, position) => {
440
+ const registry = customControlRegistryRef.current;
441
+ const positionControls = registry[position] || [];
442
+ let offset = 0;
443
+ for (const control of positionControls) {
444
+ if (control.id === id) break;
445
+ offset += control.height + 8;
446
+ }
447
+ return offset;
448
+ }, []);
449
+ const accessibleDescription = description || mapsCore.generateMapDescription(title, {
450
+ center,
451
+ zoom
452
+ });
453
+ React6__namespace.useEffect(() => {
454
+ if (!containerRef.current || mapRef.current) return;
455
+ try {
456
+ const map = new maplibregl__default.default.Map({
457
+ container: containerRef.current,
458
+ style: mapStyle,
459
+ center,
460
+ zoom,
461
+ bearing,
462
+ pitch,
463
+ minZoom,
464
+ maxZoom,
465
+ maxBounds,
466
+ interactive,
467
+ scrollZoom,
468
+ dragPan,
469
+ dragRotate,
470
+ doubleClickZoom,
471
+ touchZoomRotate,
472
+ keyboard,
473
+ attributionControl: attributionControl ? { customAttribution } : false
474
+ });
475
+ mapRef.current = map;
476
+ if (navigationControl) {
477
+ map.addControl(
478
+ new maplibregl__default.default.NavigationControl({
479
+ showCompass: true,
480
+ showZoom: true,
481
+ visualizePitch: true
482
+ }),
483
+ navigationControlPosition
484
+ );
485
+ }
486
+ if (scaleControl) {
487
+ map.addControl(new maplibregl__default.default.ScaleControl({ unit: "metric" }), scaleControlPosition);
488
+ }
489
+ if (fullscreenControl) {
490
+ map.addControl(new maplibregl__default.default.FullscreenControl(), fullscreenControlPosition);
491
+ }
492
+ if (geolocateControl) {
493
+ map.addControl(
494
+ new maplibregl__default.default.GeolocateControl({
495
+ positionOptions: { enableHighAccuracy: true },
496
+ trackUserLocation: true
497
+ }),
498
+ geolocateControlPosition
499
+ );
500
+ }
501
+ map.on("load", () => {
502
+ setMapLoaded(true);
503
+ if (bounds) {
504
+ map.fitBounds(bounds, {
505
+ padding: boundsPadding,
506
+ animate: animation && !prefersReducedMotion2
507
+ });
508
+ }
509
+ onLoad?.({ type: "load", loaded: true });
510
+ });
511
+ map.on("error", (e) => {
512
+ const errorMessage = e.error?.message || "Map error";
513
+ setMapError(errorMessage);
514
+ onError?.({ type: "error", message: errorMessage, error: e.error });
515
+ });
516
+ return () => {
517
+ map.remove();
518
+ mapRef.current = null;
519
+ setMapLoaded(false);
520
+ };
521
+ } catch (err) {
522
+ const errorMessage = err instanceof Error ? err.message : "Failed to initialize map";
523
+ setMapError(errorMessage);
524
+ onError?.({ type: "error", message: errorMessage, error: err });
525
+ }
526
+ }, []);
527
+ React6__namespace.useEffect(() => {
528
+ if (!mapRef.current || !mapLoaded) return;
529
+ mapRef.current.setStyle(mapStyle);
530
+ }, [mapStyle, mapLoaded]);
531
+ React6__namespace.useEffect(() => {
532
+ const map = mapRef.current;
533
+ if (!map || !mapLoaded) return;
534
+ const createEventParams = (e) => ({
535
+ lngLat: [e.lngLat.lng, e.lngLat.lat],
536
+ point: [e.point.x, e.point.y],
537
+ originalEvent: e.originalEvent
538
+ });
539
+ const createMoveParams = () => {
540
+ const mapBounds = map.getBounds();
541
+ return {
542
+ center: [map.getCenter().lng, map.getCenter().lat],
543
+ zoom: map.getZoom(),
544
+ bearing: map.getBearing(),
545
+ pitch: map.getPitch(),
546
+ bounds: {
547
+ southwest: [mapBounds.getSouthWest().lng, mapBounds.getSouthWest().lat],
548
+ northeast: [mapBounds.getNorthEast().lng, mapBounds.getNorthEast().lat]
549
+ }
550
+ };
551
+ };
552
+ const handleClick = (e) => {
553
+ onClick?.({
554
+ type: "click",
555
+ ...createEventParams(e),
556
+ features: map.queryRenderedFeatures(
557
+ e.point
558
+ )
559
+ });
560
+ };
561
+ const handleDblClick = (e) => {
562
+ onDblClick?.({
563
+ type: "dblclick",
564
+ ...createEventParams(e),
565
+ features: map.queryRenderedFeatures(
566
+ e.point
567
+ )
568
+ });
569
+ };
570
+ const handleContextMenu = (e) => {
571
+ onContextMenu?.({
572
+ type: "contextmenu",
573
+ ...createEventParams(e),
574
+ features: map.queryRenderedFeatures(
575
+ e.point
576
+ )
577
+ });
578
+ };
579
+ const handleMouseMove = (e) => {
580
+ onMouseMove?.({
581
+ type: "mousemove",
582
+ ...createEventParams(e),
583
+ features: map.queryRenderedFeatures(
584
+ e.point
585
+ )
586
+ });
587
+ };
588
+ const handleMove = () => {
589
+ onMove?.({ type: "move", ...createMoveParams() });
590
+ };
591
+ const handleMoveStart = () => {
592
+ onMoveStart?.({ type: "movestart", ...createMoveParams() });
593
+ };
594
+ const handleMoveEnd = () => {
595
+ onMoveEnd?.({ type: "moveend", ...createMoveParams() });
596
+ };
597
+ const handleZoom = () => {
598
+ onZoom?.({ type: "zoom", ...createMoveParams() });
599
+ };
600
+ if (onClick) map.on("click", handleClick);
601
+ if (onDblClick) map.on("dblclick", handleDblClick);
602
+ if (onContextMenu) map.on("contextmenu", handleContextMenu);
603
+ if (onMouseMove) map.on("mousemove", handleMouseMove);
604
+ if (onMove) map.on("move", handleMove);
605
+ if (onMoveStart) map.on("movestart", handleMoveStart);
606
+ if (onMoveEnd) map.on("moveend", handleMoveEnd);
607
+ if (onZoom) map.on("zoom", handleZoom);
608
+ return () => {
609
+ if (onClick) map.off("click", handleClick);
610
+ if (onDblClick) map.off("dblclick", handleDblClick);
611
+ if (onContextMenu) map.off("contextmenu", handleContextMenu);
612
+ if (onMouseMove) map.off("mousemove", handleMouseMove);
613
+ if (onMove) map.off("move", handleMove);
614
+ if (onMoveStart) map.off("movestart", handleMoveStart);
615
+ if (onMoveEnd) map.off("moveend", handleMoveEnd);
616
+ if (onZoom) map.off("zoom", handleZoom);
617
+ };
618
+ }, [
619
+ mapLoaded,
620
+ onClick,
621
+ onDblClick,
622
+ onContextMenu,
623
+ onMouseMove,
624
+ onMove,
625
+ onMoveStart,
626
+ onMoveEnd,
627
+ onZoom
628
+ ]);
629
+ const combinedError = error || mapError;
630
+ return /* @__PURE__ */ jsxRuntime.jsx(
631
+ MapContainer,
632
+ {
633
+ ref,
634
+ title,
635
+ description: accessibleDescription,
636
+ height,
637
+ width,
638
+ loading,
639
+ error: combinedError,
640
+ emptyMessage,
641
+ className,
642
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
643
+ MapContext.Provider,
644
+ {
645
+ value: {
646
+ map: mapRef.current,
647
+ loaded: mapLoaded,
648
+ controlOffsets,
649
+ registerControl,
650
+ unregisterControl,
651
+ getCustomControlOffset
652
+ },
653
+ children: [
654
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: "absolute inset-0" }),
655
+ mapLoaded && children && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 pointer-events-none [&>*]:pointer-events-auto", children })
656
+ ]
657
+ }
658
+ )
659
+ }
660
+ );
661
+ }
662
+ );
663
+ Map.displayName = "Map";
664
+ var Source = ({
665
+ id,
666
+ type,
667
+ data,
668
+ tiles,
669
+ url,
670
+ tileSize,
671
+ attribution,
672
+ cluster,
673
+ clusterRadius,
674
+ clusterMaxZoom,
675
+ generateId,
676
+ promoteId,
677
+ fitBounds: shouldFitBounds = false,
678
+ fitBoundsPadding = 50,
679
+ fitBoundsMaxZoom,
680
+ fitBoundsAnimate = true,
681
+ children
682
+ }) => {
683
+ const { map, loaded } = useMap();
684
+ const sourceAdded = React6__namespace.useRef(false);
685
+ const initialFitDone = React6__namespace.useRef(false);
686
+ const fitBoundsParamsRef = React6__namespace.useRef({
687
+ shouldFitBounds,
688
+ data,
689
+ fitBoundsPadding,
690
+ fitBoundsMaxZoom,
691
+ fitBoundsAnimate,
692
+ type
693
+ });
694
+ fitBoundsParamsRef.current = {
695
+ shouldFitBounds,
696
+ data,
697
+ fitBoundsPadding,
698
+ fitBoundsMaxZoom,
699
+ fitBoundsAnimate,
700
+ type
701
+ };
702
+ const performFitBounds = React6__namespace.useCallback(
703
+ (cancelledRef) => {
704
+ const params = fitBoundsParamsRef.current;
705
+ if (cancelledRef.current || !params.shouldFitBounds || initialFitDone.current) return;
706
+ if (params.type !== "geojson" || typeof params.data !== "object" || !params.data) return;
707
+ if (!map) return;
708
+ const calculatedBounds = mapsCore.calculateBounds(params.data);
709
+ if (!calculatedBounds) return;
710
+ const swLng = Number(calculatedBounds[0][0]);
711
+ const swLat = Number(calculatedBounds[0][1]);
712
+ const neLng = Number(calculatedBounds[1][0]);
713
+ const neLat = Number(calculatedBounds[1][1]);
714
+ if (!isFinite(swLng) || !isFinite(swLat) || !isFinite(neLng) || !isFinite(neLat)) {
715
+ console.warn("[maps-react] Source: Invalid bounds calculated, skipping fitBounds");
716
+ return;
717
+ }
718
+ const prefersReducedMotion2 = typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
719
+ requestAnimationFrame(() => {
720
+ if (cancelledRef.current || initialFitDone.current) return;
721
+ try {
722
+ const centerLng = (swLng + neLng) / 2;
723
+ const centerLat = (swLat + neLat) / 2;
724
+ const lngSpan = Math.abs(neLng - swLng);
725
+ const latSpan = Math.abs(neLat - swLat);
726
+ const maxSpan = Math.max(lngSpan, latSpan);
727
+ const zoom = Math.min(
728
+ Math.floor(Math.log2(360 / maxSpan)) - 1,
729
+ params.fitBoundsMaxZoom ?? 18
730
+ );
731
+ map.flyTo({
732
+ center: [centerLng, centerLat],
733
+ zoom: Math.max(zoom, 1),
734
+ animate: params.fitBoundsAnimate && !prefersReducedMotion2,
735
+ padding: params.fitBoundsPadding
736
+ });
737
+ initialFitDone.current = true;
738
+ } catch (err) {
739
+ console.warn("[maps-react] Source: fitBounds failed", err);
740
+ }
741
+ });
742
+ },
743
+ [map]
744
+ );
745
+ React6__namespace.useEffect(() => {
746
+ if (!map || !loaded || sourceAdded.current) return;
747
+ if (map.getSource(id)) {
748
+ sourceAdded.current = true;
749
+ return;
750
+ }
751
+ try {
752
+ let sourceConfig;
753
+ if (type === "geojson") {
754
+ let sourceData;
755
+ if (typeof data === "string") {
756
+ sourceData = data;
757
+ } else if (data && typeof data === "object") {
758
+ sourceData = data;
759
+ } else {
760
+ sourceData = { type: "FeatureCollection", features: [] };
761
+ }
762
+ const geojsonConfig = {
763
+ type: "geojson",
764
+ data: sourceData
765
+ };
766
+ if (cluster === true || typeof cluster === "object" && cluster.enabled) {
767
+ geojsonConfig.cluster = true;
768
+ geojsonConfig.clusterRadius = clusterRadius ?? (typeof cluster === "object" ? cluster.radius : void 0) ?? 50;
769
+ geojsonConfig.clusterMaxZoom = clusterMaxZoom ?? (typeof cluster === "object" ? cluster.maxZoom : void 0) ?? 14;
770
+ }
771
+ if (generateId !== void 0) {
772
+ geojsonConfig.generateId = generateId;
773
+ }
774
+ if (promoteId) {
775
+ geojsonConfig.promoteId = promoteId;
776
+ }
777
+ if (attribution) {
778
+ geojsonConfig.attribution = attribution;
779
+ }
780
+ sourceConfig = geojsonConfig;
781
+ } else if (type === "vector") {
782
+ const vectorConfig = {
783
+ type: "vector"
784
+ };
785
+ if (url) {
786
+ vectorConfig.url = url;
787
+ }
788
+ if (tiles) {
789
+ vectorConfig.tiles = tiles;
790
+ }
791
+ if (attribution) {
792
+ vectorConfig.attribution = attribution;
793
+ }
794
+ sourceConfig = vectorConfig;
795
+ } else if (type === "raster" || type === "raster-dem") {
796
+ const rasterConfig = {
797
+ type
798
+ };
799
+ if (url) {
800
+ rasterConfig.url = url;
801
+ }
802
+ if (tiles) {
803
+ rasterConfig.tiles = tiles;
804
+ }
805
+ if (tileSize) {
806
+ rasterConfig.tileSize = tileSize;
807
+ }
808
+ if (attribution) {
809
+ rasterConfig.attribution = attribution;
810
+ }
811
+ sourceConfig = rasterConfig;
812
+ } else {
813
+ console.warn(`[maps-react] Unsupported source type: ${type}`);
814
+ return;
815
+ }
816
+ const cancelledRef = { current: false };
817
+ const handleSourceData = (e) => {
818
+ if (cancelledRef.current) return;
819
+ if (e.sourceId === id && e.isSourceLoaded) {
820
+ map.off("sourcedata", handleSourceData);
821
+ performFitBounds(cancelledRef);
822
+ }
823
+ };
824
+ map.on("sourcedata", handleSourceData);
825
+ const handleIdle = () => {
826
+ if (cancelledRef.current) return;
827
+ map.off("idle", handleIdle);
828
+ performFitBounds(cancelledRef);
829
+ };
830
+ map.once("idle", handleIdle);
831
+ map.addSource(id, sourceConfig);
832
+ sourceAdded.current = true;
833
+ const source = map.getSource(id);
834
+ if (source && map.isSourceLoaded(id)) {
835
+ map.off("sourcedata", handleSourceData);
836
+ map.off("idle", handleIdle);
837
+ performFitBounds(cancelledRef);
838
+ }
839
+ const cleanupListeners = () => {
840
+ cancelledRef.current = true;
841
+ map.off("sourcedata", handleSourceData);
842
+ map.off("idle", handleIdle);
843
+ };
844
+ return () => {
845
+ cleanupListeners();
846
+ if (map && sourceAdded.current) {
847
+ try {
848
+ const style = map.getStyle();
849
+ if (style?.layers) {
850
+ style.layers.forEach((layer) => {
851
+ if ("source" in layer && layer.source === id) {
852
+ if (map.getLayer(layer.id)) {
853
+ map.removeLayer(layer.id);
854
+ }
855
+ }
856
+ });
857
+ }
858
+ if (map.getSource(id)) {
859
+ map.removeSource(id);
860
+ }
861
+ } catch {
862
+ }
863
+ sourceAdded.current = false;
864
+ initialFitDone.current = false;
865
+ }
866
+ };
867
+ } catch (err) {
868
+ console.error(`[maps-react] Failed to add source "${id}":`, err);
869
+ }
870
+ }, [
871
+ map,
872
+ loaded,
873
+ id,
874
+ type,
875
+ tiles,
876
+ url,
877
+ tileSize,
878
+ attribution,
879
+ cluster,
880
+ clusterRadius,
881
+ clusterMaxZoom,
882
+ generateId,
883
+ promoteId,
884
+ performFitBounds
885
+ // stable due to using ref for params
886
+ ]);
887
+ React6__namespace.useEffect(() => {
888
+ if (!map || !loaded || !sourceAdded.current || type !== "geojson") return;
889
+ const source = map.getSource(id);
890
+ if (!source) return;
891
+ try {
892
+ if (typeof data === "string") {
893
+ source.setData(data);
894
+ } else if (data && typeof data === "object") {
895
+ source.setData(data);
896
+ }
897
+ } catch (err) {
898
+ console.error(`[maps-react] Failed to update source "${id}" data:`, err);
899
+ }
900
+ }, [map, loaded, id, type, data]);
901
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
902
+ };
903
+ Source.displayName = "Source";
904
+ var Marker = React6__namespace.forwardRef(
905
+ ({
906
+ id,
907
+ coordinates,
908
+ color,
909
+ anchor = "bottom",
910
+ offset,
911
+ rotation,
912
+ draggable = false,
913
+ scale = 1,
914
+ onClick,
915
+ onDrag,
916
+ onDragEnd,
917
+ children
918
+ }, ref) => {
919
+ const { map, loaded } = useMap();
920
+ const markerRef = React6__namespace.useRef(null);
921
+ const elementRef = React6__namespace.useRef(null);
922
+ const originalLngLatRef = React6__namespace.useRef();
923
+ const clickHandlerRef = React6__namespace.useRef(null);
924
+ React6__namespace.useEffect(() => {
925
+ if (children && !elementRef.current) {
926
+ elementRef.current = document.createElement("div");
927
+ }
928
+ }, [children]);
929
+ React6__namespace.useEffect(() => {
930
+ if (!map || !loaded) return;
931
+ const markerOptions = {
932
+ color: children ? void 0 : color,
933
+ anchor,
934
+ draggable,
935
+ scale
936
+ };
937
+ if (offset) {
938
+ markerOptions.offset = offset;
939
+ }
940
+ if (rotation !== void 0) {
941
+ markerOptions.rotation = rotation;
942
+ }
943
+ if (children && elementRef.current) {
944
+ markerOptions.element = elementRef.current;
945
+ }
946
+ const marker = new maplibregl__default.default.Marker(markerOptions).setLngLat(coordinates).addTo(map);
947
+ markerRef.current = marker;
948
+ if (ref) {
949
+ if (typeof ref === "function") {
950
+ ref(marker);
951
+ } else {
952
+ ref.current = marker;
953
+ }
954
+ }
955
+ if (onClick) {
956
+ const element = marker.getElement();
957
+ const handleClick = (e) => {
958
+ e.stopPropagation();
959
+ const lngLat = marker.getLngLat();
960
+ onClick({
961
+ type: "click",
962
+ markerId: id || "",
963
+ lngLat: [lngLat.lng, lngLat.lat],
964
+ originalEvent: e
965
+ });
966
+ };
967
+ clickHandlerRef.current = handleClick;
968
+ element.addEventListener("click", handleClick);
969
+ }
970
+ if (draggable) {
971
+ marker.on("dragstart", () => {
972
+ const lngLat = marker.getLngLat();
973
+ originalLngLatRef.current = [lngLat.lng, lngLat.lat];
974
+ });
975
+ marker.on("drag", () => {
976
+ if (onDrag) {
977
+ const lngLat = marker.getLngLat();
978
+ onDrag({
979
+ type: "drag",
980
+ markerId: id || "",
981
+ lngLat: [lngLat.lng, lngLat.lat],
982
+ originalLngLat: originalLngLatRef.current
983
+ });
984
+ }
985
+ });
986
+ marker.on("dragend", () => {
987
+ if (onDragEnd) {
988
+ const lngLat = marker.getLngLat();
989
+ onDragEnd({
990
+ type: "dragend",
991
+ markerId: id || "",
992
+ lngLat: [lngLat.lng, lngLat.lat],
993
+ originalLngLat: originalLngLatRef.current
994
+ });
995
+ }
996
+ });
997
+ }
998
+ return () => {
999
+ if (clickHandlerRef.current) {
1000
+ marker.getElement().removeEventListener("click", clickHandlerRef.current);
1001
+ clickHandlerRef.current = null;
1002
+ }
1003
+ marker.remove();
1004
+ markerRef.current = null;
1005
+ };
1006
+ }, [map, loaded]);
1007
+ React6__namespace.useEffect(() => {
1008
+ if (markerRef.current) {
1009
+ markerRef.current.setLngLat(coordinates);
1010
+ }
1011
+ }, [coordinates]);
1012
+ React6__namespace.useEffect(() => {
1013
+ if (markerRef.current) {
1014
+ markerRef.current.setDraggable(draggable);
1015
+ }
1016
+ }, [draggable]);
1017
+ React6__namespace.useEffect(() => {
1018
+ if (markerRef.current && rotation !== void 0) {
1019
+ markerRef.current.setRotation(rotation);
1020
+ }
1021
+ }, [rotation]);
1022
+ if (children && elementRef.current) {
1023
+ return ReactDOM__namespace.createPortal(children, elementRef.current);
1024
+ }
1025
+ return null;
1026
+ }
1027
+ );
1028
+ Marker.displayName = "Marker";
1029
+ function normalizePadding(padding) {
1030
+ if (typeof padding === "number") {
1031
+ return { top: padding, right: padding, bottom: padding, left: padding };
1032
+ }
1033
+ return padding;
1034
+ }
1035
+ function prefersReducedMotion() {
1036
+ if (typeof window === "undefined") return false;
1037
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
1038
+ }
1039
+ function panToFitPopup(map, popup, padding) {
1040
+ const popupEl = popup.getElement();
1041
+ if (!popupEl) return;
1042
+ const mapContainer = map.getContainer();
1043
+ const mapRect = mapContainer.getBoundingClientRect();
1044
+ const popupRect = popupEl.getBoundingClientRect();
1045
+ let dx = 0;
1046
+ let dy = 0;
1047
+ if (popupRect.left < mapRect.left + padding.left) {
1048
+ dx = popupRect.left - mapRect.left - padding.left;
1049
+ } else if (popupRect.right > mapRect.right - padding.right) {
1050
+ dx = popupRect.right - mapRect.right + padding.right;
1051
+ }
1052
+ if (popupRect.top < mapRect.top + padding.top) {
1053
+ dy = popupRect.top - mapRect.top - padding.top;
1054
+ } else if (popupRect.bottom > mapRect.bottom - padding.bottom) {
1055
+ dy = popupRect.bottom - mapRect.bottom + padding.bottom;
1056
+ }
1057
+ if (dx !== 0 || dy !== 0) {
1058
+ map.panBy([dx, dy], {
1059
+ animate: !prefersReducedMotion()
1060
+ });
1061
+ }
1062
+ }
1063
+ var Popup = React6__namespace.forwardRef(
1064
+ ({
1065
+ coordinates,
1066
+ closeButton = true,
1067
+ closeOnClick = true,
1068
+ closeOnMove = false,
1069
+ anchor,
1070
+ offset,
1071
+ maxWidth = "300px",
1072
+ focusAfterOpen = true,
1073
+ autoPan = true,
1074
+ autoPanPadding = 50,
1075
+ open = true,
1076
+ onOpen,
1077
+ onClose,
1078
+ children
1079
+ }, ref) => {
1080
+ const { map, loaded } = useMap();
1081
+ const popupRef = React6__namespace.useRef(null);
1082
+ const containerRef = React6__namespace.useRef(null);
1083
+ if (!containerRef.current) {
1084
+ containerRef.current = document.createElement("div");
1085
+ containerRef.current.className = "maplibregl-popup-content-wrapper";
1086
+ }
1087
+ const [contentReady, setContentReady] = React6__namespace.useState(false);
1088
+ const contentCallbackRef = React6__namespace.useCallback((node) => {
1089
+ if (node && containerRef.current) {
1090
+ setContentReady(true);
1091
+ }
1092
+ }, []);
1093
+ React6__namespace.useEffect(() => {
1094
+ if (!map || !loaded || !containerRef.current) return;
1095
+ const popup = new maplibregl__default.default.Popup({
1096
+ closeButton,
1097
+ closeOnClick,
1098
+ closeOnMove,
1099
+ anchor,
1100
+ offset,
1101
+ maxWidth,
1102
+ focusAfterOpen
1103
+ });
1104
+ popup.setDOMContent(containerRef.current);
1105
+ popupRef.current = popup;
1106
+ if (ref) {
1107
+ if (typeof ref === "function") {
1108
+ ref(popup);
1109
+ } else {
1110
+ ref.current = popup;
1111
+ }
1112
+ }
1113
+ popup.on("open", () => {
1114
+ onOpen?.({
1115
+ type: "open",
1116
+ lngLat: coordinates
1117
+ });
1118
+ });
1119
+ popup.on("close", () => {
1120
+ onClose?.({
1121
+ type: "close",
1122
+ lngLat: coordinates
1123
+ });
1124
+ });
1125
+ return () => {
1126
+ popup.remove();
1127
+ popupRef.current = null;
1128
+ };
1129
+ }, [
1130
+ map,
1131
+ loaded,
1132
+ closeButton,
1133
+ closeOnClick,
1134
+ closeOnMove,
1135
+ anchor,
1136
+ offset,
1137
+ maxWidth,
1138
+ focusAfterOpen,
1139
+ ref,
1140
+ onOpen,
1141
+ onClose,
1142
+ coordinates
1143
+ ]);
1144
+ React6__namespace.useEffect(() => {
1145
+ if (popupRef.current) {
1146
+ popupRef.current.setLngLat(coordinates);
1147
+ }
1148
+ }, [coordinates]);
1149
+ React6__namespace.useEffect(() => {
1150
+ if (!map || !popupRef.current || !contentReady) return;
1151
+ if (open) {
1152
+ popupRef.current.setLngLat(coordinates).addTo(map);
1153
+ if (autoPan) {
1154
+ requestAnimationFrame(() => {
1155
+ if (popupRef.current && map) {
1156
+ panToFitPopup(map, popupRef.current, normalizePadding(autoPanPadding));
1157
+ }
1158
+ });
1159
+ }
1160
+ } else {
1161
+ popupRef.current.remove();
1162
+ }
1163
+ }, [map, open, coordinates, autoPan, autoPanPadding, contentReady]);
1164
+ return ReactDOM__namespace.createPortal(
1165
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: contentCallbackRef, children }),
1166
+ containerRef.current
1167
+ );
1168
+ }
1169
+ );
1170
+ Popup.displayName = "Popup";
1171
+ var PopupCard = React6__namespace.forwardRef(
1172
+ ({ className, children, ...props }, ref) => {
1173
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("bg-popover text-popover-foreground", className), ...props, children });
1174
+ }
1175
+ );
1176
+ PopupCard.displayName = "PopupCard";
1177
+ var badgeVariants = classVarianceAuthority.cva("text-xs px-1.5 py-0.5 rounded font-medium flex-shrink-0", {
1178
+ variants: {
1179
+ badgeVariant: {
1180
+ default: "bg-primary text-primary-foreground",
1181
+ secondary: "bg-secondary text-secondary-foreground",
1182
+ success: "bg-success text-success-foreground",
1183
+ warning: "bg-warning text-warning-foreground",
1184
+ info: "bg-info text-info-foreground"
1185
+ }
1186
+ },
1187
+ defaultVariants: {
1188
+ badgeVariant: "secondary"
1189
+ }
1190
+ });
1191
+ var PopupHeader = React6__namespace.forwardRef(
1192
+ ({ className, title, badge, badgeVariant, ...props }, ref) => {
1193
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1194
+ "div",
1195
+ {
1196
+ ref,
1197
+ className: cn(
1198
+ "flex items-start justify-between gap-2 border-b border-black dark:border-gray-400 bg-muted/30 px-4 py-3 pr-12",
1199
+ className
1200
+ ),
1201
+ ...props,
1202
+ children: [
1203
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-sm leading-tight", children: title }),
1204
+ badge && /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(badgeVariants({ badgeVariant })), children: badge })
1205
+ ]
1206
+ }
1207
+ );
1208
+ }
1209
+ );
1210
+ PopupHeader.displayName = "PopupHeader";
1211
+ var PopupContent = React6__namespace.forwardRef(
1212
+ ({ className, children, ...props }, ref) => {
1213
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("px-4 py-3 text-sm", className), ...props, children });
1214
+ }
1215
+ );
1216
+ PopupContent.displayName = "PopupContent";
1217
+ var PopupFooter = React6__namespace.forwardRef(
1218
+ ({ className, children, ...props }, ref) => {
1219
+ return /* @__PURE__ */ jsxRuntime.jsx(
1220
+ "div",
1221
+ {
1222
+ ref,
1223
+ className: cn(
1224
+ "flex justify-end gap-2 border-t border-black dark:border-gray-400 bg-muted/30 px-4 py-3",
1225
+ className
1226
+ ),
1227
+ ...props,
1228
+ children
1229
+ }
1230
+ );
1231
+ }
1232
+ );
1233
+ PopupFooter.displayName = "PopupFooter";
1234
+ function useLayer({
1235
+ id,
1236
+ source,
1237
+ sourceLayer,
1238
+ type,
1239
+ visible = true,
1240
+ opacity: _opacity,
1241
+ minZoom,
1242
+ maxZoom,
1243
+ filter,
1244
+ beforeId,
1245
+ paint = {},
1246
+ layout = {},
1247
+ onClick,
1248
+ onHover,
1249
+ hoverThrottleMs = 0
1250
+ }) {
1251
+ const { map, loaded } = useMap();
1252
+ const [layerAdded, setLayerAdded] = React6__namespace.useState(false);
1253
+ const hoveredFeatureId = React6__namespace.useRef(null);
1254
+ const lastHoverCallTime = React6__namespace.useRef(0);
1255
+ const lastMousePosition = React6__namespace.useRef(null);
1256
+ React6__namespace.useEffect(() => {
1257
+ if (!map || !loaded) return;
1258
+ if (!map.getSource(source)) {
1259
+ let timeoutId = null;
1260
+ const checkSource = () => {
1261
+ if (map.getSource(source)) {
1262
+ if (timeoutId) clearTimeout(timeoutId);
1263
+ addLayer();
1264
+ map.off("sourcedata", checkSource);
1265
+ }
1266
+ };
1267
+ timeoutId = setTimeout(() => {
1268
+ if (!map.getSource(source)) {
1269
+ console.warn(
1270
+ `[maps-react] Layer "${id}" is waiting for source "${source}" which has not been added after 5 seconds. Ensure the Source component with id="${source}" is rendered before or alongside this layer.`
1271
+ );
1272
+ }
1273
+ }, 5e3);
1274
+ map.on("sourcedata", checkSource);
1275
+ return () => {
1276
+ if (timeoutId) clearTimeout(timeoutId);
1277
+ map.off("sourcedata", checkSource);
1278
+ };
1279
+ }
1280
+ addLayer();
1281
+ function addLayer() {
1282
+ if (layerAdded || map.getLayer(id)) {
1283
+ setLayerAdded(true);
1284
+ return;
1285
+ }
1286
+ try {
1287
+ const layerConfig = {
1288
+ id,
1289
+ type,
1290
+ source,
1291
+ paint,
1292
+ layout: {
1293
+ visibility: visible ? "visible" : "none",
1294
+ ...layout
1295
+ }
1296
+ };
1297
+ if (sourceLayer) {
1298
+ layerConfig["source-layer"] = sourceLayer;
1299
+ }
1300
+ if (minZoom !== void 0) {
1301
+ layerConfig.minzoom = minZoom;
1302
+ }
1303
+ if (maxZoom !== void 0) {
1304
+ layerConfig.maxzoom = maxZoom;
1305
+ }
1306
+ if (filter) {
1307
+ layerConfig.filter = filter;
1308
+ }
1309
+ map.addLayer(layerConfig, beforeId);
1310
+ setLayerAdded(true);
1311
+ } catch (err) {
1312
+ console.error(`[maps-react] Failed to add layer "${id}":`, err);
1313
+ }
1314
+ }
1315
+ return () => {
1316
+ if (map && layerAdded) {
1317
+ try {
1318
+ if (map.getLayer(id)) {
1319
+ map.removeLayer(id);
1320
+ }
1321
+ } catch {
1322
+ }
1323
+ setLayerAdded(false);
1324
+ }
1325
+ };
1326
+ }, [map, loaded, id, source, sourceLayer, type, beforeId, layerAdded]);
1327
+ React6__namespace.useEffect(() => {
1328
+ if (!map || !layerAdded) return;
1329
+ try {
1330
+ map.setLayoutProperty(id, "visibility", visible ? "visible" : "none");
1331
+ } catch {
1332
+ }
1333
+ }, [map, id, visible, layerAdded]);
1334
+ React6__namespace.useEffect(() => {
1335
+ if (!map || !layerAdded) return;
1336
+ try {
1337
+ Object.entries(paint).forEach(([key, value]) => {
1338
+ map.setPaintProperty(id, key, value);
1339
+ });
1340
+ } catch {
1341
+ }
1342
+ }, [map, id, paint, layerAdded]);
1343
+ React6__namespace.useEffect(() => {
1344
+ if (!map || !layerAdded || !filter) return;
1345
+ try {
1346
+ map.setFilter(id, filter);
1347
+ } catch {
1348
+ }
1349
+ }, [map, id, filter, layerAdded]);
1350
+ React6__namespace.useEffect(() => {
1351
+ if (!map || !layerAdded) return;
1352
+ const createFeatureParams = (e) => {
1353
+ const feature = e.features?.[0];
1354
+ if (!feature) return null;
1355
+ return {
1356
+ feature,
1357
+ featureId: feature.id,
1358
+ layerId: id,
1359
+ sourceId: source,
1360
+ lngLat: [e.lngLat.lng, e.lngLat.lat],
1361
+ point: [e.point.x, e.point.y],
1362
+ originalEvent: e.originalEvent,
1363
+ map
1364
+ };
1365
+ };
1366
+ const handleClick = (e) => {
1367
+ const params = createFeatureParams(e);
1368
+ if (params) {
1369
+ onClick?.({ type: "click", ...params });
1370
+ }
1371
+ };
1372
+ const handleMouseEnter = (e) => {
1373
+ map.getCanvas().style.cursor = "pointer";
1374
+ lastMousePosition.current = {
1375
+ lngLat: [e.lngLat.lng, e.lngLat.lat],
1376
+ point: [e.point.x, e.point.y]
1377
+ };
1378
+ const feature = e.features?.[0];
1379
+ if (feature?.id !== void 0) {
1380
+ if (hoveredFeatureId.current !== null) {
1381
+ map.setFeatureState(
1382
+ { source, sourceLayer, id: hoveredFeatureId.current },
1383
+ { hover: false }
1384
+ );
1385
+ }
1386
+ hoveredFeatureId.current = feature.id;
1387
+ map.setFeatureState({ source, sourceLayer, id: feature.id }, { hover: true });
1388
+ }
1389
+ const params = createFeatureParams(e);
1390
+ if (params) {
1391
+ onHover?.({ type: "mouseenter", ...params });
1392
+ }
1393
+ };
1394
+ const handleMouseMove = (e) => {
1395
+ lastMousePosition.current = {
1396
+ lngLat: [e.lngLat.lng, e.lngLat.lat],
1397
+ point: [e.point.x, e.point.y]
1398
+ };
1399
+ const feature = e.features?.[0];
1400
+ const newFeatureId = feature?.id;
1401
+ if (newFeatureId !== hoveredFeatureId.current) {
1402
+ if (hoveredFeatureId.current !== null) {
1403
+ map.setFeatureState(
1404
+ { source, sourceLayer, id: hoveredFeatureId.current },
1405
+ { hover: false }
1406
+ );
1407
+ }
1408
+ if (newFeatureId !== void 0) {
1409
+ hoveredFeatureId.current = newFeatureId;
1410
+ map.setFeatureState({ source, sourceLayer, id: newFeatureId }, { hover: true });
1411
+ const now = Date.now();
1412
+ if (hoverThrottleMs === 0 || now - lastHoverCallTime.current >= hoverThrottleMs) {
1413
+ lastHoverCallTime.current = now;
1414
+ const params = createFeatureParams(e);
1415
+ if (params) {
1416
+ onHover?.({ type: "mousemove", ...params });
1417
+ }
1418
+ }
1419
+ } else {
1420
+ hoveredFeatureId.current = null;
1421
+ }
1422
+ }
1423
+ };
1424
+ const handleMouseLeave = () => {
1425
+ map.getCanvas().style.cursor = "";
1426
+ if (hoveredFeatureId.current !== null) {
1427
+ map.setFeatureState(
1428
+ { source, sourceLayer, id: hoveredFeatureId.current },
1429
+ { hover: false }
1430
+ );
1431
+ hoveredFeatureId.current = null;
1432
+ }
1433
+ const lastPos = lastMousePosition.current;
1434
+ onHover?.({
1435
+ type: "mouseleave",
1436
+ feature: null,
1437
+ layerId: id,
1438
+ sourceId: source,
1439
+ lngLat: lastPos?.lngLat ?? [0, 0],
1440
+ point: lastPos?.point ?? [0, 0],
1441
+ map
1442
+ });
1443
+ lastMousePosition.current = null;
1444
+ };
1445
+ if (onClick) {
1446
+ map.on("click", id, handleClick);
1447
+ }
1448
+ if (onHover) {
1449
+ map.on("mouseenter", id, handleMouseEnter);
1450
+ map.on("mousemove", id, handleMouseMove);
1451
+ map.on("mouseleave", id, handleMouseLeave);
1452
+ }
1453
+ return () => {
1454
+ if (onClick) {
1455
+ map.off("click", id, handleClick);
1456
+ }
1457
+ if (onHover) {
1458
+ map.off("mouseenter", id, handleMouseEnter);
1459
+ map.off("mousemove", id, handleMouseMove);
1460
+ map.off("mouseleave", id, handleMouseLeave);
1461
+ }
1462
+ };
1463
+ }, [map, id, source, sourceLayer, onClick, onHover, hoverThrottleMs, layerAdded]);
1464
+ return { layerAdded };
1465
+ }
1466
+
1467
+ // src/components/layers/FillLayer.tsx
1468
+ var FillLayer = ({
1469
+ id,
1470
+ source,
1471
+ sourceLayer,
1472
+ visible,
1473
+ opacity,
1474
+ minZoom,
1475
+ maxZoom,
1476
+ filter,
1477
+ beforeId,
1478
+ onClick,
1479
+ onHover,
1480
+ // Fill-specific props
1481
+ fillColor,
1482
+ fillOpacity,
1483
+ fillOutlineColor,
1484
+ fillPattern,
1485
+ fillTranslate,
1486
+ fillAntialias
1487
+ }) => {
1488
+ const paint = {};
1489
+ const layout = {};
1490
+ if (fillColor !== void 0) paint["fill-color"] = fillColor;
1491
+ if (fillOpacity !== void 0) paint["fill-opacity"] = fillOpacity;
1492
+ if (fillOutlineColor !== void 0) paint["fill-outline-color"] = fillOutlineColor;
1493
+ if (fillPattern !== void 0) paint["fill-pattern"] = fillPattern;
1494
+ if (fillTranslate !== void 0) paint["fill-translate"] = fillTranslate;
1495
+ if (fillAntialias !== void 0) paint["fill-antialias"] = fillAntialias;
1496
+ if (opacity !== void 0 && fillOpacity === void 0) {
1497
+ paint["fill-opacity"] = opacity;
1498
+ }
1499
+ useLayer({
1500
+ id,
1501
+ source,
1502
+ sourceLayer,
1503
+ type: "fill",
1504
+ visible,
1505
+ opacity,
1506
+ minZoom,
1507
+ maxZoom,
1508
+ filter,
1509
+ beforeId,
1510
+ paint,
1511
+ layout,
1512
+ onClick,
1513
+ onHover
1514
+ });
1515
+ return null;
1516
+ };
1517
+ FillLayer.displayName = "FillLayer";
1518
+
1519
+ // src/components/layers/LineLayer.tsx
1520
+ var LineLayer = ({
1521
+ id,
1522
+ source,
1523
+ sourceLayer,
1524
+ visible,
1525
+ opacity,
1526
+ minZoom,
1527
+ maxZoom,
1528
+ filter,
1529
+ beforeId,
1530
+ onClick,
1531
+ onHover,
1532
+ // Line-specific props
1533
+ lineColor,
1534
+ lineWidth,
1535
+ lineOpacity,
1536
+ lineBlur,
1537
+ lineCap,
1538
+ lineJoin,
1539
+ lineDasharray,
1540
+ lineGapWidth,
1541
+ lineOffset,
1542
+ lineGradient
1543
+ }) => {
1544
+ const paint = {};
1545
+ const layout = {};
1546
+ if (lineColor !== void 0) paint["line-color"] = lineColor;
1547
+ if (lineWidth !== void 0) paint["line-width"] = lineWidth;
1548
+ if (lineOpacity !== void 0) paint["line-opacity"] = lineOpacity;
1549
+ if (lineBlur !== void 0) paint["line-blur"] = lineBlur;
1550
+ if (lineDasharray !== void 0) paint["line-dasharray"] = lineDasharray;
1551
+ if (lineGapWidth !== void 0) paint["line-gap-width"] = lineGapWidth;
1552
+ if (lineOffset !== void 0) paint["line-offset"] = lineOffset;
1553
+ if (lineGradient !== void 0) paint["line-gradient"] = lineGradient;
1554
+ if (lineCap !== void 0) layout["line-cap"] = lineCap;
1555
+ if (lineJoin !== void 0) layout["line-join"] = lineJoin;
1556
+ if (opacity !== void 0 && lineOpacity === void 0) {
1557
+ paint["line-opacity"] = opacity;
1558
+ }
1559
+ useLayer({
1560
+ id,
1561
+ source,
1562
+ sourceLayer,
1563
+ type: "line",
1564
+ visible,
1565
+ opacity,
1566
+ minZoom,
1567
+ maxZoom,
1568
+ filter,
1569
+ beforeId,
1570
+ paint,
1571
+ layout,
1572
+ onClick,
1573
+ onHover
1574
+ });
1575
+ return null;
1576
+ };
1577
+ LineLayer.displayName = "LineLayer";
1578
+
1579
+ // src/components/layers/CircleLayer.tsx
1580
+ var CircleLayer = ({
1581
+ id,
1582
+ source,
1583
+ sourceLayer,
1584
+ visible,
1585
+ opacity,
1586
+ minZoom,
1587
+ maxZoom,
1588
+ filter,
1589
+ beforeId,
1590
+ onClick,
1591
+ onHover,
1592
+ // Circle-specific props
1593
+ circleRadius,
1594
+ circleColor,
1595
+ circleOpacity,
1596
+ circleStrokeWidth,
1597
+ circleStrokeColor,
1598
+ circleStrokeOpacity,
1599
+ circleBlur,
1600
+ circlePitchAlignment,
1601
+ circlePitchScale,
1602
+ circleTranslate
1603
+ }) => {
1604
+ const paint = {};
1605
+ const layout = {};
1606
+ if (circleRadius !== void 0) paint["circle-radius"] = circleRadius;
1607
+ if (circleColor !== void 0) paint["circle-color"] = circleColor;
1608
+ if (circleOpacity !== void 0) paint["circle-opacity"] = circleOpacity;
1609
+ if (circleStrokeWidth !== void 0) paint["circle-stroke-width"] = circleStrokeWidth;
1610
+ if (circleStrokeColor !== void 0) paint["circle-stroke-color"] = circleStrokeColor;
1611
+ if (circleStrokeOpacity !== void 0) paint["circle-stroke-opacity"] = circleStrokeOpacity;
1612
+ if (circleBlur !== void 0) paint["circle-blur"] = circleBlur;
1613
+ if (circlePitchAlignment !== void 0) paint["circle-pitch-alignment"] = circlePitchAlignment;
1614
+ if (circlePitchScale !== void 0) paint["circle-pitch-scale"] = circlePitchScale;
1615
+ if (circleTranslate !== void 0) paint["circle-translate"] = circleTranslate;
1616
+ if (opacity !== void 0 && circleOpacity === void 0) {
1617
+ paint["circle-opacity"] = opacity;
1618
+ }
1619
+ useLayer({
1620
+ id,
1621
+ source,
1622
+ sourceLayer,
1623
+ type: "circle",
1624
+ visible,
1625
+ opacity,
1626
+ minZoom,
1627
+ maxZoom,
1628
+ filter,
1629
+ beforeId,
1630
+ paint,
1631
+ layout,
1632
+ onClick,
1633
+ onHover
1634
+ });
1635
+ return null;
1636
+ };
1637
+ CircleLayer.displayName = "CircleLayer";
1638
+
1639
+ // src/components/layers/SymbolLayer.tsx
1640
+ var SymbolLayer = ({
1641
+ id,
1642
+ source,
1643
+ sourceLayer,
1644
+ visible,
1645
+ opacity,
1646
+ minZoom,
1647
+ maxZoom,
1648
+ filter,
1649
+ beforeId,
1650
+ onClick,
1651
+ onHover,
1652
+ // Symbol-specific props
1653
+ iconImage,
1654
+ iconSize,
1655
+ iconRotate,
1656
+ iconOffset,
1657
+ iconAnchor,
1658
+ iconOpacity,
1659
+ iconColor,
1660
+ iconHaloColor,
1661
+ iconHaloWidth,
1662
+ iconAllowOverlap,
1663
+ iconIgnorePlacement,
1664
+ textField,
1665
+ textFont,
1666
+ textSize,
1667
+ textColor,
1668
+ textOpacity,
1669
+ textHaloColor,
1670
+ textHaloWidth,
1671
+ textAnchor,
1672
+ textOffset,
1673
+ textRotate,
1674
+ textAllowOverlap,
1675
+ textIgnorePlacement,
1676
+ symbolPlacement,
1677
+ symbolSpacing,
1678
+ symbolSortKey
1679
+ }) => {
1680
+ const paint = {};
1681
+ const layout = {};
1682
+ if (iconOpacity !== void 0) paint["icon-opacity"] = iconOpacity;
1683
+ if (iconColor !== void 0) paint["icon-color"] = iconColor;
1684
+ if (iconHaloColor !== void 0) paint["icon-halo-color"] = iconHaloColor;
1685
+ if (iconHaloWidth !== void 0) paint["icon-halo-width"] = iconHaloWidth;
1686
+ if (textColor !== void 0) paint["text-color"] = textColor;
1687
+ if (textOpacity !== void 0) paint["text-opacity"] = textOpacity;
1688
+ if (textHaloColor !== void 0) paint["text-halo-color"] = textHaloColor;
1689
+ if (textHaloWidth !== void 0) paint["text-halo-width"] = textHaloWidth;
1690
+ if (iconImage !== void 0) layout["icon-image"] = iconImage;
1691
+ if (iconSize !== void 0) layout["icon-size"] = iconSize;
1692
+ if (iconRotate !== void 0) layout["icon-rotate"] = iconRotate;
1693
+ if (iconOffset !== void 0) layout["icon-offset"] = iconOffset;
1694
+ if (iconAnchor !== void 0) layout["icon-anchor"] = iconAnchor;
1695
+ if (iconAllowOverlap !== void 0) layout["icon-allow-overlap"] = iconAllowOverlap;
1696
+ if (iconIgnorePlacement !== void 0) layout["icon-ignore-placement"] = iconIgnorePlacement;
1697
+ if (textField !== void 0) layout["text-field"] = textField;
1698
+ if (textFont !== void 0) layout["text-font"] = textFont;
1699
+ if (textSize !== void 0) layout["text-size"] = textSize;
1700
+ if (textAnchor !== void 0) layout["text-anchor"] = textAnchor;
1701
+ if (textOffset !== void 0) layout["text-offset"] = textOffset;
1702
+ if (textRotate !== void 0) layout["text-rotate"] = textRotate;
1703
+ if (textAllowOverlap !== void 0) layout["text-allow-overlap"] = textAllowOverlap;
1704
+ if (textIgnorePlacement !== void 0) layout["text-ignore-placement"] = textIgnorePlacement;
1705
+ if (symbolPlacement !== void 0) layout["symbol-placement"] = symbolPlacement;
1706
+ if (symbolSpacing !== void 0) layout["symbol-spacing"] = symbolSpacing;
1707
+ if (symbolSortKey !== void 0) layout["symbol-sort-key"] = symbolSortKey;
1708
+ useLayer({
1709
+ id,
1710
+ source,
1711
+ sourceLayer,
1712
+ type: "symbol",
1713
+ visible,
1714
+ opacity,
1715
+ minZoom,
1716
+ maxZoom,
1717
+ filter,
1718
+ beforeId,
1719
+ paint,
1720
+ layout,
1721
+ onClick,
1722
+ onHover
1723
+ });
1724
+ return null;
1725
+ };
1726
+ SymbolLayer.displayName = "SymbolLayer";
1727
+
1728
+ // src/components/layers/FillExtrusionLayer.tsx
1729
+ var FillExtrusionLayer = ({
1730
+ id,
1731
+ source,
1732
+ sourceLayer,
1733
+ visible,
1734
+ opacity,
1735
+ minZoom,
1736
+ maxZoom,
1737
+ filter,
1738
+ beforeId,
1739
+ onClick,
1740
+ onHover,
1741
+ // Fill extrusion-specific props
1742
+ fillExtrusionHeight,
1743
+ fillExtrusionBase,
1744
+ fillExtrusionColor,
1745
+ fillExtrusionOpacity,
1746
+ fillExtrusionPattern,
1747
+ fillExtrusionTranslate,
1748
+ fillExtrusionVerticalGradient
1749
+ }) => {
1750
+ const paint = {};
1751
+ const layout = {};
1752
+ if (fillExtrusionHeight !== void 0) paint["fill-extrusion-height"] = fillExtrusionHeight;
1753
+ if (fillExtrusionBase !== void 0) paint["fill-extrusion-base"] = fillExtrusionBase;
1754
+ if (fillExtrusionColor !== void 0) paint["fill-extrusion-color"] = fillExtrusionColor;
1755
+ if (fillExtrusionOpacity !== void 0) paint["fill-extrusion-opacity"] = fillExtrusionOpacity;
1756
+ if (fillExtrusionPattern !== void 0) paint["fill-extrusion-pattern"] = fillExtrusionPattern;
1757
+ if (fillExtrusionTranslate !== void 0)
1758
+ paint["fill-extrusion-translate"] = fillExtrusionTranslate;
1759
+ if (fillExtrusionVerticalGradient !== void 0) {
1760
+ paint["fill-extrusion-vertical-gradient"] = fillExtrusionVerticalGradient;
1761
+ }
1762
+ if (opacity !== void 0 && fillExtrusionOpacity === void 0) {
1763
+ paint["fill-extrusion-opacity"] = opacity;
1764
+ }
1765
+ useLayer({
1766
+ id,
1767
+ source,
1768
+ sourceLayer,
1769
+ type: "fill-extrusion",
1770
+ visible,
1771
+ opacity,
1772
+ minZoom,
1773
+ maxZoom,
1774
+ filter,
1775
+ beforeId,
1776
+ paint,
1777
+ layout,
1778
+ onClick,
1779
+ onHover
1780
+ });
1781
+ return null;
1782
+ };
1783
+ FillExtrusionLayer.displayName = "FillExtrusionLayer";
1784
+
1785
+ // src/components/layers/HeatmapLayer.tsx
1786
+ var HeatmapLayer = ({
1787
+ id,
1788
+ source,
1789
+ sourceLayer,
1790
+ visible,
1791
+ opacity,
1792
+ minZoom,
1793
+ maxZoom,
1794
+ filter,
1795
+ beforeId,
1796
+ onClick,
1797
+ onHover,
1798
+ // Heatmap-specific props
1799
+ heatmapIntensity,
1800
+ heatmapWeight,
1801
+ heatmapColor,
1802
+ heatmapRadius,
1803
+ heatmapOpacity
1804
+ }) => {
1805
+ const paint = {};
1806
+ const layout = {};
1807
+ if (heatmapIntensity !== void 0) paint["heatmap-intensity"] = heatmapIntensity;
1808
+ if (heatmapWeight !== void 0) paint["heatmap-weight"] = heatmapWeight;
1809
+ if (heatmapColor !== void 0) paint["heatmap-color"] = heatmapColor;
1810
+ if (heatmapRadius !== void 0) paint["heatmap-radius"] = heatmapRadius;
1811
+ if (heatmapOpacity !== void 0) paint["heatmap-opacity"] = heatmapOpacity;
1812
+ if (opacity !== void 0 && heatmapOpacity === void 0) {
1813
+ paint["heatmap-opacity"] = opacity;
1814
+ }
1815
+ useLayer({
1816
+ id,
1817
+ source,
1818
+ sourceLayer,
1819
+ type: "heatmap",
1820
+ visible,
1821
+ opacity,
1822
+ minZoom,
1823
+ maxZoom,
1824
+ filter,
1825
+ beforeId,
1826
+ paint,
1827
+ layout,
1828
+ onClick,
1829
+ onHover
1830
+ });
1831
+ return null;
1832
+ };
1833
+ HeatmapLayer.displayName = "HeatmapLayer";
1834
+ var legendIdCounter = 0;
1835
+ var Legend = ({
1836
+ title,
1837
+ position = "bottom-left",
1838
+ type = "categorical",
1839
+ items = [],
1840
+ gradient = [],
1841
+ minLabel,
1842
+ maxLabel,
1843
+ collapsible = false,
1844
+ collapsed: initialCollapsed = false,
1845
+ class: className,
1846
+ onItemClick
1847
+ }) => {
1848
+ const { controlOffsets, registerControl, unregisterControl } = useMap();
1849
+ const [isCollapsed, setIsCollapsed] = React6__namespace.useState(initialCollapsed);
1850
+ const [customControlOffset, setCustomControlOffset] = React6__namespace.useState(0);
1851
+ const legendRef = React6__namespace.useRef(null);
1852
+ const legendIdRef = React6__namespace.useRef(`legend-${++legendIdCounter}`);
1853
+ React6__namespace.useEffect(() => {
1854
+ if (!legendRef.current || !registerControl) return;
1855
+ const updatePosition = () => {
1856
+ if (!legendRef.current) return;
1857
+ const height = legendRef.current.offsetHeight;
1858
+ const offset = registerControl(legendIdRef.current, position, height);
1859
+ setCustomControlOffset(offset);
1860
+ };
1861
+ updatePosition();
1862
+ const observer = new ResizeObserver(updatePosition);
1863
+ observer.observe(legendRef.current);
1864
+ return () => {
1865
+ observer.disconnect();
1866
+ unregisterControl?.(legendIdRef.current, position);
1867
+ };
1868
+ }, [position, registerControl, unregisterControl]);
1869
+ const verticalOffsetStyle = React6__namespace.useMemo(() => {
1870
+ return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
1871
+ }, [customControlOffset, position]);
1872
+ const handleItemClick = (item, index) => {
1873
+ if (onItemClick) {
1874
+ onItemClick(item, index);
1875
+ }
1876
+ };
1877
+ const toggleCollapse = () => {
1878
+ if (collapsible) {
1879
+ setIsCollapsed(!isCollapsed);
1880
+ }
1881
+ };
1882
+ const gradientStyle = React6__namespace.useMemo(() => {
1883
+ if (type !== "gradient" || gradient.length === 0) return "";
1884
+ const stops = gradient.map((stop) => `${stop.color} ${stop.position * 100}%`).join(", ");
1885
+ return `linear-gradient(to right, ${stops})`;
1886
+ }, [type, gradient]);
1887
+ const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
1888
+ const computedPositionClasses = React6__namespace.useMemo(() => {
1889
+ return mapsCore.computePositionClasses(position, hasControlsAtPosition);
1890
+ }, [position, hasControlsAtPosition]);
1891
+ return /* @__PURE__ */ jsxRuntime.jsxs(
1892
+ "div",
1893
+ {
1894
+ ref: legendRef,
1895
+ className: cn(
1896
+ "absolute z-10 bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
1897
+ "text-sm min-w-[140px] max-w-[280px]",
1898
+ computedPositionClasses,
1899
+ className
1900
+ ),
1901
+ style: verticalOffsetStyle,
1902
+ children: [
1903
+ (title || collapsible) && /* @__PURE__ */ jsxRuntime.jsxs(
1904
+ "button",
1905
+ {
1906
+ type: "button",
1907
+ className: cn(
1908
+ "w-full flex items-center justify-between px-3 py-2 font-medium text-card-foreground",
1909
+ collapsible && "cursor-pointer hover:bg-muted rounded-t-lg",
1910
+ !collapsible && "cursor-default"
1911
+ ),
1912
+ onClick: toggleCollapse,
1913
+ disabled: !collapsible,
1914
+ children: [
1915
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: title || "Legend" }),
1916
+ collapsible && /* @__PURE__ */ jsxRuntime.jsx(
1917
+ "svg",
1918
+ {
1919
+ className: cn("w-4 h-4 transition-transform", isCollapsed && "-rotate-90"),
1920
+ fill: "none",
1921
+ viewBox: "0 0 24 24",
1922
+ stroke: "currentColor",
1923
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1924
+ "path",
1925
+ {
1926
+ strokeLinecap: "round",
1927
+ strokeLinejoin: "round",
1928
+ strokeWidth: 2,
1929
+ d: "M19 9l-7 7-7-7"
1930
+ }
1931
+ )
1932
+ }
1933
+ )
1934
+ ]
1935
+ }
1936
+ ),
1937
+ !isCollapsed && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("px-3 pb-3", (title || collapsible) && "pt-1"), children: [
1938
+ type === "categorical" && items.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-1.5", children: items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
1939
+ "button",
1940
+ {
1941
+ type: "button",
1942
+ className: cn(
1943
+ "flex items-center gap-2 w-full text-left rounded px-1 -mx-1",
1944
+ onItemClick && "hover:bg-muted cursor-pointer",
1945
+ !onItemClick && "cursor-default",
1946
+ item.active === false && "opacity-50"
1947
+ ),
1948
+ onClick: () => handleItemClick(item, index),
1949
+ disabled: !onItemClick,
1950
+ children: [
1951
+ /* @__PURE__ */ jsxRuntime.jsx(
1952
+ "span",
1953
+ {
1954
+ className: "w-4 h-4 rounded flex-shrink-0",
1955
+ style: { backgroundColor: item.color }
1956
+ }
1957
+ ),
1958
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground truncate flex-1", children: item.label }),
1959
+ item.value !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs", children: item.value })
1960
+ ]
1961
+ }
1962
+ ) }, index)) }),
1963
+ type === "gradient" && gradient.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
1964
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-3 rounded-sm", style: { background: gradientStyle } }),
1965
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-xs text-muted-foreground", children: [
1966
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: minLabel || gradient[0]?.label || "" }),
1967
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: maxLabel || gradient[gradient.length - 1]?.label || "" })
1968
+ ] })
1969
+ ] })
1970
+ ] })
1971
+ ]
1972
+ }
1973
+ );
1974
+ };
1975
+ Legend.displayName = "Legend";
1976
+ var legendGroupIdCounter = 0;
1977
+ var LegendGroup = ({
1978
+ legends,
1979
+ position = "bottom-left",
1980
+ defaultExpanded,
1981
+ expanded: controlledExpanded,
1982
+ onExpandedChange,
1983
+ allowCollapseAll = false,
1984
+ class: className
1985
+ }) => {
1986
+ const { controlOffsets, registerControl, unregisterControl } = useMap();
1987
+ const containerRef = React6__namespace.useRef(null);
1988
+ const groupIdRef = React6__namespace.useRef(`legend-group-${++legendGroupIdCounter}`);
1989
+ const [customControlOffset, setCustomControlOffset] = React6__namespace.useState(0);
1990
+ const getInitialExpanded = () => {
1991
+ if (controlledExpanded !== void 0) return controlledExpanded;
1992
+ if (defaultExpanded) return defaultExpanded;
1993
+ return legends[0]?.id || null;
1994
+ };
1995
+ const [internalExpanded, setInternalExpanded] = React6__namespace.useState(getInitialExpanded);
1996
+ const expandedId = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
1997
+ const handleToggle = (id) => {
1998
+ const newExpanded = expandedId === id ? allowCollapseAll ? null : id : id;
1999
+ if (controlledExpanded === void 0) {
2000
+ setInternalExpanded(newExpanded);
2001
+ }
2002
+ onExpandedChange?.(newExpanded);
2003
+ };
2004
+ React6__namespace.useEffect(() => {
2005
+ if (!containerRef.current || !registerControl) return;
2006
+ const timeoutId = setTimeout(() => {
2007
+ if (containerRef.current) {
2008
+ const height = containerRef.current.offsetHeight;
2009
+ const offset = registerControl(groupIdRef.current, position, height);
2010
+ setCustomControlOffset(offset);
2011
+ }
2012
+ }, 50);
2013
+ return () => {
2014
+ clearTimeout(timeoutId);
2015
+ unregisterControl?.(groupIdRef.current, position);
2016
+ };
2017
+ }, [position, expandedId, registerControl, unregisterControl]);
2018
+ const verticalOffsetStyle = React6__namespace.useMemo(() => {
2019
+ return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
2020
+ }, [customControlOffset, position]);
2021
+ const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2022
+ const computedPositionClasses = React6__namespace.useMemo(() => {
2023
+ return mapsCore.computePositionClasses(position, hasControlsAtPosition);
2024
+ }, [position, hasControlsAtPosition]);
2025
+ const getGradientStyle = (legend) => {
2026
+ if (legend.type !== "gradient" || !legend.gradient?.length) return "";
2027
+ const stops = legend.gradient.map((stop) => `${stop.color} ${stop.position * 100}%`).join(", ");
2028
+ return `linear-gradient(to right, ${stops})`;
2029
+ };
2030
+ const handleItemClick = (legend, item, index) => {
2031
+ legend.onItemClick?.(item, index);
2032
+ };
2033
+ return /* @__PURE__ */ jsxRuntime.jsx(
2034
+ "div",
2035
+ {
2036
+ ref: containerRef,
2037
+ className: cn(
2038
+ "absolute z-10 bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
2039
+ "text-sm min-w-[160px] max-w-[280px]",
2040
+ computedPositionClasses,
2041
+ className
2042
+ ),
2043
+ style: verticalOffsetStyle,
2044
+ children: legends.map((legend, legendIndex) => {
2045
+ const isExpanded = expandedId === legend.id;
2046
+ const isFirst = legendIndex === 0;
2047
+ const isLast = legendIndex === legends.length - 1;
2048
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2049
+ !isFirst && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-t border-border" }),
2050
+ /* @__PURE__ */ jsxRuntime.jsxs(
2051
+ "button",
2052
+ {
2053
+ type: "button",
2054
+ className: cn(
2055
+ "w-full flex items-center justify-between px-3 py-2 font-medium text-card-foreground",
2056
+ "cursor-pointer hover:bg-muted transition-colors",
2057
+ isFirst && "rounded-t-lg",
2058
+ isLast && !isExpanded && "rounded-b-lg"
2059
+ ),
2060
+ onClick: () => handleToggle(legend.id),
2061
+ "aria-expanded": isExpanded,
2062
+ children: [
2063
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: legend.title }),
2064
+ /* @__PURE__ */ jsxRuntime.jsx(
2065
+ "svg",
2066
+ {
2067
+ className: cn(
2068
+ "w-4 h-4 transition-transform flex-shrink-0 ml-2",
2069
+ !isExpanded && "-rotate-90"
2070
+ ),
2071
+ fill: "none",
2072
+ viewBox: "0 0 24 24",
2073
+ stroke: "currentColor",
2074
+ children: /* @__PURE__ */ jsxRuntime.jsx(
2075
+ "path",
2076
+ {
2077
+ strokeLinecap: "round",
2078
+ strokeLinejoin: "round",
2079
+ strokeWidth: 2,
2080
+ d: "M19 9l-7 7-7-7"
2081
+ }
2082
+ )
2083
+ }
2084
+ )
2085
+ ]
2086
+ }
2087
+ ),
2088
+ /* @__PURE__ */ jsxRuntime.jsx(
2089
+ "div",
2090
+ {
2091
+ className: cn(
2092
+ "overflow-hidden transition-all duration-200",
2093
+ isExpanded ? "max-h-96 opacity-100" : "max-h-0 opacity-0"
2094
+ ),
2095
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("px-3 pb-3", isLast && "rounded-b-lg"), children: [
2096
+ legend.type !== "gradient" && legend.items && legend.items.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "space-y-1.5", children: legend.items.map((item, index) => /* @__PURE__ */ jsxRuntime.jsx("li", { children: /* @__PURE__ */ jsxRuntime.jsxs(
2097
+ "button",
2098
+ {
2099
+ type: "button",
2100
+ className: cn(
2101
+ "flex items-center gap-2 w-full text-left rounded px-1 -mx-1",
2102
+ legend.onItemClick && "hover:bg-muted cursor-pointer",
2103
+ !legend.onItemClick && "cursor-default",
2104
+ item.active === false && "opacity-50"
2105
+ ),
2106
+ onClick: () => handleItemClick(legend, item, index),
2107
+ disabled: !legend.onItemClick,
2108
+ children: [
2109
+ /* @__PURE__ */ jsxRuntime.jsx(
2110
+ "span",
2111
+ {
2112
+ className: "w-4 h-4 rounded flex-shrink-0",
2113
+ style: { backgroundColor: item.color }
2114
+ }
2115
+ ),
2116
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-foreground truncate flex-1", children: item.label }),
2117
+ item.value !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground text-xs", children: item.value })
2118
+ ]
2119
+ }
2120
+ ) }, index)) }),
2121
+ legend.type === "gradient" && legend.gradient && legend.gradient.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
2122
+ /* @__PURE__ */ jsxRuntime.jsx(
2123
+ "div",
2124
+ {
2125
+ className: "h-3 rounded-sm",
2126
+ style: { background: getGradientStyle(legend) }
2127
+ }
2128
+ ),
2129
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-between text-xs text-muted-foreground", children: [
2130
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: legend.minLabel || legend.gradient[0]?.label || "" }),
2131
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: legend.maxLabel || legend.gradient[legend.gradient.length - 1]?.label || "" })
2132
+ ] })
2133
+ ] })
2134
+ ] })
2135
+ }
2136
+ )
2137
+ ] }, legend.id);
2138
+ })
2139
+ }
2140
+ );
2141
+ };
2142
+ LegendGroup.displayName = "LegendGroup";
2143
+ var coordDisplayIdCounter = 0;
2144
+ var CoordinateDisplay = ({
2145
+ position = "bottom-right",
2146
+ format = "decimal",
2147
+ precision = 5,
2148
+ showZoom = true,
2149
+ showBearing = false,
2150
+ class: className
2151
+ }) => {
2152
+ const { map, loaded, controlOffsets, registerControl, unregisterControl } = useMap();
2153
+ const [cursorLngLat, setCursorLngLat] = React6__namespace.useState(null);
2154
+ const [currentZoom, setCurrentZoom] = React6__namespace.useState(0);
2155
+ const [currentBearing, setCurrentBearing] = React6__namespace.useState(0);
2156
+ const [customControlOffset, setCustomControlOffset] = React6__namespace.useState(0);
2157
+ const controlRef = React6__namespace.useRef(null);
2158
+ const controlIdRef = React6__namespace.useRef(`coord-display-${++coordDisplayIdCounter}`);
2159
+ React6__namespace.useEffect(() => {
2160
+ if (!controlRef.current || !registerControl) return;
2161
+ const updatePosition = () => {
2162
+ if (!controlRef.current) return;
2163
+ const height = controlRef.current.offsetHeight;
2164
+ const offset = registerControl(controlIdRef.current, position, height);
2165
+ setCustomControlOffset(offset);
2166
+ };
2167
+ updatePosition();
2168
+ const observer = new ResizeObserver(updatePosition);
2169
+ observer.observe(controlRef.current);
2170
+ return () => {
2171
+ observer.disconnect();
2172
+ unregisterControl?.(controlIdRef.current, position);
2173
+ };
2174
+ }, [position, registerControl, unregisterControl]);
2175
+ const verticalOffsetStyle = React6__namespace.useMemo(() => {
2176
+ return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
2177
+ }, [customControlOffset, position]);
2178
+ const formatCoord = React6__namespace.useCallback(
2179
+ (lngLat) => {
2180
+ return mapsCore.formatCoordinates(lngLat, precision, format);
2181
+ },
2182
+ [format, precision]
2183
+ );
2184
+ const formatZoom = (zoom) => {
2185
+ return zoom.toFixed(1);
2186
+ };
2187
+ const formatBearingValue = (bearing) => {
2188
+ const normalized = (bearing % 360 + 360) % 360;
2189
+ return `${normalized.toFixed(0)}\xB0`;
2190
+ };
2191
+ const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2192
+ const computedPositionClasses = React6__namespace.useMemo(() => {
2193
+ return mapsCore.computePositionClasses(position, hasControlsAtPosition);
2194
+ }, [position, hasControlsAtPosition]);
2195
+ React6__namespace.useEffect(() => {
2196
+ if (!map || !loaded) return;
2197
+ setCurrentZoom(map.getZoom());
2198
+ setCurrentBearing(map.getBearing());
2199
+ const handleMouseMove = (e) => {
2200
+ setCursorLngLat([e.lngLat.lng, e.lngLat.lat]);
2201
+ };
2202
+ const handleZoom = () => {
2203
+ setCurrentZoom(map.getZoom());
2204
+ };
2205
+ const handleRotate = () => {
2206
+ setCurrentBearing(map.getBearing());
2207
+ };
2208
+ map.on("mousemove", handleMouseMove);
2209
+ map.on("zoom", handleZoom);
2210
+ map.on("rotate", handleRotate);
2211
+ return () => {
2212
+ map.off("mousemove", handleMouseMove);
2213
+ map.off("zoom", handleZoom);
2214
+ map.off("rotate", handleRotate);
2215
+ };
2216
+ }, [map, loaded]);
2217
+ return /* @__PURE__ */ jsxRuntime.jsxs(
2218
+ "div",
2219
+ {
2220
+ ref: controlRef,
2221
+ className: cn(
2222
+ "absolute z-10 bg-card rounded px-2 py-1",
2223
+ "text-xs font-mono text-muted-foreground",
2224
+ "border border-black dark:border-gray-400 shadow-sm",
2225
+ "flex items-center gap-3",
2226
+ computedPositionClasses,
2227
+ className
2228
+ ),
2229
+ style: verticalOffsetStyle,
2230
+ children: [
2231
+ cursorLngLat ? /* @__PURE__ */ jsxRuntime.jsx("span", { title: "Cursor coordinates", children: formatCoord(cursorLngLat) }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: "Move cursor over map" }),
2232
+ showZoom && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2233
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-border", children: "|" }),
2234
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { title: "Zoom level", children: [
2235
+ "z",
2236
+ formatZoom(currentZoom)
2237
+ ] })
2238
+ ] }),
2239
+ showBearing && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2240
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-border", children: "|" }),
2241
+ /* @__PURE__ */ jsxRuntime.jsx("span", { title: "Bearing", children: formatBearingValue(currentBearing) })
2242
+ ] })
2243
+ ]
2244
+ }
2245
+ );
2246
+ };
2247
+ CoordinateDisplay.displayName = "CoordinateDisplay";
2248
+ var DeckOverlay = ({
2249
+ layers = [],
2250
+ onHover,
2251
+ onClick,
2252
+ getCursor,
2253
+ interleaved = true,
2254
+ effects,
2255
+ deckProps = {}
2256
+ }) => {
2257
+ const { map, loaded } = useMap();
2258
+ const overlayRef = React6__namespace.useRef(null);
2259
+ const MapboxOverlayRef = React6__namespace.useRef(null);
2260
+ React6__namespace.useEffect(() => {
2261
+ if (!map || !loaded) return;
2262
+ const initOverlay = async () => {
2263
+ try {
2264
+ const deckMapbox = await import('@deck.gl/mapbox');
2265
+ const MapboxOverlay = deckMapbox.MapboxOverlay;
2266
+ MapboxOverlayRef.current = MapboxOverlay;
2267
+ const overlay = new MapboxOverlay({
2268
+ interleaved,
2269
+ layers,
2270
+ onHover,
2271
+ onClick,
2272
+ ...getCursor ? { getCursor } : {},
2273
+ ...effects ? { effects } : {},
2274
+ ...deckProps
2275
+ });
2276
+ map.addControl(overlay);
2277
+ overlayRef.current = overlay;
2278
+ } catch (err) {
2279
+ console.warn(
2280
+ "[maps-react] Deck.gl is not available. Install @deck.gl/core, @deck.gl/layers, and @deck.gl/mapbox to use DeckOverlay.",
2281
+ err
2282
+ );
2283
+ }
2284
+ };
2285
+ initOverlay();
2286
+ return () => {
2287
+ if (overlayRef.current && map) {
2288
+ try {
2289
+ map.removeControl(overlayRef.current);
2290
+ } catch {
2291
+ }
2292
+ overlayRef.current = null;
2293
+ }
2294
+ };
2295
+ }, [map, loaded, interleaved]);
2296
+ React6__namespace.useEffect(() => {
2297
+ if (overlayRef.current && "setProps" in overlayRef.current) {
2298
+ overlayRef.current.setProps({ layers });
2299
+ }
2300
+ }, [layers]);
2301
+ React6__namespace.useEffect(() => {
2302
+ if (overlayRef.current && "setProps" in overlayRef.current) {
2303
+ overlayRef.current.setProps({
2304
+ onHover,
2305
+ onClick
2306
+ });
2307
+ }
2308
+ }, [onHover, onClick]);
2309
+ React6__namespace.useEffect(() => {
2310
+ if (overlayRef.current && effects && "setProps" in overlayRef.current) {
2311
+ overlayRef.current.setProps({ effects });
2312
+ }
2313
+ }, [effects]);
2314
+ return null;
2315
+ };
2316
+ DeckOverlay.displayName = "DeckOverlay";
2317
+
2318
+ Object.defineProperty(exports, "THEME_DARK", {
2319
+ enumerable: true,
2320
+ get: function () { return mapsCore.THEME_DARK; }
2321
+ });
2322
+ Object.defineProperty(exports, "THEME_LIGHT", {
2323
+ enumerable: true,
2324
+ get: function () { return mapsCore.THEME_LIGHT; }
2325
+ });
2326
+ Object.defineProperty(exports, "calculateBounds", {
2327
+ enumerable: true,
2328
+ get: function () { return mapsCore.calculateBounds; }
2329
+ });
2330
+ Object.defineProperty(exports, "calculateCentroid", {
2331
+ enumerable: true,
2332
+ get: function () { return mapsCore.calculateCentroid; }
2333
+ });
2334
+ Object.defineProperty(exports, "combineBounds", {
2335
+ enumerable: true,
2336
+ get: function () { return mapsCore.combineBounds; }
2337
+ });
2338
+ Object.defineProperty(exports, "countFeaturesByType", {
2339
+ enumerable: true,
2340
+ get: function () { return mapsCore.countFeaturesByType; }
2341
+ });
2342
+ Object.defineProperty(exports, "createHoverExpression", {
2343
+ enumerable: true,
2344
+ get: function () { return mapsCore.createHoverExpression; }
2345
+ });
2346
+ Object.defineProperty(exports, "createSelectionExpression", {
2347
+ enumerable: true,
2348
+ get: function () { return mapsCore.createSelectionExpression; }
2349
+ });
2350
+ Object.defineProperty(exports, "darkBasicStyle", {
2351
+ enumerable: true,
2352
+ get: function () { return mapsCore.darkBasicStyle; }
2353
+ });
2354
+ Object.defineProperty(exports, "darkTheme", {
2355
+ enumerable: true,
2356
+ get: function () { return mapsCore.darkTheme; }
2357
+ });
2358
+ Object.defineProperty(exports, "expandCluster", {
2359
+ enumerable: true,
2360
+ get: function () { return mapsCore.expandCluster; }
2361
+ });
2362
+ Object.defineProperty(exports, "expandClusterToBounds", {
2363
+ enumerable: true,
2364
+ get: function () { return mapsCore.expandClusterToBounds; }
2365
+ });
2366
+ Object.defineProperty(exports, "extendBounds", {
2367
+ enumerable: true,
2368
+ get: function () { return mapsCore.extendBounds; }
2369
+ });
2370
+ Object.defineProperty(exports, "filterByGeometryType", {
2371
+ enumerable: true,
2372
+ get: function () { return mapsCore.filterByGeometryType; }
2373
+ });
2374
+ Object.defineProperty(exports, "formatArea", {
2375
+ enumerable: true,
2376
+ get: function () { return mapsCore.formatArea; }
2377
+ });
2378
+ Object.defineProperty(exports, "formatCoordinates", {
2379
+ enumerable: true,
2380
+ get: function () { return mapsCore.formatCoordinates; }
2381
+ });
2382
+ Object.defineProperty(exports, "formatDistance", {
2383
+ enumerable: true,
2384
+ get: function () { return mapsCore.formatDistance; }
2385
+ });
2386
+ Object.defineProperty(exports, "generateMapDescription", {
2387
+ enumerable: true,
2388
+ get: function () { return mapsCore.generateMapDescription; }
2389
+ });
2390
+ Object.defineProperty(exports, "getClusterBounds", {
2391
+ enumerable: true,
2392
+ get: function () { return mapsCore.getClusterBounds; }
2393
+ });
2394
+ Object.defineProperty(exports, "getClusterChildren", {
2395
+ enumerable: true,
2396
+ get: function () { return mapsCore.getClusterChildren; }
2397
+ });
2398
+ Object.defineProperty(exports, "getClusterExpansionZoom", {
2399
+ enumerable: true,
2400
+ get: function () { return mapsCore.getClusterExpansionZoom; }
2401
+ });
2402
+ Object.defineProperty(exports, "getClusterLeaves", {
2403
+ enumerable: true,
2404
+ get: function () { return mapsCore.getClusterLeaves; }
2405
+ });
2406
+ Object.defineProperty(exports, "getHighlightStyle", {
2407
+ enumerable: true,
2408
+ get: function () { return mapsCore.getHighlightStyle; }
2409
+ });
2410
+ Object.defineProperty(exports, "getSelectionStyle", {
2411
+ enumerable: true,
2412
+ get: function () { return mapsCore.getSelectionStyle; }
2413
+ });
2414
+ Object.defineProperty(exports, "isClusterFeature", {
2415
+ enumerable: true,
2416
+ get: function () { return mapsCore.isClusterFeature; }
2417
+ });
2418
+ Object.defineProperty(exports, "isValidBounds", {
2419
+ enumerable: true,
2420
+ get: function () { return mapsCore.isValidBounds; }
2421
+ });
2422
+ Object.defineProperty(exports, "lightBasicStyle", {
2423
+ enumerable: true,
2424
+ get: function () { return mapsCore.lightBasicStyle; }
2425
+ });
2426
+ Object.defineProperty(exports, "lightTheme", {
2427
+ enumerable: true,
2428
+ get: function () { return mapsCore.lightTheme; }
2429
+ });
2430
+ Object.defineProperty(exports, "loadGeoJSON", {
2431
+ enumerable: true,
2432
+ get: function () { return mapsCore.loadGeoJSON; }
2433
+ });
2434
+ Object.defineProperty(exports, "validateGeoJSON", {
2435
+ enumerable: true,
2436
+ get: function () { return mapsCore.validateGeoJSON; }
2437
+ });
2438
+ exports.CircleLayer = CircleLayer;
2439
+ exports.CoordinateDisplay = CoordinateDisplay;
2440
+ exports.DeckOverlay = DeckOverlay;
2441
+ exports.FillExtrusionLayer = FillExtrusionLayer;
2442
+ exports.FillLayer = FillLayer;
2443
+ exports.HeatmapLayer = HeatmapLayer;
2444
+ exports.Legend = Legend;
2445
+ exports.LegendGroup = LegendGroup;
2446
+ exports.LineLayer = LineLayer;
2447
+ exports.Map = Map;
2448
+ exports.MapContainer = MapContainer;
2449
+ exports.MapContext = MapContext;
2450
+ exports.MapEmpty = MapEmpty;
2451
+ exports.MapError = MapError;
2452
+ exports.MapSkeleton = MapSkeleton;
2453
+ exports.Marker = Marker;
2454
+ exports.Popup = Popup;
2455
+ exports.PopupCard = PopupCard;
2456
+ exports.PopupContent = PopupContent;
2457
+ exports.PopupFooter = PopupFooter;
2458
+ exports.PopupHeader = PopupHeader;
2459
+ exports.Source = Source;
2460
+ exports.SymbolLayer = SymbolLayer;
2461
+ exports.cn = cn;
2462
+ exports.useLayer = useLayer;
2463
+ exports.useMap = useMap;
2464
+ exports.useMapInstance = useMapInstance;
2465
+ exports.useMapTheme = useMapTheme;
2466
+ exports.useReducedMotion = useReducedMotion;