@maptiler/geocoding-control 2.0.0-rc.6 → 2.0.0-rc.7
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/MapLibreBasedGeocodingControl.d.ts +1 -18
- package/leaflet-controller.d.ts +2 -3
- package/leaflet-controller.js +450 -453
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +3 -3
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +1010 -1015
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -3
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +2 -3
- package/maplibregl-controller.js +140 -143
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +2 -2
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +0 -17
- package/maplibregl.js +1698 -1705
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -3
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +0 -17
- package/maptilersdk.js +1695 -1702
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -3
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.d.ts +2 -3
- package/openlayers-controller.js +366 -369
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +3 -3
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +1084 -1088
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -3
- package/openlayers.umd.js.map +1 -1
- package/package.json +1 -1
- package/react.js +739 -737
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/svelte/GeocodingControl.svelte +7 -5
- package/svelte/MapLibreBasedGeocodingControl.d.ts +1 -18
- package/svelte/MapLibreBasedGeocodingControl.js +1 -6
- package/svelte/leaflet-controller.d.ts +2 -3
- package/svelte/leaflet-controller.js +3 -7
- package/svelte/leaflet.js +1 -6
- package/svelte/maplibregl-controller.d.ts +2 -3
- package/svelte/maplibregl-controller.js +3 -7
- package/svelte/maplibregl.d.ts +0 -17
- package/svelte/maptilersdk.d.ts +0 -17
- package/svelte/openlayers-controller.d.ts +2 -3
- package/svelte/openlayers-controller.js +3 -7
- package/svelte/openlayers.js +1 -4
- package/svelte/types.d.ts +1 -2
- package/types.d.ts +1 -2
- package/vanilla.js +760 -758
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
package/leaflet-controller.js
CHANGED
|
@@ -35,82 +35,82 @@ function Ut(r, t, e = {}) {
|
|
|
35
35
|
}
|
|
36
36
|
function Yt(r, t, e) {
|
|
37
37
|
if (r !== null)
|
|
38
|
-
for (var n, i, o,
|
|
39
|
-
|
|
40
|
-
for (var v = 0; v <
|
|
41
|
-
var
|
|
42
|
-
if (
|
|
43
|
-
c =
|
|
44
|
-
var E =
|
|
45
|
-
switch (
|
|
38
|
+
for (var n, i, o, u, l, c, f, p = 0, s = 0, a, h = r.type, g = h === "FeatureCollection", d = h === "Feature", w = g ? r.features.length : 1, y = 0; y < w; y++) {
|
|
39
|
+
f = g ? r.features[y].geometry : d ? r.geometry : r, a = f ? f.type === "GeometryCollection" : !1, l = a ? f.geometries.length : 1;
|
|
40
|
+
for (var v = 0; v < l; v++) {
|
|
41
|
+
var x = 0, m = 0;
|
|
42
|
+
if (u = a ? f.geometries[v] : f, u !== null) {
|
|
43
|
+
c = u.coordinates;
|
|
44
|
+
var E = u.type;
|
|
45
|
+
switch (p = 0, E) {
|
|
46
46
|
case null:
|
|
47
47
|
break;
|
|
48
48
|
case "Point":
|
|
49
49
|
if (t(
|
|
50
50
|
c,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
s,
|
|
52
|
+
y,
|
|
53
|
+
x,
|
|
54
54
|
m
|
|
55
55
|
) === !1)
|
|
56
56
|
return !1;
|
|
57
|
-
|
|
57
|
+
s++, x++;
|
|
58
58
|
break;
|
|
59
59
|
case "LineString":
|
|
60
60
|
case "MultiPoint":
|
|
61
61
|
for (n = 0; n < c.length; n++) {
|
|
62
62
|
if (t(
|
|
63
63
|
c[n],
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
s,
|
|
65
|
+
y,
|
|
66
|
+
x,
|
|
67
67
|
m
|
|
68
68
|
) === !1)
|
|
69
69
|
return !1;
|
|
70
|
-
|
|
70
|
+
s++, E === "MultiPoint" && x++;
|
|
71
71
|
}
|
|
72
|
-
E === "LineString" &&
|
|
72
|
+
E === "LineString" && x++;
|
|
73
73
|
break;
|
|
74
74
|
case "Polygon":
|
|
75
75
|
case "MultiLineString":
|
|
76
76
|
for (n = 0; n < c.length; n++) {
|
|
77
|
-
for (i = 0; i < c[n].length -
|
|
77
|
+
for (i = 0; i < c[n].length - p; i++) {
|
|
78
78
|
if (t(
|
|
79
79
|
c[n][i],
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
s,
|
|
81
|
+
y,
|
|
82
|
+
x,
|
|
83
83
|
m
|
|
84
84
|
) === !1)
|
|
85
85
|
return !1;
|
|
86
|
-
|
|
86
|
+
s++;
|
|
87
87
|
}
|
|
88
|
-
E === "MultiLineString" &&
|
|
88
|
+
E === "MultiLineString" && x++, E === "Polygon" && m++;
|
|
89
89
|
}
|
|
90
|
-
E === "Polygon" &&
|
|
90
|
+
E === "Polygon" && x++;
|
|
91
91
|
break;
|
|
92
92
|
case "MultiPolygon":
|
|
93
93
|
for (n = 0; n < c.length; n++) {
|
|
94
94
|
for (m = 0, i = 0; i < c[n].length; i++) {
|
|
95
|
-
for (o = 0; o < c[n][i].length -
|
|
95
|
+
for (o = 0; o < c[n][i].length - p; o++) {
|
|
96
96
|
if (t(
|
|
97
97
|
c[n][i][o],
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
s,
|
|
99
|
+
y,
|
|
100
|
+
x,
|
|
101
101
|
m
|
|
102
102
|
) === !1)
|
|
103
103
|
return !1;
|
|
104
|
-
|
|
104
|
+
s++;
|
|
105
105
|
}
|
|
106
106
|
m++;
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
x++;
|
|
109
109
|
}
|
|
110
110
|
break;
|
|
111
111
|
case "GeometryCollection":
|
|
112
|
-
for (n = 0; n <
|
|
113
|
-
if (Yt(
|
|
112
|
+
for (n = 0; n < u.geometries.length; n++)
|
|
113
|
+
if (Yt(u.geometries[n], t) === !1)
|
|
114
114
|
return !1;
|
|
115
115
|
break;
|
|
116
116
|
default:
|
|
@@ -121,16 +121,16 @@ function Yt(r, t, e) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
function vt(r, t) {
|
|
124
|
-
var e, n, i, o,
|
|
125
|
-
for (e = 0; e <
|
|
126
|
-
for (
|
|
127
|
-
if (o = c ?
|
|
124
|
+
var e, n, i, o, u, l, c, f, p, s, a = 0, h = r.type === "FeatureCollection", g = r.type === "Feature", d = h ? r.features.length : 1;
|
|
125
|
+
for (e = 0; e < d; e++) {
|
|
126
|
+
for (l = h ? r.features[e].geometry : g ? r.geometry : r, f = h ? r.features[e].properties : g ? r.properties : {}, p = h ? r.features[e].bbox : g ? r.bbox : void 0, s = h ? r.features[e].id : g ? r.id : void 0, c = l ? l.type === "GeometryCollection" : !1, u = c ? l.geometries.length : 1, i = 0; i < u; i++) {
|
|
127
|
+
if (o = c ? l.geometries[i] : l, o === null) {
|
|
128
128
|
if (t(
|
|
129
129
|
null,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
a,
|
|
131
|
+
f,
|
|
132
|
+
p,
|
|
133
|
+
s
|
|
134
134
|
) === !1)
|
|
135
135
|
return !1;
|
|
136
136
|
continue;
|
|
@@ -144,10 +144,10 @@ function vt(r, t) {
|
|
|
144
144
|
case "MultiPolygon": {
|
|
145
145
|
if (t(
|
|
146
146
|
o,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
147
|
+
a,
|
|
148
|
+
f,
|
|
149
|
+
p,
|
|
150
|
+
s
|
|
151
151
|
) === !1)
|
|
152
152
|
return !1;
|
|
153
153
|
break;
|
|
@@ -156,10 +156,10 @@ function vt(r, t) {
|
|
|
156
156
|
for (n = 0; n < o.geometries.length; n++)
|
|
157
157
|
if (t(
|
|
158
158
|
o.geometries[n],
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
a,
|
|
160
|
+
f,
|
|
161
|
+
p,
|
|
162
|
+
s
|
|
163
163
|
) === !1)
|
|
164
164
|
return !1;
|
|
165
165
|
break;
|
|
@@ -168,25 +168,25 @@ function vt(r, t) {
|
|
|
168
168
|
throw new Error("Unknown Geometry Type");
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
a++;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
function se(r, t) {
|
|
175
|
-
vt(r, function(e, n, i, o,
|
|
176
|
-
var
|
|
177
|
-
switch (
|
|
175
|
+
vt(r, function(e, n, i, o, u) {
|
|
176
|
+
var l = e === null ? null : e.type;
|
|
177
|
+
switch (l) {
|
|
178
178
|
case null:
|
|
179
179
|
case "Point":
|
|
180
180
|
case "LineString":
|
|
181
181
|
case "Polygon":
|
|
182
182
|
return t(
|
|
183
|
-
V(e, i, { bbox: o, id:
|
|
183
|
+
V(e, i, { bbox: o, id: u }),
|
|
184
184
|
n,
|
|
185
185
|
0
|
|
186
186
|
) === !1 ? !1 : void 0;
|
|
187
187
|
}
|
|
188
188
|
var c;
|
|
189
|
-
switch (
|
|
189
|
+
switch (l) {
|
|
190
190
|
case "MultiPoint":
|
|
191
191
|
c = "Point";
|
|
192
192
|
break;
|
|
@@ -197,12 +197,12 @@ function se(r, t) {
|
|
|
197
197
|
c = "Polygon";
|
|
198
198
|
break;
|
|
199
199
|
}
|
|
200
|
-
for (var
|
|
201
|
-
var
|
|
200
|
+
for (var f = 0; f < e.coordinates.length; f++) {
|
|
201
|
+
var p = e.coordinates[f], s = {
|
|
202
202
|
type: c,
|
|
203
|
-
coordinates:
|
|
203
|
+
coordinates: p
|
|
204
204
|
};
|
|
205
|
-
if (t(V(
|
|
205
|
+
if (t(V(s, i), n, f) === !1)
|
|
206
206
|
return !1;
|
|
207
207
|
}
|
|
208
208
|
});
|
|
@@ -303,60 +303,60 @@ function he(r, t) {
|
|
|
303
303
|
var e = { label: 0, sent: function() {
|
|
304
304
|
if (o[0] & 1) throw o[1];
|
|
305
305
|
return o[1];
|
|
306
|
-
}, trys: [], ops: [] }, n, i, o,
|
|
307
|
-
return
|
|
306
|
+
}, trys: [], ops: [] }, n, i, o, u;
|
|
307
|
+
return u = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
|
|
308
308
|
return this;
|
|
309
|
-
}),
|
|
310
|
-
function
|
|
311
|
-
return function(
|
|
312
|
-
return c([
|
|
309
|
+
}), u;
|
|
310
|
+
function l(f) {
|
|
311
|
+
return function(p) {
|
|
312
|
+
return c([f, p]);
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
|
-
function c(
|
|
315
|
+
function c(f) {
|
|
316
316
|
if (n) throw new TypeError("Generator is already executing.");
|
|
317
317
|
for (; e; ) try {
|
|
318
|
-
if (n = 1, i && (o =
|
|
319
|
-
switch (i = 0, o && (
|
|
318
|
+
if (n = 1, i && (o = f[0] & 2 ? i.return : f[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, f[1])).done) return o;
|
|
319
|
+
switch (i = 0, o && (f = [f[0] & 2, o.value]), f[0]) {
|
|
320
320
|
case 0:
|
|
321
321
|
case 1:
|
|
322
|
-
o =
|
|
322
|
+
o = f;
|
|
323
323
|
break;
|
|
324
324
|
case 4:
|
|
325
|
-
return e.label++, { value:
|
|
325
|
+
return e.label++, { value: f[1], done: !1 };
|
|
326
326
|
case 5:
|
|
327
|
-
e.label++, i =
|
|
327
|
+
e.label++, i = f[1], f = [0];
|
|
328
328
|
continue;
|
|
329
329
|
case 7:
|
|
330
|
-
|
|
330
|
+
f = e.ops.pop(), e.trys.pop();
|
|
331
331
|
continue;
|
|
332
332
|
default:
|
|
333
|
-
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (
|
|
333
|
+
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (f[0] === 6 || f[0] === 2)) {
|
|
334
334
|
e = 0;
|
|
335
335
|
continue;
|
|
336
336
|
}
|
|
337
|
-
if (
|
|
338
|
-
e.label =
|
|
337
|
+
if (f[0] === 3 && (!o || f[1] > o[0] && f[1] < o[3])) {
|
|
338
|
+
e.label = f[1];
|
|
339
339
|
break;
|
|
340
340
|
}
|
|
341
|
-
if (
|
|
342
|
-
e.label = o[1], o =
|
|
341
|
+
if (f[0] === 6 && e.label < o[1]) {
|
|
342
|
+
e.label = o[1], o = f;
|
|
343
343
|
break;
|
|
344
344
|
}
|
|
345
345
|
if (o && e.label < o[2]) {
|
|
346
|
-
e.label = o[2], e.ops.push(
|
|
346
|
+
e.label = o[2], e.ops.push(f);
|
|
347
347
|
break;
|
|
348
348
|
}
|
|
349
349
|
o[2] && e.ops.pop(), e.trys.pop();
|
|
350
350
|
continue;
|
|
351
351
|
}
|
|
352
|
-
|
|
353
|
-
} catch (
|
|
354
|
-
|
|
352
|
+
f = t.call(r, e);
|
|
353
|
+
} catch (p) {
|
|
354
|
+
f = [6, p], i = 0;
|
|
355
355
|
} finally {
|
|
356
356
|
n = o = 0;
|
|
357
357
|
}
|
|
358
|
-
if (
|
|
359
|
-
return { value:
|
|
358
|
+
if (f[0] & 5) throw f[1];
|
|
359
|
+
return { value: f[0] ? f[1] : void 0, done: !0 };
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
var F = (
|
|
@@ -373,22 +373,22 @@ function ae(r, t) {
|
|
|
373
373
|
}
|
|
374
374
|
function B(r, t, e) {
|
|
375
375
|
for (var n = new F(null, null), i = n, o = n; ; ) {
|
|
376
|
-
var
|
|
377
|
-
if (
|
|
376
|
+
var u = e(r, t.key);
|
|
377
|
+
if (u < 0) {
|
|
378
378
|
if (t.left === null)
|
|
379
379
|
break;
|
|
380
380
|
if (e(r, t.left.key) < 0) {
|
|
381
|
-
var
|
|
382
|
-
if (t.left =
|
|
381
|
+
var l = t.left;
|
|
382
|
+
if (t.left = l.right, l.right = t, t = l, t.left === null)
|
|
383
383
|
break;
|
|
384
384
|
}
|
|
385
385
|
o.left = t, o = t, t = t.left;
|
|
386
|
-
} else if (
|
|
386
|
+
} else if (u > 0) {
|
|
387
387
|
if (t.right === null)
|
|
388
388
|
break;
|
|
389
389
|
if (e(r, t.right.key) > 0) {
|
|
390
|
-
var
|
|
391
|
-
if (t.right =
|
|
390
|
+
var l = t.right;
|
|
391
|
+
if (t.right = l.left, l.left = t, t = l, t.right === null)
|
|
392
392
|
break;
|
|
393
393
|
}
|
|
394
394
|
i.right = t, i = t, t = t.right;
|
|
@@ -414,7 +414,7 @@ function bt(r, t, e) {
|
|
|
414
414
|
}
|
|
415
415
|
return { left: n, right: i };
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function pe(r, t, e) {
|
|
418
418
|
return t === null ? r : (r === null || (t = B(r.key, t, e), t.left = r), t);
|
|
419
419
|
}
|
|
420
420
|
function ft(r, t, e, n, i) {
|
|
@@ -436,8 +436,8 @@ var wt = (
|
|
|
436
436
|
}, r.prototype.add = function(t, e) {
|
|
437
437
|
var n = new F(t, e);
|
|
438
438
|
this._root === null && (n.left = n.right = null, this._size++, this._root = n);
|
|
439
|
-
var i = this._comparator, o = B(t, this._root, i),
|
|
440
|
-
return
|
|
439
|
+
var i = this._comparator, o = B(t, this._root, i), u = i(t, o.key);
|
|
440
|
+
return u === 0 ? this._root = o : (u < 0 ? (n.left = o.left, n.right = o, o.left = null) : u > 0 && (n.right = o.right, n.left = o, o.right = null), this._size++, this._root = n), this._root;
|
|
441
441
|
}, r.prototype.remove = function(t) {
|
|
442
442
|
this._root = this._remove(t, this._root, this._comparator);
|
|
443
443
|
}, r.prototype._remove = function(t, e, n) {
|
|
@@ -478,15 +478,15 @@ var wt = (
|
|
|
478
478
|
n !== null ? (i.push(n), n = n.left) : i.length !== 0 ? (n = i.pop(), t.call(e, n), n = n.right) : o = !0;
|
|
479
479
|
return this;
|
|
480
480
|
}, r.prototype.range = function(t, e, n, i) {
|
|
481
|
-
for (var o = [],
|
|
482
|
-
if (
|
|
483
|
-
o.push(
|
|
481
|
+
for (var o = [], u = this._comparator, l = this._root, c; o.length !== 0 || l; )
|
|
482
|
+
if (l)
|
|
483
|
+
o.push(l), l = l.left;
|
|
484
484
|
else {
|
|
485
|
-
if (
|
|
485
|
+
if (l = o.pop(), c = u(l.key, e), c > 0)
|
|
486
486
|
break;
|
|
487
|
-
if (
|
|
487
|
+
if (u(l.key, t) >= 0 && n.call(i, l))
|
|
488
488
|
return this;
|
|
489
|
-
|
|
489
|
+
l = l.right;
|
|
490
490
|
}
|
|
491
491
|
return this;
|
|
492
492
|
}, r.prototype.keys = function() {
|
|
@@ -564,8 +564,8 @@ var wt = (
|
|
|
564
564
|
if (n && at(t, e, 0, i - 1, o), this._root === null)
|
|
565
565
|
this._root = ct(t, e, 0, i), this._size = i;
|
|
566
566
|
else {
|
|
567
|
-
var
|
|
568
|
-
i = this._size + i, this._root = ht({ head:
|
|
567
|
+
var u = de(this.toList(), ge(t, e), o);
|
|
568
|
+
i = this._size + i, this._root = ht({ head: u }, 0, i);
|
|
569
569
|
}
|
|
570
570
|
return this;
|
|
571
571
|
}, r.prototype.isEmpty = function() {
|
|
@@ -591,8 +591,8 @@ var wt = (
|
|
|
591
591
|
return e.push(n);
|
|
592
592
|
}, t), e.join("");
|
|
593
593
|
}, r.prototype.update = function(t, e, n) {
|
|
594
|
-
var i = this._comparator, o = bt(t, this._root, i),
|
|
595
|
-
i(t, e) < 0 ?
|
|
594
|
+
var i = this._comparator, o = bt(t, this._root, i), u = o.left, l = o.right;
|
|
595
|
+
i(t, e) < 0 ? l = ot(e, n, l, i) : u = ot(e, n, u, i), this._root = pe(u, l, i);
|
|
596
596
|
}, r.prototype.split = function(t) {
|
|
597
597
|
return bt(t, this._root, this._comparator);
|
|
598
598
|
}, r.prototype[Symbol.iterator] = function() {
|
|
@@ -624,12 +624,12 @@ var wt = (
|
|
|
624
624
|
function ct(r, t, e, n) {
|
|
625
625
|
var i = n - e;
|
|
626
626
|
if (i > 0) {
|
|
627
|
-
var o = e + Math.floor(i / 2),
|
|
627
|
+
var o = e + Math.floor(i / 2), u = r[o], l = t[o], c = new F(u, l);
|
|
628
628
|
return c.left = ct(r, t, e, o), c.right = ct(r, t, o + 1, n), c;
|
|
629
629
|
}
|
|
630
630
|
return null;
|
|
631
631
|
}
|
|
632
|
-
function
|
|
632
|
+
function ge(r, t) {
|
|
633
633
|
for (var e = new F(null, null), n = e, i = 0; i < r.length; i++)
|
|
634
634
|
n = n.next = new F(r[i], t[i]);
|
|
635
635
|
return n.next = null, e.next;
|
|
@@ -642,46 +642,46 @@ function ye(r) {
|
|
|
642
642
|
function ht(r, t, e) {
|
|
643
643
|
var n = e - t;
|
|
644
644
|
if (n > 0) {
|
|
645
|
-
var i = t + Math.floor(n / 2), o = ht(r, t, i),
|
|
646
|
-
return
|
|
645
|
+
var i = t + Math.floor(n / 2), o = ht(r, t, i), u = r.head;
|
|
646
|
+
return u.left = o, r.head = r.head.next, u.right = ht(r, i + 1, e), u;
|
|
647
647
|
}
|
|
648
648
|
return null;
|
|
649
649
|
}
|
|
650
650
|
function de(r, t, e) {
|
|
651
|
-
for (var n = new F(null, null), i = n, o = r,
|
|
652
|
-
e(o.key,
|
|
653
|
-
return o !== null ? i.next = o :
|
|
651
|
+
for (var n = new F(null, null), i = n, o = r, u = t; o !== null && u !== null; )
|
|
652
|
+
e(o.key, u.key) < 0 ? (i.next = o, o = o.next) : (i.next = u, u = u.next), i = i.next;
|
|
653
|
+
return o !== null ? i.next = o : u !== null && (i.next = u), n.next;
|
|
654
654
|
}
|
|
655
655
|
function at(r, t, e, n, i) {
|
|
656
656
|
if (!(e >= n)) {
|
|
657
|
-
for (var o = r[e + n >> 1],
|
|
657
|
+
for (var o = r[e + n >> 1], u = e - 1, l = n + 1; ; ) {
|
|
658
658
|
do
|
|
659
|
-
|
|
660
|
-
while (i(r[
|
|
659
|
+
u++;
|
|
660
|
+
while (i(r[u], o) < 0);
|
|
661
661
|
do
|
|
662
|
-
|
|
663
|
-
while (i(r[
|
|
664
|
-
if (
|
|
662
|
+
l--;
|
|
663
|
+
while (i(r[l], o) > 0);
|
|
664
|
+
if (u >= l)
|
|
665
665
|
break;
|
|
666
|
-
var c = r[
|
|
667
|
-
r[
|
|
666
|
+
var c = r[u];
|
|
667
|
+
r[u] = r[l], r[l] = c, c = t[u], t[u] = t[l], t[l] = c;
|
|
668
668
|
}
|
|
669
|
-
at(r, t, e,
|
|
669
|
+
at(r, t, e, l, i), at(r, t, l + 1, n, i);
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
672
|
const O = 11102230246251565e-32, S = 134217729, xe = (3 + 8 * O) * O;
|
|
673
673
|
function st(r, t, e, n, i) {
|
|
674
|
-
let o,
|
|
675
|
-
|
|
676
|
-
let
|
|
677
|
-
if (
|
|
678
|
-
for (
|
|
679
|
-
|
|
680
|
-
for (;
|
|
681
|
-
|
|
682
|
-
for (;
|
|
683
|
-
|
|
684
|
-
return (o !== 0 ||
|
|
674
|
+
let o, u, l, c, f = t[0], p = n[0], s = 0, a = 0;
|
|
675
|
+
p > f == p > -f ? (o = f, f = t[++s]) : (o = p, p = n[++a]);
|
|
676
|
+
let h = 0;
|
|
677
|
+
if (s < r && a < e)
|
|
678
|
+
for (p > f == p > -f ? (u = f + o, l = o - (u - f), f = t[++s]) : (u = p + o, l = o - (u - p), p = n[++a]), o = u, l !== 0 && (i[h++] = l); s < r && a < e; )
|
|
679
|
+
p > f == p > -f ? (u = o + f, c = u - o, l = o - (u - c) + (f - c), f = t[++s]) : (u = o + p, c = u - o, l = o - (u - c) + (p - c), p = n[++a]), o = u, l !== 0 && (i[h++] = l);
|
|
680
|
+
for (; s < r; )
|
|
681
|
+
u = o + f, c = u - o, l = o - (u - c) + (f - c), f = t[++s], o = u, l !== 0 && (i[h++] = l);
|
|
682
|
+
for (; a < e; )
|
|
683
|
+
u = o + p, c = u - o, l = o - (u - c) + (p - c), p = n[++a], o = u, l !== 0 && (i[h++] = l);
|
|
684
|
+
return (o !== 0 || h === 0) && (i[h++] = o), h;
|
|
685
685
|
}
|
|
686
686
|
function ve(r, t) {
|
|
687
687
|
let e = t[0];
|
|
@@ -692,25 +692,25 @@ function K(r) {
|
|
|
692
692
|
return new Float64Array(r);
|
|
693
693
|
}
|
|
694
694
|
const me = (3 + 16 * O) * O, we = (2 + 12 * O) * O, Ee = (9 + 64 * O) * O * O, q = K(4), _t = K(8), St = K(12), Pt = K(16), P = K(4);
|
|
695
|
-
function be(r, t, e, n, i, o,
|
|
696
|
-
let
|
|
697
|
-
const C = r - i, R = e - i, I = t - o,
|
|
698
|
-
m = C *
|
|
699
|
-
let A = ve(4, q), D = we *
|
|
700
|
-
if (A >= D || -A >= D || (
|
|
701
|
-
m =
|
|
695
|
+
function be(r, t, e, n, i, o, u) {
|
|
696
|
+
let l, c, f, p, s, a, h, g, d, w, y, v, x, m, E, b, M, _;
|
|
697
|
+
const C = r - i, R = e - i, I = t - o, $ = n - o;
|
|
698
|
+
m = C * $, a = S * C, h = a - (a - C), g = C - h, a = S * $, d = a - (a - $), w = $ - d, E = g * w - (m - h * d - g * d - h * w), b = I * R, a = S * I, h = a - (a - I), g = I - h, a = S * R, d = a - (a - R), w = R - d, M = g * w - (b - h * d - g * d - h * w), y = E - M, s = E - y, q[0] = E - (y + s) + (s - M), v = m + y, s = v - m, x = m - (v - s) + (y - s), y = x - b, s = x - y, q[1] = x - (y + s) + (s - b), _ = v + y, s = _ - v, q[2] = v - (_ - s) + (y - s), q[3] = _;
|
|
699
|
+
let A = ve(4, q), D = we * u;
|
|
700
|
+
if (A >= D || -A >= D || (s = r - C, l = r - (C + s) + (s - i), s = e - R, f = e - (R + s) + (s - i), s = t - I, c = t - (I + s) + (s - o), s = n - $, p = n - ($ + s) + (s - o), l === 0 && c === 0 && f === 0 && p === 0) || (D = Ee * u + xe * Math.abs(A), A += C * p + $ * l - (I * f + R * c), A >= D || -A >= D)) return A;
|
|
701
|
+
m = l * $, a = S * l, h = a - (a - l), g = l - h, a = S * $, d = a - (a - $), w = $ - d, E = g * w - (m - h * d - g * d - h * w), b = c * R, a = S * c, h = a - (a - c), g = c - h, a = S * R, d = a - (a - R), w = R - d, M = g * w - (b - h * d - g * d - h * w), y = E - M, s = E - y, P[0] = E - (y + s) + (s - M), v = m + y, s = v - m, x = m - (v - s) + (y - s), y = x - b, s = x - y, P[1] = x - (y + s) + (s - b), _ = v + y, s = _ - v, P[2] = v - (_ - s) + (y - s), P[3] = _;
|
|
702
702
|
const ee = st(4, q, 4, P, _t);
|
|
703
|
-
m = C *
|
|
703
|
+
m = C * p, a = S * C, h = a - (a - C), g = C - h, a = S * p, d = a - (a - p), w = p - d, E = g * w - (m - h * d - g * d - h * w), b = I * f, a = S * I, h = a - (a - I), g = I - h, a = S * f, d = a - (a - f), w = f - d, M = g * w - (b - h * d - g * d - h * w), y = E - M, s = E - y, P[0] = E - (y + s) + (s - M), v = m + y, s = v - m, x = m - (v - s) + (y - s), y = x - b, s = x - y, P[1] = x - (y + s) + (s - b), _ = v + y, s = _ - v, P[2] = v - (_ - s) + (y - s), P[3] = _;
|
|
704
704
|
const ne = st(ee, _t, 4, P, St);
|
|
705
|
-
m =
|
|
705
|
+
m = l * p, a = S * l, h = a - (a - l), g = l - h, a = S * p, d = a - (a - p), w = p - d, E = g * w - (m - h * d - g * d - h * w), b = c * f, a = S * c, h = a - (a - c), g = c - h, a = S * f, d = a - (a - f), w = f - d, M = g * w - (b - h * d - g * d - h * w), y = E - M, s = E - y, P[0] = E - (y + s) + (s - M), v = m + y, s = v - m, x = m - (v - s) + (y - s), y = x - b, s = x - y, P[1] = x - (y + s) + (s - b), _ = v + y, s = _ - v, P[2] = v - (_ - s) + (y - s), P[3] = _;
|
|
706
706
|
const re = st(ne, St, 4, P, Pt);
|
|
707
707
|
return Pt[re - 1];
|
|
708
708
|
}
|
|
709
709
|
function _e(r, t, e, n, i, o) {
|
|
710
|
-
const
|
|
711
|
-
return Math.abs(c) >= me *
|
|
710
|
+
const u = (t - o) * (e - i), l = (r - i) * (n - o), c = u - l, f = Math.abs(u + l);
|
|
711
|
+
return Math.abs(c) >= me * f ? c : -be(r, t, e, n, i, o, f);
|
|
712
712
|
}
|
|
713
|
-
const j = (r, t) => r.ll.x <= t.x && t.x <= r.ur.x && r.ll.y <= t.y && t.y <= r.ur.y,
|
|
713
|
+
const j = (r, t) => r.ll.x <= t.x && t.x <= r.ur.x && r.ll.y <= t.y && t.y <= r.ur.y, pt = (r, t) => {
|
|
714
714
|
if (t.ur.x < r.ll.x || r.ur.x < t.ll.x || t.ur.y < r.ll.y || r.ur.y < t.ll.y) return null;
|
|
715
715
|
const e = r.ll.x < t.ll.x ? t.ll.x : r.ll.x, n = r.ur.x < t.ur.x ? r.ur.x : t.ur.x, i = r.ll.y < t.ll.y ? t.ll.y : r.ll.y, o = r.ur.y < t.ur.y ? r.ur.y : t.ur.y;
|
|
716
716
|
return {
|
|
@@ -802,10 +802,10 @@ const J = new Pe(), tt = (r, t) => r.x * t.y - r.y * t.x, Vt = (r, t) => r.x * t
|
|
|
802
802
|
const o = {
|
|
803
803
|
x: e.x - r.x,
|
|
804
804
|
y: e.y - r.y
|
|
805
|
-
},
|
|
805
|
+
}, u = tt(o, t) / i, l = tt(o, n) / i, c = r.x + l * t.x, f = e.x + u * n.x, p = r.y + l * t.y, s = e.y + u * n.y, a = (c + f) / 2, h = (p + s) / 2;
|
|
806
806
|
return {
|
|
807
|
-
x:
|
|
808
|
-
y:
|
|
807
|
+
x: a,
|
|
808
|
+
y: h
|
|
809
809
|
};
|
|
810
810
|
};
|
|
811
811
|
class L {
|
|
@@ -874,13 +874,13 @@ class L {
|
|
|
874
874
|
return (i, o) => {
|
|
875
875
|
e.has(i) || n(i), e.has(o) || n(o);
|
|
876
876
|
const {
|
|
877
|
-
sine:
|
|
878
|
-
cosine:
|
|
877
|
+
sine: u,
|
|
878
|
+
cosine: l
|
|
879
879
|
} = e.get(i), {
|
|
880
880
|
sine: c,
|
|
881
|
-
cosine:
|
|
881
|
+
cosine: f
|
|
882
882
|
} = e.get(o);
|
|
883
|
-
return
|
|
883
|
+
return u >= 0 && c >= 0 ? l < f ? 1 : l > f ? -1 : 0 : u < 0 && c < 0 ? l < f ? -1 : l > f ? 1 : 0 : c < u ? -1 : c > u ? 1 : 0;
|
|
884
884
|
};
|
|
885
885
|
}
|
|
886
886
|
}
|
|
@@ -900,44 +900,44 @@ class z {
|
|
|
900
900
|
* is directly on the right-more of the two left inputs.
|
|
901
901
|
*/
|
|
902
902
|
static compare(t, e) {
|
|
903
|
-
const n = t.leftSE.point.x, i = e.leftSE.point.x, o = t.rightSE.point.x,
|
|
904
|
-
if (
|
|
903
|
+
const n = t.leftSE.point.x, i = e.leftSE.point.x, o = t.rightSE.point.x, u = e.rightSE.point.x;
|
|
904
|
+
if (u < n) return 1;
|
|
905
905
|
if (o < i) return -1;
|
|
906
|
-
const
|
|
906
|
+
const l = t.leftSE.point.y, c = e.leftSE.point.y, f = t.rightSE.point.y, p = e.rightSE.point.y;
|
|
907
907
|
if (n < i) {
|
|
908
|
-
if (c <
|
|
909
|
-
if (c >
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
if (
|
|
913
|
-
const
|
|
914
|
-
return
|
|
908
|
+
if (c < l && c < f) return 1;
|
|
909
|
+
if (c > l && c > f) return -1;
|
|
910
|
+
const s = t.comparePoint(e.leftSE.point);
|
|
911
|
+
if (s < 0) return 1;
|
|
912
|
+
if (s > 0) return -1;
|
|
913
|
+
const a = e.comparePoint(t.rightSE.point);
|
|
914
|
+
return a !== 0 ? a : -1;
|
|
915
915
|
}
|
|
916
916
|
if (n > i) {
|
|
917
|
-
if (
|
|
918
|
-
if (
|
|
919
|
-
const
|
|
920
|
-
if (
|
|
921
|
-
const
|
|
922
|
-
return
|
|
917
|
+
if (l < c && l < p) return -1;
|
|
918
|
+
if (l > c && l > p) return 1;
|
|
919
|
+
const s = e.comparePoint(t.leftSE.point);
|
|
920
|
+
if (s !== 0) return s;
|
|
921
|
+
const a = t.comparePoint(e.rightSE.point);
|
|
922
|
+
return a < 0 ? 1 : a > 0 ? -1 : 1;
|
|
923
923
|
}
|
|
924
|
-
if (
|
|
925
|
-
if (
|
|
926
|
-
if (o <
|
|
927
|
-
const
|
|
928
|
-
if (
|
|
924
|
+
if (l < c) return -1;
|
|
925
|
+
if (l > c) return 1;
|
|
926
|
+
if (o < u) {
|
|
927
|
+
const s = e.comparePoint(t.rightSE.point);
|
|
928
|
+
if (s !== 0) return s;
|
|
929
929
|
}
|
|
930
|
-
if (o >
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
if (
|
|
930
|
+
if (o > u) {
|
|
931
|
+
const s = t.comparePoint(e.rightSE.point);
|
|
932
|
+
if (s < 0) return 1;
|
|
933
|
+
if (s > 0) return -1;
|
|
934
934
|
}
|
|
935
|
-
if (o !==
|
|
936
|
-
const
|
|
937
|
-
if (
|
|
938
|
-
if (
|
|
935
|
+
if (o !== u) {
|
|
936
|
+
const s = f - l, a = o - n, h = p - c, g = u - i;
|
|
937
|
+
if (s > a && h < g) return 1;
|
|
938
|
+
if (s < a && h > g) return -1;
|
|
939
939
|
}
|
|
940
|
-
return o >
|
|
940
|
+
return o > u ? 1 : o < u || f < p ? -1 : f > p ? 1 : t.id < e.id ? -1 : t.id > e.id ? 1 : 0;
|
|
941
941
|
}
|
|
942
942
|
/* Warning: a reference to ringWindings input will be stored,
|
|
943
943
|
* and possibly will be later modified */
|
|
@@ -945,15 +945,15 @@ class z {
|
|
|
945
945
|
this.id = ++Re, this.leftSE = t, t.segment = this, t.otherSE = e, this.rightSE = e, e.segment = this, e.otherSE = t, this.rings = n, this.windings = i;
|
|
946
946
|
}
|
|
947
947
|
static fromRing(t, e, n) {
|
|
948
|
-
let i, o,
|
|
949
|
-
const
|
|
950
|
-
if (
|
|
951
|
-
i = t, o = e,
|
|
952
|
-
else if (
|
|
953
|
-
i = e, o = t,
|
|
948
|
+
let i, o, u;
|
|
949
|
+
const l = L.comparePoints(t, e);
|
|
950
|
+
if (l < 0)
|
|
951
|
+
i = t, o = e, u = 1;
|
|
952
|
+
else if (l > 0)
|
|
953
|
+
i = e, o = t, u = -1;
|
|
954
954
|
else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);
|
|
955
|
-
const c = new L(i, !0),
|
|
956
|
-
return new z(c,
|
|
955
|
+
const c = new L(i, !0), f = new L(o, !1);
|
|
956
|
+
return new z(c, f, [n], [u]);
|
|
957
957
|
}
|
|
958
958
|
/* When a segment is split, the rightSE is replaced with a new sweep event */
|
|
959
959
|
replaceRightSE(t) {
|
|
@@ -1000,9 +1000,9 @@ class z {
|
|
|
1000
1000
|
const e = this.leftSE.point, n = this.rightSE.point, i = this.vector();
|
|
1001
1001
|
if (e.x === n.x)
|
|
1002
1002
|
return t.x === e.x ? 0 : t.x < e.x ? 1 : -1;
|
|
1003
|
-
const o = (t.y - e.y) / i.y,
|
|
1004
|
-
if (t.x ===
|
|
1005
|
-
const
|
|
1003
|
+
const o = (t.y - e.y) / i.y, u = e.x + o * i.x;
|
|
1004
|
+
if (t.x === u) return 0;
|
|
1005
|
+
const l = (t.x - e.x) / i.x, c = e.y + l * i.y;
|
|
1006
1006
|
return t.y === c ? 0 : t.y < c ? -1 : 1;
|
|
1007
1007
|
}
|
|
1008
1008
|
/**
|
|
@@ -1021,20 +1021,20 @@ class z {
|
|
|
1021
1021
|
* Else, return null.
|
|
1022
1022
|
*/
|
|
1023
1023
|
getIntersection(t) {
|
|
1024
|
-
const e = this.bbox(), n = t.bbox(), i =
|
|
1024
|
+
const e = this.bbox(), n = t.bbox(), i = pt(e, n);
|
|
1025
1025
|
if (i === null) return null;
|
|
1026
|
-
const o = this.leftSE.point,
|
|
1027
|
-
if (
|
|
1028
|
-
return
|
|
1029
|
-
if (
|
|
1030
|
-
return
|
|
1031
|
-
if (
|
|
1032
|
-
return
|
|
1033
|
-
if (
|
|
1034
|
-
if (
|
|
1035
|
-
if (
|
|
1036
|
-
const
|
|
1037
|
-
return
|
|
1026
|
+
const o = this.leftSE.point, u = this.rightSE.point, l = t.leftSE.point, c = t.rightSE.point, f = j(e, l) && this.comparePoint(l) === 0, p = j(n, o) && t.comparePoint(o) === 0, s = j(e, c) && this.comparePoint(c) === 0, a = j(n, u) && t.comparePoint(u) === 0;
|
|
1027
|
+
if (p && f)
|
|
1028
|
+
return a && !s ? u : !a && s ? c : null;
|
|
1029
|
+
if (p)
|
|
1030
|
+
return s && o.x === c.x && o.y === c.y ? null : o;
|
|
1031
|
+
if (f)
|
|
1032
|
+
return a && u.x === l.x && u.y === l.y ? null : l;
|
|
1033
|
+
if (a && s) return null;
|
|
1034
|
+
if (a) return u;
|
|
1035
|
+
if (s) return c;
|
|
1036
|
+
const h = Ce(o, this.vector(), l, t.vector());
|
|
1037
|
+
return h === null || !j(i, h) ? null : J.round(h.x, h.y);
|
|
1038
1038
|
}
|
|
1039
1039
|
/**
|
|
1040
1040
|
* Split the given segment into multiple segments on the given points.
|
|
@@ -1049,10 +1049,10 @@ class z {
|
|
|
1049
1049
|
* Warning: input array of points is modified
|
|
1050
1050
|
*/
|
|
1051
1051
|
split(t) {
|
|
1052
|
-
const e = [], n = t.events !== void 0, i = new L(t, !0), o = new L(t, !1),
|
|
1052
|
+
const e = [], n = t.events !== void 0, i = new L(t, !0), o = new L(t, !1), u = this.rightSE;
|
|
1053
1053
|
this.replaceRightSE(o), e.push(o), e.push(i);
|
|
1054
|
-
const
|
|
1055
|
-
return L.comparePoints(
|
|
1054
|
+
const l = new z(i, u, this.rings.slice(), this.windings.slice());
|
|
1055
|
+
return L.comparePoints(l.leftSE.point, l.rightSE.point) > 0 && l.swapEvents(), L.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), n && (i.checkForConsuming(), o.checkForConsuming()), e;
|
|
1056
1056
|
}
|
|
1057
1057
|
/* Swap which event is left and right */
|
|
1058
1058
|
swapEvents() {
|
|
@@ -1077,9 +1077,9 @@ class z {
|
|
|
1077
1077
|
const o = e;
|
|
1078
1078
|
e = n, n = o;
|
|
1079
1079
|
}
|
|
1080
|
-
for (let o = 0,
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1080
|
+
for (let o = 0, u = n.rings.length; o < u; o++) {
|
|
1081
|
+
const l = n.rings[o], c = n.windings[o], f = e.rings.indexOf(l);
|
|
1082
|
+
f === -1 ? (e.rings.push(l), e.windings.push(c)) : e.windings[f] += c;
|
|
1083
1083
|
}
|
|
1084
1084
|
n.rings = null, n.windings = null, n.consumedBy = e, n.leftSE.consumedBy = e.leftSE, n.rightSE.consumedBy = e.rightSE;
|
|
1085
1085
|
}
|
|
@@ -1110,25 +1110,25 @@ class z {
|
|
|
1110
1110
|
multiPolys: []
|
|
1111
1111
|
};
|
|
1112
1112
|
const e = this._afterState.rings, n = this._afterState.windings, i = this._afterState.multiPolys;
|
|
1113
|
-
for (let
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1113
|
+
for (let l = 0, c = this.rings.length; l < c; l++) {
|
|
1114
|
+
const f = this.rings[l], p = this.windings[l], s = e.indexOf(f);
|
|
1115
|
+
s === -1 ? (e.push(f), n.push(p)) : n[s] += p;
|
|
1116
1116
|
}
|
|
1117
|
-
const o = [],
|
|
1118
|
-
for (let
|
|
1119
|
-
if (n[
|
|
1120
|
-
const
|
|
1121
|
-
if (
|
|
1122
|
-
if (
|
|
1117
|
+
const o = [], u = [];
|
|
1118
|
+
for (let l = 0, c = e.length; l < c; l++) {
|
|
1119
|
+
if (n[l] === 0) continue;
|
|
1120
|
+
const f = e[l], p = f.poly;
|
|
1121
|
+
if (u.indexOf(p) === -1)
|
|
1122
|
+
if (f.isExterior) o.push(p);
|
|
1123
1123
|
else {
|
|
1124
|
-
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1124
|
+
u.indexOf(p) === -1 && u.push(p);
|
|
1125
|
+
const s = o.indexOf(f.poly);
|
|
1126
|
+
s !== -1 && o.splice(s, 1);
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
for (let
|
|
1130
|
-
const
|
|
1131
|
-
i.indexOf(
|
|
1129
|
+
for (let l = 0, c = o.length; l < c; l++) {
|
|
1130
|
+
const f = o[l].multiPoly;
|
|
1131
|
+
i.indexOf(f) === -1 && i.push(f);
|
|
1132
1132
|
}
|
|
1133
1133
|
return this._afterState;
|
|
1134
1134
|
}
|
|
@@ -1137,7 +1137,7 @@ class z {
|
|
|
1137
1137
|
if (this.consumedBy) return !1;
|
|
1138
1138
|
if (this._isInResult !== void 0) return this._isInResult;
|
|
1139
1139
|
const t = this.beforeState().multiPolys, e = this.afterState().multiPolys;
|
|
1140
|
-
switch (
|
|
1140
|
+
switch (k.type) {
|
|
1141
1141
|
case "union": {
|
|
1142
1142
|
const n = t.length === 0, i = e.length === 0;
|
|
1143
1143
|
this._isInResult = n !== i;
|
|
@@ -1145,7 +1145,7 @@ class z {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
case "intersection": {
|
|
1147
1147
|
let n, i;
|
|
1148
|
-
t.length < e.length ? (n = t.length, i = e.length) : (n = e.length, i = t.length), this._isInResult = i ===
|
|
1148
|
+
t.length < e.length ? (n = t.length, i = e.length) : (n = e.length, i = t.length), this._isInResult = i === k.numMultiPolys && n < i;
|
|
1149
1149
|
break;
|
|
1150
1150
|
}
|
|
1151
1151
|
case "xor": {
|
|
@@ -1159,12 +1159,12 @@ class z {
|
|
|
1159
1159
|
break;
|
|
1160
1160
|
}
|
|
1161
1161
|
default:
|
|
1162
|
-
throw new Error(`Unrecognized operation type found ${
|
|
1162
|
+
throw new Error(`Unrecognized operation type found ${k.type}`);
|
|
1163
1163
|
}
|
|
1164
1164
|
return this._isInResult;
|
|
1165
1165
|
}
|
|
1166
1166
|
}
|
|
1167
|
-
class
|
|
1167
|
+
class $t {
|
|
1168
1168
|
constructor(t, e, n) {
|
|
1169
1169
|
if (!Array.isArray(t) || t.length === 0)
|
|
1170
1170
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
@@ -1182,10 +1182,10 @@ class kt {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
};
|
|
1184
1184
|
let o = i;
|
|
1185
|
-
for (let
|
|
1186
|
-
if (typeof t[
|
|
1185
|
+
for (let u = 1, l = t.length; u < l; u++) {
|
|
1186
|
+
if (typeof t[u][0] != "number" || typeof t[u][1] != "number")
|
|
1187
1187
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1188
|
-
let c = J.round(t[
|
|
1188
|
+
let c = J.round(t[u][0], t[u][1]);
|
|
1189
1189
|
c.x === o.x && c.y === o.y || (this.segments.push(z.fromRing(o, c, this)), c.x < this.bbox.ll.x && (this.bbox.ll.x = c.x), c.y < this.bbox.ll.y && (this.bbox.ll.y = c.y), c.x > this.bbox.ur.x && (this.bbox.ur.x = c.x), c.y > this.bbox.ur.y && (this.bbox.ur.y = c.y), o = c);
|
|
1190
1190
|
}
|
|
1191
1191
|
(i.x !== o.x || i.y !== o.y) && this.segments.push(z.fromRing(o, i, this));
|
|
@@ -1203,7 +1203,7 @@ class Ie {
|
|
|
1203
1203
|
constructor(t, e) {
|
|
1204
1204
|
if (!Array.isArray(t))
|
|
1205
1205
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1206
|
-
this.exteriorRing = new
|
|
1206
|
+
this.exteriorRing = new $t(t[0], this, !0), this.bbox = {
|
|
1207
1207
|
ll: {
|
|
1208
1208
|
x: this.exteriorRing.bbox.ll.x,
|
|
1209
1209
|
y: this.exteriorRing.bbox.ll.y
|
|
@@ -1214,7 +1214,7 @@ class Ie {
|
|
|
1214
1214
|
}
|
|
1215
1215
|
}, this.interiorRings = [];
|
|
1216
1216
|
for (let n = 1, i = t.length; n < i; n++) {
|
|
1217
|
-
const o = new
|
|
1217
|
+
const o = new $t(t[n], this, !1);
|
|
1218
1218
|
o.bbox.ll.x < this.bbox.ll.x && (this.bbox.ll.x = o.bbox.ll.x), o.bbox.ll.y < this.bbox.ll.y && (this.bbox.ll.y = o.bbox.ll.y), o.bbox.ur.x > this.bbox.ur.x && (this.bbox.ur.x = o.bbox.ur.x), o.bbox.ur.y > this.bbox.ur.y && (this.bbox.ur.y = o.bbox.ur.y), this.interiorRings.push(o);
|
|
1219
1219
|
}
|
|
1220
1220
|
this.multiPoly = e;
|
|
@@ -1223,13 +1223,13 @@ class Ie {
|
|
|
1223
1223
|
const t = this.exteriorRing.getSweepEvents();
|
|
1224
1224
|
for (let e = 0, n = this.interiorRings.length; e < n; e++) {
|
|
1225
1225
|
const i = this.interiorRings[e].getSweepEvents();
|
|
1226
|
-
for (let o = 0,
|
|
1226
|
+
for (let o = 0, u = i.length; o < u; o++)
|
|
1227
1227
|
t.push(i[o]);
|
|
1228
1228
|
}
|
|
1229
1229
|
return t;
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
|
-
class
|
|
1232
|
+
class kt {
|
|
1233
1233
|
constructor(t, e) {
|
|
1234
1234
|
if (!Array.isArray(t))
|
|
1235
1235
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
@@ -1257,7 +1257,7 @@ class $t {
|
|
|
1257
1257
|
const t = [];
|
|
1258
1258
|
for (let e = 0, n = this.polys.length; e < n; e++) {
|
|
1259
1259
|
const i = this.polys[e].getSweepEvents();
|
|
1260
|
-
for (let o = 0,
|
|
1260
|
+
for (let o = 0, u = i.length; o < u; o++)
|
|
1261
1261
|
t.push(i[o]);
|
|
1262
1262
|
}
|
|
1263
1263
|
return t;
|
|
@@ -1271,39 +1271,39 @@ class nt {
|
|
|
1271
1271
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
1272
1272
|
const o = t[n];
|
|
1273
1273
|
if (!o.isInResult() || o.ringOut) continue;
|
|
1274
|
-
let
|
|
1275
|
-
const
|
|
1276
|
-
for (;
|
|
1274
|
+
let u = null, l = o.leftSE, c = o.rightSE;
|
|
1275
|
+
const f = [l], p = l.point, s = [];
|
|
1276
|
+
for (; u = l, l = c, f.push(l), l.point !== p; )
|
|
1277
1277
|
for (; ; ) {
|
|
1278
|
-
const
|
|
1279
|
-
if (
|
|
1280
|
-
const
|
|
1281
|
-
throw new Error(`Unable to complete output ring starting at [${
|
|
1278
|
+
const a = l.getAvailableLinkedEvents();
|
|
1279
|
+
if (a.length === 0) {
|
|
1280
|
+
const d = f[0].point, w = f[f.length - 1].point;
|
|
1281
|
+
throw new Error(`Unable to complete output ring starting at [${d.x}, ${d.y}]. Last matching segment found ends at [${w.x}, ${w.y}].`);
|
|
1282
1282
|
}
|
|
1283
|
-
if (
|
|
1284
|
-
c =
|
|
1283
|
+
if (a.length === 1) {
|
|
1284
|
+
c = a[0].otherSE;
|
|
1285
1285
|
break;
|
|
1286
1286
|
}
|
|
1287
|
-
let
|
|
1288
|
-
for (let
|
|
1289
|
-
if (
|
|
1290
|
-
|
|
1287
|
+
let h = null;
|
|
1288
|
+
for (let d = 0, w = s.length; d < w; d++)
|
|
1289
|
+
if (s[d].point === l.point) {
|
|
1290
|
+
h = d;
|
|
1291
1291
|
break;
|
|
1292
1292
|
}
|
|
1293
|
-
if (
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1293
|
+
if (h !== null) {
|
|
1294
|
+
const d = s.splice(h)[0], w = f.splice(d.index);
|
|
1295
|
+
w.unshift(w[0].otherSE), e.push(new nt(w.reverse()));
|
|
1296
1296
|
continue;
|
|
1297
1297
|
}
|
|
1298
|
-
|
|
1299
|
-
index:
|
|
1300
|
-
point:
|
|
1298
|
+
s.push({
|
|
1299
|
+
index: f.length,
|
|
1300
|
+
point: l.point
|
|
1301
1301
|
});
|
|
1302
|
-
const
|
|
1303
|
-
c =
|
|
1302
|
+
const g = l.getLeftmostComparator(u);
|
|
1303
|
+
c = a.sort(g)[0].otherSE;
|
|
1304
1304
|
break;
|
|
1305
1305
|
}
|
|
1306
|
-
e.push(new nt(
|
|
1306
|
+
e.push(new nt(f));
|
|
1307
1307
|
}
|
|
1308
1308
|
return e;
|
|
1309
1309
|
}
|
|
@@ -1316,15 +1316,15 @@ class nt {
|
|
|
1316
1316
|
getGeom() {
|
|
1317
1317
|
let t = this.events[0].point;
|
|
1318
1318
|
const e = [t];
|
|
1319
|
-
for (let
|
|
1320
|
-
const
|
|
1321
|
-
Ct(
|
|
1319
|
+
for (let f = 1, p = this.events.length - 1; f < p; f++) {
|
|
1320
|
+
const s = this.events[f].point, a = this.events[f + 1].point;
|
|
1321
|
+
Ct(s, t, a) !== 0 && (e.push(s), t = s);
|
|
1322
1322
|
}
|
|
1323
1323
|
if (e.length === 1) return null;
|
|
1324
1324
|
const n = e[0], i = e[1];
|
|
1325
1325
|
Ct(n, t, i) === 0 && e.shift(), e.push(e[0]);
|
|
1326
|
-
const o = this.isExteriorRing() ? 1 : -1,
|
|
1327
|
-
for (let
|
|
1326
|
+
const o = this.isExteriorRing() ? 1 : -1, u = this.isExteriorRing() ? 0 : e.length - 1, l = this.isExteriorRing() ? e.length : -1, c = [];
|
|
1327
|
+
for (let f = u; f != l; f += o) c.push([e[f].x, e[f].y]);
|
|
1328
1328
|
return c;
|
|
1329
1329
|
}
|
|
1330
1330
|
isExteriorRing() {
|
|
@@ -1341,8 +1341,8 @@ class nt {
|
|
|
1341
1341
|
_calcEnclosingRing() {
|
|
1342
1342
|
let t = this.events[0];
|
|
1343
1343
|
for (let i = 1, o = this.events.length; i < o; i++) {
|
|
1344
|
-
const
|
|
1345
|
-
L.compare(t,
|
|
1344
|
+
const u = this.events[i];
|
|
1345
|
+
L.compare(t, u) > 0 && (t = u);
|
|
1346
1346
|
}
|
|
1347
1347
|
let e = t.segment.prevInResult(), n = e ? e.prevInResult() : null;
|
|
1348
1348
|
for (; ; ) {
|
|
@@ -1371,7 +1371,7 @@ class At {
|
|
|
1371
1371
|
return t;
|
|
1372
1372
|
}
|
|
1373
1373
|
}
|
|
1374
|
-
class
|
|
1374
|
+
class $e {
|
|
1375
1375
|
constructor(t) {
|
|
1376
1376
|
this.rings = t, this.polys = this._composePolys(t);
|
|
1377
1377
|
}
|
|
@@ -1390,14 +1390,14 @@ class ke {
|
|
|
1390
1390
|
if (!o.poly)
|
|
1391
1391
|
if (o.isExteriorRing()) e.push(new At(o));
|
|
1392
1392
|
else {
|
|
1393
|
-
const
|
|
1394
|
-
|
|
1393
|
+
const u = o.enclosingRing();
|
|
1394
|
+
u.poly || e.push(new At(u)), u.poly.addInterior(o);
|
|
1395
1395
|
}
|
|
1396
1396
|
}
|
|
1397
1397
|
return e;
|
|
1398
1398
|
}
|
|
1399
1399
|
}
|
|
1400
|
-
class
|
|
1400
|
+
class ke {
|
|
1401
1401
|
constructor(t) {
|
|
1402
1402
|
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : z.compare;
|
|
1403
1403
|
this.queue = t, this.tree = new wt(e), this.segments = [];
|
|
@@ -1408,51 +1408,51 @@ class $e {
|
|
|
1408
1408
|
return t.isLeft ? this.queue.remove(t.otherSE) : this.tree.remove(e), n;
|
|
1409
1409
|
const i = t.isLeft ? this.tree.add(e) : this.tree.find(e);
|
|
1410
1410
|
if (!i) throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);
|
|
1411
|
-
let o = i,
|
|
1412
|
-
for (;
|
|
1413
|
-
o = this.tree.prev(o), o === null ?
|
|
1411
|
+
let o = i, u = i, l, c;
|
|
1412
|
+
for (; l === void 0; )
|
|
1413
|
+
o = this.tree.prev(o), o === null ? l = null : o.key.consumedBy === void 0 && (l = o.key);
|
|
1414
1414
|
for (; c === void 0; )
|
|
1415
|
-
|
|
1415
|
+
u = this.tree.next(u), u === null ? c = null : u.key.consumedBy === void 0 && (c = u.key);
|
|
1416
1416
|
if (t.isLeft) {
|
|
1417
|
-
let
|
|
1418
|
-
if (
|
|
1419
|
-
const
|
|
1420
|
-
if (
|
|
1421
|
-
const
|
|
1422
|
-
for (let
|
|
1423
|
-
n.push(h
|
|
1417
|
+
let f = null;
|
|
1418
|
+
if (l) {
|
|
1419
|
+
const s = l.getIntersection(e);
|
|
1420
|
+
if (s !== null && (e.isAnEndpoint(s) || (f = s), !l.isAnEndpoint(s))) {
|
|
1421
|
+
const a = this._splitSafely(l, s);
|
|
1422
|
+
for (let h = 0, g = a.length; h < g; h++)
|
|
1423
|
+
n.push(a[h]);
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
|
-
let
|
|
1426
|
+
let p = null;
|
|
1427
1427
|
if (c) {
|
|
1428
|
-
const
|
|
1429
|
-
if (
|
|
1430
|
-
const
|
|
1431
|
-
for (let
|
|
1432
|
-
n.push(h
|
|
1428
|
+
const s = c.getIntersection(e);
|
|
1429
|
+
if (s !== null && (e.isAnEndpoint(s) || (p = s), !c.isAnEndpoint(s))) {
|
|
1430
|
+
const a = this._splitSafely(c, s);
|
|
1431
|
+
for (let h = 0, g = a.length; h < g; h++)
|
|
1432
|
+
n.push(a[h]);
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
|
-
if (
|
|
1436
|
-
let
|
|
1437
|
-
|
|
1438
|
-
const
|
|
1439
|
-
for (let
|
|
1440
|
-
n.push(h
|
|
1435
|
+
if (f !== null || p !== null) {
|
|
1436
|
+
let s = null;
|
|
1437
|
+
f === null ? s = p : p === null ? s = f : s = L.comparePoints(f, p) <= 0 ? f : p, this.queue.remove(e.rightSE), n.push(e.rightSE);
|
|
1438
|
+
const a = e.split(s);
|
|
1439
|
+
for (let h = 0, g = a.length; h < g; h++)
|
|
1440
|
+
n.push(a[h]);
|
|
1441
1441
|
}
|
|
1442
|
-
n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev =
|
|
1442
|
+
n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev = l);
|
|
1443
1443
|
} else {
|
|
1444
|
-
if (
|
|
1445
|
-
const
|
|
1446
|
-
if (
|
|
1447
|
-
if (!
|
|
1448
|
-
const
|
|
1449
|
-
for (let
|
|
1450
|
-
n.push(
|
|
1444
|
+
if (l && c) {
|
|
1445
|
+
const f = l.getIntersection(c);
|
|
1446
|
+
if (f !== null) {
|
|
1447
|
+
if (!l.isAnEndpoint(f)) {
|
|
1448
|
+
const p = this._splitSafely(l, f);
|
|
1449
|
+
for (let s = 0, a = p.length; s < a; s++)
|
|
1450
|
+
n.push(p[s]);
|
|
1451
1451
|
}
|
|
1452
|
-
if (!c.isAnEndpoint(
|
|
1453
|
-
const
|
|
1454
|
-
for (let
|
|
1455
|
-
n.push(
|
|
1452
|
+
if (!c.isAnEndpoint(f)) {
|
|
1453
|
+
const p = this._splitSafely(c, f);
|
|
1454
|
+
for (let s = 0, a = p.length; s < a; s++)
|
|
1455
|
+
n.push(p[s]);
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
@@ -1473,69 +1473,69 @@ class $e {
|
|
|
1473
1473
|
const Ot = typeof process < "u" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6, Ae = typeof process < "u" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
|
|
1474
1474
|
class Oe {
|
|
1475
1475
|
run(t, e, n) {
|
|
1476
|
-
|
|
1477
|
-
const i = [new
|
|
1478
|
-
for (let
|
|
1479
|
-
i.push(new
|
|
1480
|
-
if (
|
|
1481
|
-
const
|
|
1482
|
-
let
|
|
1483
|
-
for (;
|
|
1484
|
-
|
|
1476
|
+
k.type = t, J.reset();
|
|
1477
|
+
const i = [new kt(e, !0)];
|
|
1478
|
+
for (let s = 0, a = n.length; s < a; s++)
|
|
1479
|
+
i.push(new kt(n[s], !1));
|
|
1480
|
+
if (k.numMultiPolys = i.length, k.type === "difference") {
|
|
1481
|
+
const s = i[0];
|
|
1482
|
+
let a = 1;
|
|
1483
|
+
for (; a < i.length; )
|
|
1484
|
+
pt(i[a].bbox, s.bbox) !== null ? a++ : i.splice(a, 1);
|
|
1485
1485
|
}
|
|
1486
|
-
if (
|
|
1487
|
-
for (let
|
|
1488
|
-
const
|
|
1489
|
-
for (let
|
|
1490
|
-
if (
|
|
1486
|
+
if (k.type === "intersection")
|
|
1487
|
+
for (let s = 0, a = i.length; s < a; s++) {
|
|
1488
|
+
const h = i[s];
|
|
1489
|
+
for (let g = s + 1, d = i.length; g < d; g++)
|
|
1490
|
+
if (pt(h.bbox, i[g].bbox) === null) return [];
|
|
1491
1491
|
}
|
|
1492
1492
|
const o = new wt(L.compare);
|
|
1493
|
-
for (let
|
|
1494
|
-
const
|
|
1495
|
-
for (let
|
|
1496
|
-
if (o.insert(
|
|
1493
|
+
for (let s = 0, a = i.length; s < a; s++) {
|
|
1494
|
+
const h = i[s].getSweepEvents();
|
|
1495
|
+
for (let g = 0, d = h.length; g < d; g++)
|
|
1496
|
+
if (o.insert(h[g]), o.size > Ot)
|
|
1497
1497
|
throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
|
|
1498
1498
|
}
|
|
1499
|
-
const
|
|
1500
|
-
let
|
|
1499
|
+
const u = new ke(o);
|
|
1500
|
+
let l = o.size, c = o.pop();
|
|
1501
1501
|
for (; c; ) {
|
|
1502
|
-
const
|
|
1503
|
-
if (o.size ===
|
|
1504
|
-
const
|
|
1505
|
-
throw new Error(`Unable to pop() ${
|
|
1502
|
+
const s = c.key;
|
|
1503
|
+
if (o.size === l) {
|
|
1504
|
+
const h = s.segment;
|
|
1505
|
+
throw new Error(`Unable to pop() ${s.isLeft ? "left" : "right"} SweepEvent [${s.point.x}, ${s.point.y}] from segment #${h.id} [${h.leftSE.point.x}, ${h.leftSE.point.y}] -> [${h.rightSE.point.x}, ${h.rightSE.point.y}] from queue.`);
|
|
1506
1506
|
}
|
|
1507
1507
|
if (o.size > Ot)
|
|
1508
1508
|
throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
|
|
1509
|
-
if (
|
|
1509
|
+
if (u.segments.length > Ae)
|
|
1510
1510
|
throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
|
|
1511
|
-
const
|
|
1512
|
-
for (let
|
|
1513
|
-
const
|
|
1514
|
-
|
|
1511
|
+
const a = u.process(s);
|
|
1512
|
+
for (let h = 0, g = a.length; h < g; h++) {
|
|
1513
|
+
const d = a[h];
|
|
1514
|
+
d.consumedBy === void 0 && o.insert(d);
|
|
1515
1515
|
}
|
|
1516
|
-
|
|
1516
|
+
l = o.size, c = o.pop();
|
|
1517
1517
|
}
|
|
1518
1518
|
J.reset();
|
|
1519
|
-
const
|
|
1520
|
-
return new
|
|
1519
|
+
const f = nt.factory(u.segments);
|
|
1520
|
+
return new $e(f).getGeom();
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
1523
|
-
const
|
|
1523
|
+
const k = new Oe(), Ne = function(r) {
|
|
1524
1524
|
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1525
1525
|
e[n - 1] = arguments[n];
|
|
1526
|
-
return
|
|
1526
|
+
return k.run("union", r, e);
|
|
1527
1527
|
}, Be = function(r) {
|
|
1528
1528
|
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1529
1529
|
e[n - 1] = arguments[n];
|
|
1530
|
-
return
|
|
1530
|
+
return k.run("intersection", r, e);
|
|
1531
1531
|
}, Ge = function(r) {
|
|
1532
1532
|
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1533
1533
|
e[n - 1] = arguments[n];
|
|
1534
|
-
return
|
|
1534
|
+
return k.run("xor", r, e);
|
|
1535
1535
|
}, ze = function(r) {
|
|
1536
1536
|
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1537
1537
|
e[n - 1] = arguments[n];
|
|
1538
|
-
return
|
|
1538
|
+
return k.run("difference", r, e);
|
|
1539
1539
|
};
|
|
1540
1540
|
var Zt = {
|
|
1541
1541
|
union: Ne,
|
|
@@ -1553,7 +1553,7 @@ function Fe(r, t = {}) {
|
|
|
1553
1553
|
return n.length === 0 ? null : n.length === 1 ? xt(n[0], t.properties) : Ut(n, t.properties);
|
|
1554
1554
|
}
|
|
1555
1555
|
var Jt = Fe;
|
|
1556
|
-
function
|
|
1556
|
+
function gt(r) {
|
|
1557
1557
|
const t = [...r];
|
|
1558
1558
|
return t[2] < t[0] && (Math.abs((t[0] + t[2] + 360) / 2) > Math.abs((t[0] - 360 + t[2]) / 2) ? t[0] -= 360 : t[2] += 360), t;
|
|
1559
1559
|
}
|
|
@@ -1667,10 +1667,10 @@ function Ke(r, t) {
|
|
|
1667
1667
|
function He(r, t) {
|
|
1668
1668
|
r.$$.dirty[0] === -1 && (U.push(r), je(), r.$$.dirty.fill(0)), r.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
1669
1669
|
}
|
|
1670
|
-
function tn(r, t, e, n, i, o,
|
|
1670
|
+
function tn(r, t, e, n, i, o, u = null, l = [-1]) {
|
|
1671
1671
|
const c = Et;
|
|
1672
1672
|
X(r);
|
|
1673
|
-
const
|
|
1673
|
+
const f = r.$$ = {
|
|
1674
1674
|
fragment: null,
|
|
1675
1675
|
ctx: [],
|
|
1676
1676
|
// state
|
|
@@ -1687,21 +1687,21 @@ function tn(r, t, e, n, i, o, f = null, s = [-1]) {
|
|
|
1687
1687
|
context: new Map(t.context || (c ? c.$$.context : [])),
|
|
1688
1688
|
// everything else
|
|
1689
1689
|
callbacks: Nt(),
|
|
1690
|
-
dirty:
|
|
1690
|
+
dirty: l,
|
|
1691
1691
|
skip_bound: !1,
|
|
1692
1692
|
root: t.target || c.$$.root
|
|
1693
1693
|
};
|
|
1694
|
-
|
|
1695
|
-
let
|
|
1696
|
-
if (
|
|
1697
|
-
const
|
|
1698
|
-
return
|
|
1699
|
-
}) : [],
|
|
1694
|
+
u && u(f.root);
|
|
1695
|
+
let p = !1;
|
|
1696
|
+
if (f.ctx = e ? e(r, t.props || {}, (s, a, ...h) => {
|
|
1697
|
+
const g = h.length ? h[0] : a;
|
|
1698
|
+
return f.ctx && i(f.ctx[s], f.ctx[s] = g) && (!f.skip_bound && f.bound[s] && f.bound[s](g), p && He(r, s)), a;
|
|
1699
|
+
}) : [], f.update(), p = !0, rt(f.before_update), f.fragment = n ? n(f.ctx) : !1, t.target) {
|
|
1700
1700
|
if (t.hydrate) {
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1701
|
+
const s = Ye(t.target);
|
|
1702
|
+
f.fragment && f.fragment.l(s), s.forEach(Ht);
|
|
1703
1703
|
} else
|
|
1704
|
-
|
|
1704
|
+
f.fragment && f.fragment.c();
|
|
1705
1705
|
t.intro && Je(r.$$.fragment), We(r, t.target, t.anchor), te();
|
|
1706
1706
|
}
|
|
1707
1707
|
X(c);
|
|
@@ -1846,22 +1846,22 @@ function Ft(r, t) {
|
|
|
1846
1846
|
if (!e)
|
|
1847
1847
|
return;
|
|
1848
1848
|
e.properties = { isMask: !0 };
|
|
1849
|
-
const n =
|
|
1850
|
-
if (
|
|
1851
|
-
for (const c of
|
|
1852
|
-
const
|
|
1853
|
-
if (
|
|
1854
|
-
for (const
|
|
1855
|
-
for (const
|
|
1856
|
-
|
|
1857
|
-
if (o &&
|
|
1858
|
-
for (const
|
|
1859
|
-
for (const
|
|
1860
|
-
|
|
1849
|
+
const n = gt(ut(r)), i = (n[2] - n[0]) / 360 / 1e3, o = n[0] < -180, u = n[2] > 180, l = cn(r);
|
|
1850
|
+
if (l.features.length > 1 && (o || u))
|
|
1851
|
+
for (const c of l.features) {
|
|
1852
|
+
const f = gt(ut(c));
|
|
1853
|
+
if (u && f[0] < -180 + i)
|
|
1854
|
+
for (const p of c.geometry.coordinates)
|
|
1855
|
+
for (const s of p)
|
|
1856
|
+
s[0] += 360 - i;
|
|
1857
|
+
if (o && f[2] > 180 - i)
|
|
1858
|
+
for (const p of c.geometry.coordinates)
|
|
1859
|
+
for (const s of p)
|
|
1860
|
+
s[0] -= 360 - i;
|
|
1861
1861
|
}
|
|
1862
1862
|
t(
|
|
1863
1863
|
Z([
|
|
1864
|
-
|
|
1864
|
+
l.features.length < 2 ? r : Jt(l) ?? r,
|
|
1865
1865
|
e
|
|
1866
1866
|
])
|
|
1867
1867
|
);
|
|
@@ -1878,23 +1878,23 @@ const Tt = (r) => {
|
|
|
1878
1878
|
lineCap: "butt"
|
|
1879
1879
|
};
|
|
1880
1880
|
};
|
|
1881
|
-
function an(r, t = !0, e = !0, n = {}, i = {}, o = Tt
|
|
1882
|
-
let
|
|
1883
|
-
const
|
|
1884
|
-
let
|
|
1885
|
-
const
|
|
1881
|
+
function an(r, t = !0, e = !0, n = {}, i = {}, o = Tt) {
|
|
1882
|
+
let u;
|
|
1883
|
+
const l = [];
|
|
1884
|
+
let c, f;
|
|
1885
|
+
const p = T.geoJSON(void 0, {
|
|
1886
1886
|
style: o === !0 ? Tt : o === !1 ? void 0 : o ?? void 0,
|
|
1887
1887
|
interactive: !1
|
|
1888
|
-
}).addTo(r),
|
|
1889
|
-
|
|
1888
|
+
}).addTo(r), s = (h) => {
|
|
1889
|
+
u == null || u({
|
|
1890
1890
|
type: "mapClick",
|
|
1891
|
-
coordinates: [
|
|
1891
|
+
coordinates: [h.latlng.lng, h.latlng.lat]
|
|
1892
1892
|
});
|
|
1893
1893
|
};
|
|
1894
|
-
function
|
|
1894
|
+
function a(h, g = !1) {
|
|
1895
1895
|
const d = document.createElement("div");
|
|
1896
|
-
return new sn({ props: { displayIn: "leaflet" }, target: d }), new T.Marker(
|
|
1897
|
-
interactive:
|
|
1896
|
+
return new sn({ props: { displayIn: "leaflet" }, target: d }), new T.Marker(h, {
|
|
1897
|
+
interactive: g,
|
|
1898
1898
|
icon: new T.DivIcon({
|
|
1899
1899
|
html: d,
|
|
1900
1900
|
className: "",
|
|
@@ -1905,135 +1905,132 @@ function an(r, t = !0, e = !0, n = {}, i = {}, o = Tt, f = !1) {
|
|
|
1905
1905
|
});
|
|
1906
1906
|
}
|
|
1907
1907
|
return {
|
|
1908
|
-
setEventHandler(
|
|
1909
|
-
|
|
1908
|
+
setEventHandler(h) {
|
|
1909
|
+
h ? (u = h, r.on("click", s)) : (u = void 0, r.off("click", s));
|
|
1910
1910
|
},
|
|
1911
|
-
flyTo(
|
|
1912
|
-
r.flyTo([
|
|
1911
|
+
flyTo(h, g) {
|
|
1912
|
+
r.flyTo([h[1], h[0]], g, { duration: 2, ...n });
|
|
1913
1913
|
},
|
|
1914
|
-
fitBounds(
|
|
1914
|
+
fitBounds(h, g, d) {
|
|
1915
1915
|
r.flyToBounds(
|
|
1916
1916
|
[
|
|
1917
|
-
[
|
|
1918
|
-
[
|
|
1917
|
+
[h[1], h[0]],
|
|
1918
|
+
[h[3], h[2]]
|
|
1919
1919
|
],
|
|
1920
1920
|
{
|
|
1921
|
-
padding: [
|
|
1921
|
+
padding: [g, g],
|
|
1922
1922
|
duration: 2,
|
|
1923
1923
|
...d ? { maxZoom: d } : {},
|
|
1924
1924
|
...i
|
|
1925
1925
|
}
|
|
1926
1926
|
);
|
|
1927
1927
|
},
|
|
1928
|
-
indicateReverse(
|
|
1929
|
-
r.getContainer().style.cursor =
|
|
1928
|
+
indicateReverse(h) {
|
|
1929
|
+
r.getContainer().style.cursor = h ? "crosshair" : "";
|
|
1930
1930
|
},
|
|
1931
|
-
setReverseMarker(
|
|
1931
|
+
setReverseMarker(h) {
|
|
1932
1932
|
var d;
|
|
1933
1933
|
if (!t)
|
|
1934
1934
|
return;
|
|
1935
|
-
const
|
|
1936
|
-
|
|
1935
|
+
const g = h && [h[1], h[0]];
|
|
1936
|
+
f ? g ? f.setLatLng(g) : (f.remove(), f = void 0) : g && (t instanceof Function ? f = t(r) ?? void 0 : (f = (typeof t == "object" ? new T.Marker(g, t) : a(g)).addTo(r), (d = f.getElement()) == null || d.classList.add("marker-reverse")));
|
|
1937
1937
|
},
|
|
1938
|
-
setMarkers(
|
|
1939
|
-
function
|
|
1940
|
-
|
|
1938
|
+
setMarkers(h, g, d) {
|
|
1939
|
+
function w(y) {
|
|
1940
|
+
p.clearLayers(), y && p.addData(y);
|
|
1941
1941
|
}
|
|
1942
|
-
for (const
|
|
1943
|
-
|
|
1944
|
-
if (
|
|
1945
|
-
let
|
|
1946
|
-
if (
|
|
1947
|
-
const
|
|
1948
|
-
(
|
|
1942
|
+
for (const y of l)
|
|
1943
|
+
y.remove();
|
|
1944
|
+
if (l.length = 0, w(), g) {
|
|
1945
|
+
let y = !1;
|
|
1946
|
+
if (g.geometry.type === "GeometryCollection") {
|
|
1947
|
+
const v = g.geometry.geometries.filter(
|
|
1948
|
+
(x) => x.type === "Polygon" || x.type === "MultiPolygon"
|
|
1949
1949
|
);
|
|
1950
|
-
t: if (
|
|
1951
|
-
const
|
|
1952
|
-
Z(
|
|
1950
|
+
t: if (v.length > 0) {
|
|
1951
|
+
const x = Jt(
|
|
1952
|
+
Z(v.map((m) => V(m)))
|
|
1953
1953
|
);
|
|
1954
|
-
if (!
|
|
1954
|
+
if (!x)
|
|
1955
1955
|
break t;
|
|
1956
1956
|
Ft(
|
|
1957
1957
|
{
|
|
1958
|
-
...
|
|
1959
|
-
geometry:
|
|
1958
|
+
...g,
|
|
1959
|
+
geometry: x.geometry
|
|
1960
1960
|
},
|
|
1961
|
-
|
|
1962
|
-
),
|
|
1961
|
+
w
|
|
1962
|
+
), y = !0;
|
|
1963
1963
|
} else {
|
|
1964
|
-
const
|
|
1965
|
-
(
|
|
1964
|
+
const x = g.geometry.geometries.filter(
|
|
1965
|
+
(m) => m.type === "LineString" || m.type === "MultiLineString"
|
|
1966
1966
|
);
|
|
1967
|
-
|
|
1968
|
-
...
|
|
1969
|
-
geometry: { type: "GeometryCollection", geometries:
|
|
1970
|
-
}),
|
|
1967
|
+
x.length > 0 && (w({
|
|
1968
|
+
...g,
|
|
1969
|
+
geometry: { type: "GeometryCollection", geometries: x }
|
|
1970
|
+
}), y = !0);
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
|
-
if (!
|
|
1974
|
-
if (
|
|
1975
|
-
Ft(
|
|
1976
|
-
if (!
|
|
1973
|
+
if (!y) {
|
|
1974
|
+
if (g.geometry.type === "Polygon" || g.geometry.type === "MultiPolygon")
|
|
1975
|
+
Ft(g, (v) => {
|
|
1976
|
+
if (!v)
|
|
1977
1977
|
return;
|
|
1978
|
-
const
|
|
1979
|
-
|
|
1978
|
+
const x = [...v.features], m = gt(ut(g)), E = m[2] - m[0];
|
|
1979
|
+
m[0] - E / 4 < -180 && x.push(...qt(v, -360).features), m[2] + E / 4 > 180 && x.push(...qt(v, 360).features), w(Z(x));
|
|
1980
1980
|
});
|
|
1981
|
-
else if (
|
|
1982
|
-
|
|
1981
|
+
else if (g.geometry.type === "LineString" || g.geometry.type === "MultiLineString") {
|
|
1982
|
+
w(g);
|
|
1983
1983
|
return;
|
|
1984
1984
|
}
|
|
1985
1985
|
}
|
|
1986
|
-
if (!
|
|
1986
|
+
if (!d && g.geometry.type !== "Point")
|
|
1987
1987
|
return;
|
|
1988
1988
|
if (t instanceof Function) {
|
|
1989
|
-
const
|
|
1990
|
-
|
|
1989
|
+
const v = t(r, g);
|
|
1990
|
+
v && l.push(v.addTo(r));
|
|
1991
1991
|
} else if (t) {
|
|
1992
|
-
const
|
|
1993
|
-
|
|
1994
|
-
typeof t == "object" ? new T.Marker(
|
|
1992
|
+
const v = [g.center[1], g.center[0]];
|
|
1993
|
+
l.push(
|
|
1994
|
+
typeof t == "object" ? new T.Marker(v, t) : a(v).addTo(r)
|
|
1995
1995
|
);
|
|
1996
1996
|
}
|
|
1997
1997
|
}
|
|
1998
1998
|
if (e)
|
|
1999
|
-
for (const
|
|
2000
|
-
if (
|
|
1999
|
+
for (const y of h ?? []) {
|
|
2000
|
+
if (y === g)
|
|
2001
2001
|
continue;
|
|
2002
|
-
const
|
|
2003
|
-
|
|
2004
|
-
|
|
2002
|
+
const v = [
|
|
2003
|
+
y.center[1],
|
|
2004
|
+
y.center[0]
|
|
2005
2005
|
];
|
|
2006
|
-
let
|
|
2006
|
+
let x;
|
|
2007
2007
|
if (e instanceof Function) {
|
|
2008
|
-
if (
|
|
2008
|
+
if (x = e(r, y), !x)
|
|
2009
2009
|
continue;
|
|
2010
2010
|
} else
|
|
2011
|
-
|
|
2012
|
-
|
|
2011
|
+
x = (typeof e == "object" ? new T.Marker(v, e) : a(v, !0)).addTo(r).bindTooltip(
|
|
2012
|
+
y.place_type[0] === "reverse" ? y.place_name : y.place_name.replace(/,.*/, ""),
|
|
2013
2013
|
{
|
|
2014
2014
|
direction: "top"
|
|
2015
2015
|
}
|
|
2016
2016
|
);
|
|
2017
|
-
const
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
}),
|
|
2021
|
-
|
|
2022
|
-
}),
|
|
2023
|
-
|
|
2024
|
-
}),
|
|
2017
|
+
const m = x.getElement();
|
|
2018
|
+
m && (m.addEventListener("click", (E) => {
|
|
2019
|
+
E.stopPropagation(), u == null || u({ type: "markerClick", id: y.id });
|
|
2020
|
+
}), m.addEventListener("mouseenter", () => {
|
|
2021
|
+
u == null || u({ type: "markerMouseEnter", id: y.id });
|
|
2022
|
+
}), m.addEventListener("mouseleave", () => {
|
|
2023
|
+
u == null || u({ type: "markerMouseLeave", id: y.id });
|
|
2024
|
+
}), m.classList.toggle("marker-fuzzy", !!y.matching_text)), l.push(x);
|
|
2025
2025
|
}
|
|
2026
2026
|
},
|
|
2027
|
-
setSelectedMarker(
|
|
2028
|
-
var
|
|
2029
|
-
|
|
2027
|
+
setSelectedMarker(h) {
|
|
2028
|
+
var g, d;
|
|
2029
|
+
c && ((g = c.getElement()) == null || g.classList.toggle("marker-selected", !1)), c = h > -1 ? l[h] : void 0, (d = c == null ? void 0 : c.getElement()) == null || d.classList.toggle("marker-selected", !0);
|
|
2030
2030
|
},
|
|
2031
2031
|
getCenterAndZoom() {
|
|
2032
|
-
const
|
|
2033
|
-
return [r.getZoom(),
|
|
2034
|
-
},
|
|
2035
|
-
setShowPolygonMarker(p) {
|
|
2036
|
-
l = p;
|
|
2032
|
+
const h = r.getCenter();
|
|
2033
|
+
return [r.getZoom(), h.lng, h.lat];
|
|
2037
2034
|
}
|
|
2038
2035
|
};
|
|
2039
2036
|
}
|