@local-logic/maps 0.1.3 → 0.1.4

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 (57) hide show
  1. package/dist/{index-zqYpD_YN.js → index--PIAfLjo.js} +2 -2
  2. package/dist/{index-Deqck8KU.js → index-0EkdzCyN.js} +12 -11
  3. package/dist/index-BO34uKgS.js +16 -0
  4. package/dist/{index-CyFpPXRS.js → index-BY_xYg2p.js} +12 -11
  5. package/dist/{index-CzqD82Cl.js → index-BnTZMzoy.js} +2 -2
  6. package/dist/index-C0inY_TA.js +41 -0
  7. package/dist/index-CHdAT424.js +44 -0
  8. package/dist/{index-J8lmJ6Xj.js → index-CNP-c5ZB.js} +205 -194
  9. package/dist/index-COB6j_V1.js +25 -0
  10. package/dist/{index-CFioISlP.js → index-CZPGxjSJ.js} +11 -10
  11. package/dist/index-D4t3jFAj.js +35 -0
  12. package/dist/index-DEFuc-6u.js +78 -0
  13. package/dist/index-DXT59VJA.js +29 -0
  14. package/dist/{index-VFglx6lb.js → index-GoHd1Tri.js} +2 -2
  15. package/dist/{index-NMqp09ek.js → index-MZUXTR07.js} +1 -1
  16. package/dist/{index-Bm2KdhhT.js → index-QxKYqddl.js} +1 -1
  17. package/dist/{index-B1dI6iqp.js → index-zzok3ruU.js} +1 -1
  18. package/dist/index.es.js +1 -1
  19. package/dist/index.umd.js +62 -7
  20. package/dist/src/components/Map/Root/BaseMap/Testing/index.d.ts +4 -0
  21. package/dist/src/components/Map/Root/BaseMap/Testing/index.d.ts.map +1 -0
  22. package/dist/src/components/Map/Root/BaseMap/Testing/styles.d.ts +4 -0
  23. package/dist/src/components/Map/Root/BaseMap/Testing/styles.d.ts.map +1 -0
  24. package/dist/src/components/Map/Root/BaseMap/index.d.ts.map +1 -1
  25. package/dist/src/components/Map/Root/CenterPin/Testing/index.d.ts +4 -0
  26. package/dist/src/components/Map/Root/CenterPin/Testing/index.d.ts.map +1 -0
  27. package/dist/src/components/Map/Root/CenterPin/Testing/styles.d.ts +2 -0
  28. package/dist/src/components/Map/Root/CenterPin/Testing/styles.d.ts.map +1 -0
  29. package/dist/src/components/Map/Root/CenterPin/index.d.ts.map +1 -1
  30. package/dist/src/components/Map/Root/Layers/Testing/index.d.ts +4 -0
  31. package/dist/src/components/Map/Root/Layers/Testing/index.d.ts.map +1 -0
  32. package/dist/src/components/Map/Root/Layers/Testing/styles.d.ts +9 -0
  33. package/dist/src/components/Map/Root/Layers/Testing/styles.d.ts.map +1 -0
  34. package/dist/src/components/Map/Root/Layers/index.d.ts.map +1 -1
  35. package/dist/src/components/Map/Root/Markers/Testing/index.d.ts +4 -0
  36. package/dist/src/components/Map/Root/Markers/Testing/index.d.ts.map +1 -0
  37. package/dist/src/components/Map/Root/Markers/Testing/styles.d.ts +7 -0
  38. package/dist/src/components/Map/Root/Markers/Testing/styles.d.ts.map +1 -0
  39. package/dist/src/components/Map/Root/Markers/index.d.ts.map +1 -1
  40. package/dist/src/components/Map/Root/Popup/Testing/index.d.ts +4 -0
  41. package/dist/src/components/Map/Root/Popup/Testing/index.d.ts.map +1 -0
  42. package/dist/src/components/Map/Root/Popup/Testing/styles.d.ts +5 -0
  43. package/dist/src/components/Map/Root/Popup/Testing/styles.d.ts.map +1 -0
  44. package/dist/src/components/Map/Root/Popup/index.d.ts.map +1 -1
  45. package/dist/src/components/Map/Root/constants.d.ts +1 -0
  46. package/dist/src/components/Map/Root/constants.d.ts.map +1 -1
  47. package/dist/src/components/Map/Root/types.d.ts +1 -1
  48. package/dist/src/components/Map/Root/types.d.ts.map +1 -1
  49. package/dist/src/components/Map/index.stories.d.ts +3 -0
  50. package/dist/src/components/Map/index.stories.d.ts.map +1 -1
  51. package/dist/style.css +1 -1
  52. package/dist/{styles-J872R1eq.js → styles-DvWVFFVb.js} +1 -1
  53. package/package.json +2 -1
  54. package/dist/index-HWDZde-a.js +0 -75
  55. package/dist/index-qqbvBkdn.js +0 -7
  56. package/dist/src/components/Map/Root/BaseMap/Empty/index.d.ts +0 -3
  57. package/dist/src/components/Map/Root/BaseMap/Empty/index.d.ts.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { jsx as _ } from "react/jsx-runtime";
2
2
  import * as Z from "react";
3
- import ct, { useContext as ut, useState as L, useMemo as O, lazy as w, Suspense as R, useRef as j, useEffect as V } from "react";
4
- const nt = ct.createContext({}), I = () => ut(nt), C = {
3
+ import ut, { useContext as lt, useState as L, useMemo as v, lazy as w, Suspense as R, useRef as j, useEffect as V } from "react";
4
+ const rt = ut.createContext({}), I = () => lt(rt), C = {
5
5
  zoom: 14,
6
6
  pitch: 0,
7
7
  bearing: 0,
@@ -9,43 +9,46 @@ const nt = ct.createContext({}), I = () => ut(nt), C = {
9
9
  }, J = {
10
10
  maptiler: "600d69cb-288d-445e-9839-3dfe4d76b31a",
11
11
  mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
12
- google: "a7ff20eb973126bb"
13
- }, lt = {
12
+ google: "a7ff20eb973126bb",
13
+ testing: "testing"
14
+ }, pt = {
14
15
  top: 10,
15
16
  bottom: 10,
16
17
  left: 10,
17
18
  right: 10
18
- }, W = 10, pt = 22, Wt = 10, ht = 30, ft = 60, Yt = 15, dt = [-180, -85.0511, 180, 85.0511], mt = "w-full h-full relative overflow-hidden", gt = w(() => import("./index-NMqp09ek.js")), yt = w(() => import("./index-B1dI6iqp.js")), wt = w(() => import("./index-Bm2KdhhT.js")), Mt = w(() => import("./index-qqbvBkdn.js")), _t = ({ children: r }) => {
19
+ }, W = 10, ht = 22, Qt = 10, ft = 30, dt = 60, Xt = 15, mt = [-180, -85.0511, 180, 85.0511], gt = "w-full h-full relative overflow-hidden", yt = w(() => import("./index-MZUXTR07.js")), wt = w(() => import("./index-zzok3ruU.js")), Mt = w(() => import("./index-QxKYqddl.js")), Y = w(() => import("./index-DXT59VJA.js")), _t = ({ children: r }) => {
19
20
  const {
20
21
  mapProvider: t,
21
22
  center: e,
22
23
  zoom: n = C.zoom,
23
- pitch: o = C.pitch,
24
- bearing: i = C.bearing,
24
+ pitch: i = C.pitch,
25
+ bearing: o = C.bearing,
25
26
  cooperativeGestures: a = C.cooperativeGestures,
26
27
  zoomPosition: c
27
- } = I(), [s] = L(n), l = O(() => {
28
+ } = I(), [s] = L(n), l = v(() => {
28
29
  switch (t?.name) {
29
30
  case "maptiler":
30
- return gt;
31
- case "google":
32
31
  return yt;
33
- case "mapbox":
32
+ case "google":
34
33
  return wt;
35
- default:
34
+ case "mapbox":
36
35
  return Mt;
36
+ case "testing":
37
+ return Y;
38
+ default:
39
+ return Y;
37
40
  }
38
41
  }, [t]);
39
42
  return /* @__PURE__ */ _(
40
43
  "div",
41
44
  {
42
- className: mt,
45
+ className: gt,
43
46
  "data-testid": "base-map",
44
47
  "data-map-provider-name": t?.name,
45
48
  "data-map-provider-theme": t?.theme || J[t?.name] || J.maptiler,
46
49
  "data-initial-zoom": s,
47
- "data-pitch": o,
48
- "data-bearing": i,
50
+ "data-pitch": i,
51
+ "data-bearing": o,
49
52
  "data-cooperative-gestures": a,
50
53
  "data-zoom-position": c,
51
54
  "data-center-latitude": e.latitude,
@@ -53,9 +56,9 @@ const nt = ct.createContext({}), I = () => ut(nt), C = {
53
56
  children: /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(l, { children: r }) })
54
57
  }
55
58
  );
56
- }, Pt = w(() => import("./index-C3Tj3r2u.js")), At = w(() => import("./index-CUUravWc.js")), Et = w(() => import("./index-eWv3le07.js"));
57
- function xt(r) {
58
- const { mapProvider: t } = I(), e = O(() => {
59
+ }, Pt = w(() => import("./index-C3Tj3r2u.js")), At = w(() => import("./index-CUUravWc.js")), Et = w(() => import("./index-eWv3le07.js")), xt = w(() => import("./index-BO34uKgS.js"));
60
+ function Tt(r) {
61
+ const { mapProvider: t } = I(), e = v(() => {
59
62
  switch (t?.name) {
60
63
  case "maptiler":
61
64
  return Pt;
@@ -63,13 +66,15 @@ function xt(r) {
63
66
  return At;
64
67
  case "mapbox":
65
68
  return Et;
69
+ case "testing":
70
+ return xt;
66
71
  default:
67
72
  return null;
68
73
  }
69
74
  }, [t]);
70
75
  return e ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(e, { ...r }) }) : null;
71
76
  }
72
- function rt(r, t, e = {}) {
77
+ function st(r, t, e = {}) {
73
78
  const n = { type: "Feature" };
74
79
  return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = r, n;
75
80
  }
@@ -80,23 +85,23 @@ function bt(r, t, e = {}) {
80
85
  throw new Error("coordinates must be an Array");
81
86
  if (r.length < 2)
82
87
  throw new Error("coordinates must be at least 2 numbers long");
83
- if (!Y(r[0]) || !Y(r[1]))
88
+ if (!K(r[0]) || !K(r[1]))
84
89
  throw new Error("coordinates must contain numbers");
85
- return rt({
90
+ return st({
86
91
  type: "Point",
87
92
  coordinates: r
88
93
  }, t, e);
89
94
  }
90
- function Kt(r, t, e = {}) {
91
- return rt({
95
+ function te(r, t, e = {}) {
96
+ return st({
92
97
  type: "MultiPoint",
93
98
  coordinates: r
94
99
  }, t, e);
95
100
  }
96
- function Y(r) {
101
+ function K(r) {
97
102
  return !isNaN(r) && r !== null && !Array.isArray(r);
98
103
  }
99
- const K = [
104
+ const q = [
100
105
  Int8Array,
101
106
  Uint8Array,
102
107
  Uint8ClampedArray,
@@ -106,7 +111,7 @@ const K = [
106
111
  Uint32Array,
107
112
  Float32Array,
108
113
  Float64Array
109
- ], F = 1, S = 8;
114
+ ], F = 1, O = 8;
110
115
  class G {
111
116
  /**
112
117
  * Creates an index from raw `ArrayBuffer` data.
@@ -118,14 +123,14 @@ class G {
118
123
  const [e, n] = new Uint8Array(t, 0, 2);
119
124
  if (e !== 219)
120
125
  throw new Error("Data does not appear to be in a KDBush format.");
121
- const o = n >> 4;
122
- if (o !== F)
123
- throw new Error(`Got v${o} data when expected v${F}.`);
124
- const i = K[n & 15];
125
- if (!i)
126
+ const i = n >> 4;
127
+ if (i !== F)
128
+ throw new Error(`Got v${i} data when expected v${F}.`);
129
+ const o = q[n & 15];
130
+ if (!o)
126
131
  throw new Error("Unrecognized array type.");
127
132
  const [a] = new Uint16Array(t, 2, 1), [c] = new Uint32Array(t, 4, 1);
128
- return new G(c, a, i, t);
133
+ return new G(c, a, o, t);
129
134
  }
130
135
  /**
131
136
  * Creates an index that will hold a given number of items.
@@ -134,13 +139,13 @@ class G {
134
139
  * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
135
140
  * @param {ArrayBuffer} [data] (For internal use only)
136
141
  */
137
- constructor(t, e = 64, n = Float64Array, o) {
142
+ constructor(t, e = 64, n = Float64Array, i) {
138
143
  if (isNaN(t) || t < 0) throw new Error(`Unpexpected numItems value: ${t}.`);
139
144
  this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType = n, this.IndexArrayType = t < 65536 ? Uint16Array : Uint32Array;
140
- const i = K.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, c = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - c % 8) % 8;
141
- if (i < 0)
145
+ const o = q.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, c = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - c % 8) % 8;
146
+ if (o < 0)
142
147
  throw new Error(`Unexpected typed array class: ${n}.`);
143
- o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data, S, t), this.coords = new this.ArrayType(this.data, S + c + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(S + a + c + s), this.ids = new this.IndexArrayType(this.data, S, t), this.coords = new this.ArrayType(this.data, S + c + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (F << 4) + i]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
148
+ i && i instanceof ArrayBuffer ? (this.data = i, this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + c + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(O + a + c + s), this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + c + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (F << 4) + o]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
144
149
  }
145
150
  /**
146
151
  * Add a point to the index.
@@ -169,20 +174,20 @@ class G {
169
174
  * @param {number} maxY
170
175
  * @returns {number[]} An array of indices correponding to the found items.
171
176
  */
172
- range(t, e, n, o) {
177
+ range(t, e, n, i) {
173
178
  if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
174
- const { ids: i, coords: a, nodeSize: c } = this, s = [0, i.length - 1, 0], l = [];
179
+ const { ids: o, coords: a, nodeSize: c } = this, s = [0, o.length - 1, 0], l = [];
175
180
  for (; s.length; ) {
176
181
  const h = s.pop() || 0, u = s.pop() || 0, f = s.pop() || 0;
177
182
  if (u - f <= c) {
178
183
  for (let p = f; p <= u; p++) {
179
184
  const m = a[2 * p], M = a[2 * p + 1];
180
- m >= t && m <= n && M >= e && M <= o && l.push(i[p]);
185
+ m >= t && m <= n && M >= e && M <= i && l.push(o[p]);
181
186
  }
182
187
  continue;
183
188
  }
184
189
  const d = f + u >> 1, g = a[2 * d], y = a[2 * d + 1];
185
- g >= t && g <= n && y >= e && y <= o && l.push(i[d]), (h === 0 ? t <= g : e <= y) && (s.push(f), s.push(d - 1), s.push(1 - h)), (h === 0 ? n >= g : o >= y) && (s.push(d + 1), s.push(u), s.push(1 - h));
190
+ g >= t && g <= n && y >= e && y <= i && l.push(o[d]), (h === 0 ? t <= g : e <= y) && (s.push(f), s.push(d - 1), s.push(1 - h)), (h === 0 ? n >= g : i >= y) && (s.push(d + 1), s.push(u), s.push(1 - h));
186
191
  }
187
192
  return l;
188
193
  }
@@ -195,50 +200,50 @@ class G {
195
200
  */
196
201
  within(t, e, n) {
197
202
  if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
198
- const { ids: o, coords: i, nodeSize: a } = this, c = [0, o.length - 1, 0], s = [], l = n * n;
203
+ const { ids: i, coords: o, nodeSize: a } = this, c = [0, i.length - 1, 0], s = [], l = n * n;
199
204
  for (; c.length; ) {
200
205
  const h = c.pop() || 0, u = c.pop() || 0, f = c.pop() || 0;
201
206
  if (u - f <= a) {
202
207
  for (let p = f; p <= u; p++)
203
- q(i[2 * p], i[2 * p + 1], t, e) <= l && s.push(o[p]);
208
+ Q(o[2 * p], o[2 * p + 1], t, e) <= l && s.push(i[p]);
204
209
  continue;
205
210
  }
206
- const d = f + u >> 1, g = i[2 * d], y = i[2 * d + 1];
207
- q(g, y, t, e) <= l && s.push(o[d]), (h === 0 ? t - n <= g : e - n <= y) && (c.push(f), c.push(d - 1), c.push(1 - h)), (h === 0 ? t + n >= g : e + n >= y) && (c.push(d + 1), c.push(u), c.push(1 - h));
211
+ const d = f + u >> 1, g = o[2 * d], y = o[2 * d + 1];
212
+ Q(g, y, t, e) <= l && s.push(i[d]), (h === 0 ? t - n <= g : e - n <= y) && (c.push(f), c.push(d - 1), c.push(1 - h)), (h === 0 ? t + n >= g : e + n >= y) && (c.push(d + 1), c.push(u), c.push(1 - h));
208
213
  }
209
214
  return s;
210
215
  }
211
216
  }
212
- function k(r, t, e, n, o, i) {
213
- if (o - n <= e) return;
214
- const a = n + o >> 1;
215
- st(r, t, a, n, o, i), k(r, t, e, n, a - 1, 1 - i), k(r, t, e, a + 1, o, 1 - i);
217
+ function k(r, t, e, n, i, o) {
218
+ if (i - n <= e) return;
219
+ const a = n + i >> 1;
220
+ it(r, t, a, n, i, o), k(r, t, e, n, a - 1, 1 - o), k(r, t, e, a + 1, i, 1 - o);
216
221
  }
217
- function st(r, t, e, n, o, i) {
218
- for (; o > n; ) {
219
- if (o - n > 600) {
220
- const l = o - n + 1, h = e - n + 1, u = Math.log(l), f = 0.5 * Math.exp(2 * u / 3), d = 0.5 * Math.sqrt(u * f * (l - f) / l) * (h - l / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - h * f / l + d)), y = Math.min(o, Math.floor(e + (l - h) * f / l + d));
221
- st(r, t, e, g, y, i);
222
+ function it(r, t, e, n, i, o) {
223
+ for (; i > n; ) {
224
+ if (i - n > 600) {
225
+ const l = i - n + 1, h = e - n + 1, u = Math.log(l), f = 0.5 * Math.exp(2 * u / 3), d = 0.5 * Math.sqrt(u * f * (l - f) / l) * (h - l / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - h * f / l + d)), y = Math.min(i, Math.floor(e + (l - h) * f / l + d));
226
+ it(r, t, e, g, y, o);
222
227
  }
223
- const a = t[2 * e + i];
224
- let c = n, s = o;
225
- for (T(r, t, n, e), t[2 * o + i] > a && T(r, t, n, o); c < s; ) {
226
- for (T(r, t, c, s), c++, s--; t[2 * c + i] < a; ) c++;
227
- for (; t[2 * s + i] > a; ) s--;
228
+ const a = t[2 * e + o];
229
+ let c = n, s = i;
230
+ for (S(r, t, n, e), t[2 * i + o] > a && S(r, t, n, i); c < s; ) {
231
+ for (S(r, t, c, s), c++, s--; t[2 * c + o] < a; ) c++;
232
+ for (; t[2 * s + o] > a; ) s--;
228
233
  }
229
- t[2 * n + i] === a ? T(r, t, n, s) : (s++, T(r, t, s, o)), s <= e && (n = s + 1), e <= s && (o = s - 1);
234
+ t[2 * n + o] === a ? S(r, t, n, s) : (s++, S(r, t, s, i)), s <= e && (n = s + 1), e <= s && (i = s - 1);
230
235
  }
231
236
  }
232
- function T(r, t, e, n) {
237
+ function S(r, t, e, n) {
233
238
  N(r, e, n), N(t, 2 * e, 2 * n), N(t, 2 * e + 1, 2 * n + 1);
234
239
  }
235
240
  function N(r, t, e) {
236
241
  const n = r[t];
237
242
  r[t] = r[e], r[e] = n;
238
243
  }
239
- function q(r, t, e, n) {
240
- const o = r - e, i = t - n;
241
- return o * o + i * i;
244
+ function Q(r, t, e, n) {
245
+ const i = r - e, o = t - n;
246
+ return i * i + o * o;
242
247
  }
243
248
  const vt = {
244
249
  minZoom: 0,
@@ -263,21 +268,21 @@ const vt = {
263
268
  // properties to use for individual points when running the reducer
264
269
  map: (r) => r
265
270
  // props => ({sum: props.my_value})
266
- }, Q = Math.fround || /* @__PURE__ */ ((r) => ((t) => (r[0] = +t, r[0])))(new Float32Array(1)), b = 2, E = 3, z = 4, A = 5, ot = 6;
271
+ }, X = Math.fround || /* @__PURE__ */ ((r) => ((t) => (r[0] = +t, r[0])))(new Float32Array(1)), T = 2, E = 3, z = 4, A = 5, ot = 6;
267
272
  class Ot {
268
273
  constructor(t) {
269
274
  this.options = Object.assign(Object.create(vt), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
270
275
  }
271
276
  load(t) {
272
- const { log: e, minZoom: n, maxZoom: o } = this.options;
277
+ const { log: e, minZoom: n, maxZoom: i } = this.options;
273
278
  e && console.time("total time");
274
- const i = `prepare ${t.length} points`;
275
- e && console.time(i), this.points = t;
279
+ const o = `prepare ${t.length} points`;
280
+ e && console.time(o), this.points = t;
276
281
  const a = [];
277
282
  for (let s = 0; s < t.length; s++) {
278
283
  const l = t[s];
279
284
  if (!l.geometry) continue;
280
- const [h, u] = l.geometry.coordinates, f = Q(U(h)), d = Q(D(u));
285
+ const [h, u] = l.geometry.coordinates, f = X(U(h)), d = X(D(u));
281
286
  a.push(
282
287
  f,
283
288
  d,
@@ -292,9 +297,9 @@ class Ot {
292
297
  // number of points in a cluster
293
298
  ), this.options.reduce && a.push(0);
294
299
  }
295
- let c = this.trees[o + 1] = this._createTree(a);
296
- e && console.timeEnd(i);
297
- for (let s = o; s >= n; s--) {
300
+ let c = this.trees[i + 1] = this._createTree(a);
301
+ e && console.timeEnd(o);
302
+ for (let s = i; s >= n; s--) {
298
303
  const l = +Date.now();
299
304
  c = this.trees[s] = this._createTree(this._cluster(c, s)), e && console.log("z%d: %d clusters in %dms", s, c.numItems, +Date.now() - l);
300
305
  }
@@ -302,64 +307,64 @@ class Ot {
302
307
  }
303
308
  getClusters(t, e) {
304
309
  let n = ((t[0] + 180) % 360 + 360) % 360 - 180;
305
- const o = Math.max(-90, Math.min(90, t[1]));
306
- let i = t[2] === 180 ? 180 : ((t[2] + 180) % 360 + 360) % 360 - 180;
310
+ const i = Math.max(-90, Math.min(90, t[1]));
311
+ let o = t[2] === 180 ? 180 : ((t[2] + 180) % 360 + 360) % 360 - 180;
307
312
  const a = Math.max(-90, Math.min(90, t[3]));
308
313
  if (t[2] - t[0] >= 360)
309
- n = -180, i = 180;
310
- else if (n > i) {
311
- const u = this.getClusters([n, o, 180, a], e), f = this.getClusters([-180, o, i, a], e);
314
+ n = -180, o = 180;
315
+ else if (n > o) {
316
+ const u = this.getClusters([n, i, 180, a], e), f = this.getClusters([-180, i, o, a], e);
312
317
  return u.concat(f);
313
318
  }
314
- const c = this.trees[this._limitZoom(e)], s = c.range(U(n), D(a), U(i), D(o)), l = c.data, h = [];
319
+ const c = this.trees[this._limitZoom(e)], s = c.range(U(n), D(a), U(o), D(i)), l = c.data, h = [];
315
320
  for (const u of s) {
316
321
  const f = this.stride * u;
317
- h.push(l[f + A] > 1 ? X(l, f, this.clusterProps) : this.points[l[f + E]]);
322
+ h.push(l[f + A] > 1 ? tt(l, f, this.clusterProps) : this.points[l[f + E]]);
318
323
  }
319
324
  return h;
320
325
  }
321
326
  getChildren(t) {
322
- const e = this._getOriginId(t), n = this._getOriginZoom(t), o = "No cluster with the specified id.", i = this.trees[n];
323
- if (!i) throw new Error(o);
324
- const a = i.data;
325
- if (e * this.stride >= a.length) throw new Error(o);
326
- const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride], l = a[e * this.stride + 1], h = i.within(s, l, c), u = [];
327
+ const e = this._getOriginId(t), n = this._getOriginZoom(t), i = "No cluster with the specified id.", o = this.trees[n];
328
+ if (!o) throw new Error(i);
329
+ const a = o.data;
330
+ if (e * this.stride >= a.length) throw new Error(i);
331
+ const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride], l = a[e * this.stride + 1], h = o.within(s, l, c), u = [];
327
332
  for (const f of h) {
328
333
  const d = f * this.stride;
329
- a[d + z] === t && u.push(a[d + A] > 1 ? X(a, d, this.clusterProps) : this.points[a[d + E]]);
334
+ a[d + z] === t && u.push(a[d + A] > 1 ? tt(a, d, this.clusterProps) : this.points[a[d + E]]);
330
335
  }
331
- if (u.length === 0) throw new Error(o);
336
+ if (u.length === 0) throw new Error(i);
332
337
  return u;
333
338
  }
334
339
  getLeaves(t, e, n) {
335
340
  e = e || 10, n = n || 0;
336
- const o = [];
337
- return this._appendLeaves(o, t, e, n, 0), o;
341
+ const i = [];
342
+ return this._appendLeaves(i, t, e, n, 0), i;
338
343
  }
339
344
  getTile(t, e, n) {
340
- const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a, l = (n - s) / i, h = (n + 1 + s) / i, u = {
345
+ const i = this.trees[this._limitZoom(t)], o = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a, l = (n - s) / o, h = (n + 1 + s) / o, u = {
341
346
  features: []
342
347
  };
343
348
  return this._addTileFeatures(
344
- o.range((e - s) / i, l, (e + 1 + s) / i, h),
345
- o.data,
349
+ i.range((e - s) / o, l, (e + 1 + s) / o, h),
350
+ i.data,
346
351
  e,
347
352
  n,
348
- i,
353
+ o,
349
354
  u
350
355
  ), e === 0 && this._addTileFeatures(
351
- o.range(1 - s / i, l, 1, h),
352
- o.data,
353
- i,
356
+ i.range(1 - s / o, l, 1, h),
357
+ i.data,
358
+ o,
354
359
  n,
355
- i,
360
+ o,
356
361
  u
357
- ), e === i - 1 && this._addTileFeatures(
358
- o.range(0, l, s / i, h),
359
- o.data,
362
+ ), e === o - 1 && this._addTileFeatures(
363
+ i.range(0, l, s / o, h),
364
+ i.data,
360
365
  -1,
361
366
  n,
362
- i,
367
+ o,
363
368
  u
364
369
  ), u.features.length ? u : null;
365
370
  }
@@ -372,25 +377,25 @@ class Ot {
372
377
  }
373
378
  return e;
374
379
  }
375
- _appendLeaves(t, e, n, o, i) {
380
+ _appendLeaves(t, e, n, i, o) {
376
381
  const a = this.getChildren(e);
377
382
  for (const c of a) {
378
383
  const s = c.properties;
379
- if (s && s.cluster ? i + s.point_count <= o ? i += s.point_count : i = this._appendLeaves(t, s.cluster_id, n, o, i) : i < o ? i++ : t.push(c), t.length === n) break;
384
+ if (s && s.cluster ? o + s.point_count <= i ? o += s.point_count : o = this._appendLeaves(t, s.cluster_id, n, i, o) : o < i ? o++ : t.push(c), t.length === n) break;
380
385
  }
381
- return i;
386
+ return o;
382
387
  }
383
388
  _createTree(t) {
384
389
  const e = new G(t.length / this.stride | 0, this.options.nodeSize, Float32Array);
385
390
  for (let n = 0; n < t.length; n += this.stride) e.add(t[n], t[n + 1]);
386
391
  return e.finish(), e.data = t, e;
387
392
  }
388
- _addTileFeatures(t, e, n, o, i, a) {
393
+ _addTileFeatures(t, e, n, i, o, a) {
389
394
  for (const c of t) {
390
395
  const s = c * this.stride, l = e[s + A] > 1;
391
396
  let h, u, f;
392
397
  if (l)
393
- h = it(e, s, this.clusterProps), u = e[s], f = e[s + 1];
398
+ h = at(e, s, this.clusterProps), u = e[s], f = e[s + 1];
394
399
  else {
395
400
  const y = this.points[e[s + E]];
396
401
  h = y.properties;
@@ -400,8 +405,8 @@ class Ot {
400
405
  const d = {
401
406
  type: 1,
402
407
  geometry: [[
403
- Math.round(this.options.extent * (u * i - n)),
404
- Math.round(this.options.extent * (f * i - o))
408
+ Math.round(this.options.extent * (u * o - n)),
409
+ Math.round(this.options.extent * (f * o - i))
405
410
  ]],
406
411
  tags: h
407
412
  };
@@ -413,34 +418,34 @@ class Ot {
413
418
  return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
414
419
  }
415
420
  _cluster(t, e) {
416
- const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, c = n / (o * Math.pow(2, e)), s = t.data, l = [], h = this.stride;
421
+ const { radius: n, extent: i, reduce: o, minPoints: a } = this.options, c = n / (i * Math.pow(2, e)), s = t.data, l = [], h = this.stride;
417
422
  for (let u = 0; u < s.length; u += h) {
418
- if (s[u + b] <= e) continue;
419
- s[u + b] = e;
423
+ if (s[u + T] <= e) continue;
424
+ s[u + T] = e;
420
425
  const f = s[u], d = s[u + 1], g = t.within(s[u], s[u + 1], c), y = s[u + A];
421
426
  let p = y;
422
427
  for (const m of g) {
423
428
  const M = m * h;
424
- s[M + b] > e && (p += s[M + A]);
429
+ s[M + T] > e && (p += s[M + A]);
425
430
  }
426
431
  if (p > y && p >= a) {
427
432
  let m = f * y, M = d * y, P, $ = -1;
428
433
  const B = ((u / h | 0) << 5) + (e + 1) + this.points.length;
429
- for (const at of g) {
430
- const x = at * h;
431
- if (s[x + b] <= e) continue;
432
- s[x + b] = e;
434
+ for (const ct of g) {
435
+ const x = ct * h;
436
+ if (s[x + T] <= e) continue;
437
+ s[x + T] = e;
433
438
  const H = s[x + A];
434
- m += s[x] * H, M += s[x + 1] * H, s[x + z] = B, i && (P || (P = this._map(s, u, !0), $ = this.clusterProps.length, this.clusterProps.push(P)), i(P, this._map(s, x)));
439
+ m += s[x] * H, M += s[x + 1] * H, s[x + z] = B, o && (P || (P = this._map(s, u, !0), $ = this.clusterProps.length, this.clusterProps.push(P)), o(P, this._map(s, x)));
435
440
  }
436
- s[u + z] = B, l.push(m / p, M / p, 1 / 0, B, -1, p), i && l.push($);
441
+ s[u + z] = B, l.push(m / p, M / p, 1 / 0, B, -1, p), o && l.push($);
437
442
  } else {
438
443
  for (let m = 0; m < h; m++) l.push(s[u + m]);
439
444
  if (p > 1)
440
445
  for (const m of g) {
441
446
  const M = m * h;
442
- if (!(s[M + b] <= e)) {
443
- s[M + b] = e;
447
+ if (!(s[M + T] <= e)) {
448
+ s[M + T] = e;
444
449
  for (let P = 0; P < h; P++) l.push(s[M + P]);
445
450
  }
446
451
  }
@@ -461,28 +466,28 @@ class Ot {
461
466
  const a = this.clusterProps[t[e + ot]];
462
467
  return n ? Object.assign({}, a) : a;
463
468
  }
464
- const o = this.points[t[e + E]].properties, i = this.options.map(o);
465
- return n && i === o ? Object.assign({}, i) : i;
469
+ const i = this.points[t[e + E]].properties, o = this.options.map(i);
470
+ return n && o === i ? Object.assign({}, o) : o;
466
471
  }
467
472
  }
468
- function X(r, t, e) {
473
+ function tt(r, t, e) {
469
474
  return {
470
475
  type: "Feature",
471
476
  id: r[t + E],
472
- properties: it(r, t, e),
477
+ properties: at(r, t, e),
473
478
  geometry: {
474
479
  type: "Point",
475
- coordinates: [St(r[t]), Tt(r[t + 1])]
480
+ coordinates: [St(r[t]), Ct(r[t + 1])]
476
481
  }
477
482
  };
478
483
  }
479
- function it(r, t, e) {
480
- const n = r[t + A], o = n >= 1e4 ? `${Math.round(n / 1e3)}k` : n >= 1e3 ? `${Math.round(n / 100) / 10}k` : n, i = r[t + ot], a = i === -1 ? {} : Object.assign({}, e[i]);
484
+ function at(r, t, e) {
485
+ const n = r[t + A], i = n >= 1e4 ? `${Math.round(n / 1e3)}k` : n >= 1e3 ? `${Math.round(n / 100) / 10}k` : n, o = r[t + ot], a = o === -1 ? {} : Object.assign({}, e[o]);
481
486
  return Object.assign(a, {
482
487
  cluster: !0,
483
488
  cluster_id: r[t + E],
484
489
  point_count: n,
485
- point_count_abbreviated: o
490
+ point_count_abbreviated: i
486
491
  });
487
492
  }
488
493
  function U(r) {
@@ -495,38 +500,38 @@ function D(r) {
495
500
  function St(r) {
496
501
  return (r - 0.5) * 360;
497
502
  }
498
- function Tt(r) {
503
+ function Ct(r) {
499
504
  const t = (180 - r * 360) * Math.PI / 180;
500
505
  return 360 * Math.atan(Math.exp(t)) / Math.PI - 90;
501
506
  }
502
- var tt = Object.prototype.hasOwnProperty;
503
- function et(r, t, e) {
507
+ var et = Object.prototype.hasOwnProperty;
508
+ function nt(r, t, e) {
504
509
  for (e of r.keys())
505
- if (v(e, t)) return e;
510
+ if (b(e, t)) return e;
506
511
  }
507
- function v(r, t) {
508
- var e, n, o;
512
+ function b(r, t) {
513
+ var e, n, i;
509
514
  if (r === t) return !0;
510
515
  if (r && t && (e = r.constructor) === t.constructor) {
511
516
  if (e === Date) return r.getTime() === t.getTime();
512
517
  if (e === RegExp) return r.toString() === t.toString();
513
518
  if (e === Array) {
514
519
  if ((n = r.length) === t.length)
515
- for (; n-- && v(r[n], t[n]); ) ;
520
+ for (; n-- && b(r[n], t[n]); ) ;
516
521
  return n === -1;
517
522
  }
518
523
  if (e === Set) {
519
524
  if (r.size !== t.size)
520
525
  return !1;
521
526
  for (n of r)
522
- if (o = n, o && typeof o == "object" && (o = et(t, o), !o) || !t.has(o)) return !1;
527
+ if (i = n, i && typeof i == "object" && (i = nt(t, i), !i) || !t.has(i)) return !1;
523
528
  return !0;
524
529
  }
525
530
  if (e === Map) {
526
531
  if (r.size !== t.size)
527
532
  return !1;
528
533
  for (n of r)
529
- if (o = n[0], o && typeof o == "object" && (o = et(t, o), !o) || !v(n[1], t.get(o)))
534
+ if (i = n[0], i && typeof i == "object" && (i = nt(t, i), !i) || !b(n[1], t.get(i)))
530
535
  return !1;
531
536
  return !0;
532
537
  }
@@ -545,53 +550,53 @@ function v(r, t) {
545
550
  if (!e || typeof r == "object") {
546
551
  n = 0;
547
552
  for (e in r)
548
- if (tt.call(r, e) && ++n && !tt.call(t, e) || !(e in t) || !v(r[e], t[e])) return !1;
553
+ if (et.call(r, e) && ++n && !et.call(t, e) || !(e in t) || !b(r[e], t[e])) return !1;
549
554
  return Object.keys(t).length === n;
550
555
  }
551
556
  }
552
557
  return r !== r && t !== t;
553
558
  }
554
- function Ct(r) {
559
+ function Lt(r) {
555
560
  var t = Z.useRef(r), e = Z.useRef(0);
556
- return v(r, t.current) || (t.current = r, e.current += 1), Z.useMemo(function() {
561
+ return b(r, t.current) || (t.current = r, e.current += 1), Z.useMemo(function() {
557
562
  return t.current;
558
563
  }, [e.current]);
559
564
  }
560
- function Lt(r, t) {
561
- return Z.useEffect(r, Ct(t));
565
+ function Rt(r, t) {
566
+ return Z.useEffect(r, Lt(t));
562
567
  }
563
- var Rt = function(t) {
564
- var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, c = j(), s = j(), l = L([]), h = l[0], u = l[1], f = Math.round(o);
565
- return Lt(function() {
566
- a !== !0 && ((!c.current || !v(s.current, e) || !v(c.current.options, i)) && (c.current = new Ot(i), c.current.load(e)), n && u(c.current.getClusters(n, f)), s.current = e);
567
- }, [e, n, f, i, a]), {
568
+ var It = function(t) {
569
+ var e = t.points, n = t.bounds, i = t.zoom, o = t.options, a = t.disableRefresh, c = j(), s = j(), l = L([]), h = l[0], u = l[1], f = Math.round(i);
570
+ return Rt(function() {
571
+ a !== !0 && ((!c.current || !b(s.current, e) || !b(c.current.options, o)) && (c.current = new Ot(o), c.current.load(e)), n && u(c.current.getClusters(n, f)), s.current = e);
572
+ }, [e, n, f, o, a]), {
568
573
  clusters: h,
569
574
  supercluster: c.current
570
575
  };
571
576
  };
572
- const It = w(() => import("./index-Deqck8KU.js")), Ut = w(() => import("./index-CFioISlP.js")), Dt = w(() => import("./index-CyFpPXRS.js"));
573
- function Zt({ isLoading: r, markers: t, onClick: e, ...n }) {
574
- const { mapProvider: o, activeMarker: i, zoom: a, setMarkerPoints: c, setClusterPoints: s } = I();
577
+ const Ut = w(() => import("./index-0EkdzCyN.js")), Dt = w(() => import("./index-CZPGxjSJ.js")), Zt = w(() => import("./index-BY_xYg2p.js")), Bt = w(() => import("./index-DEFuc-6u.js"));
578
+ function Ft({ isLoading: r, markers: t, onClick: e, ...n }) {
579
+ const { mapProvider: i, activeMarker: o, zoom: a, setMarkerPoints: c, setClusterPoints: s } = I();
575
580
  V(() => {
576
581
  if (r)
577
582
  return;
578
583
  const p = (t || []).map((m) => [m.longitude, m.latitude]);
579
584
  c(p);
580
585
  }, [t, c]);
581
- const l = O(
586
+ const l = v(
582
587
  () => ({
583
588
  points: t.map((p) => bt([p.longitude, p.latitude], p)),
584
589
  // Using world bounds to avoid issues with markers near the edges of the map
585
- bounds: dt,
590
+ bounds: mt,
586
591
  zoom: a,
587
592
  options: {
588
- radius: o.name === "google" && a > W ? ft : ht,
593
+ radius: i.name === "google" && a > W ? dt : ft,
589
594
  minZoom: W,
590
- maxZoom: pt
595
+ maxZoom: ht
591
596
  }
592
597
  }),
593
- [t, o, a]
594
- ), { clusters: h, supercluster: u } = Rt(l), f = j("");
598
+ [t, i, a]
599
+ ), { clusters: h, supercluster: u } = It(l), f = j("");
595
600
  V(() => {
596
601
  const p = JSON.stringify(
597
602
  h.map((m) => ({
@@ -620,26 +625,28 @@ function Zt({ isLoading: r, markers: t, onClick: e, ...n }) {
620
625
  markers: [p.properties]
621
626
  });
622
627
  }, g = (p) => {
623
- if (!u || !i) return !1;
624
- if (i.id === `${p}`)
628
+ if (!u || !o) return !1;
629
+ if (o.id === `${p}`)
625
630
  return !0;
626
631
  try {
627
- return u.getLeaves(p)?.find((m) => m.properties.id === i.id) !== void 0;
632
+ return u.getLeaves(p)?.find((m) => m.properties.id === o.id) !== void 0;
628
633
  } catch {
629
634
  return !1;
630
635
  }
631
- }, y = O(() => {
632
- switch (o?.name) {
636
+ }, y = v(() => {
637
+ switch (i?.name) {
633
638
  case "maptiler":
634
- return It;
635
- case "google":
636
639
  return Ut;
637
- case "mapbox":
640
+ case "google":
638
641
  return Dt;
642
+ case "mapbox":
643
+ return Zt;
644
+ case "testing":
645
+ return Bt;
639
646
  default:
640
647
  return null;
641
648
  }
642
- }, [o]);
649
+ }, [i]);
643
650
  return y ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(
644
651
  y,
645
652
  {
@@ -650,76 +657,80 @@ function Zt({ isLoading: r, markers: t, onClick: e, ...n }) {
650
657
  }
651
658
  ) }) : null;
652
659
  }
653
- const Bt = w(() => import("./index-zqYpD_YN.js")), Ft = w(() => import("./index-CzqD82Cl.js")), Nt = w(() => import("./index-VFglx6lb.js"));
654
- function zt({ children: r, anchor: t = "bottom", ...e }) {
655
- const { mapProvider: n } = I(), o = O(() => {
660
+ const Nt = w(() => import("./index--PIAfLjo.js")), zt = w(() => import("./index-BnTZMzoy.js")), jt = w(() => import("./index-GoHd1Tri.js")), kt = w(() => import("./index-COB6j_V1.js"));
661
+ function Gt({ children: r, anchor: t = "bottom", ...e }) {
662
+ const { mapProvider: n } = I(), i = v(() => {
656
663
  switch (n?.name) {
657
664
  case "maptiler":
658
- return Bt;
665
+ return Nt;
659
666
  case "google":
660
- return Ft;
667
+ return zt;
661
668
  case "mapbox":
662
- return Nt;
669
+ return jt;
670
+ case "testing":
671
+ return kt;
663
672
  default:
664
673
  return null;
665
674
  }
666
675
  }, [n]);
667
- return o ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(o, { ...e, anchor: t, children: r }) }) : null;
676
+ return i ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(i, { ...e, anchor: t, children: r }) }) : null;
668
677
  }
669
- const jt = w(() => import("./index-DKy2opdk.js")), kt = w(() => import("./index-k9UFzKZZ.js")), Gt = w(() => import("./index-D8-yY6UK.js"));
670
- function $t(r) {
671
- const { mapProvider: t } = I(), e = O(() => {
678
+ const $t = w(() => import("./index-DKy2opdk.js")), Ht = w(() => import("./index-k9UFzKZZ.js")), Vt = w(() => import("./index-D8-yY6UK.js")), Jt = w(() => import("./index-C0inY_TA.js"));
679
+ function Wt(r) {
680
+ const { mapProvider: t } = I(), e = v(() => {
672
681
  switch (t?.name) {
673
682
  case "maptiler":
674
- return jt;
683
+ return $t;
675
684
  case "google":
676
- return kt;
685
+ return Ht;
677
686
  case "mapbox":
678
- return Gt;
687
+ return Vt;
688
+ case "testing":
689
+ return Jt;
679
690
  default:
680
691
  return null;
681
692
  }
682
693
  }, [t]);
683
694
  return e ? /* @__PURE__ */ _(R, { fallback: null, children: /* @__PURE__ */ _(e, { ...r }) }) : null;
684
695
  }
685
- function Ht(r) {
686
- const [t, e] = L([]), [n, o] = L([]), [i, a] = L(r.zoom || C.zoom);
696
+ function Yt(r) {
697
+ const [t, e] = L([]), [n, i] = L([]), [o, a] = L(r.zoom || C.zoom);
687
698
  return /* @__PURE__ */ _(
688
- nt.Provider,
699
+ rt.Provider,
689
700
  {
690
701
  value: {
691
702
  ...r,
692
703
  locale: r.locale || "en",
693
- mapPadding: r.mapPadding || lt,
704
+ mapPadding: r.mapPadding || pt,
694
705
  locationBoundary: r.locationBoundary ? r.locationBoundary : [[r.center.longitude, r.center.latitude]],
695
706
  markerPoints: t,
696
707
  setMarkerPoints: e,
697
708
  clusterPoints: n,
698
- setClusterPoints: o,
699
- zoom: i,
709
+ setClusterPoints: i,
710
+ zoom: o,
700
711
  setZoom: a
701
712
  },
702
713
  children: r.children
703
714
  }
704
715
  );
705
716
  }
706
- const qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
717
+ const ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
707
718
  __proto__: null,
708
719
  BaseMap: _t,
709
- CenterPin: xt,
710
- Layers: $t,
711
- Markers: Zt,
712
- Popup: zt,
713
- Root: Ht
720
+ CenterPin: Tt,
721
+ Layers: Wt,
722
+ Markers: Ft,
723
+ Popup: Gt,
724
+ Root: Yt
714
725
  }, Symbol.toStringTag, { value: "Module" }));
715
726
  export {
716
727
  C as D,
717
- Wt as M,
718
- Yt as P,
719
- dt as W,
728
+ Qt as M,
729
+ Xt as P,
730
+ mt as W,
720
731
  J as a,
721
- lt as b,
722
- qt as i,
723
- Kt as m,
732
+ pt as b,
733
+ ee as i,
734
+ te as m,
724
735
  I as u
725
736
  };