@maptiler/geocoding-control 2.1.7 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +46 -0
- package/CONTRIBUTING.md +72 -0
- package/README.md +115 -43
- package/SECURITY.md +16 -0
- package/dist/index.js +860 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.js +263 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/leaflet.public.js +1251 -0
- package/dist/leaflet.public.js.map +1 -0
- package/dist/leaflet.public.umd.js +276 -0
- package/dist/leaflet.public.umd.js.map +1 -0
- package/dist/maplibregl.js +1275 -0
- package/dist/maplibregl.js.map +1 -0
- package/dist/maplibregl.umd.js +276 -0
- package/dist/maplibregl.umd.js.map +1 -0
- package/dist/maptilersdk.js +1283 -0
- package/dist/maptilersdk.js.map +1 -0
- package/dist/maptilersdk.umd.js +276 -0
- package/dist/maptilersdk.umd.js.map +1 -0
- package/dist/src/components/clear-icon.d.ts +10 -0
- package/dist/src/components/fail-icon.d.ts +10 -0
- package/dist/src/components/loading-icon.d.ts +10 -0
- package/dist/src/components/marker.d.ts +10 -0
- package/dist/src/components/reverse-geocoding-icon.d.ts +10 -0
- package/dist/src/components/search-icon.d.ts +10 -0
- package/dist/src/controls/base-control.d.ts +44 -0
- package/dist/src/controls/leaflet-control.d.ts +27 -0
- package/dist/src/controls/leaflet-events.d.ts +42 -0
- package/dist/src/controls/leaflet-options.d.ts +84 -0
- package/dist/src/controls/maplibregl-control.d.ts +34 -0
- package/dist/src/controls/maplibregl-events.d.ts +44 -0
- package/dist/src/controls/maplibregl-options.d.ts +104 -0
- package/dist/src/controls/maptilersdk-control.d.ts +7 -0
- package/dist/src/controls/maptilersdk-events.d.ts +2 -0
- package/dist/src/controls/maptilersdk-options.d.ts +10 -0
- package/dist/src/controls/openlayers-control.d.ts +35 -0
- package/dist/src/controls/openlayers-events.d.ts +43 -0
- package/dist/src/controls/openlayers-options.d.ts +83 -0
- package/dist/src/geocoder/geocoder-events.d.ts +46 -0
- package/dist/src/geocoder/geocoder-feature-item.d.ts +22 -0
- package/{svelte/types.d.ts → dist/src/geocoder/geocoder-options.d.ts} +23 -143
- package/dist/src/geocoder/geocoder.d.ts +113 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/leaflet.public.d.ts +7 -0
- package/dist/src/maplibregl.d.ts +7 -0
- package/dist/src/maptilersdk.d.ts +7 -0
- package/dist/src/openlayers.public.d.ts +7 -0
- package/dist/src/types.d.ts +46 -0
- package/dist/src/utils/geo-utils.d.ts +6 -0
- package/dist/src/utils/mask.d.ts +2 -0
- package/dist/src/utils/proximity.d.ts +2 -0
- package/package.json +84 -112
- package/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/geo-coordinates-parser.t.d.ts +0 -8
- package/geoUtils.d.ts +0 -3
- package/leaflet-controller.d.ts +0 -12
- package/leaflet-controller.js +0 -2475
- package/leaflet-controller.js.map +0 -1
- package/leaflet-controller.umd.js +0 -2
- package/leaflet-controller.umd.js.map +0 -1
- package/leaflet.d.ts +0 -131
- package/leaflet.js +0 -5082
- package/leaflet.js.map +0 -1
- package/leaflet.umd.js +0 -14
- package/leaflet.umd.js.map +0 -1
- package/maplibregl-controller.d.ts +0 -19
- package/maplibregl-controller.js +0 -2418
- package/maplibregl-controller.js.map +0 -1
- package/maplibregl-controller.umd.js +0 -2
- package/maplibregl-controller.umd.js.map +0 -1
- package/maplibregl.d.ts +0 -2509
- package/maplibregl.js +0 -5142
- package/maplibregl.js.map +0 -1
- package/maplibregl.umd.js +0 -14
- package/maplibregl.umd.js.map +0 -1
- package/maptilersdk.d.ts +0 -2504
- package/maptilersdk.js +0 -5152
- package/maptilersdk.js.map +0 -1
- package/maptilersdk.umd.js +0 -14
- package/maptilersdk.umd.js.map +0 -1
- package/mask.d.ts +0 -2
- package/openlayers-controller.d.ts +0 -15
- package/openlayers-controller.js +0 -2174
- package/openlayers-controller.js.map +0 -1
- package/openlayers-controller.umd.js +0 -2
- package/openlayers-controller.umd.js.map +0 -1
- package/openlayers.d.ts +0 -109
- package/openlayers.js +0 -5045
- package/openlayers.js.map +0 -1
- package/openlayers.umd.js +0 -14
- package/openlayers.umd.js.map +0 -1
- package/proximity.d.ts +0 -2
- package/react.d.ts +0 -45
- package/react.js +0 -2795
- package/react.js.map +0 -1
- package/react.umd.js +0 -14
- package/react.umd.js.map +0 -1
- package/style.css +0 -1
- package/svelte/ClearIcon.svelte +0 -12
- package/svelte/ClearIcon.svelte.d.ts +0 -25
- package/svelte/FailIcon.svelte +0 -12
- package/svelte/FailIcon.svelte.d.ts +0 -25
- package/svelte/FeatureItem.svelte +0 -246
- package/svelte/FeatureItem.svelte.d.ts +0 -26
- package/svelte/GeocodingControl.svelte +0 -921
- package/svelte/GeocodingControl.svelte.d.ts +0 -105
- package/svelte/LoadingIcon.svelte +0 -40
- package/svelte/LoadingIcon.svelte.d.ts +0 -25
- package/svelte/MapLibreBasedGeocodingControl.d.ts +0 -3072
- package/svelte/MapLibreBasedGeocodingControl.js +0 -210
- package/svelte/MarkerIcon.svelte +0 -71
- package/svelte/MarkerIcon.svelte.d.ts +0 -18
- package/svelte/ReverseGeocodingIcon.svelte +0 -12
- package/svelte/ReverseGeocodingIcon.svelte.d.ts +0 -25
- package/svelte/SearchIcon.svelte +0 -26
- package/svelte/SearchIcon.svelte.d.ts +0 -25
- package/svelte/geo-coordinates-parser.t.d.ts +0 -8
- package/svelte/geo-coordinates-parser.t.js +0 -1
- package/svelte/geoUtils.d.ts +0 -3
- package/svelte/geoUtils.js +0 -18
- package/svelte/info.json +0 -1
- package/svelte/leaflet-controller.d.ts +0 -12
- package/svelte/leaflet-controller.js +0 -274
- package/svelte/leaflet.d.ts +0 -131
- package/svelte/leaflet.js +0 -116
- package/svelte/maplibregl-controller.d.ts +0 -19
- package/svelte/maplibregl-controller.js +0 -279
- package/svelte/maplibregl.d.ts +0 -2509
- package/svelte/maplibregl.js +0 -17
- package/svelte/maptilersdk.d.ts +0 -2504
- package/svelte/maptilersdk.js +0 -32
- package/svelte/mask.d.ts +0 -2
- package/svelte/mask.js +0 -54
- package/svelte/openlayers-controller.d.ts +0 -15
- package/svelte/openlayers-controller.js +0 -283
- package/svelte/openlayers.d.ts +0 -109
- package/svelte/openlayers.js +0 -178
- package/svelte/proximity.d.ts +0 -2
- package/svelte/proximity.js +0 -60
- package/svelte/react.d.ts +0 -45
- package/svelte/react.js +0 -106
- package/svelte/types.js +0 -1
- package/svelte/vanilla.d.ts +0 -61
- package/svelte/vanilla.js +0 -101
- package/svelte/vite-env.d.ts +0 -2
- package/types.d.ts +0 -391
- package/vanilla.d.ts +0 -61
- package/vanilla.js +0 -2799
- package/vanilla.js.map +0 -1
- package/vanilla.umd.js +0 -14
- package/vanilla.umd.js.map +0 -1
- /package/{icons → dist/icons}/10pin.svg +0 -0
- /package/{icons → dist/icons}/9pin.svg +0 -0
- /package/{icons → dist/icons}/advertising_column.svg +0 -0
- /package/{icons → dist/icons}/aerodrome.svg +0 -0
- /package/{icons → dist/icons}/alcohol.svg +0 -0
- /package/{icons → dist/icons}/alpine_hut.svg +0 -0
- /package/{icons → dist/icons}/amusement_arcade.svg +0 -0
- /package/{icons → dist/icons}/amusement_park.svg +0 -0
- /package/{icons → dist/icons}/apartment.svg +0 -0
- /package/{icons → dist/icons}/archaeological_site.svg +0 -0
- /package/{icons → dist/icons}/area.svg +0 -0
- /package/{icons → dist/icons}/art.svg +0 -0
- /package/{icons → dist/icons}/arts_centre.svg +0 -0
- /package/{icons → dist/icons}/artwork.svg +0 -0
- /package/{icons → dist/icons}/audioguide.svg +0 -0
- /package/{icons → dist/icons}/bag.svg +0 -0
- /package/{icons → dist/icons}/beauty.svg +0 -0
- /package/{icons → dist/icons}/bed.svg +0 -0
- /package/{icons → dist/icons}/bell_tower.svg +0 -0
- /package/{icons → dist/icons}/beverages.svg +0 -0
- /package/{icons → dist/icons}/bicycle_repair_station.svg +0 -0
- /package/{icons → dist/icons}/biergarten.svg +0 -0
- /package/{icons → dist/icons}/bird_hide.svg +0 -0
- /package/{icons → dist/icons}/boat_rental.svg +0 -0
- /package/{icons → dist/icons}/bookmaker.svg +0 -0
- /package/{icons → dist/icons}/books.svg +0 -0
- /package/{icons → dist/icons}/bowl.svg +0 -0
- /package/{icons → dist/icons}/bowling_alley.svg +0 -0
- /package/{icons → dist/icons}/bunker.svg +0 -0
- /package/{icons → dist/icons}/bureau_de_change.svg +0 -0
- /package/{icons → dist/icons}/bus_station.svg +0 -0
- /package/{icons → dist/icons}/bust.svg +0 -0
- /package/{icons → dist/icons}/camping.svg +0 -0
- /package/{icons → dist/icons}/car_parts.svg +0 -0
- /package/{icons → dist/icons}/car_wash.svg +0 -0
- /package/{icons → dist/icons}/caravan_park.svg +0 -0
- /package/{icons → dist/icons}/carpet.svg +0 -0
- /package/{icons → dist/icons}/cattle_grid.svg +0 -0
- /package/{icons → dist/icons}/cave_entrance.svg +0 -0
- /package/{icons → dist/icons}/chalet.svg +0 -0
- /package/{icons → dist/icons}/charity.svg +0 -0
- /package/{icons → dist/icons}/chemist.svg +0 -0
- /package/{icons → dist/icons}/chimney.svg +0 -0
- /package/{icons → dist/icons}/church.svg +0 -0
- /package/{icons → dist/icons}/city_gate.svg +0 -0
- /package/{icons → dist/icons}/clinic.svg +0 -0
- /package/{icons → dist/icons}/clothes.svg +0 -0
- /package/{icons → dist/icons}/coffee.svg +0 -0
- /package/{icons → dist/icons}/community_centre.svg +0 -0
- /package/{icons → dist/icons}/computer.svg +0 -0
- /package/{icons → dist/icons}/consulate.svg +0 -0
- /package/{icons → dist/icons}/copyshop.svg +0 -0
- /package/{icons → dist/icons}/cosmetics.svg +0 -0
- /package/{icons → dist/icons}/courthouse.svg +0 -0
- /package/{icons → dist/icons}/crane.svg +0 -0
- /package/{icons → dist/icons}/dairy.svg +0 -0
- /package/{icons → dist/icons}/deli.svg +0 -0
- /package/{icons → dist/icons}/department_store.svg +0 -0
- /package/{icons → dist/icons}/diy.svg +0 -0
- /package/{icons → dist/icons}/electronics.svg +0 -0
- /package/{icons → dist/icons}/embankment.svg +0 -0
- /package/{icons → dist/icons}/embassy.svg +0 -0
- /package/{icons → dist/icons}/excrement_bags.svg +0 -0
- /package/{icons → dist/icons}/fabric.svg +0 -0
- /package/{icons → dist/icons}/farmyard.svg +0 -0
- /package/{icons → dist/icons}/ferry.svg +0 -0
- /package/{icons → dist/icons}/firepit.svg +0 -0
- /package/{icons → dist/icons}/firestation.svg +0 -0
- /package/{icons → dist/icons}/fishing.svg +0 -0
- /package/{icons → dist/icons}/fitness.svg +0 -0
- /package/{icons → dist/icons}/ford.svg +0 -0
- /package/{icons → dist/icons}/fort.svg +0 -0
- /package/{icons → dist/icons}/fortress.svg +0 -0
- /package/{icons → dist/icons}/full-height_turnstile.svg +0 -0
- /package/{icons → dist/icons}/generator_wind.svg +0 -0
- /package/{icons → dist/icons}/golf_pin.svg +0 -0
- /package/{icons → dist/icons}/greengrocer.svg +0 -0
- /package/{icons → dist/icons}/guest_house.svg +0 -0
- /package/{icons → dist/icons}/helipad.svg +0 -0
- /package/{icons → dist/icons}/hifi.svg +0 -0
- /package/{icons → dist/icons}/hostel.svg +0 -0
- /package/{icons → dist/icons}/hotel.svg +0 -0
- /package/{icons → dist/icons}/housenumber.svg +0 -0
- /package/{icons → dist/icons}/houseware.svg +0 -0
- /package/{icons → dist/icons}/hunting_stand.svg +0 -0
- /package/{icons → dist/icons}/interior_decoration.svg +0 -0
- /package/{icons → dist/icons}/internet_cafe.svg +0 -0
- /package/{icons → dist/icons}/kindergarten.svg +0 -0
- /package/{icons → dist/icons}/kissing_gate.svg +0 -0
- /package/{icons → dist/icons}/manor.svg +0 -0
- /package/{icons → dist/icons}/map.svg +0 -0
- /package/{icons → dist/icons}/marker_reverse.svg +0 -0
- /package/{icons → dist/icons}/marker_selected.svg +0 -0
- /package/{icons → dist/icons}/marker_unselected.svg +0 -0
- /package/{icons → dist/icons}/marketplace.svg +0 -0
- /package/{icons → dist/icons}/massage.svg +0 -0
- /package/{icons → dist/icons}/mast.svg +0 -0
- /package/{icons → dist/icons}/mast_communications.svg +0 -0
- /package/{icons → dist/icons}/mast_lighting.svg +0 -0
- /package/{icons → dist/icons}/medical_supply.svg +0 -0
- /package/{icons → dist/icons}/memorial.svg +0 -0
- /package/{icons → dist/icons}/miniature_golf.svg +0 -0
- /package/{icons → dist/icons}/motel.svg +0 -0
- /package/{icons → dist/icons}/mountain_range.svg +0 -0
- /package/{icons → dist/icons}/multifaith.svg +0 -0
- /package/{icons → dist/icons}/musical_instrument.svg +0 -0
- /package/{icons → dist/icons}/newsagent.svg +0 -0
- /package/{icons → dist/icons}/nightclub.svg +0 -0
- /package/{icons → dist/icons}/ocean.svg +0 -0
- /package/{icons → dist/icons}/office.svg +0 -0
- /package/{icons → dist/icons}/outdoor_seating.svg +0 -0
- /package/{icons → dist/icons}/palace.svg +0 -0
- /package/{icons → dist/icons}/parcel_locker.svg +0 -0
- /package/{icons → dist/icons}/parking_space.svg +0 -0
- /package/{icons → dist/icons}/parking_tickets.svg +0 -0
- /package/{icons → dist/icons}/pet.svg +0 -0
- /package/{icons → dist/icons}/photo.svg +0 -0
- /package/{icons → dist/icons}/picnic.svg +0 -0
- /package/{icons → dist/icons}/plaque.svg +0 -0
- /package/{icons → dist/icons}/poi.svg +0 -0
- /package/{icons → dist/icons}/post_box.svg +0 -0
- /package/{icons → dist/icons}/post_office.svg +0 -0
- /package/{icons → dist/icons}/postal_code.svg +0 -0
- /package/{icons → dist/icons}/pub.svg +0 -0
- /package/{icons → dist/icons}/public_bath.svg +0 -0
- /package/{icons → dist/icons}/public_bookcase.svg +0 -0
- /package/{icons → dist/icons}/public_building.svg +0 -0
- /package/{icons → dist/icons}/public_transport_tickets.svg +0 -0
- /package/{icons → dist/icons}/reverse.svg +0 -0
- /package/{icons → dist/icons}/river.svg +0 -0
- /package/{icons → dist/icons}/road.svg +0 -0
- /package/{icons → dist/icons}/saddle.svg +0 -0
- /package/{icons → dist/icons}/sauna.svg +0 -0
- /package/{icons → dist/icons}/sea.svg +0 -0
- /package/{icons → dist/icons}/second_hand.svg +0 -0
- /package/{icons → dist/icons}/shintoist.svg +0 -0
- /package/{icons → dist/icons}/shoe.svg +0 -0
- /package/{icons → dist/icons}/shower.svg +0 -0
- /package/{icons → dist/icons}/shrine.svg +0 -0
- /package/{icons → dist/icons}/sikhist.svg +0 -0
- /package/{icons → dist/icons}/slipway.svg +0 -0
- /package/{icons → dist/icons}/snowmobile.svg +0 -0
- /package/{icons → dist/icons}/social_facility.svg +0 -0
- /package/{icons → dist/icons}/sports.svg +0 -0
- /package/{icons → dist/icons}/sprite.json +0 -0
- /package/{icons → dist/icons}/sprite.png +0 -0
- /package/{icons → dist/icons}/sprite@2x.json +0 -0
- /package/{icons → dist/icons}/sprite@2x.png +0 -0
- /package/{icons → dist/icons}/stationery.svg +0 -0
- /package/{icons → dist/icons}/stile.svg +0 -0
- /package/{icons → dist/icons}/stone.svg +0 -0
- /package/{icons → dist/icons}/storage_tank.svg +0 -0
- /package/{icons → dist/icons}/stream.svg +0 -0
- /package/{icons → dist/icons}/street.svg +0 -0
- /package/{icons → dist/icons}/supermarket.svg +0 -0
- /package/{icons → dist/icons}/tea.svg +0 -0
- /package/{icons → dist/icons}/telescope_dish.svg +0 -0
- /package/{icons → dist/icons}/telescope_dome.svg +0 -0
- /package/{icons → dist/icons}/ticket.svg +0 -0
- /package/{icons → dist/icons}/tobacco.svg +0 -0
- /package/{icons → dist/icons}/tower_cantilever_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_cooling.svg +0 -0
- /package/{icons → dist/icons}/tower_dish.svg +0 -0
- /package/{icons → dist/icons}/tower_dome.svg +0 -0
- /package/{icons → dist/icons}/tower_generic.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_communication.svg +0 -0
- /package/{icons → dist/icons}/tower_lattice_lighting.svg +0 -0
- /package/{icons → dist/icons}/tower_lighting.svg +0 -0
- /package/{icons → dist/icons}/townhall.svg +0 -0
- /package/{icons → dist/icons}/toys.svg +0 -0
- /package/{icons → dist/icons}/trade.svg +0 -0
- /package/{icons → dist/icons}/traffic_light.svg +0 -0
- /package/{icons → dist/icons}/train_station.svg +0 -0
- /package/{icons → dist/icons}/travel_agency.svg +0 -0
- /package/{icons → dist/icons}/tyres.svg +0 -0
- /package/{icons → dist/icons}/university.svg +0 -0
- /package/{icons → dist/icons}/variety_store.svg +0 -0
- /package/{icons → dist/icons}/vehicle_inspection.svg +0 -0
- /package/{icons → dist/icons}/vending_machine.svg +0 -0
- /package/{icons → dist/icons}/video.svg +0 -0
- /package/{icons → dist/icons}/video_games.svg +0 -0
- /package/{icons → dist/icons}/waste_disposal.svg +0 -0
- /package/{icons → dist/icons}/water_well.svg +0 -0
- /package/{icons → dist/icons}/waterfall.svg +0 -0
- /package/{icons → dist/icons}/wilderness_hut.svg +0 -0
package/openlayers-controller.js
DELETED
|
@@ -1,2174 +0,0 @@
|
|
|
1
|
-
var ct = Object.defineProperty;
|
|
2
|
-
var at = (i, t, e) => t in i ? ct(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
-
var M = (i, t, e) => at(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { Feature as se } from "ol";
|
|
5
|
-
import { Point as Re, Polygon as Fe, MultiPolygon as qe, GeometryCollection as pt, LineString as De, MultiLineString as ze } from "ol/geom";
|
|
6
|
-
import gt from "ol/layer/Vector";
|
|
7
|
-
import { fromLonLat as me, transformExtent as yt, toLonLat as Ue, getUserProjection as mt } from "ol/proj";
|
|
8
|
-
import dt from "ol/source/Vector";
|
|
9
|
-
import Ve from "ol/style/Fill";
|
|
10
|
-
import xt from "ol/style/Icon";
|
|
11
|
-
import $e from "ol/style/Stroke";
|
|
12
|
-
import wt from "ol/style/Style";
|
|
13
|
-
import Et from "ol/style/Text";
|
|
14
|
-
function Se(i, t, e = {}) {
|
|
15
|
-
const n = { type: "Feature" };
|
|
16
|
-
return (e.id === 0 || e.id) && (n.id = e.id), e.bbox && (n.bbox = e.bbox), n.properties = t || {}, n.geometry = i, n;
|
|
17
|
-
}
|
|
18
|
-
function Be(i, t, e = {}) {
|
|
19
|
-
for (const r of i) {
|
|
20
|
-
if (r.length < 4)
|
|
21
|
-
throw new Error(
|
|
22
|
-
"Each LinearRing of a Polygon must have 4 or more Positions."
|
|
23
|
-
);
|
|
24
|
-
if (r[r.length - 1].length !== r[0].length)
|
|
25
|
-
throw new Error("First and last Position are not equivalent.");
|
|
26
|
-
for (let f = 0; f < r[r.length - 1].length; f++)
|
|
27
|
-
if (r[r.length - 1][f] !== r[0][f])
|
|
28
|
-
throw new Error("First and last Position are not equivalent.");
|
|
29
|
-
}
|
|
30
|
-
return Se({
|
|
31
|
-
type: "Polygon",
|
|
32
|
-
coordinates: i
|
|
33
|
-
}, t, e);
|
|
34
|
-
}
|
|
35
|
-
function Ce(i, t = {}) {
|
|
36
|
-
const e = { type: "FeatureCollection" };
|
|
37
|
-
return t.id && (e.id = t.id), t.bbox && (e.bbox = t.bbox), e.features = i, e;
|
|
38
|
-
}
|
|
39
|
-
function rt(i, t, e = {}) {
|
|
40
|
-
return Se({
|
|
41
|
-
type: "MultiPolygon",
|
|
42
|
-
coordinates: i
|
|
43
|
-
}, t, e);
|
|
44
|
-
}
|
|
45
|
-
function st(i, t, e) {
|
|
46
|
-
if (i !== null)
|
|
47
|
-
for (var n, r, f, a, c, E, d, T = 0, b = 0, P, N = i.type, _ = N === "FeatureCollection", L = N === "Feature", A = _ ? i.features.length : 1, V = 0; V < A; V++) {
|
|
48
|
-
d = _ ? i.features[V].geometry : L ? i.geometry : i, P = d ? d.type === "GeometryCollection" : !1, c = P ? d.geometries.length : 1;
|
|
49
|
-
for (var S = 0; S < c; S++) {
|
|
50
|
-
var F = 0, B = 0;
|
|
51
|
-
if (a = P ? d.geometries[S] : d, a !== null) {
|
|
52
|
-
E = a.coordinates;
|
|
53
|
-
var W = a.type;
|
|
54
|
-
switch (T = 0, W) {
|
|
55
|
-
case null:
|
|
56
|
-
break;
|
|
57
|
-
case "Point":
|
|
58
|
-
if (t(
|
|
59
|
-
E,
|
|
60
|
-
b,
|
|
61
|
-
V,
|
|
62
|
-
F,
|
|
63
|
-
B
|
|
64
|
-
) === !1)
|
|
65
|
-
return !1;
|
|
66
|
-
b++, F++;
|
|
67
|
-
break;
|
|
68
|
-
case "LineString":
|
|
69
|
-
case "MultiPoint":
|
|
70
|
-
for (n = 0; n < E.length; n++) {
|
|
71
|
-
if (t(
|
|
72
|
-
E[n],
|
|
73
|
-
b,
|
|
74
|
-
V,
|
|
75
|
-
F,
|
|
76
|
-
B
|
|
77
|
-
) === !1)
|
|
78
|
-
return !1;
|
|
79
|
-
b++, W === "MultiPoint" && F++;
|
|
80
|
-
}
|
|
81
|
-
W === "LineString" && F++;
|
|
82
|
-
break;
|
|
83
|
-
case "Polygon":
|
|
84
|
-
case "MultiLineString":
|
|
85
|
-
for (n = 0; n < E.length; n++) {
|
|
86
|
-
for (r = 0; r < E[n].length - T; r++) {
|
|
87
|
-
if (t(
|
|
88
|
-
E[n][r],
|
|
89
|
-
b,
|
|
90
|
-
V,
|
|
91
|
-
F,
|
|
92
|
-
B
|
|
93
|
-
) === !1)
|
|
94
|
-
return !1;
|
|
95
|
-
b++;
|
|
96
|
-
}
|
|
97
|
-
W === "MultiLineString" && F++, W === "Polygon" && B++;
|
|
98
|
-
}
|
|
99
|
-
W === "Polygon" && F++;
|
|
100
|
-
break;
|
|
101
|
-
case "MultiPolygon":
|
|
102
|
-
for (n = 0; n < E.length; n++) {
|
|
103
|
-
for (B = 0, r = 0; r < E[n].length; r++) {
|
|
104
|
-
for (f = 0; f < E[n][r].length - T; f++) {
|
|
105
|
-
if (t(
|
|
106
|
-
E[n][r][f],
|
|
107
|
-
b,
|
|
108
|
-
V,
|
|
109
|
-
F,
|
|
110
|
-
B
|
|
111
|
-
) === !1)
|
|
112
|
-
return !1;
|
|
113
|
-
b++;
|
|
114
|
-
}
|
|
115
|
-
B++;
|
|
116
|
-
}
|
|
117
|
-
F++;
|
|
118
|
-
}
|
|
119
|
-
break;
|
|
120
|
-
case "GeometryCollection":
|
|
121
|
-
for (n = 0; n < a.geometries.length; n++)
|
|
122
|
-
if (st(a.geometries[n], t) === !1)
|
|
123
|
-
return !1;
|
|
124
|
-
break;
|
|
125
|
-
default:
|
|
126
|
-
throw new Error("Unknown Geometry Type");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function Ge(i, t) {
|
|
133
|
-
var e, n, r, f, a, c, E, d, T, b, P = 0, N = i.type === "FeatureCollection", _ = i.type === "Feature", L = N ? i.features.length : 1;
|
|
134
|
-
for (e = 0; e < L; e++) {
|
|
135
|
-
for (c = N ? i.features[e].geometry : _ ? i.geometry : i, d = N ? i.features[e].properties : _ ? i.properties : {}, T = N ? i.features[e].bbox : _ ? i.bbox : void 0, b = N ? i.features[e].id : _ ? i.id : void 0, E = c ? c.type === "GeometryCollection" : !1, a = E ? c.geometries.length : 1, r = 0; r < a; r++) {
|
|
136
|
-
if (f = E ? c.geometries[r] : c, f === null) {
|
|
137
|
-
if (t(
|
|
138
|
-
null,
|
|
139
|
-
P,
|
|
140
|
-
d,
|
|
141
|
-
T,
|
|
142
|
-
b
|
|
143
|
-
) === !1)
|
|
144
|
-
return !1;
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
switch (f.type) {
|
|
148
|
-
case "Point":
|
|
149
|
-
case "LineString":
|
|
150
|
-
case "MultiPoint":
|
|
151
|
-
case "Polygon":
|
|
152
|
-
case "MultiLineString":
|
|
153
|
-
case "MultiPolygon": {
|
|
154
|
-
if (t(
|
|
155
|
-
f,
|
|
156
|
-
P,
|
|
157
|
-
d,
|
|
158
|
-
T,
|
|
159
|
-
b
|
|
160
|
-
) === !1)
|
|
161
|
-
return !1;
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
case "GeometryCollection": {
|
|
165
|
-
for (n = 0; n < f.geometries.length; n++)
|
|
166
|
-
if (t(
|
|
167
|
-
f.geometries[n],
|
|
168
|
-
P,
|
|
169
|
-
d,
|
|
170
|
-
T,
|
|
171
|
-
b
|
|
172
|
-
) === !1)
|
|
173
|
-
return !1;
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
default:
|
|
177
|
-
throw new Error("Unknown Geometry Type");
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
P++;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function St(i, t) {
|
|
184
|
-
Ge(i, function(e, n, r, f, a) {
|
|
185
|
-
var c = e === null ? null : e.type;
|
|
186
|
-
switch (c) {
|
|
187
|
-
case null:
|
|
188
|
-
case "Point":
|
|
189
|
-
case "LineString":
|
|
190
|
-
case "Polygon":
|
|
191
|
-
return t(
|
|
192
|
-
Se(e, r, { bbox: f, id: a }),
|
|
193
|
-
n,
|
|
194
|
-
0
|
|
195
|
-
) === !1 ? !1 : void 0;
|
|
196
|
-
}
|
|
197
|
-
var E;
|
|
198
|
-
switch (c) {
|
|
199
|
-
case "MultiPoint":
|
|
200
|
-
E = "Point";
|
|
201
|
-
break;
|
|
202
|
-
case "MultiLineString":
|
|
203
|
-
E = "LineString";
|
|
204
|
-
break;
|
|
205
|
-
case "MultiPolygon":
|
|
206
|
-
E = "Polygon";
|
|
207
|
-
break;
|
|
208
|
-
}
|
|
209
|
-
for (var d = 0; d < e.coordinates.length; d++) {
|
|
210
|
-
var T = e.coordinates[d], b = {
|
|
211
|
-
type: E,
|
|
212
|
-
coordinates: T
|
|
213
|
-
};
|
|
214
|
-
if (t(Se(b, r), n, d) === !1)
|
|
215
|
-
return !1;
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
function vt(i, t = {}) {
|
|
220
|
-
if (i.bbox != null && t.recompute !== !0)
|
|
221
|
-
return i.bbox;
|
|
222
|
-
const e = [1 / 0, 1 / 0, -1 / 0, -1 / 0];
|
|
223
|
-
return st(i, (n) => {
|
|
224
|
-
e[0] > n[0] && (e[0] = n[0]), e[1] > n[1] && (e[1] = n[1]), e[2] < n[0] && (e[2] = n[0]), e[3] < n[1] && (e[3] = n[1]);
|
|
225
|
-
}), e;
|
|
226
|
-
}
|
|
227
|
-
var Ke = vt, bt = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, _e = Math.ceil, j = Math.floor, X = "[BigNumber Error] ", Xe = X + "Number primitive has more than 15 significant digits: ", ee = 1e14, C = 14, We = 9007199254740991, Oe = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], ue = 1e7, Y = 1e9;
|
|
228
|
-
function ot(i) {
|
|
229
|
-
var t, e, n, r = S.prototype = { constructor: S, toString: null, valueOf: null }, f = new S(1), a = 20, c = 4, E = -7, d = 21, T = -1e7, b = 1e7, P = !1, N = 1, _ = 0, L = {
|
|
230
|
-
prefix: "",
|
|
231
|
-
groupSize: 3,
|
|
232
|
-
secondaryGroupSize: 0,
|
|
233
|
-
groupSeparator: ",",
|
|
234
|
-
decimalSeparator: ".",
|
|
235
|
-
fractionGroupSize: 0,
|
|
236
|
-
fractionGroupSeparator: " ",
|
|
237
|
-
// non-breaking space
|
|
238
|
-
suffix: ""
|
|
239
|
-
}, A = "0123456789abcdefghijklmnopqrstuvwxyz", V = !0;
|
|
240
|
-
function S(s, o) {
|
|
241
|
-
var l, m, h, g, w, u, p, x, y = this;
|
|
242
|
-
if (!(y instanceof S)) return new S(s, o);
|
|
243
|
-
if (o == null) {
|
|
244
|
-
if (s && s._isBigNumber === !0) {
|
|
245
|
-
y.s = s.s, !s.c || s.e > b ? y.c = y.e = null : s.e < T ? y.c = [y.e = 0] : (y.e = s.e, y.c = s.c.slice());
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
if ((u = typeof s == "number") && s * 0 == 0) {
|
|
249
|
-
if (y.s = 1 / s < 0 ? (s = -s, -1) : 1, s === ~~s) {
|
|
250
|
-
for (g = 0, w = s; w >= 10; w /= 10, g++) ;
|
|
251
|
-
g > b ? y.c = y.e = null : (y.e = g, y.c = [s]);
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
x = String(s);
|
|
255
|
-
} else {
|
|
256
|
-
if (!bt.test(x = String(s))) return n(y, x, u);
|
|
257
|
-
y.s = x.charCodeAt(0) == 45 ? (x = x.slice(1), -1) : 1;
|
|
258
|
-
}
|
|
259
|
-
(g = x.indexOf(".")) > -1 && (x = x.replace(".", "")), (w = x.search(/e/i)) > 0 ? (g < 0 && (g = w), g += +x.slice(w + 1), x = x.substring(0, w)) : g < 0 && (g = x.length);
|
|
260
|
-
} else {
|
|
261
|
-
if (q(o, 2, A.length, "Base"), o == 10 && V)
|
|
262
|
-
return y = new S(s), Z(y, a + y.e + 1, c);
|
|
263
|
-
if (x = String(s), u = typeof s == "number") {
|
|
264
|
-
if (s * 0 != 0) return n(y, x, u, o);
|
|
265
|
-
if (y.s = 1 / s < 0 ? (x = x.slice(1), -1) : 1, S.DEBUG && x.replace(/^0\.0*|\./, "").length > 15)
|
|
266
|
-
throw Error(Xe + s);
|
|
267
|
-
} else
|
|
268
|
-
y.s = x.charCodeAt(0) === 45 ? (x = x.slice(1), -1) : 1;
|
|
269
|
-
for (l = A.slice(0, o), g = w = 0, p = x.length; w < p; w++)
|
|
270
|
-
if (l.indexOf(m = x.charAt(w)) < 0) {
|
|
271
|
-
if (m == ".") {
|
|
272
|
-
if (w > g) {
|
|
273
|
-
g = p;
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
} else if (!h && (x == x.toUpperCase() && (x = x.toLowerCase()) || x == x.toLowerCase() && (x = x.toUpperCase()))) {
|
|
277
|
-
h = !0, w = -1, g = 0;
|
|
278
|
-
continue;
|
|
279
|
-
}
|
|
280
|
-
return n(y, String(s), u, o);
|
|
281
|
-
}
|
|
282
|
-
u = !1, x = e(x, o, 10, y.s), (g = x.indexOf(".")) > -1 ? x = x.replace(".", "") : g = x.length;
|
|
283
|
-
}
|
|
284
|
-
for (w = 0; x.charCodeAt(w) === 48; w++) ;
|
|
285
|
-
for (p = x.length; x.charCodeAt(--p) === 48; ) ;
|
|
286
|
-
if (x = x.slice(w, ++p)) {
|
|
287
|
-
if (p -= w, u && S.DEBUG && p > 15 && (s > We || s !== j(s)))
|
|
288
|
-
throw Error(Xe + y.s * s);
|
|
289
|
-
if ((g = g - w - 1) > b)
|
|
290
|
-
y.c = y.e = null;
|
|
291
|
-
else if (g < T)
|
|
292
|
-
y.c = [y.e = 0];
|
|
293
|
-
else {
|
|
294
|
-
if (y.e = g, y.c = [], w = (g + 1) % C, g < 0 && (w += C), w < p) {
|
|
295
|
-
for (w && y.c.push(+x.slice(0, w)), p -= C; w < p; )
|
|
296
|
-
y.c.push(+x.slice(w, w += C));
|
|
297
|
-
w = C - (x = x.slice(w)).length;
|
|
298
|
-
} else
|
|
299
|
-
w -= p;
|
|
300
|
-
for (; w--; x += "0") ;
|
|
301
|
-
y.c.push(+x);
|
|
302
|
-
}
|
|
303
|
-
} else
|
|
304
|
-
y.c = [y.e = 0];
|
|
305
|
-
}
|
|
306
|
-
S.clone = ot, S.ROUND_UP = 0, S.ROUND_DOWN = 1, S.ROUND_CEIL = 2, S.ROUND_FLOOR = 3, S.ROUND_HALF_UP = 4, S.ROUND_HALF_DOWN = 5, S.ROUND_HALF_EVEN = 6, S.ROUND_HALF_CEIL = 7, S.ROUND_HALF_FLOOR = 8, S.EUCLID = 9, S.config = S.set = function(s) {
|
|
307
|
-
var o, l;
|
|
308
|
-
if (s != null)
|
|
309
|
-
if (typeof s == "object") {
|
|
310
|
-
if (s.hasOwnProperty(o = "DECIMAL_PLACES") && (l = s[o], q(l, 0, Y, o), a = l), s.hasOwnProperty(o = "ROUNDING_MODE") && (l = s[o], q(l, 0, 8, o), c = l), s.hasOwnProperty(o = "EXPONENTIAL_AT") && (l = s[o], l && l.pop ? (q(l[0], -1e9, 0, o), q(l[1], 0, Y, o), E = l[0], d = l[1]) : (q(l, -1e9, Y, o), E = -(d = l < 0 ? -l : l))), s.hasOwnProperty(o = "RANGE"))
|
|
311
|
-
if (l = s[o], l && l.pop)
|
|
312
|
-
q(l[0], -1e9, -1, o), q(l[1], 1, Y, o), T = l[0], b = l[1];
|
|
313
|
-
else if (q(l, -1e9, Y, o), l)
|
|
314
|
-
T = -(b = l < 0 ? -l : l);
|
|
315
|
-
else
|
|
316
|
-
throw Error(X + o + " cannot be zero: " + l);
|
|
317
|
-
if (s.hasOwnProperty(o = "CRYPTO"))
|
|
318
|
-
if (l = s[o], l === !!l)
|
|
319
|
-
if (l)
|
|
320
|
-
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
321
|
-
P = l;
|
|
322
|
-
else
|
|
323
|
-
throw P = !l, Error(X + "crypto unavailable");
|
|
324
|
-
else
|
|
325
|
-
P = l;
|
|
326
|
-
else
|
|
327
|
-
throw Error(X + o + " not true or false: " + l);
|
|
328
|
-
if (s.hasOwnProperty(o = "MODULO_MODE") && (l = s[o], q(l, 0, 9, o), N = l), s.hasOwnProperty(o = "POW_PRECISION") && (l = s[o], q(l, 0, Y, o), _ = l), s.hasOwnProperty(o = "FORMAT"))
|
|
329
|
-
if (l = s[o], typeof l == "object") L = l;
|
|
330
|
-
else throw Error(X + o + " not an object: " + l);
|
|
331
|
-
if (s.hasOwnProperty(o = "ALPHABET"))
|
|
332
|
-
if (l = s[o], typeof l == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(l))
|
|
333
|
-
V = l.slice(0, 10) == "0123456789", A = l;
|
|
334
|
-
else
|
|
335
|
-
throw Error(X + o + " invalid: " + l);
|
|
336
|
-
} else
|
|
337
|
-
throw Error(X + "Object expected: " + s);
|
|
338
|
-
return {
|
|
339
|
-
DECIMAL_PLACES: a,
|
|
340
|
-
ROUNDING_MODE: c,
|
|
341
|
-
EXPONENTIAL_AT: [E, d],
|
|
342
|
-
RANGE: [T, b],
|
|
343
|
-
CRYPTO: P,
|
|
344
|
-
MODULO_MODE: N,
|
|
345
|
-
POW_PRECISION: _,
|
|
346
|
-
FORMAT: L,
|
|
347
|
-
ALPHABET: A
|
|
348
|
-
};
|
|
349
|
-
}, S.isBigNumber = function(s) {
|
|
350
|
-
if (!s || s._isBigNumber !== !0) return !1;
|
|
351
|
-
if (!S.DEBUG) return !0;
|
|
352
|
-
var o, l, m = s.c, h = s.e, g = s.s;
|
|
353
|
-
e: if ({}.toString.call(m) == "[object Array]") {
|
|
354
|
-
if ((g === 1 || g === -1) && h >= -1e9 && h <= Y && h === j(h)) {
|
|
355
|
-
if (m[0] === 0) {
|
|
356
|
-
if (h === 0 && m.length === 1) return !0;
|
|
357
|
-
break e;
|
|
358
|
-
}
|
|
359
|
-
if (o = (h + 1) % C, o < 1 && (o += C), String(m[0]).length == o) {
|
|
360
|
-
for (o = 0; o < m.length; o++)
|
|
361
|
-
if (l = m[o], l < 0 || l >= ee || l !== j(l)) break e;
|
|
362
|
-
if (l !== 0) return !0;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
} else if (m === null && h === null && (g === null || g === 1 || g === -1))
|
|
366
|
-
return !0;
|
|
367
|
-
throw Error(X + "Invalid BigNumber: " + s);
|
|
368
|
-
}, S.maximum = S.max = function() {
|
|
369
|
-
return B(arguments, -1);
|
|
370
|
-
}, S.minimum = S.min = function() {
|
|
371
|
-
return B(arguments, 1);
|
|
372
|
-
}, S.random = function() {
|
|
373
|
-
var s = 9007199254740992, o = Math.random() * s & 2097151 ? function() {
|
|
374
|
-
return j(Math.random() * s);
|
|
375
|
-
} : function() {
|
|
376
|
-
return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
|
|
377
|
-
};
|
|
378
|
-
return function(l) {
|
|
379
|
-
var m, h, g, w, u, p = 0, x = [], y = new S(f);
|
|
380
|
-
if (l == null ? l = a : q(l, 0, Y), w = _e(l / C), P)
|
|
381
|
-
if (crypto.getRandomValues) {
|
|
382
|
-
for (m = crypto.getRandomValues(new Uint32Array(w *= 2)); p < w; )
|
|
383
|
-
u = m[p] * 131072 + (m[p + 1] >>> 11), u >= 9e15 ? (h = crypto.getRandomValues(new Uint32Array(2)), m[p] = h[0], m[p + 1] = h[1]) : (x.push(u % 1e14), p += 2);
|
|
384
|
-
p = w / 2;
|
|
385
|
-
} else if (crypto.randomBytes) {
|
|
386
|
-
for (m = crypto.randomBytes(w *= 7); p < w; )
|
|
387
|
-
u = (m[p] & 31) * 281474976710656 + m[p + 1] * 1099511627776 + m[p + 2] * 4294967296 + m[p + 3] * 16777216 + (m[p + 4] << 16) + (m[p + 5] << 8) + m[p + 6], u >= 9e15 ? crypto.randomBytes(7).copy(m, p) : (x.push(u % 1e14), p += 7);
|
|
388
|
-
p = w / 7;
|
|
389
|
-
} else
|
|
390
|
-
throw P = !1, Error(X + "crypto unavailable");
|
|
391
|
-
if (!P)
|
|
392
|
-
for (; p < w; )
|
|
393
|
-
u = o(), u < 9e15 && (x[p++] = u % 1e14);
|
|
394
|
-
for (w = x[--p], l %= C, w && l && (u = Oe[C - l], x[p] = j(w / u) * u); x[p] === 0; x.pop(), p--) ;
|
|
395
|
-
if (p < 0)
|
|
396
|
-
x = [g = 0];
|
|
397
|
-
else {
|
|
398
|
-
for (g = -1; x[0] === 0; x.splice(0, 1), g -= C) ;
|
|
399
|
-
for (p = 1, u = x[0]; u >= 10; u /= 10, p++) ;
|
|
400
|
-
p < C && (g -= C - p);
|
|
401
|
-
}
|
|
402
|
-
return y.e = g, y.c = x, y;
|
|
403
|
-
};
|
|
404
|
-
}(), S.sum = function() {
|
|
405
|
-
for (var s = 1, o = arguments, l = new S(o[0]); s < o.length; ) l = l.plus(o[s++]);
|
|
406
|
-
return l;
|
|
407
|
-
}, e = /* @__PURE__ */ function() {
|
|
408
|
-
var s = "0123456789";
|
|
409
|
-
function o(l, m, h, g) {
|
|
410
|
-
for (var w, u = [0], p, x = 0, y = l.length; x < y; ) {
|
|
411
|
-
for (p = u.length; p--; u[p] *= m) ;
|
|
412
|
-
for (u[0] += g.indexOf(l.charAt(x++)), w = 0; w < u.length; w++)
|
|
413
|
-
u[w] > h - 1 && (u[w + 1] == null && (u[w + 1] = 0), u[w + 1] += u[w] / h | 0, u[w] %= h);
|
|
414
|
-
}
|
|
415
|
-
return u.reverse();
|
|
416
|
-
}
|
|
417
|
-
return function(l, m, h, g, w) {
|
|
418
|
-
var u, p, x, y, v, R, O, k, D = l.indexOf("."), U = a, I = c;
|
|
419
|
-
for (D >= 0 && (y = _, _ = 0, l = l.replace(".", ""), k = new S(m), R = k.pow(l.length - D), _ = y, k.c = o(
|
|
420
|
-
oe(J(R.c), R.e, "0"),
|
|
421
|
-
10,
|
|
422
|
-
h,
|
|
423
|
-
s
|
|
424
|
-
), k.e = k.c.length), O = o(l, m, h, w ? (u = A, s) : (u = s, A)), x = y = O.length; O[--y] == 0; O.pop()) ;
|
|
425
|
-
if (!O[0]) return u.charAt(0);
|
|
426
|
-
if (D < 0 ? --x : (R.c = O, R.e = x, R.s = g, R = t(R, k, U, I, h), O = R.c, v = R.r, x = R.e), p = x + U + 1, D = O[p], y = h / 2, v = v || p < 0 || O[p + 1] != null, v = I < 4 ? (D != null || v) && (I == 0 || I == (R.s < 0 ? 3 : 2)) : D > y || D == y && (I == 4 || v || I == 6 && O[p - 1] & 1 || I == (R.s < 0 ? 8 : 7)), p < 1 || !O[0])
|
|
427
|
-
l = v ? oe(u.charAt(1), -U, u.charAt(0)) : u.charAt(0);
|
|
428
|
-
else {
|
|
429
|
-
if (O.length = p, v)
|
|
430
|
-
for (--h; ++O[--p] > h; )
|
|
431
|
-
O[p] = 0, p || (++x, O = [1].concat(O));
|
|
432
|
-
for (y = O.length; !O[--y]; ) ;
|
|
433
|
-
for (D = 0, l = ""; D <= y; l += u.charAt(O[D++])) ;
|
|
434
|
-
l = oe(l, x, u.charAt(0));
|
|
435
|
-
}
|
|
436
|
-
return l;
|
|
437
|
-
};
|
|
438
|
-
}(), t = /* @__PURE__ */ function() {
|
|
439
|
-
function s(m, h, g) {
|
|
440
|
-
var w, u, p, x, y = 0, v = m.length, R = h % ue, O = h / ue | 0;
|
|
441
|
-
for (m = m.slice(); v--; )
|
|
442
|
-
p = m[v] % ue, x = m[v] / ue | 0, w = O * p + x * R, u = R * p + w % ue * ue + y, y = (u / g | 0) + (w / ue | 0) + O * x, m[v] = u % g;
|
|
443
|
-
return y && (m = [y].concat(m)), m;
|
|
444
|
-
}
|
|
445
|
-
function o(m, h, g, w) {
|
|
446
|
-
var u, p;
|
|
447
|
-
if (g != w)
|
|
448
|
-
p = g > w ? 1 : -1;
|
|
449
|
-
else
|
|
450
|
-
for (u = p = 0; u < g; u++)
|
|
451
|
-
if (m[u] != h[u]) {
|
|
452
|
-
p = m[u] > h[u] ? 1 : -1;
|
|
453
|
-
break;
|
|
454
|
-
}
|
|
455
|
-
return p;
|
|
456
|
-
}
|
|
457
|
-
function l(m, h, g, w) {
|
|
458
|
-
for (var u = 0; g--; )
|
|
459
|
-
m[g] -= u, u = m[g] < h[g] ? 1 : 0, m[g] = u * w + m[g] - h[g];
|
|
460
|
-
for (; !m[0] && m.length > 1; m.splice(0, 1)) ;
|
|
461
|
-
}
|
|
462
|
-
return function(m, h, g, w, u) {
|
|
463
|
-
var p, x, y, v, R, O, k, D, U, I, G, $, ye, Le, Me, te, he, H = m.s == h.s ? 1 : -1, K = m.c, z = h.c;
|
|
464
|
-
if (!K || !K[0] || !z || !z[0])
|
|
465
|
-
return new S(
|
|
466
|
-
// Return NaN if either NaN, or both Infinity or 0.
|
|
467
|
-
!m.s || !h.s || (K ? z && K[0] == z[0] : !z) ? NaN : (
|
|
468
|
-
// Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
|
|
469
|
-
K && K[0] == 0 || !z ? H * 0 : H / 0
|
|
470
|
-
)
|
|
471
|
-
);
|
|
472
|
-
for (D = new S(H), U = D.c = [], x = m.e - h.e, H = g + x + 1, u || (u = ee, x = Q(m.e / C) - Q(h.e / C), H = H / C | 0), y = 0; z[y] == (K[y] || 0); y++) ;
|
|
473
|
-
if (z[y] > (K[y] || 0) && x--, H < 0)
|
|
474
|
-
U.push(1), v = !0;
|
|
475
|
-
else {
|
|
476
|
-
for (Le = K.length, te = z.length, y = 0, H += 2, R = j(u / (z[0] + 1)), R > 1 && (z = s(z, R, u), K = s(K, R, u), te = z.length, Le = K.length), ye = te, I = K.slice(0, te), G = I.length; G < te; I[G++] = 0) ;
|
|
477
|
-
he = z.slice(), he = [0].concat(he), Me = z[0], z[1] >= u / 2 && Me++;
|
|
478
|
-
do {
|
|
479
|
-
if (R = 0, p = o(z, I, te, G), p < 0) {
|
|
480
|
-
if ($ = I[0], te != G && ($ = $ * u + (I[1] || 0)), R = j($ / Me), R > 1)
|
|
481
|
-
for (R >= u && (R = u - 1), O = s(z, R, u), k = O.length, G = I.length; o(O, I, k, G) == 1; )
|
|
482
|
-
R--, l(O, te < k ? he : z, k, u), k = O.length, p = 1;
|
|
483
|
-
else
|
|
484
|
-
R == 0 && (p = R = 1), O = z.slice(), k = O.length;
|
|
485
|
-
if (k < G && (O = [0].concat(O)), l(I, O, G, u), G = I.length, p == -1)
|
|
486
|
-
for (; o(z, I, te, G) < 1; )
|
|
487
|
-
R++, l(I, te < G ? he : z, G, u), G = I.length;
|
|
488
|
-
} else p === 0 && (R++, I = [0]);
|
|
489
|
-
U[y++] = R, I[0] ? I[G++] = K[ye] || 0 : (I = [K[ye]], G = 1);
|
|
490
|
-
} while ((ye++ < Le || I[0] != null) && H--);
|
|
491
|
-
v = I[0] != null, U[0] || U.splice(0, 1);
|
|
492
|
-
}
|
|
493
|
-
if (u == ee) {
|
|
494
|
-
for (y = 1, H = U[0]; H >= 10; H /= 10, y++) ;
|
|
495
|
-
Z(D, g + (D.e = y + x * C - 1) + 1, w, v);
|
|
496
|
-
} else
|
|
497
|
-
D.e = x, D.r = +v;
|
|
498
|
-
return D;
|
|
499
|
-
};
|
|
500
|
-
}();
|
|
501
|
-
function F(s, o, l, m) {
|
|
502
|
-
var h, g, w, u, p;
|
|
503
|
-
if (l == null ? l = c : q(l, 0, 8), !s.c) return s.toString();
|
|
504
|
-
if (h = s.c[0], w = s.e, o == null)
|
|
505
|
-
p = J(s.c), p = m == 1 || m == 2 && (w <= E || w >= d) ? xe(p, w) : oe(p, w, "0");
|
|
506
|
-
else if (s = Z(new S(s), o, l), g = s.e, p = J(s.c), u = p.length, m == 1 || m == 2 && (o <= g || g <= E)) {
|
|
507
|
-
for (; u < o; p += "0", u++) ;
|
|
508
|
-
p = xe(p, g);
|
|
509
|
-
} else if (o -= w, p = oe(p, g, "0"), g + 1 > u) {
|
|
510
|
-
if (--o > 0) for (p += "."; o--; p += "0") ;
|
|
511
|
-
} else if (o += g - u, o > 0)
|
|
512
|
-
for (g + 1 == u && (p += "."); o--; p += "0") ;
|
|
513
|
-
return s.s < 0 && h ? "-" + p : p;
|
|
514
|
-
}
|
|
515
|
-
function B(s, o) {
|
|
516
|
-
for (var l, m, h = 1, g = new S(s[0]); h < s.length; h++)
|
|
517
|
-
m = new S(s[h]), (!m.s || (l = fe(g, m)) === o || l === 0 && g.s === o) && (g = m);
|
|
518
|
-
return g;
|
|
519
|
-
}
|
|
520
|
-
function W(s, o, l) {
|
|
521
|
-
for (var m = 1, h = o.length; !o[--h]; o.pop()) ;
|
|
522
|
-
for (h = o[0]; h >= 10; h /= 10, m++) ;
|
|
523
|
-
return (l = m + l * C - 1) > b ? s.c = s.e = null : l < T ? s.c = [s.e = 0] : (s.e = l, s.c = o), s;
|
|
524
|
-
}
|
|
525
|
-
n = /* @__PURE__ */ function() {
|
|
526
|
-
var s = /^(-?)0([xbo])(?=\w[\w.]*$)/i, o = /^([^.]+)\.$/, l = /^\.([^.]+)$/, m = /^-?(Infinity|NaN)$/, h = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
|
|
527
|
-
return function(g, w, u, p) {
|
|
528
|
-
var x, y = u ? w : w.replace(h, "");
|
|
529
|
-
if (m.test(y))
|
|
530
|
-
g.s = isNaN(y) ? null : y < 0 ? -1 : 1;
|
|
531
|
-
else {
|
|
532
|
-
if (!u && (y = y.replace(s, function(v, R, O) {
|
|
533
|
-
return x = (O = O.toLowerCase()) == "x" ? 16 : O == "b" ? 2 : 8, !p || p == x ? R : v;
|
|
534
|
-
}), p && (x = p, y = y.replace(o, "$1").replace(l, "0.$1")), w != y))
|
|
535
|
-
return new S(y, x);
|
|
536
|
-
if (S.DEBUG)
|
|
537
|
-
throw Error(X + "Not a" + (p ? " base " + p : "") + " number: " + w);
|
|
538
|
-
g.s = null;
|
|
539
|
-
}
|
|
540
|
-
g.c = g.e = null;
|
|
541
|
-
};
|
|
542
|
-
}();
|
|
543
|
-
function Z(s, o, l, m) {
|
|
544
|
-
var h, g, w, u, p, x, y, v = s.c, R = Oe;
|
|
545
|
-
if (v) {
|
|
546
|
-
e: {
|
|
547
|
-
for (h = 1, u = v[0]; u >= 10; u /= 10, h++) ;
|
|
548
|
-
if (g = o - h, g < 0)
|
|
549
|
-
g += C, w = o, p = v[x = 0], y = j(p / R[h - w - 1] % 10);
|
|
550
|
-
else if (x = _e((g + 1) / C), x >= v.length)
|
|
551
|
-
if (m) {
|
|
552
|
-
for (; v.length <= x; v.push(0)) ;
|
|
553
|
-
p = y = 0, h = 1, g %= C, w = g - C + 1;
|
|
554
|
-
} else
|
|
555
|
-
break e;
|
|
556
|
-
else {
|
|
557
|
-
for (p = u = v[x], h = 1; u >= 10; u /= 10, h++) ;
|
|
558
|
-
g %= C, w = g - C + h, y = w < 0 ? 0 : j(p / R[h - w - 1] % 10);
|
|
559
|
-
}
|
|
560
|
-
if (m = m || o < 0 || // Are there any non-zero digits after the rounding digit?
|
|
561
|
-
// The expression n % pows10[d - j - 1] returns all digits of n to the right
|
|
562
|
-
// of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
|
|
563
|
-
v[x + 1] != null || (w < 0 ? p : p % R[h - w - 1]), m = l < 4 ? (y || m) && (l == 0 || l == (s.s < 0 ? 3 : 2)) : y > 5 || y == 5 && (l == 4 || m || l == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
564
|
-
(g > 0 ? w > 0 ? p / R[h - w] : 0 : v[x - 1]) % 10 & 1 || l == (s.s < 0 ? 8 : 7)), o < 1 || !v[0])
|
|
565
|
-
return v.length = 0, m ? (o -= s.e + 1, v[0] = R[(C - o % C) % C], s.e = -o || 0) : v[0] = s.e = 0, s;
|
|
566
|
-
if (g == 0 ? (v.length = x, u = 1, x--) : (v.length = x + 1, u = R[C - g], v[x] = w > 0 ? j(p / R[h - w] % R[w]) * u : 0), m)
|
|
567
|
-
for (; ; )
|
|
568
|
-
if (x == 0) {
|
|
569
|
-
for (g = 1, w = v[0]; w >= 10; w /= 10, g++) ;
|
|
570
|
-
for (w = v[0] += u, u = 1; w >= 10; w /= 10, u++) ;
|
|
571
|
-
g != u && (s.e++, v[0] == ee && (v[0] = 1));
|
|
572
|
-
break;
|
|
573
|
-
} else {
|
|
574
|
-
if (v[x] += u, v[x] != ee) break;
|
|
575
|
-
v[x--] = 0, u = 1;
|
|
576
|
-
}
|
|
577
|
-
for (g = v.length; v[--g] === 0; v.pop()) ;
|
|
578
|
-
}
|
|
579
|
-
s.e > b ? s.c = s.e = null : s.e < T && (s.c = [s.e = 0]);
|
|
580
|
-
}
|
|
581
|
-
return s;
|
|
582
|
-
}
|
|
583
|
-
function re(s) {
|
|
584
|
-
var o, l = s.e;
|
|
585
|
-
return l === null ? s.toString() : (o = J(s.c), o = l <= E || l >= d ? xe(o, l) : oe(o, l, "0"), s.s < 0 ? "-" + o : o);
|
|
586
|
-
}
|
|
587
|
-
return r.absoluteValue = r.abs = function() {
|
|
588
|
-
var s = new S(this);
|
|
589
|
-
return s.s < 0 && (s.s = 1), s;
|
|
590
|
-
}, r.comparedTo = function(s, o) {
|
|
591
|
-
return fe(this, new S(s, o));
|
|
592
|
-
}, r.decimalPlaces = r.dp = function(s, o) {
|
|
593
|
-
var l, m, h, g = this;
|
|
594
|
-
if (s != null)
|
|
595
|
-
return q(s, 0, Y), o == null ? o = c : q(o, 0, 8), Z(new S(g), s + g.e + 1, o);
|
|
596
|
-
if (!(l = g.c)) return null;
|
|
597
|
-
if (m = ((h = l.length - 1) - Q(this.e / C)) * C, h = l[h]) for (; h % 10 == 0; h /= 10, m--) ;
|
|
598
|
-
return m < 0 && (m = 0), m;
|
|
599
|
-
}, r.dividedBy = r.div = function(s, o) {
|
|
600
|
-
return t(this, new S(s, o), a, c);
|
|
601
|
-
}, r.dividedToIntegerBy = r.idiv = function(s, o) {
|
|
602
|
-
return t(this, new S(s, o), 0, 1);
|
|
603
|
-
}, r.exponentiatedBy = r.pow = function(s, o) {
|
|
604
|
-
var l, m, h, g, w, u, p, x, y, v = this;
|
|
605
|
-
if (s = new S(s), s.c && !s.isInteger())
|
|
606
|
-
throw Error(X + "Exponent not an integer: " + re(s));
|
|
607
|
-
if (o != null && (o = new S(o)), u = s.e > 14, !v.c || !v.c[0] || v.c[0] == 1 && !v.e && v.c.length == 1 || !s.c || !s.c[0])
|
|
608
|
-
return y = new S(Math.pow(+re(v), u ? s.s * (2 - de(s)) : +re(s))), o ? y.mod(o) : y;
|
|
609
|
-
if (p = s.s < 0, o) {
|
|
610
|
-
if (o.c ? !o.c[0] : !o.s) return new S(NaN);
|
|
611
|
-
m = !p && v.isInteger() && o.isInteger(), m && (v = v.mod(o));
|
|
612
|
-
} else {
|
|
613
|
-
if (s.e > 9 && (v.e > 0 || v.e < -1 || (v.e == 0 ? v.c[0] > 1 || u && v.c[1] >= 24e7 : v.c[0] < 8e13 || u && v.c[0] <= 9999975e7)))
|
|
614
|
-
return g = v.s < 0 && de(s) ? -0 : 0, v.e > -1 && (g = 1 / g), new S(p ? 1 / g : g);
|
|
615
|
-
_ && (g = _e(_ / C + 2));
|
|
616
|
-
}
|
|
617
|
-
for (u ? (l = new S(0.5), p && (s.s = 1), x = de(s)) : (h = Math.abs(+re(s)), x = h % 2), y = new S(f); ; ) {
|
|
618
|
-
if (x) {
|
|
619
|
-
if (y = y.times(v), !y.c) break;
|
|
620
|
-
g ? y.c.length > g && (y.c.length = g) : m && (y = y.mod(o));
|
|
621
|
-
}
|
|
622
|
-
if (h) {
|
|
623
|
-
if (h = j(h / 2), h === 0) break;
|
|
624
|
-
x = h % 2;
|
|
625
|
-
} else if (s = s.times(l), Z(s, s.e + 1, 1), s.e > 14)
|
|
626
|
-
x = de(s);
|
|
627
|
-
else {
|
|
628
|
-
if (h = +re(s), h === 0) break;
|
|
629
|
-
x = h % 2;
|
|
630
|
-
}
|
|
631
|
-
v = v.times(v), g ? v.c && v.c.length > g && (v.c.length = g) : m && (v = v.mod(o));
|
|
632
|
-
}
|
|
633
|
-
return m ? y : (p && (y = f.div(y)), o ? y.mod(o) : g ? Z(y, _, c, w) : y);
|
|
634
|
-
}, r.integerValue = function(s) {
|
|
635
|
-
var o = new S(this);
|
|
636
|
-
return s == null ? s = c : q(s, 0, 8), Z(o, o.e + 1, s);
|
|
637
|
-
}, r.isEqualTo = r.eq = function(s, o) {
|
|
638
|
-
return fe(this, new S(s, o)) === 0;
|
|
639
|
-
}, r.isFinite = function() {
|
|
640
|
-
return !!this.c;
|
|
641
|
-
}, r.isGreaterThan = r.gt = function(s, o) {
|
|
642
|
-
return fe(this, new S(s, o)) > 0;
|
|
643
|
-
}, r.isGreaterThanOrEqualTo = r.gte = function(s, o) {
|
|
644
|
-
return (o = fe(this, new S(s, o))) === 1 || o === 0;
|
|
645
|
-
}, r.isInteger = function() {
|
|
646
|
-
return !!this.c && Q(this.e / C) > this.c.length - 2;
|
|
647
|
-
}, r.isLessThan = r.lt = function(s, o) {
|
|
648
|
-
return fe(this, new S(s, o)) < 0;
|
|
649
|
-
}, r.isLessThanOrEqualTo = r.lte = function(s, o) {
|
|
650
|
-
return (o = fe(this, new S(s, o))) === -1 || o === 0;
|
|
651
|
-
}, r.isNaN = function() {
|
|
652
|
-
return !this.s;
|
|
653
|
-
}, r.isNegative = function() {
|
|
654
|
-
return this.s < 0;
|
|
655
|
-
}, r.isPositive = function() {
|
|
656
|
-
return this.s > 0;
|
|
657
|
-
}, r.isZero = function() {
|
|
658
|
-
return !!this.c && this.c[0] == 0;
|
|
659
|
-
}, r.minus = function(s, o) {
|
|
660
|
-
var l, m, h, g, w = this, u = w.s;
|
|
661
|
-
if (s = new S(s, o), o = s.s, !u || !o) return new S(NaN);
|
|
662
|
-
if (u != o)
|
|
663
|
-
return s.s = -o, w.plus(s);
|
|
664
|
-
var p = w.e / C, x = s.e / C, y = w.c, v = s.c;
|
|
665
|
-
if (!p || !x) {
|
|
666
|
-
if (!y || !v) return y ? (s.s = -o, s) : new S(v ? w : NaN);
|
|
667
|
-
if (!y[0] || !v[0])
|
|
668
|
-
return v[0] ? (s.s = -o, s) : new S(y[0] ? w : (
|
|
669
|
-
// IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
|
|
670
|
-
c == 3 ? -0 : 0
|
|
671
|
-
));
|
|
672
|
-
}
|
|
673
|
-
if (p = Q(p), x = Q(x), y = y.slice(), u = p - x) {
|
|
674
|
-
for ((g = u < 0) ? (u = -u, h = y) : (x = p, h = v), h.reverse(), o = u; o--; h.push(0)) ;
|
|
675
|
-
h.reverse();
|
|
676
|
-
} else
|
|
677
|
-
for (m = (g = (u = y.length) < (o = v.length)) ? u : o, u = o = 0; o < m; o++)
|
|
678
|
-
if (y[o] != v[o]) {
|
|
679
|
-
g = y[o] < v[o];
|
|
680
|
-
break;
|
|
681
|
-
}
|
|
682
|
-
if (g && (h = y, y = v, v = h, s.s = -s.s), o = (m = v.length) - (l = y.length), o > 0) for (; o--; y[l++] = 0) ;
|
|
683
|
-
for (o = ee - 1; m > u; ) {
|
|
684
|
-
if (y[--m] < v[m]) {
|
|
685
|
-
for (l = m; l && !y[--l]; y[l] = o) ;
|
|
686
|
-
--y[l], y[m] += ee;
|
|
687
|
-
}
|
|
688
|
-
y[m] -= v[m];
|
|
689
|
-
}
|
|
690
|
-
for (; y[0] == 0; y.splice(0, 1), --x) ;
|
|
691
|
-
return y[0] ? W(s, y, x) : (s.s = c == 3 ? -1 : 1, s.c = [s.e = 0], s);
|
|
692
|
-
}, r.modulo = r.mod = function(s, o) {
|
|
693
|
-
var l, m, h = this;
|
|
694
|
-
return s = new S(s, o), !h.c || !s.s || s.c && !s.c[0] ? new S(NaN) : !s.c || h.c && !h.c[0] ? new S(h) : (N == 9 ? (m = s.s, s.s = 1, l = t(h, s, 0, 3), s.s = m, l.s *= m) : l = t(h, s, 0, N), s = h.minus(l.times(s)), !s.c[0] && N == 1 && (s.s = h.s), s);
|
|
695
|
-
}, r.multipliedBy = r.times = function(s, o) {
|
|
696
|
-
var l, m, h, g, w, u, p, x, y, v, R, O, k, D, U, I = this, G = I.c, $ = (s = new S(s, o)).c;
|
|
697
|
-
if (!G || !$ || !G[0] || !$[0])
|
|
698
|
-
return !I.s || !s.s || G && !G[0] && !$ || $ && !$[0] && !G ? s.c = s.e = s.s = null : (s.s *= I.s, !G || !$ ? s.c = s.e = null : (s.c = [0], s.e = 0)), s;
|
|
699
|
-
for (m = Q(I.e / C) + Q(s.e / C), s.s *= I.s, p = G.length, v = $.length, p < v && (k = G, G = $, $ = k, h = p, p = v, v = h), h = p + v, k = []; h--; k.push(0)) ;
|
|
700
|
-
for (D = ee, U = ue, h = v; --h >= 0; ) {
|
|
701
|
-
for (l = 0, R = $[h] % U, O = $[h] / U | 0, w = p, g = h + w; g > h; )
|
|
702
|
-
x = G[--w] % U, y = G[w] / U | 0, u = O * x + y * R, x = R * x + u % U * U + k[g] + l, l = (x / D | 0) + (u / U | 0) + O * y, k[g--] = x % D;
|
|
703
|
-
k[g] = l;
|
|
704
|
-
}
|
|
705
|
-
return l ? ++m : k.splice(0, 1), W(s, k, m);
|
|
706
|
-
}, r.negated = function() {
|
|
707
|
-
var s = new S(this);
|
|
708
|
-
return s.s = -s.s || null, s;
|
|
709
|
-
}, r.plus = function(s, o) {
|
|
710
|
-
var l, m = this, h = m.s;
|
|
711
|
-
if (s = new S(s, o), o = s.s, !h || !o) return new S(NaN);
|
|
712
|
-
if (h != o)
|
|
713
|
-
return s.s = -o, m.minus(s);
|
|
714
|
-
var g = m.e / C, w = s.e / C, u = m.c, p = s.c;
|
|
715
|
-
if (!g || !w) {
|
|
716
|
-
if (!u || !p) return new S(h / 0);
|
|
717
|
-
if (!u[0] || !p[0]) return p[0] ? s : new S(u[0] ? m : h * 0);
|
|
718
|
-
}
|
|
719
|
-
if (g = Q(g), w = Q(w), u = u.slice(), h = g - w) {
|
|
720
|
-
for (h > 0 ? (w = g, l = p) : (h = -h, l = u), l.reverse(); h--; l.push(0)) ;
|
|
721
|
-
l.reverse();
|
|
722
|
-
}
|
|
723
|
-
for (h = u.length, o = p.length, h - o < 0 && (l = p, p = u, u = l, o = h), h = 0; o; )
|
|
724
|
-
h = (u[--o] = u[o] + p[o] + h) / ee | 0, u[o] = ee === u[o] ? 0 : u[o] % ee;
|
|
725
|
-
return h && (u = [h].concat(u), ++w), W(s, u, w);
|
|
726
|
-
}, r.precision = r.sd = function(s, o) {
|
|
727
|
-
var l, m, h, g = this;
|
|
728
|
-
if (s != null && s !== !!s)
|
|
729
|
-
return q(s, 1, Y), o == null ? o = c : q(o, 0, 8), Z(new S(g), s, o);
|
|
730
|
-
if (!(l = g.c)) return null;
|
|
731
|
-
if (h = l.length - 1, m = h * C + 1, h = l[h]) {
|
|
732
|
-
for (; h % 10 == 0; h /= 10, m--) ;
|
|
733
|
-
for (h = l[0]; h >= 10; h /= 10, m++) ;
|
|
734
|
-
}
|
|
735
|
-
return s && g.e + 1 > m && (m = g.e + 1), m;
|
|
736
|
-
}, r.shiftedBy = function(s) {
|
|
737
|
-
return q(s, -9007199254740991, We), this.times("1e" + s);
|
|
738
|
-
}, r.squareRoot = r.sqrt = function() {
|
|
739
|
-
var s, o, l, m, h, g = this, w = g.c, u = g.s, p = g.e, x = a + 4, y = new S("0.5");
|
|
740
|
-
if (u !== 1 || !w || !w[0])
|
|
741
|
-
return new S(!u || u < 0 && (!w || w[0]) ? NaN : w ? g : 1 / 0);
|
|
742
|
-
if (u = Math.sqrt(+re(g)), u == 0 || u == 1 / 0 ? (o = J(w), (o.length + p) % 2 == 0 && (o += "0"), u = Math.sqrt(+o), p = Q((p + 1) / 2) - (p < 0 || p % 2), u == 1 / 0 ? o = "5e" + p : (o = u.toExponential(), o = o.slice(0, o.indexOf("e") + 1) + p), l = new S(o)) : l = new S(u + ""), l.c[0]) {
|
|
743
|
-
for (p = l.e, u = p + x, u < 3 && (u = 0); ; )
|
|
744
|
-
if (h = l, l = y.times(h.plus(t(g, h, x, 1))), J(h.c).slice(0, u) === (o = J(l.c)).slice(0, u))
|
|
745
|
-
if (l.e < p && --u, o = o.slice(u - 3, u + 1), o == "9999" || !m && o == "4999") {
|
|
746
|
-
if (!m && (Z(h, h.e + a + 2, 0), h.times(h).eq(g))) {
|
|
747
|
-
l = h;
|
|
748
|
-
break;
|
|
749
|
-
}
|
|
750
|
-
x += 4, u += 4, m = 1;
|
|
751
|
-
} else {
|
|
752
|
-
(!+o || !+o.slice(1) && o.charAt(0) == "5") && (Z(l, l.e + a + 2, 1), s = !l.times(l).eq(g));
|
|
753
|
-
break;
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
return Z(l, l.e + a + 1, c, s);
|
|
757
|
-
}, r.toExponential = function(s, o) {
|
|
758
|
-
return s != null && (q(s, 0, Y), s++), F(this, s, o, 1);
|
|
759
|
-
}, r.toFixed = function(s, o) {
|
|
760
|
-
return s != null && (q(s, 0, Y), s = s + this.e + 1), F(this, s, o);
|
|
761
|
-
}, r.toFormat = function(s, o, l) {
|
|
762
|
-
var m, h = this;
|
|
763
|
-
if (l == null)
|
|
764
|
-
s != null && o && typeof o == "object" ? (l = o, o = null) : s && typeof s == "object" ? (l = s, s = o = null) : l = L;
|
|
765
|
-
else if (typeof l != "object")
|
|
766
|
-
throw Error(X + "Argument not an object: " + l);
|
|
767
|
-
if (m = h.toFixed(s, o), h.c) {
|
|
768
|
-
var g, w = m.split("."), u = +l.groupSize, p = +l.secondaryGroupSize, x = l.groupSeparator || "", y = w[0], v = w[1], R = h.s < 0, O = R ? y.slice(1) : y, k = O.length;
|
|
769
|
-
if (p && (g = u, u = p, p = g, k -= g), u > 0 && k > 0) {
|
|
770
|
-
for (g = k % u || u, y = O.substr(0, g); g < k; g += u) y += x + O.substr(g, u);
|
|
771
|
-
p > 0 && (y += x + O.slice(g)), R && (y = "-" + y);
|
|
772
|
-
}
|
|
773
|
-
m = v ? y + (l.decimalSeparator || "") + ((p = +l.fractionGroupSize) ? v.replace(
|
|
774
|
-
new RegExp("\\d{" + p + "}\\B", "g"),
|
|
775
|
-
"$&" + (l.fractionGroupSeparator || "")
|
|
776
|
-
) : v) : y;
|
|
777
|
-
}
|
|
778
|
-
return (l.prefix || "") + m + (l.suffix || "");
|
|
779
|
-
}, r.toFraction = function(s) {
|
|
780
|
-
var o, l, m, h, g, w, u, p, x, y, v, R, O = this, k = O.c;
|
|
781
|
-
if (s != null && (u = new S(s), !u.isInteger() && (u.c || u.s !== 1) || u.lt(f)))
|
|
782
|
-
throw Error(X + "Argument " + (u.isInteger() ? "out of range: " : "not an integer: ") + re(u));
|
|
783
|
-
if (!k) return new S(O);
|
|
784
|
-
for (o = new S(f), x = l = new S(f), m = p = new S(f), R = J(k), g = o.e = R.length - O.e - 1, o.c[0] = Oe[(w = g % C) < 0 ? C + w : w], s = !s || u.comparedTo(o) > 0 ? g > 0 ? o : x : u, w = b, b = 1 / 0, u = new S(R), p.c[0] = 0; y = t(u, o, 0, 1), h = l.plus(y.times(m)), h.comparedTo(s) != 1; )
|
|
785
|
-
l = m, m = h, x = p.plus(y.times(h = x)), p = h, o = u.minus(y.times(h = o)), u = h;
|
|
786
|
-
return h = t(s.minus(l), m, 0, 1), p = p.plus(h.times(x)), l = l.plus(h.times(m)), p.s = x.s = O.s, g = g * 2, v = t(x, m, g, c).minus(O).abs().comparedTo(
|
|
787
|
-
t(p, l, g, c).minus(O).abs()
|
|
788
|
-
) < 1 ? [x, m] : [p, l], b = w, v;
|
|
789
|
-
}, r.toNumber = function() {
|
|
790
|
-
return +re(this);
|
|
791
|
-
}, r.toPrecision = function(s, o) {
|
|
792
|
-
return s != null && q(s, 1, Y), F(this, s, o, 2);
|
|
793
|
-
}, r.toString = function(s) {
|
|
794
|
-
var o, l = this, m = l.s, h = l.e;
|
|
795
|
-
return h === null ? m ? (o = "Infinity", m < 0 && (o = "-" + o)) : o = "NaN" : (s == null ? o = h <= E || h >= d ? xe(J(l.c), h) : oe(J(l.c), h, "0") : s === 10 && V ? (l = Z(new S(l), a + h + 1, c), o = oe(J(l.c), l.e, "0")) : (q(s, 2, A.length, "Base"), o = e(oe(J(l.c), h, "0"), 10, s, m, !0)), m < 0 && l.c[0] && (o = "-" + o)), o;
|
|
796
|
-
}, r.valueOf = r.toJSON = function() {
|
|
797
|
-
return re(this);
|
|
798
|
-
}, r._isBigNumber = !0, r[Symbol.toStringTag] = "BigNumber", r[Symbol.for("nodejs.util.inspect.custom")] = r.valueOf, i != null && S.set(i), S;
|
|
799
|
-
}
|
|
800
|
-
function Q(i) {
|
|
801
|
-
var t = i | 0;
|
|
802
|
-
return i > 0 || i === t ? t : t - 1;
|
|
803
|
-
}
|
|
804
|
-
function J(i) {
|
|
805
|
-
for (var t, e, n = 1, r = i.length, f = i[0] + ""; n < r; ) {
|
|
806
|
-
for (t = i[n++] + "", e = C - t.length; e--; t = "0" + t) ;
|
|
807
|
-
f += t;
|
|
808
|
-
}
|
|
809
|
-
for (r = f.length; f.charCodeAt(--r) === 48; ) ;
|
|
810
|
-
return f.slice(0, r + 1 || 1);
|
|
811
|
-
}
|
|
812
|
-
function fe(i, t) {
|
|
813
|
-
var e, n, r = i.c, f = t.c, a = i.s, c = t.s, E = i.e, d = t.e;
|
|
814
|
-
if (!a || !c) return null;
|
|
815
|
-
if (e = r && !r[0], n = f && !f[0], e || n) return e ? n ? 0 : -c : a;
|
|
816
|
-
if (a != c) return a;
|
|
817
|
-
if (e = a < 0, n = E == d, !r || !f) return n ? 0 : !r ^ e ? 1 : -1;
|
|
818
|
-
if (!n) return E > d ^ e ? 1 : -1;
|
|
819
|
-
for (c = (E = r.length) < (d = f.length) ? E : d, a = 0; a < c; a++) if (r[a] != f[a]) return r[a] > f[a] ^ e ? 1 : -1;
|
|
820
|
-
return E == d ? 0 : E > d ^ e ? 1 : -1;
|
|
821
|
-
}
|
|
822
|
-
function q(i, t, e, n) {
|
|
823
|
-
if (i < t || i > e || i !== j(i))
|
|
824
|
-
throw Error(X + (n || "Argument") + (typeof i == "number" ? i < t || i > e ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(i));
|
|
825
|
-
}
|
|
826
|
-
function de(i) {
|
|
827
|
-
var t = i.c.length - 1;
|
|
828
|
-
return Q(i.e / C) == t && i.c[t] % 2 != 0;
|
|
829
|
-
}
|
|
830
|
-
function xe(i, t) {
|
|
831
|
-
return (i.length > 1 ? i.charAt(0) + "." + i.slice(1) : i) + (t < 0 ? "e" : "e+") + t;
|
|
832
|
-
}
|
|
833
|
-
function oe(i, t, e) {
|
|
834
|
-
var n, r;
|
|
835
|
-
if (t < 0) {
|
|
836
|
-
for (r = e + "."; ++t; r += e) ;
|
|
837
|
-
i = r + i;
|
|
838
|
-
} else if (n = i.length, ++t > n) {
|
|
839
|
-
for (r = e, t -= n; --t; r += e) ;
|
|
840
|
-
i += r;
|
|
841
|
-
} else t < n && (i = i.slice(0, t) + "." + i.slice(t));
|
|
842
|
-
return i;
|
|
843
|
-
}
|
|
844
|
-
var ne = ot(), Tt = class {
|
|
845
|
-
constructor(i) {
|
|
846
|
-
M(this, "key");
|
|
847
|
-
M(this, "left", null);
|
|
848
|
-
M(this, "right", null);
|
|
849
|
-
this.key = i;
|
|
850
|
-
}
|
|
851
|
-
}, ce = class extends Tt {
|
|
852
|
-
constructor(i) {
|
|
853
|
-
super(i);
|
|
854
|
-
}
|
|
855
|
-
}, Pt = class {
|
|
856
|
-
constructor() {
|
|
857
|
-
M(this, "size", 0);
|
|
858
|
-
M(this, "modificationCount", 0);
|
|
859
|
-
M(this, "splayCount", 0);
|
|
860
|
-
}
|
|
861
|
-
splay(i) {
|
|
862
|
-
const t = this.root;
|
|
863
|
-
if (t == null)
|
|
864
|
-
return this.compare(i, i), -1;
|
|
865
|
-
let e = null, n = null, r = null, f = null, a = t;
|
|
866
|
-
const c = this.compare;
|
|
867
|
-
let E;
|
|
868
|
-
for (; ; )
|
|
869
|
-
if (E = c(a.key, i), E > 0) {
|
|
870
|
-
let d = a.left;
|
|
871
|
-
if (d == null || (E = c(d.key, i), E > 0 && (a.left = d.right, d.right = a, a = d, d = a.left, d == null)))
|
|
872
|
-
break;
|
|
873
|
-
e == null ? n = a : e.left = a, e = a, a = d;
|
|
874
|
-
} else if (E < 0) {
|
|
875
|
-
let d = a.right;
|
|
876
|
-
if (d == null || (E = c(d.key, i), E < 0 && (a.right = d.left, d.left = a, a = d, d = a.right, d == null)))
|
|
877
|
-
break;
|
|
878
|
-
r == null ? f = a : r.right = a, r = a, a = d;
|
|
879
|
-
} else
|
|
880
|
-
break;
|
|
881
|
-
return r != null && (r.right = a.left, a.left = f), e != null && (e.left = a.right, a.right = n), this.root !== a && (this.root = a, this.splayCount++), E;
|
|
882
|
-
}
|
|
883
|
-
splayMin(i) {
|
|
884
|
-
let t = i, e = t.left;
|
|
885
|
-
for (; e != null; ) {
|
|
886
|
-
const n = e;
|
|
887
|
-
t.left = n.right, n.right = t, t = n, e = t.left;
|
|
888
|
-
}
|
|
889
|
-
return t;
|
|
890
|
-
}
|
|
891
|
-
splayMax(i) {
|
|
892
|
-
let t = i, e = t.right;
|
|
893
|
-
for (; e != null; ) {
|
|
894
|
-
const n = e;
|
|
895
|
-
t.right = n.left, n.left = t, t = n, e = t.right;
|
|
896
|
-
}
|
|
897
|
-
return t;
|
|
898
|
-
}
|
|
899
|
-
_delete(i) {
|
|
900
|
-
if (this.root == null || this.splay(i) != 0) return null;
|
|
901
|
-
let e = this.root;
|
|
902
|
-
const n = e, r = e.left;
|
|
903
|
-
if (this.size--, r == null)
|
|
904
|
-
this.root = e.right;
|
|
905
|
-
else {
|
|
906
|
-
const f = e.right;
|
|
907
|
-
e = this.splayMax(r), e.right = f, this.root = e;
|
|
908
|
-
}
|
|
909
|
-
return this.modificationCount++, n;
|
|
910
|
-
}
|
|
911
|
-
addNewRoot(i, t) {
|
|
912
|
-
this.size++, this.modificationCount++;
|
|
913
|
-
const e = this.root;
|
|
914
|
-
if (e == null) {
|
|
915
|
-
this.root = i;
|
|
916
|
-
return;
|
|
917
|
-
}
|
|
918
|
-
t < 0 ? (i.left = e, i.right = e.right, e.right = null) : (i.right = e, i.left = e.left, e.left = null), this.root = i;
|
|
919
|
-
}
|
|
920
|
-
_first() {
|
|
921
|
-
const i = this.root;
|
|
922
|
-
return i == null ? null : (this.root = this.splayMin(i), this.root);
|
|
923
|
-
}
|
|
924
|
-
_last() {
|
|
925
|
-
const i = this.root;
|
|
926
|
-
return i == null ? null : (this.root = this.splayMax(i), this.root);
|
|
927
|
-
}
|
|
928
|
-
clear() {
|
|
929
|
-
this.root = null, this.size = 0, this.modificationCount++;
|
|
930
|
-
}
|
|
931
|
-
has(i) {
|
|
932
|
-
return this.validKey(i) && this.splay(i) == 0;
|
|
933
|
-
}
|
|
934
|
-
defaultCompare() {
|
|
935
|
-
return (i, t) => i < t ? -1 : i > t ? 1 : 0;
|
|
936
|
-
}
|
|
937
|
-
wrap() {
|
|
938
|
-
return {
|
|
939
|
-
getRoot: () => this.root,
|
|
940
|
-
setRoot: (i) => {
|
|
941
|
-
this.root = i;
|
|
942
|
-
},
|
|
943
|
-
getSize: () => this.size,
|
|
944
|
-
getModificationCount: () => this.modificationCount,
|
|
945
|
-
getSplayCount: () => this.splayCount,
|
|
946
|
-
setSplayCount: (i) => {
|
|
947
|
-
this.splayCount = i;
|
|
948
|
-
},
|
|
949
|
-
splay: (i) => this.splay(i),
|
|
950
|
-
has: (i) => this.has(i)
|
|
951
|
-
};
|
|
952
|
-
}
|
|
953
|
-
}, it, nt, ve = class pe extends Pt {
|
|
954
|
-
constructor(e, n) {
|
|
955
|
-
super();
|
|
956
|
-
M(this, "root", null);
|
|
957
|
-
M(this, "compare");
|
|
958
|
-
M(this, "validKey");
|
|
959
|
-
M(this, it, "[object Set]");
|
|
960
|
-
this.compare = e ?? this.defaultCompare(), this.validKey = n ?? ((r) => r != null && r != null);
|
|
961
|
-
}
|
|
962
|
-
delete(e) {
|
|
963
|
-
return this.validKey(e) ? this._delete(e) != null : !1;
|
|
964
|
-
}
|
|
965
|
-
deleteAll(e) {
|
|
966
|
-
for (const n of e)
|
|
967
|
-
this.delete(n);
|
|
968
|
-
}
|
|
969
|
-
forEach(e) {
|
|
970
|
-
const n = this[Symbol.iterator]();
|
|
971
|
-
let r;
|
|
972
|
-
for (; r = n.next(), !r.done; )
|
|
973
|
-
e(r.value, r.value, this);
|
|
974
|
-
}
|
|
975
|
-
add(e) {
|
|
976
|
-
const n = this.splay(e);
|
|
977
|
-
return n != 0 && this.addNewRoot(new ce(e), n), this;
|
|
978
|
-
}
|
|
979
|
-
addAndReturn(e) {
|
|
980
|
-
const n = this.splay(e);
|
|
981
|
-
return n != 0 && this.addNewRoot(new ce(e), n), this.root.key;
|
|
982
|
-
}
|
|
983
|
-
addAll(e) {
|
|
984
|
-
for (const n of e)
|
|
985
|
-
this.add(n);
|
|
986
|
-
}
|
|
987
|
-
isEmpty() {
|
|
988
|
-
return this.root == null;
|
|
989
|
-
}
|
|
990
|
-
isNotEmpty() {
|
|
991
|
-
return this.root != null;
|
|
992
|
-
}
|
|
993
|
-
single() {
|
|
994
|
-
if (this.size == 0) throw "Bad state: No element";
|
|
995
|
-
if (this.size > 1) throw "Bad state: Too many element";
|
|
996
|
-
return this.root.key;
|
|
997
|
-
}
|
|
998
|
-
first() {
|
|
999
|
-
if (this.size == 0) throw "Bad state: No element";
|
|
1000
|
-
return this._first().key;
|
|
1001
|
-
}
|
|
1002
|
-
last() {
|
|
1003
|
-
if (this.size == 0) throw "Bad state: No element";
|
|
1004
|
-
return this._last().key;
|
|
1005
|
-
}
|
|
1006
|
-
lastBefore(e) {
|
|
1007
|
-
if (e == null) throw "Invalid arguments(s)";
|
|
1008
|
-
if (this.root == null) return null;
|
|
1009
|
-
if (this.splay(e) < 0) return this.root.key;
|
|
1010
|
-
let r = this.root.left;
|
|
1011
|
-
if (r == null) return null;
|
|
1012
|
-
let f = r.right;
|
|
1013
|
-
for (; f != null; )
|
|
1014
|
-
r = f, f = r.right;
|
|
1015
|
-
return r.key;
|
|
1016
|
-
}
|
|
1017
|
-
firstAfter(e) {
|
|
1018
|
-
if (e == null) throw "Invalid arguments(s)";
|
|
1019
|
-
if (this.root == null) return null;
|
|
1020
|
-
if (this.splay(e) > 0) return this.root.key;
|
|
1021
|
-
let r = this.root.right;
|
|
1022
|
-
if (r == null) return null;
|
|
1023
|
-
let f = r.left;
|
|
1024
|
-
for (; f != null; )
|
|
1025
|
-
r = f, f = r.left;
|
|
1026
|
-
return r.key;
|
|
1027
|
-
}
|
|
1028
|
-
retainAll(e) {
|
|
1029
|
-
const n = new pe(this.compare, this.validKey), r = this.modificationCount;
|
|
1030
|
-
for (const f of e) {
|
|
1031
|
-
if (r != this.modificationCount)
|
|
1032
|
-
throw "Concurrent modification during iteration.";
|
|
1033
|
-
this.validKey(f) && this.splay(f) == 0 && n.add(this.root.key);
|
|
1034
|
-
}
|
|
1035
|
-
n.size != this.size && (this.root = n.root, this.size = n.size, this.modificationCount++);
|
|
1036
|
-
}
|
|
1037
|
-
lookup(e) {
|
|
1038
|
-
return !this.validKey(e) || this.splay(e) != 0 ? null : this.root.key;
|
|
1039
|
-
}
|
|
1040
|
-
intersection(e) {
|
|
1041
|
-
const n = new pe(this.compare, this.validKey);
|
|
1042
|
-
for (const r of this)
|
|
1043
|
-
e.has(r) && n.add(r);
|
|
1044
|
-
return n;
|
|
1045
|
-
}
|
|
1046
|
-
difference(e) {
|
|
1047
|
-
const n = new pe(this.compare, this.validKey);
|
|
1048
|
-
for (const r of this)
|
|
1049
|
-
e.has(r) || n.add(r);
|
|
1050
|
-
return n;
|
|
1051
|
-
}
|
|
1052
|
-
union(e) {
|
|
1053
|
-
const n = this.clone();
|
|
1054
|
-
return n.addAll(e), n;
|
|
1055
|
-
}
|
|
1056
|
-
clone() {
|
|
1057
|
-
const e = new pe(this.compare, this.validKey);
|
|
1058
|
-
return e.size = this.size, e.root = this.copyNode(this.root), e;
|
|
1059
|
-
}
|
|
1060
|
-
copyNode(e) {
|
|
1061
|
-
if (e == null) return null;
|
|
1062
|
-
function n(f, a) {
|
|
1063
|
-
let c, E;
|
|
1064
|
-
do {
|
|
1065
|
-
if (c = f.left, E = f.right, c != null) {
|
|
1066
|
-
const d = new ce(c.key);
|
|
1067
|
-
a.left = d, n(c, d);
|
|
1068
|
-
}
|
|
1069
|
-
if (E != null) {
|
|
1070
|
-
const d = new ce(E.key);
|
|
1071
|
-
a.right = d, f = E, a = d;
|
|
1072
|
-
}
|
|
1073
|
-
} while (E != null);
|
|
1074
|
-
}
|
|
1075
|
-
const r = new ce(e.key);
|
|
1076
|
-
return n(e, r), r;
|
|
1077
|
-
}
|
|
1078
|
-
toSet() {
|
|
1079
|
-
return this.clone();
|
|
1080
|
-
}
|
|
1081
|
-
entries() {
|
|
1082
|
-
return new Mt(this.wrap());
|
|
1083
|
-
}
|
|
1084
|
-
keys() {
|
|
1085
|
-
return this[Symbol.iterator]();
|
|
1086
|
-
}
|
|
1087
|
-
values() {
|
|
1088
|
-
return this[Symbol.iterator]();
|
|
1089
|
-
}
|
|
1090
|
-
[(nt = Symbol.iterator, it = Symbol.toStringTag, nt)]() {
|
|
1091
|
-
return new Lt(this.wrap());
|
|
1092
|
-
}
|
|
1093
|
-
}, lt = class {
|
|
1094
|
-
constructor(i) {
|
|
1095
|
-
M(this, "tree");
|
|
1096
|
-
M(this, "path", new Array());
|
|
1097
|
-
M(this, "modificationCount", null);
|
|
1098
|
-
M(this, "splayCount");
|
|
1099
|
-
this.tree = i, this.splayCount = i.getSplayCount();
|
|
1100
|
-
}
|
|
1101
|
-
[Symbol.iterator]() {
|
|
1102
|
-
return this;
|
|
1103
|
-
}
|
|
1104
|
-
next() {
|
|
1105
|
-
return this.moveNext() ? { done: !1, value: this.current() } : { done: !0, value: null };
|
|
1106
|
-
}
|
|
1107
|
-
current() {
|
|
1108
|
-
if (!this.path.length) return null;
|
|
1109
|
-
const i = this.path[this.path.length - 1];
|
|
1110
|
-
return this.getValue(i);
|
|
1111
|
-
}
|
|
1112
|
-
rebuildPath(i) {
|
|
1113
|
-
this.path.splice(0, this.path.length), this.tree.splay(i), this.path.push(this.tree.getRoot()), this.splayCount = this.tree.getSplayCount();
|
|
1114
|
-
}
|
|
1115
|
-
findLeftMostDescendent(i) {
|
|
1116
|
-
for (; i != null; )
|
|
1117
|
-
this.path.push(i), i = i.left;
|
|
1118
|
-
}
|
|
1119
|
-
moveNext() {
|
|
1120
|
-
if (this.modificationCount != this.tree.getModificationCount()) {
|
|
1121
|
-
if (this.modificationCount == null) {
|
|
1122
|
-
this.modificationCount = this.tree.getModificationCount();
|
|
1123
|
-
let e = this.tree.getRoot();
|
|
1124
|
-
for (; e != null; )
|
|
1125
|
-
this.path.push(e), e = e.left;
|
|
1126
|
-
return this.path.length > 0;
|
|
1127
|
-
}
|
|
1128
|
-
throw "Concurrent modification during iteration.";
|
|
1129
|
-
}
|
|
1130
|
-
if (!this.path.length) return !1;
|
|
1131
|
-
this.splayCount != this.tree.getSplayCount() && this.rebuildPath(this.path[this.path.length - 1].key);
|
|
1132
|
-
let i = this.path[this.path.length - 1], t = i.right;
|
|
1133
|
-
if (t != null) {
|
|
1134
|
-
for (; t != null; )
|
|
1135
|
-
this.path.push(t), t = t.left;
|
|
1136
|
-
return !0;
|
|
1137
|
-
}
|
|
1138
|
-
for (this.path.pop(); this.path.length && this.path[this.path.length - 1].right === i; )
|
|
1139
|
-
i = this.path.pop();
|
|
1140
|
-
return this.path.length > 0;
|
|
1141
|
-
}
|
|
1142
|
-
}, Lt = class extends lt {
|
|
1143
|
-
getValue(i) {
|
|
1144
|
-
return i.key;
|
|
1145
|
-
}
|
|
1146
|
-
}, Mt = class extends lt {
|
|
1147
|
-
getValue(i) {
|
|
1148
|
-
return [i.key, i.key];
|
|
1149
|
-
}
|
|
1150
|
-
}, ut = (i) => () => i, Ne = (i) => {
|
|
1151
|
-
const t = i ? (e, n) => n.minus(e).abs().isLessThanOrEqualTo(i) : ut(!1);
|
|
1152
|
-
return (e, n) => t(e, n) ? 0 : e.comparedTo(n);
|
|
1153
|
-
};
|
|
1154
|
-
function Rt(i) {
|
|
1155
|
-
const t = i ? (e, n, r, f, a) => e.exponentiatedBy(2).isLessThanOrEqualTo(
|
|
1156
|
-
f.minus(n).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(i)
|
|
1157
|
-
) : ut(!1);
|
|
1158
|
-
return (e, n, r) => {
|
|
1159
|
-
const f = e.x, a = e.y, c = r.x, E = r.y, d = a.minus(E).times(n.x.minus(c)).minus(f.minus(c).times(n.y.minus(E)));
|
|
1160
|
-
return t(d, f, a, c, E) ? 0 : d.comparedTo(0);
|
|
1161
|
-
};
|
|
1162
|
-
}
|
|
1163
|
-
var _t = (i) => i, Ot = (i) => {
|
|
1164
|
-
if (i) {
|
|
1165
|
-
const t = new ve(Ne(i)), e = new ve(Ne(i)), n = (f, a) => a.addAndReturn(f), r = (f) => ({
|
|
1166
|
-
x: n(f.x, t),
|
|
1167
|
-
y: n(f.y, e)
|
|
1168
|
-
});
|
|
1169
|
-
return r({ x: new ne(0), y: new ne(0) }), r;
|
|
1170
|
-
}
|
|
1171
|
-
return _t;
|
|
1172
|
-
}, Ae = (i) => ({
|
|
1173
|
-
set: (t) => {
|
|
1174
|
-
le = Ae(t);
|
|
1175
|
-
},
|
|
1176
|
-
reset: () => Ae(i),
|
|
1177
|
-
compare: Ne(i),
|
|
1178
|
-
snap: Ot(i),
|
|
1179
|
-
orient: Rt(i)
|
|
1180
|
-
}), le = Ae(), ae = (i, t) => i.ll.x.isLessThanOrEqualTo(t.x) && t.x.isLessThanOrEqualTo(i.ur.x) && i.ll.y.isLessThanOrEqualTo(t.y) && t.y.isLessThanOrEqualTo(i.ur.y), Ie = (i, t) => {
|
|
1181
|
-
if (t.ur.x.isLessThan(i.ll.x) || i.ur.x.isLessThan(t.ll.x) || t.ur.y.isLessThan(i.ll.y) || i.ur.y.isLessThan(t.ll.y))
|
|
1182
|
-
return null;
|
|
1183
|
-
const e = i.ll.x.isLessThan(t.ll.x) ? t.ll.x : i.ll.x, n = i.ur.x.isLessThan(t.ur.x) ? i.ur.x : t.ur.x, r = i.ll.y.isLessThan(t.ll.y) ? t.ll.y : i.ll.y, f = i.ur.y.isLessThan(t.ur.y) ? i.ur.y : t.ur.y;
|
|
1184
|
-
return { ll: { x: e, y: r }, ur: { x: n, y: f } };
|
|
1185
|
-
}, we = (i, t) => i.x.times(t.y).minus(i.y.times(t.x)), ft = (i, t) => i.x.times(t.x).plus(i.y.times(t.y)), be = (i) => ft(i, i).sqrt(), Ct = (i, t, e) => {
|
|
1186
|
-
const n = { x: t.x.minus(i.x), y: t.y.minus(i.y) }, r = { x: e.x.minus(i.x), y: e.y.minus(i.y) };
|
|
1187
|
-
return we(r, n).div(be(r)).div(be(n));
|
|
1188
|
-
}, Nt = (i, t, e) => {
|
|
1189
|
-
const n = { x: t.x.minus(i.x), y: t.y.minus(i.y) }, r = { x: e.x.minus(i.x), y: e.y.minus(i.y) };
|
|
1190
|
-
return ft(r, n).div(be(r)).div(be(n));
|
|
1191
|
-
}, Ye = (i, t, e) => t.y.isZero() ? null : { x: i.x.plus(t.x.div(t.y).times(e.minus(i.y))), y: e }, Ze = (i, t, e) => t.x.isZero() ? null : { x: e, y: i.y.plus(t.y.div(t.x).times(e.minus(i.x))) }, At = (i, t, e, n) => {
|
|
1192
|
-
if (t.x.isZero()) return Ze(e, n, i.x);
|
|
1193
|
-
if (n.x.isZero()) return Ze(i, t, e.x);
|
|
1194
|
-
if (t.y.isZero()) return Ye(e, n, i.y);
|
|
1195
|
-
if (n.y.isZero()) return Ye(i, t, e.y);
|
|
1196
|
-
const r = we(t, n);
|
|
1197
|
-
if (r.isZero()) return null;
|
|
1198
|
-
const f = { x: e.x.minus(i.x), y: e.y.minus(i.y) }, a = we(f, t).div(r), c = we(f, n).div(r), E = i.x.plus(c.times(t.x)), d = e.x.plus(a.times(n.x)), T = i.y.plus(c.times(t.y)), b = e.y.plus(a.times(n.y)), P = E.plus(d).div(2), N = T.plus(b).div(2);
|
|
1199
|
-
return { x: P, y: N };
|
|
1200
|
-
}, ie = class ht {
|
|
1201
|
-
// Warning: 'point' input will be modified and re-used (for performance)
|
|
1202
|
-
constructor(t, e) {
|
|
1203
|
-
M(this, "point");
|
|
1204
|
-
M(this, "isLeft");
|
|
1205
|
-
M(this, "segment");
|
|
1206
|
-
M(this, "otherSE");
|
|
1207
|
-
M(this, "consumedBy");
|
|
1208
|
-
t.events === void 0 ? t.events = [this] : t.events.push(this), this.point = t, this.isLeft = e;
|
|
1209
|
-
}
|
|
1210
|
-
// for ordering sweep events in the sweep event queue
|
|
1211
|
-
static compare(t, e) {
|
|
1212
|
-
const n = ht.comparePoints(t.point, e.point);
|
|
1213
|
-
return n !== 0 ? n : (t.point !== e.point && t.link(e), t.isLeft !== e.isLeft ? t.isLeft ? 1 : -1 : Pe.compare(t.segment, e.segment));
|
|
1214
|
-
}
|
|
1215
|
-
// for ordering points in sweep line order
|
|
1216
|
-
static comparePoints(t, e) {
|
|
1217
|
-
return t.x.isLessThan(e.x) ? -1 : t.x.isGreaterThan(e.x) ? 1 : t.y.isLessThan(e.y) ? -1 : t.y.isGreaterThan(e.y) ? 1 : 0;
|
|
1218
|
-
}
|
|
1219
|
-
link(t) {
|
|
1220
|
-
if (t.point === this.point)
|
|
1221
|
-
throw new Error("Tried to link already linked events");
|
|
1222
|
-
const e = t.point.events;
|
|
1223
|
-
for (let n = 0, r = e.length; n < r; n++) {
|
|
1224
|
-
const f = e[n];
|
|
1225
|
-
this.point.events.push(f), f.point = this.point;
|
|
1226
|
-
}
|
|
1227
|
-
this.checkForConsuming();
|
|
1228
|
-
}
|
|
1229
|
-
/* Do a pass over our linked events and check to see if any pair
|
|
1230
|
-
* of segments match, and should be consumed. */
|
|
1231
|
-
checkForConsuming() {
|
|
1232
|
-
const t = this.point.events.length;
|
|
1233
|
-
for (let e = 0; e < t; e++) {
|
|
1234
|
-
const n = this.point.events[e];
|
|
1235
|
-
if (n.segment.consumedBy === void 0)
|
|
1236
|
-
for (let r = e + 1; r < t; r++) {
|
|
1237
|
-
const f = this.point.events[r];
|
|
1238
|
-
f.consumedBy === void 0 && n.otherSE.point.events === f.otherSE.point.events && n.segment.consume(f.segment);
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
getAvailableLinkedEvents() {
|
|
1243
|
-
const t = [];
|
|
1244
|
-
for (let e = 0, n = this.point.events.length; e < n; e++) {
|
|
1245
|
-
const r = this.point.events[e];
|
|
1246
|
-
r !== this && !r.segment.ringOut && r.segment.isInResult() && t.push(r);
|
|
1247
|
-
}
|
|
1248
|
-
return t;
|
|
1249
|
-
}
|
|
1250
|
-
/**
|
|
1251
|
-
* Returns a comparator function for sorting linked events that will
|
|
1252
|
-
* favor the event that will give us the smallest left-side angle.
|
|
1253
|
-
* All ring construction starts as low as possible heading to the right,
|
|
1254
|
-
* so by always turning left as sharp as possible we'll get polygons
|
|
1255
|
-
* without uncessary loops & holes.
|
|
1256
|
-
*
|
|
1257
|
-
* The comparator function has a compute cache such that it avoids
|
|
1258
|
-
* re-computing already-computed values.
|
|
1259
|
-
*/
|
|
1260
|
-
getLeftmostComparator(t) {
|
|
1261
|
-
const e = /* @__PURE__ */ new Map(), n = (r) => {
|
|
1262
|
-
const f = r.otherSE;
|
|
1263
|
-
e.set(r, {
|
|
1264
|
-
sine: Ct(this.point, t.point, f.point),
|
|
1265
|
-
cosine: Nt(this.point, t.point, f.point)
|
|
1266
|
-
});
|
|
1267
|
-
};
|
|
1268
|
-
return (r, f) => {
|
|
1269
|
-
e.has(r) || n(r), e.has(f) || n(f);
|
|
1270
|
-
const { sine: a, cosine: c } = e.get(r), { sine: E, cosine: d } = e.get(f);
|
|
1271
|
-
return a.isGreaterThanOrEqualTo(0) && E.isGreaterThanOrEqualTo(0) ? c.isLessThan(d) ? 1 : c.isGreaterThan(d) ? -1 : 0 : a.isLessThan(0) && E.isLessThan(0) ? c.isLessThan(d) ? -1 : c.isGreaterThan(d) ? 1 : 0 : E.isLessThan(a) ? -1 : E.isGreaterThan(a) ? 1 : 0;
|
|
1272
|
-
};
|
|
1273
|
-
}
|
|
1274
|
-
}, It = class ke {
|
|
1275
|
-
constructor(t) {
|
|
1276
|
-
M(this, "events");
|
|
1277
|
-
M(this, "poly");
|
|
1278
|
-
M(this, "_isExteriorRing");
|
|
1279
|
-
M(this, "_enclosingRing");
|
|
1280
|
-
this.events = t;
|
|
1281
|
-
for (let e = 0, n = t.length; e < n; e++)
|
|
1282
|
-
t[e].segment.ringOut = this;
|
|
1283
|
-
this.poly = null;
|
|
1284
|
-
}
|
|
1285
|
-
/* Given the segments from the sweep line pass, compute & return a series
|
|
1286
|
-
* of closed rings from all the segments marked to be part of the result */
|
|
1287
|
-
static factory(t) {
|
|
1288
|
-
const e = [];
|
|
1289
|
-
for (let n = 0, r = t.length; n < r; n++) {
|
|
1290
|
-
const f = t[n];
|
|
1291
|
-
if (!f.isInResult() || f.ringOut) continue;
|
|
1292
|
-
let a = null, c = f.leftSE, E = f.rightSE;
|
|
1293
|
-
const d = [c], T = c.point, b = [];
|
|
1294
|
-
for (; a = c, c = E, d.push(c), c.point !== T; )
|
|
1295
|
-
for (; ; ) {
|
|
1296
|
-
const P = c.getAvailableLinkedEvents();
|
|
1297
|
-
if (P.length === 0) {
|
|
1298
|
-
const L = d[0].point, A = d[d.length - 1].point;
|
|
1299
|
-
throw new Error(
|
|
1300
|
-
`Unable to complete output ring starting at [${L.x}, ${L.y}]. Last matching segment found ends at [${A.x}, ${A.y}].`
|
|
1301
|
-
);
|
|
1302
|
-
}
|
|
1303
|
-
if (P.length === 1) {
|
|
1304
|
-
E = P[0].otherSE;
|
|
1305
|
-
break;
|
|
1306
|
-
}
|
|
1307
|
-
let N = null;
|
|
1308
|
-
for (let L = 0, A = b.length; L < A; L++)
|
|
1309
|
-
if (b[L].point === c.point) {
|
|
1310
|
-
N = L;
|
|
1311
|
-
break;
|
|
1312
|
-
}
|
|
1313
|
-
if (N !== null) {
|
|
1314
|
-
const L = b.splice(N)[0], A = d.splice(L.index);
|
|
1315
|
-
A.unshift(A[0].otherSE), e.push(new ke(A.reverse()));
|
|
1316
|
-
continue;
|
|
1317
|
-
}
|
|
1318
|
-
b.push({
|
|
1319
|
-
index: d.length,
|
|
1320
|
-
point: c.point
|
|
1321
|
-
});
|
|
1322
|
-
const _ = c.getLeftmostComparator(a);
|
|
1323
|
-
E = P.sort(_)[0].otherSE;
|
|
1324
|
-
break;
|
|
1325
|
-
}
|
|
1326
|
-
e.push(new ke(d));
|
|
1327
|
-
}
|
|
1328
|
-
return e;
|
|
1329
|
-
}
|
|
1330
|
-
getGeom() {
|
|
1331
|
-
let t = this.events[0].point;
|
|
1332
|
-
const e = [t];
|
|
1333
|
-
for (let d = 1, T = this.events.length - 1; d < T; d++) {
|
|
1334
|
-
const b = this.events[d].point, P = this.events[d + 1].point;
|
|
1335
|
-
le.orient(b, t, P) !== 0 && (e.push(b), t = b);
|
|
1336
|
-
}
|
|
1337
|
-
if (e.length === 1) return null;
|
|
1338
|
-
const n = e[0], r = e[1];
|
|
1339
|
-
le.orient(n, t, r) === 0 && e.shift(), e.push(e[0]);
|
|
1340
|
-
const f = this.isExteriorRing() ? 1 : -1, a = this.isExteriorRing() ? 0 : e.length - 1, c = this.isExteriorRing() ? e.length : -1, E = [];
|
|
1341
|
-
for (let d = a; d != c; d += f)
|
|
1342
|
-
E.push([e[d].x.toNumber(), e[d].y.toNumber()]);
|
|
1343
|
-
return E;
|
|
1344
|
-
}
|
|
1345
|
-
isExteriorRing() {
|
|
1346
|
-
if (this._isExteriorRing === void 0) {
|
|
1347
|
-
const t = this.enclosingRing();
|
|
1348
|
-
this._isExteriorRing = t ? !t.isExteriorRing() : !0;
|
|
1349
|
-
}
|
|
1350
|
-
return this._isExteriorRing;
|
|
1351
|
-
}
|
|
1352
|
-
enclosingRing() {
|
|
1353
|
-
return this._enclosingRing === void 0 && (this._enclosingRing = this._calcEnclosingRing()), this._enclosingRing;
|
|
1354
|
-
}
|
|
1355
|
-
/* Returns the ring that encloses this one, if any */
|
|
1356
|
-
_calcEnclosingRing() {
|
|
1357
|
-
var r, f;
|
|
1358
|
-
let t = this.events[0];
|
|
1359
|
-
for (let a = 1, c = this.events.length; a < c; a++) {
|
|
1360
|
-
const E = this.events[a];
|
|
1361
|
-
ie.compare(t, E) > 0 && (t = E);
|
|
1362
|
-
}
|
|
1363
|
-
let e = t.segment.prevInResult(), n = e ? e.prevInResult() : null;
|
|
1364
|
-
for (; ; ) {
|
|
1365
|
-
if (!e) return null;
|
|
1366
|
-
if (!n) return e.ringOut;
|
|
1367
|
-
if (n.ringOut !== e.ringOut)
|
|
1368
|
-
return ((r = n.ringOut) == null ? void 0 : r.enclosingRing()) !== e.ringOut ? e.ringOut : (f = e.ringOut) == null ? void 0 : f.enclosingRing();
|
|
1369
|
-
e = n.prevInResult(), n = e ? e.prevInResult() : null;
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
}, He = class {
|
|
1373
|
-
constructor(i) {
|
|
1374
|
-
M(this, "exteriorRing");
|
|
1375
|
-
M(this, "interiorRings");
|
|
1376
|
-
this.exteriorRing = i, i.poly = this, this.interiorRings = [];
|
|
1377
|
-
}
|
|
1378
|
-
addInterior(i) {
|
|
1379
|
-
this.interiorRings.push(i), i.poly = this;
|
|
1380
|
-
}
|
|
1381
|
-
getGeom() {
|
|
1382
|
-
const i = this.exteriorRing.getGeom();
|
|
1383
|
-
if (i === null) return null;
|
|
1384
|
-
const t = [i];
|
|
1385
|
-
for (let e = 0, n = this.interiorRings.length; e < n; e++) {
|
|
1386
|
-
const r = this.interiorRings[e].getGeom();
|
|
1387
|
-
r !== null && t.push(r);
|
|
1388
|
-
}
|
|
1389
|
-
return t;
|
|
1390
|
-
}
|
|
1391
|
-
}, kt = class {
|
|
1392
|
-
constructor(i) {
|
|
1393
|
-
M(this, "rings");
|
|
1394
|
-
M(this, "polys");
|
|
1395
|
-
this.rings = i, this.polys = this._composePolys(i);
|
|
1396
|
-
}
|
|
1397
|
-
getGeom() {
|
|
1398
|
-
const i = [];
|
|
1399
|
-
for (let t = 0, e = this.polys.length; t < e; t++) {
|
|
1400
|
-
const n = this.polys[t].getGeom();
|
|
1401
|
-
n !== null && i.push(n);
|
|
1402
|
-
}
|
|
1403
|
-
return i;
|
|
1404
|
-
}
|
|
1405
|
-
_composePolys(i) {
|
|
1406
|
-
var e;
|
|
1407
|
-
const t = [];
|
|
1408
|
-
for (let n = 0, r = i.length; n < r; n++) {
|
|
1409
|
-
const f = i[n];
|
|
1410
|
-
if (!f.poly)
|
|
1411
|
-
if (f.isExteriorRing()) t.push(new He(f));
|
|
1412
|
-
else {
|
|
1413
|
-
const a = f.enclosingRing();
|
|
1414
|
-
a != null && a.poly || t.push(new He(a)), (e = a == null ? void 0 : a.poly) == null || e.addInterior(f);
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
return t;
|
|
1418
|
-
}
|
|
1419
|
-
}, Bt = class {
|
|
1420
|
-
constructor(i, t = Pe.compare) {
|
|
1421
|
-
M(this, "queue");
|
|
1422
|
-
M(this, "tree");
|
|
1423
|
-
M(this, "segments");
|
|
1424
|
-
this.queue = i, this.tree = new ve(t), this.segments = [];
|
|
1425
|
-
}
|
|
1426
|
-
process(i) {
|
|
1427
|
-
const t = i.segment, e = [];
|
|
1428
|
-
if (i.consumedBy)
|
|
1429
|
-
return i.isLeft ? this.queue.delete(i.otherSE) : this.tree.delete(t), e;
|
|
1430
|
-
i.isLeft && this.tree.add(t);
|
|
1431
|
-
let n = t, r = t;
|
|
1432
|
-
do
|
|
1433
|
-
n = this.tree.lastBefore(n);
|
|
1434
|
-
while (n != null && n.consumedBy != null);
|
|
1435
|
-
do
|
|
1436
|
-
r = this.tree.firstAfter(r);
|
|
1437
|
-
while (r != null && r.consumedBy != null);
|
|
1438
|
-
if (i.isLeft) {
|
|
1439
|
-
let f = null;
|
|
1440
|
-
if (n) {
|
|
1441
|
-
const c = n.getIntersection(t);
|
|
1442
|
-
if (c !== null && (t.isAnEndpoint(c) || (f = c), !n.isAnEndpoint(c))) {
|
|
1443
|
-
const E = this._splitSafely(n, c);
|
|
1444
|
-
for (let d = 0, T = E.length; d < T; d++)
|
|
1445
|
-
e.push(E[d]);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1448
|
-
let a = null;
|
|
1449
|
-
if (r) {
|
|
1450
|
-
const c = r.getIntersection(t);
|
|
1451
|
-
if (c !== null && (t.isAnEndpoint(c) || (a = c), !r.isAnEndpoint(c))) {
|
|
1452
|
-
const E = this._splitSafely(r, c);
|
|
1453
|
-
for (let d = 0, T = E.length; d < T; d++)
|
|
1454
|
-
e.push(E[d]);
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
if (f !== null || a !== null) {
|
|
1458
|
-
let c = null;
|
|
1459
|
-
f === null ? c = a : a === null ? c = f : c = ie.comparePoints(
|
|
1460
|
-
f,
|
|
1461
|
-
a
|
|
1462
|
-
) <= 0 ? f : a, this.queue.delete(t.rightSE), e.push(t.rightSE);
|
|
1463
|
-
const E = t.split(c);
|
|
1464
|
-
for (let d = 0, T = E.length; d < T; d++)
|
|
1465
|
-
e.push(E[d]);
|
|
1466
|
-
}
|
|
1467
|
-
e.length > 0 ? (this.tree.delete(t), e.push(i)) : (this.segments.push(t), t.prev = n);
|
|
1468
|
-
} else {
|
|
1469
|
-
if (n && r) {
|
|
1470
|
-
const f = n.getIntersection(r);
|
|
1471
|
-
if (f !== null) {
|
|
1472
|
-
if (!n.isAnEndpoint(f)) {
|
|
1473
|
-
const a = this._splitSafely(n, f);
|
|
1474
|
-
for (let c = 0, E = a.length; c < E; c++)
|
|
1475
|
-
e.push(a[c]);
|
|
1476
|
-
}
|
|
1477
|
-
if (!r.isAnEndpoint(f)) {
|
|
1478
|
-
const a = this._splitSafely(r, f);
|
|
1479
|
-
for (let c = 0, E = a.length; c < E; c++)
|
|
1480
|
-
e.push(a[c]);
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
}
|
|
1484
|
-
this.tree.delete(t);
|
|
1485
|
-
}
|
|
1486
|
-
return e;
|
|
1487
|
-
}
|
|
1488
|
-
/* Safely split a segment that is currently in the datastructures
|
|
1489
|
-
* IE - a segment other than the one that is currently being processed. */
|
|
1490
|
-
_splitSafely(i, t) {
|
|
1491
|
-
this.tree.delete(i);
|
|
1492
|
-
const e = i.rightSE;
|
|
1493
|
-
this.queue.delete(e);
|
|
1494
|
-
const n = i.split(t);
|
|
1495
|
-
return n.push(e), i.consumedBy === void 0 && this.tree.add(i), n;
|
|
1496
|
-
}
|
|
1497
|
-
}, Gt = class {
|
|
1498
|
-
constructor() {
|
|
1499
|
-
M(this, "type");
|
|
1500
|
-
M(this, "numMultiPolys");
|
|
1501
|
-
}
|
|
1502
|
-
run(i, t, e) {
|
|
1503
|
-
ge.type = i;
|
|
1504
|
-
const n = [new je(t, !0)];
|
|
1505
|
-
for (let d = 0, T = e.length; d < T; d++)
|
|
1506
|
-
n.push(new je(e[d], !1));
|
|
1507
|
-
if (ge.numMultiPolys = n.length, ge.type === "difference") {
|
|
1508
|
-
const d = n[0];
|
|
1509
|
-
let T = 1;
|
|
1510
|
-
for (; T < n.length; )
|
|
1511
|
-
Ie(n[T].bbox, d.bbox) !== null ? T++ : n.splice(T, 1);
|
|
1512
|
-
}
|
|
1513
|
-
if (ge.type === "intersection")
|
|
1514
|
-
for (let d = 0, T = n.length; d < T; d++) {
|
|
1515
|
-
const b = n[d];
|
|
1516
|
-
for (let P = d + 1, N = n.length; P < N; P++)
|
|
1517
|
-
if (Ie(b.bbox, n[P].bbox) === null) return [];
|
|
1518
|
-
}
|
|
1519
|
-
const r = new ve(ie.compare);
|
|
1520
|
-
for (let d = 0, T = n.length; d < T; d++) {
|
|
1521
|
-
const b = n[d].getSweepEvents();
|
|
1522
|
-
for (let P = 0, N = b.length; P < N; P++)
|
|
1523
|
-
r.add(b[P]);
|
|
1524
|
-
}
|
|
1525
|
-
const f = new Bt(r);
|
|
1526
|
-
let a = null;
|
|
1527
|
-
for (r.size != 0 && (a = r.first(), r.delete(a)); a; ) {
|
|
1528
|
-
const d = f.process(a);
|
|
1529
|
-
for (let T = 0, b = d.length; T < b; T++) {
|
|
1530
|
-
const P = d[T];
|
|
1531
|
-
P.consumedBy === void 0 && r.add(P);
|
|
1532
|
-
}
|
|
1533
|
-
r.size != 0 ? (a = r.first(), r.delete(a)) : a = null;
|
|
1534
|
-
}
|
|
1535
|
-
le.reset();
|
|
1536
|
-
const c = It.factory(f.segments);
|
|
1537
|
-
return new kt(c).getGeom();
|
|
1538
|
-
}
|
|
1539
|
-
}, ge = new Gt(), Te = ge, Ft = 0, Pe = class Ee {
|
|
1540
|
-
/* Warning: a reference to ringWindings input will be stored,
|
|
1541
|
-
* and possibly will be later modified */
|
|
1542
|
-
constructor(t, e, n, r) {
|
|
1543
|
-
M(this, "id");
|
|
1544
|
-
M(this, "leftSE");
|
|
1545
|
-
M(this, "rightSE");
|
|
1546
|
-
M(this, "rings");
|
|
1547
|
-
M(this, "windings");
|
|
1548
|
-
M(this, "ringOut");
|
|
1549
|
-
M(this, "consumedBy");
|
|
1550
|
-
M(this, "prev");
|
|
1551
|
-
M(this, "_prevInResult");
|
|
1552
|
-
M(this, "_beforeState");
|
|
1553
|
-
M(this, "_afterState");
|
|
1554
|
-
M(this, "_isInResult");
|
|
1555
|
-
this.id = ++Ft, this.leftSE = t, t.segment = this, t.otherSE = e, this.rightSE = e, e.segment = this, e.otherSE = t, this.rings = n, this.windings = r;
|
|
1556
|
-
}
|
|
1557
|
-
/* This compare() function is for ordering segments in the sweep
|
|
1558
|
-
* line tree, and does so according to the following criteria:
|
|
1559
|
-
*
|
|
1560
|
-
* Consider the vertical line that lies an infinestimal step to the
|
|
1561
|
-
* right of the right-more of the two left endpoints of the input
|
|
1562
|
-
* segments. Imagine slowly moving a point up from negative infinity
|
|
1563
|
-
* in the increasing y direction. Which of the two segments will that
|
|
1564
|
-
* point intersect first? That segment comes 'before' the other one.
|
|
1565
|
-
*
|
|
1566
|
-
* If neither segment would be intersected by such a line, (if one
|
|
1567
|
-
* or more of the segments are vertical) then the line to be considered
|
|
1568
|
-
* is directly on the right-more of the two left inputs.
|
|
1569
|
-
*/
|
|
1570
|
-
static compare(t, e) {
|
|
1571
|
-
const n = t.leftSE.point.x, r = e.leftSE.point.x, f = t.rightSE.point.x, a = e.rightSE.point.x;
|
|
1572
|
-
if (a.isLessThan(n)) return 1;
|
|
1573
|
-
if (f.isLessThan(r)) return -1;
|
|
1574
|
-
const c = t.leftSE.point.y, E = e.leftSE.point.y, d = t.rightSE.point.y, T = e.rightSE.point.y;
|
|
1575
|
-
if (n.isLessThan(r)) {
|
|
1576
|
-
if (E.isLessThan(c) && E.isLessThan(d)) return 1;
|
|
1577
|
-
if (E.isGreaterThan(c) && E.isGreaterThan(d)) return -1;
|
|
1578
|
-
const b = t.comparePoint(e.leftSE.point);
|
|
1579
|
-
if (b < 0) return 1;
|
|
1580
|
-
if (b > 0) return -1;
|
|
1581
|
-
const P = e.comparePoint(t.rightSE.point);
|
|
1582
|
-
return P !== 0 ? P : -1;
|
|
1583
|
-
}
|
|
1584
|
-
if (n.isGreaterThan(r)) {
|
|
1585
|
-
if (c.isLessThan(E) && c.isLessThan(T)) return -1;
|
|
1586
|
-
if (c.isGreaterThan(E) && c.isGreaterThan(T)) return 1;
|
|
1587
|
-
const b = e.comparePoint(t.leftSE.point);
|
|
1588
|
-
if (b !== 0) return b;
|
|
1589
|
-
const P = t.comparePoint(e.rightSE.point);
|
|
1590
|
-
return P < 0 ? 1 : P > 0 ? -1 : 1;
|
|
1591
|
-
}
|
|
1592
|
-
if (c.isLessThan(E)) return -1;
|
|
1593
|
-
if (c.isGreaterThan(E)) return 1;
|
|
1594
|
-
if (f.isLessThan(a)) {
|
|
1595
|
-
const b = e.comparePoint(t.rightSE.point);
|
|
1596
|
-
if (b !== 0) return b;
|
|
1597
|
-
}
|
|
1598
|
-
if (f.isGreaterThan(a)) {
|
|
1599
|
-
const b = t.comparePoint(e.rightSE.point);
|
|
1600
|
-
if (b < 0) return 1;
|
|
1601
|
-
if (b > 0) return -1;
|
|
1602
|
-
}
|
|
1603
|
-
if (!f.eq(a)) {
|
|
1604
|
-
const b = d.minus(c), P = f.minus(n), N = T.minus(E), _ = a.minus(r);
|
|
1605
|
-
if (b.isGreaterThan(P) && N.isLessThan(_)) return 1;
|
|
1606
|
-
if (b.isLessThan(P) && N.isGreaterThan(_)) return -1;
|
|
1607
|
-
}
|
|
1608
|
-
return f.isGreaterThan(a) ? 1 : f.isLessThan(a) || d.isLessThan(T) ? -1 : d.isGreaterThan(T) ? 1 : t.id < e.id ? -1 : t.id > e.id ? 1 : 0;
|
|
1609
|
-
}
|
|
1610
|
-
static fromRing(t, e, n) {
|
|
1611
|
-
let r, f, a;
|
|
1612
|
-
const c = ie.comparePoints(t, e);
|
|
1613
|
-
if (c < 0)
|
|
1614
|
-
r = t, f = e, a = 1;
|
|
1615
|
-
else if (c > 0)
|
|
1616
|
-
r = e, f = t, a = -1;
|
|
1617
|
-
else
|
|
1618
|
-
throw new Error(
|
|
1619
|
-
`Tried to create degenerate segment at [${t.x}, ${t.y}]`
|
|
1620
|
-
);
|
|
1621
|
-
const E = new ie(r, !0), d = new ie(f, !1);
|
|
1622
|
-
return new Ee(E, d, [n], [a]);
|
|
1623
|
-
}
|
|
1624
|
-
/* When a segment is split, the rightSE is replaced with a new sweep event */
|
|
1625
|
-
replaceRightSE(t) {
|
|
1626
|
-
this.rightSE = t, this.rightSE.segment = this, this.rightSE.otherSE = this.leftSE, this.leftSE.otherSE = this.rightSE;
|
|
1627
|
-
}
|
|
1628
|
-
bbox() {
|
|
1629
|
-
const t = this.leftSE.point.y, e = this.rightSE.point.y;
|
|
1630
|
-
return {
|
|
1631
|
-
ll: { x: this.leftSE.point.x, y: t.isLessThan(e) ? t : e },
|
|
1632
|
-
ur: { x: this.rightSE.point.x, y: t.isGreaterThan(e) ? t : e }
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
|
-
/* A vector from the left point to the right */
|
|
1636
|
-
vector() {
|
|
1637
|
-
return {
|
|
1638
|
-
x: this.rightSE.point.x.minus(this.leftSE.point.x),
|
|
1639
|
-
y: this.rightSE.point.y.minus(this.leftSE.point.y)
|
|
1640
|
-
};
|
|
1641
|
-
}
|
|
1642
|
-
isAnEndpoint(t) {
|
|
1643
|
-
return t.x.eq(this.leftSE.point.x) && t.y.eq(this.leftSE.point.y) || t.x.eq(this.rightSE.point.x) && t.y.eq(this.rightSE.point.y);
|
|
1644
|
-
}
|
|
1645
|
-
/* Compare this segment with a point.
|
|
1646
|
-
*
|
|
1647
|
-
* A point P is considered to be colinear to a segment if there
|
|
1648
|
-
* exists a distance D such that if we travel along the segment
|
|
1649
|
-
* from one * endpoint towards the other a distance D, we find
|
|
1650
|
-
* ourselves at point P.
|
|
1651
|
-
*
|
|
1652
|
-
* Return value indicates:
|
|
1653
|
-
*
|
|
1654
|
-
* 1: point lies above the segment (to the left of vertical)
|
|
1655
|
-
* 0: point is colinear to segment
|
|
1656
|
-
* -1: point lies below the segment (to the right of vertical)
|
|
1657
|
-
*/
|
|
1658
|
-
comparePoint(t) {
|
|
1659
|
-
return le.orient(this.leftSE.point, t, this.rightSE.point);
|
|
1660
|
-
}
|
|
1661
|
-
/**
|
|
1662
|
-
* Given another segment, returns the first non-trivial intersection
|
|
1663
|
-
* between the two segments (in terms of sweep line ordering), if it exists.
|
|
1664
|
-
*
|
|
1665
|
-
* A 'non-trivial' intersection is one that will cause one or both of the
|
|
1666
|
-
* segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
|
|
1667
|
-
*
|
|
1668
|
-
* * endpoint of segA with endpoint of segB --> trivial
|
|
1669
|
-
* * endpoint of segA with point along segB --> non-trivial
|
|
1670
|
-
* * endpoint of segB with point along segA --> non-trivial
|
|
1671
|
-
* * point along segA with point along segB --> non-trivial
|
|
1672
|
-
*
|
|
1673
|
-
* If no non-trivial intersection exists, return null
|
|
1674
|
-
* Else, return null.
|
|
1675
|
-
*/
|
|
1676
|
-
getIntersection(t) {
|
|
1677
|
-
const e = this.bbox(), n = t.bbox(), r = Ie(e, n);
|
|
1678
|
-
if (r === null) return null;
|
|
1679
|
-
const f = this.leftSE.point, a = this.rightSE.point, c = t.leftSE.point, E = t.rightSE.point, d = ae(e, c) && this.comparePoint(c) === 0, T = ae(n, f) && t.comparePoint(f) === 0, b = ae(e, E) && this.comparePoint(E) === 0, P = ae(n, a) && t.comparePoint(a) === 0;
|
|
1680
|
-
if (T && d)
|
|
1681
|
-
return P && !b ? a : !P && b ? E : null;
|
|
1682
|
-
if (T)
|
|
1683
|
-
return b && f.x.eq(E.x) && f.y.eq(E.y) ? null : f;
|
|
1684
|
-
if (d)
|
|
1685
|
-
return P && a.x.eq(c.x) && a.y.eq(c.y) ? null : c;
|
|
1686
|
-
if (P && b) return null;
|
|
1687
|
-
if (P) return a;
|
|
1688
|
-
if (b) return E;
|
|
1689
|
-
const N = At(f, this.vector(), c, t.vector());
|
|
1690
|
-
return N === null || !ae(r, N) ? null : le.snap(N);
|
|
1691
|
-
}
|
|
1692
|
-
/**
|
|
1693
|
-
* Split the given segment into multiple segments on the given points.
|
|
1694
|
-
* * Each existing segment will retain its leftSE and a new rightSE will be
|
|
1695
|
-
* generated for it.
|
|
1696
|
-
* * A new segment will be generated which will adopt the original segment's
|
|
1697
|
-
* rightSE, and a new leftSE will be generated for it.
|
|
1698
|
-
* * If there are more than two points given to split on, new segments
|
|
1699
|
-
* in the middle will be generated with new leftSE and rightSE's.
|
|
1700
|
-
* * An array of the newly generated SweepEvents will be returned.
|
|
1701
|
-
*
|
|
1702
|
-
* Warning: input array of points is modified
|
|
1703
|
-
*/
|
|
1704
|
-
split(t) {
|
|
1705
|
-
const e = [], n = t.events !== void 0, r = new ie(t, !0), f = new ie(t, !1), a = this.rightSE;
|
|
1706
|
-
this.replaceRightSE(f), e.push(f), e.push(r);
|
|
1707
|
-
const c = new Ee(
|
|
1708
|
-
r,
|
|
1709
|
-
a,
|
|
1710
|
-
this.rings.slice(),
|
|
1711
|
-
this.windings.slice()
|
|
1712
|
-
);
|
|
1713
|
-
return ie.comparePoints(c.leftSE.point, c.rightSE.point) > 0 && c.swapEvents(), ie.comparePoints(this.leftSE.point, this.rightSE.point) > 0 && this.swapEvents(), n && (r.checkForConsuming(), f.checkForConsuming()), e;
|
|
1714
|
-
}
|
|
1715
|
-
/* Swap which event is left and right */
|
|
1716
|
-
swapEvents() {
|
|
1717
|
-
const t = this.rightSE;
|
|
1718
|
-
this.rightSE = this.leftSE, this.leftSE = t, this.leftSE.isLeft = !0, this.rightSE.isLeft = !1;
|
|
1719
|
-
for (let e = 0, n = this.windings.length; e < n; e++)
|
|
1720
|
-
this.windings[e] *= -1;
|
|
1721
|
-
}
|
|
1722
|
-
/* Consume another segment. We take their rings under our wing
|
|
1723
|
-
* and mark them as consumed. Use for perfectly overlapping segments */
|
|
1724
|
-
consume(t) {
|
|
1725
|
-
let e = this, n = t;
|
|
1726
|
-
for (; e.consumedBy; ) e = e.consumedBy;
|
|
1727
|
-
for (; n.consumedBy; ) n = n.consumedBy;
|
|
1728
|
-
const r = Ee.compare(e, n);
|
|
1729
|
-
if (r !== 0) {
|
|
1730
|
-
if (r > 0) {
|
|
1731
|
-
const f = e;
|
|
1732
|
-
e = n, n = f;
|
|
1733
|
-
}
|
|
1734
|
-
if (e.prev === n) {
|
|
1735
|
-
const f = e;
|
|
1736
|
-
e = n, n = f;
|
|
1737
|
-
}
|
|
1738
|
-
for (let f = 0, a = n.rings.length; f < a; f++) {
|
|
1739
|
-
const c = n.rings[f], E = n.windings[f], d = e.rings.indexOf(c);
|
|
1740
|
-
d === -1 ? (e.rings.push(c), e.windings.push(E)) : e.windings[d] += E;
|
|
1741
|
-
}
|
|
1742
|
-
n.rings = null, n.windings = null, n.consumedBy = e, n.leftSE.consumedBy = e.leftSE, n.rightSE.consumedBy = e.rightSE;
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
/* The first segment previous segment chain that is in the result */
|
|
1746
|
-
prevInResult() {
|
|
1747
|
-
return this._prevInResult !== void 0 ? this._prevInResult : (this.prev ? this.prev.isInResult() ? this._prevInResult = this.prev : this._prevInResult = this.prev.prevInResult() : this._prevInResult = null, this._prevInResult);
|
|
1748
|
-
}
|
|
1749
|
-
beforeState() {
|
|
1750
|
-
if (this._beforeState !== void 0) return this._beforeState;
|
|
1751
|
-
if (!this.prev)
|
|
1752
|
-
this._beforeState = {
|
|
1753
|
-
rings: [],
|
|
1754
|
-
windings: [],
|
|
1755
|
-
multiPolys: []
|
|
1756
|
-
};
|
|
1757
|
-
else {
|
|
1758
|
-
const t = this.prev.consumedBy || this.prev;
|
|
1759
|
-
this._beforeState = t.afterState();
|
|
1760
|
-
}
|
|
1761
|
-
return this._beforeState;
|
|
1762
|
-
}
|
|
1763
|
-
afterState() {
|
|
1764
|
-
if (this._afterState !== void 0) return this._afterState;
|
|
1765
|
-
const t = this.beforeState();
|
|
1766
|
-
this._afterState = {
|
|
1767
|
-
rings: t.rings.slice(0),
|
|
1768
|
-
windings: t.windings.slice(0),
|
|
1769
|
-
multiPolys: []
|
|
1770
|
-
};
|
|
1771
|
-
const e = this._afterState.rings, n = this._afterState.windings, r = this._afterState.multiPolys;
|
|
1772
|
-
for (let c = 0, E = this.rings.length; c < E; c++) {
|
|
1773
|
-
const d = this.rings[c], T = this.windings[c], b = e.indexOf(d);
|
|
1774
|
-
b === -1 ? (e.push(d), n.push(T)) : n[b] += T;
|
|
1775
|
-
}
|
|
1776
|
-
const f = [], a = [];
|
|
1777
|
-
for (let c = 0, E = e.length; c < E; c++) {
|
|
1778
|
-
if (n[c] === 0) continue;
|
|
1779
|
-
const d = e[c], T = d.poly;
|
|
1780
|
-
if (a.indexOf(T) === -1)
|
|
1781
|
-
if (d.isExterior) f.push(T);
|
|
1782
|
-
else {
|
|
1783
|
-
a.indexOf(T) === -1 && a.push(T);
|
|
1784
|
-
const b = f.indexOf(d.poly);
|
|
1785
|
-
b !== -1 && f.splice(b, 1);
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
for (let c = 0, E = f.length; c < E; c++) {
|
|
1789
|
-
const d = f[c].multiPoly;
|
|
1790
|
-
r.indexOf(d) === -1 && r.push(d);
|
|
1791
|
-
}
|
|
1792
|
-
return this._afterState;
|
|
1793
|
-
}
|
|
1794
|
-
/* Is this segment part of the final result? */
|
|
1795
|
-
isInResult() {
|
|
1796
|
-
if (this.consumedBy) return !1;
|
|
1797
|
-
if (this._isInResult !== void 0) return this._isInResult;
|
|
1798
|
-
const t = this.beforeState().multiPolys, e = this.afterState().multiPolys;
|
|
1799
|
-
switch (Te.type) {
|
|
1800
|
-
case "union": {
|
|
1801
|
-
const n = t.length === 0, r = e.length === 0;
|
|
1802
|
-
this._isInResult = n !== r;
|
|
1803
|
-
break;
|
|
1804
|
-
}
|
|
1805
|
-
case "intersection": {
|
|
1806
|
-
let n, r;
|
|
1807
|
-
t.length < e.length ? (n = t.length, r = e.length) : (n = e.length, r = t.length), this._isInResult = r === Te.numMultiPolys && n < r;
|
|
1808
|
-
break;
|
|
1809
|
-
}
|
|
1810
|
-
case "xor": {
|
|
1811
|
-
const n = Math.abs(t.length - e.length);
|
|
1812
|
-
this._isInResult = n % 2 === 1;
|
|
1813
|
-
break;
|
|
1814
|
-
}
|
|
1815
|
-
case "difference": {
|
|
1816
|
-
const n = (r) => r.length === 1 && r[0].isSubject;
|
|
1817
|
-
this._isInResult = n(t) !== n(e);
|
|
1818
|
-
break;
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
return this._isInResult;
|
|
1822
|
-
}
|
|
1823
|
-
}, Je = class {
|
|
1824
|
-
constructor(i, t, e) {
|
|
1825
|
-
M(this, "poly");
|
|
1826
|
-
M(this, "isExterior");
|
|
1827
|
-
M(this, "segments");
|
|
1828
|
-
M(this, "bbox");
|
|
1829
|
-
if (!Array.isArray(i) || i.length === 0)
|
|
1830
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1831
|
-
if (this.poly = t, this.isExterior = e, this.segments = [], typeof i[0][0] != "number" || typeof i[0][1] != "number")
|
|
1832
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1833
|
-
const n = le.snap({ x: new ne(i[0][0]), y: new ne(i[0][1]) });
|
|
1834
|
-
this.bbox = {
|
|
1835
|
-
ll: { x: n.x, y: n.y },
|
|
1836
|
-
ur: { x: n.x, y: n.y }
|
|
1837
|
-
};
|
|
1838
|
-
let r = n;
|
|
1839
|
-
for (let f = 1, a = i.length; f < a; f++) {
|
|
1840
|
-
if (typeof i[f][0] != "number" || typeof i[f][1] != "number")
|
|
1841
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1842
|
-
const c = le.snap({ x: new ne(i[f][0]), y: new ne(i[f][1]) });
|
|
1843
|
-
c.x.eq(r.x) && c.y.eq(r.y) || (this.segments.push(Pe.fromRing(r, c, this)), c.x.isLessThan(this.bbox.ll.x) && (this.bbox.ll.x = c.x), c.y.isLessThan(this.bbox.ll.y) && (this.bbox.ll.y = c.y), c.x.isGreaterThan(this.bbox.ur.x) && (this.bbox.ur.x = c.x), c.y.isGreaterThan(this.bbox.ur.y) && (this.bbox.ur.y = c.y), r = c);
|
|
1844
|
-
}
|
|
1845
|
-
(!n.x.eq(r.x) || !n.y.eq(r.y)) && this.segments.push(Pe.fromRing(r, n, this));
|
|
1846
|
-
}
|
|
1847
|
-
getSweepEvents() {
|
|
1848
|
-
const i = [];
|
|
1849
|
-
for (let t = 0, e = this.segments.length; t < e; t++) {
|
|
1850
|
-
const n = this.segments[t];
|
|
1851
|
-
i.push(n.leftSE), i.push(n.rightSE);
|
|
1852
|
-
}
|
|
1853
|
-
return i;
|
|
1854
|
-
}
|
|
1855
|
-
}, qt = class {
|
|
1856
|
-
constructor(i, t) {
|
|
1857
|
-
M(this, "multiPoly");
|
|
1858
|
-
M(this, "exteriorRing");
|
|
1859
|
-
M(this, "interiorRings");
|
|
1860
|
-
M(this, "bbox");
|
|
1861
|
-
if (!Array.isArray(i))
|
|
1862
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1863
|
-
this.exteriorRing = new Je(i[0], this, !0), this.bbox = {
|
|
1864
|
-
ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
|
|
1865
|
-
ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
|
|
1866
|
-
}, this.interiorRings = [];
|
|
1867
|
-
for (let e = 1, n = i.length; e < n; e++) {
|
|
1868
|
-
const r = new Je(i[e], this, !1);
|
|
1869
|
-
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);
|
|
1870
|
-
}
|
|
1871
|
-
this.multiPoly = t;
|
|
1872
|
-
}
|
|
1873
|
-
getSweepEvents() {
|
|
1874
|
-
const i = this.exteriorRing.getSweepEvents();
|
|
1875
|
-
for (let t = 0, e = this.interiorRings.length; t < e; t++) {
|
|
1876
|
-
const n = this.interiorRings[t].getSweepEvents();
|
|
1877
|
-
for (let r = 0, f = n.length; r < f; r++)
|
|
1878
|
-
i.push(n[r]);
|
|
1879
|
-
}
|
|
1880
|
-
return i;
|
|
1881
|
-
}
|
|
1882
|
-
}, je = class {
|
|
1883
|
-
constructor(i, t) {
|
|
1884
|
-
M(this, "isSubject");
|
|
1885
|
-
M(this, "polys");
|
|
1886
|
-
M(this, "bbox");
|
|
1887
|
-
if (!Array.isArray(i))
|
|
1888
|
-
throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
|
|
1889
|
-
try {
|
|
1890
|
-
typeof i[0][0][0] == "number" && (i = [i]);
|
|
1891
|
-
} catch {
|
|
1892
|
-
}
|
|
1893
|
-
this.polys = [], this.bbox = {
|
|
1894
|
-
ll: { x: new ne(Number.POSITIVE_INFINITY), y: new ne(Number.POSITIVE_INFINITY) },
|
|
1895
|
-
ur: { x: new ne(Number.NEGATIVE_INFINITY), y: new ne(Number.NEGATIVE_INFINITY) }
|
|
1896
|
-
};
|
|
1897
|
-
for (let e = 0, n = i.length; e < n; e++) {
|
|
1898
|
-
const r = new qt(i[e], this);
|
|
1899
|
-
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);
|
|
1900
|
-
}
|
|
1901
|
-
this.isSubject = t;
|
|
1902
|
-
}
|
|
1903
|
-
getSweepEvents() {
|
|
1904
|
-
const i = [];
|
|
1905
|
-
for (let t = 0, e = this.polys.length; t < e; t++) {
|
|
1906
|
-
const n = this.polys[t].getSweepEvents();
|
|
1907
|
-
for (let r = 0, f = n.length; r < f; r++)
|
|
1908
|
-
i.push(n[r]);
|
|
1909
|
-
}
|
|
1910
|
-
return i;
|
|
1911
|
-
}
|
|
1912
|
-
}, Dt = (i, ...t) => Te.run("union", i, t), zt = (i, ...t) => Te.run("difference", i, t);
|
|
1913
|
-
le.set;
|
|
1914
|
-
function Ut(i) {
|
|
1915
|
-
const t = [];
|
|
1916
|
-
if (Ge(i, (r) => {
|
|
1917
|
-
t.push(r.coordinates);
|
|
1918
|
-
}), t.length < 2)
|
|
1919
|
-
throw new Error("Must have at least two features");
|
|
1920
|
-
const e = i.features[0].properties || {}, n = zt(t[0], ...t.slice(1));
|
|
1921
|
-
return n.length === 0 ? null : n.length === 1 ? Be(n[0], e) : rt(n, e);
|
|
1922
|
-
}
|
|
1923
|
-
var Vt = Ut;
|
|
1924
|
-
function $t(i) {
|
|
1925
|
-
if (!i) throw new Error("geojson is required");
|
|
1926
|
-
var t = [];
|
|
1927
|
-
return St(i, function(e) {
|
|
1928
|
-
t.push(e);
|
|
1929
|
-
}), Ce(t);
|
|
1930
|
-
}
|
|
1931
|
-
var Kt = $t;
|
|
1932
|
-
function Xt(i, t = {}) {
|
|
1933
|
-
const e = [];
|
|
1934
|
-
if (Ge(i, (r) => {
|
|
1935
|
-
e.push(r.coordinates);
|
|
1936
|
-
}), e.length < 2)
|
|
1937
|
-
throw new Error("Must have at least 2 geometries");
|
|
1938
|
-
const n = Dt(e[0], ...e.slice(1));
|
|
1939
|
-
return n.length === 0 ? null : n.length === 1 ? Be(n[0], t.properties) : rt(n, t.properties);
|
|
1940
|
-
}
|
|
1941
|
-
var Wt = Xt;
|
|
1942
|
-
function Qe(i) {
|
|
1943
|
-
const t = [...i];
|
|
1944
|
-
return t[2] < t[0] && (Math.abs((t[0] + t[2] + 360) / 2) > Math.abs((t[0] - 360 + t[2]) / 2) ? t[0] -= 360 : t[2] += 360), t;
|
|
1945
|
-
}
|
|
1946
|
-
function et(i, t) {
|
|
1947
|
-
const e = Vt(
|
|
1948
|
-
Ce([
|
|
1949
|
-
Be([
|
|
1950
|
-
[
|
|
1951
|
-
[180, 90],
|
|
1952
|
-
[-180, 90],
|
|
1953
|
-
[-180, -90],
|
|
1954
|
-
[180, -90],
|
|
1955
|
-
[180, 90]
|
|
1956
|
-
]
|
|
1957
|
-
]),
|
|
1958
|
-
i
|
|
1959
|
-
])
|
|
1960
|
-
);
|
|
1961
|
-
if (!e)
|
|
1962
|
-
return;
|
|
1963
|
-
e.properties = { isMask: !0 };
|
|
1964
|
-
const n = Qe(Ke(i)), r = (n[2] - n[0]) / 360 / 1e3, f = n[0] < -180, a = n[2] > 180, c = Kt(i);
|
|
1965
|
-
if (c.features.length > 1 && (f || a))
|
|
1966
|
-
for (const E of c.features) {
|
|
1967
|
-
const d = Qe(Ke(E));
|
|
1968
|
-
if (a && d[0] < -180 + r)
|
|
1969
|
-
for (const T of E.geometry.coordinates)
|
|
1970
|
-
for (const b of T)
|
|
1971
|
-
b[0] += 360 - r;
|
|
1972
|
-
if (f && d[2] > 180 - r)
|
|
1973
|
-
for (const T of E.geometry.coordinates)
|
|
1974
|
-
for (const b of T)
|
|
1975
|
-
b[0] -= 360 - r;
|
|
1976
|
-
}
|
|
1977
|
-
t(
|
|
1978
|
-
Ce([
|
|
1979
|
-
c.features.length < 2 ? i : Wt(c) ?? i,
|
|
1980
|
-
e
|
|
1981
|
-
])
|
|
1982
|
-
);
|
|
1983
|
-
}
|
|
1984
|
-
const tt = "EPSG:4326";
|
|
1985
|
-
function Yt(i) {
|
|
1986
|
-
var f;
|
|
1987
|
-
const t = i.getProperties(), { isMask: e } = t, n = (f = i.getGeometry()) == null ? void 0 : f.getType(), r = e ? 0 : n === "LineString" || n === "MultiLineString" ? 3 : 2;
|
|
1988
|
-
return new wt({
|
|
1989
|
-
stroke: e ? void 0 : new $e({
|
|
1990
|
-
color: "#3170fe",
|
|
1991
|
-
lineDash: [r, r],
|
|
1992
|
-
width: r,
|
|
1993
|
-
lineCap: "butt"
|
|
1994
|
-
}),
|
|
1995
|
-
fill: e ? new Ve({
|
|
1996
|
-
color: "#00000020"
|
|
1997
|
-
}) : void 0,
|
|
1998
|
-
image: new xt({
|
|
1999
|
-
src: `/icons/marker_${t.isReverse ? "reverse" : t.isSelected ? "selected" : "unselected"}.svg`,
|
|
2000
|
-
anchor: [0.5, 1]
|
|
2001
|
-
}),
|
|
2002
|
-
zIndex: t.isSelected ? 2 : t.isReverse ? 0 : 1,
|
|
2003
|
-
text: t.isSelected && t.tooltip ? new Et({
|
|
2004
|
-
backgroundFill: new Ve({ color: "white" }),
|
|
2005
|
-
text: t.tooltip,
|
|
2006
|
-
offsetY: -40,
|
|
2007
|
-
backgroundStroke: new $e({
|
|
2008
|
-
color: "white",
|
|
2009
|
-
lineJoin: "round",
|
|
2010
|
-
width: 3
|
|
2011
|
-
}),
|
|
2012
|
-
padding: [2, 0, 0, 2]
|
|
2013
|
-
}) : void 0
|
|
2014
|
-
});
|
|
2015
|
-
}
|
|
2016
|
-
function oi(i, t = {}, e = {}, n = Yt) {
|
|
2017
|
-
let r = -1, f, a, c, E = !1;
|
|
2018
|
-
const d = new gt({
|
|
2019
|
-
updateWhileAnimating: !0
|
|
2020
|
-
});
|
|
2021
|
-
i.addLayer(d);
|
|
2022
|
-
const T = new dt({});
|
|
2023
|
-
d.setSource(T), d.setStyle(n), i.on("click", (_) => {
|
|
2024
|
-
i.forEachFeatureAtPixel(_.pixel, (L) => {
|
|
2025
|
-
const A = L.getId();
|
|
2026
|
-
if (A)
|
|
2027
|
-
return _.stopPropagation(), a == null || a({ type: "markerClick", id: A }), L;
|
|
2028
|
-
});
|
|
2029
|
-
}), i.on("pointermove", (_) => {
|
|
2030
|
-
const L = i.forEachFeatureAtPixel(_.pixel, (A) => A.getId());
|
|
2031
|
-
f !== L && (f && (a == null || a({
|
|
2032
|
-
type: "markerMouseLeave",
|
|
2033
|
-
id: f
|
|
2034
|
-
})), L && (a == null || a({
|
|
2035
|
-
type: "markerMouseEnter",
|
|
2036
|
-
id: L
|
|
2037
|
-
})), i.getTargetElement().style.cursor = L ? "pointer" : E ? "crosshair" : "", f = L);
|
|
2038
|
-
});
|
|
2039
|
-
function b() {
|
|
2040
|
-
return mt() ?? i.getView().getProjection();
|
|
2041
|
-
}
|
|
2042
|
-
function P(_) {
|
|
2043
|
-
return _.transform(tt, b());
|
|
2044
|
-
}
|
|
2045
|
-
const N = (_) => {
|
|
2046
|
-
a == null || a({
|
|
2047
|
-
type: "mapClick",
|
|
2048
|
-
coordinates: Ue(_.coordinate, b())
|
|
2049
|
-
});
|
|
2050
|
-
};
|
|
2051
|
-
return {
|
|
2052
|
-
setEventHandler(_) {
|
|
2053
|
-
_ ? (a = _, i.on("click", N)) : (a = void 0, i.un("click", N));
|
|
2054
|
-
},
|
|
2055
|
-
flyTo(_, L) {
|
|
2056
|
-
i.getView().animate({
|
|
2057
|
-
center: me(_, b()),
|
|
2058
|
-
...L ? { zoom: L } : {},
|
|
2059
|
-
duration: 2e3,
|
|
2060
|
-
...t
|
|
2061
|
-
});
|
|
2062
|
-
},
|
|
2063
|
-
fitBounds(_, L, A) {
|
|
2064
|
-
i.getView().fit(yt(_, tt, b()), {
|
|
2065
|
-
padding: [L, L, L, L],
|
|
2066
|
-
...A ? { maxZoom: A } : {},
|
|
2067
|
-
duration: 2e3,
|
|
2068
|
-
...e
|
|
2069
|
-
});
|
|
2070
|
-
},
|
|
2071
|
-
indicateReverse(_) {
|
|
2072
|
-
E = _, i.getTargetElement().style.cursor = _ ? "crosshair" : "";
|
|
2073
|
-
},
|
|
2074
|
-
setReverseMarker(_) {
|
|
2075
|
-
c ? _ ? c.getGeometry().setCoordinates(
|
|
2076
|
-
me(_, b())
|
|
2077
|
-
) : (T.removeFeature(c), c.dispose(), c = void 0) : _ && (c = new se(
|
|
2078
|
-
new Re(me(_, b()))
|
|
2079
|
-
), c.setProperties({ isReverse: !0 }), T.addFeature(c));
|
|
2080
|
-
},
|
|
2081
|
-
setFeatures(_, L, A) {
|
|
2082
|
-
function V(S) {
|
|
2083
|
-
var F;
|
|
2084
|
-
if (S)
|
|
2085
|
-
for (const B of S.features) {
|
|
2086
|
-
const W = B.geometry.type === "Polygon" ? new Fe(B.geometry.coordinates) : B.geometry.type === "MultiPolygon" ? new qe(B.geometry.coordinates) : null;
|
|
2087
|
-
W && T.addFeature(
|
|
2088
|
-
new se({
|
|
2089
|
-
isMask: !!((F = B.properties) != null && F.isMask),
|
|
2090
|
-
geometry: P(W)
|
|
2091
|
-
})
|
|
2092
|
-
);
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
T.clear(), c && T.addFeature(c);
|
|
2096
|
-
e: if (L) {
|
|
2097
|
-
let S = !1;
|
|
2098
|
-
if (L.geometry.type === "GeometryCollection") {
|
|
2099
|
-
const F = L.geometry.geometries.map(
|
|
2100
|
-
(B) => B.type === "Polygon" ? new Fe(B.coordinates) : B.type === "MultiPolygon" ? new qe(B.coordinates) : null
|
|
2101
|
-
).filter((B) => !!B);
|
|
2102
|
-
if (F.length > 0)
|
|
2103
|
-
T.addFeature(
|
|
2104
|
-
new se(P(new pt(F)))
|
|
2105
|
-
), S = !0;
|
|
2106
|
-
else
|
|
2107
|
-
for (const B of L.geometry.geometries)
|
|
2108
|
-
B.type === "LineString" ? (T.addFeature(
|
|
2109
|
-
new se(
|
|
2110
|
-
P(new De(B.coordinates))
|
|
2111
|
-
)
|
|
2112
|
-
), S = !0) : B.type === "MultiLineString" && T.addFeature(
|
|
2113
|
-
new se(
|
|
2114
|
-
P(new ze(B.coordinates))
|
|
2115
|
-
)
|
|
2116
|
-
), S = !0;
|
|
2117
|
-
}
|
|
2118
|
-
if (!S) {
|
|
2119
|
-
if (L.geometry.type === "Polygon")
|
|
2120
|
-
et(L, V);
|
|
2121
|
-
else if (L.geometry.type === "MultiPolygon")
|
|
2122
|
-
et(L, V);
|
|
2123
|
-
else if (L.geometry.type === "LineString") {
|
|
2124
|
-
T.addFeature(
|
|
2125
|
-
new se(
|
|
2126
|
-
P(new De(L.geometry.coordinates))
|
|
2127
|
-
)
|
|
2128
|
-
);
|
|
2129
|
-
break e;
|
|
2130
|
-
} else if (L.geometry.type === "MultiLineString") {
|
|
2131
|
-
T.addFeature(
|
|
2132
|
-
new se(
|
|
2133
|
-
P(new ze(L.geometry.coordinates))
|
|
2134
|
-
)
|
|
2135
|
-
);
|
|
2136
|
-
break e;
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
|
-
if (!A && !L.geometry.type.endsWith("Point"))
|
|
2140
|
-
break e;
|
|
2141
|
-
T.addFeature(new se(P(new Re(L.center))));
|
|
2142
|
-
}
|
|
2143
|
-
for (const S of _ ?? []) {
|
|
2144
|
-
if (S === L)
|
|
2145
|
-
continue;
|
|
2146
|
-
const F = new se(
|
|
2147
|
-
new Re(me(S.center, b()))
|
|
2148
|
-
);
|
|
2149
|
-
F.setId(S.id), F.setProperties({
|
|
2150
|
-
fuzzy: !!S.matching_text,
|
|
2151
|
-
tooltip: S.place_type[0] === "reverse" ? S.place_name : S.place_name.replace(/,.*/, "")
|
|
2152
|
-
}), T.addFeature(F);
|
|
2153
|
-
}
|
|
2154
|
-
},
|
|
2155
|
-
setSelectedMarker(_) {
|
|
2156
|
-
var V, S, F;
|
|
2157
|
-
const L = T.getFeatures(), A = (V = L[0]) != null && V.getProperties().isReverse ? 1 : 0;
|
|
2158
|
-
r > -1 && ((S = L[r + A]) == null || S.setProperties({
|
|
2159
|
-
isSelected: !1
|
|
2160
|
-
})), _ > -1 && ((F = L[_ + A]) == null || F.setProperties({
|
|
2161
|
-
isSelected: !0
|
|
2162
|
-
})), r = _;
|
|
2163
|
-
},
|
|
2164
|
-
getCenterAndZoom() {
|
|
2165
|
-
const _ = i.getView(), L = _.getCenter(), A = _.getZoom();
|
|
2166
|
-
if (!(!L || A === void 0))
|
|
2167
|
-
return [A, ...Ue(L, b())];
|
|
2168
|
-
}
|
|
2169
|
-
};
|
|
2170
|
-
}
|
|
2171
|
-
export {
|
|
2172
|
-
oi as createOpenLayersMapController
|
|
2173
|
-
};
|
|
2174
|
-
//# sourceMappingURL=openlayers-controller.js.map
|