@local-logic/maps 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-B85VZGVP.js +56 -0
- package/dist/index-BRD3rjLE.js +138 -0
- package/dist/index-BpFpg_5A.js +78 -0
- package/dist/index-BrxP9NHZ.js +56 -0
- package/dist/{index-AcZakyxd.js → index-CN_dNOir.js} +168 -172
- package/dist/index-CRdDPWou.js +34 -0
- package/dist/{index-Dz1XJJEv.js → index-CSVsF1EQ.js} +28 -28
- package/dist/index-CceEGv05.js +104 -0
- package/dist/{index-DdYanSGw.js → index-CiWKwaC4.js} +2 -2
- package/dist/{index-6JzOJU8O.js → index-CmajMf1d.js} +21 -21
- package/dist/index-D5kHxP9H.js +43 -0
- package/dist/{index-29Y5fJR0.js → index-DNNz78Rc.js} +2 -2
- package/dist/index-Db33Ugg9.js +34 -0
- package/dist/index-DfhwDiOS.js +155 -0
- package/dist/index-arkRlpaR.js +80 -0
- package/dist/index-ufLC1PLO.js +57 -0
- package/dist/{index-Dxh7aMoG.js → index-vHMPqmOL.js} +2 -2
- package/dist/index.es.js +1 -1
- package/dist/{index.modern-fpUBOYPT.js → index.modern-B-ChKejQ.js} +9 -9
- package/dist/index.umd.js +115 -115
- package/dist/{logo-control-C5ZdRec5.js → logo-control-VgN6MEKI.js} +186 -206
- package/dist/{mapbox-gl-D6JObe4m.js → mapbox-gl-C6frO4Gl.js} +1877 -1877
- package/dist/{maplibre-gl-DDfJU6SR.js → maplibre-gl-DkDrZ6rP.js} +1230 -1228
- package/dist/{scale-control-Cflgzbvb.js → scale-control-jBKptTbw.js} +234 -252
- package/dist/style.css +1 -1
- package/dist/{styles-B8oT_wcC.js → styles-BR85tnqI.js} +16 -17
- package/package.json +2 -2
- package/dist/index-CHSsiFtN.js +0 -139
- package/dist/index-CqUTGwL0.js +0 -34
- package/dist/index-Cwn0dgP_.js +0 -56
- package/dist/index-D--WdzK4.js +0 -79
- package/dist/index-D1Phs0fA.js +0 -57
- package/dist/index-D1vI6Ww_.js +0 -43
- package/dist/index-DHHG0vNa.js +0 -157
- package/dist/index-DKFcZs0A.js +0 -81
- package/dist/index-DZTFM839.js +0 -105
- package/dist/index-_8n5sl1B.js +0 -56
- package/dist/index-_n1FGHXc.js +0 -34
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as O } from "react/jsx-runtime";
|
|
2
2
|
import * as U from "react";
|
|
3
|
-
import it, { useContext as at, useState as
|
|
4
|
-
const tt = it.createContext({}),
|
|
3
|
+
import it, { useContext as at, useState as L, useMemo as b, lazy as y, useRef as k, useEffect as ct } from "react";
|
|
4
|
+
const tt = it.createContext({}), I = () => at(tt), C = {
|
|
5
5
|
zoom: 14,
|
|
6
6
|
pitch: 0,
|
|
7
7
|
bearing: 0,
|
|
8
8
|
cooperativeGestures: !1
|
|
9
|
-
},
|
|
9
|
+
}, V = {
|
|
10
10
|
maptiler: "600d69cb-288d-445e-9839-3dfe4d76b31a",
|
|
11
11
|
mapbox: "locallogic/cmb9nz9kb011501ru8drq8fqf",
|
|
12
12
|
google: "a7ff20eb973126bb"
|
|
13
|
-
},
|
|
13
|
+
}, H = 13, ut = 22, Vt = 12.5, pt = 30, ht = 60, lt = "w-full h-full relative overflow-hidden", ft = y(() => import("./index-BpFpg_5A.js")), dt = y(() => import("./index-CceEGv05.js")), mt = y(() => import("./index-arkRlpaR.js")), gt = y(() => import("./index-qqbvBkdn.js")), yt = ({ padding: r = 1e-3, children: t }) => {
|
|
14
14
|
const {
|
|
15
15
|
mapProvider: e,
|
|
16
16
|
center: n,
|
|
17
|
-
zoom: o =
|
|
18
|
-
pitch: i =
|
|
19
|
-
bearing: a =
|
|
20
|
-
cooperativeGestures: c =
|
|
17
|
+
zoom: o = C.zoom,
|
|
18
|
+
pitch: i = C.pitch,
|
|
19
|
+
bearing: a = C.bearing,
|
|
20
|
+
cooperativeGestures: c = C.cooperativeGestures,
|
|
21
21
|
zoomPosition: s
|
|
22
|
-
} =
|
|
23
|
-
switch (e
|
|
22
|
+
} = I(), [p] = L(o), h = b(() => {
|
|
23
|
+
switch (e?.name) {
|
|
24
24
|
case "maptiler":
|
|
25
25
|
return ft;
|
|
26
26
|
case "google":
|
|
27
27
|
return dt;
|
|
28
28
|
case "mapbox":
|
|
29
|
-
return gt;
|
|
30
|
-
default:
|
|
31
29
|
return mt;
|
|
30
|
+
default:
|
|
31
|
+
return gt;
|
|
32
32
|
}
|
|
33
33
|
}, [e]);
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ O(
|
|
35
35
|
"div",
|
|
36
36
|
{
|
|
37
37
|
className: lt,
|
|
38
38
|
"data-testid": "base-map",
|
|
39
|
-
"data-map-provider-name": e
|
|
40
|
-
"data-map-provider-theme":
|
|
41
|
-
"data-initial-zoom":
|
|
39
|
+
"data-map-provider-name": e?.name,
|
|
40
|
+
"data-map-provider-theme": e?.theme || V[e?.name] || V.maptiler,
|
|
41
|
+
"data-initial-zoom": p,
|
|
42
42
|
"data-pitch": i,
|
|
43
43
|
"data-bearing": a,
|
|
44
44
|
"data-cooperative-gestures": c,
|
|
45
45
|
"data-zoom-position": s,
|
|
46
46
|
"data-center-latitude": n.latitude,
|
|
47
47
|
"data-center-longitude": n.longitude,
|
|
48
|
-
children: /* @__PURE__ */
|
|
48
|
+
children: /* @__PURE__ */ O(h, { padding: r, children: t })
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
|
-
}, wt =
|
|
51
|
+
}, wt = y(() => import("./index-vHMPqmOL.js")), Mt = y(() => import("./index-DNNz78Rc.js")), _t = y(() => import("./index-CiWKwaC4.js"));
|
|
52
52
|
function At(r) {
|
|
53
|
-
const { mapProvider: t } =
|
|
54
|
-
switch (t
|
|
53
|
+
const { mapProvider: t } = I(), e = b(() => {
|
|
54
|
+
switch (t?.name) {
|
|
55
55
|
case "maptiler":
|
|
56
56
|
return wt;
|
|
57
57
|
case "google":
|
|
@@ -62,7 +62,7 @@ function At(r) {
|
|
|
62
62
|
return null;
|
|
63
63
|
}
|
|
64
64
|
}, [t]);
|
|
65
|
-
return e ? /* @__PURE__ */
|
|
65
|
+
return e ? /* @__PURE__ */ O(e, { ...r }) : null;
|
|
66
66
|
}
|
|
67
67
|
function et(r, t, e = {}) {
|
|
68
68
|
const n = { type: "Feature" };
|
|
@@ -75,23 +75,23 @@ function xt(r, t, e = {}) {
|
|
|
75
75
|
throw new Error("coordinates must be an Array");
|
|
76
76
|
if (r.length < 2)
|
|
77
77
|
throw new Error("coordinates must be at least 2 numbers long");
|
|
78
|
-
if (!
|
|
78
|
+
if (!Y(r[0]) || !Y(r[1]))
|
|
79
79
|
throw new Error("coordinates must contain numbers");
|
|
80
80
|
return et({
|
|
81
81
|
type: "Point",
|
|
82
82
|
coordinates: r
|
|
83
83
|
}, t, e);
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function Ht(r, t, e = {}) {
|
|
86
86
|
return et({
|
|
87
87
|
type: "MultiPoint",
|
|
88
88
|
coordinates: r
|
|
89
89
|
}, t, e);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Y(r) {
|
|
92
92
|
return !isNaN(r) && r !== null && !Array.isArray(r);
|
|
93
93
|
}
|
|
94
|
-
const
|
|
94
|
+
const J = [
|
|
95
95
|
Int8Array,
|
|
96
96
|
Uint8Array,
|
|
97
97
|
Uint8ClampedArray,
|
|
@@ -101,7 +101,7 @@ const K = [
|
|
|
101
101
|
Uint32Array,
|
|
102
102
|
Float32Array,
|
|
103
103
|
Float64Array
|
|
104
|
-
], F = 1,
|
|
104
|
+
], F = 1, T = 8;
|
|
105
105
|
class j {
|
|
106
106
|
/**
|
|
107
107
|
* Creates an index from raw `ArrayBuffer` data.
|
|
@@ -116,7 +116,7 @@ class j {
|
|
|
116
116
|
const o = n >> 4;
|
|
117
117
|
if (o !== F)
|
|
118
118
|
throw new Error(`Got v${o} data when expected v${F}.`);
|
|
119
|
-
const i =
|
|
119
|
+
const i = J[n & 15];
|
|
120
120
|
if (!i)
|
|
121
121
|
throw new Error("Unrecognized array type.");
|
|
122
122
|
const [a] = new Uint16Array(t, 2, 1), [c] = new Uint32Array(t, 4, 1);
|
|
@@ -132,10 +132,10 @@ class j {
|
|
|
132
132
|
constructor(t, e = 64, n = Float64Array, o) {
|
|
133
133
|
if (isNaN(t) || t < 0) throw new Error(`Unpexpected numItems value: ${t}.`);
|
|
134
134
|
this.numItems = +t, this.nodeSize = Math.min(Math.max(+e, 2), 65535), this.ArrayType = n, this.IndexArrayType = t < 65536 ? Uint16Array : Uint32Array;
|
|
135
|
-
const i =
|
|
135
|
+
const i = J.indexOf(this.ArrayType), a = t * 2 * this.ArrayType.BYTES_PER_ELEMENT, c = t * this.IndexArrayType.BYTES_PER_ELEMENT, s = (8 - c % 8) % 8;
|
|
136
136
|
if (i < 0)
|
|
137
137
|
throw new Error(`Unexpected typed array class: ${n}.`);
|
|
138
|
-
o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data,
|
|
138
|
+
o && o instanceof ArrayBuffer ? (this.data = o, this.ids = new this.IndexArrayType(this.data, T, t), this.coords = new this.ArrayType(this.data, T + c + s, t * 2), this._pos = t * 2, this._finished = !0) : (this.data = new ArrayBuffer(T + a + c + s), this.ids = new this.IndexArrayType(this.data, T, t), this.coords = new this.ArrayType(this.data, T + 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);
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Add a point to the index.
|
|
@@ -166,20 +166,20 @@ class j {
|
|
|
166
166
|
*/
|
|
167
167
|
range(t, e, n, o) {
|
|
168
168
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
169
|
-
const { ids: i, coords: a, nodeSize: c } = this, s = [0, i.length - 1, 0],
|
|
169
|
+
const { ids: i, coords: a, nodeSize: c } = this, s = [0, i.length - 1, 0], p = [];
|
|
170
170
|
for (; s.length; ) {
|
|
171
|
-
const
|
|
171
|
+
const h = s.pop() || 0, u = s.pop() || 0, f = s.pop() || 0;
|
|
172
172
|
if (u - f <= c) {
|
|
173
|
-
for (let
|
|
174
|
-
const
|
|
175
|
-
|
|
173
|
+
for (let m = f; m <= u; m++) {
|
|
174
|
+
const w = a[2 * m], M = a[2 * m + 1];
|
|
175
|
+
w >= t && w <= n && M >= e && M <= o && p.push(i[m]);
|
|
176
176
|
}
|
|
177
177
|
continue;
|
|
178
178
|
}
|
|
179
|
-
const
|
|
180
|
-
|
|
179
|
+
const d = f + u >> 1, g = a[2 * d], l = a[2 * d + 1];
|
|
180
|
+
g >= t && g <= n && l >= e && l <= o && p.push(i[d]), (h === 0 ? t <= g : e <= l) && (s.push(f), s.push(d - 1), s.push(1 - h)), (h === 0 ? n >= g : o >= l) && (s.push(d + 1), s.push(u), s.push(1 - h));
|
|
181
181
|
}
|
|
182
|
-
return
|
|
182
|
+
return p;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* Search the index for items within a given radius.
|
|
@@ -190,16 +190,16 @@ class j {
|
|
|
190
190
|
*/
|
|
191
191
|
within(t, e, n) {
|
|
192
192
|
if (!this._finished) throw new Error("Data not yet indexed - call index.finish().");
|
|
193
|
-
const { ids: o, coords: i, nodeSize: a } = this, c = [0, o.length - 1, 0], s = [],
|
|
193
|
+
const { ids: o, coords: i, nodeSize: a } = this, c = [0, o.length - 1, 0], s = [], p = n * n;
|
|
194
194
|
for (; c.length; ) {
|
|
195
|
-
const
|
|
195
|
+
const h = c.pop() || 0, u = c.pop() || 0, f = c.pop() || 0;
|
|
196
196
|
if (u - f <= a) {
|
|
197
|
-
for (let
|
|
198
|
-
|
|
197
|
+
for (let m = f; m <= u; m++)
|
|
198
|
+
K(i[2 * m], i[2 * m + 1], t, e) <= p && s.push(o[m]);
|
|
199
199
|
continue;
|
|
200
200
|
}
|
|
201
|
-
const
|
|
202
|
-
|
|
201
|
+
const d = f + u >> 1, g = i[2 * d], l = i[2 * d + 1];
|
|
202
|
+
K(g, l, t, e) <= p && s.push(o[d]), (h === 0 ? t - n <= g : e - n <= l) && (c.push(f), c.push(d - 1), c.push(1 - h)), (h === 0 ? t + n >= g : e + n >= l) && (c.push(d + 1), c.push(u), c.push(1 - h));
|
|
203
203
|
}
|
|
204
204
|
return s;
|
|
205
205
|
}
|
|
@@ -212,26 +212,26 @@ function N(r, t, e, n, o, i) {
|
|
|
212
212
|
function nt(r, t, e, n, o, i) {
|
|
213
213
|
for (; o > n; ) {
|
|
214
214
|
if (o - n > 600) {
|
|
215
|
-
const
|
|
216
|
-
nt(r, t, e,
|
|
215
|
+
const p = o - n + 1, h = e - n + 1, u = Math.log(p), f = 0.5 * Math.exp(2 * u / 3), d = 0.5 * Math.sqrt(u * f * (p - f) / p) * (h - p / 2 < 0 ? -1 : 1), g = Math.max(n, Math.floor(e - h * f / p + d)), l = Math.min(o, Math.floor(e + (p - h) * f / p + d));
|
|
216
|
+
nt(r, t, e, g, l, i);
|
|
217
217
|
}
|
|
218
218
|
const a = t[2 * e + i];
|
|
219
219
|
let c = n, s = o;
|
|
220
|
-
for (
|
|
221
|
-
for (
|
|
220
|
+
for (S(r, t, n, e), t[2 * o + i] > a && S(r, t, n, o); c < s; ) {
|
|
221
|
+
for (S(r, t, c, s), c++, s--; t[2 * c + i] < a; ) c++;
|
|
222
222
|
for (; t[2 * s + i] > a; ) s--;
|
|
223
223
|
}
|
|
224
|
-
t[2 * n + i] === a ?
|
|
224
|
+
t[2 * n + i] === a ? S(r, t, n, s) : (s++, S(r, t, s, o)), s <= e && (n = s + 1), e <= s && (o = s - 1);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function S(r, t, e, n) {
|
|
228
228
|
z(r, e, n), z(t, 2 * e, 2 * n), z(t, 2 * e + 1, 2 * n + 1);
|
|
229
229
|
}
|
|
230
230
|
function z(r, t, e) {
|
|
231
231
|
const n = r[t];
|
|
232
232
|
r[t] = r[e], r[e] = n;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function K(r, t, e, n) {
|
|
235
235
|
const o = r - e, i = t - n;
|
|
236
236
|
return o * o + i * i;
|
|
237
237
|
}
|
|
@@ -258,8 +258,8 @@ const Et = {
|
|
|
258
258
|
// properties to use for individual points when running the reducer
|
|
259
259
|
map: (r) => r
|
|
260
260
|
// props => ({sum: props.my_value})
|
|
261
|
-
},
|
|
262
|
-
class
|
|
261
|
+
}, q = Math.fround || /* @__PURE__ */ ((r) => (t) => (r[0] = +t, r[0]))(new Float32Array(1)), P = 2, x = 3, D = 4, A = 5, rt = 6;
|
|
262
|
+
class Pt {
|
|
263
263
|
constructor(t) {
|
|
264
264
|
this.options = Object.assign(Object.create(Et), t), this.trees = new Array(this.options.maxZoom + 1), this.stride = this.options.reduce ? 7 : 6, this.clusterProps = [];
|
|
265
265
|
}
|
|
@@ -270,12 +270,12 @@ class Ot {
|
|
|
270
270
|
e && console.time(i), this.points = t;
|
|
271
271
|
const a = [];
|
|
272
272
|
for (let s = 0; s < t.length; s++) {
|
|
273
|
-
const
|
|
274
|
-
if (!
|
|
275
|
-
const [
|
|
273
|
+
const p = t[s];
|
|
274
|
+
if (!p.geometry) continue;
|
|
275
|
+
const [h, u] = p.geometry.coordinates, f = q(R(h)), d = q(Z(u));
|
|
276
276
|
a.push(
|
|
277
277
|
f,
|
|
278
|
-
|
|
278
|
+
d,
|
|
279
279
|
// projected point coordinates
|
|
280
280
|
1 / 0,
|
|
281
281
|
// the last zoom the point was processed at
|
|
@@ -290,8 +290,8 @@ class Ot {
|
|
|
290
290
|
let c = this.trees[o + 1] = this._createTree(a);
|
|
291
291
|
e && console.timeEnd(i);
|
|
292
292
|
for (let s = o; s >= n; s--) {
|
|
293
|
-
const
|
|
294
|
-
c = this.trees[s] = this._createTree(this._cluster(c, s)), e && console.log("z%d: %d clusters in %dms", s, c.numItems, +Date.now() -
|
|
293
|
+
const p = +Date.now();
|
|
294
|
+
c = this.trees[s] = this._createTree(this._cluster(c, s)), e && console.log("z%d: %d clusters in %dms", s, c.numItems, +Date.now() - p);
|
|
295
295
|
}
|
|
296
296
|
return e && console.timeEnd("total time"), this;
|
|
297
297
|
}
|
|
@@ -306,22 +306,22 @@ class Ot {
|
|
|
306
306
|
const u = this.getClusters([n, o, 180, a], e), f = this.getClusters([-180, o, i, a], e);
|
|
307
307
|
return u.concat(f);
|
|
308
308
|
}
|
|
309
|
-
const c = this.trees[this._limitZoom(e)], s = c.range(
|
|
309
|
+
const c = this.trees[this._limitZoom(e)], s = c.range(R(n), Z(a), R(i), Z(o)), p = c.data, h = [];
|
|
310
310
|
for (const u of s) {
|
|
311
311
|
const f = this.stride * u;
|
|
312
|
-
|
|
312
|
+
h.push(p[f + A] > 1 ? Q(p, f, this.clusterProps) : this.points[p[f + x]]);
|
|
313
313
|
}
|
|
314
|
-
return
|
|
314
|
+
return h;
|
|
315
315
|
}
|
|
316
316
|
getChildren(t) {
|
|
317
317
|
const e = this._getOriginId(t), n = this._getOriginZoom(t), o = "No cluster with the specified id.", i = this.trees[n];
|
|
318
318
|
if (!i) throw new Error(o);
|
|
319
319
|
const a = i.data;
|
|
320
320
|
if (e * this.stride >= a.length) throw new Error(o);
|
|
321
|
-
const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride],
|
|
322
|
-
for (const f of
|
|
323
|
-
const
|
|
324
|
-
a[
|
|
321
|
+
const c = this.options.radius / (this.options.extent * Math.pow(2, n - 1)), s = a[e * this.stride], p = a[e * this.stride + 1], h = i.within(s, p, c), u = [];
|
|
322
|
+
for (const f of h) {
|
|
323
|
+
const d = f * this.stride;
|
|
324
|
+
a[d + D] === t && u.push(a[d + A] > 1 ? Q(a, d, this.clusterProps) : this.points[a[d + x]]);
|
|
325
325
|
}
|
|
326
326
|
if (u.length === 0) throw new Error(o);
|
|
327
327
|
return u;
|
|
@@ -332,25 +332,25 @@ class Ot {
|
|
|
332
332
|
return this._appendLeaves(o, t, e, n, 0), o;
|
|
333
333
|
}
|
|
334
334
|
getTile(t, e, n) {
|
|
335
|
-
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a,
|
|
335
|
+
const o = this.trees[this._limitZoom(t)], i = Math.pow(2, t), { extent: a, radius: c } = this.options, s = c / a, p = (n - s) / i, h = (n + 1 + s) / i, u = {
|
|
336
336
|
features: []
|
|
337
337
|
};
|
|
338
338
|
return this._addTileFeatures(
|
|
339
|
-
o.range((e - s) / i,
|
|
339
|
+
o.range((e - s) / i, p, (e + 1 + s) / i, h),
|
|
340
340
|
o.data,
|
|
341
341
|
e,
|
|
342
342
|
n,
|
|
343
343
|
i,
|
|
344
344
|
u
|
|
345
345
|
), e === 0 && this._addTileFeatures(
|
|
346
|
-
o.range(1 - s / i,
|
|
346
|
+
o.range(1 - s / i, p, 1, h),
|
|
347
347
|
o.data,
|
|
348
348
|
i,
|
|
349
349
|
n,
|
|
350
350
|
i,
|
|
351
351
|
u
|
|
352
352
|
), e === i - 1 && this._addTileFeatures(
|
|
353
|
-
o.range(0,
|
|
353
|
+
o.range(0, p, s / i, h),
|
|
354
354
|
o.data,
|
|
355
355
|
-1,
|
|
356
356
|
n,
|
|
@@ -382,66 +382,66 @@ class Ot {
|
|
|
382
382
|
}
|
|
383
383
|
_addTileFeatures(t, e, n, o, i, a) {
|
|
384
384
|
for (const c of t) {
|
|
385
|
-
const s = c * this.stride,
|
|
386
|
-
let
|
|
387
|
-
if (
|
|
388
|
-
|
|
385
|
+
const s = c * this.stride, p = e[s + A] > 1;
|
|
386
|
+
let h, u, f;
|
|
387
|
+
if (p)
|
|
388
|
+
h = st(e, s, this.clusterProps), u = e[s], f = e[s + 1];
|
|
389
389
|
else {
|
|
390
390
|
const l = this.points[e[s + x]];
|
|
391
|
-
|
|
392
|
-
const [
|
|
393
|
-
u =
|
|
391
|
+
h = l.properties;
|
|
392
|
+
const [m, w] = l.geometry.coordinates;
|
|
393
|
+
u = R(m), f = Z(w);
|
|
394
394
|
}
|
|
395
|
-
const
|
|
395
|
+
const d = {
|
|
396
396
|
type: 1,
|
|
397
397
|
geometry: [[
|
|
398
398
|
Math.round(this.options.extent * (u * i - n)),
|
|
399
399
|
Math.round(this.options.extent * (f * i - o))
|
|
400
400
|
]],
|
|
401
|
-
tags:
|
|
401
|
+
tags: h
|
|
402
402
|
};
|
|
403
|
-
let
|
|
404
|
-
|
|
403
|
+
let g;
|
|
404
|
+
p || this.options.generateId ? g = e[s + x] : g = this.points[e[s + x]].id, g !== void 0 && (d.id = g), a.features.push(d);
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
_limitZoom(t) {
|
|
408
408
|
return Math.max(this.options.minZoom, Math.min(Math.floor(+t), this.options.maxZoom + 1));
|
|
409
409
|
}
|
|
410
410
|
_cluster(t, e) {
|
|
411
|
-
const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, c = n / (o * Math.pow(2, e)), s = t.data,
|
|
412
|
-
for (let u = 0; u < s.length; u +=
|
|
413
|
-
if (s[u +
|
|
414
|
-
s[u +
|
|
415
|
-
const f = s[u],
|
|
416
|
-
let
|
|
417
|
-
for (const
|
|
418
|
-
const M =
|
|
419
|
-
s[M +
|
|
411
|
+
const { radius: n, extent: o, reduce: i, minPoints: a } = this.options, c = n / (o * Math.pow(2, e)), s = t.data, p = [], h = this.stride;
|
|
412
|
+
for (let u = 0; u < s.length; u += h) {
|
|
413
|
+
if (s[u + P] <= e) continue;
|
|
414
|
+
s[u + P] = e;
|
|
415
|
+
const f = s[u], d = s[u + 1], g = t.within(s[u], s[u + 1], c), l = s[u + A];
|
|
416
|
+
let m = l;
|
|
417
|
+
for (const w of g) {
|
|
418
|
+
const M = w * h;
|
|
419
|
+
s[M + P] > e && (m += s[M + A]);
|
|
420
420
|
}
|
|
421
|
-
if (
|
|
422
|
-
let
|
|
423
|
-
const B = ((u /
|
|
424
|
-
for (const ot of
|
|
425
|
-
const E = ot *
|
|
426
|
-
if (s[E +
|
|
427
|
-
s[E +
|
|
421
|
+
if (m > l && m >= a) {
|
|
422
|
+
let w = f * l, M = d * l, _, G = -1;
|
|
423
|
+
const B = ((u / h | 0) << 5) + (e + 1) + this.points.length;
|
|
424
|
+
for (const ot of g) {
|
|
425
|
+
const E = ot * h;
|
|
426
|
+
if (s[E + P] <= e) continue;
|
|
427
|
+
s[E + P] = e;
|
|
428
428
|
const $ = s[E + A];
|
|
429
|
-
|
|
429
|
+
w += s[E] * $, M += s[E + 1] * $, s[E + D] = B, i && (_ || (_ = this._map(s, u, !0), G = this.clusterProps.length, this.clusterProps.push(_)), i(_, this._map(s, E)));
|
|
430
430
|
}
|
|
431
|
-
s[u + D] = B,
|
|
431
|
+
s[u + D] = B, p.push(w / m, M / m, 1 / 0, B, -1, m), i && p.push(G);
|
|
432
432
|
} else {
|
|
433
|
-
for (let
|
|
434
|
-
if (
|
|
435
|
-
for (const
|
|
436
|
-
const M =
|
|
437
|
-
if (!(s[M +
|
|
438
|
-
s[M +
|
|
439
|
-
for (let _ = 0; _ <
|
|
433
|
+
for (let w = 0; w < h; w++) p.push(s[u + w]);
|
|
434
|
+
if (m > 1)
|
|
435
|
+
for (const w of g) {
|
|
436
|
+
const M = w * h;
|
|
437
|
+
if (!(s[M + P] <= e)) {
|
|
438
|
+
s[M + P] = e;
|
|
439
|
+
for (let _ = 0; _ < h; _++) p.push(s[M + _]);
|
|
440
440
|
}
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
return
|
|
444
|
+
return p;
|
|
445
445
|
}
|
|
446
446
|
// get index of the point from which the cluster originated
|
|
447
447
|
_getOriginId(t) {
|
|
@@ -460,14 +460,14 @@ class Ot {
|
|
|
460
460
|
return n && i === o ? Object.assign({}, i) : i;
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
function
|
|
463
|
+
function Q(r, t, e) {
|
|
464
464
|
return {
|
|
465
465
|
type: "Feature",
|
|
466
466
|
id: r[t + x],
|
|
467
467
|
properties: st(r, t, e),
|
|
468
468
|
geometry: {
|
|
469
469
|
type: "Point",
|
|
470
|
-
coordinates: [
|
|
470
|
+
coordinates: [vt(r[t]), Ot(r[t + 1])]
|
|
471
471
|
}
|
|
472
472
|
};
|
|
473
473
|
}
|
|
@@ -480,26 +480,26 @@ function st(r, t, e) {
|
|
|
480
480
|
point_count_abbreviated: o
|
|
481
481
|
});
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function R(r) {
|
|
484
484
|
return r / 360 + 0.5;
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Z(r) {
|
|
487
487
|
const t = Math.sin(r * Math.PI / 180), e = 0.5 - 0.25 * Math.log((1 + t) / (1 - t)) / Math.PI;
|
|
488
488
|
return e < 0 ? 0 : e > 1 ? 1 : e;
|
|
489
489
|
}
|
|
490
|
-
function
|
|
490
|
+
function vt(r) {
|
|
491
491
|
return (r - 0.5) * 360;
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function Ot(r) {
|
|
494
494
|
const t = (180 - r * 360) * Math.PI / 180;
|
|
495
495
|
return 360 * Math.atan(Math.exp(t)) / Math.PI - 90;
|
|
496
496
|
}
|
|
497
|
-
var
|
|
497
|
+
var W = Object.prototype.hasOwnProperty;
|
|
498
498
|
function X(r, t, e) {
|
|
499
499
|
for (e of r.keys())
|
|
500
|
-
if (
|
|
500
|
+
if (v(e, t)) return e;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function v(r, t) {
|
|
503
503
|
var e, n, o;
|
|
504
504
|
if (r === t) return !0;
|
|
505
505
|
if (r && t && (e = r.constructor) === t.constructor) {
|
|
@@ -507,7 +507,7 @@ function b(r, t) {
|
|
|
507
507
|
if (e === RegExp) return r.toString() === t.toString();
|
|
508
508
|
if (e === Array) {
|
|
509
509
|
if ((n = r.length) === t.length)
|
|
510
|
-
for (; n-- &&
|
|
510
|
+
for (; n-- && v(r[n], t[n]); ) ;
|
|
511
511
|
return n === -1;
|
|
512
512
|
}
|
|
513
513
|
if (e === Set) {
|
|
@@ -521,7 +521,7 @@ function b(r, t) {
|
|
|
521
521
|
if (r.size !== t.size)
|
|
522
522
|
return !1;
|
|
523
523
|
for (n of r)
|
|
524
|
-
if (o = n[0], o && typeof o == "object" && (o = X(t, o), !o) || !
|
|
524
|
+
if (o = n[0], o && typeof o == "object" && (o = X(t, o), !o) || !v(n[1], t.get(o)))
|
|
525
525
|
return !1;
|
|
526
526
|
return !0;
|
|
527
527
|
}
|
|
@@ -540,101 +540,97 @@ function b(r, t) {
|
|
|
540
540
|
if (!e || typeof r == "object") {
|
|
541
541
|
n = 0;
|
|
542
542
|
for (e in r)
|
|
543
|
-
if (
|
|
543
|
+
if (W.call(r, e) && ++n && !W.call(t, e) || !(e in t) || !v(r[e], t[e])) return !1;
|
|
544
544
|
return Object.keys(t).length === n;
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
return r !== r && t !== t;
|
|
548
548
|
}
|
|
549
|
-
function
|
|
549
|
+
function bt(r) {
|
|
550
550
|
var t = U.useRef(r), e = U.useRef(0);
|
|
551
|
-
return
|
|
551
|
+
return v(r, t.current) || (t.current = r, e.current += 1), U.useMemo(function() {
|
|
552
552
|
return t.current;
|
|
553
553
|
}, [e.current]);
|
|
554
554
|
}
|
|
555
|
-
function
|
|
556
|
-
return U.useEffect(r,
|
|
555
|
+
function Tt(r, t) {
|
|
556
|
+
return U.useEffect(r, bt(t));
|
|
557
557
|
}
|
|
558
|
-
var
|
|
559
|
-
var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, c =
|
|
560
|
-
return
|
|
561
|
-
a !== !0 && ((!c.current || !
|
|
558
|
+
var St = function(t) {
|
|
559
|
+
var e = t.points, n = t.bounds, o = t.zoom, i = t.options, a = t.disableRefresh, c = k(), s = k(), p = L([]), h = p[0], u = p[1], f = Math.round(o);
|
|
560
|
+
return Tt(function() {
|
|
561
|
+
a !== !0 && ((!c.current || !v(s.current, e) || !v(c.current.options, i)) && (c.current = new Pt(i), c.current.load(e)), n && u(c.current.getClusters(n, f)), s.current = e);
|
|
562
562
|
}, [e, n, f, i, a]), {
|
|
563
|
-
clusters:
|
|
563
|
+
clusters: h,
|
|
564
564
|
supercluster: c.current
|
|
565
565
|
};
|
|
566
566
|
};
|
|
567
|
-
const
|
|
568
|
-
function
|
|
569
|
-
const { mapProvider: n, activeMarker: o, center: i, bounds: a, zoom: c, setMarkerPoints: s } =
|
|
567
|
+
const Ct = y(() => import("./index-BrxP9NHZ.js")), Lt = y(() => import("./index-ufLC1PLO.js")), It = y(() => import("./index-B85VZGVP.js"));
|
|
568
|
+
function Rt({ markers: r, onClick: t, ...e }) {
|
|
569
|
+
const { mapProvider: n, activeMarker: o, center: i, bounds: a, zoom: c, setMarkerPoints: s } = I();
|
|
570
570
|
ct(() => {
|
|
571
571
|
let l = [[i.latitude, i.longitude]];
|
|
572
572
|
r.length > 0 && (l = l.concat(
|
|
573
|
-
r.map((
|
|
573
|
+
r.map((m) => [m.latitude, m.longitude])
|
|
574
574
|
)), s(l);
|
|
575
575
|
}, [r, i]);
|
|
576
|
-
const
|
|
576
|
+
const p = b(
|
|
577
577
|
() => ({
|
|
578
578
|
points: r.map((l) => xt([l.longitude, l.latitude], l)),
|
|
579
579
|
bounds: a,
|
|
580
580
|
zoom: c,
|
|
581
581
|
options: {
|
|
582
|
-
radius: n.name === "google" && c >
|
|
583
|
-
minZoom:
|
|
582
|
+
radius: n.name === "google" && c > H ? ht : pt,
|
|
583
|
+
minZoom: H,
|
|
584
584
|
maxZoom: ut
|
|
585
585
|
}
|
|
586
586
|
}),
|
|
587
587
|
[r, n, a, c]
|
|
588
|
-
), { clusters:
|
|
589
|
-
var d, y, M;
|
|
588
|
+
), { clusters: h, supercluster: u } = St(p), f = (l) => {
|
|
590
589
|
if (!("properties" in l))
|
|
591
590
|
throw new Error("Cluster does not have properties");
|
|
592
|
-
if (
|
|
593
|
-
t
|
|
591
|
+
if (l.properties?.cluster && typeof l.properties?.cluster_id == "number") {
|
|
592
|
+
t?.({
|
|
594
593
|
id: `${l.properties.cluster_id}`,
|
|
595
594
|
latitude: l.geometry.coordinates[1],
|
|
596
595
|
longitude: l.geometry.coordinates[0],
|
|
597
|
-
markers:
|
|
596
|
+
markers: u?.getLeaves(l.properties.cluster_id)?.map((m) => m.properties) ?? []
|
|
598
597
|
});
|
|
599
598
|
return;
|
|
600
599
|
}
|
|
601
|
-
t
|
|
600
|
+
t?.({
|
|
602
601
|
id: l.properties.id,
|
|
603
602
|
latitude: l.properties.latitude,
|
|
604
603
|
longitude: l.properties.longitude,
|
|
605
604
|
markers: [l.properties]
|
|
606
605
|
});
|
|
607
|
-
},
|
|
608
|
-
|
|
609
|
-
return !u || !o ? !1 : o.id === `${l}` ? !0 : ((d = u.getLeaves(l)) == null ? void 0 : d.find((y) => y.properties.id === o.id)) !== void 0;
|
|
610
|
-
}, m = P(() => {
|
|
611
|
-
switch (n == null ? void 0 : n.name) {
|
|
606
|
+
}, d = (l) => !u || !o ? !1 : o.id === `${l}` ? !0 : u.getLeaves(l)?.find((m) => m.properties.id === o.id) !== void 0, g = b(() => {
|
|
607
|
+
switch (n?.name) {
|
|
612
608
|
case "maptiler":
|
|
613
|
-
return
|
|
609
|
+
return Ct;
|
|
614
610
|
case "google":
|
|
615
|
-
return
|
|
611
|
+
return Lt;
|
|
616
612
|
case "mapbox":
|
|
617
|
-
return
|
|
613
|
+
return It;
|
|
618
614
|
default:
|
|
619
615
|
return null;
|
|
620
616
|
}
|
|
621
617
|
}, [n]);
|
|
622
|
-
return
|
|
623
|
-
|
|
618
|
+
return g ? /* @__PURE__ */ O(
|
|
619
|
+
g,
|
|
624
620
|
{
|
|
625
|
-
clusters:
|
|
621
|
+
clusters: h,
|
|
626
622
|
onClick: f,
|
|
627
|
-
doesSuperclusterContainActiveMarker:
|
|
623
|
+
doesSuperclusterContainActiveMarker: d,
|
|
628
624
|
...e
|
|
629
625
|
}
|
|
630
626
|
) : null;
|
|
631
627
|
}
|
|
632
|
-
const
|
|
628
|
+
const Zt = y(() => import("./index-CRdDPWou.js")), Ut = y(() => import("./index-D5kHxP9H.js")), Bt = y(() => import("./index-Db33Ugg9.js"));
|
|
633
629
|
function Ft({ children: r, anchor: t = "bottom", ...e }) {
|
|
634
|
-
const { mapProvider: n } =
|
|
635
|
-
switch (n
|
|
630
|
+
const { mapProvider: n } = I(), o = b(() => {
|
|
631
|
+
switch (n?.name) {
|
|
636
632
|
case "maptiler":
|
|
637
|
-
return
|
|
633
|
+
return Zt;
|
|
638
634
|
case "google":
|
|
639
635
|
return Ut;
|
|
640
636
|
case "mapbox":
|
|
@@ -643,12 +639,12 @@ function Ft({ children: r, anchor: t = "bottom", ...e }) {
|
|
|
643
639
|
return null;
|
|
644
640
|
}
|
|
645
641
|
}, [n]);
|
|
646
|
-
return o ? /* @__PURE__ */
|
|
642
|
+
return o ? /* @__PURE__ */ O(o, { ...e, anchor: t, children: r }) : null;
|
|
647
643
|
}
|
|
648
|
-
const zt =
|
|
644
|
+
const zt = y(() => import("./index-DfhwDiOS.js")), Dt = y(() => import("./index-CSVsF1EQ.js")), Nt = y(() => import("./index-BRD3rjLE.js"));
|
|
649
645
|
function jt(r) {
|
|
650
|
-
const { mapProvider: t } =
|
|
651
|
-
switch (t
|
|
646
|
+
const { mapProvider: t } = I(), e = b(() => {
|
|
647
|
+
switch (t?.name) {
|
|
652
648
|
case "maptiler":
|
|
653
649
|
return zt;
|
|
654
650
|
case "google":
|
|
@@ -659,11 +655,11 @@ function jt(r) {
|
|
|
659
655
|
return null;
|
|
660
656
|
}
|
|
661
657
|
}, [t]);
|
|
662
|
-
return e ? /* @__PURE__ */
|
|
658
|
+
return e ? /* @__PURE__ */ O(e, { ...r }) : null;
|
|
663
659
|
}
|
|
664
660
|
function Gt(r) {
|
|
665
|
-
const [t, e] =
|
|
666
|
-
return /* @__PURE__ */
|
|
661
|
+
const [t, e] = L([]), [n, o] = L(r.zoom || C.zoom), [i, a] = L();
|
|
662
|
+
return /* @__PURE__ */ O(
|
|
667
663
|
tt.Provider,
|
|
668
664
|
{
|
|
669
665
|
value: { ...r, markerPoints: t, setMarkerPoints: e, bounds: i, setBounds: a, zoom: n, setZoom: o },
|
|
@@ -671,20 +667,20 @@ function Gt(r) {
|
|
|
671
667
|
}
|
|
672
668
|
);
|
|
673
669
|
}
|
|
674
|
-
const
|
|
670
|
+
const Yt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
675
671
|
__proto__: null,
|
|
676
672
|
BaseMap: yt,
|
|
677
673
|
CenterPin: At,
|
|
678
674
|
Layers: jt,
|
|
679
|
-
Markers:
|
|
675
|
+
Markers: Rt,
|
|
680
676
|
Popup: Ft,
|
|
681
677
|
Root: Gt
|
|
682
678
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
683
679
|
export {
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
680
|
+
Vt as M,
|
|
681
|
+
V as a,
|
|
682
|
+
C as d,
|
|
683
|
+
Yt as i,
|
|
684
|
+
Ht as m,
|
|
685
|
+
I as u
|
|
690
686
|
};
|