@maptiler/geocoding-control 2.1.0-with-autocomplete-timeout → 2.1.1
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/leaflet-controller.js +1942 -1523
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +1 -22
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +2798 -2385
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +1 -22
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.js +1918 -1498
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +1 -22
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.js +2892 -2478
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +1 -22
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.js +2898 -2482
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +1 -22
- package/maptilersdk.umd.js.map +1 -1
- package/openlayers-controller.js +1686 -1264
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +1 -22
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +2778 -2365
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +1 -22
- package/openlayers.umd.js.map +1 -1
- package/package.json +19 -19
- package/react.js +753 -756
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/{MapLibreBasedGeocodingControl.d.ts → src/MapLibreBasedGeocodingControl.d.ts} +35 -69
- package/{maplibregl.d.ts → src/maplibregl.d.ts} +34 -68
- package/{maptilersdk.d.ts → src/maptilersdk.d.ts} +34 -68
- package/src/types.d.ts +391 -0
- package/svelte/GeocodingControl.svelte +71 -58
- package/svelte/GeocodingControl.svelte.d.ts +5 -3
- package/svelte/MapLibreBasedGeocodingControl.d.ts +35 -69
- package/svelte/maplibregl.d.ts +34 -68
- package/svelte/maptilersdk.d.ts +34 -68
- package/svelte/maptilersdk.js +2 -0
- package/svelte/react.js +3 -0
- package/svelte/types.d.ts +175 -128
- package/vanilla.js +847 -853
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
- package/types.d.ts +0 -344
- /package/{geo-coordinates-parser.t.d.ts → src/geo-coordinates-parser.t.d.ts} +0 -0
- /package/{geoUtils.d.ts → src/geoUtils.d.ts} +0 -0
- /package/{leaflet-controller.d.ts → src/leaflet-controller.d.ts} +0 -0
- /package/{leaflet.d.ts → src/leaflet.d.ts} +0 -0
- /package/{maplibregl-controller.d.ts → src/maplibregl-controller.d.ts} +0 -0
- /package/{mask.d.ts → src/mask.d.ts} +0 -0
- /package/{openlayers-controller.d.ts → src/openlayers-controller.d.ts} +0 -0
- /package/{openlayers.d.ts → src/openlayers.d.ts} +0 -0
- /package/{proximity.d.ts → src/proximity.d.ts} +0 -0
- /package/{react.d.ts → src/react.d.ts} +0 -0
- /package/{vanilla.d.ts → src/vanilla.d.ts} +0 -0
package/leaflet-controller.js
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import * as
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
return (
|
|
8
|
-
}
|
|
9
|
-
function
|
|
10
|
-
for (const
|
|
11
|
-
if (
|
|
1
|
+
var Pt = Object.defineProperty;
|
|
2
|
+
var Ot = (t, e, n) => e in t ? Pt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var C = (t, e, n) => Ot(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import * as ce from "leaflet";
|
|
5
|
+
function Ee(t, e, n = {}) {
|
|
6
|
+
const i = { type: "Feature" };
|
|
7
|
+
return (n.id === 0 || n.id) && (i.id = n.id), n.bbox && (i.bbox = n.bbox), i.properties = e || {}, i.geometry = t, i;
|
|
8
|
+
}
|
|
9
|
+
function Ze(t, e, n = {}) {
|
|
10
|
+
for (const r of t) {
|
|
11
|
+
if (r.length < 4)
|
|
12
12
|
throw new Error(
|
|
13
13
|
"Each LinearRing of a Polygon must have 4 or more Positions."
|
|
14
14
|
);
|
|
15
|
-
if (
|
|
15
|
+
if (r[r.length - 1].length !== r[0].length)
|
|
16
16
|
throw new Error("First and last Position are not equivalent.");
|
|
17
|
-
for (let
|
|
18
|
-
if (
|
|
17
|
+
for (let u = 0; u < r[r.length - 1].length; u++)
|
|
18
|
+
if (r[r.length - 1][u] !== r[0][u])
|
|
19
19
|
throw new Error("First and last Position are not equivalent.");
|
|
20
20
|
}
|
|
21
|
-
return
|
|
21
|
+
return Ee({
|
|
22
22
|
type: "Polygon",
|
|
23
|
-
coordinates:
|
|
24
|
-
},
|
|
23
|
+
coordinates: t
|
|
24
|
+
}, e, n);
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
return
|
|
26
|
+
function ve(t, e = {}) {
|
|
27
|
+
const n = { type: "FeatureCollection" };
|
|
28
|
+
return e.id && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.features = t, n;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function gt(t, e, n = {}) {
|
|
31
|
+
return Ee({
|
|
32
32
|
type: "MultiPolygon",
|
|
33
|
-
coordinates:
|
|
34
|
-
},
|
|
35
|
-
}
|
|
36
|
-
function
|
|
37
|
-
if (
|
|
38
|
-
for (var
|
|
39
|
-
|
|
40
|
-
for (var v = 0; v <
|
|
41
|
-
var
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
switch (
|
|
33
|
+
coordinates: t
|
|
34
|
+
}, e, n);
|
|
35
|
+
}
|
|
36
|
+
function yt(t, e, n) {
|
|
37
|
+
if (t !== null)
|
|
38
|
+
for (var i, r, u, a, h, E, p, _ = 0, b = 0, M, T = t.type, L = T === "FeatureCollection", B = T === "Feature", q = L ? t.features.length : 1, I = 0; I < q; I++) {
|
|
39
|
+
p = L ? t.features[I].geometry : B ? t.geometry : t, M = p ? p.type === "GeometryCollection" : !1, h = M ? p.geometries.length : 1;
|
|
40
|
+
for (var v = 0; v < h; v++) {
|
|
41
|
+
var N = 0, $ = 0;
|
|
42
|
+
if (a = M ? p.geometries[v] : p, a !== null) {
|
|
43
|
+
E = a.coordinates;
|
|
44
|
+
var K = a.type;
|
|
45
|
+
switch (_ = 0, K) {
|
|
46
46
|
case null:
|
|
47
47
|
break;
|
|
48
48
|
case "Point":
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
if (e(
|
|
50
|
+
E,
|
|
51
|
+
b,
|
|
52
|
+
I,
|
|
53
|
+
N,
|
|
54
|
+
$
|
|
55
55
|
) === !1)
|
|
56
56
|
return !1;
|
|
57
|
-
|
|
57
|
+
b++, N++;
|
|
58
58
|
break;
|
|
59
59
|
case "LineString":
|
|
60
60
|
case "MultiPoint":
|
|
61
|
-
for (
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
for (i = 0; i < E.length; i++) {
|
|
62
|
+
if (e(
|
|
63
|
+
E[i],
|
|
64
|
+
b,
|
|
65
|
+
I,
|
|
66
|
+
N,
|
|
67
|
+
$
|
|
68
68
|
) === !1)
|
|
69
69
|
return !1;
|
|
70
|
-
|
|
70
|
+
b++, K === "MultiPoint" && N++;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
K === "LineString" && N++;
|
|
73
73
|
break;
|
|
74
74
|
case "Polygon":
|
|
75
75
|
case "MultiLineString":
|
|
76
|
-
for (
|
|
77
|
-
for (
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
76
|
+
for (i = 0; i < E.length; i++) {
|
|
77
|
+
for (r = 0; r < E[i].length - _; r++) {
|
|
78
|
+
if (e(
|
|
79
|
+
E[i][r],
|
|
80
|
+
b,
|
|
81
|
+
I,
|
|
82
|
+
N,
|
|
83
|
+
$
|
|
84
84
|
) === !1)
|
|
85
85
|
return !1;
|
|
86
|
-
|
|
86
|
+
b++;
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
K === "MultiLineString" && N++, K === "Polygon" && $++;
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
K === "Polygon" && N++;
|
|
91
91
|
break;
|
|
92
92
|
case "MultiPolygon":
|
|
93
|
-
for (
|
|
94
|
-
for (
|
|
95
|
-
for (
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
93
|
+
for (i = 0; i < E.length; i++) {
|
|
94
|
+
for ($ = 0, r = 0; r < E[i].length; r++) {
|
|
95
|
+
for (u = 0; u < E[i][r].length - _; u++) {
|
|
96
|
+
if (e(
|
|
97
|
+
E[i][r][u],
|
|
98
|
+
b,
|
|
99
|
+
I,
|
|
100
|
+
N,
|
|
101
|
+
$
|
|
102
102
|
) === !1)
|
|
103
103
|
return !1;
|
|
104
|
-
|
|
104
|
+
b++;
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
$++;
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
N++;
|
|
109
109
|
}
|
|
110
110
|
break;
|
|
111
111
|
case "GeometryCollection":
|
|
112
|
-
for (
|
|
113
|
-
if (
|
|
112
|
+
for (i = 0; i < a.geometries.length; i++)
|
|
113
|
+
if (yt(a.geometries[i], e) === !1)
|
|
114
114
|
return !1;
|
|
115
115
|
break;
|
|
116
116
|
default:
|
|
@@ -120,46 +120,46 @@ function Yt(r, t, e) {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
var
|
|
125
|
-
for (
|
|
126
|
-
for (
|
|
127
|
-
if (
|
|
128
|
-
if (
|
|
123
|
+
function Ye(t, e) {
|
|
124
|
+
var n, i, r, u, a, h, E, p, _, b, M = 0, T = t.type === "FeatureCollection", L = t.type === "Feature", B = T ? t.features.length : 1;
|
|
125
|
+
for (n = 0; n < B; n++) {
|
|
126
|
+
for (h = T ? t.features[n].geometry : L ? t.geometry : t, p = T ? t.features[n].properties : L ? t.properties : {}, _ = T ? t.features[n].bbox : L ? t.bbox : void 0, b = T ? t.features[n].id : L ? t.id : void 0, E = h ? h.type === "GeometryCollection" : !1, a = E ? h.geometries.length : 1, r = 0; r < a; r++) {
|
|
127
|
+
if (u = E ? h.geometries[r] : h, u === null) {
|
|
128
|
+
if (e(
|
|
129
129
|
null,
|
|
130
|
-
|
|
131
|
-
f,
|
|
130
|
+
M,
|
|
132
131
|
p,
|
|
133
|
-
|
|
132
|
+
_,
|
|
133
|
+
b
|
|
134
134
|
) === !1)
|
|
135
135
|
return !1;
|
|
136
136
|
continue;
|
|
137
137
|
}
|
|
138
|
-
switch (
|
|
138
|
+
switch (u.type) {
|
|
139
139
|
case "Point":
|
|
140
140
|
case "LineString":
|
|
141
141
|
case "MultiPoint":
|
|
142
142
|
case "Polygon":
|
|
143
143
|
case "MultiLineString":
|
|
144
144
|
case "MultiPolygon": {
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
f,
|
|
145
|
+
if (e(
|
|
146
|
+
u,
|
|
147
|
+
M,
|
|
149
148
|
p,
|
|
150
|
-
|
|
149
|
+
_,
|
|
150
|
+
b
|
|
151
151
|
) === !1)
|
|
152
152
|
return !1;
|
|
153
153
|
break;
|
|
154
154
|
}
|
|
155
155
|
case "GeometryCollection": {
|
|
156
|
-
for (
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
f,
|
|
156
|
+
for (i = 0; i < u.geometries.length; i++)
|
|
157
|
+
if (e(
|
|
158
|
+
u.geometries[i],
|
|
159
|
+
M,
|
|
161
160
|
p,
|
|
162
|
-
|
|
161
|
+
_,
|
|
162
|
+
b
|
|
163
163
|
) === !1)
|
|
164
164
|
return !1;
|
|
165
165
|
break;
|
|
@@ -168,62 +168,62 @@ function vt(r, t) {
|
|
|
168
168
|
throw new Error("Unknown Geometry Type");
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
M++;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
|
|
176
|
-
var
|
|
177
|
-
switch (
|
|
174
|
+
function Rt(t, e) {
|
|
175
|
+
Ye(t, function(n, i, r, u, a) {
|
|
176
|
+
var h = n === null ? null : n.type;
|
|
177
|
+
switch (h) {
|
|
178
178
|
case null:
|
|
179
179
|
case "Point":
|
|
180
180
|
case "LineString":
|
|
181
181
|
case "Polygon":
|
|
182
|
-
return
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
return e(
|
|
183
|
+
Ee(n, r, { bbox: u, id: a }),
|
|
184
|
+
i,
|
|
185
185
|
0
|
|
186
186
|
) === !1 ? !1 : void 0;
|
|
187
187
|
}
|
|
188
|
-
var
|
|
189
|
-
switch (
|
|
188
|
+
var E;
|
|
189
|
+
switch (h) {
|
|
190
190
|
case "MultiPoint":
|
|
191
|
-
|
|
191
|
+
E = "Point";
|
|
192
192
|
break;
|
|
193
193
|
case "MultiLineString":
|
|
194
|
-
|
|
194
|
+
E = "LineString";
|
|
195
195
|
break;
|
|
196
196
|
case "MultiPolygon":
|
|
197
|
-
|
|
197
|
+
E = "Polygon";
|
|
198
198
|
break;
|
|
199
199
|
}
|
|
200
|
-
for (var
|
|
201
|
-
var
|
|
202
|
-
type:
|
|
203
|
-
coordinates:
|
|
200
|
+
for (var p = 0; p < n.coordinates.length; p++) {
|
|
201
|
+
var _ = n.coordinates[p], b = {
|
|
202
|
+
type: E,
|
|
203
|
+
coordinates: _
|
|
204
204
|
};
|
|
205
|
-
if (
|
|
205
|
+
if (e(Ee(b, r), i, p) === !1)
|
|
206
206
|
return !1;
|
|
207
207
|
}
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
if (
|
|
212
|
-
return
|
|
213
|
-
const
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
}),
|
|
217
|
-
}
|
|
218
|
-
var
|
|
219
|
-
function
|
|
220
|
-
if (!
|
|
210
|
+
function Nt(t, e = {}) {
|
|
211
|
+
if (t.bbox != null && e.recompute !== !0)
|
|
212
|
+
return t.bbox;
|
|
213
|
+
const n = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
|
|
214
|
+
return yt(t, (i) => {
|
|
215
|
+
n[0] > i[0] && (n[0] = i[0]), n[1] > i[1] && (n[1] = i[1]), n[2] < i[0] && (n[2] = i[0]), n[3] < i[1] && (n[3] = i[1]);
|
|
216
|
+
}), n;
|
|
217
|
+
}
|
|
218
|
+
var qe = Nt;
|
|
219
|
+
function At(t) {
|
|
220
|
+
if (!t)
|
|
221
221
|
throw new Error("geojson is required");
|
|
222
|
-
switch (
|
|
222
|
+
switch (t.type) {
|
|
223
223
|
case "Feature":
|
|
224
|
-
return
|
|
224
|
+
return dt(t);
|
|
225
225
|
case "FeatureCollection":
|
|
226
|
-
return
|
|
226
|
+
return It(t);
|
|
227
227
|
case "Point":
|
|
228
228
|
case "LineString":
|
|
229
229
|
case "Polygon":
|
|
@@ -231,627 +231,1073 @@ function ue(r) {
|
|
|
231
231
|
case "MultiLineString":
|
|
232
232
|
case "MultiPolygon":
|
|
233
233
|
case "GeometryCollection":
|
|
234
|
-
return
|
|
234
|
+
return We(t);
|
|
235
235
|
default:
|
|
236
236
|
throw new Error("unknown GeoJSON type");
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
const
|
|
241
|
-
return Object.keys(
|
|
242
|
-
switch (
|
|
239
|
+
function dt(t) {
|
|
240
|
+
const e = { type: "Feature" };
|
|
241
|
+
return Object.keys(t).forEach((n) => {
|
|
242
|
+
switch (n) {
|
|
243
243
|
case "type":
|
|
244
244
|
case "properties":
|
|
245
245
|
case "geometry":
|
|
246
246
|
return;
|
|
247
247
|
default:
|
|
248
|
-
|
|
248
|
+
e[n] = t[n];
|
|
249
249
|
}
|
|
250
|
-
}),
|
|
250
|
+
}), e.properties = mt(t.properties), t.geometry == null ? e.geometry = null : e.geometry = We(t.geometry), e;
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
const
|
|
254
|
-
return
|
|
255
|
-
const
|
|
256
|
-
typeof
|
|
257
|
-
}),
|
|
252
|
+
function mt(t) {
|
|
253
|
+
const e = {};
|
|
254
|
+
return t && Object.keys(t).forEach((n) => {
|
|
255
|
+
const i = t[n];
|
|
256
|
+
typeof i == "object" ? i === null ? e[n] = null : Array.isArray(i) ? e[n] = i.map((r) => r) : e[n] = mt(i) : e[n] = i;
|
|
257
|
+
}), e;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
260
|
-
const
|
|
261
|
-
return Object.keys(
|
|
262
|
-
switch (
|
|
259
|
+
function It(t) {
|
|
260
|
+
const e = { type: "FeatureCollection" };
|
|
261
|
+
return Object.keys(t).forEach((n) => {
|
|
262
|
+
switch (n) {
|
|
263
263
|
case "type":
|
|
264
264
|
case "features":
|
|
265
265
|
return;
|
|
266
266
|
default:
|
|
267
|
-
|
|
267
|
+
e[n] = t[n];
|
|
268
268
|
}
|
|
269
|
-
}),
|
|
270
|
-
}
|
|
271
|
-
function
|
|
272
|
-
const
|
|
273
|
-
return
|
|
274
|
-
}
|
|
275
|
-
function
|
|
276
|
-
const
|
|
277
|
-
return typeof
|
|
278
|
-
}
|
|
279
|
-
var
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
f = e.ops.pop(), e.trys.pop();
|
|
331
|
-
continue;
|
|
332
|
-
default:
|
|
333
|
-
if (o = e.trys, !(o = o.length > 0 && o[o.length - 1]) && (f[0] === 6 || f[0] === 2)) {
|
|
334
|
-
e = 0;
|
|
269
|
+
}), e.features = t.features.map((n) => dt(n)), e;
|
|
270
|
+
}
|
|
271
|
+
function We(t) {
|
|
272
|
+
const e = { type: t.type };
|
|
273
|
+
return t.bbox && (e.bbox = t.bbox), t.type === "GeometryCollection" ? (e.geometries = t.geometries.map((n) => We(n)), e) : (e.coordinates = xt(t.coordinates), e);
|
|
274
|
+
}
|
|
275
|
+
function xt(t) {
|
|
276
|
+
const e = t;
|
|
277
|
+
return typeof e[0] != "object" ? e.slice() : e.map((n) => xt(n));
|
|
278
|
+
}
|
|
279
|
+
var kt = At, Bt = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, Be = Math.ceil, j = Math.floor, Z = "[BigNumber Error] ", He = Z + "Number primitive has more than 15 significant digits: ", ee = 1e14, R = 14, je = 9007199254740991, Ge = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], le = 1e7, Y = 1e9;
|
|
280
|
+
function wt(t) {
|
|
281
|
+
var e, n, i, r = v.prototype = { constructor: v, toString: null, valueOf: null }, u = new v(1), a = 20, h = 4, E = -7, p = 21, _ = -1e7, b = 1e7, M = !1, T = 1, L = 0, B = {
|
|
282
|
+
prefix: "",
|
|
283
|
+
groupSize: 3,
|
|
284
|
+
secondaryGroupSize: 0,
|
|
285
|
+
groupSeparator: ",",
|
|
286
|
+
decimalSeparator: ".",
|
|
287
|
+
fractionGroupSize: 0,
|
|
288
|
+
fractionGroupSeparator: " ",
|
|
289
|
+
// non-breaking space
|
|
290
|
+
suffix: ""
|
|
291
|
+
}, q = "0123456789abcdefghijklmnopqrstuvwxyz", I = !0;
|
|
292
|
+
function v(s, o) {
|
|
293
|
+
var l, m, c, y, w, f, g, x, d = this;
|
|
294
|
+
if (!(d instanceof v)) return new v(s, o);
|
|
295
|
+
if (o == null) {
|
|
296
|
+
if (s && s._isBigNumber === !0) {
|
|
297
|
+
d.s = s.s, !s.c || s.e > b ? d.c = d.e = null : s.e < _ ? d.c = [d.e = 0] : (d.e = s.e, d.c = s.c.slice());
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if ((f = typeof s == "number") && s * 0 == 0) {
|
|
301
|
+
if (d.s = 1 / s < 0 ? (s = -s, -1) : 1, s === ~~s) {
|
|
302
|
+
for (y = 0, w = s; w >= 10; w /= 10, y++) ;
|
|
303
|
+
y > b ? d.c = d.e = null : (d.e = y, d.c = [s]);
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
x = String(s);
|
|
307
|
+
} else {
|
|
308
|
+
if (!Bt.test(x = String(s))) return i(d, x, f);
|
|
309
|
+
d.s = x.charCodeAt(0) == 45 ? (x = x.slice(1), -1) : 1;
|
|
310
|
+
}
|
|
311
|
+
(y = x.indexOf(".")) > -1 && (x = x.replace(".", "")), (w = x.search(/e/i)) > 0 ? (y < 0 && (y = w), y += +x.slice(w + 1), x = x.substring(0, w)) : y < 0 && (y = x.length);
|
|
312
|
+
} else {
|
|
313
|
+
if (F(o, 2, q.length, "Base"), o == 10 && I)
|
|
314
|
+
return d = new v(s), W(d, a + d.e + 1, h);
|
|
315
|
+
if (x = String(s), f = typeof s == "number") {
|
|
316
|
+
if (s * 0 != 0) return i(d, x, f, o);
|
|
317
|
+
if (d.s = 1 / s < 0 ? (x = x.slice(1), -1) : 1, v.DEBUG && x.replace(/^0\.0*|\./, "").length > 15)
|
|
318
|
+
throw Error(He + s);
|
|
319
|
+
} else
|
|
320
|
+
d.s = x.charCodeAt(0) === 45 ? (x = x.slice(1), -1) : 1;
|
|
321
|
+
for (l = q.slice(0, o), y = w = 0, g = x.length; w < g; w++)
|
|
322
|
+
if (l.indexOf(m = x.charAt(w)) < 0) {
|
|
323
|
+
if (m == ".") {
|
|
324
|
+
if (w > y) {
|
|
325
|
+
y = g;
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
} else if (!c && (x == x.toUpperCase() && (x = x.toLowerCase()) || x == x.toLowerCase() && (x = x.toUpperCase()))) {
|
|
329
|
+
c = !0, w = -1, y = 0;
|
|
335
330
|
continue;
|
|
336
331
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
if (f[0] === 6 && e.label < o[1]) {
|
|
342
|
-
e.label = o[1], o = f;
|
|
343
|
-
break;
|
|
344
|
-
}
|
|
345
|
-
if (o && e.label < o[2]) {
|
|
346
|
-
e.label = o[2], e.ops.push(f);
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
o[2] && e.ops.pop(), e.trys.pop();
|
|
350
|
-
continue;
|
|
351
|
-
}
|
|
352
|
-
f = t.call(r, e);
|
|
353
|
-
} catch (p) {
|
|
354
|
-
f = [6, p], i = 0;
|
|
355
|
-
} finally {
|
|
356
|
-
n = o = 0;
|
|
332
|
+
return i(d, String(s), f, o);
|
|
333
|
+
}
|
|
334
|
+
f = !1, x = n(x, o, 10, d.s), (y = x.indexOf(".")) > -1 ? x = x.replace(".", "") : y = x.length;
|
|
357
335
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
);
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
var u = e(r, t.key);
|
|
377
|
-
if (u < 0) {
|
|
378
|
-
if (t.left === null)
|
|
379
|
-
break;
|
|
380
|
-
if (e(r, t.left.key) < 0) {
|
|
381
|
-
var l = t.left;
|
|
382
|
-
if (t.left = l.right, l.right = t, t = l, t.left === null)
|
|
383
|
-
break;
|
|
384
|
-
}
|
|
385
|
-
o.left = t, o = t, t = t.left;
|
|
386
|
-
} else if (u > 0) {
|
|
387
|
-
if (t.right === null)
|
|
388
|
-
break;
|
|
389
|
-
if (e(r, t.right.key) > 0) {
|
|
390
|
-
var l = t.right;
|
|
391
|
-
if (t.right = l.left, l.left = t, t = l, t.right === null)
|
|
392
|
-
break;
|
|
336
|
+
for (w = 0; x.charCodeAt(w) === 48; w++) ;
|
|
337
|
+
for (g = x.length; x.charCodeAt(--g) === 48; ) ;
|
|
338
|
+
if (x = x.slice(w, ++g)) {
|
|
339
|
+
if (g -= w, f && v.DEBUG && g > 15 && (s > je || s !== j(s)))
|
|
340
|
+
throw Error(He + d.s * s);
|
|
341
|
+
if ((y = y - w - 1) > b)
|
|
342
|
+
d.c = d.e = null;
|
|
343
|
+
else if (y < _)
|
|
344
|
+
d.c = [d.e = 0];
|
|
345
|
+
else {
|
|
346
|
+
if (d.e = y, d.c = [], w = (y + 1) % R, y < 0 && (w += R), w < g) {
|
|
347
|
+
for (w && d.c.push(+x.slice(0, w)), g -= R; w < g; )
|
|
348
|
+
d.c.push(+x.slice(w, w += R));
|
|
349
|
+
w = R - (x = x.slice(w)).length;
|
|
350
|
+
} else
|
|
351
|
+
w -= g;
|
|
352
|
+
for (; w--; x += "0") ;
|
|
353
|
+
d.c.push(+x);
|
|
393
354
|
}
|
|
394
|
-
i.right = t, i = t, t = t.right;
|
|
395
355
|
} else
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
356
|
+
d.c = [d.e = 0];
|
|
357
|
+
}
|
|
358
|
+
v.clone = wt, v.ROUND_UP = 0, v.ROUND_DOWN = 1, v.ROUND_CEIL = 2, v.ROUND_FLOOR = 3, v.ROUND_HALF_UP = 4, v.ROUND_HALF_DOWN = 5, v.ROUND_HALF_EVEN = 6, v.ROUND_HALF_CEIL = 7, v.ROUND_HALF_FLOOR = 8, v.EUCLID = 9, v.config = v.set = function(s) {
|
|
359
|
+
var o, l;
|
|
360
|
+
if (s != null)
|
|
361
|
+
if (typeof s == "object") {
|
|
362
|
+
if (s.hasOwnProperty(o = "DECIMAL_PLACES") && (l = s[o], F(l, 0, Y, o), a = l), s.hasOwnProperty(o = "ROUNDING_MODE") && (l = s[o], F(l, 0, 8, o), h = l), s.hasOwnProperty(o = "EXPONENTIAL_AT") && (l = s[o], l && l.pop ? (F(l[0], -1e9, 0, o), F(l[1], 0, Y, o), E = l[0], p = l[1]) : (F(l, -1e9, Y, o), E = -(p = l < 0 ? -l : l))), s.hasOwnProperty(o = "RANGE"))
|
|
363
|
+
if (l = s[o], l && l.pop)
|
|
364
|
+
F(l[0], -1e9, -1, o), F(l[1], 1, Y, o), _ = l[0], b = l[1];
|
|
365
|
+
else if (F(l, -1e9, Y, o), l)
|
|
366
|
+
_ = -(b = l < 0 ? -l : l);
|
|
367
|
+
else
|
|
368
|
+
throw Error(Z + o + " cannot be zero: " + l);
|
|
369
|
+
if (s.hasOwnProperty(o = "CRYPTO"))
|
|
370
|
+
if (l = s[o], l === !!l)
|
|
371
|
+
if (l)
|
|
372
|
+
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
373
|
+
M = l;
|
|
374
|
+
else
|
|
375
|
+
throw M = !l, Error(Z + "crypto unavailable");
|
|
376
|
+
else
|
|
377
|
+
M = l;
|
|
378
|
+
else
|
|
379
|
+
throw Error(Z + o + " not true or false: " + l);
|
|
380
|
+
if (s.hasOwnProperty(o = "MODULO_MODE") && (l = s[o], F(l, 0, 9, o), T = l), s.hasOwnProperty(o = "POW_PRECISION") && (l = s[o], F(l, 0, Y, o), L = l), s.hasOwnProperty(o = "FORMAT"))
|
|
381
|
+
if (l = s[o], typeof l == "object") B = l;
|
|
382
|
+
else throw Error(Z + o + " not an object: " + l);
|
|
383
|
+
if (s.hasOwnProperty(o = "ALPHABET"))
|
|
384
|
+
if (l = s[o], typeof l == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(l))
|
|
385
|
+
I = l.slice(0, 10) == "0123456789", q = l;
|
|
386
|
+
else
|
|
387
|
+
throw Error(Z + o + " invalid: " + l);
|
|
388
|
+
} else
|
|
389
|
+
throw Error(Z + "Object expected: " + s);
|
|
390
|
+
return {
|
|
391
|
+
DECIMAL_PLACES: a,
|
|
392
|
+
ROUNDING_MODE: h,
|
|
393
|
+
EXPONENTIAL_AT: [E, p],
|
|
394
|
+
RANGE: [_, b],
|
|
395
|
+
CRYPTO: M,
|
|
396
|
+
MODULO_MODE: T,
|
|
397
|
+
POW_PRECISION: L,
|
|
398
|
+
FORMAT: B,
|
|
399
|
+
ALPHABET: q
|
|
400
|
+
};
|
|
401
|
+
}, v.isBigNumber = function(s) {
|
|
402
|
+
if (!s || s._isBigNumber !== !0) return !1;
|
|
403
|
+
if (!v.DEBUG) return !0;
|
|
404
|
+
var o, l, m = s.c, c = s.e, y = s.s;
|
|
405
|
+
e: if ({}.toString.call(m) == "[object Array]") {
|
|
406
|
+
if ((y === 1 || y === -1) && c >= -1e9 && c <= Y && c === j(c)) {
|
|
407
|
+
if (m[0] === 0) {
|
|
408
|
+
if (c === 0 && m.length === 1) return !0;
|
|
409
|
+
break e;
|
|
410
|
+
}
|
|
411
|
+
if (o = (c + 1) % R, o < 1 && (o += R), String(m[0]).length == o) {
|
|
412
|
+
for (o = 0; o < m.length; o++)
|
|
413
|
+
if (l = m[o], l < 0 || l >= ee || l !== j(l)) break e;
|
|
414
|
+
if (l !== 0) return !0;
|
|
415
|
+
}
|
|
456
416
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
417
|
+
} else if (m === null && c === null && (y === null || y === 1 || y === -1))
|
|
418
|
+
return !0;
|
|
419
|
+
throw Error(Z + "Invalid BigNumber: " + s);
|
|
420
|
+
}, v.maximum = v.max = function() {
|
|
421
|
+
return $(arguments, -1);
|
|
422
|
+
}, v.minimum = v.min = function() {
|
|
423
|
+
return $(arguments, 1);
|
|
424
|
+
}, v.random = function() {
|
|
425
|
+
var s = 9007199254740992, o = Math.random() * s & 2097151 ? function() {
|
|
426
|
+
return j(Math.random() * s);
|
|
427
|
+
} : function() {
|
|
428
|
+
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
429
|
+
};
|
|
430
|
+
return function(l) {
|
|
431
|
+
var m, c, y, w, f, g = 0, x = [], d = new v(u);
|
|
432
|
+
if (l == null ? l = a : F(l, 0, Y), w = Be(l / R), M)
|
|
433
|
+
if (crypto.getRandomValues) {
|
|
434
|
+
for (m = crypto.getRandomValues(new Uint32Array(w *= 2)); g < w; )
|
|
435
|
+
f = m[g] * 131072 + (m[g + 1] >>> 11), f >= 9e15 ? (c = crypto.getRandomValues(new Uint32Array(2)), m[g] = c[0], m[g + 1] = c[1]) : (x.push(f % 1e14), g += 2);
|
|
436
|
+
g = w / 2;
|
|
437
|
+
} else if (crypto.randomBytes) {
|
|
438
|
+
for (m = crypto.randomBytes(w *= 7); g < w; )
|
|
439
|
+
f = (m[g] & 31) * 281474976710656 + m[g + 1] * 1099511627776 + m[g + 2] * 4294967296 + m[g + 3] * 16777216 + (m[g + 4] << 16) + (m[g + 5] << 8) + m[g + 6], f >= 9e15 ? crypto.randomBytes(7).copy(m, g) : (x.push(f % 1e14), g += 7);
|
|
440
|
+
g = w / 7;
|
|
441
|
+
} else
|
|
442
|
+
throw M = !1, Error(Z + "crypto unavailable");
|
|
443
|
+
if (!M)
|
|
444
|
+
for (; g < w; )
|
|
445
|
+
f = o(), f < 9e15 && (x[g++] = f % 1e14);
|
|
446
|
+
for (w = x[--g], l %= R, w && l && (f = Ge[R - l], x[g] = j(w / f) * f); x[g] === 0; x.pop(), g--) ;
|
|
447
|
+
if (g < 0)
|
|
448
|
+
x = [y = 0];
|
|
449
|
+
else {
|
|
450
|
+
for (y = -1; x[0] === 0; x.splice(0, 1), y -= R) ;
|
|
451
|
+
for (g = 1, f = x[0]; f >= 10; f /= 10, g++) ;
|
|
452
|
+
g < R && (y -= R - g);
|
|
464
453
|
}
|
|
465
|
-
return
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
454
|
+
return d.e = y, d.c = x, d;
|
|
455
|
+
};
|
|
456
|
+
}(), v.sum = function() {
|
|
457
|
+
for (var s = 1, o = arguments, l = new v(o[0]); s < o.length; ) l = l.plus(o[s++]);
|
|
458
|
+
return l;
|
|
459
|
+
}, n = /* @__PURE__ */ function() {
|
|
460
|
+
var s = "0123456789";
|
|
461
|
+
function o(l, m, c, y) {
|
|
462
|
+
for (var w, f = [0], g, x = 0, d = l.length; x < d; ) {
|
|
463
|
+
for (g = f.length; g--; f[g] *= m) ;
|
|
464
|
+
for (f[0] += y.indexOf(l.charAt(x++)), w = 0; w < f.length; w++)
|
|
465
|
+
f[w] > c - 1 && (f[w + 1] == null && (f[w + 1] = 0), f[w + 1] += f[w] / c | 0, f[w] %= c);
|
|
474
466
|
}
|
|
475
|
-
return
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
467
|
+
return f.reverse();
|
|
468
|
+
}
|
|
469
|
+
return function(l, m, c, y, w) {
|
|
470
|
+
var f, g, x, d, S, P, O, k, D = l.indexOf("."), U = a, A = h;
|
|
471
|
+
for (D >= 0 && (d = L, L = 0, l = l.replace(".", ""), k = new v(m), P = k.pow(l.length - D), L = d, k.c = o(
|
|
472
|
+
se(H(P.c), P.e, "0"),
|
|
473
|
+
10,
|
|
474
|
+
c,
|
|
475
|
+
s
|
|
476
|
+
), k.e = k.c.length), O = o(l, m, c, w ? (f = q, s) : (f = s, q)), x = d = O.length; O[--d] == 0; O.pop()) ;
|
|
477
|
+
if (!O[0]) return f.charAt(0);
|
|
478
|
+
if (D < 0 ? --x : (P.c = O, P.e = x, P.s = y, P = e(P, k, U, A, c), O = P.c, S = P.r, x = P.e), g = x + U + 1, D = O[g], d = c / 2, S = S || g < 0 || O[g + 1] != null, S = A < 4 ? (D != null || S) && (A == 0 || A == (P.s < 0 ? 3 : 2)) : D > d || D == d && (A == 4 || S || A == 6 && O[g - 1] & 1 || A == (P.s < 0 ? 8 : 7)), g < 1 || !O[0])
|
|
479
|
+
l = S ? se(f.charAt(1), -U, f.charAt(0)) : f.charAt(0);
|
|
480
|
+
else {
|
|
481
|
+
if (O.length = g, S)
|
|
482
|
+
for (--c; ++O[--g] > c; )
|
|
483
|
+
O[g] = 0, g || (++x, O = [1].concat(O));
|
|
484
|
+
for (d = O.length; !O[--d]; ) ;
|
|
485
|
+
for (D = 0, l = ""; D <= d; l += f.charAt(O[D++])) ;
|
|
486
|
+
l = se(l, x, f.charAt(0));
|
|
487
|
+
}
|
|
488
|
+
return l;
|
|
489
|
+
};
|
|
490
|
+
}(), e = /* @__PURE__ */ function() {
|
|
491
|
+
function s(m, c, y) {
|
|
492
|
+
var w, f, g, x, d = 0, S = m.length, P = c % le, O = c / le | 0;
|
|
493
|
+
for (m = m.slice(); S--; )
|
|
494
|
+
g = m[S] % le, x = m[S] / le | 0, w = O * g + x * P, f = P * g + w % le * le + d, d = (f / y | 0) + (w / le | 0) + O * x, m[S] = f % y;
|
|
495
|
+
return d && (m = [d].concat(m)), m;
|
|
496
|
+
}
|
|
497
|
+
function o(m, c, y, w) {
|
|
498
|
+
var f, g;
|
|
499
|
+
if (y != w)
|
|
500
|
+
g = y > w ? 1 : -1;
|
|
501
|
+
else
|
|
502
|
+
for (f = g = 0; f < y; f++)
|
|
503
|
+
if (m[f] != c[f]) {
|
|
504
|
+
g = m[f] > c[f] ? 1 : -1;
|
|
486
505
|
break;
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
i++, e = e.right;
|
|
526
|
-
} else
|
|
527
|
-
n = !0;
|
|
528
|
-
return null;
|
|
529
|
-
}, r.prototype.next = function(t) {
|
|
530
|
-
var e = this._root, n = null;
|
|
531
|
-
if (t.right) {
|
|
532
|
-
for (n = t.right; n.left; )
|
|
533
|
-
n = n.left;
|
|
534
|
-
return n;
|
|
506
|
+
}
|
|
507
|
+
return g;
|
|
508
|
+
}
|
|
509
|
+
function l(m, c, y, w) {
|
|
510
|
+
for (var f = 0; y--; )
|
|
511
|
+
m[y] -= f, f = m[y] < c[y] ? 1 : 0, m[y] = f * w + m[y] - c[y];
|
|
512
|
+
for (; !m[0] && m.length > 1; m.splice(0, 1)) ;
|
|
513
|
+
}
|
|
514
|
+
return function(m, c, y, w, f) {
|
|
515
|
+
var g, x, d, S, P, O, k, D, U, A, G, V, be, Ie, ke, te, ge, J = m.s == c.s ? 1 : -1, X = m.c, z = c.c;
|
|
516
|
+
if (!X || !X[0] || !z || !z[0])
|
|
517
|
+
return new v(
|
|
518
|
+
// Return NaN if either NaN, or both Infinity or 0.
|
|
519
|
+
!m.s || !c.s || (X ? z && X[0] == z[0] : !z) ? NaN : (
|
|
520
|
+
// Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
|
|
521
|
+
X && X[0] == 0 || !z ? J * 0 : J / 0
|
|
522
|
+
)
|
|
523
|
+
);
|
|
524
|
+
for (D = new v(J), U = D.c = [], x = m.e - c.e, J = y + x + 1, f || (f = ee, x = Q(m.e / R) - Q(c.e / R), J = J / R | 0), d = 0; z[d] == (X[d] || 0); d++) ;
|
|
525
|
+
if (z[d] > (X[d] || 0) && x--, J < 0)
|
|
526
|
+
U.push(1), S = !0;
|
|
527
|
+
else {
|
|
528
|
+
for (Ie = X.length, te = z.length, d = 0, J += 2, P = j(f / (z[0] + 1)), P > 1 && (z = s(z, P, f), X = s(X, P, f), te = z.length, Ie = X.length), be = te, A = X.slice(0, te), G = A.length; G < te; A[G++] = 0) ;
|
|
529
|
+
ge = z.slice(), ge = [0].concat(ge), ke = z[0], z[1] >= f / 2 && ke++;
|
|
530
|
+
do {
|
|
531
|
+
if (P = 0, g = o(z, A, te, G), g < 0) {
|
|
532
|
+
if (V = A[0], te != G && (V = V * f + (A[1] || 0)), P = j(V / ke), P > 1)
|
|
533
|
+
for (P >= f && (P = f - 1), O = s(z, P, f), k = O.length, G = A.length; o(O, A, k, G) == 1; )
|
|
534
|
+
P--, l(O, te < k ? ge : z, k, f), k = O.length, g = 1;
|
|
535
|
+
else
|
|
536
|
+
P == 0 && (g = P = 1), O = z.slice(), k = O.length;
|
|
537
|
+
if (k < G && (O = [0].concat(O)), l(A, O, G, f), G = A.length, g == -1)
|
|
538
|
+
for (; o(z, A, te, G) < 1; )
|
|
539
|
+
P++, l(A, te < G ? ge : z, G, f), G = A.length;
|
|
540
|
+
} else g === 0 && (P++, A = [0]);
|
|
541
|
+
U[d++] = P, A[0] ? A[G++] = X[be] || 0 : (A = [X[be]], G = 1);
|
|
542
|
+
} while ((be++ < Ie || A[0] != null) && J--);
|
|
543
|
+
S = A[0] != null, U[0] || U.splice(0, 1);
|
|
535
544
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
545
|
+
if (f == ee) {
|
|
546
|
+
for (d = 1, J = U[0]; J >= 10; J /= 10, d++) ;
|
|
547
|
+
W(D, y + (D.e = d + x * R - 1) + 1, w, S);
|
|
548
|
+
} else
|
|
549
|
+
D.e = x, D.r = +S;
|
|
550
|
+
return D;
|
|
551
|
+
};
|
|
552
|
+
}();
|
|
553
|
+
function N(s, o, l, m) {
|
|
554
|
+
var c, y, w, f, g;
|
|
555
|
+
if (l == null ? l = h : F(l, 0, 8), !s.c) return s.toString();
|
|
556
|
+
if (c = s.c[0], w = s.e, o == null)
|
|
557
|
+
g = H(s.c), g = m == 1 || m == 2 && (w <= E || w >= p) ? Te(g, w) : se(g, w, "0");
|
|
558
|
+
else if (s = W(new v(s), o, l), y = s.e, g = H(s.c), f = g.length, m == 1 || m == 2 && (o <= y || y <= E)) {
|
|
559
|
+
for (; f < o; g += "0", f++) ;
|
|
560
|
+
g = Te(g, y);
|
|
561
|
+
} else if (o -= w, g = se(g, y, "0"), y + 1 > f) {
|
|
562
|
+
if (--o > 0) for (g += "."; o--; g += "0") ;
|
|
563
|
+
} else if (o += y - f, o > 0)
|
|
564
|
+
for (y + 1 == f && (g += "."); o--; g += "0") ;
|
|
565
|
+
return s.s < 0 && c ? "-" + g : g;
|
|
566
|
+
}
|
|
567
|
+
function $(s, o) {
|
|
568
|
+
for (var l, m, c = 1, y = new v(s[0]); c < s.length; c++)
|
|
569
|
+
m = new v(s[c]), (!m.s || (l = fe(y, m)) === o || l === 0 && y.s === o) && (y = m);
|
|
570
|
+
return y;
|
|
571
|
+
}
|
|
572
|
+
function K(s, o, l) {
|
|
573
|
+
for (var m = 1, c = o.length; !o[--c]; o.pop()) ;
|
|
574
|
+
for (c = o[0]; c >= 10; c /= 10, m++) ;
|
|
575
|
+
return (l = m + l * R - 1) > b ? s.c = s.e = null : l < _ ? s.c = [s.e = 0] : (s.e = l, s.c = o), s;
|
|
576
|
+
}
|
|
577
|
+
i = /* @__PURE__ */ function() {
|
|
578
|
+
var s = /^(-?)0([xbo])(?=\w[\w.]*$)/i, o = /^([^.]+)\.$/, l = /^\.([^.]+)$/, m = /^-?(Infinity|NaN)$/, c = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
|
|
579
|
+
return function(y, w, f, g) {
|
|
580
|
+
var x, d = f ? w : w.replace(c, "");
|
|
581
|
+
if (m.test(d))
|
|
582
|
+
y.s = isNaN(d) ? null : d < 0 ? -1 : 1;
|
|
583
|
+
else {
|
|
584
|
+
if (!f && (d = d.replace(s, function(S, P, O) {
|
|
585
|
+
return x = (O = O.toLowerCase()) == "x" ? 16 : O == "b" ? 2 : 8, !g || g == x ? P : S;
|
|
586
|
+
}), g && (x = g, d = d.replace(o, "$1").replace(l, "0.$1")), w != d))
|
|
587
|
+
return new v(d, x);
|
|
588
|
+
if (v.DEBUG)
|
|
589
|
+
throw Error(Z + "Not a" + (g ? " base " + g : "") + " number: " + w);
|
|
590
|
+
y.s = null;
|
|
541
591
|
}
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
592
|
+
y.c = y.e = null;
|
|
593
|
+
};
|
|
594
|
+
}();
|
|
595
|
+
function W(s, o, l, m) {
|
|
596
|
+
var c, y, w, f, g, x, d, S = s.c, P = Ge;
|
|
597
|
+
if (S) {
|
|
598
|
+
e: {
|
|
599
|
+
for (c = 1, f = S[0]; f >= 10; f /= 10, c++) ;
|
|
600
|
+
if (y = o - c, y < 0)
|
|
601
|
+
y += R, w = o, g = S[x = 0], d = j(g / P[c - w - 1] % 10);
|
|
602
|
+
else if (x = Be((y + 1) / R), x >= S.length)
|
|
603
|
+
if (m) {
|
|
604
|
+
for (; S.length <= x; S.push(0)) ;
|
|
605
|
+
g = d = 0, c = 1, y %= R, w = y - R + 1;
|
|
606
|
+
} else
|
|
607
|
+
break e;
|
|
608
|
+
else {
|
|
609
|
+
for (g = f = S[x], c = 1; f >= 10; f /= 10, c++) ;
|
|
610
|
+
y %= R, w = y - R + c, d = w < 0 ? 0 : j(g / P[c - w - 1] % 10);
|
|
611
|
+
}
|
|
612
|
+
if (m = m || o < 0 || // Are there any non-zero digits after the rounding digit?
|
|
613
|
+
// The expression n % pows10[d - j - 1] returns all digits of n to the right
|
|
614
|
+
// of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
|
|
615
|
+
S[x + 1] != null || (w < 0 ? g : g % P[c - w - 1]), m = l < 4 ? (d || m) && (l == 0 || l == (s.s < 0 ? 3 : 2)) : d > 5 || d == 5 && (l == 4 || m || l == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
616
|
+
(y > 0 ? w > 0 ? g / P[c - w] : 0 : S[x - 1]) % 10 & 1 || l == (s.s < 0 ? 8 : 7)), o < 1 || !S[0])
|
|
617
|
+
return S.length = 0, m ? (o -= s.e + 1, S[0] = P[(R - o % R) % R], s.e = -o || 0) : S[0] = s.e = 0, s;
|
|
618
|
+
if (y == 0 ? (S.length = x, f = 1, x--) : (S.length = x + 1, f = P[R - y], S[x] = w > 0 ? j(g / P[c - w] % P[w]) * f : 0), m)
|
|
619
|
+
for (; ; )
|
|
620
|
+
if (x == 0) {
|
|
621
|
+
for (y = 1, w = S[0]; w >= 10; w /= 10, y++) ;
|
|
622
|
+
for (w = S[0] += f, f = 1; w >= 10; w /= 10, f++) ;
|
|
623
|
+
y != f && (s.e++, S[0] == ee && (S[0] = 1));
|
|
624
|
+
break;
|
|
625
|
+
} else {
|
|
626
|
+
if (S[x] += f, S[x] != ee) break;
|
|
627
|
+
S[x--] = 0, f = 1;
|
|
628
|
+
}
|
|
629
|
+
for (y = S.length; S[--y] === 0; S.pop()) ;
|
|
549
630
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
631
|
+
s.e > b ? s.c = s.e = null : s.e < _ && (s.c = [s.e = 0]);
|
|
632
|
+
}
|
|
633
|
+
return s;
|
|
634
|
+
}
|
|
635
|
+
function re(s) {
|
|
636
|
+
var o, l = s.e;
|
|
637
|
+
return l === null ? s.toString() : (o = H(s.c), o = l <= E || l >= p ? Te(o, l) : se(o, l, "0"), s.s < 0 ? "-" + o : o);
|
|
638
|
+
}
|
|
639
|
+
return r.absoluteValue = r.abs = function() {
|
|
640
|
+
var s = new v(this);
|
|
641
|
+
return s.s < 0 && (s.s = 1), s;
|
|
642
|
+
}, r.comparedTo = function(s, o) {
|
|
643
|
+
return fe(this, new v(s, o));
|
|
644
|
+
}, r.decimalPlaces = r.dp = function(s, o) {
|
|
645
|
+
var l, m, c, y = this;
|
|
646
|
+
if (s != null)
|
|
647
|
+
return F(s, 0, Y), o == null ? o = h : F(o, 0, 8), W(new v(y), s + y.e + 1, o);
|
|
648
|
+
if (!(l = y.c)) return null;
|
|
649
|
+
if (m = ((c = l.length - 1) - Q(this.e / R)) * R, c = l[c]) for (; c % 10 == 0; c /= 10, m--) ;
|
|
650
|
+
return m < 0 && (m = 0), m;
|
|
651
|
+
}, r.dividedBy = r.div = function(s, o) {
|
|
652
|
+
return e(this, new v(s, o), a, h);
|
|
653
|
+
}, r.dividedToIntegerBy = r.idiv = function(s, o) {
|
|
654
|
+
return e(this, new v(s, o), 0, 1);
|
|
655
|
+
}, r.exponentiatedBy = r.pow = function(s, o) {
|
|
656
|
+
var l, m, c, y, w, f, g, x, d, S = this;
|
|
657
|
+
if (s = new v(s), s.c && !s.isInteger())
|
|
658
|
+
throw Error(Z + "Exponent not an integer: " + re(s));
|
|
659
|
+
if (o != null && (o = new v(o)), f = s.e > 14, !S.c || !S.c[0] || S.c[0] == 1 && !S.e && S.c.length == 1 || !s.c || !s.c[0])
|
|
660
|
+
return d = new v(Math.pow(+re(S), f ? s.s * (2 - _e(s)) : +re(s))), o ? d.mod(o) : d;
|
|
661
|
+
if (g = s.s < 0, o) {
|
|
662
|
+
if (o.c ? !o.c[0] : !o.s) return new v(NaN);
|
|
663
|
+
m = !g && S.isInteger() && o.isInteger(), m && (S = S.mod(o));
|
|
664
|
+
} else {
|
|
665
|
+
if (s.e > 9 && (S.e > 0 || S.e < -1 || (S.e == 0 ? S.c[0] > 1 || f && S.c[1] >= 24e7 : S.c[0] < 8e13 || f && S.c[0] <= 9999975e7)))
|
|
666
|
+
return y = S.s < 0 && _e(s) ? -0 : 0, S.e > -1 && (y = 1 / y), new v(g ? 1 / y : y);
|
|
667
|
+
L && (y = Be(L / R + 2));
|
|
668
|
+
}
|
|
669
|
+
for (f ? (l = new v(0.5), g && (s.s = 1), x = _e(s)) : (c = Math.abs(+re(s)), x = c % 2), d = new v(u); ; ) {
|
|
670
|
+
if (x) {
|
|
671
|
+
if (d = d.times(S), !d.c) break;
|
|
672
|
+
y ? d.c.length > y && (d.c.length = y) : m && (d = d.mod(o));
|
|
555
673
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}, r.prototype.load = function(t, e, n) {
|
|
562
|
-
e === void 0 && (e = []), n === void 0 && (n = !1);
|
|
563
|
-
var i = t.length, o = this._comparator;
|
|
564
|
-
if (n && at(t, e, 0, i - 1, o), this._root === null)
|
|
565
|
-
this._root = ct(t, e, 0, i), this._size = i;
|
|
674
|
+
if (c) {
|
|
675
|
+
if (c = j(c / 2), c === 0) break;
|
|
676
|
+
x = c % 2;
|
|
677
|
+
} else if (s = s.times(l), W(s, s.e + 1, 1), s.e > 14)
|
|
678
|
+
x = _e(s);
|
|
566
679
|
else {
|
|
567
|
-
|
|
568
|
-
|
|
680
|
+
if (c = +re(s), c === 0) break;
|
|
681
|
+
x = c % 2;
|
|
569
682
|
}
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
683
|
+
S = S.times(S), y ? S.c && S.c.length > y && (S.c.length = y) : m && (S = S.mod(o));
|
|
684
|
+
}
|
|
685
|
+
return m ? d : (g && (d = u.div(d)), o ? d.mod(o) : y ? W(d, L, h, w) : d);
|
|
686
|
+
}, r.integerValue = function(s) {
|
|
687
|
+
var o = new v(this);
|
|
688
|
+
return s == null ? s = h : F(s, 0, 8), W(o, o.e + 1, s);
|
|
689
|
+
}, r.isEqualTo = r.eq = function(s, o) {
|
|
690
|
+
return fe(this, new v(s, o)) === 0;
|
|
691
|
+
}, r.isFinite = function() {
|
|
692
|
+
return !!this.c;
|
|
693
|
+
}, r.isGreaterThan = r.gt = function(s, o) {
|
|
694
|
+
return fe(this, new v(s, o)) > 0;
|
|
695
|
+
}, r.isGreaterThanOrEqualTo = r.gte = function(s, o) {
|
|
696
|
+
return (o = fe(this, new v(s, o))) === 1 || o === 0;
|
|
697
|
+
}, r.isInteger = function() {
|
|
698
|
+
return !!this.c && Q(this.e / R) > this.c.length - 2;
|
|
699
|
+
}, r.isLessThan = r.lt = function(s, o) {
|
|
700
|
+
return fe(this, new v(s, o)) < 0;
|
|
701
|
+
}, r.isLessThanOrEqualTo = r.lte = function(s, o) {
|
|
702
|
+
return (o = fe(this, new v(s, o))) === -1 || o === 0;
|
|
703
|
+
}, r.isNaN = function() {
|
|
704
|
+
return !this.s;
|
|
705
|
+
}, r.isNegative = function() {
|
|
706
|
+
return this.s < 0;
|
|
707
|
+
}, r.isPositive = function() {
|
|
708
|
+
return this.s > 0;
|
|
709
|
+
}, r.isZero = function() {
|
|
710
|
+
return !!this.c && this.c[0] == 0;
|
|
711
|
+
}, r.minus = function(s, o) {
|
|
712
|
+
var l, m, c, y, w = this, f = w.s;
|
|
713
|
+
if (s = new v(s, o), o = s.s, !f || !o) return new v(NaN);
|
|
714
|
+
if (f != o)
|
|
715
|
+
return s.s = -o, w.plus(s);
|
|
716
|
+
var g = w.e / R, x = s.e / R, d = w.c, S = s.c;
|
|
717
|
+
if (!g || !x) {
|
|
718
|
+
if (!d || !S) return d ? (s.s = -o, s) : new v(S ? w : NaN);
|
|
719
|
+
if (!d[0] || !S[0])
|
|
720
|
+
return S[0] ? (s.s = -o, s) : new v(d[0] ? w : (
|
|
721
|
+
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
722
|
+
h == 3 ? -0 : 0
|
|
723
|
+
));
|
|
724
|
+
}
|
|
725
|
+
if (g = Q(g), x = Q(x), d = d.slice(), f = g - x) {
|
|
726
|
+
for ((y = f < 0) ? (f = -f, c = d) : (x = g, c = S), c.reverse(), o = f; o--; c.push(0)) ;
|
|
727
|
+
c.reverse();
|
|
728
|
+
} else
|
|
729
|
+
for (m = (y = (f = d.length) < (o = S.length)) ? f : o, f = o = 0; o < m; o++)
|
|
730
|
+
if (d[o] != S[o]) {
|
|
731
|
+
y = d[o] < S[o];
|
|
732
|
+
break;
|
|
619
733
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
);
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
var
|
|
646
|
-
return
|
|
734
|
+
if (y && (c = d, d = S, S = c, s.s = -s.s), o = (m = S.length) - (l = d.length), o > 0) for (; o--; d[l++] = 0) ;
|
|
735
|
+
for (o = ee - 1; m > f; ) {
|
|
736
|
+
if (d[--m] < S[m]) {
|
|
737
|
+
for (l = m; l && !d[--l]; d[l] = o) ;
|
|
738
|
+
--d[l], d[m] += ee;
|
|
739
|
+
}
|
|
740
|
+
d[m] -= S[m];
|
|
741
|
+
}
|
|
742
|
+
for (; d[0] == 0; d.splice(0, 1), --x) ;
|
|
743
|
+
return d[0] ? K(s, d, x) : (s.s = h == 3 ? -1 : 1, s.c = [s.e = 0], s);
|
|
744
|
+
}, r.modulo = r.mod = function(s, o) {
|
|
745
|
+
var l, m, c = this;
|
|
746
|
+
return s = new v(s, o), !c.c || !s.s || s.c && !s.c[0] ? new v(NaN) : !s.c || c.c && !c.c[0] ? new v(c) : (T == 9 ? (m = s.s, s.s = 1, l = e(c, s, 0, 3), s.s = m, l.s *= m) : l = e(c, s, 0, T), s = c.minus(l.times(s)), !s.c[0] && T == 1 && (s.s = c.s), s);
|
|
747
|
+
}, r.multipliedBy = r.times = function(s, o) {
|
|
748
|
+
var l, m, c, y, w, f, g, x, d, S, P, O, k, D, U, A = this, G = A.c, V = (s = new v(s, o)).c;
|
|
749
|
+
if (!G || !V || !G[0] || !V[0])
|
|
750
|
+
return !A.s || !s.s || G && !G[0] && !V || V && !V[0] && !G ? s.c = s.e = s.s = null : (s.s *= A.s, !G || !V ? s.c = s.e = null : (s.c = [0], s.e = 0)), s;
|
|
751
|
+
for (m = Q(A.e / R) + Q(s.e / R), s.s *= A.s, g = G.length, S = V.length, g < S && (k = G, G = V, V = k, c = g, g = S, S = c), c = g + S, k = []; c--; k.push(0)) ;
|
|
752
|
+
for (D = ee, U = le, c = S; --c >= 0; ) {
|
|
753
|
+
for (l = 0, P = V[c] % U, O = V[c] / U | 0, w = g, y = c + w; y > c; )
|
|
754
|
+
x = G[--w] % U, d = G[w] / U | 0, f = O * x + d * P, x = P * x + f % U * U + k[y] + l, l = (x / D | 0) + (f / U | 0) + O * d, k[y--] = x % D;
|
|
755
|
+
k[y] = l;
|
|
756
|
+
}
|
|
757
|
+
return l ? ++m : k.splice(0, 1), K(s, k, m);
|
|
758
|
+
}, r.negated = function() {
|
|
759
|
+
var s = new v(this);
|
|
760
|
+
return s.s = -s.s || null, s;
|
|
761
|
+
}, r.plus = function(s, o) {
|
|
762
|
+
var l, m = this, c = m.s;
|
|
763
|
+
if (s = new v(s, o), o = s.s, !c || !o) return new v(NaN);
|
|
764
|
+
if (c != o)
|
|
765
|
+
return s.s = -o, m.minus(s);
|
|
766
|
+
var y = m.e / R, w = s.e / R, f = m.c, g = s.c;
|
|
767
|
+
if (!y || !w) {
|
|
768
|
+
if (!f || !g) return new v(c / 0);
|
|
769
|
+
if (!f[0] || !g[0]) return g[0] ? s : new v(f[0] ? m : c * 0);
|
|
770
|
+
}
|
|
771
|
+
if (y = Q(y), w = Q(w), f = f.slice(), c = y - w) {
|
|
772
|
+
for (c > 0 ? (w = y, l = g) : (c = -c, l = f), l.reverse(); c--; l.push(0)) ;
|
|
773
|
+
l.reverse();
|
|
774
|
+
}
|
|
775
|
+
for (c = f.length, o = g.length, c - o < 0 && (l = g, g = f, f = l, o = c), c = 0; o; )
|
|
776
|
+
c = (f[--o] = f[o] + g[o] + c) / ee | 0, f[o] = ee === f[o] ? 0 : f[o] % ee;
|
|
777
|
+
return c && (f = [c].concat(f), ++w), K(s, f, w);
|
|
778
|
+
}, r.precision = r.sd = function(s, o) {
|
|
779
|
+
var l, m, c, y = this;
|
|
780
|
+
if (s != null && s !== !!s)
|
|
781
|
+
return F(s, 1, Y), o == null ? o = h : F(o, 0, 8), W(new v(y), s, o);
|
|
782
|
+
if (!(l = y.c)) return null;
|
|
783
|
+
if (c = l.length - 1, m = c * R + 1, c = l[c]) {
|
|
784
|
+
for (; c % 10 == 0; c /= 10, m--) ;
|
|
785
|
+
for (c = l[0]; c >= 10; c /= 10, m++) ;
|
|
786
|
+
}
|
|
787
|
+
return s && y.e + 1 > m && (m = y.e + 1), m;
|
|
788
|
+
}, r.shiftedBy = function(s) {
|
|
789
|
+
return F(s, -9007199254740991, je), this.times("1e" + s);
|
|
790
|
+
}, r.squareRoot = r.sqrt = function() {
|
|
791
|
+
var s, o, l, m, c, y = this, w = y.c, f = y.s, g = y.e, x = a + 4, d = new v("0.5");
|
|
792
|
+
if (f !== 1 || !w || !w[0])
|
|
793
|
+
return new v(!f || f < 0 && (!w || w[0]) ? NaN : w ? y : 1 / 0);
|
|
794
|
+
if (f = Math.sqrt(+re(y)), f == 0 || f == 1 / 0 ? (o = H(w), (o.length + g) % 2 == 0 && (o += "0"), f = Math.sqrt(+o), g = Q((g + 1) / 2) - (g < 0 || g % 2), f == 1 / 0 ? o = "5e" + g : (o = f.toExponential(), o = o.slice(0, o.indexOf("e") + 1) + g), l = new v(o)) : l = new v(f + ""), l.c[0]) {
|
|
795
|
+
for (g = l.e, f = g + x, f < 3 && (f = 0); ; )
|
|
796
|
+
if (c = l, l = d.times(c.plus(e(y, c, x, 1))), H(c.c).slice(0, f) === (o = H(l.c)).slice(0, f))
|
|
797
|
+
if (l.e < g && --f, o = o.slice(f - 3, f + 1), o == "9999" || !m && o == "4999") {
|
|
798
|
+
if (!m && (W(c, c.e + a + 2, 0), c.times(c).eq(y))) {
|
|
799
|
+
l = c;
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
802
|
+
x += 4, f += 4, m = 1;
|
|
803
|
+
} else {
|
|
804
|
+
(!+o || !+o.slice(1) && o.charAt(0) == "5") && (W(l, l.e + a + 2, 1), s = !l.times(l).eq(y));
|
|
805
|
+
break;
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
return W(l, l.e + a + 1, h, s);
|
|
809
|
+
}, r.toExponential = function(s, o) {
|
|
810
|
+
return s != null && (F(s, 0, Y), s++), N(this, s, o, 1);
|
|
811
|
+
}, r.toFixed = function(s, o) {
|
|
812
|
+
return s != null && (F(s, 0, Y), s = s + this.e + 1), N(this, s, o);
|
|
813
|
+
}, r.toFormat = function(s, o, l) {
|
|
814
|
+
var m, c = this;
|
|
815
|
+
if (l == null)
|
|
816
|
+
s != null && o && typeof o == "object" ? (l = o, o = null) : s && typeof s == "object" ? (l = s, s = o = null) : l = B;
|
|
817
|
+
else if (typeof l != "object")
|
|
818
|
+
throw Error(Z + "Argument not an object: " + l);
|
|
819
|
+
if (m = c.toFixed(s, o), c.c) {
|
|
820
|
+
var y, w = m.split("."), f = +l.groupSize, g = +l.secondaryGroupSize, x = l.groupSeparator || "", d = w[0], S = w[1], P = c.s < 0, O = P ? d.slice(1) : d, k = O.length;
|
|
821
|
+
if (g && (y = f, f = g, g = y, k -= y), f > 0 && k > 0) {
|
|
822
|
+
for (y = k % f || f, d = O.substr(0, y); y < k; y += f) d += x + O.substr(y, f);
|
|
823
|
+
g > 0 && (d += x + O.slice(y)), P && (d = "-" + d);
|
|
824
|
+
}
|
|
825
|
+
m = S ? d + (l.decimalSeparator || "") + ((g = +l.fractionGroupSize) ? S.replace(
|
|
826
|
+
new RegExp("\\d{" + g + "}\\B", "g"),
|
|
827
|
+
"$&" + (l.fractionGroupSeparator || "")
|
|
828
|
+
) : S) : d;
|
|
829
|
+
}
|
|
830
|
+
return (l.prefix || "") + m + (l.suffix || "");
|
|
831
|
+
}, r.toFraction = function(s) {
|
|
832
|
+
var o, l, m, c, y, w, f, g, x, d, S, P, O = this, k = O.c;
|
|
833
|
+
if (s != null && (f = new v(s), !f.isInteger() && (f.c || f.s !== 1) || f.lt(u)))
|
|
834
|
+
throw Error(Z + "Argument " + (f.isInteger() ? "out of range: " : "not an integer: ") + re(f));
|
|
835
|
+
if (!k) return new v(O);
|
|
836
|
+
for (o = new v(u), x = l = new v(u), m = g = new v(u), P = H(k), y = o.e = P.length - O.e - 1, o.c[0] = Ge[(w = y % R) < 0 ? R + w : w], s = !s || f.comparedTo(o) > 0 ? y > 0 ? o : x : f, w = b, b = 1 / 0, f = new v(P), g.c[0] = 0; d = e(f, o, 0, 1), c = l.plus(d.times(m)), c.comparedTo(s) != 1; )
|
|
837
|
+
l = m, m = c, x = g.plus(d.times(c = x)), g = c, o = f.minus(d.times(c = o)), f = c;
|
|
838
|
+
return c = e(s.minus(l), m, 0, 1), g = g.plus(c.times(x)), l = l.plus(c.times(m)), g.s = x.s = O.s, y = y * 2, S = e(x, m, y, h).minus(O).abs().comparedTo(
|
|
839
|
+
e(g, l, y, h).minus(O).abs()
|
|
840
|
+
) < 1 ? [x, m] : [g, l], b = w, S;
|
|
841
|
+
}, r.toNumber = function() {
|
|
842
|
+
return +re(this);
|
|
843
|
+
}, r.toPrecision = function(s, o) {
|
|
844
|
+
return s != null && F(s, 1, Y), N(this, s, o, 2);
|
|
845
|
+
}, r.toString = function(s) {
|
|
846
|
+
var o, l = this, m = l.s, c = l.e;
|
|
847
|
+
return c === null ? m ? (o = "Infinity", m < 0 && (o = "-" + o)) : o = "NaN" : (s == null ? o = c <= E || c >= p ? Te(H(l.c), c) : se(H(l.c), c, "0") : s === 10 && I ? (l = W(new v(l), a + c + 1, h), o = se(H(l.c), l.e, "0")) : (F(s, 2, q.length, "Base"), o = n(se(H(l.c), c, "0"), 10, s, m, !0)), m < 0 && l.c[0] && (o = "-" + o)), o;
|
|
848
|
+
}, r.valueOf = r.toJSON = function() {
|
|
849
|
+
return re(this);
|
|
850
|
+
}, r._isBigNumber = !0, r[Symbol.toStringTag] = "BigNumber", r[Symbol.for("nodejs.util.inspect.custom")] = r.valueOf, t != null && v.set(t), v;
|
|
851
|
+
}
|
|
852
|
+
function Q(t) {
|
|
853
|
+
var e = t | 0;
|
|
854
|
+
return t > 0 || t === e ? e : e - 1;
|
|
855
|
+
}
|
|
856
|
+
function H(t) {
|
|
857
|
+
for (var e, n, i = 1, r = t.length, u = t[0] + ""; i < r; ) {
|
|
858
|
+
for (e = t[i++] + "", n = R - e.length; n--; e = "0" + e) ;
|
|
859
|
+
u += e;
|
|
860
|
+
}
|
|
861
|
+
for (r = u.length; u.charCodeAt(--r) === 48; ) ;
|
|
862
|
+
return u.slice(0, r + 1 || 1);
|
|
863
|
+
}
|
|
864
|
+
function fe(t, e) {
|
|
865
|
+
var n, i, r = t.c, u = e.c, a = t.s, h = e.s, E = t.e, p = e.e;
|
|
866
|
+
if (!a || !h) return null;
|
|
867
|
+
if (n = r && !r[0], i = u && !u[0], n || i) return n ? i ? 0 : -h : a;
|
|
868
|
+
if (a != h) return a;
|
|
869
|
+
if (n = a < 0, i = E == p, !r || !u) return i ? 0 : !r ^ n ? 1 : -1;
|
|
870
|
+
if (!i) return E > p ^ n ? 1 : -1;
|
|
871
|
+
for (h = (E = r.length) < (p = u.length) ? E : p, a = 0; a < h; a++) if (r[a] != u[a]) return r[a] > u[a] ^ n ? 1 : -1;
|
|
872
|
+
return E == p ? 0 : E > p ^ n ? 1 : -1;
|
|
873
|
+
}
|
|
874
|
+
function F(t, e, n, i) {
|
|
875
|
+
if (t < e || t > n || t !== j(t))
|
|
876
|
+
throw Error(Z + (i || "Argument") + (typeof t == "number" ? t < e || t > n ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(t));
|
|
877
|
+
}
|
|
878
|
+
function _e(t) {
|
|
879
|
+
var e = t.c.length - 1;
|
|
880
|
+
return Q(t.e / R) == e && t.c[e] % 2 != 0;
|
|
881
|
+
}
|
|
882
|
+
function Te(t, e) {
|
|
883
|
+
return (t.length > 1 ? t.charAt(0) + "." + t.slice(1) : t) + (e < 0 ? "e" : "e+") + e;
|
|
884
|
+
}
|
|
885
|
+
function se(t, e, n) {
|
|
886
|
+
var i, r;
|
|
887
|
+
if (e < 0) {
|
|
888
|
+
for (r = n + "."; ++e; r += n) ;
|
|
889
|
+
t = r + t;
|
|
890
|
+
} else if (i = t.length, ++e > i) {
|
|
891
|
+
for (r = n, e -= i; --e; r += n) ;
|
|
892
|
+
t += r;
|
|
893
|
+
} else e < i && (t = t.slice(0, e) + "." + t.slice(e));
|
|
894
|
+
return t;
|
|
895
|
+
}
|
|
896
|
+
var ie = wt(), Gt = class {
|
|
897
|
+
constructor(t) {
|
|
898
|
+
C(this, "key");
|
|
899
|
+
C(this, "left", null);
|
|
900
|
+
C(this, "right", null);
|
|
901
|
+
this.key = t;
|
|
647
902
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
903
|
+
}, ye = class extends Gt {
|
|
904
|
+
constructor(t) {
|
|
905
|
+
super(t);
|
|
906
|
+
}
|
|
907
|
+
}, $t = class {
|
|
908
|
+
constructor() {
|
|
909
|
+
C(this, "size", 0);
|
|
910
|
+
C(this, "modificationCount", 0);
|
|
911
|
+
C(this, "splayCount", 0);
|
|
912
|
+
}
|
|
913
|
+
splay(t) {
|
|
914
|
+
const e = this.root;
|
|
915
|
+
if (e == null)
|
|
916
|
+
return this.compare(t, t), -1;
|
|
917
|
+
let n = null, i = null, r = null, u = null, a = e;
|
|
918
|
+
const h = this.compare;
|
|
919
|
+
let E;
|
|
920
|
+
for (; ; )
|
|
921
|
+
if (E = h(a.key, t), E > 0) {
|
|
922
|
+
let p = a.left;
|
|
923
|
+
if (p == null || (E = h(p.key, t), E > 0 && (a.left = p.right, p.right = a, a = p, p = a.left, p == null)))
|
|
924
|
+
break;
|
|
925
|
+
n == null ? i = a : n.left = a, n = a, a = p;
|
|
926
|
+
} else if (E < 0) {
|
|
927
|
+
let p = a.right;
|
|
928
|
+
if (p == null || (E = h(p.key, t), E < 0 && (a.right = p.left, p.left = a, a = p, p = a.right, p == null)))
|
|
929
|
+
break;
|
|
930
|
+
r == null ? u = a : r.right = a, r = a, a = p;
|
|
931
|
+
} else
|
|
665
932
|
break;
|
|
666
|
-
|
|
667
|
-
|
|
933
|
+
return r != null && (r.right = a.left, a.left = u), n != null && (n.left = a.right, a.right = i), this.root !== a && (this.root = a, this.splayCount++), E;
|
|
934
|
+
}
|
|
935
|
+
splayMin(t) {
|
|
936
|
+
let e = t, n = e.left;
|
|
937
|
+
for (; n != null; ) {
|
|
938
|
+
const i = n;
|
|
939
|
+
e.left = i.right, i.right = e, e = i, n = e.left;
|
|
668
940
|
}
|
|
669
|
-
|
|
941
|
+
return e;
|
|
670
942
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
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
|
-
}
|
|
686
|
-
function ve(r, t) {
|
|
687
|
-
let e = t[0];
|
|
688
|
-
for (let n = 1; n < r; n++) e += t[n];
|
|
689
|
-
return e;
|
|
690
|
-
}
|
|
691
|
-
function K(r) {
|
|
692
|
-
return new Float64Array(r);
|
|
693
|
-
}
|
|
694
|
-
const me = (3 + 16 * O) * O, we = (2 + 12 * O) * O, be = (9 + 64 * O) * O * O, q = K(4), _t = K(8), St = K(12), Pt = K(16), P = K(4);
|
|
695
|
-
function Ee(r, t, e, n, i, o, u) {
|
|
696
|
-
let l, c, f, p, s, a, h, g, d, w, y, v, x, m, b, E, 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, b = g * w - (m - h * d - g * d - h * w), E = 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 - (E - h * d - g * d - h * w), y = b - M, s = b - y, q[0] = b - (y + s) + (s - M), v = m + y, s = v - m, x = m - (v - s) + (y - s), y = x - E, s = x - y, q[1] = x - (y + s) + (s - E), _ = 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 = be * 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, b = g * w - (m - h * d - g * d - h * w), E = 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 - (E - h * d - g * d - h * w), y = b - M, s = b - y, P[0] = b - (y + s) + (s - M), v = m + y, s = v - m, x = m - (v - s) + (y - s), y = x - E, s = x - y, P[1] = x - (y + s) + (s - E), _ = v + y, s = _ - v, P[2] = v - (_ - s) + (y - s), P[3] = _;
|
|
702
|
-
const ee = st(4, q, 4, P, _t);
|
|
703
|
-
m = C * p, a = S * C, h = a - (a - C), g = C - h, a = S * p, d = a - (a - p), w = p - d, b = g * w - (m - h * d - g * d - h * w), E = 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 - (E - h * d - g * d - h * w), y = b - M, s = b - y, P[0] = b - (y + s) + (s - M), v = m + y, s = v - m, x = m - (v - s) + (y - s), y = x - E, s = x - y, P[1] = x - (y + s) + (s - E), _ = v + y, s = _ - v, P[2] = v - (_ - s) + (y - s), P[3] = _;
|
|
704
|
-
const ne = st(ee, _t, 4, P, St);
|
|
705
|
-
m = l * p, a = S * l, h = a - (a - l), g = l - h, a = S * p, d = a - (a - p), w = p - d, b = g * w - (m - h * d - g * d - h * w), E = 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 - (E - h * d - g * d - h * w), y = b - M, s = b - y, P[0] = b - (y + s) + (s - M), v = m + y, s = v - m, x = m - (v - s) + (y - s), y = x - E, s = x - y, P[1] = x - (y + s) + (s - E), _ = v + y, s = _ - v, P[2] = v - (_ - s) + (y - s), 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 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 : -Ee(r, t, e, n, i, o, f);
|
|
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, pt = (r, t) => {
|
|
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
|
-
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
|
-
return {
|
|
717
|
-
ll: {
|
|
718
|
-
x: e,
|
|
719
|
-
y: i
|
|
720
|
-
},
|
|
721
|
-
ur: {
|
|
722
|
-
x: n,
|
|
723
|
-
y: o
|
|
943
|
+
splayMax(t) {
|
|
944
|
+
let e = t, n = e.right;
|
|
945
|
+
for (; n != null; ) {
|
|
946
|
+
const i = n;
|
|
947
|
+
e.right = i.left, i.left = e, e = i, n = e.right;
|
|
724
948
|
}
|
|
725
|
-
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
this.
|
|
949
|
+
return e;
|
|
950
|
+
}
|
|
951
|
+
_delete(t) {
|
|
952
|
+
if (this.root == null || this.splay(t) != 0) return null;
|
|
953
|
+
let n = this.root;
|
|
954
|
+
const i = n, r = n.left;
|
|
955
|
+
if (this.size--, r == null)
|
|
956
|
+
this.root = n.right;
|
|
957
|
+
else {
|
|
958
|
+
const u = n.right;
|
|
959
|
+
n = this.splayMax(r), n.right = u, this.root = n;
|
|
960
|
+
}
|
|
961
|
+
return this.modificationCount++, i;
|
|
962
|
+
}
|
|
963
|
+
addNewRoot(t, e) {
|
|
964
|
+
this.size++, this.modificationCount++;
|
|
965
|
+
const n = this.root;
|
|
966
|
+
if (n == null) {
|
|
967
|
+
this.root = t;
|
|
968
|
+
return;
|
|
969
|
+
}
|
|
970
|
+
e < 0 ? (t.left = n, t.right = n.right, n.right = null) : (t.right = n, t.left = n.left, n.left = null), this.root = t;
|
|
971
|
+
}
|
|
972
|
+
_first() {
|
|
973
|
+
const t = this.root;
|
|
974
|
+
return t == null ? null : (this.root = this.splayMin(t), this.root);
|
|
975
|
+
}
|
|
976
|
+
_last() {
|
|
977
|
+
const t = this.root;
|
|
978
|
+
return t == null ? null : (this.root = this.splayMax(t), this.root);
|
|
979
|
+
}
|
|
980
|
+
clear() {
|
|
981
|
+
this.root = null, this.size = 0, this.modificationCount++;
|
|
982
|
+
}
|
|
983
|
+
has(t) {
|
|
984
|
+
return this.validKey(t) && this.splay(t) == 0;
|
|
738
985
|
}
|
|
739
|
-
|
|
740
|
-
|
|
986
|
+
defaultCompare() {
|
|
987
|
+
return (t, e) => t < e ? -1 : t > e ? 1 : 0;
|
|
741
988
|
}
|
|
742
|
-
|
|
989
|
+
wrap() {
|
|
743
990
|
return {
|
|
744
|
-
|
|
745
|
-
|
|
991
|
+
getRoot: () => this.root,
|
|
992
|
+
setRoot: (t) => {
|
|
993
|
+
this.root = t;
|
|
994
|
+
},
|
|
995
|
+
getSize: () => this.size,
|
|
996
|
+
getModificationCount: () => this.modificationCount,
|
|
997
|
+
getSplayCount: () => this.splayCount,
|
|
998
|
+
setSplayCount: (t) => {
|
|
999
|
+
this.splayCount = t;
|
|
1000
|
+
},
|
|
1001
|
+
splay: (t) => this.splay(t),
|
|
1002
|
+
has: (t) => this.has(t)
|
|
746
1003
|
};
|
|
747
1004
|
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
this
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
1005
|
+
}, ht, pt, Pe = class me extends $t {
|
|
1006
|
+
constructor(n, i) {
|
|
1007
|
+
super();
|
|
1008
|
+
C(this, "root", null);
|
|
1009
|
+
C(this, "compare");
|
|
1010
|
+
C(this, "validKey");
|
|
1011
|
+
C(this, ht, "[object Set]");
|
|
1012
|
+
this.compare = n ?? this.defaultCompare(), this.validKey = i ?? ((r) => r != null && r != null);
|
|
1013
|
+
}
|
|
1014
|
+
delete(n) {
|
|
1015
|
+
return this.validKey(n) ? this._delete(n) != null : !1;
|
|
1016
|
+
}
|
|
1017
|
+
deleteAll(n) {
|
|
1018
|
+
for (const i of n)
|
|
1019
|
+
this.delete(i);
|
|
1020
|
+
}
|
|
1021
|
+
forEach(n) {
|
|
1022
|
+
const i = this[Symbol.iterator]();
|
|
1023
|
+
let r;
|
|
1024
|
+
for (; r = i.next(), !r.done; )
|
|
1025
|
+
n(r.value, r.value, this);
|
|
1026
|
+
}
|
|
1027
|
+
add(n) {
|
|
1028
|
+
const i = this.splay(n);
|
|
1029
|
+
return i != 0 && this.addNewRoot(new ye(n), i), this;
|
|
1030
|
+
}
|
|
1031
|
+
addAndReturn(n) {
|
|
1032
|
+
const i = this.splay(n);
|
|
1033
|
+
return i != 0 && this.addNewRoot(new ye(n), i), this.root.key;
|
|
1034
|
+
}
|
|
1035
|
+
addAll(n) {
|
|
1036
|
+
for (const i of n)
|
|
1037
|
+
this.add(i);
|
|
1038
|
+
}
|
|
1039
|
+
isEmpty() {
|
|
1040
|
+
return this.root == null;
|
|
1041
|
+
}
|
|
1042
|
+
isNotEmpty() {
|
|
1043
|
+
return this.root != null;
|
|
1044
|
+
}
|
|
1045
|
+
single() {
|
|
1046
|
+
if (this.size == 0) throw "Bad state: No element";
|
|
1047
|
+
if (this.size > 1) throw "Bad state: Too many element";
|
|
1048
|
+
return this.root.key;
|
|
1049
|
+
}
|
|
1050
|
+
first() {
|
|
1051
|
+
if (this.size == 0) throw "Bad state: No element";
|
|
1052
|
+
return this._first().key;
|
|
1053
|
+
}
|
|
1054
|
+
last() {
|
|
1055
|
+
if (this.size == 0) throw "Bad state: No element";
|
|
1056
|
+
return this._last().key;
|
|
1057
|
+
}
|
|
1058
|
+
lastBefore(n) {
|
|
1059
|
+
if (n == null) throw "Invalid arguments(s)";
|
|
1060
|
+
if (this.root == null) return null;
|
|
1061
|
+
if (this.splay(n) < 0) return this.root.key;
|
|
1062
|
+
let r = this.root.left;
|
|
1063
|
+
if (r == null) return null;
|
|
1064
|
+
let u = r.right;
|
|
1065
|
+
for (; u != null; )
|
|
1066
|
+
r = u, u = r.right;
|
|
1067
|
+
return r.key;
|
|
1068
|
+
}
|
|
1069
|
+
firstAfter(n) {
|
|
1070
|
+
if (n == null) throw "Invalid arguments(s)";
|
|
1071
|
+
if (this.root == null) return null;
|
|
1072
|
+
if (this.splay(n) > 0) return this.root.key;
|
|
1073
|
+
let r = this.root.right;
|
|
1074
|
+
if (r == null) return null;
|
|
1075
|
+
let u = r.left;
|
|
1076
|
+
for (; u != null; )
|
|
1077
|
+
r = u, u = r.left;
|
|
1078
|
+
return r.key;
|
|
1079
|
+
}
|
|
1080
|
+
retainAll(n) {
|
|
1081
|
+
const i = new me(this.compare, this.validKey), r = this.modificationCount;
|
|
1082
|
+
for (const u of n) {
|
|
1083
|
+
if (r != this.modificationCount)
|
|
1084
|
+
throw "Concurrent modification during iteration.";
|
|
1085
|
+
this.validKey(u) && this.splay(u) == 0 && i.add(this.root.key);
|
|
1086
|
+
}
|
|
1087
|
+
i.size != this.size && (this.root = i.root, this.size = i.size, this.modificationCount++);
|
|
1088
|
+
}
|
|
1089
|
+
lookup(n) {
|
|
1090
|
+
return !this.validKey(n) || this.splay(n) != 0 ? null : this.root.key;
|
|
1091
|
+
}
|
|
1092
|
+
intersection(n) {
|
|
1093
|
+
const i = new me(this.compare, this.validKey);
|
|
1094
|
+
for (const r of this)
|
|
1095
|
+
n.has(r) && i.add(r);
|
|
1096
|
+
return i;
|
|
1097
|
+
}
|
|
1098
|
+
difference(n) {
|
|
1099
|
+
const i = new me(this.compare, this.validKey);
|
|
1100
|
+
for (const r of this)
|
|
1101
|
+
n.has(r) || i.add(r);
|
|
1102
|
+
return i;
|
|
1103
|
+
}
|
|
1104
|
+
union(n) {
|
|
1105
|
+
const i = this.clone();
|
|
1106
|
+
return i.addAll(n), i;
|
|
1107
|
+
}
|
|
1108
|
+
clone() {
|
|
1109
|
+
const n = new me(this.compare, this.validKey);
|
|
1110
|
+
return n.size = this.size, n.root = this.copyNode(this.root), n;
|
|
1111
|
+
}
|
|
1112
|
+
copyNode(n) {
|
|
1113
|
+
if (n == null) return null;
|
|
1114
|
+
function i(u, a) {
|
|
1115
|
+
let h, E;
|
|
1116
|
+
do {
|
|
1117
|
+
if (h = u.left, E = u.right, h != null) {
|
|
1118
|
+
const p = new ye(h.key);
|
|
1119
|
+
a.left = p, i(h, p);
|
|
1120
|
+
}
|
|
1121
|
+
if (E != null) {
|
|
1122
|
+
const p = new ye(E.key);
|
|
1123
|
+
a.right = p, u = E, a = p;
|
|
1124
|
+
}
|
|
1125
|
+
} while (E != null);
|
|
1126
|
+
}
|
|
1127
|
+
const r = new ye(n.key);
|
|
1128
|
+
return i(n, r), r;
|
|
766
1129
|
}
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
1130
|
+
toSet() {
|
|
1131
|
+
return this.clone();
|
|
1132
|
+
}
|
|
1133
|
+
entries() {
|
|
1134
|
+
return new Ft(this.wrap());
|
|
1135
|
+
}
|
|
1136
|
+
keys() {
|
|
1137
|
+
return this[Symbol.iterator]();
|
|
1138
|
+
}
|
|
1139
|
+
values() {
|
|
1140
|
+
return this[Symbol.iterator]();
|
|
1141
|
+
}
|
|
1142
|
+
[(pt = Symbol.iterator, ht = Symbol.toStringTag, pt)]() {
|
|
1143
|
+
return new qt(this.wrap());
|
|
1144
|
+
}
|
|
1145
|
+
}, Et = class {
|
|
1146
|
+
constructor(t) {
|
|
1147
|
+
C(this, "tree");
|
|
1148
|
+
C(this, "path", new Array());
|
|
1149
|
+
C(this, "modificationCount", null);
|
|
1150
|
+
C(this, "splayCount");
|
|
1151
|
+
this.tree = t, this.splayCount = t.getSplayCount();
|
|
1152
|
+
}
|
|
1153
|
+
[Symbol.iterator]() {
|
|
1154
|
+
return this;
|
|
1155
|
+
}
|
|
1156
|
+
next() {
|
|
1157
|
+
return this.moveNext() ? { done: !1, value: this.current() } : { done: !0, value: null };
|
|
1158
|
+
}
|
|
1159
|
+
current() {
|
|
1160
|
+
if (!this.path.length) return null;
|
|
1161
|
+
const t = this.path[this.path.length - 1];
|
|
1162
|
+
return this.getValue(t);
|
|
1163
|
+
}
|
|
1164
|
+
rebuildPath(t) {
|
|
1165
|
+
this.path.splice(0, this.path.length), this.tree.splay(t), this.path.push(this.tree.getRoot()), this.splayCount = this.tree.getSplayCount();
|
|
1166
|
+
}
|
|
1167
|
+
findLeftMostDescendent(t) {
|
|
1168
|
+
for (; t != null; )
|
|
1169
|
+
this.path.push(t), t = t.left;
|
|
1170
|
+
}
|
|
1171
|
+
moveNext() {
|
|
1172
|
+
if (this.modificationCount != this.tree.getModificationCount()) {
|
|
1173
|
+
if (this.modificationCount == null) {
|
|
1174
|
+
this.modificationCount = this.tree.getModificationCount();
|
|
1175
|
+
let n = this.tree.getRoot();
|
|
1176
|
+
for (; n != null; )
|
|
1177
|
+
this.path.push(n), n = n.left;
|
|
1178
|
+
return this.path.length > 0;
|
|
1179
|
+
}
|
|
1180
|
+
throw "Concurrent modification during iteration.";
|
|
1181
|
+
}
|
|
1182
|
+
if (!this.path.length) return !1;
|
|
1183
|
+
this.splayCount != this.tree.getSplayCount() && this.rebuildPath(this.path[this.path.length - 1].key);
|
|
1184
|
+
let t = this.path[this.path.length - 1], e = t.right;
|
|
1185
|
+
if (e != null) {
|
|
1186
|
+
for (; e != null; )
|
|
1187
|
+
this.path.push(e), e = e.left;
|
|
1188
|
+
return !0;
|
|
1189
|
+
}
|
|
1190
|
+
for (this.path.pop(); this.path.length && this.path[this.path.length - 1].right === t; )
|
|
1191
|
+
t = this.path.pop();
|
|
1192
|
+
return this.path.length > 0;
|
|
1193
|
+
}
|
|
1194
|
+
}, qt = class extends Et {
|
|
1195
|
+
getValue(t) {
|
|
1196
|
+
return t.key;
|
|
1197
|
+
}
|
|
1198
|
+
}, Ft = class extends Et {
|
|
1199
|
+
getValue(t) {
|
|
1200
|
+
return [t.key, t.key];
|
|
1201
|
+
}
|
|
1202
|
+
}, vt = (t) => () => t, Fe = (t) => {
|
|
1203
|
+
const e = t ? (n, i) => i.minus(n).abs().isLessThanOrEqualTo(t) : vt(!1);
|
|
1204
|
+
return (n, i) => e(n, i) ? 0 : n.comparedTo(i);
|
|
810
1205
|
};
|
|
811
|
-
|
|
1206
|
+
function Dt(t) {
|
|
1207
|
+
const e = t ? (n, i, r, u, a) => n.exponentiatedBy(2).isLessThanOrEqualTo(
|
|
1208
|
+
u.minus(i).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(t)
|
|
1209
|
+
) : vt(!1);
|
|
1210
|
+
return (n, i, r) => {
|
|
1211
|
+
const u = n.x, a = n.y, h = r.x, E = r.y, p = a.minus(E).times(i.x.minus(h)).minus(u.minus(h).times(i.y.minus(E)));
|
|
1212
|
+
return e(p, u, a, h, E) ? 0 : p.comparedTo(0);
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1215
|
+
var zt = (t) => t, Ut = (t) => {
|
|
1216
|
+
if (t) {
|
|
1217
|
+
const e = new Pe(Fe(t)), n = new Pe(Fe(t)), i = (u, a) => a.addAndReturn(u), r = (u) => ({
|
|
1218
|
+
x: i(u.x, e),
|
|
1219
|
+
y: i(u.y, n)
|
|
1220
|
+
});
|
|
1221
|
+
return r({ x: new ie(0), y: new ie(0) }), r;
|
|
1222
|
+
}
|
|
1223
|
+
return zt;
|
|
1224
|
+
}, De = (t) => ({
|
|
1225
|
+
set: (e) => {
|
|
1226
|
+
oe = De(e);
|
|
1227
|
+
},
|
|
1228
|
+
reset: () => De(t),
|
|
1229
|
+
compare: Fe(t),
|
|
1230
|
+
snap: Ut(t),
|
|
1231
|
+
orient: Dt(t)
|
|
1232
|
+
}), oe = De(), de = (t, e) => t.ll.x.isLessThanOrEqualTo(e.x) && e.x.isLessThanOrEqualTo(t.ur.x) && t.ll.y.isLessThanOrEqualTo(e.y) && e.y.isLessThanOrEqualTo(t.ur.y), ze = (t, e) => {
|
|
1233
|
+
if (e.ur.x.isLessThan(t.ll.x) || t.ur.x.isLessThan(e.ll.x) || e.ur.y.isLessThan(t.ll.y) || t.ur.y.isLessThan(e.ll.y))
|
|
1234
|
+
return null;
|
|
1235
|
+
const n = t.ll.x.isLessThan(e.ll.x) ? e.ll.x : t.ll.x, i = t.ur.x.isLessThan(e.ur.x) ? t.ur.x : e.ur.x, r = t.ll.y.isLessThan(e.ll.y) ? e.ll.y : t.ll.y, u = t.ur.y.isLessThan(e.ur.y) ? t.ur.y : e.ur.y;
|
|
1236
|
+
return { ll: { x: n, y: r }, ur: { x: i, y: u } };
|
|
1237
|
+
}, Me = (t, e) => t.x.times(e.y).minus(t.y.times(e.x)), St = (t, e) => t.x.times(e.x).plus(t.y.times(e.y)), Oe = (t) => St(t, t).sqrt(), Vt = (t, e, n) => {
|
|
1238
|
+
const i = { x: e.x.minus(t.x), y: e.y.minus(t.y) }, r = { x: n.x.minus(t.x), y: n.y.minus(t.y) };
|
|
1239
|
+
return Me(r, i).div(Oe(r)).div(Oe(i));
|
|
1240
|
+
}, Kt = (t, e, n) => {
|
|
1241
|
+
const i = { x: e.x.minus(t.x), y: e.y.minus(t.y) }, r = { x: n.x.minus(t.x), y: n.y.minus(t.y) };
|
|
1242
|
+
return St(r, i).div(Oe(r)).div(Oe(i));
|
|
1243
|
+
}, Qe = (t, e, n) => e.y.isZero() ? null : { x: t.x.plus(e.x.div(e.y).times(n.minus(t.y))), y: n }, et = (t, e, n) => e.x.isZero() ? null : { x: n, y: t.y.plus(e.y.div(e.x).times(n.minus(t.x))) }, Xt = (t, e, n, i) => {
|
|
1244
|
+
if (e.x.isZero()) return et(n, i, t.x);
|
|
1245
|
+
if (i.x.isZero()) return et(t, e, n.x);
|
|
1246
|
+
if (e.y.isZero()) return Qe(n, i, t.y);
|
|
1247
|
+
if (i.y.isZero()) return Qe(t, e, n.y);
|
|
1248
|
+
const r = Me(e, i);
|
|
1249
|
+
if (r.isZero()) return null;
|
|
1250
|
+
const u = { x: n.x.minus(t.x), y: n.y.minus(t.y) }, a = Me(u, e).div(r), h = Me(u, i).div(r), E = t.x.plus(h.times(e.x)), p = n.x.plus(a.times(i.x)), _ = t.y.plus(h.times(e.y)), b = n.y.plus(a.times(i.y)), M = E.plus(p).div(2), T = _.plus(b).div(2);
|
|
1251
|
+
return { x: M, y: T };
|
|
1252
|
+
}, ne = class bt {
|
|
1253
|
+
// Warning: 'point' input will be modified and re-used (for performance)
|
|
1254
|
+
constructor(e, n) {
|
|
1255
|
+
C(this, "point");
|
|
1256
|
+
C(this, "isLeft");
|
|
1257
|
+
C(this, "segment");
|
|
1258
|
+
C(this, "otherSE");
|
|
1259
|
+
C(this, "consumedBy");
|
|
1260
|
+
e.events === void 0 ? e.events = [this] : e.events.push(this), this.point = e, this.isLeft = n;
|
|
1261
|
+
}
|
|
812
1262
|
// for ordering sweep events in the sweep event queue
|
|
813
|
-
static compare(
|
|
814
|
-
const
|
|
815
|
-
return
|
|
1263
|
+
static compare(e, n) {
|
|
1264
|
+
const i = bt.comparePoints(e.point, n.point);
|
|
1265
|
+
return i !== 0 ? i : (e.point !== n.point && e.link(n), e.isLeft !== n.isLeft ? e.isLeft ? 1 : -1 : Ne.compare(e.segment, n.segment));
|
|
816
1266
|
}
|
|
817
1267
|
// for ordering points in sweep line order
|
|
818
|
-
static comparePoints(
|
|
819
|
-
return
|
|
820
|
-
}
|
|
821
|
-
// Warning: 'point' input will be modified and re-used (for performance)
|
|
822
|
-
constructor(t, e) {
|
|
823
|
-
t.events === void 0 ? t.events = [this] : t.events.push(this), this.point = t, this.isLeft = e;
|
|
1268
|
+
static comparePoints(e, n) {
|
|
1269
|
+
return e.x.isLessThan(n.x) ? -1 : e.x.isGreaterThan(n.x) ? 1 : e.y.isLessThan(n.y) ? -1 : e.y.isGreaterThan(n.y) ? 1 : 0;
|
|
824
1270
|
}
|
|
825
|
-
link(
|
|
826
|
-
if (
|
|
1271
|
+
link(e) {
|
|
1272
|
+
if (e.point === this.point)
|
|
827
1273
|
throw new Error("Tried to link already linked events");
|
|
828
|
-
const
|
|
829
|
-
for (let
|
|
830
|
-
const
|
|
831
|
-
this.point.events.push(
|
|
1274
|
+
const n = e.point.events;
|
|
1275
|
+
for (let i = 0, r = n.length; i < r; i++) {
|
|
1276
|
+
const u = n[i];
|
|
1277
|
+
this.point.events.push(u), u.point = this.point;
|
|
832
1278
|
}
|
|
833
1279
|
this.checkForConsuming();
|
|
834
1280
|
}
|
|
835
1281
|
/* Do a pass over our linked events and check to see if any pair
|
|
836
1282
|
* of segments match, and should be consumed. */
|
|
837
1283
|
checkForConsuming() {
|
|
838
|
-
const
|
|
839
|
-
for (let
|
|
840
|
-
const
|
|
841
|
-
if (
|
|
842
|
-
for (let
|
|
843
|
-
const
|
|
844
|
-
|
|
1284
|
+
const e = this.point.events.length;
|
|
1285
|
+
for (let n = 0; n < e; n++) {
|
|
1286
|
+
const i = this.point.events[n];
|
|
1287
|
+
if (i.segment.consumedBy === void 0)
|
|
1288
|
+
for (let r = n + 1; r < e; r++) {
|
|
1289
|
+
const u = this.point.events[r];
|
|
1290
|
+
u.consumedBy === void 0 && i.otherSE.point.events === u.otherSE.point.events && i.segment.consume(u.segment);
|
|
845
1291
|
}
|
|
846
1292
|
}
|
|
847
1293
|
}
|
|
848
1294
|
getAvailableLinkedEvents() {
|
|
849
|
-
const
|
|
850
|
-
for (let
|
|
851
|
-
const
|
|
852
|
-
|
|
1295
|
+
const e = [];
|
|
1296
|
+
for (let n = 0, i = this.point.events.length; n < i; n++) {
|
|
1297
|
+
const r = this.point.events[n];
|
|
1298
|
+
r !== this && !r.segment.ringOut && r.segment.isInResult() && e.push(r);
|
|
853
1299
|
}
|
|
854
|
-
return
|
|
1300
|
+
return e;
|
|
855
1301
|
}
|
|
856
1302
|
/**
|
|
857
1303
|
* Returns a comparator function for sorting linked events that will
|
|
@@ -863,29 +1309,303 @@ class L {
|
|
|
863
1309
|
* The comparator function has a compute cache such that it avoids
|
|
864
1310
|
* re-computing already-computed values.
|
|
865
1311
|
*/
|
|
866
|
-
getLeftmostComparator(
|
|
867
|
-
const
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
sine:
|
|
871
|
-
cosine:
|
|
1312
|
+
getLeftmostComparator(e) {
|
|
1313
|
+
const n = /* @__PURE__ */ new Map(), i = (r) => {
|
|
1314
|
+
const u = r.otherSE;
|
|
1315
|
+
n.set(r, {
|
|
1316
|
+
sine: Vt(this.point, e.point, u.point),
|
|
1317
|
+
cosine: Kt(this.point, e.point, u.point)
|
|
872
1318
|
});
|
|
873
1319
|
};
|
|
874
|
-
return (
|
|
875
|
-
|
|
876
|
-
const {
|
|
877
|
-
|
|
878
|
-
cosine: l
|
|
879
|
-
} = e.get(i), {
|
|
880
|
-
sine: c,
|
|
881
|
-
cosine: f
|
|
882
|
-
} = e.get(o);
|
|
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;
|
|
1320
|
+
return (r, u) => {
|
|
1321
|
+
n.has(r) || i(r), n.has(u) || i(u);
|
|
1322
|
+
const { sine: a, cosine: h } = n.get(r), { sine: E, cosine: p } = n.get(u);
|
|
1323
|
+
return a.isGreaterThanOrEqualTo(0) && E.isGreaterThanOrEqualTo(0) ? h.isLessThan(p) ? 1 : h.isGreaterThan(p) ? -1 : 0 : a.isLessThan(0) && E.isLessThan(0) ? h.isLessThan(p) ? -1 : h.isGreaterThan(p) ? 1 : 0 : E.isLessThan(a) ? -1 : E.isGreaterThan(a) ? 1 : 0;
|
|
884
1324
|
};
|
|
885
1325
|
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
|
|
1326
|
+
}, Zt = class Ue {
|
|
1327
|
+
constructor(e) {
|
|
1328
|
+
C(this, "events");
|
|
1329
|
+
C(this, "poly");
|
|
1330
|
+
C(this, "_isExteriorRing");
|
|
1331
|
+
C(this, "_enclosingRing");
|
|
1332
|
+
this.events = e;
|
|
1333
|
+
for (let n = 0, i = e.length; n < i; n++)
|
|
1334
|
+
e[n].segment.ringOut = this;
|
|
1335
|
+
this.poly = null;
|
|
1336
|
+
}
|
|
1337
|
+
/* Given the segments from the sweep line pass, compute & return a series
|
|
1338
|
+
* of closed rings from all the segments marked to be part of the result */
|
|
1339
|
+
static factory(e) {
|
|
1340
|
+
const n = [];
|
|
1341
|
+
for (let i = 0, r = e.length; i < r; i++) {
|
|
1342
|
+
const u = e[i];
|
|
1343
|
+
if (!u.isInResult() || u.ringOut) continue;
|
|
1344
|
+
let a = null, h = u.leftSE, E = u.rightSE;
|
|
1345
|
+
const p = [h], _ = h.point, b = [];
|
|
1346
|
+
for (; a = h, h = E, p.push(h), h.point !== _; )
|
|
1347
|
+
for (; ; ) {
|
|
1348
|
+
const M = h.getAvailableLinkedEvents();
|
|
1349
|
+
if (M.length === 0) {
|
|
1350
|
+
const B = p[0].point, q = p[p.length - 1].point;
|
|
1351
|
+
throw new Error(
|
|
1352
|
+
`Unable to complete output ring starting at [${B.x}, ${B.y}]. Last matching segment found ends at [${q.x}, ${q.y}].`
|
|
1353
|
+
);
|
|
1354
|
+
}
|
|
1355
|
+
if (M.length === 1) {
|
|
1356
|
+
E = M[0].otherSE;
|
|
1357
|
+
break;
|
|
1358
|
+
}
|
|
1359
|
+
let T = null;
|
|
1360
|
+
for (let B = 0, q = b.length; B < q; B++)
|
|
1361
|
+
if (b[B].point === h.point) {
|
|
1362
|
+
T = B;
|
|
1363
|
+
break;
|
|
1364
|
+
}
|
|
1365
|
+
if (T !== null) {
|
|
1366
|
+
const B = b.splice(T)[0], q = p.splice(B.index);
|
|
1367
|
+
q.unshift(q[0].otherSE), n.push(new Ue(q.reverse()));
|
|
1368
|
+
continue;
|
|
1369
|
+
}
|
|
1370
|
+
b.push({
|
|
1371
|
+
index: p.length,
|
|
1372
|
+
point: h.point
|
|
1373
|
+
});
|
|
1374
|
+
const L = h.getLeftmostComparator(a);
|
|
1375
|
+
E = M.sort(L)[0].otherSE;
|
|
1376
|
+
break;
|
|
1377
|
+
}
|
|
1378
|
+
n.push(new Ue(p));
|
|
1379
|
+
}
|
|
1380
|
+
return n;
|
|
1381
|
+
}
|
|
1382
|
+
getGeom() {
|
|
1383
|
+
let e = this.events[0].point;
|
|
1384
|
+
const n = [e];
|
|
1385
|
+
for (let p = 1, _ = this.events.length - 1; p < _; p++) {
|
|
1386
|
+
const b = this.events[p].point, M = this.events[p + 1].point;
|
|
1387
|
+
oe.orient(b, e, M) !== 0 && (n.push(b), e = b);
|
|
1388
|
+
}
|
|
1389
|
+
if (n.length === 1) return null;
|
|
1390
|
+
const i = n[0], r = n[1];
|
|
1391
|
+
oe.orient(i, e, r) === 0 && n.shift(), n.push(n[0]);
|
|
1392
|
+
const u = this.isExteriorRing() ? 1 : -1, a = this.isExteriorRing() ? 0 : n.length - 1, h = this.isExteriorRing() ? n.length : -1, E = [];
|
|
1393
|
+
for (let p = a; p != h; p += u)
|
|
1394
|
+
E.push([n[p].x.toNumber(), n[p].y.toNumber()]);
|
|
1395
|
+
return E;
|
|
1396
|
+
}
|
|
1397
|
+
isExteriorRing() {
|
|
1398
|
+
if (this._isExteriorRing === void 0) {
|
|
1399
|
+
const e = this.enclosingRing();
|
|
1400
|
+
this._isExteriorRing = e ? !e.isExteriorRing() : !0;
|
|
1401
|
+
}
|
|
1402
|
+
return this._isExteriorRing;
|
|
1403
|
+
}
|
|
1404
|
+
enclosingRing() {
|
|
1405
|
+
return this._enclosingRing === void 0 && (this._enclosingRing = this._calcEnclosingRing()), this._enclosingRing;
|
|
1406
|
+
}
|
|
1407
|
+
/* Returns the ring that encloses this one, if any */
|
|
1408
|
+
_calcEnclosingRing() {
|
|
1409
|
+
var r, u;
|
|
1410
|
+
let e = this.events[0];
|
|
1411
|
+
for (let a = 1, h = this.events.length; a < h; a++) {
|
|
1412
|
+
const E = this.events[a];
|
|
1413
|
+
ne.compare(e, E) > 0 && (e = E);
|
|
1414
|
+
}
|
|
1415
|
+
let n = e.segment.prevInResult(), i = n ? n.prevInResult() : null;
|
|
1416
|
+
for (; ; ) {
|
|
1417
|
+
if (!n) return null;
|
|
1418
|
+
if (!i) return n.ringOut;
|
|
1419
|
+
if (i.ringOut !== n.ringOut)
|
|
1420
|
+
return ((r = i.ringOut) == null ? void 0 : r.enclosingRing()) !== n.ringOut ? n.ringOut : (u = n.ringOut) == null ? void 0 : u.enclosingRing();
|
|
1421
|
+
n = i.prevInResult(), i = n ? n.prevInResult() : null;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
}, tt = class {
|
|
1425
|
+
constructor(t) {
|
|
1426
|
+
C(this, "exteriorRing");
|
|
1427
|
+
C(this, "interiorRings");
|
|
1428
|
+
this.exteriorRing = t, t.poly = this, this.interiorRings = [];
|
|
1429
|
+
}
|
|
1430
|
+
addInterior(t) {
|
|
1431
|
+
this.interiorRings.push(t), t.poly = this;
|
|
1432
|
+
}
|
|
1433
|
+
getGeom() {
|
|
1434
|
+
const t = this.exteriorRing.getGeom();
|
|
1435
|
+
if (t === null) return null;
|
|
1436
|
+
const e = [t];
|
|
1437
|
+
for (let n = 0, i = this.interiorRings.length; n < i; n++) {
|
|
1438
|
+
const r = this.interiorRings[n].getGeom();
|
|
1439
|
+
r !== null && e.push(r);
|
|
1440
|
+
}
|
|
1441
|
+
return e;
|
|
1442
|
+
}
|
|
1443
|
+
}, Yt = class {
|
|
1444
|
+
constructor(t) {
|
|
1445
|
+
C(this, "rings");
|
|
1446
|
+
C(this, "polys");
|
|
1447
|
+
this.rings = t, this.polys = this._composePolys(t);
|
|
1448
|
+
}
|
|
1449
|
+
getGeom() {
|
|
1450
|
+
const t = [];
|
|
1451
|
+
for (let e = 0, n = this.polys.length; e < n; e++) {
|
|
1452
|
+
const i = this.polys[e].getGeom();
|
|
1453
|
+
i !== null && t.push(i);
|
|
1454
|
+
}
|
|
1455
|
+
return t;
|
|
1456
|
+
}
|
|
1457
|
+
_composePolys(t) {
|
|
1458
|
+
var n;
|
|
1459
|
+
const e = [];
|
|
1460
|
+
for (let i = 0, r = t.length; i < r; i++) {
|
|
1461
|
+
const u = t[i];
|
|
1462
|
+
if (!u.poly)
|
|
1463
|
+
if (u.isExteriorRing()) e.push(new tt(u));
|
|
1464
|
+
else {
|
|
1465
|
+
const a = u.enclosingRing();
|
|
1466
|
+
a != null && a.poly || e.push(new tt(a)), (n = a == null ? void 0 : a.poly) == null || n.addInterior(u);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
return e;
|
|
1470
|
+
}
|
|
1471
|
+
}, Wt = class {
|
|
1472
|
+
constructor(t, e = Ne.compare) {
|
|
1473
|
+
C(this, "queue");
|
|
1474
|
+
C(this, "tree");
|
|
1475
|
+
C(this, "segments");
|
|
1476
|
+
this.queue = t, this.tree = new Pe(e), this.segments = [];
|
|
1477
|
+
}
|
|
1478
|
+
process(t) {
|
|
1479
|
+
const e = t.segment, n = [];
|
|
1480
|
+
if (t.consumedBy)
|
|
1481
|
+
return t.isLeft ? this.queue.delete(t.otherSE) : this.tree.delete(e), n;
|
|
1482
|
+
t.isLeft && this.tree.add(e);
|
|
1483
|
+
let i = e, r = e;
|
|
1484
|
+
do
|
|
1485
|
+
i = this.tree.lastBefore(i);
|
|
1486
|
+
while (i != null && i.consumedBy != null);
|
|
1487
|
+
do
|
|
1488
|
+
r = this.tree.firstAfter(r);
|
|
1489
|
+
while (r != null && r.consumedBy != null);
|
|
1490
|
+
if (t.isLeft) {
|
|
1491
|
+
let u = null;
|
|
1492
|
+
if (i) {
|
|
1493
|
+
const h = i.getIntersection(e);
|
|
1494
|
+
if (h !== null && (e.isAnEndpoint(h) || (u = h), !i.isAnEndpoint(h))) {
|
|
1495
|
+
const E = this._splitSafely(i, h);
|
|
1496
|
+
for (let p = 0, _ = E.length; p < _; p++)
|
|
1497
|
+
n.push(E[p]);
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
let a = null;
|
|
1501
|
+
if (r) {
|
|
1502
|
+
const h = r.getIntersection(e);
|
|
1503
|
+
if (h !== null && (e.isAnEndpoint(h) || (a = h), !r.isAnEndpoint(h))) {
|
|
1504
|
+
const E = this._splitSafely(r, h);
|
|
1505
|
+
for (let p = 0, _ = E.length; p < _; p++)
|
|
1506
|
+
n.push(E[p]);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
if (u !== null || a !== null) {
|
|
1510
|
+
let h = null;
|
|
1511
|
+
u === null ? h = a : a === null ? h = u : h = ne.comparePoints(
|
|
1512
|
+
u,
|
|
1513
|
+
a
|
|
1514
|
+
) <= 0 ? u : a, this.queue.delete(e.rightSE), n.push(e.rightSE);
|
|
1515
|
+
const E = e.split(h);
|
|
1516
|
+
for (let p = 0, _ = E.length; p < _; p++)
|
|
1517
|
+
n.push(E[p]);
|
|
1518
|
+
}
|
|
1519
|
+
n.length > 0 ? (this.tree.delete(e), n.push(t)) : (this.segments.push(e), e.prev = i);
|
|
1520
|
+
} else {
|
|
1521
|
+
if (i && r) {
|
|
1522
|
+
const u = i.getIntersection(r);
|
|
1523
|
+
if (u !== null) {
|
|
1524
|
+
if (!i.isAnEndpoint(u)) {
|
|
1525
|
+
const a = this._splitSafely(i, u);
|
|
1526
|
+
for (let h = 0, E = a.length; h < E; h++)
|
|
1527
|
+
n.push(a[h]);
|
|
1528
|
+
}
|
|
1529
|
+
if (!r.isAnEndpoint(u)) {
|
|
1530
|
+
const a = this._splitSafely(r, u);
|
|
1531
|
+
for (let h = 0, E = a.length; h < E; h++)
|
|
1532
|
+
n.push(a[h]);
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
this.tree.delete(e);
|
|
1537
|
+
}
|
|
1538
|
+
return n;
|
|
1539
|
+
}
|
|
1540
|
+
/* Safely split a segment that is currently in the datastructures
|
|
1541
|
+
* IE - a segment other than the one that is currently being processed. */
|
|
1542
|
+
_splitSafely(t, e) {
|
|
1543
|
+
this.tree.delete(t);
|
|
1544
|
+
const n = t.rightSE;
|
|
1545
|
+
this.queue.delete(n);
|
|
1546
|
+
const i = t.split(e);
|
|
1547
|
+
return i.push(n), t.consumedBy === void 0 && this.tree.add(t), i;
|
|
1548
|
+
}
|
|
1549
|
+
}, Jt = class {
|
|
1550
|
+
constructor() {
|
|
1551
|
+
C(this, "type");
|
|
1552
|
+
C(this, "numMultiPolys");
|
|
1553
|
+
}
|
|
1554
|
+
run(t, e, n) {
|
|
1555
|
+
xe.type = t;
|
|
1556
|
+
const i = [new it(e, !0)];
|
|
1557
|
+
for (let p = 0, _ = n.length; p < _; p++)
|
|
1558
|
+
i.push(new it(n[p], !1));
|
|
1559
|
+
if (xe.numMultiPolys = i.length, xe.type === "difference") {
|
|
1560
|
+
const p = i[0];
|
|
1561
|
+
let _ = 1;
|
|
1562
|
+
for (; _ < i.length; )
|
|
1563
|
+
ze(i[_].bbox, p.bbox) !== null ? _++ : i.splice(_, 1);
|
|
1564
|
+
}
|
|
1565
|
+
if (xe.type === "intersection")
|
|
1566
|
+
for (let p = 0, _ = i.length; p < _; p++) {
|
|
1567
|
+
const b = i[p];
|
|
1568
|
+
for (let M = p + 1, T = i.length; M < T; M++)
|
|
1569
|
+
if (ze(b.bbox, i[M].bbox) === null) return [];
|
|
1570
|
+
}
|
|
1571
|
+
const r = new Pe(ne.compare);
|
|
1572
|
+
for (let p = 0, _ = i.length; p < _; p++) {
|
|
1573
|
+
const b = i[p].getSweepEvents();
|
|
1574
|
+
for (let M = 0, T = b.length; M < T; M++)
|
|
1575
|
+
r.add(b[M]);
|
|
1576
|
+
}
|
|
1577
|
+
const u = new Wt(r);
|
|
1578
|
+
let a = null;
|
|
1579
|
+
for (r.size != 0 && (a = r.first(), r.delete(a)); a; ) {
|
|
1580
|
+
const p = u.process(a);
|
|
1581
|
+
for (let _ = 0, b = p.length; _ < b; _++) {
|
|
1582
|
+
const M = p[_];
|
|
1583
|
+
M.consumedBy === void 0 && r.add(M);
|
|
1584
|
+
}
|
|
1585
|
+
r.size != 0 ? (a = r.first(), r.delete(a)) : a = null;
|
|
1586
|
+
}
|
|
1587
|
+
oe.reset();
|
|
1588
|
+
const h = Zt.factory(u.segments);
|
|
1589
|
+
return new Yt(h).getGeom();
|
|
1590
|
+
}
|
|
1591
|
+
}, xe = new Jt(), Re = xe, Ht = 0, Ne = class Ce {
|
|
1592
|
+
/* Warning: a reference to ringWindings input will be stored,
|
|
1593
|
+
* and possibly will be later modified */
|
|
1594
|
+
constructor(e, n, i, r) {
|
|
1595
|
+
C(this, "id");
|
|
1596
|
+
C(this, "leftSE");
|
|
1597
|
+
C(this, "rightSE");
|
|
1598
|
+
C(this, "rings");
|
|
1599
|
+
C(this, "windings");
|
|
1600
|
+
C(this, "ringOut");
|
|
1601
|
+
C(this, "consumedBy");
|
|
1602
|
+
C(this, "prev");
|
|
1603
|
+
C(this, "_prevInResult");
|
|
1604
|
+
C(this, "_beforeState");
|
|
1605
|
+
C(this, "_afterState");
|
|
1606
|
+
C(this, "_isInResult");
|
|
1607
|
+
this.id = ++Ht, this.leftSE = e, e.segment = this, e.otherSE = n, this.rightSE = n, n.segment = this, n.otherSE = e, this.rings = i, this.windings = r;
|
|
1608
|
+
}
|
|
889
1609
|
/* This compare() function is for ordering segments in the sweep
|
|
890
1610
|
* line tree, and does so according to the following criteria:
|
|
891
1611
|
*
|
|
@@ -899,88 +1619,80 @@ class z {
|
|
|
899
1619
|
* or more of the segments are vertical) then the line to be considered
|
|
900
1620
|
* is directly on the right-more of the two left inputs.
|
|
901
1621
|
*/
|
|
902
|
-
static compare(
|
|
903
|
-
const
|
|
904
|
-
if (
|
|
905
|
-
if (
|
|
906
|
-
const
|
|
907
|
-
if (
|
|
908
|
-
if (
|
|
909
|
-
if (
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
if (
|
|
913
|
-
const
|
|
914
|
-
return
|
|
915
|
-
}
|
|
916
|
-
if (
|
|
917
|
-
if (
|
|
918
|
-
if (
|
|
919
|
-
const
|
|
920
|
-
if (
|
|
921
|
-
const
|
|
922
|
-
return
|
|
923
|
-
}
|
|
924
|
-
if (
|
|
925
|
-
if (
|
|
926
|
-
if (
|
|
927
|
-
const
|
|
928
|
-
if (
|
|
929
|
-
}
|
|
930
|
-
if (
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
if (
|
|
934
|
-
}
|
|
935
|
-
if (
|
|
936
|
-
const
|
|
937
|
-
if (
|
|
938
|
-
if (
|
|
939
|
-
}
|
|
940
|
-
return
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
const c = new L(i, !0), f = new L(o, !1);
|
|
956
|
-
return new z(c, f, [n], [u]);
|
|
1622
|
+
static compare(e, n) {
|
|
1623
|
+
const i = e.leftSE.point.x, r = n.leftSE.point.x, u = e.rightSE.point.x, a = n.rightSE.point.x;
|
|
1624
|
+
if (a.isLessThan(i)) return 1;
|
|
1625
|
+
if (u.isLessThan(r)) return -1;
|
|
1626
|
+
const h = e.leftSE.point.y, E = n.leftSE.point.y, p = e.rightSE.point.y, _ = n.rightSE.point.y;
|
|
1627
|
+
if (i.isLessThan(r)) {
|
|
1628
|
+
if (E.isLessThan(h) && E.isLessThan(p)) return 1;
|
|
1629
|
+
if (E.isGreaterThan(h) && E.isGreaterThan(p)) return -1;
|
|
1630
|
+
const b = e.comparePoint(n.leftSE.point);
|
|
1631
|
+
if (b < 0) return 1;
|
|
1632
|
+
if (b > 0) return -1;
|
|
1633
|
+
const M = n.comparePoint(e.rightSE.point);
|
|
1634
|
+
return M !== 0 ? M : -1;
|
|
1635
|
+
}
|
|
1636
|
+
if (i.isGreaterThan(r)) {
|
|
1637
|
+
if (h.isLessThan(E) && h.isLessThan(_)) return -1;
|
|
1638
|
+
if (h.isGreaterThan(E) && h.isGreaterThan(_)) return 1;
|
|
1639
|
+
const b = n.comparePoint(e.leftSE.point);
|
|
1640
|
+
if (b !== 0) return b;
|
|
1641
|
+
const M = e.comparePoint(n.rightSE.point);
|
|
1642
|
+
return M < 0 ? 1 : M > 0 ? -1 : 1;
|
|
1643
|
+
}
|
|
1644
|
+
if (h.isLessThan(E)) return -1;
|
|
1645
|
+
if (h.isGreaterThan(E)) return 1;
|
|
1646
|
+
if (u.isLessThan(a)) {
|
|
1647
|
+
const b = n.comparePoint(e.rightSE.point);
|
|
1648
|
+
if (b !== 0) return b;
|
|
1649
|
+
}
|
|
1650
|
+
if (u.isGreaterThan(a)) {
|
|
1651
|
+
const b = e.comparePoint(n.rightSE.point);
|
|
1652
|
+
if (b < 0) return 1;
|
|
1653
|
+
if (b > 0) return -1;
|
|
1654
|
+
}
|
|
1655
|
+
if (!u.eq(a)) {
|
|
1656
|
+
const b = p.minus(h), M = u.minus(i), T = _.minus(E), L = a.minus(r);
|
|
1657
|
+
if (b.isGreaterThan(M) && T.isLessThan(L)) return 1;
|
|
1658
|
+
if (b.isLessThan(M) && T.isGreaterThan(L)) return -1;
|
|
1659
|
+
}
|
|
1660
|
+
return u.isGreaterThan(a) ? 1 : u.isLessThan(a) || p.isLessThan(_) ? -1 : p.isGreaterThan(_) ? 1 : e.id < n.id ? -1 : e.id > n.id ? 1 : 0;
|
|
1661
|
+
}
|
|
1662
|
+
static fromRing(e, n, i) {
|
|
1663
|
+
let r, u, a;
|
|
1664
|
+
const h = ne.comparePoints(e, n);
|
|
1665
|
+
if (h < 0)
|
|
1666
|
+
r = e, u = n, a = 1;
|
|
1667
|
+
else if (h > 0)
|
|
1668
|
+
r = n, u = e, a = -1;
|
|
1669
|
+
else
|
|
1670
|
+
throw new Error(
|
|
1671
|
+
`Tried to create degenerate segment at [${e.x}, ${e.y}]`
|
|
1672
|
+
);
|
|
1673
|
+
const E = new ne(r, !0), p = new ne(u, !1);
|
|
1674
|
+
return new Ce(E, p, [i], [a]);
|
|
957
1675
|
}
|
|
958
1676
|
/* When a segment is split, the rightSE is replaced with a new sweep event */
|
|
959
|
-
replaceRightSE(
|
|
960
|
-
this.rightSE =
|
|
1677
|
+
replaceRightSE(e) {
|
|
1678
|
+
this.rightSE = e, this.rightSE.segment = this, this.rightSE.otherSE = this.leftSE, this.leftSE.otherSE = this.rightSE;
|
|
961
1679
|
}
|
|
962
1680
|
bbox() {
|
|
963
|
-
const
|
|
1681
|
+
const e = this.leftSE.point.y, n = this.rightSE.point.y;
|
|
964
1682
|
return {
|
|
965
|
-
ll: {
|
|
966
|
-
|
|
967
|
-
y: t < e ? t : e
|
|
968
|
-
},
|
|
969
|
-
ur: {
|
|
970
|
-
x: this.rightSE.point.x,
|
|
971
|
-
y: t > e ? t : e
|
|
972
|
-
}
|
|
1683
|
+
ll: { x: this.leftSE.point.x, y: e.isLessThan(n) ? e : n },
|
|
1684
|
+
ur: { x: this.rightSE.point.x, y: e.isGreaterThan(n) ? e : n }
|
|
973
1685
|
};
|
|
974
1686
|
}
|
|
975
1687
|
/* A vector from the left point to the right */
|
|
976
1688
|
vector() {
|
|
977
1689
|
return {
|
|
978
|
-
x: this.rightSE.point.x
|
|
979
|
-
y: this.rightSE.point.y
|
|
1690
|
+
x: this.rightSE.point.x.minus(this.leftSE.point.x),
|
|
1691
|
+
y: this.rightSE.point.y.minus(this.leftSE.point.y)
|
|
980
1692
|
};
|
|
981
1693
|
}
|
|
982
|
-
isAnEndpoint(
|
|
983
|
-
return
|
|
1694
|
+
isAnEndpoint(e) {
|
|
1695
|
+
return e.x.eq(this.leftSE.point.x) && e.y.eq(this.leftSE.point.y) || e.x.eq(this.rightSE.point.x) && e.y.eq(this.rightSE.point.y);
|
|
984
1696
|
}
|
|
985
1697
|
/* Compare this segment with a point.
|
|
986
1698
|
*
|
|
@@ -995,15 +1707,8 @@ class z {
|
|
|
995
1707
|
* 0: point is colinear to segment
|
|
996
1708
|
* -1: point lies below the segment (to the right of vertical)
|
|
997
1709
|
*/
|
|
998
|
-
comparePoint(
|
|
999
|
-
|
|
1000
|
-
const e = this.leftSE.point, n = this.rightSE.point, i = this.vector();
|
|
1001
|
-
if (e.x === n.x)
|
|
1002
|
-
return t.x === e.x ? 0 : t.x < e.x ? 1 : -1;
|
|
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
|
-
return t.y === c ? 0 : t.y < c ? -1 : 1;
|
|
1710
|
+
comparePoint(e) {
|
|
1711
|
+
return oe.orient(this.leftSE.point, e, this.rightSE.point);
|
|
1007
1712
|
}
|
|
1008
1713
|
/**
|
|
1009
1714
|
* Given another segment, returns the first non-trivial intersection
|
|
@@ -1020,21 +1725,21 @@ class z {
|
|
|
1020
1725
|
* If no non-trivial intersection exists, return null
|
|
1021
1726
|
* Else, return null.
|
|
1022
1727
|
*/
|
|
1023
|
-
getIntersection(
|
|
1024
|
-
const
|
|
1025
|
-
if (
|
|
1026
|
-
const
|
|
1027
|
-
if (
|
|
1028
|
-
return
|
|
1728
|
+
getIntersection(e) {
|
|
1729
|
+
const n = this.bbox(), i = e.bbox(), r = ze(n, i);
|
|
1730
|
+
if (r === null) return null;
|
|
1731
|
+
const u = this.leftSE.point, a = this.rightSE.point, h = e.leftSE.point, E = e.rightSE.point, p = de(n, h) && this.comparePoint(h) === 0, _ = de(i, u) && e.comparePoint(u) === 0, b = de(n, E) && this.comparePoint(E) === 0, M = de(i, a) && e.comparePoint(a) === 0;
|
|
1732
|
+
if (_ && p)
|
|
1733
|
+
return M && !b ? a : !M && b ? E : null;
|
|
1734
|
+
if (_)
|
|
1735
|
+
return b && u.x.eq(E.x) && u.y.eq(E.y) ? null : u;
|
|
1029
1736
|
if (p)
|
|
1030
|
-
return
|
|
1031
|
-
if (
|
|
1032
|
-
|
|
1033
|
-
if (
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
const h = Ce(o, this.vector(), l, t.vector());
|
|
1037
|
-
return h === null || !j(i, h) ? null : J.round(h.x, h.y);
|
|
1737
|
+
return M && a.x.eq(h.x) && a.y.eq(h.y) ? null : h;
|
|
1738
|
+
if (M && b) return null;
|
|
1739
|
+
if (M) return a;
|
|
1740
|
+
if (b) return E;
|
|
1741
|
+
const T = Xt(u, this.vector(), h, e.vector());
|
|
1742
|
+
return T === null || !de(r, T) ? null : oe.snap(T);
|
|
1038
1743
|
}
|
|
1039
1744
|
/**
|
|
1040
1745
|
* Split the given segment into multiple segments on the given points.
|
|
@@ -1048,40 +1753,45 @@ class z {
|
|
|
1048
1753
|
*
|
|
1049
1754
|
* Warning: input array of points is modified
|
|
1050
1755
|
*/
|
|
1051
|
-
split(
|
|
1052
|
-
const
|
|
1053
|
-
this.replaceRightSE(
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1756
|
+
split(e) {
|
|
1757
|
+
const n = [], i = e.events !== void 0, r = new ne(e, !0), u = new ne(e, !1), a = this.rightSE;
|
|
1758
|
+
this.replaceRightSE(u), n.push(u), n.push(r);
|
|
1759
|
+
const h = new Ce(
|
|
1760
|
+
r,
|
|
1761
|
+
a,
|
|
1762
|
+
this.rings.slice(),
|
|
1763
|
+
this.windings.slice()
|
|
1764
|
+
);
|
|
1765
|
+
return ne.comparePoints(h.leftSE.point, h.rightSE.point) > 0 && h.swapEvents(), ne.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), i && (r.checkForConsuming(), u.checkForConsuming()), n;
|
|
1056
1766
|
}
|
|
1057
1767
|
/* Swap which event is left and right */
|
|
1058
1768
|
swapEvents() {
|
|
1059
|
-
const
|
|
1060
|
-
this.rightSE = this.leftSE, this.leftSE =
|
|
1061
|
-
for (let
|
|
1062
|
-
this.windings[
|
|
1769
|
+
const e = this.rightSE;
|
|
1770
|
+
this.rightSE = this.leftSE, this.leftSE = e, this.leftSE.isLeft = !0, this.rightSE.isLeft = !1;
|
|
1771
|
+
for (let n = 0, i = this.windings.length; n < i; n++)
|
|
1772
|
+
this.windings[n] *= -1;
|
|
1063
1773
|
}
|
|
1064
1774
|
/* Consume another segment. We take their rings under our wing
|
|
1065
1775
|
* and mark them as consumed. Use for perfectly overlapping segments */
|
|
1066
|
-
consume(
|
|
1067
|
-
let
|
|
1068
|
-
for (; e.consumedBy; ) e = e.consumedBy;
|
|
1776
|
+
consume(e) {
|
|
1777
|
+
let n = this, i = e;
|
|
1069
1778
|
for (; n.consumedBy; ) n = n.consumedBy;
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1779
|
+
for (; i.consumedBy; ) i = i.consumedBy;
|
|
1780
|
+
const r = Ce.compare(n, i);
|
|
1781
|
+
if (r !== 0) {
|
|
1782
|
+
if (r > 0) {
|
|
1783
|
+
const u = n;
|
|
1784
|
+
n = i, i = u;
|
|
1075
1785
|
}
|
|
1076
|
-
if (
|
|
1077
|
-
const
|
|
1078
|
-
|
|
1786
|
+
if (n.prev === i) {
|
|
1787
|
+
const u = n;
|
|
1788
|
+
n = i, i = u;
|
|
1079
1789
|
}
|
|
1080
|
-
for (let
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1790
|
+
for (let u = 0, a = i.rings.length; u < a; u++) {
|
|
1791
|
+
const h = i.rings[u], E = i.windings[u], p = n.rings.indexOf(h);
|
|
1792
|
+
p === -1 ? (n.rings.push(h), n.windings.push(E)) : n.windings[p] += E;
|
|
1083
1793
|
}
|
|
1084
|
-
|
|
1794
|
+
i.rings = null, i.windings = null, i.consumedBy = n, i.leftSE.consumedBy = n.leftSE, i.rightSE.consumedBy = n.rightSE;
|
|
1085
1795
|
}
|
|
1086
1796
|
}
|
|
1087
1797
|
/* The first segment previous segment chain that is in the result */
|
|
@@ -1090,45 +1800,46 @@ class z {
|
|
|
1090
1800
|
}
|
|
1091
1801
|
beforeState() {
|
|
1092
1802
|
if (this._beforeState !== void 0) return this._beforeState;
|
|
1093
|
-
if (!this.prev)
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1803
|
+
if (!this.prev)
|
|
1804
|
+
this._beforeState = {
|
|
1805
|
+
rings: [],
|
|
1806
|
+
windings: [],
|
|
1807
|
+
multiPolys: []
|
|
1808
|
+
};
|
|
1098
1809
|
else {
|
|
1099
|
-
const
|
|
1100
|
-
this._beforeState =
|
|
1810
|
+
const e = this.prev.consumedBy || this.prev;
|
|
1811
|
+
this._beforeState = e.afterState();
|
|
1101
1812
|
}
|
|
1102
1813
|
return this._beforeState;
|
|
1103
1814
|
}
|
|
1104
1815
|
afterState() {
|
|
1105
1816
|
if (this._afterState !== void 0) return this._afterState;
|
|
1106
|
-
const
|
|
1817
|
+
const e = this.beforeState();
|
|
1107
1818
|
this._afterState = {
|
|
1108
|
-
rings:
|
|
1109
|
-
windings:
|
|
1819
|
+
rings: e.rings.slice(0),
|
|
1820
|
+
windings: e.windings.slice(0),
|
|
1110
1821
|
multiPolys: []
|
|
1111
1822
|
};
|
|
1112
|
-
const
|
|
1113
|
-
for (let
|
|
1114
|
-
const
|
|
1115
|
-
|
|
1116
|
-
}
|
|
1117
|
-
const
|
|
1118
|
-
for (let
|
|
1119
|
-
if (
|
|
1120
|
-
const
|
|
1121
|
-
if (
|
|
1122
|
-
if (
|
|
1823
|
+
const n = this._afterState.rings, i = this._afterState.windings, r = this._afterState.multiPolys;
|
|
1824
|
+
for (let h = 0, E = this.rings.length; h < E; h++) {
|
|
1825
|
+
const p = this.rings[h], _ = this.windings[h], b = n.indexOf(p);
|
|
1826
|
+
b === -1 ? (n.push(p), i.push(_)) : i[b] += _;
|
|
1827
|
+
}
|
|
1828
|
+
const u = [], a = [];
|
|
1829
|
+
for (let h = 0, E = n.length; h < E; h++) {
|
|
1830
|
+
if (i[h] === 0) continue;
|
|
1831
|
+
const p = n[h], _ = p.poly;
|
|
1832
|
+
if (a.indexOf(_) === -1)
|
|
1833
|
+
if (p.isExterior) u.push(_);
|
|
1123
1834
|
else {
|
|
1124
|
-
|
|
1125
|
-
const
|
|
1126
|
-
|
|
1835
|
+
a.indexOf(_) === -1 && a.push(_);
|
|
1836
|
+
const b = u.indexOf(p.poly);
|
|
1837
|
+
b !== -1 && u.splice(b, 1);
|
|
1127
1838
|
}
|
|
1128
1839
|
}
|
|
1129
|
-
for (let
|
|
1130
|
-
const
|
|
1131
|
-
|
|
1840
|
+
for (let h = 0, E = u.length; h < E; h++) {
|
|
1841
|
+
const p = u[h].multiPoly;
|
|
1842
|
+
r.indexOf(p) === -1 && r.push(p);
|
|
1132
1843
|
}
|
|
1133
1844
|
return this._afterState;
|
|
1134
1845
|
}
|
|
@@ -1136,59 +1847,54 @@ class z {
|
|
|
1136
1847
|
isInResult() {
|
|
1137
1848
|
if (this.consumedBy) return !1;
|
|
1138
1849
|
if (this._isInResult !== void 0) return this._isInResult;
|
|
1139
|
-
const
|
|
1140
|
-
switch (
|
|
1850
|
+
const e = this.beforeState().multiPolys, n = this.afterState().multiPolys;
|
|
1851
|
+
switch (Re.type) {
|
|
1141
1852
|
case "union": {
|
|
1142
|
-
const
|
|
1143
|
-
this._isInResult =
|
|
1853
|
+
const i = e.length === 0, r = n.length === 0;
|
|
1854
|
+
this._isInResult = i !== r;
|
|
1144
1855
|
break;
|
|
1145
1856
|
}
|
|
1146
1857
|
case "intersection": {
|
|
1147
|
-
let
|
|
1148
|
-
|
|
1858
|
+
let i, r;
|
|
1859
|
+
e.length < n.length ? (i = e.length, r = n.length) : (i = n.length, r = e.length), this._isInResult = r === Re.numMultiPolys && i < r;
|
|
1149
1860
|
break;
|
|
1150
1861
|
}
|
|
1151
1862
|
case "xor": {
|
|
1152
|
-
const
|
|
1153
|
-
this._isInResult =
|
|
1863
|
+
const i = Math.abs(e.length - n.length);
|
|
1864
|
+
this._isInResult = i % 2 === 1;
|
|
1154
1865
|
break;
|
|
1155
1866
|
}
|
|
1156
1867
|
case "difference": {
|
|
1157
|
-
const
|
|
1158
|
-
this._isInResult =
|
|
1868
|
+
const i = (r) => r.length === 1 && r[0].isSubject;
|
|
1869
|
+
this._isInResult = i(e) !== i(n);
|
|
1159
1870
|
break;
|
|
1160
1871
|
}
|
|
1161
|
-
default:
|
|
1162
|
-
throw new Error(`Unrecognized operation type found ${k.type}`);
|
|
1163
1872
|
}
|
|
1164
1873
|
return this._isInResult;
|
|
1165
1874
|
}
|
|
1166
|
-
}
|
|
1167
|
-
class $t {
|
|
1875
|
+
}, nt = class {
|
|
1168
1876
|
constructor(t, e, n) {
|
|
1877
|
+
C(this, "poly");
|
|
1878
|
+
C(this, "isExterior");
|
|
1879
|
+
C(this, "segments");
|
|
1880
|
+
C(this, "bbox");
|
|
1169
1881
|
if (!Array.isArray(t) || t.length === 0)
|
|
1170
1882
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1171
1883
|
if (this.poly = e, this.isExterior = n, this.segments = [], typeof t[0][0] != "number" || typeof t[0][1] != "number")
|
|
1172
1884
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1173
|
-
const i =
|
|
1885
|
+
const i = oe.snap({ x: new ie(t[0][0]), y: new ie(t[0][1]) });
|
|
1174
1886
|
this.bbox = {
|
|
1175
|
-
ll: {
|
|
1176
|
-
|
|
1177
|
-
y: i.y
|
|
1178
|
-
},
|
|
1179
|
-
ur: {
|
|
1180
|
-
x: i.x,
|
|
1181
|
-
y: i.y
|
|
1182
|
-
}
|
|
1887
|
+
ll: { x: i.x, y: i.y },
|
|
1888
|
+
ur: { x: i.x, y: i.y }
|
|
1183
1889
|
};
|
|
1184
|
-
let
|
|
1185
|
-
for (let u = 1,
|
|
1890
|
+
let r = i;
|
|
1891
|
+
for (let u = 1, a = t.length; u < a; u++) {
|
|
1186
1892
|
if (typeof t[u][0] != "number" || typeof t[u][1] != "number")
|
|
1187
1893
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1188
|
-
|
|
1189
|
-
|
|
1894
|
+
const h = oe.snap({ x: new ie(t[u][0]), y: new ie(t[u][1]) });
|
|
1895
|
+
h.x.eq(r.x) && h.y.eq(r.y) || (this.segments.push(Ne.fromRing(r, h, this)), h.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = h.x), h.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = h.y), h.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = h.x), h.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = h.y), r = h);
|
|
1190
1896
|
}
|
|
1191
|
-
(i.x
|
|
1897
|
+
(!i.x.eq(r.x) || !i.y.eq(r.y)) && this.segments.push(Ne.fromRing(r, i, this));
|
|
1192
1898
|
}
|
|
1193
1899
|
getSweepEvents() {
|
|
1194
1900
|
const t = [];
|
|
@@ -1198,24 +1904,21 @@ class $t {
|
|
|
1198
1904
|
}
|
|
1199
1905
|
return t;
|
|
1200
1906
|
}
|
|
1201
|
-
}
|
|
1202
|
-
class Ie {
|
|
1907
|
+
}, jt = class {
|
|
1203
1908
|
constructor(t, e) {
|
|
1909
|
+
C(this, "multiPoly");
|
|
1910
|
+
C(this, "exteriorRing");
|
|
1911
|
+
C(this, "interiorRings");
|
|
1912
|
+
C(this, "bbox");
|
|
1204
1913
|
if (!Array.isArray(t))
|
|
1205
1914
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1206
|
-
this.exteriorRing = new
|
|
1207
|
-
ll: {
|
|
1208
|
-
|
|
1209
|
-
y: this.exteriorRing.bbox.ll.y
|
|
1210
|
-
},
|
|
1211
|
-
ur: {
|
|
1212
|
-
x: this.exteriorRing.bbox.ur.x,
|
|
1213
|
-
y: this.exteriorRing.bbox.ur.y
|
|
1214
|
-
}
|
|
1915
|
+
this.exteriorRing = new nt(t[0], this, !0), this.bbox = {
|
|
1916
|
+
ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
|
|
1917
|
+
ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
|
|
1215
1918
|
}, this.interiorRings = [];
|
|
1216
1919
|
for (let n = 1, i = t.length; n < i; n++) {
|
|
1217
|
-
const
|
|
1218
|
-
|
|
1920
|
+
const r = new nt(t[n], this, !1);
|
|
1921
|
+
r.bbox.ll.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = r.bbox.ll.x), r.bbox.ll.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = r.bbox.ll.y), r.bbox.ur.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = r.bbox.ur.x), r.bbox.ur.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = r.bbox.ur.y), this.interiorRings.push(r);
|
|
1219
1922
|
}
|
|
1220
1923
|
this.multiPoly = e;
|
|
1221
1924
|
}
|
|
@@ -1223,14 +1926,16 @@ class Ie {
|
|
|
1223
1926
|
const t = this.exteriorRing.getSweepEvents();
|
|
1224
1927
|
for (let e = 0, n = this.interiorRings.length; e < n; e++) {
|
|
1225
1928
|
const i = this.interiorRings[e].getSweepEvents();
|
|
1226
|
-
for (let
|
|
1227
|
-
t.push(i[
|
|
1929
|
+
for (let r = 0, u = i.length; r < u; r++)
|
|
1930
|
+
t.push(i[r]);
|
|
1228
1931
|
}
|
|
1229
1932
|
return t;
|
|
1230
1933
|
}
|
|
1231
|
-
}
|
|
1232
|
-
class kt {
|
|
1934
|
+
}, it = class {
|
|
1233
1935
|
constructor(t, e) {
|
|
1936
|
+
C(this, "isSubject");
|
|
1937
|
+
C(this, "polys");
|
|
1938
|
+
C(this, "bbox");
|
|
1234
1939
|
if (!Array.isArray(t))
|
|
1235
1940
|
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1236
1941
|
try {
|
|
@@ -1238,18 +1943,12 @@ class kt {
|
|
|
1238
1943
|
} catch {
|
|
1239
1944
|
}
|
|
1240
1945
|
this.polys = [], this.bbox = {
|
|
1241
|
-
ll: {
|
|
1242
|
-
|
|
1243
|
-
y: Number.POSITIVE_INFINITY
|
|
1244
|
-
},
|
|
1245
|
-
ur: {
|
|
1246
|
-
x: Number.NEGATIVE_INFINITY,
|
|
1247
|
-
y: Number.NEGATIVE_INFINITY
|
|
1248
|
-
}
|
|
1946
|
+
ll: { x: new ie(Number.POSITIVE_INFINITY), y: new ie(Number.POSITIVE_INFINITY) },
|
|
1947
|
+
ur: { x: new ie(Number.NEGATIVE_INFINITY), y: new ie(Number.NEGATIVE_INFINITY) }
|
|
1249
1948
|
};
|
|
1250
1949
|
for (let n = 0, i = t.length; n < i; n++) {
|
|
1251
|
-
const
|
|
1252
|
-
|
|
1950
|
+
const r = new jt(t[n], this);
|
|
1951
|
+
r.bbox.ll.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = r.bbox.ll.x), r.bbox.ll.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = r.bbox.ll.y), r.bbox.ur.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = r.bbox.ur.x), r.bbox.ur.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = r.bbox.ur.y), this.polys.push(r);
|
|
1253
1952
|
}
|
|
1254
1953
|
this.isSubject = e;
|
|
1255
1954
|
}
|
|
@@ -1257,456 +1956,177 @@ class kt {
|
|
|
1257
1956
|
const t = [];
|
|
1258
1957
|
for (let e = 0, n = this.polys.length; e < n; e++) {
|
|
1259
1958
|
const i = this.polys[e].getSweepEvents();
|
|
1260
|
-
for (let
|
|
1261
|
-
t.push(i[
|
|
1262
|
-
}
|
|
1263
|
-
return t;
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
class nt {
|
|
1267
|
-
/* Given the segments from the sweep line pass, compute & return a series
|
|
1268
|
-
* of closed rings from all the segments marked to be part of the result */
|
|
1269
|
-
static factory(t) {
|
|
1270
|
-
const e = [];
|
|
1271
|
-
for (let n = 0, i = t.length; n < i; n++) {
|
|
1272
|
-
const o = t[n];
|
|
1273
|
-
if (!o.isInResult() || o.ringOut) continue;
|
|
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
|
-
for (; ; ) {
|
|
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
|
-
}
|
|
1283
|
-
if (a.length === 1) {
|
|
1284
|
-
c = a[0].otherSE;
|
|
1285
|
-
break;
|
|
1286
|
-
}
|
|
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
|
-
break;
|
|
1292
|
-
}
|
|
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
|
-
continue;
|
|
1297
|
-
}
|
|
1298
|
-
s.push({
|
|
1299
|
-
index: f.length,
|
|
1300
|
-
point: l.point
|
|
1301
|
-
});
|
|
1302
|
-
const g = l.getLeftmostComparator(u);
|
|
1303
|
-
c = a.sort(g)[0].otherSE;
|
|
1304
|
-
break;
|
|
1305
|
-
}
|
|
1306
|
-
e.push(new nt(f));
|
|
1307
|
-
}
|
|
1308
|
-
return e;
|
|
1309
|
-
}
|
|
1310
|
-
constructor(t) {
|
|
1311
|
-
this.events = t;
|
|
1312
|
-
for (let e = 0, n = t.length; e < n; e++)
|
|
1313
|
-
t[e].segment.ringOut = this;
|
|
1314
|
-
this.poly = null;
|
|
1315
|
-
}
|
|
1316
|
-
getGeom() {
|
|
1317
|
-
let t = this.events[0].point;
|
|
1318
|
-
const e = [t];
|
|
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
|
-
}
|
|
1323
|
-
if (e.length === 1) return null;
|
|
1324
|
-
const n = e[0], i = e[1];
|
|
1325
|
-
Ct(n, t, i) === 0 && e.shift(), e.push(e[0]);
|
|
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
|
-
return c;
|
|
1329
|
-
}
|
|
1330
|
-
isExteriorRing() {
|
|
1331
|
-
if (this._isExteriorRing === void 0) {
|
|
1332
|
-
const t = this.enclosingRing();
|
|
1333
|
-
this._isExteriorRing = t ? !t.isExteriorRing() : !0;
|
|
1334
|
-
}
|
|
1335
|
-
return this._isExteriorRing;
|
|
1336
|
-
}
|
|
1337
|
-
enclosingRing() {
|
|
1338
|
-
return this._enclosingRing === void 0 && (this._enclosingRing = this._calcEnclosingRing()), this._enclosingRing;
|
|
1339
|
-
}
|
|
1340
|
-
/* Returns the ring that encloses this one, if any */
|
|
1341
|
-
_calcEnclosingRing() {
|
|
1342
|
-
let t = this.events[0];
|
|
1343
|
-
for (let i = 1, o = this.events.length; i < o; i++) {
|
|
1344
|
-
const u = this.events[i];
|
|
1345
|
-
L.compare(t, u) > 0 && (t = u);
|
|
1346
|
-
}
|
|
1347
|
-
let e = t.segment.prevInResult(), n = e ? e.prevInResult() : null;
|
|
1348
|
-
for (; ; ) {
|
|
1349
|
-
if (!e) return null;
|
|
1350
|
-
if (!n) return e.ringOut;
|
|
1351
|
-
if (n.ringOut !== e.ringOut)
|
|
1352
|
-
return n.ringOut.enclosingRing() !== e.ringOut ? e.ringOut : e.ringOut.enclosingRing();
|
|
1353
|
-
e = n.prevInResult(), n = e ? e.prevInResult() : null;
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
}
|
|
1357
|
-
class At {
|
|
1358
|
-
constructor(t) {
|
|
1359
|
-
this.exteriorRing = t, t.poly = this, this.interiorRings = [];
|
|
1360
|
-
}
|
|
1361
|
-
addInterior(t) {
|
|
1362
|
-
this.interiorRings.push(t), t.poly = this;
|
|
1363
|
-
}
|
|
1364
|
-
getGeom() {
|
|
1365
|
-
const t = [this.exteriorRing.getGeom()];
|
|
1366
|
-
if (t[0] === null) return null;
|
|
1367
|
-
for (let e = 0, n = this.interiorRings.length; e < n; e++) {
|
|
1368
|
-
const i = this.interiorRings[e].getGeom();
|
|
1369
|
-
i !== null && t.push(i);
|
|
1370
|
-
}
|
|
1371
|
-
return t;
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
class $e {
|
|
1375
|
-
constructor(t) {
|
|
1376
|
-
this.rings = t, this.polys = this._composePolys(t);
|
|
1377
|
-
}
|
|
1378
|
-
getGeom() {
|
|
1379
|
-
const t = [];
|
|
1380
|
-
for (let e = 0, n = this.polys.length; e < n; e++) {
|
|
1381
|
-
const i = this.polys[e].getGeom();
|
|
1382
|
-
i !== null && t.push(i);
|
|
1959
|
+
for (let r = 0, u = i.length; r < u; r++)
|
|
1960
|
+
t.push(i[r]);
|
|
1383
1961
|
}
|
|
1384
1962
|
return t;
|
|
1385
1963
|
}
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
const u = o.enclosingRing();
|
|
1394
|
-
u.poly || e.push(new At(u)), u.poly.addInterior(o);
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
return e;
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
class ke {
|
|
1401
|
-
constructor(t) {
|
|
1402
|
-
let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : z.compare;
|
|
1403
|
-
this.queue = t, this.tree = new wt(e), this.segments = [];
|
|
1404
|
-
}
|
|
1405
|
-
process(t) {
|
|
1406
|
-
const e = t.segment, n = [];
|
|
1407
|
-
if (t.consumedBy)
|
|
1408
|
-
return t.isLeft ? this.queue.remove(t.otherSE) : this.tree.remove(e), n;
|
|
1409
|
-
const i = t.isLeft ? this.tree.add(e) : this.tree.find(e);
|
|
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, 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
|
-
for (; c === void 0; )
|
|
1415
|
-
u = this.tree.next(u), u === null ? c = null : u.key.consumedBy === void 0 && (c = u.key);
|
|
1416
|
-
if (t.isLeft) {
|
|
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
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
let p = null;
|
|
1427
|
-
if (c) {
|
|
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
|
-
}
|
|
1434
|
-
}
|
|
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
|
-
}
|
|
1442
|
-
n.length > 0 ? (this.tree.remove(e), n.push(t)) : (this.segments.push(e), e.prev = l);
|
|
1443
|
-
} else {
|
|
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
|
-
}
|
|
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
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
this.tree.remove(e);
|
|
1460
|
-
}
|
|
1461
|
-
return n;
|
|
1462
|
-
}
|
|
1463
|
-
/* Safely split a segment that is currently in the datastructures
|
|
1464
|
-
* IE - a segment other than the one that is currently being processed. */
|
|
1465
|
-
_splitSafely(t, e) {
|
|
1466
|
-
this.tree.remove(t);
|
|
1467
|
-
const n = t.rightSE;
|
|
1468
|
-
this.queue.remove(n);
|
|
1469
|
-
const i = t.split(e);
|
|
1470
|
-
return i.push(n), t.consumedBy === void 0 && this.tree.add(t), i;
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
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
|
-
run(t, e, n) {
|
|
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
|
-
}
|
|
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
|
-
}
|
|
1492
|
-
const o = new wt(L.compare);
|
|
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
|
-
throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
|
|
1498
|
-
}
|
|
1499
|
-
const u = new ke(o);
|
|
1500
|
-
let l = o.size, c = o.pop();
|
|
1501
|
-
for (; c; ) {
|
|
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
|
-
}
|
|
1507
|
-
if (o.size > Ot)
|
|
1508
|
-
throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
|
|
1509
|
-
if (u.segments.length > Ae)
|
|
1510
|
-
throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
|
|
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
|
-
}
|
|
1516
|
-
l = o.size, c = o.pop();
|
|
1517
|
-
}
|
|
1518
|
-
J.reset();
|
|
1519
|
-
const f = nt.factory(u.segments);
|
|
1520
|
-
return new $e(f).getGeom();
|
|
1521
|
-
}
|
|
1522
|
-
}
|
|
1523
|
-
const k = new Oe(), Ne = function(r) {
|
|
1524
|
-
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1525
|
-
e[n - 1] = arguments[n];
|
|
1526
|
-
return k.run("union", r, e);
|
|
1527
|
-
}, Be = 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 k.run("intersection", r, e);
|
|
1531
|
-
}, Ge = function(r) {
|
|
1532
|
-
for (var t = arguments.length, e = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
|
|
1533
|
-
e[n - 1] = arguments[n];
|
|
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
|
-
};
|
|
1540
|
-
var Zt = {
|
|
1541
|
-
union: Ne,
|
|
1542
|
-
intersection: Be,
|
|
1543
|
-
xor: Ge,
|
|
1544
|
-
difference: ze
|
|
1545
|
-
};
|
|
1546
|
-
function Fe(r, t = {}) {
|
|
1547
|
-
const e = [];
|
|
1548
|
-
if (vt(r, (i) => {
|
|
1549
|
-
e.push(i.coordinates);
|
|
1550
|
-
}), e.length < 2)
|
|
1964
|
+
}, Qt = (t, ...e) => Re.run("union", t, e), en = (t, ...e) => Re.run("difference", t, e);
|
|
1965
|
+
oe.set;
|
|
1966
|
+
function tn(t, e = {}) {
|
|
1967
|
+
const n = [];
|
|
1968
|
+
if (Ye(t, (r) => {
|
|
1969
|
+
n.push(r.coordinates);
|
|
1970
|
+
}), n.length < 2)
|
|
1551
1971
|
throw new Error("Must have at least 2 geometries");
|
|
1552
|
-
const
|
|
1553
|
-
return
|
|
1972
|
+
const i = Qt(n[0], ...n.slice(1));
|
|
1973
|
+
return i.length === 0 ? null : i.length === 1 ? Ze(i[0], e.properties) : gt(i, e.properties);
|
|
1554
1974
|
}
|
|
1555
|
-
var
|
|
1556
|
-
function
|
|
1557
|
-
const
|
|
1558
|
-
return
|
|
1975
|
+
var _t = tn;
|
|
1976
|
+
function Ve(t) {
|
|
1977
|
+
const e = [...t];
|
|
1978
|
+
return e[2] < e[0] && (Math.abs((e[0] + e[2] + 360) / 2) > Math.abs((e[0] - 360 + e[2]) / 2) ? e[0] -= 360 : e[2] += 360), e;
|
|
1559
1979
|
}
|
|
1560
|
-
function
|
|
1980
|
+
function Se() {
|
|
1561
1981
|
}
|
|
1562
|
-
function
|
|
1563
|
-
return
|
|
1982
|
+
function Tt(t) {
|
|
1983
|
+
return t();
|
|
1564
1984
|
}
|
|
1565
|
-
function
|
|
1985
|
+
function rt() {
|
|
1566
1986
|
return /* @__PURE__ */ Object.create(null);
|
|
1567
1987
|
}
|
|
1568
|
-
function
|
|
1569
|
-
|
|
1988
|
+
function Ae(t) {
|
|
1989
|
+
t.forEach(Tt);
|
|
1570
1990
|
}
|
|
1571
|
-
function
|
|
1572
|
-
return typeof
|
|
1991
|
+
function Lt(t) {
|
|
1992
|
+
return typeof t == "function";
|
|
1573
1993
|
}
|
|
1574
|
-
function
|
|
1575
|
-
return
|
|
1994
|
+
function nn(t, e) {
|
|
1995
|
+
return t != t ? e == e : t !== e || t && typeof t == "object" || typeof t == "function";
|
|
1576
1996
|
}
|
|
1577
|
-
function
|
|
1578
|
-
return Object.keys(
|
|
1997
|
+
function rn(t) {
|
|
1998
|
+
return Object.keys(t).length === 0;
|
|
1579
1999
|
}
|
|
1580
|
-
function
|
|
1581
|
-
|
|
2000
|
+
function sn(t, e) {
|
|
2001
|
+
t.appendChild(e);
|
|
1582
2002
|
}
|
|
1583
|
-
function
|
|
1584
|
-
|
|
2003
|
+
function on(t, e, n) {
|
|
2004
|
+
t.insertBefore(e, n || null);
|
|
1585
2005
|
}
|
|
1586
|
-
function
|
|
1587
|
-
|
|
2006
|
+
function Mt(t) {
|
|
2007
|
+
t.parentNode && t.parentNode.removeChild(t);
|
|
1588
2008
|
}
|
|
1589
|
-
function
|
|
1590
|
-
return document.createElementNS("http://www.w3.org/2000/svg",
|
|
2009
|
+
function st(t) {
|
|
2010
|
+
return document.createElementNS("http://www.w3.org/2000/svg", t);
|
|
1591
2011
|
}
|
|
1592
|
-
function
|
|
1593
|
-
|
|
2012
|
+
function ue(t, e, n) {
|
|
2013
|
+
n == null ? t.removeAttribute(e) : t.getAttribute(e) !== n && t.setAttribute(e, n);
|
|
1594
2014
|
}
|
|
1595
|
-
function
|
|
1596
|
-
return Array.from(
|
|
2015
|
+
function ln(t) {
|
|
2016
|
+
return Array.from(t.childNodes);
|
|
1597
2017
|
}
|
|
1598
|
-
function
|
|
1599
|
-
|
|
2018
|
+
function Le(t, e, n) {
|
|
2019
|
+
t.classList.toggle(e, !!n);
|
|
1600
2020
|
}
|
|
1601
|
-
let
|
|
1602
|
-
function
|
|
1603
|
-
|
|
2021
|
+
let Je;
|
|
2022
|
+
function we(t) {
|
|
2023
|
+
Je = t;
|
|
1604
2024
|
}
|
|
1605
|
-
const
|
|
1606
|
-
let
|
|
1607
|
-
const
|
|
1608
|
-
let
|
|
1609
|
-
function
|
|
1610
|
-
|
|
2025
|
+
const he = [], ot = [];
|
|
2026
|
+
let pe = [];
|
|
2027
|
+
const lt = [], un = /* @__PURE__ */ Promise.resolve();
|
|
2028
|
+
let Ke = !1;
|
|
2029
|
+
function fn() {
|
|
2030
|
+
Ke || (Ke = !0, un.then(Ct));
|
|
1611
2031
|
}
|
|
1612
|
-
function
|
|
1613
|
-
|
|
2032
|
+
function Xe(t) {
|
|
2033
|
+
pe.push(t);
|
|
1614
2034
|
}
|
|
1615
|
-
const
|
|
1616
|
-
let
|
|
1617
|
-
function
|
|
1618
|
-
if (
|
|
2035
|
+
const $e = /* @__PURE__ */ new Set();
|
|
2036
|
+
let ae = 0;
|
|
2037
|
+
function Ct() {
|
|
2038
|
+
if (ae !== 0)
|
|
1619
2039
|
return;
|
|
1620
|
-
const
|
|
2040
|
+
const t = Je;
|
|
1621
2041
|
do {
|
|
1622
2042
|
try {
|
|
1623
|
-
for (;
|
|
1624
|
-
const
|
|
1625
|
-
|
|
2043
|
+
for (; ae < he.length; ) {
|
|
2044
|
+
const e = he[ae];
|
|
2045
|
+
ae++, we(e), cn(e.$$);
|
|
1626
2046
|
}
|
|
1627
|
-
} catch (
|
|
1628
|
-
throw
|
|
1629
|
-
}
|
|
1630
|
-
for (
|
|
1631
|
-
for (let
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
} while (
|
|
1637
|
-
for (;
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
}
|
|
1641
|
-
function
|
|
1642
|
-
if (
|
|
1643
|
-
|
|
1644
|
-
const
|
|
1645
|
-
|
|
1646
|
-
}
|
|
1647
|
-
}
|
|
1648
|
-
function
|
|
1649
|
-
const
|
|
1650
|
-
|
|
1651
|
-
}
|
|
1652
|
-
const
|
|
1653
|
-
function
|
|
1654
|
-
|
|
1655
|
-
}
|
|
1656
|
-
function
|
|
1657
|
-
const { fragment:
|
|
1658
|
-
|
|
1659
|
-
const
|
|
1660
|
-
|
|
1661
|
-
}),
|
|
1662
|
-
}
|
|
1663
|
-
function
|
|
1664
|
-
const
|
|
1665
|
-
|
|
1666
|
-
}
|
|
1667
|
-
function
|
|
1668
|
-
|
|
1669
|
-
}
|
|
1670
|
-
function
|
|
1671
|
-
const
|
|
1672
|
-
|
|
1673
|
-
const
|
|
2047
|
+
} catch (e) {
|
|
2048
|
+
throw he.length = 0, ae = 0, e;
|
|
2049
|
+
}
|
|
2050
|
+
for (we(null), he.length = 0, ae = 0; ot.length; ) ot.pop()();
|
|
2051
|
+
for (let e = 0; e < pe.length; e += 1) {
|
|
2052
|
+
const n = pe[e];
|
|
2053
|
+
$e.has(n) || ($e.add(n), n());
|
|
2054
|
+
}
|
|
2055
|
+
pe.length = 0;
|
|
2056
|
+
} while (he.length);
|
|
2057
|
+
for (; lt.length; )
|
|
2058
|
+
lt.pop()();
|
|
2059
|
+
Ke = !1, $e.clear(), we(t);
|
|
2060
|
+
}
|
|
2061
|
+
function cn(t) {
|
|
2062
|
+
if (t.fragment !== null) {
|
|
2063
|
+
t.update(), Ae(t.before_update);
|
|
2064
|
+
const e = t.dirty;
|
|
2065
|
+
t.dirty = [-1], t.fragment && t.fragment.p(t.ctx, e), t.after_update.forEach(Xe);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
function an(t) {
|
|
2069
|
+
const e = [], n = [];
|
|
2070
|
+
pe.forEach((i) => t.indexOf(i) === -1 ? e.push(i) : n.push(i)), n.forEach((i) => i()), pe = e;
|
|
2071
|
+
}
|
|
2072
|
+
const hn = /* @__PURE__ */ new Set();
|
|
2073
|
+
function pn(t, e) {
|
|
2074
|
+
t && t.i && (hn.delete(t), t.i(e));
|
|
2075
|
+
}
|
|
2076
|
+
function gn(t, e, n) {
|
|
2077
|
+
const { fragment: i, after_update: r } = t.$$;
|
|
2078
|
+
i && i.m(e, n), Xe(() => {
|
|
2079
|
+
const u = t.$$.on_mount.map(Tt).filter(Lt);
|
|
2080
|
+
t.$$.on_destroy ? t.$$.on_destroy.push(...u) : Ae(u), t.$$.on_mount = [];
|
|
2081
|
+
}), r.forEach(Xe);
|
|
2082
|
+
}
|
|
2083
|
+
function yn(t, e) {
|
|
2084
|
+
const n = t.$$;
|
|
2085
|
+
n.fragment !== null && (an(n.after_update), Ae(n.on_destroy), n.fragment && n.fragment.d(e), n.on_destroy = n.fragment = null, n.ctx = []);
|
|
2086
|
+
}
|
|
2087
|
+
function dn(t, e) {
|
|
2088
|
+
t.$$.dirty[0] === -1 && (he.push(t), fn(), t.$$.dirty.fill(0)), t.$$.dirty[e / 31 | 0] |= 1 << e % 31;
|
|
2089
|
+
}
|
|
2090
|
+
function mn(t, e, n, i, r, u, a = null, h = [-1]) {
|
|
2091
|
+
const E = Je;
|
|
2092
|
+
we(t);
|
|
2093
|
+
const p = t.$$ = {
|
|
1674
2094
|
fragment: null,
|
|
1675
2095
|
ctx: [],
|
|
1676
2096
|
// state
|
|
1677
|
-
props:
|
|
1678
|
-
update:
|
|
1679
|
-
not_equal:
|
|
1680
|
-
bound:
|
|
2097
|
+
props: u,
|
|
2098
|
+
update: Se,
|
|
2099
|
+
not_equal: r,
|
|
2100
|
+
bound: rt(),
|
|
1681
2101
|
// lifecycle
|
|
1682
2102
|
on_mount: [],
|
|
1683
2103
|
on_destroy: [],
|
|
1684
2104
|
on_disconnect: [],
|
|
1685
2105
|
before_update: [],
|
|
1686
2106
|
after_update: [],
|
|
1687
|
-
context: new Map(
|
|
2107
|
+
context: new Map(e.context || (E ? E.$$.context : [])),
|
|
1688
2108
|
// everything else
|
|
1689
|
-
callbacks:
|
|
1690
|
-
dirty:
|
|
2109
|
+
callbacks: rt(),
|
|
2110
|
+
dirty: h,
|
|
1691
2111
|
skip_bound: !1,
|
|
1692
|
-
root:
|
|
2112
|
+
root: e.target || E.$$.root
|
|
1693
2113
|
};
|
|
1694
|
-
|
|
1695
|
-
let
|
|
1696
|
-
if (
|
|
1697
|
-
const
|
|
1698
|
-
return
|
|
1699
|
-
})
|
|
1700
|
-
if (
|
|
1701
|
-
const
|
|
1702
|
-
|
|
2114
|
+
a && a(p.root);
|
|
2115
|
+
let _ = !1;
|
|
2116
|
+
if (p.ctx = n(t, e.props || {}, (b, M, ...T) => {
|
|
2117
|
+
const L = T.length ? T[0] : M;
|
|
2118
|
+
return p.ctx && r(p.ctx[b], p.ctx[b] = L) && (!p.skip_bound && p.bound[b] && p.bound[b](L), _ && dn(t, b)), M;
|
|
2119
|
+
}), p.update(), _ = !0, Ae(p.before_update), p.fragment = i(p.ctx), e.target) {
|
|
2120
|
+
if (e.hydrate) {
|
|
2121
|
+
const b = ln(e.target);
|
|
2122
|
+
p.fragment && p.fragment.l(b), b.forEach(Mt);
|
|
1703
2123
|
} else
|
|
1704
|
-
|
|
1705
|
-
|
|
2124
|
+
p.fragment && p.fragment.c();
|
|
2125
|
+
e.intro && pn(t.$$.fragment), gn(t, e.target, e.anchor), Ct();
|
|
1706
2126
|
}
|
|
1707
|
-
|
|
2127
|
+
we(E);
|
|
1708
2128
|
}
|
|
1709
|
-
class
|
|
2129
|
+
class xn {
|
|
1710
2130
|
constructor() {
|
|
1711
2131
|
/**
|
|
1712
2132
|
* ### PRIVATE API
|
|
@@ -1715,7 +2135,7 @@ class en {
|
|
|
1715
2135
|
*
|
|
1716
2136
|
* @type {any}
|
|
1717
2137
|
*/
|
|
1718
|
-
|
|
2138
|
+
C(this, "$$");
|
|
1719
2139
|
/**
|
|
1720
2140
|
* ### PRIVATE API
|
|
1721
2141
|
*
|
|
@@ -1723,11 +2143,11 @@ class en {
|
|
|
1723
2143
|
*
|
|
1724
2144
|
* @type {any}
|
|
1725
2145
|
*/
|
|
1726
|
-
|
|
2146
|
+
C(this, "$$set");
|
|
1727
2147
|
}
|
|
1728
2148
|
/** @returns {void} */
|
|
1729
2149
|
$destroy() {
|
|
1730
|
-
|
|
2150
|
+
yn(this, 1), this.$destroy = Se;
|
|
1731
2151
|
}
|
|
1732
2152
|
/**
|
|
1733
2153
|
* @template {Extract<keyof Events, string>} K
|
|
@@ -1735,103 +2155,102 @@ class en {
|
|
|
1735
2155
|
* @param {((e: Events[K]) => void) | null | undefined} callback
|
|
1736
2156
|
* @returns {() => void}
|
|
1737
2157
|
*/
|
|
1738
|
-
$on(
|
|
1739
|
-
if (!
|
|
1740
|
-
return
|
|
1741
|
-
const
|
|
1742
|
-
return
|
|
1743
|
-
const
|
|
1744
|
-
|
|
2158
|
+
$on(e, n) {
|
|
2159
|
+
if (!Lt(n))
|
|
2160
|
+
return Se;
|
|
2161
|
+
const i = this.$$.callbacks[e] || (this.$$.callbacks[e] = []);
|
|
2162
|
+
return i.push(n), () => {
|
|
2163
|
+
const r = i.indexOf(n);
|
|
2164
|
+
r !== -1 && i.splice(r, 1);
|
|
1745
2165
|
};
|
|
1746
2166
|
}
|
|
1747
2167
|
/**
|
|
1748
2168
|
* @param {Partial<Props>} props
|
|
1749
2169
|
* @returns {void}
|
|
1750
2170
|
*/
|
|
1751
|
-
$set(
|
|
1752
|
-
this.$$set && !
|
|
2171
|
+
$set(e) {
|
|
2172
|
+
this.$$set && !rn(e) && (this.$$.skip_bound = !0, this.$$set(e), this.$$.skip_bound = !1);
|
|
1753
2173
|
}
|
|
1754
2174
|
}
|
|
1755
|
-
const
|
|
1756
|
-
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(
|
|
1757
|
-
function
|
|
1758
|
-
let
|
|
2175
|
+
const wn = "4";
|
|
2176
|
+
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(wn);
|
|
2177
|
+
function En(t) {
|
|
2178
|
+
let e, n, i;
|
|
1759
2179
|
return {
|
|
1760
2180
|
c() {
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
2181
|
+
e = st("svg"), n = st("path"), ue(n, "stroke-width", "4"), ue(n, "d", "M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"), ue(n, "class", "svelte-gzo3ar"), ue(e, "width", i = /*displayIn*/
|
|
2182
|
+
t[0] === "list" ? 20 : void 0), ue(e, "viewBox", "0 0 70 85"), ue(e, "fill", "none"), ue(e, "class", "svelte-gzo3ar"), Le(
|
|
2183
|
+
e,
|
|
1764
2184
|
"in-map",
|
|
1765
2185
|
/*displayIn*/
|
|
1766
|
-
|
|
1767
|
-
),
|
|
1768
|
-
|
|
2186
|
+
t[0] !== "list"
|
|
2187
|
+
), Le(
|
|
2188
|
+
e,
|
|
1769
2189
|
"list-icon",
|
|
1770
2190
|
/*displayIn*/
|
|
1771
|
-
|
|
2191
|
+
t[0] === "list"
|
|
1772
2192
|
);
|
|
1773
2193
|
},
|
|
1774
|
-
m(
|
|
1775
|
-
|
|
2194
|
+
m(r, u) {
|
|
2195
|
+
on(r, e, u), sn(e, n);
|
|
1776
2196
|
},
|
|
1777
|
-
p(
|
|
1778
|
-
|
|
1779
|
-
1 &&
|
|
1780
|
-
|
|
1781
|
-
1 &&
|
|
1782
|
-
|
|
2197
|
+
p(r, [u]) {
|
|
2198
|
+
u & /*displayIn*/
|
|
2199
|
+
1 && i !== (i = /*displayIn*/
|
|
2200
|
+
r[0] === "list" ? 20 : void 0) && ue(e, "width", i), u & /*displayIn*/
|
|
2201
|
+
1 && Le(
|
|
2202
|
+
e,
|
|
1783
2203
|
"in-map",
|
|
1784
2204
|
/*displayIn*/
|
|
1785
|
-
|
|
1786
|
-
),
|
|
1787
|
-
1 &&
|
|
1788
|
-
|
|
2205
|
+
r[0] !== "list"
|
|
2206
|
+
), u & /*displayIn*/
|
|
2207
|
+
1 && Le(
|
|
2208
|
+
e,
|
|
1789
2209
|
"list-icon",
|
|
1790
2210
|
/*displayIn*/
|
|
1791
|
-
|
|
2211
|
+
r[0] === "list"
|
|
1792
2212
|
);
|
|
1793
2213
|
},
|
|
1794
|
-
i:
|
|
1795
|
-
o:
|
|
1796
|
-
d(
|
|
1797
|
-
|
|
2214
|
+
i: Se,
|
|
2215
|
+
o: Se,
|
|
2216
|
+
d(r) {
|
|
2217
|
+
r && Mt(e);
|
|
1798
2218
|
}
|
|
1799
2219
|
};
|
|
1800
2220
|
}
|
|
1801
|
-
function
|
|
1802
|
-
let { displayIn:
|
|
1803
|
-
return
|
|
1804
|
-
"displayIn" in
|
|
1805
|
-
}, [
|
|
2221
|
+
function vn(t, e, n) {
|
|
2222
|
+
let { displayIn: i } = e;
|
|
2223
|
+
return t.$$set = (r) => {
|
|
2224
|
+
"displayIn" in r && n(0, i = r.displayIn);
|
|
2225
|
+
}, [i];
|
|
1806
2226
|
}
|
|
1807
|
-
class
|
|
1808
|
-
constructor(
|
|
1809
|
-
super(),
|
|
2227
|
+
class Sn extends xn {
|
|
2228
|
+
constructor(e) {
|
|
2229
|
+
super(), mn(this, e, vn, En, nn, { displayIn: 0 });
|
|
1810
2230
|
}
|
|
1811
2231
|
}
|
|
1812
|
-
function
|
|
1813
|
-
const
|
|
1814
|
-
if (
|
|
1815
|
-
|
|
1816
|
-
}),
|
|
2232
|
+
function bn(t) {
|
|
2233
|
+
const e = [];
|
|
2234
|
+
if (Ye(t, (r) => {
|
|
2235
|
+
e.push(r.coordinates);
|
|
2236
|
+
}), e.length < 2)
|
|
1817
2237
|
throw new Error("Must have at least two features");
|
|
1818
|
-
const
|
|
1819
|
-
return
|
|
1820
|
-
}
|
|
1821
|
-
var
|
|
1822
|
-
function
|
|
1823
|
-
if (!
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
xt([
|
|
2238
|
+
const n = t.features[0].properties || {}, i = en(e[0], ...e.slice(1));
|
|
2239
|
+
return i.length === 0 ? null : i.length === 1 ? Ze(i[0], n) : gt(i, n);
|
|
2240
|
+
}
|
|
2241
|
+
var _n = bn;
|
|
2242
|
+
function Tn(t) {
|
|
2243
|
+
if (!t) throw new Error("geojson is required");
|
|
2244
|
+
var e = [];
|
|
2245
|
+
return Rt(t, function(n) {
|
|
2246
|
+
e.push(n);
|
|
2247
|
+
}), ve(e);
|
|
2248
|
+
}
|
|
2249
|
+
var Ln = Tn;
|
|
2250
|
+
function ut(t, e) {
|
|
2251
|
+
const n = _n(
|
|
2252
|
+
ve([
|
|
2253
|
+
Ze([
|
|
1835
2254
|
[
|
|
1836
2255
|
[180, 90],
|
|
1837
2256
|
[-180, 90],
|
|
@@ -1840,63 +2259,63 @@ function Ft(r, t) {
|
|
|
1840
2259
|
[180, 90]
|
|
1841
2260
|
]
|
|
1842
2261
|
]),
|
|
1843
|
-
|
|
2262
|
+
t
|
|
1844
2263
|
])
|
|
1845
2264
|
);
|
|
1846
|
-
if (!
|
|
2265
|
+
if (!n)
|
|
1847
2266
|
return;
|
|
1848
|
-
|
|
1849
|
-
const
|
|
1850
|
-
if (
|
|
1851
|
-
for (const
|
|
1852
|
-
const
|
|
1853
|
-
if (
|
|
1854
|
-
for (const
|
|
1855
|
-
for (const
|
|
1856
|
-
|
|
1857
|
-
if (
|
|
1858
|
-
for (const
|
|
1859
|
-
for (const
|
|
1860
|
-
|
|
1861
|
-
}
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
2267
|
+
n.properties = { isMask: !0 };
|
|
2268
|
+
const i = Ve(qe(t)), r = (i[2] - i[0]) / 360 / 1e3, u = i[0] < -180, a = i[2] > 180, h = Ln(t);
|
|
2269
|
+
if (h.features.length > 1 && (u || a))
|
|
2270
|
+
for (const E of h.features) {
|
|
2271
|
+
const p = Ve(qe(E));
|
|
2272
|
+
if (a && p[0] < -180 + r)
|
|
2273
|
+
for (const _ of E.geometry.coordinates)
|
|
2274
|
+
for (const b of _)
|
|
2275
|
+
b[0] += 360 - r;
|
|
2276
|
+
if (u && p[2] > 180 - r)
|
|
2277
|
+
for (const _ of E.geometry.coordinates)
|
|
2278
|
+
for (const b of _)
|
|
2279
|
+
b[0] -= 360 - r;
|
|
2280
|
+
}
|
|
2281
|
+
e(
|
|
2282
|
+
ve([
|
|
2283
|
+
h.features.length < 2 ? t : _t(h) ?? t,
|
|
2284
|
+
n
|
|
1866
2285
|
])
|
|
1867
2286
|
);
|
|
1868
2287
|
}
|
|
1869
|
-
const
|
|
1870
|
-
var
|
|
1871
|
-
const
|
|
2288
|
+
const ft = (t) => {
|
|
2289
|
+
var i, r, u;
|
|
2290
|
+
const e = (i = t == null ? void 0 : t.geometry) == null ? void 0 : i.type, n = (r = t == null ? void 0 : t.properties) != null && r.isMask ? 0 : e === "LineString" || e === "MultiLineString" ? 3 : 2;
|
|
1872
2291
|
return {
|
|
1873
2292
|
color: "#3170fe",
|
|
1874
2293
|
fillColor: "#000",
|
|
1875
|
-
fillOpacity: (
|
|
1876
|
-
weight:
|
|
1877
|
-
dashArray: [
|
|
2294
|
+
fillOpacity: (u = t == null ? void 0 : t.properties) != null && u.isMask ? 0.1 : 0,
|
|
2295
|
+
weight: n,
|
|
2296
|
+
dashArray: [n, n],
|
|
1878
2297
|
lineCap: "butt"
|
|
1879
2298
|
};
|
|
1880
2299
|
};
|
|
1881
|
-
function
|
|
1882
|
-
let
|
|
1883
|
-
const
|
|
1884
|
-
let
|
|
1885
|
-
const
|
|
1886
|
-
style:
|
|
2300
|
+
function Cn(t, e = !0, n = !0, i = {}, r = {}, u = ft) {
|
|
2301
|
+
let a;
|
|
2302
|
+
const h = [];
|
|
2303
|
+
let E, p;
|
|
2304
|
+
const _ = ce.geoJSON(void 0, {
|
|
2305
|
+
style: u === !0 ? ft : u === !1 ? void 0 : u ?? void 0,
|
|
1887
2306
|
interactive: !1
|
|
1888
|
-
}).addTo(
|
|
1889
|
-
|
|
2307
|
+
}).addTo(t), b = (T) => {
|
|
2308
|
+
a == null || a({
|
|
1890
2309
|
type: "mapClick",
|
|
1891
|
-
coordinates: [
|
|
2310
|
+
coordinates: [T.latlng.lng, T.latlng.lat]
|
|
1892
2311
|
});
|
|
1893
2312
|
};
|
|
1894
|
-
function
|
|
1895
|
-
const
|
|
1896
|
-
return new
|
|
1897
|
-
interactive:
|
|
1898
|
-
icon: new
|
|
1899
|
-
html:
|
|
2313
|
+
function M(T, L = !1) {
|
|
2314
|
+
const B = document.createElement("div");
|
|
2315
|
+
return new Sn({ props: { displayIn: "leaflet" }, target: B }), new ce.Marker(T, {
|
|
2316
|
+
interactive: L,
|
|
2317
|
+
icon: new ce.DivIcon({
|
|
2318
|
+
html: B,
|
|
1900
2319
|
className: "",
|
|
1901
2320
|
iconAnchor: [12, 26],
|
|
1902
2321
|
iconSize: [25, 30],
|
|
@@ -1905,152 +2324,152 @@ function an(r, t = !0, e = !0, n = {}, i = {}, o = Tt) {
|
|
|
1905
2324
|
});
|
|
1906
2325
|
}
|
|
1907
2326
|
return {
|
|
1908
|
-
setEventHandler(
|
|
1909
|
-
|
|
2327
|
+
setEventHandler(T) {
|
|
2328
|
+
T ? (a = T, t.on("click", b)) : (a = void 0, t.off("click", b));
|
|
1910
2329
|
},
|
|
1911
|
-
flyTo(
|
|
1912
|
-
|
|
2330
|
+
flyTo(T, L) {
|
|
2331
|
+
t.flyTo([T[1], T[0]], L, { duration: 2, ...i });
|
|
1913
2332
|
},
|
|
1914
|
-
fitBounds(
|
|
1915
|
-
|
|
2333
|
+
fitBounds(T, L, B) {
|
|
2334
|
+
t.flyToBounds(
|
|
1916
2335
|
[
|
|
1917
|
-
[
|
|
1918
|
-
[
|
|
2336
|
+
[T[1], T[0]],
|
|
2337
|
+
[T[3], T[2]]
|
|
1919
2338
|
],
|
|
1920
2339
|
{
|
|
1921
|
-
padding: [
|
|
2340
|
+
padding: [L, L],
|
|
1922
2341
|
duration: 2,
|
|
1923
|
-
...
|
|
1924
|
-
...
|
|
2342
|
+
...B ? { maxZoom: B } : {},
|
|
2343
|
+
...r
|
|
1925
2344
|
}
|
|
1926
2345
|
);
|
|
1927
2346
|
},
|
|
1928
|
-
indicateReverse(
|
|
1929
|
-
|
|
2347
|
+
indicateReverse(T) {
|
|
2348
|
+
t.getContainer().style.cursor = T ? "crosshair" : "";
|
|
1930
2349
|
},
|
|
1931
|
-
setReverseMarker(
|
|
1932
|
-
var
|
|
1933
|
-
if (!
|
|
2350
|
+
setReverseMarker(T) {
|
|
2351
|
+
var B;
|
|
2352
|
+
if (!e)
|
|
1934
2353
|
return;
|
|
1935
|
-
const
|
|
1936
|
-
|
|
2354
|
+
const L = T && [T[1], T[0]];
|
|
2355
|
+
p ? L ? p.setLatLng(L) : (p.remove(), p = void 0) : L && (e instanceof Function ? p = e(t) ?? void 0 : (p = (typeof e == "object" ? new ce.Marker(L, e) : M(L)).addTo(t), (B = p.getElement()) == null || B.classList.add("marker-reverse")));
|
|
1937
2356
|
},
|
|
1938
|
-
setFeatures(
|
|
1939
|
-
function
|
|
1940
|
-
|
|
2357
|
+
setFeatures(T, L, B) {
|
|
2358
|
+
function q(I) {
|
|
2359
|
+
_.clearLayers(), I && _.addData(I);
|
|
1941
2360
|
}
|
|
1942
|
-
for (const
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
let
|
|
1947
|
-
if (
|
|
1948
|
-
const v =
|
|
1949
|
-
(
|
|
2361
|
+
for (const I of h)
|
|
2362
|
+
I.remove();
|
|
2363
|
+
h.length = 0, q();
|
|
2364
|
+
e: if (L) {
|
|
2365
|
+
let I = !1;
|
|
2366
|
+
if (L.geometry.type === "GeometryCollection") {
|
|
2367
|
+
const v = L.geometry.geometries.filter(
|
|
2368
|
+
(N) => N.type === "Polygon" || N.type === "MultiPolygon"
|
|
1950
2369
|
);
|
|
1951
|
-
|
|
1952
|
-
const
|
|
1953
|
-
|
|
2370
|
+
t: if (v.length > 0) {
|
|
2371
|
+
const N = _t(
|
|
2372
|
+
ve(v.map(($) => Ee($)))
|
|
1954
2373
|
);
|
|
1955
|
-
if (!
|
|
1956
|
-
break
|
|
1957
|
-
|
|
2374
|
+
if (!N)
|
|
2375
|
+
break t;
|
|
2376
|
+
ut(
|
|
1958
2377
|
{
|
|
1959
|
-
...
|
|
1960
|
-
geometry:
|
|
2378
|
+
...L,
|
|
2379
|
+
geometry: N.geometry
|
|
1961
2380
|
},
|
|
1962
|
-
|
|
1963
|
-
),
|
|
2381
|
+
q
|
|
2382
|
+
), I = !0;
|
|
1964
2383
|
} else {
|
|
1965
|
-
const
|
|
1966
|
-
(
|
|
2384
|
+
const N = L.geometry.geometries.filter(
|
|
2385
|
+
($) => $.type === "LineString" || $.type === "MultiLineString"
|
|
1967
2386
|
);
|
|
1968
|
-
|
|
1969
|
-
...
|
|
1970
|
-
geometry: { type: "GeometryCollection", geometries:
|
|
1971
|
-
}),
|
|
2387
|
+
N.length > 0 && (q({
|
|
2388
|
+
...L,
|
|
2389
|
+
geometry: { type: "GeometryCollection", geometries: N }
|
|
2390
|
+
}), I = !0);
|
|
1972
2391
|
}
|
|
1973
2392
|
}
|
|
1974
|
-
if (!
|
|
1975
|
-
if (
|
|
1976
|
-
|
|
2393
|
+
if (!I) {
|
|
2394
|
+
if (L.geometry.type === "Polygon" || L.geometry.type === "MultiPolygon")
|
|
2395
|
+
ut(L, (v) => {
|
|
1977
2396
|
if (!v)
|
|
1978
2397
|
return;
|
|
1979
|
-
const
|
|
1980
|
-
|
|
2398
|
+
const N = [...v.features], $ = Ve(qe(L)), K = $[2] - $[0];
|
|
2399
|
+
$[0] - K / 4 < -180 && N.push(...ct(v, -360).features), $[2] + K / 4 > 180 && N.push(...ct(v, 360).features), q(ve(N));
|
|
1981
2400
|
});
|
|
1982
|
-
else if (
|
|
1983
|
-
|
|
1984
|
-
break
|
|
2401
|
+
else if (L.geometry.type === "LineString" || L.geometry.type === "MultiLineString") {
|
|
2402
|
+
q(L);
|
|
2403
|
+
break e;
|
|
1985
2404
|
}
|
|
1986
2405
|
}
|
|
1987
|
-
if (!
|
|
1988
|
-
break
|
|
1989
|
-
if (
|
|
1990
|
-
const v = t
|
|
1991
|
-
v &&
|
|
1992
|
-
} else if (
|
|
1993
|
-
const v = [
|
|
1994
|
-
|
|
1995
|
-
typeof
|
|
2406
|
+
if (!B && L.geometry.type !== "Point")
|
|
2407
|
+
break e;
|
|
2408
|
+
if (e instanceof Function) {
|
|
2409
|
+
const v = e(t, L);
|
|
2410
|
+
v && h.push(v.addTo(t));
|
|
2411
|
+
} else if (e) {
|
|
2412
|
+
const v = [L.center[1], L.center[0]];
|
|
2413
|
+
h.push(
|
|
2414
|
+
typeof e == "object" ? new ce.Marker(v, e) : M(v).addTo(t)
|
|
1996
2415
|
);
|
|
1997
2416
|
}
|
|
1998
2417
|
}
|
|
1999
|
-
if (
|
|
2000
|
-
for (const
|
|
2001
|
-
if (
|
|
2418
|
+
if (n)
|
|
2419
|
+
for (const I of T ?? []) {
|
|
2420
|
+
if (I === L)
|
|
2002
2421
|
continue;
|
|
2003
2422
|
const v = [
|
|
2004
|
-
|
|
2005
|
-
|
|
2423
|
+
I.center[1],
|
|
2424
|
+
I.center[0]
|
|
2006
2425
|
];
|
|
2007
|
-
let
|
|
2008
|
-
if (
|
|
2009
|
-
if (
|
|
2426
|
+
let N;
|
|
2427
|
+
if (n instanceof Function) {
|
|
2428
|
+
if (N = n(t, I), !N)
|
|
2010
2429
|
continue;
|
|
2011
2430
|
} else
|
|
2012
|
-
|
|
2013
|
-
|
|
2431
|
+
N = (typeof n == "object" ? new ce.Marker(v, n) : M(v, !0)).addTo(t).bindTooltip(
|
|
2432
|
+
I.place_type[0] === "reverse" ? I.place_name : I.place_name.replace(/,.*/, ""),
|
|
2014
2433
|
{
|
|
2015
2434
|
direction: "top"
|
|
2016
2435
|
}
|
|
2017
2436
|
);
|
|
2018
|
-
const
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
}),
|
|
2022
|
-
|
|
2023
|
-
}),
|
|
2024
|
-
|
|
2025
|
-
}),
|
|
2437
|
+
const $ = N.getElement();
|
|
2438
|
+
$ && ($.addEventListener("click", (K) => {
|
|
2439
|
+
K.stopPropagation(), a == null || a({ type: "markerClick", id: I.id });
|
|
2440
|
+
}), $.addEventListener("mouseenter", () => {
|
|
2441
|
+
a == null || a({ type: "markerMouseEnter", id: I.id });
|
|
2442
|
+
}), $.addEventListener("mouseleave", () => {
|
|
2443
|
+
a == null || a({ type: "markerMouseLeave", id: I.id });
|
|
2444
|
+
}), $.classList.toggle("marker-fuzzy", !!I.matching_text)), h.push(N);
|
|
2026
2445
|
}
|
|
2027
2446
|
},
|
|
2028
|
-
setSelectedMarker(
|
|
2029
|
-
var
|
|
2030
|
-
|
|
2447
|
+
setSelectedMarker(T) {
|
|
2448
|
+
var L, B;
|
|
2449
|
+
E && ((L = E.getElement()) == null || L.classList.toggle("marker-selected", !1)), E = T > -1 ? h[T] : void 0, (B = E == null ? void 0 : E.getElement()) == null || B.classList.toggle("marker-selected", !0);
|
|
2031
2450
|
},
|
|
2032
2451
|
getCenterAndZoom() {
|
|
2033
|
-
const
|
|
2034
|
-
return [
|
|
2452
|
+
const T = t.getCenter();
|
|
2453
|
+
return [t.getZoom(), T.lng, T.lat];
|
|
2035
2454
|
}
|
|
2036
2455
|
};
|
|
2037
2456
|
}
|
|
2038
|
-
function
|
|
2039
|
-
const
|
|
2040
|
-
for (const
|
|
2041
|
-
if (
|
|
2042
|
-
for (const
|
|
2043
|
-
|
|
2457
|
+
function ct(t, e) {
|
|
2458
|
+
const n = kt(t);
|
|
2459
|
+
for (const i of n.features)
|
|
2460
|
+
if (i.geometry.type == "MultiPolygon")
|
|
2461
|
+
for (const r of i.geometry.coordinates)
|
|
2462
|
+
at(r, e);
|
|
2044
2463
|
else
|
|
2045
|
-
|
|
2046
|
-
return
|
|
2464
|
+
at(i.geometry.coordinates, e);
|
|
2465
|
+
return n;
|
|
2047
2466
|
}
|
|
2048
|
-
function
|
|
2049
|
-
for (const
|
|
2050
|
-
for (const
|
|
2051
|
-
|
|
2467
|
+
function at(t, e) {
|
|
2468
|
+
for (const n of t)
|
|
2469
|
+
for (const i of n)
|
|
2470
|
+
i[0] += e;
|
|
2052
2471
|
}
|
|
2053
2472
|
export {
|
|
2054
|
-
|
|
2473
|
+
Cn as createLeafletMapController
|
|
2055
2474
|
};
|
|
2056
2475
|
//# sourceMappingURL=leaflet-controller.js.map
|