@local-logic/maps 0.0.4 → 0.0.6

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 (153) hide show
  1. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  2. package/dist/index-B43MtiHH.js +30 -0
  3. package/dist/index-BAAE2pMq.js +64 -0
  4. package/dist/index-BHjgd5HB.js +29 -0
  5. package/dist/index-BZ2605rA.js +39 -0
  6. package/dist/index-B_LO5X9C.js +46 -0
  7. package/dist/index-BbrOUWDy.js +29 -0
  8. package/dist/index-Bd-X-1Gd.js +42 -0
  9. package/dist/index-CPq7k7F4.js +63 -0
  10. package/dist/index-CTk5bvm9.js +155 -0
  11. package/dist/index-CXLLvdx4.js +670 -0
  12. package/dist/index-CXjxZmYt.js +144 -0
  13. package/dist/index-DHw9gU4K.js +29 -0
  14. package/dist/index-DVitM43i.js +137 -0
  15. package/dist/index-J1MKzGEM.js +31 -0
  16. package/dist/index-qqbvBkdn.js +7 -0
  17. package/dist/index.d.ts +2 -0
  18. package/dist/index.es.js +4 -0
  19. package/dist/index.modern-EsUgbhzI.js +908 -0
  20. package/dist/index.umd.js +3181 -0
  21. package/dist/logo-control-NE-LlsRy.js +607 -0
  22. package/dist/mapbox-gl-D58OubwB.js +32266 -0
  23. package/dist/maplibre-gl-CfOZKUDd.js +20722 -0
  24. package/dist/scale-control-CyJd4u6j.js +716 -0
  25. package/dist/src/components/Map/Root/BaseMap/Empty/index.d.ts +3 -0
  26. package/dist/src/components/Map/Root/BaseMap/Empty/index.d.ts.map +1 -0
  27. package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts +11 -0
  28. package/dist/src/components/Map/Root/BaseMap/Google/index.d.ts.map +1 -0
  29. package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts +4 -0
  30. package/dist/src/components/Map/Root/BaseMap/Mapbox/index.d.ts.map +1 -0
  31. package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts +4 -0
  32. package/dist/src/components/Map/Root/BaseMap/Maptiler/index.d.ts.map +1 -0
  33. package/dist/src/components/Map/Root/BaseMap/index.d.ts +4 -0
  34. package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -0
  35. package/dist/src/components/Map/Root/BaseMap/styles.d.ts +2 -0
  36. package/dist/src/components/Map/Root/BaseMap/styles.d.ts.map +1 -0
  37. package/dist/src/components/Map/Root/BaseMap/types.d.ts +3 -0
  38. package/dist/src/components/Map/Root/BaseMap/types.d.ts.map +1 -0
  39. package/dist/src/components/Map/Root/Layers/Google/index.d.ts +4 -0
  40. package/dist/src/components/Map/Root/Layers/Google/index.d.ts.map +1 -0
  41. package/dist/src/components/Map/Root/Layers/Mapbox/index.d.ts +4 -0
  42. package/dist/src/components/Map/Root/Layers/Mapbox/index.d.ts.map +1 -0
  43. package/dist/src/components/Map/Root/Layers/Maptiler/index.d.ts +4 -0
  44. package/dist/src/components/Map/Root/Layers/Maptiler/index.d.ts.map +1 -0
  45. package/dist/src/components/Map/Root/Layers/index.d.ts +4 -0
  46. package/dist/src/components/Map/Root/Layers/index.d.ts.map +1 -0
  47. package/dist/src/components/Map/Root/Layers/types.d.ts +13 -0
  48. package/dist/src/components/Map/Root/Layers/types.d.ts.map +1 -0
  49. package/dist/src/components/Map/Root/Layers/utils.d.ts +6 -0
  50. package/dist/src/components/Map/Root/Layers/utils.d.ts.map +1 -0
  51. package/dist/src/components/Map/Root/Markers/Cluster/index.d.ts +6 -0
  52. package/dist/src/components/Map/Root/Markers/Cluster/index.d.ts.map +1 -0
  53. package/dist/src/components/Map/Root/Markers/Cluster/styles.d.ts +2 -0
  54. package/dist/src/components/Map/Root/Markers/Cluster/styles.d.ts.map +1 -0
  55. package/dist/src/components/Map/Root/Markers/Google/index.d.ts +4 -0
  56. package/dist/src/components/Map/Root/Markers/Google/index.d.ts.map +1 -0
  57. package/dist/src/components/Map/Root/Markers/Mapbox/index.d.ts +4 -0
  58. package/dist/src/components/Map/Root/Markers/Mapbox/index.d.ts.map +1 -0
  59. package/dist/src/components/Map/Root/Markers/Maptiler/index.d.ts +4 -0
  60. package/dist/src/components/Map/Root/Markers/Maptiler/index.d.ts.map +1 -0
  61. package/dist/src/components/Map/Root/Markers/index.d.ts +4 -0
  62. package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -0
  63. package/dist/src/components/Map/Root/Markers/styles.d.ts +5 -0
  64. package/dist/src/components/Map/Root/Markers/styles.d.ts.map +1 -0
  65. package/dist/src/components/Map/Root/Markers/types.d.ts +28 -0
  66. package/dist/src/components/Map/Root/Markers/types.d.ts.map +1 -0
  67. package/dist/src/components/Map/Root/Popup/Google/index.d.ts +4 -0
  68. package/dist/src/components/Map/Root/Popup/Google/index.d.ts.map +1 -0
  69. package/dist/src/components/Map/Root/Popup/Mapbox/index.d.ts +4 -0
  70. package/dist/src/components/Map/Root/Popup/Mapbox/index.d.ts.map +1 -0
  71. package/dist/src/components/Map/Root/Popup/Maptiler/index.d.ts +4 -0
  72. package/dist/src/components/Map/Root/Popup/Maptiler/index.d.ts.map +1 -0
  73. package/dist/src/components/Map/Root/Popup/index.d.ts +4 -0
  74. package/dist/src/components/Map/Root/Popup/index.d.ts.map +1 -0
  75. package/dist/src/components/Map/Root/Popup/styles.d.ts +2 -0
  76. package/dist/src/components/Map/Root/Popup/styles.d.ts.map +1 -0
  77. package/dist/src/components/Map/Root/Popup/types.d.ts +10 -0
  78. package/dist/src/components/Map/Root/Popup/types.d.ts.map +1 -0
  79. package/dist/src/components/Map/Root/constants.d.ts +7 -0
  80. package/dist/src/components/Map/Root/constants.d.ts.map +1 -0
  81. package/dist/src/components/Map/Root/context.d.ts +11 -0
  82. package/dist/src/components/Map/Root/context.d.ts.map +1 -0
  83. package/dist/src/components/Map/Root/index.d.ts +11 -0
  84. package/dist/src/components/Map/Root/index.d.ts.map +1 -0
  85. package/dist/src/components/Map/Root/types.d.ts +26 -0
  86. package/dist/src/components/Map/Root/types.d.ts.map +1 -0
  87. package/dist/src/components/Map/index.d.ts +2 -0
  88. package/dist/src/components/Map/index.d.ts.map +1 -0
  89. package/dist/src/components/Map/index.stories.d.ts +8 -0
  90. package/dist/src/components/Map/index.stories.d.ts.map +1 -0
  91. package/dist/src/components/Map/index.test.d.ts +2 -0
  92. package/dist/src/components/Map/index.test.d.ts.map +1 -0
  93. package/dist/src/components/Map/storybook-data.d.ts +18 -0
  94. package/dist/src/components/Map/storybook-data.d.ts.map +1 -0
  95. package/dist/src/index.d.ts +2 -0
  96. package/dist/src/index.d.ts.map +1 -0
  97. package/dist/style.css +1 -0
  98. package/{src/components/Map/Root/Popup/styles.ts → dist/styles-uPzJnzVS.js} +4 -1
  99. package/dist/utils-YqJg0vBb.js +25 -0
  100. package/package.json +14 -3
  101. package/.env.example +0 -3
  102. package/.storybook/defaults.ts +0 -40
  103. package/.storybook/globals.css +0 -32
  104. package/.storybook/main.ts +0 -19
  105. package/.storybook/preview.tsx +0 -28
  106. package/CHANGELOG.md +0 -27
  107. package/eslint.config.mjs +0 -46
  108. package/lint-staged.config.cjs +0 -4
  109. package/postcss.config.cjs +0 -6
  110. package/prettier.config.cjs +0 -1
  111. package/src/components/Map/Root/BaseMap/Empty/index.tsx +0 -7
  112. package/src/components/Map/Root/BaseMap/Google/index.tsx +0 -96
  113. package/src/components/Map/Root/BaseMap/Mapbox/index.tsx +0 -66
  114. package/src/components/Map/Root/BaseMap/Maptiler/index.tsx +0 -59
  115. package/src/components/Map/Root/BaseMap/index.tsx +0 -34
  116. package/src/components/Map/Root/BaseMap/styles.ts +0 -1
  117. package/src/components/Map/Root/BaseMap/types.ts +0 -3
  118. package/src/components/Map/Root/Layers/Google/index.tsx +0 -97
  119. package/src/components/Map/Root/Layers/Mapbox/index.tsx +0 -74
  120. package/src/components/Map/Root/Layers/Maptiler/index.tsx +0 -74
  121. package/src/components/Map/Root/Layers/index.tsx +0 -32
  122. package/src/components/Map/Root/Layers/types.ts +0 -15
  123. package/src/components/Map/Root/Layers/utils.ts +0 -64
  124. package/src/components/Map/Root/Markers/Cluster/index.tsx +0 -27
  125. package/src/components/Map/Root/Markers/Cluster/styles.ts +0 -11
  126. package/src/components/Map/Root/Markers/Google/index.tsx +0 -49
  127. package/src/components/Map/Root/Markers/Mapbox/index.tsx +0 -52
  128. package/src/components/Map/Root/Markers/Maptiler/index.tsx +0 -52
  129. package/src/components/Map/Root/Markers/index.tsx +0 -81
  130. package/src/components/Map/Root/Markers/styles.ts +0 -37
  131. package/src/components/Map/Root/Markers/types.ts +0 -32
  132. package/src/components/Map/Root/Popup/Google/index.tsx +0 -57
  133. package/src/components/Map/Root/Popup/Google/popup.css +0 -15
  134. package/src/components/Map/Root/Popup/Mapbox/index.tsx +0 -36
  135. package/src/components/Map/Root/Popup/Mapbox/popup.css +0 -15
  136. package/src/components/Map/Root/Popup/Maptiler/index.tsx +0 -37
  137. package/src/components/Map/Root/Popup/Maptiler/popup.css +0 -15
  138. package/src/components/Map/Root/Popup/index.tsx +0 -32
  139. package/src/components/Map/Root/Popup/types.ts +0 -20
  140. package/src/components/Map/Root/constants.ts +0 -6
  141. package/src/components/Map/Root/context.tsx +0 -15
  142. package/src/components/Map/Root/index.tsx +0 -30
  143. package/src/components/Map/Root/types.ts +0 -30
  144. package/src/components/Map/index.stories.tsx +0 -133
  145. package/src/components/Map/index.test.tsx +0 -16
  146. package/src/components/Map/index.tsx +0 -1
  147. package/src/components/Map/storybook-data.ts +0 -255
  148. package/src/index.ts +0 -1
  149. package/tailwind.config.cjs +0 -1
  150. package/tsconfig.json +0 -14
  151. package/tsconfig.node.json +0 -8
  152. package/vite-env.d.ts +0 -13
  153. package/vite.config.ts +0 -46
@@ -0,0 +1,716 @@
1
+ import * as E from "react";
2
+ import { useContext as T, useMemo as M, useLayoutEffect as V, useEffect as h, useState as G, useRef as b, useImperativeHandle as k, memo as L, forwardRef as A } from "react";
3
+ import { createPortal as H } from "react-dom";
4
+ const q = E.createContext(null);
5
+ function gt() {
6
+ var r;
7
+ const t = (r = T(q)) == null ? void 0 : r.maps, e = T(R);
8
+ return M(() => ({ ...t, current: e == null ? void 0 : e.map }), [t, e]);
9
+ }
10
+ function Q(t, e) {
11
+ const n = Array.isArray(t) ? t[0] : t ? t.x : 0, r = Array.isArray(t) ? t[1] : t ? t.y : 0, o = Array.isArray(e) ? e[0] : e ? e.x : 0, i = Array.isArray(e) ? e[1] : e ? e.y : 0;
12
+ return n === o && r === i;
13
+ }
14
+ function v(t, e) {
15
+ if (t === e)
16
+ return !0;
17
+ if (!t || !e)
18
+ return !1;
19
+ if (Array.isArray(t)) {
20
+ if (!Array.isArray(e) || t.length !== e.length)
21
+ return !1;
22
+ for (let n = 0; n < t.length; n++)
23
+ if (!v(t[n], e[n]))
24
+ return !1;
25
+ return !0;
26
+ } else if (Array.isArray(e))
27
+ return !1;
28
+ if (typeof t == "object" && typeof e == "object") {
29
+ const n = Object.keys(t), r = Object.keys(e);
30
+ if (n.length !== r.length)
31
+ return !1;
32
+ for (const o of n)
33
+ if (!e.hasOwnProperty(o) || !v(t[o], e[o]))
34
+ return !1;
35
+ return !0;
36
+ }
37
+ return !1;
38
+ }
39
+ function K(t) {
40
+ const e = t.clone();
41
+ return e.pixelsToGLUnits = t.pixelsToGLUnits, e;
42
+ }
43
+ function F(t, e) {
44
+ if (!t.getProjection)
45
+ return;
46
+ const n = t.getProjection(), r = e.getProjection();
47
+ v(n, r) || e.setProjection(n);
48
+ }
49
+ function O(t) {
50
+ return {
51
+ longitude: t.center.lng,
52
+ latitude: t.center.lat,
53
+ zoom: t.zoom,
54
+ pitch: t.pitch,
55
+ bearing: t.bearing,
56
+ padding: t.padding
57
+ };
58
+ }
59
+ function j(t, e) {
60
+ const n = e.viewState || e;
61
+ let r = !1;
62
+ if ("zoom" in n) {
63
+ const o = t.zoom;
64
+ t.zoom = n.zoom, r = r || o !== t.zoom;
65
+ }
66
+ if ("bearing" in n) {
67
+ const o = t.bearing;
68
+ t.bearing = n.bearing, r = r || o !== t.bearing;
69
+ }
70
+ if ("pitch" in n) {
71
+ const o = t.pitch;
72
+ t.pitch = n.pitch, r = r || o !== t.pitch;
73
+ }
74
+ if (n.padding && !t.isPaddingEqual(n.padding) && (r = !0, t.padding = n.padding), "longitude" in n && "latitude" in n) {
75
+ const o = t.center;
76
+ t.center = new o.constructor(n.longitude, n.latitude), r = r || o !== t.center;
77
+ }
78
+ return r;
79
+ }
80
+ const $ = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
81
+ function U(t) {
82
+ if (!t)
83
+ return null;
84
+ if (typeof t == "string" || ("toJS" in t && (t = t.toJS()), !t.layers))
85
+ return t;
86
+ const e = {};
87
+ for (const r of t.layers)
88
+ e[r.id] = r;
89
+ const n = t.layers.map((r) => {
90
+ let o = null;
91
+ "interactive" in r && (o = Object.assign({}, r), delete o.interactive);
92
+ const i = e[r.ref];
93
+ if (i) {
94
+ o = o || Object.assign({}, r), delete o.ref;
95
+ for (const s of $)
96
+ s in i && (o[s] = i[s]);
97
+ }
98
+ return o || r;
99
+ });
100
+ return { ...t, layers: n };
101
+ }
102
+ const D = { version: 8, sources: {}, layers: [] }, Z = {
103
+ mousedown: "onMouseDown",
104
+ mouseup: "onMouseUp",
105
+ mouseover: "onMouseOver",
106
+ mousemove: "onMouseMove",
107
+ click: "onClick",
108
+ dblclick: "onDblClick",
109
+ mouseenter: "onMouseEnter",
110
+ mouseleave: "onMouseLeave",
111
+ mouseout: "onMouseOut",
112
+ contextmenu: "onContextMenu",
113
+ touchstart: "onTouchStart",
114
+ touchend: "onTouchEnd",
115
+ touchmove: "onTouchMove",
116
+ touchcancel: "onTouchCancel"
117
+ }, z = {
118
+ movestart: "onMoveStart",
119
+ move: "onMove",
120
+ moveend: "onMoveEnd",
121
+ dragstart: "onDragStart",
122
+ drag: "onDrag",
123
+ dragend: "onDragEnd",
124
+ zoomstart: "onZoomStart",
125
+ zoom: "onZoom",
126
+ zoomend: "onZoomEnd",
127
+ rotatestart: "onRotateStart",
128
+ rotate: "onRotate",
129
+ rotateend: "onRotateEnd",
130
+ pitchstart: "onPitchStart",
131
+ pitch: "onPitch",
132
+ pitchend: "onPitchEnd"
133
+ }, B = {
134
+ wheel: "onWheel",
135
+ boxzoomstart: "onBoxZoomStart",
136
+ boxzoomend: "onBoxZoomEnd",
137
+ boxzoomcancel: "onBoxZoomCancel",
138
+ resize: "onResize",
139
+ load: "onLoad",
140
+ render: "onRender",
141
+ idle: "onIdle",
142
+ remove: "onRemove",
143
+ data: "onData",
144
+ styledata: "onStyleData",
145
+ sourcedata: "onSourceData",
146
+ error: "onError"
147
+ }, J = [
148
+ "minZoom",
149
+ "maxZoom",
150
+ "minPitch",
151
+ "maxPitch",
152
+ "maxBounds",
153
+ "projection",
154
+ "renderWorldCopies"
155
+ ], Y = [
156
+ "scrollZoom",
157
+ "boxZoom",
158
+ "dragRotate",
159
+ "dragPan",
160
+ "keyboard",
161
+ "doubleClickZoom",
162
+ "touchZoomRotate",
163
+ "touchPitch"
164
+ ];
165
+ class w {
166
+ constructor(e, n, r) {
167
+ this._map = null, this._internalUpdate = !1, this._inRender = !1, this._hoveredFeatures = null, this._deferredEvents = {
168
+ move: !1,
169
+ zoom: !1,
170
+ pitch: !1,
171
+ rotate: !1
172
+ }, this._onEvent = (o) => {
173
+ const i = this.props[B[o.type]];
174
+ i ? i(o) : o.type === "error" && console.error(o.error);
175
+ }, this._onPointerEvent = (o) => {
176
+ (o.type === "mousemove" || o.type === "mouseout") && this._updateHover(o);
177
+ const i = this.props[Z[o.type]];
178
+ i && (this.props.interactiveLayerIds && o.type !== "mouseover" && o.type !== "mouseout" && (o.features = this._hoveredFeatures || this._queryRenderedFeatures(o.point)), i(o), delete o.features);
179
+ }, this._onCameraEvent = (o) => {
180
+ if (!this._internalUpdate) {
181
+ const i = this.props[z[o.type]];
182
+ i && i(o);
183
+ }
184
+ o.type in this._deferredEvents && (this._deferredEvents[o.type] = !1);
185
+ }, this._MapClass = e, this.props = n, this._initialize(r);
186
+ }
187
+ get map() {
188
+ return this._map;
189
+ }
190
+ get transform() {
191
+ return this._renderTransform;
192
+ }
193
+ setProps(e) {
194
+ const n = this.props;
195
+ this.props = e;
196
+ const r = this._updateSettings(e, n);
197
+ r && this._createShadowTransform(this._map);
198
+ const o = this._updateSize(e), i = this._updateViewState(e, !0);
199
+ this._updateStyle(e, n), this._updateStyleComponents(e, n), this._updateHandlers(e, n), (r || o || i && !this._map.isMoving()) && this.redraw();
200
+ }
201
+ static reuse(e, n) {
202
+ const r = w.savedMaps.pop();
203
+ if (!r)
204
+ return null;
205
+ const o = r.map, i = o.getContainer();
206
+ for (n.className = i.className; i.childNodes.length > 0; )
207
+ n.appendChild(i.childNodes[0]);
208
+ o._container = n, r.setProps({ ...e, styleDiffing: !1 }), o.resize();
209
+ const { initialViewState: s } = e;
210
+ return s && (s.bounds ? o.fitBounds(s.bounds, { ...s.fitBoundsOptions, duration: 0 }) : r._updateViewState(s, !1)), o.isStyleLoaded() ? o.fire("load") : o.once("styledata", () => o.fire("load")), o._update(), r;
211
+ }
212
+ /* eslint-disable complexity,max-statements */
213
+ _initialize(e) {
214
+ const { props: n } = this, { mapStyle: r = D } = n, o = {
215
+ ...n,
216
+ ...n.initialViewState,
217
+ accessToken: n.mapboxAccessToken || X() || null,
218
+ container: e,
219
+ style: U(r)
220
+ }, i = o.initialViewState || o.viewState || o;
221
+ if (Object.assign(o, {
222
+ center: [i.longitude || 0, i.latitude || 0],
223
+ zoom: i.zoom || 0,
224
+ pitch: i.pitch || 0,
225
+ bearing: i.bearing || 0
226
+ }), n.gl) {
227
+ const u = HTMLCanvasElement.prototype.getContext;
228
+ HTMLCanvasElement.prototype.getContext = () => (HTMLCanvasElement.prototype.getContext = u, n.gl);
229
+ }
230
+ const s = new this._MapClass(o);
231
+ i.padding && s.setPadding(i.padding), n.cursor && (s.getCanvas().style.cursor = n.cursor), this._createShadowTransform(s);
232
+ const l = s._render;
233
+ s._render = (u) => {
234
+ this._inRender = !0, l.call(s, u), this._inRender = !1;
235
+ };
236
+ const a = s._renderTaskQueue.run;
237
+ s._renderTaskQueue.run = (u) => {
238
+ a.call(s._renderTaskQueue, u), this._onBeforeRepaint();
239
+ }, s.on("render", () => this._onAfterRepaint());
240
+ const c = s.fire;
241
+ s.fire = this._fireEvent.bind(this, c), s.on("resize", () => {
242
+ this._renderTransform.resize(s.transform.width, s.transform.height);
243
+ }), s.on("styledata", () => {
244
+ this._updateStyleComponents(this.props, {}), F(s.transform, this._renderTransform);
245
+ }), s.on("sourcedata", () => this._updateStyleComponents(this.props, {}));
246
+ for (const u in Z)
247
+ s.on(u, this._onPointerEvent);
248
+ for (const u in z)
249
+ s.on(u, this._onCameraEvent);
250
+ for (const u in B)
251
+ s.on(u, this._onEvent);
252
+ this._map = s;
253
+ }
254
+ /* eslint-enable complexity,max-statements */
255
+ recycle() {
256
+ const n = this.map.getContainer().querySelector("[mapboxgl-children]");
257
+ n == null || n.remove(), w.savedMaps.push(this);
258
+ }
259
+ destroy() {
260
+ this._map.remove();
261
+ }
262
+ // Force redraw the map now. Typically resize() and jumpTo() is reflected in the next
263
+ // render cycle, which is managed by Mapbox's animation loop.
264
+ // This removes the synchronization issue caused by requestAnimationFrame.
265
+ redraw() {
266
+ const e = this._map;
267
+ !this._inRender && e.style && (e._frame && (e._frame.cancel(), e._frame = null), e._render());
268
+ }
269
+ _createShadowTransform(e) {
270
+ const n = K(e.transform);
271
+ e.painter.transform = n, this._renderTransform = n;
272
+ }
273
+ /* Trigger map resize if size is controlled
274
+ @param {object} nextProps
275
+ @returns {bool} true if size has changed
276
+ */
277
+ _updateSize(e) {
278
+ const { viewState: n } = e;
279
+ if (n) {
280
+ const r = this._map;
281
+ if (n.width !== r.transform.width || n.height !== r.transform.height)
282
+ return r.resize(), !0;
283
+ }
284
+ return !1;
285
+ }
286
+ // Adapted from map.jumpTo
287
+ /* Update camera to match props
288
+ @param {object} nextProps
289
+ @param {bool} triggerEvents - should fire camera events
290
+ @returns {bool} true if anything is changed
291
+ */
292
+ _updateViewState(e, n) {
293
+ if (this._internalUpdate)
294
+ return !1;
295
+ const r = this._map, o = this._renderTransform, { zoom: i, pitch: s, bearing: l } = o, a = r.isMoving();
296
+ a && (o.cameraElevationReference = "sea");
297
+ const c = j(o, {
298
+ ...O(r.transform),
299
+ ...e
300
+ });
301
+ if (a && (o.cameraElevationReference = "ground"), c && n) {
302
+ const u = this._deferredEvents;
303
+ u.move = !0, u.zoom || (u.zoom = i !== o.zoom), u.rotate || (u.rotate = l !== o.bearing), u.pitch || (u.pitch = s !== o.pitch);
304
+ }
305
+ return a || j(r.transform, e), c;
306
+ }
307
+ /* Update camera constraints and projection settings to match props
308
+ @param {object} nextProps
309
+ @param {object} currProps
310
+ @returns {bool} true if anything is changed
311
+ */
312
+ _updateSettings(e, n) {
313
+ const r = this._map;
314
+ let o = !1;
315
+ for (const i of J)
316
+ if (i in e && !v(e[i], n[i])) {
317
+ o = !0;
318
+ const s = r[`set${i[0].toUpperCase()}${i.slice(1)}`];
319
+ s == null || s.call(r, e[i]);
320
+ }
321
+ return o;
322
+ }
323
+ /* Update map style to match props
324
+ @param {object} nextProps
325
+ @param {object} currProps
326
+ @returns {bool} true if style is changed
327
+ */
328
+ _updateStyle(e, n) {
329
+ if (e.cursor !== n.cursor && (this._map.getCanvas().style.cursor = e.cursor || ""), e.mapStyle !== n.mapStyle) {
330
+ const { mapStyle: r = D, styleDiffing: o = !0 } = e, i = {
331
+ diff: o
332
+ };
333
+ return "localIdeographFontFamily" in e && (i.localIdeographFontFamily = e.localIdeographFontFamily), this._map.setStyle(U(r), i), !0;
334
+ }
335
+ return !1;
336
+ }
337
+ /* Update fog, light and terrain to match props
338
+ @param {object} nextProps
339
+ @param {object} currProps
340
+ @returns {bool} true if anything is changed
341
+ */
342
+ _updateStyleComponents(e, n) {
343
+ const r = this._map;
344
+ let o = !1;
345
+ return r.isStyleLoaded() && ("light" in e && r.setLight && !v(e.light, n.light) && (o = !0, r.setLight(e.light)), "fog" in e && r.setFog && !v(e.fog, n.fog) && (o = !0, r.setFog(e.fog)), "terrain" in e && r.setTerrain && !v(e.terrain, n.terrain) && (!e.terrain || r.getSource(e.terrain.source)) && (o = !0, r.setTerrain(e.terrain))), o;
346
+ }
347
+ /* Update interaction handlers to match props
348
+ @param {object} nextProps
349
+ @param {object} currProps
350
+ @returns {bool} true if anything is changed
351
+ */
352
+ _updateHandlers(e, n) {
353
+ const r = this._map;
354
+ let o = !1;
355
+ for (const i of Y) {
356
+ const s = e[i] ?? !0, l = n[i] ?? !0;
357
+ v(s, l) || (o = !0, s ? r[i].enable(s) : r[i].disable());
358
+ }
359
+ return o;
360
+ }
361
+ _queryRenderedFeatures(e) {
362
+ const n = this._map, r = n.transform, { interactiveLayerIds: o = [] } = this.props;
363
+ try {
364
+ return n.transform = this._renderTransform, n.queryRenderedFeatures(e, {
365
+ layers: o.filter(n.getLayer.bind(n))
366
+ });
367
+ } catch {
368
+ return [];
369
+ } finally {
370
+ n.transform = r;
371
+ }
372
+ }
373
+ _updateHover(e) {
374
+ var o;
375
+ const { props: n } = this;
376
+ if (n.interactiveLayerIds && (n.onMouseMove || n.onMouseEnter || n.onMouseLeave)) {
377
+ const i = e.type, s = ((o = this._hoveredFeatures) == null ? void 0 : o.length) > 0, l = this._queryRenderedFeatures(e.point), a = l.length > 0;
378
+ !a && s && (e.type = "mouseleave", this._onPointerEvent(e)), this._hoveredFeatures = l, a && !s && (e.type = "mouseenter", this._onPointerEvent(e)), e.type = i;
379
+ } else
380
+ this._hoveredFeatures = null;
381
+ }
382
+ _fireEvent(e, n, r) {
383
+ const o = this._map, i = o.transform, s = typeof n == "string" ? n : n.type;
384
+ return s === "move" && this._updateViewState(this.props, !1), s in z && (typeof n == "object" && (n.viewState = O(i)), this._map.isMoving()) ? (o.transform = this._renderTransform, e.call(o, n, r), o.transform = i, o) : (e.call(o, n, r), o);
385
+ }
386
+ // All camera manipulations are complete, ready to repaint
387
+ _onBeforeRepaint() {
388
+ const e = this._map;
389
+ this._internalUpdate = !0;
390
+ for (const r in this._deferredEvents)
391
+ this._deferredEvents[r] && e.fire(r);
392
+ this._internalUpdate = !1;
393
+ const n = this._map.transform;
394
+ e.transform = this._renderTransform, this._onAfterRepaint = () => {
395
+ F(this._renderTransform, n), e.transform = n;
396
+ };
397
+ }
398
+ }
399
+ w.savedMaps = [];
400
+ function X() {
401
+ let t = null;
402
+ if (typeof location < "u") {
403
+ const e = /access_token=([^&\/]*)/.exec(location.search);
404
+ t = e && e[1];
405
+ }
406
+ try {
407
+ t = t || process.env.MapboxAccessToken;
408
+ } catch {
409
+ }
410
+ try {
411
+ t = t || process.env.REACT_APP_MAPBOX_ACCESS_TOKEN;
412
+ } catch {
413
+ }
414
+ return t;
415
+ }
416
+ const tt = [
417
+ "setMaxBounds",
418
+ "setMinZoom",
419
+ "setMaxZoom",
420
+ "setMinPitch",
421
+ "setMaxPitch",
422
+ "setRenderWorldCopies",
423
+ "setProjection",
424
+ "setStyle",
425
+ "addSource",
426
+ "removeSource",
427
+ "addLayer",
428
+ "removeLayer",
429
+ "setLayerZoomRange",
430
+ "setFilter",
431
+ "setPaintProperty",
432
+ "setLayoutProperty",
433
+ "setLight",
434
+ "setTerrain",
435
+ "setFog",
436
+ "remove"
437
+ ];
438
+ function et(t) {
439
+ if (!t)
440
+ return null;
441
+ const e = t.map, n = {
442
+ getMap: () => e,
443
+ // Overwrite getters to use our shadow transform
444
+ getCenter: () => t.transform.center,
445
+ getZoom: () => t.transform.zoom,
446
+ getBearing: () => t.transform.bearing,
447
+ getPitch: () => t.transform.pitch,
448
+ getPadding: () => t.transform.padding,
449
+ getBounds: () => t.transform.getBounds(),
450
+ project: (r) => {
451
+ const o = e.transform;
452
+ e.transform = t.transform;
453
+ const i = e.project(r);
454
+ return e.transform = o, i;
455
+ },
456
+ unproject: (r) => {
457
+ const o = e.transform;
458
+ e.transform = t.transform;
459
+ const i = e.unproject(r);
460
+ return e.transform = o, i;
461
+ },
462
+ // options diverge between mapbox and maplibre
463
+ queryTerrainElevation: (r, o) => {
464
+ const i = e.transform;
465
+ e.transform = t.transform;
466
+ const s = e.queryTerrainElevation(r, o);
467
+ return e.transform = i, s;
468
+ },
469
+ queryRenderedFeatures: (r, o) => {
470
+ const i = e.transform;
471
+ e.transform = t.transform;
472
+ const s = e.queryRenderedFeatures(r, o);
473
+ return e.transform = i, s;
474
+ }
475
+ };
476
+ for (const r of nt(e))
477
+ !(r in n) && !tt.includes(r) && (n[r] = e[r].bind(e));
478
+ return n;
479
+ }
480
+ function nt(t) {
481
+ const e = /* @__PURE__ */ new Set();
482
+ let n = t;
483
+ for (; n; ) {
484
+ for (const r of Object.getOwnPropertyNames(n))
485
+ r[0] !== "_" && typeof t[r] == "function" && r !== "fire" && r !== "setEventedParent" && e.add(r);
486
+ n = Object.getPrototypeOf(n);
487
+ }
488
+ return Array.from(e);
489
+ }
490
+ const ot = typeof document < "u" ? V : h, rt = [
491
+ "baseApiUrl",
492
+ "maxParallelImageRequests",
493
+ "workerClass",
494
+ "workerCount",
495
+ "workerUrl"
496
+ ];
497
+ function it(t, e) {
498
+ for (const r of rt)
499
+ r in e && (t[r] = e[r]);
500
+ const { RTLTextPlugin: n = "https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js" } = e;
501
+ n && t.getRTLTextPluginStatus && t.getRTLTextPluginStatus() === "unavailable" && t.setRTLTextPlugin(n, (r) => {
502
+ r && console.error(r);
503
+ }, !0);
504
+ }
505
+ const R = E.createContext(null);
506
+ function st(t, e) {
507
+ const n = T(q), [r, o] = G(null), i = b(), { current: s } = b({ mapLib: null, map: null });
508
+ h(() => {
509
+ const c = t.mapLib;
510
+ let u = !0, f;
511
+ return Promise.resolve(c || import("./mapbox-gl-D58OubwB.js").then((d) => d.m)).then((d) => {
512
+ if (!u)
513
+ return;
514
+ if (!d)
515
+ throw new Error("Invalid mapLib");
516
+ const m = "Map" in d ? d : d.default;
517
+ if (!m.Map)
518
+ throw new Error("Invalid mapLib");
519
+ if (it(m, t), !m.supported || m.supported(t))
520
+ t.reuseMaps && (f = w.reuse(t, i.current)), f || (f = new w(m.Map, t, i.current)), s.map = et(f), s.mapLib = m, o(f), n == null || n.onMapMount(s.map, t.id);
521
+ else
522
+ throw new Error("Map is not supported by this browser");
523
+ }).catch((d) => {
524
+ const { onError: m } = t;
525
+ m ? m({
526
+ type: "error",
527
+ target: null,
528
+ error: d
529
+ }) : console.error(d);
530
+ }), () => {
531
+ u = !1, f && (n == null || n.onMapUnmount(t.id), t.reuseMaps ? f.recycle() : f.destroy());
532
+ };
533
+ }, []), ot(() => {
534
+ r && r.setProps(t);
535
+ }), k(e, () => s.map, [r]);
536
+ const l = M(() => ({
537
+ position: "relative",
538
+ width: "100%",
539
+ height: "100%",
540
+ ...t.style
541
+ }), [t.style]), a = {
542
+ height: "100%"
543
+ };
544
+ return E.createElement("div", { id: t.id, ref: i, style: l }, r && E.createElement(
545
+ R.Provider,
546
+ { value: s },
547
+ E.createElement("div", { "mapboxgl-children": "", style: a }, t.children)
548
+ ));
549
+ }
550
+ const pt = E.forwardRef(st), at = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;
551
+ function S(t, e) {
552
+ if (!t || !e)
553
+ return;
554
+ const n = t.style;
555
+ for (const r in e) {
556
+ const o = e[r];
557
+ Number.isFinite(o) && !at.test(r) ? n[r] = `${o}px` : n[r] = o;
558
+ }
559
+ }
560
+ const yt = L(A((t, e) => {
561
+ const { map: n, mapLib: r } = T(R), o = b({ props: t });
562
+ o.current.props = t;
563
+ const i = M(() => {
564
+ let N = !1;
565
+ E.Children.forEach(t.children, (y) => {
566
+ y && (N = !0);
567
+ });
568
+ const I = {
569
+ ...t,
570
+ element: N ? document.createElement("div") : null
571
+ }, C = new r.Marker(I);
572
+ return C.setLngLat([t.longitude, t.latitude]), C.getElement().addEventListener("click", (y) => {
573
+ var g, p;
574
+ (p = (g = o.current.props).onClick) == null || p.call(g, {
575
+ type: "click",
576
+ target: C,
577
+ originalEvent: y
578
+ });
579
+ }), C.on("dragstart", (y) => {
580
+ var p, _;
581
+ const g = y;
582
+ g.lngLat = i.getLngLat(), (_ = (p = o.current.props).onDragStart) == null || _.call(p, g);
583
+ }), C.on("drag", (y) => {
584
+ var p, _;
585
+ const g = y;
586
+ g.lngLat = i.getLngLat(), (_ = (p = o.current.props).onDrag) == null || _.call(p, g);
587
+ }), C.on("dragend", (y) => {
588
+ var p, _;
589
+ const g = y;
590
+ g.lngLat = i.getLngLat(), (_ = (p = o.current.props).onDragEnd) == null || _.call(p, g);
591
+ }), C;
592
+ }, []);
593
+ h(() => (i.addTo(n.getMap()), () => {
594
+ i.remove();
595
+ }), []);
596
+ const { longitude: s, latitude: l, offset: a, style: c, draggable: u = !1, popup: f = null, rotation: d = 0, rotationAlignment: m = "auto", pitchAlignment: P = "auto" } = t;
597
+ return h(() => {
598
+ S(i.getElement(), c);
599
+ }, [c]), k(e, () => i, []), (i.getLngLat().lng !== s || i.getLngLat().lat !== l) && i.setLngLat([s, l]), a && !Q(i.getOffset(), a) && i.setOffset(a), i.isDraggable() !== u && i.setDraggable(u), i.getRotation() !== d && i.setRotation(d), i.getRotationAlignment() !== m && i.setRotationAlignment(m), i.getPitchAlignment() !== P && i.setPitchAlignment(P), i.getPopup() !== f && i.setPopup(f), H(t.children, i.getElement());
600
+ }));
601
+ function W(t) {
602
+ return new Set(t ? t.trim().split(/\s+/) : []);
603
+ }
604
+ const vt = L(A((t, e) => {
605
+ const { map: n, mapLib: r } = T(R), o = M(() => document.createElement("div"), []), i = b({ props: t });
606
+ i.current.props = t;
607
+ const s = M(() => {
608
+ const l = { ...t }, a = new r.Popup(l);
609
+ return a.setLngLat([t.longitude, t.latitude]), a.once("open", (c) => {
610
+ var u, f;
611
+ (f = (u = i.current.props).onOpen) == null || f.call(u, c);
612
+ }), a;
613
+ }, []);
614
+ if (h(() => {
615
+ const l = (a) => {
616
+ var c, u;
617
+ (u = (c = i.current.props).onClose) == null || u.call(c, a);
618
+ };
619
+ return s.on("close", l), s.setDOMContent(o).addTo(n.getMap()), () => {
620
+ s.off("close", l), s.isOpen() && s.remove();
621
+ };
622
+ }, []), h(() => {
623
+ S(s.getElement(), t.style);
624
+ }, [t.style]), k(e, () => s, []), s.isOpen() && ((s.getLngLat().lng !== t.longitude || s.getLngLat().lat !== t.latitude) && s.setLngLat([t.longitude, t.latitude]), t.offset && !v(s.options.offset, t.offset) && s.setOffset(t.offset), (s.options.anchor !== t.anchor || s.options.maxWidth !== t.maxWidth) && (s.options.anchor = t.anchor, s.setMaxWidth(t.maxWidth)), s.options.className !== t.className)) {
625
+ const l = W(s.options.className), a = W(t.className);
626
+ for (const c of l)
627
+ a.has(c) || s.removeClassName(c);
628
+ for (const c of a)
629
+ l.has(c) || s.addClassName(c);
630
+ s.options.className = t.className;
631
+ }
632
+ return H(t.children, o);
633
+ }));
634
+ function x(t, e, n, r) {
635
+ const o = T(R), i = M(() => t(o), []);
636
+ return h(() => {
637
+ const s = e, l = null, a = typeof e == "function" ? e : null, { map: c } = o;
638
+ return c.hasControl(i) || (c.addControl(i, s == null ? void 0 : s.position), l && l(o)), () => {
639
+ a && a(o), c.hasControl(i) && c.removeControl(i);
640
+ };
641
+ }, []), i;
642
+ }
643
+ function ct(t) {
644
+ const e = x(({ mapLib: n }) => new n.AttributionControl(t), {
645
+ position: t.position
646
+ });
647
+ return h(() => {
648
+ S(e._container, t.style);
649
+ }, [t.style]), null;
650
+ }
651
+ L(ct);
652
+ function lt(t) {
653
+ const e = x(({ mapLib: n }) => new n.FullscreenControl({
654
+ container: t.containerId && document.getElementById(t.containerId)
655
+ }), { position: t.position });
656
+ return h(() => {
657
+ S(e._controlContainer, t.style);
658
+ }, [t.style]), null;
659
+ }
660
+ L(lt);
661
+ function ut(t, e) {
662
+ const n = b({ props: t }), r = x(({ mapLib: o }) => {
663
+ const i = new o.GeolocateControl(t), s = i._setupUI.bind(i);
664
+ return i._setupUI = (l) => {
665
+ i._container.hasChildNodes() || s(l);
666
+ }, i.on("geolocate", (l) => {
667
+ var a, c;
668
+ (c = (a = n.current.props).onGeolocate) == null || c.call(a, l);
669
+ }), i.on("error", (l) => {
670
+ var a, c;
671
+ (c = (a = n.current.props).onError) == null || c.call(a, l);
672
+ }), i.on("outofmaxbounds", (l) => {
673
+ var a, c;
674
+ (c = (a = n.current.props).onOutOfMaxBounds) == null || c.call(a, l);
675
+ }), i.on("trackuserlocationstart", (l) => {
676
+ var a, c;
677
+ (c = (a = n.current.props).onTrackUserLocationStart) == null || c.call(a, l);
678
+ }), i.on("trackuserlocationend", (l) => {
679
+ var a, c;
680
+ (c = (a = n.current.props).onTrackUserLocationEnd) == null || c.call(a, l);
681
+ }), i;
682
+ }, { position: t.position });
683
+ return n.current.props = t, k(e, () => r, []), h(() => {
684
+ S(r._container, t.style);
685
+ }, [t.style]), null;
686
+ }
687
+ L(A(ut));
688
+ function ft(t) {
689
+ const e = x(({ mapLib: n }) => new n.NavigationControl(t), {
690
+ position: t.position
691
+ });
692
+ return h(() => {
693
+ S(e._container, t.style);
694
+ }, [t.style]), null;
695
+ }
696
+ const _t = L(ft);
697
+ function dt(t) {
698
+ const e = x(({ mapLib: i }) => new i.ScaleControl(t), {
699
+ position: t.position
700
+ }), n = b(t), r = n.current;
701
+ n.current = t;
702
+ const { style: o } = t;
703
+ return t.maxWidth !== void 0 && t.maxWidth !== r.maxWidth && (e.options.maxWidth = t.maxWidth), t.unit !== void 0 && t.unit !== r.unit && e.setUnit(t.unit), h(() => {
704
+ S(e._container, o);
705
+ }, [o]), null;
706
+ }
707
+ L(dt);
708
+ export {
709
+ pt as M,
710
+ _t as N,
711
+ vt as P,
712
+ yt as a,
713
+ R as b,
714
+ v as d,
715
+ gt as u
716
+ };