@maptiler/geocoding-control 1.3.3 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -4
- package/icons/airport.svg +6 -0
- package/icons/animal_shelter.svg +4 -0
- package/icons/art_gallery.svg +4 -0
- package/icons/atm.svg +5 -1
- package/icons/barrier.svg +4 -0
- package/icons/baseball.svg +4 -0
- package/icons/basketball.svg +4 -0
- package/icons/bbq.svg +4 -1
- package/icons/beach.svg +4 -0
- package/icons/beer.svg +4 -1
- package/icons/bench.svg +4 -1
- package/icons/bicycle.svg +4 -1
- package/icons/bicycle_parking.svg +5 -1
- package/icons/bicycle_rental.svg +5 -1
- package/icons/billiards.svg +4 -0
- package/icons/board.svg +4 -1
- package/icons/bollard.svg +4 -0
- package/icons/bowling.svg +4 -1
- package/icons/building.svg +4 -0
- package/icons/bulldozer.svg +4 -0
- package/icons/bus_guided.svg +4 -0
- package/icons/bus_trolley.svg +4 -0
- package/icons/butcher.svg +4 -1
- package/icons/camper_trailer.svg +4 -0
- package/icons/campfire.svg +4 -0
- package/icons/caution.svg +4 -0
- package/icons/cemetery.svg +3 -11
- package/icons/charging_station.svg +4 -1
- package/icons/christian.svg +5 -0
- package/icons/circle-dot.svg +4 -0
- package/icons/circle-stroke.svg +4 -0
- package/icons/circle.svg +4 -0
- package/icons/city.svg +4 -0
- package/icons/communications_tower.svg +4 -1
- package/icons/confectionery.svg +4 -1
- package/icons/construction.svg +4 -0
- package/icons/cricket.svg +4 -0
- package/icons/cross.svg +4 -1
- package/icons/cycle_barrier.svg +4 -0
- package/icons/dam.svg +4 -0
- package/icons/danger.svg +4 -0
- package/icons/diamond.svg +4 -0
- package/icons/diamond_stroked.svg +4 -0
- package/icons/dot.svg +4 -0
- package/icons/drinking_water.svg +4 -1
- package/icons/emergency_phone.svg +4 -1
- package/icons/entrance.svg +4 -0
- package/icons/farm.svg +3 -8
- package/icons/fence.svg +4 -0
- package/icons/florist.svg +4 -1
- package/icons/furniture.svg +4 -1
- package/icons/gaming.svg +4 -0
- package/icons/garden.svg +4 -0
- package/icons/garden_centre.svg +4 -1
- package/icons/gate.svg +4 -1
- package/icons/globe.svg +4 -0
- package/icons/golf_green.svg +4 -0
- package/icons/gondola.svg +4 -0
- package/icons/guidepost.svg +4 -1
- package/icons/hardware.svg +3 -3
- package/icons/heart.svg +4 -0
- package/icons/heliport.svg +4 -0
- package/icons/highway_rest_area.svg +4 -0
- package/icons/home.svg +4 -0
- package/icons/hot_spring.svg +4 -1
- package/icons/hut.svg +4 -0
- package/icons/industry.svg +4 -0
- package/icons/karaoke.svg +4 -0
- package/icons/lift_gate.svg +4 -0
- package/icons/light_rail.svg +4 -0
- package/icons/lighthouse.svg +4 -1
- package/icons/marker.svg +4 -0
- package/icons/marker_stroked.svg +4 -0
- package/icons/monorail.svg +4 -0
- package/icons/motorcycle.svg +4 -1
- package/icons/motorcycle_parking.svg +4 -1
- package/icons/motorcycle_rental.svg +4 -0
- package/icons/motorcycle_repair.svg +4 -0
- package/icons/natural.svg +4 -0
- package/icons/noodle.svg +4 -0
- package/icons/obelisk.svg +4 -1
- package/icons/observation_tower.svg +4 -1
- package/icons/oneway.svg +4 -0
- package/icons/optician.svg +4 -1
- package/icons/park.svg +4 -1
- package/icons/parking_paid.svg +4 -0
- package/icons/pin.svg +4 -0
- package/icons/pipe.svg +4 -0
- package/icons/pizza.svg +4 -0
- package/icons/place_of_worship.svg +4 -1
- package/icons/playground.svg +3 -3
- package/icons/racetrack.svg +4 -0
- package/icons/radiation.svg +4 -0
- package/icons/railway.svg +4 -0
- package/icons/ranger_station.svg +4 -0
- package/icons/recycling.svg +4 -1
- package/icons/road_accident.svg +4 -0
- package/icons/roadblock.svg +4 -0
- package/icons/rocket.svg +4 -0
- package/icons/school_bus.svg +4 -0
- package/icons/sculpture.svg +4 -0
- package/icons/seafood.svg +4 -1
- package/icons/shelter.svg +4 -1
- package/icons/shoes.svg +4 -1
- package/icons/sikh.svg +4 -0
- package/icons/snow.svg +4 -0
- package/icons/soccer.svg +4 -1
- package/icons/spring.svg +4 -1
- package/icons/square.svg +4 -0
- package/icons/square_stroked.svg +4 -0
- package/icons/star.svg +4 -0
- package/icons/star_stroked.svg +4 -0
- package/icons/statue.svg +4 -1
- package/icons/subway.svg +4 -0
- package/icons/sushi.svg +4 -0
- package/icons/swimming.svg +5 -0
- package/icons/swimming_pool.svg +8 -0
- package/icons/tako.svg +4 -0
- package/icons/taxi.svg +4 -1
- package/icons/teahouse.svg +4 -0
- package/icons/terminal.svg +4 -1
- package/icons/theme_park.svg +4 -0
- package/icons/town.svg +4 -0
- package/icons/town_hall.svg +4 -1
- package/icons/townhall.svg +4 -1
- package/icons/tram_stop.svg +4 -0
- package/icons/transit.svg +4 -0
- package/icons/triangle.svg +4 -0
- package/icons/triangle_stroked.svg +4 -0
- package/icons/truck.svg +4 -0
- package/icons/tunnel.svg +4 -0
- package/icons/veterinary.svg +4 -1
- package/icons/viewpoint.svg +4 -1
- package/icons/village.svg +4 -0
- package/icons/volleyball.svg +4 -0
- package/icons/warehouse.svg +4 -0
- package/icons/water.svg +3 -5
- package/icons/water_park.svg +6 -1
- package/icons/water_tower.svg +4 -1
- package/icons/watermill.svg +4 -0
- package/icons/wetland.svg +4 -0
- package/icons/wine.svg +4 -0
- package/leaflet-controller.d.ts +2 -2
- package/leaflet-controller.js +1427 -9922
- package/leaflet-controller.js.map +1 -1
- package/leaflet-controller.umd.js +3 -9
- package/leaflet-controller.umd.js.map +1 -1
- package/leaflet.js +2708 -11166
- package/leaflet.js.map +1 -1
- package/leaflet.umd.js +3 -9
- package/leaflet.umd.js.map +1 -1
- package/maplibregl-controller.d.ts +2 -2
- package/maplibregl-controller.js +1268 -9849
- package/maplibregl-controller.js.map +1 -1
- package/maplibregl-controller.umd.js +3 -9
- package/maplibregl-controller.umd.js.map +1 -1
- package/maplibregl.js +2550 -11094
- package/maplibregl.js.map +1 -1
- package/maplibregl.umd.js +3 -9
- package/maplibregl.umd.js.map +1 -1
- package/maptilersdk.js +2558 -11102
- package/maptilersdk.js.map +1 -1
- package/maptilersdk.umd.js +3 -9
- package/maptilersdk.umd.js.map +1 -1
- package/mask.d.ts +1 -1
- package/openlayers-controller.js +1191 -9762
- package/openlayers-controller.js.map +1 -1
- package/openlayers-controller.umd.js +3 -9
- package/openlayers-controller.umd.js.map +1 -1
- package/openlayers.js +2689 -11223
- package/openlayers.js.map +1 -1
- package/openlayers.umd.js +3 -9
- package/openlayers.umd.js.map +1 -1
- package/package.json +26 -24
- package/react.js +996 -955
- package/react.js.map +1 -1
- package/react.umd.js +1 -1
- package/react.umd.js.map +1 -1
- package/style.css +1 -1
- package/svelte/FeatureItem.svelte +6 -5
- package/svelte/GeocodingControl.svelte +68 -12
- package/svelte/GeocodingControl.svelte.d.ts +4 -2
- package/svelte/geoUtils.js +7 -1
- package/svelte/leaflet-controller.d.ts +2 -2
- package/svelte/leaflet-controller.js +48 -2
- package/svelte/maplibregl-controller.d.ts +2 -2
- package/svelte/maplibregl-controller.js +5 -2
- package/svelte/mask.d.ts +1 -1
- package/svelte/mask.js +32 -29
- package/svelte/openlayers-controller.js +13 -14
- package/svelte/types.d.ts +15 -9
- package/types.d.ts +15 -9
- package/vanilla.js +1016 -975
- package/vanilla.js.map +1 -1
- package/vanilla.umd.js +1 -1
- package/vanilla.umd.js.map +1 -1
- package/icons/beach_resort.svg +0 -1
- package/icons/drinking-water.svg +0 -1
- package/icons/emergency-phone.svg +0 -1
- package/icons/rental_bicycle.svg +0 -1
- package/icons/rental_car.svg +0 -1
- /package/icons/{camp_site.svg → campsite.svg} +0 -0
- /package/icons/{toll_booth.svg → toll.svg} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(M,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("leaflet")):typeof define=="function"&&define.amd?define(["exports","leaflet"],L):(M=typeof globalThis<"u"?globalThis:M||self,L(M.leafletMaptilerGeocodingController={},M.L))})(this,function(M,L){"use strict";var un=Object.defineProperty;var fn=(M,L,j)=>L in M?un(M,L,{enumerable:!0,configurable:!0,writable:!0,value:j}):M[L]=j;var _t=(M,L,j)=>fn(M,typeof L!="symbol"?L+"":L,j);function j(r){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const n=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(t,e,n.get?n:{enumerable:!0,get:()=>r[e]})}}return t.default=r,Object.freeze(t)}const Q=j(L);function V(r,t,e={}){const n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=r,n}function lt(r,t,e={}){for(const i of r){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<i[i.length-1].length;o++)if(i[i.length-1][o]!==i[0][o])throw new Error("First and last Position are not equivalent.")}return V({type:"Polygon",coordinates:r},t,e)}function Z(r,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}function Pt(r,t,e={}){return V({type:"MultiPolygon",coordinates:r},t,e)}function Mt(r,t,e){if(r!==null)for(var n,i,o,l,u,c,f,p=0,s=0,a,h=r.type,g=h==="FeatureCollection",y=h==="Feature",d=g?r.features.length:1,x=0;x<d;x++){f=g?r.features[x].geometry:y?r.geometry:r,a=f?f.type==="GeometryCollection":!1,u=a?f.geometries.length:1;for(var v=0;v<u;v++){var m=0,b=0;if(l=a?f.geometries[v]:f,l!==null){c=l.coordinates;var w=l.type;switch(p=0,w){case null:break;case"Point":if(t(c,s,x,m,b)===!1)return!1;s++,m++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],s,x,m,b)===!1)return!1;s++,w==="MultiPoint"&&m++}w==="LineString"&&m++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(i=0;i<c[n].length-p;i++){if(t(c[n][i],s,x,m,b)===!1)return!1;s++}w==="MultiLineString"&&m++,w==="Polygon"&&b++}w==="Polygon"&&m++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(b=0,i=0;i<c[n].length;i++){for(o=0;o<c[n][i].length-p;o++){if(t(c[n][i][o],s,x,m,b)===!1)return!1;s++}b++}m++}break;case"GeometryCollection":for(n=0;n<l.geometries.length;n++)if(Mt(l.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ut(r,t){var e,n,i,o,l,u,c,f,p,s,a=0,h=r.type==="FeatureCollection",g=r.type==="Feature",y=h?r.features.length:1;for(e=0;e<y;e++){for(u=h?r.features[e].geometry:g?r.geometry:r,f=h?r.features[e].properties:g?r.properties:{},p=h?r.features[e].bbox:g?r.bbox:void 0,s=h?r.features[e].id:g?r.id:void 0,c=u?u.type==="GeometryCollection":!1,l=c?u.geometries.length:1,i=0;i<l;i++){if(o=c?u.geometries[i]:u,o===null){if(t(null,a,f,p,s)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,a,f,p,s)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],a,f,p,s)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}a++}}function re(r,t){ut(r,function(e,n,i,o,l){var u=e===null?null:e.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return t(V(e,i,{bbox:o,id:l}),n,0)===!1?!1:void 0}var c;switch(u){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var f=0;f<e.coordinates.length;f++){var p=e.coordinates[f],s={type:c,coordinates:p};if(t(V(s,i),n,f)===!1)return!1}})}function ie(r,t={}){if(r.bbox!=null&&t.recompute!==!0)return r.bbox;const e=[1/0,1/0,-1/0,-1/0];return Mt(r,n=>{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])}),e}var ft=ie;function oe(r){if(!r)throw new Error("geojson is required");switch(r.type){case"Feature":return Lt(r);case"FeatureCollection":return se(r);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return ct(r);default:throw new Error("unknown GeoJSON type")}}function Lt(r){const t={type:"Feature"};return Object.keys(r).forEach(e=>{switch(e){case"type":case"properties":case"geometry":return;default:t[e]=r[e]}}),t.properties=Ct(r.properties),r.geometry==null?t.geometry=null:t.geometry=ct(r.geometry),t}function Ct(r){const t={};return r&&Object.keys(r).forEach(e=>{const n=r[e];typeof n=="object"?n===null?t[e]=null:Array.isArray(n)?t[e]=n.map(i=>i):t[e]=Ct(n):t[e]=n}),t}function se(r){const t={type:"FeatureCollection"};return Object.keys(r).forEach(e=>{switch(e){case"type":case"features":return;default:t[e]=r[e]}}),t.features=r.features.map(e=>Lt(e)),t}function ct(r){const t={type:r.type};return r.bbox&&(t.bbox=r.bbox),r.type==="GeometryCollection"?(t.geometries=r.geometries.map(e=>ct(e)),t):(t.coordinates=Rt(r.coordinates),t)}function Rt(r){const t=r;return typeof t[0]!="object"?t.slice():t.map(e=>Rt(e))}var le=oe;/**
|
|
2
2
|
* splaytree v3.1.2
|
|
3
3
|
* Fast Splay tree for Node and browser
|
|
4
4
|
*
|
|
@@ -18,12 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
20
20
|
and limitations under the License.
|
|
21
|
-
***************************************************************************** */function
|
|
22
|
-
`);var g=u+(a?" ":"│ ");l.left&&Xn(l.left,g,!1,f,h),l.right&&Xn(l.right,g,!0,f,h)}}var Un=function(){function l(u){u===void 0&&(u=bs),this._root=null,this._size=0,this._comparator=u}return l.prototype.insert=function(u,a){return this._size++,this._root=Bn(u,a,this._root,this._comparator)},l.prototype.add=function(u,a){var f=new ue(u,a);this._root===null&&(f.left=f.right=null,this._size++,this._root=f);var h=this._comparator,g=oe(u,this._root,h),d=h(u,g.key);return d===0?this._root=g:(d<0?(f.left=g.left,f.right=g,g.left=null):d>0&&(f.right=g.right,f.left=g,g.right=null),this._size++,this._root=f),this._root},l.prototype.remove=function(u){this._root=this._remove(u,this._root,this._comparator)},l.prototype._remove=function(u,a,f){var h;if(a===null)return null;a=oe(u,a,f);var g=f(u,a.key);return g===0?(a.left===null?h=a.right:(h=oe(u,a.left,f),h.right=a.right),this._size--,h):a},l.prototype.pop=function(){var u=this._root;if(u){for(;u.left;)u=u.left;return this._root=oe(u.key,this._root,this._comparator),this._root=this._remove(u.key,this._root,this._comparator),{key:u.key,data:u.data}}return null},l.prototype.findStatic=function(u){for(var a=this._root,f=this._comparator;a;){var h=f(u,a.key);if(h===0)return a;h<0?a=a.left:a=a.right}return null},l.prototype.find=function(u){return this._root&&(this._root=oe(u,this._root,this._comparator),this._comparator(u,this._root.key)!==0)?null:this._root},l.prototype.contains=function(u){for(var a=this._root,f=this._comparator;a;){var h=f(u,a.key);if(h===0)return!0;h<0?a=a.left:a=a.right}return!1},l.prototype.forEach=function(u,a){for(var f=this._root,h=[],g=!1;!g;)f!==null?(h.push(f),f=f.left):h.length!==0?(f=h.pop(),u.call(a,f),f=f.right):g=!0;return this},l.prototype.range=function(u,a,f,h){for(var g=[],d=this._comparator,p=this._root,w;g.length!==0||p;)if(p)g.push(p),p=p.left;else{if(p=g.pop(),w=d(p.key,a),w>0)break;if(d(p.key,u)>=0&&f.call(h,p))return this;p=p.right}return this},l.prototype.keys=function(){var u=[];return this.forEach(function(a){var f=a.key;return u.push(f)}),u},l.prototype.values=function(){var u=[];return this.forEach(function(a){var f=a.data;return u.push(f)}),u},l.prototype.min=function(){return this._root?this.minNode(this._root).key:null},l.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},l.prototype.minNode=function(u){if(u===void 0&&(u=this._root),u)for(;u.left;)u=u.left;return u},l.prototype.maxNode=function(u){if(u===void 0&&(u=this._root),u)for(;u.right;)u=u.right;return u},l.prototype.at=function(u){for(var a=this._root,f=!1,h=0,g=[];!f;)if(a)g.push(a),a=a.left;else if(g.length>0){if(a=g.pop(),h===u)return a;h++,a=a.right}else f=!0;return null},l.prototype.next=function(u){var a=this._root,f=null;if(u.right){for(f=u.right;f.left;)f=f.left;return f}for(var h=this._comparator;a;){var g=h(u.key,a.key);if(g===0)break;g<0?(f=a,a=a.left):a=a.right}return f},l.prototype.prev=function(u){var a=this._root,f=null;if(u.left!==null){for(f=u.left;f.right;)f=f.right;return f}for(var h=this._comparator;a;){var g=h(u.key,a.key);if(g===0)break;g<0?a=a.left:(f=a,a=a.right)}return f},l.prototype.clear=function(){return this._root=null,this._size=0,this},l.prototype.toList=function(){return As(this._root)},l.prototype.load=function(u,a,f){a===void 0&&(a=[]),f===void 0&&(f=!1);var h=u.length,g=this._comparator;if(f&&Zn(u,a,0,h-1,g),this._root===null)this._root=Vn(u,a,0,h),this._size=h;else{var d=Ds(this.toList(),Ps(u,a),g);h=this._size+h,this._root=Hn({head:d},0,h)}return this},l.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(l.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),l.prototype.toString=function(u){u===void 0&&(u=function(f){return String(f.key)});var a=[];return Xn(this._root,"",!0,function(f){return a.push(f)},u),a.join("")},l.prototype.update=function(u,a,f){var h=this._comparator,g=bi(u,this._root,h),d=g.left,p=g.right;h(u,a)<0?p=Bn(a,f,p,h):d=Bn(a,f,d,h),this._root=Ms(d,p,h)},l.prototype.split=function(u){return bi(u,this._root,this._comparator)},l.prototype[Symbol.iterator]=function(){var u,a,f;return Os(this,function(h){switch(h.label){case 0:u=this._root,a=[],f=!1,h.label=1;case 1:return f?[3,6]:u===null?[3,2]:(a.push(u),u=u.left,[3,5]);case 2:return a.length===0?[3,4]:(u=a.pop(),[4,u]);case 3:return h.sent(),u=u.right,[3,5];case 4:f=!0,h.label=5;case 5:return[3,1];case 6:return[2]}})},l}();function Vn(l,u,a,f){var h=f-a;if(h>0){var g=a+Math.floor(h/2),d=l[g],p=u[g],w=new ue(d,p);return w.left=Vn(l,u,a,g),w.right=Vn(l,u,g+1,f),w}return null}function Ps(l,u){for(var a=new ue(null,null),f=a,h=0;h<l.length;h++)f=f.next=new ue(l[h],u[h]);return f.next=null,a.next}function As(l){for(var u=l,a=[],f=!1,h=new ue(null,null),g=h;!f;)u?(a.push(u),u=u.left):a.length>0?(u=g=g.next=a.pop(),u=u.right):f=!0;return g.next=null,h.next}function Hn(l,u,a){var f=a-u;if(f>0){var h=u+Math.floor(f/2),g=Hn(l,u,h),d=l.head;return d.left=g,l.head=l.head.next,d.right=Hn(l,h+1,a),d}return null}function Ds(l,u,a){for(var f=new ue(null,null),h=f,g=l,d=u;g!==null&&d!==null;)a(g.key,d.key)<0?(h.next=g,g=g.next):(h.next=d,d=d.next),h=h.next;return g!==null?h.next=g:d!==null&&(h.next=d),f.next}function Zn(l,u,a,f,h){if(!(a>=f)){for(var g=l[a+f>>1],d=a-1,p=f+1;;){do d++;while(h(l[d],g)<0);do p--;while(h(l[p],g)>0);if(d>=p)break;var w=l[d];l[d]=l[p],l[p]=w,w=u[d],u[d]=u[p],u[p]=w}Zn(l,u,a,p,h),Zn(l,u,p+1,f,h)}}const ee=11102230246251565e-32,Nt=134217729,Fs=(3+8*ee)*ee;function $n(l,u,a,f,h){let g,d,p,w,x=u[0],N=f[0],m=0,I=0;N>x==N>-x?(g=x,x=u[++m]):(g=N,N=f[++I]);let _=0;if(m<l&&I<a)for(N>x==N>-x?(d=x+g,p=g-(d-x),x=u[++m]):(d=N+g,p=g-(d-N),N=f[++I]),g=d,p!==0&&(h[_++]=p);m<l&&I<a;)N>x==N>-x?(d=g+x,w=d-g,p=g-(d-w)+(x-w),x=u[++m]):(d=g+N,w=d-g,p=g-(d-w)+(N-w),N=f[++I]),g=d,p!==0&&(h[_++]=p);for(;m<l;)d=g+x,w=d-g,p=g-(d-w)+(x-w),x=u[++m],g=d,p!==0&&(h[_++]=p);for(;I<a;)d=g+N,w=d-g,p=g-(d-w)+(N-w),N=f[++I],g=d,p!==0&&(h[_++]=p);return(g!==0||_===0)&&(h[_++]=g),_}function Gs(l,u){let a=u[0];for(let f=1;f<l;f++)a+=u[f];return a}function Ve(l){return new Float64Array(l)}const qs=(3+16*ee)*ee,Ys=(2+12*ee)*ee,zs=(9+64*ee)*ee*ee,Te=Ve(4),Mi=Ve(8),Pi=Ve(12),Ai=Ve(16),wt=Ve(4);function Bs(l,u,a,f,h,g,d){let p,w,x,N,m,I,_,S,R,O,A,M,b,q,G,B,X,V;const U=l-h,st=a-h,et=u-g,rt=f-g;q=U*rt,I=Nt*U,_=I-(I-U),S=U-_,I=Nt*rt,R=I-(I-rt),O=rt-R,G=S*O-(q-_*R-S*R-_*O),B=et*st,I=Nt*et,_=I-(I-et),S=et-_,I=Nt*st,R=I-(I-st),O=st-R,X=S*O-(B-_*R-S*R-_*O),A=G-X,m=G-A,Te[0]=G-(A+m)+(m-X),M=q+A,m=M-q,b=q-(M-m)+(A-m),A=b-B,m=b-A,Te[1]=b-(A+m)+(m-B),V=M+A,m=V-M,Te[2]=M-(V-m)+(A-m),Te[3]=V;let ot=Gs(4,Te),z=Ys*d;if(ot>=z||-ot>=z||(m=l-U,p=l-(U+m)+(m-h),m=a-st,x=a-(st+m)+(m-h),m=u-et,w=u-(et+m)+(m-g),m=f-rt,N=f-(rt+m)+(m-g),p===0&&w===0&&x===0&&N===0)||(z=zs*d+Fs*Math.abs(ot),ot+=U*N+rt*p-(et*x+st*w),ot>=z||-ot>=z))return ot;q=p*rt,I=Nt*p,_=I-(I-p),S=p-_,I=Nt*rt,R=I-(I-rt),O=rt-R,G=S*O-(q-_*R-S*R-_*O),B=w*st,I=Nt*w,_=I-(I-w),S=w-_,I=Nt*st,R=I-(I-st),O=st-R,X=S*O-(B-_*R-S*R-_*O),A=G-X,m=G-A,wt[0]=G-(A+m)+(m-X),M=q+A,m=M-q,b=q-(M-m)+(A-m),A=b-B,m=b-A,wt[1]=b-(A+m)+(m-B),V=M+A,m=V-M,wt[2]=M-(V-m)+(A-m),wt[3]=V;const nt=$n(4,Te,4,wt,Mi);q=U*N,I=Nt*U,_=I-(I-U),S=U-_,I=Nt*N,R=I-(I-N),O=N-R,G=S*O-(q-_*R-S*R-_*O),B=et*x,I=Nt*et,_=I-(I-et),S=et-_,I=Nt*x,R=I-(I-x),O=x-R,X=S*O-(B-_*R-S*R-_*O),A=G-X,m=G-A,wt[0]=G-(A+m)+(m-X),M=q+A,m=M-q,b=q-(M-m)+(A-m),A=b-B,m=b-A,wt[1]=b-(A+m)+(m-B),V=M+A,m=V-M,wt[2]=M-(V-m)+(A-m),wt[3]=V;const lt=$n(nt,Mi,4,wt,Pi);q=p*N,I=Nt*p,_=I-(I-p),S=p-_,I=Nt*N,R=I-(I-N),O=N-R,G=S*O-(q-_*R-S*R-_*O),B=w*x,I=Nt*w,_=I-(I-w),S=w-_,I=Nt*x,R=I-(I-x),O=x-R,X=S*O-(B-_*R-S*R-_*O),A=G-X,m=G-A,wt[0]=G-(A+m)+(m-X),M=q+A,m=M-q,b=q-(M-m)+(A-m),A=b-B,m=b-A,wt[1]=b-(A+m)+(m-B),V=M+A,m=V-M,wt[2]=M-(V-m)+(A-m),wt[3]=V;const gt=$n(lt,Pi,4,wt,Ai);return Ai[gt-1]}function Xs(l,u,a,f,h,g){const d=(u-g)*(a-h),p=(l-h)*(f-g),w=d-p,x=Math.abs(d+p);return Math.abs(w)>=qs*x?w:-Bs(l,u,a,f,h,g,x)}const He=(l,u)=>l.ll.x<=u.x&&u.x<=l.ur.x&&l.ll.y<=u.y&&u.y<=l.ur.y,jn=(l,u)=>{if(u.ur.x<l.ll.x||l.ur.x<u.ll.x||u.ur.y<l.ll.y||l.ur.y<u.ll.y)return null;const a=l.ll.x<u.ll.x?u.ll.x:l.ll.x,f=l.ur.x<u.ur.x?l.ur.x:u.ur.x,h=l.ll.y<u.ll.y?u.ll.y:l.ll.y,g=l.ur.y<u.ur.y?l.ur.y:u.ur.y;return{ll:{x:a,y:h},ur:{x:f,y:g}}};let le=Number.EPSILON;le===void 0&&(le=Math.pow(2,-52));const Us=le*le,Di=(l,u)=>{if(-le<l&&l<le&&-le<u&&u<le)return 0;const a=l-u;return a*a<Us*l*u?0:l<u?-1:1};class Vs{constructor(){this.reset()}reset(){this.xRounder=new Fi,this.yRounder=new Fi}round(u,a){return{x:this.xRounder.round(u),y:this.yRounder.round(a)}}}class Fi{constructor(){this.tree=new Un,this.round(0)}round(u){const a=this.tree.add(u),f=this.tree.prev(a);if(f!==null&&Di(a.key,f.key)===0)return this.tree.remove(u),f.key;const h=this.tree.next(a);return h!==null&&Di(a.key,h.key)===0?(this.tree.remove(u),h.key):u}}const Ze=new Vs,cn=(l,u)=>l.x*u.y-l.y*u.x,Gi=(l,u)=>l.x*u.x+l.y*u.y,qi=(l,u,a)=>{const f=Xs(l.x,l.y,u.x,u.y,a.x,a.y);return f>0?-1:f<0?1:0},fn=l=>Math.sqrt(Gi(l,l)),Hs=(l,u,a)=>{const f={x:u.x-l.x,y:u.y-l.y},h={x:a.x-l.x,y:a.y-l.y};return cn(h,f)/fn(h)/fn(f)},Zs=(l,u,a)=>{const f={x:u.x-l.x,y:u.y-l.y},h={x:a.x-l.x,y:a.y-l.y};return Gi(h,f)/fn(h)/fn(f)},Yi=(l,u,a)=>u.y===0?null:{x:l.x+u.x/u.y*(a-l.y),y:a},zi=(l,u,a)=>u.x===0?null:{x:a,y:l.y+u.y/u.x*(a-l.x)},$s=(l,u,a,f)=>{if(u.x===0)return zi(a,f,l.x);if(f.x===0)return zi(l,u,a.x);if(u.y===0)return Yi(a,f,l.y);if(f.y===0)return Yi(l,u,a.y);const h=cn(u,f);if(h==0)return null;const g={x:a.x-l.x,y:a.y-l.y},d=cn(g,u)/h,p=cn(g,f)/h,w=l.x+p*u.x,x=a.x+d*f.x,N=l.y+p*u.y,m=a.y+d*f.y,I=(w+x)/2,_=(N+m)/2;return{x:I,y:_}};class Ft{static compare(u,a){const f=Ft.comparePoints(u.point,a.point);return f!==0?f:(u.point!==a.point&&u.link(a),u.isLeft!==a.isLeft?u.isLeft?1:-1:he.compare(u.segment,a.segment))}static comparePoints(u,a){return u.x<a.x?-1:u.x>a.x?1:u.y<a.y?-1:u.y>a.y?1:0}constructor(u,a){u.events===void 0?u.events=[this]:u.events.push(this),this.point=u,this.isLeft=a}link(u){if(u.point===this.point)throw new Error("Tried to link already linked events");const a=u.point.events;for(let f=0,h=a.length;f<h;f++){const g=a[f];this.point.events.push(g),g.point=this.point}this.checkForConsuming()}checkForConsuming(){const u=this.point.events.length;for(let a=0;a<u;a++){const f=this.point.events[a];if(f.segment.consumedBy===void 0)for(let h=a+1;h<u;h++){const g=this.point.events[h];g.consumedBy===void 0&&f.otherSE.point.events===g.otherSE.point.events&&f.segment.consume(g.segment)}}}getAvailableLinkedEvents(){const u=[];for(let a=0,f=this.point.events.length;a<f;a++){const h=this.point.events[a];h!==this&&!h.segment.ringOut&&h.segment.isInResult()&&u.push(h)}return u}getLeftmostComparator(u){const a=new Map,f=h=>{const g=h.otherSE;a.set(h,{sine:Hs(this.point,u.point,g.point),cosine:Zs(this.point,u.point,g.point)})};return(h,g)=>{a.has(h)||f(h),a.has(g)||f(g);const{sine:d,cosine:p}=a.get(h),{sine:w,cosine:x}=a.get(g);return d>=0&&w>=0?p<x?1:p>x?-1:0:d<0&&w<0?p<x?-1:p>x?1:0:w<d?-1:w>d?1:0}}}let js=0;class he{static compare(u,a){const f=u.leftSE.point.x,h=a.leftSE.point.x,g=u.rightSE.point.x,d=a.rightSE.point.x;if(d<f)return 1;if(g<h)return-1;const p=u.leftSE.point.y,w=a.leftSE.point.y,x=u.rightSE.point.y,N=a.rightSE.point.y;if(f<h){if(w<p&&w<x)return 1;if(w>p&&w>x)return-1;const m=u.comparePoint(a.leftSE.point);if(m<0)return 1;if(m>0)return-1;const I=a.comparePoint(u.rightSE.point);return I!==0?I:-1}if(f>h){if(p<w&&p<N)return-1;if(p>w&&p>N)return 1;const m=a.comparePoint(u.leftSE.point);if(m!==0)return m;const I=u.comparePoint(a.rightSE.point);return I<0?1:I>0?-1:1}if(p<w)return-1;if(p>w)return 1;if(g<d){const m=a.comparePoint(u.rightSE.point);if(m!==0)return m}if(g>d){const m=u.comparePoint(a.rightSE.point);if(m<0)return 1;if(m>0)return-1}if(g!==d){const m=x-p,I=g-f,_=N-w,S=d-h;if(m>I&&_<S)return 1;if(m<I&&_>S)return-1}return g>d?1:g<d||x<N?-1:x>N?1:u.id<a.id?-1:u.id>a.id?1:0}constructor(u,a,f,h){this.id=++js,this.leftSE=u,u.segment=this,u.otherSE=a,this.rightSE=a,a.segment=this,a.otherSE=u,this.rings=f,this.windings=h}static fromRing(u,a,f){let h,g,d;const p=Ft.comparePoints(u,a);if(p<0)h=u,g=a,d=1;else if(p>0)h=a,g=u,d=-1;else throw new Error(`Tried to create degenerate segment at [${u.x}, ${u.y}]`);const w=new Ft(h,!0),x=new Ft(g,!1);return new he(w,x,[f],[d])}replaceRightSE(u){this.rightSE=u,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const u=this.leftSE.point.y,a=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:u<a?u:a},ur:{x:this.rightSE.point.x,y:u>a?u:a}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(u){return u.x===this.leftSE.point.x&&u.y===this.leftSE.point.y||u.x===this.rightSE.point.x&&u.y===this.rightSE.point.y}comparePoint(u){if(this.isAnEndpoint(u))return 0;const a=this.leftSE.point,f=this.rightSE.point,h=this.vector();if(a.x===f.x)return u.x===a.x?0:u.x<a.x?1:-1;const g=(u.y-a.y)/h.y,d=a.x+g*h.x;if(u.x===d)return 0;const p=(u.x-a.x)/h.x,w=a.y+p*h.y;return u.y===w?0:u.y<w?-1:1}getIntersection(u){const a=this.bbox(),f=u.bbox(),h=jn(a,f);if(h===null)return null;const g=this.leftSE.point,d=this.rightSE.point,p=u.leftSE.point,w=u.rightSE.point,x=He(a,p)&&this.comparePoint(p)===0,N=He(f,g)&&u.comparePoint(g)===0,m=He(a,w)&&this.comparePoint(w)===0,I=He(f,d)&&u.comparePoint(d)===0;if(N&&x)return I&&!m?d:!I&&m?w:null;if(N)return m&&g.x===w.x&&g.y===w.y?null:g;if(x)return I&&d.x===p.x&&d.y===p.y?null:p;if(I&&m)return null;if(I)return d;if(m)return w;const _=$s(g,this.vector(),p,u.vector());return _===null||!He(h,_)?null:Ze.round(_.x,_.y)}split(u){const a=[],f=u.events!==void 0,h=new Ft(u,!0),g=new Ft(u,!1),d=this.rightSE;this.replaceRightSE(g),a.push(g),a.push(h);const p=new he(h,d,this.rings.slice(),this.windings.slice());return Ft.comparePoints(p.leftSE.point,p.rightSE.point)>0&&p.swapEvents(),Ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),f&&(h.checkForConsuming(),g.checkForConsuming()),a}swapEvents(){const u=this.rightSE;this.rightSE=this.leftSE,this.leftSE=u,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let a=0,f=this.windings.length;a<f;a++)this.windings[a]*=-1}consume(u){let a=this,f=u;for(;a.consumedBy;)a=a.consumedBy;for(;f.consumedBy;)f=f.consumedBy;const h=he.compare(a,f);if(h!==0){if(h>0){const g=a;a=f,f=g}if(a.prev===f){const g=a;a=f,f=g}for(let g=0,d=f.rings.length;g<d;g++){const p=f.rings[g],w=f.windings[g],x=a.rings.indexOf(p);x===-1?(a.rings.push(p),a.windings.push(w)):a.windings[x]+=w}f.rings=null,f.windings=null,f.consumedBy=a,f.leftSE.consumedBy=a.leftSE,f.rightSE.consumedBy=a.rightSE}}prevInResult(){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)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const u=this.prev.consumedBy||this.prev;this._beforeState=u.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const u=this.beforeState();this._afterState={rings:u.rings.slice(0),windings:u.windings.slice(0),multiPolys:[]};const a=this._afterState.rings,f=this._afterState.windings,h=this._afterState.multiPolys;for(let p=0,w=this.rings.length;p<w;p++){const x=this.rings[p],N=this.windings[p],m=a.indexOf(x);m===-1?(a.push(x),f.push(N)):f[m]+=N}const g=[],d=[];for(let p=0,w=a.length;p<w;p++){if(f[p]===0)continue;const x=a[p],N=x.poly;if(d.indexOf(N)===-1)if(x.isExterior)g.push(N);else{d.indexOf(N)===-1&&d.push(N);const m=g.indexOf(x.poly);m!==-1&&g.splice(m,1)}}for(let p=0,w=g.length;p<w;p++){const x=g[p].multiPoly;h.indexOf(x)===-1&&h.push(x)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const u=this.beforeState().multiPolys,a=this.afterState().multiPolys;switch(Ut.type){case"union":{const f=u.length===0,h=a.length===0;this._isInResult=f!==h;break}case"intersection":{let f,h;u.length<a.length?(f=u.length,h=a.length):(f=a.length,h=u.length),this._isInResult=h===Ut.numMultiPolys&&f<h;break}case"xor":{const f=Math.abs(u.length-a.length);this._isInResult=f%2===1;break}case"difference":{const f=h=>h.length===1&&h[0].isSubject;this._isInResult=f(u)!==f(a);break}default:throw new Error(`Unrecognized operation type found ${Ut.type}`)}return this._isInResult}}class Bi{constructor(u,a,f){if(!Array.isArray(u)||u.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=a,this.isExterior=f,this.segments=[],typeof u[0][0]!="number"||typeof u[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const h=Ze.round(u[0][0],u[0][1]);this.bbox={ll:{x:h.x,y:h.y},ur:{x:h.x,y:h.y}};let g=h;for(let d=1,p=u.length;d<p;d++){if(typeof u[d][0]!="number"||typeof u[d][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let w=Ze.round(u[d][0],u[d][1]);w.x===g.x&&w.y===g.y||(this.segments.push(he.fromRing(g,w,this)),w.x<this.bbox.ll.x&&(this.bbox.ll.x=w.x),w.y<this.bbox.ll.y&&(this.bbox.ll.y=w.y),w.x>this.bbox.ur.x&&(this.bbox.ur.x=w.x),w.y>this.bbox.ur.y&&(this.bbox.ur.y=w.y),g=w)}(h.x!==g.x||h.y!==g.y)&&this.segments.push(he.fromRing(g,h,this))}getSweepEvents(){const u=[];for(let a=0,f=this.segments.length;a<f;a++){const h=this.segments[a];u.push(h.leftSE),u.push(h.rightSE)}return u}}class Ws{constructor(u,a){if(!Array.isArray(u))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Bi(u[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let f=1,h=u.length;f<h;f++){const g=new Bi(u[f],this,!1);g.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=g.bbox.ll.x),g.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=g.bbox.ll.y),g.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=g.bbox.ur.x),g.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=g.bbox.ur.y),this.interiorRings.push(g)}this.multiPoly=a}getSweepEvents(){const u=this.exteriorRing.getSweepEvents();for(let a=0,f=this.interiorRings.length;a<f;a++){const h=this.interiorRings[a].getSweepEvents();for(let g=0,d=h.length;g<d;g++)u.push(h[g])}return u}}class Xi{constructor(u,a){if(!Array.isArray(u))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof u[0][0][0]=="number"&&(u=[u])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let f=0,h=u.length;f<h;f++){const g=new Ws(u[f],this);g.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=g.bbox.ll.x),g.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=g.bbox.ll.y),g.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=g.bbox.ur.x),g.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=g.bbox.ur.y),this.polys.push(g)}this.isSubject=a}getSweepEvents(){const u=[];for(let a=0,f=this.polys.length;a<f;a++){const h=this.polys[a].getSweepEvents();for(let g=0,d=h.length;g<d;g++)u.push(h[g])}return u}}class gn{static factory(u){const a=[];for(let f=0,h=u.length;f<h;f++){const g=u[f];if(!g.isInResult()||g.ringOut)continue;let d=null,p=g.leftSE,w=g.rightSE;const x=[p],N=p.point,m=[];for(;d=p,p=w,x.push(p),p.point!==N;)for(;;){const I=p.getAvailableLinkedEvents();if(I.length===0){const R=x[0].point,O=x[x.length-1].point;throw new Error(`Unable to complete output ring starting at [${R.x}, ${R.y}]. Last matching segment found ends at [${O.x}, ${O.y}].`)}if(I.length===1){w=I[0].otherSE;break}let _=null;for(let R=0,O=m.length;R<O;R++)if(m[R].point===p.point){_=R;break}if(_!==null){const R=m.splice(_)[0],O=x.splice(R.index);O.unshift(O[0].otherSE),a.push(new gn(O.reverse()));continue}m.push({index:x.length,point:p.point});const S=p.getLeftmostComparator(d);w=I.sort(S)[0].otherSE;break}a.push(new gn(x))}return a}constructor(u){this.events=u;for(let a=0,f=u.length;a<f;a++)u[a].segment.ringOut=this;this.poly=null}getGeom(){let u=this.events[0].point;const a=[u];for(let x=1,N=this.events.length-1;x<N;x++){const m=this.events[x].point,I=this.events[x+1].point;qi(m,u,I)!==0&&(a.push(m),u=m)}if(a.length===1)return null;const f=a[0],h=a[1];qi(f,u,h)===0&&a.shift(),a.push(a[0]);const g=this.isExteriorRing()?1:-1,d=this.isExteriorRing()?0:a.length-1,p=this.isExteriorRing()?a.length:-1,w=[];for(let x=d;x!=p;x+=g)w.push([a[x].x,a[x].y]);return w}isExteriorRing(){if(this._isExteriorRing===void 0){const u=this.enclosingRing();this._isExteriorRing=u?!u.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let u=this.events[0];for(let h=1,g=this.events.length;h<g;h++){const d=this.events[h];Ft.compare(u,d)>0&&(u=d)}let a=u.segment.prevInResult(),f=a?a.prevInResult():null;for(;;){if(!a)return null;if(!f)return a.ringOut;if(f.ringOut!==a.ringOut)return f.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=f.prevInResult(),f=a?a.prevInResult():null}}}class Ui{constructor(u){this.exteriorRing=u,u.poly=this,this.interiorRings=[]}addInterior(u){this.interiorRings.push(u),u.poly=this}getGeom(){const u=[this.exteriorRing.getGeom()];if(u[0]===null)return null;for(let a=0,f=this.interiorRings.length;a<f;a++){const h=this.interiorRings[a].getGeom();h!==null&&u.push(h)}return u}}class Qs{constructor(u){this.rings=u,this.polys=this._composePolys(u)}getGeom(){const u=[];for(let a=0,f=this.polys.length;a<f;a++){const h=this.polys[a].getGeom();h!==null&&u.push(h)}return u}_composePolys(u){const a=[];for(let f=0,h=u.length;f<h;f++){const g=u[f];if(!g.poly)if(g.isExteriorRing())a.push(new Ui(g));else{const d=g.enclosingRing();d.poly||a.push(new Ui(d)),d.poly.addInterior(g)}}return a}}class Js{constructor(u){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:he.compare;this.queue=u,this.tree=new Un(a),this.segments=[]}process(u){const a=u.segment,f=[];if(u.consumedBy)return u.isLeft?this.queue.remove(u.otherSE):this.tree.remove(a),f;const h=u.isLeft?this.tree.add(a):this.tree.find(a);if(!h)throw new Error(`Unable to find segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] in SweepLine tree.`);let g=h,d=h,p,w;for(;p===void 0;)g=this.tree.prev(g),g===null?p=null:g.key.consumedBy===void 0&&(p=g.key);for(;w===void 0;)d=this.tree.next(d),d===null?w=null:d.key.consumedBy===void 0&&(w=d.key);if(u.isLeft){let x=null;if(p){const m=p.getIntersection(a);if(m!==null&&(a.isAnEndpoint(m)||(x=m),!p.isAnEndpoint(m))){const I=this._splitSafely(p,m);for(let _=0,S=I.length;_<S;_++)f.push(I[_])}}let N=null;if(w){const m=w.getIntersection(a);if(m!==null&&(a.isAnEndpoint(m)||(N=m),!w.isAnEndpoint(m))){const I=this._splitSafely(w,m);for(let _=0,S=I.length;_<S;_++)f.push(I[_])}}if(x!==null||N!==null){let m=null;x===null?m=N:N===null?m=x:m=Ft.comparePoints(x,N)<=0?x:N,this.queue.remove(a.rightSE),f.push(a.rightSE);const I=a.split(m);for(let _=0,S=I.length;_<S;_++)f.push(I[_])}f.length>0?(this.tree.remove(a),f.push(u)):(this.segments.push(a),a.prev=p)}else{if(p&&w){const x=p.getIntersection(w);if(x!==null){if(!p.isAnEndpoint(x)){const N=this._splitSafely(p,x);for(let m=0,I=N.length;m<I;m++)f.push(N[m])}if(!w.isAnEndpoint(x)){const N=this._splitSafely(w,x);for(let m=0,I=N.length;m<I;m++)f.push(N[m])}}}this.tree.remove(a)}return f}_splitSafely(u,a){this.tree.remove(u);const f=u.rightSE;this.queue.remove(f);const h=u.split(a);return h.push(f),u.consumedBy===void 0&&this.tree.add(u),h}}const Vi=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Ks=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class ta{run(u,a,f){Ut.type=u,Ze.reset();const h=[new Xi(a,!0)];for(let m=0,I=f.length;m<I;m++)h.push(new Xi(f[m],!1));if(Ut.numMultiPolys=h.length,Ut.type==="difference"){const m=h[0];let I=1;for(;I<h.length;)jn(h[I].bbox,m.bbox)!==null?I++:h.splice(I,1)}if(Ut.type==="intersection")for(let m=0,I=h.length;m<I;m++){const _=h[m];for(let S=m+1,R=h.length;S<R;S++)if(jn(_.bbox,h[S].bbox)===null)return[]}const g=new Un(Ft.compare);for(let m=0,I=h.length;m<I;m++){const _=h[m].getSweepEvents();for(let S=0,R=_.length;S<R;S++)if(g.insert(_[S]),g.size>Vi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const d=new Js(g);let p=g.size,w=g.pop();for(;w;){const m=w.key;if(g.size===p){const _=m.segment;throw new Error(`Unable to pop() ${m.isLeft?"left":"right"} SweepEvent [${m.point.x}, ${m.point.y}] from segment #${_.id} [${_.leftSE.point.x}, ${_.leftSE.point.y}] -> [${_.rightSE.point.x}, ${_.rightSE.point.y}] from queue.`)}if(g.size>Vi)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(d.segments.length>Ks)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const I=d.process(m);for(let _=0,S=I.length;_<S;_++){const R=I[_];R.consumedBy===void 0&&g.insert(R)}p=g.size,w=g.pop()}Ze.reset();const x=gn.factory(d.segments);return new Qs(x).getGeom()}}const Ut=new ta;var Hi={union:function(l){for(var u=arguments.length,a=new Array(u>1?u-1:0),f=1;f<u;f++)a[f-1]=arguments[f];return Ut.run("union",l,a)},intersection:function(l){for(var u=arguments.length,a=new Array(u>1?u-1:0),f=1;f<u;f++)a[f-1]=arguments[f];return Ut.run("intersection",l,a)},xor:function(l){for(var u=arguments.length,a=new Array(u>1?u-1:0),f=1;f<u;f++)a[f-1]=arguments[f];return Ut.run("xor",l,a)},difference:function(l){for(var u=arguments.length,a=new Array(u>1?u-1:0),f=1;f<u;f++)a[f-1]=arguments[f];return Ut.run("difference",l,a)}};function Zi(l,u,a){if(l!==null)for(var f,h,g,d,p,w,x,N=0,m=0,I,_=l.type,S=_==="FeatureCollection",R=_==="Feature",O=S?l.features.length:1,A=0;A<O;A++){x=S?l.features[A].geometry:R?l.geometry:l,I=x?x.type==="GeometryCollection":!1,p=I?x.geometries.length:1;for(var M=0;M<p;M++){var b=0,q=0;if(d=I?x.geometries[M]:x,d!==null){w=d.coordinates;var G=d.type;switch(N=0,G){case null:break;case"Point":if(u(w,m,A,b,q)===!1)return!1;m++,b++;break;case"LineString":case"MultiPoint":for(f=0;f<w.length;f++){if(u(w[f],m,A,b,q)===!1)return!1;m++,G==="MultiPoint"&&b++}G==="LineString"&&b++;break;case"Polygon":case"MultiLineString":for(f=0;f<w.length;f++){for(h=0;h<w[f].length-N;h++){if(u(w[f][h],m,A,b,q)===!1)return!1;m++}G==="MultiLineString"&&b++,G==="Polygon"&&q++}G==="Polygon"&&b++;break;case"MultiPolygon":for(f=0;f<w.length;f++){for(q=0,h=0;h<w[f].length;h++){for(g=0;g<w[f][h].length-N;g++){if(u(w[f][h][g],m,A,b,q)===!1)return!1;m++}q++}b++}break;case"GeometryCollection":for(f=0;f<d.geometries.length;f++)if(Zi(d.geometries[f],u)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function $i(l,u){if(l.type==="Feature")u(l,0);else if(l.type==="FeatureCollection")for(var a=0;a<l.features.length&&u(l.features[a],a)!==!1;a++);}function vn(l,u){var a,f,h,g,d,p,w,x,N,m,I=0,_=l.type==="FeatureCollection",S=l.type==="Feature",R=_?l.features.length:1;for(a=0;a<R;a++){for(p=_?l.features[a].geometry:S?l.geometry:l,x=_?l.features[a].properties:S?l.properties:{},N=_?l.features[a].bbox:S?l.bbox:void 0,m=_?l.features[a].id:S?l.id:void 0,w=p?p.type==="GeometryCollection":!1,d=w?p.geometries.length:1,h=0;h<d;h++){if(g=w?p.geometries[h]:p,g===null){if(u(null,I,x,N,m)===!1)return!1;continue}switch(g.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(u(g,I,x,N,m)===!1)return!1;break}case"GeometryCollection":{for(f=0;f<g.geometries.length;f++)if(u(g.geometries[f],I,x,N,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}I++}}function ea(l,u={}){const a=[];if(vn(l,h=>{a.push(h.coordinates)}),a.length<2)throw new Error("Must have at least 2 geometries");const f=Hi.union(a[0],...a.slice(1));return f.length===0?null:f.length===1?zn(f[0],u.properties):Ri(f,u.properties)}var na=ea;function $e(){}function ji(l){return l()}function Wi(){return Object.create(null)}function yn(l){l.forEach(ji)}function Qi(l){return typeof l=="function"}function ia(l,u){return l!=l?u==u:l!==u||l&&typeof l=="object"||typeof l=="function"}function ra(l){return Object.keys(l).length===0}function sa(l,u){l.appendChild(u)}function aa(l,u,a){l.insertBefore(u,a||null)}function Ji(l){l.parentNode&&l.parentNode.removeChild(l)}function Ki(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function ce(l,u,a){a==null?l.removeAttribute(u):l.getAttribute(u)!==a&&l.setAttribute(u,a)}function ua(l){return Array.from(l.childNodes)}function mn(l,u,a){l.classList.toggle(u,!!a)}let Wn;function je(l){Wn=l}const Ce=[],tr=[];let Re=[];const er=[],oa=Promise.resolve();let Qn=!1;function la(){Qn||(Qn=!0,oa.then(nr))}function Jn(l){Re.push(l)}const Kn=new Set;let Oe=0;function nr(){if(Oe!==0)return;const l=Wn;do{try{for(;Oe<Ce.length;){const u=Ce[Oe];Oe++,je(u),ha(u.$$)}}catch(u){throw Ce.length=0,Oe=0,u}for(je(null),Ce.length=0,Oe=0;tr.length;)tr.pop()();for(let u=0;u<Re.length;u+=1){const a=Re[u];Kn.has(a)||(Kn.add(a),a())}Re.length=0}while(Ce.length);for(;er.length;)er.pop()();Qn=!1,Kn.clear(),je(l)}function ha(l){if(l.fragment!==null){l.update(),yn(l.before_update);const u=l.dirty;l.dirty=[-1],l.fragment&&l.fragment.p(l.ctx,u),l.after_update.forEach(Jn)}}function ca(l){const u=[],a=[];Re.forEach(f=>l.indexOf(f)===-1?u.push(f):a.push(f)),a.forEach(f=>f()),Re=u}const fa=new Set;function ga(l,u){l&&l.i&&(fa.delete(l),l.i(u))}function va(l,u,a){const{fragment:f,after_update:h}=l.$$;f&&f.m(u,a),Jn(()=>{const g=l.$$.on_mount.map(ji).filter(Qi);l.$$.on_destroy?l.$$.on_destroy.push(...g):yn(g),l.$$.on_mount=[]}),h.forEach(Jn)}function ya(l,u){const a=l.$$;a.fragment!==null&&(ca(a.after_update),yn(a.on_destroy),a.fragment&&a.fragment.d(u),a.on_destroy=a.fragment=null,a.ctx=[])}function ma(l,u){l.$$.dirty[0]===-1&&(Ce.push(l),la(),l.$$.dirty.fill(0)),l.$$.dirty[u/31|0]|=1<<u%31}function da(l,u,a,f,h,g,d=null,p=[-1]){const w=Wn;je(l);const x=l.$$={fragment:null,ctx:[],props:g,update:$e,not_equal:h,bound:Wi(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(u.context||(w?w.$$.context:[])),callbacks:Wi(),dirty:p,skip_bound:!1,root:u.target||w.$$.root};d&&d(x.root);let N=!1;if(x.ctx=a?a(l,u.props||{},(m,I,..._)=>{const S=_.length?_[0]:I;return x.ctx&&h(x.ctx[m],x.ctx[m]=S)&&(!x.skip_bound&&x.bound[m]&&x.bound[m](S),N&&ma(l,m)),I}):[],x.update(),N=!0,yn(x.before_update),x.fragment=f?f(x.ctx):!1,u.target){if(u.hydrate){const m=ua(u.target);x.fragment&&x.fragment.l(m),m.forEach(Ji)}else x.fragment&&x.fragment.c();u.intro&&ga(l.$$.fragment),va(l,u.target,u.anchor),nr()}je(w)}class pa{constructor(){Ti(this,"$$");Ti(this,"$$set")}$destroy(){ya(this,1),this.$destroy=$e}$on(u,a){if(!Qi(a))return $e;const f=this.$$.callbacks[u]||(this.$$.callbacks[u]=[]);return f.push(a),()=>{const h=f.indexOf(a);h!==-1&&f.splice(h,1)}}$set(u){this.$$set&&!ra(u)&&(this.$$.skip_bound=!0,this.$$set(u),this.$$.skip_bound=!1)}}const _a="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(_a);function xa(l){let u,a,f;return{c(){u=Ki("svg"),a=Ki("path"),ce(a,"stroke-width","4"),ce(a,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),ce(a,"class","svelte-gzo3ar"),ce(u,"width",f=l[0]==="list"?20:void 0),ce(u,"viewBox","0 0 70 85"),ce(u,"fill","none"),ce(u,"class","svelte-gzo3ar"),mn(u,"in-map",l[0]!=="list"),mn(u,"list-icon",l[0]==="list")},m(h,g){aa(h,u,g),sa(u,a)},p(h,[g]){g&1&&f!==(f=h[0]==="list"?20:void 0)&&ce(u,"width",f),g&1&&mn(u,"in-map",h[0]!=="list"),g&1&&mn(u,"list-icon",h[0]==="list")},i:$e,o:$e,d(h){h&&Ji(u)}}}function ka(l,u,a){let{displayIn:f}=u;return l.$$set=h=>{"displayIn"in h&&a(0,f=h.displayIn)},[f]}class Ea extends pa{constructor(u){super(),da(this,u,ka,xa,ia,{displayIn:0})}}function Ia(l,u={}){if(l.bbox!=null&&u.recompute!==!0)return l.bbox;const a=[1/0,1/0,-1/0,-1/0];return Zi(l,f=>{a[0]>f[0]&&(a[0]=f[0]),a[1]>f[1]&&(a[1]=f[1]),a[2]<f[0]&&(a[2]=f[0]),a[3]<f[1]&&(a[3]=f[1])}),a}function Na(l,u={}){const a=Ia(l),f=(a[0]+a[2])/2,h=(a[1]+a[3])/2;return Ts([f,h],u.properties,u)}var Sa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wa(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var ir={exports:{}};(function(l,u){(function(a,f){l.exports=f()})(Sa,function(){function a(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function f(r,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function h(r,t,e){return t&&f(r.prototype,t),e&&f(r,e),r}function g(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(t&&t.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),t&&p(r,t)}function d(r){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},d(r)}function p(r,t){return p=Object.setPrototypeOf||function(e,n){return e.__proto__=n,e},p(r,t)}function w(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function x(r,t,e){return x=w()?Reflect.construct:function(n,i,s){var o=[null];o.push.apply(o,i);var c=new(Function.bind.apply(n,o));return s&&p(c,s.prototype),c},x.apply(null,arguments)}function N(r){var t=typeof Map=="function"?new Map:void 0;return N=function(e){if(e===null||(n=e,Function.toString.call(n).indexOf("[native code]")===-1))return e;var n;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return x(e,arguments,d(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),p(i,e)},N(r)}function m(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function I(r,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m(r)}function _(r){var t=w();return function(){var e,n=d(r);if(t){var i=d(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return I(this,e)}}function S(r,t,e){return S=typeof Reflect<"u"&&Reflect.get?Reflect.get:function(n,i,s){var o=function(v,y){for(;!Object.prototype.hasOwnProperty.call(v,y)&&(v=d(v))!==null;);return v}(n,i);if(o){var c=Object.getOwnPropertyDescriptor(o,i);return c.get?c.get.call(s):c.value}},S(r,t,e||r)}function R(r){return function(t){if(Array.isArray(t))return A(t)}(r)||function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}(r)||O(r)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
23
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function O(r,t){if(r){if(typeof r=="string")return A(r,t);var e=Object.prototype.toString.call(r).slice(8,-1);return e==="Object"&&r.constructor&&(e=r.constructor.name),e==="Map"||e==="Set"?Array.from(r):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?A(r,t):void 0}}function A(r,t){(t==null||t>r.length)&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function M(r,t){var e=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!e){if(Array.isArray(r)||(e=O(r))||t){e&&(r=e);var n=0,i=function(){};return{s:i,n:function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}},e:function(v){throw v},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
24
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,o=!0,c=!1;return{s:function(){e=e.call(r)},n:function(){var v=e.next();return o=v.done,v},e:function(v){c=!0,s=v},f:function(){try{o||e.return==null||e.return()}finally{if(c)throw s}}}}var b=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=r.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=r.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==r.JOIN_ROUND&&(this._quadrantSegments=r.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(t){this._joinStyle=t}},{key:"setSimplifyFactor",value:function(t){this._simplifyFactor=t<0?0:t}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(t){this._endCapStyle=t}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(t){this._mitreLimit=t}},{key:"setSingleSided",value:function(t){this._isSingleSided=t}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=r.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=r.CAP_ROUND,this._joinStyle=r.JOIN_ROUND,this._mitreLimit=r.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=r.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(n)}else if(arguments.length===4){var i=arguments[0],s=arguments[1],o=arguments[2],c=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(s),this.setJoinStyle(o),this.setMitreLimit(c)}}}},{key:"bufferDistanceError",value:function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)}}]),r}();b.CAP_ROUND=1,b.CAP_FLAT=2,b.CAP_SQUARE=3,b.JOIN_ROUND=1,b.JOIN_MITRE=2,b.JOIN_BEVEL=3,b.DEFAULT_QUADRANT_SEGMENTS=8,b.DEFAULT_MITRE_LIMIT=5,b.DEFAULT_SIMPLIFY_FACTOR=.01;var q=function(r){g(e,r);var t=_(e);function e(n){var i;return a(this,e),(i=t.call(this,n)).name=Object.keys({Exception:e})[0],i}return h(e,[{key:"toString",value:function(){return this.message}}]),e}(N(Error)),G=function(r){g(e,r);var t=_(e);function e(n){var i;return a(this,e),(i=t.call(this,n)).name=Object.keys({IllegalArgumentException:e})[0],i}return e}(q),B=function(){function r(){a(this,r)}return h(r,[{key:"filter",value:function(t){}}]),r}();function X(){}function V(){}function U(){}var st,et,rt,ot,z,nt,lt,gt,kt=function(){function r(){a(this,r)}return h(r,null,[{key:"equalsWithTolerance",value:function(t,e,n){return Math.abs(t-e)<=n}}]),r}(),Et=function(){function r(t,e){a(this,r),this.low=e||0,this.high=t||0}return h(r,null,[{key:"toBinaryString",value:function(t){var e,n="";for(e=2147483648;e>0;e>>>=1)n+=(t.high&e)===e?"1":"0";for(e=2147483648;e>0;e>>>=1)n+=(t.low&e)===e?"1":"0";return n}}]),r}();function H(){}function Lt(){}H.NaN=NaN,H.isNaN=function(r){return Number.isNaN(r)},H.isInfinite=function(r){return!Number.isFinite(r)},H.MAX_VALUE=Number.MAX_VALUE,H.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,H.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(nt=2146435072,lt=new Float64Array(1),gt=new Int32Array(lt.buffer),H.doubleToLongBits=function(r){lt[0]=r;var t=0|gt[0],e=0|gt[1];return(e&nt)===nt&&1048575&e&&t!==0&&(t=0,e=2146959360),new Et(e,t)},H.longBitsToDouble=function(r){return gt[0]=r.low,gt[1]=r.high,lt[0]}):(st=1023,et=Math.log2,rt=Math.floor,ot=Math.pow,z=function(){for(var r=53;r>0;r--){var t=ot(2,r)-1;if(rt(et(t))+1===r)return t}return 0}(),H.doubleToLongBits=function(r){var t,e,n,i,s,o,c,v,y;if(r<0||1/r===Number.NEGATIVE_INFINITY?(o=1<<31,r=-r):o=0,r===0)return new Et(v=o,y=0);if(r===1/0)return new Et(v=2146435072|o,y=0);if(r!=r)return new Et(v=2146959360,y=0);if(i=0,y=0,(t=rt(r))>1)if(t<=z)(i=rt(et(t)))<=20?(y=0,v=t<<20-i&1048575):(y=t%(e=ot(2,n=i-20))<<32-n,v=t/e&1048575);else for(n=t,y=0;(n=rt(e=n/2))!==0;)i++,y>>>=1,y|=(1&v)<<31,v>>>=1,e!==n&&(v|=524288);if(c=i+st,s=t===0,t=r-t,i<52&&t!==0)for(n=0;;){if((e=2*t)>=1?(t=e-1,s?(c--,s=!1):(n<<=1,n|=1,i++)):(t=e,s?--c==0&&(i++,s=!1):(n<<=1,i++)),i===20)v|=n,n=0;else if(i===52){y|=n;break}if(e===1){i<20?v|=n<<20-i:i<52&&(y|=n<<52-i);break}}return v|=c<<20,new Et(v|=o,y)},H.longBitsToDouble=function(r){var t,e,n,i,s=r.high,o=r.low,c=s&1<<31?-1:1;for(n=((2146435072&s)>>20)-st,i=0,e=1<<19,t=1;t<=20;t++)s&e&&(i+=ot(2,-t)),e>>>=1;for(e=1<<31,t=21;t<=52;t++)o&e&&(i+=ot(2,-t)),e>>>=1;if(n===-1023){if(i===0)return 0*c;n=-1022}else{if(n===1024)return i===0?c/0:NaN;i+=1}return c*i*ot(2,n)});var It=function(r){g(e,r);var t=_(e);function e(n){var i;return a(this,e),(i=t.call(this,n)).name=Object.keys({RuntimeException:e})[0],i}return e}(q),Rt=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,null,[{key:"constructor_",value:function(){if(arguments.length===0)It.constructor_.call(this);else if(arguments.length===1){var n=arguments[0];It.constructor_.call(this,n)}}}]),e}(It),it=function(){function r(){a(this,r)}return h(r,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)r.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new Rt("Should never reach here"+(t!==null?": "+t:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var t=arguments[0];r.isTrue(t,null)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(!e)throw n===null?new Rt:new Rt(n)}}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];r.equals(t,e,null)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];if(!i.equals(n))throw new Rt("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))}}}]),r}(),ne=new ArrayBuffer(8),lu=new Float64Array(ne),Fr=new Int32Array(ne),T=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getM",value:function(){return H.NaN}},{key:"setOrdinate",value:function(t,e){switch(t){case r.X:this.x=e;break;case r.Y:this.y=e;break;case r.Z:this.setZ(e);break;default:throw new G("Invalid ordinate index: "+t)}}},{key:"equals2D",value:function(){if(arguments.length===1){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(arguments.length===2){var e=arguments[0],n=arguments[1];return!!kt.equalsWithTolerance(this.x,e.x,n)&&!!kt.equalsWithTolerance(this.y,e.y,n)}}},{key:"setM",value:function(t){throw new G("Invalid ordinate index: "+r.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(t){switch(t){case r.X:return this.x;case r.Y:return this.y;case r.Z:return this.getZ()}throw new G("Invalid ordinate index: "+t)}},{key:"equals3D",value:function(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||H.isNaN(this.getZ())&&H.isNaN(t.getZ()))}},{key:"equals",value:function(t){return t instanceof r&&this.equals2D(t)}},{key:"equalInZ",value:function(t,e){return kt.equalsWithTolerance(this.getZ(),t.getZ(),e)}},{key:"setX",value:function(t){this.x=t}},{key:"compareTo",value:function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(t){this.z=t}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return it.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}},{key:"copy",value:function(){return new r(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.getZ()-t.getZ();return Math.sqrt(e*e+n*n+i*i)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(t){this.y=t}},{key:"distance",value:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*t+r.hashCode(this.x))+r.hashCode(this.y)}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}},{key:"interfaces_",get:function(){return[X,V,U]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)r.constructor_.call(this,0,0);else if(arguments.length===1){var t=arguments[0];r.constructor_.call(this,t.x,t.y,t.getZ())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];r.constructor_.call(this,e,n,r.NULL_ORDINATE)}else if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2];this.x=i,this.y=s,this.z=o}}},{key:"hashCode",value:function(t){return lu[0]=t,Fr[0]^Fr[1]}}]),r}(),hu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"compare",value:function(t,e){var n=r.compare(t.x,e.x);if(n!==0)return n;var i=r.compare(t.y,e.y);return i!==0?i:this._dimensionsToTest<=2?0:r.compare(t.getZ(),e.getZ())}},{key:"interfaces_",get:function(){return[Lt]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)r.constructor_.call(this,2);else if(arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new G("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}},{key:"compare",value:function(t,e){return t<e?-1:t>e?1:H.isNaN(t)?H.isNaN(e)?0:-1:H.isNaN(e)?1:0}}]),r}();T.DimensionalComparator=hu,T.NULL_ORDINATE=H.NaN,T.X=0,T.Y=1,T.Z=2,T.M=3;var vt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(t){if(!(t instanceof r))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()}},{key:"intersection",value:function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new r;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny;return new r(e,this._maxx<t._maxx?this._maxx:t._maxx,n,this._maxy<t._maxy?this._maxy:t._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof T){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof r){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof r){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof T){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(arguments.length===2){if(arguments[0]instanceof T&&arguments[1]instanceof T){var n=arguments[0],i=arguments[1];if(this.isNull())return!1;var s=n.x<i.x?n.x:i.x;if(s>this._maxx)return!1;var o=n.x>i.x?n.x:i.x;if(o<this._minx)return!1;var c=n.y<i.y?n.y:i.y;if(c>this._maxy)return!1;var v=n.y>i.y?n.y:i.y;return!(v<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var y=arguments[0],E=arguments[1];return!this.isNull()&&!(y>this._maxx||y<this._minx||E>this._maxy||E<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return Math.sqrt(t*t+e*e)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof T){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof r){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),i<this._miny&&(this._miny=i),i>this._maxy&&(this._maxy=i))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0}},{key:"translate",value:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}},{key:"copy",value:function(){return new r(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(t){return!(!this.isNull()&&!t.isNull())||t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e}},{key:"expandBy",value:function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof r){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof T){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}}},{key:"centre",value:function(){return this.isNull()?null:new T((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof T){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof r){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var s=arguments[0],o=arguments[1],c=arguments[2],v=arguments[3];s<o?(this._minx=s,this._maxx=o):(this._minx=o,this._maxx=s),c<v?(this._miny=c,this._maxy=v):(this._miny=v,this._maxy=c)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+T.hashCode(this._minx))+T.hashCode(this._maxx))+T.hashCode(this._miny))+T.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[X,U]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof T){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof r){var e=arguments[0];this.init(e)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var s=arguments[0],o=arguments[1],c=arguments[2],v=arguments[3];this.init(s,o,c,v)}}},{key:"intersects",value:function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(arguments.length===4){var i=arguments[0],s=arguments[1],o=arguments[2],c=arguments[3],v=Math.min(o.x,c.x),y=Math.max(o.x,c.x),E=Math.min(i.x,s.x),L=Math.max(i.x,s.x);return!(E>y)&&!(L<v)&&(v=Math.min(o.y,c.y),y=Math.max(o.y,c.y),E=Math.min(i.y,s.y),L=Math.max(i.y,s.y),!(E>y)&&!(L<v))}}}]),r}(),$=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===r.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(t){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(t){return this===t||this.equalsExact(t,0)}},{key:"geometryChanged",value:function(){this.apply(r.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(t){return t!==null&&this.norm().equalsExact(t.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var t;if(arguments.length===1){var e=arguments[0];return t=e,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(e)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return t=n,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(n,i)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(t){if(t.getTypeCode()===r.TYPECODE_GEOMETRYCOLLECTION)throw new G("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(t,e,n){return n===0?t.equals(e):t.distance(e)<=n}},{key:"norm",value:function(){var t=this.copy();return t.normalize(),t}},{key:"reverse",value:function(){var t=this.reverseInternal();return this.envelope!=null&&(t.envelope=this.envelope.copy()),t.setSRID(this.getSRID()),t}},{key:"copy",value:function(){var t=this.copyInternal();return t.envelope=this._envelope==null?null:this._envelope.copy(),t._SRID=this._SRID,t._userData=this._userData,t}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new vt(this._envelope)}},{key:"setSRID",value:function(t){this._SRID=t}},{key:"setUserData",value:function(t){this._userData=t}},{key:"compare",value:function(t,e){for(var n=t.iterator(),i=e.iterator();n.hasNext()&&i.hasNext();){var s=n.next(),o=i.next(),c=s.compareTo(o);if(c!==0)return c}return n.hasNext()?1:i.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(t){return this.getClass()===t.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===r.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===r.TYPECODE_MULTIPOINT||this.getTypeCode()===r.TYPECODE_MULTILINESTRING||this.getTypeCode()===r.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[V,X,U]}},{key:"getClass",value:function(){return r}}],[{key:"hasNonEmptyElements",value:function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(t){for(var e=0;e<t.length;e++)if(t[e]===null)return!0;return!1}}]),r}();$.constructor_=function(r){r&&(this._envelope=null,this._userData=null,this._factory=r,this._SRID=r.getSRID())},$.TYPECODE_POINT=0,$.TYPECODE_MULTIPOINT=1,$.TYPECODE_LINESTRING=2,$.TYPECODE_LINEARRING=3,$.TYPECODE_MULTILINESTRING=4,$.TYPECODE_POLYGON=5,$.TYPECODE_MULTIPOLYGON=6,$.TYPECODE_GEOMETRYCOLLECTION=7,$.TYPENAME_POINT="Point",$.TYPENAME_MULTIPOINT="MultiPoint",$.TYPENAME_LINESTRING="LineString",$.TYPENAME_LINEARRING="LinearRing",$.TYPENAME_MULTILINESTRING="MultiLineString",$.TYPENAME_POLYGON="Polygon",$.TYPENAME_MULTIPOLYGON="MultiPolygon",$.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",$.geometryChangedFilter={get interfaces_(){return[B]},filter:function(r){r.geometryChangedAction()}};var k=function(){function r(){a(this,r)}return h(r,null,[{key:"toLocationSymbol",value:function(t){switch(t){case r.EXTERIOR:return"e";case r.BOUNDARY:return"b";case r.INTERIOR:return"i";case r.NONE:return"-"}throw new G("Unknown location value: "+t)}}]),r}();k.INTERIOR=0,k.BOUNDARY=1,k.EXTERIOR=2,k.NONE=-1;var Wt=function(){function r(){a(this,r)}return h(r,[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}]),r}(),Cn=function(r){g(e,r);var t=_(e);function e(n){var i;return a(this,e),(i=t.call(this,n)).name=Object.keys({NoSuchElementException:e})[0],i}return e}(q),ve=function(r){g(e,r);var t=_(e);function e(n){var i;return a(this,e),(i=t.call(this,n)).name=Object.keys({UnsupportedOperationException:e})[0],i}return e}(q),Gr=function(r){g(e,r);var t=_(e);function e(){return a(this,e),t.apply(this,arguments)}return h(e,[{key:"contains",value:function(){}}]),e}(Wt),ui=function(r,t){g(n,r);var e=_(n);function n(i){var s;return a(this,n),(s=e.call(this)).map=new Map,i instanceof Wt&&s.addAll(i),s}return h(n,[{key:"contains",value:function(i){var s=i.hashCode?i.hashCode():i;return!!this.map.has(s)}},{key:"add",value:function(i){var s=i.hashCode?i.hashCode():i;return!this.map.has(s)&&!!this.map.set(s,i)}},{key:"addAll",value:function(i){var s,o=M(i);try{for(o.s();!(s=o.n()).done;){var c=s.value;this.add(c)}}catch(v){o.e(v)}finally{o.f()}return!0}},{key:"remove",value:function(){throw new ve}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new cu(this.map)}},{key:t,value:function(){return this.map}}]),n}(Gr,Symbol.iterator),cu=function(){function r(t){a(this,r),this.iterator=t.values();var e=this.iterator.next(),n=e.done,i=e.value;this.done=n,this.value=i}return h(r,[{key:"next",value:function(){if(this.done)throw new Cn;var t=this.value,e=this.iterator.next(),n=e.done,i=e.value;return this.done=n,this.value=i,t}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new ve}}]),r}(),F=function(){function r(){a(this,r)}return h(r,null,[{key:"opposite",value:function(t){return t===r.LEFT?r.RIGHT:t===r.RIGHT?r.LEFT:t}}]),r}();F.ON=0,F.LEFT=1,F.RIGHT=2;var qr=function(r){g(e,r);var t=_(e);function e(n){var i;return a(this,e),(i=t.call(this,n)).name=Object.keys({EmptyStackException:e})[0],i}return e}(q),Yr=function(r){g(e,r);var t=_(e);function e(n){var i;return a(this,e),(i=t.call(this,n)).name=Object.keys({IndexOutOfBoundsException:e})[0],i}return e}(q),de=function(r){g(e,r);var t=_(e);function e(){return a(this,e),t.apply(this,arguments)}return h(e,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}]),e}(Wt),fu=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),(n=t.call(this)).array=[],n}return h(e,[{key:"add",value:function(n){return this.array.push(n),!0}},{key:"get",value:function(n){if(n<0||n>=this.size())throw new Yr;return this.array[n]}},{key:"push",value:function(n){return this.array.push(n),n}},{key:"pop",value:function(){if(this.array.length===0)throw new qr;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new qr;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(n){return this.array.indexOf(n)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}]),e}(de);function tt(r,t){return r.interfaces_&&r.interfaces_.indexOf(t)>-1}var Ke=function(){function r(t){a(this,r),this.str=t}return h(r,[{key:"append",value:function(t){this.str+=t}},{key:"setCharAt",value:function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}},{key:"toString",value:function(){return this.str}}]),r}(),Rn=function(){function r(t){a(this,r),this.value=t}return h(r,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(t){return this.value<t?-1:this.value>t?1:0}}],[{key:"compare",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"isNan",value:function(t){return Number.isNaN(t)}},{key:"valueOf",value:function(t){return new r(t)}}]),r}(),oi=function(){function r(){a(this,r)}return h(r,null,[{key:"isWhitespace",value:function(t){return t<=32&&t>=0||t===127}},{key:"toUpperCase",value:function(t){return t.toUpperCase()}}]),r}(),Q=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"le",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo}},{key:"extractSignificantDigits",value:function(t,e){var n=this.abs(),i=r.magnitude(n._hi),s=r.TEN.pow(i);(n=n.divide(s)).gt(r.TEN)?(n=n.divide(r.TEN),i+=1):n.lt(r.ONE)&&(n=n.multiply(r.TEN),i-=1);for(var o=i+1,c=new Ke,v=r.MAX_PRINT_DIGITS-1,y=0;y<=v;y++){t&&y===o&&c.append(".");var E=Math.trunc(n._hi);if(E<0)break;var L=!1,C=0;E>9?(L=!0,C="9"):C="0"+E,c.append(C),n=n.subtract(r.valueOf(E)).multiply(r.TEN),L&&n.selfAdd(r.TEN);var D=!0,P=r.magnitude(n._hi);if(P<0&&Math.abs(P)>=v-y&&(D=!1),!D)break}return e[0]=i,c.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof r){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof r){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof r){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(t){return this.le(t)?this:t}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof r){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=null,o=null,c=null,v=null,y=null,E=null,L=null,C=null;return y=this._hi/n,C=(s=(E=r.SPLIT*y)-(s=E-y))*(c=(C=r.SPLIT*n)-(c=C-n))-(L=y*n)+s*(v=n-c)+(o=y-s)*c+o*v,C=y+(E=(this._hi-L-C+this._lo-y*i)/n),this._hi=C,this._lo=y-C+E,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof r){var t=arguments[0],e=null,n=null,i=null,s=null,o=null,c=null,v=null,y=null;n=(o=this._hi/t._hi)-(e=(c=r.SPLIT*o)-(e=c-o)),y=e*(i=(y=r.SPLIT*t._hi)-(i=y-t._hi))-(v=o*t._hi)+e*(s=t._hi-i)+n*i+n*s;var E=y=o+(c=(this._hi-v-y+this._lo-o*t._lo)/t._hi),L=o-y+c;return new r(E,L)}if(typeof arguments[0]=="number"){var C=arguments[0];return H.isNaN(C)?r.createNaN():r.copy(this).selfDivide(C,0)}}},{key:"ge",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}},{key:"pow",value:function(t){if(t===0)return r.valueOf(1);var e=new r(this),n=r.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2==1&&n.selfMultiply(e),(i/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n}},{key:"ceil",value:function(){if(this.isNaN())return r.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new r(t,e)}},{key:"compareTo",value:function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof r){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}}},{key:"max",value:function(t){return this.ge(t)?this:t}},{key:"sqrt",value:function(){if(this.isZero())return r.valueOf(0);if(this.isNegative())return r.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=r.valueOf(e),i=this.subtract(n.sqr())._hi*(.5*t);return n.add(i)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof r){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0],n=null,i=null,s=null,o=null,c=null,v=null;return o=(s=this._hi+e)-(c=s-this._hi),i=(v=(o=e-c+(this._hi-o))+this._lo)+(s-(n=s+v)),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var y=arguments[0],E=arguments[1],L=null,C=null,D=null,P=null,Z=null,j=null,K=null;P=this._hi+y,C=this._lo+E,Z=P-(j=P-this._hi),D=C-(K=C-this._lo);var ct=(L=P+(j=(Z=y-j+(this._hi-Z))+C))+(j=(D=E-K+(this._lo-D))+(j+(P-L))),pt=j+(L-ct);return this._hi=ct,this._lo=pt,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof r){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=null,o=null,c=null,v=null,y=null,E=null;s=(y=r.SPLIT*this._hi)-this._hi,E=r.SPLIT*n,s=y-s,o=this._hi-s,c=E-n;var L=(y=this._hi*n)+(E=s*(c=E-c)-y+s*(v=n-c)+o*c+o*v+(this._hi*i+this._lo*n)),C=E+(s=y-L);return this._hi=L,this._lo=C,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return r.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new r(t,e)}},{key:"negate",value:function(){return this.isNaN()?this:new r(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}},{key:"multiply",value:function(){if(arguments[0]instanceof r){var t=arguments[0];return t.isNaN()?r.createNaN():r.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return H.isNaN(e)?r.createNaN():r.copy(this).selfMultiply(e,0)}}},{key:"isNaN",value:function(){return H.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var t=r.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,s=n;if(n.charAt(0)===".")s="0"+n;else if(i<0)s="0."+r.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var o=i-n.length;s=n+r.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+s:s}},{key:"reciprocal",value:function(){var t,e,n,i,s=null,o=null,c=null,v=null;t=(n=1/this._hi)-(s=(c=r.SPLIT*n)-(s=c-n)),o=(v=r.SPLIT*this._hi)-this._hi;var y=n+(c=(1-(i=n*this._hi)-(v=s*(o=v-o)-i+s*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new r(y,n-y+c)}},{key:"toSciNotation",value:function(){if(this.isZero())return r.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=r.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+n);var s="";n.length>1&&(s=n.substring(1));var o=n.charAt(0)+"."+s;return this.isNegative()?"-"+o+i:o+i}},{key:"abs",value:function(){return this.isNaN()?r.NaN:this.isNegative()?this.negate():new r(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<t._lo}},{key:"add",value:function(){if(arguments[0]instanceof r){var t=arguments[0];return r.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return r.copy(this).selfAdd(e)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof r){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._hi=n,this._lo=i}}},{key:"gt",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>t._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?r.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[U,X,V]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof r){var e=arguments[0];this.init(e)}else if(typeof arguments[0]=="string"){var n=arguments[0];r.constructor_.call(this,r.parse(n))}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.init(i,s)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];return r.determinant(r.valueOf(t),r.valueOf(e),r.valueOf(n),r.valueOf(i))}if(arguments[3]instanceof r&&arguments[2]instanceof r&&arguments[0]instanceof r&&arguments[1]instanceof r){var s=arguments[0],o=arguments[1],c=arguments[2],v=arguments[3],y=s.multiply(v).selfSubtract(o.multiply(c));return y}}},{key:"sqr",value:function(t){return r.valueOf(t).selfMultiply(t)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var t=arguments[0];return r.parse(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return new r(e)}}},{key:"sqrt",value:function(t){return r.valueOf(t).sqrt()}},{key:"parse",value:function(t){for(var e=0,n=t.length;oi.isWhitespace(t.charAt(e));)e++;var i=!1;if(e<n){var s=t.charAt(e);s!=="-"&&s!=="+"||(e++,s==="-"&&(i=!0))}for(var o=new r,c=0,v=0,y=0,E=!1;!(e>=n);){var L=t.charAt(e);if(e++,oi.isDigit(L)){var C=L-"0";o.selfMultiply(r.TEN),o.selfAdd(C),c++}else{if(L!=="."){if(L==="e"||L==="E"){var D=t.substring(e);try{y=Rn.parseInt(D)}catch(ct){throw ct instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+D+" in string "+t):ct}break}throw new NumberFormatException("Unexpected character '"+L+"' at position "+e+" in string "+t)}v=c,E=!0}}var P=o;E||(v=c);var Z=c-v-y;if(Z===0)P=o;else if(Z>0){var j=r.TEN.pow(Z);P=o.divide(j)}else if(Z<0){var K=r.TEN.pow(-Z);P=o.multiply(K)}return i?P.negate():P}},{key:"createNaN",value:function(){return new r(H.NaN,H.NaN)}},{key:"copy",value:function(t){return new r(t)}},{key:"magnitude",value:function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),i=Math.trunc(Math.floor(n));return 10*Math.pow(10,i)<=e&&(i+=1),i}},{key:"stringOfChar",value:function(t,e){for(var n=new Ke,i=0;i<e;i++)n.append(t);return n.toString()}}]),r}();Q.PI=new Q(3.141592653589793,12246467991473532e-32),Q.TWO_PI=new Q(6.283185307179586,24492935982947064e-32),Q.PI_2=new Q(1.5707963267948966,6123233995736766e-32),Q.E=new Q(2.718281828459045,14456468917292502e-32),Q.NaN=new Q(H.NaN,H.NaN),Q.EPS=123259516440783e-46,Q.SPLIT=134217729,Q.MAX_PRINT_DIGITS=32,Q.TEN=Q.valueOf(10),Q.ONE=Q.valueOf(1),Q.SCI_NOT_EXPONENT_CHAR="E",Q.SCI_NOT_ZERO="0.0E0";var li=function(){function r(){a(this,r)}return h(r,null,[{key:"orientationIndex",value:function(t,e,n){var i=r.orientationIndexFilter(t,e,n);if(i<=1)return i;var s=Q.valueOf(e.x).selfAdd(-t.x),o=Q.valueOf(e.y).selfAdd(-t.y),c=Q.valueOf(n.x).selfAdd(-e.x),v=Q.valueOf(n.y).selfAdd(-e.y);return s.selfMultiply(v).selfSubtract(o.selfMultiply(c)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof Q&&arguments[2]instanceof Q&&arguments[0]instanceof Q&&arguments[1]instanceof Q){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3],s=t.multiply(i).selfSubtract(e.multiply(n));return s.signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var o=arguments[0],c=arguments[1],v=arguments[2],y=arguments[3],E=Q.valueOf(o),L=Q.valueOf(c),C=Q.valueOf(v),D=Q.valueOf(y),P=E.multiply(D).selfSubtract(L.multiply(C));return P.signum()}}},{key:"intersection",value:function(t,e,n,i){var s=new Q(t.y).selfSubtract(e.y),o=new Q(e.x).selfSubtract(t.x),c=new Q(t.x).selfMultiply(e.y).selfSubtract(new Q(e.x).selfMultiply(t.y)),v=new Q(n.y).selfSubtract(i.y),y=new Q(i.x).selfSubtract(n.x),E=new Q(n.x).selfMultiply(i.y).selfSubtract(new Q(i.x).selfMultiply(n.y)),L=o.multiply(E).selfSubtract(y.multiply(c)),C=v.multiply(c).selfSubtract(s.multiply(E)),D=s.multiply(y).selfSubtract(v.multiply(o)),P=L.selfDivide(D).doubleValue(),Z=C.selfDivide(D).doubleValue();return H.isNaN(P)||H.isInfinite(P)||H.isNaN(Z)||H.isInfinite(Z)?null:new T(P,Z)}},{key:"orientationIndexFilter",value:function(t,e,n){var i=null,s=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),c=s-o;if(s>0){if(o<=0)return r.signum(c);i=s+o}else{if(!(s<0)||o>=0)return r.signum(c);i=-s-o}var v=r.DP_SAFE_EPSILON*i;return c>=v||-c>=v?r.signum(c):2}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}}]),r}();li.DP_SAFE_EPSILON=1e-15;var at=function(){function r(){a(this,r)}return h(r,[{key:"getM",value:function(t){if(this.hasM()){var e=this.getDimension()-this.getMeasures();return this.getOrdinate(t,e)}return H.NaN}},{key:"setOrdinate",value:function(t,e,n){}},{key:"getZ",value:function(t){return this.hasZ()?this.getOrdinate(t,2):H.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(t,e){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(t){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(t){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(t){}},{key:"copy",value:function(){}},{key:"getY",value:function(t){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[V]}}]),r}();at.X=0,at.Y=1,at.Z=2,at.M=3;var J=function(){function r(){a(this,r)}return h(r,null,[{key:"index",value:function(t,e,n){return li.orientationIndex(t,e,n)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var t=arguments[0],e=t.length-1;if(e<3)throw new G("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],i=0,s=1;s<=e;s++){var o=t[s];o.y>n.y&&(n=o,i=s)}var c=i;do(c-=1)<0&&(c=e);while(t[c].equals2D(n)&&c!==i);var v=i;do v=(v+1)%e;while(t[v].equals2D(n)&&v!==i);var y=t[c],E=t[v];if(y.equals2D(n)||E.equals2D(n)||y.equals2D(E))return!1;var L=r.index(y,n,E),C=null;return C=L===0?y.x>E.x:L>0,C}if(tt(arguments[0],at)){var D=arguments[0],P=D.size()-1;if(P<3)throw new G("Ring has fewer than 4 points, so orientation cannot be determined");for(var Z=D.getCoordinate(0),j=0,K=1;K<=P;K++){var ct=D.getCoordinate(K);ct.y>Z.y&&(Z=ct,j=K)}var pt=null,St=j;do(St-=1)<0&&(St=P),pt=D.getCoordinate(St);while(pt.equals2D(Z)&&St!==j);var Dt=null,Zt=j;do Zt=(Zt+1)%P,Dt=D.getCoordinate(Zt);while(Dt.equals2D(Z)&&Zt!==j);if(pt.equals2D(Z)||Dt.equals2D(Z)||pt.equals2D(Dt))return!1;var ae=r.index(pt,Z,Dt);return ae===0?pt.x>Dt.x:ae>0}}}]),r}();J.CLOCKWISE=-1,J.RIGHT=J.CLOCKWISE,J.COUNTERCLOCKWISE=1,J.LEFT=J.COUNTERCLOCKWISE,J.COLLINEAR=0,J.STRAIGHT=J.COLLINEAR;var gu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n}},{key:"findRightmostEdgeAtVertex",value:function(){var t=this._minDe.getEdge().getCoordinates();it.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],i=J.index(this._minCoord,n,e),s=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&i===J.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&i===J.CLOCKWISE)&&(s=!0),s&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length||n[e].y===n[e+1].y)return-1;var i=F.LEFT;return n[e].y<n[e+1].y&&(i=F.RIGHT),i}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(t){for(var e=t.getEdge().getCoordinates(),n=0;n<e.length-1;n++)(this._minCoord===null||e[n].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])}},{key:"findRightmostEdgeAtNode",value:function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}it.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===F.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}]),r}(),ie=function(r){g(e,r);var t=_(e);function e(n,i){var s;return a(this,e),(s=t.call(this,i?n+" [ "+i+" ]":n)).pt=i?new T(i):void 0,s.name=Object.keys({TopologyException:e})[0],s}return h(e,[{key:"getCoordinate",value:function(){return this.pt}}]),e}(It),vu=function(){function r(){a(this,r),this.array=[]}return h(r,[{key:"addLast",value:function(t){this.array.push(t)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}]),r}(),W=function(r,t){g(n,r);var e=_(n);function n(i){var s;return a(this,n),(s=e.call(this)).array=[],i instanceof Wt&&s.addAll(i),s}return h(n,[{key:"interfaces_",get:function(){return[de,Wt]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(i){return arguments.length===1?this.array.push(i):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(i){var s,o=M(i);try{for(o.s();!(s=o.n()).done;){var c=s.value;this.array.push(c)}}catch(v){o.e(v)}finally{o.f()}}},{key:"set",value:function(i,s){var o=this.array[i];return this.array[i]=s,o}},{key:"iterator",value:function(){return new yu(this)}},{key:"get",value:function(i){if(i<0||i>=this.size())throw new Yr;return this.array[i]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(i){i?this.array.sort(function(s,o){return i.compare(s,o)}):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(i){for(var s=0,o=this.array.length;s<o;s++)if(this.array[s]===i)return!!this.array.splice(s,1);return!1}},{key:t,value:function(){return this.array.values()}}]),n}(de,Symbol.iterator),yu=function(){function r(t){a(this,r),this.arrayList=t,this.position=0}return h(r,[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new Cn;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(t){return this.arrayList.set(this.position-1,t)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}]),r}(),mu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"clearVisitedEdges",value:function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var i=n.next();if(i.isVisited()||i.getSym().isVisited()){e=i;break}}if(e===null)throw new ie("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var s=t.getEdges().iterator();s.hasNext();){var o=s.next();o.setVisited(!0),this.copySymDepths(o)}}},{key:"computeDepth",value:function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.getNode(),e.getLabel(),e.setEdgeDepths(F.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)}},{key:"create",value:function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(F.RIGHT)>=1&&e.getDepth(F.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}}},{key:"computeDepths",value:function(t){var e=new ui,n=new vu,i=t.getNode();for(n.addLast(i),e.add(i),t.setVisited(!0);!n.isEmpty();){var s=n.removeFirst();e.add(s),this.computeNodeDepth(s);for(var o=s.getEdges().iterator();o.hasNext();){var c=o.next().getSym();if(!c.isVisited()){var v=c.getNode();e.contains(v)||(n.addLast(v),e.add(v))}}}}},{key:"compareTo",value:function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var t=new vt,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),i=0;i<n.length-1;i++)t.expandToInclude(n[i]);this._env=t}return this._env}},{key:"addReachable",value:function(t){var e=new fu;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}}},{key:"copySymDepths",value:function(t){var e=t.getSym();e.setDepth(F.LEFT,t.getDepth(F.RIGHT)),e.setDepth(F.RIGHT,t.getDepth(F.LEFT))}},{key:"add",value:function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var i=n.next();this._dirEdgeList.add(i);var s=i.getSym().getNode();s.isVisited()||e.push(s)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new W,this._nodes=new W,this._rightMostCoord=null,this._env=null,this._finder=new gu}}]),r}(),hi=function(){function r(){a(this,r)}return h(r,null,[{key:"intersection",value:function(t,e,n,i){var s=t.x<e.x?t.x:e.x,o=t.y<e.y?t.y:e.y,c=t.x>e.x?t.x:e.x,v=t.y>e.y?t.y:e.y,y=n.x<i.x?n.x:i.x,E=n.y<i.y?n.y:i.y,L=n.x>i.x?n.x:i.x,C=n.y>i.y?n.y:i.y,D=((s>y?s:y)+(c<L?c:L))/2,P=((o>E?o:E)+(v<C?v:C))/2,Z=t.x-D,j=t.y-P,K=e.x-D,ct=e.y-P,pt=n.x-D,St=n.y-P,Dt=i.x-D,Zt=i.y-P,ae=j-ct,Ne=K-Z,ln=Z*ct-K*j,hn=St-Zt,Xe=Dt-pt,ws=pt*Zt-Dt*St,Ls=ae*Xe-hn*Ne,wi=(Ne*ws-Xe*ln)/Ls,Li=(hn*ln-ae*ws)/Ls;return H.isNaN(wi)||H.isInfinite(wi)||H.isNaN(Li)||H.isInfinite(Li)?null:new T(wi+D,Li+P)}}]),r}(),qt=function(){function r(){a(this,r)}return h(r,null,[{key:"arraycopy",value:function(t,e,n,i,s){for(var o=0,c=e;c<e+s;c++)n[i+o]=t[c],o++}},{key:"getProperty",value:function(t){return{"line.separator":`
|
|
25
|
-
`}[t]}}]),r}(),tn=function(){function r(){a(this,r)}return h(r,null,[{key:"log10",value:function(t){var e=Math.log(t);return H.isInfinite(e)||H.isNaN(e)?e:e/r.LOG_10}},{key:"min",value:function(t,e,n,i){var s=t;return e<s&&(s=e),n<s&&(s=n),i<s&&(s=i),s}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],s=arguments[1],o=arguments[2];return i<s?s:i>o?o:i}}},{key:"wrap",value:function(t,e){return t<0?e- -t%e:t%e}},{key:"max",value:function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}if(arguments.length===4){var s=arguments[0],o=arguments[1],c=arguments[2],v=arguments[3],y=s;return o>y&&(y=o),c>y&&(y=c),v>y&&(y=v),y}}},{key:"average",value:function(t,e){return(t+e)/2}}]),r}();tn.LOG_10=Math.log(10);var Qt=function(){function r(){a(this,r)}return h(r,null,[{key:"segmentToSegment",value:function(t,e,n,i){if(t.equals(e))return r.pointToSegment(t,n,i);if(n.equals(i))return r.pointToSegment(i,t,e);var s=!1;if(vt.intersects(t,e,n,i)){var o=(e.x-t.x)*(i.y-n.y)-(e.y-t.y)*(i.x-n.x);if(o===0)s=!0;else{var c=(t.y-n.y)*(i.x-n.x)-(t.x-n.x)*(i.y-n.y),v=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,y=c/o;(y<0||y>1||v<0||v>1)&&(s=!0)}}else s=!0;return s?tn.min(r.pointToSegment(t,n,i),r.pointToSegment(e,n,i),r.pointToSegment(n,t,e),r.pointToSegment(i,t,e)):0}},{key:"pointToSegment",value:function(t,e,n){if(e.x===n.x&&e.y===n.y)return t.distance(e);var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),s=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/i;if(s<=0)return t.distance(e);if(s>=1)return t.distance(n);var o=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(o)*Math.sqrt(i)}},{key:"pointToLinePerpendicular",value:function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),s=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(s)*Math.sqrt(i)}},{key:"pointToSegmentString",value:function(t,e){if(e.length===0)throw new G("Line array must contain at least one vertex");for(var n=t.distance(e[0]),i=0;i<e.length-1;i++){var s=r.pointToSegment(t,e[i],e[i+1]);s<n&&(n=s)}return n}}]),r}(),zr=function(){function r(){a(this,r)}return h(r,[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||tt(arguments[0],at);else if(arguments.length!==2){if(arguments.length===3){var t=arguments[0],e=arguments[1];return this.create(t,e)}}}}]),r}(),On=function(){function r(){a(this,r)}return h(r,[{key:"filter",value:function(t){}}]),r}(),du=function(){function r(){a(this,r)}return h(r,null,[{key:"ofLine",value:function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new T;t.getCoordinate(0,i);for(var s=i.x,o=i.y,c=1;c<e;c++){t.getCoordinate(c,i);var v=i.x,y=i.y,E=v-s,L=y-o;n+=Math.sqrt(E*E+L*L),s=v,o=y}return n}}]),r}(),Br=function r(){a(this,r)},pe=function(){function r(){a(this,r)}return h(r,null,[{key:"copyCoord",value:function(t,e,n,i){for(var s=Math.min(t.getDimension(),n.getDimension()),o=0;o<s;o++)n.setOrdinate(i,o,t.getOrdinate(e,o))}},{key:"isRing",value:function(t){var e=t.size();return e===0||!(e<=3)&&t.getOrdinate(0,at.X)===t.getOrdinate(e-1,at.X)&&t.getOrdinate(0,at.Y)===t.getOrdinate(e-1,at.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(tt(arguments[0],at)&&Number.isInteger(arguments[1])){var t=arguments[0],e=arguments[1];r.scroll(t,e,r.isRing(t))}else if(tt(arguments[0],at)&&arguments[1]instanceof T){var n=arguments[0],i=arguments[1],s=r.indexOf(i,n);if(s<=0)return null;r.scroll(n,s)}}else if(arguments.length===3){var o=arguments[0],c=arguments[1],v=arguments[2],y=c;if(y<=0)return null;for(var E=o.copy(),L=v?o.size()-1:o.size(),C=0;C<L;C++)for(var D=0;D<o.getDimension();D++)o.setOrdinate(C,D,E.getOrdinate((c+C)%L,D));if(v)for(var P=0;P<o.getDimension();P++)o.setOrdinate(L,P,o.getOrdinate(0,P))}}},{key:"isEqual",value:function(t,e){var n=t.size();if(n!==e.size())return!1;for(var i=Math.min(t.getDimension(),e.getDimension()),s=0;s<n;s++)for(var o=0;o<i;o++){var c=t.getOrdinate(s,o),v=e.getOrdinate(s,o);if(t.getOrdinate(s,o)!==e.getOrdinate(s,o)&&(!H.isNaN(c)||!H.isNaN(v)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var t=arguments[0];return r.minCoordinateIndex(t,0,t.size()-1)}if(arguments.length===3){for(var e=arguments[0],n=arguments[1],i=arguments[2],s=-1,o=null,c=n;c<=i;c++){var v=e.getCoordinate(c);(o===null||o.compareTo(v)>0)&&(o=v,s=c)}return s}}},{key:"extend",value:function(t,e,n){var i=t.create(n,e.getDimension()),s=e.size();if(r.copy(e,0,i,0,s),s>0)for(var o=s;o<n;o++)r.copy(e,s-1,i,o,1);return i}},{key:"reverse",value:function(t){for(var e=t.size()-1,n=Math.trunc(e/2),i=0;i<=n;i++)r.swap(t,i,e-i)}},{key:"swap",value:function(t,e,n){if(e===n)return null;for(var i=0;i<t.getDimension();i++){var s=t.getOrdinate(e,i);t.setOrdinate(e,i,t.getOrdinate(n,i)),t.setOrdinate(n,i,s)}}},{key:"copy",value:function(t,e,n,i,s){for(var o=0;o<s;o++)r.copyCoord(t,e+o,n,i+o)}},{key:"ensureValidRing",value:function(t,e){var n=e.size();return n===0?e:n<=3?r.createClosedRing(t,e,4):e.getOrdinate(0,at.X)===e.getOrdinate(n-1,at.X)&&e.getOrdinate(0,at.Y)===e.getOrdinate(n-1,at.Y)?e:r.createClosedRing(t,e,n+1)}},{key:"indexOf",value:function(t,e){for(var n=0;n<e.size();n++)if(t.x===e.getOrdinate(n,at.X)&&t.y===e.getOrdinate(n,at.Y))return n;return-1}},{key:"createClosedRing",value:function(t,e,n){var i=t.create(n,e.getDimension()),s=e.size();r.copy(e,0,i,0,s);for(var o=s;o<n;o++)r.copy(e,0,i,o,1);return i}},{key:"minCoordinate",value:function(t){for(var e=null,n=0;n<t.size();n++){var i=t.getCoordinate(n);(e===null||e.compareTo(i)>0)&&(e=i)}return e}}]),r}(),Y=function(){function r(){a(this,r)}return h(r,null,[{key:"toDimensionSymbol",value:function(t){switch(t){case r.FALSE:return r.SYM_FALSE;case r.TRUE:return r.SYM_TRUE;case r.DONTCARE:return r.SYM_DONTCARE;case r.P:return r.SYM_P;case r.L:return r.SYM_L;case r.A:return r.SYM_A}throw new G("Unknown dimension value: "+t)}},{key:"toDimensionValue",value:function(t){switch(oi.toUpperCase(t)){case r.SYM_FALSE:return r.FALSE;case r.SYM_TRUE:return r.TRUE;case r.SYM_DONTCARE:return r.DONTCARE;case r.SYM_P:return r.P;case r.SYM_L:return r.L;case r.SYM_A:return r.A}throw new G("Unknown dimension symbol: "+t)}}]),r}();Y.P=0,Y.L=1,Y.A=2,Y.FALSE=-1,Y.TRUE=-2,Y.DONTCARE=-3,Y.SYM_FALSE="F",Y.SYM_TRUE="T",Y.SYM_DONTCARE="*",Y.SYM_P="0",Y.SYM_L="1",Y.SYM_A="2";var bn=function(){function r(){a(this,r)}return h(r,[{key:"filter",value:function(t){}}]),r}(),Mn=function(){function r(){a(this,r)}return h(r,[{key:"filter",value:function(t,e){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),r}(),en=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new vt:this._points.expandEnvelope(new vt)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new e(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof $){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var s=n;if(this._points.size()!==s._points.size())return!1;for(var o=0;o<this._points.size();o++)if(!this.equal(this._points.getCoordinate(o),s._points.getCoordinate(o),i))return!1;return!0}return S(d(e.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var n=0;n<Math.trunc(this._points.size()/2);n++){var i=this._points.size()-1-n;if(!this._points.getCoordinate(n).equals(this._points.getCoordinate(i))){if(this._points.getCoordinate(n).compareTo(this._points.getCoordinate(i))>0){var s=this._points.copy();pe.reverse(s),this._points=s}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?Y.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var n=this._points.copy();return pe.reverse(n),this.getFactory().createLineString(n)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return $.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return du.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var n=arguments[0],i=n,s=0,o=0;s<this._points.size()&&o<i._points.size();){var c=this._points.getCoordinate(s).compareTo(i._points.getCoordinate(o));if(c!==0)return c;s++,o++}return s<this._points.size()?1:o<i._points.size()?-1:0}if(arguments.length===2){var v=arguments[0],y=arguments[1],E=v;return y.compare(this._points,E._points)}}},{key:"apply",value:function(){if(tt(arguments[0],On))for(var n=arguments[0],i=0;i<this._points.size();i++)n.filter(this._points.getCoordinate(i));else if(tt(arguments[0],Mn)){var s=arguments[0];if(this._points.size()===0)return null;for(var o=0;o<this._points.size()&&(s.filter(this._points,o),!s.isDone());o++);s.isGeometryChanged()&&this.geometryChanged()}else if(tt(arguments[0],bn)){var c=arguments[0];c.filter(this)}else if(tt(arguments[0],B)){var v=arguments[0];v.filter(this)}}},{key:"getBoundary",value:function(){throw new ve}},{key:"isEquivalentClass",value:function(n){return n instanceof e}},{key:"getCoordinateN",value:function(n){return this._points.getCoordinate(n)}},{key:"getGeometryType",value:function(){return $.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(n){if(n===null&&(n=this.getFactory().getCoordinateSequenceFactory().create([])),n.size()===1)throw new G("Invalid number of points in LineString (found "+n.size()+" - must be 0 or >= 2)");this._points=n}},{key:"isCoordinate",value:function(n){for(var i=0;i<this._points.size();i++)if(this._points.getCoordinate(i).equals(n))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(n){return this.getFactory().createPoint(this._points.getCoordinate(n))}},{key:"interfaces_",get:function(){return[Br]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var n=arguments[0],i=arguments[1];$.constructor_.call(this,i),this.init(n)}}}}]),e}($),Xr=function r(){a(this,r)},ci=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new vt;var n=new vt;return n.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),n}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new e(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof $){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&(!(!this.isEmpty()||!n.isEmpty())||this.isEmpty()===n.isEmpty()&&this.equal(n.getCoordinate(),this.getCoordinate(),i))}return S(d(e.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return Y.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return $.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getCoordinate().compareTo(i.getCoordinate())}if(arguments.length===2){var s=arguments[0],o=arguments[1],c=s;return o.compare(this._coordinates,c._coordinates)}}},{key:"apply",value:function(){if(tt(arguments[0],On)){var n=arguments[0];if(this.isEmpty())return null;n.filter(this.getCoordinate())}else if(tt(arguments[0],Mn)){var i=arguments[0];if(this.isEmpty())return null;i.filter(this._coordinates,0),i.isGeometryChanged()&&this.geometryChanged()}else if(tt(arguments[0],bn)){var s=arguments[0];s.filter(this)}else if(tt(arguments[0],B)){var o=arguments[0];o.filter(this)}}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return $.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(n){n===null&&(n=this.getFactory().getCoordinateSequenceFactory().create([])),it.isTrue(n.size()<=1),this._coordinates=n}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Xr]}}],[{key:"constructor_",value:function(){this._coordinates=null;var n=arguments[0],i=arguments[1];$.constructor_.call(this,i),this.init(n)}}]),e}($),Ur=function(){function r(){a(this,r)}return h(r,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];return Math.abs(r.ofRingSigned(t))}if(tt(arguments[0],at)){var e=arguments[0];return Math.abs(r.ofRingSigned(e))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,i=1;i<t.length-1;i++){var s=t[i].x-n,o=t[i+1].y,c=t[i-1].y;e+=s*(c-o)}return e/2}if(tt(arguments[0],at)){var v=arguments[0],y=v.size();if(y<3)return 0;var E=new T,L=new T,C=new T;v.getCoordinate(0,L),v.getCoordinate(1,C);var D=L.x;C.x-=D;for(var P=0,Z=1;Z<y-1;Z++)E.y=L.y,L.x=C.x,L.y=C.y,v.getCoordinate(Z+1,C),C.x-=D,P+=L.x*(E.y-C.y);return P/2}}}]),r}(),_e=function(){function r(){a(this,r)}return h(r,null,[{key:"sort",value:function(){var t=arguments,e=arguments[0];if(arguments.length===1)e.sort(function(D,P){return D.compareTo(P)});else if(arguments.length===2)e.sort(function(D,P){return t[1].compare(D,P)});else if(arguments.length===3){var n=e.slice(arguments[1],arguments[2]);n.sort();var i=e.slice(0,arguments[1]).concat(n,e.slice(arguments[2],e.length));e.splice(0,e.length);var s,o=M(i);try{for(o.s();!(s=o.n()).done;){var c=s.value;e.push(c)}}catch(D){o.e(D)}finally{o.f()}}else if(arguments.length===4){var v=e.slice(arguments[1],arguments[2]);v.sort(function(D,P){return t[3].compare(D,P)});var y=e.slice(0,arguments[1]).concat(v,e.slice(arguments[2],e.length));e.splice(0,e.length);var E,L=M(y);try{for(L.s();!(E=L.n()).done;){var C=E.value;e.push(C)}}catch(D){L.e(D)}finally{L.f()}}}},{key:"asList",value:function(t){var e,n=new W,i=M(t);try{for(i.s();!(e=i.n()).done;){var s=e.value;n.add(s)}}catch(o){i.e(o)}finally{i.f()}return n}},{key:"copyOf",value:function(t,e){return t.slice(0,e)}}]),r}(),Vr=function r(){a(this,r)},Pn=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var n=new Array(this.getNumPoints()).fill(null),i=-1,s=this._shell.getCoordinates(),o=0;o<s.length;o++)n[++i]=s[o];for(var c=0;c<this._holes.length;c++)for(var v=this._holes[c].getCoordinates(),y=0;y<v.length;y++)n[++i]=v[y];return n}},{key:"getArea",value:function(){var n=0;n+=Ur.ofRing(this._shell.getCoordinateSequence());for(var i=0;i<this._holes.length;i++)n-=Ur.ofRing(this._holes[i].getCoordinateSequence());return n}},{key:"copyInternal",value:function(){for(var n=this._shell.copy(),i=new Array(this._holes.length).fill(null),s=0;s<this._holes.length;s++)i[s]=this._holes[s].copy();return new e(n,i,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var n=this._shell.getCoordinateSequence(),i=this.getEnvelopeInternal(),s=0;s<5;s++){var o=n.getX(s);if(o!==i.getMinX()&&o!==i.getMaxX())return!1;var c=n.getY(s);if(c!==i.getMinY()&&c!==i.getMaxY())return!1}for(var v=n.getX(0),y=n.getY(0),E=1;E<=4;E++){var L=n.getX(E),C=n.getY(E);if(L!==v==(C!==y))return!1;v=L,y=C}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof $){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var s=n,o=this._shell,c=s._shell;if(!o.equalsExact(c,i)||this._holes.length!==s._holes.length)return!1;for(var v=0;v<this._holes.length;v++)if(!this._holes[v].equalsExact(s._holes[v],i))return!1;return!0}return S(d(e.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var n=0;n<this._holes.length;n++)this._holes[n]=this.normalized(this._holes[n],!1);_e.sort(this._holes)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(i.isEmpty())return null;var o=i.getCoordinateSequence(),c=pe.minCoordinateIndex(o,0,o.size()-2);pe.scroll(o,c,!0),J.isCCW(o)===s&&pe.reverse(o)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var n=this.getExteriorRing().reverse(),i=new Array(this.getNumInteriorRing()).fill(null),s=0;s<i.length;s++)i[s]=this.getInteriorRingN(s).reverse();return this.getFactory().createPolygon(n,i)}},{key:"getTypeCode",value:function(){return $.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var n=0;n+=this._shell.getLength();for(var i=0;i<this._holes.length;i++)n+=this._holes[i].getLength();return n}},{key:"getNumPoints",value:function(){for(var n=this._shell.getNumPoints(),i=0;i<this._holes.length;i++)n+=this._holes[i].getNumPoints();return n}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(n,i){var s=n.copy();return this.normalize(s,i),s}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=this._shell,s=n._shell;return i.compareToSameClass(s)}if(arguments.length===2){var o=arguments[0],c=arguments[1],v=o,y=this._shell,E=v._shell,L=y.compareToSameClass(E,c);if(L!==0)return L;for(var C=this.getNumInteriorRing(),D=v.getNumInteriorRing(),P=0;P<C&&P<D;){var Z=this.getInteriorRingN(P),j=v.getInteriorRingN(P),K=Z.compareToSameClass(j,c);if(K!==0)return K;P++}return P<C?1:P<D?-1:0}}},{key:"apply",value:function(){if(tt(arguments[0],On)){var n=arguments[0];this._shell.apply(n);for(var i=0;i<this._holes.length;i++)this._holes[i].apply(n)}else if(tt(arguments[0],Mn)){var s=arguments[0];if(this._shell.apply(s),!s.isDone())for(var o=0;o<this._holes.length&&(this._holes[o].apply(s),!s.isDone());o++);s.isGeometryChanged()&&this.geometryChanged()}else if(tt(arguments[0],bn)){var c=arguments[0];c.filter(this)}else if(tt(arguments[0],B)){var v=arguments[0];v.filter(this),this._shell.apply(v);for(var y=0;y<this._holes.length;y++)this._holes[y].apply(v)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var n=new Array(this._holes.length+1).fill(null);n[0]=this._shell;for(var i=0;i<this._holes.length;i++)n[i+1]=this._holes[i];return n.length<=1?this.getFactory().createLinearRing(n[0].getCoordinateSequence()):this.getFactory().createMultiLineString(n)}},{key:"getGeometryType",value:function(){return $.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(n){return this._holes[n]}},{key:"interfaces_",get:function(){return[Vr]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var n=arguments[0],i=arguments[1],s=arguments[2];if($.constructor_.call(this,s),n===null&&(n=this.getFactory().createLinearRing()),i===null&&(i=[]),$.hasNullElements(i))throw new G("holes must not contain null elements");if(n.isEmpty()&&$.hasNonEmptyElements(i))throw new G("shell is empty but holes are not");this._shell=n,this._holes=i}}]),e}($),pu=function(r){g(e,r);var t=_(e);function e(){return a(this,e),t.apply(this,arguments)}return e}(Gr),Hr=function(r){g(e,r);var t=_(e);function e(n){var i;return a(this,e),(i=t.call(this)).array=[],n instanceof Wt&&i.addAll(n),i}return h(e,[{key:"contains",value:function(n){var i,s=M(this.array);try{for(s.s();!(i=s.n()).done;)if(i.value.compareTo(n)===0)return!0}catch(o){s.e(o)}finally{s.f()}return!1}},{key:"add",value:function(n){if(this.contains(n))return!1;for(var i=0,s=this.array.length;i<s;i++)if(this.array[i].compareTo(n)===1)return!!this.array.splice(i,0,n);return this.array.push(n),!0}},{key:"addAll",value:function(n){var i,s=M(n);try{for(s.s();!(i=s.n()).done;){var o=i.value;this.add(o)}}catch(c){s.e(c)}finally{s.f()}return!0}},{key:"remove",value:function(){throw new ve}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new _u(this.array)}}]),e}(pu),_u=function(){function r(t){a(this,r),this.array=t,this.position=0}return h(r,[{key:"next",value:function(){if(this.position===this.array.length)throw new Cn;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new ve}}]),r}(),Mt=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"computeEnvelopeInternal",value:function(){for(var n=new vt,i=0;i<this._geometries.length;i++)n.expandToInclude(this._geometries[i].getEnvelopeInternal());return n}},{key:"getGeometryN",value:function(n){return this._geometries[n]}},{key:"getCoordinates",value:function(){for(var n=new Array(this.getNumPoints()).fill(null),i=-1,s=0;s<this._geometries.length;s++)for(var o=this._geometries[s].getCoordinates(),c=0;c<o.length;c++)n[++i]=o[c];return n}},{key:"getArea",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getArea();return n}},{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new e(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof $){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var s=n;if(this._geometries.length!==s._geometries.length)return!1;for(var o=0;o<this._geometries.length;o++)if(!this._geometries[o].equalsExact(s._geometries[o],i))return!1;return!0}return S(d(e.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var n=0;n<this._geometries.length;n++)this._geometries[n].normalize();_e.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var n=Y.FALSE,i=0;i<this._geometries.length;i++)n=Math.max(n,this._geometries[i].getBoundaryDimension());return n}},{key:"reverseInternal",value:function(){for(var n=this._geometries.length,i=new W(n),s=0;s<n;s++)i.add(this._geometries[s].reverse());return this.getFactory().buildGeometry(i)}},{key:"getTypeCode",value:function(){return $.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var n=Y.FALSE,i=0;i<this._geometries.length;i++)n=Math.max(n,this._geometries[i].getDimension());return n}},{key:"getLength",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getLength();return n}},{key:"getNumPoints",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getNumPoints();return n}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=new Hr(_e.asList(this._geometries)),s=new Hr(_e.asList(n._geometries));return this.compare(i,s)}if(arguments.length===2){for(var o=arguments[0],c=arguments[1],v=o,y=this.getNumGeometries(),E=v.getNumGeometries(),L=0;L<y&&L<E;){var C=this.getGeometryN(L),D=v.getGeometryN(L),P=C.compareToSameClass(D,c);if(P!==0)return P;L++}return L<y?1:L<E?-1:0}}},{key:"apply",value:function(){if(tt(arguments[0],On))for(var n=arguments[0],i=0;i<this._geometries.length;i++)this._geometries[i].apply(n);else if(tt(arguments[0],Mn)){var s=arguments[0];if(this._geometries.length===0)return null;for(var o=0;o<this._geometries.length&&(this._geometries[o].apply(s),!s.isDone());o++);s.isGeometryChanged()&&this.geometryChanged()}else if(tt(arguments[0],bn)){var c=arguments[0];c.filter(this);for(var v=0;v<this._geometries.length;v++)this._geometries[v].apply(c)}else if(tt(arguments[0],B)){var y=arguments[0];y.filter(this);for(var E=0;E<this._geometries.length;E++)this._geometries[E].apply(y)}}},{key:"getBoundary",value:function(){return $.checkNotGeometryCollection(this),it.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return $.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var n=0;n<this._geometries.length;n++)if(!this._geometries[n].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var n=arguments[0],i=arguments[1];if($.constructor_.call(this,i),n===null&&(n=[]),$.hasNullElements(n))throw new G("geometries must not contain null elements");this._geometries=n}}}}]),e}($),fi=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new e(n,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof $){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&S(d(e.prototype),"equalsExact",this).call(this,n,i)}return S(d(e.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var n=arguments[0];return this._geometries[n].getCoordinate()}return S(d(e.prototype),"getCoordinate",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return Y.FALSE}},{key:"getTypeCode",value:function(){return $.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return $.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Xr]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Mt.constructor_.call(this,n,i)}}]),e}(Mt),nn=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"copyInternal",value:function(){return new e(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return Y.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||S(d(e.prototype),"isClosed",this).call(this)}},{key:"reverseInternal",value:function(){var n=this._points.copy();return pe.reverse(n),this.getFactory().createLinearRing(n)}},{key:"getTypeCode",value:function(){return $.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!S(d(e.prototype),"isClosed",this).call(this))throw new G("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new G("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return $.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];en.constructor_.call(this,n,i),this.validateConstruction()}}]),e}(en);nn.MINIMUM_VALID_SIZE=4;var xe=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"setOrdinate",value:function(n,i){switch(n){case e.X:this.x=i;break;case e.Y:this.y=i;break;default:throw new G("Invalid ordinate index: "+n)}}},{key:"getZ",value:function(){return T.NULL_ORDINATE}},{key:"getOrdinate",value:function(n){switch(n){case e.X:return this.x;case e.Y:return this.y}throw new G("Invalid ordinate index: "+n)}},{key:"setZ",value:function(n){throw new G("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new e(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)T.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof e){var n=arguments[0];T.constructor_.call(this,n.x,n.y)}else if(arguments[0]instanceof T){var i=arguments[0];T.constructor_.call(this,i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],o=arguments[1];T.constructor_.call(this,s,o,T.NULL_ORDINATE)}}}]),e}(T);xe.X=0,xe.Y=1,xe.Z=-1,xe.M=-1;var ke=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(n,i){switch(n){case e.X:this.x=i;break;case e.Y:this.y=i;break;case e.M:this._m=i;break;default:throw new G("Invalid ordinate index: "+n)}}},{key:"setM",value:function(n){this._m=n}},{key:"getZ",value:function(){return T.NULL_ORDINATE}},{key:"getOrdinate",value:function(n){switch(n){case e.X:return this.x;case e.Y:return this.y;case e.M:return this._m}throw new G("Invalid ordinate index: "+n)}},{key:"setZ",value:function(n){throw new G("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new e(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ(),this._m=n.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)T.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof e){var n=arguments[0];T.constructor_.call(this,n.x,n.y),this._m=n._m}else if(arguments[0]instanceof T){var i=arguments[0];T.constructor_.call(this,i.x,i.y),this._m=this.getM()}}else if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2];T.constructor_.call(this,s,o,T.NULL_ORDINATE),this._m=c}}}]),e}(T);ke.X=0,ke.Y=1,ke.Z=-1,ke.M=2;var gi=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(n,i){switch(n){case T.X:this.x=i;break;case T.Y:this.y=i;break;case T.Z:this.z=i;break;case T.M:this._m=i;break;default:throw new G("Invalid ordinate index: "+n)}}},{key:"setM",value:function(n){this._m=n}},{key:"getOrdinate",value:function(n){switch(n){case T.X:return this.x;case T.Y:return this.y;case T.Z:return this.getZ();case T.M:return this.getM()}throw new G("Invalid ordinate index: "+n)}},{key:"copy",value:function(){return new e(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ(),this._m=n.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)T.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof e){var n=arguments[0];T.constructor_.call(this,n),this._m=n._m}else if(arguments[0]instanceof T){var i=arguments[0];T.constructor_.call(this,i),this._m=this.getM()}}else if(arguments.length===4){var s=arguments[0],o=arguments[1],c=arguments[2],v=arguments[3];T.constructor_.call(this,s,o,c),this._m=v}}}]),e}(T),An=function(){function r(){a(this,r)}return h(r,null,[{key:"measures",value:function(t){return t instanceof xe?0:t instanceof ke||t instanceof gi?1:0}},{key:"dimension",value:function(t){return t instanceof xe?2:t instanceof ke?3:t instanceof gi?4:3}},{key:"create",value:function(){if(arguments.length===1){var t=arguments[0];return r.create(t,0)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return e===2?new xe:e===3&&n===0?new T:e===3&&n===1?new ke:e===4&&n===1?new gi:new T}}}]),r}(),rn=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"getCoordinate",value:function(n){return this.get(n)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&tt(arguments[0],Wt)){for(var n=arguments[0],i=arguments[1],s=!1,o=n.iterator();o.hasNext();)this.add(o.next(),i),s=!0;return s}return S(d(e.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var n=S(d(e.prototype),"clone",this).call(this),i=0;i<this.size();i++)n.add(i,this.get(i).clone());return n}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(e.coordArrayType);if(arguments.length===1){var n=arguments[0];if(n)return this.toArray(e.coordArrayType);for(var i=this.size(),s=new Array(i).fill(null),o=0;o<i;o++)s[o]=this.get(i-o-1);return s}}},{key:"add",value:function(){if(arguments.length===1){var n=arguments[0];return S(d(e.prototype),"add",this).call(this,n)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var i=arguments[0],s=arguments[1];return this.add(i,s,!0),!0}if(arguments[0]instanceof T&&typeof arguments[1]=="boolean"){var o=arguments[0],c=arguments[1];if(!c&&this.size()>=1){var v=this.get(this.size()-1);if(v.equals2D(o))return null}S(d(e.prototype),"add",this).call(this,o)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var y=arguments[0],E=arguments[1];return this.add(y,E),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var L=arguments[0],C=arguments[1],D=arguments[2];if(D)for(var P=0;P<L.length;P++)this.add(L[P],C);else for(var Z=L.length-1;Z>=0;Z--)this.add(L[Z],C);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof T){var j=arguments[0],K=arguments[1],ct=arguments[2];if(!ct){var pt=this.size();if(pt>0){if(j>0){var St=this.get(j-1);if(St.equals2D(K))return null}if(j<pt){var Dt=this.get(j);if(Dt.equals2D(K))return null}}}S(d(e.prototype),"add",this).call(this,j,K)}}else if(arguments.length===4){var Zt=arguments[0],ae=arguments[1],Ne=arguments[2],ln=arguments[3],hn=1;Ne>ln&&(hn=-1);for(var Xe=Ne;Xe!==ln;Xe+=hn)this.add(Zt[Xe],ae);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var n=this.get(0).copy();this.add(n,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.ensureCapacity(n.length),this.add(n,!0)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.ensureCapacity(i.length),this.add(i,s)}}}}]),e}(W);rn.coordArrayType=new Array(0).fill(null);var _t=function(){function r(){a(this,r)}return h(r,null,[{key:"isRing",value:function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])}},{key:"ptNotInList",value:function(t,e){for(var n=0;n<t.length;n++){var i=t[n];if(r.indexOf(i,e)<0)return i}return null}},{key:"scroll",value:function(t,e){var n=r.indexOf(e,t);if(n<0)return null;var i=new Array(t.length).fill(null);qt.arraycopy(t,n,i,0,t.length-n),qt.arraycopy(t,0,i,t.length-n,n),qt.arraycopy(i,0,t,0,t.length)}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(arguments.length===3){var i=arguments[0],s=arguments[1],o=arguments[2];if(i===s)return!0;if(i===null||s===null||i.length!==s.length)return!1;for(var c=0;c<i.length;c++)if(o.compare(i[c],s[c])!==0)return!1;return!0}}},{key:"intersection",value:function(t,e){for(var n=new rn,i=0;i<t.length;i++)e.intersects(t[i])&&n.add(t[i],!0);return n.toCoordinateArray()}},{key:"measures",value:function(t){if(t===null||t.length===0)return 0;var e,n=0,i=M(t);try{for(i.s();!(e=i.n()).done;){var s=e.value;n=Math.max(n,An.measures(s))}}catch(o){i.e(o)}finally{i.f()}return n}},{key:"hasRepeatedPoints",value:function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(t){return r.hasRepeatedPoints(t)?new rn(t,!1).toCoordinateArray():t}},{key:"reverse",value:function(t){for(var e=t.length-1,n=Math.trunc(e/2),i=0;i<=n;i++){var s=t[i];t[i]=t[e-i],t[e-i]=s}}},{key:"removeNull",value:function(t){for(var e=0,n=0;n<t.length;n++)t[n]!==null&&e++;var i=new Array(e).fill(null);if(e===0)return i;for(var s=0,o=0;o<t.length;o++)t[o]!==null&&(i[s++]=t[o]);return i}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=t[n].copy();return e}if(arguments.length===5)for(var i=arguments[0],s=arguments[1],o=arguments[2],c=arguments[3],v=arguments[4],y=0;y<v;y++)o[c+y]=i[s+y].copy()}},{key:"isEqualReversed",value:function(t,e){for(var n=0;n<t.length;n++){var i=t[n],s=e[t.length-n-1];if(i.compareTo(s)!==0)return!1}return!0}},{key:"envelope",value:function(t){for(var e=new vt,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e}},{key:"toCoordinateArray",value:function(t){return t.toArray(r.coordArrayType)}},{key:"dimension",value:function(t){if(t===null||t.length===0)return 3;var e,n=0,i=M(t);try{for(i.s();!(e=i.n()).done;){var s=e.value;n=Math.max(n,An.dimension(s))}}catch(o){i.e(o)}finally{i.f()}return n}},{key:"atLeastNCoordinatesOrNothing",value:function(t,e){return e.length>=t?e:[]}},{key:"indexOf",value:function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1}},{key:"increasingDirection",value:function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,i=t[e].compareTo(t[n]);if(i!==0)return i}return 1}},{key:"compare",value:function(t,e){for(var n=0;n<t.length&&n<e.length;){var i=t[n].compareTo(e[n]);if(i!==0)return i;n++}return n<e.length?-1:n<t.length?1:0}},{key:"minCoordinate",value:function(t){for(var e=null,n=0;n<t.length;n++)(e===null||e.compareTo(t[n])>0)&&(e=t[n]);return e}},{key:"extract",value:function(t,e,n){e=tn.clamp(e,0,t.length);var i=(n=tn.clamp(n,-1,t.length))-e+1;n<0&&(i=0),e>=t.length&&(i=0),n<e&&(i=0);var s=new Array(i).fill(null);if(i===0)return s;for(var o=0,c=e;c<=n;c++)s[o++]=t[c];return s}}]),r}(),xu=function(){function r(){a(this,r)}return h(r,[{key:"compare",value:function(t,e){var n=t,i=e;return _t.compare(n,i)}},{key:"interfaces_",get:function(){return[Lt]}}]),r}(),ku=function(){function r(){a(this,r)}return h(r,[{key:"compare",value:function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;var s=_t.compare(n,i);return _t.isEqualReversed(n,i)?0:s}},{key:"OLDcompare",value:function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;for(var s=_t.increasingDirection(n),o=_t.increasingDirection(i),c=s>0?0:n.length-1,v=o>0?0:n.length-1,y=0;y<n.length;y++){var E=n[c].compareTo(i[v]);if(E!==0)return E;c+=s,v+=o}return 0}},{key:"interfaces_",get:function(){return[Lt]}}]),r}();_t.ForwardComparator=xu,_t.BidirectionalComparator=ku,_t.coordArrayType=new Array(0).fill(null);var Dn=function(){function r(t){a(this,r),this.str=t}return h(r,[{key:"append",value:function(t){this.str+=t}},{key:"setCharAt",value:function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}},{key:"toString",value:function(){return this.str}}]),r}(),sn=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getM",value:function(t){return this.hasM()?this._coordinates[t].getM():H.NaN}},{key:"setOrdinate",value:function(t,e,n){switch(e){case at.X:this._coordinates[t].x=n;break;case at.Y:this._coordinates[t].y=n;break;default:this._coordinates[t].setOrdinate(e,n)}}},{key:"getZ",value:function(t){return this.hasZ()?this._coordinates[t].getZ():H.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(t,e){switch(e){case at.X:return this._coordinates[t].x;case at.Y:return this._coordinates[t].y;default:return this._coordinates[t].getOrdinate(e)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}if(arguments.length===2){var e=arguments[0],n=arguments[1];n.setCoordinate(this._coordinates[e])}}},{key:"getCoordinateCopy",value:function(t){var e=this.createCoordinate();return e.setCoordinate(this._coordinates[t]),e}},{key:"createCoordinate",value:function(){return An.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(t){return this._coordinates[t].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t}},{key:"copy",value:function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++){var n=this.createCoordinate();n.setCoordinate(this._coordinates[e]),t[e]=n}return new r(t,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var t=new Dn(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"}},{key:"getY",value:function(t){return this._coordinates[t].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[at,U]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];r.constructor_.call(this,t,_t.dimension(t),_t.measures(t))}else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)this._coordinates[n]=new T}else if(tt(arguments[0],at)){var i=arguments[0];if(i===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._measures=i.getMeasures(),this._coordinates=new Array(i.size()).fill(null);for(var s=0;s<this._coordinates.length;s++)this._coordinates[s]=i.getCoordinateCopy(s)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],c=arguments[1];r.constructor_.call(this,o,c,_t.measures(o))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var v=arguments[0],y=arguments[1];this._coordinates=new Array(v).fill(null),this._dimension=y;for(var E=0;E<v;E++)this._coordinates[E]=An.create(y)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var L=arguments[0],C=arguments[1],D=arguments[2];this._dimension=C,this._measures=D,this._coordinates=L===null?new Array(0).fill(null):L}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var P=arguments[0],Z=arguments[1],j=arguments[2];this._coordinates=new Array(P).fill(null),this._dimension=Z,this._measures=j;for(var K=0;K<P;K++)this._coordinates[K]=this.createCoordinate()}}}}]),r}(),vi=function(){function r(){a(this,r)}return h(r,[{key:"readResolve",value:function(){return r.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new sn(t)}if(tt(arguments[0],at)){var e=arguments[0];return new sn(e)}}else{if(arguments.length===2){var n=arguments[0],i=arguments[1];return i>3&&(i=3),i<2&&(i=2),new sn(n,i)}if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2],v=o-c;return c>1&&(c=1),v>3&&(v=3),v<2&&(v=2),new sn(s,v+c,c)}}}},{key:"interfaces_",get:function(){return[zr,U]}}],[{key:"instance",value:function(){return r.instanceObject}}]),r}();vi.instanceObject=new vi;var yi=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new e(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof $){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&S(d(e.prototype),"equalsExact",this).call(this,n,i)}return S(d(e.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return $.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var n=new W,i=0;i<this._geometries.length;i++)for(var s=this._geometries[i].getBoundary(),o=0;o<s.getNumGeometries();o++)n.add(s.getGeometryN(o));var c=new Array(n.size()).fill(null);return this.getFactory().createMultiLineString(n.toArray(c))}},{key:"getGeometryType",value:function(){return $.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[Vr]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Mt.constructor_.call(this,n,i)}}]),e}(Mt),Zr=function(){function r(){a(this,r)}return h(r,[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}]),r}(),Eu=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),(n=t.call(this)).map=new Map,n}return h(e,[{key:"get",value:function(n){return this.map.get(n)||null}},{key:"put",value:function(n,i){return this.map.set(n,i),i}},{key:"values",value:function(){for(var n=new W,i=this.map.values(),s=i.next();!s.done;)n.add(s.value),s=i.next();return n}},{key:"entrySet",value:function(){var n=new ui;return this.map.entries().forEach(function(i){return n.add(i)}),n}},{key:"size",value:function(){return this.map.size()}}]),e}(Zr),Vt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"equals",value:function(t){if(!(t instanceof r))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale}},{key:"compareTo",value:function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return Rn.compare(n,i)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===r.FLOATING||this._modelType===r.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var t="UNKNOWN";return this._modelType===r.FLOATING?t="Floating":this._modelType===r.FLOATING_SINGLE?t="Floating-Single":this._modelType===r.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var t=arguments[0];return H.isNaN(t)||this._modelType===r.FLOATING_SINGLE?t:this._modelType===r.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof T){var e=arguments[0];if(this._modelType===r.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}}},{key:"getMaximumSignificantDigits",value:function(){var t=16;return this._modelType===r.FLOATING?t=16:this._modelType===r.FLOATING_SINGLE?t=6:this._modelType===r.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t}},{key:"setScale",value:function(t){this._scale=Math.abs(t)}},{key:"interfaces_",get:function(){return[U,X]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=r.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof De){var t=arguments[0];this._modelType=t,t===r.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var e=arguments[0];this._modelType=r.FIXED,this.setScale(e)}else if(arguments[0]instanceof r){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}}},{key:"mostPrecise",value:function(t,e){return t.compareTo(e)>=0?t:e}}]),r}(),De=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"readResolve",value:function(){return r.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[U]}}],[{key:"constructor_",value:function(){this._name=null;var t=arguments[0];this._name=t,r.nameToTypeMap.put(t,this)}}]),r}();De.nameToTypeMap=new Eu,Vt.Type=De,Vt.FIXED=new De("FIXED"),Vt.FLOATING=new De("FLOATING"),Vt.FLOATING_SINGLE=new De("FLOATING SINGLE"),Vt.maximumPreciseValue=9007199254740992;var mi=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new e(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof $){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&S(d(e.prototype),"equalsExact",this).call(this,n,i)}return S(d(e.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?Y.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var n=0;n<this._geometries.length;n++)if(!this._geometries[n].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return $.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new ve}},{key:"getGeometryType",value:function(){return $.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[Br]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Mt.constructor_.call(this,n,i)}}]),e}(Mt),Fe=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"createEmpty",value:function(t){switch(t){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new G("Invalid dimension: "+t)}}},{key:"toGeometry",value:function(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new T(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new T(t.getMinX(),t.getMinY()),new T(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new T(t.getMinX(),t.getMinY()),new T(t.getMinX(),t.getMaxY()),new T(t.getMaxX(),t.getMaxY()),new T(t.getMaxX(),t.getMinY()),new T(t.getMinX(),t.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLineString(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(tt(arguments[0],at)){var e=arguments[0];return new en(e,this)}}}},{key:"createMultiLineString",value:function(){if(arguments.length===0)return new mi(null,this);if(arguments.length===1){var t=arguments[0];return new mi(t,this)}}},{key:"buildGeometry",value:function(t){for(var e=null,n=!1,i=!1,s=t.iterator();s.hasNext();){var o=s.next(),c=o.getTypeCode();e===null&&(e=c),c!==e&&(n=!0),o instanceof Mt&&(i=!0)}if(e===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(r.toGeometryArray(t));var v=t.iterator().next();if(t.size()>1){if(v instanceof Pn)return this.createMultiPolygon(r.toPolygonArray(t));if(v instanceof en)return this.createMultiLineString(r.toLineStringArray(t));if(v instanceof ci)return this.createMultiPoint(r.toPointArray(t));it.shouldNeverReachHere("Unhandled geometry type: "+v.getGeometryType())}return v}},{key:"createMultiPointFromCoords",value:function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof T){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(tt(arguments[0],at)){var e=arguments[0];return new ci(e,this)}}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(tt(arguments[0],at)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof nn){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return new Pn(i,s,this)}}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){if(arguments.length===0)return new Mt(null,this);if(arguments.length===1){var t=arguments[0];return new Mt(t,this)}}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(tt(arguments[0],at)){var e=arguments[0];return new nn(e,this)}}}},{key:"createMultiPolygon",value:function(){if(arguments.length===0)return new yi(null,this);if(arguments.length===1){var t=arguments[0];return new yi(t,this)}}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new fi(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new fi(t,this)}if(tt(arguments[0],at)){var e=arguments[0];if(e===null)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(e.size()).fill(null),i=0;i<e.size();i++){var s=this.getCoordinateSequenceFactory().create(1,e.getDimension(),e.getMeasures());pe.copy(e,i,s,0,1),n[i]=this.createPoint(s)}return this.createMultiPoint(n)}}}},{key:"interfaces_",get:function(){return[U]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)r.constructor_.call(this,new Vt,0);else if(arguments.length===1){if(tt(arguments[0],zr)){var t=arguments[0];r.constructor_.call(this,new Vt,0,t)}else if(arguments[0]instanceof Vt){var e=arguments[0];r.constructor_.call(this,e,0,r.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];r.constructor_.call(this,n,i,r.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2];this._precisionModel=s,this._coordinateSequenceFactory=c,this._SRID=o}}},{key:"toMultiPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toGeometryArray",value:function(t){if(t===null)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return vi.instance()}},{key:"toMultiLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toMultiPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLinearRingArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"createPointFromInternalCoord",value:function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)}}]),r}(),di="XY",Iu="XYZ",Nu="XYM",Su="XYZM",$r={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},jr="EMPTY",Fn=1,re=2,ye=3,Wr=4,Ge=5,wu=6;for(var Lu in $r)$r[Lu].toUpperCase();var Tu=function(){function r(t){a(this,r),this.wkt=t,this.index_=-1}return h(r,[{key:"isAlpha_",value:function(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}},{key:"isNumeric_",value:function(t,e){return t>="0"&&t<="9"||t=="."&&!(e!==void 0&&e)}},{key:"isWhiteSpace_",value:function(t){return t==" "||t==" "||t=="\r"||t==`
|
|
26
|
-
`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var t,e=this.nextChar_(),n=this.index_,i=e;if(e=="(")t=re;else if(e==",")t=Ge;else if(e==")")t=ye;else if(this.isNumeric_(e)||e=="-")t=Wr,i=this.readNumber_();else if(this.isAlpha_(e))t=Fn,i=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(e!=="")throw new Error("Unexpected character: "+e);t=wu}return{position:n,value:i,type:t}}},{key:"readNumber_",value:function(){var t,e=this.index_,n=!1,i=!1;do t=="."?n=!0:t!="e"&&t!="E"||(i=!0),t=this.nextChar_();while(this.isNumeric_(t,n)||!i&&(t=="e"||t=="E")||i&&(t=="-"||t=="+"));return parseFloat(this.wkt.substring(e,this.index_--))}},{key:"readText_",value:function(){var t,e=this.index_;do t=this.nextChar_();while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}]),r}(),Cu=function(){function r(t,e){a(this,r),this.lexer_=t,this.token_,this.layout_=di,this.factory=e}return h(r,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(t){return this.token_.type==t}},{key:"match",value:function(t){var e=this.isTokenType(t);return e&&this.consume_(),e}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var t=di,e=this.token_;if(this.isTokenType(Fn)){var n=e.value;n==="Z"?t=Iu:n==="M"?t=Nu:n==="ZM"&&(t=Su),t!==di&&this.consume_()}return t}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(re)){var t=[];do t.push(this.parseGeometry_());while(this.match(Ge));if(this.match(ye))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(re)){var t=this.parsePoint_();if(this.match(ye))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(re)){var t=this.parsePointList_();if(this.match(ye))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(re)){var t=this.parseLineStringTextList_();if(this.match(ye))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var t;if(this.match(re)){if(t=this.token_.type==re?this.parsePointTextList_():this.parsePointList_(),this.match(ye))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(re)){var t=this.parseLineStringTextList_();if(this.match(ye))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(re)){var t=this.parsePolygonTextList_();if(this.match(ye))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var t=[],e=this.layout_.length,n=0;n<e;++n){var i=this.token_;if(!this.match(Wr))break;t.push(i.value)}if(t.length==e)return t;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var t=[this.parsePoint_()];this.match(Ge);)t.push(this.parsePoint_());return t}},{key:"parsePointTextList_",value:function(){for(var t=[this.parsePointText_()];this.match(Ge);)t.push(this.parsePointText_());return t}},{key:"parseLineStringTextList_",value:function(){for(var t=[this.parseLineStringText_()];this.match(Ge);)t.push(this.parseLineStringText_());return t}},{key:"parsePolygonTextList_",value:function(){for(var t=[this.parsePolygonText_()];this.match(Ge);)t.push(this.parsePolygonText_());return t}},{key:"isEmptyGeometry_",value:function(){var t=this.isTokenType(Fn)&&this.token_.value==jr;return t&&this.consume_(),t}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var t=this.factory,e=function(j){return x(T,R(j))},n=function(j){var K=j.map(function(ct){return t.createLinearRing(ct.map(e))});return K.length>1?t.createPolygon(K[0],K.slice(1)):t.createPolygon(K[0])},i=this.token_;if(this.match(Fn)){var s=i.value;if(this.layout_=this.parseGeometryLayout_(),s=="GEOMETRYCOLLECTION"){var o=this.parseGeometryCollectionText_();return t.createGeometryCollection(o)}switch(s){case"POINT":var c=this.parsePointText_();return c?t.createPoint(x(T,R(c))):t.createPoint();case"LINESTRING":var v=this.parseLineStringText_().map(e);return t.createLineString(v);case"LINEARRING":var y=this.parseLineStringText_().map(e);return t.createLinearRing(y);case"POLYGON":var E=this.parsePolygonText_();return E&&E.length!==0?n(E):t.createPolygon();case"MULTIPOINT":var L=this.parseMultiPointText_();if(!L||L.length===0)return t.createMultiPoint();var C=L.map(e).map(function(j){return t.createPoint(j)});return t.createMultiPoint(C);case"MULTILINESTRING":var D=this.parseMultiLineStringText_().map(function(j){return t.createLineString(j.map(e))});return t.createMultiLineString(D);case"MULTIPOLYGON":var P=this.parseMultiPolygonText_();if(!P||P.length===0)return t.createMultiPolygon();var Z=P.map(n);return t.createMultiPolygon(Z);default:throw new Error("Invalid geometry type: "+s)}}throw new Error(this.formatErrorMessage_())}}]),r}();function Qr(r){if(r.isEmpty())return"";var t=r.getCoordinate(),e=[t.x,t.y];return t.z===void 0||Number.isNaN(t.z)||e.push(t.z),t.m===void 0||Number.isNaN(t.m)||e.push(t.m),e.join(" ")}function an(r){for(var t=r.getCoordinates().map(function(s){var o=[s.x,s.y];return s.z===void 0||Number.isNaN(s.z)||o.push(s.z),s.m===void 0||Number.isNaN(s.m)||o.push(s.m),o}),e=[],n=0,i=t.length;n<i;++n)e.push(t[n].join(" "));return e.join(", ")}function Jr(r){var t=[];t.push("("+an(r.getExteriorRing())+")");for(var e=0,n=r.getNumInteriorRing();e<n;++e)t.push("("+an(r.getInteriorRingN(e))+")");return t.join(", ")}var Ru={Point:Qr,LineString:an,LinearRing:an,Polygon:Jr,MultiPoint:function(r){for(var t=[],e=0,n=r.getNumGeometries();e<n;++e)t.push("("+Qr(r.getGeometryN(e))+")");return t.join(", ")},MultiLineString:function(r){for(var t=[],e=0,n=r.getNumGeometries();e<n;++e)t.push("("+an(r.getGeometryN(e))+")");return t.join(", ")},MultiPolygon:function(r){for(var t=[],e=0,n=r.getNumGeometries();e<n;++e)t.push("("+Jr(r.getGeometryN(e))+")");return t.join(", ")},GeometryCollection:function(r){for(var t=[],e=0,n=r.getNumGeometries();e<n;++e)t.push(Kr(r.getGeometryN(e)));return t.join(", ")}};function Kr(r){var t=r.getGeometryType(),e=Ru[t];t=t.toUpperCase();var n=function(i){var s="";if(i.isEmpty())return s;var o=i.getCoordinate();return o.z===void 0||Number.isNaN(o.z)||(s+="Z"),o.m===void 0||Number.isNaN(o.m)||(s+="M"),s}(r);return n.length>0&&(t+=" "+n),r.isEmpty()?t+" "+jr:t+" ("+e(r)+")"}var Ou=function(){function r(t){a(this,r),this.geometryFactory=t||new Fe,this.precisionModel=this.geometryFactory.getPrecisionModel()}return h(r,[{key:"read",value:function(t){var e=new Tu(t);return new Cu(e,this.geometryFactory).parse()}},{key:"write",value:function(t){return Kr(t)}}]),r}(),pi=function(){function r(t){a(this,r),this.parser=new Ou(t)}return h(r,[{key:"write",value:function(t){return this.parser.write(t)}}],[{key:"toLineString",value:function(t,e){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"}}]),r}(),yt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getIndexAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}},{key:"getTopologySummary",value:function(){var t=new Dn;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}},{key:"computeIntersection",value:function(t,e,n,i){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=i,this._result=this.computeIntersect(t,e,n,i)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var t=arguments[0],e=this.getEdgeDistance(t,0),n=this.getEdgeDistance(t,1);e>n?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var t=arguments[0],e=0;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}}},{key:"getIntersection",value:function(t){return this._intPt[t]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==r.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(t,e){return r.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])}},{key:"isCollinear",value:function(){return this._result===r.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return pi.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+pi.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(t,e){return this._inputLines[t][e]}},{key:"isIntersection",value:function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new T,this._intPt[1]=new T,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(t,e,n){var i=Math.abs(n.x-e.x),s=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=i>s?i:s;else{var c=Math.abs(t.x-e.x),v=Math.abs(t.y-e.y);(o=i>s?c:v)!==0||t.equals(e)||(o=Math.max(c,v))}return it.isTrue(!(o===0&&!t.equals(e)),"Bad distance calculation"),o}},{key:"nonRobustComputeEdgeDistance",value:function(t,e,n){var i=t.x-e.x,s=t.y-e.y,o=Math.sqrt(i*i+s*s);return it.isTrue(!(o===0&&!t.equals(e)),"Invalid distance calculation"),o}}]),r}();yt.DONT_INTERSECT=0,yt.DO_INTERSECT=1,yt.COLLINEAR=2,yt.NO_INTERSECTION=0,yt.POINT_INTERSECTION=1,yt.COLLINEAR_INTERSECTION=2;var Ee=function(r){g(e,r);var t=_(e);function e(){return a(this,e),t.call(this)}return h(e,[{key:"isInSegmentEnvelopes",value:function(n){var i=new vt(this._inputLines[0][0],this._inputLines[0][1]),s=new vt(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&s.contains(n)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return S(d(e.prototype),"computeIntersection",this).apply(this,arguments);var n=arguments[0],i=arguments[1],s=arguments[2];if(this._isProper=!1,vt.intersects(i,s,n)&&J.index(i,s,n)===0&&J.index(s,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(s))&&(this._isProper=!1),this._result=yt.POINT_INTERSECTION,null;this._result=yt.NO_INTERSECTION}},{key:"intersection",value:function(n,i,s,o){var c=this.intersectionSafe(n,i,s,o);return this.isInSegmentEnvelopes(c)||(c=new T(e.nearestEndpoint(n,i,s,o))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c}},{key:"checkDD",value:function(n,i,s,o,c){var v=li.intersection(n,i,s,o),y=this.isInSegmentEnvelopes(v);qt.out.println("DD in env = "+y+" --------------------- "+v),c.distance(v)>1e-4&&qt.out.println("Distance = "+c.distance(v))}},{key:"intersectionSafe",value:function(n,i,s,o){var c=hi.intersection(n,i,s,o);return c===null&&(c=e.nearestEndpoint(n,i,s,o)),c}},{key:"computeCollinearIntersection",value:function(n,i,s,o){var c=vt.intersects(n,i,s),v=vt.intersects(n,i,o),y=vt.intersects(s,o,n),E=vt.intersects(s,o,i);return c&&v?(this._intPt[0]=s,this._intPt[1]=o,yt.COLLINEAR_INTERSECTION):y&&E?(this._intPt[0]=n,this._intPt[1]=i,yt.COLLINEAR_INTERSECTION):c&&y?(this._intPt[0]=s,this._intPt[1]=n,!s.equals(n)||v||E?yt.COLLINEAR_INTERSECTION:yt.POINT_INTERSECTION):c&&E?(this._intPt[0]=s,this._intPt[1]=i,!s.equals(i)||v||y?yt.COLLINEAR_INTERSECTION:yt.POINT_INTERSECTION):v&&y?(this._intPt[0]=o,this._intPt[1]=n,!o.equals(n)||c||E?yt.COLLINEAR_INTERSECTION:yt.POINT_INTERSECTION):v&&E?(this._intPt[0]=o,this._intPt[1]=i,!o.equals(i)||c||y?yt.COLLINEAR_INTERSECTION:yt.POINT_INTERSECTION):yt.NO_INTERSECTION}},{key:"computeIntersect",value:function(n,i,s,o){if(this._isProper=!1,!vt.intersects(n,i,s,o))return yt.NO_INTERSECTION;var c=J.index(n,i,s),v=J.index(n,i,o);if(c>0&&v>0||c<0&&v<0)return yt.NO_INTERSECTION;var y=J.index(s,o,n),E=J.index(s,o,i);return y>0&&E>0||y<0&&E<0?yt.NO_INTERSECTION:c===0&&v===0&&y===0&&E===0?this.computeCollinearIntersection(n,i,s,o):(c===0||v===0||y===0||E===0?(this._isProper=!1,n.equals2D(s)||n.equals2D(o)?this._intPt[0]=n:i.equals2D(s)||i.equals2D(o)?this._intPt[0]=i:c===0?this._intPt[0]=new T(s):v===0?this._intPt[0]=new T(o):y===0?this._intPt[0]=new T(n):E===0&&(this._intPt[0]=new T(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,s,o)),yt.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(n,i,s,o){var c=n,v=Qt.pointToSegment(n,s,o),y=Qt.pointToSegment(i,s,o);return y<v&&(v=y,c=i),(y=Qt.pointToSegment(s,n,i))<v&&(v=y,c=s),(y=Qt.pointToSegment(o,n,i))<v&&(v=y,c=o),c}}]),e}(yt),bu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"countSegment",value:function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,i=e.x;return n>i&&(n=e.x,i=t.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var s=J.index(t,e,this._p);if(s===J.COLLINEAR)return this._isPointOnSegment=!0,null;e.y<t.y&&(s=-s),s===J.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==k.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?k.BOUNDARY:this._crossingCount%2==1?k.INTERIOR:k.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof T&&tt(arguments[1],at)){for(var t=arguments[0],e=arguments[1],n=new r(t),i=new T,s=new T,o=1;o<e.size();o++)if(e.getCoordinate(o,i),e.getCoordinate(o-1,s),n.countSegment(i,s),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof T&&arguments[1]instanceof Array){for(var c=arguments[0],v=arguments[1],y=new r(c),E=1;E<v.length;E++){var L=v[E],C=v[E-1];if(y.countSegment(L,C),y.isOnSegment())return y.getLocation()}return y.getLocation()}}}]),r}(),_i=function(){function r(){a(this,r)}return h(r,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof T&&tt(arguments[1],at)){for(var t=arguments[0],e=arguments[1],n=new Ee,i=new T,s=new T,o=e.size(),c=1;c<o;c++)if(e.getCoordinate(c-1,i),e.getCoordinate(c,s),n.computeIntersection(t,i,s),n.hasIntersection())return!0;return!1}if(arguments[0]instanceof T&&arguments[1]instanceof Array){for(var v=arguments[0],y=arguments[1],E=new Ee,L=1;L<y.length;L++){var C=y[L-1],D=y[L];if(E.computeIntersection(v,C,D),E.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(t,e){return bu.locatePointInRing(t,e)}},{key:"isInRing",value:function(t,e){return r.locateInRing(t,e)!==k.EXTERIOR}}]),r}(),Yt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"setAllLocations",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t}},{key:"isNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==k.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]===k.NONE&&(this.location[e]=t)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[F.ON]=this.location[F.ON],e[F.LEFT]=k.NONE,e[F.RIGHT]=k.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===k.NONE&&n<t.location.length&&(this.location[n]=t.location[n])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var t=this.location[F.LEFT];this.location[F.LEFT]=this.location[F.RIGHT],this.location[F.RIGHT]=t}},{key:"toString",value:function(){var t=new Ke;return this.location.length>1&&t.append(k.toLocationSymbol(this.location[F.LEFT])),t.append(k.toLocationSymbol(this.location[F.ON])),this.location.length>1&&t.append(k.toLocationSymbol(this.location[F.RIGHT])),t.toString()}},{key:"setLocations",value:function(t,e,n){this.location[F.ON]=t,this.location[F.LEFT]=e,this.location[F.RIGHT]=n}},{key:"get",value:function(t){return t<this.location.length?this.location[t]:k.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===k.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var t=arguments[0];this.setLocation(F.ON,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.location[e]=n}}},{key:"init",value:function(t){this.location=new Array(t).fill(null),this.setAllLocations(k.NONE)}},{key:"isEqualOnSide",value:function(t,e){return this.location[e]===t.location[e]}},{key:"allPositionsEqual",value:function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var e=arguments[0];this.init(1),this.location[F.ON]=e}else if(arguments[0]instanceof r){var n=arguments[0];if(this.init(n.location.length),n!==null)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2];this.init(3),this.location[F.ON]=s,this.location[F.LEFT]=o,this.location[F.RIGHT]=c}}}]),r}(),zt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getGeometryCount",value:function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t}},{key:"setAllLocations",value:function(t,e){this.elt[t].setAllLocations(e)}},{key:"isNull",value:function(t){return this.elt[t].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}}},{key:"isLine",value:function(t){return this.elt[t].isLine()}},{key:"merge",value:function(t){for(var e=0;e<2;e++)this.elt[e]===null&&t.elt[e]!==null?this.elt[e]=new Yt(t.elt[e]):this.elt[e].merge(t.elt[e])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(F.ON)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}}},{key:"toString",value:function(){var t=new Ke;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}}},{key:"isAnyNull",value:function(t){return this.elt[t].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(F.ON,e)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];this.elt[n].setLocation(i,s)}}},{key:"isEqualOnSide",value:function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)}},{key:"allPositionsEqual",value:function(t,e){return this.elt[t].allPositionsEqual(e)}},{key:"toLine",value:function(t){this.elt[t].isArea()&&(this.elt[t]=new Yt(this.elt[t].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new Yt(t),this.elt[1]=new Yt(t)}else if(arguments[0]instanceof r){var e=arguments[0];this.elt[0]=new Yt(e.elt[0]),this.elt[1]=new Yt(e.elt[1])}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[0]=new Yt(k.NONE),this.elt[1]=new Yt(k.NONE),this.elt[n].setLocation(i)}else if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2];this.elt[0]=new Yt(s,o,c),this.elt[1]=new Yt(s,o,c)}else if(arguments.length===4){var v=arguments[0],y=arguments[1],E=arguments[2],L=arguments[3];this.elt[0]=new Yt(k.NONE,k.NONE,k.NONE),this.elt[1]=new Yt(k.NONE,k.NONE,k.NONE),this.elt[v].setLocations(y,E,L)}}},{key:"toLineLabel",value:function(t){for(var e=new r(k.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e}}]),r}(),Gn=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=J.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(t){this._startDe=t;var e=t,n=!0;do{if(e===null)throw new ie("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new ie("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var i=e.getLabel();it.isTrue(i.isArea()),this.mergeLabel(i),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(t){return this._pts.get(t)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var t=this._startDe;do{var e=t.getNode().getEdges().getOutgoingDegree(this);e>this._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(t,e,n){var i=t.getCoordinates();if(e){var s=1;n&&(s=0);for(var o=s;o<i.length;o++)this._pts.add(i[o])}else{var c=i.length-2;n&&(c=i.length-1);for(var v=c;v>=0;v--)this._pts.add(i[v])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)}},{key:"containsPoint",value:function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t)||!_i.isInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0}},{key:"addHole",value:function(t){this._holes.add(t)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],i=e.getLocation(n,F.RIGHT);if(i===k.NONE)return null;if(this._label.getLocation(n)===k.NONE)return this._label.setLocation(n,i),null}}},{key:"setShell",value:function(t){this._shell=t,t!==null&&t.addHole(this)}},{key:"toPolygon",value:function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new W,this._pts=new W,this._label=new zt(k.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new W,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()}}}}]),r}(),Mu=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"setEdgeRing",value:function(n,i){n.setMinEdgeRing(i)}},{key:"getNext",value:function(n){return n.getNextMin()}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Gn.constructor_.call(this,n,i)}}]),e}(Gn),Pu=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"buildMinimalRings",value:function(){var n=new W,i=this._startDe;do{if(i.getMinEdgeRing()===null){var s=new Mu(i,this._geometryFactory);n.add(s)}i=i.getNext()}while(i!==this._startDe);return n}},{key:"setEdgeRing",value:function(n,i){n.setEdgeRing(i)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var n=this._startDe;do n.getNode().getEdges().linkMinimalDirectedEdges(this),n=n.getNext();while(n!==this._startDe)}},{key:"getNext",value:function(n){return n.getNext()}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Gn.constructor_.call(this,n,i)}}]),e}(Gn),ts=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"setVisited",value:function(t){this._isVisited=t}},{key:"setInResult",value:function(t){this._isInResult=t}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(t){this._label=t}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(t){this._isCovered=t,this._isCoveredSet=!0}},{key:"updateIM",value:function(t){it.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._label=t}}}}]),r}(),qn=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"isIncidentEdgeInResult",value:function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();)if(n.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(n){n.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(n){}},{key:"computeMergedLocation",value:function(n,i){var s=k.NONE;if(s=this._label.getLocation(i),!n.isNull(i)){var o=n.getLocation(i);s!==k.BOUNDARY&&(s=o)}return s}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return S(d(e.prototype),"setLabel",this).apply(this,arguments);var n=arguments[0],i=arguments[1];this._label===null?this._label=new zt(n,i):this._label.setLocation(n,i)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof e){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof zt)for(var i=arguments[0],s=0;s<2;s++){var o=this.computeMergedLocation(i,s),c=this._label.getLocation(s);c===k.NONE&&this._label.setLocation(s,o)}}},{key:"add",value:function(n){this._edges.insert(n),n.setNode(this)}},{key:"setLabelBoundary",value:function(n){if(this._label===null)return null;var i=k.NONE;this._label!==null&&(i=this._label.getLocation(n));var s=null;switch(i){case k.BOUNDARY:s=k.INTERIOR;break;case k.INTERIOR:default:s=k.BOUNDARY}this._label.setLocation(n,s)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new zt(0,k.NONE)}}]),e}(ts),Au=function(r){g(e,r);var t=_(e);function e(){return a(this,e),t.apply(this,arguments)}return e}(Zr);function es(r){return r==null?0:r.color}function ht(r){return r==null?null:r.parent}function Jt(r,t){r!==null&&(r.color=t)}function xi(r){return r==null?null:r.left}function ns(r){return r==null?null:r.right}var un=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),(n=t.call(this)).root_=null,n.size_=0,n}return h(e,[{key:"get",value:function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null}},{key:"put",value:function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,o,c=this.root_;do if(s=c,(o=n.compareTo(c.key))<0)c=c.left;else{if(!(o>0)){var v=c.value;return c.value=i,v}c=c.right}while(c!==null);var y={key:n,left:null,right:null,value:i,parent:s,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return o<0?s.left=y:s.right=y,this.fixAfterInsertion(y),this.size_++,null}},{key:"fixAfterInsertion",value:function(n){var i;for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)ht(n)===xi(ht(ht(n)))?es(i=ns(ht(ht(n))))===1?(Jt(ht(n),0),Jt(i,0),Jt(ht(ht(n)),1),n=ht(ht(n))):(n===ns(ht(n))&&(n=ht(n),this.rotateLeft(n)),Jt(ht(n),0),Jt(ht(ht(n)),1),this.rotateRight(ht(ht(n)))):es(i=xi(ht(ht(n))))===1?(Jt(ht(n),0),Jt(i,0),Jt(ht(ht(n)),1),n=ht(ht(n))):(n===xi(ht(n))&&(n=ht(n),this.rotateRight(n)),Jt(ht(n),0),Jt(ht(ht(n)),1),this.rotateLeft(ht(ht(n))));this.root_.color=0}},{key:"values",value:function(){var n=new W,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=e.successor(i))!==null;)n.add(i.value);return n}},{key:"entrySet",value:function(){var n=new ui,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=e.successor(i))!==null;)n.add(i);return n}},{key:"rotateLeft",value:function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent==null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}}},{key:"rotateRight",value:function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent==null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}}},{key:"getFirstEntry",value:function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return!0;i=i.right}}return!1}}],[{key:"successor",value:function(n){var i;if(n===null)return null;if(n.right!==null){for(i=n.right;i.left!==null;)i=i.left;return i}i=n.parent;for(var s=n;i!==null&&s===i.right;)s=i,i=i.parent;return i}}]),e}(Au),is=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"find",value:function(t){return this.nodeMap.get(t)}},{key:"addNode",value:function(){if(arguments[0]instanceof T){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof qn){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}}},{key:"print",value:function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(t){for(var e=new W,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===k.BOUNDARY&&e.add(i)}return e}},{key:"add",value:function(t){var e=t.getCoordinate();this.addNode(e).add(t)}}],[{key:"constructor_",value:function(){this.nodeMap=new un,this.nodeFact=null;var t=arguments[0];this.nodeFact=t}}]),r}(),Tt=function(){function r(){a(this,r)}return h(r,null,[{key:"isNorthern",value:function(t){return t===r.NE||t===r.NW}},{key:"isOpposite",value:function(t,e){return t!==e&&(t-e+4)%4===2}},{key:"commonHalfPlane",value:function(t,e){if(t===e)return t;if((t-e+4)%4===2)return-1;var n=t<e?t:e;return n===0&&(t>e?t:e)===3?3:n}},{key:"isInHalfPlane",value:function(t,e){return e===r.SE?t===r.SE||t===r.SW:t===e||t===e+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new G("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?r.NE:r.SE:e>=0?r.NW:r.SW}if(arguments[0]instanceof T&&arguments[1]instanceof T){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new G("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?r.NE:r.SE:i.y>=n.y?r.NW:r.SW}}}]),r}();Tt.NE=0,Tt.NW=1,Tt.SW=2,Tt.SE=3;var rs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"compareDirection",value:function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:J.index(t._p0,t._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(t){this._node=t}},{key:"print",value:function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),s=n.substring(i+1);t.print(" "+s+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)}},{key:"compareTo",value:function(t){var e=t;return this.compareDirection(e)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label}},{key:"computeLabel",value:function(t){}},{key:"init",value:function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=Tt.quadrant(this._dx,this._dy),it.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2];r.constructor_.call(this,e,n,i,null)}else if(arguments.length===4){var s=arguments[0],o=arguments[1],c=arguments[2],v=arguments[3];r.constructor_.call(this,s),this.init(o,c),this._label=v}}}]),r}(),ki=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(n){return this._depth[n]}},{key:"setVisited",value:function(n){this._isVisited=n}},{key:"computeDirectedLabel",value:function(){this._label=new zt(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(n,i){if(this._depth[n]!==-999&&this._depth[n]!==i)throw new ie("assigned depths do not match",this.getCoordinate());this._depth[n]=i}},{key:"isInteriorAreaEdge",value:function(){for(var n=!0,i=0;i<2;i++)this._label.isArea(i)&&this._label.getLocation(i,F.LEFT)===k.INTERIOR&&this._label.getLocation(i,F.RIGHT)===k.INTERIOR||(n=!1);return n}},{key:"setNextMin",value:function(n){this._nextMin=n}},{key:"print",value:function(n){S(d(e.prototype),"print",this).call(this,n),n.print(" "+this._depth[F.LEFT]+"/"+this._depth[F.RIGHT]),n.print(" ("+this.getDepthDelta()+")"),this._isInResult&&n.print(" inResult")}},{key:"setMinEdgeRing",value:function(n){this._minEdgeRing=n}},{key:"isLineEdge",value:function(){var n=this._label.isLine(0)||this._label.isLine(1),i=!this._label.isArea(0)||this._label.allPositionsEqual(0,k.EXTERIOR),s=!this._label.isArea(1)||this._label.allPositionsEqual(1,k.EXTERIOR);return n&&i&&s}},{key:"setEdgeRing",value:function(n){this._edgeRing=n}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var n=this._edge.getDepthDelta();return this._isForward||(n=-n),n}},{key:"setInResult",value:function(n){this._isInResult=n}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(n){this.print(n),n.print(" "),this._isForward?this._edge.print(n):this._edge.printReverse(n)}},{key:"setSym",value:function(n){this._sym=n}},{key:"setVisitedEdge",value:function(n){this.setVisited(n),this._sym.setVisited(n)}},{key:"setEdgeDepths",value:function(n,i){var s=this.getEdge().getDepthDelta();this._isForward||(s=-s);var o=1;n===F.LEFT&&(o=-1);var c=F.opposite(n),v=i+s*o;this.setDepth(n,i),this.setDepth(c,v)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(n){this._next=n}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var n=arguments[0],i=arguments[1];if(rs.constructor_.call(this,n),this._isForward=i,i)this.init(n.getCoordinate(0),n.getCoordinate(1));else{var s=n.getNumPoints()-1;this.init(n.getCoordinate(s),n.getCoordinate(s-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(n,i){return n===k.EXTERIOR&&i===k.INTERIOR?1:n===k.INTERIOR&&i===k.EXTERIOR?-1:0}}]),e}(rs),ss=function(){function r(){a(this,r)}return h(r,[{key:"createNode",value:function(t){return new qn(t,null)}}]),r}(),as=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"printEdges",value:function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}}},{key:"find",value:function(t){return this._nodes.find(t)}},{key:"addNode",value:function(){if(arguments[0]instanceof qn){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof T){var e=arguments[0];return this._nodes.addNode(e)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(t){qt.out.println(t)}},{key:"isBoundaryNode",value:function(t,e){var n=this._nodes.find(e);if(n===null)return!1;var i=n.getLabel();return i!==null&&i.getLocation(t)===k.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(t,e,n,i){return!!t.equals(n)&&J.index(t,e,i)===J.COLLINEAR&&Tt.quadrant(t,e)===Tt.quadrant(n,i)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(t){qt.out.print(t)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(t,e){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),s=i.getCoordinates();if(this.matchInSameDirection(t,e,s[0],s[1])||this.matchInSameDirection(t,e,s[s.length-1],s[s.length-2]))return i}return null}},{key:"insertEdge",value:function(t){this._edges.add(t)}},{key:"findEdgeEnd",value:function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null}},{key:"addEdges",value:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var i=new ki(n,!0),s=new ki(n,!1);i.setSym(s),s.setSym(i),this.add(i),this.add(s)}}},{key:"add",value:function(t){this._nodes.add(t),this._edgeEndList.add(t)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(t,e){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),s=i.getCoordinates();if(t.equals(s[0])&&e.equals(s[1]))return i}return null}}],[{key:"constructor_",value:function(){if(this._edges=new W,this._nodes=null,this._edgeEndList=new W,arguments.length===0)this._nodes=new is(new ss);else if(arguments.length===1){var t=arguments[0];this._nodes=new is(t)}}},{key:"linkResultDirectedEdges",value:function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()}}]),r}(),Du=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"sortShellsAndHoles",value:function(t,e,n){for(var i=t.iterator();i.hasNext();){var s=i.next();s.isHole()?n.add(s):e.add(s)}}},{key:"computePolygons",value:function(t){for(var e=new W,n=t.iterator();n.hasNext();){var i=n.next().toPolygon(this._geometryFactory);e.add(i)}return e}},{key:"placeFreeHoles",value:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();if(i.getShell()===null){var s=r.findEdgeRingContaining(i,t);if(s===null)throw new ie("unable to assign hole to a shell",i.getCoordinate(0));i.setShell(s)}}}},{key:"buildMinimalEdgeRings",value:function(t,e,n){for(var i=new W,s=t.iterator();s.hasNext();){var o=s.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var c=o.buildMinimalRings(),v=this.findShell(c);v!==null?(this.placePolygonHoles(v,c),e.add(v)):n.addAll(c)}else i.add(o)}return i}},{key:"buildMaximalEdgeRings",value:function(t){for(var e=new W,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var s=new Pu(i,this._geometryFactory);e.add(s),s.setInResult()}}return e}},{key:"placePolygonHoles",value:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var s=i.next();s.isHole()||(n=s,e++)}return it.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n}},{key:"add",value:function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];as.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),s=new W,o=this.buildMinimalEdgeRings(i,this._shellList,s);this.sortShellsAndHoles(o,this._shellList,s),this.placeFreeHoles(this._shellList,s)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new W;var t=arguments[0];this._geometryFactory=t}},{key:"findEdgeRingContaining",value:function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),s=n.getCoordinateN(0),o=null,c=null,v=e.iterator();v.hasNext();){var y=v.next(),E=y.getLinearRing(),L=E.getEnvelopeInternal();if(!L.equals(i)&&L.contains(i)){s=_t.ptNotInList(n.getCoordinates(),E.getCoordinates());var C=!1;_i.isInRing(s,E.getCoordinates())&&(C=!0),C&&(o===null||c.contains(L))&&(c=(o=y).getLinearRing().getEnvelopeInternal())}}return o}}]),r}(),us=function(){function r(){a(this,r)}return h(r,[{key:"getBounds",value:function(){}}]),r}(),se=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[us,U]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}}]),r}(),Yn=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"poll",value:function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(t){for(var e=null,n=this._items.get(t);2*t<=this._size&&((e=2*t)!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(n)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,n)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new W,this._items.add(null)}}]),r}(),Fu=function(){function r(){a(this,r)}return h(r,[{key:"insert",value:function(t,e){}},{key:"remove",value:function(t,e){}},{key:"query",value:function(){}}]),r}(),Bt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(t){it.isTrue(this._bounds===null),this._childBoundables.add(t)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[us,U]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new W,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}}}]),r}(),qe={reverseOrder:function(){return{compare:function(r,t){return t.compareTo(r)}}},min:function(r){return qe.sort(r),r.get(0)},sort:function(r,t){var e=r.toArray();t?_e.sort(e,t):_e.sort(e);for(var n=r.iterator(),i=0,s=e.length;i<s;i++)n.next(),n.set(e[i])},singletonList:function(r){var t=new W;return t.add(r),t}},Gu=function(){function r(){a(this,r)}return h(r,null,[{key:"maxDistance",value:function(t,e,n,i,s,o,c,v){var y=r.distance(t,e,s,o);return y=Math.max(y,r.distance(t,e,c,v)),y=Math.max(y,r.distance(n,i,s,o)),y=Math.max(y,r.distance(n,i,c,v))}},{key:"distance",value:function(t,e,n,i){var s=n-t,o=i-e;return Math.sqrt(s*s+o*o)}},{key:"maximumDistance",value:function(t,e){var n=Math.min(t.getMinX(),e.getMinX()),i=Math.min(t.getMinY(),e.getMinY()),s=Math.max(t.getMaxX(),e.getMaxX()),o=Math.max(t.getMaxY(),e.getMaxY());return r.distance(n,i,s,o)}},{key:"minMaxDistance",value:function(t,e){var n=t.getMinX(),i=t.getMinY(),s=t.getMaxX(),o=t.getMaxY(),c=e.getMinX(),v=e.getMinY(),y=e.getMaxX(),E=e.getMaxY(),L=r.maxDistance(n,i,n,o,c,v,c,E);return L=Math.min(L,r.maxDistance(n,i,n,o,c,v,y,v)),L=Math.min(L,r.maxDistance(n,i,n,o,y,E,c,E)),L=Math.min(L,r.maxDistance(n,i,n,o,y,E,y,v)),L=Math.min(L,r.maxDistance(n,i,s,i,c,v,c,E)),L=Math.min(L,r.maxDistance(n,i,s,i,c,v,y,v)),L=Math.min(L,r.maxDistance(n,i,s,i,y,E,c,E)),L=Math.min(L,r.maxDistance(n,i,s,i,y,E,y,v)),L=Math.min(L,r.maxDistance(s,o,n,o,c,v,c,E)),L=Math.min(L,r.maxDistance(s,o,n,o,c,v,y,v)),L=Math.min(L,r.maxDistance(s,o,n,o,y,E,c,E)),L=Math.min(L,r.maxDistance(s,o,n,o,y,E,y,v)),L=Math.min(L,r.maxDistance(s,o,s,i,c,v,c,E)),L=Math.min(L,r.maxDistance(s,o,s,i,c,v,y,v)),L=Math.min(L,r.maxDistance(s,o,s,i,y,E,c,E)),L=Math.min(L,r.maxDistance(s,o,s,i,y,E,y,v))}}]),r}(),Ye=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"maximumDistance",value:function(){return Gu.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(t,e){var n=r.isComposite(this._boundable1),i=r.isComposite(this._boundable2);if(n&&i)return r.area(this._boundable1)>r.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,e),null):(this.expand(this._boundable2,this._boundable1,!0,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,!1,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,!0,t,e),null;throw new G("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(r.isComposite(this._boundable1)||r.isComposite(this._boundable2))}},{key:"compareTo",value:function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0}},{key:"expand",value:function(t,e,n,i,s){for(var o=t.getChildBoundables().iterator();o.hasNext();){var c=o.next(),v=null;(v=n?new r(e,c,this._itemDistance):new r(c,e,this._itemDistance)).getDistance()<s&&i.add(v)}}},{key:"getBoundable",value:function(t){return t===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()}},{key:"area",value:function(t){return t.getBounds().getArea()}},{key:"isComposite",value:function(t){return t instanceof Bt}}]),r}(),os=function(){function r(){a(this,r)}return h(r,[{key:"visitItem",value:function(t){}}]),r}(),ze=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"queryInternal",value:function(){if(tt(arguments[2],os)&&arguments[0]instanceof Object&&arguments[1]instanceof Bt)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=e.getChildBoundables(),s=0;s<i.size();s++){var o=i.get(s);this.getIntersectsOp().intersects(o.getBounds(),t)&&(o instanceof Bt?this.queryInternal(t,o,n):o instanceof se?n.visitItem(o.getItem()):it.shouldNeverReachHere())}else if(tt(arguments[2],de)&&arguments[0]instanceof Object&&arguments[1]instanceof Bt)for(var c=arguments[0],v=arguments[1],y=arguments[2],E=v.getChildBoundables(),L=0;L<E.size();L++){var C=E.get(L);this.getIntersectsOp().intersects(C.getBounds(),c)&&(C instanceof Bt?this.queryInternal(c,C,y):C instanceof se?y.add(C.getItem()):it.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(t){return t.get(t.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=arguments[0],e=0,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof Bt?e+=this.size(i):i instanceof se&&(e+=1)}return e}}},{key:"removeItem",value:function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof se&&s.getItem()===e&&(n=s)}return n!==null&&(t.getChildBoundables().remove(n),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new W:t}if(arguments.length===1){for(var e=arguments[0],n=new W,i=e.getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Bt){var o=this.itemsTree(s);o!==null&&n.add(o)}else s instanceof se?n.add(s.getItem()):it.shouldNeverReachHere()}return n.size()<=0?null:n}}},{key:"insert",value:function(t,e){it.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new se(t,e))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var t=arguments[0],e=new W;return this.boundablesAtLevel(t,this._root,e),e}if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];if(it.isTrue(n>-2),i.getLevel()===n)return s.add(i),null;for(var o=i.getChildBoundables().iterator();o.hasNext();){var c=o.next();c instanceof Bt?this.boundablesAtLevel(n,c,s):(it.isTrue(c instanceof se),n===-1&&s.add(c))}return null}}},{key:"query",value:function(){if(arguments.length===1){var t=arguments[0];this.build();var e=new W;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,i)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],o=this.removeItem(i,s);if(o)return!0;for(var c=null,v=i.getChildBoundables().iterator();v.hasNext();){var y=v.next();if(this.getIntersectsOp().intersects(y.getBounds(),n)&&y instanceof Bt&&(o=this.remove(n,y,s))){c=y;break}}return c!==null&&c.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(c),o}}},{key:"createHigherLevels",value:function(t,e){it.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return n.size()===1?n.get(0):this.createHigherLevels(n,e+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var t=arguments[0],e=0,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof Bt){var s=this.depth(i);s>e&&(e=s)}}return e+1}}},{key:"createParentBoundables",value:function(t,e){it.isTrue(!t.isEmpty());var n=new W;n.add(this.createNode(e));var i=new W(t);qe.sort(i,this.getComparator());for(var s=i.iterator();s.hasNext();){var o=s.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(o)}return n}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[U]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new W,this._nodeCapacity=null,arguments.length===0)r.constructor_.call(this,r.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var t=arguments[0];it.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}},{key:"compareDoubles",value:function(t,e){return t>e?1:t<e?-1:0}}]),r}();ze.IntersectsOp=function(){},ze.DEFAULT_NODE_CAPACITY=10;var qu=function(){function r(){a(this,r)}return h(r,[{key:"distance",value:function(t,e){}}]),r}(),Kt=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"createParentBoundablesFromVerticalSlices",value:function(n,i){it.isTrue(n.length>0);for(var s=new W,o=0;o<n.length;o++)s.addAll(this.createParentBoundablesFromVerticalSlice(n[o],i));return s}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.nearestNeighbourK(n,H.POSITIVE_INFINITY,i)}if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2],v=o,y=new Yn;y.add(s);for(var E=new Yn;!y.isEmpty()&&v>=0;){var L=y.poll(),C=L.getDistance();if(C>=v)break;if(L.isLeaves())if(E.size()<c)E.add(L);else{var D=E.peek();D.getDistance()>C&&(E.poll(),E.add(L));var P=E.peek();v=P.getDistance()}else L.expandToQueue(y,v)}return e.getItems(E)}}},{key:"createNode",value:function(n){return new ls(n)}},{key:"size",value:function(){return arguments.length===0?S(d(e.prototype),"size",this).call(this):S(d(e.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof vt))return S(d(e.prototype),"insert",this).apply(this,arguments);var n=arguments[0],i=arguments[1];if(n.isNull())return null;S(d(e.prototype),"insert",this).call(this,n,i)}},{key:"getIntersectsOp",value:function(){return e.intersectsOp}},{key:"verticalSlices",value:function(n,i){for(var s=Math.trunc(Math.ceil(n.size()/i)),o=new Array(i).fill(null),c=n.iterator(),v=0;v<i;v++){o[v]=new W;for(var y=0;c.hasNext()&&y<s;){var E=c.next();o[v].add(E),y++}}return o}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];return S(d(e.prototype),"query",this).call(this,n)}if(arguments.length===2){var i=arguments[0],s=arguments[1];S(d(e.prototype),"query",this).call(this,i,s)}}},{key:"getComparator",value:function(){return e.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(n,i){return S(d(e.prototype),"createParentBoundables",this).call(this,n,i)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof vt){var n=arguments[0],i=arguments[1];return S(d(e.prototype),"remove",this).call(this,n,i)}return S(d(e.prototype),"remove",this).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?S(d(e.prototype),"depth",this).call(this):S(d(e.prototype),"depth",this).apply(this,arguments)}},{key:"createParentBoundables",value:function(n,i){it.isTrue(!n.isEmpty());var s=Math.trunc(Math.ceil(n.size()/this.getNodeCapacity())),o=new W(n);qe.sort(o,e.xComparator);var c=this.verticalSlices(o,Math.trunc(Math.ceil(Math.sqrt(s))));return this.createParentBoundablesFromVerticalSlices(c,i)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(tt(arguments[0],qu)){var n=arguments[0];if(this.isEmpty())return null;var i=new Ye(this.getRoot(),this.getRoot(),n);return this.nearestNeighbour(i)}if(arguments[0]instanceof Ye){var s=arguments[0],o=H.POSITIVE_INFINITY,c=null,v=new Yn;for(v.add(s);!v.isEmpty()&&o>0;){var y=v.poll(),E=y.getDistance();if(E>=o)break;y.isLeaves()?(o=E,c=y):y.expandToQueue(v,o)}return c===null?null:[c.getBoundable(0).getItem(),c.getBoundable(1).getItem()]}}else{if(arguments.length===2){var L=arguments[0],C=arguments[1];if(this.isEmpty()||L.isEmpty())return null;var D=new Ye(this.getRoot(),L.getRoot(),C);return this.nearestNeighbour(D)}if(arguments.length===3){var P=arguments[0],Z=arguments[1],j=arguments[2],K=new se(P,Z),ct=new Ye(this.getRoot(),K,j);return this.nearestNeighbour(ct)[0]}if(arguments.length===4){var pt=arguments[0],St=arguments[1],Dt=arguments[2],Zt=arguments[3],ae=new se(pt,St),Ne=new Ye(this.getRoot(),ae,Dt);return this.nearestNeighbourK(Ne,Zt)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=H.POSITIVE_INFINITY,o=new Yn;for(o.add(n);!o.isEmpty();){var c=o.poll(),v=c.getDistance();if(v>i)return!1;if(c.maximumDistance()<=i)return!0;if(c.isLeaves()){if((s=v)<=i)return!0}else c.expandToQueue(o,s)}return!1}if(arguments.length===3){var y=arguments[0],E=arguments[1],L=arguments[2],C=new Ye(this.getRoot(),y.getRoot(),E);return this.isWithinDistance(C,L)}}},{key:"interfaces_",get:function(){return[Fu,U]}}],[{key:"constructor_",value:function(){if(arguments.length===0)e.constructor_.call(this,e.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];ze.constructor_.call(this,n)}}},{key:"centreX",value:function(n){return e.avg(n.getMinX(),n.getMaxX())}},{key:"avg",value:function(n,i){return(n+i)/2}},{key:"getItems",value:function(n){for(var i=new Array(n.size()).fill(null),s=0;!n.isEmpty();){var o=n.poll();i[s]=o.getBoundable(0).getItem(),s++}return i}},{key:"centreY",value:function(n){return e.avg(n.getMinY(),n.getMaxY())}}]),e}(ze),ls=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"computeBounds",value:function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var s=i.next();n===null?n=new vt(s.getBounds()):n.expandToInclude(s.getBounds())}return n}}],[{key:"constructor_",value:function(){var n=arguments[0];Bt.constructor_.call(this,n)}}]),e}(Bt);Kt.STRtreeNode=ls,Kt.xComparator=new(function(){function r(){a(this,r)}return h(r,[{key:"interfaces_",get:function(){return[Lt]}},{key:"compare",value:function(t,e){return ze.compareDoubles(Kt.centreX(t.getBounds()),Kt.centreX(e.getBounds()))}}]),r}()),Kt.yComparator=new(function(){function r(){a(this,r)}return h(r,[{key:"interfaces_",get:function(){return[Lt]}},{key:"compare",value:function(t,e){return ze.compareDoubles(Kt.centreY(t.getBounds()),Kt.centreY(e.getBounds()))}}]),r}()),Kt.intersectsOp=new(function(){function r(){a(this,r)}return h(r,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(t,e){return t.intersects(e)}}]),r}()),Kt.DEFAULT_NODE_CAPACITY=10;var Yu=function(){function r(){a(this,r)}return h(r,null,[{key:"relativeSign",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"compare",value:function(t,e,n){if(e.equals2D(n))return 0;var i=r.relativeSign(e.x,n.x),s=r.relativeSign(e.y,n.y);switch(t){case 0:return r.compareValue(i,s);case 1:return r.compareValue(s,i);case 2:return r.compareValue(s,-i);case 3:return r.compareValue(-i,s);case 4:return r.compareValue(-i,-s);case 5:return r.compareValue(-s,-i);case 6:return r.compareValue(-s,i);case 7:return r.compareValue(i,-s)}return it.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}}]),r}(),zu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:this._isInterior?e._isInterior?Yu.compare(this._segmentOctant,this.coord,e.coord):1:-1}},{key:"isEndPoint",value:function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._segString=t,this.coord=new T(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))}}]),r}(),Bu=function(){function r(){a(this,r)}return h(r,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),r}(),Xu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getSplitCoordinates",value:function(){var t=new rn;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next();this.addEdgeCoordinates(n,i,t),n=i}return t.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var t=new W;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}}},{key:"createSplitEdgePts",value:function(t,e){var n=e.segmentIndex-t.segmentIndex+2;if(n===2)return[new T(t.coord),new T(e.coord)];var i=this._edge.getCoordinate(e.segmentIndex),s=e.isInterior()||!e.coord.equals2D(i);s||n--;var o=new Array(n).fill(null),c=0;o[c++]=new T(t.coord);for(var v=t.segmentIndex+1;v<=e.segmentIndex;v++)o[c++]=this._edge.getCoordinate(v);return s&&(o[c]=new T(e.coord)),o}},{key:"print",value:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"findCollapsesFromExistingVertices",value:function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e);this._edge.getCoordinate(e+1);var i=this._edge.getCoordinate(e+2);n.equals2D(i)&&t.add(Rn.valueOf(e+1))}}},{key:"addEdgeCoordinates",value:function(t,e,n){var i=this.createSplitEdgePts(t,e);n.add(i,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),s=this.createSplitEdge(n,i);t.add(s),n=i}}},{key:"findCollapseIndex",value:function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var i=e.segmentIndex-t.segmentIndex;return e.isInterior()||i--,i===1&&(n[0]=t.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(t){for(var e=new Array(1).fill(null),n=this.iterator(),i=n.next();n.hasNext();){var s=n.next();this.findCollapseIndex(i,s,e)&&t.add(Rn.valueOf(e[0])),i=s}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)}},{key:"createSplitEdge",value:function(t,e){var n=this.createSplitEdgePts(t,e);return new Ie(n,this._edge.getData())}},{key:"add",value:function(t,e){var n=new zu(this._edge,t,e,this._edge.getSegmentOctant(e)),i=this._nodeMap.get(n);return i!==null?(it.isTrue(i.coord.equals2D(t),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)}},{key:"checkSplitEdgesCorrectness",value:function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new It("bad split edge start point at "+n);var i=t.get(t.size()-1).getCoordinates(),s=i[i.length-1];if(!s.equals2D(e[e.length-1]))throw new It("bad split edge end point at "+s)}}],[{key:"constructor_",value:function(){this._nodeMap=new un,this._edge=null;var t=arguments[0];this._edge=t}}]),r}(),Uu=function(){function r(){a(this,r)}return h(r,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new G("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),i=Math.abs(e);return t>=0?e>=0?n>=i?0:1:n>=i?7:6:e>=0?n>=i?3:2:n>=i?4:5}if(arguments[0]instanceof T&&arguments[1]instanceof T){var s=arguments[0],o=arguments[1],c=o.x-s.x,v=o.y-s.y;if(c===0&&v===0)throw new G("Cannot compute the octant for two identical points "+s);return r.octant(c,v)}}}]),r}(),Vu=function(){function r(){a(this,r)}return h(r,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(t){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(t){}},{key:"getData",value:function(){}}]),r}(),Hu=function(){function r(){a(this,r)}return h(r,[{key:"addIntersection",value:function(t,e){}},{key:"interfaces_",get:function(){return[Vu]}}]),r}(),Ie=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(t){return this._pts[t]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}},{key:"setData",value:function(t){this._data=t}},{key:"safeOctant",value:function(t,e){return t.equals2D(e)?0:Uu.octant(t,e)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[3],o=new T(n.getIntersection(s));this.addIntersection(o,i)}}},{key:"toString",value:function(){return pi.toLineString(new sn(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(t,e){var n=e,i=n+1;if(i<this._pts.length){var s=this._pts[i];t.equals2D(s)&&(n=i)}return this._nodeList.add(t,n)}},{key:"addIntersections",value:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)}},{key:"interfaces_",get:function(){return[Hu]}}],[{key:"constructor_",value:function(){this._nodeList=new Xu(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var t=arguments[0],e=new W;return r.getNodedSubstrings(t,e),e}if(arguments.length===2)for(var n=arguments[0],i=arguments[1],s=n.iterator();s.hasNext();){var o=s.next();o.getNodeList().addSplitEdges(i)}}}]),r}(),Pt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof r){var t=arguments[0],e=J.index(this.p0,this.p1,t.p0),n=J.index(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof T){var i=arguments[0];return J.index(this.p0,this.p1,i)}}},{key:"toGeometry",value:function(t){return t.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(t){if(!(t instanceof r))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)}},{key:"intersection",value:function(t){var e=new Ee;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof T){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new T(t);var e=this.projectionFactor(t),n=new T;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof r){var i=arguments[0],s=this.projectionFactor(i.p0),o=this.projectionFactor(i.p1);if(s>=1&&o>=1||s<=0&&o<=0)return null;var c=this.project(i.p0);s<0&&(c=this.p0),s>1&&(c=this.p1);var v=this.project(i.p1);return o<0&&(v=this.p0),o>1&&(v=this.p1),new r(c,v)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(t){return t===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(t){return Qt.pointToLinePerpendicular(t,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return r.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=e*e+n*n;return i<=0?H.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i}},{key:"closestPoints",value:function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),i=H.MAX_VALUE,s=null,o=this.closestPoint(t.p0);i=o.distance(t.p0),n[0]=o,n[1]=t.p0;var c=this.closestPoint(t.p1);(s=c.distance(t.p1))<i&&(i=s,n[0]=c,n[1]=t.p1);var v=t.closestPoint(this.p0);(s=v.distance(this.p0))<i&&(i=s,n[0]=this.p0,n[1]=v);var y=t.closestPoint(this.p1);return(s=y.distance(this.p1))<i&&(i=s,n[0]=this.p1,n[1]=y),n}},{key:"closestPoint",value:function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(t){var e=t,n=this.p0.compareTo(e.p0);return n!==0?n:this.p1.compareTo(e.p1)}},{key:"reverse",value:function(){var t=this.p0;this.p0=this.p1,this.p1=t}},{key:"equalsTopo",value:function(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)}},{key:"lineIntersection",value:function(t){return hi.intersection(this.p0,this.p1,t.p0,t.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),i=this.p0.y+t*(this.p1.y-this.p0.y),s=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,c=Math.sqrt(s*s+o*o),v=0,y=0;if(e!==0){if(c<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");v=e*s/c,y=e*o/c}return new T(n-y,i+v)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}}},{key:"segmentFraction",value:function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||H.isNaN(e))&&(e=1),e}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(t){var e=this.p1.getY()-this.p0.getY(),n=this.p0.getX()-this.p1.getX(),i=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),s=e*e+n*n,o=e*e-n*n,c=t.getX(),v=t.getY();return new T((-o*c-2*e*n*v-2*e*i)/s,(o*v-2*e*n*c-2*n*i)/s)}},{key:"distance",value:function(){if(arguments[0]instanceof r){var t=arguments[0];return Qt.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof T){var e=arguments[0];return Qt.pointToSegment(e,this.p0,this.p1)}}},{key:"pointAlong",value:function(t){var e=new T;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e}},{key:"hashCode",value:function(){var t=H.doubleToLongBits(this.p0.x);t^=31*H.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=H.doubleToLongBits(this.p1.x);return n^=31*H.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))}},{key:"interfaces_",get:function(){return[X,U]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)r.constructor_.call(this,new T,new T);else if(arguments.length===1){var t=arguments[0];r.constructor_.call(this,t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.p0=e,this.p1=n}else if(arguments.length===4){var i=arguments[0],s=arguments[1],o=arguments[2],c=arguments[3];r.constructor_.call(this,new T(i,s),new T(o,c))}}},{key:"midPoint",value:function(t,e){return new T((t.x+e.x)/2,(t.y+e.y)/2)}}]),r}(),Zu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Pt,this._overlapSeg2=new Pt}}]),r}(),hs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getLineSegment",value:function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]}},{key:"computeSelect",value:function(t,e,n,i){var s=this._pts[e],o=this._pts[n];if(n-e==1)return i.select(this,e),null;if(!t.intersects(s,o))return null;var c=Math.trunc((e+n)/2);e<c&&this.computeSelect(t,e,c,i),c<n&&this.computeSelect(t,c,n,i)}},{key:"getCoordinates",value:function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.computeOverlaps(this._start,this._end,t,t._start,t._end,e)}else if(arguments.length===6){var n=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3],c=arguments[4],v=arguments[5];if(i-n==1&&c-o==1)return v.overlap(this,n,s,o),null;if(!this.overlaps(n,i,s,o,c))return null;var y=Math.trunc((n+i)/2),E=Math.trunc((o+c)/2);n<y&&(o<E&&this.computeOverlaps(n,y,s,o,E,v),E<c&&this.computeOverlaps(n,y,s,E,c,v)),y<i&&(o<E&&this.computeOverlaps(y,i,s,o,E,v),E<c&&this.computeOverlaps(y,i,s,E,c,v))}}},{key:"setId",value:function(t){this._id=t}},{key:"select",value:function(t,e){this.computeSelect(t,this._start,this._end,e)}},{key:"getEnvelope",value:function(){if(this._env===null){var t=this._pts[this._start],e=this._pts[this._end];this._env=new vt(t,e)}return this._env}},{key:"overlaps",value:function(t,e,n,i,s){return vt.intersects(this._pts[t],this._pts[e],n._pts[i],n._pts[s])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=i}}]),r}(),$u=function(){function r(){a(this,r)}return h(r,null,[{key:"findChainEnd",value:function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var i=Tt.quadrant(t[n],t[n+1]),s=e+1;s<t.length&&!(!t[s-1].equals2D(t[s])&&Tt.quadrant(t[s-1],t[s])!==i);)s++;return s-1}},{key:"getChains",value:function(){if(arguments.length===1){var t=arguments[0];return r.getChains(t,null)}if(arguments.length===2){var e=arguments[0],n=arguments[1],i=new W,s=0;do{var o=r.findChainEnd(e,s),c=new hs(e,s,o,n);i.add(c),s=o}while(s<e.length-1);return i}}}]),r}(),Ei=function(){function r(){a(this,r)}return h(r,[{key:"computeNodes",value:function(t){}},{key:"getNodedSubstrings",value:function(){}}]),r}(),cs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"setSegmentIntersector",value:function(t){this._segInt=t}},{key:"interfaces_",get:function(){return[Ei]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setSegmentIntersector(t)}}}}]),r}(),Ii=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return Ie.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(n){for(var i=$u.getChains(n.getCoordinates(),n).iterator();i.hasNext();){var s=i.next();s.setId(this._idCounter++),this._index.insert(s.getEnvelope(),s),this._monoChains.add(s)}}},{key:"computeNodes",value:function(n){this._nodedSegStrings=n;for(var i=n.iterator();i.hasNext();)this.add(i.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var n=new fs(this._segInt),i=this._monoChains.iterator();i.hasNext();)for(var s=i.next(),o=this._index.query(s.getEnvelope()).iterator();o.hasNext();){var c=o.next();if(c.getId()>s.getId()&&(s.computeOverlaps(c,n),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new W,this._index=new Kt,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var n=arguments[0];cs.constructor_.call(this,n)}}}}]),e}(cs),fs=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"overlap",value:function(){if(arguments.length!==4)return S(d(e.prototype),"overlap",this).apply(this,arguments);var n=arguments[0],i=arguments[1],s=arguments[2],o=arguments[3],c=n.getContext(),v=s.getContext();this._si.processIntersections(c,i,v,o)}}],[{key:"constructor_",value:function(){this._si=null;var n=arguments[0];this._si=n}}]),e}(Zu);Ii.SegmentOverlapAction=fs;var Ht=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"isDeletable",value:function(t,e,n,i){var s=this._inputLine[t],o=this._inputLine[e],c=this._inputLine[n];return!!this.isConcave(s,o,c)&&!!this.isShallow(s,o,c,i)&&this.isShallowSampled(s,o,t,n,i)}},{key:"deleteShallowConcavities",value:function(){for(var t=1,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e),i=!1;n<this._inputLine.length;){var s=!1;this.isDeletable(t,e,n,this._distanceTol)&&(this._isDeleted[e]=r.DELETE,s=!0,i=!0),t=s?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return i}},{key:"isShallowConcavity",value:function(t,e,n,i){return J.index(t,e,n)===this._angleOrientation&&Qt.pointToSegment(e,t,n)<i}},{key:"isShallowSampled",value:function(t,e,n,i,s){var o=Math.trunc((i-n)/r.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var c=n;c<i;c+=o)if(!this.isShallow(t,e,this._inputLine[c],s))return!1;return!0}},{key:"isConcave",value:function(t,e,n){var i=J.index(t,e,n)===this._angleOrientation;return i}},{key:"simplify",value:function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=J.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do e=this.deleteShallowConcavities();while(e);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===r.DELETE;)e++;return e}},{key:"isShallow",value:function(t,e,n,i){return Qt.pointToSegment(e,t,n)<i}},{key:"collapseLine",value:function(){for(var t=new rn,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==r.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=J.COUNTERCLOCKWISE;var t=arguments[0];this._inputLine=t}},{key:"simplify",value:function(t,e){return new r(t).simplify(e)}}]),r}();Ht.INIT=0,Ht.DELETE=1,Ht.KEEP=1,Ht.NUM_PTS_TO_CHECK=10;var gs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getCoordinates",value:function(){return this._ptList.toArray(r.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"addPt",value:function(t){var e=new T(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var i=t.length-1;i>=0;i--)this.addPt(t[i])}},{key:"isRedundant",value:function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance}},{key:"toString",value:function(){return new Fe().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var t=new T(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)}},{key:"setMinimumVertexDistance",value:function(t){this._minimimVertexDistance=t}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new W}}]),r}();gs.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var At=function(){function r(){a(this,r)}return h(r,null,[{key:"toDegrees",value:function(t){return 180*t/Math.PI}},{key:"normalize",value:function(t){for(;t>Math.PI;)t-=r.PI_TIMES_2;for(;t<=-Math.PI;)t+=r.PI_TIMES_2;return t}},{key:"angle",value:function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}if(arguments.length===2){var e=arguments[0],n=arguments[1],i=n.x-e.x,s=n.y-e.y;return Math.atan2(s,i)}}},{key:"isAcute",value:function(t,e,n){var i=t.x-e.x,s=t.y-e.y;return i*(n.x-e.x)+s*(n.y-e.y)>0}},{key:"isObtuse",value:function(t,e,n){var i=t.x-e.x,s=t.y-e.y;return i*(n.x-e.x)+s*(n.y-e.y)<0}},{key:"interiorAngle",value:function(t,e,n){var i=r.angle(e,t),s=r.angle(e,n);return Math.abs(s-i)}},{key:"normalizePositive",value:function(t){if(t<0){for(;t<0;)t+=r.PI_TIMES_2;t>=r.PI_TIMES_2&&(t=0)}else{for(;t>=r.PI_TIMES_2;)t-=r.PI_TIMES_2;t<0&&(t=0)}return t}},{key:"angleBetween",value:function(t,e,n){var i=r.angle(e,t),s=r.angle(e,n);return r.diff(i,s)}},{key:"diff",value:function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n}},{key:"toRadians",value:function(t){return t*Math.PI/180}},{key:"getTurn",value:function(t,e){var n=Math.sin(e-t);return n>0?r.COUNTERCLOCKWISE:n<0?r.CLOCKWISE:r.NONE}},{key:"angleBetweenOriented",value:function(t,e,n){var i=r.angle(e,t),s=r.angle(e,n)-i;return s<=-Math.PI?s+r.PI_TIMES_2:s>Math.PI?s-r.PI_TIMES_2:s}}]),r}();At.PI_TIMES_2=2*Math.PI,At.PI_OVER_2=Math.PI/2,At.PI_OVER_4=Math.PI/4,At.COUNTERCLOCKWISE=J.COUNTERCLOCKWISE,At.CLOCKWISE=J.CLOCKWISE,At.NONE=J.COLLINEAR;var on=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"addNextSegment",value:function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=J.index(this._s0,this._s1,this._s2),i=n===J.CLOCKWISE&&this._side===F.LEFT||n===J.COUNTERCLOCKWISE&&this._side===F.RIGHT;n===0?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)}},{key:"addLineEndCap",value:function(t,e){var n=new Pt(t,e),i=new Pt;this.computeOffsetSegment(n,F.LEFT,this._distance,i);var s=new Pt;this.computeOffsetSegment(n,F.RIGHT,this._distance,s);var o=e.x-t.x,c=e.y-t.y,v=Math.atan2(c,o);switch(this._bufParams.getEndCapStyle()){case b.CAP_ROUND:this._segList.addPt(i.p1),this.addDirectedFillet(e,v+Math.PI/2,v-Math.PI/2,J.CLOCKWISE,this._distance),this._segList.addPt(s.p1);break;case b.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(s.p1);break;case b.CAP_SQUARE:var y=new T;y.x=Math.abs(this._distance)*Math.cos(v),y.y=Math.abs(this._distance)*Math.sin(v);var E=new T(i.p1.x+y.x,i.p1.y+y.y),L=new T(s.p1.x+y.x,s.p1.y+y.y);this._segList.addPt(E),this._segList.addPt(L)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(t,e,n,i){var s=hi.intersection(e.p0,e.p1,n.p0,n.p1);if(s!==null&&(i<=0?1:s.distance(t)/Math.abs(i))<=this._bufParams.getMitreLimit())return this._segList.addPt(s),null;this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*r.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===b.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===b.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(t){this._segList.addPt(new T(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new T(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new T(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new T(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(t,e){this._segList.addPts(t,e)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(t,e,n,i,s){var o=e.x-t.x,c=e.y-t.y,v=Math.atan2(c,o),y=n.x-t.x,E=n.y-t.y,L=Math.atan2(E,y);i===J.CLOCKWISE?v<=L&&(v+=2*Math.PI):v>=L&&(v-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,v,L,i,s),this._segList.addPt(n)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(t,e,n,i){var s=this._seg0.p1,o=At.angle(s,this._seg0.p0),c=At.angleBetweenOriented(this._seg0.p0,s,this._seg1.p1)/2,v=At.normalize(o+c),y=At.normalize(v+Math.PI),E=i*n,L=n-E*Math.abs(Math.sin(c)),C=s.x+E*Math.cos(y),D=s.y+E*Math.sin(y),P=new T(C,D),Z=new Pt(s,P),j=Z.pointAlongOffset(1,L),K=Z.pointAlongOffset(1,-L);this._side===F.LEFT?(this._segList.addPt(j),this._segList.addPt(K)):(this._segList.addPt(K),this._segList.addPt(j))}},{key:"addDirectedFillet",value:function(t,e,n,i,s){var o=i===J.CLOCKWISE?-1:1,c=Math.abs(e-n),v=Math.trunc(c/this._filletAngleQuantum+.5);if(v<1)return null;for(var y=c/v,E=new T,L=0;L<v;L++){var C=e+o*L*y;E.x=t.x+s*Math.cos(C),E.y=t.y+s*Math.sin(C),this._segList.addPt(E)}}},{key:"computeOffsetSegment",value:function(t,e,n,i){var s=e===F.LEFT?1:-1,o=t.p1.x-t.p0.x,c=t.p1.y-t.p0.y,v=Math.sqrt(o*o+c*c),y=s*n*o/v,E=s*n*c/v;i.p0.x=t.p0.x-E,i.p0.y=t.p0.y+y,i.p1.x=t.p1.x-E,i.p1.y=t.p1.y+y}},{key:"addInsideTurn",value:function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*r.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new T((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var i=new T((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(t){var e=new T(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}},{key:"init",value:function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new gs,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*r.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===b.JOIN_BEVEL||this._bufParams.getJoinStyle()===b.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,J.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Pt,this._seg1=new Pt,this._offset0=new Pt,this._offset1=new Pt,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._precisionModel=t,this._bufParams=e,this._li=new Ee,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===b.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}}]),r}();on.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,on.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,on.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,on.MAX_CLOSING_SEG_LEN_FACTOR=80;var ju=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getOffsetCurve",value:function(t,e){if(this._distance=e,e===0)return null;var n=e<0,i=Math.abs(e),s=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],s):this.computeOffsetCurve(t,n,s);var o=s.getCoordinates();return n&&_t.reverse(o),o}},{key:"computeSingleSidedBufferCurve",value:function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var s=Ht.simplify(t,-i),o=s.length-1;n.initSideSegments(s[o],s[o-1],F.LEFT),n.addFirstSegment();for(var c=o-2;c>=0;c--)n.addNextSegment(s[c],!0)}else{n.addSegments(t,!1);var v=Ht.simplify(t,i),y=v.length-1;n.initSideSegments(v[0],v[1],F.LEFT),n.addFirstSegment();for(var E=2;E<=y;E++)n.addNextSegment(v[E],!0)}n.addLastSegment(),n.closeRing()}},{key:"computeRingBufferCurve",value:function(t,e,n){var i=this.simplifyTolerance(this._distance);e===F.RIGHT&&(i=-i);var s=Ht.simplify(t,i),o=s.length-1;n.initSideSegments(s[o-1],s[0],e);for(var c=1;c<=o;c++){var v=c!==1;n.addNextSegment(s[c],v)}n.closeRing()}},{key:"computeLineBufferCurve",value:function(t,e){var n=this.simplifyTolerance(this._distance),i=Ht.simplify(t,n),s=i.length-1;e.initSideSegments(i[0],i[1],F.LEFT);for(var o=2;o<=s;o++)e.addNextSegment(i[o],!0);e.addLastSegment(),e.addLineEndCap(i[s-1],i[s]);var c=Ht.simplify(t,-n),v=c.length-1;e.initSideSegments(c[v],c[v-1],F.LEFT);for(var y=v-2;y>=0;y--)e.addNextSegment(c[y],!0);e.addLastSegment(),e.addLineEndCap(c[1],c[0]),e.closeRing()}},{key:"computePointCurve",value:function(t,e){switch(this._bufParams.getEndCapStyle()){case b.CAP_ROUND:e.createCircle(t);break;case b.CAP_SQUARE:e.createSquare(t)}}},{key:"getLineCurve",value:function(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;var n=Math.abs(e),i=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],i);else if(this._bufParams.isSingleSided()){var s=e<0;this.computeSingleSidedBufferCurve(t,s,i)}else this.computeLineBufferCurve(t,i);return i.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(t){return t*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return r.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()}},{key:"computeOffsetCurve",value:function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var s=Ht.simplify(t,-i),o=s.length-1;n.initSideSegments(s[o],s[o-1],F.LEFT),n.addFirstSegment();for(var c=o-2;c>=0;c--)n.addNextSegment(s[c],!0)}else{var v=Ht.simplify(t,i),y=v.length-1;n.initSideSegments(v[0],v[1],F.LEFT),n.addFirstSegment();for(var E=2;E<=y;E++)n.addNextSegment(v[E],!0)}n.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(t){return t===0||t<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(t){return new on(this._precisionModel,this._bufParams,t)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}},{key:"copyCoordinates",value:function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new T(t[n]);return e}}]),r}(),vs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var t=arguments[0],e=new W,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),s=i.getEnvelope();t.y<s.getMinY()||t.y>s.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(arguments.length===3){if(tt(arguments[2],de)&&arguments[0]instanceof T&&arguments[1]instanceof ki)for(var o=arguments[0],c=arguments[1],v=arguments[2],y=c.getEdge().getCoordinates(),E=0;E<y.length-1;E++){this._seg.p0=y[E],this._seg.p1=y[E+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse();var L=Math.max(this._seg.p0.x,this._seg.p1.x);if(!(L<o.x)&&!(this._seg.isHorizontal()||o.y<this._seg.p0.y||o.y>this._seg.p1.y||J.index(this._seg.p0,this._seg.p1,o)===J.RIGHT)){var C=c.getDepth(F.LEFT);this._seg.p0.equals(y[E])||(C=c.getDepth(F.RIGHT));var D=new ys(this._seg,C);v.add(D)}}else if(tt(arguments[2],de)&&arguments[0]instanceof T&&tt(arguments[1],de))for(var P=arguments[0],Z=arguments[1],j=arguments[2],K=Z.iterator();K.hasNext();){var ct=K.next();ct.isForward()&&this.findStabbedSegments(P,ct,j)}}}},{key:"getDepth",value:function(t){var e=this.findStabbedSegments(t);return e.size()===0?0:qe.min(e)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Pt;var t=arguments[0];this._subgraphs=t}}]),r}(),ys=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"compareTo",value:function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))!==0?n:this._upwardSeg.compareTo(e._upwardSeg)}},{key:"compareX",value:function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Pt(t),this._leftDepth=e}}]),r}();vs.DepthSegment=ys;var ms=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,null,[{key:"constructor_",value:function(){q.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),e}(q),Ni=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getY",value:function(){var t=this.y/this.w;if(H.isNaN(t)||H.isInfinite(t))throw new ms;return t}},{key:"getX",value:function(){var t=this.x/this.w;if(H.isNaN(t)||H.isInfinite(t))throw new ms;return t}},{key:"getCoordinate",value:function(){var t=new T;return t.x=this.getX(),t.y=this.getY(),t}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];this.x=e,this.y=n,this.w=1}else if(arguments[0]instanceof r&&arguments[1]instanceof r){var i=arguments[0],s=arguments[1];this.x=i.y*s.w-s.y*i.w,this.y=s.x*i.w-i.x*s.w,this.w=i.x*s.y-s.x*i.y}else if(arguments[0]instanceof T&&arguments[1]instanceof T){var o=arguments[0],c=arguments[1];this.x=o.y-c.y,this.y=c.x-o.x,this.w=o.x*c.y-c.x*o.y}}else if(arguments.length===3){var v=arguments[0],y=arguments[1],E=arguments[2];this.x=v,this.y=y,this.w=E}else if(arguments.length===4){var L=arguments[0],C=arguments[1],D=arguments[2],P=arguments[3],Z=L.y-C.y,j=C.x-L.x,K=L.x*C.y-C.x*L.y,ct=D.y-P.y,pt=P.x-D.x,St=D.x*P.y-P.x*D.y;this.x=j*St-pt*K,this.y=ct*K-Z*St,this.w=Z*pt-ct*j}}}]),r}(),Wu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"area",value:function(){return r.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return r.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(t){if(t===null)throw new G("Supplied point is null.");return r.interpolateZ(t,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return r.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return r.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return r.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return r.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return r.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return r.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.p0=t,this.p1=e,this.p2=n}},{key:"area",value:function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)}},{key:"signedArea",value:function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2}},{key:"det",value:function(t,e,n,i){return t*i-e*n}},{key:"interpolateZ",value:function(t,e,n,i){var s=e.x,o=e.y,c=n.x-s,v=i.x-s,y=n.y-o,E=i.y-o,L=c*E-v*y,C=t.x-s,D=t.y-o,P=(E*C-v*D)/L,Z=(-y*C+c*D)/L;return e.getZ()+P*(n.getZ()-e.getZ())+Z*(i.getZ()-e.getZ())}},{key:"longestSideLength",value:function(t,e,n){var i=t.distance(e),s=e.distance(n),o=n.distance(t),c=i;return s>c&&(c=s),o>c&&(c=o),c}},{key:"circumcentreDD",value:function(t,e,n){var i=Q.valueOf(t.x).subtract(n.x),s=Q.valueOf(t.y).subtract(n.y),o=Q.valueOf(e.x).subtract(n.x),c=Q.valueOf(e.y).subtract(n.y),v=Q.determinant(i,s,o,c).multiply(2),y=i.sqr().add(s.sqr()),E=o.sqr().add(c.sqr()),L=Q.determinant(s,y,c,E),C=Q.determinant(i,y,o,E),D=Q.valueOf(n.x).subtract(L.divide(v)).doubleValue(),P=Q.valueOf(n.y).add(C.divide(v)).doubleValue();return new T(D,P)}},{key:"isAcute",value:function(t,e,n){return!!At.isAcute(t,e,n)&&!!At.isAcute(e,n,t)&&!!At.isAcute(n,t,e)}},{key:"circumcentre",value:function(t,e,n){var i=n.x,s=n.y,o=t.x-i,c=t.y-s,v=e.x-i,y=e.y-s,E=2*r.det(o,c,v,y),L=r.det(c,o*o+c*c,y,v*v+y*y),C=r.det(o,o*o+c*c,v,v*v+y*y);return new T(i-L/E,s+C/E)}},{key:"perpendicularBisector",value:function(t,e){var n=e.x-t.x,i=e.y-t.y,s=new Ni(t.x+n/2,t.y+i/2,1),o=new Ni(t.x-i+n/2,t.y+n+i/2,1);return new Ni(s,o)}},{key:"angleBisector",value:function(t,e,n){var i=e.distance(t),s=i/(i+e.distance(n)),o=n.x-t.x,c=n.y-t.y;return new T(t.x+s*o,t.y+s*c)}},{key:"area3D",value:function(t,e,n){var i=e.x-t.x,s=e.y-t.y,o=e.getZ()-t.getZ(),c=n.x-t.x,v=n.y-t.y,y=n.getZ()-t.getZ(),E=s*y-o*v,L=o*c-i*y,C=i*v-s*c,D=E*E+L*L+C*C,P=Math.sqrt(D)/2;return P}},{key:"centroid",value:function(t,e,n){var i=(t.x+e.x+n.x)/3,s=(t.y+e.y+n.y)/3;return new T(i,s)}},{key:"inCentre",value:function(t,e,n){var i=e.distance(n),s=t.distance(n),o=t.distance(e),c=i+s+o,v=(i*t.x+s*e.x+o*n.x)/c,y=(i*t.y+s*e.y+o*n.y)/c;return new T(v,y)}}]),r}(),Qu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"addRingSide",value:function(t,e,n,i,s){if(e===0&&t.length<nn.MINIMUM_VALID_SIZE)return null;var o=i,c=s;t.length>=nn.MINIMUM_VALID_SIZE&&J.isCCW(t)&&(o=s,c=i,n=F.opposite(n));var v=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(v,o,c)}},{key:"addRingBothSides",value:function(t,e){this.addRingSide(t,e,F.LEFT,k.EXTERIOR,k.INTERIOR),this.addRingSide(t,e,F.RIGHT,k.INTERIOR,k.EXTERIOR)}},{key:"addPoint",value:function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,k.EXTERIOR,k.INTERIOR)}},{key:"addPolygon",value:function(t){var e=this._distance,n=F.LEFT;this._distance<0&&(e=-this._distance,n=F.RIGHT);var i=t.getExteriorRing(),s=_t.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&s.length<3)return null;this.addRingSide(s,e,n,k.EXTERIOR,k.INTERIOR);for(var o=0;o<t.getNumInteriorRing();o++){var c=t.getInteriorRingN(o),v=_t.removeRepeatedPoints(c.getCoordinates());this._distance>0&&this.isErodedCompletely(c,-this._distance)||this.addRingSide(v,e,F.opposite(n),k.INTERIOR,k.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(t,e){var n=new Wu(t[0],t[1],t[2]),i=n.inCentre();return Qt.pointToSegment(i,n.p0,n.p1)<Math.abs(e)}},{key:"addLineString",value:function(t){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var e=_t.removeRepeatedPoints(t.getCoordinates());if(_t.isRing(e)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(e,this._distance);else{var n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,k.EXTERIOR,k.INTERIOR)}}},{key:"addCurve",value:function(t,e,n){if(t===null||t.length<2)return null;var i=new Ie(t,new zt(0,k.BOUNDARY,e,n));this._curveList.add(i)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(t){if(t.isEmpty())return null;if(t instanceof Pn)this.addPolygon(t);else if(t instanceof en)this.addLineString(t);else if(t instanceof ci)this.addPoint(t);else if(t instanceof fi)this.addCollection(t);else if(t instanceof mi)this.addCollection(t);else if(t instanceof yi)this.addCollection(t);else{if(!(t instanceof Mt))throw new ve(t.getGeometryType());this.addCollection(t)}}},{key:"isErodedCompletely",value:function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),s=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>s}},{key:"addCollection",value:function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new W;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n}}]),r}(),Ju=function(){function r(){a(this,r)}return h(r,[{key:"locate",value:function(t){}}]),r}(),Ku=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,r.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new Cn;var t=this._parent.getGeometryN(this._index++);return t instanceof Mt?(this._subcollectionIterator=new r(t),this._subcollectionIterator.next()):t}},{key:"remove",value:function(){throw new ve(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[Bu]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()}},{key:"isAtomic",value:function(t){return!(t instanceof Mt)}}]),r}(),to=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"locate",value:function(t){return r.locate(t,this._geom)}},{key:"interfaces_",get:function(){return[Ju]}}],[{key:"constructor_",value:function(){this._geom=null;var t=arguments[0];this._geom=t}},{key:"locatePointInPolygon",value:function(t,e){if(e.isEmpty())return k.EXTERIOR;var n=e.getExteriorRing(),i=r.locatePointInRing(t,n);if(i!==k.INTERIOR)return i;for(var s=0;s<e.getNumInteriorRing();s++){var o=e.getInteriorRingN(s),c=r.locatePointInRing(t,o);if(c===k.BOUNDARY)return k.BOUNDARY;if(c===k.INTERIOR)return k.EXTERIOR}return k.INTERIOR}},{key:"locatePointInRing",value:function(t,e){return e.getEnvelopeInternal().intersects(t)?_i.locateInRing(t,e.getCoordinates()):k.EXTERIOR}},{key:"containsPointInPolygon",value:function(t,e){return k.EXTERIOR!==r.locatePointInPolygon(t,e)}},{key:"locateInGeometry",value:function(t,e){if(e instanceof Pn)return r.locatePointInPolygon(t,e);if(e instanceof Mt)for(var n=new Ku(e);n.hasNext();){var i=n.next();if(i!==e){var s=r.locateInGeometry(t,i);if(s!==k.EXTERIOR)return s}}return k.EXTERIOR}},{key:"isContained",value:function(t,e){return k.EXTERIOR!==r.locate(t,e)}},{key:"locate",value:function(t,e){return e.isEmpty()?k.EXTERIOR:e.getEnvelopeInternal().intersects(t)?r.locateInGeometry(t,e):k.EXTERIOR}}]),r}(),eo=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getNextCW",value:function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return e===0&&(n=this._edgeList.size()-1),this._edgeList.get(n)}},{key:"propagateSideLabels",value:function(t){for(var e=k.NONE,n=this.iterator();n.hasNext();){var i=n.next().getLabel();i.isArea(t)&&i.getLocation(t,F.LEFT)!==k.NONE&&(e=i.getLocation(t,F.LEFT))}if(e===k.NONE)return null;for(var s=e,o=this.iterator();o.hasNext();){var c=o.next(),v=c.getLabel();if(v.getLocation(t,F.ON)===k.NONE&&v.setLocation(t,F.ON,s),v.isArea(t)){var y=v.getLocation(t,F.LEFT),E=v.getLocation(t,F.RIGHT);if(E!==k.NONE){if(E!==s)throw new ie("side location conflict",c.getCoordinate());y===k.NONE&&it.shouldNeverReachHere("found single null side (at "+c.getCoordinate()+")"),s=y}else it.isTrue(v.getLocation(t,F.LEFT)===k.NONE,"found single null side"),v.setLocation(t,F.RIGHT,s),v.setLocation(t,F.LEFT,s)}}}},{key:"getCoordinate",value:function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null}},{key:"print",value:function(t){qt.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"isAreaLabelsConsistent",value:function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,i=e.get(n).getLabel().getLocation(t,F.LEFT);it.isTrue(i!==k.NONE,"Found unlabelled area edge");for(var s=i,o=this.iterator();o.hasNext();){var c=o.next().getLabel();it.isTrue(c.isArea(t),"Found non-area edge");var v=c.getLocation(t,F.LEFT),y=c.getLocation(t,F.RIGHT);if(v===y||y!==s)return!1;s=v}return!0}},{key:"findIndex",value:function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new W(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(t,e,n){return this._ptInAreaLocation[t]===k.NONE&&(this._ptInAreaLocation[t]=to.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]}},{key:"toString",value:function(){var t=new Ke;t.append("EdgeEndStar: "+this.getCoordinate()),t.append(`
|
|
27
|
-
`);for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append(`
|
|
28
|
-
`)}return t.toString()}},{key:"computeEdgeEndLabels",value:function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)}},{key:"computeLabelling",value:function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var i=n.next().getLabel(),s=0;s<2;s++)i.isLine(s)&&i.getLocation(s)===k.BOUNDARY&&(e[s]=!0);for(var o=this.iterator();o.hasNext();)for(var c=o.next(),v=c.getLabel(),y=0;y<2;y++)if(v.isAnyNull(y)){var E=k.NONE;if(e[y])E=k.EXTERIOR;else{var L=c.getCoordinate();E=this.getLocation(y,L,t)}v.setAllLocationsIfNull(y,E)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(t,e){this._edgeMap.put(t,e),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new un,this._edgeList=null,this._ptInAreaLocation=[k.NONE,k.NONE]}}]),r}(),no=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var n=null,i=null,s=this._SCANNING_FOR_INCOMING,o=0;o<this._resultAreaEdgeList.size();o++){var c=this._resultAreaEdgeList.get(o),v=c.getSym();if(c.getLabel().isArea())switch(n===null&&c.isInResult()&&(n=c),s){case this._SCANNING_FOR_INCOMING:if(!v.isInResult())continue;i=v,s=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!c.isInResult())continue;i.setNext(c),s=this._SCANNING_FOR_INCOMING}}if(s===this._LINKING_TO_OUTGOING){if(n===null)throw new ie("no outgoing dirEdge found",this.getCoordinate());it.isTrue(n.isInResult(),"unable to link last incoming dirEdge"),i.setNext(n)}}},{key:"insert",value:function(n){var i=n;this.insertEdgeEnd(i,i)}},{key:"getRightmostEdge",value:function(){var n=this.getEdges(),i=n.size();if(i<1)return null;var s=n.get(0);if(i===1)return s;var o=n.get(i-1),c=s.getQuadrant(),v=o.getQuadrant();return Tt.isNorthern(c)&&Tt.isNorthern(v)?s:Tt.isNorthern(c)||Tt.isNorthern(v)?s.getDy()!==0?s:o.getDy()!==0?o:(it.shouldNeverReachHere("found two horizontal edges incident on node"),null):o}},{key:"print",value:function(n){qt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();){var s=i.next();n.print("out "),s.print(n),n.println(),n.print("in "),s.getSym().print(n),n.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new W;for(var n=this.iterator();n.hasNext();){var i=n.next();(i.isInResult()||i.getSym().isInResult())&&this._resultAreaEdgeList.add(i)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(n){for(var i=this.iterator();i.hasNext();){var s=i.next().getLabel();s.setAllLocationsIfNull(0,n.getLocation(0)),s.setAllLocationsIfNull(1,n.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var n=null,i=null,s=this._edgeList.size()-1;s>=0;s--){var o=this._edgeList.get(s),c=o.getSym();i===null&&(i=c),n!==null&&c.setNext(n),n=o}i.setNext(n)}},{key:"computeDepths",value:function(){if(arguments.length===1){var n=arguments[0],i=this.findIndex(n),s=n.getDepth(F.LEFT),o=n.getDepth(F.RIGHT),c=this.computeDepths(i+1,this._edgeList.size(),s),v=this.computeDepths(0,i,c);if(v!==o)throw new ie("depth mismatch at "+n.getCoordinate())}else if(arguments.length===3){for(var y=arguments[0],E=arguments[1],L=arguments[2],C=L,D=y;D<E;D++){var P=this._edgeList.get(D);P.setEdgeDepths(F.RIGHT,C),C=P.getDepth(F.LEFT)}return C}}},{key:"mergeSymLabels",value:function(){for(var n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().merge(i.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(n){for(var i=null,s=null,o=this._SCANNING_FOR_INCOMING,c=this._resultAreaEdgeList.size()-1;c>=0;c--){var v=this._resultAreaEdgeList.get(c),y=v.getSym();switch(i===null&&v.getEdgeRing()===n&&(i=v),o){case this._SCANNING_FOR_INCOMING:if(y.getEdgeRing()!==n)continue;s=y,o=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(v.getEdgeRing()!==n)continue;s.setNextMin(v),o=this._SCANNING_FOR_INCOMING}}o===this._LINKING_TO_OUTGOING&&(it.isTrue(i!==null,"found null for first outgoing dirEdge"),it.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),s.setNextMin(i))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var s=i.next();s.isInResult()&&n++}return n}if(arguments.length===1){for(var o=arguments[0],c=0,v=this.iterator();v.hasNext();){var y=v.next();y.getEdgeRing()===o&&c++}return c}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var n=k.NONE,i=this.iterator();i.hasNext();){var s=i.next(),o=s.getSym();if(!s.isLineEdge()){if(s.isInResult()){n=k.INTERIOR;break}if(o.isInResult()){n=k.EXTERIOR;break}}}if(n===k.NONE)return null;for(var c=n,v=this.iterator();v.hasNext();){var y=v.next(),E=y.getSym();y.isLineEdge()?y.getEdge().setCovered(c===k.INTERIOR):(y.isInResult()&&(c=k.EXTERIOR),E.isInResult()&&(c=k.INTERIOR))}}},{key:"computeLabelling",value:function(n){S(d(e.prototype),"computeLabelling",this).call(this,n),this._label=new zt(k.NONE);for(var i=this.iterator();i.hasNext();)for(var s=i.next().getEdge().getLabel(),o=0;o<2;o++){var c=s.getLocation(o);c!==k.INTERIOR&&c!==k.BOUNDARY||this._label.setLocation(o,k.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),e}(eo),io=function(r){g(e,r);var t=_(e);function e(){return a(this,e),t.call(this)}return h(e,[{key:"createNode",value:function(n){return new qn(n,new no)}}]),e}(ss),ds=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"compareTo",value:function(t){var e=t;return r.compareOriented(this._pts,this._orientation,e._pts,e._orientation)}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=r.orientation(t)}},{key:"orientation",value:function(t){return _t.increasingDirection(t)===1}},{key:"compareOriented",value:function(t,e,n,i){for(var s=e?1:-1,o=i?1:-1,c=e?t.length:-1,v=i?n.length:-1,y=e?0:t.length-1,E=i?0:n.length-1;;){var L=t[y].compareTo(n[E]);if(L!==0)return L;var C=(y+=s)===c,D=(E+=o)===v;if(C&&!D)return-1;if(!C&&D)return 1;if(C&&D)return 0}}}]),r}(),ro=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"print",value:function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var i=n.getCoordinates(),s=0;s<i.length;s++)s>0&&t.print(","),t.print(i[s].x+" "+i[s].y);t.println(")")}t.print(") ")}},{key:"addAll",value:function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())}},{key:"findEdgeIndex",value:function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(t){return this._edges.get(t)}},{key:"findEqualEdge",value:function(t){var e=new ds(t.getCoordinates());return this._ocaMap.get(e)}},{key:"add",value:function(t){this._edges.add(t);var e=new ds(t.getCoordinates());this._ocaMap.put(e,t)}}],[{key:"constructor_",value:function(){this._edges=new W,this._ocaMap=new un}}]),r}(),ps=function(){function r(){a(this,r)}return h(r,[{key:"processIntersections",value:function(t,e,n,i){}},{key:"isDone",value:function(){}}]),r}(),so=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"isTrivialIntersection",value:function(t,e,n,i){if(t===n&&this._li.getIntersectionNum()===1){if(r.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var s=t.size()-1;if(e===0&&i===s||i===0&&e===s)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var s=t.getCoordinates()[e],o=t.getCoordinates()[e+1],c=n.getCoordinates()[i],v=n.getCoordinates()[i+1];this._li.computeIntersection(s,o,c,v),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[ps]}}],[{key:"constructor_",value:function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t}},{key:"isAdjacentSegments",value:function(t,e){return Math.abs(t-e)===1}}]),r}(),ao=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)}},{key:"compareTo",value:function(t){var e=t;return this.compare(e.segmentIndex,e.dist)}},{key:"isEndPoint",value:function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new T(t),this.segmentIndex=e,this.dist=n}}]),r}(),uo=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"print",value:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),s=this.createSplitEdge(n,i);t.add(s),n=i}}},{key:"addEndpoints",value:function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)}},{key:"createSplitEdge",value:function(t,e){var n=e.segmentIndex-t.segmentIndex+2,i=this.edge.pts[e.segmentIndex],s=e.dist>0||!e.coord.equals2D(i);s||n--;var o=new Array(n).fill(null),c=0;o[c++]=new T(t.coord);for(var v=t.segmentIndex+1;v<=e.segmentIndex;v++)o[c++]=this.edge.pts[v];return s&&(o[c]=e.coord),new xs(o,new zt(this.edge._label))}},{key:"add",value:function(t,e,n){var i=new ao(t,e,n),s=this._nodeMap.get(i);return s!==null?s:(this._nodeMap.put(i,i),i)}},{key:"isIntersection",value:function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new un,this.edge=null;var t=arguments[0];this.edge=t}}]),r}(),oo=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(r.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])||r.isTrue(this._matrix[k.INTERIOR][k.BOUNDARY])||r.isTrue(this._matrix[k.BOUNDARY][k.INTERIOR])||r.isTrue(this._matrix[k.BOUNDARY][k.BOUNDARY]))&&this._matrix[k.EXTERIOR][k.INTERIOR]===Y.FALSE&&this._matrix[k.EXTERIOR][k.BOUNDARY]===Y.FALSE}},{key:"isCoveredBy",value:function(){return(r.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])||r.isTrue(this._matrix[k.INTERIOR][k.BOUNDARY])||r.isTrue(this._matrix[k.BOUNDARY][k.INTERIOR])||r.isTrue(this._matrix[k.BOUNDARY][k.BOUNDARY]))&&this._matrix[k.INTERIOR][k.EXTERIOR]===Y.FALSE&&this._matrix[k.BOUNDARY][k.EXTERIOR]===Y.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),i=e%3;this._matrix[n][i]=Y.toDimensionValue(t.charAt(e))}else if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2];this._matrix[s][o]=c}}},{key:"isContains",value:function(){return r.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&this._matrix[k.EXTERIOR][k.INTERIOR]===Y.FALSE&&this._matrix[k.EXTERIOR][k.BOUNDARY]===Y.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),i=e%3;this.setAtLeast(n,i,Y.toDimensionValue(t.charAt(e)))}else if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2];this._matrix[s][o]<c&&(this._matrix[s][o]=c)}}},{key:"setAtLeastIfValid",value:function(t,e,n){t>=0&&e>=0&&this.setAtLeast(t,e,n)}},{key:"isWithin",value:function(){return r.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&this._matrix[k.INTERIOR][k.EXTERIOR]===Y.FALSE&&this._matrix[k.BOUNDARY][k.EXTERIOR]===Y.FALSE}},{key:"isTouches",value:function(t,e){return t>e?this.isTouches(e,t):(t===Y.A&&e===Y.A||t===Y.L&&e===Y.L||t===Y.L&&e===Y.A||t===Y.P&&e===Y.A||t===Y.P&&e===Y.L)&&this._matrix[k.INTERIOR][k.INTERIOR]===Y.FALSE&&(r.isTrue(this._matrix[k.INTERIOR][k.BOUNDARY])||r.isTrue(this._matrix[k.BOUNDARY][k.INTERIOR])||r.isTrue(this._matrix[k.BOUNDARY][k.BOUNDARY]))}},{key:"isOverlaps",value:function(t,e){return t===Y.P&&e===Y.P||t===Y.A&&e===Y.A?r.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&r.isTrue(this._matrix[k.INTERIOR][k.EXTERIOR])&&r.isTrue(this._matrix[k.EXTERIOR][k.INTERIOR]):t===Y.L&&e===Y.L&&this._matrix[k.INTERIOR][k.INTERIOR]===1&&r.isTrue(this._matrix[k.INTERIOR][k.EXTERIOR])&&r.isTrue(this._matrix[k.EXTERIOR][k.INTERIOR])}},{key:"isEquals",value:function(t,e){return t===e&&r.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&this._matrix[k.INTERIOR][k.EXTERIOR]===Y.FALSE&&this._matrix[k.BOUNDARY][k.EXTERIOR]===Y.FALSE&&this._matrix[k.EXTERIOR][k.INTERIOR]===Y.FALSE&&this._matrix[k.EXTERIOR][k.BOUNDARY]===Y.FALSE}},{key:"toString",value:function(){for(var t=new Dn("123456789"),e=0;e<3;e++)for(var n=0;n<3;n++)t.setCharAt(3*e+n,Y.toDimensionSymbol(this._matrix[e][n]));return t.toString()}},{key:"setAll",value:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this._matrix[e][n]=t}},{key:"get",value:function(t,e){return this._matrix[t][e]}},{key:"transpose",value:function(){var t=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=t,t=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=t,t=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=t,this}},{key:"matches",value:function(t){if(t.length!==9)throw new G("Should be length 9: "+t);for(var e=0;e<3;e++)for(var n=0;n<3;n++)if(!r.matches(this._matrix[e][n],t.charAt(3*e+n)))return!1;return!0}},{key:"add",value:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this.setAtLeast(e,n,t.get(e,n))}},{key:"isDisjoint",value:function(){return this._matrix[k.INTERIOR][k.INTERIOR]===Y.FALSE&&this._matrix[k.INTERIOR][k.BOUNDARY]===Y.FALSE&&this._matrix[k.BOUNDARY][k.INTERIOR]===Y.FALSE&&this._matrix[k.BOUNDARY][k.BOUNDARY]===Y.FALSE}},{key:"isCrosses",value:function(t,e){return t===Y.P&&e===Y.L||t===Y.P&&e===Y.A||t===Y.L&&e===Y.A?r.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&r.isTrue(this._matrix[k.INTERIOR][k.EXTERIOR]):t===Y.L&&e===Y.P||t===Y.A&&e===Y.P||t===Y.A&&e===Y.L?r.isTrue(this._matrix[k.INTERIOR][k.INTERIOR])&&r.isTrue(this._matrix[k.EXTERIOR][k.INTERIOR]):t===Y.L&&e===Y.L&&this._matrix[k.INTERIOR][k.INTERIOR]===0}},{key:"interfaces_",get:function(){return[V]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(Y.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var t=arguments[0];r.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof r){var e=arguments[0];r.constructor_.call(this),this._matrix[k.INTERIOR][k.INTERIOR]=e._matrix[k.INTERIOR][k.INTERIOR],this._matrix[k.INTERIOR][k.BOUNDARY]=e._matrix[k.INTERIOR][k.BOUNDARY],this._matrix[k.INTERIOR][k.EXTERIOR]=e._matrix[k.INTERIOR][k.EXTERIOR],this._matrix[k.BOUNDARY][k.INTERIOR]=e._matrix[k.BOUNDARY][k.INTERIOR],this._matrix[k.BOUNDARY][k.BOUNDARY]=e._matrix[k.BOUNDARY][k.BOUNDARY],this._matrix[k.BOUNDARY][k.EXTERIOR]=e._matrix[k.BOUNDARY][k.EXTERIOR],this._matrix[k.EXTERIOR][k.INTERIOR]=e._matrix[k.EXTERIOR][k.INTERIOR],this._matrix[k.EXTERIOR][k.BOUNDARY]=e._matrix[k.EXTERIOR][k.BOUNDARY],this._matrix[k.EXTERIOR][k.EXTERIOR]=e._matrix[k.EXTERIOR][k.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var t=arguments[0],e=arguments[1];return e===Y.SYM_DONTCARE||e===Y.SYM_TRUE&&(t>=0||t===Y.TRUE)||e===Y.SYM_FALSE&&t===Y.FALSE||e===Y.SYM_P&&t===Y.P||e===Y.SYM_L&&t===Y.L||e===Y.SYM_A&&t===Y.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var n=arguments[0],i=arguments[1],s=new r(n);return s.matches(i)}}},{key:"isTrue",value:function(t){return t>=0||t===Y.TRUE}}]),r}(),lo=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(t){return t===null||t.length===0?null:(this.ensureCapacity(this._size+t.length),qt.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}},{key:"ensureCapacity",value:function(t){if(t<=this._data.length)return null;var e=Math.max(t,2*this._data.length);this._data=_e.copyOf(this._data,e)}},{key:"toArray",value:function(){var t=new Array(this._size).fill(null);return qt.arraycopy(this._data,0,t,0,this._size),t}},{key:"add",value:function(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)r.constructor_.call(this,10);else if(arguments.length===1){var t=arguments[0];this._data=new Array(t).fill(null)}}}]),r}(),ho=function(){function r(){a(this,r)}return h(r,[{key:"getChainStartIndices",value:function(t){var e=0,n=new lo(Math.trunc(t.length/2));n.add(e);do{var i=this.findChainEnd(t,e);n.add(i),e=i}while(e<t.length-1);return n.toArray()}},{key:"findChainEnd",value:function(t,e){for(var n=Tt.quadrant(t[e],t[e+1]),i=e+1;i<t.length&&Tt.quadrant(t[i-1],t[i])===n;)i++;return i-1}},{key:"OLDgetChainStartIndices",value:function(t){var e=0,n=new W;n.add(e);do{var i=this.findChainEnd(t,e);n.add(i),e=i}while(e<t.length-1);return r.toIntArray(n)}}],[{key:"toIntArray",value:function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e}}]),r}(),co=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n}},{key:"getMinX",value:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],i)}else if(arguments.length===6){var s=arguments[0],o=arguments[1],c=arguments[2],v=arguments[3],y=arguments[4],E=arguments[5];if(o-s==1&&y-v==1)return E.addIntersections(this.e,s,c.e,v),null;if(!this.overlaps(s,o,c,v,y))return null;var L=Math.trunc((s+o)/2),C=Math.trunc((v+y)/2);s<L&&(v<C&&this.computeIntersectsForChain(s,L,c,v,C,E),C<y&&this.computeIntersectsForChain(s,L,c,C,y,E)),L<o&&(v<C&&this.computeIntersectsForChain(L,o,c,v,C,E),C<y&&this.computeIntersectsForChain(L,o,c,C,y,E))}}},{key:"overlaps",value:function(t,e,n,i,s){return vt.intersects(this.pts[t],this.pts[e],n.pts[i],n.pts[s])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var i=0;i<t.startIndex.length-1;i++)this.computeIntersectsForChain(n,t,i,e)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new ho;this.startIndex=e.getChainStartIndices(this.pts)}}]),r}(),_s=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getDepth",value:function(t,e){return this._depth[t][e]}},{key:"setDepth",value:function(t,e,n){this._depth[t][e]=n}},{key:"isNull",value:function(){if(arguments.length===0){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==r.NULL_VALUE)return!1;return!0}if(arguments.length===1){var n=arguments[0];return this._depth[n][1]===r.NULL_VALUE}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this._depth[i][s]===r.NULL_VALUE}}},{key:"normalize",value:function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var i=0;this._depth[t][n]>e&&(i=1),this._depth[t][n]=i}}}},{key:"getDelta",value:function(t){return this._depth[t][F.RIGHT]-this._depth[t][F.LEFT]}},{key:"getLocation",value:function(t,e){return this._depth[t][e]<=0?k.EXTERIOR:k.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var i=t.getLocation(e,n);i!==k.EXTERIOR&&i!==k.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=r.depthAtLocation(i):this._depth[e][n]+=r.depthAtLocation(i))}else if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2];c===k.INTERIOR&&this._depth[s][o]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var t=0;t<2;t++)for(var e=0;e<3;e++)this._depth[t][e]=r.NULL_VALUE}},{key:"depthAtLocation",value:function(t){return t===k.EXTERIOR?0:t===k.INTERIOR?1:r.NULL_VALUE}}]),r}();_s.NULL_VALUE=-1;var xs=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var n=new Array(2).fill(null);return n[0]=this.pts[0],n[1]=this.pts[1],new e(n,zt.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(n){this._isIsolated=n}},{key:"setName",value:function(n){this._name=n}},{key:"equals",value:function(n){if(!(n instanceof e))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var s=!0,o=!0,c=this.pts.length,v=0;v<this.pts.length;v++)if(this.pts[v].equals2D(i.pts[v])||(s=!1),this.pts[v].equals2D(i.pts[--c])||(o=!1),!s&&!o)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}}},{key:"print",value:function(n){n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i<this.pts.length;i++)i>0&&n.print(","),n.print(this.pts[i].x+" "+this.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(n){e.updateIM(this._label,n)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(n){n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(this.pts[i]+" ");n.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new co(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new vt;for(var n=0;n<this.pts.length;n++)this._env.expandToInclude(this.pts[n])}return this._env}},{key:"addIntersection",value:function(n,i,s,o){var c=new T(n.getIntersection(o)),v=i,y=n.getEdgeDistance(s,o),E=v+1;if(E<this.pts.length){var L=this.pts[E];c.equals2D(L)&&(v=E,y=0)}this.eiList.add(c,v,y)}},{key:"toString",value:function(){var n=new Dn;n.append("edge "+this._name+": "),n.append("LINESTRING (");for(var i=0;i<this.pts.length;i++)i>0&&n.append(","),n.append(this.pts[i].x+" "+this.pts[i].y);return n.append(") "+this._label+" "+this._depthDelta),n.toString()}},{key:"isPointwiseEqual",value:function(n){if(this.pts.length!==n.pts.length)return!1;for(var i=0;i<this.pts.length;i++)if(!this.pts[i].equals2D(n.pts[i]))return!1;return!0}},{key:"setDepthDelta",value:function(n){this._depthDelta=n}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(n,i,s){for(var o=0;o<n.getIntersectionNum();o++)this.addIntersection(n,i,s,o)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new uo(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new _s,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.constructor_.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.pts=i,this._label=s}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof oo&&arguments[0]instanceof zt))return S(d(e),"updateIM",this).apply(this,arguments);var n=arguments[0],i=arguments[1];i.setAtLeastIfValid(n.getLocation(0,F.ON),n.getLocation(1,F.ON),1),n.isArea()&&(i.setAtLeastIfValid(n.getLocation(0,F.LEFT),n.getLocation(1,F.LEFT),2),i.setAtLeastIfValid(n.getLocation(0,F.RIGHT),n.getLocation(1,F.RIGHT),2))}}]),e}(ts),ks=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"setWorkingPrecisionModel",value:function(t){this._workingPrecisionModel=t}},{key:"insertUniqueEdge",value:function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new zt(t.getLabel())).flip(),n.merge(i);var s=r.depthDelta(i),o=e.getDepthDelta()+s;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(r.depthDelta(t.getLabel()))}},{key:"buildSubgraphs",value:function(t,e){for(var n=new W,i=t.iterator();i.hasNext();){var s=i.next(),o=s.getRightmostCoordinate(),c=new vs(n).getDepth(o);s.computeDepth(c),s.findResultEdges(),n.add(s),e.add(s.getDirectedEdges(),s.getNodes())}}},{key:"createSubgraphs",value:function(t){for(var e=new W,n=t.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var s=new mu;s.create(i),e.add(s)}}return qe.sort(e,qe.reverseOrder()),e}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new Ii,n=new Ee;return n.setPrecisionModel(t),e.setSegmentIntersector(new so(n)),e}},{key:"buffer",value:function(t,e){var n=this._workingPrecisionModel;n===null&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var i=new ju(n,this._bufParams),s=new Qu(t,e,i).getCurves();if(s.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(s,n),this._graph=new as(new io),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),c=new Du(this._geomFact);this.buildSubgraphs(o,c);var v=c.getPolygons();return v.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(v)}},{key:"computeNodedEdges",value:function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var i=n.getNodedSubstrings().iterator();i.hasNext();){var s=i.next(),o=s.getCoordinates();if(o.length!==2||!o[0].equals2D(o[1])){var c=s.getData(),v=new xs(s.getCoordinates(),new zt(c));this.insertUniqueEdge(v)}}}},{key:"setNoder",value:function(t){this._workingNoder=t}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new ro;var t=arguments[0];this._bufParams=t}},{key:"depthDelta",value:function(t){var e=t.getLocation(0,F.LEFT),n=t.getLocation(0,F.RIGHT);return e===k.INTERIOR&&n===k.EXTERIOR?1:e===k.EXTERIOR&&n===k.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(t){for(var e=new Fe,n=new W;t.hasNext();){var i=t.next(),s=e.createLineString(i.getCoordinates());n.add(s)}return e.buildGeometry(n)}}]),r}(),fo=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"rescale",value:function(){if(tt(arguments[0],Wt))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var i=arguments[0],s=0;s<i.length;s++)i[s].x=i[s].x/this._scaleFactor+this._offsetX,i[s].y=i[s].y/this._scaleFactor+this._offsetY;i.length===2&&i[0].equals2D(i[1])&&qt.out.println(i)}}},{key:"scale",value:function(){if(tt(arguments[0],Wt)){for(var t=arguments[0],e=new W(t.size()),n=t.iterator();n.hasNext();){var i=n.next();e.add(new Ie(this.scale(i.getCoordinates()),i.getData()))}return e}if(arguments[0]instanceof Array){for(var s=arguments[0],o=new Array(s.length).fill(null),c=0;c<s.length;c++)o[c]=new T(Math.round((s[c].x-this._offsetX)*this._scaleFactor),Math.round((s[c].y-this._offsetY)*this._scaleFactor),s[c].getZ());var v=_t.removeRepeatedPoints(o);return v}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t}},{key:"computeNodes",value:function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)}},{key:"interfaces_",get:function(){return[Ei]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],e=arguments[1];r.constructor_.call(this,t,e,0,0)}else if(arguments.length===4){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._isScaled=!this.isIntegerPrecision()}}}]),r}(),Es=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next(),n=e.getCoordinates();this.checkEndPtVertexIntersections(n[0],this._segStrings),this.checkEndPtVertexIntersections(n[n.length-1],this._segStrings)}else if(arguments.length===2){for(var i=arguments[0],s=arguments[1],o=s.iterator();o.hasNext();)for(var c=o.next(),v=c.getCoordinates(),y=1;y<v.length-1;y++)if(v[y].equals(i))throw new It("found endpt/interior pt intersection at index "+y+" :pt "+i)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkInteriorIntersections(e,i)}else if(arguments.length===2)for(var s=arguments[0],o=arguments[1],c=s.getCoordinates(),v=o.getCoordinates(),y=0;y<c.length-1;y++)for(var E=0;E<v.length-1;E++)this.checkInteriorIntersections(s,y,o,E);else if(arguments.length===4){var L=arguments[0],C=arguments[1],D=arguments[2],P=arguments[3];if(L===D&&C===P)return null;var Z=L.getCoordinates()[C],j=L.getCoordinates()[C+1],K=D.getCoordinates()[P],ct=D.getCoordinates()[P+1];if(this._li.computeIntersection(Z,j,K,ct),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Z,j)||this.hasInteriorIntersection(this._li,K,ct)))throw new It("found non-noded intersection at "+Z+"-"+j+" and "+K+"-"+ct)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(arguments.length===1)for(var n=arguments[0],i=n.getCoordinates(),s=0;s<i.length-2;s++)this.checkCollapse(i[s],i[s+1],i[s+2])}},{key:"hasInteriorIntersection",value:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++){var s=t.getIntersection(i);if(!s.equals(e)&&!s.equals(n))return!0}return!1}},{key:"checkCollapse",value:function(t,e,n){if(t.equals(n))throw new It("found non-noded collapse at "+r.fact.createLineString([t,e,n]))}}],[{key:"constructor_",value:function(){this._li=new Ee,this._segStrings=null;var t=arguments[0];this._segStrings=t}}]),r}();Es.fact=new Fe;var Si=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"intersectsScaled",value:function(t,e){var n=Math.min(t.x,e.x),i=Math.max(t.x,e.x),s=Math.min(t.y,e.y),o=Math.max(t.y,e.y),c=this._maxx<n||this._minx>i||this._maxy<s||this._miny>o;if(c)return!1;var v=this.intersectsToleranceSquare(t,e);return it.isTrue(!(c&&v),"Found bad envelope test"),v}},{key:"initCorners",value:function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new T(this._maxx,this._maxy),this._corner[1]=new T(this._minx,this._maxy),this._corner[2]=new T(this._minx,this._miny),this._corner[3]=new T(this._maxx,this._miny)}},{key:"intersects",value:function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(t){return Math.round(t*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var t=r.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new vt(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(t,e){var n=!1,i=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!n||!i)||!!t.equals(this._pt)||!!e.equals(this._pt))))}},{key:"addSnappedNode",value:function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return!!this.intersects(n,i)&&(t.addIntersection(this.getCoordinate(),e),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new G("Scale factor must be non-zero");e!==1&&(this._pt=new T(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new T,this._p1Scaled=new T),this.initCorners(this._pt)}}]),r}();Si.SAFE_ENV_EXPANSION_FACTOR=.75;var go=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Pt}}]),r}(),Is=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"snap",value:function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}if(arguments.length===3){var e=arguments[0],n=arguments[1],i=arguments[2],s=e.getSafeEnvelope(),o=new Ns(e,n,i);return this._index.query(s,new(function(){function c(){a(this,c)}return h(c,[{key:"interfaces_",get:function(){return[os]}},{key:"visitItem",value:function(v){v.select(s,o)}}]),c}())),o.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var t=arguments[0];this._index=t}}]),r}(),Ns=function(r){g(e,r);var t=_(e);function e(){var n;return a(this,e),n=t.call(this),e.constructor_.apply(m(n),arguments),n}return h(e,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof hs))return S(d(e.prototype),"select",this).apply(this,arguments);var n=arguments[0],i=arguments[1],s=n.getContext();if(this._parentEdge===s&&(i===this._hotPixelVertexIndex||i+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(s,i)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],s=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=s}}]),e}(go);Is.HotPixelSnapAction=Ns;var vo=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"processIntersections",value:function(t,e,n,i){if(t===n&&e===i)return null;var s=t.getCoordinates()[e],o=t.getCoordinates()[e+1],c=n.getCoordinates()[i],v=n.getCoordinates()[i+1];if(this._li.computeIntersection(s,o,c,v),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var y=0;y<this._li.getIntersectionNum();y++)this._interiorIntersections.add(this._li.getIntersection(y));t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[ps]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new W}}]),r}(),yo=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"checkCorrectness",value:function(t){var e=Ie.getNodedSubstrings(t),n=new Es(e);try{n.checkValid()}catch(i){if(!(i instanceof q))throw i;i.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return Ie.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)}},{key:"findInteriorIntersections",value:function(t,e){var n=new vo(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(tt(arguments[0],Wt))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Ie)for(var i=arguments[0],s=i.getCoordinates(),o=0;o<s.length;o++){var c=new Si(s[o],this._scaleFactor,this._li),v=this._pointSnapper.snap(c,i,o);v&&i.addIntersection(s[o],o)}}},{key:"computeNodes",value:function(t){this._nodedSegStrings=t,this._noder=new Ii,this._pointSnapper=new Is(this._noder.getIndex()),this.snapRound(t,this._li)}},{key:"computeIntersectionSnaps",value:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=new Si(n,this._scaleFactor,this._li);this._pointSnapper.snap(i)}}},{key:"interfaces_",get:function(){return[Ei]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new Ee,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()}}]),r}(),Be=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"bufferFixedPrecision",value:function(t){var e=new fo(new yo(new Vt(1)),t.getScale()),n=new ks(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var t=r.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(s){if(!(s instanceof ie))throw s;this._saveException=s}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var e=arguments[0],n=r.precisionScaleFactor(this._argGeom,this._distance,e),i=new Vt(n);this.bufferFixedPrecision(i)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Vt.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(t){this._bufParams.setQuadrantSegments(t)}},{key:"bufferOriginalPrecision",value:function(){try{var t=new ks(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof It))throw e;this._saveException=e}}},{key:"getResultGeometry",value:function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(t){this._bufParams.setEndCapStyle(t)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new b,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}}},{key:"bufferOp",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new r(t),i=n.getResultGeometry(e);return i}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof $&&typeof arguments[1]=="number"){var s=arguments[0],o=arguments[1],c=arguments[2],v=new r(s);v.setQuadrantSegments(c);var y=v.getResultGeometry(o);return y}if(arguments[2]instanceof b&&arguments[0]instanceof $&&typeof arguments[1]=="number"){var E=arguments[0],L=arguments[1],C=arguments[2],D=new r(E,C),P=D.getResultGeometry(L);return P}}else if(arguments.length===4){var Z=arguments[0],j=arguments[1],K=arguments[2],ct=arguments[3],pt=new r(Z);pt.setQuadrantSegments(K),pt.setEndCapStyle(ct);var St=pt.getResultGeometry(j);return St}}},{key:"precisionScaleFactor",value:function(t,e,n){var i=t.getEnvelopeInternal(),s=tn.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(s)/Math.log(10)+1);return Math.pow(10,o)}}]),r}();Be.CAP_ROUND=b.CAP_ROUND,Be.CAP_BUTT=b.CAP_FLAT,Be.CAP_FLAT=b.CAP_FLAT,Be.CAP_SQUARE=b.CAP_SQUARE,Be.MAX_PRECISION_DIGITS=12;var mo=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Ss=function(){function r(t){a(this,r),this.geometryFactory=t||new Fe}return h(r,[{key:"read",value:function(t){var e,n=(e=typeof t=="string"?JSON.parse(t):t).type;if(!Xt[n])throw new Error("Unknown GeoJSON type: "+e.type);return mo.indexOf(n)!==-1?Xt[n].call(this,e.coordinates):n==="GeometryCollection"?Xt[n].call(this,e.geometries):Xt[n].call(this,e)}},{key:"write",value:function(t){var e=t.getGeometryType();if(!te[e])throw new Error("Geometry is not supported");return te[e].call(this,t)}}]),r}(),Xt={Feature:function(r){var t={};for(var e in r)t[e]=r[e];if(r.geometry){var n=r.geometry.type;if(!Xt[n])throw new Error("Unknown GeoJSON type: "+r.type);t.geometry=this.read(r.geometry)}return r.bbox&&(t.bbox=Xt.bbox.call(this,r.bbox)),t},FeatureCollection:function(r){var t={};if(r.features){t.features=[];for(var e=0;e<r.features.length;++e)t.features.push(this.read(r.features[e]))}return r.bbox&&(t.bbox=this.parse.bbox.call(this,r.bbox)),t},coordinates:function(r){for(var t=[],e=0;e<r.length;++e){var n=r[e];t.push(x(T,R(n)))}return t},bbox:function(r){return this.geometryFactory.createLinearRing([new T(r[0],r[1]),new T(r[2],r[1]),new T(r[2],r[3]),new T(r[0],r[3]),new T(r[0],r[1])])},Point:function(r){var t=x(T,R(r));return this.geometryFactory.createPoint(t)},MultiPoint:function(r){for(var t=[],e=0;e<r.length;++e)t.push(Xt.Point.call(this,r[e]));return this.geometryFactory.createMultiPoint(t)},LineString:function(r){var t=Xt.coordinates.call(this,r);return this.geometryFactory.createLineString(t)},MultiLineString:function(r){for(var t=[],e=0;e<r.length;++e)t.push(Xt.LineString.call(this,r[e]));return this.geometryFactory.createMultiLineString(t)},Polygon:function(r){for(var t=Xt.coordinates.call(this,r[0]),e=this.geometryFactory.createLinearRing(t),n=[],i=1;i<r.length;++i){var s=r[i],o=Xt.coordinates.call(this,s),c=this.geometryFactory.createLinearRing(o);n.push(c)}return this.geometryFactory.createPolygon(e,n)},MultiPolygon:function(r){for(var t=[],e=0;e<r.length;++e){var n=r[e];t.push(Xt.Polygon.call(this,n))}return this.geometryFactory.createMultiPolygon(t)},GeometryCollection:function(r){for(var t=[],e=0;e<r.length;++e){var n=r[e];t.push(this.read(n))}return this.geometryFactory.createGeometryCollection(t)}},te={coordinate:function(r){var t=[r.x,r.y];return r.z&&t.push(r.z),r.m&&t.push(r.m),t},Point:function(r){return{type:"Point",coordinates:te.coordinate.call(this,r.getCoordinate())}},MultiPoint:function(r){for(var t=[],e=0;e<r._geometries.length;++e){var n=r._geometries[e],i=te.Point.call(this,n);t.push(i.coordinates)}return{type:"MultiPoint",coordinates:t}},LineString:function(r){for(var t=[],e=r.getCoordinates(),n=0;n<e.length;++n){var i=e[n];t.push(te.coordinate.call(this,i))}return{type:"LineString",coordinates:t}},MultiLineString:function(r){for(var t=[],e=0;e<r._geometries.length;++e){var n=r._geometries[e],i=te.LineString.call(this,n);t.push(i.coordinates)}return{type:"MultiLineString",coordinates:t}},Polygon:function(r){var t=[],e=te.LineString.call(this,r._shell);t.push(e.coordinates);for(var n=0;n<r._holes.length;++n){var i=r._holes[n],s=te.LineString.call(this,i);t.push(s.coordinates)}return{type:"Polygon",coordinates:t}},MultiPolygon:function(r){for(var t=[],e=0;e<r._geometries.length;++e){var n=r._geometries[e],i=te.Polygon.call(this,n);t.push(i.coordinates)}return{type:"MultiPolygon",coordinates:t}},GeometryCollection:function(r){for(var t=[],e=0;e<r._geometries.length;++e){var n=r._geometries[e],i=n.getGeometryType();t.push(te[i].call(this,n))}return{type:"GeometryCollection",geometries:t}}};return{BufferOp:Be,GeoJSONReader:function(){function r(t){a(this,r),this.parser=new Ss(t||new Fe)}return h(r,[{key:"read",value:function(t){return this.parser.read(t)}}]),r}(),GeoJSONWriter:function(){function r(){a(this,r),this.parser=new Ss(this.geometryFactory)}return h(r,[{key:"write",value:function(t){return this.parser.write(t)}}]),r}()}})})(ir);var La=ir.exports;const Ta=wa(La);function fe(){return new dn}function dn(){this.reset()}dn.prototype={constructor:dn,reset:function(){this.s=this.t=0},add:function(l){rr(pn,l,this.t),rr(this,pn.s,this.s),this.s?this.t+=pn.t:this.s=pn.t},valueOf:function(){return this.s}};var pn=new dn;function rr(l,u,a){var f=l.s=u+a,h=f-u,g=f-h;l.t=u-g+(a-h)}var ft=1e-6,ut=Math.PI,$t=ut/2,sr=ut/4,jt=ut*2,ge=180/ut,Gt=ut/180,xt=Math.abs,Ca=Math.atan,be=Math.atan2,mt=Math.cos,dt=Math.sin,Me=Math.sqrt;function ar(l){return l>1?0:l<-1?ut:Math.acos(l)}function me(l){return l>1?$t:l<-1?-$t:Math.asin(l)}function We(){}function _n(l,u){l&&or.hasOwnProperty(l.type)&&or[l.type](l,u)}var ur={Feature:function(l,u){_n(l.geometry,u)},FeatureCollection:function(l,u){for(var a=l.features,f=-1,h=a.length;++f<h;)_n(a[f].geometry,u)}},or={Sphere:function(l,u){u.sphere()},Point:function(l,u){l=l.coordinates,u.point(l[0],l[1],l[2])},MultiPoint:function(l,u){for(var a=l.coordinates,f=-1,h=a.length;++f<h;)l=a[f],u.point(l[0],l[1],l[2])},LineString:function(l,u){ti(l.coordinates,u,0)},MultiLineString:function(l,u){for(var a=l.coordinates,f=-1,h=a.length;++f<h;)ti(a[f],u,0)},Polygon:function(l,u){lr(l.coordinates,u)},MultiPolygon:function(l,u){for(var a=l.coordinates,f=-1,h=a.length;++f<h;)lr(a[f],u)},GeometryCollection:function(l,u){for(var a=l.geometries,f=-1,h=a.length;++f<h;)_n(a[f],u)}};function ti(l,u,a){var f=-1,h=l.length-a,g;for(u.lineStart();++f<h;)g=l[f],u.point(g[0],g[1],g[2]);u.lineEnd()}function lr(l,u){var a=-1,f=l.length;for(u.polygonStart();++a<f;)ti(l[a],u,1);u.polygonEnd()}function Ra(l,u){l&&ur.hasOwnProperty(l.type)?ur[l.type](l,u):_n(l,u)}fe(),fe();function ei(l){return[be(l[1],l[0]),me(l[2])]}function Pe(l){var u=l[0],a=l[1],f=mt(a);return[f*mt(u),f*dt(u),dt(a)]}function xn(l,u){return l[0]*u[0]+l[1]*u[1]+l[2]*u[2]}function kn(l,u){return[l[1]*u[2]-l[2]*u[1],l[2]*u[0]-l[0]*u[2],l[0]*u[1]-l[1]*u[0]]}function ni(l,u){l[0]+=u[0],l[1]+=u[1],l[2]+=u[2]}function En(l,u){return[l[0]*u,l[1]*u,l[2]*u]}function ii(l){var u=Me(l[0]*l[0]+l[1]*l[1]+l[2]*l[2]);l[0]/=u,l[1]/=u,l[2]/=u}fe();function hr(l,u){function a(f,h){return f=l(f,h),u(f[0],f[1])}return l.invert&&u.invert&&(a.invert=function(f,h){return f=u.invert(f,h),f&&l.invert(f[0],f[1])}),a}function ri(l,u){return[l>ut?l-jt:l<-ut?l+jt:l,u]}ri.invert=ri;function Oa(l,u,a){return(l%=jt)?u||a?hr(fr(l),gr(u,a)):fr(l):u||a?gr(u,a):ri}function cr(l){return function(u,a){return u+=l,[u>ut?u-jt:u<-ut?u+jt:u,a]}}function fr(l){var u=cr(l);return u.invert=cr(-l),u}function gr(l,u){var a=mt(l),f=dt(l),h=mt(u),g=dt(u);function d(p,w){var x=mt(w),N=mt(p)*x,m=dt(p)*x,I=dt(w),_=I*a+N*f;return[be(m*h-_*g,N*a-I*f),me(_*h+m*g)]}return d.invert=function(p,w){var x=mt(w),N=mt(p)*x,m=dt(p)*x,I=dt(w),_=I*h-m*g;return[be(m*h+I*g,N*a+_*f),me(_*a-N*f)]},d}function ba(l,u,a,f,h,g){if(a){var d=mt(u),p=dt(u),w=f*a;h==null?(h=u+f*jt,g=u-w/2):(h=vr(d,h),g=vr(d,g),(f>0?h<g:h>g)&&(h+=f*jt));for(var x,N=h;f>0?N>g:N<g;N-=w)x=ei([d,-p*mt(N),-p*dt(N)]),l.point(x[0],x[1])}}function vr(l,u){u=Pe(u),u[0]-=l,ii(u);var a=ar(-u[1]);return((-u[2]<0?-a:a)+jt-ft)%jt}function yr(){var l=[],u;return{point:function(a,f){u.push([a,f])},lineStart:function(){l.push(u=[])},lineEnd:We,rejoin:function(){l.length>1&&l.push(l.pop().concat(l.shift()))},result:function(){var a=l;return l=[],u=null,a}}}function Ma(l,u,a,f,h,g){var d=l[0],p=l[1],w=u[0],x=u[1],N=0,m=1,I=w-d,_=x-p,S;if(S=a-d,!(!I&&S>0)){if(S/=I,I<0){if(S<N)return;S<m&&(m=S)}else if(I>0){if(S>m)return;S>N&&(N=S)}if(S=h-d,!(!I&&S<0)){if(S/=I,I<0){if(S>m)return;S>N&&(N=S)}else if(I>0){if(S<N)return;S<m&&(m=S)}if(S=f-p,!(!_&&S>0)){if(S/=_,_<0){if(S<N)return;S<m&&(m=S)}else if(_>0){if(S>m)return;S>N&&(N=S)}if(S=g-p,!(!_&&S<0)){if(S/=_,_<0){if(S>m)return;S>N&&(N=S)}else if(_>0){if(S<N)return;S<m&&(m=S)}return N>0&&(l[0]=d+N*I,l[1]=p+N*_),m<1&&(u[0]=d+m*I,u[1]=p+m*_),!0}}}}}function In(l,u){return xt(l[0]-u[0])<ft&&xt(l[1]-u[1])<ft}function Nn(l,u,a,f){this.x=l,this.z=u,this.o=a,this.e=f,this.v=!1,this.n=this.p=null}function mr(l,u,a,f,h){var g=[],d=[],p,w;if(l.forEach(function(S){if(!((R=S.length-1)<=0)){var R,O=S[0],A=S[R],M;if(In(O,A)){for(h.lineStart(),p=0;p<R;++p)h.point((O=S[p])[0],O[1]);h.lineEnd();return}g.push(M=new Nn(O,S,null,!0)),d.push(M.o=new Nn(O,null,M,!1)),g.push(M=new Nn(A,S,null,!1)),d.push(M.o=new Nn(A,null,M,!0))}}),!!g.length){for(d.sort(u),dr(g),dr(d),p=0,w=d.length;p<w;++p)d[p].e=a=!a;for(var x=g[0],N,m;;){for(var I=x,_=!0;I.v;)if((I=I.n)===x)return;N=I.z,h.lineStart();do{if(I.v=I.o.v=!0,I.e){if(_)for(p=0,w=N.length;p<w;++p)h.point((m=N[p])[0],m[1]);else f(I.x,I.n.x,1,h);I=I.n}else{if(_)for(N=I.p.z,p=N.length-1;p>=0;--p)h.point((m=N[p])[0],m[1]);else f(I.x,I.p.x,-1,h);I=I.p}I=I.o,N=I.z,_=!_}while(!I.v);h.lineEnd()}}}function dr(l){if(u=l.length){for(var u,a=0,f=l[0],h;++a<u;)f.n=h=l[a],h.p=f,f=h;f.n=h=l[0],h.p=f}}function pr(l,u){return l<u?-1:l>u?1:l>=u?0:NaN}function Pa(l){return l.length===1&&(l=Aa(l)),{left:function(u,a,f,h){for(f==null&&(f=0),h==null&&(h=u.length);f<h;){var g=f+h>>>1;l(u[g],a)<0?f=g+1:h=g}return f},right:function(u,a,f,h){for(f==null&&(f=0),h==null&&(h=u.length);f<h;){var g=f+h>>>1;l(u[g],a)>0?h=g:f=g+1}return f}}}function Aa(l){return function(u,a){return pr(l(u),a)}}Pa(pr);function _r(l){for(var u=l.length,a,f=-1,h=0,g,d;++f<u;)h+=l[f].length;for(g=new Array(h);--u>=0;)for(d=l[u],a=d.length;--a>=0;)g[--h]=d[a];return g}var Qe=1e9,Sn=-Qe;function Da(l,u,a,f){function h(x,N){return l<=x&&x<=a&&u<=N&&N<=f}function g(x,N,m,I){var _=0,S=0;if(x==null||(_=d(x,m))!==(S=d(N,m))||w(x,N)<0^m>0)do I.point(_===0||_===3?l:a,_>1?f:u);while((_=(_+m+4)%4)!==S);else I.point(N[0],N[1])}function d(x,N){return xt(x[0]-l)<ft?N>0?0:3:xt(x[0]-a)<ft?N>0?2:1:xt(x[1]-u)<ft?N>0?1:0:N>0?3:2}function p(x,N){return w(x.x,N.x)}function w(x,N){var m=d(x,1),I=d(N,1);return m!==I?m-I:m===0?N[1]-x[1]:m===1?x[0]-N[0]:m===2?x[1]-N[1]:N[0]-x[0]}return function(x){var N=x,m=yr(),I,_,S,R,O,A,M,b,q,G,B,X={point:V,lineStart:rt,lineEnd:ot,polygonStart:st,polygonEnd:et};function V(nt,lt){h(nt,lt)&&N.point(nt,lt)}function U(){for(var nt=0,lt=0,gt=_.length;lt<gt;++lt)for(var kt=_[lt],Et=1,H=kt.length,Lt=kt[0],It,Rt,it=Lt[0],ne=Lt[1];Et<H;++Et)It=it,Rt=ne,Lt=kt[Et],it=Lt[0],ne=Lt[1],Rt<=f?ne>f&&(it-It)*(f-Rt)>(ne-Rt)*(l-It)&&++nt:ne<=f&&(it-It)*(f-Rt)<(ne-Rt)*(l-It)&&--nt;return nt}function st(){N=m,I=[],_=[],B=!0}function et(){var nt=U(),lt=B&&nt,gt=(I=_r(I)).length;(lt||gt)&&(x.polygonStart(),lt&&(x.lineStart(),g(null,null,1,x),x.lineEnd()),gt&&mr(I,p,nt,g,x),x.polygonEnd()),N=x,I=_=S=null}function rt(){X.point=z,_&&_.push(S=[]),G=!0,q=!1,M=b=NaN}function ot(){I&&(z(R,O),A&&q&&m.rejoin(),I.push(m.result())),X.point=V,q&&N.lineEnd()}function z(nt,lt){var gt=h(nt,lt);if(_&&S.push([nt,lt]),G)R=nt,O=lt,A=gt,G=!1,gt&&(N.lineStart(),N.point(nt,lt));else if(gt&&q)N.point(nt,lt);else{var kt=[M=Math.max(Sn,Math.min(Qe,M)),b=Math.max(Sn,Math.min(Qe,b))],Et=[nt=Math.max(Sn,Math.min(Qe,nt)),lt=Math.max(Sn,Math.min(Qe,lt))];Ma(kt,Et,l,u,a,f)?(q||(N.lineStart(),N.point(kt[0],kt[1])),N.point(Et[0],Et[1]),gt||N.lineEnd(),B=!1):gt&&(N.lineStart(),N.point(nt,lt),B=!1)}M=nt,b=lt,q=gt}return X}}var si=fe();function Fa(l,u){var a=u[0],f=u[1],h=[dt(a),-mt(a),0],g=0,d=0;si.reset();for(var p=0,w=l.length;p<w;++p)if(N=(x=l[p]).length)for(var x,N,m=x[N-1],I=m[0],_=m[1]/2+sr,S=dt(_),R=mt(_),O=0;O<N;++O,I=M,S=q,R=G,m=A){var A=x[O],M=A[0],b=A[1]/2+sr,q=dt(b),G=mt(b),B=M-I,X=B>=0?1:-1,V=X*B,U=V>ut,st=S*q;if(si.add(be(st*X*dt(V),R*G+st*mt(V))),g+=U?B+X*jt:B,U^I>=a^M>=a){var et=kn(Pe(m),Pe(A));ii(et);var rt=kn(h,et);ii(rt);var ot=(U^B>=0?-1:1)*me(rt[2]);(f>ot||f===ot&&(et[0]||et[1]))&&(d+=U^B>=0?1:-1)}}return(g<-ft||g<ft&&si<-ft)^d&1}fe();function xr(l){return l}fe(),fe();var Ae=1/0,wn=Ae,Je=-Ae,Ln=Je,kr={point:Ga,lineStart:We,lineEnd:We,polygonStart:We,polygonEnd:We,result:function(){var l=[[Ae,wn],[Je,Ln]];return Je=Ln=-(wn=Ae=1/0),l}};function Ga(l,u){l<Ae&&(Ae=l),l>Je&&(Je=l),u<wn&&(wn=u),u>Ln&&(Ln=u)}fe();function Er(l,u,a,f){return function(h,g){var d=u(g),p=h.invert(f[0],f[1]),w=yr(),x=u(w),N=!1,m,I,_,S={point:R,lineStart:A,lineEnd:M,polygonStart:function(){S.point=b,S.lineStart=q,S.lineEnd=G,I=[],m=[]},polygonEnd:function(){S.point=R,S.lineStart=A,S.lineEnd=M,I=_r(I);var B=Fa(m,p);I.length?(N||(g.polygonStart(),N=!0),mr(I,Ya,B,a,g)):B&&(N||(g.polygonStart(),N=!0),g.lineStart(),a(null,null,1,g),g.lineEnd()),N&&(g.polygonEnd(),N=!1),I=m=null},sphere:function(){g.polygonStart(),g.lineStart(),a(null,null,1,g),g.lineEnd(),g.polygonEnd()}};function R(B,X){var V=h(B,X);l(B=V[0],X=V[1])&&g.point(B,X)}function O(B,X){var V=h(B,X);d.point(V[0],V[1])}function A(){S.point=O,d.lineStart()}function M(){S.point=R,d.lineEnd()}function b(B,X){_.push([B,X]);var V=h(B,X);x.point(V[0],V[1])}function q(){x.lineStart(),_=[]}function G(){b(_[0][0],_[0][1]),x.lineEnd();var B=x.clean(),X=w.result(),V,U=X.length,st,et,rt;if(_.pop(),m.push(_),_=null,!!U){if(B&1){if(et=X[0],(st=et.length-1)>0){for(N||(g.polygonStart(),N=!0),g.lineStart(),V=0;V<st;++V)g.point((rt=et[V])[0],rt[1]);g.lineEnd()}return}U>1&&B&2&&X.push(X.pop().concat(X.shift())),I.push(X.filter(qa))}}return S}}function qa(l){return l.length>1}function Ya(l,u){return((l=l.x)[0]<0?l[1]-$t-ft:$t-l[1])-((u=u.x)[0]<0?u[1]-$t-ft:$t-u[1])}const Ir=Er(function(){return!0},za,Xa,[-ut,-$t]);function za(l){var u=NaN,a=NaN,f=NaN,h;return{lineStart:function(){l.lineStart(),h=1},point:function(g,d){var p=g>0?ut:-ut,w=xt(g-u);xt(w-ut)<ft?(l.point(u,a=(a+d)/2>0?$t:-$t),l.point(f,a),l.lineEnd(),l.lineStart(),l.point(p,a),l.point(g,a),h=0):f!==p&&w>=ut&&(xt(u-f)<ft&&(u-=f*ft),xt(g-p)<ft&&(g-=p*ft),a=Ba(u,a,g,d),l.point(f,a),l.lineEnd(),l.lineStart(),l.point(p,a),h=0),l.point(u=g,a=d),f=p},lineEnd:function(){l.lineEnd(),u=a=NaN},clean:function(){return 2-h}}}function Ba(l,u,a,f){var h,g,d=dt(l-a);return xt(d)>ft?Ca((dt(u)*(g=mt(f))*dt(a)-dt(f)*(h=mt(u))*dt(l))/(h*g*d)):(u+f)/2}function Xa(l,u,a,f){var h;if(l==null)h=a*$t,f.point(-ut,h),f.point(0,h),f.point(ut,h),f.point(ut,0),f.point(ut,-h),f.point(0,-h),f.point(-ut,-h),f.point(-ut,0),f.point(-ut,h);else if(xt(l[0]-u[0])>ft){var g=l[0]<u[0]?ut:-ut;h=a*g/2,f.point(-g,h),f.point(0,h),f.point(g,h)}else f.point(u[0],u[1])}function Ua(l,u){var a=mt(l),f=a>0,h=xt(a)>ft;function g(N,m,I,_){ba(_,l,u,I,N,m)}function d(N,m){return mt(N)*mt(m)>a}function p(N){var m,I,_,S,R;return{lineStart:function(){S=_=!1,R=1},point:function(O,A){var M=[O,A],b,q=d(O,A),G=f?q?0:x(O,A):q?x(O+(O<0?ut:-ut),A):0;if(!m&&(S=_=q)&&N.lineStart(),q!==_&&(b=w(m,M),(!b||In(m,b)||In(M,b))&&(M[0]+=ft,M[1]+=ft,q=d(M[0],M[1]))),q!==_)R=0,q?(N.lineStart(),b=w(M,m),N.point(b[0],b[1])):(b=w(m,M),N.point(b[0],b[1]),N.lineEnd()),m=b;else if(h&&m&&f^q){var B;!(G&I)&&(B=w(M,m,!0))&&(R=0,f?(N.lineStart(),N.point(B[0][0],B[0][1]),N.point(B[1][0],B[1][1]),N.lineEnd()):(N.point(B[1][0],B[1][1]),N.lineEnd(),N.lineStart(),N.point(B[0][0],B[0][1])))}q&&(!m||!In(m,M))&&N.point(M[0],M[1]),m=M,_=q,I=G},lineEnd:function(){_&&N.lineEnd(),m=null},clean:function(){return R|(S&&_)<<1}}}function w(N,m,I){var _=Pe(N),S=Pe(m),R=[1,0,0],O=kn(_,S),A=xn(O,O),M=O[0],b=A-M*M;if(!b)return!I&&N;var q=a*A/b,G=-a*M/b,B=kn(R,O),X=En(R,q),V=En(O,G);ni(X,V);var U=B,st=xn(X,U),et=xn(U,U),rt=st*st-et*(xn(X,X)-1);if(!(rt<0)){var ot=Me(rt),z=En(U,(-st-ot)/et);if(ni(z,X),z=ei(z),!I)return z;var nt=N[0],lt=m[0],gt=N[1],kt=m[1],Et;lt<nt&&(Et=nt,nt=lt,lt=Et);var H=lt-nt,Lt=xt(H-ut)<ft,It=Lt||H<ft;if(!Lt&&kt<gt&&(Et=gt,gt=kt,kt=Et),It?Lt?gt+kt>0^z[1]<(xt(z[0]-nt)<ft?gt:kt):gt<=z[1]&&z[1]<=kt:H>ut^(nt<=z[0]&&z[0]<=lt)){var Rt=En(U,(-st+ot)/et);return ni(Rt,X),[z,ei(Rt)]}}}function x(N,m){var I=f?l:ut-l,_=0;return N<-I?_|=1:N>I&&(_|=2),m<-I?_|=4:m>I&&(_|=8),_}return Er(d,p,g,f?[0,-l]:[-ut,l-ut])}function Nr(l){return function(u){var a=new ai;for(var f in l)a[f]=l[f];return a.stream=u,a}}function ai(){}ai.prototype={constructor:ai,point:function(l,u){this.stream.point(l,u)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Sr(l,u,a){var f=u[1][0]-u[0][0],h=u[1][1]-u[0][1],g=l.clipExtent&&l.clipExtent();l.scale(150).translate([0,0]),g!=null&&l.clipExtent(null),Ra(a,l.stream(kr));var d=kr.result(),p=Math.min(f/(d[1][0]-d[0][0]),h/(d[1][1]-d[0][1])),w=+u[0][0]+(f-p*(d[1][0]+d[0][0]))/2,x=+u[0][1]+(h-p*(d[1][1]+d[0][1]))/2;return g!=null&&l.clipExtent(g),l.scale(p*150).translate([w,x])}function Va(l,u,a){return Sr(l,[[0,0],u],a)}var wr=16,Ha=mt(30*Gt);function Lr(l,u){return+u?$a(l,u):Za(l)}function Za(l){return Nr({point:function(u,a){u=l(u,a),this.stream.point(u[0],u[1])}})}function $a(l,u){function a(f,h,g,d,p,w,x,N,m,I,_,S,R,O){var A=x-f,M=N-h,b=A*A+M*M;if(b>4*u&&R--){var q=d+I,G=p+_,B=w+S,X=Me(q*q+G*G+B*B),V=me(B/=X),U=xt(xt(B)-1)<ft||xt(g-m)<ft?(g+m)/2:be(G,q),st=l(U,V),et=st[0],rt=st[1],ot=et-f,z=rt-h,nt=M*ot-A*z;(nt*nt/b>u||xt((A*ot+M*z)/b-.5)>.3||d*I+p*_+w*S<Ha)&&(a(f,h,g,d,p,w,et,rt,U,q/=X,G/=X,B,R,O),O.point(et,rt),a(et,rt,U,q,G,B,x,N,m,I,_,S,R,O))}}return function(f){var h,g,d,p,w,x,N,m,I,_,S,R,O={point:A,lineStart:M,lineEnd:q,polygonStart:function(){f.polygonStart(),O.lineStart=G},polygonEnd:function(){f.polygonEnd(),O.lineStart=M}};function A(V,U){V=l(V,U),f.point(V[0],V[1])}function M(){m=NaN,O.point=b,f.lineStart()}function b(V,U){var st=Pe([V,U]),et=l(V,U);a(m,I,N,_,S,R,m=et[0],I=et[1],N=V,_=st[0],S=st[1],R=st[2],wr,f),f.point(m,I)}function q(){O.point=A,f.lineEnd()}function G(){M(),O.point=B,O.lineEnd=X}function B(V,U){b(h=V,U),g=m,d=I,p=_,w=S,x=R,O.point=b}function X(){a(m,I,N,_,S,R,g,d,h,p,w,x,wr,f),O.lineEnd=q,q()}return O}}var ja=Nr({point:function(l,u){this.stream.point(l*Gt,u*Gt)}});function Wa(l){return Qa(function(){return l})()}function Qa(l){var u,a=150,f=480,h=250,g,d,p=0,w=0,x=0,N=0,m=0,I,_,S=null,R=Ir,O=null,A,M,b,q=xr,G=.5,B=Lr(et,G),X,V;function U(z){return z=_(z[0]*Gt,z[1]*Gt),[z[0]*a+g,d-z[1]*a]}function st(z){return z=_.invert((z[0]-g)/a,(d-z[1])/a),z&&[z[0]*ge,z[1]*ge]}function et(z,nt){return z=u(z,nt),[z[0]*a+g,d-z[1]*a]}U.stream=function(z){return X&&V===z?X:X=ja(R(I,B(q(V=z))))},U.clipAngle=function(z){return arguments.length?(R=+z?Ua(S=z*Gt,6*Gt):(S=null,Ir),ot()):S*ge},U.clipExtent=function(z){return arguments.length?(q=z==null?(O=A=M=b=null,xr):Da(O=+z[0][0],A=+z[0][1],M=+z[1][0],b=+z[1][1]),ot()):O==null?null:[[O,A],[M,b]]},U.scale=function(z){return arguments.length?(a=+z,rt()):a},U.translate=function(z){return arguments.length?(f=+z[0],h=+z[1],rt()):[f,h]},U.center=function(z){return arguments.length?(p=z[0]%360*Gt,w=z[1]%360*Gt,rt()):[p*ge,w*ge]},U.rotate=function(z){return arguments.length?(x=z[0]%360*Gt,N=z[1]%360*Gt,m=z.length>2?z[2]%360*Gt:0,rt()):[x*ge,N*ge,m*ge]},U.precision=function(z){return arguments.length?(B=Lr(et,G=z*z),ot()):Me(G)},U.fitExtent=function(z,nt){return Sr(U,z,nt)},U.fitSize=function(z,nt){return Va(U,z,nt)};function rt(){_=hr(I=Oa(x,N,m),u);var z=u(p,w);return g=f-z[0]*a,d=h+z[1]*a,ot()}function ot(){return X=V=null,U}return function(){return u=l.apply(this,arguments),U.invert=u.invert&&st,rt()}}function Tr(l){return function(u,a){var f=mt(u),h=mt(a),g=l(f*h);return[g*h*dt(u),g*dt(a)]}}function Cr(l){return function(u,a){var f=Me(u*u+a*a),h=l(f),g=dt(h),d=mt(h);return[be(u*g,f*d),me(f&&a*g/f)]}}var Ja=Tr(function(l){return Me(2/(1+l))});Ja.invert=Cr(function(l){return 2*me(l/2)});var Rr=Tr(function(l){return(l=ar(l))&&l/dt(l)});Rr.invert=Cr(function(l){return l});function Ka(){return Wa(Rr).scale(79.4188).clipAngle(180-.001)}function Or(l,u){return[l,u]}Or.invert=Or;var{BufferOp:tu,GeoJSONReader:eu,GeoJSONWriter:nu}=Ta;function iu(l,u,a){a=a||{};var f=a.units||"kilometers",h=a.steps||8;if(!l)throw new Error("geojson is required");if(typeof a!="object")throw new Error("options must be an object");if(typeof h!="number")throw new Error("steps must be an number");if(u===void 0)throw new Error("radius is required");if(h<=0)throw new Error("steps must be greater than 0");var g=[];switch(l.type){case"GeometryCollection":return vn(l,function(d){var p=Tn(d,u,f,h);p&&g.push(p)}),Le(g);case"FeatureCollection":return $i(l,function(d){var p=Tn(d,u,f,h);p&&$i(p,function(w){w&&g.push(w)})}),Le(g)}return Tn(l,u,f,h)}function Tn(l,u,a,f){var h=l.properties||{},g=l.type==="Feature"?l.geometry:l;if(g.type==="GeometryCollection"){var d=[];return vn(l,function(R){var O=Tn(R,u,a,f);O&&d.push(O)}),Le(d)}var p=ru(g),w={type:g.type,coordinates:Mr(g.coordinates,p)},x=new eu,N=x.read(w),m=Cs(Rs(u,a),"meters"),I=tu.bufferOp(N,m,f),_=new nu;if(I=_.write(I),!br(I.coordinates)){var S={type:I.type,coordinates:Pr(I.coordinates,p)};return Ue(S,h)}}function br(l){return Array.isArray(l[0])?br(l[0]):isNaN(l[0])}function Mr(l,u){return typeof l[0]!="object"?u(l):l.map(function(a){return Mr(a,u)})}function Pr(l,u){return typeof l[0]!="object"?u.invert(l):l.map(function(a){return Pr(a,u)})}function ru(l){var u=Na(l).geometry.coordinates,a=[-u[0],-u[1]];return Ka().rotate(a).scale(Ct)}var su=iu;function au(l){const u=[];if(vn(l,h=>{u.push(h.coordinates)}),u.length<2)throw new Error("Must have at least two features");const a=l.features[0].properties||{},f=Hi.difference(u[0],...u.slice(1));return f.length===0?null:f.length===1?zn(f[0],a):Ri(f,a)}var uu=au;function Ar(l){let u;for(const a of l)u&&a[0]-u[0]>=180?a[0]-=360:u&&a[0]-u[0]<-180&&(a[0]+=360),u=a}function Dr(l,u){const a=uu(Le([zn([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),l]));if(!a)return;a.properties={isMask:"y"};const f=su(l,0);if(f){if(f.geometry.type==="Polygon")for(const h of f.geometry.coordinates)Ar(h);else for(const h of f.geometry.coordinates)for(const g of h)Ar(g);u(Le([f,a]))}}function ou(l,u=!0,a=!0,f={},h={},g=d=>{var x,N,m;const p=(x=d==null?void 0:d.geometry)==null?void 0:x.type,w=(N=d==null?void 0:d.properties)!=null&&N.isMask?0:p==="LineString"||p==="MultiLineString"?3:2;return{color:"#3170fe",fillColor:"#000",fillOpacity:(m=d==null?void 0:d.properties)!=null&&m.isMask?.1:0,weight:w,dashArray:[w,w],lineCap:"butt"}}){let d;const p=[];let w,x;const N=we.geoJSON(void 0,{style:g,interactive:!1}).addTo(l),m=_=>{d==null||d({type:"mapClick",coordinates:[_.latlng.lng,_.latlng.lat]})};function I(_,S=!1){const R=document.createElement("div");return new Ea({props:{displayIn:"leaflet"},target:R}),new we.Marker(_,{interactive:S,icon:new we.DivIcon({html:R,className:"",iconAnchor:[12,26],iconSize:[25,30],tooltipAnchor:[1,-24]})})}return{setEventHandler(_){_?(d=_,l.on("click",m)):(d=void 0,l.off("click",m))},flyTo(_,S){l.flyTo([_[1],_[0]],S,{duration:2,...f})},fitBounds(_,S,R){l.flyToBounds([[_[1],_[0]],[_[3],_[2]]],{padding:[S,S],duration:2,maxZoom:R,...h})},indicateReverse(_){l.getContainer().style.cursor=_?"crosshair":""},setReverseMarker(_){var R;if(!u)return;const S=_&&[_[1],_[0]];x?S?x.setLatLng(S):(x.remove(),x=void 0):S&&(x=(typeof u=="object"?new we.Marker(S,u):I(S)).addTo(l),(R=x.getElement())==null||R.classList.add("marker-reverse"))},setMarkers(_,S){if(!u)return;function R(O){N.clearLayers(),O&&N.addData(O)}for(const O of p)O.remove();if(p.length=0,R(),S){let O=!1;if(S.geometry.type==="GeometryCollection"){const M=S.geometry.geometries.filter(b=>b.type==="Polygon"||b.type==="MultiPolygon");t:if(M.length>0){const b=na(Le(M.map(q=>Ue(q))));if(!b)break t;Dr({...S,geometry:b.geometry},R),O=!0}else{const b=S.geometry.geometries.filter(q=>q.type==="LineString"||q.type==="MultiLineString");b.length>0&&(R({...S,geometry:{type:"GeometryCollection",geometries:b}}),O=!0)}}if(!O){if(S.geometry.type==="Polygon"||S.geometry.type==="MultiPolygon")Dr(S,R);else if(S.geometry.type==="LineString"||S.geometry.type==="MultiLineString"){R(S);return}}const A=[S.center[1],S.center[0]];p.push((typeof u=="object"?new we.Marker(A,u):I(A)).addTo(l))}if(a)for(const O of _??[]){if(O===S)continue;const A=[O.center[1],O.center[0]],M=typeof a=="object"?new we.Marker(A,a):I(A,!0);M.addTo(l).bindTooltip(O.place_type[0]==="reverse"?O.place_name:O.place_name.replace(/,.*/,""),{direction:"top"});const b=M.getElement();b&&(b.addEventListener("click",q=>{q.stopPropagation(),d==null||d({type:"markerClick",id:O.id})}),b.addEventListener("mouseenter",()=>{d==null||d({type:"markerMouseEnter",id:O.id})}),b.addEventListener("mouseleave",()=>{d==null||d({type:"markerMouseLeave",id:O.id})}),b.classList.toggle("marker-fuzzy",!!O.matching_text)),p.push(M)}},setSelectedMarker(_){var S,R;w&&((S=w.getElement())==null||S.classList.toggle("marker-selected",!1)),w=_>-1?p[_]:void 0,(R=w==null?void 0:w.getElement())==null||R.classList.toggle("marker-selected",!0)},getCenterAndZoom(){const _=l.getCenter();return[l.getZoom(),_.lng,_.lat]}}}Ot.createLeafletMapController=ou,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"})});
|
|
21
|
+
***************************************************************************** */function ue(r,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,l;return l={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function u(f){return function(p){return c([f,p])}}function c(f){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,i&&(o=f[0]&2?i.return:f[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,f[1])).done)return o;switch(i=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return e.label++,{value:f[1],done:!1};case 5:e.label++,i=f[1],f=[0];continue;case 7:f=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){e=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){e.label=f[1];break}if(f[0]===6&&e.label<o[1]){e.label=o[1],o=f;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(f);break}o[2]&&e.ops.pop(),e.trys.pop();continue}f=t.call(r,e)}catch(p){f=[6,p],i=0}finally{n=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}var G=function(){function r(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return r}();function fe(r,t){return r>t?1:r<t?-1:0}function z(r,t,e){for(var n=new G(null,null),i=n,o=n;;){var l=e(r,t.key);if(l<0){if(t.left===null)break;if(e(r,t.left.key)<0){var u=t.left;if(t.left=u.right,u.right=t,t=u,t.left===null)break}o.left=t,o=t,t=t.left}else if(l>0){if(t.right===null)break;if(e(r,t.right.key)>0){var u=t.right;if(t.right=u.left,u.left=t,t=u,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,o.left=t.right,t.left=n.right,t.right=n.left,t}function ht(r,t,e,n){var i=new G(r,t);if(e===null)return i.left=i.right=null,i;e=z(r,e,n);var o=n(r,e.key);return o<0?(i.left=e.left,i.right=e,e.left=null):o>=0&&(i.right=e.right,i.left=e,e.right=null),i}function kt(r,t,e){var n=null,i=null;if(t){t=z(r,t,e);var o=e(t.key,r);o===0?(n=t.left,i=t.right):o<0?(i=t.right,t.right=null,n=t):(n=t.left,t.left=null,i=t)}return{left:n,right:i}}function ce(r,t,e){return t===null?r:(r===null||(t=z(r.key,t,e),t.left=r),t)}function at(r,t,e,n,i){if(r){n(""+t+(e?"└── ":"├── ")+i(r)+`
|
|
22
|
+
`);var o=t+(e?" ":"│ ");r.left&&at(r.left,o,!1,n,i),r.right&&at(r.right,o,!0,n,i)}}var pt=function(){function r(t){t===void 0&&(t=fe),this._root=null,this._size=0,this._comparator=t}return r.prototype.insert=function(t,e){return this._size++,this._root=ht(t,e,this._root,this._comparator)},r.prototype.add=function(t,e){var n=new G(t,e);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,o=z(t,this._root,i),l=i(t,o.key);return l===0?this._root=o:(l<0?(n.left=o.left,n.right=o,o.left=null):l>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},r.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},r.prototype._remove=function(t,e,n){var i;if(e===null)return null;e=z(t,e,n);var o=n(t,e.key);return o===0?(e.left===null?i=e.right:(i=z(t,e.left,n),i.right=e.right),this._size--,i):e},r.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=z(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},r.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return e;i<0?e=e.left:e=e.right}return null},r.prototype.find=function(t){return this._root&&(this._root=z(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},r.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var i=n(t,e.key);if(i===0)return!0;i<0?e=e.left:e=e.right}return!1},r.prototype.forEach=function(t,e){for(var n=this._root,i=[],o=!1;!o;)n!==null?(i.push(n),n=n.left):i.length!==0?(n=i.pop(),t.call(e,n),n=n.right):o=!0;return this},r.prototype.range=function(t,e,n,i){for(var o=[],l=this._comparator,u=this._root,c;o.length!==0||u;)if(u)o.push(u),u=u.left;else{if(u=o.pop(),c=l(u.key,e),c>0)break;if(l(u.key,t)>=0&&n.call(i,u))return this;u=u.right}return this},r.prototype.keys=function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t},r.prototype.values=function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},r.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},r.prototype.at=function(t){for(var e=this._root,n=!1,i=0,o=[];!n;)if(e)o.push(e),e=e.left;else if(o.length>0){if(e=o.pop(),i===t)return e;i++,e=e.right}else n=!0;return null},r.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?(n=e,e=e.left):e=e.right}return n},r.prototype.prev=function(t){var e=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var i=this._comparator;e;){var o=i(t.key,e.key);if(o===0)break;o<0?e=e.left:(n=e,e=e.right)}return n},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return ae(this._root)},r.prototype.load=function(t,e,n){e===void 0&&(e=[]),n===void 0&&(n=!1);var i=t.length,o=this._comparator;if(n&&dt(t,e,0,i-1,o),this._root===null)this._root=gt(t,e,0,i),this._size=i;else{var l=pe(this.toList(),he(t,e),o);i=this._size+i,this._root=yt({head:l},0,i)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var e=[];return at(this._root,"",!0,function(n){return e.push(n)},t),e.join("")},r.prototype.update=function(t,e,n){var i=this._comparator,o=kt(t,this._root,i),l=o.left,u=o.right;i(t,e)<0?u=ht(e,n,u,i):l=ht(e,n,l,i),this._root=ce(l,u,i)},r.prototype.split=function(t){return kt(t,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var t,e,n;return ue(this,function(i){switch(i.label){case 0:t=this._root,e=[],n=!1,i.label=1;case 1:return n?[3,6]:t===null?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return e.length===0?[3,4]:(t=e.pop(),[4,t]);case 3:return i.sent(),t=t.right,[3,5];case 4:n=!0,i.label=5;case 5:return[3,1];case 6:return[2]}})},r}();function gt(r,t,e,n){var i=n-e;if(i>0){var o=e+Math.floor(i/2),l=r[o],u=t[o],c=new G(l,u);return c.left=gt(r,t,e,o),c.right=gt(r,t,o+1,n),c}return null}function he(r,t){for(var e=new G(null,null),n=e,i=0;i<r.length;i++)n=n.next=new G(r[i],t[i]);return n.next=null,e.next}function ae(r){for(var t=r,e=[],n=!1,i=new G(null,null),o=i;!n;)t?(e.push(t),t=t.left):e.length>0?(t=o=o.next=e.pop(),t=t.right):n=!0;return o.next=null,i.next}function yt(r,t,e){var n=e-t;if(n>0){var i=t+Math.floor(n/2),o=yt(r,t,i),l=r.head;return l.left=o,r.head=r.head.next,l.right=yt(r,i+1,e),l}return null}function pe(r,t,e){for(var n=new G(null,null),i=n,o=r,l=t;o!==null&&l!==null;)e(o.key,l.key)<0?(i.next=o,o=o.next):(i.next=l,l=l.next),i=i.next;return o!==null?i.next=o:l!==null&&(i.next=l),n.next}function dt(r,t,e,n,i){if(!(e>=n)){for(var o=r[e+n>>1],l=e-1,u=n+1;;){do l++;while(i(r[l],o)<0);do u--;while(i(r[u],o)>0);if(l>=u)break;var c=r[l];r[l]=r[u],r[u]=c,c=t[l],t[l]=t[u],t[u]=c}dt(r,t,e,u,i),dt(r,t,u+1,n,i)}}const N=11102230246251565e-32,E=134217729,ge=(3+8*N)*N;function xt(r,t,e,n,i){let o,l,u,c,f=t[0],p=n[0],s=0,a=0;p>f==p>-f?(o=f,f=t[++s]):(o=p,p=n[++a]);let h=0;if(s<r&&a<e)for(p>f==p>-f?(l=f+o,u=o-(l-f),f=t[++s]):(l=p+o,u=o-(l-p),p=n[++a]),o=l,u!==0&&(i[h++]=u);s<r&&a<e;)p>f==p>-f?(l=o+f,c=l-o,u=o-(l-c)+(f-c),f=t[++s]):(l=o+p,c=l-o,u=o-(l-c)+(p-c),p=n[++a]),o=l,u!==0&&(i[h++]=u);for(;s<r;)l=o+f,c=l-o,u=o-(l-c)+(f-c),f=t[++s],o=l,u!==0&&(i[h++]=u);for(;a<e;)l=o+p,c=l-o,u=o-(l-c)+(p-c),p=n[++a],o=l,u!==0&&(i[h++]=u);return(o!==0||h===0)&&(i[h++]=o),h}function ye(r,t){let e=t[0];for(let n=1;n<r;n++)e+=t[n];return e}function J(r){return new Float64Array(r)}const de=(3+16*N)*N,xe=(2+12*N)*N,me=(9+64*N)*N*N,U=J(4),It=J(8),$t=J(12),Ot=J(16),P=J(4);function ve(r,t,e,n,i,o,l){let u,c,f,p,s,a,h,g,y,d,x,v,m,b,w,S,R,_;const I=r-i,$=e-i,O=t-o,A=n-o;b=I*A,a=E*I,h=a-(a-I),g=I-h,a=E*A,y=a-(a-A),d=A-y,w=g*d-(b-h*y-g*y-h*d),S=O*$,a=E*O,h=a-(a-O),g=O-h,a=E*$,y=a-(a-$),d=$-y,R=g*d-(S-h*y-g*y-h*d),x=w-R,s=w-x,U[0]=w-(x+s)+(s-R),v=b+x,s=v-b,m=b-(v-s)+(x-s),x=m-S,s=m-x,U[1]=m-(x+s)+(s-S),_=v+x,s=_-v,U[2]=v-(_-s)+(x-s),U[3]=_;let B=ye(4,U),et=xe*l;if(B>=et||-B>=et||(s=r-I,u=r-(I+s)+(s-i),s=e-$,f=e-($+s)+(s-i),s=t-O,c=t-(O+s)+(s-o),s=n-A,p=n-(A+s)+(s-o),u===0&&c===0&&f===0&&p===0)||(et=me*l+ge*Math.abs(B),B+=I*p+A*u-(O*f+$*c),B>=et||-B>=et))return B;b=u*A,a=E*u,h=a-(a-u),g=u-h,a=E*A,y=a-(a-A),d=A-y,w=g*d-(b-h*y-g*y-h*d),S=c*$,a=E*c,h=a-(a-c),g=c-h,a=E*$,y=a-(a-$),d=$-y,R=g*d-(S-h*y-g*y-h*d),x=w-R,s=w-x,P[0]=w-(x+s)+(s-R),v=b+x,s=v-b,m=b-(v-s)+(x-s),x=m-S,s=m-x,P[1]=m-(x+s)+(s-S),_=v+x,s=_-v,P[2]=v-(_-s)+(x-s),P[3]=_;const on=xt(4,U,4,P,It);b=I*p,a=E*I,h=a-(a-I),g=I-h,a=E*p,y=a-(a-p),d=p-y,w=g*d-(b-h*y-g*y-h*d),S=O*f,a=E*O,h=a-(a-O),g=O-h,a=E*f,y=a-(a-f),d=f-y,R=g*d-(S-h*y-g*y-h*d),x=w-R,s=w-x,P[0]=w-(x+s)+(s-R),v=b+x,s=v-b,m=b-(v-s)+(x-s),x=m-S,s=m-x,P[1]=m-(x+s)+(s-S),_=v+x,s=_-v,P[2]=v-(_-s)+(x-s),P[3]=_;const sn=xt(on,It,4,P,$t);b=u*p,a=E*u,h=a-(a-u),g=u-h,a=E*p,y=a-(a-p),d=p-y,w=g*d-(b-h*y-g*y-h*d),S=c*f,a=E*c,h=a-(a-c),g=c-h,a=E*f,y=a-(a-f),d=f-y,R=g*d-(S-h*y-g*y-h*d),x=w-R,s=w-x,P[0]=w-(x+s)+(s-R),v=b+x,s=v-b,m=b-(v-s)+(x-s),x=m-S,s=m-x,P[1]=m-(x+s)+(s-S),_=v+x,s=_-v,P[2]=v-(_-s)+(x-s),P[3]=_;const ln=xt(sn,$t,4,P,Ot);return Ot[ln-1]}function be(r,t,e,n,i,o){const l=(t-o)*(e-i),u=(r-i)*(n-o),c=l-u,f=Math.abs(l+u);return Math.abs(c)>=de*f?c:-ve(r,t,e,n,i,o,f)}const W=(r,t)=>r.ll.x<=t.x&&t.x<=r.ur.x&&r.ll.y<=t.y&&t.y<=r.ur.y,mt=(r,t)=>{if(t.ur.x<r.ll.x||r.ur.x<t.ll.x||t.ur.y<r.ll.y||r.ur.y<t.ll.y)return null;const e=r.ll.x<t.ll.x?t.ll.x:r.ll.x,n=r.ur.x<t.ur.x?r.ur.x:t.ur.x,i=r.ll.y<t.ll.y?t.ll.y:r.ll.y,o=r.ur.y<t.ur.y?r.ur.y:t.ur.y;return{ll:{x:e,y:i},ur:{x:n,y:o}}};let T=Number.EPSILON;T===void 0&&(T=Math.pow(2,-52));const we=T*T,At=(r,t)=>{if(-T<r&&r<T&&-T<t&&t<T)return 0;const e=r-t;return e*e<we*r*t?0:r<t?-1:1};class Ee{constructor(){this.reset()}reset(){this.xRounder=new Nt,this.yRounder=new Nt}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class Nt{constructor(){this.tree=new pt,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(n!==null&&At(e.key,n.key)===0)return this.tree.remove(t),n.key;const i=this.tree.next(e);return i!==null&&At(e.key,i.key)===0?(this.tree.remove(t),i.key):t}}const K=new Ee,nt=(r,t)=>r.x*t.y-r.y*t.x,Bt=(r,t)=>r.x*t.x+r.y*t.y,Gt=(r,t,e)=>{const n=be(r.x,r.y,t.x,t.y,e.x,e.y);return n>0?-1:n<0?1:0},rt=r=>Math.sqrt(Bt(r,r)),Se=(r,t,e)=>{const n={x:t.x-r.x,y:t.y-r.y},i={x:e.x-r.x,y:e.y-r.y};return nt(i,n)/rt(i)/rt(n)},_e=(r,t,e)=>{const n={x:t.x-r.x,y:t.y-r.y},i={x:e.x-r.x,y:e.y-r.y};return Bt(i,n)/rt(i)/rt(n)},zt=(r,t,e)=>t.y===0?null:{x:r.x+t.x/t.y*(e-r.y),y:e},Tt=(r,t,e)=>t.x===0?null:{x:e,y:r.y+t.y/t.x*(e-r.x)},Pe=(r,t,e,n)=>{if(t.x===0)return Tt(e,n,r.x);if(n.x===0)return Tt(r,t,e.x);if(t.y===0)return zt(e,n,r.y);if(n.y===0)return zt(r,t,e.y);const i=nt(t,n);if(i==0)return null;const o={x:e.x-r.x,y:e.y-r.y},l=nt(o,t)/i,u=nt(o,n)/i,c=r.x+u*t.x,f=e.x+l*n.x,p=r.y+u*t.y,s=e.y+l*n.y,a=(c+f)/2,h=(p+s)/2;return{x:a,y:h}};class C{static compare(t,e){const n=C.comparePoints(t.point,e.point);return n!==0?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:F.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let n=0,i=e.length;n<i;n++){const o=e[n];this.point.events.push(o),o.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(n.segment.consumedBy===void 0)for(let i=e+1;i<t;i++){const o=this.point.events[i];o.consumedBy===void 0&&n.otherSE.point.events===o.otherSE.point.events&&n.segment.consume(o.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const i=this.point.events[e];i!==this&&!i.segment.ringOut&&i.segment.isInResult()&&t.push(i)}return t}getLeftmostComparator(t){const e=new Map,n=i=>{const o=i.otherSE;e.set(i,{sine:Se(this.point,t.point,o.point),cosine:_e(this.point,t.point,o.point)})};return(i,o)=>{e.has(i)||n(i),e.has(o)||n(o);const{sine:l,cosine:u}=e.get(i),{sine:c,cosine:f}=e.get(o);return l>=0&&c>=0?u<f?1:u>f?-1:0:l<0&&c<0?u<f?-1:u>f?1:0:c<l?-1:c>l?1:0}}}let Me=0;class F{static compare(t,e){const n=t.leftSE.point.x,i=e.leftSE.point.x,o=t.rightSE.point.x,l=e.rightSE.point.x;if(l<n)return 1;if(o<i)return-1;const u=t.leftSE.point.y,c=e.leftSE.point.y,f=t.rightSE.point.y,p=e.rightSE.point.y;if(n<i){if(c<u&&c<f)return 1;if(c>u&&c>f)return-1;const s=t.comparePoint(e.leftSE.point);if(s<0)return 1;if(s>0)return-1;const a=e.comparePoint(t.rightSE.point);return a!==0?a:-1}if(n>i){if(u<c&&u<p)return-1;if(u>c&&u>p)return 1;const s=e.comparePoint(t.leftSE.point);if(s!==0)return s;const a=t.comparePoint(e.rightSE.point);return a<0?1:a>0?-1:1}if(u<c)return-1;if(u>c)return 1;if(o<l){const s=e.comparePoint(t.rightSE.point);if(s!==0)return s}if(o>l){const s=t.comparePoint(e.rightSE.point);if(s<0)return 1;if(s>0)return-1}if(o!==l){const s=f-u,a=o-n,h=p-c,g=l-i;if(s>a&&h<g)return 1;if(s<a&&h>g)return-1}return o>l?1:o<l||f<p?-1:f>p?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,i){this.id=++Me,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=i}static fromRing(t,e,n){let i,o,l;const u=C.comparePoints(t,e);if(u<0)i=t,o=e,l=1;else if(u>0)i=e,o=t,l=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const c=new C(i,!0),f=new C(o,!1);return new F(c,f,[n],[l])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,i=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const o=(t.y-e.y)/i.y,l=e.x+o*i.x;if(t.x===l)return 0;const u=(t.x-e.x)/i.x,c=e.y+u*i.y;return t.y===c?0:t.y<c?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),i=mt(e,n);if(i===null)return null;const o=this.leftSE.point,l=this.rightSE.point,u=t.leftSE.point,c=t.rightSE.point,f=W(e,u)&&this.comparePoint(u)===0,p=W(n,o)&&t.comparePoint(o)===0,s=W(e,c)&&this.comparePoint(c)===0,a=W(n,l)&&t.comparePoint(l)===0;if(p&&f)return a&&!s?l:!a&&s?c:null;if(p)return s&&o.x===c.x&&o.y===c.y?null:o;if(f)return a&&l.x===u.x&&l.y===u.y?null:u;if(a&&s)return null;if(a)return l;if(s)return c;const h=Pe(o,this.vector(),u,t.vector());return h===null||!W(i,h)?null:K.round(h.x,h.y)}split(t){const e=[],n=t.events!==void 0,i=new C(t,!0),o=new C(t,!1),l=this.rightSE;this.replaceRightSE(o),e.push(o),e.push(i);const u=new F(i,l,this.rings.slice(),this.windings.slice());return C.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),C.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const i=F.compare(e,n);if(i!==0){if(i>0){const o=e;e=n,n=o}if(e.prev===n){const o=e;e=n,n=o}for(let o=0,l=n.rings.length;o<l;o++){const u=n.rings[o],c=n.windings[o],f=e.rings.indexOf(u);f===-1?(e.rings.push(u),e.windings.push(c)):e.windings[f]+=c}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){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)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,i=this._afterState.multiPolys;for(let u=0,c=this.rings.length;u<c;u++){const f=this.rings[u],p=this.windings[u],s=e.indexOf(f);s===-1?(e.push(f),n.push(p)):n[s]+=p}const o=[],l=[];for(let u=0,c=e.length;u<c;u++){if(n[u]===0)continue;const f=e[u],p=f.poly;if(l.indexOf(p)===-1)if(f.isExterior)o.push(p);else{l.indexOf(p)===-1&&l.push(p);const s=o.indexOf(f.poly);s!==-1&&o.splice(s,1)}}for(let u=0,c=o.length;u<c;u++){const f=o[u].multiPoly;i.indexOf(f)===-1&&i.push(f)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(k.type){case"union":{const n=t.length===0,i=e.length===0;this._isInResult=n!==i;break}case"intersection":{let n,i;t.length<e.length?(n=t.length,i=e.length):(n=e.length,i=t.length),this._isInResult=i===k.numMultiPolys&&n<i;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2===1;break}case"difference":{const n=i=>i.length===1&&i[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${k.type}`)}return this._isInResult}}class Ft{constructor(t,e,n){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const i=K.round(t[0][0],t[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};let o=i;for(let l=1,u=t.length;l<u;l++){if(typeof t[l][0]!="number"||typeof t[l][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let c=K.round(t[l][0],t[l][1]);c.x===o.x&&c.y===o.y||(this.segments.push(F.fromRing(o,c,this)),c.x<this.bbox.ll.x&&(this.bbox.ll.x=c.x),c.y<this.bbox.ll.y&&(this.bbox.ll.y=c.y),c.x>this.bbox.ur.x&&(this.bbox.ur.x=c.x),c.y>this.bbox.ur.y&&(this.bbox.ur.y=c.y),o=c)}(i.x!==o.x||i.y!==o.y)&&this.segments.push(F.fromRing(o,i,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const i=this.segments[e];t.push(i.leftSE),t.push(i.rightSE)}return t}}class Le{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ft(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let n=1,i=t.length;n<i;n++){const o=new Ft(t[n],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const i=this.interiorRings[e].getSweepEvents();for(let o=0,l=i.length;o<l;o++)t.push(i[o])}return t}}class qt{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let n=0,i=t.length;n<i;n++){const o=new Le(t[n],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const i=this.polys[e].getSweepEvents();for(let o=0,l=i.length;o<l;o++)t.push(i[o])}return t}}class it{static factory(t){const e=[];for(let n=0,i=t.length;n<i;n++){const o=t[n];if(!o.isInResult()||o.ringOut)continue;let l=null,u=o.leftSE,c=o.rightSE;const f=[u],p=u.point,s=[];for(;l=u,u=c,f.push(u),u.point!==p;)for(;;){const a=u.getAvailableLinkedEvents();if(a.length===0){const y=f[0].point,d=f[f.length-1].point;throw new Error(`Unable to complete output ring starting at [${y.x}, ${y.y}]. Last matching segment found ends at [${d.x}, ${d.y}].`)}if(a.length===1){c=a[0].otherSE;break}let h=null;for(let y=0,d=s.length;y<d;y++)if(s[y].point===u.point){h=y;break}if(h!==null){const y=s.splice(h)[0],d=f.splice(y.index);d.unshift(d[0].otherSE),e.push(new it(d.reverse()));continue}s.push({index:f.length,point:u.point});const g=u.getLeftmostComparator(l);c=a.sort(g)[0].otherSE;break}e.push(new it(f))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let f=1,p=this.events.length-1;f<p;f++){const s=this.events[f].point,a=this.events[f+1].point;Gt(s,t,a)!==0&&(e.push(s),t=s)}if(e.length===1)return null;const n=e[0],i=e[1];Gt(n,t,i)===0&&e.shift(),e.push(e[0]);const o=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,u=this.isExteriorRing()?e.length:-1,c=[];for(let f=l;f!=u;f+=o)c.push([e[f].x,e[f].y]);return c}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let i=1,o=this.events.length;i<o;i++){const l=this.events[i];C.compare(t,l)>0&&(t=l)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class jt{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(t[0]===null)return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const i=this.interiorRings[e].getGeom();i!==null&&t.push(i)}return t}}class Ce{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const i=this.polys[e].getGeom();i!==null&&t.push(i)}return t}_composePolys(t){const e=[];for(let n=0,i=t.length;n<i;n++){const o=t[n];if(!o.poly)if(o.isExteriorRing())e.push(new jt(o));else{const l=o.enclosingRing();l.poly||e.push(new jt(l)),l.poly.addInterior(o)}}return e}}class Re{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:F.compare;this.queue=t,this.tree=new pt(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const i=t.isLeft?this.tree.add(e):this.tree.find(e);if(!i)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let o=i,l=i,u,c;for(;u===void 0;)o=this.tree.prev(o),o===null?u=null:o.key.consumedBy===void 0&&(u=o.key);for(;c===void 0;)l=this.tree.next(l),l===null?c=null:l.key.consumedBy===void 0&&(c=l.key);if(t.isLeft){let f=null;if(u){const s=u.getIntersection(e);if(s!==null&&(e.isAnEndpoint(s)||(f=s),!u.isAnEndpoint(s))){const a=this._splitSafely(u,s);for(let h=0,g=a.length;h<g;h++)n.push(a[h])}}let p=null;if(c){const s=c.getIntersection(e);if(s!==null&&(e.isAnEndpoint(s)||(p=s),!c.isAnEndpoint(s))){const a=this._splitSafely(c,s);for(let h=0,g=a.length;h<g;h++)n.push(a[h])}}if(f!==null||p!==null){let s=null;f===null?s=p:p===null?s=f:s=C.comparePoints(f,p)<=0?f:p,this.queue.remove(e.rightSE),n.push(e.rightSE);const a=e.split(s);for(let h=0,g=a.length;h<g;h++)n.push(a[h])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=u)}else{if(u&&c){const f=u.getIntersection(c);if(f!==null){if(!u.isAnEndpoint(f)){const p=this._splitSafely(u,f);for(let s=0,a=p.length;s<a;s++)n.push(p[s])}if(!c.isAnEndpoint(f)){const p=this._splitSafely(c,f);for(let s=0,a=p.length;s<a;s++)n.push(p[s])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const i=t.split(e);return i.push(n),t.consumedBy===void 0&&this.tree.add(t),i}}const Qt=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ke=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Ie{run(t,e,n){k.type=t,K.reset();const i=[new qt(e,!0)];for(let s=0,a=n.length;s<a;s++)i.push(new qt(n[s],!1));if(k.numMultiPolys=i.length,k.type==="difference"){const s=i[0];let a=1;for(;a<i.length;)mt(i[a].bbox,s.bbox)!==null?a++:i.splice(a,1)}if(k.type==="intersection")for(let s=0,a=i.length;s<a;s++){const h=i[s];for(let g=s+1,y=i.length;g<y;g++)if(mt(h.bbox,i[g].bbox)===null)return[]}const o=new pt(C.compare);for(let s=0,a=i.length;s<a;s++){const h=i[s].getSweepEvents();for(let g=0,y=h.length;g<y;g++)if(o.insert(h[g]),o.size>Qt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const l=new Re(o);let u=o.size,c=o.pop();for(;c;){const s=c.key;if(o.size===u){const h=s.segment;throw new Error(`Unable to pop() ${s.isLeft?"left":"right"} SweepEvent [${s.point.x}, ${s.point.y}] from segment #${h.id} [${h.leftSE.point.x}, ${h.leftSE.point.y}] -> [${h.rightSE.point.x}, ${h.rightSE.point.y}] from queue.`)}if(o.size>Qt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(l.segments.length>ke)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const a=l.process(s);for(let h=0,g=a.length;h<g;h++){const y=a[h];y.consumedBy===void 0&&o.insert(y)}u=o.size,c=o.pop()}K.reset();const f=it.factory(l.segments);return new Ce(f).getGeom()}}const k=new Ie;var Ut={union:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return k.run("union",r,e)},intersection:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return k.run("intersection",r,e)},xor:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return k.run("xor",r,e)},difference:function(r){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return k.run("difference",r,e)}};function $e(r,t={}){const e=[];if(ut(r,i=>{e.push(i.coordinates)}),e.length<2)throw new Error("Must have at least 2 geometries");const n=Ut.union(e[0],...e.slice(1));return n.length===0?null:n.length===1?lt(n[0],t.properties):Pt(n,t.properties)}var Dt=$e;function vt(r){const t=[...r];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}function H(){}function Yt(r){return r()}function Xt(){return Object.create(null)}function ot(r){r.forEach(Yt)}function Vt(r){return typeof r=="function"}function Oe(r,t){return r!=r?t==t:r!==t||r&&typeof r=="object"||typeof r=="function"}function Ae(r){return Object.keys(r).length===0}function Ne(r,t){r.appendChild(t)}function Be(r,t,e){r.insertBefore(t,e||null)}function Zt(r){r.parentNode&&r.parentNode.removeChild(r)}function Jt(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function q(r,t,e){e==null?r.removeAttribute(t):r.getAttribute(t)!==e&&r.setAttribute(t,e)}function Ge(r){return Array.from(r.childNodes)}function st(r,t,e){r.classList.toggle(t,!!e)}let bt;function tt(r){bt=r}const D=[],Wt=[];let Y=[];const Kt=[],ze=Promise.resolve();let wt=!1;function Te(){wt||(wt=!0,ze.then(Ht))}function Et(r){Y.push(r)}const St=new Set;let X=0;function Ht(){if(X!==0)return;const r=bt;do{try{for(;X<D.length;){const t=D[X];X++,tt(t),Fe(t.$$)}}catch(t){throw D.length=0,X=0,t}for(tt(null),D.length=0,X=0;Wt.length;)Wt.pop()();for(let t=0;t<Y.length;t+=1){const e=Y[t];St.has(e)||(St.add(e),e())}Y.length=0}while(D.length);for(;Kt.length;)Kt.pop()();wt=!1,St.clear(),tt(r)}function Fe(r){if(r.fragment!==null){r.update(),ot(r.before_update);const t=r.dirty;r.dirty=[-1],r.fragment&&r.fragment.p(r.ctx,t),r.after_update.forEach(Et)}}function qe(r){const t=[],e=[];Y.forEach(n=>r.indexOf(n)===-1?t.push(n):e.push(n)),e.forEach(n=>n()),Y=t}const je=new Set;function Qe(r,t){r&&r.i&&(je.delete(r),r.i(t))}function Ue(r,t,e){const{fragment:n,after_update:i}=r.$$;n&&n.m(t,e),Et(()=>{const o=r.$$.on_mount.map(Yt).filter(Vt);r.$$.on_destroy?r.$$.on_destroy.push(...o):ot(o),r.$$.on_mount=[]}),i.forEach(Et)}function De(r,t){const e=r.$$;e.fragment!==null&&(qe(e.after_update),ot(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Ye(r,t){r.$$.dirty[0]===-1&&(D.push(r),Te(),r.$$.dirty.fill(0)),r.$$.dirty[t/31|0]|=1<<t%31}function Xe(r,t,e,n,i,o,l=null,u=[-1]){const c=bt;tt(r);const f=r.$$={fragment:null,ctx:[],props:o,update:H,not_equal:i,bound:Xt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:Xt(),dirty:u,skip_bound:!1,root:t.target||c.$$.root};l&&l(f.root);let p=!1;if(f.ctx=e?e(r,t.props||{},(s,a,...h)=>{const g=h.length?h[0]:a;return f.ctx&&i(f.ctx[s],f.ctx[s]=g)&&(!f.skip_bound&&f.bound[s]&&f.bound[s](g),p&&Ye(r,s)),a}):[],f.update(),p=!0,ot(f.before_update),f.fragment=n?n(f.ctx):!1,t.target){if(t.hydrate){const s=Ge(t.target);f.fragment&&f.fragment.l(s),s.forEach(Zt)}else f.fragment&&f.fragment.c();t.intro&&Qe(r.$$.fragment),Ue(r,t.target,t.anchor),Ht()}tt(c)}class Ve{constructor(){_t(this,"$$");_t(this,"$$set")}$destroy(){De(this,1),this.$destroy=H}$on(t,e){if(!Vt(e))return H;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const i=n.indexOf(e);i!==-1&&n.splice(i,1)}}$set(t){this.$$set&&!Ae(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Ze="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ze);function Je(r){let t,e,n;return{c(){t=Jt("svg"),e=Jt("path"),q(e,"stroke-width","4"),q(e,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),q(e,"class","svelte-gzo3ar"),q(t,"width",n=r[0]==="list"?20:void 0),q(t,"viewBox","0 0 70 85"),q(t,"fill","none"),q(t,"class","svelte-gzo3ar"),st(t,"in-map",r[0]!=="list"),st(t,"list-icon",r[0]==="list")},m(i,o){Be(i,t,o),Ne(t,e)},p(i,[o]){o&1&&n!==(n=i[0]==="list"?20:void 0)&&q(t,"width",n),o&1&&st(t,"in-map",i[0]!=="list"),o&1&&st(t,"list-icon",i[0]==="list")},i:H,o:H,d(i){i&&Zt(t)}}}function We(r,t,e){let{displayIn:n}=t;return r.$$set=i=>{"displayIn"in i&&e(0,n=i.displayIn)},[n]}class Ke extends Ve{constructor(t){super(),Xe(this,t,We,Je,Oe,{displayIn:0})}}function He(r){const t=[];if(ut(r,i=>{t.push(i.coordinates)}),t.length<2)throw new Error("Must have at least two features");const e=r.features[0].properties||{},n=Ut.difference(t[0],...t.slice(1));return n.length===0?null:n.length===1?lt(n[0],e):Pt(n,e)}var tn=He;function en(r){if(!r)throw new Error("geojson is required");var t=[];return re(r,function(e){t.push(e)}),Z(t)}var nn=en;function te(r,t){const e=tn(Z([lt([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),r]));if(!e)return;e.properties={isMask:!0};const n=vt(ft(r)),i=(n[2]-n[0])/360/1e3,o=n[0]<-180,l=n[2]>180,u=nn(r);if(u.features.length>1&&(o||l))for(const c of u.features){const f=vt(ft(c));if(l&&f[0]<-180+i)for(const p of c.geometry.coordinates)for(const s of p)s[0]+=360-i;if(o&&f[2]>180-i)for(const p of c.geometry.coordinates)for(const s of p)s[0]-=360-i}t(Z([u.features.length<2?r:Dt(u)??r,e]))}function rn(r,t=!0,e=!0,n={},i={},o=l=>{var f,p,s;const u=(f=l==null?void 0:l.geometry)==null?void 0:f.type,c=(p=l==null?void 0:l.properties)!=null&&p.isMask?0:u==="LineString"||u==="MultiLineString"?3:2;return{color:"#3170fe",fillColor:"#000",fillOpacity:(s=l==null?void 0:l.properties)!=null&&s.isMask?.1:0,weight:c,dashArray:[c,c],lineCap:"butt"}}){let l;const u=[];let c,f;const p=Q.geoJSON(void 0,{style:o,interactive:!1}).addTo(r),s=h=>{l==null||l({type:"mapClick",coordinates:[h.latlng.lng,h.latlng.lat]})};function a(h,g=!1){const y=document.createElement("div");return new Ke({props:{displayIn:"leaflet"},target:y}),new Q.Marker(h,{interactive:g,icon:new Q.DivIcon({html:y,className:"",iconAnchor:[12,26],iconSize:[25,30],tooltipAnchor:[1,-24]})})}return{setEventHandler(h){h?(l=h,r.on("click",s)):(l=void 0,r.off("click",s))},flyTo(h,g){r.flyTo([h[1],h[0]],g,{duration:2,...n})},fitBounds(h,g,y){r.flyToBounds([[h[1],h[0]],[h[3],h[2]]],{padding:[g,g],duration:2,...y?{maxZoom:y}:{},...i})},indicateReverse(h){r.getContainer().style.cursor=h?"crosshair":""},setReverseMarker(h){var y;if(!t)return;const g=h&&[h[1],h[0]];f?g?f.setLatLng(g):(f.remove(),f=void 0):g&&(f=(typeof t=="object"?new Q.Marker(g,t):a(g)).addTo(r),(y=f.getElement())==null||y.classList.add("marker-reverse"))},setMarkers(h,g){if(!t)return;function y(d){p.clearLayers(),d&&p.addData(d)}for(const d of u)d.remove();if(u.length=0,y(),g){let d=!1;if(g.geometry.type==="GeometryCollection"){const v=g.geometry.geometries.filter(m=>m.type==="Polygon"||m.type==="MultiPolygon");t:if(v.length>0){const m=Dt(Z(v.map(b=>V(b))));if(!m)break t;te({...g,geometry:m.geometry},y),d=!0}else{const m=g.geometry.geometries.filter(b=>b.type==="LineString"||b.type==="MultiLineString");m.length>0&&(y({...g,geometry:{type:"GeometryCollection",geometries:m}}),d=!0)}}if(!d){if(g.geometry.type==="Polygon"||g.geometry.type==="MultiPolygon")te(g,v=>{if(!v)return;const m=[...v.features],b=vt(ft(g)),w=b[2]-b[0];b[0]-w/4<-180&&m.push(...ee(v,-360).features),b[2]+w/4>180&&m.push(...ee(v,360).features),y(Z(m))});else if(g.geometry.type==="LineString"||g.geometry.type==="MultiLineString"){y(g);return}}const x=[g.center[1],g.center[0]];u.push((typeof t=="object"?new Q.Marker(x,t):a(x)).addTo(r))}if(e)for(const d of h??[]){if(d===g)continue;const x=[d.center[1],d.center[0]],v=typeof e=="object"?new Q.Marker(x,e):a(x,!0);v.addTo(r).bindTooltip(d.place_type[0]==="reverse"?d.place_name:d.place_name.replace(/,.*/,""),{direction:"top"});const m=v.getElement();m&&(m.addEventListener("click",b=>{b.stopPropagation(),l==null||l({type:"markerClick",id:d.id})}),m.addEventListener("mouseenter",()=>{l==null||l({type:"markerMouseEnter",id:d.id})}),m.addEventListener("mouseleave",()=>{l==null||l({type:"markerMouseLeave",id:d.id})}),m.classList.toggle("marker-fuzzy",!!d.matching_text)),u.push(v)}},setSelectedMarker(h){var g,y;c&&((g=c.getElement())==null||g.classList.toggle("marker-selected",!1)),c=h>-1?u[h]:void 0,(y=c==null?void 0:c.getElement())==null||y.classList.toggle("marker-selected",!0)},getCenterAndZoom(){const h=r.getCenter();return[r.getZoom(),h.lng,h.lat]}}}function ee(r,t){const e=le(r);for(const n of e.features)if(n.geometry.type=="MultiPolygon")for(const i of n.geometry.coordinates)ne(i,t);else ne(n.geometry.coordinates,t);return e}function ne(r,t){for(const e of r)for(const n of e)n[0]+=t}M.createLeafletMapController=rn,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})});
|
|
29
23
|
//# sourceMappingURL=leaflet-controller.umd.js.map
|