@maptiler/geocoding-control 1.4.2-dev.3 → 2.0.0-rc.2
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 +2659 -35
- package/leaflet-controller.d.ts +1 -1
- package/leaflet-controller.js +580 -569
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +3 -3
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.d.ts +74 -16
- package/leaflet.js +1396 -1369
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -3
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +7 -7
- package/maplibregl-controller.js +683 -661
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +3 -3
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.d.ts +2614 -5
- package/maplibregl.js +1563 -1418
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -3
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.d.ts +2614 -5
- package/maptilersdk.js +1574 -1426
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -3
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.d.ts +1 -1
- package/openlayers-controller.js +308 -306
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +3 -3
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.d.ts +21 -0
- package/openlayers.js +1300 -1318
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -3
- package/openlayers.umd.js.map +1 -1
- package/package.json +17 -17
- package/react.d.ts +4 -4
- package/react.js +811 -798
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/style.css +1 -1
- package/svelte/FeatureItem.svelte +1 -1
- package/svelte/FeatureItem.svelte.d.ts +1 -1
- package/svelte/GeocodingControl.svelte +68 -46
- package/svelte/GeocodingControl.svelte.d.ts +25 -11
- package/svelte/MapLibreBasedGeocodingControl.d.ts +2659 -35
- package/svelte/MapLibreBasedGeocodingControl.js +165 -58
- package/svelte/leaflet-controller.d.ts +1 -1
- package/svelte/leaflet-controller.js +50 -24
- package/svelte/leaflet.d.ts +74 -16
- package/svelte/leaflet.js +26 -15
- package/svelte/maplibregl-controller.d.ts +7 -7
- package/svelte/maplibregl-controller.js +96 -66
- package/svelte/maplibregl.d.ts +2614 -5
- package/svelte/maplibregl.js +10 -7
- package/svelte/maptilersdk.d.ts +2614 -5
- package/svelte/maptilersdk.js +23 -18
- package/svelte/openlayers-controller.d.ts +1 -1
- package/svelte/openlayers-controller.js +4 -1
- package/svelte/openlayers.d.ts +21 -0
- package/svelte/openlayers.js +31 -45
- package/svelte/react.d.ts +4 -4
- package/svelte/react.js +5 -5
- package/svelte/types.d.ts +72 -30
- package/svelte/vanilla.d.ts +14 -1
- package/svelte/vanilla.js +31 -8
- package/types.d.ts +72 -30
- package/vanilla.d.ts +14 -1
- package/vanilla.js +837 -796
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
package/leaflet-controller.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var it = (r, t, e) =>
|
|
4
|
-
import * as
|
|
1
|
+
var ie = Object.defineProperty;
|
|
2
|
+
var oe = (r, t, e) => t in r ? ie(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var it = (r, t, e) => oe(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import * as T from "leaflet";
|
|
5
5
|
function V(r, t, e = {}) {
|
|
6
6
|
const n = { type: "Feature" };
|
|
7
7
|
return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = r, n;
|
|
@@ -27,49 +27,49 @@ function Z(r, t = {}) {
|
|
|
27
27
|
const e = { type: "FeatureCollection" };
|
|
28
28
|
return t.id && (e.id = t.id), t.bbox && (e.bbox = t.bbox), e.features = r, e;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function Ut(r, t, e = {}) {
|
|
31
31
|
return V({
|
|
32
32
|
type: "MultiPolygon",
|
|
33
33
|
coordinates: r
|
|
34
34
|
}, t, e);
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function Yt(r, t, e) {
|
|
37
37
|
if (r !== null)
|
|
38
|
-
for (var n, i, o,
|
|
39
|
-
|
|
40
|
-
for (var
|
|
41
|
-
var
|
|
42
|
-
if (
|
|
43
|
-
c =
|
|
44
|
-
var E =
|
|
38
|
+
for (var n, i, o, f, s, c, u, p = 0, l = 0, h, a = r.type, y = a === "FeatureCollection", g = a === "Feature", x = y ? r.features.length : 1, d = 0; d < x; d++) {
|
|
39
|
+
u = y ? r.features[d].geometry : g ? r.geometry : r, h = u ? u.type === "GeometryCollection" : !1, s = h ? u.geometries.length : 1;
|
|
40
|
+
for (var m = 0; m < s; m++) {
|
|
41
|
+
var v = 0, w = 0;
|
|
42
|
+
if (f = h ? u.geometries[m] : u, f !== null) {
|
|
43
|
+
c = f.coordinates;
|
|
44
|
+
var E = f.type;
|
|
45
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
|
+
l,
|
|
52
|
+
d,
|
|
53
|
+
v,
|
|
54
54
|
w
|
|
55
55
|
) === !1)
|
|
56
56
|
return !1;
|
|
57
|
-
|
|
57
|
+
l++, v++;
|
|
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
|
+
l,
|
|
65
|
+
d,
|
|
66
|
+
v,
|
|
67
67
|
w
|
|
68
68
|
) === !1)
|
|
69
69
|
return !1;
|
|
70
|
-
|
|
70
|
+
l++, E === "MultiPoint" && v++;
|
|
71
71
|
}
|
|
72
|
-
E === "LineString" &&
|
|
72
|
+
E === "LineString" && v++;
|
|
73
73
|
break;
|
|
74
74
|
case "Polygon":
|
|
75
75
|
case "MultiLineString":
|
|
@@ -77,17 +77,17 @@ function Ut(r, t, e) {
|
|
|
77
77
|
for (i = 0; i < c[n].length - p; i++) {
|
|
78
78
|
if (t(
|
|
79
79
|
c[n][i],
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
l,
|
|
81
|
+
d,
|
|
82
|
+
v,
|
|
83
83
|
w
|
|
84
84
|
) === !1)
|
|
85
85
|
return !1;
|
|
86
|
-
|
|
86
|
+
l++;
|
|
87
87
|
}
|
|
88
|
-
E === "MultiLineString" &&
|
|
88
|
+
E === "MultiLineString" && v++, E === "Polygon" && w++;
|
|
89
89
|
}
|
|
90
|
-
E === "Polygon" &&
|
|
90
|
+
E === "Polygon" && v++;
|
|
91
91
|
break;
|
|
92
92
|
case "MultiPolygon":
|
|
93
93
|
for (n = 0; n < c.length; n++) {
|
|
@@ -95,22 +95,22 @@ function Ut(r, t, e) {
|
|
|
95
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
|
+
l,
|
|
99
|
+
d,
|
|
100
|
+
v,
|
|
101
101
|
w
|
|
102
102
|
) === !1)
|
|
103
103
|
return !1;
|
|
104
|
-
|
|
104
|
+
l++;
|
|
105
105
|
}
|
|
106
106
|
w++;
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
v++;
|
|
109
109
|
}
|
|
110
110
|
break;
|
|
111
111
|
case "GeometryCollection":
|
|
112
|
-
for (n = 0; n <
|
|
113
|
-
if (
|
|
112
|
+
for (n = 0; n < f.geometries.length; n++)
|
|
113
|
+
if (Yt(f.geometries[n], t) === !1)
|
|
114
114
|
return !1;
|
|
115
115
|
break;
|
|
116
116
|
default:
|
|
@@ -120,17 +120,17 @@ function Ut(r, t, e) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
var e, n, i, o,
|
|
125
|
-
for (e = 0; e <
|
|
126
|
-
for (
|
|
127
|
-
if (o = c ?
|
|
123
|
+
function vt(r, t) {
|
|
124
|
+
var e, n, i, o, f, s, c, u, p, l, h = 0, a = r.type === "FeatureCollection", y = r.type === "Feature", g = a ? r.features.length : 1;
|
|
125
|
+
for (e = 0; e < g; e++) {
|
|
126
|
+
for (s = a ? r.features[e].geometry : y ? r.geometry : r, u = a ? r.features[e].properties : y ? r.properties : {}, p = a ? r.features[e].bbox : y ? r.bbox : void 0, l = a ? r.features[e].id : y ? r.id : void 0, c = s ? s.type === "GeometryCollection" : !1, f = c ? s.geometries.length : 1, i = 0; i < f; i++) {
|
|
127
|
+
if (o = c ? s.geometries[i] : s, o === null) {
|
|
128
128
|
if (t(
|
|
129
129
|
null,
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
h,
|
|
131
|
+
u,
|
|
132
132
|
p,
|
|
133
|
-
|
|
133
|
+
l
|
|
134
134
|
) === !1)
|
|
135
135
|
return !1;
|
|
136
136
|
continue;
|
|
@@ -144,10 +144,10 @@ function mt(r, t) {
|
|
|
144
144
|
case "MultiPolygon": {
|
|
145
145
|
if (t(
|
|
146
146
|
o,
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
h,
|
|
148
|
+
u,
|
|
149
149
|
p,
|
|
150
|
-
|
|
150
|
+
l
|
|
151
151
|
) === !1)
|
|
152
152
|
return !1;
|
|
153
153
|
break;
|
|
@@ -156,10 +156,10 @@ function mt(r, t) {
|
|
|
156
156
|
for (n = 0; n < o.geometries.length; n++)
|
|
157
157
|
if (t(
|
|
158
158
|
o.geometries[n],
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
h,
|
|
160
|
+
u,
|
|
161
161
|
p,
|
|
162
|
-
|
|
162
|
+
l
|
|
163
163
|
) === !1)
|
|
164
164
|
return !1;
|
|
165
165
|
break;
|
|
@@ -168,25 +168,25 @@ function mt(r, t) {
|
|
|
168
168
|
throw new Error("Unknown Geometry Type");
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
h++;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
|
|
176
|
-
var
|
|
177
|
-
switch (
|
|
174
|
+
function se(r, t) {
|
|
175
|
+
vt(r, function(e, n, i, o, f) {
|
|
176
|
+
var s = e === null ? null : e.type;
|
|
177
|
+
switch (s) {
|
|
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: f }),
|
|
184
184
|
n,
|
|
185
185
|
0
|
|
186
186
|
) === !1 ? !1 : void 0;
|
|
187
187
|
}
|
|
188
188
|
var c;
|
|
189
|
-
switch (
|
|
189
|
+
switch (s) {
|
|
190
190
|
case "MultiPoint":
|
|
191
191
|
c = "Point";
|
|
192
192
|
break;
|
|
@@ -197,33 +197,33 @@ function oe(r, t) {
|
|
|
197
197
|
c = "Polygon";
|
|
198
198
|
break;
|
|
199
199
|
}
|
|
200
|
-
for (var
|
|
201
|
-
var p = e.coordinates[
|
|
200
|
+
for (var u = 0; u < e.coordinates.length; u++) {
|
|
201
|
+
var p = e.coordinates[u], l = {
|
|
202
202
|
type: c,
|
|
203
203
|
coordinates: p
|
|
204
204
|
};
|
|
205
|
-
if (t(V(
|
|
205
|
+
if (t(V(l, i), n, u) === !1)
|
|
206
206
|
return !1;
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function le(r, t = {}) {
|
|
211
211
|
if (r.bbox != null && t.recompute !== !0)
|
|
212
212
|
return r.bbox;
|
|
213
213
|
const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
|
|
214
|
-
return
|
|
214
|
+
return Yt(r, (n) => {
|
|
215
215
|
e[0] > n[0] && (e[0] = n[0]), e[1] > n[1] && (e[1] = n[1]), e[2] < n[0] && (e[2] = n[0]), e[3] < n[1] && (e[3] = n[1]);
|
|
216
216
|
}), e;
|
|
217
217
|
}
|
|
218
|
-
var ut =
|
|
219
|
-
function
|
|
218
|
+
var ut = le;
|
|
219
|
+
function ue(r) {
|
|
220
220
|
if (!r)
|
|
221
221
|
throw new Error("geojson is required");
|
|
222
222
|
switch (r.type) {
|
|
223
223
|
case "Feature":
|
|
224
|
-
return
|
|
224
|
+
return Dt(r);
|
|
225
225
|
case "FeatureCollection":
|
|
226
|
-
return
|
|
226
|
+
return fe(r);
|
|
227
227
|
case "Point":
|
|
228
228
|
case "LineString":
|
|
229
229
|
case "Polygon":
|
|
@@ -231,12 +231,12 @@ function le(r) {
|
|
|
231
231
|
case "MultiLineString":
|
|
232
232
|
case "MultiPolygon":
|
|
233
233
|
case "GeometryCollection":
|
|
234
|
-
return
|
|
234
|
+
return mt(r);
|
|
235
235
|
default:
|
|
236
236
|
throw new Error("unknown GeoJSON type");
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function Dt(r) {
|
|
240
240
|
const t = { type: "Feature" };
|
|
241
241
|
return Object.keys(r).forEach((e) => {
|
|
242
242
|
switch (e) {
|
|
@@ -247,16 +247,16 @@ function Yt(r) {
|
|
|
247
247
|
default:
|
|
248
248
|
t[e] = r[e];
|
|
249
249
|
}
|
|
250
|
-
}), t.properties =
|
|
250
|
+
}), t.properties = jt(r.properties), r.geometry == null ? t.geometry = null : t.geometry = mt(r.geometry), t;
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function jt(r) {
|
|
253
253
|
const t = {};
|
|
254
254
|
return r && Object.keys(r).forEach((e) => {
|
|
255
255
|
const n = r[e];
|
|
256
|
-
typeof n == "object" ? n === null ? t[e] = null : Array.isArray(n) ? t[e] = n.map((i) => i) : t[e] =
|
|
256
|
+
typeof n == "object" ? n === null ? t[e] = null : Array.isArray(n) ? t[e] = n.map((i) => i) : t[e] = jt(n) : t[e] = n;
|
|
257
257
|
}), t;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function fe(r) {
|
|
260
260
|
const t = { type: "FeatureCollection" };
|
|
261
261
|
return Object.keys(r).forEach((e) => {
|
|
262
262
|
switch (e) {
|
|
@@ -266,17 +266,17 @@ function ue(r) {
|
|
|
266
266
|
default:
|
|
267
267
|
t[e] = r[e];
|
|
268
268
|
}
|
|
269
|
-
}), t.features = r.features.map((e) =>
|
|
269
|
+
}), t.features = r.features.map((e) => Dt(e)), t;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function mt(r) {
|
|
272
272
|
const t = { type: r.type };
|
|
273
|
-
return r.bbox && (t.bbox = r.bbox), r.type === "GeometryCollection" ? (t.geometries = r.geometries.map((e) =>
|
|
273
|
+
return r.bbox && (t.bbox = r.bbox), r.type === "GeometryCollection" ? (t.geometries = r.geometries.map((e) => mt(e)), t) : (t.coordinates = Xt(r.coordinates), t);
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function Xt(r) {
|
|
276
276
|
const t = r;
|
|
277
|
-
return typeof t[0] != "object" ? t.slice() : t.map((e) =>
|
|
277
|
+
return typeof t[0] != "object" ? t.slice() : t.map((e) => Xt(e));
|
|
278
278
|
}
|
|
279
|
-
var
|
|
279
|
+
var ce = ue;
|
|
280
280
|
/**
|
|
281
281
|
* splaytree v3.1.2
|
|
282
282
|
* Fast Splay tree for Node and browser
|
|
@@ -299,67 +299,67 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
299
299
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
300
300
|
and limitations under the License.
|
|
301
301
|
***************************************************************************** */
|
|
302
|
-
function
|
|
302
|
+
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, f;
|
|
307
|
+
return f = { next: s(0), throw: s(1), return: s(2) }, typeof Symbol == "function" && (f[Symbol.iterator] = function() {
|
|
308
308
|
return this;
|
|
309
|
-
}),
|
|
310
|
-
function u
|
|
309
|
+
}), f;
|
|
310
|
+
function s(u) {
|
|
311
311
|
return function(p) {
|
|
312
|
-
return c([
|
|
312
|
+
return c([u, p]);
|
|
313
313
|
};
|
|
314
314
|
}
|
|
315
|
-
function c(
|
|
315
|
+
function c(u) {
|
|
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 = u[0] & 2 ? i.return : u[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, u[1])).done) return o;
|
|
319
|
+
switch (i = 0, o && (u = [u[0] & 2, o.value]), u[0]) {
|
|
320
320
|
case 0:
|
|
321
321
|
case 1:
|
|
322
|
-
o =
|
|
322
|
+
o = u;
|
|
323
323
|
break;
|
|
324
324
|
case 4:
|
|
325
|
-
return e.label++, { value:
|
|
325
|
+
return e.label++, { value: u[1], done: !1 };
|
|
326
326
|
case 5:
|
|
327
|
-
e.label++, i =
|
|
327
|
+
e.label++, i = u[1], u = [0];
|
|
328
328
|
continue;
|
|
329
329
|
case 7:
|
|
330
|
-
|
|
330
|
+
u = 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]) && (u[0] === 6 || u[0] === 2)) {
|
|
334
334
|
e = 0;
|
|
335
335
|
continue;
|
|
336
336
|
}
|
|
337
|
-
if (
|
|
338
|
-
e.label =
|
|
337
|
+
if (u[0] === 3 && (!o || u[1] > o[0] && u[1] < o[3])) {
|
|
338
|
+
e.label = u[1];
|
|
339
339
|
break;
|
|
340
340
|
}
|
|
341
|
-
if (
|
|
342
|
-
e.label = o[1], o =
|
|
341
|
+
if (u[0] === 6 && e.label < o[1]) {
|
|
342
|
+
e.label = o[1], o = u;
|
|
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(u);
|
|
347
347
|
break;
|
|
348
348
|
}
|
|
349
349
|
o[2] && e.ops.pop(), e.trys.pop();
|
|
350
350
|
continue;
|
|
351
351
|
}
|
|
352
|
-
|
|
352
|
+
u = t.call(r, e);
|
|
353
353
|
} catch (p) {
|
|
354
|
-
|
|
354
|
+
u = [6, p], i = 0;
|
|
355
355
|
} finally {
|
|
356
356
|
n = o = 0;
|
|
357
357
|
}
|
|
358
|
-
if (
|
|
359
|
-
return { value:
|
|
358
|
+
if (u[0] & 5) throw u[1];
|
|
359
|
+
return { value: u[0] ? u[1] : void 0, done: !0 };
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
var
|
|
362
|
+
var F = (
|
|
363
363
|
/** @class */
|
|
364
364
|
/* @__PURE__ */ function() {
|
|
365
365
|
function r(t, e) {
|
|
@@ -368,27 +368,27 @@ var T = (
|
|
|
368
368
|
return r;
|
|
369
369
|
}()
|
|
370
370
|
);
|
|
371
|
-
function
|
|
371
|
+
function ae(r, t) {
|
|
372
372
|
return r > t ? 1 : r < t ? -1 : 0;
|
|
373
373
|
}
|
|
374
374
|
function B(r, t, e) {
|
|
375
|
-
for (var n = new
|
|
376
|
-
var
|
|
377
|
-
if (
|
|
375
|
+
for (var n = new F(null, null), i = n, o = n; ; ) {
|
|
376
|
+
var f = e(r, t.key);
|
|
377
|
+
if (f < 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 s = t.left;
|
|
382
|
+
if (t.left = s.right, s.right = t, t = s, t.left === null)
|
|
383
383
|
break;
|
|
384
384
|
}
|
|
385
385
|
o.left = t, o = t, t = t.left;
|
|
386
|
-
} else if (
|
|
386
|
+
} else if (f > 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 s = t.right;
|
|
391
|
+
if (t.right = s.left, s.left = t, t = s, t.right === null)
|
|
392
392
|
break;
|
|
393
393
|
}
|
|
394
394
|
i.right = t, i = t, t = t.right;
|
|
@@ -398,7 +398,7 @@ function B(r, t, e) {
|
|
|
398
398
|
return i.right = t.left, o.left = t.right, t.left = n.right, t.right = n.left, t;
|
|
399
399
|
}
|
|
400
400
|
function ot(r, t, e, n) {
|
|
401
|
-
var i = new
|
|
401
|
+
var i = new F(r, t);
|
|
402
402
|
if (e === null)
|
|
403
403
|
return i.left = i.right = null, i;
|
|
404
404
|
e = B(r, e, n);
|
|
@@ -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) {
|
|
@@ -429,15 +429,15 @@ var wt = (
|
|
|
429
429
|
/** @class */
|
|
430
430
|
function() {
|
|
431
431
|
function r(t) {
|
|
432
|
-
t === void 0 && (t =
|
|
432
|
+
t === void 0 && (t = ae), this._root = null, this._size = 0, this._comparator = t;
|
|
433
433
|
}
|
|
434
434
|
return r.prototype.insert = function(t, e) {
|
|
435
435
|
return this._size++, this._root = ot(t, e, this._root, this._comparator);
|
|
436
436
|
}, r.prototype.add = function(t, e) {
|
|
437
|
-
var n = new
|
|
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), f = i(t, o.key);
|
|
440
|
+
return f === 0 ? this._root = o : (f < 0 ? (n.left = o.left, n.right = o, o.left = null) : f > 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 = [], f = this._comparator, s = this._root, c; o.length !== 0 || s; )
|
|
482
|
+
if (s)
|
|
483
|
+
o.push(s), s = s.left;
|
|
484
484
|
else {
|
|
485
|
-
if (
|
|
485
|
+
if (s = o.pop(), c = f(s.key, e), c > 0)
|
|
486
486
|
break;
|
|
487
|
-
if (
|
|
487
|
+
if (f(s.key, t) >= 0 && n.call(i, s))
|
|
488
488
|
return this;
|
|
489
|
-
|
|
489
|
+
s = s.right;
|
|
490
490
|
}
|
|
491
491
|
return this;
|
|
492
492
|
}, r.prototype.keys = function() {
|
|
@@ -557,15 +557,15 @@ var wt = (
|
|
|
557
557
|
}, r.prototype.clear = function() {
|
|
558
558
|
return this._root = null, this._size = 0, this;
|
|
559
559
|
}, r.prototype.toList = function() {
|
|
560
|
-
return
|
|
560
|
+
return ye(this._root);
|
|
561
561
|
}, r.prototype.load = function(t, e, n) {
|
|
562
562
|
e === void 0 && (e = []), n === void 0 && (n = !1);
|
|
563
563
|
var i = t.length, o = this._comparator;
|
|
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 f = de(this.toList(), ge(t, e), o);
|
|
568
|
+
i = this._size + i, this._root = ht({ head: f }, 0, i);
|
|
569
569
|
}
|
|
570
570
|
return this;
|
|
571
571
|
}, r.prototype.isEmpty = function() {
|
|
@@ -591,13 +591,13 @@ 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), f = o.left, s = o.right;
|
|
595
|
+
i(t, e) < 0 ? s = ot(e, n, s, i) : f = ot(e, n, f, i), this._root = pe(f, s, i);
|
|
596
596
|
}, r.prototype.split = function(t) {
|
|
597
597
|
return bt(t, this._root, this._comparator);
|
|
598
598
|
}, r.prototype[Symbol.iterator] = function() {
|
|
599
599
|
var t, e, n;
|
|
600
|
-
return
|
|
600
|
+
return he(this, function(i) {
|
|
601
601
|
switch (i.label) {
|
|
602
602
|
case 0:
|
|
603
603
|
t = this._root, e = [], n = !1, i.label = 1;
|
|
@@ -624,66 +624,66 @@ 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), f = r[o], s = t[o], c = new F(f, s);
|
|
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
|
|
633
|
-
for (var e = new
|
|
634
|
-
n = n.next = new
|
|
632
|
+
function ge(r, t) {
|
|
633
|
+
for (var e = new F(null, null), n = e, i = 0; i < r.length; i++)
|
|
634
|
+
n = n.next = new F(r[i], t[i]);
|
|
635
635
|
return n.next = null, e.next;
|
|
636
636
|
}
|
|
637
|
-
function
|
|
638
|
-
for (var t = r, e = [], n = !1, i = new
|
|
637
|
+
function ye(r) {
|
|
638
|
+
for (var t = r, e = [], n = !1, i = new F(null, null), o = i; !n; )
|
|
639
639
|
t ? (e.push(t), t = t.left) : e.length > 0 ? (t = o = o.next = e.pop(), t = t.right) : n = !0;
|
|
640
640
|
return o.next = null, i.next;
|
|
641
641
|
}
|
|
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), f = r.head;
|
|
646
|
+
return f.left = o, r.head = r.head.next, f.right = ht(r, i + 1, e), f;
|
|
647
647
|
}
|
|
648
648
|
return null;
|
|
649
649
|
}
|
|
650
|
-
function
|
|
651
|
-
for (var n = new
|
|
652
|
-
e(o.key,
|
|
653
|
-
return o !== null ? i.next = o :
|
|
650
|
+
function de(r, t, e) {
|
|
651
|
+
for (var n = new F(null, null), i = n, o = r, f = t; o !== null && f !== null; )
|
|
652
|
+
e(o.key, f.key) < 0 ? (i.next = o, o = o.next) : (i.next = f, f = f.next), i = i.next;
|
|
653
|
+
return o !== null ? i.next = o : f !== null && (i.next = f), 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], f = e - 1, s = n + 1; ; ) {
|
|
658
658
|
do
|
|
659
|
-
|
|
660
|
-
while (i(r[
|
|
659
|
+
f++;
|
|
660
|
+
while (i(r[f], o) < 0);
|
|
661
661
|
do
|
|
662
|
-
|
|
663
|
-
while (i(r[
|
|
664
|
-
if (
|
|
662
|
+
s--;
|
|
663
|
+
while (i(r[s], o) > 0);
|
|
664
|
+
if (f >= s)
|
|
665
665
|
break;
|
|
666
|
-
var c = r[
|
|
667
|
-
r[
|
|
666
|
+
var c = r[f];
|
|
667
|
+
r[f] = r[s], r[s] = c, c = t[f], t[f] = t[s], t[s] = c;
|
|
668
668
|
}
|
|
669
|
-
at(r, t, e,
|
|
669
|
+
at(r, t, e, s, i), at(r, t, s + 1, n, i);
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
const O = 11102230246251565e-32, S = 134217729,
|
|
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
|
-
p >
|
|
676
|
-
let
|
|
677
|
-
if (
|
|
678
|
-
for (p >
|
|
679
|
-
p >
|
|
680
|
-
for (;
|
|
681
|
-
|
|
682
|
-
for (;
|
|
683
|
-
|
|
684
|
-
return (o !== 0 ||
|
|
685
|
-
}
|
|
686
|
-
function
|
|
674
|
+
let o, f, s, c, u = t[0], p = n[0], l = 0, h = 0;
|
|
675
|
+
p > u == p > -u ? (o = u, u = t[++l]) : (o = p, p = n[++h]);
|
|
676
|
+
let a = 0;
|
|
677
|
+
if (l < r && h < e)
|
|
678
|
+
for (p > u == p > -u ? (f = u + o, s = o - (f - u), u = t[++l]) : (f = p + o, s = o - (f - p), p = n[++h]), o = f, s !== 0 && (i[a++] = s); l < r && h < e; )
|
|
679
|
+
p > u == p > -u ? (f = o + u, c = f - o, s = o - (f - c) + (u - c), u = t[++l]) : (f = o + p, c = f - o, s = o - (f - c) + (p - c), p = n[++h]), o = f, s !== 0 && (i[a++] = s);
|
|
680
|
+
for (; l < r; )
|
|
681
|
+
f = o + u, c = f - o, s = o - (f - c) + (u - c), u = t[++l], o = f, s !== 0 && (i[a++] = s);
|
|
682
|
+
for (; h < e; )
|
|
683
|
+
f = o + p, c = f - o, s = o - (f - c) + (p - c), p = n[++h], o = f, s !== 0 && (i[a++] = s);
|
|
684
|
+
return (o !== 0 || a === 0) && (i[a++] = o), a;
|
|
685
|
+
}
|
|
686
|
+
function ve(r, t) {
|
|
687
687
|
let e = t[0];
|
|
688
688
|
for (let n = 1; n < r; n++) e += t[n];
|
|
689
689
|
return e;
|
|
@@ -691,24 +691,24 @@ function xe(r, t) {
|
|
|
691
691
|
function K(r) {
|
|
692
692
|
return new Float64Array(r);
|
|
693
693
|
}
|
|
694
|
-
const me = (3 + 16 * O) * O,
|
|
695
|
-
function
|
|
696
|
-
let
|
|
697
|
-
const C = r - i, R = e - i,
|
|
698
|
-
w = C *
|
|
699
|
-
let A =
|
|
700
|
-
if (A >= D || -A >= D || (
|
|
701
|
-
w =
|
|
702
|
-
const
|
|
703
|
-
w = C * p,
|
|
704
|
-
const
|
|
705
|
-
w =
|
|
706
|
-
const
|
|
707
|
-
return Pt[
|
|
708
|
-
}
|
|
709
|
-
function
|
|
710
|
-
const
|
|
711
|
-
return Math.abs(c) >= me *
|
|
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, f) {
|
|
696
|
+
let s, c, u, p, l, h, a, y, g, x, d, m, v, w, E, b, M, _;
|
|
697
|
+
const C = r - i, R = e - i, I = t - o, $ = n - o;
|
|
698
|
+
w = C * $, h = S * C, a = h - (h - C), y = C - a, h = S * $, g = h - (h - $), x = $ - g, E = y * x - (w - a * g - y * g - a * x), b = I * R, h = S * I, a = h - (h - I), y = I - a, h = S * R, g = h - (h - R), x = R - g, M = y * x - (b - a * g - y * g - a * x), d = E - M, l = E - d, q[0] = E - (d + l) + (l - M), m = w + d, l = m - w, v = w - (m - l) + (d - l), d = v - b, l = v - d, q[1] = v - (d + l) + (l - b), _ = m + d, l = _ - m, q[2] = m - (_ - l) + (d - l), q[3] = _;
|
|
699
|
+
let A = ve(4, q), D = we * f;
|
|
700
|
+
if (A >= D || -A >= D || (l = r - C, s = r - (C + l) + (l - i), l = e - R, u = e - (R + l) + (l - i), l = t - I, c = t - (I + l) + (l - o), l = n - $, p = n - ($ + l) + (l - o), s === 0 && c === 0 && u === 0 && p === 0) || (D = Ee * f + xe * Math.abs(A), A += C * p + $ * s - (I * u + R * c), A >= D || -A >= D)) return A;
|
|
701
|
+
w = s * $, h = S * s, a = h - (h - s), y = s - a, h = S * $, g = h - (h - $), x = $ - g, E = y * x - (w - a * g - y * g - a * x), b = c * R, h = S * c, a = h - (h - c), y = c - a, h = S * R, g = h - (h - R), x = R - g, M = y * x - (b - a * g - y * g - a * x), d = E - M, l = E - d, P[0] = E - (d + l) + (l - M), m = w + d, l = m - w, v = w - (m - l) + (d - l), d = v - b, l = v - d, P[1] = v - (d + l) + (l - b), _ = m + d, l = _ - m, P[2] = m - (_ - l) + (d - l), P[3] = _;
|
|
702
|
+
const ee = st(4, q, 4, P, _t);
|
|
703
|
+
w = C * p, h = S * C, a = h - (h - C), y = C - a, h = S * p, g = h - (h - p), x = p - g, E = y * x - (w - a * g - y * g - a * x), b = I * u, h = S * I, a = h - (h - I), y = I - a, h = S * u, g = h - (h - u), x = u - g, M = y * x - (b - a * g - y * g - a * x), d = E - M, l = E - d, P[0] = E - (d + l) + (l - M), m = w + d, l = m - w, v = w - (m - l) + (d - l), d = v - b, l = v - d, P[1] = v - (d + l) + (l - b), _ = m + d, l = _ - m, P[2] = m - (_ - l) + (d - l), P[3] = _;
|
|
704
|
+
const ne = st(ee, _t, 4, P, St);
|
|
705
|
+
w = s * p, h = S * s, a = h - (h - s), y = s - a, h = S * p, g = h - (h - p), x = p - g, E = y * x - (w - a * g - y * g - a * x), b = c * u, h = S * c, a = h - (h - c), y = c - a, h = S * u, g = h - (h - u), x = u - g, M = y * x - (b - a * g - y * g - a * x), d = E - M, l = E - d, P[0] = E - (d + l) + (l - M), m = w + d, l = m - w, v = w - (m - l) + (d - l), d = v - b, l = v - d, P[1] = v - (d + l) + (l - b), _ = m + d, l = _ - m, P[2] = m - (_ - l) + (d - l), P[3] = _;
|
|
706
|
+
const re = st(ne, St, 4, P, Pt);
|
|
707
|
+
return Pt[re - 1];
|
|
708
|
+
}
|
|
709
|
+
function _e(r, t, e, n, i, o) {
|
|
710
|
+
const f = (t - o) * (e - i), s = (r - i) * (n - o), c = f - s, u = Math.abs(f + s);
|
|
711
|
+
return Math.abs(c) >= me * u ? c : -be(r, t, e, n, i, o, u);
|
|
712
712
|
}
|
|
713
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;
|
|
@@ -726,13 +726,13 @@ const j = (r, t) => r.ll.x <= t.x && t.x <= r.ur.x && r.ll.y <= t.y && t.y <= r.
|
|
|
726
726
|
};
|
|
727
727
|
let G = Number.EPSILON;
|
|
728
728
|
G === void 0 && (G = Math.pow(2, -52));
|
|
729
|
-
const
|
|
729
|
+
const Se = G * G, Mt = (r, t) => {
|
|
730
730
|
if (-G < r && r < G && -G < t && t < G)
|
|
731
731
|
return 0;
|
|
732
732
|
const e = r - t;
|
|
733
|
-
return e * e <
|
|
733
|
+
return e * e < Se * r * t ? 0 : r < t ? -1 : 1;
|
|
734
734
|
};
|
|
735
|
-
class
|
|
735
|
+
class Pe {
|
|
736
736
|
constructor() {
|
|
737
737
|
this.reset();
|
|
738
738
|
}
|
|
@@ -765,10 +765,10 @@ class Lt {
|
|
|
765
765
|
return i !== null && Mt(e.key, i.key) === 0 ? (this.tree.remove(t), i.key) : t;
|
|
766
766
|
}
|
|
767
767
|
}
|
|
768
|
-
const J = new
|
|
769
|
-
const n =
|
|
768
|
+
const J = new Pe(), tt = (r, t) => r.x * t.y - r.y * t.x, Vt = (r, t) => r.x * t.x + r.y * t.y, Ct = (r, t, e) => {
|
|
769
|
+
const n = _e(r.x, r.y, t.x, t.y, e.x, e.y);
|
|
770
770
|
return n > 0 ? -1 : n < 0 ? 1 : 0;
|
|
771
|
-
}, et = (r) => Math.sqrt(
|
|
771
|
+
}, et = (r) => Math.sqrt(Vt(r, r)), Me = (r, t, e) => {
|
|
772
772
|
const n = {
|
|
773
773
|
x: t.x - r.x,
|
|
774
774
|
y: t.y - r.y
|
|
@@ -777,7 +777,7 @@ const J = new Se(), tt = (r, t) => r.x * t.y - r.y * t.x, Xt = (r, t) => r.x * t
|
|
|
777
777
|
y: e.y - r.y
|
|
778
778
|
};
|
|
779
779
|
return tt(i, n) / et(i) / et(n);
|
|
780
|
-
},
|
|
780
|
+
}, Le = (r, t, e) => {
|
|
781
781
|
const n = {
|
|
782
782
|
x: t.x - r.x,
|
|
783
783
|
y: t.y - r.y
|
|
@@ -785,16 +785,16 @@ const J = new Se(), tt = (r, t) => r.x * t.y - r.y * t.x, Xt = (r, t) => r.x * t
|
|
|
785
785
|
x: e.x - r.x,
|
|
786
786
|
y: e.y - r.y
|
|
787
787
|
};
|
|
788
|
-
return
|
|
788
|
+
return Vt(i, n) / et(i) / et(n);
|
|
789
789
|
}, Rt = (r, t, e) => t.y === 0 ? null : {
|
|
790
790
|
x: r.x + t.x / t.y * (e - r.y),
|
|
791
791
|
y: e
|
|
792
|
-
},
|
|
792
|
+
}, It = (r, t, e) => t.x === 0 ? null : {
|
|
793
793
|
x: e,
|
|
794
794
|
y: r.y + t.y / t.x * (e - r.x)
|
|
795
|
-
},
|
|
796
|
-
if (t.x === 0) return
|
|
797
|
-
if (n.x === 0) return
|
|
795
|
+
}, Ce = (r, t, e, n) => {
|
|
796
|
+
if (t.x === 0) return It(e, n, r.x);
|
|
797
|
+
if (n.x === 0) return It(r, t, e.x);
|
|
798
798
|
if (t.y === 0) return Rt(e, n, r.y);
|
|
799
799
|
if (n.y === 0) return Rt(r, t, e.y);
|
|
800
800
|
const i = tt(t, n);
|
|
@@ -802,10 +802,10 @@ const J = new Se(), tt = (r, t) => r.x * t.y - r.y * t.x, Xt = (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
|
+
}, f = tt(o, t) / i, s = tt(o, n) / i, c = r.x + s * t.x, u = e.x + f * n.x, p = r.y + s * t.y, l = e.y + f * n.y, h = (c + u) / 2, a = (p + l) / 2;
|
|
806
806
|
return {
|
|
807
|
-
x:
|
|
808
|
-
y:
|
|
807
|
+
x: h,
|
|
808
|
+
y: a
|
|
809
809
|
};
|
|
810
810
|
};
|
|
811
811
|
class L {
|
|
@@ -867,24 +867,24 @@ class L {
|
|
|
867
867
|
const e = /* @__PURE__ */ new Map(), n = (i) => {
|
|
868
868
|
const o = i.otherSE;
|
|
869
869
|
e.set(i, {
|
|
870
|
-
sine:
|
|
871
|
-
cosine:
|
|
870
|
+
sine: Me(this.point, t.point, o.point),
|
|
871
|
+
cosine: Le(this.point, t.point, o.point)
|
|
872
872
|
});
|
|
873
873
|
};
|
|
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: f,
|
|
878
|
+
cosine: s
|
|
879
879
|
} = e.get(i), {
|
|
880
880
|
sine: c,
|
|
881
|
-
cosine:
|
|
881
|
+
cosine: u
|
|
882
882
|
} = e.get(o);
|
|
883
|
-
return
|
|
883
|
+
return f >= 0 && c >= 0 ? s < u ? 1 : s > u ? -1 : 0 : f < 0 && c < 0 ? s < u ? -1 : s > u ? 1 : 0 : c < f ? -1 : c > f ? 1 : 0;
|
|
884
884
|
};
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
|
-
let
|
|
887
|
+
let Re = 0;
|
|
888
888
|
class z {
|
|
889
889
|
/* This compare() function is for ordering segments in the sweep
|
|
890
890
|
* line tree, and does so according to the following criteria:
|
|
@@ -900,60 +900,60 @@ 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, f = e.rightSE.point.x;
|
|
904
|
+
if (f < n) return 1;
|
|
905
905
|
if (o < i) return -1;
|
|
906
|
-
const
|
|
906
|
+
const s = t.leftSE.point.y, c = e.leftSE.point.y, u = 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 < s && c < u) return 1;
|
|
909
|
+
if (c > s && c > u) return -1;
|
|
910
|
+
const l = t.comparePoint(e.leftSE.point);
|
|
911
|
+
if (l < 0) return 1;
|
|
912
|
+
if (l > 0) return -1;
|
|
913
|
+
const h = e.comparePoint(t.rightSE.point);
|
|
914
|
+
return h !== 0 ? h : -1;
|
|
915
915
|
}
|
|
916
916
|
if (n > i) {
|
|
917
|
-
if (
|
|
918
|
-
if (
|
|
919
|
-
const
|
|
920
|
-
if (
|
|
921
|
-
const
|
|
922
|
-
return
|
|
917
|
+
if (s < c && s < p) return -1;
|
|
918
|
+
if (s > c && s > p) return 1;
|
|
919
|
+
const l = e.comparePoint(t.leftSE.point);
|
|
920
|
+
if (l !== 0) return l;
|
|
921
|
+
const h = t.comparePoint(e.rightSE.point);
|
|
922
|
+
return h < 0 ? 1 : h > 0 ? -1 : 1;
|
|
923
923
|
}
|
|
924
|
-
if (
|
|
925
|
-
if (
|
|
926
|
-
if (o <
|
|
927
|
-
const
|
|
928
|
-
if (
|
|
924
|
+
if (s < c) return -1;
|
|
925
|
+
if (s > c) return 1;
|
|
926
|
+
if (o < f) {
|
|
927
|
+
const l = e.comparePoint(t.rightSE.point);
|
|
928
|
+
if (l !== 0) return l;
|
|
929
929
|
}
|
|
930
|
-
if (o >
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
if (
|
|
930
|
+
if (o > f) {
|
|
931
|
+
const l = t.comparePoint(e.rightSE.point);
|
|
932
|
+
if (l < 0) return 1;
|
|
933
|
+
if (l > 0) return -1;
|
|
934
934
|
}
|
|
935
|
-
if (o !==
|
|
936
|
-
const
|
|
937
|
-
if (
|
|
938
|
-
if (
|
|
935
|
+
if (o !== f) {
|
|
936
|
+
const l = u - s, h = o - n, a = p - c, y = f - i;
|
|
937
|
+
if (l > h && a < y) return 1;
|
|
938
|
+
if (l < h && a > y) return -1;
|
|
939
939
|
}
|
|
940
|
-
return o >
|
|
940
|
+
return o > f ? 1 : o < f || u < p ? -1 : u > 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 */
|
|
944
944
|
constructor(t, e, n, i) {
|
|
945
|
-
this.id = ++
|
|
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, f;
|
|
949
|
+
const s = L.comparePoints(t, e);
|
|
950
|
+
if (s < 0)
|
|
951
|
+
i = t, o = e, f = 1;
|
|
952
|
+
else if (s > 0)
|
|
953
|
+
i = e, o = t, f = -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), u = new L(o, !1);
|
|
956
|
+
return new z(c, u, [n], [f]);
|
|
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, f = e.x + o * i.x;
|
|
1004
|
+
if (t.x === f) return 0;
|
|
1005
|
+
const s = (t.x - e.x) / i.x, c = e.y + s * i.y;
|
|
1006
1006
|
return t.y === c ? 0 : t.y < c ? -1 : 1;
|
|
1007
1007
|
}
|
|
1008
1008
|
/**
|
|
@@ -1023,18 +1023,18 @@ class z {
|
|
|
1023
1023
|
getIntersection(t) {
|
|
1024
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 (p &&
|
|
1028
|
-
return
|
|
1026
|
+
const o = this.leftSE.point, f = this.rightSE.point, s = t.leftSE.point, c = t.rightSE.point, u = j(e, s) && this.comparePoint(s) === 0, p = j(n, o) && t.comparePoint(o) === 0, l = j(e, c) && this.comparePoint(c) === 0, h = j(n, f) && t.comparePoint(f) === 0;
|
|
1027
|
+
if (p && u)
|
|
1028
|
+
return h && !l ? f : !h && l ? c : null;
|
|
1029
1029
|
if (p)
|
|
1030
|
-
return
|
|
1031
|
-
if (
|
|
1032
|
-
return
|
|
1033
|
-
if (
|
|
1034
|
-
if (
|
|
1035
|
-
if (
|
|
1036
|
-
const
|
|
1037
|
-
return
|
|
1030
|
+
return l && o.x === c.x && o.y === c.y ? null : o;
|
|
1031
|
+
if (u)
|
|
1032
|
+
return h && f.x === s.x && f.y === s.y ? null : s;
|
|
1033
|
+
if (h && l) return null;
|
|
1034
|
+
if (h) return f;
|
|
1035
|
+
if (l) return c;
|
|
1036
|
+
const a = Ce(o, this.vector(), s, t.vector());
|
|
1037
|
+
return a === null || !j(i, a) ? null : J.round(a.x, a.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), f = this.rightSE;
|
|
1053
1053
|
this.replaceRightSE(o), e.push(o), e.push(i);
|
|
1054
|
-
const
|
|
1055
|
-
return L.comparePoints(
|
|
1054
|
+
const s = new z(i, f, this.rings.slice(), this.windings.slice());
|
|
1055
|
+
return L.comparePoints(s.leftSE.point, s.rightSE.point) > 0 && s.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, f = n.rings.length; o < f; o++) {
|
|
1081
|
+
const s = n.rings[o], c = n.windings[o], u = e.rings.indexOf(s);
|
|
1082
|
+
u === -1 ? (e.rings.push(s), e.windings.push(c)) : e.windings[u] += 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 s = 0, c = this.rings.length; s < c; s++) {
|
|
1114
|
+
const u = this.rings[s], p = this.windings[s], l = e.indexOf(u);
|
|
1115
|
+
l === -1 ? (e.push(u), n.push(p)) : n[l] += p;
|
|
1116
1116
|
}
|
|
1117
|
-
const o = [],
|
|
1118
|
-
for (let
|
|
1119
|
-
if (n[
|
|
1120
|
-
const
|
|
1121
|
-
if (
|
|
1122
|
-
if (
|
|
1117
|
+
const o = [], f = [];
|
|
1118
|
+
for (let s = 0, c = e.length; s < c; s++) {
|
|
1119
|
+
if (n[s] === 0) continue;
|
|
1120
|
+
const u = e[s], p = u.poly;
|
|
1121
|
+
if (f.indexOf(p) === -1)
|
|
1122
|
+
if (u.isExterior) o.push(p);
|
|
1123
1123
|
else {
|
|
1124
|
-
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1124
|
+
f.indexOf(p) === -1 && f.push(p);
|
|
1125
|
+
const l = o.indexOf(u.poly);
|
|
1126
|
+
l !== -1 && o.splice(l, 1);
|
|
1127
1127
|
}
|
|
1128
1128
|
}
|
|
1129
|
-
for (let
|
|
1130
|
-
const
|
|
1131
|
-
i.indexOf(
|
|
1129
|
+
for (let s = 0, c = o.length; s < c; s++) {
|
|
1130
|
+
const u = o[s].multiPoly;
|
|
1131
|
+
i.indexOf(u) === -1 && i.push(u);
|
|
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 It {
|
|
|
1182
1182
|
}
|
|
1183
1183
|
};
|
|
1184
1184
|
let o = i;
|
|
1185
|
-
for (let
|
|
1186
|
-
if (typeof t[
|
|
1185
|
+
for (let f = 1, s = t.length; f < s; f++) {
|
|
1186
|
+
if (typeof t[f][0] != "number" || typeof t[f][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[f][0], t[f][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));
|
|
@@ -1199,11 +1199,11 @@ class It {
|
|
|
1199
1199
|
return t;
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
|
-
class
|
|
1202
|
+
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 Re {
|
|
|
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 Re {
|
|
|
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, f = i.length; o < f; 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");
|
|
@@ -1248,7 +1248,7 @@ class $t {
|
|
|
1248
1248
|
}
|
|
1249
1249
|
};
|
|
1250
1250
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
1251
|
-
const o = new
|
|
1251
|
+
const o = new Ie(t[n], this);
|
|
1252
1252
|
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.polys.push(o);
|
|
1253
1253
|
}
|
|
1254
1254
|
this.isSubject = e;
|
|
@@ -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, f = i.length; o < f; 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 f = null, s = o.leftSE, c = o.rightSE;
|
|
1275
|
+
const u = [s], p = s.point, l = [];
|
|
1276
|
+
for (; f = s, s = c, u.push(s), s.point !== p; )
|
|
1277
1277
|
for (; ; ) {
|
|
1278
|
-
const
|
|
1279
|
-
if (
|
|
1280
|
-
const
|
|
1281
|
-
throw new Error(`Unable to complete output ring starting at [${
|
|
1278
|
+
const h = s.getAvailableLinkedEvents();
|
|
1279
|
+
if (h.length === 0) {
|
|
1280
|
+
const g = u[0].point, x = u[u.length - 1].point;
|
|
1281
|
+
throw new Error(`Unable to complete output ring starting at [${g.x}, ${g.y}]. Last matching segment found ends at [${x.x}, ${x.y}].`);
|
|
1282
1282
|
}
|
|
1283
|
-
if (
|
|
1284
|
-
c =
|
|
1283
|
+
if (h.length === 1) {
|
|
1284
|
+
c = h[0].otherSE;
|
|
1285
1285
|
break;
|
|
1286
1286
|
}
|
|
1287
|
-
let
|
|
1288
|
-
for (let
|
|
1289
|
-
if (
|
|
1290
|
-
|
|
1287
|
+
let a = null;
|
|
1288
|
+
for (let g = 0, x = l.length; g < x; g++)
|
|
1289
|
+
if (l[g].point === s.point) {
|
|
1290
|
+
a = g;
|
|
1291
1291
|
break;
|
|
1292
1292
|
}
|
|
1293
|
-
if (
|
|
1294
|
-
const
|
|
1295
|
-
|
|
1293
|
+
if (a !== null) {
|
|
1294
|
+
const g = l.splice(a)[0], x = u.splice(g.index);
|
|
1295
|
+
x.unshift(x[0].otherSE), e.push(new nt(x.reverse()));
|
|
1296
1296
|
continue;
|
|
1297
1297
|
}
|
|
1298
|
-
|
|
1299
|
-
index:
|
|
1300
|
-
point:
|
|
1298
|
+
l.push({
|
|
1299
|
+
index: u.length,
|
|
1300
|
+
point: s.point
|
|
1301
1301
|
});
|
|
1302
|
-
const
|
|
1303
|
-
c =
|
|
1302
|
+
const y = s.getLeftmostComparator(f);
|
|
1303
|
+
c = h.sort(y)[0].otherSE;
|
|
1304
1304
|
break;
|
|
1305
1305
|
}
|
|
1306
|
-
e.push(new nt(
|
|
1306
|
+
e.push(new nt(u));
|
|
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 u = 1, p = this.events.length - 1; u < p; u++) {
|
|
1320
|
+
const l = this.events[u].point, h = this.events[u + 1].point;
|
|
1321
|
+
Ct(l, t, h) !== 0 && (e.push(l), t = l);
|
|
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, f = this.isExteriorRing() ? 0 : e.length - 1, s = this.isExteriorRing() ? e.length : -1, c = [];
|
|
1327
|
+
for (let u = f; u != s; u += o) c.push([e[u].x, e[u].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 f = this.events[i];
|
|
1345
|
+
L.compare(t, f) > 0 && (t = f);
|
|
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 f = o.enclosingRing();
|
|
1394
|
+
f.poly || e.push(new At(f)), f.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 Ie {
|
|
|
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, f = i, s, c;
|
|
1412
|
+
for (; s === void 0; )
|
|
1413
|
+
o = this.tree.prev(o), o === null ? s = null : o.key.consumedBy === void 0 && (s = o.key);
|
|
1414
1414
|
for (; c === void 0; )
|
|
1415
|
-
|
|
1415
|
+
f = this.tree.next(f), f === null ? c = null : f.key.consumedBy === void 0 && (c = f.key);
|
|
1416
1416
|
if (t.isLeft) {
|
|
1417
|
-
let
|
|
1418
|
-
if (
|
|
1419
|
-
const
|
|
1420
|
-
if (
|
|
1421
|
-
const
|
|
1422
|
-
for (let
|
|
1423
|
-
n.push(a
|
|
1417
|
+
let u = null;
|
|
1418
|
+
if (s) {
|
|
1419
|
+
const l = s.getIntersection(e);
|
|
1420
|
+
if (l !== null && (e.isAnEndpoint(l) || (u = l), !s.isAnEndpoint(l))) {
|
|
1421
|
+
const h = this._splitSafely(s, l);
|
|
1422
|
+
for (let a = 0, y = h.length; a < y; a++)
|
|
1423
|
+
n.push(h[a]);
|
|
1424
1424
|
}
|
|
1425
1425
|
}
|
|
1426
1426
|
let p = null;
|
|
1427
1427
|
if (c) {
|
|
1428
|
-
const
|
|
1429
|
-
if (
|
|
1430
|
-
const
|
|
1431
|
-
for (let
|
|
1432
|
-
n.push(a
|
|
1428
|
+
const l = c.getIntersection(e);
|
|
1429
|
+
if (l !== null && (e.isAnEndpoint(l) || (p = l), !c.isAnEndpoint(l))) {
|
|
1430
|
+
const h = this._splitSafely(c, l);
|
|
1431
|
+
for (let a = 0, y = h.length; a < y; a++)
|
|
1432
|
+
n.push(h[a]);
|
|
1433
1433
|
}
|
|
1434
1434
|
}
|
|
1435
|
-
if (
|
|
1436
|
-
let
|
|
1437
|
-
|
|
1438
|
-
const
|
|
1439
|
-
for (let
|
|
1440
|
-
n.push(a
|
|
1435
|
+
if (u !== null || p !== null) {
|
|
1436
|
+
let l = null;
|
|
1437
|
+
u === null ? l = p : p === null ? l = u : l = L.comparePoints(u, p) <= 0 ? u : p, this.queue.remove(e.rightSE), n.push(e.rightSE);
|
|
1438
|
+
const h = e.split(l);
|
|
1439
|
+
for (let a = 0, y = h.length; a < y; a++)
|
|
1440
|
+
n.push(h[a]);
|
|
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 = s);
|
|
1443
1443
|
} else {
|
|
1444
|
-
if (
|
|
1445
|
-
const
|
|
1446
|
-
if (
|
|
1447
|
-
if (!
|
|
1448
|
-
const p = this._splitSafely(
|
|
1449
|
-
for (let
|
|
1450
|
-
n.push(p[
|
|
1444
|
+
if (s && c) {
|
|
1445
|
+
const u = s.getIntersection(c);
|
|
1446
|
+
if (u !== null) {
|
|
1447
|
+
if (!s.isAnEndpoint(u)) {
|
|
1448
|
+
const p = this._splitSafely(s, u);
|
|
1449
|
+
for (let l = 0, h = p.length; l < h; l++)
|
|
1450
|
+
n.push(p[l]);
|
|
1451
1451
|
}
|
|
1452
|
-
if (!c.isAnEndpoint(
|
|
1453
|
-
const p = this._splitSafely(c,
|
|
1454
|
-
for (let
|
|
1455
|
-
n.push(p[
|
|
1452
|
+
if (!c.isAnEndpoint(u)) {
|
|
1453
|
+
const p = this._splitSafely(c, u);
|
|
1454
|
+
for (let l = 0, h = p.length; l < h; l++)
|
|
1455
|
+
n.push(p[l]);
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
@@ -1470,120 +1470,120 @@ class Ie {
|
|
|
1470
1470
|
return i.push(n), t.consumedBy === void 0 && this.tree.add(t), i;
|
|
1471
1471
|
}
|
|
1472
1472
|
}
|
|
1473
|
-
const Ot = typeof process < "u" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6,
|
|
1474
|
-
class
|
|
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
|
+
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
|
-
pt(i[
|
|
1476
|
+
k.type = t, J.reset();
|
|
1477
|
+
const i = [new kt(e, !0)];
|
|
1478
|
+
for (let l = 0, h = n.length; l < h; l++)
|
|
1479
|
+
i.push(new kt(n[l], !1));
|
|
1480
|
+
if (k.numMultiPolys = i.length, k.type === "difference") {
|
|
1481
|
+
const l = i[0];
|
|
1482
|
+
let h = 1;
|
|
1483
|
+
for (; h < i.length; )
|
|
1484
|
+
pt(i[h].bbox, l.bbox) !== null ? h++ : i.splice(h, 1);
|
|
1485
1485
|
}
|
|
1486
|
-
if (
|
|
1487
|
-
for (let
|
|
1488
|
-
const
|
|
1489
|
-
for (let
|
|
1490
|
-
if (pt(
|
|
1486
|
+
if (k.type === "intersection")
|
|
1487
|
+
for (let l = 0, h = i.length; l < h; l++) {
|
|
1488
|
+
const a = i[l];
|
|
1489
|
+
for (let y = l + 1, g = i.length; y < g; y++)
|
|
1490
|
+
if (pt(a.bbox, i[y].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 l = 0, h = i.length; l < h; l++) {
|
|
1494
|
+
const a = i[l].getSweepEvents();
|
|
1495
|
+
for (let y = 0, g = a.length; y < g; y++)
|
|
1496
|
+
if (o.insert(a[y]), 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 f = new ke(o);
|
|
1500
|
+
let s = 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 l = c.key;
|
|
1503
|
+
if (o.size === s) {
|
|
1504
|
+
const a = l.segment;
|
|
1505
|
+
throw new Error(`Unable to pop() ${l.isLeft ? "left" : "right"} SweepEvent [${l.point.x}, ${l.point.y}] from segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.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 (f.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 h = f.process(l);
|
|
1512
|
+
for (let a = 0, y = h.length; a < y; a++) {
|
|
1513
|
+
const g = h[a];
|
|
1514
|
+
g.consumedBy === void 0 && o.insert(g);
|
|
1515
1515
|
}
|
|
1516
|
-
|
|
1516
|
+
s = o.size, c = o.pop();
|
|
1517
1517
|
}
|
|
1518
1518
|
J.reset();
|
|
1519
|
-
const
|
|
1520
|
-
return new
|
|
1519
|
+
const u = nt.factory(f.segments);
|
|
1520
|
+
return new $e(u).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
|
|
1527
|
-
}, Ne = function(r) {
|
|
1528
|
-
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1529
|
-
e[n - 1] = arguments[n];
|
|
1530
|
-
return $.run("intersection", r, e);
|
|
1526
|
+
return k.run("union", r, e);
|
|
1531
1527
|
}, Be = function(r) {
|
|
1532
1528
|
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1533
1529
|
e[n - 1] = arguments[n];
|
|
1534
|
-
return
|
|
1530
|
+
return k.run("intersection", r, e);
|
|
1535
1531
|
}, Ge = function(r) {
|
|
1536
1532
|
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1537
1533
|
e[n - 1] = arguments[n];
|
|
1538
|
-
return
|
|
1534
|
+
return k.run("xor", r, e);
|
|
1535
|
+
}, ze = function(r) {
|
|
1536
|
+
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1537
|
+
e[n - 1] = arguments[n];
|
|
1538
|
+
return k.run("difference", r, e);
|
|
1539
1539
|
};
|
|
1540
|
-
var
|
|
1541
|
-
union:
|
|
1542
|
-
intersection:
|
|
1543
|
-
xor:
|
|
1544
|
-
difference:
|
|
1540
|
+
var Zt = {
|
|
1541
|
+
union: Ne,
|
|
1542
|
+
intersection: Be,
|
|
1543
|
+
xor: Ge,
|
|
1544
|
+
difference: ze
|
|
1545
1545
|
};
|
|
1546
|
-
function
|
|
1546
|
+
function Fe(r, t = {}) {
|
|
1547
1547
|
const e = [];
|
|
1548
|
-
if (
|
|
1548
|
+
if (vt(r, (i) => {
|
|
1549
1549
|
e.push(i.coordinates);
|
|
1550
1550
|
}), e.length < 2)
|
|
1551
1551
|
throw new Error("Must have at least 2 geometries");
|
|
1552
|
-
const n =
|
|
1553
|
-
return n.length === 0 ? null : n.length === 1 ? xt(n[0], t.properties) :
|
|
1552
|
+
const n = Zt.union(e[0], ...e.slice(1));
|
|
1553
|
+
return n.length === 0 ? null : n.length === 1 ? xt(n[0], t.properties) : Ut(n, t.properties);
|
|
1554
1554
|
}
|
|
1555
|
-
var
|
|
1555
|
+
var Jt = Fe;
|
|
1556
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
|
}
|
|
1560
1560
|
function W() {
|
|
1561
1561
|
}
|
|
1562
|
-
function
|
|
1562
|
+
function Wt(r) {
|
|
1563
1563
|
return r();
|
|
1564
1564
|
}
|
|
1565
1565
|
function Nt() {
|
|
1566
1566
|
return /* @__PURE__ */ Object.create(null);
|
|
1567
1567
|
}
|
|
1568
1568
|
function rt(r) {
|
|
1569
|
-
r.forEach(
|
|
1569
|
+
r.forEach(Wt);
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1571
|
+
function Kt(r) {
|
|
1572
1572
|
return typeof r == "function";
|
|
1573
1573
|
}
|
|
1574
1574
|
function Te(r, t) {
|
|
1575
1575
|
return r != r ? t == t : r !== t || r && typeof r == "object" || typeof r == "function";
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1577
|
+
function qe(r) {
|
|
1578
1578
|
return Object.keys(r).length === 0;
|
|
1579
1579
|
}
|
|
1580
|
-
function
|
|
1580
|
+
function Qe(r, t) {
|
|
1581
1581
|
r.appendChild(t);
|
|
1582
1582
|
}
|
|
1583
|
-
function
|
|
1583
|
+
function Ue(r, t, e) {
|
|
1584
1584
|
r.insertBefore(t, e || null);
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1586
|
+
function Ht(r) {
|
|
1587
1587
|
r.parentNode && r.parentNode.removeChild(r);
|
|
1588
1588
|
}
|
|
1589
1589
|
function Bt(r) {
|
|
@@ -1592,7 +1592,7 @@ function Bt(r) {
|
|
|
1592
1592
|
function N(r, t, e) {
|
|
1593
1593
|
e == null ? r.removeAttribute(t) : r.getAttribute(t) !== e && r.setAttribute(t, e);
|
|
1594
1594
|
}
|
|
1595
|
-
function
|
|
1595
|
+
function Ye(r) {
|
|
1596
1596
|
return Array.from(r.childNodes);
|
|
1597
1597
|
}
|
|
1598
1598
|
function H(r, t, e) {
|
|
@@ -1604,17 +1604,17 @@ function X(r) {
|
|
|
1604
1604
|
}
|
|
1605
1605
|
const U = [], Gt = [];
|
|
1606
1606
|
let Y = [];
|
|
1607
|
-
const zt = [],
|
|
1607
|
+
const zt = [], De = /* @__PURE__ */ Promise.resolve();
|
|
1608
1608
|
let yt = !1;
|
|
1609
|
-
function
|
|
1610
|
-
yt || (yt = !0,
|
|
1609
|
+
function je() {
|
|
1610
|
+
yt || (yt = !0, De.then(te));
|
|
1611
1611
|
}
|
|
1612
1612
|
function dt(r) {
|
|
1613
1613
|
Y.push(r);
|
|
1614
1614
|
}
|
|
1615
1615
|
const lt = /* @__PURE__ */ new Set();
|
|
1616
1616
|
let Q = 0;
|
|
1617
|
-
function
|
|
1617
|
+
function te() {
|
|
1618
1618
|
if (Q !== 0)
|
|
1619
1619
|
return;
|
|
1620
1620
|
const r = Et;
|
|
@@ -1622,7 +1622,7 @@ function Ht() {
|
|
|
1622
1622
|
try {
|
|
1623
1623
|
for (; Q < U.length; ) {
|
|
1624
1624
|
const t = U[Q];
|
|
1625
|
-
Q++, X(t),
|
|
1625
|
+
Q++, X(t), Xe(t.$$);
|
|
1626
1626
|
}
|
|
1627
1627
|
} catch (t) {
|
|
1628
1628
|
throw U.length = 0, Q = 0, t;
|
|
@@ -1638,39 +1638,39 @@ function Ht() {
|
|
|
1638
1638
|
zt.pop()();
|
|
1639
1639
|
yt = !1, lt.clear(), X(r);
|
|
1640
1640
|
}
|
|
1641
|
-
function
|
|
1641
|
+
function Xe(r) {
|
|
1642
1642
|
if (r.fragment !== null) {
|
|
1643
1643
|
r.update(), rt(r.before_update);
|
|
1644
1644
|
const t = r.dirty;
|
|
1645
1645
|
r.dirty = [-1], r.fragment && r.fragment.p(r.ctx, t), r.after_update.forEach(dt);
|
|
1646
1646
|
}
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1648
|
+
function Ve(r) {
|
|
1649
1649
|
const t = [], e = [];
|
|
1650
1650
|
Y.forEach((n) => r.indexOf(n) === -1 ? t.push(n) : e.push(n)), e.forEach((n) => n()), Y = t;
|
|
1651
1651
|
}
|
|
1652
|
-
const
|
|
1653
|
-
function
|
|
1654
|
-
r && r.i && (
|
|
1652
|
+
const Ze = /* @__PURE__ */ new Set();
|
|
1653
|
+
function Je(r, t) {
|
|
1654
|
+
r && r.i && (Ze.delete(r), r.i(t));
|
|
1655
1655
|
}
|
|
1656
|
-
function
|
|
1656
|
+
function We(r, t, e) {
|
|
1657
1657
|
const { fragment: n, after_update: i } = r.$$;
|
|
1658
1658
|
n && n.m(t, e), dt(() => {
|
|
1659
|
-
const o = r.$$.on_mount.map(
|
|
1659
|
+
const o = r.$$.on_mount.map(Wt).filter(Kt);
|
|
1660
1660
|
r.$$.on_destroy ? r.$$.on_destroy.push(...o) : rt(o), r.$$.on_mount = [];
|
|
1661
1661
|
}), i.forEach(dt);
|
|
1662
1662
|
}
|
|
1663
|
-
function
|
|
1663
|
+
function Ke(r, t) {
|
|
1664
1664
|
const e = r.$$;
|
|
1665
|
-
e.fragment !== null && (
|
|
1665
|
+
e.fragment !== null && (Ve(e.after_update), rt(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
|
|
1666
1666
|
}
|
|
1667
|
-
function
|
|
1668
|
-
r.$$.dirty[0] === -1 && (U.push(r),
|
|
1667
|
+
function He(r, t) {
|
|
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
|
|
1670
|
+
function tn(r, t, e, n, i, o, f = null, s = [-1]) {
|
|
1671
1671
|
const c = Et;
|
|
1672
1672
|
X(r);
|
|
1673
|
-
const
|
|
1673
|
+
const u = r.$$ = {
|
|
1674
1674
|
fragment: null,
|
|
1675
1675
|
ctx: [],
|
|
1676
1676
|
// state
|
|
@@ -1687,26 +1687,26 @@ function He(r, t, e, n, i, o, l = null, u = [-1]) {
|
|
|
1687
1687
|
context: new Map(t.context || (c ? c.$$.context : [])),
|
|
1688
1688
|
// everything else
|
|
1689
1689
|
callbacks: Nt(),
|
|
1690
|
-
dirty:
|
|
1690
|
+
dirty: s,
|
|
1691
1691
|
skip_bound: !1,
|
|
1692
1692
|
root: t.target || c.$$.root
|
|
1693
1693
|
};
|
|
1694
|
-
|
|
1694
|
+
f && f(u.root);
|
|
1695
1695
|
let p = !1;
|
|
1696
|
-
if (
|
|
1697
|
-
const
|
|
1698
|
-
return
|
|
1699
|
-
}) : [],
|
|
1696
|
+
if (u.ctx = e ? e(r, t.props || {}, (l, h, ...a) => {
|
|
1697
|
+
const y = a.length ? a[0] : h;
|
|
1698
|
+
return u.ctx && i(u.ctx[l], u.ctx[l] = y) && (!u.skip_bound && u.bound[l] && u.bound[l](y), p && He(r, l)), h;
|
|
1699
|
+
}) : [], u.update(), p = !0, rt(u.before_update), u.fragment = n ? n(u.ctx) : !1, t.target) {
|
|
1700
1700
|
if (t.hydrate) {
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1701
|
+
const l = Ye(t.target);
|
|
1702
|
+
u.fragment && u.fragment.l(l), l.forEach(Ht);
|
|
1703
1703
|
} else
|
|
1704
|
-
|
|
1705
|
-
t.intro &&
|
|
1704
|
+
u.fragment && u.fragment.c();
|
|
1705
|
+
t.intro && Je(r.$$.fragment), We(r, t.target, t.anchor), te();
|
|
1706
1706
|
}
|
|
1707
1707
|
X(c);
|
|
1708
1708
|
}
|
|
1709
|
-
class
|
|
1709
|
+
class en {
|
|
1710
1710
|
constructor() {
|
|
1711
1711
|
/**
|
|
1712
1712
|
* ### PRIVATE API
|
|
@@ -1727,7 +1727,7 @@ class tn {
|
|
|
1727
1727
|
}
|
|
1728
1728
|
/** @returns {void} */
|
|
1729
1729
|
$destroy() {
|
|
1730
|
-
|
|
1730
|
+
Ke(this, 1), this.$destroy = W;
|
|
1731
1731
|
}
|
|
1732
1732
|
/**
|
|
1733
1733
|
* @template {Extract<keyof Events, string>} K
|
|
@@ -1736,7 +1736,7 @@ class tn {
|
|
|
1736
1736
|
* @returns {() => void}
|
|
1737
1737
|
*/
|
|
1738
1738
|
$on(t, e) {
|
|
1739
|
-
if (!
|
|
1739
|
+
if (!Kt(e))
|
|
1740
1740
|
return W;
|
|
1741
1741
|
const n = this.$$.callbacks[t] || (this.$$.callbacks[t] = []);
|
|
1742
1742
|
return n.push(e), () => {
|
|
@@ -1749,12 +1749,12 @@ class tn {
|
|
|
1749
1749
|
* @returns {void}
|
|
1750
1750
|
*/
|
|
1751
1751
|
$set(t) {
|
|
1752
|
-
this.$$set && !
|
|
1752
|
+
this.$$set && !qe(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
|
|
1753
1753
|
}
|
|
1754
1754
|
}
|
|
1755
|
-
const
|
|
1756
|
-
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(
|
|
1757
|
-
function
|
|
1755
|
+
const nn = "4";
|
|
1756
|
+
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(nn);
|
|
1757
|
+
function rn(r) {
|
|
1758
1758
|
let t, e, n;
|
|
1759
1759
|
return {
|
|
1760
1760
|
c() {
|
|
@@ -1772,7 +1772,7 @@ function nn(r) {
|
|
|
1772
1772
|
);
|
|
1773
1773
|
},
|
|
1774
1774
|
m(i, o) {
|
|
1775
|
-
|
|
1775
|
+
Ue(i, t, o), Qe(t, e);
|
|
1776
1776
|
},
|
|
1777
1777
|
p(i, [o]) {
|
|
1778
1778
|
o & /*displayIn*/
|
|
@@ -1794,42 +1794,42 @@ function nn(r) {
|
|
|
1794
1794
|
i: W,
|
|
1795
1795
|
o: W,
|
|
1796
1796
|
d(i) {
|
|
1797
|
-
i &&
|
|
1797
|
+
i && Ht(t);
|
|
1798
1798
|
}
|
|
1799
1799
|
};
|
|
1800
1800
|
}
|
|
1801
|
-
function
|
|
1801
|
+
function on(r, t, e) {
|
|
1802
1802
|
let { displayIn: n } = t;
|
|
1803
1803
|
return r.$$set = (i) => {
|
|
1804
1804
|
"displayIn" in i && e(0, n = i.displayIn);
|
|
1805
1805
|
}, [n];
|
|
1806
1806
|
}
|
|
1807
|
-
class
|
|
1807
|
+
class sn extends en {
|
|
1808
1808
|
constructor(t) {
|
|
1809
|
-
super(),
|
|
1809
|
+
super(), tn(this, t, on, rn, Te, { displayIn: 0 });
|
|
1810
1810
|
}
|
|
1811
1811
|
}
|
|
1812
|
-
function
|
|
1812
|
+
function ln(r) {
|
|
1813
1813
|
const t = [];
|
|
1814
|
-
if (
|
|
1814
|
+
if (vt(r, (i) => {
|
|
1815
1815
|
t.push(i.coordinates);
|
|
1816
1816
|
}), t.length < 2)
|
|
1817
1817
|
throw new Error("Must have at least two features");
|
|
1818
|
-
const e = r.features[0].properties || {}, n =
|
|
1819
|
-
return n.length === 0 ? null : n.length === 1 ? xt(n[0], e) :
|
|
1818
|
+
const e = r.features[0].properties || {}, n = Zt.difference(t[0], ...t.slice(1));
|
|
1819
|
+
return n.length === 0 ? null : n.length === 1 ? xt(n[0], e) : Ut(n, e);
|
|
1820
1820
|
}
|
|
1821
|
-
var
|
|
1822
|
-
function
|
|
1821
|
+
var un = ln;
|
|
1822
|
+
function fn(r) {
|
|
1823
1823
|
if (!r)
|
|
1824
1824
|
throw new Error("geojson is required");
|
|
1825
1825
|
var t = [];
|
|
1826
|
-
return
|
|
1826
|
+
return se(r, function(e) {
|
|
1827
1827
|
t.push(e);
|
|
1828
1828
|
}), Z(t);
|
|
1829
1829
|
}
|
|
1830
|
-
var
|
|
1831
|
-
function
|
|
1832
|
-
const e =
|
|
1830
|
+
var cn = fn;
|
|
1831
|
+
function Ft(r, t) {
|
|
1832
|
+
const e = un(
|
|
1833
1833
|
Z([
|
|
1834
1834
|
xt([
|
|
1835
1835
|
[
|
|
@@ -1846,56 +1846,57 @@ function Tt(r, t) {
|
|
|
1846
1846
|
if (!e)
|
|
1847
1847
|
return;
|
|
1848
1848
|
e.properties = { isMask: !0 };
|
|
1849
|
-
const n = gt(ut(r)), i = (n[2] - n[0]) / 360 / 1e3, o = n[0] < -180,
|
|
1850
|
-
if (
|
|
1851
|
-
for (const c of
|
|
1852
|
-
const
|
|
1853
|
-
if (
|
|
1849
|
+
const n = gt(ut(r)), i = (n[2] - n[0]) / 360 / 1e3, o = n[0] < -180, f = n[2] > 180, s = cn(r);
|
|
1850
|
+
if (s.features.length > 1 && (o || f))
|
|
1851
|
+
for (const c of s.features) {
|
|
1852
|
+
const u = gt(ut(c));
|
|
1853
|
+
if (f && u[0] < -180 + i)
|
|
1854
1854
|
for (const p of c.geometry.coordinates)
|
|
1855
|
-
for (const
|
|
1856
|
-
|
|
1857
|
-
if (o &&
|
|
1855
|
+
for (const l of p)
|
|
1856
|
+
l[0] += 360 - i;
|
|
1857
|
+
if (o && u[2] > 180 - i)
|
|
1858
1858
|
for (const p of c.geometry.coordinates)
|
|
1859
|
-
for (const
|
|
1860
|
-
|
|
1859
|
+
for (const l of p)
|
|
1860
|
+
l[0] -= 360 - i;
|
|
1861
1861
|
}
|
|
1862
1862
|
t(
|
|
1863
1863
|
Z([
|
|
1864
|
-
|
|
1864
|
+
s.features.length < 2 ? r : Jt(s) ?? r,
|
|
1865
1865
|
e
|
|
1866
1866
|
])
|
|
1867
1867
|
);
|
|
1868
1868
|
}
|
|
1869
|
-
|
|
1870
|
-
var
|
|
1871
|
-
const
|
|
1869
|
+
const Tt = (r) => {
|
|
1870
|
+
var n, i, o;
|
|
1871
|
+
const t = (n = r == null ? void 0 : r.geometry) == null ? void 0 : n.type, e = (i = r == null ? void 0 : r.properties) != null && i.isMask ? 0 : t === "LineString" || t === "MultiLineString" ? 3 : 2;
|
|
1872
1872
|
return {
|
|
1873
1873
|
color: "#3170fe",
|
|
1874
1874
|
fillColor: "#000",
|
|
1875
|
-
fillOpacity: (
|
|
1876
|
-
weight:
|
|
1877
|
-
dashArray: [
|
|
1875
|
+
fillOpacity: (o = r == null ? void 0 : r.properties) != null && o.isMask ? 0.1 : 0,
|
|
1876
|
+
weight: e,
|
|
1877
|
+
dashArray: [e, e],
|
|
1878
1878
|
lineCap: "butt"
|
|
1879
1879
|
};
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1880
|
+
};
|
|
1881
|
+
function an(r, t = !0, e = !0, n = {}, i = {}, o = Tt, f = !1) {
|
|
1882
|
+
let s;
|
|
1883
|
+
const c = [];
|
|
1884
|
+
let u, p;
|
|
1885
|
+
const l = T.geoJSON(void 0, {
|
|
1886
|
+
style: o === !0 ? Tt : o === !1 ? void 0 : o ?? void 0,
|
|
1886
1887
|
interactive: !1
|
|
1887
|
-
}).addTo(r),
|
|
1888
|
-
|
|
1888
|
+
}).addTo(r), h = (y) => {
|
|
1889
|
+
s == null || s({
|
|
1889
1890
|
type: "mapClick",
|
|
1890
|
-
coordinates: [
|
|
1891
|
+
coordinates: [y.latlng.lng, y.latlng.lat]
|
|
1891
1892
|
});
|
|
1892
1893
|
};
|
|
1893
|
-
function a(
|
|
1894
|
-
const
|
|
1895
|
-
return new
|
|
1894
|
+
function a(y, g = !1) {
|
|
1895
|
+
const x = document.createElement("div");
|
|
1896
|
+
return new sn({ props: { displayIn: "leaflet" }, target: x }), new T.Marker(y, {
|
|
1896
1897
|
interactive: g,
|
|
1897
|
-
icon: new
|
|
1898
|
-
html:
|
|
1898
|
+
icon: new T.DivIcon({
|
|
1899
|
+
html: x,
|
|
1899
1900
|
className: "",
|
|
1900
1901
|
iconAnchor: [12, 26],
|
|
1901
1902
|
iconSize: [25, 30],
|
|
@@ -1904,141 +1905,151 @@ function hn(r, t = !0, e = !0, n = {}, i = {}, o = (l) => {
|
|
|
1904
1905
|
});
|
|
1905
1906
|
}
|
|
1906
1907
|
return {
|
|
1907
|
-
setEventHandler(
|
|
1908
|
-
|
|
1908
|
+
setEventHandler(y) {
|
|
1909
|
+
y ? (s = y, r.on("click", h)) : (s = void 0, r.off("click", h));
|
|
1909
1910
|
},
|
|
1910
|
-
flyTo(
|
|
1911
|
-
r.flyTo([
|
|
1911
|
+
flyTo(y, g) {
|
|
1912
|
+
r.flyTo([y[1], y[0]], g, { duration: 2, ...n });
|
|
1912
1913
|
},
|
|
1913
|
-
fitBounds(
|
|
1914
|
+
fitBounds(y, g, x) {
|
|
1914
1915
|
r.flyToBounds(
|
|
1915
1916
|
[
|
|
1916
|
-
[
|
|
1917
|
-
[
|
|
1917
|
+
[y[1], y[0]],
|
|
1918
|
+
[y[3], y[2]]
|
|
1918
1919
|
],
|
|
1919
1920
|
{
|
|
1920
1921
|
padding: [g, g],
|
|
1921
1922
|
duration: 2,
|
|
1922
|
-
...
|
|
1923
|
+
...x ? { maxZoom: x } : {},
|
|
1923
1924
|
...i
|
|
1924
1925
|
}
|
|
1925
1926
|
);
|
|
1926
1927
|
},
|
|
1927
|
-
indicateReverse(
|
|
1928
|
-
r.getContainer().style.cursor =
|
|
1928
|
+
indicateReverse(y) {
|
|
1929
|
+
r.getContainer().style.cursor = y ? "crosshair" : "";
|
|
1929
1930
|
},
|
|
1930
|
-
setReverseMarker(
|
|
1931
|
-
var
|
|
1931
|
+
setReverseMarker(y) {
|
|
1932
|
+
var x;
|
|
1932
1933
|
if (!t)
|
|
1933
1934
|
return;
|
|
1934
|
-
const g =
|
|
1935
|
-
|
|
1935
|
+
const g = y && [y[1], y[0]];
|
|
1936
|
+
p ? g ? p.setLatLng(g) : (p.remove(), p = void 0) : g && (t instanceof Function ? p = t(r) ?? void 0 : (p = (typeof t == "object" ? new T.Marker(g, t) : a(g)).addTo(r), (x = p.getElement()) == null || x.classList.add("marker-reverse")));
|
|
1936
1937
|
},
|
|
1937
|
-
setMarkers(
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
function y(d) {
|
|
1941
|
-
p.clearLayers(), d && p.addData(d);
|
|
1938
|
+
setMarkers(y, g) {
|
|
1939
|
+
function x(d) {
|
|
1940
|
+
l.clearLayers(), d && l.addData(d);
|
|
1942
1941
|
}
|
|
1943
|
-
for (const d of
|
|
1942
|
+
for (const d of c)
|
|
1944
1943
|
d.remove();
|
|
1945
|
-
if (
|
|
1944
|
+
if (c.length = 0, x(), g) {
|
|
1946
1945
|
let d = !1;
|
|
1947
1946
|
if (g.geometry.type === "GeometryCollection") {
|
|
1948
|
-
const
|
|
1949
|
-
(
|
|
1947
|
+
const m = g.geometry.geometries.filter(
|
|
1948
|
+
(v) => v.type === "Polygon" || v.type === "MultiPolygon"
|
|
1950
1949
|
);
|
|
1951
|
-
t: if (
|
|
1952
|
-
const
|
|
1953
|
-
Z(
|
|
1950
|
+
t: if (m.length > 0) {
|
|
1951
|
+
const v = Jt(
|
|
1952
|
+
Z(m.map((w) => V(w)))
|
|
1954
1953
|
);
|
|
1955
|
-
if (!
|
|
1954
|
+
if (!v)
|
|
1956
1955
|
break t;
|
|
1957
|
-
|
|
1956
|
+
Ft(
|
|
1958
1957
|
{
|
|
1959
1958
|
...g,
|
|
1960
|
-
geometry:
|
|
1959
|
+
geometry: v.geometry
|
|
1961
1960
|
},
|
|
1962
|
-
|
|
1961
|
+
x
|
|
1963
1962
|
), d = !0;
|
|
1964
1963
|
} else {
|
|
1965
|
-
const
|
|
1964
|
+
const v = g.geometry.geometries.filter(
|
|
1966
1965
|
(w) => w.type === "LineString" || w.type === "MultiLineString"
|
|
1967
1966
|
);
|
|
1968
|
-
|
|
1967
|
+
v.length > 0 && (x({
|
|
1969
1968
|
...g,
|
|
1970
|
-
geometry: { type: "GeometryCollection", geometries:
|
|
1969
|
+
geometry: { type: "GeometryCollection", geometries: v }
|
|
1971
1970
|
}), d = !0);
|
|
1972
1971
|
}
|
|
1973
1972
|
}
|
|
1974
1973
|
if (!d) {
|
|
1975
1974
|
if (g.geometry.type === "Polygon" || g.geometry.type === "MultiPolygon")
|
|
1976
|
-
|
|
1977
|
-
if (!
|
|
1975
|
+
Ft(g, (m) => {
|
|
1976
|
+
if (!m)
|
|
1978
1977
|
return;
|
|
1979
|
-
const
|
|
1980
|
-
w[0] - E / 4 < -180 &&
|
|
1978
|
+
const v = [...m.features], w = gt(ut(g)), E = w[2] - w[0];
|
|
1979
|
+
w[0] - E / 4 < -180 && v.push(...qt(m, -360).features), w[2] + E / 4 > 180 && v.push(...qt(m, 360).features), x(Z(v));
|
|
1981
1980
|
});
|
|
1982
1981
|
else if (g.geometry.type === "LineString" || g.geometry.type === "MultiLineString") {
|
|
1983
|
-
|
|
1982
|
+
x(g);
|
|
1984
1983
|
return;
|
|
1985
1984
|
}
|
|
1986
1985
|
}
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1986
|
+
if (!f && g.geometry.type !== "Point")
|
|
1987
|
+
return;
|
|
1988
|
+
if (t instanceof Function) {
|
|
1989
|
+
const m = t(r, g);
|
|
1990
|
+
m && c.push(m.addTo(r));
|
|
1991
|
+
} else if (t) {
|
|
1992
|
+
const m = [g.center[1], g.center[0]];
|
|
1993
|
+
c.push(
|
|
1994
|
+
typeof t == "object" ? new T.Marker(m, t) : a(m).addTo(r)
|
|
1995
|
+
);
|
|
1996
|
+
}
|
|
1991
1997
|
}
|
|
1992
1998
|
if (e)
|
|
1993
|
-
for (const d of
|
|
1999
|
+
for (const d of y ?? []) {
|
|
1994
2000
|
if (d === g)
|
|
1995
2001
|
continue;
|
|
1996
|
-
const
|
|
2002
|
+
const m = [
|
|
1997
2003
|
d.center[1],
|
|
1998
2004
|
d.center[0]
|
|
1999
|
-
]
|
|
2000
|
-
v
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2005
|
+
];
|
|
2006
|
+
let v;
|
|
2007
|
+
if (e instanceof Function) {
|
|
2008
|
+
if (v = e(r, d), !v)
|
|
2009
|
+
continue;
|
|
2010
|
+
} else
|
|
2011
|
+
v = (typeof e == "object" ? new T.Marker(m, e) : a(m, !0)).addTo(r).bindTooltip(
|
|
2012
|
+
d.place_type[0] === "reverse" ? d.place_name : d.place_name.replace(/,.*/, ""),
|
|
2013
|
+
{
|
|
2014
|
+
direction: "top"
|
|
2015
|
+
}
|
|
2016
|
+
);
|
|
2017
|
+
const w = v.getElement();
|
|
2018
|
+
w && (w.addEventListener("click", (E) => {
|
|
2019
|
+
E.stopPropagation(), s == null || s({ type: "markerClick", id: d.id });
|
|
2020
|
+
}), w.addEventListener("mouseenter", () => {
|
|
2021
|
+
s == null || s({ type: "markerMouseEnter", id: d.id });
|
|
2022
|
+
}), w.addEventListener("mouseleave", () => {
|
|
2023
|
+
s == null || s({ type: "markerMouseLeave", id: d.id });
|
|
2024
|
+
}), w.classList.toggle("marker-fuzzy", !!d.matching_text)), c.push(v);
|
|
2014
2025
|
}
|
|
2015
2026
|
},
|
|
2016
|
-
setSelectedMarker(
|
|
2017
|
-
var g,
|
|
2018
|
-
|
|
2027
|
+
setSelectedMarker(y) {
|
|
2028
|
+
var g, x;
|
|
2029
|
+
u && ((g = u.getElement()) == null || g.classList.toggle("marker-selected", !1)), u = y > -1 ? c[y] : void 0, (x = u == null ? void 0 : u.getElement()) == null || x.classList.toggle("marker-selected", !0);
|
|
2019
2030
|
},
|
|
2020
2031
|
getCenterAndZoom() {
|
|
2021
|
-
const
|
|
2022
|
-
return [r.getZoom(),
|
|
2032
|
+
const y = r.getCenter();
|
|
2033
|
+
return [r.getZoom(), y.lng, y.lat];
|
|
2023
2034
|
}
|
|
2024
2035
|
};
|
|
2025
2036
|
}
|
|
2026
|
-
function
|
|
2027
|
-
const e =
|
|
2037
|
+
function qt(r, t) {
|
|
2038
|
+
const e = ce(r);
|
|
2028
2039
|
for (const n of e.features)
|
|
2029
2040
|
if (n.geometry.type == "MultiPolygon")
|
|
2030
2041
|
for (const i of n.geometry.coordinates)
|
|
2031
|
-
|
|
2042
|
+
Qt(i, t);
|
|
2032
2043
|
else
|
|
2033
|
-
|
|
2044
|
+
Qt(n.geometry.coordinates, t);
|
|
2034
2045
|
return e;
|
|
2035
2046
|
}
|
|
2036
|
-
function
|
|
2047
|
+
function Qt(r, t) {
|
|
2037
2048
|
for (const e of r)
|
|
2038
2049
|
for (const n of e)
|
|
2039
2050
|
n[0] += t;
|
|
2040
2051
|
}
|
|
2041
2052
|
export {
|
|
2042
|
-
|
|
2053
|
+
an as createLeafletMapController
|
|
2043
2054
|
};
|
|
2044
2055
|
//# sourceMappingURL=leaflet-controller.js.map
|