@local-logic/maps 0.0.7 → 0.0.9

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.
@@ -1,22 +1,22 @@
1
- import { jsx as x, Fragment as nt } from "react/jsx-runtime";
1
+ import { jsx as x, Fragment as st } from "react/jsx-runtime";
2
2
  import * as F from "react";
3
- import st, { useContext as ot, lazy as w, useMemo as L, useRef as G, useState as q } from "react";
4
- const Q = st.createContext(
3
+ import ot, { useContext as it, lazy as w, useMemo as L, useRef as G, useState as Q } from "react";
4
+ const X = ot.createContext(
5
5
  {}
6
- ), R = () => ot(Q), S = {
6
+ ), R = () => it(X), S = {
7
7
  zoom: 16,
8
8
  pitch: 0,
9
9
  bearing: 0,
10
10
  cooperativeGestures: !1
11
- }, Ut = {
11
+ }, V = {
12
12
  maptiler: "600d69cb-288d-445e-9839-3dfe4d76b31a",
13
13
  mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
14
14
  google: "a7ff20eb973126bb"
15
- }, it = "w-full h-full relative overflow-hidden", at = w(() => import("./index-CIUYCbof.js")), ct = w(() => import("./index-FSH3b4mt.js")), ut = w(() => import("./index-CSXMNubL.js")), ht = w(() => import("./index-qqbvBkdn.js")), pt = ({ children: n }) => {
15
+ }, at = "w-full h-full relative overflow-hidden", ct = w(() => import("./index-BF2kb4Y-.js")), ut = w(() => import("./index-C5-_i-6M.js")), ht = w(() => import("./index-CrIFr9oc.js")), pt = w(() => import("./index-qqbvBkdn.js")), lt = ({ children: r }) => {
16
16
  const {
17
17
  mapProvider: t,
18
18
  center: e,
19
- zoom: r = S.zoom,
19
+ zoom: n = S.zoom,
20
20
  pitch: o = S.pitch,
21
21
  bearing: i = S.bearing,
22
22
  cooperativeGestures: a = S.cooperativeGestures,
@@ -24,55 +24,55 @@ const Q = st.createContext(
24
24
  } = R(), s = L(() => {
25
25
  switch (t == null ? void 0 : t.name) {
26
26
  case "maptiler":
27
- return at;
28
- case "google":
29
27
  return ct;
30
- case "mapbox":
28
+ case "google":
31
29
  return ut;
32
- default:
30
+ case "mapbox":
33
31
  return ht;
32
+ default:
33
+ return pt;
34
34
  }
35
35
  }, [t]);
36
36
  return /* @__PURE__ */ x(
37
37
  "div",
38
38
  {
39
- className: it,
39
+ className: at,
40
40
  "data-testid": "base-map",
41
41
  "data-map-provider-name": t == null ? void 0 : t.name,
42
- "data-map-provider-theme": t == null ? void 0 : t.theme,
43
- "data-zoom": r,
42
+ "data-map-provider-theme": (t == null ? void 0 : t.theme) || V[t == null ? void 0 : t.name] || V.maptiler,
43
+ "data-zoom": n,
44
44
  "data-pitch": o,
45
45
  "data-bearing": i,
46
46
  "data-cooperative-gestures": a,
47
47
  "data-zoom-position": u,
48
48
  "data-center-latitude": e.latitude,
49
49
  "data-center-longitude": e.longitude,
50
- children: /* @__PURE__ */ x(s, { children: n })
50
+ children: /* @__PURE__ */ x(s, { children: r })
51
51
  }
52
52
  );
53
53
  };
54
- function lt(n, t, e = {}) {
55
- const r = { type: "Feature" };
56
- return (e.id === 0 || e.id) && (r.id = e.id), e.bbox && (r.bbox = e.bbox), r.properties = t || {}, r.geometry = n, r;
54
+ function ft(r, t, e = {}) {
55
+ const n = { type: "Feature" };
56
+ return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = r, n;
57
57
  }
58
- function ft(n, t, e = {}) {
59
- if (!n)
58
+ function dt(r, t, e = {}) {
59
+ if (!r)
60
60
  throw new Error("coordinates is required");
61
- if (!Array.isArray(n))
61
+ if (!Array.isArray(r))
62
62
  throw new Error("coordinates must be an Array");
63
- if (n.length < 2)
63
+ if (r.length < 2)
64
64
  throw new Error("coordinates must be at least 2 numbers long");
65
- if (!V(n[0]) || !V(n[1]))
65
+ if (!k(r[0]) || !k(r[1]))
66
66
  throw new Error("coordinates must contain numbers");
67
- return lt({
67
+ return ft({
68
68
  type: "Point",
69
- coordinates: n
69
+ coordinates: r
70
70
  }, t, e);
71
71
  }
72
- function V(n) {
73
- return !isNaN(n) && n !== null && !Array.isArray(n);
72
+ function k(r) {
73
+ return !isNaN(r) && r !== null && !Array.isArray(r);
74
74
  }
75
- const k = [
75
+ const H = [
76
76
  Int8Array,
77
77
  Uint8Array,
78
78
  Uint8ClampedArray,
@@ -91,13 +91,13 @@ class D {
91
91
  static from(t) {
92
92
  if (!(t instanceof ArrayBuffer))
93
93
  throw new Error("Data must be an instance of ArrayBuffer.");
94
- const [e, r] = new Uint8Array(t, 0, 2);
94
+ const [e, n] = new Uint8Array(t, 0, 2);
95
95
  if (e !== 219)
96
96
  throw new Error("Data does not appear to be in a KDBush format.");
97
- const o = r >> 4;
97
+ const o = n >> 4;
98
98
  if (o !== C)
99
99
  throw new Error(`Got v${o} data when expected v${C}.`);
100
- const i = k[r & 15];
100
+ const i = H[n & 15];
101
101
  if (!i)
102
102
  throw new Error("Unrecognized array type.");
103
103
  const [a] = new Uint16Array(t, 2, 1), [u] = new Uint32Array(t, 4, 1);
@@ -110,12 +110,12 @@ class D {
110
110
  * @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
111
111
  * @param {ArrayBuffer} [data] (For internal use only)
112
112
  */
113
- constructor(t, e = 64, r = Float64Array, o) {
113
+ constructor(t, e = 64, n = Float64Array, o) {
114
114
  if (isNaN(t) || t < 0) throw new Error(`Unpexpected numItems value: ${t}.`);
115
- this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType = r, this.IndexArrayType = t < 65536 ? Uint16Array : Uint32Array;
116
- const i = k.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, u = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - u % 8) % 8;
115
+ this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType = n, this.IndexArrayType = t < 65536 ? Uint16Array : Uint32Array;
116
+ const i = H.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, u = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - u % 8) % 8;
117
117
  if (i < 0)
118
- throw new Error(`Unexpected typed array class: ${r}.`);
118
+ throw new Error(`Unexpected typed array class: ${n}.`);
119
119
  o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + u + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(O + a + u + s), this.ids = new this.IndexArrayType(this.data, O, t), this.coords = new this.ArrayType(this.data, O + u + s, t * 2), this._pos = 0, this._finished = !1, new Uint8Array(this.data, 0, 2).set([219, (C << 4) + i]), new Uint16Array(this.data, 2, 1)[0] = e, new Uint32Array(this.data, 4, 1)[0] = t);
120
120
  }
121
121
  /**
@@ -125,8 +125,8 @@ class D {
125
125
  * @returns {number} An incremental index associated with the added item (starting from `0`).
126
126
  */
127
127
  add(t, e) {
128
- const r = this._pos >> 1;
129
- return this.ids[r] = r, this.coords[this._pos++] = t, this.coords[this._pos++] = e, r;
128
+ const n = this._pos >> 1;
129
+ return this.ids[n] = n, this.coords[this._pos++] = t, this.coords[this._pos++] = e, n;
130
130
  }
131
131
  /**
132
132
  * Perform indexing of the added points.
@@ -145,7 +145,7 @@ class D {
145
145
  * @param {number} maxY
146
146
  * @returns {number[]} An array of indices correponding to the found items.
147
147
  */
148
- range(t, e, r, o) {
148
+ range(t, e, n, o) {
149
149
  if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
150
150
  const { ids: i, coords: a, nodeSize: u } = this, s = [0, i.length - 1, 0], c = [];
151
151
  for (; s.length; ) {
@@ -153,12 +153,12 @@ class D {
153
153
  if (h - l <= u) {
154
154
  for (let d = l; d <= h; d++) {
155
155
  const y = a[2 * d], M = a[2 * d + 1];
156
- y >= t && y <= r && M >= e && M <= o && c.push(i[d]);
156
+ y >= t && y <= n && M >= e && M <= o && c.push(i[d]);
157
157
  }
158
158
  continue;
159
159
  }
160
160
  const f = l + h >> 1, g = a[2 * f], m = a[2 * f + 1];
161
- g >= t && g <= r && m >= e && m <= o && c.push(i[f]), (p === 0 ? t <= g : e <= m) && (s.push(l), s.push(f - 1), s.push(1 - p)), (p === 0 ? r >= g : o >= m) && (s.push(f + 1), s.push(h), s.push(1 - p));
161
+ g >= t && g <= n && m >= e && m <= o && c.push(i[f]), (p === 0 ? t <= g : e <= m) && (s.push(l), s.push(f - 1), s.push(1 - p)), (p === 0 ? n >= g : o >= m) && (s.push(f + 1), s.push(h), s.push(1 - p));
162
162
  }
163
163
  return c;
164
164
  }
@@ -169,54 +169,54 @@ class D {
169
169
  * @param {number} r Query radius.
170
170
  * @returns {number[]} An array of indices correponding to the found items.
171
171
  */
172
- within(t, e, r) {
172
+ within(t, e, n) {
173
173
  if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
174
- const { ids: o, coords: i, nodeSize: a } = this, u = [0, o.length - 1, 0], s = [], c = r * r;
174
+ const { ids: o, coords: i, nodeSize: a } = this, u = [0, o.length - 1, 0], s = [], c = n * n;
175
175
  for (; u.length; ) {
176
176
  const p = u.pop() || 0, h = u.pop() || 0, l = u.pop() || 0;
177
177
  if (h - l <= a) {
178
178
  for (let d = l; d <= h; d++)
179
- H(i[2 * d], i[2 * d + 1], t, e) <= c && s.push(o[d]);
179
+ J(i[2 * d], i[2 * d + 1], t, e) <= c && s.push(o[d]);
180
180
  continue;
181
181
  }
182
182
  const f = l + h >> 1, g = i[2 * f], m = i[2 * f + 1];
183
- H(g, m, t, e) <= c && s.push(o[f]), (p === 0 ? t - r <= g : e - r <= m) && (u.push(l), u.push(f - 1), u.push(1 - p)), (p === 0 ? t + r >= g : e + r >= m) && (u.push(f + 1), u.push(h), u.push(1 - p));
183
+ J(g, m, t, e) <= c && s.push(o[f]), (p === 0 ? t - n <= g : e - n <= m) && (u.push(l), u.push(f - 1), u.push(1 - p)), (p === 0 ? t + n >= g : e + n >= m) && (u.push(f + 1), u.push(h), u.push(1 - p));
184
184
  }
185
185
  return s;
186
186
  }
187
187
  }
188
- function j(n, t, e, r, o, i) {
189
- if (o - r <= e) return;
190
- const a = r + o >> 1;
191
- X(n, t, a, r, o, i), j(n, t, e, r, a - 1, 1 - i), j(n, t, e, a + 1, o, 1 - i);
188
+ function j(r, t, e, n, o, i) {
189
+ if (o - n <= e) return;
190
+ const a = n + o >> 1;
191
+ tt(r, t, a, n, o, i), j(r, t, e, n, a - 1, 1 - i), j(r, t, e, a + 1, o, 1 - i);
192
192
  }
193
- function X(n, t, e, r, o, i) {
194
- for (; o > r; ) {
195
- if (o - r > 600) {
196
- const c = o - r + 1, p = e - r + 1, h = Math.log(c), l = 0.5 * Math.exp(2 * h / 3), f = 0.5 * Math.sqrt(h * l * (c - l) / c) * (p - c / 2 < 0 ? -1 : 1), g = Math.max(r, Math.floor(e - p * l / c + f)), m = Math.min(o, Math.floor(e + (c - p) * l / c + f));
197
- X(n, t, e, g, m, i);
193
+ function tt(r, t, e, n, o, i) {
194
+ for (; o > n; ) {
195
+ if (o - n > 600) {
196
+ const c = o - n + 1, p = e - n + 1, h = Math.log(c), l = 0.5 * Math.exp(2 * h / 3), f = 0.5 * Math.sqrt(h * l * (c - l) / c) * (p - c / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - p * l / c + f)), m = Math.min(o, Math.floor(e + (c - p) * l / c + f));
197
+ tt(r, t, e, g, m, i);
198
198
  }
199
199
  const a = t[2 * e + i];
200
- let u = r, s = o;
201
- for (P(n, t, r, e), t[2 * o + i] > a && P(n, t, r, o); u < s; ) {
202
- for (P(n, t, u, s), u++, s--; t[2 * u + i] < a; ) u++;
200
+ let u = n, s = o;
201
+ for (P(r, t, n, e), t[2 * o + i] > a && P(r, t, n, o); u < s; ) {
202
+ for (P(r, t, u, s), u++, s--; t[2 * u + i] < a; ) u++;
203
203
  for (; t[2 * s + i] > a; ) s--;
204
204
  }
205
- t[2 * r + i] === a ? P(n, t, r, s) : (s++, P(n, t, s, o)), s <= e && (r = s + 1), e <= s && (o = s - 1);
205
+ t[2 * n + i] === a ? P(r, t, n, s) : (s++, P(r, t, s, o)), s <= e && (n = s + 1), e <= s && (o = s - 1);
206
206
  }
207
207
  }
208
- function P(n, t, e, r) {
209
- U(n, e, r), U(t, 2 * e, 2 * r), U(t, 2 * e + 1, 2 * r + 1);
208
+ function P(r, t, e, n) {
209
+ U(r, e, n), U(t, 2 * e, 2 * n), U(t, 2 * e + 1, 2 * n + 1);
210
210
  }
211
- function U(n, t, e) {
212
- const r = n[t];
213
- n[t] = n[e], n[e] = r;
211
+ function U(r, t, e) {
212
+ const n = r[t];
213
+ r[t] = r[e], r[e] = n;
214
214
  }
215
- function H(n, t, e, r) {
216
- const o = n - e, i = t - r;
215
+ function J(r, t, e, n) {
216
+ const o = r - e, i = t - n;
217
217
  return o * o + i * i;
218
218
  }
219
- const dt = {
219
+ const gt = {
220
220
  minZoom: 0,
221
221
  // min zoom to generate clusters on
222
222
  maxZoom: 16,
@@ -237,15 +237,15 @@ const dt = {
237
237
  reduce: null,
238
238
  // (accumulated, props) => { accumulated.sum += props.sum; }
239
239
  // properties to use for individual points when running the reducer
240
- map: (n) => n
240
+ map: (r) => r
241
241
  // props => ({sum: props.my_value})
242
- }, J = Math.fround || /* @__PURE__ */ ((n) => (t) => (n[0] = +t, n[0]))(new Float32Array(1)), v = 2, E = 3, z = 4, A = 5, tt = 6;
243
- class gt {
242
+ }, K = Math.fround || /* @__PURE__ */ ((r) => (t) => (r[0] = +t, r[0]))(new Float32Array(1)), T = 2, E = 3, z = 4, A = 5, et = 6;
243
+ class mt {
244
244
  constructor(t) {
245
- this.options = Object.assign(Object.create(dt), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
245
+ this.options = Object.assign(Object.create(gt), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
246
246
  }
247
247
  load(t) {
248
- const { log: e, minZoom: r, maxZoom: o } = this.options;
248
+ const { log: e, minZoom: n, maxZoom: o } = this.options;
249
249
  e && console.time("total time");
250
250
  const i = `prepare ${t.length} points`;
251
251
  e && console.time(i), this.points = t;
@@ -253,7 +253,7 @@ class gt {
253
253
  for (let s = 0; s < t.length; s++) {
254
254
  const c = t[s];
255
255
  if (!c.geometry) continue;
256
- const [p, h] = c.geometry.coordinates, l = J(I(p)), f = J(B(h));
256
+ const [p, h] = c.geometry.coordinates, l = K(I(p)), f = K(B(h));
257
257
  a.push(
258
258
  l,
259
259
  f,
@@ -270,71 +270,71 @@ class gt {
270
270
  }
271
271
  let u = this.trees[o + 1] = this._createTree(a);
272
272
  e && console.timeEnd(i);
273
- for (let s = o; s >= r; s--) {
273
+ for (let s = o; s >= n; s--) {
274
274
  const c = +Date.now();
275
275
  u = this.trees[s] = this._createTree(this._cluster(u, s)), e && console.log("z%d: %d clusters in %dms", s, u.numItems, +Date.now() - c);
276
276
  }
277
277
  return e && console.timeEnd("total time"), this;
278
278
  }
279
279
  getClusters(t, e) {
280
- let r = ((t[0] + 180) % 360 + 360) % 360 - 180;
280
+ let n = ((t[0] + 180) % 360 + 360) % 360 - 180;
281
281
  const o = Math.max(-90, Math.min(90, t[1]));
282
282
  let i = t[2] === 180 ? 180 : ((t[2] + 180) % 360 + 360) % 360 - 180;
283
283
  const a = Math.max(-90, Math.min(90, t[3]));
284
284
  if (t[2] - t[0] >= 360)
285
- r = -180, i = 180;
286
- else if (r > i) {
287
- const h = this.getClusters([r, o, 180, a], e), l = this.getClusters([-180, o, i, a], e);
285
+ n = -180, i = 180;
286
+ else if (n > i) {
287
+ const h = this.getClusters([n, o, 180, a], e), l = this.getClusters([-180, o, i, a], e);
288
288
  return h.concat(l);
289
289
  }
290
- const u = this.trees[this._limitZoom(e)], s = u.range(I(r), B(a), I(i), B(o)), c = u.data, p = [];
290
+ const u = this.trees[this._limitZoom(e)], s = u.range(I(n), B(a), I(i), B(o)), c = u.data, p = [];
291
291
  for (const h of s) {
292
292
  const l = this.stride * h;
293
- p.push(c[l + A] > 1 ? K(c, l, this.clusterProps) : this.points[c[l + E]]);
293
+ p.push(c[l + A] > 1 ? W(c, l, this.clusterProps) : this.points[c[l + E]]);
294
294
  }
295
295
  return p;
296
296
  }
297
297
  getChildren(t) {
298
- const e = this._getOriginId(t), r = this._getOriginZoom(t), o = "No cluster with the specified id.", i = this.trees[r];
298
+ const e = this._getOriginId(t), n = this._getOriginZoom(t), o = "No cluster with the specified id.", i = this.trees[n];
299
299
  if (!i) throw new Error(o);
300
300
  const a = i.data;
301
301
  if (e * this.stride >= a.length) throw new Error(o);
302
- const u = this.options.radius / (this.options.extent * Math.pow(2, r - 1)), s = a[e * this.stride], c = a[e * this.stride + 1], p = i.within(s, c, u), h = [];
302
+ const u = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride], c = a[e * this.stride + 1], p = i.within(s, c, u), h = [];
303
303
  for (const l of p) {
304
304
  const f = l * this.stride;
305
- a[f + z] === t && h.push(a[f + A] > 1 ? K(a, f, this.clusterProps) : this.points[a[f + E]]);
305
+ a[f + z] === t && h.push(a[f + A] > 1 ? W(a, f, this.clusterProps) : this.points[a[f + E]]);
306
306
  }
307
307
  if (h.length === 0) throw new Error(o);
308
308
  return h;
309
309
  }
310
- getLeaves(t, e, r) {
311
- e = e || 10, r = r || 0;
310
+ getLeaves(t, e, n) {
311
+ e = e || 10, n = n || 0;
312
312
  const o = [];
313
- return this._appendLeaves(o, t, e, r, 0), o;
313
+ return this._appendLeaves(o, t, e, n, 0), o;
314
314
  }
315
- getTile(t, e, r) {
316
- const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: u } = this.options, s = u / a, c = (r - s) / i, p = (r + 1 + s) / i, h = {
315
+ getTile(t, e, n) {
316
+ const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: u } = this.options, s = u / a, c = (n - s) / i, p = (n + 1 + s) / i, h = {
317
317
  features: []
318
318
  };
319
319
  return this._addTileFeatures(
320
320
  o.range((e - s) / i, c, (e + 1 + s) / i, p),
321
321
  o.data,
322
322
  e,
323
- r,
323
+ n,
324
324
  i,
325
325
  h
326
326
  ), e === 0 && this._addTileFeatures(
327
327
  o.range(1 - s / i, c, 1, p),
328
328
  o.data,
329
329
  i,
330
- r,
330
+ n,
331
331
  i,
332
332
  h
333
333
  ), e === i - 1 && this._addTileFeatures(
334
334
  o.range(0, c, s / i, p),
335
335
  o.data,
336
336
  -1,
337
- r,
337
+ n,
338
338
  i,
339
339
  h
340
340
  ), h.features.length ? h : null;
@@ -342,31 +342,31 @@ class gt {
342
342
  getClusterExpansionZoom(t) {
343
343
  let e = this._getOriginZoom(t) - 1;
344
344
  for (; e <= this.options.maxZoom; ) {
345
- const r = this.getChildren(t);
346
- if (e++, r.length !== 1) break;
347
- t = r[0].properties.cluster_id;
345
+ const n = this.getChildren(t);
346
+ if (e++, n.length !== 1) break;
347
+ t = n[0].properties.cluster_id;
348
348
  }
349
349
  return e;
350
350
  }
351
- _appendLeaves(t, e, r, o, i) {
351
+ _appendLeaves(t, e, n, o, i) {
352
352
  const a = this.getChildren(e);
353
353
  for (const u of a) {
354
354
  const s = u.properties;
355
- if (s && s.cluster ? i + s.point_count <= o ? i += s.point_count : i = this._appendLeaves(t, s.cluster_id, r, o, i) : i < o ? i++ : t.push(u), t.length === r) break;
355
+ 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(u), t.length === n) break;
356
356
  }
357
357
  return i;
358
358
  }
359
359
  _createTree(t) {
360
360
  const e = new D(t.length / this.stride | 0, this.options.nodeSize, Float32Array);
361
- for (let r = 0; r < t.length; r += this.stride) e.add(t[r], t[r + 1]);
361
+ for (let n = 0; n < t.length; n += this.stride) e.add(t[n], t[n + 1]);
362
362
  return e.finish(), e.data = t, e;
363
363
  }
364
- _addTileFeatures(t, e, r, o, i, a) {
364
+ _addTileFeatures(t, e, n, o, i, a) {
365
365
  for (const u of t) {
366
366
  const s = u * this.stride, c = e[s + A] > 1;
367
367
  let p, h, l;
368
368
  if (c)
369
- p = et(e, s, this.clusterProps), h = e[s], l = e[s + 1];
369
+ p = nt(e, s, this.clusterProps), h = e[s], l = e[s + 1];
370
370
  else {
371
371
  const m = this.points[e[s + E]];
372
372
  p = m.properties;
@@ -376,7 +376,7 @@ class gt {
376
376
  const f = {
377
377
  type: 1,
378
378
  geometry: [[
379
- Math.round(this.options.extent * (h * i - r)),
379
+ Math.round(this.options.extent * (h * i - n)),
380
380
  Math.round(this.options.extent * (l * i - o))
381
381
  ]],
382
382
  tags: p
@@ -389,23 +389,23 @@ class gt {
389
389
  return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
390
390
  }
391
391
  _cluster(t, e) {
392
- const { radius: r, extent: o, reduce: i, minPoints: a } = this.options, u = r / (o * Math.pow(2, e)), s = t.data, c = [], p = this.stride;
392
+ const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, u = n / (o * Math.pow(2, e)), s = t.data, c = [], p = this.stride;
393
393
  for (let h = 0; h < s.length; h += p) {
394
- if (s[h + v] <= e) continue;
395
- s[h + v] = e;
394
+ if (s[h + T] <= e) continue;
395
+ s[h + T] = e;
396
396
  const l = s[h], f = s[h + 1], g = t.within(s[h], s[h + 1], u), m = s[h + A];
397
397
  let d = m;
398
398
  for (const y of g) {
399
399
  const M = y * p;
400
- s[M + v] > e && (d += s[M + A]);
400
+ s[M + T] > e && (d += s[M + A]);
401
401
  }
402
402
  if (d > m && d >= a) {
403
403
  let y = l * m, M = f * m, _, N = -1;
404
404
  const Z = ((h / p | 0) << 5) + (e + 1) + this.points.length;
405
405
  for (const rt of g) {
406
406
  const b = rt * p;
407
- if (s[b + v] <= e) continue;
408
- s[b + v] = e;
407
+ if (s[b + T] <= e) continue;
408
+ s[b + T] = e;
409
409
  const $ = s[b + A];
410
410
  y += s[b] * $, M += s[b + 1] * $, s[b + z] = Z, i && (_ || (_ = this._map(s, h, !0), N = this.clusterProps.length, this.clusterProps.push(_)), i(_, this._map(s, b)));
411
411
  }
@@ -415,8 +415,8 @@ class gt {
415
415
  if (d > 1)
416
416
  for (const y of g) {
417
417
  const M = y * p;
418
- if (!(s[M + v] <= e)) {
419
- s[M + v] = e;
418
+ if (!(s[M + T] <= e)) {
419
+ s[M + T] = e;
420
420
  for (let _ = 0; _ < p; _++) c.push(s[M + _]);
421
421
  }
422
422
  }
@@ -432,115 +432,115 @@ class gt {
432
432
  _getOriginZoom(t) {
433
433
  return (t - this.points.length) % 32;
434
434
  }
435
- _map(t, e, r) {
435
+ _map(t, e, n) {
436
436
  if (t[e + A] > 1) {
437
- const a = this.clusterProps[t[e + tt]];
438
- return r ? Object.assign({}, a) : a;
437
+ const a = this.clusterProps[t[e + et]];
438
+ return n ? Object.assign({}, a) : a;
439
439
  }
440
440
  const o = this.points[t[e + E]].properties, i = this.options.map(o);
441
- return r && i === o ? Object.assign({}, i) : i;
441
+ return n && i === o ? Object.assign({}, i) : i;
442
442
  }
443
443
  }
444
- function K(n, t, e) {
444
+ function W(r, t, e) {
445
445
  return {
446
446
  type: "Feature",
447
- id: n[t + E],
448
- properties: et(n, t, e),
447
+ id: r[t + E],
448
+ properties: nt(r, t, e),
449
449
  geometry: {
450
450
  type: "Point",
451
- coordinates: [mt(n[t]), yt(n[t + 1])]
451
+ coordinates: [yt(r[t]), wt(r[t + 1])]
452
452
  }
453
453
  };
454
454
  }
455
- function et(n, t, e) {
456
- const r = n[t + A], o = r >= 1e4 ? `${Math.round(r / 1e3)}k` : r >= 1e3 ? `${Math.round(r / 100) / 10}k` : r, i = n[t + tt], a = i === -1 ? {} : Object.assign({}, e[i]);
455
+ function nt(r, t, e) {
456
+ 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 + et], a = i === -1 ? {} : Object.assign({}, e[i]);
457
457
  return Object.assign(a, {
458
458
  cluster: !0,
459
- cluster_id: n[t + E],
460
- point_count: r,
459
+ cluster_id: r[t + E],
460
+ point_count: n,
461
461
  point_count_abbreviated: o
462
462
  });
463
463
  }
464
- function I(n) {
465
- return n / 360 + 0.5;
464
+ function I(r) {
465
+ return r / 360 + 0.5;
466
466
  }
467
- function B(n) {
468
- const t = Math.sin(n * Math.PI / 180), e = 0.5 - 0.25 * Math.log((1 + t) / (1 - t)) / Math.PI;
467
+ function B(r) {
468
+ const t = Math.sin(r * Math.PI / 180), e = 0.5 - 0.25 * Math.log((1 + t) / (1 - t)) / Math.PI;
469
469
  return e < 0 ? 0 : e > 1 ? 1 : e;
470
470
  }
471
- function mt(n) {
472
- return (n - 0.5) * 360;
471
+ function yt(r) {
472
+ return (r - 0.5) * 360;
473
473
  }
474
- function yt(n) {
475
- const t = (180 - n * 360) * Math.PI / 180;
474
+ function wt(r) {
475
+ const t = (180 - r * 360) * Math.PI / 180;
476
476
  return 360 * Math.atan(Math.exp(t)) / Math.PI - 90;
477
477
  }
478
- var W = Object.prototype.hasOwnProperty;
479
- function Y(n, t, e) {
480
- for (e of n.keys())
481
- if (T(e, t)) return e;
478
+ var Y = Object.prototype.hasOwnProperty;
479
+ function q(r, t, e) {
480
+ for (e of r.keys())
481
+ if (v(e, t)) return e;
482
482
  }
483
- function T(n, t) {
484
- var e, r, o;
485
- if (n === t) return !0;
486
- if (n && t && (e = n.constructor) === t.constructor) {
487
- if (e === Date) return n.getTime() === t.getTime();
488
- if (e === RegExp) return n.toString() === t.toString();
483
+ function v(r, t) {
484
+ var e, n, o;
485
+ if (r === t) return !0;
486
+ if (r && t && (e = r.constructor) === t.constructor) {
487
+ if (e === Date) return r.getTime() === t.getTime();
488
+ if (e === RegExp) return r.toString() === t.toString();
489
489
  if (e === Array) {
490
- if ((r = n.length) === t.length)
491
- for (; r-- && T(n[r], t[r]); ) ;
492
- return r === -1;
490
+ if ((n = r.length) === t.length)
491
+ for (; n-- && v(r[n], t[n]); ) ;
492
+ return n === -1;
493
493
  }
494
494
  if (e === Set) {
495
- if (n.size !== t.size)
495
+ if (r.size !== t.size)
496
496
  return !1;
497
- for (r of n)
498
- if (o = r, o && typeof o == "object" && (o = Y(t, o), !o) || !t.has(o)) return !1;
497
+ for (n of r)
498
+ if (o = n, o && typeof o == "object" && (o = q(t, o), !o) || !t.has(o)) return !1;
499
499
  return !0;
500
500
  }
501
501
  if (e === Map) {
502
- if (n.size !== t.size)
502
+ if (r.size !== t.size)
503
503
  return !1;
504
- for (r of n)
505
- if (o = r[0], o && typeof o == "object" && (o = Y(t, o), !o) || !T(r[1], t.get(o)))
504
+ for (n of r)
505
+ if (o = n[0], o && typeof o == "object" && (o = q(t, o), !o) || !v(n[1], t.get(o)))
506
506
  return !1;
507
507
  return !0;
508
508
  }
509
509
  if (e === ArrayBuffer)
510
- n = new Uint8Array(n), t = new Uint8Array(t);
510
+ r = new Uint8Array(r), t = new Uint8Array(t);
511
511
  else if (e === DataView) {
512
- if ((r = n.byteLength) === t.byteLength)
513
- for (; r-- && n.getInt8(r) === t.getInt8(r); ) ;
514
- return r === -1;
512
+ if ((n = r.byteLength) === t.byteLength)
513
+ for (; n-- && r.getInt8(n) === t.getInt8(n); ) ;
514
+ return n === -1;
515
515
  }
516
- if (ArrayBuffer.isView(n)) {
517
- if ((r = n.byteLength) === t.byteLength)
518
- for (; r-- && n[r] === t[r]; ) ;
519
- return r === -1;
516
+ if (ArrayBuffer.isView(r)) {
517
+ if ((n = r.byteLength) === t.byteLength)
518
+ for (; n-- && r[n] === t[n]; ) ;
519
+ return n === -1;
520
520
  }
521
- if (!e || typeof n == "object") {
522
- r = 0;
523
- for (e in n)
524
- if (W.call(n, e) && ++r && !W.call(t, e) || !(e in t) || !T(n[e], t[e])) return !1;
525
- return Object.keys(t).length === r;
521
+ if (!e || typeof r == "object") {
522
+ n = 0;
523
+ for (e in r)
524
+ if (Y.call(r, e) && ++n && !Y.call(t, e) || !(e in t) || !v(r[e], t[e])) return !1;
525
+ return Object.keys(t).length === n;
526
526
  }
527
527
  }
528
- return n !== n && t !== t;
528
+ return r !== r && t !== t;
529
529
  }
530
- function wt(n) {
531
- var t = F.useRef(n), e = F.useRef(0);
532
- return T(n, t.current) || (t.current = n, e.current += 1), F.useMemo(function() {
530
+ function Mt(r) {
531
+ var t = F.useRef(r), e = F.useRef(0);
532
+ return v(r, t.current) || (t.current = r, e.current += 1), F.useMemo(function() {
533
533
  return t.current;
534
534
  }, [e.current]);
535
535
  }
536
- function Mt(n, t) {
537
- return F.useEffect(n, wt(t));
536
+ function xt(r, t) {
537
+ return F.useEffect(r, Mt(t));
538
538
  }
539
- var xt = function(t) {
540
- var e = t.points, r = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, u = G(), s = G(), c = q([]), p = c[0], h = c[1], l = Math.round(o);
541
- return Mt(function() {
542
- a !== !0 && ((!u.current || !T(s.current, e) || !T(u.current.options, i)) && (u.current = new gt(i), u.current.load(e)), r && h(u.current.getClusters(r, l)), s.current = e);
543
- }, [e, r, l, i, a]), {
539
+ var _t = function(t) {
540
+ var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, u = G(), s = G(), c = Q([]), p = c[0], h = c[1], l = Math.round(o);
541
+ return xt(function() {
542
+ a !== !0 && ((!u.current || !v(s.current, e) || !v(u.current.options, i)) && (u.current = new mt(i), u.current.load(e)), n && h(u.current.getClusters(n, l)), s.current = e);
543
+ }, [e, n, l, i, a]), {
544
544
  clusters: p,
545
545
  supercluster: u.current
546
546
  };
@@ -555,7 +555,7 @@ const zt = `
555
555
  transition-transform
556
556
 
557
557
  data-[is-cluster=true]:w-auto
558
- `, _t = `
558
+ `, At = `
559
559
  cursor-pointer
560
560
  fill-primary-100
561
561
  stroke-1
@@ -577,9 +577,9 @@ const zt = `
577
577
  group-hover:text-primary-100
578
578
  group-hover:max-w-2.5
579
579
  group-hover:max-h-2.5
580
- `, At = w(() => import("./index-D0VvNlqV.js")), Et = w(() => import("./index-7D9tjwUD.js")), bt = w(() => import("./index-C7t1isWh.js")), vt = ({ markers: n, onClick: t, ...e }) => {
581
- const { mapProvider: r, bounds: o } = R(), { clusters: i, supercluster: a } = xt({
582
- points: n.map((c) => ft([c.longitude, c.latitude], c)),
580
+ `, Et = w(() => import("./index-92HhWupr.js")), bt = w(() => import("./index-ChwN5abO.js")), Tt = w(() => import("./index-D5-2anzJ.js")), vt = ({ markers: r, onClick: t, ...e }) => {
581
+ const { mapProvider: n, bounds: o } = R(), { clusters: i, supercluster: a } = _t({
582
+ points: r.map((c) => dt([c.longitude, c.latitude], c)),
583
583
  bounds: o,
584
584
  zoom: 16,
585
585
  options: { radius: 50, maxZoom: 30 }
@@ -603,70 +603,70 @@ const zt = `
603
603
  markers: [c.properties]
604
604
  });
605
605
  }, s = L(() => {
606
- switch (r == null ? void 0 : r.name) {
606
+ switch (n == null ? void 0 : n.name) {
607
607
  case "maptiler":
608
- return At;
609
- case "google":
610
608
  return Et;
611
- case "mapbox":
609
+ case "google":
612
610
  return bt;
611
+ case "mapbox":
612
+ return Tt;
613
613
  default:
614
614
  return null;
615
615
  }
616
- }, [r]);
617
- return s ? /* @__PURE__ */ x(nt, { children: /* @__PURE__ */ x(s, { clusters: i, onClick: u, ...e, children: /* @__PURE__ */ x("svg", { viewBox: "0 0 20 28", fill: "none", className: _t, children: /* @__PURE__ */ x(
616
+ }, [n]);
617
+ return s ? /* @__PURE__ */ x(st, { children: /* @__PURE__ */ x(s, { clusters: i, onClick: u, ...e, children: /* @__PURE__ */ x("svg", { viewBox: "0 0 20 28", fill: "none", className: At, children: /* @__PURE__ */ x(
618
618
  "path",
619
619
  {
620
620
  d: "M20 10C20 15.5228 12 27.5 10 27.5C8 27.5 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10Z",
621
621
  fill: "inherit"
622
622
  }
623
623
  ) }) }) }) : null;
624
- }, Tt = w(() => import("./index-J1MKzGEM.js")), Ot = w(() => import("./index-BZ2605rA.js")), Pt = w(() => import("./index-B43MtiHH.js"));
625
- function St({ children: n, ...t }) {
626
- const { mapProvider: e } = R(), r = L(() => {
624
+ }, Ot = w(() => import("./index-J1MKzGEM.js")), Pt = w(() => import("./index-BZ2605rA.js")), St = w(() => import("./index-B43MtiHH.js"));
625
+ function It({ children: r, ...t }) {
626
+ const { mapProvider: e } = R(), n = L(() => {
627
627
  switch (e == null ? void 0 : e.name) {
628
628
  case "maptiler":
629
- return Tt;
630
- case "google":
631
629
  return Ot;
632
- case "mapbox":
630
+ case "google":
633
631
  return Pt;
632
+ case "mapbox":
633
+ return St;
634
634
  default:
635
635
  return null;
636
636
  }
637
637
  }, [e]);
638
- return r ? /* @__PURE__ */ x(r, { ...t, children: n }) : null;
638
+ return n ? /* @__PURE__ */ x(n, { ...t, children: r }) : null;
639
639
  }
640
- const It = w(() => import("./index-CTk5bvm9.js")), Bt = w(() => import("./index-CPq7k7F4.js")), Ft = w(() => import("./index-DVitM43i.js"));
641
- function Lt(n) {
640
+ const Bt = w(() => import("./index-CTk5bvm9.js")), Ft = w(() => import("./index-CPq7k7F4.js")), Lt = w(() => import("./index-DVitM43i.js"));
641
+ function Rt(r) {
642
642
  const { mapProvider: t } = R(), e = L(() => {
643
643
  switch (t == null ? void 0 : t.name) {
644
644
  case "maptiler":
645
- return It;
646
- case "google":
647
645
  return Bt;
648
- case "mapbox":
646
+ case "google":
649
647
  return Ft;
648
+ case "mapbox":
649
+ return Lt;
650
650
  default:
651
651
  return null;
652
652
  }
653
653
  }, [t]);
654
- return e ? /* @__PURE__ */ x(e, { ...n }) : null;
654
+ return e ? /* @__PURE__ */ x(e, { ...r }) : null;
655
655
  }
656
- function Rt(n) {
657
- const [t, e] = q();
658
- return /* @__PURE__ */ x(Q.Provider, { value: { ...n, bounds: t, setBounds: e }, children: n.children });
656
+ function Zt(r) {
657
+ const [t, e] = Q();
658
+ return /* @__PURE__ */ x(X.Provider, { value: { ...r, bounds: t, setBounds: e }, children: r.children });
659
659
  }
660
660
  const Nt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
661
661
  __proto__: null,
662
- BaseMap: pt,
663
- Layers: Lt,
662
+ BaseMap: lt,
663
+ Layers: Rt,
664
664
  Markers: vt,
665
- Popup: St,
666
- Root: Rt
665
+ Popup: It,
666
+ Root: Zt
667
667
  }, Symbol.toStringTag, { value: "Module" }));
668
668
  export {
669
- Ut as a,
669
+ V as a,
670
670
  Dt as b,
671
671
  zt as c,
672
672
  S as d,