@local-logic/maps 0.0.21 → 0.0.22

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 (38) hide show
  1. package/dist/index-B85VZGVP.js +56 -0
  2. package/dist/index-BRD3rjLE.js +138 -0
  3. package/dist/index-BpFpg_5A.js +78 -0
  4. package/dist/index-BrxP9NHZ.js +56 -0
  5. package/dist/{index-AcZakyxd.js → index-CN_dNOir.js} +168 -172
  6. package/dist/index-CRdDPWou.js +34 -0
  7. package/dist/{index-Dz1XJJEv.js → index-CSVsF1EQ.js} +28 -28
  8. package/dist/index-CceEGv05.js +104 -0
  9. package/dist/{index-DdYanSGw.js → index-CiWKwaC4.js} +2 -2
  10. package/dist/{index-6JzOJU8O.js → index-CmajMf1d.js} +21 -21
  11. package/dist/index-D5kHxP9H.js +43 -0
  12. package/dist/{index-29Y5fJR0.js → index-DNNz78Rc.js} +2 -2
  13. package/dist/index-Db33Ugg9.js +34 -0
  14. package/dist/index-DfhwDiOS.js +155 -0
  15. package/dist/index-arkRlpaR.js +80 -0
  16. package/dist/index-ufLC1PLO.js +57 -0
  17. package/dist/{index-Dxh7aMoG.js → index-vHMPqmOL.js} +2 -2
  18. package/dist/index.es.js +1 -1
  19. package/dist/{index.modern-fpUBOYPT.js → index.modern-B-ChKejQ.js} +9 -9
  20. package/dist/index.umd.js +115 -115
  21. package/dist/{logo-control-C5ZdRec5.js → logo-control-VgN6MEKI.js} +186 -206
  22. package/dist/{mapbox-gl-D6JObe4m.js → mapbox-gl-C6frO4Gl.js} +1877 -1877
  23. package/dist/{maplibre-gl-DDfJU6SR.js → maplibre-gl-DkDrZ6rP.js} +1230 -1228
  24. package/dist/{scale-control-Cflgzbvb.js → scale-control-jBKptTbw.js} +234 -252
  25. package/dist/style.css +1 -1
  26. package/dist/{styles-B8oT_wcC.js → styles-BR85tnqI.js} +16 -17
  27. package/package.json +2 -2
  28. package/dist/index-CHSsiFtN.js +0 -139
  29. package/dist/index-CqUTGwL0.js +0 -34
  30. package/dist/index-Cwn0dgP_.js +0 -56
  31. package/dist/index-D--WdzK4.js +0 -79
  32. package/dist/index-D1Phs0fA.js +0 -57
  33. package/dist/index-D1vI6Ww_.js +0 -43
  34. package/dist/index-DHHG0vNa.js +0 -157
  35. package/dist/index-DKFcZs0A.js +0 -81
  36. package/dist/index-DZTFM839.js +0 -105
  37. package/dist/index-_8n5sl1B.js +0 -56
  38. package/dist/index-_n1FGHXc.js +0 -34
@@ -1,17 +1,16 @@
1
- import * as M from "react";
2
- import { useContext as w, useMemo as x, useLayoutEffect as $, useEffect as d, useState as J, useRef as b, useImperativeHandle as k, memo as _, forwardRef as z } from "react";
3
- import { createPortal as H } from "react-dom";
4
- const V = M.createContext(null);
5
- function pt() {
6
- var i;
7
- const t = (i = w(V)) == null ? void 0 : i.maps, n = w(R);
8
- return x(() => ({ ...t, current: n == null ? void 0 : n.map }), [t, n]);
1
+ import * as C from "react";
2
+ import { useContext as M, useMemo as S, useLayoutEffect as B, useEffect as l, useState as G, useRef as E, useImperativeHandle as R, memo as p, forwardRef as T } from "react";
3
+ import { createPortal as Z } from "react-dom";
4
+ const j = C.createContext(null);
5
+ function ht() {
6
+ const t = M(j)?.maps, n = M(b);
7
+ return S(() => ({ ...t, current: n?.map }), [t, n]);
9
8
  }
10
- function K(t, n) {
9
+ function $(t, n) {
11
10
  const e = Array.isArray(t) ? t[0] : t ? t.x : 0, i = Array.isArray(t) ? t[1] : t ? t.y : 0, r = Array.isArray(n) ? n[0] : n ? n.x : 0, o = Array.isArray(n) ? n[1] : n ? n.y : 0;
12
11
  return e === r && i === o;
13
12
  }
14
- function y(t, n) {
13
+ function h(t, n) {
15
14
  if (t === n)
16
15
  return !0;
17
16
  if (!t || !n)
@@ -20,7 +19,7 @@ function y(t, n) {
20
19
  if (!Array.isArray(n) || t.length !== n.length)
21
20
  return !1;
22
21
  for (let e = 0; e < t.length; e++)
23
- if (!y(t[e], n[e]))
22
+ if (!h(t[e], n[e]))
24
23
  return !1;
25
24
  return !0;
26
25
  } else if (Array.isArray(n))
@@ -30,13 +29,13 @@ function y(t, n) {
30
29
  if (e.length !== i.length)
31
30
  return !1;
32
31
  for (const r of e)
33
- if (!n.hasOwnProperty(r) || !y(t[r], n[r]))
32
+ if (!n.hasOwnProperty(r) || !h(t[r], n[r]))
34
33
  return !1;
35
34
  return !0;
36
35
  }
37
36
  return !1;
38
37
  }
39
- function A(t) {
38
+ function N(t) {
40
39
  return {
41
40
  longitude: t.center.lng,
42
41
  latitude: t.center.lat,
@@ -46,16 +45,16 @@ function A(t) {
46
45
  padding: t.padding
47
46
  };
48
47
  }
49
- function U(t, n) {
48
+ function O(t, n) {
50
49
  const e = n.viewState || n, i = {};
51
50
  if ("longitude" in e && "latitude" in e && (e.longitude !== t.center.lng || e.latitude !== t.center.lat)) {
52
51
  const r = t.center.constructor;
53
52
  i.center = new r(e.longitude, e.latitude);
54
53
  }
55
- return "zoom" in e && e.zoom !== t.zoom && (i.zoom = e.zoom), "bearing" in e && e.bearing !== t.bearing && (i.bearing = e.bearing), "pitch" in e && e.pitch !== t.pitch && (i.pitch = e.pitch), e.padding && t.padding && !y(e.padding, t.padding) && (i.padding = e.padding), i;
54
+ return "zoom" in e && e.zoom !== t.zoom && (i.zoom = e.zoom), "bearing" in e && e.bearing !== t.bearing && (i.bearing = e.bearing), "pitch" in e && e.pitch !== t.pitch && (i.pitch = e.pitch), e.padding && t.padding && !h(e.padding, t.padding) && (i.padding = e.padding), i;
56
55
  }
57
- const Y = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
58
- function I(t) {
56
+ const J = ["type", "source", "source-layer", "minzoom", "maxzoom", "filter", "layout"];
57
+ function A(t) {
59
58
  if (!t)
60
59
  return null;
61
60
  if (typeof t == "string" || ("toJS" in t && (t = t.toJS()), !t.layers))
@@ -69,14 +68,14 @@ function I(t) {
69
68
  const o = n[i.ref];
70
69
  if (o) {
71
70
  r = r || Object.assign({}, i), delete r.ref;
72
- for (const s of Y)
71
+ for (const s of J)
73
72
  s in o && (r[s] = o[s]);
74
73
  }
75
74
  return r || i;
76
75
  });
77
76
  return { ...t, layers: e };
78
77
  }
79
- const F = { version: 8, sources: {}, layers: [] }, D = {
78
+ const U = { version: 8, sources: {}, layers: [] }, I = {
80
79
  mousedown: "onMouseDown",
81
80
  mouseup: "onMouseUp",
82
81
  mouseover: "onMouseOver",
@@ -91,7 +90,7 @@ const F = { version: 8, sources: {}, layers: [] }, D = {
91
90
  touchend: "onTouchEnd",
92
91
  touchmove: "onTouchMove",
93
92
  touchcancel: "onTouchCancel"
94
- }, W = {
93
+ }, F = {
95
94
  movestart: "onMoveStart",
96
95
  move: "onMove",
97
96
  moveend: "onMoveEnd",
@@ -107,7 +106,7 @@ const F = { version: 8, sources: {}, layers: [] }, D = {
107
106
  pitchstart: "onPitchStart",
108
107
  pitch: "onPitch",
109
108
  pitchend: "onPitchEnd"
110
- }, Z = {
109
+ }, D = {
111
110
  wheel: "onWheel",
112
111
  boxzoomstart: "onBoxZoomStart",
113
112
  boxzoomend: "onBoxZoomEnd",
@@ -121,7 +120,7 @@ const F = { version: 8, sources: {}, layers: [] }, D = {
121
120
  styledata: "onStyleData",
122
121
  sourcedata: "onSourceData",
123
122
  error: "onError"
124
- }, Q = [
123
+ }, K = [
125
124
  "minZoom",
126
125
  "maxZoom",
127
126
  "minPitch",
@@ -129,7 +128,7 @@ const F = { version: 8, sources: {}, layers: [] }, D = {
129
128
  "maxBounds",
130
129
  "projection",
131
130
  "renderWorldCopies"
132
- ], X = [
131
+ ], Y = [
133
132
  "scrollZoom",
134
133
  "boxZoom",
135
134
  "dragRotate",
@@ -139,20 +138,20 @@ const F = { version: 8, sources: {}, layers: [] }, D = {
139
138
  "touchZoomRotate",
140
139
  "touchPitch"
141
140
  ];
142
- class P {
141
+ class x {
143
142
  constructor(n, e, i) {
144
143
  this._map = null, this._internalUpdate = !1, this._hoveredFeatures = null, this._propsedCameraUpdate = null, this._styleComponents = {}, this._onEvent = (r) => {
145
- const o = this.props[Z[r.type]];
144
+ const o = this.props[D[r.type]];
146
145
  o ? o(r) : r.type === "error" && console.error(r.error);
147
146
  }, this._onCameraEvent = (r) => {
148
147
  if (this._internalUpdate)
149
148
  return;
150
- r.viewState = this._propsedCameraUpdate || A(this._map.transform);
151
- const o = this.props[W[r.type]];
149
+ r.viewState = this._propsedCameraUpdate || N(this._map.transform);
150
+ const o = this.props[F[r.type]];
152
151
  o && o(r);
153
- }, this._onCameraUpdate = (r) => this._internalUpdate ? r : (this._propsedCameraUpdate = A(r), U(r, this.props)), this._onPointerEvent = (r) => {
152
+ }, this._onCameraUpdate = (r) => this._internalUpdate ? r : (this._propsedCameraUpdate = N(r), O(r, this.props)), this._onPointerEvent = (r) => {
154
153
  (r.type === "mousemove" || r.type === "mouseout") && this._updateHover(r);
155
- const o = this.props[D[r.type]];
154
+ const o = this.props[I[r.type]];
156
155
  o && (this.props.interactiveLayerIds && r.type !== "mouseover" && r.type !== "mouseout" && (r.features = this._hoveredFeatures || this._queryRenderedFeatures(r.point)), o(r), delete r.features);
157
156
  }, this._MapClass = n, this.props = e, this._initialize(i);
158
157
  }
@@ -166,7 +165,7 @@ class P {
166
165
  this._updateStyle(n, e), this._updateStyleComponents(n), this._updateHandlers(n, e), (i || r || o && !this._map.isMoving()) && this.redraw();
167
166
  }
168
167
  static reuse(n, e) {
169
- const i = P.savedMaps.pop();
168
+ const i = x.savedMaps.pop();
170
169
  if (!i)
171
170
  return null;
172
171
  const r = i.map, o = r.getContainer();
@@ -180,11 +179,11 @@ class P {
180
179
  }
181
180
  /* eslint-disable complexity,max-statements */
182
181
  _initialize(n) {
183
- const { props: e } = this, { mapStyle: i = F } = e, r = {
182
+ const { props: e } = this, { mapStyle: i = U } = e, r = {
184
183
  ...e,
185
184
  ...e.initialViewState,
186
185
  container: n,
187
- style: I(i)
186
+ style: A(i)
188
187
  }, o = r.initialViewState || r.viewState || r;
189
188
  if (Object.assign(r, {
190
189
  center: [o.longitude || 0, o.latitude || 0],
@@ -197,29 +196,27 @@ class P {
197
196
  }
198
197
  const s = new this._MapClass(r);
199
198
  o.padding && s.setPadding(o.padding), e.cursor && (s.getCanvas().style.cursor = e.cursor), s.transformCameraUpdate = this._onCameraUpdate, s.on("style.load", () => {
200
- var a;
201
199
  this._styleComponents = {
202
200
  light: s.getLight(),
203
201
  sky: s.getSky(),
204
202
  // @ts-ignore getProjection() does not exist in v4
205
- projection: (a = s.getProjection) == null ? void 0 : a.call(s),
203
+ projection: s.getProjection?.(),
206
204
  terrain: s.getTerrain()
207
205
  }, this._updateStyleComponents(this.props);
208
206
  }), s.on("sourcedata", () => {
209
207
  this._updateStyleComponents(this.props);
210
208
  });
211
- for (const a in D)
209
+ for (const a in I)
212
210
  s.on(a, this._onPointerEvent);
213
- for (const a in W)
211
+ for (const a in F)
214
212
  s.on(a, this._onCameraEvent);
215
- for (const a in Z)
213
+ for (const a in D)
216
214
  s.on(a, this._onEvent);
217
215
  this._map = s;
218
216
  }
219
217
  /* eslint-enable complexity,max-statements */
220
218
  recycle() {
221
- const e = this.map.getContainer().querySelector("[mapboxgl-children]");
222
- e == null || e.remove(), P.savedMaps.push(this);
219
+ this.map.getContainer().querySelector("[mapboxgl-children]")?.remove(), x.savedMaps.push(this);
223
220
  }
224
221
  destroy() {
225
222
  this._map.remove();
@@ -253,7 +250,7 @@ class P {
253
250
  _updateViewState(n) {
254
251
  const e = this._map, i = e.transform;
255
252
  if (!e.isMoving()) {
256
- const o = U(i, n);
253
+ const o = O(i, n);
257
254
  if (Object.keys(o).length > 0)
258
255
  return this._internalUpdate = !0, e.jumpTo(o), this._internalUpdate = !1, !0;
259
256
  }
@@ -267,21 +264,17 @@ class P {
267
264
  _updateSettings(n, e) {
268
265
  const i = this._map;
269
266
  let r = !1;
270
- for (const o of Q)
271
- if (o in n && !y(n[o], e[o])) {
272
- r = !0;
273
- const s = i[`set${o[0].toUpperCase()}${o.slice(1)}`];
274
- s == null || s.call(i, n[o]);
275
- }
267
+ for (const o of K)
268
+ o in n && !h(n[o], e[o]) && (r = !0, i[`set${o[0].toUpperCase()}${o.slice(1)}`]?.call(i, n[o]));
276
269
  return r;
277
270
  }
278
271
  /* Update map style to match props */
279
272
  _updateStyle(n, e) {
280
273
  if (n.cursor !== e.cursor && (this._map.getCanvas().style.cursor = n.cursor || ""), n.mapStyle !== e.mapStyle) {
281
- const { mapStyle: i = F, styleDiffing: r = !0 } = n, o = {
274
+ const { mapStyle: i = U, styleDiffing: r = !0 } = n, o = {
282
275
  diff: r
283
276
  };
284
- "localIdeographFontFamily" in n && (o.localIdeographFontFamily = n.localIdeographFontFamily), this._map.setStyle(I(i), o);
277
+ "localIdeographFontFamily" in n && (o.localIdeographFontFamily = n.localIdeographFontFamily), this._map.setStyle(A(i), o);
285
278
  }
286
279
  }
287
280
  /* Update fog, light, projection and terrain to match props
@@ -290,16 +283,15 @@ class P {
290
283
  * 2. They can be overwritten by mapStyle
291
284
  */
292
285
  _updateStyleComponents({ light: n, projection: e, sky: i, terrain: r }) {
293
- var a, c;
294
286
  const o = this._map, s = this._styleComponents;
295
- o.style._loaded && (n && !y(n, s.light) && (s.light = n, o.setLight(n)), e && !y(e, s.projection) && e !== ((a = s.projection) == null ? void 0 : a.type) && (s.projection = typeof e == "string" ? { type: e } : e, (c = o.setProjection) == null || c.call(o, s.projection)), i && !y(i, s.sky) && (s.sky = i, o.setSky(i)), r !== void 0 && !y(r, s.terrain) && (!r || o.getSource(r.source)) && (s.terrain = r, o.setTerrain(r)));
287
+ o.style._loaded && (n && !h(n, s.light) && (s.light = n, o.setLight(n)), e && !h(e, s.projection) && e !== s.projection?.type && (s.projection = typeof e == "string" ? { type: e } : e, o.setProjection?.(s.projection)), i && !h(i, s.sky) && (s.sky = i, o.setSky(i)), r !== void 0 && !h(r, s.terrain) && (!r || o.getSource(r.source)) && (s.terrain = r, o.setTerrain(r)));
296
288
  }
297
289
  /* Update interaction handlers to match props */
298
290
  _updateHandlers(n, e) {
299
291
  const i = this._map;
300
- for (const r of X) {
292
+ for (const r of Y) {
301
293
  const o = n[r] ?? !0, s = e[r] ?? !0;
302
- y(o, s) || (o ? i[r].enable(o) : i[r].disable());
294
+ h(o, s) || (o ? i[r].enable(o) : i[r].disable());
303
295
  }
304
296
  }
305
297
  _queryRenderedFeatures(n) {
@@ -313,17 +305,16 @@ class P {
313
305
  }
314
306
  }
315
307
  _updateHover(n) {
316
- var r;
317
308
  const { props: e } = this;
318
309
  if (e.interactiveLayerIds && (e.onMouseMove || e.onMouseEnter || e.onMouseLeave)) {
319
- const o = n.type, s = ((r = this._hoveredFeatures) == null ? void 0 : r.length) > 0, a = this._queryRenderedFeatures(n.point), c = a.length > 0;
320
- !c && s && (n.type = "mouseleave", this._onPointerEvent(n)), this._hoveredFeatures = a, c && !s && (n.type = "mouseenter", this._onPointerEvent(n)), n.type = o;
310
+ const r = n.type, o = this._hoveredFeatures?.length > 0, s = this._queryRenderedFeatures(n.point), a = s.length > 0;
311
+ !a && o && (n.type = "mouseleave", this._onPointerEvent(n)), this._hoveredFeatures = s, a && !o && (n.type = "mouseenter", this._onPointerEvent(n)), n.type = r;
321
312
  } else
322
313
  this._hoveredFeatures = null;
323
314
  }
324
315
  }
325
- P.savedMaps = [];
326
- const tt = [
316
+ x.savedMaps = [];
317
+ const Q = [
327
318
  "setMaxBounds",
328
319
  "setMinZoom",
329
320
  "setMaxZoom",
@@ -345,17 +336,17 @@ const tt = [
345
336
  "setFog",
346
337
  "remove"
347
338
  ];
348
- function et(t) {
339
+ function X(t) {
349
340
  if (!t)
350
341
  return null;
351
342
  const n = t.map, e = {
352
343
  getMap: () => n
353
344
  };
354
- for (const i of nt(n))
355
- !(i in e) && !tt.includes(i) && (e[i] = n[i].bind(n));
345
+ for (const i of tt(n))
346
+ !(i in e) && !Q.includes(i) && (e[i] = n[i].bind(n));
356
347
  return e;
357
348
  }
358
- function nt(t) {
349
+ function tt(t) {
359
350
  const n = /* @__PURE__ */ new Set();
360
351
  let e = t;
361
352
  for (; e; ) {
@@ -365,8 +356,8 @@ function nt(t) {
365
356
  }
366
357
  return Array.from(n);
367
358
  }
368
- const ot = typeof document < "u" ? $ : d;
369
- function rt(t, n) {
359
+ const et = typeof document < "u" ? B : l;
360
+ function nt(t, n) {
370
361
  const { RTLTextPlugin: e, maxParallelImageRequests: i, workerCount: r, workerUrl: o } = n;
371
362
  if (e && t.getRTLTextPluginStatus && t.getRTLTextPluginStatus() === "unavailable") {
372
363
  const { pluginUrl: s, lazy: a = !0 } = typeof e == "string" ? { pluginUrl: e } : e;
@@ -376,36 +367,36 @@ function rt(t, n) {
376
367
  }
377
368
  i !== void 0 && t.setMaxParallelImageRequests(i), r !== void 0 && t.setWorkerCount(r), o !== void 0 && t.setWorkerUrl(o);
378
369
  }
379
- const R = M.createContext(null);
380
- function it(t, n) {
381
- const e = w(V), [i, r] = J(null), o = b(), { current: s } = b({ mapLib: null, map: null });
382
- d(() => {
383
- const l = t.mapLib;
384
- let m = !0, u;
385
- return Promise.resolve(l || import("./maplibre-gl-DDfJU6SR.js").then((f) => f.m)).then((f) => {
386
- if (!m)
370
+ const b = C.createContext(null);
371
+ function ot(t, n) {
372
+ const e = M(j), [i, r] = G(null), o = E(), { current: s } = E({ mapLib: null, map: null });
373
+ l(() => {
374
+ const u = t.mapLib;
375
+ let w = !0, f;
376
+ return Promise.resolve(u || import("./maplibre-gl-DkDrZ6rP.js").then((d) => d.m)).then((d) => {
377
+ if (!w)
387
378
  return;
388
- if (!f)
379
+ if (!d)
389
380
  throw new Error("Invalid mapLib");
390
- const p = "Map" in f ? f : f.default;
391
- if (!p.Map)
381
+ const m = "Map" in d ? d : d.default;
382
+ if (!m.Map)
392
383
  throw new Error("Invalid mapLib");
393
- rt(p, t), t.reuseMaps && (u = P.reuse(t, o.current)), u || (u = new P(p.Map, t, o.current)), s.map = et(u), s.mapLib = p, r(u), e == null || e.onMapMount(s.map, t.id);
394
- }).catch((f) => {
395
- const { onError: p } = t;
396
- p ? p({
384
+ nt(m, t), t.reuseMaps && (f = x.reuse(t, o.current)), f || (f = new x(m.Map, t, o.current)), s.map = X(f), s.mapLib = m, r(f), e?.onMapMount(s.map, t.id);
385
+ }).catch((d) => {
386
+ const { onError: m } = t;
387
+ m ? m({
397
388
  type: "error",
398
389
  target: null,
399
390
  originalEvent: null,
400
- error: f
401
- }) : console.error(f);
391
+ error: d
392
+ }) : console.error(d);
402
393
  }), () => {
403
- m = !1, u && (e == null || e.onMapUnmount(t.id), t.reuseMaps ? u.recycle() : u.destroy());
394
+ w = !1, f && (e?.onMapUnmount(t.id), t.reuseMaps ? f.recycle() : f.destroy());
404
395
  };
405
- }, []), ot(() => {
396
+ }, []), et(() => {
406
397
  i && i.setProps(t);
407
- }), k(n, () => s.map, [i]);
408
- const a = x(() => ({
398
+ }), R(n, () => s.map, [i]);
399
+ const a = S(() => ({
409
400
  position: "relative",
410
401
  width: "100%",
411
402
  height: "100%",
@@ -413,205 +404,194 @@ function it(t, n) {
413
404
  }), [t.style]), c = {
414
405
  height: "100%"
415
406
  };
416
- return M.createElement("div", { id: t.id, ref: o, style: a }, i && M.createElement(
417
- R.Provider,
407
+ return C.createElement("div", { id: t.id, ref: o, style: a }, i && C.createElement(
408
+ b.Provider,
418
409
  { value: s },
419
- M.createElement("div", { "mapboxgl-children": "", style: c }, t.children)
410
+ C.createElement("div", { "mapboxgl-children": "", style: c }, t.children)
420
411
  ));
421
412
  }
422
- const yt = M.forwardRef(it), st = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;
423
- function C(t, n) {
413
+ const gt = C.forwardRef(ot), rt = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;
414
+ function y(t, n) {
424
415
  if (!t || !n)
425
416
  return;
426
417
  const e = t.style;
427
418
  for (const i in n) {
428
419
  const r = n[i];
429
- Number.isFinite(r) && !st.test(i) ? e[i] = `${r}px` : e[i] = r;
420
+ Number.isFinite(r) && !rt.test(i) ? e[i] = `${r}px` : e[i] = r;
430
421
  }
431
422
  }
432
- function q(t, n) {
423
+ function H(t, n) {
433
424
  if (t === n)
434
425
  return null;
435
- const e = j(t), i = j(n), r = [];
426
+ const e = W(t), i = W(n), r = [];
436
427
  for (const o of i)
437
428
  e.has(o) || r.push(o);
438
429
  for (const o of e)
439
430
  i.has(o) || r.push(o);
440
431
  return r.length === 0 ? null : r;
441
432
  }
442
- function j(t) {
433
+ function W(t) {
443
434
  return new Set(t ? t.trim().split(/\s+/) : []);
444
435
  }
445
- const vt = _(z((t, n) => {
446
- const { map: e, mapLib: i } = w(R), r = b({ props: t }), o = x(() => {
447
- let T = !1;
448
- M.Children.forEach(t.children, (v) => {
449
- v && (T = !0);
436
+ const pt = p(T((t, n) => {
437
+ const { map: e, mapLib: i } = M(b), r = E({ props: t }), o = S(() => {
438
+ let P = !1;
439
+ C.Children.forEach(t.children, (g) => {
440
+ g && (P = !0);
450
441
  });
451
- const G = {
442
+ const q = {
452
443
  ...t,
453
- element: T ? document.createElement("div") : void 0
454
- }, S = new i.Marker(G);
455
- return S.setLngLat([t.longitude, t.latitude]), S.getElement().addEventListener("click", (v) => {
456
- var h, g;
457
- (g = (h = r.current.props).onClick) == null || g.call(h, {
444
+ element: P ? document.createElement("div") : void 0
445
+ }, _ = new i.Marker(q);
446
+ return _.setLngLat([t.longitude, t.latitude]), _.getElement().addEventListener("click", (g) => {
447
+ r.current.props.onClick?.({
458
448
  type: "click",
459
- target: S,
460
- originalEvent: v
449
+ target: _,
450
+ originalEvent: g
461
451
  });
462
- }), S.on("dragstart", (v) => {
463
- var g, L;
464
- const h = v;
465
- h.lngLat = o.getLngLat(), (L = (g = r.current.props).onDragStart) == null || L.call(g, h);
466
- }), S.on("drag", (v) => {
467
- var g, L;
468
- const h = v;
469
- h.lngLat = o.getLngLat(), (L = (g = r.current.props).onDrag) == null || L.call(g, h);
470
- }), S.on("dragend", (v) => {
471
- var g, L;
472
- const h = v;
473
- h.lngLat = o.getLngLat(), (L = (g = r.current.props).onDragEnd) == null || L.call(g, h);
474
- }), S;
452
+ }), _.on("dragstart", (g) => {
453
+ const v = g;
454
+ v.lngLat = o.getLngLat(), r.current.props.onDragStart?.(v);
455
+ }), _.on("drag", (g) => {
456
+ const v = g;
457
+ v.lngLat = o.getLngLat(), r.current.props.onDrag?.(v);
458
+ }), _.on("dragend", (g) => {
459
+ const v = g;
460
+ v.lngLat = o.getLngLat(), r.current.props.onDragEnd?.(v);
461
+ }), _;
475
462
  }, []);
476
- d(() => (o.addTo(e.getMap()), () => {
463
+ l(() => (o.addTo(e.getMap()), () => {
477
464
  o.remove();
478
465
  }), []);
479
- const { longitude: s, latitude: a, offset: c, style: l, draggable: m = !1, popup: u = null, rotation: f = 0, rotationAlignment: p = "auto", pitchAlignment: N = "auto" } = t;
480
- d(() => {
481
- C(o.getElement(), l);
482
- }, [l]), k(n, () => o, []);
483
- const B = r.current.props;
484
- (o.getLngLat().lng !== s || o.getLngLat().lat !== a) && o.setLngLat([s, a]), c && !K(o.getOffset(), c) && o.setOffset(c), o.isDraggable() !== m && o.setDraggable(m), o.getRotation() !== f && o.setRotation(f), o.getRotationAlignment() !== p && o.setRotationAlignment(p), o.getPitchAlignment() !== N && o.setPitchAlignment(N), o.getPopup() !== u && o.setPopup(u);
485
- const O = q(B.className, t.className);
486
- if (O)
487
- for (const T of O)
488
- o.toggleClassName(T);
489
- return r.current.props = t, H(t.children, o.getElement());
490
- })), _t = _(z((t, n) => {
491
- const { map: e, mapLib: i } = w(R), r = x(() => document.createElement("div"), []), o = b({ props: t }), s = x(() => {
466
+ const { longitude: s, latitude: a, offset: c, style: u, draggable: w = !1, popup: f = null, rotation: d = 0, rotationAlignment: m = "auto", pitchAlignment: k = "auto" } = t;
467
+ l(() => {
468
+ y(o.getElement(), u);
469
+ }, [u]), R(n, () => o, []);
470
+ const V = r.current.props;
471
+ (o.getLngLat().lng !== s || o.getLngLat().lat !== a) && o.setLngLat([s, a]), c && !$(o.getOffset(), c) && o.setOffset(c), o.isDraggable() !== w && o.setDraggable(w), o.getRotation() !== d && o.setRotation(d), o.getRotationAlignment() !== m && o.setRotationAlignment(m), o.getPitchAlignment() !== k && o.setPitchAlignment(k), o.getPopup() !== f && o.setPopup(f);
472
+ const z = H(V.className, t.className);
473
+ if (z)
474
+ for (const P of z)
475
+ o.toggleClassName(P);
476
+ return r.current.props = t, Z(t.children, o.getElement());
477
+ })), yt = p(T((t, n) => {
478
+ const { map: e, mapLib: i } = M(b), r = S(() => document.createElement("div"), []), o = E({ props: t }), s = S(() => {
492
479
  const a = { ...t }, c = new i.Popup(a);
493
- return c.setLngLat([t.longitude, t.latitude]), c.once("open", (l) => {
494
- var m, u;
495
- (u = (m = o.current.props).onOpen) == null || u.call(m, l);
480
+ return c.setLngLat([t.longitude, t.latitude]), c.once("open", (u) => {
481
+ o.current.props.onOpen?.(u);
496
482
  }), c;
497
483
  }, []);
498
- if (d(() => {
484
+ if (l(() => {
499
485
  const a = (c) => {
500
- var l, m;
501
- (m = (l = o.current.props).onClose) == null || m.call(l, c);
486
+ o.current.props.onClose?.(c);
502
487
  };
503
488
  return s.on("close", a), s.setDOMContent(r).addTo(e.getMap()), () => {
504
489
  s.off("close", a), s.isOpen() && s.remove();
505
490
  };
506
- }, []), d(() => {
507
- C(s.getElement(), t.style);
508
- }, [t.style]), k(n, () => s, []), s.isOpen()) {
491
+ }, []), l(() => {
492
+ y(s.getElement(), t.style);
493
+ }, [t.style]), R(n, () => s, []), s.isOpen()) {
509
494
  const a = o.current.props;
510
- (s.getLngLat().lng !== t.longitude || s.getLngLat().lat !== t.latitude) && s.setLngLat([t.longitude, t.latitude]), t.offset && !y(a.offset, t.offset) && s.setOffset(t.offset), (a.anchor !== t.anchor || a.maxWidth !== t.maxWidth) && (s.options.anchor = t.anchor, s.setMaxWidth(t.maxWidth));
511
- const c = q(a.className, t.className);
495
+ (s.getLngLat().lng !== t.longitude || s.getLngLat().lat !== t.latitude) && s.setLngLat([t.longitude, t.latitude]), t.offset && !h(a.offset, t.offset) && s.setOffset(t.offset), (a.anchor !== t.anchor || a.maxWidth !== t.maxWidth) && (s.options.anchor = t.anchor, s.setMaxWidth(t.maxWidth));
496
+ const c = H(a.className, t.className);
512
497
  if (c)
513
- for (const l of c)
514
- s.toggleClassName(l);
498
+ for (const u of c)
499
+ s.toggleClassName(u);
515
500
  o.current.props = t;
516
501
  }
517
- return H(t.children, r);
502
+ return Z(t.children, r);
518
503
  }));
519
- function E(t, n, e, i) {
520
- const r = w(R), o = x(() => t(r), []);
521
- return d(() => {
522
- const s = n, a = null, c = typeof n == "function" ? n : null, { map: l } = r;
523
- return l.hasControl(o) || (l.addControl(o, s == null ? void 0 : s.position), a && a(r)), () => {
524
- c && c(r), l.hasControl(o) && l.removeControl(o);
504
+ function L(t, n, e, i) {
505
+ const r = M(b), o = S(() => t(r), []);
506
+ return l(() => {
507
+ const s = n, a = null, c = typeof n == "function" ? n : null, { map: u } = r;
508
+ return u.hasControl(o) || (u.addControl(o, s?.position), a && a(r)), () => {
509
+ c && c(r), u.hasControl(o) && u.removeControl(o);
525
510
  };
526
511
  }, []), o;
527
512
  }
528
- function at(t) {
529
- const n = E(({ mapLib: e }) => new e.AttributionControl(t), {
513
+ function it(t) {
514
+ const n = L(({ mapLib: e }) => new e.AttributionControl(t), {
530
515
  position: t.position
531
516
  });
532
- return d(() => {
533
- C(n._container, t.style);
517
+ return l(() => {
518
+ y(n._container, t.style);
534
519
  }, [t.style]), null;
535
520
  }
536
- _(at);
537
- function ct(t) {
538
- const n = E(({ mapLib: e }) => new e.FullscreenControl({
521
+ p(it);
522
+ function st(t) {
523
+ const n = L(({ mapLib: e }) => new e.FullscreenControl({
539
524
  container: t.containerId && document.getElementById(t.containerId)
540
525
  }), { position: t.position });
541
- return d(() => {
542
- C(n._controlContainer, t.style);
526
+ return l(() => {
527
+ y(n._controlContainer, t.style);
543
528
  }, [t.style]), null;
544
529
  }
545
- _(ct);
546
- function lt(t, n) {
547
- const e = b({ props: t }), i = E(({ mapLib: r }) => {
530
+ p(st);
531
+ function at(t, n) {
532
+ const e = E({ props: t }), i = L(({ mapLib: r }) => {
548
533
  const o = new r.GeolocateControl(t), s = o._setupUI;
549
534
  return o._setupUI = () => {
550
535
  o._container.hasChildNodes() || s();
551
536
  }, o.on("geolocate", (a) => {
552
- var c, l;
553
- (l = (c = e.current.props).onGeolocate) == null || l.call(c, a);
537
+ e.current.props.onGeolocate?.(a);
554
538
  }), o.on("error", (a) => {
555
- var c, l;
556
- (l = (c = e.current.props).onError) == null || l.call(c, a);
539
+ e.current.props.onError?.(a);
557
540
  }), o.on("outofmaxbounds", (a) => {
558
- var c, l;
559
- (l = (c = e.current.props).onOutOfMaxBounds) == null || l.call(c, a);
541
+ e.current.props.onOutOfMaxBounds?.(a);
560
542
  }), o.on("trackuserlocationstart", (a) => {
561
- var c, l;
562
- (l = (c = e.current.props).onTrackUserLocationStart) == null || l.call(c, a);
543
+ e.current.props.onTrackUserLocationStart?.(a);
563
544
  }), o.on("trackuserlocationend", (a) => {
564
- var c, l;
565
- (l = (c = e.current.props).onTrackUserLocationEnd) == null || l.call(c, a);
545
+ e.current.props.onTrackUserLocationEnd?.(a);
566
546
  }), o;
567
547
  }, { position: t.position });
568
- return e.current.props = t, k(n, () => i, []), d(() => {
569
- C(i._container, t.style);
548
+ return e.current.props = t, R(n, () => i, []), l(() => {
549
+ y(i._container, t.style);
570
550
  }, [t.style]), null;
571
551
  }
572
- _(z(lt));
573
- function ut(t) {
574
- const n = E(({ mapLib: e }) => new e.NavigationControl(t), {
552
+ p(T(at));
553
+ function ct(t) {
554
+ const n = L(({ mapLib: e }) => new e.NavigationControl(t), {
575
555
  position: t.position
576
556
  });
577
- return d(() => {
578
- C(n._container, t.style);
557
+ return l(() => {
558
+ y(n._container, t.style);
579
559
  }, [t.style]), null;
580
560
  }
581
- const Ct = _(ut);
582
- function dt(t) {
583
- const n = E(({ mapLib: o }) => new o.ScaleControl(t), {
561
+ const vt = p(ct);
562
+ function lt(t) {
563
+ const n = L(({ mapLib: o }) => new o.ScaleControl(t), {
584
564
  position: t.position
585
- }), e = b(t), i = e.current;
565
+ }), e = E(t), i = e.current;
586
566
  e.current = t;
587
567
  const { style: r } = t;
588
- return t.maxWidth !== void 0 && t.maxWidth !== i.maxWidth && (n.options.maxWidth = t.maxWidth), t.unit !== void 0 && t.unit !== i.unit && n.setUnit(t.unit), d(() => {
589
- C(n._container, r);
568
+ return t.maxWidth !== void 0 && t.maxWidth !== i.maxWidth && (n.options.maxWidth = t.maxWidth), t.unit !== void 0 && t.unit !== i.unit && n.setUnit(t.unit), l(() => {
569
+ y(n._container, r);
590
570
  }, [r]), null;
591
571
  }
592
- _(dt);
593
- function ft(t) {
594
- const n = E(({ mapLib: e }) => new e.TerrainControl(t), {
572
+ p(lt);
573
+ function ut(t) {
574
+ const n = L(({ mapLib: e }) => new e.TerrainControl(t), {
595
575
  position: t.position
596
576
  });
597
- return d(() => {
598
- C(n._container, t.style);
577
+ return l(() => {
578
+ y(n._container, t.style);
599
579
  }, [t.style]), null;
600
580
  }
601
- _(ft);
602
- function mt(t) {
603
- const n = E(({ mapLib: e }) => new e.LogoControl(t), { position: t.position });
604
- return d(() => {
605
- C(n._container, t.style);
581
+ p(ut);
582
+ function dt(t) {
583
+ const n = L(({ mapLib: e }) => new e.LogoControl(t), { position: t.position });
584
+ return l(() => {
585
+ y(n._container, t.style);
606
586
  }, [t.style]), null;
607
587
  }
608
- _(mt);
588
+ p(dt);
609
589
  export {
610
- yt as M,
611
- Ct as N,
612
- _t as P,
613
- vt as a,
614
- R as b,
615
- y as d,
616
- pt as u
590
+ gt as M,
591
+ vt as N,
592
+ yt as P,
593
+ pt as a,
594
+ b,
595
+ h as d,
596
+ ht as u
617
597
  };