@teritorio/openstreetmap-logical-history-component 0.2.0

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.js ADDED
@@ -0,0 +1,2296 @@
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createVNode as o, customRef as s, defineComponent as c, getCurrentInstance as l, getCurrentScope as u, guardReactiveProps as d, inject as f, mergeProps as p, nextTick as m, normalizeClass as h, normalizeProps as g, onMounted as _, onScopeDispose as v, openBlock as y, provide as b, readonly as x, ref as S, renderList as C, renderSlot as w, shallowRef as T, toDisplayString as E, toRef as D, toValue as O, unref as k, useCssVars as A, useId as ee, useTemplateRef as te, watch as j, withCtx as M, withDirectives as ne, withModifiers as N } from "vue";
2
+ import re from "maplibre-gl";
3
+ //#region \0rolldown/runtime.js
4
+ var ie = Object.create, ae = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, se = Object.getOwnPropertyNames, ce = Object.getPrototypeOf, le = Object.prototype.hasOwnProperty, ue = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), de = (e, t, n, r) => {
5
+ if (t && typeof t == "object" || typeof t == "function") for (var i = se(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !le.call(e, s) && s !== n && ae(e, s, {
6
+ get: ((e) => t[e]).bind(null, s),
7
+ enumerable: !(r = oe(t, s)) || r.enumerable
8
+ });
9
+ return e;
10
+ }, fe = (e, t, n) => (n = e == null ? {} : ie(ce(e)), de(t || !e || !e.__esModule ? ae(n, "default", {
11
+ value: e,
12
+ enumerable: !0
13
+ }) : n, e)), P = 6371008.8, pe = {
14
+ centimeters: P * 100,
15
+ centimetres: P * 100,
16
+ degrees: 360 / (2 * Math.PI),
17
+ feet: P * 3.28084,
18
+ inches: P * 39.37,
19
+ kilometers: P / 1e3,
20
+ kilometres: P / 1e3,
21
+ meters: P,
22
+ metres: P,
23
+ miles: P / 1609.344,
24
+ millimeters: P * 1e3,
25
+ millimetres: P * 1e3,
26
+ nauticalmiles: P / 1852,
27
+ radians: 1,
28
+ yards: P * 1.0936
29
+ };
30
+ function F(e, t, n = {}) {
31
+ let r = { type: "Feature" };
32
+ return (n.id === 0 || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = t || {}, r.geometry = e, r;
33
+ }
34
+ function me(e, t, n = {}) {
35
+ if (!e) throw Error("coordinates is required");
36
+ if (!Array.isArray(e)) throw Error("coordinates must be an Array");
37
+ if (e.length < 2) throw Error("coordinates must be at least 2 numbers long");
38
+ if (!be(e[0]) || !be(e[1])) throw Error("coordinates must contain numbers");
39
+ return F({
40
+ type: "Point",
41
+ coordinates: e
42
+ }, t, n);
43
+ }
44
+ function he(e, t, n = {}) {
45
+ for (let t of e) {
46
+ if (t.length < 4) throw Error("Each LinearRing of a Polygon must have 4 or more Positions.");
47
+ if (t[t.length - 1].length !== t[0].length) throw Error("First and last Position are not equivalent.");
48
+ for (let e = 0; e < t[t.length - 1].length; e++) if (t[t.length - 1][e] !== t[0][e]) throw Error("First and last Position are not equivalent.");
49
+ }
50
+ return F({
51
+ type: "Polygon",
52
+ coordinates: e
53
+ }, t, n);
54
+ }
55
+ function I(e, t, n = {}) {
56
+ if (e.length < 2) throw Error("coordinates must be an array of two or more positions");
57
+ return F({
58
+ type: "LineString",
59
+ coordinates: e
60
+ }, t, n);
61
+ }
62
+ function L(e, t = {}) {
63
+ let n = { type: "FeatureCollection" };
64
+ return t.id && (n.id = t.id), t.bbox && (n.bbox = t.bbox), n.features = e, n;
65
+ }
66
+ function ge(e, t, n = {}) {
67
+ return F({
68
+ type: "MultiLineString",
69
+ coordinates: e
70
+ }, t, n);
71
+ }
72
+ function _e(e, t, n = {}) {
73
+ return F({
74
+ type: "MultiPolygon",
75
+ coordinates: e
76
+ }, t, n);
77
+ }
78
+ function ve(e, t = "kilometers") {
79
+ let n = pe[t];
80
+ if (!n) throw Error(t + " units is invalid");
81
+ return e * n;
82
+ }
83
+ function ye(e) {
84
+ return e % (2 * Math.PI) * 180 / Math.PI;
85
+ }
86
+ function R(e) {
87
+ return e % 360 * Math.PI / 180;
88
+ }
89
+ function be(e) {
90
+ return !isNaN(e) && e !== null && !Array.isArray(e);
91
+ }
92
+ function xe(e) {
93
+ return typeof e == "object" && !!e && !Array.isArray(e);
94
+ }
95
+ //#endregion
96
+ //#region node_modules/@turf/meta/dist/esm/index.js
97
+ function Se(e, t, n) {
98
+ if (e !== null) for (var r, i, a, o, s, c, l, u = 0, d = 0, f, p = e.type, m = p === "FeatureCollection", h = p === "Feature", g = m ? e.features.length : 1, _ = 0; _ < g; _++) {
99
+ l = m ? e.features[_].geometry : h ? e.geometry : e, f = l ? l.type === "GeometryCollection" : !1, s = f ? l.geometries.length : 1;
100
+ for (var v = 0; v < s; v++) {
101
+ var y = 0, b = 0;
102
+ if (o = f ? l.geometries[v] : l, o !== null) {
103
+ c = o.coordinates;
104
+ var x = o.type;
105
+ switch (u = n && (x === "Polygon" || x === "MultiPolygon") ? 1 : 0, x) {
106
+ case null: break;
107
+ case "Point":
108
+ if (t(c, d, _, y, b) === !1) return !1;
109
+ d++, y++;
110
+ break;
111
+ case "LineString":
112
+ case "MultiPoint":
113
+ for (r = 0; r < c.length; r++) {
114
+ if (t(c[r], d, _, y, b) === !1) return !1;
115
+ d++, x === "MultiPoint" && y++;
116
+ }
117
+ x === "LineString" && y++;
118
+ break;
119
+ case "Polygon":
120
+ case "MultiLineString":
121
+ for (r = 0; r < c.length; r++) {
122
+ for (i = 0; i < c[r].length - u; i++) {
123
+ if (t(c[r][i], d, _, y, b) === !1) return !1;
124
+ d++;
125
+ }
126
+ x === "MultiLineString" && y++, x === "Polygon" && b++;
127
+ }
128
+ x === "Polygon" && y++;
129
+ break;
130
+ case "MultiPolygon":
131
+ for (r = 0; r < c.length; r++) {
132
+ for (b = 0, i = 0; i < c[r].length; i++) {
133
+ for (a = 0; a < c[r][i].length - u; a++) {
134
+ if (t(c[r][i][a], d, _, y, b) === !1) return !1;
135
+ d++;
136
+ }
137
+ b++;
138
+ }
139
+ y++;
140
+ }
141
+ break;
142
+ case "GeometryCollection":
143
+ for (r = 0; r < o.geometries.length; r++) if (Se(o.geometries[r], t, n) === !1) return !1;
144
+ break;
145
+ default: throw Error("Unknown Geometry Type");
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+ function Ce(e, t) {
152
+ if (e.type === "Feature") t(e, 0);
153
+ else if (e.type === "FeatureCollection") for (var n = 0; n < e.features.length && t(e.features[n], n) !== !1; n++);
154
+ }
155
+ function we(e, t, n) {
156
+ var r = n;
157
+ return Ce(e, function(e, i) {
158
+ r = i === 0 && n === void 0 ? e : t(r, e, i);
159
+ }), r;
160
+ }
161
+ function Te(e, t) {
162
+ var n, r, i, a, o, s, c, l, u, d, f = 0, p = e.type === "FeatureCollection", m = e.type === "Feature", h = p ? e.features.length : 1;
163
+ for (n = 0; n < h; n++) {
164
+ for (s = p ? e.features[n].geometry : m ? e.geometry : e, l = p ? e.features[n].properties : m ? e.properties : {}, u = p ? e.features[n].bbox : m ? e.bbox : void 0, d = p ? e.features[n].id : m ? e.id : void 0, c = s ? s.type === "GeometryCollection" : !1, o = c ? s.geometries.length : 1, i = 0; i < o; i++) {
165
+ if (a = c ? s.geometries[i] : s, a === null) {
166
+ if (t(null, f, l, u, d) === !1) return !1;
167
+ continue;
168
+ }
169
+ switch (a.type) {
170
+ case "Point":
171
+ case "LineString":
172
+ case "MultiPoint":
173
+ case "Polygon":
174
+ case "MultiLineString":
175
+ case "MultiPolygon":
176
+ if (t(a, f, l, u, d) === !1) return !1;
177
+ break;
178
+ case "GeometryCollection":
179
+ for (r = 0; r < a.geometries.length; r++) if (t(a.geometries[r], f, l, u, d) === !1) return !1;
180
+ break;
181
+ default: throw Error("Unknown Geometry Type");
182
+ }
183
+ }
184
+ f++;
185
+ }
186
+ }
187
+ function Ee(e, t, n) {
188
+ var r = n;
189
+ return Te(e, function(e, i, a, o, s) {
190
+ r = i === 0 && n === void 0 ? e : t(r, e, i, a, o, s);
191
+ }), r;
192
+ }
193
+ function De(e, t) {
194
+ Te(e, function(e, n, r, i, a) {
195
+ var o = e === null ? null : e.type;
196
+ switch (o) {
197
+ case null:
198
+ case "Point":
199
+ case "LineString":
200
+ case "Polygon": return t(F(e, r, {
201
+ bbox: i,
202
+ id: a
203
+ }), n, 0) === !1 ? !1 : void 0;
204
+ }
205
+ var s;
206
+ switch (o) {
207
+ case "MultiPoint":
208
+ s = "Point";
209
+ break;
210
+ case "MultiLineString":
211
+ s = "LineString";
212
+ break;
213
+ case "MultiPolygon":
214
+ s = "Polygon";
215
+ break;
216
+ }
217
+ for (var c = 0; c < e.coordinates.length; c++) {
218
+ var l = e.coordinates[c];
219
+ if (t(F({
220
+ type: s,
221
+ coordinates: l
222
+ }, r), n, c) === !1) return !1;
223
+ }
224
+ });
225
+ }
226
+ //#endregion
227
+ //#region node_modules/@turf/area/dist/esm/index.js
228
+ function Oe(e) {
229
+ return Ee(e, (e, t) => e + ke(t), 0);
230
+ }
231
+ function ke(e) {
232
+ let t = 0, n;
233
+ switch (e.type) {
234
+ case "Polygon": return Ae(e.coordinates);
235
+ case "MultiPolygon":
236
+ for (n = 0; n < e.coordinates.length; n++) t += Ae(e.coordinates[n]);
237
+ return t;
238
+ case "Point":
239
+ case "MultiPoint":
240
+ case "LineString":
241
+ case "MultiLineString": return 0;
242
+ }
243
+ return 0;
244
+ }
245
+ function Ae(e) {
246
+ let t = 0;
247
+ if (e && e.length > 0) {
248
+ t += Math.abs(Ne(e[0]));
249
+ for (let n = 1; n < e.length; n++) t -= Math.abs(Ne(e[n]));
250
+ }
251
+ return t;
252
+ }
253
+ var je = P * P / 2, Me = Math.PI / 180;
254
+ function Ne(e) {
255
+ let t = e.length - 1;
256
+ if (t <= 2) return 0;
257
+ let n = 0, r = 0;
258
+ for (; r < t;) {
259
+ let i = e[r], a = e[r + 1 === t ? 0 : r + 1], o = e[r + 2 >= t ? (r + 2) % t : r + 2], s = i[0] * Me, c = a[1] * Me, l = o[0] * Me;
260
+ n += (l - s) * Math.sin(c), r++;
261
+ }
262
+ return n * je;
263
+ }
264
+ //#endregion
265
+ //#region node_modules/geojson-equality-ts/dist/esm/index.js
266
+ var Pe = Object.defineProperty, z = (e, t) => Pe(e, "name", {
267
+ value: t,
268
+ configurable: !0
269
+ }), Fe = class {
270
+ constructor(e) {
271
+ this.direction = !1, this.compareProperties = !0, this.precision = 10 ** -(e?.precision ?? 17), this.direction = e?.direction ?? !1, this.compareProperties = e?.compareProperties ?? !0;
272
+ }
273
+ compare(e, t) {
274
+ if (e.type !== t.type || !Le(e, t)) return !1;
275
+ switch (e.type) {
276
+ case "Point": return this.compareCoord(e.coordinates, t.coordinates);
277
+ case "LineString": return this.compareLine(e.coordinates, t.coordinates);
278
+ case "Polygon": return this.comparePolygon(e, t);
279
+ case "GeometryCollection": return this.compareGeometryCollection(e, t);
280
+ case "Feature": return this.compareFeature(e, t);
281
+ case "FeatureCollection": return this.compareFeatureCollection(e, t);
282
+ default: if (e.type.startsWith("Multi")) {
283
+ let n = Re(e), r = Re(t);
284
+ return n.every((e) => r.some((t) => this.compare(e, t)));
285
+ }
286
+ }
287
+ return !1;
288
+ }
289
+ compareCoord(e, t) {
290
+ return e.length === t.length && e.every((e, n) => Math.abs(e - t[n]) < this.precision);
291
+ }
292
+ compareLine(e, t, n = 0, r = !1) {
293
+ if (!Le(e, t)) return !1;
294
+ let i = e, a = t;
295
+ if (r && !this.compareCoord(i[0], a[0])) {
296
+ let e = this.fixStartIndex(a, i);
297
+ if (e) a = e;
298
+ else return !1;
299
+ }
300
+ let o = this.compareCoord(i[n], a[n]);
301
+ return this.direction || o ? this.comparePath(i, a) : this.compareCoord(i[n], a[a.length - (1 + n)]) ? this.comparePath(i.slice().reverse(), a) : !1;
302
+ }
303
+ fixStartIndex(e, t) {
304
+ let n, r = -1;
305
+ for (let n = 0; n < e.length; n++) if (this.compareCoord(e[n], t[0])) {
306
+ r = n;
307
+ break;
308
+ }
309
+ return r >= 0 && (n = [].concat(e.slice(r, e.length), e.slice(1, r + 1))), n;
310
+ }
311
+ comparePath(e, t) {
312
+ return e.every((e, n) => this.compareCoord(e, t[n]));
313
+ }
314
+ comparePolygon(e, t) {
315
+ if (this.compareLine(e.coordinates[0], t.coordinates[0], 1, !0)) {
316
+ let n = e.coordinates.slice(1, e.coordinates.length), r = t.coordinates.slice(1, t.coordinates.length);
317
+ return n.every((e) => r.some((t) => this.compareLine(e, t, 1, !0)));
318
+ }
319
+ return !1;
320
+ }
321
+ compareGeometryCollection(e, t) {
322
+ return Le(e.geometries, t.geometries) && this.compareBBox(e, t) && e.geometries.every((e, n) => this.compare(e, t.geometries[n]));
323
+ }
324
+ compareFeature(e, t) {
325
+ return e.id === t.id && (this.compareProperties ? Be(e.properties, t.properties) : !0) && this.compareBBox(e, t) && this.compare(e.geometry, t.geometry);
326
+ }
327
+ compareFeatureCollection(e, t) {
328
+ return Le(e.features, t.features) && this.compareBBox(e, t) && e.features.every((e, n) => this.compare(e, t.features[n]));
329
+ }
330
+ compareBBox(e, t) {
331
+ return !e.bbox && !t.bbox || (e.bbox && t.bbox ? this.compareCoord(e.bbox, t.bbox) : !1);
332
+ }
333
+ };
334
+ z(Fe, "GeojsonEquality");
335
+ var Ie = Fe;
336
+ function Le(e, t) {
337
+ return e.coordinates ? e.coordinates.length === t.coordinates.length : e.length === t.length;
338
+ }
339
+ z(Le, "sameLength");
340
+ function Re(e) {
341
+ return e.coordinates.map((t) => ({
342
+ type: e.type.replace("Multi", ""),
343
+ coordinates: t
344
+ }));
345
+ }
346
+ z(Re, "explode");
347
+ function ze(e, t, n) {
348
+ return new Ie(n).compare(e, t);
349
+ }
350
+ z(ze, "geojsonEquality");
351
+ function Be(e, t) {
352
+ if (e === null && t === null) return !0;
353
+ if (e === null || t === null) return !1;
354
+ let n = Object.keys(e), r = Object.keys(t);
355
+ if (n.length !== r.length) return !1;
356
+ for (var i of n) {
357
+ let n = e[i], r = t[i], a = Ve(n) && Ve(r);
358
+ if (a && !Be(n, r) || !a && n !== r) return !1;
359
+ }
360
+ return !0;
361
+ }
362
+ z(Be, "equal");
363
+ var Ve = /* @__PURE__ */ z((e) => typeof e == "object" && !!e, "isObject");
364
+ //#endregion
365
+ //#region node_modules/@turf/invariant/dist/esm/index.js
366
+ function B(e) {
367
+ if (!e) throw Error("coord is required");
368
+ if (!Array.isArray(e)) {
369
+ if (e.type === "Feature" && e.geometry !== null && e.geometry.type === "Point") return [...e.geometry.coordinates];
370
+ if (e.type === "Point") return [...e.coordinates];
371
+ }
372
+ if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1])) return [...e];
373
+ throw Error("coord must be GeoJSON Point or an Array of numbers");
374
+ }
375
+ function V(e) {
376
+ if (Array.isArray(e)) return e;
377
+ if (e.type === "Feature") {
378
+ if (e.geometry !== null) return e.geometry.coordinates;
379
+ } else if (e.coordinates) return e.coordinates;
380
+ throw Error("coords must be GeoJSON Feature, Geometry Object or an Array");
381
+ }
382
+ function H(e) {
383
+ return e.type === "Feature" ? e.geometry : e;
384
+ }
385
+ function He(e, t) {
386
+ return e.type === "FeatureCollection" ? "FeatureCollection" : e.type === "GeometryCollection" ? "GeometryCollection" : e.type === "Feature" && e.geometry !== null ? e.geometry.type : e.type;
387
+ }
388
+ //#endregion
389
+ //#region node_modules/@turf/boolean-point-on-line/dist/esm/index.js
390
+ function U(e, t, n = {}) {
391
+ let r = B(e), i = V(t);
392
+ for (let e = 0; e < i.length - 1; e++) {
393
+ let t = !1;
394
+ if (n.ignoreEndVertices && (e === 0 && (t = "start"), e === i.length - 2 && (t = "end"), e === 0 && e + 1 === i.length - 1 && (t = "both")), Ue(i[e], i[e + 1], r, t, n.epsilon === void 0 ? null : n.epsilon)) return !0;
395
+ }
396
+ return !1;
397
+ }
398
+ function Ue(e, t, n, r, i) {
399
+ let a = n[0], o = n[1], s = e[0], c = e[1], l = t[0], u = t[1], d = n[0] - s, f = n[1] - c, p = l - s, m = u - c, h = d * m - f * p;
400
+ if (i !== null) {
401
+ if (Math.abs(h) > i) return !1;
402
+ } else if (h !== 0) return !1;
403
+ return Math.abs(p) === Math.abs(m) && Math.abs(p) === 0 ? r ? !1 : n[0] === e[0] && n[1] === e[1] : r ? r === "start" ? Math.abs(p) >= Math.abs(m) ? p > 0 ? s < a && a <= l : l <= a && a < s : m > 0 ? c < o && o <= u : u <= o && o < c : r === "end" ? Math.abs(p) >= Math.abs(m) ? p > 0 ? s <= a && a < l : l < a && a <= s : m > 0 ? c <= o && o < u : u < o && o <= c : r === "both" ? Math.abs(p) >= Math.abs(m) ? p > 0 ? s < a && a < l : l < a && a < s : m > 0 ? c < o && o < u : u < o && o < c : !1 : Math.abs(p) >= Math.abs(m) ? p > 0 ? s <= a && a <= l : l <= a && a <= s : m > 0 ? c <= o && o <= u : u <= o && o <= c;
404
+ }
405
+ //#endregion
406
+ //#region node_modules/@turf/clean-coords/dist/esm/index.js
407
+ function We(e, t = {}) {
408
+ var n = typeof t == "object" ? t.mutate : t;
409
+ if (!e) throw Error("geojson is required");
410
+ var r = He(e), i = [];
411
+ switch (r) {
412
+ case "LineString":
413
+ i = Ge(e, r);
414
+ break;
415
+ case "MultiLineString":
416
+ case "Polygon":
417
+ V(e).forEach(function(e) {
418
+ i.push(Ge(e, r));
419
+ });
420
+ break;
421
+ case "MultiPolygon":
422
+ V(e).forEach(function(e) {
423
+ var t = [];
424
+ e.forEach(function(e) {
425
+ t.push(Ge(e, r));
426
+ }), i.push(t);
427
+ });
428
+ break;
429
+ case "Point": return e;
430
+ case "MultiPoint":
431
+ var a = {};
432
+ V(e).forEach(function(e) {
433
+ var t = e.join("-");
434
+ Object.prototype.hasOwnProperty.call(a, t) || (i.push(e), a[t] = !0);
435
+ });
436
+ break;
437
+ default: throw Error(r + " geometry not supported");
438
+ }
439
+ return e.coordinates ? n === !0 ? (e.coordinates = i, e) : {
440
+ type: r,
441
+ coordinates: i
442
+ } : n === !0 ? (e.geometry.coordinates = i, e) : F({
443
+ type: r,
444
+ coordinates: i
445
+ }, e.properties, {
446
+ bbox: e.bbox,
447
+ id: e.id
448
+ });
449
+ }
450
+ function Ge(e, t) {
451
+ let n = V(e);
452
+ if (n.length === 2 && !Ke(n[0], n[1])) return n;
453
+ let r = [], i = 0, a = 1, o = 2;
454
+ for (r.push(n[i]); o < n.length;) U(n[a], I([n[i], n[o]])) ? a = o : (r.push(n[a]), i = a, a++, o = a), o++;
455
+ if (r.push(n[a]), t === "Polygon" || t === "MultiPolygon") {
456
+ if (U(r[0], I([r[1], r[r.length - 2]])) && (r.shift(), r.pop(), r.push(r[0])), r.length < 4) throw Error("invalid polygon, fewer than 4 points");
457
+ if (!Ke(r[0], r[r.length - 1])) throw Error("invalid polygon, first and last points not equal");
458
+ }
459
+ return r;
460
+ }
461
+ function Ke(e, t) {
462
+ return e[0] === t[0] && e[1] === t[1];
463
+ }
464
+ //#endregion
465
+ //#region node_modules/@turf/boolean-equal/dist/esm/index.js
466
+ function qe(e, t, n = {}) {
467
+ let r = n.precision;
468
+ if (r = r == null || isNaN(r) ? 6 : r, typeof r != "number" || !(r >= 0)) throw Error("precision must be a positive number");
469
+ return H(e).type === H(t).type ? ze(We(e), We(t), { precision: r }) : !1;
470
+ }
471
+ var Je = qe;
472
+ //#endregion
473
+ //#region src/utils/feature-transform.ts
474
+ function Ye(e) {
475
+ return e.features.map((t) => {
476
+ if (t.id == null) {
477
+ console.warn("Skipping feature with null id");
478
+ return;
479
+ }
480
+ let n = e.metadata.links[t.properties.links];
481
+ if (!n) {
482
+ console.warn(`Feature ${t.id} has no group, skipping.`);
483
+ return;
484
+ }
485
+ let r = n.find((e) => e.before === t.id || e.after === t.id);
486
+ if (!r) {
487
+ console.warn(`Feature ${t.id} has no link, skipping.`);
488
+ return;
489
+ }
490
+ let i = e.features.find((e) => e.properties.links === t.properties.links && e.id !== t.id);
491
+ return i?.geometry && t.geometry && (t.properties.geom = !Je(t.geometry, i.geometry)), t.id === r.before ? {
492
+ ...t,
493
+ properties: {
494
+ ...t.properties,
495
+ is_before: !0
496
+ }
497
+ } : t.id === r.after && !n.filter((e) => "before" in e).length ? {
498
+ ...t,
499
+ properties: {
500
+ ...t.properties,
501
+ is_new: !0
502
+ }
503
+ } : t.id === r.after || r.before === void 0 && r.after !== void 0 ? {
504
+ ...t,
505
+ properties: {
506
+ ...t.properties,
507
+ is_after: !0
508
+ }
509
+ } : t;
510
+ }).filter((e) => e !== void 0).sort((e, t) => {
511
+ let n = e.geometry, r = t.geometry;
512
+ return !n && !r ? 0 : n ? r ? Oe(t) - Oe(e) : -1 : 1;
513
+ });
514
+ }
515
+ //#endregion
516
+ //#region src/composables/useLoCha.ts
517
+ var W = {
518
+ new: "#52c41a",
519
+ delete: "#FF0000",
520
+ updateBefore: "#FFA479",
521
+ updateAfter: "#F2BE00"
522
+ }, Xe = Object.fromEntries([
523
+ "new",
524
+ "delete",
525
+ "updateAfter",
526
+ "updateBefore"
527
+ ].map((e) => [e, e]));
528
+ function Ze() {
529
+ let e = S(), n = S([]), r = t(() => e.value?.features.length);
530
+ function i(e) {
531
+ return e.reduce((e, t) => {
532
+ let n = t.properties.links;
533
+ return e[n] || (e[n] = []), e[n].push(t), e;
534
+ }, []);
535
+ }
536
+ function a(t) {
537
+ l();
538
+ let r = {
539
+ ...t,
540
+ features: Ye(t)
541
+ };
542
+ e.value = r, n.value = i(r.features);
543
+ }
544
+ function o(e) {
545
+ return e.filter((e) => e.properties.is_before);
546
+ }
547
+ function s(e) {
548
+ return e.filter((e) => e.properties.is_after || e.properties.is_new);
549
+ }
550
+ function c(e) {
551
+ return e.properties.is_new ? Xe.new : e.properties.deleted ? Xe.delete : e.properties.is_before ? Xe.updateBefore : Xe.updateAfter;
552
+ }
553
+ function l() {
554
+ e.value = void 0, n.value = [];
555
+ }
556
+ return {
557
+ featureCount: r,
558
+ loCha: e,
559
+ groups: n,
560
+ setLoCha: a,
561
+ getStatus: c,
562
+ getBeforeFeatures: o,
563
+ getAfterFeatures: s
564
+ };
565
+ }
566
+ //#endregion
567
+ //#region src/constants/injectionKeys.ts
568
+ var Qe = Symbol("reasonCollapsed"), $e = Symbol("loCha"), et = Symbol("loChaInstanceId"), tt = {
569
+ n: "node",
570
+ w: "way",
571
+ r: "relation"
572
+ };
573
+ function nt(e, t) {
574
+ return `https://www.openstreetmap.org/${tt[e]}/${t}/history`;
575
+ }
576
+ function rt(e) {
577
+ return `https://www.openstreetmap.org/user/${encodeURIComponent(e)}`;
578
+ }
579
+ function it(e, t) {
580
+ return `http://127.0.0.1:8111/load_object?objects=${e}${t}`;
581
+ }
582
+ function at(e, t) {
583
+ return `https://osmlab.github.io/osm-deep-history/#/${tt[e]}/${t}`;
584
+ }
585
+ function ot(e, t) {
586
+ return `https://pewu.github.io/osm-history/#/${tt[e]}/${t}`;
587
+ }
588
+ //#endregion
589
+ //#region src/components/LoCha/LoChaObject.vue?vue&type=script&setup=true&lang.ts
590
+ var st = { class: "locha-object" }, ct = { class: "wrap" }, lt = ["href"], ut = { class: "date" }, dt = ["href", "title"], ft = { class: "actions" }, pt = ["href"], mt = ["href", "target"], ht = ["href"], gt = ["href"], _t = /* @__PURE__ */ c({
591
+ __name: "LoChaObject",
592
+ props: {
593
+ feature: {},
594
+ josmTarget: {}
595
+ },
596
+ setup(e) {
597
+ A((e) => ({
598
+ v3a1ecbb2: l.value,
599
+ v46ce0461: k(W).delete,
600
+ v2ebb96aa: k(W).new
601
+ }));
602
+ let n = e, { getStatus: o } = f($e), s = t(() => o(n.feature)), c = t(() => {
603
+ switch (s.value) {
604
+ case "new": return "new";
605
+ case "delete": return "deleted";
606
+ default: return "";
607
+ }
608
+ }), l = t(() => W[s.value]);
609
+ return (t, o) => (y(), i("article", st, [
610
+ a("header", null, [
611
+ a("div", ct, [a("a", {
612
+ href: k(nt)(e.feature.properties.objtype, e.feature.properties.id),
613
+ title: "OSM History",
614
+ target: "_blank",
615
+ onClick: o[0] ||= N(() => {}, ["stop"])
616
+ }, E(`${e.feature.properties.objtype}${e.feature.properties.id}-v${e.feature.properties.version}`), 9, lt), s.value === "new" || s.value === "delete" ? (y(), i("div", {
617
+ key: 0,
618
+ class: h(["status-content", {
619
+ "object-new": s.value === "new",
620
+ "object-deleted": s.value === "delete"
621
+ }])
622
+ }, E(c.value), 3)) : r("", !0)]),
623
+ a("h3", null, E(n.feature.properties.tags.name), 1),
624
+ a("p", ut, " 📅 " + E(n.feature.properties.created), 1),
625
+ a("a", {
626
+ href: k(rt)(e.feature.properties.username),
627
+ title: `View ${e.feature.properties.username} OSM profile`,
628
+ target: "_blank",
629
+ onClick: o[1] ||= N(() => {}, ["stop"])
630
+ }, " 👤" + E(e.feature.properties.username), 9, dt)
631
+ ]),
632
+ w(t.$slots, "tags-diff", {}, void 0, !0),
633
+ a("div", ft, [
634
+ a("a", {
635
+ href: k(nt)(e.feature.properties.objtype, e.feature.properties.id),
636
+ type: "button",
637
+ title: "Edit in OSM iD",
638
+ target: "_blank",
639
+ onClick: o[2] ||= N(() => {}, ["stop"])
640
+ }, " OSM iD ", 8, pt),
641
+ a("a", {
642
+ href: k(it)(e.feature.properties.objtype, e.feature.properties.id),
643
+ type: "button",
644
+ title: "Edit in JOSM",
645
+ target: e.josmTarget || "hidden_josm_target",
646
+ onClick: o[3] ||= N(() => {}, ["stop"])
647
+ }, " JOSM ", 8, mt),
648
+ a("a", {
649
+ href: k(at)(e.feature.properties.objtype, e.feature.properties.id),
650
+ type: "button",
651
+ title: "OSM Deep History",
652
+ target: "_blank",
653
+ onClick: o[4] ||= N(() => {}, ["stop"])
654
+ }, " Deep H ", 8, ht),
655
+ a("a", {
656
+ href: k(ot)(e.feature.properties.objtype, e.feature.properties.id),
657
+ type: "button",
658
+ title: "OSM History Viewer",
659
+ target: "_blank",
660
+ onClick: o[5] ||= N(() => {}, ["stop"])
661
+ }, " OSM H ", 8, gt)
662
+ ])
663
+ ]));
664
+ }
665
+ }), vt = (e, t) => {
666
+ let n = e.__vccOpts || e;
667
+ for (let [e, r] of t) n[e] = r;
668
+ return n;
669
+ }, yt = /* @__PURE__ */ vt(_t, [["__scopeId", "data-v-c95e1ede"]]);
670
+ //#endregion
671
+ //#region node_modules/@turf/bbox/dist/esm/index.js
672
+ function G(e, t = {}) {
673
+ if (e.bbox != null && !0 !== t.recompute) return e.bbox;
674
+ let n = [
675
+ Infinity,
676
+ Infinity,
677
+ -Infinity,
678
+ -Infinity
679
+ ];
680
+ return Se(e, (e) => {
681
+ n[0] > e[0] && (n[0] = e[0]), n[1] > e[1] && (n[1] = e[1]), n[2] < e[0] && (n[2] = e[0]), n[3] < e[1] && (n[3] = e[1]);
682
+ }), n;
683
+ }
684
+ var bt = G;
685
+ //#endregion
686
+ //#region node_modules/@vueuse/shared/dist/index.js
687
+ function xt(e, t) {
688
+ return u() ? (v(e, t), !0) : !1;
689
+ }
690
+ var St = typeof window < "u" && typeof document < "u";
691
+ typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
692
+ var Ct = (e) => e != null, wt = Object.prototype.toString, Tt = (e) => wt.call(e) === "[object Object]", Et = () => {}, Dt = /* @__PURE__ */ Ot();
693
+ function Ot() {
694
+ var e, t;
695
+ return St && !!(!((e = window) == null || (e = e.navigator) == null) && e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window) == null || (t = t.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
696
+ }
697
+ function kt(...e) {
698
+ if (e.length !== 1) return D(...e);
699
+ let t = e[0];
700
+ return typeof t == "function" ? x(s(() => ({
701
+ get: t,
702
+ set: Et
703
+ }))) : S(t);
704
+ }
705
+ function At(e) {
706
+ return Array.isArray(e) ? e : [e];
707
+ }
708
+ function jt(e, t, n) {
709
+ return j(e, t, {
710
+ ...n,
711
+ immediate: !0
712
+ });
713
+ }
714
+ //#endregion
715
+ //#region node_modules/@vueuse/core/dist/index.js
716
+ var Mt = St ? window : void 0;
717
+ St && window.document, St && window.navigator, St && window.location;
718
+ function Nt(e) {
719
+ let t = O(e);
720
+ return t?.$el ?? t;
721
+ }
722
+ function Pt(...e) {
723
+ let n = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), r = t(() => {
724
+ let t = At(O(e[0])).filter((e) => e != null);
725
+ return t.every((e) => typeof e != "string") ? t : void 0;
726
+ });
727
+ return jt(() => [
728
+ r.value?.map((e) => Nt(e)) ?? [Mt].filter((e) => e != null),
729
+ At(O(r.value ? e[1] : e[0])),
730
+ At(k(r.value ? e[2] : e[1])),
731
+ O(r.value ? e[3] : e[2])
732
+ ], ([e, t, r, i], a, o) => {
733
+ if (!e?.length || !t?.length || !r?.length) return;
734
+ let s = Tt(i) ? { ...i } : i, c = e.flatMap((e) => t.flatMap((t) => r.map((r) => n(e, t, r, s))));
735
+ o(() => {
736
+ c.forEach((e) => e());
737
+ });
738
+ }, { flush: "post" });
739
+ }
740
+ function Ft() {
741
+ let e = T(!1), t = l();
742
+ return t && _(() => {
743
+ e.value = !0;
744
+ }, t), e;
745
+ }
746
+ /* @__NO_SIDE_EFFECTS__ */
747
+ function It(e) {
748
+ let n = Ft();
749
+ return t(() => (n.value, !!e()));
750
+ }
751
+ function Lt(e, n, r = {}) {
752
+ let { root: i, rootMargin: a, threshold: o = 0, window: s = Mt, immediate: c = !0 } = r, l = /* @__PURE__ */ It(() => s && "IntersectionObserver" in s), u = t(() => At(O(e)).map(Nt).filter(Ct)), d = Et, f = T(c), p = l.value ? j(() => [
753
+ u.value,
754
+ Nt(i),
755
+ O(a),
756
+ f.value
757
+ ], ([e, t, r]) => {
758
+ if (d(), !f.value || !e.length) return;
759
+ let i = new IntersectionObserver(n, {
760
+ root: Nt(t),
761
+ rootMargin: r,
762
+ threshold: o
763
+ });
764
+ e.forEach((e) => e && i.observe(e)), d = () => {
765
+ i.disconnect(), d = Et;
766
+ };
767
+ }, {
768
+ immediate: c,
769
+ flush: "post"
770
+ }) : Et, m = () => {
771
+ d(), p(), f.value = !1;
772
+ };
773
+ return xt(m), {
774
+ isSupported: l,
775
+ isActive: f,
776
+ pause() {
777
+ d(), f.value = !1;
778
+ },
779
+ resume() {
780
+ f.value = !0;
781
+ },
782
+ stop: m
783
+ };
784
+ }
785
+ function Rt(e) {
786
+ return typeof Window < "u" && e instanceof Window ? e.document.documentElement : typeof Document < "u" && e instanceof Document ? e.documentElement : e;
787
+ }
788
+ function zt(e) {
789
+ let t = window.getComputedStyle(e);
790
+ if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && e.clientWidth < e.scrollWidth || t.overflowY === "auto" && e.clientHeight < e.scrollHeight) return !0;
791
+ {
792
+ let t = e.parentNode;
793
+ return !t || t.tagName === "BODY" ? !1 : zt(t);
794
+ }
795
+ }
796
+ function Bt(e) {
797
+ let t = e || window.event, n = t.target;
798
+ return zt(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
799
+ }
800
+ var Vt = /* @__PURE__ */ new WeakMap();
801
+ function Ht(e, n = !1) {
802
+ let r = T(n), i = null, a = "";
803
+ j(kt(e), (e) => {
804
+ let t = Rt(O(e));
805
+ if (t) {
806
+ let e = t;
807
+ if (Vt.get(e) || Vt.set(e, e.style.overflow), e.style.overflow !== "hidden" && (a = e.style.overflow), e.style.overflow === "hidden") return r.value = !0;
808
+ if (r.value) return e.style.overflow = "hidden";
809
+ }
810
+ }, { immediate: !0 });
811
+ let o = () => {
812
+ let t = Rt(O(e));
813
+ !t || r.value || (Dt && (i = Pt(t, "touchmove", (e) => {
814
+ Bt(e);
815
+ }, { passive: !1 })), t.style.overflow = "hidden", r.value = !0);
816
+ }, s = () => {
817
+ let t = Rt(O(e));
818
+ !t || !r.value || (Dt && i?.(), t.style.overflow = a, Vt.delete(t), r.value = !1);
819
+ };
820
+ return xt(s), t({
821
+ get() {
822
+ return r.value;
823
+ },
824
+ set(e) {
825
+ e ? o() : s();
826
+ }
827
+ });
828
+ }
829
+ //#endregion
830
+ //#region node_modules/@vueuse/components/dist/index.js
831
+ var Ut = { mounted(e, t) {
832
+ typeof t.value == "function" ? Lt(e, t.value) : Lt(e, ...t.value);
833
+ } };
834
+ function Wt() {
835
+ let e = !1, t = T(!1);
836
+ return (n, r) => {
837
+ if (t.value = r.value, e) return;
838
+ e = !0;
839
+ let i = Ht(n, r.value);
840
+ j(t, (e) => i.value = e);
841
+ };
842
+ }
843
+ Wt();
844
+ //#endregion
845
+ //#region src/constants/map.ts
846
+ var Gt = "https://maps.cartoway.com/styles/positron/style.json", Kt = "#f4f4f5", qt = "bbox", K = "lochas", q = {
847
+ Bbox: {
848
+ id: "bbox-layer",
849
+ type: "line",
850
+ source: qt,
851
+ paint: {
852
+ "line-color": "#000000",
853
+ "line-width": 1,
854
+ "line-dasharray": [2, 2]
855
+ }
856
+ },
857
+ PolygonBorder: {
858
+ id: "feature-polygons-border",
859
+ type: "line",
860
+ source: K,
861
+ paint: {
862
+ "line-width": [
863
+ "case",
864
+ [
865
+ "==",
866
+ ["get", "is_before"],
867
+ !0
868
+ ],
869
+ 1,
870
+ 2
871
+ ],
872
+ "line-color": "#000000"
873
+ },
874
+ filter: [
875
+ "in",
876
+ ["geometry-type"],
877
+ ["literal", ["Polygon", "MultiPolygon"]]
878
+ ]
879
+ },
880
+ Polygon: {
881
+ id: "feature-polygons",
882
+ type: "fill",
883
+ source: K,
884
+ paint: {
885
+ "fill-opacity": [
886
+ "case",
887
+ [
888
+ "boolean",
889
+ ["feature-state", "hover"],
890
+ !1
891
+ ],
892
+ 1,
893
+ .3
894
+ ],
895
+ "fill-color": [
896
+ "case",
897
+ [
898
+ "==",
899
+ ["get", "geom"],
900
+ !1
901
+ ],
902
+ Kt,
903
+ [
904
+ "==",
905
+ ["get", "is_new"],
906
+ !0
907
+ ],
908
+ W.new,
909
+ [
910
+ "==",
911
+ ["get", "deleted"],
912
+ !0
913
+ ],
914
+ W.delete,
915
+ [
916
+ "==",
917
+ ["get", "is_before"],
918
+ !0
919
+ ],
920
+ W.updateBefore,
921
+ W.updateAfter
922
+ ]
923
+ },
924
+ filter: [
925
+ "in",
926
+ ["geometry-type"],
927
+ ["literal", ["Polygon", "MultiPolygon"]]
928
+ ]
929
+ },
930
+ LineString: {
931
+ id: "feature-lines",
932
+ type: "line",
933
+ source: K,
934
+ paint: {
935
+ "line-width": 6,
936
+ "line-color": [
937
+ "case",
938
+ [
939
+ "==",
940
+ ["get", "geom"],
941
+ !1
942
+ ],
943
+ Kt,
944
+ [
945
+ "==",
946
+ ["get", "is_new"],
947
+ !0
948
+ ],
949
+ W.new,
950
+ [
951
+ "==",
952
+ ["get", "deleted"],
953
+ !0
954
+ ],
955
+ W.delete,
956
+ [
957
+ "==",
958
+ ["get", "is_before"],
959
+ !0
960
+ ],
961
+ W.updateBefore,
962
+ W.updateAfter
963
+ ],
964
+ "line-opacity": [
965
+ "case",
966
+ [
967
+ "boolean",
968
+ ["feature-state", "hover"],
969
+ !1
970
+ ],
971
+ 1,
972
+ .5
973
+ ],
974
+ "line-offset": [
975
+ "case",
976
+ [
977
+ "==",
978
+ ["get", "is_before"],
979
+ !0
980
+ ],
981
+ -3,
982
+ 3
983
+ ]
984
+ },
985
+ layout: { "line-cap": "round" },
986
+ filter: [
987
+ "in",
988
+ ["geometry-type"],
989
+ ["literal", ["LineString", "MultiLineString"]]
990
+ ]
991
+ },
992
+ LineStringBorder: {
993
+ id: "feature-lines-border",
994
+ type: "line",
995
+ source: K,
996
+ paint: {
997
+ "line-width": [
998
+ "case",
999
+ [
1000
+ "==",
1001
+ ["get", "is_before"],
1002
+ !0
1003
+ ],
1004
+ 1,
1005
+ 2
1006
+ ],
1007
+ "line-color": "#000000",
1008
+ "line-offset": [
1009
+ "case",
1010
+ [
1011
+ "==",
1012
+ ["get", "is_before"],
1013
+ !0
1014
+ ],
1015
+ -2,
1016
+ 2
1017
+ ]
1018
+ },
1019
+ layout: { "line-cap": "round" },
1020
+ filter: [
1021
+ "in",
1022
+ ["geometry-type"],
1023
+ ["literal", ["LineString", "MultiLineString"]]
1024
+ ]
1025
+ },
1026
+ Point: {
1027
+ id: "feature-points",
1028
+ type: "circle",
1029
+ source: K,
1030
+ paint: {
1031
+ "circle-radius": [
1032
+ "case",
1033
+ [
1034
+ "boolean",
1035
+ ["feature-state", "hover"],
1036
+ !1
1037
+ ],
1038
+ 14,
1039
+ 12
1040
+ ],
1041
+ "circle-stroke-color": "#000000",
1042
+ "circle-stroke-width": [
1043
+ "case",
1044
+ [
1045
+ "==",
1046
+ ["get", "is_before"],
1047
+ !0
1048
+ ],
1049
+ 1,
1050
+ 2
1051
+ ],
1052
+ "circle-opacity": [
1053
+ "case",
1054
+ [
1055
+ "boolean",
1056
+ ["feature-state", "hover"],
1057
+ !1
1058
+ ],
1059
+ 1,
1060
+ .3
1061
+ ],
1062
+ "circle-color": [
1063
+ "case",
1064
+ [
1065
+ "==",
1066
+ ["get", "geom"],
1067
+ !1
1068
+ ],
1069
+ Kt,
1070
+ [
1071
+ "==",
1072
+ ["get", "is_new"],
1073
+ !0
1074
+ ],
1075
+ W.new,
1076
+ [
1077
+ "==",
1078
+ ["get", "deleted"],
1079
+ !0
1080
+ ],
1081
+ W.delete,
1082
+ [
1083
+ "==",
1084
+ ["get", "is_before"],
1085
+ !0
1086
+ ],
1087
+ W.updateBefore,
1088
+ W.updateAfter
1089
+ ]
1090
+ },
1091
+ filter: [
1092
+ "in",
1093
+ ["geometry-type"],
1094
+ ["literal", ["Point", "MultiPoint"]]
1095
+ ]
1096
+ }
1097
+ };
1098
+ //#endregion
1099
+ //#region node_modules/@turf/bbox-clip/dist/esm/index.js
1100
+ function Jt(e, t, n) {
1101
+ var r = e.length, i = J(e[0], t), a = [], o, s, c;
1102
+ let l, u;
1103
+ for (n ||= [], o = 1; o < r; o++) {
1104
+ for (l = e[o - 1], u = e[o], s = c = J(u, t);;) if (!(i | s)) {
1105
+ a.push(l), s === c ? o === r - 1 && a.push(u) : (a.push(u), o < r - 1 && (n.push(a), a = []));
1106
+ break;
1107
+ } else if (i & s) break;
1108
+ else i ? (l = Xt(l, u, i, t), i = J(l, t)) : (u = Xt(l, u, s, t), s = J(u, t));
1109
+ i = c;
1110
+ }
1111
+ return a.length && n.push(a), n;
1112
+ }
1113
+ function Yt(e, t) {
1114
+ var n, r, i, a, o, s, c;
1115
+ for (r = 1; r <= 8; r *= 2) {
1116
+ for (n = [], i = e[e.length - 1], a = !(J(i, t) & r), o = 0; o < e.length; o++) s = e[o], c = !(J(s, t) & r), c !== a && n.push(Xt(i, s, r, t)), c && n.push(s), i = s, a = c;
1117
+ if (e = n, !e.length) break;
1118
+ }
1119
+ return n;
1120
+ }
1121
+ function Xt(e, t, n, r) {
1122
+ return n & 8 ? [e[0] + (t[0] - e[0]) * (r[3] - e[1]) / (t[1] - e[1]), r[3]] : n & 4 ? [e[0] + (t[0] - e[0]) * (r[1] - e[1]) / (t[1] - e[1]), r[1]] : n & 2 ? [r[2], e[1] + (t[1] - e[1]) * (r[2] - e[0]) / (t[0] - e[0])] : n & 1 ? [r[0], e[1] + (t[1] - e[1]) * (r[0] - e[0]) / (t[0] - e[0])] : null;
1123
+ }
1124
+ function J(e, t) {
1125
+ var n = 0;
1126
+ return e[0] < t[0] ? n |= 1 : e[0] > t[2] && (n |= 2), e[1] < t[1] ? n |= 4 : e[1] > t[3] && (n |= 8), n;
1127
+ }
1128
+ function Zt(e, t) {
1129
+ let n = H(e), r = n.type, i = e.type === "Feature" ? e.properties : {}, a = n.coordinates;
1130
+ switch (r) {
1131
+ case "LineString":
1132
+ case "MultiLineString": {
1133
+ let e = [];
1134
+ return r === "LineString" && (a = [a]), a.forEach((n) => {
1135
+ Jt(n, t, e);
1136
+ }), e.length === 1 ? I(e[0], i) : ge(e, i);
1137
+ }
1138
+ case "Polygon": return he(Qt(a, t), i);
1139
+ case "MultiPolygon": return _e(a.map((e) => Qt(e, t)), i);
1140
+ default: throw Error("geometry " + r + " not supported");
1141
+ }
1142
+ }
1143
+ function Qt(e, t) {
1144
+ let n = [];
1145
+ for (let r of e) {
1146
+ let e = Yt(r, t);
1147
+ e.length > 0 && ((e[0][0] !== e[e.length - 1][0] || e[0][1] !== e[e.length - 1][1]) && e.push(e[0]), e.length >= 4 && n.push(e));
1148
+ }
1149
+ return n;
1150
+ }
1151
+ var $t = Zt;
1152
+ //#endregion
1153
+ //#region node_modules/@turf/bbox-polygon/dist/esm/index.js
1154
+ function en(e, t = {}) {
1155
+ let n = Number(e[0]), r = Number(e[1]), i = Number(e[2]), a = Number(e[3]);
1156
+ if (e.length === 6) throw Error("@turf/bbox-polygon does not support BBox with 6 positions");
1157
+ let o = [n, r];
1158
+ return he([[
1159
+ o,
1160
+ [i, r],
1161
+ [i, a],
1162
+ [n, a],
1163
+ o
1164
+ ]], t.properties, {
1165
+ bbox: e,
1166
+ id: t.id
1167
+ });
1168
+ }
1169
+ var tn = en, Y = 11102230246251565e-32, X = 134217729, nn = (3 + 8 * Y) * Y;
1170
+ function rn(e, t, n, r, i) {
1171
+ let a, o, s, c, l = t[0], u = r[0], d = 0, f = 0;
1172
+ u > l == u > -l ? (a = l, l = t[++d]) : (a = u, u = r[++f]);
1173
+ let p = 0;
1174
+ if (d < e && f < n) for (u > l == u > -l ? (o = l + a, s = a - (o - l), l = t[++d]) : (o = u + a, s = a - (o - u), u = r[++f]), a = o, s !== 0 && (i[p++] = s); d < e && f < n;) u > l == u > -l ? (o = a + l, c = o - a, s = a - (o - c) + (l - c), l = t[++d]) : (o = a + u, c = o - a, s = a - (o - c) + (u - c), u = r[++f]), a = o, s !== 0 && (i[p++] = s);
1175
+ for (; d < e;) o = a + l, c = o - a, s = a - (o - c) + (l - c), l = t[++d], a = o, s !== 0 && (i[p++] = s);
1176
+ for (; f < n;) o = a + u, c = o - a, s = a - (o - c) + (u - c), u = r[++f], a = o, s !== 0 && (i[p++] = s);
1177
+ return (a !== 0 || p === 0) && (i[p++] = a), p;
1178
+ }
1179
+ function an(e, t) {
1180
+ let n = t[0];
1181
+ for (let r = 1; r < e; r++) n += t[r];
1182
+ return n;
1183
+ }
1184
+ function Z(e) {
1185
+ return new Float64Array(e);
1186
+ }
1187
+ //#endregion
1188
+ //#region node_modules/robust-predicates/esm/orient2d.js
1189
+ var on = (3 + 16 * Y) * Y, sn = (2 + 12 * Y) * Y, cn = (9 + 64 * Y) * Y * Y, ln = Z(4), un = Z(8), dn = Z(12), fn = Z(16), Q = Z(4);
1190
+ function pn(e, t, n, r, i, a, o) {
1191
+ let s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T = e - i, E = n - i, D = t - a, O = r - a;
1192
+ b = T * O, f = X * T, p = f - (f - T), m = T - p, f = X * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = D * E, f = X * D, p = f - (f - D), m = D - p, f = X * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, ln[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, ln[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, ln[2] = v - (w - d) + (_ - d), ln[3] = w;
1193
+ let k = an(4, ln), A = sn * o;
1194
+ if (k >= A || -k >= A || (d = e - T, s = e - (T + d) + (d - i), d = n - E, l = n - (E + d) + (d - i), d = t - D, c = t - (D + d) + (d - a), d = r - O, u = r - (O + d) + (d - a), s === 0 && c === 0 && l === 0 && u === 0) || (A = cn * o + nn * Math.abs(k), k += T * u + O * s - (D * l + E * c), k >= A || -k >= A)) return k;
1195
+ b = s * O, f = X * s, p = f - (f - s), m = s - p, f = X * O, h = f - (f - O), g = O - h, x = m * g - (b - p * h - m * h - p * g), S = c * E, f = X * c, p = f - (f - c), m = c - p, f = X * E, h = f - (f - E), g = E - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, Q[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, Q[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, Q[2] = v - (w - d) + (_ - d), Q[3] = w;
1196
+ let ee = rn(4, ln, 4, Q, un);
1197
+ b = T * u, f = X * T, p = f - (f - T), m = T - p, f = X * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = D * l, f = X * D, p = f - (f - D), m = D - p, f = X * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, Q[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, Q[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, Q[2] = v - (w - d) + (_ - d), Q[3] = w;
1198
+ let te = rn(ee, un, 4, Q, dn);
1199
+ return b = s * u, f = X * s, p = f - (f - s), m = s - p, f = X * u, h = f - (f - u), g = u - h, x = m * g - (b - p * h - m * h - p * g), S = c * l, f = X * c, p = f - (f - c), m = c - p, f = X * l, h = f - (f - l), g = l - h, C = m * g - (S - p * h - m * h - p * g), _ = x - C, d = x - _, Q[0] = x - (_ + d) + (d - C), v = b + _, d = v - b, y = b - (v - d) + (_ - d), _ = y - S, d = y - _, Q[1] = y - (_ + d) + (d - S), w = v + _, d = w - v, Q[2] = v - (w - d) + (_ - d), Q[3] = w, fn[rn(te, dn, 4, Q, fn) - 1];
1200
+ }
1201
+ function mn(e, t, n, r, i, a) {
1202
+ let o = (t - a) * (n - i), s = (e - i) * (r - a), c = o - s, l = Math.abs(o + s);
1203
+ return Math.abs(c) >= on * l ? c : -pn(e, t, n, r, i, a, l);
1204
+ }
1205
+ (7 + 56 * Y) * Y, (3 + 28 * Y) * Y, (26 + 288 * Y) * Y * Y, Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(8), Z(8), Z(8), Z(4), Z(8), Z(8), Z(8), Z(12), Z(192), Z(192), (10 + 96 * Y) * Y, (4 + 48 * Y) * Y, (44 + 576 * Y) * Y * Y, Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(8), Z(8), Z(8), Z(8), Z(8), Z(8), Z(8), Z(8), Z(8), Z(4), Z(4), Z(4), Z(8), Z(16), Z(16), Z(16), Z(32), Z(32), Z(48), Z(64), Z(1152), Z(1152), (16 + 224 * Y) * Y, (5 + 72 * Y) * Y, (71 + 1408 * Y) * Y * Y, Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(4), Z(24), Z(24), Z(24), Z(24), Z(24), Z(24), Z(24), Z(24), Z(24), Z(24), Z(1152), Z(1152), Z(1152), Z(1152), Z(1152), Z(2304), Z(2304), Z(3456), Z(5760), Z(8), Z(8), Z(8), Z(16), Z(24), Z(48), Z(48), Z(96), Z(192), Z(384), Z(384), Z(384), Z(768), Z(96), Z(96), Z(96), Z(1152);
1206
+ //#endregion
1207
+ //#region node_modules/point-in-polygon-hao/dist/esm/index.js
1208
+ function hn(e, t) {
1209
+ var n, r, i = 0, a, o, s, c, l, u, d, f = e[0], p = e[1], m = t.length;
1210
+ for (n = 0; n < m; n++) {
1211
+ r = 0;
1212
+ var h = t[n], g = h.length - 1;
1213
+ if (u = h[0], u[0] !== h[g][0] && u[1] !== h[g][1]) throw Error("First and last coordinates in a ring must be the same");
1214
+ for (o = u[0] - f, s = u[1] - p; r < g; r++) {
1215
+ if (d = h[r + 1], c = d[0] - f, l = d[1] - p, s === 0 && l === 0) {
1216
+ if (c <= 0 && o >= 0 || o <= 0 && c >= 0) return 0;
1217
+ } else if (l >= 0 && s <= 0 || l <= 0 && s >= 0) {
1218
+ if (a = mn(o, c, s, l, 0, 0), a === 0) return 0;
1219
+ (a > 0 && l > 0 && s <= 0 || a < 0 && l <= 0 && s > 0) && i++;
1220
+ }
1221
+ u = d, s = l, o = c;
1222
+ }
1223
+ }
1224
+ return i % 2 != 0;
1225
+ }
1226
+ //#endregion
1227
+ //#region node_modules/@turf/boolean-point-in-polygon/dist/esm/index.js
1228
+ function gn(e, t, n = {}) {
1229
+ if (!e) throw Error("point is required");
1230
+ if (!t) throw Error("polygon is required");
1231
+ let r = B(e), i = H(t), a = i.type, o = t.bbox, s = i.coordinates;
1232
+ if (o && _n(r, o) === !1) return !1;
1233
+ a === "Polygon" && (s = [s]);
1234
+ let c = !1;
1235
+ for (var l = 0; l < s.length; ++l) {
1236
+ let e = hn(r, s[l]);
1237
+ if (e === 0) return !n.ignoreBoundary;
1238
+ e && (c = !0);
1239
+ }
1240
+ return c;
1241
+ }
1242
+ function _n(e, t) {
1243
+ return t[0] <= e[0] && t[1] <= e[1] && t[2] >= e[0] && t[3] >= e[1];
1244
+ }
1245
+ //#endregion
1246
+ //#region node_modules/@turf/geojson-rbush/dist/esm/index.js
1247
+ var vn = /* @__PURE__ */ fe((/* @__PURE__ */ ue(((e, t) => {
1248
+ (function(n, r) {
1249
+ typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n ||= self).RBush = r();
1250
+ })(e, function() {
1251
+ function e(e, r, i, a, o) {
1252
+ (function e(n, r, i, a, o) {
1253
+ for (; a > i;) {
1254
+ if (a - i > 600) {
1255
+ var s = a - i + 1, c = r - i + 1, l = Math.log(s), u = .5 * Math.exp(2 * l / 3), d = .5 * Math.sqrt(l * u * (s - u) / s) * (c - s / 2 < 0 ? -1 : 1);
1256
+ e(n, r, Math.max(i, Math.floor(r - c * u / s + d)), Math.min(a, Math.floor(r + (s - c) * u / s + d)), o);
1257
+ }
1258
+ var f = n[r], p = i, m = a;
1259
+ for (t(n, i, r), o(n[a], f) > 0 && t(n, i, a); p < m;) {
1260
+ for (t(n, p, m), p++, m--; o(n[p], f) < 0;) p++;
1261
+ for (; o(n[m], f) > 0;) m--;
1262
+ }
1263
+ o(n[i], f) === 0 ? t(n, i, m) : t(n, ++m, a), m <= r && (i = m + 1), r <= m && (a = m - 1);
1264
+ }
1265
+ })(e, r, i || 0, a || e.length - 1, o || n);
1266
+ }
1267
+ function t(e, t, n) {
1268
+ var r = e[t];
1269
+ e[t] = e[n], e[n] = r;
1270
+ }
1271
+ function n(e, t) {
1272
+ return e < t ? -1 : e > t ? 1 : 0;
1273
+ }
1274
+ var r = function(e) {
1275
+ e === void 0 && (e = 9), this._maxEntries = Math.max(4, e), this._minEntries = Math.max(2, Math.ceil(.4 * this._maxEntries)), this.clear();
1276
+ };
1277
+ function i(e, t, n) {
1278
+ if (!n) return t.indexOf(e);
1279
+ for (var r = 0; r < t.length; r++) if (n(e, t[r])) return r;
1280
+ return -1;
1281
+ }
1282
+ function a(e, t) {
1283
+ o(e, 0, e.children.length, t, e);
1284
+ }
1285
+ function o(e, t, n, r, i) {
1286
+ i ||= m(null), i.minX = Infinity, i.minY = Infinity, i.maxX = -Infinity, i.maxY = -Infinity;
1287
+ for (var a = t; a < n; a++) {
1288
+ var o = e.children[a];
1289
+ s(i, e.leaf ? r(o) : o);
1290
+ }
1291
+ return i;
1292
+ }
1293
+ function s(e, t) {
1294
+ return e.minX = Math.min(e.minX, t.minX), e.minY = Math.min(e.minY, t.minY), e.maxX = Math.max(e.maxX, t.maxX), e.maxY = Math.max(e.maxY, t.maxY), e;
1295
+ }
1296
+ function c(e, t) {
1297
+ return e.minX - t.minX;
1298
+ }
1299
+ function l(e, t) {
1300
+ return e.minY - t.minY;
1301
+ }
1302
+ function u(e) {
1303
+ return (e.maxX - e.minX) * (e.maxY - e.minY);
1304
+ }
1305
+ function d(e) {
1306
+ return e.maxX - e.minX + (e.maxY - e.minY);
1307
+ }
1308
+ function f(e, t) {
1309
+ return e.minX <= t.minX && e.minY <= t.minY && t.maxX <= e.maxX && t.maxY <= e.maxY;
1310
+ }
1311
+ function p(e, t) {
1312
+ return t.minX <= e.maxX && t.minY <= e.maxY && t.maxX >= e.minX && t.maxY >= e.minY;
1313
+ }
1314
+ function m(e) {
1315
+ return {
1316
+ children: e,
1317
+ height: 1,
1318
+ leaf: !0,
1319
+ minX: Infinity,
1320
+ minY: Infinity,
1321
+ maxX: -Infinity,
1322
+ maxY: -Infinity
1323
+ };
1324
+ }
1325
+ function h(t, n, r, i, a) {
1326
+ for (var o = [n, r]; o.length;) if (!((r = o.pop()) - (n = o.pop()) <= i)) {
1327
+ var s = n + Math.ceil((r - n) / i / 2) * i;
1328
+ e(t, s, n, r, a), o.push(n, s, s, r);
1329
+ }
1330
+ }
1331
+ return r.prototype.all = function() {
1332
+ return this._all(this.data, []);
1333
+ }, r.prototype.search = function(e) {
1334
+ var t = this.data, n = [];
1335
+ if (!p(e, t)) return n;
1336
+ for (var r = this.toBBox, i = []; t;) {
1337
+ for (var a = 0; a < t.children.length; a++) {
1338
+ var o = t.children[a], s = t.leaf ? r(o) : o;
1339
+ p(e, s) && (t.leaf ? n.push(o) : f(e, s) ? this._all(o, n) : i.push(o));
1340
+ }
1341
+ t = i.pop();
1342
+ }
1343
+ return n;
1344
+ }, r.prototype.collides = function(e) {
1345
+ var t = this.data;
1346
+ if (!p(e, t)) return !1;
1347
+ for (var n = []; t;) {
1348
+ for (var r = 0; r < t.children.length; r++) {
1349
+ var i = t.children[r], a = t.leaf ? this.toBBox(i) : i;
1350
+ if (p(e, a)) {
1351
+ if (t.leaf || f(e, a)) return !0;
1352
+ n.push(i);
1353
+ }
1354
+ }
1355
+ t = n.pop();
1356
+ }
1357
+ return !1;
1358
+ }, r.prototype.load = function(e) {
1359
+ if (!e || !e.length) return this;
1360
+ if (e.length < this._minEntries) {
1361
+ for (var t = 0; t < e.length; t++) this.insert(e[t]);
1362
+ return this;
1363
+ }
1364
+ var n = this._build(e.slice(), 0, e.length - 1, 0);
1365
+ if (this.data.children.length) if (this.data.height === n.height) this._splitRoot(this.data, n);
1366
+ else {
1367
+ if (this.data.height < n.height) {
1368
+ var r = this.data;
1369
+ this.data = n, n = r;
1370
+ }
1371
+ this._insert(n, this.data.height - n.height - 1, !0);
1372
+ }
1373
+ else this.data = n;
1374
+ return this;
1375
+ }, r.prototype.insert = function(e) {
1376
+ return e && this._insert(e, this.data.height - 1), this;
1377
+ }, r.prototype.clear = function() {
1378
+ return this.data = m([]), this;
1379
+ }, r.prototype.remove = function(e, t) {
1380
+ if (!e) return this;
1381
+ for (var n, r, a, o = this.data, s = this.toBBox(e), c = [], l = []; o || c.length;) {
1382
+ if (o || (o = c.pop(), r = c[c.length - 1], n = l.pop(), a = !0), o.leaf) {
1383
+ var u = i(e, o.children, t);
1384
+ if (u !== -1) return o.children.splice(u, 1), c.push(o), this._condense(c), this;
1385
+ }
1386
+ a || o.leaf || !f(o, s) ? r ? (n++, o = r.children[n], a = !1) : o = null : (c.push(o), l.push(n), n = 0, r = o, o = o.children[0]);
1387
+ }
1388
+ return this;
1389
+ }, r.prototype.toBBox = function(e) {
1390
+ return e;
1391
+ }, r.prototype.compareMinX = function(e, t) {
1392
+ return e.minX - t.minX;
1393
+ }, r.prototype.compareMinY = function(e, t) {
1394
+ return e.minY - t.minY;
1395
+ }, r.prototype.toJSON = function() {
1396
+ return this.data;
1397
+ }, r.prototype.fromJSON = function(e) {
1398
+ return this.data = e, this;
1399
+ }, r.prototype._all = function(e, t) {
1400
+ for (var n = []; e;) e.leaf ? t.push.apply(t, e.children) : n.push.apply(n, e.children), e = n.pop();
1401
+ return t;
1402
+ }, r.prototype._build = function(e, t, n, r) {
1403
+ var i, o = n - t + 1, s = this._maxEntries;
1404
+ if (o <= s) return a(i = m(e.slice(t, n + 1)), this.toBBox), i;
1405
+ r || (r = Math.ceil(Math.log(o) / Math.log(s)), s = Math.ceil(o / s ** (r - 1))), (i = m([])).leaf = !1, i.height = r;
1406
+ var c = Math.ceil(o / s), l = c * Math.ceil(Math.sqrt(s));
1407
+ h(e, t, n, l, this.compareMinX);
1408
+ for (var u = t; u <= n; u += l) {
1409
+ var d = Math.min(u + l - 1, n);
1410
+ h(e, u, d, c, this.compareMinY);
1411
+ for (var f = u; f <= d; f += c) {
1412
+ var p = Math.min(f + c - 1, d);
1413
+ i.children.push(this._build(e, f, p, r - 1));
1414
+ }
1415
+ }
1416
+ return a(i, this.toBBox), i;
1417
+ }, r.prototype._chooseSubtree = function(e, t, n, r) {
1418
+ for (; r.push(t), !t.leaf && r.length - 1 !== n;) {
1419
+ for (var i = Infinity, a = Infinity, o = void 0, s = 0; s < t.children.length; s++) {
1420
+ var c = t.children[s], l = u(c), d = (f = e, p = c, (Math.max(p.maxX, f.maxX) - Math.min(p.minX, f.minX)) * (Math.max(p.maxY, f.maxY) - Math.min(p.minY, f.minY)) - l);
1421
+ d < a ? (a = d, i = l < i ? l : i, o = c) : d === a && l < i && (i = l, o = c);
1422
+ }
1423
+ t = o || t.children[0];
1424
+ }
1425
+ var f, p;
1426
+ return t;
1427
+ }, r.prototype._insert = function(e, t, n) {
1428
+ var r = n ? e : this.toBBox(e), i = [], a = this._chooseSubtree(r, this.data, t, i);
1429
+ for (a.children.push(e), s(a, r); t >= 0 && i[t].children.length > this._maxEntries;) this._split(i, t), t--;
1430
+ this._adjustParentBBoxes(r, i, t);
1431
+ }, r.prototype._split = function(e, t) {
1432
+ var n = e[t], r = n.children.length, i = this._minEntries;
1433
+ this._chooseSplitAxis(n, i, r);
1434
+ var o = this._chooseSplitIndex(n, i, r), s = m(n.children.splice(o, n.children.length - o));
1435
+ s.height = n.height, s.leaf = n.leaf, a(n, this.toBBox), a(s, this.toBBox), t ? e[t - 1].children.push(s) : this._splitRoot(n, s);
1436
+ }, r.prototype._splitRoot = function(e, t) {
1437
+ this.data = m([e, t]), this.data.height = e.height + 1, this.data.leaf = !1, a(this.data, this.toBBox);
1438
+ }, r.prototype._chooseSplitIndex = function(e, t, n) {
1439
+ for (var r, i, a, s, c, l, d, f = Infinity, p = Infinity, m = t; m <= n - t; m++) {
1440
+ var h = o(e, 0, m, this.toBBox), g = o(e, m, n, this.toBBox), _ = (i = h, a = g, s = void 0, c = void 0, l = void 0, d = void 0, s = Math.max(i.minX, a.minX), c = Math.max(i.minY, a.minY), l = Math.min(i.maxX, a.maxX), d = Math.min(i.maxY, a.maxY), Math.max(0, l - s) * Math.max(0, d - c)), v = u(h) + u(g);
1441
+ _ < f ? (f = _, r = m, p = v < p ? v : p) : _ === f && v < p && (p = v, r = m);
1442
+ }
1443
+ return r || n - t;
1444
+ }, r.prototype._chooseSplitAxis = function(e, t, n) {
1445
+ var r = e.leaf ? this.compareMinX : c, i = e.leaf ? this.compareMinY : l;
1446
+ this._allDistMargin(e, t, n, r) < this._allDistMargin(e, t, n, i) && e.children.sort(r);
1447
+ }, r.prototype._allDistMargin = function(e, t, n, r) {
1448
+ e.children.sort(r);
1449
+ for (var i = this.toBBox, a = o(e, 0, t, i), c = o(e, n - t, n, i), l = d(a) + d(c), u = t; u < n - t; u++) {
1450
+ var f = e.children[u];
1451
+ s(a, e.leaf ? i(f) : f), l += d(a);
1452
+ }
1453
+ for (var p = n - t - 1; p >= t; p--) {
1454
+ var m = e.children[p];
1455
+ s(c, e.leaf ? i(m) : m), l += d(c);
1456
+ }
1457
+ return l;
1458
+ }, r.prototype._adjustParentBBoxes = function(e, t, n) {
1459
+ for (var r = n; r >= 0; r--) s(t[r], e);
1460
+ }, r.prototype._condense = function(e) {
1461
+ for (var t = e.length - 1, n = void 0; t >= 0; t--) e[t].children.length === 0 ? t > 0 ? (n = e[t - 1].children).splice(n.indexOf(e[t]), 1) : this.clear() : a(e[t], this.toBBox);
1462
+ }, r;
1463
+ });
1464
+ })))(), 1);
1465
+ function yn(e) {
1466
+ var t;
1467
+ if (e.bbox) t = e.bbox;
1468
+ else if (Array.isArray(e) && e.length === 4) t = e;
1469
+ else if (Array.isArray(e) && e.length === 6) t = [
1470
+ e[0],
1471
+ e[1],
1472
+ e[3],
1473
+ e[4]
1474
+ ];
1475
+ else if (e.type === "Feature") t = G(e);
1476
+ else if (e.type === "FeatureCollection") t = G(e);
1477
+ else throw Error("invalid geojson");
1478
+ return {
1479
+ minX: t[0],
1480
+ minY: t[1],
1481
+ maxX: t[2],
1482
+ maxY: t[3]
1483
+ };
1484
+ }
1485
+ var bn = class {
1486
+ constructor(e = 9) {
1487
+ this.tree = new vn.default(e), this.tree.toBBox = yn;
1488
+ }
1489
+ insert(e) {
1490
+ if (e.type !== "Feature") throw Error("invalid feature");
1491
+ return e.bbox = e.bbox ? e.bbox : G(e), this.tree.insert(e), this;
1492
+ }
1493
+ load(e) {
1494
+ var t = [];
1495
+ return Array.isArray(e) ? e.forEach(function(e) {
1496
+ if (e.type !== "Feature") throw Error("invalid features");
1497
+ e.bbox = e.bbox ? e.bbox : G(e), t.push(e);
1498
+ }) : Ce(e, function(e) {
1499
+ if (e.type !== "Feature") throw Error("invalid features");
1500
+ e.bbox = e.bbox ? e.bbox : G(e), t.push(e);
1501
+ }), this.tree.load(t), this;
1502
+ }
1503
+ remove(e, t) {
1504
+ if (e.type !== "Feature") throw Error("invalid feature");
1505
+ return e.bbox = e.bbox ? e.bbox : G(e), this.tree.remove(e, t), this;
1506
+ }
1507
+ clear() {
1508
+ return this.tree.clear(), this;
1509
+ }
1510
+ search(e) {
1511
+ return L(this.tree.search(yn(e)));
1512
+ }
1513
+ collides(e) {
1514
+ return this.tree.collides(yn(e));
1515
+ }
1516
+ all() {
1517
+ return L(this.tree.all());
1518
+ }
1519
+ toJSON() {
1520
+ return this.tree.toJSON();
1521
+ }
1522
+ fromJSON(e) {
1523
+ return this.tree.fromJSON(e), this;
1524
+ }
1525
+ };
1526
+ function xn(e) {
1527
+ return new bn(e);
1528
+ }
1529
+ //#endregion
1530
+ //#region node_modules/@turf/truncate/dist/esm/index.js
1531
+ function Sn(e, t) {
1532
+ if (t ??= {}, !xe(t)) throw Error("options is invalid");
1533
+ var n = t.precision, r = t.coordinates, i = t.mutate;
1534
+ if (n = n == null || isNaN(n) ? 6 : n, r = r == null || isNaN(r) ? 3 : r, !e) throw Error("<geojson> is required");
1535
+ if (typeof n != "number") throw Error("<precision> must be a number");
1536
+ if (typeof r != "number") throw Error("<coordinates> must be a number");
1537
+ (i === !1 || i === void 0) && (e = JSON.parse(JSON.stringify(e)));
1538
+ var a = 10 ** n;
1539
+ return Se(e, function(e) {
1540
+ Cn(e, a, r);
1541
+ }), e;
1542
+ }
1543
+ function Cn(e, t, n) {
1544
+ e.length > n && e.splice(n, e.length);
1545
+ for (var r = 0; r < e.length; r++) e[r] = Math.round(e[r] * t) / t;
1546
+ return e;
1547
+ }
1548
+ //#endregion
1549
+ //#region node_modules/@turf/line-segment/dist/esm/index.js
1550
+ function wn(e) {
1551
+ if (!e) throw Error("geojson is required");
1552
+ let t = [];
1553
+ return De(e, (e) => {
1554
+ Tn(e, t);
1555
+ }), L(t);
1556
+ }
1557
+ function Tn(e, t) {
1558
+ let n = [], r = e.geometry;
1559
+ if (r !== null) {
1560
+ switch (r.type) {
1561
+ case "Polygon":
1562
+ n = V(r);
1563
+ break;
1564
+ case "LineString": n = [V(r)];
1565
+ }
1566
+ n.forEach((n) => {
1567
+ En(n, e.properties).forEach((e) => {
1568
+ e.id = t.length, t.push(e);
1569
+ });
1570
+ });
1571
+ }
1572
+ }
1573
+ function En(e, t) {
1574
+ let n = [];
1575
+ return e.reduce((e, r) => {
1576
+ let i = I([e, r], t);
1577
+ return i.bbox = Dn(e, r), n.push(i), r;
1578
+ }), n;
1579
+ }
1580
+ function Dn(e, t) {
1581
+ let n = e[0], r = e[1], i = t[0], a = t[1];
1582
+ return [
1583
+ n < i ? n : i,
1584
+ r < a ? r : a,
1585
+ n > i ? n : i,
1586
+ r > a ? r : a
1587
+ ];
1588
+ }
1589
+ //#endregion
1590
+ //#region node_modules/sweepline-intersections/dist/sweeplineIntersections.esm.js
1591
+ var On = class {
1592
+ constructor(e = [], t = kn) {
1593
+ if (this.data = e, this.length = this.data.length, this.compare = t, this.length > 0) for (let e = (this.length >> 1) - 1; e >= 0; e--) this._down(e);
1594
+ }
1595
+ push(e) {
1596
+ this.data.push(e), this.length++, this._up(this.length - 1);
1597
+ }
1598
+ pop() {
1599
+ if (this.length === 0) return;
1600
+ let e = this.data[0], t = this.data.pop();
1601
+ return this.length--, this.length > 0 && (this.data[0] = t, this._down(0)), e;
1602
+ }
1603
+ peek() {
1604
+ return this.data[0];
1605
+ }
1606
+ _up(e) {
1607
+ let { data: t, compare: n } = this, r = t[e];
1608
+ for (; e > 0;) {
1609
+ let i = e - 1 >> 1, a = t[i];
1610
+ if (n(r, a) >= 0) break;
1611
+ t[e] = a, e = i;
1612
+ }
1613
+ t[e] = r;
1614
+ }
1615
+ _down(e) {
1616
+ let { data: t, compare: n } = this, r = this.length >> 1, i = t[e];
1617
+ for (; e < r;) {
1618
+ let r = (e << 1) + 1, a = t[r], o = r + 1;
1619
+ if (o < this.length && n(t[o], a) < 0 && (r = o, a = t[o]), n(a, i) >= 0) break;
1620
+ t[e] = a, e = r;
1621
+ }
1622
+ t[e] = i;
1623
+ }
1624
+ };
1625
+ function kn(e, t) {
1626
+ return e < t ? -1 : e > t ? 1 : 0;
1627
+ }
1628
+ function An(e, t) {
1629
+ return e.p.x > t.p.x ? 1 : e.p.x < t.p.x ? -1 : e.p.y === t.p.y || e.p.y > t.p.y ? 1 : -1;
1630
+ }
1631
+ function jn(e, t) {
1632
+ return e.rightSweepEvent.p.x > t.rightSweepEvent.p.x ? 1 : e.rightSweepEvent.p.x < t.rightSweepEvent.p.x ? -1 : e.rightSweepEvent.p.y === t.rightSweepEvent.p.y || e.rightSweepEvent.p.y < t.rightSweepEvent.p.y ? 1 : -1;
1633
+ }
1634
+ var Mn = class {
1635
+ constructor(e, t, n, r) {
1636
+ this.p = {
1637
+ x: e[0],
1638
+ y: e[1]
1639
+ }, this.featureId = t, this.ringId = n, this.eventId = r, this.otherEvent = null, this.isLeftEndpoint = null;
1640
+ }
1641
+ isSamePoint(e) {
1642
+ return this.p.x === e.p.x && this.p.y === e.p.y;
1643
+ }
1644
+ };
1645
+ function Nn(e, t) {
1646
+ if (e.type === "FeatureCollection") {
1647
+ let n = e.features;
1648
+ for (let e = 0; e < n.length; e++) Ln(n[e], t);
1649
+ } else Ln(e, t);
1650
+ }
1651
+ var Pn = 0, Fn = 0, In = 0;
1652
+ function Ln(e, t) {
1653
+ let n = e.type === "Feature" ? e.geometry : e, r = n.coordinates;
1654
+ (n.type === "Polygon" || n.type === "MultiLineString") && (r = [r]), n.type === "LineString" && (r = [[r]]);
1655
+ for (let e = 0; e < r.length; e++) for (let n = 0; n < r[e].length; n++) {
1656
+ let i = r[e][n][0], a = null;
1657
+ Fn += 1;
1658
+ for (let o = 0; o < r[e][n].length - 1; o++) {
1659
+ a = r[e][n][o + 1];
1660
+ let s = new Mn(i, Pn, Fn, In), c = new Mn(a, Pn, Fn, In + 1);
1661
+ s.otherEvent = c, c.otherEvent = s, An(s, c) > 0 ? (c.isLeftEndpoint = !0, s.isLeftEndpoint = !1) : (s.isLeftEndpoint = !0, c.isLeftEndpoint = !1), t.push(s), t.push(c), i = a, In += 1;
1662
+ }
1663
+ }
1664
+ Pn += 1;
1665
+ }
1666
+ var Rn = class {
1667
+ constructor(e) {
1668
+ this.leftSweepEvent = e, this.rightSweepEvent = e.otherEvent;
1669
+ }
1670
+ };
1671
+ function zn(e, t) {
1672
+ if (e === null || t === null || e.leftSweepEvent.ringId === t.leftSweepEvent.ringId && (e.rightSweepEvent.isSamePoint(t.leftSweepEvent) || e.rightSweepEvent.isSamePoint(t.leftSweepEvent) || e.rightSweepEvent.isSamePoint(t.rightSweepEvent) || e.leftSweepEvent.isSamePoint(t.leftSweepEvent) || e.leftSweepEvent.isSamePoint(t.rightSweepEvent))) return !1;
1673
+ let n = e.leftSweepEvent.p.x, r = e.leftSweepEvent.p.y, i = e.rightSweepEvent.p.x, a = e.rightSweepEvent.p.y, o = t.leftSweepEvent.p.x, s = t.leftSweepEvent.p.y, c = t.rightSweepEvent.p.x, l = t.rightSweepEvent.p.y, u = (l - s) * (i - n) - (c - o) * (a - r), d = (c - o) * (r - s) - (l - s) * (n - o), f = (i - n) * (r - s) - (a - r) * (n - o);
1674
+ if (u === 0) return !1;
1675
+ let p = d / u, m = f / u;
1676
+ return p >= 0 && p <= 1 && m >= 0 && m <= 1 ? [n + p * (i - n), r + p * (a - r)] : !1;
1677
+ }
1678
+ function Bn(e, t) {
1679
+ t ||= !1;
1680
+ let n = [], r = new On([], jn);
1681
+ for (; e.length;) {
1682
+ let i = e.pop();
1683
+ if (i.isLeftEndpoint) {
1684
+ let e = new Rn(i);
1685
+ for (let a = 0; a < r.data.length; a++) {
1686
+ let o = r.data[a];
1687
+ if (t && o.leftSweepEvent.featureId === i.featureId) continue;
1688
+ let s = zn(e, o);
1689
+ s !== !1 && n.push(s);
1690
+ }
1691
+ r.push(e);
1692
+ } else i.isLeftEndpoint === !1 && r.pop();
1693
+ }
1694
+ return n;
1695
+ }
1696
+ function Vn(e, t) {
1697
+ let n = new On([], An);
1698
+ return Nn(e, n), Bn(n, t);
1699
+ }
1700
+ //#endregion
1701
+ //#region node_modules/@turf/line-intersect/dist/esm/index.js
1702
+ var Hn = Vn;
1703
+ function Un(e, t, n = {}) {
1704
+ let { removeDuplicates: r = !0, ignoreSelfIntersections: i = !0 } = n, a = [];
1705
+ e.type === "FeatureCollection" ? a = a.concat(e.features) : e.type === "Feature" ? a.push(e) : (e.type === "LineString" || e.type === "Polygon" || e.type === "MultiLineString" || e.type === "MultiPolygon") && a.push(F(e)), t.type === "FeatureCollection" ? a = a.concat(t.features) : t.type === "Feature" ? a.push(t) : (t.type === "LineString" || t.type === "Polygon" || t.type === "MultiLineString" || t.type === "MultiPolygon") && a.push(F(t));
1706
+ let o = Hn(L(a), i), s = [];
1707
+ if (r) {
1708
+ let e = {};
1709
+ o.forEach((t) => {
1710
+ let n = t.join(",");
1711
+ e[n] || (e[n] = !0, s.push(t));
1712
+ });
1713
+ } else s = o;
1714
+ return L(s.map((e) => me(e)));
1715
+ }
1716
+ //#endregion
1717
+ //#region node_modules/@turf/distance/dist/esm/index.js
1718
+ function Wn(e, t, n = {}) {
1719
+ var r = B(e), i = B(t), a = R(i[1] - r[1]), o = R(i[0] - r[0]), s = R(r[1]), c = R(i[1]), l = Math.sin(a / 2) ** 2 + Math.sin(o / 2) ** 2 * Math.cos(s) * Math.cos(c);
1720
+ return ve(2 * Math.atan2(Math.sqrt(l), Math.sqrt(1 - l)), n.units);
1721
+ }
1722
+ //#endregion
1723
+ //#region node_modules/@turf/nearest-point-on-line/dist/esm/index.js
1724
+ var Gn = Object.defineProperty, Kn = Object.defineProperties, qn = Object.getOwnPropertyDescriptors, Jn = Object.getOwnPropertySymbols, Yn = Object.prototype.hasOwnProperty, Xn = Object.prototype.propertyIsEnumerable, Zn = (e, t, n) => t in e ? Gn(e, t, {
1725
+ enumerable: !0,
1726
+ configurable: !0,
1727
+ writable: !0,
1728
+ value: n
1729
+ }) : e[t] = n, Qn = (e, t) => {
1730
+ for (var n in t ||= {}) Yn.call(t, n) && Zn(e, n, t[n]);
1731
+ if (Jn) for (var n of Jn(t)) Xn.call(t, n) && Zn(e, n, t[n]);
1732
+ return e;
1733
+ }, $n = (e, t) => Kn(e, qn(t));
1734
+ function er(e, t, n = {}) {
1735
+ if (!e || !t) throw Error("lines and inputPoint are required arguments");
1736
+ let r = B(t), i = me([Infinity, Infinity], {
1737
+ lineStringIndex: -1,
1738
+ segmentIndex: -1,
1739
+ totalDistance: -1,
1740
+ lineDistance: -1,
1741
+ segmentDistance: -1,
1742
+ pointDistance: Infinity,
1743
+ multiFeatureIndex: -1,
1744
+ index: -1,
1745
+ location: -1,
1746
+ dist: Infinity
1747
+ }), a = 0, o = 0, s = -1;
1748
+ return De(e, function(e, c, l) {
1749
+ s !== l && (s = l, o = 0);
1750
+ let u = V(e);
1751
+ for (let e = 0; e < u.length - 1; e++) {
1752
+ let s = me(u[e]), c = B(s), d = me(u[e + 1]), f = B(d), p = Wn(s, d, n), m, h;
1753
+ f[0] === r[0] && f[1] === r[1] ? [m, h] = [f, !0] : c[0] === r[0] && c[1] === r[1] ? [m, h] = [c, !1] : [m, h] = or(c, f, r);
1754
+ let g = Wn(t, m, n);
1755
+ if (g < i.properties.pointDistance) {
1756
+ let t = Wn(s, m, n);
1757
+ i = me(m, {
1758
+ lineStringIndex: l,
1759
+ segmentIndex: h ? e + 1 : e,
1760
+ totalDistance: a + t,
1761
+ lineDistance: o + t,
1762
+ segmentDistance: t,
1763
+ pointDistance: g,
1764
+ multiFeatureIndex: -1,
1765
+ index: -1,
1766
+ location: -1,
1767
+ dist: Infinity
1768
+ }), i.properties = $n(Qn({}, i.properties), {
1769
+ multiFeatureIndex: i.properties.lineStringIndex,
1770
+ index: i.properties.segmentIndex,
1771
+ location: i.properties.totalDistance,
1772
+ dist: i.properties.pointDistance
1773
+ });
1774
+ }
1775
+ a += p, o += p;
1776
+ }
1777
+ }), i;
1778
+ }
1779
+ function $(e, t) {
1780
+ let [n, r, i] = e, [a, o, s] = t;
1781
+ return n * a + r * o + i * s;
1782
+ }
1783
+ function tr(e, t) {
1784
+ let [n, r, i] = e, [a, o, s] = t;
1785
+ return [
1786
+ r * s - i * o,
1787
+ i * a - n * s,
1788
+ n * o - r * a
1789
+ ];
1790
+ }
1791
+ function nr(e) {
1792
+ return Math.sqrt(e[0] ** 2 + e[1] ** 2 + e[2] ** 2);
1793
+ }
1794
+ function rr(e) {
1795
+ let t = nr(e);
1796
+ return [
1797
+ e[0] / t,
1798
+ e[1] / t,
1799
+ e[2] / t
1800
+ ];
1801
+ }
1802
+ function ir(e) {
1803
+ let t = R(e[1]), n = R(e[0]);
1804
+ return [
1805
+ Math.cos(t) * Math.cos(n),
1806
+ Math.cos(t) * Math.sin(n),
1807
+ Math.sin(t)
1808
+ ];
1809
+ }
1810
+ function ar(e) {
1811
+ let [t, n, r] = e, i = Math.min(Math.max(r, -1), 1), a = ye(Math.asin(i));
1812
+ return [ye(Math.atan2(n, t)), a];
1813
+ }
1814
+ function or(e, t, n) {
1815
+ let r = ir(e), i = ir(t), a = ir(n), o = tr(r, i);
1816
+ if (o[0] === 0 && o[1] === 0 && o[2] === 0) return $(r, i) > 0 ? [[...t], !0] : [[...n], !1];
1817
+ let s = tr(o, a);
1818
+ if (s[0] === 0 && s[1] === 0 && s[2] === 0) return [[...t], !0];
1819
+ let c = rr(tr(s, o)), l = [
1820
+ -c[0],
1821
+ -c[1],
1822
+ -c[2]
1823
+ ], u = $(a, c) > $(a, l) ? c : l, d = rr(o), f = $(tr(r, u), d), p = $(tr(u, i), d);
1824
+ return f >= 0 && p >= 0 ? [ar(u), !1] : $(r, a) > $(i, a) ? [[...e], !1] : [[...t], !0];
1825
+ }
1826
+ //#endregion
1827
+ //#region node_modules/@turf/line-split/dist/esm/index.js
1828
+ function sr(e, t) {
1829
+ if (!e) throw Error("line is required");
1830
+ if (!t) throw Error("splitter is required");
1831
+ let n = He(e), r = He(t);
1832
+ if (n !== "LineString") throw Error("line must be LineString");
1833
+ if (r === "FeatureCollection") throw Error("splitter cannot be a FeatureCollection");
1834
+ if (r === "GeometryCollection") throw Error("splitter cannot be a GeometryCollection");
1835
+ var i = Sn(t, { precision: 7 });
1836
+ switch (e.type !== "Feature" && (e = F(e)), r) {
1837
+ case "Point": return lr(e, i);
1838
+ case "MultiPoint": return cr(e, i);
1839
+ case "LineString":
1840
+ case "MultiLineString":
1841
+ case "Polygon":
1842
+ case "MultiPolygon": return cr(e, Un(e, i, { ignoreSelfIntersections: !0 }));
1843
+ }
1844
+ }
1845
+ function cr(e, t) {
1846
+ var n = [], r = xn();
1847
+ return De(t, function(t) {
1848
+ if (n.forEach(function(e, t) {
1849
+ e.id = t;
1850
+ }), !n.length) n = lr(e, t).features, r.load(L(n));
1851
+ else {
1852
+ var i = r.search(t);
1853
+ if (i.features.length) {
1854
+ var a = ur(t, i);
1855
+ n = n.filter(function(e) {
1856
+ return e.id !== a.id;
1857
+ }), r.remove(a), Ce(lr(a, t), function(e) {
1858
+ n.push(e), r.insert(e);
1859
+ });
1860
+ }
1861
+ }
1862
+ }), L(n);
1863
+ }
1864
+ function lr(e, t) {
1865
+ var n = [], r = V(e)[0], i = V(e)[e.geometry.coordinates.length - 1];
1866
+ if (dr(r, B(t)) || dr(i, B(t))) return L([e]);
1867
+ var a = xn(), o = wn(e);
1868
+ a.load(o);
1869
+ var s = a.search(t);
1870
+ if (!s.features.length) return L([e]);
1871
+ var c = ur(t, s), l = we(o, function(e, r, i) {
1872
+ var a = V(r)[1], o = B(t);
1873
+ return i === c.id ? (e.push(o), n.push(I(e)), dr(o, a) ? [o] : [o, a]) : (e.push(a), e);
1874
+ }, [r]);
1875
+ return l.length > 1 && n.push(I(l)), L(n);
1876
+ }
1877
+ function ur(e, t) {
1878
+ if (!t.features.length) throw Error("lines must contain features");
1879
+ if (t.features.length === 1) return t.features[0];
1880
+ var n, r = Infinity;
1881
+ return Ce(t, function(t) {
1882
+ var i = er(t, e).properties.dist;
1883
+ i < r && (n = t, r = i);
1884
+ }), n;
1885
+ }
1886
+ function dr(e, t) {
1887
+ return e[0] === t[0] && e[1] === t[1];
1888
+ }
1889
+ //#endregion
1890
+ //#region node_modules/@turf/boolean-contains/dist/esm/index.js
1891
+ function fr(e, t) {
1892
+ let n = H(e), r = H(t), i = n.type, a = r.type, o = n.coordinates, s = r.coordinates;
1893
+ switch (i) {
1894
+ case "Point": switch (a) {
1895
+ case "Point": return wr(o, s);
1896
+ default: throw Error("feature2 " + a + " geometry not supported");
1897
+ }
1898
+ case "MultiPoint": switch (a) {
1899
+ case "Point": return hr(n, r);
1900
+ case "MultiPoint": return gr(n, r);
1901
+ default: throw Error("feature2 " + a + " geometry not supported");
1902
+ }
1903
+ case "LineString": switch (a) {
1904
+ case "Point": return U(r, n, { ignoreEndVertices: !0 });
1905
+ case "LineString": return yr(n, r);
1906
+ case "MultiPoint": return _r(n, r);
1907
+ default: throw Error("feature2 " + a + " geometry not supported");
1908
+ }
1909
+ case "Polygon": switch (a) {
1910
+ case "Point": return gn(r, n, { ignoreBoundary: !0 });
1911
+ case "LineString": return xr(n, r);
1912
+ case "Polygon": return Sr(n, r);
1913
+ case "MultiPoint": return vr(n, r);
1914
+ case "MultiPolygon": return mr(n, r);
1915
+ default: throw Error("feature2 " + a + " geometry not supported");
1916
+ }
1917
+ case "MultiPolygon": switch (a) {
1918
+ case "Polygon": return pr(n, r);
1919
+ default: throw Error("feature2 " + a + " geometry not supported");
1920
+ }
1921
+ default: throw Error("feature1 " + i + " geometry not supported");
1922
+ }
1923
+ }
1924
+ function pr(e, t) {
1925
+ return e.coordinates.some((e) => Sr({
1926
+ type: "Polygon",
1927
+ coordinates: e
1928
+ }, t));
1929
+ }
1930
+ function mr(e, t) {
1931
+ return t.coordinates.every((t) => Sr(e, {
1932
+ type: "Polygon",
1933
+ coordinates: t
1934
+ }));
1935
+ }
1936
+ function hr(e, t) {
1937
+ let n, r = !1;
1938
+ for (n = 0; n < e.coordinates.length; n++) if (wr(e.coordinates[n], t.coordinates)) {
1939
+ r = !0;
1940
+ break;
1941
+ }
1942
+ return r;
1943
+ }
1944
+ function gr(e, t) {
1945
+ for (let n of t.coordinates) {
1946
+ let t = !1;
1947
+ for (let r of e.coordinates) if (wr(n, r)) {
1948
+ t = !0;
1949
+ break;
1950
+ }
1951
+ if (!t) return !1;
1952
+ }
1953
+ return !0;
1954
+ }
1955
+ function _r(e, t) {
1956
+ let n = !1;
1957
+ for (let r of t.coordinates) if (U(r, e, { ignoreEndVertices: !0 }) && (n = !0), !U(r, e)) return !1;
1958
+ return !!n;
1959
+ }
1960
+ function vr(e, t) {
1961
+ for (let n of t.coordinates) if (!gn(n, e, { ignoreBoundary: !0 })) return !1;
1962
+ return !0;
1963
+ }
1964
+ function yr(e, t) {
1965
+ let n = !1;
1966
+ for (let r of t.coordinates) if (U({
1967
+ type: "Point",
1968
+ coordinates: r
1969
+ }, e, { ignoreEndVertices: !0 }) && (n = !0), !U({
1970
+ type: "Point",
1971
+ coordinates: r
1972
+ }, e, { ignoreEndVertices: !1 })) return !1;
1973
+ return n;
1974
+ }
1975
+ function br(e, t) {
1976
+ let n = e.coordinates, r = [];
1977
+ for (let e = 0; e < n.length - 1; e++) {
1978
+ let i = I([n[e], n[e + 1]]), a = sr(i, F(t));
1979
+ a.features.length === 0 ? r.push(i) : r.push(...a.features);
1980
+ }
1981
+ return L(r);
1982
+ }
1983
+ function xr(e, t) {
1984
+ if (!Cr(G(e), G(t))) return !1;
1985
+ for (let n of t.coordinates) if (!gn(n, e)) return !1;
1986
+ let n = !1, r = br(t, e);
1987
+ for (let t of r.features) {
1988
+ let r = Tr(t.geometry.coordinates[0], t.geometry.coordinates[1]);
1989
+ if (!gn(r, e)) return !1;
1990
+ !n && gn(r, e, { ignoreBoundary: !0 }) && (n = !0);
1991
+ }
1992
+ return n;
1993
+ }
1994
+ function Sr(e, t) {
1995
+ if (e.type === "Feature" && e.geometry === null || t.type === "Feature" && t.geometry === null || !Cr(G(e), G(t))) return !1;
1996
+ let n = H(t).coordinates;
1997
+ for (let t of n) for (let n of t) if (!gn(n, e)) return !1;
1998
+ return !0;
1999
+ }
2000
+ function Cr(e, t) {
2001
+ return !(e[0] > t[0] || e[2] < t[2] || e[1] > t[1] || e[3] < t[3]);
2002
+ }
2003
+ function wr(e, t) {
2004
+ return e[0] === t[0] && e[1] === t[1];
2005
+ }
2006
+ function Tr(e, t) {
2007
+ return [(e[0] + t[0]) / 2, (e[1] + t[1]) / 2];
2008
+ }
2009
+ var Er = fr;
2010
+ //#endregion
2011
+ //#region node_modules/@turf/envelope/dist/esm/index.js
2012
+ function Dr(e) {
2013
+ return en(G(e));
2014
+ }
2015
+ var Or = Dr;
2016
+ //#endregion
2017
+ //#region src/utils/geom.ts
2018
+ function kr(e) {
2019
+ return e.geometry && (e.geometry.type === "LineString" || e.geometry.type === "MultiLineString" || e.geometry.type === "Polygon" || e.geometry.type === "MultiPolygon");
2020
+ }
2021
+ function Ar(e, t) {
2022
+ let n = e.map((e) => e.geometry ? e.geometry.type === "Point" || e.geometry.type === "MultiPoint" ? Er(tn(t), e) ? e : null : kr(e) ? $t(e, t) : null : null).filter((e) => e !== null);
2023
+ return n.length === 0 ? null : Or(L(n));
2024
+ }
2025
+ var jr = .001;
2026
+ function Mr(e) {
2027
+ let t = e[0], n = e[1], r = e[2], i = e[3];
2028
+ return t === r && (t -= jr, r += jr), n === i && (n -= jr, i += jr), [
2029
+ t,
2030
+ n,
2031
+ r,
2032
+ i
2033
+ ];
2034
+ }
2035
+ //#endregion
2036
+ //#region src/components/VMap.vue?vue&type=script&setup=true&lang.ts
2037
+ var Nr = ["id"], Pr = /* @__PURE__ */ vt(/* @__PURE__ */ c({
2038
+ __name: "VMap",
2039
+ props: {
2040
+ id: {},
2041
+ features: {},
2042
+ bbox: {}
2043
+ },
2044
+ setup(e) {
2045
+ let t = e, n = {
2046
+ top: 60,
2047
+ left: 60,
2048
+ right: 60,
2049
+ bottom: 80
2050
+ }, r = T(), a = T(!1), o = T(), s = T();
2051
+ j(a, (e) => {
2052
+ e ? c() : (r.value && r.value.remove(), r.value = void 0);
2053
+ }), j(() => t.features, (e) => {
2054
+ r.value && a.value && e && (r.value.remove(), r.value = void 0, c());
2055
+ });
2056
+ function c() {
2057
+ if (!r.value) {
2058
+ let e = t.bbox ? Ar(t.features, Mr(t.bbox)) : L(t.features);
2059
+ if (e) {
2060
+ let i = bt(e), a = [[i[0], i[1]], [i[2], i[3]]];
2061
+ r.value = new re.Map({
2062
+ hash: !1,
2063
+ container: `map-${t.id}`,
2064
+ bounds: a,
2065
+ fitBoundsOptions: {
2066
+ padding: n,
2067
+ animate: !1,
2068
+ maxZoom: 17
2069
+ },
2070
+ style: Gt,
2071
+ attributionControl: { compact: !1 }
2072
+ }), r.value.addControl(new re.NavigationControl()), r.value.on("load", u);
2073
+ }
2074
+ }
2075
+ }
2076
+ function l(e) {
2077
+ if (!r.value) throw Error("Call initMap() function first.");
2078
+ r.value.addSource(qt, {
2079
+ type: "geojson",
2080
+ data: {
2081
+ type: "Feature",
2082
+ geometry: {
2083
+ type: "Polygon",
2084
+ coordinates: [[
2085
+ [e[0], e[1]],
2086
+ [e[2], e[1]],
2087
+ [e[2], e[3]],
2088
+ [e[0], e[3]],
2089
+ [e[0], e[1]]
2090
+ ]]
2091
+ },
2092
+ properties: {}
2093
+ }
2094
+ }), r.value.addLayer(q.Bbox);
2095
+ }
2096
+ function u() {
2097
+ if (!r.value) throw Error("Call initMap() function first.");
2098
+ t.bbox && l(t.bbox), r.value.addSource(K, {
2099
+ type: "geojson",
2100
+ data: {
2101
+ type: "FeatureCollection",
2102
+ features: t.features
2103
+ }
2104
+ }), d(), h();
2105
+ }
2106
+ function d() {
2107
+ if (!r.value) throw Error("Call initMap() function first.");
2108
+ r.value.getLayer(q.Polygon.id) || r.value.addLayer(q.Polygon), r.value.getLayer(q.PolygonBorder.id) || r.value.addLayer(q.PolygonBorder), r.value.getLayer(q.LineStringBorder.id) || r.value.addLayer(q.LineStringBorder), r.value.getLayer(q.LineString.id) || r.value.addLayer(q.LineString), r.value.getLayer(q.Point.id) || r.value.addLayer(q.Point);
2109
+ }
2110
+ function f(e) {
2111
+ !e.features || e.features.length === 0 || (s.value !== void 0 && _(), s.value = e.features[0], g(e.lngLat, e.features[0]));
2112
+ }
2113
+ function p() {
2114
+ r.value.getCanvas().style.cursor = "pointer";
2115
+ }
2116
+ function m() {
2117
+ r.value.getCanvas().style.cursor = "", s.value !== void 0 && (s.value = void 0), _();
2118
+ }
2119
+ function h() {
2120
+ if (!r.value) throw Error("Call initMap() function first.");
2121
+ Object.values(q).forEach((e) => {
2122
+ e.id !== "bbox-layer" && (r.value.on("mousemove", e.id, f), r.value.on("mouseenter", e.id, p), r.value.on("mouseleave", e.id, m));
2123
+ });
2124
+ }
2125
+ function g(e, t) {
2126
+ if (!r.value) throw Error("Call initMap() function first.");
2127
+ o.value = new re.Popup().setLngLat(e).setHTML(`${tt[t.properties.objtype]}-${t.properties.id}-v${t.properties.version}`).addTo(r.value);
2128
+ }
2129
+ function _() {
2130
+ o.value?.remove(), o.value = void 0;
2131
+ }
2132
+ function v([e]) {
2133
+ a.value = e?.isIntersecting || !1;
2134
+ }
2135
+ return (t, n) => ne((y(), i("div", {
2136
+ id: `map-${e.id}`,
2137
+ class: "v-map"
2138
+ }, null, 8, Nr)), [[k(Ut), v]]);
2139
+ }
2140
+ }), [["__scopeId", "data-v-4ab07a92"]]), Fr = { class: "locha-group" }, Ir = { class: "link-metadata" }, Lr = { class: "before-list" }, Rr = { class: "after-list" }, zr = /* @__PURE__ */ vt(/* @__PURE__ */ c({
2141
+ __name: "LoChaGroup",
2142
+ props: {
2143
+ index: {},
2144
+ features: {},
2145
+ josmTarget: {}
2146
+ },
2147
+ setup(t) {
2148
+ let n = t, r = f(et), { loCha: s, getBeforeFeatures: c, getAfterFeatures: l } = f($e);
2149
+ if (!s.value) throw Error("LoCha is empty.");
2150
+ function u(e, t) {
2151
+ if (e.properties.is_before) {
2152
+ let n = s.value.metadata.links[t].find((t) => t.before === e.id || t.after === e.id);
2153
+ return n && [n];
2154
+ }
2155
+ return s.value.metadata.links[t].filter((t) => t.before === e.id || t.after === e.id);
2156
+ }
2157
+ function d(e) {
2158
+ return s.value.features.find((t) => t.id === e.before)?.properties;
2159
+ }
2160
+ function p(e) {
2161
+ let t = "", n = s.value.features.find((t) => t.id === e.before);
2162
+ return n && (t = `${n.properties.objtype}${n.properties.id}-v${n.properties.version}`), t;
2163
+ }
2164
+ return (f, m) => (y(), i("div", Fr, [
2165
+ a("div", Ir, [w(f.$slots, "link-metadata", {
2166
+ links: k(s).metadata.links[t.index],
2167
+ index: t.index
2168
+ }, void 0, !0)]),
2169
+ a("div", Lr, [a("ul", null, [(y(!0), i(e, null, C(k(c)(t.features), (n) => (y(), i("li", { key: n.id }, [o(yt, {
2170
+ feature: n,
2171
+ "josm-target": t.josmTarget
2172
+ }, {
2173
+ "tags-diff": M(() => [(y(!0), i(e, null, C(u(n, t.index), (e, t) => w(f.$slots, "tags-diff", {
2174
+ key: t,
2175
+ date: n.properties.created,
2176
+ diff: e.diff_tags,
2177
+ src: n.properties,
2178
+ reason: e.conflation_reason
2179
+ }, void 0, !0)), 128))]),
2180
+ _: 2
2181
+ }, 1032, ["feature", "josm-target"])]))), 128))])]),
2182
+ a("div", Rr, [a("ul", null, [(y(!0), i(e, null, C(k(l)(t.features), (n) => (y(), i("li", { key: n.id }, [o(yt, {
2183
+ feature: n,
2184
+ "josm-target": t.josmTarget
2185
+ }, {
2186
+ "tags-diff": M(() => [(y(!0), i(e, null, C(u(n, t.index), (e, t) => w(f.$slots, "tags-diff", {
2187
+ key: t,
2188
+ date: n.properties.created,
2189
+ title: p(e),
2190
+ diff: e.diff_tags,
2191
+ reason: e.conflation_reason,
2192
+ dst: n.properties,
2193
+ src: d(e)
2194
+ }, void 0, !0)), 128))]),
2195
+ _: 2
2196
+ }, 1032, ["feature", "josm-target"])]))), 128))])]),
2197
+ o(Pr, {
2198
+ id: `${k(r)}-${n.index}`,
2199
+ features: t.features,
2200
+ bbox: k(s)?.bbox
2201
+ }, null, 8, [
2202
+ "id",
2203
+ "features",
2204
+ "bbox"
2205
+ ])
2206
+ ]));
2207
+ }
2208
+ }), [["__scopeId", "data-v-1b303352"]]), Br = ["href"], Vr = ["name"], Hr = /* @__PURE__ */ vt(/* @__PURE__ */ c({
2209
+ __name: "LoChaGroupList",
2210
+ props: { hash: {} },
2211
+ setup(t) {
2212
+ A((e) => ({ v3d8c924f: k(c) }));
2213
+ let n = t, { groups: r } = f($e), s = f(et), c = W.delete, l = S(), u = te("listRef");
2214
+ function d(e) {
2215
+ return `locha-${s}-group-${e}`;
2216
+ }
2217
+ function g() {
2218
+ return `hidden_josm_target_${s}`;
2219
+ }
2220
+ j(() => n.hash, (e) => {
2221
+ l.value = e, e && m(() => _(e));
2222
+ }, { immediate: !0 });
2223
+ function _(e, t = {}) {
2224
+ let n = e.startsWith("#") ? e.slice(1) : e, r = u.value?.querySelector(`#${CSS.escape(n)}`);
2225
+ if (!r) return console.warn(`Element with ID "${e}" not found`), !1;
2226
+ let { behavior: i = "smooth", block: a = "start", inline: o = "nearest" } = t;
2227
+ return r.scrollIntoView({
2228
+ behavior: i,
2229
+ block: a,
2230
+ inline: o
2231
+ }), !0;
2232
+ }
2233
+ return (t, n) => (y(), i("div", {
2234
+ ref_key: "listRef",
2235
+ ref: u,
2236
+ class: "locha-group-list"
2237
+ }, [a("ul", null, [(y(!0), i(e, null, C(k(r), (e, n) => (y(), i("li", {
2238
+ key: n,
2239
+ class: h({ selected: l.value === `#${d(n)}` })
2240
+ }, [a("a", {
2241
+ class: "anchor-button",
2242
+ href: `#${d(n)}`
2243
+ }, "🔗", 8, Br), o(zr, {
2244
+ id: d(n),
2245
+ features: e,
2246
+ index: n,
2247
+ "josm-target": g()
2248
+ }, {
2249
+ "tags-diff": M((e) => [w(t.$slots, "tags-diff", p({ ref_for: !0 }, e), void 0, !0)]),
2250
+ "link-metadata": M((e) => [w(t.$slots, "link-metadata", p({ ref_for: !0 }, e), void 0, !0)]),
2251
+ _: 3
2252
+ }, 8, [
2253
+ "id",
2254
+ "features",
2255
+ "index",
2256
+ "josm-target"
2257
+ ])], 2))), 128))]), a("iframe", {
2258
+ name: g(),
2259
+ style: { display: "none" }
2260
+ }, null, 8, Vr)], 512));
2261
+ }
2262
+ }), [["__scopeId", "data-v-5774adc7"]]), Ur = { class: "locha" }, Wr = {
2263
+ key: 0,
2264
+ class: "user-feedback"
2265
+ }, Gr = /* @__PURE__ */ vt(/* @__PURE__ */ c({
2266
+ __name: "LoCha",
2267
+ props: {
2268
+ data: {},
2269
+ reasonCollapsed: {
2270
+ type: Boolean,
2271
+ default: !0
2272
+ },
2273
+ hash: {}
2274
+ },
2275
+ setup(e) {
2276
+ let t = e, r = ee();
2277
+ b(Qe, t.reasonCollapsed), b(et, r);
2278
+ let a = Ze();
2279
+ b($e, a);
2280
+ let { featureCount: o, setLoCha: s } = a;
2281
+ return j(() => t.data, (e) => {
2282
+ e && s(e);
2283
+ }, { immediate: !0 }), (t, r) => (y(), i("section", Ur, [k(o) ? (y(), n(Hr, {
2284
+ key: 1,
2285
+ hash: e.hash
2286
+ }, {
2287
+ "tags-diff": M((e) => [w(t.$slots, "tags-diff", g(d(e)), void 0, !0)]),
2288
+ "link-metadata": M((e) => [w(t.$slots, "link-metadata", g(d(e)), void 0, !0)]),
2289
+ _: 3
2290
+ }, 8, ["hash"])) : (y(), i("p", Wr, " ⚠️ No data "))]));
2291
+ }
2292
+ }), [["__scopeId", "data-v-915c7b44"]]);
2293
+ //#endregion
2294
+ export { Gr as LoCha };
2295
+
2296
+ //# sourceMappingURL=index.js.map