@maptiler/geocoding-control 1.3.3 → 1.4.0
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 +24 -22
- 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(L,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(L=typeof globalThis<"u"?globalThis:L||self,b(L.maplibreglMaptilerGeocodingController={}))})(this,function(L){"use strict";var We=Object.defineProperty;var Je=(L,b,T)=>b in L?We(L,b,{enumerable:!0,configurable:!0,writable:!0,value:T}):L[b]=T;var vt=(L,b,T)=>Je(L,typeof b!="symbol"?b+"":b,T);function b(i,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=i,n}function T(i,t,e={}){for(const r of i){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<r[r.length-1].length;o++)if(r[r.length-1][o]!==r[0][o])throw new Error("First and last Position are not equivalent.")}return b({type:"Polygon",coordinates:i},t,e)}function V(i,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=i,e}function wt(i,t,e={}){return b({type:"MultiPolygon",coordinates:i},t,e)}/**
|
|
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&&zn(l.left,g,!1,f,h),l.right&&zn(l.right,g,!0,f,h)}}var Bn=function(){function l(u){u===void 0&&(u=Rs),this._root=null,this._size=0,this._comparator=u}return l.prototype.insert=function(u,a){return this._size++,this._root=Yn(u,a,this._root,this._comparator)},l.prototype.add=function(u,a){var f=new at(u,a);this._root===null&&(f.left=f.right=null,this._size++,this._root=f);var h=this._comparator,g=ut(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=ut(u,a,f);var g=f(u,a.key);return g===0?(a.left===null?h=a.right:(h=ut(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=ut(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=ut(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 Ms(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&&Vn(u,a,0,h-1,g),this._root===null)this._root=Xn(u,a,0,h),this._size=h;else{var d=Ps(this.toList(),bs(u,a),g);h=this._size+h,this._root=Un({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 zn(this._root,"",!0,function(f){return a.push(f)},u),a.join("")},l.prototype.update=function(u,a,f){var h=this._comparator,g=Ci(u,this._root,h),d=g.left,p=g.right;h(u,a)<0?p=Yn(a,f,p,h):d=Yn(a,f,d,h),this._root=Os(d,p,h)},l.prototype.split=function(u){return Ci(u,this._root,this._comparator)},l.prototype[Symbol.iterator]=function(){var u,a,f;return Cs(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 Xn(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 at(d,p);return w.left=Xn(l,u,a,g),w.right=Xn(l,u,g+1,f),w}return null}function bs(l,u){for(var a=new at(null,null),f=a,h=0;h<l.length;h++)f=f.next=new at(l[h],u[h]);return f.next=null,a.next}function Ms(l){for(var u=l,a=[],f=!1,h=new at(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 Un(l,u,a){var f=a-u;if(f>0){var h=u+Math.floor(f/2),g=Un(l,u,h),d=l.head;return d.left=g,l.head=l.head.next,d.right=Un(l,h+1,a),d}return null}function Ps(l,u,a){for(var f=new at(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 Vn(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}Vn(l,u,a,p,h),Vn(l,u,p+1,f,h)}}const et=11102230246251565e-32,we=134217729,As=(3+8*et)*et;function Hn(l,u,a,f,h){let g,d,p,w,_=u[0],N=f[0],m=0,I=0;N>_==N>-_?(g=_,_=u[++m]):(g=N,N=f[++I]);let E=0;if(m<l&&I<a)for(N>_==N>-_?(d=_+g,p=g-(d-_),_=u[++m]):(d=N+g,p=g-(d-N),N=f[++I]),g=d,p!==0&&(h[E++]=p);m<l&&I<a;)N>_==N>-_?(d=g+_,w=d-g,p=g-(d-w)+(_-w),_=u[++m]):(d=g+N,w=d-g,p=g-(d-w)+(N-w),N=f[++I]),g=d,p!==0&&(h[E++]=p);for(;m<l;)d=g+_,w=d-g,p=g-(d-w)+(_-w),_=u[++m],g=d,p!==0&&(h[E++]=p);for(;I<a;)d=g+N,w=d-g,p=g-(d-w)+(N-w),N=f[++I],g=d,p!==0&&(h[E++]=p);return(g!==0||E===0)&&(h[E++]=g),E}function Ds(l,u){let a=u[0];for(let f=1;f<l;f++)a+=u[f];return a}function Xt(l){return new Float64Array(l)}const Fs=(3+16*et)*et,Gs=(2+12*et)*et,qs=(9+64*et)*et*et,St=Xt(4),Ri=Xt(8),Oi=Xt(12),bi=Xt(16),Le=Xt(4);function Ys(l,u,a,f,h,g,d){let p,w,_,N,m,I,E,L,M,R,O,b,P,G,D,B,X,V;const U=l-h,se=a-h,te=u-g,re=f-g;G=U*re,I=we*U,E=I-(I-U),L=U-E,I=we*re,M=I-(I-re),R=re-M,D=L*R-(G-E*M-L*M-E*R),B=te*se,I=we*te,E=I-(I-te),L=te-E,I=we*se,M=I-(I-se),R=se-M,X=L*R-(B-E*M-L*M-E*R),O=D-X,m=D-O,St[0]=D-(O+m)+(m-X),b=G+O,m=b-G,P=G-(b-m)+(O-m),O=P-B,m=P-O,St[1]=P-(O+m)+(m-B),V=b+O,m=V-b,St[2]=b-(V-m)+(O-m),St[3]=V;let oe=Ds(4,St),z=Gs*d;if(oe>=z||-oe>=z||(m=l-U,p=l-(U+m)+(m-h),m=a-se,_=a-(se+m)+(m-h),m=u-te,w=u-(te+m)+(m-g),m=f-re,N=f-(re+m)+(m-g),p===0&&w===0&&_===0&&N===0)||(z=qs*d+As*Math.abs(oe),oe+=U*N+re*p-(te*_+se*w),oe>=z||-oe>=z))return oe;G=p*re,I=we*p,E=I-(I-p),L=p-E,I=we*re,M=I-(I-re),R=re-M,D=L*R-(G-E*M-L*M-E*R),B=w*se,I=we*w,E=I-(I-w),L=w-E,I=we*se,M=I-(I-se),R=se-M,X=L*R-(B-E*M-L*M-E*R),O=D-X,m=D-O,Le[0]=D-(O+m)+(m-X),b=G+O,m=b-G,P=G-(b-m)+(O-m),O=P-B,m=P-O,Le[1]=P-(O+m)+(m-B),V=b+O,m=V-b,Le[2]=b-(V-m)+(O-m),Le[3]=V;const ne=Hn(4,St,4,Le,Ri);G=U*N,I=we*U,E=I-(I-U),L=U-E,I=we*N,M=I-(I-N),R=N-M,D=L*R-(G-E*M-L*M-E*R),B=te*_,I=we*te,E=I-(I-te),L=te-E,I=we*_,M=I-(I-_),R=_-M,X=L*R-(B-E*M-L*M-E*R),O=D-X,m=D-O,Le[0]=D-(O+m)+(m-X),b=G+O,m=b-G,P=G-(b-m)+(O-m),O=P-B,m=P-O,Le[1]=P-(O+m)+(m-B),V=b+O,m=V-b,Le[2]=b-(V-m)+(O-m),Le[3]=V;const le=Hn(ne,Ri,4,Le,Oi);G=p*N,I=we*p,E=I-(I-p),L=p-E,I=we*N,M=I-(I-N),R=N-M,D=L*R-(G-E*M-L*M-E*R),B=w*_,I=we*w,E=I-(I-w),L=w-E,I=we*_,M=I-(I-_),R=_-M,X=L*R-(B-E*M-L*M-E*R),O=D-X,m=D-O,Le[0]=D-(O+m)+(m-X),b=G+O,m=b-G,P=G-(b-m)+(O-m),O=P-B,m=P-O,Le[1]=P-(O+m)+(m-B),V=b+O,m=V-b,Le[2]=b-(V-m)+(O-m),Le[3]=V;const ve=Hn(le,Oi,4,Le,bi);return bi[ve-1]}function zs(l,u,a,f,h,g){const d=(u-g)*(a-h),p=(l-h)*(f-g),w=d-p,_=Math.abs(d+p);return Math.abs(w)>=Fs*_?w:-Ys(l,u,a,f,h,g,_)}const Ut=(l,u)=>l.ll.x<=u.x&&u.x<=l.ur.x&&l.ll.y<=u.y&&u.y<=l.ur.y,Zn=(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 ot=Number.EPSILON;ot===void 0&&(ot=Math.pow(2,-52));const Bs=ot*ot,Mi=(l,u)=>{if(-ot<l&&l<ot&&-ot<u&&u<ot)return 0;const a=l-u;return a*a<Bs*l*u?0:l<u?-1:1};class Xs{constructor(){this.reset()}reset(){this.xRounder=new Pi,this.yRounder=new Pi}round(u,a){return{x:this.xRounder.round(u),y:this.yRounder.round(a)}}}class Pi{constructor(){this.tree=new Bn,this.round(0)}round(u){const a=this.tree.add(u),f=this.tree.prev(a);if(f!==null&&Mi(a.key,f.key)===0)return this.tree.remove(u),f.key;const h=this.tree.next(a);return h!==null&&Mi(a.key,h.key)===0?(this.tree.remove(u),h.key):u}}const Vt=new Xs,ln=(l,u)=>l.x*u.y-l.y*u.x,Ai=(l,u)=>l.x*u.x+l.y*u.y,Di=(l,u,a)=>{const f=zs(l.x,l.y,u.x,u.y,a.x,a.y);return f>0?-1:f<0?1:0},hn=l=>Math.sqrt(Ai(l,l)),Us=(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 ln(h,f)/hn(h)/hn(f)},Vs=(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 Ai(h,f)/hn(h)/hn(f)},Fi=(l,u,a)=>u.y===0?null:{x:l.x+u.x/u.y*(a-l.y),y:a},Gi=(l,u,a)=>u.x===0?null:{x:a,y:l.y+u.y/u.x*(a-l.x)},Hs=(l,u,a,f)=>{if(u.x===0)return Gi(a,f,l.x);if(f.x===0)return Gi(l,u,a.x);if(u.y===0)return Fi(a,f,l.y);if(f.y===0)return Fi(l,u,a.y);const h=ln(u,f);if(h==0)return null;const g={x:a.x-l.x,y:a.y-l.y},d=ln(g,u)/h,p=ln(g,f)/h,w=l.x+p*u.x,_=a.x+d*f.x,N=l.y+p*u.y,m=a.y+d*f.y,I=(w+_)/2,E=(N+m)/2;return{x:I,y:E}};class De{static compare(u,a){const f=De.comparePoints(u.point,a.point);return f!==0?f:(u.point!==a.point&&u.link(a),u.isLeft!==a.isLeft?u.isLeft?1:-1:lt.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:Us(this.point,u.point,g.point),cosine:Vs(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:_}=a.get(g);return d>=0&&w>=0?p<_?1:p>_?-1:0:d<0&&w<0?p<_?-1:p>_?1:0:w<d?-1:w>d?1:0}}}let Zs=0;class lt{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,_=u.rightSE.point.y,N=a.rightSE.point.y;if(f<h){if(w<p&&w<_)return 1;if(w>p&&w>_)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=_-p,I=g-f,E=N-w,L=d-h;if(m>I&&E<L)return 1;if(m<I&&E>L)return-1}return g>d?1:g<d||_<N?-1:_>N?1:u.id<a.id?-1:u.id>a.id?1:0}constructor(u,a,f,h){this.id=++Zs,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=De.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 De(h,!0),_=new De(g,!1);return new lt(w,_,[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=Zn(a,f);if(h===null)return null;const g=this.leftSE.point,d=this.rightSE.point,p=u.leftSE.point,w=u.rightSE.point,_=Ut(a,p)&&this.comparePoint(p)===0,N=Ut(f,g)&&u.comparePoint(g)===0,m=Ut(a,w)&&this.comparePoint(w)===0,I=Ut(f,d)&&u.comparePoint(d)===0;if(N&&_)return I&&!m?d:!I&&m?w:null;if(N)return m&&g.x===w.x&&g.y===w.y?null:g;if(_)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 E=Hs(g,this.vector(),p,u.vector());return E===null||!Ut(h,E)?null:Vt.round(E.x,E.y)}split(u){const a=[],f=u.events!==void 0,h=new De(u,!0),g=new De(u,!1),d=this.rightSE;this.replaceRightSE(g),a.push(g),a.push(h);const p=new lt(h,d,this.rings.slice(),this.windings.slice());return De.comparePoints(p.leftSE.point,p.rightSE.point)>0&&p.swapEvents(),De.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=lt.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],_=a.rings.indexOf(p);_===-1?(a.rings.push(p),a.windings.push(w)):a.windings[_]+=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 _=this.rings[p],N=this.windings[p],m=a.indexOf(_);m===-1?(a.push(_),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 _=a[p],N=_.poly;if(d.indexOf(N)===-1)if(_.isExterior)g.push(N);else{d.indexOf(N)===-1&&d.push(N);const m=g.indexOf(_.poly);m!==-1&&g.splice(m,1)}}for(let p=0,w=g.length;p<w;p++){const _=g[p].multiPoly;h.indexOf(_)===-1&&h.push(_)}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(Xe.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===Xe.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 ${Xe.type}`)}return this._isInResult}}class qi{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=Vt.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=Vt.round(u[d][0],u[d][1]);w.x===g.x&&w.y===g.y||(this.segments.push(lt.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(lt.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 $s{constructor(u,a){if(!Array.isArray(u))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new qi(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 qi(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 Yi{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 $s(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 cn{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 _=[p],N=p.point,m=[];for(;d=p,p=w,_.push(p),p.point!==N;)for(;;){const I=p.getAvailableLinkedEvents();if(I.length===0){const M=_[0].point,R=_[_.length-1].point;throw new Error(`Unable to complete output ring starting at [${M.x}, ${M.y}]. Last matching segment found ends at [${R.x}, ${R.y}].`)}if(I.length===1){w=I[0].otherSE;break}let E=null;for(let M=0,R=m.length;M<R;M++)if(m[M].point===p.point){E=M;break}if(E!==null){const M=m.splice(E)[0],R=_.splice(M.index);R.unshift(R[0].otherSE),a.push(new cn(R.reverse()));continue}m.push({index:_.length,point:p.point});const L=p.getLeftmostComparator(d);w=I.sort(L)[0].otherSE;break}a.push(new cn(_))}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 _=1,N=this.events.length-1;_<N;_++){const m=this.events[_].point,I=this.events[_+1].point;Di(m,u,I)!==0&&(a.push(m),u=m)}if(a.length===1)return null;const f=a[0],h=a[1];Di(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 _=d;_!=p;_+=g)w.push([a[_].x,a[_].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];De.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 zi{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 js{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 zi(g));else{const d=g.enclosingRing();d.poly||a.push(new zi(d)),d.poly.addInterior(g)}}return a}}class Ws{constructor(u){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:lt.compare;this.queue=u,this.tree=new Bn(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 _=null;if(p){const m=p.getIntersection(a);if(m!==null&&(a.isAnEndpoint(m)||(_=m),!p.isAnEndpoint(m))){const I=this._splitSafely(p,m);for(let E=0,L=I.length;E<L;E++)f.push(I[E])}}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 E=0,L=I.length;E<L;E++)f.push(I[E])}}if(_!==null||N!==null){let m=null;_===null?m=N:N===null?m=_:m=De.comparePoints(_,N)<=0?_:N,this.queue.remove(a.rightSE),f.push(a.rightSE);const I=a.split(m);for(let E=0,L=I.length;E<L;E++)f.push(I[E])}f.length>0?(this.tree.remove(a),f.push(u)):(this.segments.push(a),a.prev=p)}else{if(p&&w){const _=p.getIntersection(w);if(_!==null){if(!p.isAnEndpoint(_)){const N=this._splitSafely(p,_);for(let m=0,I=N.length;m<I;m++)f.push(N[m])}if(!w.isAnEndpoint(_)){const N=this._splitSafely(w,_);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 Bi=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Qs=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Ks{run(u,a,f){Xe.type=u,Vt.reset();const h=[new Yi(a,!0)];for(let m=0,I=f.length;m<I;m++)h.push(new Yi(f[m],!1));if(Xe.numMultiPolys=h.length,Xe.type==="difference"){const m=h[0];let I=1;for(;I<h.length;)Zn(h[I].bbox,m.bbox)!==null?I++:h.splice(I,1)}if(Xe.type==="intersection")for(let m=0,I=h.length;m<I;m++){const E=h[m];for(let L=m+1,M=h.length;L<M;L++)if(Zn(E.bbox,h[L].bbox)===null)return[]}const g=new Bn(De.compare);for(let m=0,I=h.length;m<I;m++){const E=h[m].getSweepEvents();for(let L=0,M=E.length;L<M;L++)if(g.insert(E[L]),g.size>Bi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const d=new Ws(g);let p=g.size,w=g.pop();for(;w;){const m=w.key;if(g.size===p){const E=m.segment;throw new Error(`Unable to pop() ${m.isLeft?"left":"right"} SweepEvent [${m.point.x}, ${m.point.y}] from segment #${E.id} [${E.leftSE.point.x}, ${E.leftSE.point.y}] -> [${E.rightSE.point.x}, ${E.rightSE.point.y}] from queue.`)}if(g.size>Bi)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(d.segments.length>Qs)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const I=d.process(m);for(let E=0,L=I.length;E<L;E++){const M=I[E];M.consumedBy===void 0&&g.insert(M)}p=g.size,w=g.pop()}Vt.reset();const _=cn.factory(d.segments);return new js(_).getGeom()}}const Xe=new Ks;var Xi={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 Xe.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 Xe.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 Xe.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 Xe.run("difference",l,a)}};function Ui(l,u,a){if(l!==null)for(var f,h,g,d,p,w,_,N=0,m=0,I,E=l.type,L=E==="FeatureCollection",M=E==="Feature",R=L?l.features.length:1,O=0;O<R;O++){_=L?l.features[O].geometry:M?l.geometry:l,I=_?_.type==="GeometryCollection":!1,p=I?_.geometries.length:1;for(var b=0;b<p;b++){var P=0,G=0;if(d=I?_.geometries[b]:_,d!==null){w=d.coordinates;var D=d.type;switch(N=0,D){case null:break;case"Point":if(u(w,m,O,P,G)===!1)return!1;m++,P++;break;case"LineString":case"MultiPoint":for(f=0;f<w.length;f++){if(u(w[f],m,O,P,G)===!1)return!1;m++,D==="MultiPoint"&&P++}D==="LineString"&&P++;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,O,P,G)===!1)return!1;m++}D==="MultiLineString"&&P++,D==="Polygon"&&G++}D==="Polygon"&&P++;break;case"MultiPolygon":for(f=0;f<w.length;f++){for(G=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,O,P,G)===!1)return!1;m++}G++}P++}break;case"GeometryCollection":for(f=0;f<d.geometries.length;f++)if(Ui(d.geometries[f],u)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Vi(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 fn(l,u){var a,f,h,g,d,p,w,_,N,m,I=0,E=l.type==="FeatureCollection",L=l.type==="Feature",M=E?l.features.length:1;for(a=0;a<M;a++){for(p=E?l.features[a].geometry:L?l.geometry:l,_=E?l.features[a].properties:L?l.properties:{},N=E?l.features[a].bbox:L?l.bbox:void 0,m=E?l.features[a].id:L?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,_,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,_,N,m)===!1)return!1;break}case"GeometryCollection":{for(f=0;f<g.geometries.length;f++)if(u(g.geometries[f],I,_,N,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}I++}}function Js(l,u={}){const a=[];if(fn(l,h=>{a.push(h.coordinates)}),a.length<2)throw new Error("Must have at least 2 geometries");const f=Xi.union(a[0],...a.slice(1));return f.length===0?null:f.length===1?qn(f[0],u.properties):Li(f,u.properties)}var ea=Js;function Ht(){}function Hi(l){return l()}function Zi(){return Object.create(null)}function gn(l){l.forEach(Hi)}function $i(l){return typeof l=="function"}function ta(l,u){return l!=l?u==u:l!==u||l&&typeof l=="object"||typeof l=="function"}function na(l){return Object.keys(l).length===0}function ia(l,u){l.appendChild(u)}function ra(l,u,a){l.insertBefore(u,a||null)}function ji(l){l.parentNode&&l.parentNode.removeChild(l)}function Wi(l){return document.createElementNS("http://www.w3.org/2000/svg",l)}function ht(l,u,a){a==null?l.removeAttribute(u):l.getAttribute(u)!==a&&l.setAttribute(u,a)}function sa(l){return Array.from(l.childNodes)}function vn(l,u,a){l.classList.toggle(u,!!a)}let $n;function Zt(l){$n=l}const Lt=[],Qi=[];let Tt=[];const Ki=[],aa=Promise.resolve();let jn=!1;function ua(){jn||(jn=!0,aa.then(Ji))}function Wn(l){Tt.push(l)}const Qn=new Set;let Ct=0;function Ji(){if(Ct!==0)return;const l=$n;do{try{for(;Ct<Lt.length;){const u=Lt[Ct];Ct++,Zt(u),oa(u.$$)}}catch(u){throw Lt.length=0,Ct=0,u}for(Zt(null),Lt.length=0,Ct=0;Qi.length;)Qi.pop()();for(let u=0;u<Tt.length;u+=1){const a=Tt[u];Qn.has(a)||(Qn.add(a),a())}Tt.length=0}while(Lt.length);for(;Ki.length;)Ki.pop()();jn=!1,Qn.clear(),Zt(l)}function oa(l){if(l.fragment!==null){l.update(),gn(l.before_update);const u=l.dirty;l.dirty=[-1],l.fragment&&l.fragment.p(l.ctx,u),l.after_update.forEach(Wn)}}function la(l){const u=[],a=[];Tt.forEach(f=>l.indexOf(f)===-1?u.push(f):a.push(f)),a.forEach(f=>f()),Tt=u}const ha=new Set;function ca(l,u){l&&l.i&&(ha.delete(l),l.i(u))}function fa(l,u,a){const{fragment:f,after_update:h}=l.$$;f&&f.m(u,a),Wn(()=>{const g=l.$$.on_mount.map(Hi).filter($i);l.$$.on_destroy?l.$$.on_destroy.push(...g):gn(g),l.$$.on_mount=[]}),h.forEach(Wn)}function ga(l,u){const a=l.$$;a.fragment!==null&&(la(a.after_update),gn(a.on_destroy),a.fragment&&a.fragment.d(u),a.on_destroy=a.fragment=null,a.ctx=[])}function va(l,u){l.$$.dirty[0]===-1&&(Lt.push(l),ua(),l.$$.dirty.fill(0)),l.$$.dirty[u/31|0]|=1<<u%31}function ya(l,u,a,f,h,g,d=null,p=[-1]){const w=$n;Zt(l);const _=l.$$={fragment:null,ctx:[],props:g,update:Ht,not_equal:h,bound:Zi(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(u.context||(w?w.$$.context:[])),callbacks:Zi(),dirty:p,skip_bound:!1,root:u.target||w.$$.root};d&&d(_.root);let N=!1;if(_.ctx=a?a(l,u.props||{},(m,I,...E)=>{const L=E.length?E[0]:I;return _.ctx&&h(_.ctx[m],_.ctx[m]=L)&&(!_.skip_bound&&_.bound[m]&&_.bound[m](L),N&&va(l,m)),I}):[],_.update(),N=!0,gn(_.before_update),_.fragment=f?f(_.ctx):!1,u.target){if(u.hydrate){const m=sa(u.target);_.fragment&&_.fragment.l(m),m.forEach(ji)}else _.fragment&&_.fragment.c();u.intro&&ca(l.$$.fragment),fa(l,u.target,u.anchor),Ji()}Zt(w)}class ma{constructor(){Si(this,"$$");Si(this,"$$set")}$destroy(){ga(this,1),this.$destroy=Ht}$on(u,a){if(!$i(a))return Ht;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&&!na(u)&&(this.$$.skip_bound=!0,this.$$set(u),this.$$.skip_bound=!1)}}const da="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(da);function pa(l){let u,a,f;return{c(){u=Wi("svg"),a=Wi("path"),ht(a,"stroke-width","4"),ht(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"),ht(a,"class","svelte-gzo3ar"),ht(u,"width",f=l[0]==="list"?20:void 0),ht(u,"viewBox","0 0 70 85"),ht(u,"fill","none"),ht(u,"class","svelte-gzo3ar"),vn(u,"in-map",l[0]!=="list"),vn(u,"list-icon",l[0]==="list")},m(h,g){ra(h,u,g),ia(u,a)},p(h,[g]){g&1&&f!==(f=h[0]==="list"?20:void 0)&&ht(u,"width",f),g&1&&vn(u,"in-map",h[0]!=="list"),g&1&&vn(u,"list-icon",h[0]==="list")},i:Ht,o:Ht,d(h){h&&ji(u)}}}function _a(l,u,a){let{displayIn:f}=u;return l.$$set=h=>{"displayIn"in h&&a(0,f=h.displayIn)},[f]}class xa extends ma{constructor(u){super(),ya(this,u,_a,pa,ta,{displayIn:0})}}function ka(l,u={}){if(l.bbox!=null&&u.recompute!==!0)return l.bbox;const a=[1/0,1/0,-1/0,-1/0];return Ui(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 Ea(l,u={}){const a=ka(l),f=(a[0]+a[2])/2,h=(a[1]+a[3])/2;return Ss([f,h],u.properties,u)}var Ia=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Na(l){return l&&l.__esModule&&Object.prototype.hasOwnProperty.call(l,"default")?l.default:l}var er={exports:{}};(function(l,u){(function(a,f){l.exports=f()})(Ia,function(){function a(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function f(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function h(r,e,t){return e&&f(r.prototype,e),t&&f(r,t),r}function g(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&p(r,e)}function d(r){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(r)}function p(r,e){return p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},p(r,e)}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 _(r,e,t){return _=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},_.apply(null,arguments)}function N(r){var e=typeof Map=="function"?new Map:void 0;return N=function(t){if(t===null||(n=t,Function.toString.call(n).indexOf("[native code]")===-1))return t;var n;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return _(t,arguments,d(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),p(i,t)},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,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m(r)}function E(r){var e=w();return function(){var t,n=d(r);if(e){var i=d(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return I(this,t)}}function L(r,e,t){return L=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}},L(r,e,t||r)}function M(r){return function(e){if(Array.isArray(e))return O(e)}(r)||function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}(r)||R(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 R(r,e){if(r){if(typeof r=="string")return O(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set"?Array.from(r):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?O(r,e):void 0}}function O(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function b(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=R(r))||e){t&&(r=t);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(){t=t.call(r)},n:function(){var v=t.next();return o=v.done,v},e:function(v){c=!0,s=v},f:function(){try{o||t.return==null||t.return()}finally{if(c)throw s}}}}var P=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(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=r.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=r.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=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(e){this._joinStyle=e}},{key:"setSimplifyFactor",value:function(e){this._simplifyFactor=e<0?0:e}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(e){this._endCapStyle=e}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(e){this._mitreLimit=e}},{key:"setSingleSided",value:function(e){this._isSingleSided=e}}],[{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 e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.setQuadrantSegments(t),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(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)}}]),r}();P.CAP_ROUND=1,P.CAP_FLAT=2,P.CAP_SQUARE=3,P.JOIN_ROUND=1,P.JOIN_MITRE=2,P.JOIN_BEVEL=3,P.DEFAULT_QUADRANT_SEGMENTS=8,P.DEFAULT_MITRE_LIMIT=5,P.DEFAULT_SIMPLIFY_FACTOR=.01;var G=function(r){g(t,r);var e=E(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({Exception:t})[0],i}return h(t,[{key:"toString",value:function(){return this.message}}]),t}(N(Error)),D=function(r){g(t,r);var e=E(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({IllegalArgumentException:t})[0],i}return t}(G),B=function(){function r(){a(this,r)}return h(r,[{key:"filter",value:function(e){}}]),r}();function X(){}function V(){}function U(){}var se,te,re,oe,z,ne,le,ve,Ee=function(){function r(){a(this,r)}return h(r,null,[{key:"equalsWithTolerance",value:function(e,t,n){return Math.abs(e-t)<=n}}]),r}(),Ie=function(){function r(e,t){a(this,r),this.low=t||0,this.high=e||0}return h(r,null,[{key:"toBinaryString",value:function(e){var t,n="";for(t=2147483648;t>0;t>>>=1)n+=(e.high&t)===t?"1":"0";for(t=2147483648;t>0;t>>>=1)n+=(e.low&t)===t?"1":"0";return n}}]),r}();function H(){}function Te(){}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"?(ne=2146435072,le=new Float64Array(1),ve=new Int32Array(le.buffer),H.doubleToLongBits=function(r){le[0]=r;var e=0|ve[0],t=0|ve[1];return(t&ne)===ne&&1048575&t&&e!==0&&(e=0,t=2146959360),new Ie(t,e)},H.longBitsToDouble=function(r){return ve[0]=r.low,ve[1]=r.high,le[0]}):(se=1023,te=Math.log2,re=Math.floor,oe=Math.pow,z=function(){for(var r=53;r>0;r--){var e=oe(2,r)-1;if(re(te(e))+1===r)return e}return 0}(),H.doubleToLongBits=function(r){var e,t,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 Ie(v=o,y=0);if(r===1/0)return new Ie(v=2146435072|o,y=0);if(r!=r)return new Ie(v=2146959360,y=0);if(i=0,y=0,(e=re(r))>1)if(e<=z)(i=re(te(e)))<=20?(y=0,v=e<<20-i&1048575):(y=e%(t=oe(2,n=i-20))<<32-n,v=e/t&1048575);else for(n=e,y=0;(n=re(t=n/2))!==0;)i++,y>>>=1,y|=(1&v)<<31,v>>>=1,t!==n&&(v|=524288);if(c=i+se,s=e===0,e=r-e,i<52&&e!==0)for(n=0;;){if((t=2*e)>=1?(e=t-1,s?(c--,s=!1):(n<<=1,n|=1,i++)):(e=t,s?--c==0&&(i++,s=!1):(n<<=1,i++)),i===20)v|=n,n=0;else if(i===52){y|=n;break}if(t===1){i<20?v|=n<<20-i:i<52&&(y|=n<<52-i);break}}return v|=c<<20,new Ie(v|=o,y)},H.longBitsToDouble=function(r){var e,t,n,i,s=r.high,o=r.low,c=s&1<<31?-1:1;for(n=((2146435072&s)>>20)-se,i=0,t=1<<19,e=1;e<=20;e++)s&t&&(i+=oe(2,-e)),t>>>=1;for(t=1<<31,e=21;e<=52;e++)o&t&&(i+=oe(2,-e)),t>>>=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*oe(2,n)});var Ne=function(r){g(t,r);var e=E(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({RuntimeException:t})[0],i}return t}(G),Re=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,null,[{key:"constructor_",value:function(){if(arguments.length===0)Ne.constructor_.call(this);else if(arguments.length===1){var n=arguments[0];Ne.constructor_.call(this,n)}}}]),t}(Ne),ie=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 e=arguments[0];throw new Re("Should never reach here"+(e!==null?": "+e:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var e=arguments[0];r.isTrue(e,null)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(!t)throw n===null?new Re:new Re(n)}}},{key:"equals",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];r.equals(e,t,null)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];if(!i.equals(n))throw new Re("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))}}}]),r}(),tt=new ArrayBuffer(8),uu=new Float64Array(tt),Ar=new Int32Array(tt),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(e,t){switch(e){case r.X:this.x=t;break;case r.Y:this.y=t;break;case r.Z:this.setZ(t);break;default:throw new D("Invalid ordinate index: "+e)}}},{key:"equals2D",value:function(){if(arguments.length===1){var e=arguments[0];return this.x===e.x&&this.y===e.y}if(arguments.length===2){var t=arguments[0],n=arguments[1];return!!Ee.equalsWithTolerance(this.x,t.x,n)&&!!Ee.equalsWithTolerance(this.y,t.y,n)}}},{key:"setM",value:function(e){throw new D("Invalid ordinate index: "+r.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(e){switch(e){case r.X:return this.x;case r.Y:return this.y;case r.Z:return this.getZ()}throw new D("Invalid ordinate index: "+e)}},{key:"equals3D",value:function(e){return this.x===e.x&&this.y===e.y&&(this.getZ()===e.getZ()||H.isNaN(this.getZ())&&H.isNaN(e.getZ()))}},{key:"equals",value:function(e){return e instanceof r&&this.equals2D(e)}},{key:"equalInZ",value:function(e,t){return Ee.equalsWithTolerance(this.getZ(),e.getZ(),t)}},{key:"setX",value:function(e){this.x=e}},{key:"compareTo",value:function(e){var t=e;return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(e){this.z=e}},{key:"clone",value:function(){try{return null}catch(e){if(e instanceof CloneNotSupportedException)return ie.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw e}}},{key:"copy",value:function(){return new r(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.getZ()-e.getZ();return Math.sqrt(t*t+n*n+i*i)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(e){this.y=e}},{key:"distance",value:function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)}},{key:"hashCode",value:function(){var e=17;return e=37*(e=37*e+r.hashCode(this.x))+r.hashCode(this.y)}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.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 e=arguments[0];r.constructor_.call(this,e.x,e.y,e.getZ())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];r.constructor_.call(this,t,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(e){return uu[0]=e,Ar[0]^Ar[1]}}]),r}(),ou=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"compare",value:function(e,t){var n=r.compare(e.x,t.x);if(n!==0)return n;var i=r.compare(e.y,t.y);return i!==0?i:this._dimensionsToTest<=2?0:r.compare(e.getZ(),t.getZ())}},{key:"interfaces_",get:function(){return[Te]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)r.constructor_.call(this,2);else if(arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new D("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}}},{key:"compare",value:function(e,t){return e<t?-1:e>t?1:H.isNaN(e)?H.isNaN(t)?0:-1:H.isNaN(t)?1:0}}]),r}();T.DimensionalComparator=ou,T.NULL_ORDINATE=H.NaN,T.X=0,T.Y=1,T.Z=2,T.M=3;var ye=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(e){if(!(e instanceof r))return!1;var t=e;return this.isNull()?t.isNull():this._maxx===t.getMaxX()&&this._maxy===t.getMaxY()&&this._minx===t.getMinX()&&this._miny===t.getMinY()}},{key:"intersection",value:function(e){if(this.isNull()||e.isNull()||!this.intersects(e))return new r;var t=this._minx>e._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny;return new r(t,this._maxx<e._maxx?this._maxx:e._maxx,n,this._maxy<e._maxy?this._maxy:e._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 e=arguments[0];return this.covers(e.x,e.y)}if(arguments[0]instanceof r){var t=arguments[0];return!this.isNull()&&!t.isNull()&&t.getMinX()>=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.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 e=arguments[0];return!this.isNull()&&!e.isNull()&&!(e._minx>this._maxx||e._maxx<this._minx||e._miny>this._maxy||e._maxy<this._miny)}if(arguments[0]instanceof T){var t=arguments[0];return this.intersects(t.x,t.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],k=arguments[1];return!this.isNull()&&!(y>this._maxx||y<this._minx||k>this._maxy||k<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return Math.sqrt(e*e+t*t)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof T){var e=arguments[0];this.expandToInclude(e.x,e.y)}else if(arguments[0]instanceof r){var t=arguments[0];if(t.isNull())return null;this.isNull()?(this._minx=t.getMinX(),this._maxx=t.getMaxX(),this._miny=t.getMinY(),this._maxy=t.getMaxY()):(t._minx<this._minx&&(this._minx=t._minx),t._maxx>this._maxx&&(this._maxx=t._maxx),t._miny<this._miny&&(this._miny=t._miny),t._maxy>this._maxy&&(this._maxy=t._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 e=this.getWidth(),t=this.getHeight();return e<t?e:t}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(e){var t=e;return this.isNull()?t.isNull()?0:-1:t.isNull()?1:this._minx<t._minx?-1:this._minx>t._minx?1:this._miny<t._miny?-1:this._miny>t._miny?1:this._maxx<t._maxx?-1:this._maxx>t._maxx?1:this._maxy<t._maxy?-1:this._maxy>t._maxy?1:0}},{key:"translate",value:function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)}},{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(e){return!(!this.isNull()&&!e.isNull())||e._minx>this._maxx||e._maxx<this._minx||e._miny>this._maxy||e._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 e=this.getWidth(),t=this.getHeight();return e>t?e:t}},{key:"expandBy",value:function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,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 e=arguments[0];return this.covers(e)}if(arguments[0]instanceof T){var t=arguments[0];return this.covers(t)}}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 e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof r){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._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(e){if(this.intersects(e))return 0;var t=0;this._maxx<e._minx?t=e._minx-this._maxx:this._minx>e._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxy<e._miny?n=e._miny-this._maxy:this._miny>e._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)}},{key:"hashCode",value:function(){var e=17;return e=37*(e=37*(e=37*(e=37*e+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 e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof r){var t=arguments[0];this.init(t)}}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 e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.x<t.x?e.x:t.x)&&n.x<=(e.x>t.x?e.x:t.x)&&n.y>=(e.y<t.y?e.y:t.y)&&n.y<=(e.y>t.y?e.y:t.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),k=Math.min(i.x,s.x),S=Math.max(i.x,s.x);return!(k>y)&&!(S<v)&&(v=Math.min(o.y,c.y),y=Math.max(o.y,c.y),k=Math.min(i.y,s.y),S=Math.max(i.y,s.y),!(k>y)&&!(S<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(e){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(e){return this===e||this.equalsExact(e,0)}},{key:"geometryChanged",value:function(){this.apply(r.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(e){return e!==null&&this.norm().equalsExact(e.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var e;if(arguments.length===1){var t=arguments[0];return e=t,this.getTypeCode()!==e.getTypeCode()?this.getTypeCode()-e.getTypeCode():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return e=n,this.getTypeCode()!==e.getTypeCode()?this.getTypeCode()-e.getTypeCode():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.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(e){if(e.getTypeCode()===r.TYPECODE_GEOMETRYCOLLECTION)throw new D("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(e,t,n){return n===0?e.equals(t):e.distance(t)<=n}},{key:"norm",value:function(){var e=this.copy();return e.normalize(),e}},{key:"reverse",value:function(){var e=this.reverseInternal();return this.envelope!=null&&(e.envelope=this.envelope.copy()),e.setSRID(this.getSRID()),e}},{key:"copy",value:function(){var e=this.copyInternal();return e.envelope=this._envelope==null?null:this._envelope.copy(),e._SRID=this._SRID,e._userData=this._userData,e}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new ye(this._envelope)}},{key:"setSRID",value:function(e){this._SRID=e}},{key:"setUserData",value:function(e){this._userData=e}},{key:"compare",value:function(e,t){for(var n=e.iterator(),i=t.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(e){return this.getClass()===e.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(e){for(var t=0;t<e.length;t++)if(!e[t].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(e){for(var t=0;t<e.length;t++)if(e[t]===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 x=function(){function r(){a(this,r)}return h(r,null,[{key:"toLocationSymbol",value:function(e){switch(e){case r.EXTERIOR:return"e";case r.BOUNDARY:return"b";case r.INTERIOR:return"i";case r.NONE:return"-"}throw new D("Unknown location value: "+e)}}]),r}();x.INTERIOR=0,x.BOUNDARY=1,x.EXTERIOR=2,x.NONE=-1;var je=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}(),Ln=function(r){g(t,r);var e=E(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({NoSuchElementException:t})[0],i}return t}(G),gt=function(r){g(t,r);var e=E(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({UnsupportedOperationException:t})[0],i}return t}(G),Dr=function(r){g(t,r);var e=E(t);function t(){return a(this,t),e.apply(this,arguments)}return h(t,[{key:"contains",value:function(){}}]),t}(je),si=function(r,e){g(n,r);var t=E(n);function n(i){var s;return a(this,n),(s=t.call(this)).map=new Map,i instanceof je&&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=b(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 gt}},{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 lu(this.map)}},{key:e,value:function(){return this.map}}]),n}(Dr,Symbol.iterator),lu=function(){function r(e){a(this,r),this.iterator=e.values();var t=this.iterator.next(),n=t.done,i=t.value;this.done=n,this.value=i}return h(r,[{key:"next",value:function(){if(this.done)throw new Ln;var e=this.value,t=this.iterator.next(),n=t.done,i=t.value;return this.done=n,this.value=i,e}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new gt}}]),r}(),q=function(){function r(){a(this,r)}return h(r,null,[{key:"opposite",value:function(e){return e===r.LEFT?r.RIGHT:e===r.RIGHT?r.LEFT:e}}]),r}();q.ON=0,q.LEFT=1,q.RIGHT=2;var Fr=function(r){g(t,r);var e=E(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({EmptyStackException:t})[0],i}return t}(G),Gr=function(r){g(t,r);var e=E(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({IndexOutOfBoundsException:t})[0],i}return t}(G),pt=function(r){g(t,r);var e=E(t);function t(){return a(this,t),e.apply(this,arguments)}return h(t,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}]),t}(je),hu=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),(n=e.call(this)).array=[],n}return h(t,[{key:"add",value:function(n){return this.array.push(n),!0}},{key:"get",value:function(n){if(n<0||n>=this.size())throw new Gr;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 Fr;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Fr;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()}}]),t}(pt);function ee(r,e){return r.interfaces_&&r.interfaces_.indexOf(e)>-1}var Qt=function(){function r(e){a(this,r),this.str=e}return h(r,[{key:"append",value:function(e){this.str+=e}},{key:"setCharAt",value:function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)}},{key:"toString",value:function(){return this.str}}]),r}(),Tn=function(){function r(e){a(this,r),this.value=e}return h(r,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(e){return this.value<e?-1:this.value>e?1:0}}],[{key:"compare",value:function(e,t){return e<t?-1:e>t?1:0}},{key:"isNan",value:function(e){return Number.isNaN(e)}},{key:"valueOf",value:function(e){return new r(e)}}]),r}(),ai=function(){function r(){a(this,r)}return h(r,null,[{key:"isWhitespace",value:function(e){return e<=32&&e>=0||e===127}},{key:"toUpperCase",value:function(e){return e.toUpperCase()}}]),r}(),Q=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"le",value:function(e){return this._hi<e._hi||this._hi===e._hi&&this._lo<=e._lo}},{key:"extractSignificantDigits",value:function(e,t){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 Qt,v=r.MAX_PRINT_DIGITS-1,y=0;y<=v;y++){e&&y===o&&c.append(".");var k=Math.trunc(n._hi);if(k<0)break;var S=!1,C=0;k>9?(S=!0,C="9"):C="0"+k,c.append(C),n=n.subtract(r.valueOf(k)).multiply(r.TEN),S&&n.selfAdd(r.TEN);var F=!0,A=r.magnitude(n._hi);if(A<0&&Math.abs(A)>=v-y&&(F=!1),!F)break}return t[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 e=arguments[0];return this.add(e.negate())}if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof r){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof r){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(e){return this.le(e)?this:e}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof r){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=null,o=null,c=null,v=null,y=null,k=null,S=null,C=null;return y=this._hi/n,C=(s=(k=r.SPLIT*y)-(s=k-y))*(c=(C=r.SPLIT*n)-(c=C-n))-(S=y*n)+s*(v=n-c)+(o=y-s)*c+o*v,C=y+(k=(this._hi-S-C+this._lo-y*i)/n),this._hi=C,this._lo=y-C+k,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof r){var e=arguments[0],t=null,n=null,i=null,s=null,o=null,c=null,v=null,y=null;n=(o=this._hi/e._hi)-(t=(c=r.SPLIT*o)-(t=c-o)),y=t*(i=(y=r.SPLIT*e._hi)-(i=y-e._hi))-(v=o*e._hi)+t*(s=e._hi-i)+n*i+n*s;var k=y=o+(c=(this._hi-v-y+this._lo-o*e._lo)/e._hi),S=o-y+c;return new r(k,S)}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(e){return this._hi>e._hi||this._hi===e._hi&&this._lo>=e._lo}},{key:"pow",value:function(e){if(e===0)return r.valueOf(1);var t=new r(this),n=r.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2==1&&n.selfMultiply(t),(i/=2)>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n}},{key:"ceil",value:function(){if(this.isNaN())return r.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new r(e,t)}},{key:"compareTo",value:function(e){var t=e;return this._hi<t._hi?-1:this._hi>t._hi?1:this._lo<t._lo?-1:this._lo>t._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 e=arguments[0];return this.init(e),this}if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}}},{key:"max",value:function(e){return this.ge(e)?this:e}},{key:"sqrt",value:function(){if(this.isZero())return r.valueOf(0);if(this.isNegative())return r.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=r.valueOf(t),i=this.subtract(n.sqr())._hi*(.5*e);return n.add(i)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof r){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0],n=null,i=null,s=null,o=null,c=null,v=null;return o=(s=this._hi+t)-(c=s-this._hi),i=(v=(o=t-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],k=arguments[1],S=null,C=null,F=null,A=null,Z=null,j=null,J=null;A=this._hi+y,C=this._lo+k,Z=A-(j=A-this._hi),F=C-(J=C-this._lo);var ce=(S=A+(j=(Z=y-j+(this._hi-Z))+C))+(j=(F=k-J+(this._lo-F))+(j+(A-S))),_e=j+(S-ce);return this._hi=ce,this._lo=_e,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof r){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],s=null,o=null,c=null,v=null,y=null,k=null;s=(y=r.SPLIT*this._hi)-this._hi,k=r.SPLIT*n,s=y-s,o=this._hi-s,c=k-n;var S=(y=this._hi*n)+(k=s*(c=k-c)-y+s*(v=n-c)+o*c+o*v+(this._hi*i+this._lo*n)),C=k+(s=y-S);return this._hi=S,this._lo=C,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return r.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new r(e,t)}},{key:"negate",value:function(){return this.isNaN()?this:new r(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(e){if(e instanceof CloneNotSupportedException)return null;throw e}}},{key:"multiply",value:function(){if(arguments[0]instanceof r){var e=arguments[0];return e.isNaN()?r.createNaN():r.copy(this).selfMultiply(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return H.isNaN(t)?r.createNaN():r.copy(this).selfMultiply(t,0)}}},{key:"isNaN",value:function(){return H.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var e=r.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),i=t[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 e,t,n,i,s=null,o=null,c=null,v=null;e=(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*(t=this._hi-o)+e*o+e*t)-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 e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),i=r.SCI_NOT_EXPONENT_CHAR+t[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(e){return this._hi<e._hi||this._hi===e._hi&&this._lo<e._lo}},{key:"add",value:function(){if(arguments[0]instanceof r){var e=arguments[0];return r.copy(this).selfAdd(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return r.copy(this).selfAdd(t)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this._hi=e,this._lo=0}else if(arguments[0]instanceof r){var t=arguments[0];this._hi=t._hi,this._lo=t._lo}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._hi=n,this._lo=i}}},{key:"gt",value:function(e){return this._hi>e._hi||this._hi===e._hi&&this._lo>e._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 e=arguments[0];this.init(e)}else if(arguments[0]instanceof r){var t=arguments[0];this.init(t)}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 e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];return r.determinant(r.valueOf(e),r.valueOf(t),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(e){return r.valueOf(e).selfMultiply(e)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var e=arguments[0];return r.parse(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return new r(t)}}},{key:"sqrt",value:function(e){return r.valueOf(e).sqrt()}},{key:"parse",value:function(e){for(var t=0,n=e.length;ai.isWhitespace(e.charAt(t));)t++;var i=!1;if(t<n){var s=e.charAt(t);s!=="-"&&s!=="+"||(t++,s==="-"&&(i=!0))}for(var o=new r,c=0,v=0,y=0,k=!1;!(t>=n);){var S=e.charAt(t);if(t++,ai.isDigit(S)){var C=S-"0";o.selfMultiply(r.TEN),o.selfAdd(C),c++}else{if(S!=="."){if(S==="e"||S==="E"){var F=e.substring(t);try{y=Tn.parseInt(F)}catch(ce){throw ce instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+F+" in string "+e):ce}break}throw new NumberFormatException("Unexpected character '"+S+"' at position "+t+" in string "+e)}v=c,k=!0}}var A=o;k||(v=c);var Z=c-v-y;if(Z===0)A=o;else if(Z>0){var j=r.TEN.pow(Z);A=o.divide(j)}else if(Z<0){var J=r.TEN.pow(-Z);A=o.multiply(J)}return i?A.negate():A}},{key:"createNaN",value:function(){return new r(H.NaN,H.NaN)}},{key:"copy",value:function(e){return new r(e)}},{key:"magnitude",value:function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),i=Math.trunc(Math.floor(n));return 10*Math.pow(10,i)<=t&&(i+=1),i}},{key:"stringOfChar",value:function(e,t){for(var n=new Qt,i=0;i<t;i++)n.append(e);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 ui=function(){function r(){a(this,r)}return h(r,null,[{key:"orientationIndex",value:function(e,t,n){var i=r.orientationIndexFilter(e,t,n);if(i<=1)return i;var s=Q.valueOf(t.x).selfAdd(-e.x),o=Q.valueOf(t.y).selfAdd(-e.y),c=Q.valueOf(n.x).selfAdd(-t.x),v=Q.valueOf(n.y).selfAdd(-t.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 e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3],s=e.multiply(i).selfSubtract(t.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],k=Q.valueOf(o),S=Q.valueOf(c),C=Q.valueOf(v),F=Q.valueOf(y),A=k.multiply(F).selfSubtract(S.multiply(C));return A.signum()}}},{key:"intersection",value:function(e,t,n,i){var s=new Q(e.y).selfSubtract(t.y),o=new Q(t.x).selfSubtract(e.x),c=new Q(e.x).selfMultiply(t.y).selfSubtract(new Q(t.x).selfMultiply(e.y)),v=new Q(n.y).selfSubtract(i.y),y=new Q(i.x).selfSubtract(n.x),k=new Q(n.x).selfMultiply(i.y).selfSubtract(new Q(i.x).selfMultiply(n.y)),S=o.multiply(k).selfSubtract(y.multiply(c)),C=v.multiply(c).selfSubtract(s.multiply(k)),F=s.multiply(y).selfSubtract(v.multiply(o)),A=S.selfDivide(F).doubleValue(),Z=C.selfDivide(F).doubleValue();return H.isNaN(A)||H.isInfinite(A)||H.isNaN(Z)||H.isInfinite(Z)?null:new T(A,Z)}},{key:"orientationIndexFilter",value:function(e,t,n){var i=null,s=(e.x-n.x)*(t.y-n.y),o=(e.y-n.y)*(t.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(e){return e>0?1:e<0?-1:0}}]),r}();ui.DP_SAFE_EPSILON=1e-15;var ae=function(){function r(){a(this,r)}return h(r,[{key:"getM",value:function(e){if(this.hasM()){var t=this.getDimension()-this.getMeasures();return this.getOrdinate(e,t)}return H.NaN}},{key:"setOrdinate",value:function(e,t,n){}},{key:"getZ",value:function(e){return this.hasZ()?this.getOrdinate(e,2):H.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(e,t){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(e){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(e){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(e){}},{key:"copy",value:function(){}},{key:"getY",value:function(e){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[V]}}]),r}();ae.X=0,ae.Y=1,ae.Z=2,ae.M=3;var K=function(){function r(){a(this,r)}return h(r,null,[{key:"index",value:function(e,t,n){return ui.orientationIndex(e,t,n)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var e=arguments[0],t=e.length-1;if(t<3)throw new D("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=e[0],i=0,s=1;s<=t;s++){var o=e[s];o.y>n.y&&(n=o,i=s)}var c=i;do(c-=1)<0&&(c=t);while(e[c].equals2D(n)&&c!==i);var v=i;do v=(v+1)%t;while(e[v].equals2D(n)&&v!==i);var y=e[c],k=e[v];if(y.equals2D(n)||k.equals2D(n)||y.equals2D(k))return!1;var S=r.index(y,n,k),C=null;return C=S===0?y.x>k.x:S>0,C}if(ee(arguments[0],ae)){var F=arguments[0],A=F.size()-1;if(A<3)throw new D("Ring has fewer than 4 points, so orientation cannot be determined");for(var Z=F.getCoordinate(0),j=0,J=1;J<=A;J++){var ce=F.getCoordinate(J);ce.y>Z.y&&(Z=ce,j=J)}var _e=null,Se=j;do(Se-=1)<0&&(Se=A),_e=F.getCoordinate(Se);while(_e.equals2D(Z)&&Se!==j);var Pe=null,He=j;do He=(He+1)%A,Pe=F.getCoordinate(He);while(Pe.equals2D(Z)&&He!==j);if(_e.equals2D(Z)||Pe.equals2D(Z)||_e.equals2D(Pe))return!1;var st=r.index(_e,Z,Pe);return st===0?_e.x>Pe.x:st>0}}}]),r}();K.CLOCKWISE=-1,K.RIGHT=K.CLOCKWISE,K.COUNTERCLOCKWISE=1,K.LEFT=K.COUNTERCLOCKWISE,K.COLLINEAR=0,K.STRAIGHT=K.COLLINEAR;var cu=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(e,t){var n=this.getRightmostSideOfSegment(e,t);return n<0&&(n=this.getRightmostSideOfSegment(e,t-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(e)),n}},{key:"findRightmostEdgeAtVertex",value:function(){var e=this._minDe.getEdge().getCoordinates();ie.isTrue(this._minIndex>0&&this._minIndex<e.length,"rightmost point expected to be interior vertex of edge");var t=e[this._minIndex-1],n=e[this._minIndex+1],i=K.index(this._minCoord,n,t),s=!1;(t.y<this._minCoord.y&&n.y<this._minCoord.y&&i===K.COUNTERCLOCKWISE||t.y>this._minCoord.y&&n.y>this._minCoord.y&&i===K.CLOCKWISE)&&(s=!0),s&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(e,t){var n=e.getEdge().getCoordinates();if(t<0||t+1>=n.length||n[t].y===n[t+1].y)return-1;var i=q.LEFT;return n[t].y<n[t+1].y&&(i=q.RIGHT),i}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(e){for(var t=e.getEdge().getCoordinates(),n=0;n<t.length-1;n++)(this._minCoord===null||t[n].x>this._minCoord.x)&&(this._minDe=e,this._minIndex=n,this._minCoord=t[n])}},{key:"findRightmostEdgeAtNode",value:function(){var e=this._minDe.getNode().getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next();n.isForward()&&this.checkForRightmostCoordinate(n)}ie.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)===q.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}]),r}(),nt=function(r){g(t,r);var e=E(t);function t(n,i){var s;return a(this,t),(s=e.call(this,i?n+" [ "+i+" ]":n)).pt=i?new T(i):void 0,s.name=Object.keys({TopologyException:t})[0],s}return h(t,[{key:"getCoordinate",value:function(){return this.pt}}]),t}(Ne),fu=function(){function r(){a(this,r),this.array=[]}return h(r,[{key:"addLast",value:function(e){this.array.push(e)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}]),r}(),W=function(r,e){g(n,r);var t=E(n);function n(i){var s;return a(this,n),(s=t.call(this)).array=[],i instanceof je&&s.addAll(i),s}return h(n,[{key:"interfaces_",get:function(){return[pt,je]}},{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=b(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 gu(this)}},{key:"get",value:function(i){if(i<0||i>=this.size())throw new Gr;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:e,value:function(){return this.array.values()}}]),n}(pt,Symbol.iterator),gu=function(){function r(e){a(this,r),this.arrayList=e,this.position=0}return h(r,[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new Ln;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(e){return this.arrayList.set(this.position-1,e)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}]),r}(),vu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"clearVisitedEdges",value:function(){for(var e=this._dirEdgeList.iterator();e.hasNext();)e.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(e){for(var t=null,n=e.getEdges().iterator();n.hasNext();){var i=n.next();if(i.isVisited()||i.getSym().isVisited()){t=i;break}}if(t===null)throw new nt("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(t);for(var s=e.getEdges().iterator();s.hasNext();){var o=s.next();o.setVisited(!0),this.copySymDepths(o)}}},{key:"computeDepth",value:function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.getNode(),t.getLabel(),t.setEdgeDepths(q.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)}},{key:"create",value:function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(q.RIGHT)>=1&&t.getDepth(q.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}}},{key:"computeDepths",value:function(e){var t=new si,n=new fu,i=e.getNode();for(n.addLast(i),t.add(i),e.setVisited(!0);!n.isEmpty();){var s=n.removeFirst();t.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();t.contains(v)||(n.addLast(v),t.add(v))}}}}},{key:"compareTo",value:function(e){var t=e;return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var e=new ye,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next().getEdge().getCoordinates(),i=0;i<n.length-1;i++)e.expandToInclude(n[i]);this._env=e}return this._env}},{key:"addReachable",value:function(e){var t=new hu;for(t.add(e);!t.empty();){var n=t.pop();this.add(n,t)}}},{key:"copySymDepths",value:function(e){var t=e.getSym();t.setDepth(q.LEFT,e.getDepth(q.RIGHT)),t.setDepth(q.RIGHT,e.getDepth(q.LEFT))}},{key:"add",value:function(e,t){e.setVisited(!0),this._nodes.add(e);for(var n=e.getEdges().iterator();n.hasNext();){var i=n.next();this._dirEdgeList.add(i);var s=i.getSym().getNode();s.isVisited()||t.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 cu}}]),r}(),oi=function(){function r(){a(this,r)}return h(r,null,[{key:"intersection",value:function(e,t,n,i){var s=e.x<t.x?e.x:t.x,o=e.y<t.y?e.y:t.y,c=e.x>t.x?e.x:t.x,v=e.y>t.y?e.y:t.y,y=n.x<i.x?n.x:i.x,k=n.y<i.y?n.y:i.y,S=n.x>i.x?n.x:i.x,C=n.y>i.y?n.y:i.y,F=((s>y?s:y)+(c<S?c:S))/2,A=((o>k?o:k)+(v<C?v:C))/2,Z=e.x-F,j=e.y-A,J=t.x-F,ce=t.y-A,_e=n.x-F,Se=n.y-A,Pe=i.x-F,He=i.y-A,st=j-ce,wt=J-Z,un=Z*ce-J*j,on=Se-He,zt=Pe-_e,Ns=_e*He-Pe*Se,ws=st*zt-on*wt,Ni=(wt*Ns-zt*un)/ws,wi=(on*un-st*Ns)/ws;return H.isNaN(Ni)||H.isInfinite(Ni)||H.isNaN(wi)||H.isInfinite(wi)?null:new T(Ni+F,wi+A)}}]),r}(),Ge=function(){function r(){a(this,r)}return h(r,null,[{key:"arraycopy",value:function(e,t,n,i,s){for(var o=0,c=t;c<t+s;c++)n[i+o]=e[c],o++}},{key:"getProperty",value:function(e){return{"line.separator":`
|
|
25
|
-
`}[e]}}]),r}(),Kt=function(){function r(){a(this,r)}return h(r,null,[{key:"log10",value:function(e){var t=Math.log(e);return H.isInfinite(t)||H.isNaN(t)?t:t/r.LOG_10}},{key:"min",value:function(e,t,n,i){var s=e;return t<s&&(s=t),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 e=arguments[0],t=arguments[1],n=arguments[2];return e<t?t:e>n?n:e}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(e,t){return e<0?t- -e%t:e%t}},{key:"max",value:function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],i=e;return t>i&&(i=t),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(e,t){return(e+t)/2}}]),r}();Kt.LOG_10=Math.log(10);var We=function(){function r(){a(this,r)}return h(r,null,[{key:"segmentToSegment",value:function(e,t,n,i){if(e.equals(t))return r.pointToSegment(e,n,i);if(n.equals(i))return r.pointToSegment(i,e,t);var s=!1;if(ye.intersects(e,t,n,i)){var o=(t.x-e.x)*(i.y-n.y)-(t.y-e.y)*(i.x-n.x);if(o===0)s=!0;else{var c=(e.y-n.y)*(i.x-n.x)-(e.x-n.x)*(i.y-n.y),v=((e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y))/o,y=c/o;(y<0||y>1||v<0||v>1)&&(s=!0)}}else s=!0;return s?Kt.min(r.pointToSegment(e,n,i),r.pointToSegment(t,n,i),r.pointToSegment(n,e,t),r.pointToSegment(i,e,t)):0}},{key:"pointToSegment",value:function(e,t,n){if(t.x===n.x&&t.y===n.y)return e.distance(t);var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),s=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/i;if(s<=0)return e.distance(t);if(s>=1)return e.distance(n);var o=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(o)*Math.sqrt(i)}},{key:"pointToLinePerpendicular",value:function(e,t,n){var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),s=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(s)*Math.sqrt(i)}},{key:"pointToSegmentString",value:function(e,t){if(t.length===0)throw new D("Line array must contain at least one vertex");for(var n=e.distance(t[0]),i=0;i<t.length-1;i++){var s=r.pointToSegment(e,t[i],t[i+1]);s<n&&(n=s)}return n}}]),r}(),qr=function(){function r(){a(this,r)}return h(r,[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||ee(arguments[0],ae);else if(arguments.length!==2){if(arguments.length===3){var e=arguments[0],t=arguments[1];return this.create(e,t)}}}}]),r}(),Cn=function(){function r(){a(this,r)}return h(r,[{key:"filter",value:function(e){}}]),r}(),yu=function(){function r(){a(this,r)}return h(r,null,[{key:"ofLine",value:function(e){var t=e.size();if(t<=1)return 0;var n=0,i=new T;e.getCoordinate(0,i);for(var s=i.x,o=i.y,c=1;c<t;c++){e.getCoordinate(c,i);var v=i.x,y=i.y,k=v-s,S=y-o;n+=Math.sqrt(k*k+S*S),s=v,o=y}return n}}]),r}(),Yr=function r(){a(this,r)},_t=function(){function r(){a(this,r)}return h(r,null,[{key:"copyCoord",value:function(e,t,n,i){for(var s=Math.min(e.getDimension(),n.getDimension()),o=0;o<s;o++)n.setOrdinate(i,o,e.getOrdinate(t,o))}},{key:"isRing",value:function(e){var t=e.size();return t===0||!(t<=3)&&e.getOrdinate(0,ae.X)===e.getOrdinate(t-1,ae.X)&&e.getOrdinate(0,ae.Y)===e.getOrdinate(t-1,ae.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(ee(arguments[0],ae)&&Number.isInteger(arguments[1])){var e=arguments[0],t=arguments[1];r.scroll(e,t,r.isRing(e))}else if(ee(arguments[0],ae)&&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 k=o.copy(),S=v?o.size()-1:o.size(),C=0;C<S;C++)for(var F=0;F<o.getDimension();F++)o.setOrdinate(C,F,k.getOrdinate((c+C)%S,F));if(v)for(var A=0;A<o.getDimension();A++)o.setOrdinate(S,A,o.getOrdinate(0,A))}}},{key:"isEqual",value:function(e,t){var n=e.size();if(n!==t.size())return!1;for(var i=Math.min(e.getDimension(),t.getDimension()),s=0;s<n;s++)for(var o=0;o<i;o++){var c=e.getOrdinate(s,o),v=t.getOrdinate(s,o);if(e.getOrdinate(s,o)!==t.getOrdinate(s,o)&&(!H.isNaN(c)||!H.isNaN(v)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var e=arguments[0];return r.minCoordinateIndex(e,0,e.size()-1)}if(arguments.length===3){for(var t=arguments[0],n=arguments[1],i=arguments[2],s=-1,o=null,c=n;c<=i;c++){var v=t.getCoordinate(c);(o===null||o.compareTo(v)>0)&&(o=v,s=c)}return s}}},{key:"extend",value:function(e,t,n){var i=e.create(n,t.getDimension()),s=t.size();if(r.copy(t,0,i,0,s),s>0)for(var o=s;o<n;o++)r.copy(t,s-1,i,o,1);return i}},{key:"reverse",value:function(e){for(var t=e.size()-1,n=Math.trunc(t/2),i=0;i<=n;i++)r.swap(e,i,t-i)}},{key:"swap",value:function(e,t,n){if(t===n)return null;for(var i=0;i<e.getDimension();i++){var s=e.getOrdinate(t,i);e.setOrdinate(t,i,e.getOrdinate(n,i)),e.setOrdinate(n,i,s)}}},{key:"copy",value:function(e,t,n,i,s){for(var o=0;o<s;o++)r.copyCoord(e,t+o,n,i+o)}},{key:"ensureValidRing",value:function(e,t){var n=t.size();return n===0?t:n<=3?r.createClosedRing(e,t,4):t.getOrdinate(0,ae.X)===t.getOrdinate(n-1,ae.X)&&t.getOrdinate(0,ae.Y)===t.getOrdinate(n-1,ae.Y)?t:r.createClosedRing(e,t,n+1)}},{key:"indexOf",value:function(e,t){for(var n=0;n<t.size();n++)if(e.x===t.getOrdinate(n,ae.X)&&e.y===t.getOrdinate(n,ae.Y))return n;return-1}},{key:"createClosedRing",value:function(e,t,n){var i=e.create(n,t.getDimension()),s=t.size();r.copy(t,0,i,0,s);for(var o=s;o<n;o++)r.copy(t,0,i,o,1);return i}},{key:"minCoordinate",value:function(e){for(var t=null,n=0;n<e.size();n++){var i=e.getCoordinate(n);(t===null||t.compareTo(i)>0)&&(t=i)}return t}}]),r}(),Y=function(){function r(){a(this,r)}return h(r,null,[{key:"toDimensionSymbol",value:function(e){switch(e){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 D("Unknown dimension value: "+e)}},{key:"toDimensionValue",value:function(e){switch(ai.toUpperCase(e)){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 D("Unknown dimension symbol: "+e)}}]),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 Rn=function(){function r(){a(this,r)}return h(r,[{key:"filter",value:function(e){}}]),r}(),On=function(){function r(){a(this,r)}return h(r,[{key:"filter",value:function(e,t){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),r}(),Jt=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new ye:this._points.expandEnvelope(new ye)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new t(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 L(d(t.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();_t.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 _t.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 yu.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],k=v;return y.compare(this._points,k._points)}}},{key:"apply",value:function(){if(ee(arguments[0],Cn))for(var n=arguments[0],i=0;i<this._points.size();i++)n.filter(this._points.getCoordinate(i));else if(ee(arguments[0],On)){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(ee(arguments[0],Rn)){var c=arguments[0];c.filter(this)}else if(ee(arguments[0],B)){var v=arguments[0];v.filter(this)}}},{key:"getBoundary",value:function(){throw new gt}},{key:"isEquivalentClass",value:function(n){return n instanceof t}},{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 D("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[Yr]}}],[{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)}}}}]),t}($),zr=function r(){a(this,r)},li=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new ye;var n=new ye;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 t(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 L(d(t.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(ee(arguments[0],Cn)){var n=arguments[0];if(this.isEmpty())return null;n.filter(this.getCoordinate())}else if(ee(arguments[0],On)){var i=arguments[0];if(this.isEmpty())return null;i.filter(this._coordinates,0),i.isGeometryChanged()&&this.geometryChanged()}else if(ee(arguments[0],Rn)){var s=arguments[0];s.filter(this)}else if(ee(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([])),ie.isTrue(n.size()<=1),this._coordinates=n}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[zr]}}],[{key:"constructor_",value:function(){this._coordinates=null;var n=arguments[0],i=arguments[1];$.constructor_.call(this,i),this.init(n)}}]),t}($),Br=function(){function r(){a(this,r)}return h(r,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var e=arguments[0];return Math.abs(r.ofRingSigned(e))}if(ee(arguments[0],ae)){var t=arguments[0];return Math.abs(r.ofRingSigned(t))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var e=arguments[0];if(e.length<3)return 0;for(var t=0,n=e[0].x,i=1;i<e.length-1;i++){var s=e[i].x-n,o=e[i+1].y,c=e[i-1].y;t+=s*(c-o)}return t/2}if(ee(arguments[0],ae)){var v=arguments[0],y=v.size();if(y<3)return 0;var k=new T,S=new T,C=new T;v.getCoordinate(0,S),v.getCoordinate(1,C);var F=S.x;C.x-=F;for(var A=0,Z=1;Z<y-1;Z++)k.y=S.y,S.x=C.x,S.y=C.y,v.getCoordinate(Z+1,C),C.x-=F,A+=S.x*(k.y-C.y);return A/2}}}]),r}(),xt=function(){function r(){a(this,r)}return h(r,null,[{key:"sort",value:function(){var e=arguments,t=arguments[0];if(arguments.length===1)t.sort(function(F,A){return F.compareTo(A)});else if(arguments.length===2)t.sort(function(F,A){return e[1].compare(F,A)});else if(arguments.length===3){var n=t.slice(arguments[1],arguments[2]);n.sort();var i=t.slice(0,arguments[1]).concat(n,t.slice(arguments[2],t.length));t.splice(0,t.length);var s,o=b(i);try{for(o.s();!(s=o.n()).done;){var c=s.value;t.push(c)}}catch(F){o.e(F)}finally{o.f()}}else if(arguments.length===4){var v=t.slice(arguments[1],arguments[2]);v.sort(function(F,A){return e[3].compare(F,A)});var y=t.slice(0,arguments[1]).concat(v,t.slice(arguments[2],t.length));t.splice(0,t.length);var k,S=b(y);try{for(S.s();!(k=S.n()).done;){var C=k.value;t.push(C)}}catch(F){S.e(F)}finally{S.f()}}}},{key:"asList",value:function(e){var t,n=new W,i=b(e);try{for(i.s();!(t=i.n()).done;){var s=t.value;n.add(s)}}catch(o){i.e(o)}finally{i.f()}return n}},{key:"copyOf",value:function(e,t){return e.slice(0,t)}}]),r}(),Xr=function r(){a(this,r)},bn=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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+=Br.ofRing(this._shell.getCoordinateSequence());for(var i=0;i<this._holes.length;i++)n-=Br.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 t(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),k=1;k<=4;k++){var S=n.getX(k),C=n.getY(k);if(S!==v==(C!==y))return!1;v=S,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 L(d(t.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);xt.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=_t.minCoordinateIndex(o,0,o.size()-2);_t.scroll(o,c,!0),K.isCCW(o)===s&&_t.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,k=v._shell,S=y.compareToSameClass(k,c);if(S!==0)return S;for(var C=this.getNumInteriorRing(),F=v.getNumInteriorRing(),A=0;A<C&&A<F;){var Z=this.getInteriorRingN(A),j=v.getInteriorRingN(A),J=Z.compareToSameClass(j,c);if(J!==0)return J;A++}return A<C?1:A<F?-1:0}}},{key:"apply",value:function(){if(ee(arguments[0],Cn)){var n=arguments[0];this._shell.apply(n);for(var i=0;i<this._holes.length;i++)this._holes[i].apply(n)}else if(ee(arguments[0],On)){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(ee(arguments[0],Rn)){var c=arguments[0];c.filter(this)}else if(ee(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[Xr]}}],[{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 D("holes must not contain null elements");if(n.isEmpty()&&$.hasNonEmptyElements(i))throw new D("shell is empty but holes are not");this._shell=n,this._holes=i}}]),t}($),mu=function(r){g(t,r);var e=E(t);function t(){return a(this,t),e.apply(this,arguments)}return t}(Dr),Ur=function(r){g(t,r);var e=E(t);function t(n){var i;return a(this,t),(i=e.call(this)).array=[],n instanceof je&&i.addAll(n),i}return h(t,[{key:"contains",value:function(n){var i,s=b(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=b(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 gt}},{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 du(this.array)}}]),t}(mu),du=function(){function r(e){a(this,r),this.array=e,this.position=0}return h(r,[{key:"next",value:function(){if(this.position===this.array.length)throw new Ln;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new gt}}]),r}(),Oe=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"computeEnvelopeInternal",value:function(){for(var n=new ye,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 t(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 L(d(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var n=0;n<this._geometries.length;n++)this._geometries[n].normalize();xt.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 Ur(xt.asList(this._geometries)),s=new Ur(xt.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(),k=v.getNumGeometries(),S=0;S<y&&S<k;){var C=this.getGeometryN(S),F=v.getGeometryN(S),A=C.compareToSameClass(F,c);if(A!==0)return A;S++}return S<y?1:S<k?-1:0}}},{key:"apply",value:function(){if(ee(arguments[0],Cn))for(var n=arguments[0],i=0;i<this._geometries.length;i++)this._geometries[i].apply(n);else if(ee(arguments[0],On)){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(ee(arguments[0],Rn)){var c=arguments[0];c.filter(this);for(var v=0;v<this._geometries.length;v++)this._geometries[v].apply(c)}else if(ee(arguments[0],B)){var y=arguments[0];y.filter(this);for(var k=0;k<this._geometries.length;k++)this._geometries[k].apply(y)}}},{key:"getBoundary",value:function(){return $.checkNotGeometryCollection(this),ie.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 D("geometries must not contain null elements");this._geometries=n}}}}]),t}($),hi=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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 t(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)&&L(d(t.prototype),"equalsExact",this).call(this,n,i)}return L(d(t.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 L(d(t.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[zr]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Oe.constructor_.call(this,n,i)}}]),t}(Oe),en=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return Y.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||L(d(t.prototype),"isClosed",this).call(this)}},{key:"reverseInternal",value:function(){var n=this._points.copy();return _t.reverse(n),this.getFactory().createLinearRing(n)}},{key:"getTypeCode",value:function(){return $.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!L(d(t.prototype),"isClosed",this).call(this))throw new D("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new D("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];Jt.constructor_.call(this,n,i),this.validateConstruction()}}]),t}(Jt);en.MINIMUM_VALID_SIZE=4;var kt=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"setOrdinate",value:function(n,i){switch(n){case t.X:this.x=i;break;case t.Y:this.y=i;break;default:throw new D("Invalid ordinate index: "+n)}}},{key:"getZ",value:function(){return T.NULL_ORDINATE}},{key:"getOrdinate",value:function(n){switch(n){case t.X:return this.x;case t.Y:return this.y}throw new D("Invalid ordinate index: "+n)}},{key:"setZ",value:function(n){throw new D("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(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 t){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)}}}]),t}(T);kt.X=0,kt.Y=1,kt.Z=-1,kt.M=-1;var Et=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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.M:this._m=i;break;default:throw new D("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 t.X:return this.x;case t.Y:return this.y;case t.M:return this._m}throw new D("Invalid ordinate index: "+n)}},{key:"setZ",value:function(n){throw new D("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(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 t){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}}}]),t}(T);Et.X=0,Et.Y=1,Et.Z=-1,Et.M=2;var ci=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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 D("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 D("Invalid ordinate index: "+n)}},{key:"copy",value:function(){return new t(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 t){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}}}]),t}(T),Mn=function(){function r(){a(this,r)}return h(r,null,[{key:"measures",value:function(e){return e instanceof kt?0:e instanceof Et||e instanceof ci?1:0}},{key:"dimension",value:function(e){return e instanceof kt?2:e instanceof Et?3:e instanceof ci?4:3}},{key:"create",value:function(){if(arguments.length===1){var e=arguments[0];return r.create(e,0)}if(arguments.length===2){var t=arguments[0],n=arguments[1];return t===2?new kt:t===3&&n===0?new T:t===3&&n===1?new Et:t===4&&n===1?new ci:new T}}}]),r}(),tn=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"getCoordinate",value:function(n){return this.get(n)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&ee(arguments[0],je)){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 L(d(t.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var n=L(d(t.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(t.coordArrayType);if(arguments.length===1){var n=arguments[0];if(n)return this.toArray(t.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 L(d(t.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}L(d(t.prototype),"add",this).call(this,o)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var y=arguments[0],k=arguments[1];return this.add(y,k),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var S=arguments[0],C=arguments[1],F=arguments[2];if(F)for(var A=0;A<S.length;A++)this.add(S[A],C);else for(var Z=S.length-1;Z>=0;Z--)this.add(S[Z],C);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof T){var j=arguments[0],J=arguments[1],ce=arguments[2];if(!ce){var _e=this.size();if(_e>0){if(j>0){var Se=this.get(j-1);if(Se.equals2D(J))return null}if(j<_e){var Pe=this.get(j);if(Pe.equals2D(J))return null}}}L(d(t.prototype),"add",this).call(this,j,J)}}else if(arguments.length===4){var He=arguments[0],st=arguments[1],wt=arguments[2],un=arguments[3],on=1;wt>un&&(on=-1);for(var zt=wt;zt!==un;zt+=on)this.add(He[zt],st);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)}}}}]),t}(W);tn.coordArrayType=new Array(0).fill(null);var xe=function(){function r(){a(this,r)}return h(r,null,[{key:"isRing",value:function(e){return!(e.length<4)&&!!e[0].equals2D(e[e.length-1])}},{key:"ptNotInList",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(r.indexOf(i,t)<0)return i}return null}},{key:"scroll",value:function(e,t){var n=r.indexOf(t,e);if(n<0)return null;var i=new Array(e.length).fill(null);Ge.arraycopy(e,n,i,0,e.length-n),Ge.arraycopy(e,0,i,e.length-n,n),Ge.arraycopy(i,0,e,0,e.length)}},{key:"equals",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(e===t)return!0;if(e===null||t===null||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].equals(t[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(e,t){for(var n=new tn,i=0;i<e.length;i++)t.intersects(e[i])&&n.add(e[i],!0);return n.toCoordinateArray()}},{key:"measures",value:function(e){if(e===null||e.length===0)return 0;var t,n=0,i=b(e);try{for(i.s();!(t=i.n()).done;){var s=t.value;n=Math.max(n,Mn.measures(s))}}catch(o){i.e(o)}finally{i.f()}return n}},{key:"hasRepeatedPoints",value:function(e){for(var t=1;t<e.length;t++)if(e[t-1].equals(e[t]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(e){return r.hasRepeatedPoints(e)?new tn(e,!1).toCoordinateArray():e}},{key:"reverse",value:function(e){for(var t=e.length-1,n=Math.trunc(t/2),i=0;i<=n;i++){var s=e[i];e[i]=e[t-i],e[t-i]=s}}},{key:"removeNull",value:function(e){for(var t=0,n=0;n<e.length;n++)e[n]!==null&&t++;var i=new Array(t).fill(null);if(t===0)return i;for(var s=0,o=0;o<e.length;o++)e[o]!==null&&(i[s++]=e[o]);return i}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var e=arguments[0],t=new Array(e.length).fill(null),n=0;n<e.length;n++)t[n]=e[n].copy();return t}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(e,t){for(var n=0;n<e.length;n++){var i=e[n],s=t[e.length-n-1];if(i.compareTo(s)!==0)return!1}return!0}},{key:"envelope",value:function(e){for(var t=new ye,n=0;n<e.length;n++)t.expandToInclude(e[n]);return t}},{key:"toCoordinateArray",value:function(e){return e.toArray(r.coordArrayType)}},{key:"dimension",value:function(e){if(e===null||e.length===0)return 3;var t,n=0,i=b(e);try{for(i.s();!(t=i.n()).done;){var s=t.value;n=Math.max(n,Mn.dimension(s))}}catch(o){i.e(o)}finally{i.f()}return n}},{key:"atLeastNCoordinatesOrNothing",value:function(e,t){return t.length>=e?t:[]}},{key:"indexOf",value:function(e,t){for(var n=0;n<t.length;n++)if(e.equals(t[n]))return n;return-1}},{key:"increasingDirection",value:function(e){for(var t=0;t<Math.trunc(e.length/2);t++){var n=e.length-1-t,i=e[t].compareTo(e[n]);if(i!==0)return i}return 1}},{key:"compare",value:function(e,t){for(var n=0;n<e.length&&n<t.length;){var i=e[n].compareTo(t[n]);if(i!==0)return i;n++}return n<t.length?-1:n<e.length?1:0}},{key:"minCoordinate",value:function(e){for(var t=null,n=0;n<e.length;n++)(t===null||t.compareTo(e[n])>0)&&(t=e[n]);return t}},{key:"extract",value:function(e,t,n){t=Kt.clamp(t,0,e.length);var i=(n=Kt.clamp(n,-1,e.length))-t+1;n<0&&(i=0),t>=e.length&&(i=0),n<t&&(i=0);var s=new Array(i).fill(null);if(i===0)return s;for(var o=0,c=t;c<=n;c++)s[o++]=e[c];return s}}]),r}(),pu=function(){function r(){a(this,r)}return h(r,[{key:"compare",value:function(e,t){var n=e,i=t;return xe.compare(n,i)}},{key:"interfaces_",get:function(){return[Te]}}]),r}(),_u=function(){function r(){a(this,r)}return h(r,[{key:"compare",value:function(e,t){var n=e,i=t;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;var s=xe.compare(n,i);return xe.isEqualReversed(n,i)?0:s}},{key:"OLDcompare",value:function(e,t){var n=e,i=t;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;for(var s=xe.increasingDirection(n),o=xe.increasingDirection(i),c=s>0?0:n.length-1,v=o>0?0:n.length-1,y=0;y<n.length;y++){var k=n[c].compareTo(i[v]);if(k!==0)return k;c+=s,v+=o}return 0}},{key:"interfaces_",get:function(){return[Te]}}]),r}();xe.ForwardComparator=pu,xe.BidirectionalComparator=_u,xe.coordArrayType=new Array(0).fill(null);var Pn=function(){function r(e){a(this,r),this.str=e}return h(r,[{key:"append",value:function(e){this.str+=e}},{key:"setCharAt",value:function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)}},{key:"toString",value:function(){return this.str}}]),r}(),nn=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getM",value:function(e){return this.hasM()?this._coordinates[e].getM():H.NaN}},{key:"setOrdinate",value:function(e,t,n){switch(t){case ae.X:this._coordinates[e].x=n;break;case ae.Y:this._coordinates[e].y=n;break;default:this._coordinates[e].setOrdinate(t,n)}}},{key:"getZ",value:function(e){return this.hasZ()?this._coordinates[e].getZ():H.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(e,t){switch(t){case ae.X:return this._coordinates[e].x;case ae.Y:return this._coordinates[e].y;default:return this._coordinates[e].getOrdinate(t)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var e=arguments[0];return this._coordinates[e]}if(arguments.length===2){var t=arguments[0],n=arguments[1];n.setCoordinate(this._coordinates[t])}}},{key:"getCoordinateCopy",value:function(e){var t=this.createCoordinate();return t.setCoordinate(this._coordinates[e]),t}},{key:"createCoordinate",value:function(){return Mn.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(e){return this._coordinates[e].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(e){for(var t=0;t<this._coordinates.length;t++)e.expandToInclude(this._coordinates[t]);return e}},{key:"copy",value:function(){for(var e=new Array(this.size()).fill(null),t=0;t<this._coordinates.length;t++){var n=this.createCoordinate();n.setCoordinate(this._coordinates[t]),e[t]=n}return new r(e,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var e=new Pn(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var t=1;t<this._coordinates.length;t++)e.append(", "),e.append(this._coordinates[t]);return e.append(")"),e.toString()}return"()"}},{key:"getY",value:function(e){return this._coordinates[e].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[ae,U]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];r.constructor_.call(this,e,xe.dimension(e),xe.measures(e))}else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n<t;n++)this._coordinates[n]=new T}else if(ee(arguments[0],ae)){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,xe.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 k=0;k<v;k++)this._coordinates[k]=Mn.create(y)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var S=arguments[0],C=arguments[1],F=arguments[2];this._dimension=C,this._measures=F,this._coordinates=S===null?new Array(0).fill(null):S}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var A=arguments[0],Z=arguments[1],j=arguments[2];this._coordinates=new Array(A).fill(null),this._dimension=Z,this._measures=j;for(var J=0;J<A;J++)this._coordinates[J]=this.createCoordinate()}}}}]),r}(),fi=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 e=arguments[0];return new nn(e)}if(ee(arguments[0],ae)){var t=arguments[0];return new nn(t)}}else{if(arguments.length===2){var n=arguments[0],i=arguments[1];return i>3&&(i=3),i<2&&(i=2),new nn(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 nn(s,v+c,c)}}}},{key:"interfaces_",get:function(){return[qr,U]}}],[{key:"instance",value:function(){return r.instanceObject}}]),r}();fi.instanceObject=new fi;var gi=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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 t(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)&&L(d(t.prototype),"equalsExact",this).call(this,n,i)}return L(d(t.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[Xr]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Oe.constructor_.call(this,n,i)}}]),t}(Oe),Vr=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}(),xu=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),(n=e.call(this)).map=new Map,n}return h(t,[{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 si;return this.map.entries().forEach(function(i){return n.add(i)}),n}},{key:"size",value:function(){return this.map.size()}}]),t}(Vr),Ue=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"equals",value:function(e){if(!(e instanceof r))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale}},{key:"compareTo",value:function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return Tn.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 e="UNKNOWN";return this._modelType===r.FLOATING?e="Floating":this._modelType===r.FLOATING_SINGLE?e="Floating-Single":this._modelType===r.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var e=arguments[0];return H.isNaN(e)||this._modelType===r.FLOATING_SINGLE?e:this._modelType===r.FIXED?Math.round(e*this._scale)/this._scale:e}if(arguments[0]instanceof T){var t=arguments[0];if(this._modelType===r.FLOATING)return null;t.x=this.makePrecise(t.x),t.y=this.makePrecise(t.y)}}},{key:"getMaximumSignificantDigits",value:function(){var e=16;return this._modelType===r.FLOATING?e=16:this._modelType===r.FLOATING_SINGLE?e=6:this._modelType===r.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e}},{key:"setScale",value:function(e){this._scale=Math.abs(e)}},{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 Pt){var e=arguments[0];this._modelType=e,e===r.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var t=arguments[0];this._modelType=r.FIXED,this.setScale(t)}else if(arguments[0]instanceof r){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}}},{key:"mostPrecise",value:function(e,t){return e.compareTo(t)>=0?e:t}}]),r}(),Pt=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 e=arguments[0];this._name=e,r.nameToTypeMap.put(e,this)}}]),r}();Pt.nameToTypeMap=new xu,Ue.Type=Pt,Ue.FIXED=new Pt("FIXED"),Ue.FLOATING=new Pt("FLOATING"),Ue.FLOATING_SINGLE=new Pt("FLOATING SINGLE"),Ue.maximumPreciseValue=9007199254740992;var vi=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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 t(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)&&L(d(t.prototype),"equalsExact",this).call(this,n,i)}return L(d(t.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 gt}},{key:"getGeometryType",value:function(){return $.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[Yr]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Oe.constructor_.call(this,n,i)}}]),t}(Oe),At=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"createEmpty",value:function(e){switch(e){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new D("Invalid dimension: "+e)}}},{key:"toGeometry",value:function(e){return e.isNull()?this.createPoint():e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new T(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new T(e.getMinX(),e.getMinY()),new T(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new T(e.getMinX(),e.getMinY()),new T(e.getMinX(),e.getMaxY()),new T(e.getMaxX(),e.getMaxY()),new T(e.getMaxX(),e.getMinY()),new T(e.getMinX(),e.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 e=arguments[0];return this.createLineString(e!==null?this.getCoordinateSequenceFactory().create(e):null)}if(ee(arguments[0],ae)){var t=arguments[0];return new Jt(t,this)}}}},{key:"createMultiLineString",value:function(){if(arguments.length===0)return new vi(null,this);if(arguments.length===1){var e=arguments[0];return new vi(e,this)}}},{key:"buildGeometry",value:function(e){for(var t=null,n=!1,i=!1,s=e.iterator();s.hasNext();){var o=s.next(),c=o.getTypeCode();t===null&&(t=c),c!==t&&(n=!0),o instanceof Oe&&(i=!0)}if(t===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(r.toGeometryArray(e));var v=e.iterator().next();if(e.size()>1){if(v instanceof bn)return this.createMultiPolygon(r.toPolygonArray(e));if(v instanceof Jt)return this.createMultiLineString(r.toLineStringArray(e));if(v instanceof li)return this.createMultiPoint(r.toPointArray(e));ie.shouldNeverReachHere("Unhandled geometry type: "+v.getGeometryType())}return v}},{key:"createMultiPointFromCoords",value:function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):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 e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}if(ee(arguments[0],ae)){var t=arguments[0];return new li(t,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(ee(arguments[0],ae)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof en){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],s=arguments[1];return new bn(i,s,this)}}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){if(arguments.length===0)return new Oe(null,this);if(arguments.length===1){var e=arguments[0];return new Oe(e,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 e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}if(ee(arguments[0],ae)){var t=arguments[0];return new en(t,this)}}}},{key:"createMultiPolygon",value:function(){if(arguments.length===0)return new gi(null,this);if(arguments.length===1){var e=arguments[0];return new gi(e,this)}}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new hi(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new hi(e,this)}if(ee(arguments[0],ae)){var t=arguments[0];if(t===null)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(t.size()).fill(null),i=0;i<t.size();i++){var s=this.getCoordinateSequenceFactory().create(1,t.getDimension(),t.getMeasures());_t.copy(t,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 Ue,0);else if(arguments.length===1){if(ee(arguments[0],qr)){var e=arguments[0];r.constructor_.call(this,new Ue,0,e)}else if(arguments[0]instanceof Ue){var t=arguments[0];r.constructor_.call(this,t,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(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toGeometryArray",value:function(e){if(e===null)return null;var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return fi.instance()}},{key:"toMultiLineStringArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toLineStringArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toMultiPointArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toLinearRingArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toPointArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toPolygonArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"createPointFromInternalCoord",value:function(e,t){return t.getPrecisionModel().makePrecise(e),t.getFactory().createPoint(e)}}]),r}(),yi="XY",ku="XYZ",Eu="XYM",Iu="XYZM",Hr={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"},Zr="EMPTY",An=1,it=2,vt=3,$r=4,Dt=5,Nu=6;for(var wu in Hr)Hr[wu].toUpperCase();var Su=function(){function r(e){a(this,r),this.wkt=e,this.index_=-1}return h(r,[{key:"isAlpha_",value:function(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}},{key:"isNumeric_",value:function(e,t){return e>="0"&&e<="9"||e=="."&&!(t!==void 0&&t)}},{key:"isWhiteSpace_",value:function(e){return e==" "||e==" "||e=="\r"||e==`
|
|
26
|
-
`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var e,t=this.nextChar_(),n=this.index_,i=t;if(t=="(")e=it;else if(t==",")e=Dt;else if(t==")")e=vt;else if(this.isNumeric_(t)||t=="-")e=$r,i=this.readNumber_();else if(this.isAlpha_(t))e=An,i=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t!=="")throw new Error("Unexpected character: "+t);e=Nu}return{position:n,value:i,type:e}}},{key:"readNumber_",value:function(){var e,t=this.index_,n=!1,i=!1;do e=="."?n=!0:e!="e"&&e!="E"||(i=!0),e=this.nextChar_();while(this.isNumeric_(e,n)||!i&&(e=="e"||e=="E")||i&&(e=="-"||e=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}},{key:"readText_",value:function(){var e,t=this.index_;do e=this.nextChar_();while(this.isAlpha_(e));return this.wkt.substring(t,this.index_--).toUpperCase()}}]),r}(),Lu=function(){function r(e,t){a(this,r),this.lexer_=e,this.token_,this.layout_=yi,this.factory=t}return h(r,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(e){return this.token_.type==e}},{key:"match",value:function(e){var t=this.isTokenType(e);return t&&this.consume_(),t}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var e=yi,t=this.token_;if(this.isTokenType(An)){var n=t.value;n==="Z"?e=ku:n==="M"?e=Eu:n==="ZM"&&(e=Iu),e!==yi&&this.consume_()}return e}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(it)){var e=[];do e.push(this.parseGeometry_());while(this.match(Dt));if(this.match(vt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(it)){var e=this.parsePoint_();if(this.match(vt))return e}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(it)){var e=this.parsePointList_();if(this.match(vt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(it)){var e=this.parseLineStringTextList_();if(this.match(vt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var e;if(this.match(it)){if(e=this.token_.type==it?this.parsePointTextList_():this.parsePointList_(),this.match(vt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(it)){var e=this.parseLineStringTextList_();if(this.match(vt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(it)){var e=this.parsePolygonTextList_();if(this.match(vt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var e=[],t=this.layout_.length,n=0;n<t;++n){var i=this.token_;if(!this.match($r))break;e.push(i.value)}if(e.length==t)return e;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var e=[this.parsePoint_()];this.match(Dt);)e.push(this.parsePoint_());return e}},{key:"parsePointTextList_",value:function(){for(var e=[this.parsePointText_()];this.match(Dt);)e.push(this.parsePointText_());return e}},{key:"parseLineStringTextList_",value:function(){for(var e=[this.parseLineStringText_()];this.match(Dt);)e.push(this.parseLineStringText_());return e}},{key:"parsePolygonTextList_",value:function(){for(var e=[this.parsePolygonText_()];this.match(Dt);)e.push(this.parsePolygonText_());return e}},{key:"isEmptyGeometry_",value:function(){var e=this.isTokenType(An)&&this.token_.value==Zr;return e&&this.consume_(),e}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var e=this.factory,t=function(j){return _(T,M(j))},n=function(j){var J=j.map(function(ce){return e.createLinearRing(ce.map(t))});return J.length>1?e.createPolygon(J[0],J.slice(1)):e.createPolygon(J[0])},i=this.token_;if(this.match(An)){var s=i.value;if(this.layout_=this.parseGeometryLayout_(),s=="GEOMETRYCOLLECTION"){var o=this.parseGeometryCollectionText_();return e.createGeometryCollection(o)}switch(s){case"POINT":var c=this.parsePointText_();return c?e.createPoint(_(T,M(c))):e.createPoint();case"LINESTRING":var v=this.parseLineStringText_().map(t);return e.createLineString(v);case"LINEARRING":var y=this.parseLineStringText_().map(t);return e.createLinearRing(y);case"POLYGON":var k=this.parsePolygonText_();return k&&k.length!==0?n(k):e.createPolygon();case"MULTIPOINT":var S=this.parseMultiPointText_();if(!S||S.length===0)return e.createMultiPoint();var C=S.map(t).map(function(j){return e.createPoint(j)});return e.createMultiPoint(C);case"MULTILINESTRING":var F=this.parseMultiLineStringText_().map(function(j){return e.createLineString(j.map(t))});return e.createMultiLineString(F);case"MULTIPOLYGON":var A=this.parseMultiPolygonText_();if(!A||A.length===0)return e.createMultiPolygon();var Z=A.map(n);return e.createMultiPolygon(Z);default:throw new Error("Invalid geometry type: "+s)}}throw new Error(this.formatErrorMessage_())}}]),r}();function jr(r){if(r.isEmpty())return"";var e=r.getCoordinate(),t=[e.x,e.y];return e.z===void 0||Number.isNaN(e.z)||t.push(e.z),e.m===void 0||Number.isNaN(e.m)||t.push(e.m),t.join(" ")}function rn(r){for(var e=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}),t=[],n=0,i=e.length;n<i;++n)t.push(e[n].join(" "));return t.join(", ")}function Wr(r){var e=[];e.push("("+rn(r.getExteriorRing())+")");for(var t=0,n=r.getNumInteriorRing();t<n;++t)e.push("("+rn(r.getInteriorRingN(t))+")");return e.join(", ")}var Tu={Point:jr,LineString:rn,LinearRing:rn,Polygon:Wr,MultiPoint:function(r){for(var e=[],t=0,n=r.getNumGeometries();t<n;++t)e.push("("+jr(r.getGeometryN(t))+")");return e.join(", ")},MultiLineString:function(r){for(var e=[],t=0,n=r.getNumGeometries();t<n;++t)e.push("("+rn(r.getGeometryN(t))+")");return e.join(", ")},MultiPolygon:function(r){for(var e=[],t=0,n=r.getNumGeometries();t<n;++t)e.push("("+Wr(r.getGeometryN(t))+")");return e.join(", ")},GeometryCollection:function(r){for(var e=[],t=0,n=r.getNumGeometries();t<n;++t)e.push(Qr(r.getGeometryN(t)));return e.join(", ")}};function Qr(r){var e=r.getGeometryType(),t=Tu[e];e=e.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&&(e+=" "+n),r.isEmpty()?e+" "+Zr:e+" ("+t(r)+")"}var Cu=function(){function r(e){a(this,r),this.geometryFactory=e||new At,this.precisionModel=this.geometryFactory.getPrecisionModel()}return h(r,[{key:"read",value:function(e){var t=new Su(e);return new Lu(t,this.geometryFactory).parse()}},{key:"write",value:function(e){return Qr(e)}}]),r}(),mi=function(){function r(e){a(this,r),this.parser=new Cu(e)}return h(r,[{key:"write",value:function(e){return this.parser.write(e)}}],[{key:"toLineString",value:function(e,t){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+e.x+" "+e.y+", "+t.x+" "+t.y+" )"}}]),r}(),me=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getIndexAlongSegment",value:function(e,t){return this.computeIntLineIndex(),this._intLineIndex[e][t]}},{key:"getTopologySummary",value:function(){var e=new Pn;return this.isEndPoint()&&e.append(" endpoint"),this._isProper&&e.append(" proper"),this.isCollinear()&&e.append(" collinear"),e.toString()}},{key:"computeIntersection",value:function(e,t,n,i){this._inputLines[0][0]=e,this._inputLines[0][1]=t,this._inputLines[1][0]=n,this._inputLines[1][1]=i,this._result=this.computeIntersect(e,t,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 e=arguments[0],t=this.getEdgeDistance(e,0),n=this.getEdgeDistance(e,1);t>n?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(e){this._precisionModel=e}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var e=arguments[0],t=0;t<this._result;t++)if(!this._intPt[t].equals2D(this._inputLines[e][0])&&!this._intPt[t].equals2D(this._inputLines[e][1]))return!0;return!1}}},{key:"getIntersection",value:function(e){return this._intPt[e]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==r.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(e,t){return r.computeEdgeDistance(this._intPt[t],this._inputLines[e][0],this._inputLines[e][1])}},{key:"isCollinear",value:function(){return this._result===r.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return mi.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+mi.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(e,t){return this._inputLines[e][t]}},{key:"isIntersection",value:function(e){for(var t=0;t<this._result;t++)if(this._intPt[t].equals2D(e))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(e,t){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[e][t]]}}],[{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(e,t,n){var i=Math.abs(n.x-t.x),s=Math.abs(n.y-t.y),o=-1;if(e.equals(t))o=0;else if(e.equals(n))o=i>s?i:s;else{var c=Math.abs(e.x-t.x),v=Math.abs(e.y-t.y);(o=i>s?c:v)!==0||e.equals(t)||(o=Math.max(c,v))}return ie.isTrue(!(o===0&&!e.equals(t)),"Bad distance calculation"),o}},{key:"nonRobustComputeEdgeDistance",value:function(e,t,n){var i=e.x-t.x,s=e.y-t.y,o=Math.sqrt(i*i+s*s);return ie.isTrue(!(o===0&&!e.equals(t)),"Invalid distance calculation"),o}}]),r}();me.DONT_INTERSECT=0,me.DO_INTERSECT=1,me.COLLINEAR=2,me.NO_INTERSECTION=0,me.POINT_INTERSECTION=1,me.COLLINEAR_INTERSECTION=2;var It=function(r){g(t,r);var e=E(t);function t(){return a(this,t),e.call(this)}return h(t,[{key:"isInSegmentEnvelopes",value:function(n){var i=new ye(this._inputLines[0][0],this._inputLines[0][1]),s=new ye(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&s.contains(n)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return L(d(t.prototype),"computeIntersection",this).apply(this,arguments);var n=arguments[0],i=arguments[1],s=arguments[2];if(this._isProper=!1,ye.intersects(i,s,n)&&K.index(i,s,n)===0&&K.index(s,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(s))&&(this._isProper=!1),this._result=me.POINT_INTERSECTION,null;this._result=me.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(t.nearestEndpoint(n,i,s,o))),this._precisionModel!==null&&this._precisionModel.makePrecise(c),c}},{key:"checkDD",value:function(n,i,s,o,c){var v=ui.intersection(n,i,s,o),y=this.isInSegmentEnvelopes(v);Ge.out.println("DD in env = "+y+" --------------------- "+v),c.distance(v)>1e-4&&Ge.out.println("Distance = "+c.distance(v))}},{key:"intersectionSafe",value:function(n,i,s,o){var c=oi.intersection(n,i,s,o);return c===null&&(c=t.nearestEndpoint(n,i,s,o)),c}},{key:"computeCollinearIntersection",value:function(n,i,s,o){var c=ye.intersects(n,i,s),v=ye.intersects(n,i,o),y=ye.intersects(s,o,n),k=ye.intersects(s,o,i);return c&&v?(this._intPt[0]=s,this._intPt[1]=o,me.COLLINEAR_INTERSECTION):y&&k?(this._intPt[0]=n,this._intPt[1]=i,me.COLLINEAR_INTERSECTION):c&&y?(this._intPt[0]=s,this._intPt[1]=n,!s.equals(n)||v||k?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):c&&k?(this._intPt[0]=s,this._intPt[1]=i,!s.equals(i)||v||y?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):v&&y?(this._intPt[0]=o,this._intPt[1]=n,!o.equals(n)||c||k?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):v&&k?(this._intPt[0]=o,this._intPt[1]=i,!o.equals(i)||c||y?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):me.NO_INTERSECTION}},{key:"computeIntersect",value:function(n,i,s,o){if(this._isProper=!1,!ye.intersects(n,i,s,o))return me.NO_INTERSECTION;var c=K.index(n,i,s),v=K.index(n,i,o);if(c>0&&v>0||c<0&&v<0)return me.NO_INTERSECTION;var y=K.index(s,o,n),k=K.index(s,o,i);return y>0&&k>0||y<0&&k<0?me.NO_INTERSECTION:c===0&&v===0&&y===0&&k===0?this.computeCollinearIntersection(n,i,s,o):(c===0||v===0||y===0||k===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):k===0&&(this._intPt[0]=new T(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,s,o)),me.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(n,i,s,o){var c=n,v=We.pointToSegment(n,s,o),y=We.pointToSegment(i,s,o);return y<v&&(v=y,c=i),(y=We.pointToSegment(s,n,i))<v&&(v=y,c=s),(y=We.pointToSegment(o,n,i))<v&&(v=y,c=o),c}}]),t}(me),Ru=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"countSegment",value:function(e,t){if(e.x<this._p.x&&t.x<this._p.x)return null;if(this._p.x===t.x&&this._p.y===t.y)return this._isPointOnSegment=!0,null;if(e.y===this._p.y&&t.y===this._p.y){var n=e.x,i=t.x;return n>i&&(n=t.x,i=e.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var s=K.index(e,t,this._p);if(s===K.COLLINEAR)return this._isPointOnSegment=!0,null;t.y<e.y&&(s=-s),s===K.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==x.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?x.BOUNDARY:this._crossingCount%2==1?x.INTERIOR:x.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof T&&ee(arguments[1],ae)){for(var e=arguments[0],t=arguments[1],n=new r(e),i=new T,s=new T,o=1;o<t.size();o++)if(t.getCoordinate(o,i),t.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),k=1;k<v.length;k++){var S=v[k],C=v[k-1];if(y.countSegment(S,C),y.isOnSegment())return y.getLocation()}return y.getLocation()}}}]),r}(),di=function(){function r(){a(this,r)}return h(r,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof T&&ee(arguments[1],ae)){for(var e=arguments[0],t=arguments[1],n=new It,i=new T,s=new T,o=t.size(),c=1;c<o;c++)if(t.getCoordinate(c-1,i),t.getCoordinate(c,s),n.computeIntersection(e,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],k=new It,S=1;S<y.length;S++){var C=y[S-1],F=y[S];if(k.computeIntersection(v,C,F),k.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(e,t){return Ru.locatePointInRing(e,t)}},{key:"isInRing",value:function(e,t){return r.locateInRing(e,t)!==x.EXTERIOR}}]),r}(),qe=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"setAllLocations",value:function(e){for(var t=0;t<this.location.length;t++)this.location[t]=e}},{key:"isNull",value:function(){for(var e=0;e<this.location.length;e++)if(this.location[e]!==x.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(e){for(var t=0;t<this.location.length;t++)this.location[t]===x.NONE&&(this.location[t]=e)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(e){if(e.location.length>this.location.length){var t=new Array(3).fill(null);t[q.ON]=this.location[q.ON],t[q.LEFT]=x.NONE,t[q.RIGHT]=x.NONE,this.location=t}for(var n=0;n<this.location.length;n++)this.location[n]===x.NONE&&n<e.location.length&&(this.location[n]=e.location[n])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var e=this.location[q.LEFT];this.location[q.LEFT]=this.location[q.RIGHT],this.location[q.RIGHT]=e}},{key:"toString",value:function(){var e=new Qt;return this.location.length>1&&e.append(x.toLocationSymbol(this.location[q.LEFT])),e.append(x.toLocationSymbol(this.location[q.ON])),this.location.length>1&&e.append(x.toLocationSymbol(this.location[q.RIGHT])),e.toString()}},{key:"setLocations",value:function(e,t,n){this.location[q.ON]=e,this.location[q.LEFT]=t,this.location[q.RIGHT]=n}},{key:"get",value:function(e){return e<this.location.length?this.location[e]:x.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var e=0;e<this.location.length;e++)if(this.location[e]===x.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var e=arguments[0];this.setLocation(q.ON,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.location[t]=n}}},{key:"init",value:function(e){this.location=new Array(e).fill(null),this.setAllLocations(x.NONE)}},{key:"isEqualOnSide",value:function(e,t){return this.location[t]===e.location[t]}},{key:"allPositionsEqual",value:function(e){for(var t=0;t<this.location.length;t++)if(this.location[t]!==e)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var t=arguments[0];this.init(1),this.location[q.ON]=t}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[q.ON]=s,this.location[q.LEFT]=o,this.location[q.RIGHT]=c}}}]),r}(),Ye=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getGeometryCount",value:function(){var e=0;return this.elt[0].isNull()||e++,this.elt[1].isNull()||e++,e}},{key:"setAllLocations",value:function(e,t){this.elt[e].setAllLocations(t)}},{key:"isNull",value:function(e){return this.elt[e].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var e=arguments[0];this.setAllLocationsIfNull(0,e),this.setAllLocationsIfNull(1,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.elt[t].setAllLocationsIfNull(n)}}},{key:"isLine",value:function(e){return this.elt[e].isLine()}},{key:"merge",value:function(e){for(var t=0;t<2;t++)this.elt[t]===null&&e.elt[t]!==null?this.elt[t]=new qe(e.elt[t]):this.elt[t].merge(e.elt[t])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var e=arguments[0];return this.elt[e].get(q.ON)}if(arguments.length===2){var t=arguments[0],n=arguments[1];return this.elt[t].get(n)}}},{key:"toString",value:function(){var e=new Qt;return this.elt[0]!==null&&(e.append("A:"),e.append(this.elt[0].toString())),this.elt[1]!==null&&(e.append(" B:"),e.append(this.elt[1].toString())),e.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var e=arguments[0];return this.elt[e].isArea()}}},{key:"isAnyNull",value:function(e){return this.elt[e].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.elt[e].setLocation(q.ON,t)}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(e,t){return this.elt[0].isEqualOnSide(e.elt[0],t)&&this.elt[1].isEqualOnSide(e.elt[1],t)}},{key:"allPositionsEqual",value:function(e,t){return this.elt[e].allPositionsEqual(t)}},{key:"toLine",value:function(e){this.elt[e].isArea()&&(this.elt[e]=new qe(this.elt[e].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new qe(e),this.elt[1]=new qe(e)}else if(arguments[0]instanceof r){var t=arguments[0];this.elt[0]=new qe(t.elt[0]),this.elt[1]=new qe(t.elt[1])}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[0]=new qe(x.NONE),this.elt[1]=new qe(x.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 qe(s,o,c),this.elt[1]=new qe(s,o,c)}else if(arguments.length===4){var v=arguments[0],y=arguments[1],k=arguments[2],S=arguments[3];this.elt[0]=new qe(x.NONE,x.NONE,x.NONE),this.elt[1]=new qe(x.NONE,x.NONE,x.NONE),this.elt[v].setLocations(y,k,S)}}},{key:"toLineLabel",value:function(e){for(var t=new r(x.NONE),n=0;n<2;n++)t.setLocation(n,e.getLocation(n));return t}}]),r}(),Dn=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 e=new Array(this._pts.size()).fill(null),t=0;t<this._pts.size();t++)e[t]=this._pts.get(t);this._ring=this._geometryFactory.createLinearRing(e),this._isHole=K.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(e){this._startDe=e;var t=e,n=!0;do{if(t===null)throw new nt("Found null DirectedEdge");if(t.getEdgeRing()===this)throw new nt("Directed Edge visited twice during ring-building at "+t.getCoordinate());this._edges.add(t);var i=t.getLabel();ie.isTrue(i.isArea()),this.mergeLabel(i),this.addPoints(t.getEdge(),t.isForward(),n),n=!1,this.setEdgeRing(t,this),t=this.getNext(t)}while(t!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(e){return this._pts.get(e)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var e=this._startDe;do{var t=e.getNode().getEdges().getOutgoingDegree(this);t>this._maxNodeDegree&&(this._maxNodeDegree=t),e=this.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(e,t,n){var i=e.getCoordinates();if(t){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 e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)}},{key:"containsPoint",value:function(e){var t=this.getLinearRing();if(!t.getEnvelopeInternal().contains(e)||!di.isInRing(e,t.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(e))return!1;return!0}},{key:"addHole",value:function(e){this._holes.add(e)}},{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 e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(n,q.RIGHT);if(i===x.NONE)return null;if(this._label.getLocation(n)===x.NONE)return this._label.setLocation(n,i),null}}},{key:"setShell",value:function(e){this._shell=e,e!==null&&e.addHole(this)}},{key:"toPolygon",value:function(e){for(var t=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)t[n]=this._holes.get(n).getLinearRing();return e.createPolygon(this.getLinearRing(),t)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new W,this._pts=new W,this._label=new Ye(x.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 e=arguments[0],t=arguments[1];this._geometryFactory=t,this.computePoints(e),this.computeRing()}}}}]),r}(),Ou=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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];Dn.constructor_.call(this,n,i)}}]),t}(Dn),bu=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"buildMinimalRings",value:function(){var n=new W,i=this._startDe;do{if(i.getMinEdgeRing()===null){var s=new Ou(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];Dn.constructor_.call(this,n,i)}}]),t}(Dn),Kr=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"setVisited",value:function(e){this._isVisited=e}},{key:"setInResult",value:function(e){this._isInResult=e}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(e){this._label=e}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(e){this._isCovered=e,this._isCoveredSet=!0}},{key:"updateIM",value:function(e){ie.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(e)}},{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 e=arguments[0];this._label=e}}}}]),r}(),Fn=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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=x.NONE;if(s=this._label.getLocation(i),!n.isNull(i)){var o=n.getLocation(i);s!==x.BOUNDARY&&(s=o)}return s}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return L(d(t.prototype),"setLabel",this).apply(this,arguments);var n=arguments[0],i=arguments[1];this._label===null?this._label=new Ye(n,i):this._label.setLocation(n,i)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof t){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof Ye)for(var i=arguments[0],s=0;s<2;s++){var o=this.computeMergedLocation(i,s),c=this._label.getLocation(s);c===x.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=x.NONE;this._label!==null&&(i=this._label.getLocation(n));var s=null;switch(i){case x.BOUNDARY:s=x.INTERIOR;break;case x.INTERIOR:default:s=x.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 Ye(0,x.NONE)}}]),t}(Kr),Mu=function(r){g(t,r);var e=E(t);function t(){return a(this,t),e.apply(this,arguments)}return t}(Vr);function Jr(r){return r==null?0:r.color}function he(r){return r==null?null:r.parent}function Qe(r,e){r!==null&&(r.color=e)}function pi(r){return r==null?null:r.left}function es(r){return r==null?null:r.right}var sn=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),(n=e.call(this)).root_=null,n.size_=0,n}return h(t,[{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;)he(n)===pi(he(he(n)))?Jr(i=es(he(he(n))))===1?(Qe(he(n),0),Qe(i,0),Qe(he(he(n)),1),n=he(he(n))):(n===es(he(n))&&(n=he(n),this.rotateLeft(n)),Qe(he(n),0),Qe(he(he(n)),1),this.rotateRight(he(he(n)))):Jr(i=pi(he(he(n))))===1?(Qe(he(n),0),Qe(i,0),Qe(he(he(n)),1),n=he(he(n))):(n===pi(he(n))&&(n=he(n),this.rotateRight(n)),Qe(he(n),0),Qe(he(he(n)),1),this.rotateLeft(he(he(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=t.successor(i))!==null;)n.add(i.value);return n}},{key:"entrySet",value:function(){var n=new si,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=t.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}}]),t}(Mu),ts=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"find",value:function(e){return this.nodeMap.get(e)}},{key:"addNode",value:function(){if(arguments[0]instanceof T){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}if(arguments[0]instanceof Fn){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(e){for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(e){for(var t=new W,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(e)===x.BOUNDARY&&t.add(i)}return t}},{key:"add",value:function(e){var t=e.getCoordinate();this.addNode(t).add(e)}}],[{key:"constructor_",value:function(){this.nodeMap=new sn,this.nodeFact=null;var e=arguments[0];this.nodeFact=e}}]),r}(),Ce=function(){function r(){a(this,r)}return h(r,null,[{key:"isNorthern",value:function(e){return e===r.NE||e===r.NW}},{key:"isOpposite",value:function(e,t){return e!==t&&(e-t+4)%4===2}},{key:"commonHalfPlane",value:function(e,t){if(e===t)return e;if((e-t+4)%4===2)return-1;var n=e<t?e:t;return n===0&&(e>t?e:t)===3?3:n}},{key:"isInHalfPlane",value:function(e,t){return t===r.SE?e===r.SE||e===r.SW:e===t||e===t+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new D("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?r.NE:r.SE:t>=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 D("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}();Ce.NE=0,Ce.NW=1,Ce.SW=2,Ce.SE=3;var ns=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"compareDirection",value:function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant<e._quadrant?-1:K.index(e._p0,e._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(e){this._node=e}},{key:"print",value:function(e){var t=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),s=n.substring(i+1);e.print(" "+s+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label)}},{key:"compareTo",value:function(e){var t=e;return this.compareDirection(t)}},{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 e=Math.atan2(this._dy,this._dx),t=this.getClass().getName(),n=t.lastIndexOf(".");return" "+t.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label}},{key:"computeLabel",value:function(e){}},{key:"init",value:function(e,t){this._p0=e,this._p1=t,this._dx=t.x-e.x,this._dy=t.y-e.y,this._quadrant=Ce.quadrant(this._dx,this._dy),ie.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 e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2];r.constructor_.call(this,t,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}(),_i=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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 Ye(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 nt("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,q.LEFT)===x.INTERIOR&&this._label.getLocation(i,q.RIGHT)===x.INTERIOR||(n=!1);return n}},{key:"setNextMin",value:function(n){this._nextMin=n}},{key:"print",value:function(n){L(d(t.prototype),"print",this).call(this,n),n.print(" "+this._depth[q.LEFT]+"/"+this._depth[q.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,x.EXTERIOR),s=!this._label.isArea(1)||this._label.allPositionsEqual(1,x.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===q.LEFT&&(o=-1);var c=q.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(ns.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===x.EXTERIOR&&i===x.INTERIOR?1:n===x.INTERIOR&&i===x.EXTERIOR?-1:0}}]),t}(ns),is=function(){function r(){a(this,r)}return h(r,[{key:"createNode",value:function(e){return new Fn(e,null)}}]),r}(),rs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"printEdges",value:function(e){e.println("Edges:");for(var t=0;t<this._edges.size();t++){e.println("edge "+t+":");var n=this._edges.get(t);n.print(e),n.eiList.print(e)}}},{key:"find",value:function(e){return this._nodes.find(e)}},{key:"addNode",value:function(){if(arguments[0]instanceof Fn){var e=arguments[0];return this._nodes.addNode(e)}if(arguments[0]instanceof T){var t=arguments[0];return this._nodes.addNode(t)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var e=this._nodes.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(e){Ge.out.println(e)}},{key:"isBoundaryNode",value:function(e,t){var n=this._nodes.find(t);if(n===null)return!1;var i=n.getLabel();return i!==null&&i.getLocation(e)===x.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var e=this._nodes.iterator();e.hasNext();)e.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(e,t,n,i){return!!e.equals(n)&&K.index(e,t,i)===K.COLLINEAR&&Ce.quadrant(e,t)===Ce.quadrant(n,i)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(e){Ge.out.print(e)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(e,t){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),s=i.getCoordinates();if(this.matchInSameDirection(e,t,s[0],s[1])||this.matchInSameDirection(e,t,s[s.length-1],s[s.length-2]))return i}return null}},{key:"insertEdge",value:function(e){this._edges.add(e)}},{key:"findEdgeEnd",value:function(e){for(var t=this.getEdgeEnds().iterator();t.hasNext();){var n=t.next();if(n.getEdge()===e)return n}return null}},{key:"addEdges",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next();this._edges.add(n);var i=new _i(n,!0),s=new _i(n,!1);i.setSym(s),s.setSym(i),this.add(i),this.add(s)}}},{key:"add",value:function(e){this._nodes.add(e),this._edgeEndList.add(e)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(e,t){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),s=i.getCoordinates();if(e.equals(s[0])&&t.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 ts(new is);else if(arguments.length===1){var e=arguments[0];this._nodes=new ts(e)}}},{key:"linkResultDirectedEdges",value:function(e){for(var t=e.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}}]),r}(),Pu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"sortShellsAndHoles",value:function(e,t,n){for(var i=e.iterator();i.hasNext();){var s=i.next();s.isHole()?n.add(s):t.add(s)}}},{key:"computePolygons",value:function(e){for(var t=new W,n=e.iterator();n.hasNext();){var i=n.next().toPolygon(this._geometryFactory);t.add(i)}return t}},{key:"placeFreeHoles",value:function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();if(i.getShell()===null){var s=r.findEdgeRingContaining(i,e);if(s===null)throw new nt("unable to assign hole to a shell",i.getCoordinate(0));i.setShell(s)}}}},{key:"buildMinimalEdgeRings",value:function(e,t,n){for(var i=new W,s=e.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),t.add(v)):n.addAll(c)}else i.add(o)}return i}},{key:"buildMaximalEdgeRings",value:function(e){for(var t=new W,n=e.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var s=new bu(i,this._geometryFactory);t.add(s),s.setInResult()}}return t}},{key:"placePolygonHoles",value:function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(e)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(e){for(var t=0,n=null,i=e.iterator();i.hasNext();){var s=i.next();s.isHole()||(n=s,t++)}return ie.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n}},{key:"add",value:function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];rs.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(t),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 e=arguments[0];this._geometryFactory=e}},{key:"findEdgeRingContaining",value:function(e,t){for(var n=e.getLinearRing(),i=n.getEnvelopeInternal(),s=n.getCoordinateN(0),o=null,c=null,v=t.iterator();v.hasNext();){var y=v.next(),k=y.getLinearRing(),S=k.getEnvelopeInternal();if(!S.equals(i)&&S.contains(i)){s=xe.ptNotInList(n.getCoordinates(),k.getCoordinates());var C=!1;di.isInRing(s,k.getCoordinates())&&(C=!0),C&&(o===null||c.contains(S))&&(c=(o=y).getLinearRing().getEnvelopeInternal())}}return o}}]),r}(),ss=function(){function r(){a(this,r)}return h(r,[{key:"getBounds",value:function(){}}]),r}(),rt=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[ss,U]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t}}]),r}(),Gn=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"poll",value:function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(e){for(var t=null,n=this._items.get(e);2*e<=this._size&&((t=2*e)!==this._size&&this._items.get(t+1).compareTo(this._items.get(t))<0&&t++,this._items.get(t).compareTo(n)<0);e=t)this._items.set(e,this._items.get(t));this._items.set(e,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(e){this._items.add(null),this._size+=1;var t=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(t/2)))<0;t/=2)this._items.set(t,this._items.get(Math.trunc(t/2)));this._items.set(t,e)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new W,this._items.add(null)}}]),r}(),Au=function(){function r(){a(this,r)}return h(r,[{key:"insert",value:function(e,t){}},{key:"remove",value:function(e,t){}},{key:"query",value:function(){}}]),r}(),ze=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(e){ie.isTrue(this._bounds===null),this._childBoundables.add(e)}},{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[ss,U]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new W,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this._level=e}}}}]),r}(),Ft={reverseOrder:function(){return{compare:function(r,e){return e.compareTo(r)}}},min:function(r){return Ft.sort(r),r.get(0)},sort:function(r,e){var t=r.toArray();e?xt.sort(t,e):xt.sort(t);for(var n=r.iterator(),i=0,s=t.length;i<s;i++)n.next(),n.set(t[i])},singletonList:function(r){var e=new W;return e.add(r),e}},Du=function(){function r(){a(this,r)}return h(r,null,[{key:"maxDistance",value:function(e,t,n,i,s,o,c,v){var y=r.distance(e,t,s,o);return y=Math.max(y,r.distance(e,t,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(e,t,n,i){var s=n-e,o=i-t;return Math.sqrt(s*s+o*o)}},{key:"maximumDistance",value:function(e,t){var n=Math.min(e.getMinX(),t.getMinX()),i=Math.min(e.getMinY(),t.getMinY()),s=Math.max(e.getMaxX(),t.getMaxX()),o=Math.max(e.getMaxY(),t.getMaxY());return r.distance(n,i,s,o)}},{key:"minMaxDistance",value:function(e,t){var n=e.getMinX(),i=e.getMinY(),s=e.getMaxX(),o=e.getMaxY(),c=t.getMinX(),v=t.getMinY(),y=t.getMaxX(),k=t.getMaxY(),S=r.maxDistance(n,i,n,o,c,v,c,k);return S=Math.min(S,r.maxDistance(n,i,n,o,c,v,y,v)),S=Math.min(S,r.maxDistance(n,i,n,o,y,k,c,k)),S=Math.min(S,r.maxDistance(n,i,n,o,y,k,y,v)),S=Math.min(S,r.maxDistance(n,i,s,i,c,v,c,k)),S=Math.min(S,r.maxDistance(n,i,s,i,c,v,y,v)),S=Math.min(S,r.maxDistance(n,i,s,i,y,k,c,k)),S=Math.min(S,r.maxDistance(n,i,s,i,y,k,y,v)),S=Math.min(S,r.maxDistance(s,o,n,o,c,v,c,k)),S=Math.min(S,r.maxDistance(s,o,n,o,c,v,y,v)),S=Math.min(S,r.maxDistance(s,o,n,o,y,k,c,k)),S=Math.min(S,r.maxDistance(s,o,n,o,y,k,y,v)),S=Math.min(S,r.maxDistance(s,o,s,i,c,v,c,k)),S=Math.min(S,r.maxDistance(s,o,s,i,c,v,y,v)),S=Math.min(S,r.maxDistance(s,o,s,i,y,k,c,k)),S=Math.min(S,r.maxDistance(s,o,s,i,y,k,y,v))}}]),r}(),Gt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"maximumDistance",value:function(){return Du.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(e,t){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,e,t),null):(this.expand(this._boundable2,this._boundable1,!0,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,!1,e,t),null;if(i)return this.expand(this._boundable2,this._boundable1,!0,e,t),null;throw new D("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(r.isComposite(this._boundable1)||r.isComposite(this._boundable2))}},{key:"compareTo",value:function(e){var t=e;return this._distance<t._distance?-1:this._distance>t._distance?1:0}},{key:"expand",value:function(e,t,n,i,s){for(var o=e.getChildBoundables().iterator();o.hasNext();){var c=o.next(),v=null;(v=n?new r(t,c,this._itemDistance):new r(c,t,this._itemDistance)).getDistance()<s&&i.add(v)}}},{key:"getBoundable",value:function(e){return e===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 e=arguments[0],t=arguments[1],n=arguments[2];this._boundable1=e,this._boundable2=t,this._itemDistance=n,this._distance=this.distance()}},{key:"area",value:function(e){return e.getBounds().getArea()}},{key:"isComposite",value:function(e){return e instanceof ze}}]),r}(),as=function(){function r(){a(this,r)}return h(r,[{key:"visitItem",value:function(e){}}]),r}(),qt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"queryInternal",value:function(){if(ee(arguments[2],as)&&arguments[0]instanceof Object&&arguments[1]instanceof ze)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=t.getChildBoundables(),s=0;s<i.size();s++){var o=i.get(s);this.getIntersectsOp().intersects(o.getBounds(),e)&&(o instanceof ze?this.queryInternal(e,o,n):o instanceof rt?n.visitItem(o.getItem()):ie.shouldNeverReachHere())}else if(ee(arguments[2],pt)&&arguments[0]instanceof Object&&arguments[1]instanceof ze)for(var c=arguments[0],v=arguments[1],y=arguments[2],k=v.getChildBoundables(),S=0;S<k.size();S++){var C=k.get(S);this.getIntersectsOp().intersects(C.getBounds(),c)&&(C instanceof ze?this.queryInternal(c,C,y):C instanceof rt?y.add(C.getItem()):ie.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(e){return e.get(e.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 e=arguments[0],t=0,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof ze?t+=this.size(i):i instanceof rt&&(t+=1)}return t}}},{key:"removeItem",value:function(e,t){for(var n=null,i=e.getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof rt&&s.getItem()===t&&(n=s)}return n!==null&&(e.getChildBoundables().remove(n),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new W:e}if(arguments.length===1){for(var t=arguments[0],n=new W,i=t.getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof ze){var o=this.itemsTree(s);o!==null&&n.add(o)}else s instanceof rt?n.add(s.getItem()):ie.shouldNeverReachHere()}return n.size()<=0?null:n}}},{key:"insert",value:function(e,t){ie.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new rt(e,t))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var e=arguments[0],t=new W;return this.boundablesAtLevel(e,this._root,t),t}if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];if(ie.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 ze?this.boundablesAtLevel(n,c,s):(ie.isTrue(c instanceof rt),n===-1&&s.add(c))}return null}}},{key:"query",value:function(){if(arguments.length===1){var e=arguments[0];this.build();var t=new W;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.queryInternal(e,this._root,t),t}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 e=arguments[0],t=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.remove(e,this._root,t)}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 ze&&(o=this.remove(n,y,s))){c=y;break}}return c!==null&&c.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(c),o}}},{key:"createHigherLevels",value:function(e,t){ie.isTrue(!e.isEmpty());var n=this.createParentBoundables(e,t+1);return n.size()===1?n.get(0):this.createHigherLevels(n,t+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 e=arguments[0],t=0,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof ze){var s=this.depth(i);s>t&&(t=s)}}return t+1}}},{key:"createParentBoundables",value:function(e,t){ie.isTrue(!e.isEmpty());var n=new W;n.add(this.createNode(t));var i=new W(e);Ft.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(t)),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 e=arguments[0];ie.isTrue(e>1,"Node capacity must be greater than 1"),this._nodeCapacity=e}}},{key:"compareDoubles",value:function(e,t){return e>t?1:e<t?-1:0}}]),r}();qt.IntersectsOp=function(){},qt.DEFAULT_NODE_CAPACITY=10;var Fu=function(){function r(){a(this,r)}return h(r,[{key:"distance",value:function(e,t){}}]),r}(),Ke=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"createParentBoundablesFromVerticalSlices",value:function(n,i){ie.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 Gn;y.add(s);for(var k=new Gn;!y.isEmpty()&&v>=0;){var S=y.poll(),C=S.getDistance();if(C>=v)break;if(S.isLeaves())if(k.size()<c)k.add(S);else{var F=k.peek();F.getDistance()>C&&(k.poll(),k.add(S));var A=k.peek();v=A.getDistance()}else S.expandToQueue(y,v)}return t.getItems(k)}}},{key:"createNode",value:function(n){return new us(n)}},{key:"size",value:function(){return arguments.length===0?L(d(t.prototype),"size",this).call(this):L(d(t.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof ye))return L(d(t.prototype),"insert",this).apply(this,arguments);var n=arguments[0],i=arguments[1];if(n.isNull())return null;L(d(t.prototype),"insert",this).call(this,n,i)}},{key:"getIntersectsOp",value:function(){return t.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 k=c.next();o[v].add(k),y++}}return o}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];return L(d(t.prototype),"query",this).call(this,n)}if(arguments.length===2){var i=arguments[0],s=arguments[1];L(d(t.prototype),"query",this).call(this,i,s)}}},{key:"getComparator",value:function(){return t.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(n,i){return L(d(t.prototype),"createParentBoundables",this).call(this,n,i)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof ye){var n=arguments[0],i=arguments[1];return L(d(t.prototype),"remove",this).call(this,n,i)}return L(d(t.prototype),"remove",this).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?L(d(t.prototype),"depth",this).call(this):L(d(t.prototype),"depth",this).apply(this,arguments)}},{key:"createParentBoundables",value:function(n,i){ie.isTrue(!n.isEmpty());var s=Math.trunc(Math.ceil(n.size()/this.getNodeCapacity())),o=new W(n);Ft.sort(o,t.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(ee(arguments[0],Fu)){var n=arguments[0];if(this.isEmpty())return null;var i=new Gt(this.getRoot(),this.getRoot(),n);return this.nearestNeighbour(i)}if(arguments[0]instanceof Gt){var s=arguments[0],o=H.POSITIVE_INFINITY,c=null,v=new Gn;for(v.add(s);!v.isEmpty()&&o>0;){var y=v.poll(),k=y.getDistance();if(k>=o)break;y.isLeaves()?(o=k,c=y):y.expandToQueue(v,o)}return c===null?null:[c.getBoundable(0).getItem(),c.getBoundable(1).getItem()]}}else{if(arguments.length===2){var S=arguments[0],C=arguments[1];if(this.isEmpty()||S.isEmpty())return null;var F=new Gt(this.getRoot(),S.getRoot(),C);return this.nearestNeighbour(F)}if(arguments.length===3){var A=arguments[0],Z=arguments[1],j=arguments[2],J=new rt(A,Z),ce=new Gt(this.getRoot(),J,j);return this.nearestNeighbour(ce)[0]}if(arguments.length===4){var _e=arguments[0],Se=arguments[1],Pe=arguments[2],He=arguments[3],st=new rt(_e,Se),wt=new Gt(this.getRoot(),st,Pe);return this.nearestNeighbourK(wt,He)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=H.POSITIVE_INFINITY,o=new Gn;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],k=arguments[1],S=arguments[2],C=new Gt(this.getRoot(),y.getRoot(),k);return this.isWithinDistance(C,S)}}},{key:"interfaces_",get:function(){return[Au,U]}}],[{key:"constructor_",value:function(){if(arguments.length===0)t.constructor_.call(this,t.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];qt.constructor_.call(this,n)}}},{key:"centreX",value:function(n){return t.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 t.avg(n.getMinY(),n.getMaxY())}}]),t}(qt),us=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"computeBounds",value:function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var s=i.next();n===null?n=new ye(s.getBounds()):n.expandToInclude(s.getBounds())}return n}}],[{key:"constructor_",value:function(){var n=arguments[0];ze.constructor_.call(this,n)}}]),t}(ze);Ke.STRtreeNode=us,Ke.xComparator=new(function(){function r(){a(this,r)}return h(r,[{key:"interfaces_",get:function(){return[Te]}},{key:"compare",value:function(e,t){return qt.compareDoubles(Ke.centreX(e.getBounds()),Ke.centreX(t.getBounds()))}}]),r}()),Ke.yComparator=new(function(){function r(){a(this,r)}return h(r,[{key:"interfaces_",get:function(){return[Te]}},{key:"compare",value:function(e,t){return qt.compareDoubles(Ke.centreY(e.getBounds()),Ke.centreY(t.getBounds()))}}]),r}()),Ke.intersectsOp=new(function(){function r(){a(this,r)}return h(r,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(e,t){return e.intersects(t)}}]),r}()),Ke.DEFAULT_NODE_CAPACITY=10;var Gu=function(){function r(){a(this,r)}return h(r,null,[{key:"relativeSign",value:function(e,t){return e<t?-1:e>t?1:0}},{key:"compare",value:function(e,t,n){if(t.equals2D(n))return 0;var i=r.relativeSign(t.x,n.x),s=r.relativeSign(t.y,n.y);switch(e){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 ie.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0}}]),r}(),qu=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(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(e){var t=e;return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:this._isInterior?t._isInterior?Gu.compare(this._segmentOctant,this.coord,t.coord):1:-1}},{key:"isEndPoint",value:function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e}},{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 e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._segString=e,this.coord=new T(t),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!t.equals2D(e.getCoordinate(n))}}]),r}(),Yu=function(){function r(){a(this,r)}return h(r,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),r}(),zu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getSplitCoordinates",value:function(){var e=new tn;this.addEndpoints();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next();this.addEdgeCoordinates(n,i,e),n=i}return e.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var e=new W;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var t=e.iterator();t.hasNext();){var n=t.next().intValue();this.add(this._edge.getCoordinate(n),n)}}},{key:"createSplitEdgePts",value:function(e,t){var n=t.segmentIndex-e.segmentIndex+2;if(n===2)return[new T(e.coord),new T(t.coord)];var i=this._edge.getCoordinate(t.segmentIndex),s=t.isInterior()||!t.coord.equals2D(i);s||n--;var o=new Array(n).fill(null),c=0;o[c++]=new T(e.coord);for(var v=e.segmentIndex+1;v<=t.segmentIndex;v++)o[c++]=this._edge.getCoordinate(v);return s&&(o[c]=new T(t.coord)),o}},{key:"print",value:function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"findCollapsesFromExistingVertices",value:function(e){for(var t=0;t<this._edge.size()-2;t++){var n=this._edge.getCoordinate(t);this._edge.getCoordinate(t+1);var i=this._edge.getCoordinate(t+2);n.equals2D(i)&&e.add(Tn.valueOf(t+1))}}},{key:"addEdgeCoordinates",value:function(e,t,n){var i=this.createSplitEdgePts(e,t);n.add(i,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(e){this.addEndpoints(),this.addCollapsedNodes();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next(),s=this.createSplitEdge(n,i);e.add(s),n=i}}},{key:"findCollapseIndex",value:function(e,t,n){if(!e.coord.equals2D(t.coord))return!1;var i=t.segmentIndex-e.segmentIndex;return t.isInterior()||i--,i===1&&(n[0]=e.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(e){for(var t=new Array(1).fill(null),n=this.iterator(),i=n.next();n.hasNext();){var s=n.next();this.findCollapseIndex(i,s,t)&&e.add(Tn.valueOf(t[0])),i=s}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var e=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(e),e)}},{key:"createSplitEdge",value:function(e,t){var n=this.createSplitEdgePts(e,t);return new Nt(n,this._edge.getData())}},{key:"add",value:function(e,t){var n=new qu(this._edge,e,t,this._edge.getSegmentOctant(t)),i=this._nodeMap.get(n);return i!==null?(ie.isTrue(i.coord.equals2D(e),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)}},{key:"checkSplitEdgesCorrectness",value:function(e){var t=this._edge.getCoordinates(),n=e.get(0).getCoordinate(0);if(!n.equals2D(t[0]))throw new Ne("bad split edge start point at "+n);var i=e.get(e.size()-1).getCoordinates(),s=i[i.length-1];if(!s.equals2D(t[t.length-1]))throw new Ne("bad split edge end point at "+s)}}],[{key:"constructor_",value:function(){this._nodeMap=new sn,this._edge=null;var e=arguments[0];this._edge=e}}]),r}(),Bu=function(){function r(){a(this,r)}return h(r,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new D("Cannot compute the octant for point ( "+e+", "+t+" )");var n=Math.abs(e),i=Math.abs(t);return e>=0?t>=0?n>=i?0:1:n>=i?7:6:t>=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 D("Cannot compute the octant for two identical points "+s);return r.octant(c,v)}}}]),r}(),Xu=function(){function r(){a(this,r)}return h(r,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(e){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(e){}},{key:"getData",value:function(){}}]),r}(),Uu=function(){function r(){a(this,r)}return h(r,[{key:"addIntersection",value:function(e,t){}},{key:"interfaces_",get:function(){return[Xu]}}]),r}(),Nt=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(e){return this._pts[e]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))}},{key:"setData",value:function(e){this._data=e}},{key:"safeOctant",value:function(e,t){return e.equals2D(t)?0:Bu.octant(e,t)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}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 mi.toLineString(new nn(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(e,t){var n=t,i=n+1;if(i<this._pts.length){var s=this._pts[i];e.equals2D(s)&&(n=i)}return this._nodeList.add(e,n)}},{key:"addIntersections",value:function(e,t,n){for(var i=0;i<e.getIntersectionNum();i++)this.addIntersection(e,t,n,i)}},{key:"interfaces_",get:function(){return[Uu]}}],[{key:"constructor_",value:function(){this._nodeList=new zu(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var e=arguments[0],t=new W;return r.getNodedSubstrings(e,t),t}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}(),be=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 e=arguments[0],t=K.index(this.p0,this.p1,e.p0),n=K.index(this.p0,this.p1,e.p1);return t>=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}if(arguments[0]instanceof T){var i=arguments[0];return K.index(this.p0,this.p1,i)}}},{key:"toGeometry",value:function(e){return e.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(e){if(!(e instanceof r))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)}},{key:"intersection",value:function(e){var t=new It;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof T){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new T(e);var t=this.projectionFactor(e),n=new T;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(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(e){return e===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(e){return We.pointToLinePerpendicular(e,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(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=t*t+n*n;return i<=0?H.NaN:((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i}},{key:"closestPoints",value:function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=H.MAX_VALUE,s=null,o=this.closestPoint(e.p0);i=o.distance(e.p0),n[0]=o,n[1]=e.p0;var c=this.closestPoint(e.p1);(s=c.distance(e.p1))<i&&(i=s,n[0]=c,n[1]=e.p1);var v=e.closestPoint(this.p0);(s=v.distance(this.p0))<i&&(i=s,n[0]=this.p0,n[1]=v);var y=e.closestPoint(this.p1);return(s=y.distance(this.p1))<i&&(i=s,n[0]=this.p1,n[1]=y),n}},{key:"closestPoint",value:function(e){var t=this.projectionFactor(e);return t>0&&t<1?this.project(e):this.p0.distance(e)<this.p1.distance(e)?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(e){var t=e,n=this.p0.compareTo(t.p0);return n!==0?n:this.p1.compareTo(t.p1)}},{key:"reverse",value:function(){var e=this.p0;this.p0=this.p1,this.p1=e}},{key:"equalsTopo",value:function(e){return this.p0.equals(e.p0)&&this.p1.equals(e.p1)||this.p0.equals(e.p1)&&this.p1.equals(e.p0)}},{key:"lineIntersection",value:function(e){return oi.intersection(this.p0,this.p1,e.p0,e.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(e,t){var n=this.p0.x+e*(this.p1.x-this.p0.x),i=this.p0.y+e*(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(t!==0){if(c<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");v=t*s/c,y=t*o/c}return new T(n-y,i+v)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var e=arguments[0];this.setCoordinates(e.p0,e.p1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.p0.x=t.x,this.p0.y=t.y,this.p1.x=n.x,this.p1.y=n.y}}},{key:"segmentFraction",value:function(e){var t=this.projectionFactor(e);return t<0?t=0:(t>1||H.isNaN(t))&&(t=1),t}},{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(e){var t=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=t*t+n*n,o=t*t-n*n,c=e.getX(),v=e.getY();return new T((-o*c-2*t*n*v-2*t*i)/s,(o*v-2*t*n*c-2*n*i)/s)}},{key:"distance",value:function(){if(arguments[0]instanceof r){var e=arguments[0];return We.segmentToSegment(this.p0,this.p1,e.p0,e.p1)}if(arguments[0]instanceof T){var t=arguments[0];return We.pointToSegment(t,this.p0,this.p1)}}},{key:"pointAlong",value:function(e){var t=new T;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t}},{key:"hashCode",value:function(){var e=H.doubleToLongBits(this.p0.x);e^=31*H.doubleToLongBits(this.p0.y);var t=Math.trunc(e)^Math.trunc(e>>32),n=H.doubleToLongBits(this.p1.x);return n^=31*H.doubleToLongBits(this.p1.y),t^(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 e=arguments[0];r.constructor_.call(this,e.p0,e.p1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.p0=t,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(e,t){return new T((e.x+t.x)/2,(e.y+t.y)/2)}}]),r}(),Vu=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 e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new be,this._overlapSeg2=new be}}]),r}(),os=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getLineSegment",value:function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]}},{key:"computeSelect",value:function(e,t,n,i){var s=this._pts[t],o=this._pts[n];if(n-t==1)return i.select(this,t),null;if(!e.intersects(s,o))return null;var c=Math.trunc((t+n)/2);t<c&&this.computeSelect(e,t,c,i),c<n&&this.computeSelect(e,c,n,i)}},{key:"getCoordinates",value:function(){for(var e=new Array(this._end-this._start+1).fill(null),t=0,n=this._start;n<=this._end;n++)e[t++]=this._pts[n];return e}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.computeOverlaps(this._start,this._end,e,e._start,e._end,t)}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),k=Math.trunc((o+c)/2);n<y&&(o<k&&this.computeOverlaps(n,y,s,o,k,v),k<c&&this.computeOverlaps(n,y,s,k,c,v)),y<i&&(o<k&&this.computeOverlaps(y,i,s,o,k,v),k<c&&this.computeOverlaps(y,i,s,k,c,v))}}},{key:"setId",value:function(e){this._id=e}},{key:"select",value:function(e,t){this.computeSelect(e,this._start,this._end,t)}},{key:"getEnvelope",value:function(){if(this._env===null){var e=this._pts[this._start],t=this._pts[this._end];this._env=new ye(e,t)}return this._env}},{key:"overlaps",value:function(e,t,n,i,s){return ye.intersects(this._pts[e],this._pts[t],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 e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=i}}]),r}(),Hu=function(){function r(){a(this,r)}return h(r,null,[{key:"findChainEnd",value:function(e,t){for(var n=t;n<e.length-1&&e[n].equals2D(e[n+1]);)n++;if(n>=e.length-1)return e.length-1;for(var i=Ce.quadrant(e[n],e[n+1]),s=t+1;s<e.length&&!(!e[s-1].equals2D(e[s])&&Ce.quadrant(e[s-1],e[s])!==i);)s++;return s-1}},{key:"getChains",value:function(){if(arguments.length===1){var e=arguments[0];return r.getChains(e,null)}if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new W,s=0;do{var o=r.findChainEnd(t,s),c=new os(t,s,o,n);i.add(c),s=o}while(s<t.length-1);return i}}}]),r}(),xi=function(){function r(){a(this,r)}return h(r,[{key:"computeNodes",value:function(e){}},{key:"getNodedSubstrings",value:function(){}}]),r}(),ls=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"setSegmentIntersector",value:function(e){this._segInt=e}},{key:"interfaces_",get:function(){return[xi]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setSegmentIntersector(e)}}}}]),r}(),ki=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return Nt.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(n){for(var i=Hu.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 hs(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 Ke,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var n=arguments[0];ls.constructor_.call(this,n)}}}}]),t}(ls),hs=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"overlap",value:function(){if(arguments.length!==4)return L(d(t.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}}]),t}(Vu);ki.SegmentOverlapAction=hs;var Ve=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"isDeletable",value:function(e,t,n,i){var s=this._inputLine[e],o=this._inputLine[t],c=this._inputLine[n];return!!this.isConcave(s,o,c)&&!!this.isShallow(s,o,c,i)&&this.isShallowSampled(s,o,e,n,i)}},{key:"deleteShallowConcavities",value:function(){for(var e=1,t=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(t),i=!1;n<this._inputLine.length;){var s=!1;this.isDeletable(e,t,n,this._distanceTol)&&(this._isDeleted[t]=r.DELETE,s=!0,i=!0),e=s?n:t,t=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(t)}return i}},{key:"isShallowConcavity",value:function(e,t,n,i){return K.index(e,t,n)===this._angleOrientation&&We.pointToSegment(t,e,n)<i}},{key:"isShallowSampled",value:function(e,t,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(e,t,this._inputLine[c],s))return!1;return!0}},{key:"isConcave",value:function(e,t,n){var i=K.index(e,t,n)===this._angleOrientation;return i}},{key:"simplify",value:function(e){this._distanceTol=Math.abs(e),e<0&&(this._angleOrientation=K.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var t=!1;do t=this.deleteShallowConcavities();while(t);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(e){for(var t=e+1;t<this._inputLine.length&&this._isDeleted[t]===r.DELETE;)t++;return t}},{key:"isShallow",value:function(e,t,n,i){return We.pointToSegment(t,e,n)<i}},{key:"collapseLine",value:function(){for(var e=new tn,t=0;t<this._inputLine.length;t++)this._isDeleted[t]!==r.DELETE&&e.add(this._inputLine[t]);return e.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=K.COUNTERCLOCKWISE;var e=arguments[0];this._inputLine=e}},{key:"simplify",value:function(e,t){return new r(e).simplify(t)}}]),r}();Ve.INIT=0,Ve.DELETE=1,Ve.KEEP=1,Ve.NUM_PTS_TO_CHECK=10;var cs=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(e){this._precisionModel=e}},{key:"addPt",value:function(e){var t=new T(e);if(this._precisionModel.makePrecise(t),this.isRedundant(t))return null;this._ptList.add(t)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(e,t){if(t)for(var n=0;n<e.length;n++)this.addPt(e[n]);else for(var i=e.length-1;i>=0;i--)this.addPt(e[i])}},{key:"isRedundant",value:function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1);return e.distance(t)<this._minimimVertexDistance}},{key:"toString",value:function(){return new At().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var e=new T(this._ptList.get(0)),t=this._ptList.get(this._ptList.size()-1);if(e.equals(t))return null;this._ptList.add(e)}},{key:"setMinimumVertexDistance",value:function(e){this._minimimVertexDistance=e}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new W}}]),r}();cs.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var Me=function(){function r(){a(this,r)}return h(r,null,[{key:"toDegrees",value:function(e){return 180*e/Math.PI}},{key:"normalize",value:function(e){for(;e>Math.PI;)e-=r.PI_TIMES_2;for(;e<=-Math.PI;)e+=r.PI_TIMES_2;return e}},{key:"angle",value:function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}if(arguments.length===2){var t=arguments[0],n=arguments[1],i=n.x-t.x,s=n.y-t.y;return Math.atan2(s,i)}}},{key:"isAcute",value:function(e,t,n){var i=e.x-t.x,s=e.y-t.y;return i*(n.x-t.x)+s*(n.y-t.y)>0}},{key:"isObtuse",value:function(e,t,n){var i=e.x-t.x,s=e.y-t.y;return i*(n.x-t.x)+s*(n.y-t.y)<0}},{key:"interiorAngle",value:function(e,t,n){var i=r.angle(t,e),s=r.angle(t,n);return Math.abs(s-i)}},{key:"normalizePositive",value:function(e){if(e<0){for(;e<0;)e+=r.PI_TIMES_2;e>=r.PI_TIMES_2&&(e=0)}else{for(;e>=r.PI_TIMES_2;)e-=r.PI_TIMES_2;e<0&&(e=0)}return e}},{key:"angleBetween",value:function(e,t,n){var i=r.angle(t,e),s=r.angle(t,n);return r.diff(i,s)}},{key:"diff",value:function(e,t){var n=null;return(n=e<t?t-e:e-t)>Math.PI&&(n=2*Math.PI-n),n}},{key:"toRadians",value:function(e){return e*Math.PI/180}},{key:"getTurn",value:function(e,t){var n=Math.sin(t-e);return n>0?r.COUNTERCLOCKWISE:n<0?r.CLOCKWISE:r.NONE}},{key:"angleBetweenOriented",value:function(e,t,n){var i=r.angle(t,e),s=r.angle(t,n)-i;return s<=-Math.PI?s+r.PI_TIMES_2:s>Math.PI?s-r.PI_TIMES_2:s}}]),r}();Me.PI_TIMES_2=2*Math.PI,Me.PI_OVER_2=Math.PI/2,Me.PI_OVER_4=Math.PI/4,Me.COUNTERCLOCKWISE=K.COUNTERCLOCKWISE,Me.CLOCKWISE=K.CLOCKWISE,Me.NONE=K.COLLINEAR;var an=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"addNextSegment",value:function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,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=K.index(this._s0,this._s1,this._s2),i=n===K.CLOCKWISE&&this._side===q.LEFT||n===K.COUNTERCLOCKWISE&&this._side===q.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)}},{key:"addLineEndCap",value:function(e,t){var n=new be(e,t),i=new be;this.computeOffsetSegment(n,q.LEFT,this._distance,i);var s=new be;this.computeOffsetSegment(n,q.RIGHT,this._distance,s);var o=t.x-e.x,c=t.y-e.y,v=Math.atan2(c,o);switch(this._bufParams.getEndCapStyle()){case P.CAP_ROUND:this._segList.addPt(i.p1),this.addDirectedFillet(t,v+Math.PI/2,v-Math.PI/2,K.CLOCKWISE,this._distance),this._segList.addPt(s.p1);break;case P.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(s.p1);break;case P.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 k=new T(i.p1.x+y.x,i.p1.y+y.y),S=new T(s.p1.x+y.x,s.p1.y+y.y);this._segList.addPt(k),this._segList.addPt(S)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(e,t,n,i){var s=oi.intersection(t.p0,t.p1,n.p0,n.p1);if(s!==null&&(i<=0?1:s.distance(e)/Math.abs(i))<=this._bufParams.getMitreLimit())return this._segList.addPt(s),null;this.addLimitedMitreJoin(t,n,i,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(e,t){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()===P.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===P.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(t&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,e,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(e){this._segList.addPt(new T(e.x+this._distance,e.y+this._distance)),this._segList.addPt(new T(e.x+this._distance,e.y-this._distance)),this._segList.addPt(new T(e.x-this._distance,e.y-this._distance)),this._segList.addPt(new T(e.x-this._distance,e.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(e,t){this._segList.addPts(e,t)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(e,t,n,i,s){var o=t.x-e.x,c=t.y-e.y,v=Math.atan2(c,o),y=n.x-e.x,k=n.y-e.y,S=Math.atan2(k,y);i===K.CLOCKWISE?v<=S&&(v+=2*Math.PI):v>=S&&(v-=2*Math.PI),this._segList.addPt(t),this.addDirectedFillet(e,v,S,i,s),this._segList.addPt(n)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(e,t,n){this._s1=e,this._s2=t,this._side=n,this._seg1.setCoordinates(e,t),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(e,t,n,i){var s=this._seg0.p1,o=Me.angle(s,this._seg0.p0),c=Me.angleBetweenOriented(this._seg0.p0,s,this._seg1.p1)/2,v=Me.normalize(o+c),y=Me.normalize(v+Math.PI),k=i*n,S=n-k*Math.abs(Math.sin(c)),C=s.x+k*Math.cos(y),F=s.y+k*Math.sin(y),A=new T(C,F),Z=new be(s,A),j=Z.pointAlongOffset(1,S),J=Z.pointAlongOffset(1,-S);this._side===q.LEFT?(this._segList.addPt(j),this._segList.addPt(J)):(this._segList.addPt(J),this._segList.addPt(j))}},{key:"addDirectedFillet",value:function(e,t,n,i,s){var o=i===K.CLOCKWISE?-1:1,c=Math.abs(t-n),v=Math.trunc(c/this._filletAngleQuantum+.5);if(v<1)return null;for(var y=c/v,k=new T,S=0;S<v;S++){var C=t+o*S*y;k.x=e.x+s*Math.cos(C),k.y=e.y+s*Math.sin(C),this._segList.addPt(k)}}},{key:"computeOffsetSegment",value:function(e,t,n,i){var s=t===q.LEFT?1:-1,o=e.p1.x-e.p0.x,c=e.p1.y-e.p0.y,v=Math.sqrt(o*o+c*c),y=s*n*o/v,k=s*n*c/v;i.p0.x=e.p0.x-k,i.p0.y=e.p0.y+y,i.p1.x=e.p1.x-k,i.p1.y=e.p1.y+y}},{key:"addInsideTurn",value:function(e,t){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(e){var t=new T(e.x+this._distance,e.y);this._segList.addPt(t),this.addDirectedFillet(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)}},{key:"init",value:function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new cs,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*r.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===P.JOIN_BEVEL||this._bufParams.getJoinStyle()===P.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,K.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 be,this._seg1=new be,this._offset0=new be,this._offset1=new be,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=t,this._li=new It,this._filletAngleQuantum=Math.PI/2/t.getQuadrantSegments(),t.getQuadrantSegments()>=8&&t.getJoinStyle()===P.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}}]),r}();an.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,an.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,an.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,an.MAX_CLOSING_SEG_LEN_FACTOR=80;var Zu=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getOffsetCurve",value:function(e,t){if(this._distance=t,t===0)return null;var n=t<0,i=Math.abs(t),s=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],s):this.computeOffsetCurve(e,n,s);var o=s.getCoordinates();return n&&xe.reverse(o),o}},{key:"computeSingleSidedBufferCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var s=Ve.simplify(e,-i),o=s.length-1;n.initSideSegments(s[o],s[o-1],q.LEFT),n.addFirstSegment();for(var c=o-2;c>=0;c--)n.addNextSegment(s[c],!0)}else{n.addSegments(e,!1);var v=Ve.simplify(e,i),y=v.length-1;n.initSideSegments(v[0],v[1],q.LEFT),n.addFirstSegment();for(var k=2;k<=y;k++)n.addNextSegment(v[k],!0)}n.addLastSegment(),n.closeRing()}},{key:"computeRingBufferCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);t===q.RIGHT&&(i=-i);var s=Ve.simplify(e,i),o=s.length-1;n.initSideSegments(s[o-1],s[0],t);for(var c=1;c<=o;c++){var v=c!==1;n.addNextSegment(s[c],v)}n.closeRing()}},{key:"computeLineBufferCurve",value:function(e,t){var n=this.simplifyTolerance(this._distance),i=Ve.simplify(e,n),s=i.length-1;t.initSideSegments(i[0],i[1],q.LEFT);for(var o=2;o<=s;o++)t.addNextSegment(i[o],!0);t.addLastSegment(),t.addLineEndCap(i[s-1],i[s]);var c=Ve.simplify(e,-n),v=c.length-1;t.initSideSegments(c[v],c[v-1],q.LEFT);for(var y=v-2;y>=0;y--)t.addNextSegment(c[y],!0);t.addLastSegment(),t.addLineEndCap(c[1],c[0]),t.closeRing()}},{key:"computePointCurve",value:function(e,t){switch(this._bufParams.getEndCapStyle()){case P.CAP_ROUND:t.createCircle(e);break;case P.CAP_SQUARE:t.createSquare(e)}}},{key:"getLineCurve",value:function(e,t){if(this._distance=t,this.isLineOffsetEmpty(t))return null;var n=Math.abs(t),i=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var s=t<0;this.computeSingleSidedBufferCurve(e,s,i)}else this.computeLineBufferCurve(e,i);return i.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(e){return e*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return r.copyCoordinates(e);var i=this.getSegGen(n);return this.computeRingBufferCurve(e,t,i),i.getCoordinates()}},{key:"computeOffsetCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){var s=Ve.simplify(e,-i),o=s.length-1;n.initSideSegments(s[o],s[o-1],q.LEFT),n.addFirstSegment();for(var c=o-2;c>=0;c--)n.addNextSegment(s[c],!0)}else{var v=Ve.simplify(e,i),y=v.length-1;n.initSideSegments(v[0],v[1],q.LEFT),n.addFirstSegment();for(var k=2;k<=y;k++)n.addNextSegment(v[k],!0)}n.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(e){return e===0||e<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(e){return new an(this._precisionModel,this._bufParams,e)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t}},{key:"copyCoordinates",value:function(e){for(var t=new Array(e.length).fill(null),n=0;n<t.length;n++)t[n]=new T(e[n]);return t}}]),r}(),fs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var e=arguments[0],t=new W,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),s=i.getEnvelope();e.y<s.getMinY()||e.y>s.getMaxY()||this.findStabbedSegments(e,i.getDirectedEdges(),t)}return t}if(arguments.length===3){if(ee(arguments[2],pt)&&arguments[0]instanceof T&&arguments[1]instanceof _i)for(var o=arguments[0],c=arguments[1],v=arguments[2],y=c.getEdge().getCoordinates(),k=0;k<y.length-1;k++){this._seg.p0=y[k],this._seg.p1=y[k+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse();var S=Math.max(this._seg.p0.x,this._seg.p1.x);if(!(S<o.x)&&!(this._seg.isHorizontal()||o.y<this._seg.p0.y||o.y>this._seg.p1.y||K.index(this._seg.p0,this._seg.p1,o)===K.RIGHT)){var C=c.getDepth(q.LEFT);this._seg.p0.equals(y[k])||(C=c.getDepth(q.RIGHT));var F=new gs(this._seg,C);v.add(F)}}else if(ee(arguments[2],pt)&&arguments[0]instanceof T&&ee(arguments[1],pt))for(var A=arguments[0],Z=arguments[1],j=arguments[2],J=Z.iterator();J.hasNext();){var ce=J.next();ce.isForward()&&this.findStabbedSegments(A,ce,j)}}}},{key:"getDepth",value:function(e){var t=this.findStabbedSegments(e);return t.size()===0?0:Ft.min(t)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new be;var e=arguments[0];this._subgraphs=e}}]),r}(),gs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"compareTo",value:function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg))!==0?n:this._upwardSeg.compareTo(t._upwardSeg)}},{key:"compareX",value:function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.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 e=arguments[0],t=arguments[1];this._upwardSeg=new be(e),this._leftDepth=t}}]),r}();fs.DepthSegment=gs;var vs=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,null,[{key:"constructor_",value:function(){G.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),t}(G),Ei=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getY",value:function(){var e=this.y/this.w;if(H.isNaN(e)||H.isInfinite(e))throw new vs;return e}},{key:"getX",value:function(){var e=this.x/this.w;if(H.isNaN(e)||H.isInfinite(e))throw new vs;return e}},{key:"getCoordinate",value:function(){var e=new T;return e.x=this.getX(),e.y=this.getY(),e}}],[{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 e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];this.x=t,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],k=arguments[2];this.x=v,this.y=y,this.w=k}else if(arguments.length===4){var S=arguments[0],C=arguments[1],F=arguments[2],A=arguments[3],Z=S.y-C.y,j=C.x-S.x,J=S.x*C.y-C.x*S.y,ce=F.y-A.y,_e=A.x-F.x,Se=F.x*A.y-A.x*F.y;this.x=j*Se-_e*J,this.y=ce*J-Z*Se,this.w=Z*_e-ce*j}}}]),r}(),$u=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(e){if(e===null)throw new D("Supplied point is null.");return r.interpolateZ(e,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 e=arguments[0],t=arguments[1],n=arguments[2];this.p0=e,this.p1=t,this.p2=n}},{key:"area",value:function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)}},{key:"signedArea",value:function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2}},{key:"det",value:function(e,t,n,i){return e*i-t*n}},{key:"interpolateZ",value:function(e,t,n,i){var s=t.x,o=t.y,c=n.x-s,v=i.x-s,y=n.y-o,k=i.y-o,S=c*k-v*y,C=e.x-s,F=e.y-o,A=(k*C-v*F)/S,Z=(-y*C+c*F)/S;return t.getZ()+A*(n.getZ()-t.getZ())+Z*(i.getZ()-t.getZ())}},{key:"longestSideLength",value:function(e,t,n){var i=e.distance(t),s=t.distance(n),o=n.distance(e),c=i;return s>c&&(c=s),o>c&&(c=o),c}},{key:"circumcentreDD",value:function(e,t,n){var i=Q.valueOf(e.x).subtract(n.x),s=Q.valueOf(e.y).subtract(n.y),o=Q.valueOf(t.x).subtract(n.x),c=Q.valueOf(t.y).subtract(n.y),v=Q.determinant(i,s,o,c).multiply(2),y=i.sqr().add(s.sqr()),k=o.sqr().add(c.sqr()),S=Q.determinant(s,y,c,k),C=Q.determinant(i,y,o,k),F=Q.valueOf(n.x).subtract(S.divide(v)).doubleValue(),A=Q.valueOf(n.y).add(C.divide(v)).doubleValue();return new T(F,A)}},{key:"isAcute",value:function(e,t,n){return!!Me.isAcute(e,t,n)&&!!Me.isAcute(t,n,e)&&!!Me.isAcute(n,e,t)}},{key:"circumcentre",value:function(e,t,n){var i=n.x,s=n.y,o=e.x-i,c=e.y-s,v=t.x-i,y=t.y-s,k=2*r.det(o,c,v,y),S=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-S/k,s+C/k)}},{key:"perpendicularBisector",value:function(e,t){var n=t.x-e.x,i=t.y-e.y,s=new Ei(e.x+n/2,e.y+i/2,1),o=new Ei(e.x-i+n/2,e.y+n+i/2,1);return new Ei(s,o)}},{key:"angleBisector",value:function(e,t,n){var i=t.distance(e),s=i/(i+t.distance(n)),o=n.x-e.x,c=n.y-e.y;return new T(e.x+s*o,e.y+s*c)}},{key:"area3D",value:function(e,t,n){var i=t.x-e.x,s=t.y-e.y,o=t.getZ()-e.getZ(),c=n.x-e.x,v=n.y-e.y,y=n.getZ()-e.getZ(),k=s*y-o*v,S=o*c-i*y,C=i*v-s*c,F=k*k+S*S+C*C,A=Math.sqrt(F)/2;return A}},{key:"centroid",value:function(e,t,n){var i=(e.x+t.x+n.x)/3,s=(e.y+t.y+n.y)/3;return new T(i,s)}},{key:"inCentre",value:function(e,t,n){var i=t.distance(n),s=e.distance(n),o=e.distance(t),c=i+s+o,v=(i*e.x+s*t.x+o*n.x)/c,y=(i*e.y+s*t.y+o*n.y)/c;return new T(v,y)}}]),r}(),ju=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"addRingSide",value:function(e,t,n,i,s){if(t===0&&e.length<en.MINIMUM_VALID_SIZE)return null;var o=i,c=s;e.length>=en.MINIMUM_VALID_SIZE&&K.isCCW(e)&&(o=s,c=i,n=q.opposite(n));var v=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(v,o,c)}},{key:"addRingBothSides",value:function(e,t){this.addRingSide(e,t,q.LEFT,x.EXTERIOR,x.INTERIOR),this.addRingSide(e,t,q.RIGHT,x.INTERIOR,x.EXTERIOR)}},{key:"addPoint",value:function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,x.EXTERIOR,x.INTERIOR)}},{key:"addPolygon",value:function(e){var t=this._distance,n=q.LEFT;this._distance<0&&(t=-this._distance,n=q.RIGHT);var i=e.getExteriorRing(),s=xe.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&s.length<3)return null;this.addRingSide(s,t,n,x.EXTERIOR,x.INTERIOR);for(var o=0;o<e.getNumInteriorRing();o++){var c=e.getInteriorRingN(o),v=xe.removeRepeatedPoints(c.getCoordinates());this._distance>0&&this.isErodedCompletely(c,-this._distance)||this.addRingSide(v,t,q.opposite(n),x.INTERIOR,x.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(e,t){var n=new $u(e[0],e[1],e[2]),i=n.inCentre();return We.pointToSegment(i,n.p0,n.p1)<Math.abs(t)}},{key:"addLineString",value:function(e){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var t=xe.removeRepeatedPoints(e.getCoordinates());if(xe.isRing(t)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(t,this._distance);else{var n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,x.EXTERIOR,x.INTERIOR)}}},{key:"addCurve",value:function(e,t,n){if(e===null||e.length<2)return null;var i=new Nt(e,new Ye(0,x.BOUNDARY,t,n));this._curveList.add(i)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(e){if(e.isEmpty())return null;if(e instanceof bn)this.addPolygon(e);else if(e instanceof Jt)this.addLineString(e);else if(e instanceof li)this.addPoint(e);else if(e instanceof hi)this.addCollection(e);else if(e instanceof vi)this.addCollection(e);else if(e instanceof gi)this.addCollection(e);else{if(!(e instanceof Oe))throw new gt(e.getGeometryType());this.addCollection(e)}}},{key:"isErodedCompletely",value:function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var i=e.getEnvelopeInternal(),s=Math.min(i.getHeight(),i.getWidth());return t<0&&2*Math.abs(t)>s}},{key:"addCollection",value:function(e){for(var t=0;t<e.getNumGeometries();t++){var n=e.getGeometryN(t);this.add(n)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new W;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n}}]),r}(),Wu=function(){function r(){a(this,r)}return h(r,[{key:"locate",value:function(e){}}]),r}(),Qu=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 Ln;var e=this._parent.getGeometryN(this._index++);return e instanceof Oe?(this._subcollectionIterator=new r(e),this._subcollectionIterator.next()):e}},{key:"remove",value:function(){throw new gt(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[Yu]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var e=arguments[0];this._parent=e,this._atStart=!0,this._index=0,this._max=e.getNumGeometries()}},{key:"isAtomic",value:function(e){return!(e instanceof Oe)}}]),r}(),Ku=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"locate",value:function(e){return r.locate(e,this._geom)}},{key:"interfaces_",get:function(){return[Wu]}}],[{key:"constructor_",value:function(){this._geom=null;var e=arguments[0];this._geom=e}},{key:"locatePointInPolygon",value:function(e,t){if(t.isEmpty())return x.EXTERIOR;var n=t.getExteriorRing(),i=r.locatePointInRing(e,n);if(i!==x.INTERIOR)return i;for(var s=0;s<t.getNumInteriorRing();s++){var o=t.getInteriorRingN(s),c=r.locatePointInRing(e,o);if(c===x.BOUNDARY)return x.BOUNDARY;if(c===x.INTERIOR)return x.EXTERIOR}return x.INTERIOR}},{key:"locatePointInRing",value:function(e,t){return t.getEnvelopeInternal().intersects(e)?di.locateInRing(e,t.getCoordinates()):x.EXTERIOR}},{key:"containsPointInPolygon",value:function(e,t){return x.EXTERIOR!==r.locatePointInPolygon(e,t)}},{key:"locateInGeometry",value:function(e,t){if(t instanceof bn)return r.locatePointInPolygon(e,t);if(t instanceof Oe)for(var n=new Qu(t);n.hasNext();){var i=n.next();if(i!==t){var s=r.locateInGeometry(e,i);if(s!==x.EXTERIOR)return s}}return x.EXTERIOR}},{key:"isContained",value:function(e,t){return x.EXTERIOR!==r.locate(e,t)}},{key:"locate",value:function(e,t){return t.isEmpty()?x.EXTERIOR:t.getEnvelopeInternal().intersects(e)?r.locateInGeometry(e,t):x.EXTERIOR}}]),r}(),Ju=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getNextCW",value:function(e){this.getEdges();var t=this._edgeList.indexOf(e),n=t-1;return t===0&&(n=this._edgeList.size()-1),this._edgeList.get(n)}},{key:"propagateSideLabels",value:function(e){for(var t=x.NONE,n=this.iterator();n.hasNext();){var i=n.next().getLabel();i.isArea(e)&&i.getLocation(e,q.LEFT)!==x.NONE&&(t=i.getLocation(e,q.LEFT))}if(t===x.NONE)return null;for(var s=t,o=this.iterator();o.hasNext();){var c=o.next(),v=c.getLabel();if(v.getLocation(e,q.ON)===x.NONE&&v.setLocation(e,q.ON,s),v.isArea(e)){var y=v.getLocation(e,q.LEFT),k=v.getLocation(e,q.RIGHT);if(k!==x.NONE){if(k!==s)throw new nt("side location conflict",c.getCoordinate());y===x.NONE&&ie.shouldNeverReachHere("found single null side (at "+c.getCoordinate()+")"),s=y}else ie.isTrue(v.getLocation(e,q.LEFT)===x.NONE,"found single null side"),v.setLocation(e,q.RIGHT,s),v.setLocation(e,q.LEFT,s)}}}},{key:"getCoordinate",value:function(){var e=this.iterator();return e.hasNext()?e.next().getCoordinate():null}},{key:"print",value:function(e){Ge.out.println("EdgeEndStar: "+this.getCoordinate());for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"isAreaLabelsConsistent",value:function(e){return this.computeEdgeEndLabels(e.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(e){var t=this.getEdges();if(t.size()<=0)return!0;var n=t.size()-1,i=t.get(n).getLabel().getLocation(e,q.LEFT);ie.isTrue(i!==x.NONE,"Found unlabelled area edge");for(var s=i,o=this.iterator();o.hasNext();){var c=o.next().getLabel();ie.isTrue(c.isArea(e),"Found non-area edge");var v=c.getLocation(e,q.LEFT),y=c.getLocation(e,q.RIGHT);if(v===y||y!==s)return!1;s=v}return!0}},{key:"findIndex",value:function(e){this.iterator();for(var t=0;t<this._edgeList.size();t++)if(this._edgeList.get(t)===e)return t;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(e,t,n){return this._ptInAreaLocation[e]===x.NONE&&(this._ptInAreaLocation[e]=Ku.locate(t,n[e].getGeometry())),this._ptInAreaLocation[e]}},{key:"toString",value:function(){var e=new Qt;e.append("EdgeEndStar: "+this.getCoordinate()),e.append(`
|
|
27
|
-
`);for(var t=this.iterator();t.hasNext();){var n=t.next();e.append(n),e.append(`
|
|
28
|
-
`)}return e.toString()}},{key:"computeEdgeEndLabels",value:function(e){for(var t=this.iterator();t.hasNext();)t.next().computeLabel(e)}},{key:"computeLabelling",value:function(e){this.computeEdgeEndLabels(e[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var t=[!1,!1],n=this.iterator();n.hasNext();)for(var i=n.next().getLabel(),s=0;s<2;s++)i.isLine(s)&&i.getLocation(s)===x.BOUNDARY&&(t[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 k=x.NONE;if(t[y])k=x.EXTERIOR;else{var S=c.getCoordinate();k=this.getLocation(y,S,e)}v.setAllLocationsIfNull(y,k)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(e,t){this._edgeMap.put(e,t),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new sn,this._edgeList=null,this._ptInAreaLocation=[x.NONE,x.NONE]}}]),r}(),eo=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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 nt("no outgoing dirEdge found",this.getCoordinate());ie.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 Ce.isNorthern(c)&&Ce.isNorthern(v)?s:Ce.isNorthern(c)||Ce.isNorthern(v)?s.getDy()!==0?s:o.getDy()!==0?o:(ie.shouldNeverReachHere("found two horizontal edges incident on node"),null):o}},{key:"print",value:function(n){Ge.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(q.LEFT),o=n.getDepth(q.RIGHT),c=this.computeDepths(i+1,this._edgeList.size(),s),v=this.computeDepths(0,i,c);if(v!==o)throw new nt("depth mismatch at "+n.getCoordinate())}else if(arguments.length===3){for(var y=arguments[0],k=arguments[1],S=arguments[2],C=S,F=y;F<k;F++){var A=this._edgeList.get(F);A.setEdgeDepths(q.RIGHT,C),C=A.getDepth(q.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&&(ie.isTrue(i!==null,"found null for first outgoing dirEdge"),ie.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=x.NONE,i=this.iterator();i.hasNext();){var s=i.next(),o=s.getSym();if(!s.isLineEdge()){if(s.isInResult()){n=x.INTERIOR;break}if(o.isInResult()){n=x.EXTERIOR;break}}}if(n===x.NONE)return null;for(var c=n,v=this.iterator();v.hasNext();){var y=v.next(),k=y.getSym();y.isLineEdge()?y.getEdge().setCovered(c===x.INTERIOR):(y.isInResult()&&(c=x.EXTERIOR),k.isInResult()&&(c=x.INTERIOR))}}},{key:"computeLabelling",value:function(n){L(d(t.prototype),"computeLabelling",this).call(this,n),this._label=new Ye(x.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!==x.INTERIOR&&c!==x.BOUNDARY||this._label.setLocation(o,x.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),t}(Ju),to=function(r){g(t,r);var e=E(t);function t(){return a(this,t),e.call(this)}return h(t,[{key:"createNode",value:function(n){return new Fn(n,new eo)}}]),t}(is),ys=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"compareTo",value:function(e){var t=e;return r.compareOriented(this._pts,this._orientation,t._pts,t._orientation)}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=r.orientation(e)}},{key:"orientation",value:function(e){return xe.increasingDirection(e)===1}},{key:"compareOriented",value:function(e,t,n,i){for(var s=t?1:-1,o=i?1:-1,c=t?e.length:-1,v=i?n.length:-1,y=t?0:e.length-1,k=i?0:n.length-1;;){var S=e[y].compareTo(n[k]);if(S!==0)return S;var C=(y+=s)===c,F=(k+=o)===v;if(C&&!F)return-1;if(!C&&F)return 1;if(C&&F)return 0}}}]),r}(),no=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"print",value:function(e){e.print("MULTILINESTRING ( ");for(var t=0;t<this._edges.size();t++){var n=this._edges.get(t);t>0&&e.print(","),e.print("(");for(var i=n.getCoordinates(),s=0;s<i.length;s++)s>0&&e.print(","),e.print(i[s].x+" "+i[s].y);e.println(")")}e.print(") ")}},{key:"addAll",value:function(e){for(var t=e.iterator();t.hasNext();)this.add(t.next())}},{key:"findEdgeIndex",value:function(e){for(var t=0;t<this._edges.size();t++)if(this._edges.get(t).equals(e))return t;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(e){return this._edges.get(e)}},{key:"findEqualEdge",value:function(e){var t=new ys(e.getCoordinates());return this._ocaMap.get(t)}},{key:"add",value:function(e){this._edges.add(e);var t=new ys(e.getCoordinates());this._ocaMap.put(t,e)}}],[{key:"constructor_",value:function(){this._edges=new W,this._ocaMap=new sn}}]),r}(),ms=function(){function r(){a(this,r)}return h(r,[{key:"processIntersections",value:function(e,t,n,i){}},{key:"isDone",value:function(){}}]),r}(),io=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"isTrivialIntersection",value:function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(r.isAdjacentSegments(t,i))return!0;if(e.isClosed()){var s=e.size()-1;if(t===0&&i===s||i===0&&t===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(e,t,n,i){if(e===n&&t===i)return null;this.numTests++;var s=e.getCoordinates()[t],o=e.getCoordinates()[t+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(e,t,n,i)||(this._hasIntersection=!0,e.addIntersections(this._li,t,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[ms]}}],[{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 e=arguments[0];this._li=e}},{key:"isAdjacentSegments",value:function(e,t){return Math.abs(e-t)===1}}]),r}(),ro=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(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex),e.println(" dist = "+this.dist)}},{key:"compareTo",value:function(e){var t=e;return this.compare(t.segmentIndex,t.dist)}},{key:"isEndPoint",value:function(e){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===e}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(e,t){return this.segmentIndex<e?-1:this.segmentIndex>e?1:this.dist<t?-1:this.dist>t?1:0}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var e=arguments[0],t=arguments[1],n=arguments[2];this.coord=new T(e),this.segmentIndex=t,this.dist=n}}]),r}(),so=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"print",value:function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(e){this.addEndpoints();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next(),s=this.createSplitEdge(n,i);e.add(s),n=i}}},{key:"addEndpoints",value:function(){var e=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[e],e,0)}},{key:"createSplitEdge",value:function(e,t){var n=t.segmentIndex-e.segmentIndex+2,i=this.edge.pts[t.segmentIndex],s=t.dist>0||!t.coord.equals2D(i);s||n--;var o=new Array(n).fill(null),c=0;o[c++]=new T(e.coord);for(var v=e.segmentIndex+1;v<=t.segmentIndex;v++)o[c++]=this.edge.pts[v];return s&&(o[c]=t.coord),new ps(o,new Ye(this.edge._label))}},{key:"add",value:function(e,t,n){var i=new ro(e,t,n),s=this._nodeMap.get(i);return s!==null?s:(this._nodeMap.put(i,i),i)}},{key:"isIntersection",value:function(e){for(var t=this.iterator();t.hasNext();)if(t.next().coord.equals(e))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new sn,this.edge=null;var e=arguments[0];this.edge=e}}]),r}(),ao=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[x.INTERIOR][x.INTERIOR])||r.isTrue(this._matrix[x.INTERIOR][x.BOUNDARY])||r.isTrue(this._matrix[x.BOUNDARY][x.INTERIOR])||r.isTrue(this._matrix[x.BOUNDARY][x.BOUNDARY]))&&this._matrix[x.EXTERIOR][x.INTERIOR]===Y.FALSE&&this._matrix[x.EXTERIOR][x.BOUNDARY]===Y.FALSE}},{key:"isCoveredBy",value:function(){return(r.isTrue(this._matrix[x.INTERIOR][x.INTERIOR])||r.isTrue(this._matrix[x.INTERIOR][x.BOUNDARY])||r.isTrue(this._matrix[x.BOUNDARY][x.INTERIOR])||r.isTrue(this._matrix[x.BOUNDARY][x.BOUNDARY]))&&this._matrix[x.INTERIOR][x.EXTERIOR]===Y.FALSE&&this._matrix[x.BOUNDARY][x.EXTERIOR]===Y.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var e=arguments[0],t=0;t<e.length;t++){var n=Math.trunc(t/3),i=t%3;this._matrix[n][i]=Y.toDimensionValue(e.charAt(t))}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[x.INTERIOR][x.INTERIOR])&&this._matrix[x.EXTERIOR][x.INTERIOR]===Y.FALSE&&this._matrix[x.EXTERIOR][x.BOUNDARY]===Y.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var e=arguments[0],t=0;t<e.length;t++){var n=Math.trunc(t/3),i=t%3;this.setAtLeast(n,i,Y.toDimensionValue(e.charAt(t)))}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(e,t,n){e>=0&&t>=0&&this.setAtLeast(e,t,n)}},{key:"isWithin",value:function(){return r.isTrue(this._matrix[x.INTERIOR][x.INTERIOR])&&this._matrix[x.INTERIOR][x.EXTERIOR]===Y.FALSE&&this._matrix[x.BOUNDARY][x.EXTERIOR]===Y.FALSE}},{key:"isTouches",value:function(e,t){return e>t?this.isTouches(t,e):(e===Y.A&&t===Y.A||e===Y.L&&t===Y.L||e===Y.L&&t===Y.A||e===Y.P&&t===Y.A||e===Y.P&&t===Y.L)&&this._matrix[x.INTERIOR][x.INTERIOR]===Y.FALSE&&(r.isTrue(this._matrix[x.INTERIOR][x.BOUNDARY])||r.isTrue(this._matrix[x.BOUNDARY][x.INTERIOR])||r.isTrue(this._matrix[x.BOUNDARY][x.BOUNDARY]))}},{key:"isOverlaps",value:function(e,t){return e===Y.P&&t===Y.P||e===Y.A&&t===Y.A?r.isTrue(this._matrix[x.INTERIOR][x.INTERIOR])&&r.isTrue(this._matrix[x.INTERIOR][x.EXTERIOR])&&r.isTrue(this._matrix[x.EXTERIOR][x.INTERIOR]):e===Y.L&&t===Y.L&&this._matrix[x.INTERIOR][x.INTERIOR]===1&&r.isTrue(this._matrix[x.INTERIOR][x.EXTERIOR])&&r.isTrue(this._matrix[x.EXTERIOR][x.INTERIOR])}},{key:"isEquals",value:function(e,t){return e===t&&r.isTrue(this._matrix[x.INTERIOR][x.INTERIOR])&&this._matrix[x.INTERIOR][x.EXTERIOR]===Y.FALSE&&this._matrix[x.BOUNDARY][x.EXTERIOR]===Y.FALSE&&this._matrix[x.EXTERIOR][x.INTERIOR]===Y.FALSE&&this._matrix[x.EXTERIOR][x.BOUNDARY]===Y.FALSE}},{key:"toString",value:function(){for(var e=new Pn("123456789"),t=0;t<3;t++)for(var n=0;n<3;n++)e.setCharAt(3*t+n,Y.toDimensionSymbol(this._matrix[t][n]));return e.toString()}},{key:"setAll",value:function(e){for(var t=0;t<3;t++)for(var n=0;n<3;n++)this._matrix[t][n]=e}},{key:"get",value:function(e,t){return this._matrix[e][t]}},{key:"transpose",value:function(){var e=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=e,e=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=e,e=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=e,this}},{key:"matches",value:function(e){if(e.length!==9)throw new D("Should be length 9: "+e);for(var t=0;t<3;t++)for(var n=0;n<3;n++)if(!r.matches(this._matrix[t][n],e.charAt(3*t+n)))return!1;return!0}},{key:"add",value:function(e){for(var t=0;t<3;t++)for(var n=0;n<3;n++)this.setAtLeast(t,n,e.get(t,n))}},{key:"isDisjoint",value:function(){return this._matrix[x.INTERIOR][x.INTERIOR]===Y.FALSE&&this._matrix[x.INTERIOR][x.BOUNDARY]===Y.FALSE&&this._matrix[x.BOUNDARY][x.INTERIOR]===Y.FALSE&&this._matrix[x.BOUNDARY][x.BOUNDARY]===Y.FALSE}},{key:"isCrosses",value:function(e,t){return e===Y.P&&t===Y.L||e===Y.P&&t===Y.A||e===Y.L&&t===Y.A?r.isTrue(this._matrix[x.INTERIOR][x.INTERIOR])&&r.isTrue(this._matrix[x.INTERIOR][x.EXTERIOR]):e===Y.L&&t===Y.P||e===Y.A&&t===Y.P||e===Y.A&&t===Y.L?r.isTrue(this._matrix[x.INTERIOR][x.INTERIOR])&&r.isTrue(this._matrix[x.EXTERIOR][x.INTERIOR]):e===Y.L&&t===Y.L&&this._matrix[x.INTERIOR][x.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 e=arguments[0];r.constructor_.call(this),this.set(e)}else if(arguments[0]instanceof r){var t=arguments[0];r.constructor_.call(this),this._matrix[x.INTERIOR][x.INTERIOR]=t._matrix[x.INTERIOR][x.INTERIOR],this._matrix[x.INTERIOR][x.BOUNDARY]=t._matrix[x.INTERIOR][x.BOUNDARY],this._matrix[x.INTERIOR][x.EXTERIOR]=t._matrix[x.INTERIOR][x.EXTERIOR],this._matrix[x.BOUNDARY][x.INTERIOR]=t._matrix[x.BOUNDARY][x.INTERIOR],this._matrix[x.BOUNDARY][x.BOUNDARY]=t._matrix[x.BOUNDARY][x.BOUNDARY],this._matrix[x.BOUNDARY][x.EXTERIOR]=t._matrix[x.BOUNDARY][x.EXTERIOR],this._matrix[x.EXTERIOR][x.INTERIOR]=t._matrix[x.EXTERIOR][x.INTERIOR],this._matrix[x.EXTERIOR][x.BOUNDARY]=t._matrix[x.EXTERIOR][x.BOUNDARY],this._matrix[x.EXTERIOR][x.EXTERIOR]=t._matrix[x.EXTERIOR][x.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var e=arguments[0],t=arguments[1];return t===Y.SYM_DONTCARE||t===Y.SYM_TRUE&&(e>=0||e===Y.TRUE)||t===Y.SYM_FALSE&&e===Y.FALSE||t===Y.SYM_P&&e===Y.P||t===Y.SYM_L&&e===Y.L||t===Y.SYM_A&&e===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(e){return e>=0||e===Y.TRUE}}]),r}(),uo=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(e){return e===null||e.length===0?null:(this.ensureCapacity(this._size+e.length),Ge.arraycopy(e,0,this._data,this._size,e.length),void(this._size+=e.length))}},{key:"ensureCapacity",value:function(e){if(e<=this._data.length)return null;var t=Math.max(e,2*this._data.length);this._data=xt.copyOf(this._data,t)}},{key:"toArray",value:function(){var e=new Array(this._size).fill(null);return Ge.arraycopy(this._data,0,e,0,this._size),e}},{key:"add",value:function(e){this.ensureCapacity(this._size+1),this._data[this._size]=e,++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 e=arguments[0];this._data=new Array(e).fill(null)}}}]),r}(),oo=function(){function r(){a(this,r)}return h(r,[{key:"getChainStartIndices",value:function(e){var t=0,n=new uo(Math.trunc(e.length/2));n.add(t);do{var i=this.findChainEnd(e,t);n.add(i),t=i}while(t<e.length-1);return n.toArray()}},{key:"findChainEnd",value:function(e,t){for(var n=Ce.quadrant(e[t],e[t+1]),i=t+1;i<e.length&&Ce.quadrant(e[i-1],e[i])===n;)i++;return i-1}},{key:"OLDgetChainStartIndices",value:function(e){var t=0,n=new W;n.add(t);do{var i=this.findChainEnd(e,t);n.add(i),t=i}while(t<e.length-1);return r.toIntArray(n)}}],[{key:"toIntArray",value:function(e){for(var t=new Array(e.size()).fill(null),n=0;n<t.length;n++)t[n]=e.get(n).intValue();return t}}]),r}(),lo=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(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return t>n?t:n}},{key:"getMinX",value:function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return t<n?t:n}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[e],this.startIndex[e+1],t,t.startIndex[n],t.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],k=arguments[5];if(o-s==1&&y-v==1)return k.addIntersections(this.e,s,c.e,v),null;if(!this.overlaps(s,o,c,v,y))return null;var S=Math.trunc((s+o)/2),C=Math.trunc((v+y)/2);s<S&&(v<C&&this.computeIntersectsForChain(s,S,c,v,C,k),C<y&&this.computeIntersectsForChain(s,S,c,C,y,k)),S<o&&(v<C&&this.computeIntersectsForChain(S,o,c,v,C,k),C<y&&this.computeIntersectsForChain(S,o,c,C,y,k))}}},{key:"overlaps",value:function(e,t,n,i,s){return ye.intersects(this.pts[e],this.pts[t],n.pts[i],n.pts[s])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(e,t){for(var n=0;n<this.startIndex.length-1;n++)for(var i=0;i<e.startIndex.length-1;i++)this.computeIntersectsForChain(n,e,i,t)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var e=arguments[0];this.e=e,this.pts=e.getCoordinates();var t=new oo;this.startIndex=t.getChainStartIndices(this.pts)}}]),r}(),ds=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"getDepth",value:function(e,t){return this._depth[e][t]}},{key:"setDepth",value:function(e,t,n){this._depth[e][t]=n}},{key:"isNull",value:function(){if(arguments.length===0){for(var e=0;e<2;e++)for(var t=0;t<3;t++)if(this._depth[e][t]!==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 e=0;e<2;e++)if(!this.isNull(e)){var t=this._depth[e][1];this._depth[e][2]<t&&(t=this._depth[e][2]),t<0&&(t=0);for(var n=1;n<3;n++){var i=0;this._depth[e][n]>t&&(i=1),this._depth[e][n]=i}}}},{key:"getDelta",value:function(e){return this._depth[e][q.RIGHT]-this._depth[e][q.LEFT]}},{key:"getLocation",value:function(e,t){return this._depth[e][t]<=0?x.EXTERIOR:x.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 e=arguments[0],t=0;t<2;t++)for(var n=1;n<3;n++){var i=e.getLocation(t,n);i!==x.EXTERIOR&&i!==x.INTERIOR||(this.isNull(t,n)?this._depth[t][n]=r.depthAtLocation(i):this._depth[t][n]+=r.depthAtLocation(i))}else if(arguments.length===3){var s=arguments[0],o=arguments[1],c=arguments[2];c===x.INTERIOR&&this._depth[s][o]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var t=0;t<3;t++)this._depth[e][t]=r.NULL_VALUE}},{key:"depthAtLocation",value:function(e){return e===x.EXTERIOR?0:e===x.INTERIOR?1:r.NULL_VALUE}}]),r}();ds.NULL_VALUE=-1;var ps=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{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 t(n,Ye.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 t))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){t.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 lo(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new ye;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),k=v+1;if(k<this.pts.length){var S=this.pts[k];c.equals2D(S)&&(v=k,y=0)}this.eiList.add(c,v,y)}},{key:"toString",value:function(){var n=new Pn;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 so(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new ds,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.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 ao&&arguments[0]instanceof Ye))return L(d(t),"updateIM",this).apply(this,arguments);var n=arguments[0],i=arguments[1];i.setAtLeastIfValid(n.getLocation(0,q.ON),n.getLocation(1,q.ON),1),n.isArea()&&(i.setAtLeastIfValid(n.getLocation(0,q.LEFT),n.getLocation(1,q.LEFT),2),i.setAtLeastIfValid(n.getLocation(0,q.RIGHT),n.getLocation(1,q.RIGHT),2))}}]),t}(Kr),_s=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"setWorkingPrecisionModel",value:function(e){this._workingPrecisionModel=e}},{key:"insertUniqueEdge",value:function(e){var t=this._edgeList.findEqualEdge(e);if(t!==null){var n=t.getLabel(),i=e.getLabel();t.isPointwiseEqual(e)||(i=new Ye(e.getLabel())).flip(),n.merge(i);var s=r.depthDelta(i),o=t.getDepthDelta()+s;t.setDepthDelta(o)}else this._edgeList.add(e),e.setDepthDelta(r.depthDelta(e.getLabel()))}},{key:"buildSubgraphs",value:function(e,t){for(var n=new W,i=e.iterator();i.hasNext();){var s=i.next(),o=s.getRightmostCoordinate(),c=new fs(n).getDepth(o);s.computeDepth(c),s.findResultEdges(),n.add(s),t.add(s.getDirectedEdges(),s.getNodes())}}},{key:"createSubgraphs",value:function(e){for(var t=new W,n=e.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var s=new vu;s.create(i),t.add(s)}}return Ft.sort(t,Ft.reverseOrder()),t}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(e){if(this._workingNoder!==null)return this._workingNoder;var t=new ki,n=new It;return n.setPrecisionModel(e),t.setSegmentIntersector(new io(n)),t}},{key:"buffer",value:function(e,t){var n=this._workingPrecisionModel;n===null&&(n=e.getPrecisionModel()),this._geomFact=e.getFactory();var i=new Zu(n,this._bufParams),s=new ju(e,t,i).getCurves();if(s.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(s,n),this._graph=new rs(new to),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),c=new Pu(this._geomFact);this.buildSubgraphs(o,c);var v=c.getPolygons();return v.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(v)}},{key:"computeNodedEdges",value:function(e,t){var n=this.getNoder(t);n.computeNodes(e);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 ps(s.getCoordinates(),new Ye(c));this.insertUniqueEdge(v)}}}},{key:"setNoder",value:function(e){this._workingNoder=e}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new no;var e=arguments[0];this._bufParams=e}},{key:"depthDelta",value:function(e){var t=e.getLocation(0,q.LEFT),n=e.getLocation(0,q.RIGHT);return t===x.INTERIOR&&n===x.EXTERIOR?1:t===x.EXTERIOR&&n===x.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(e){for(var t=new At,n=new W;e.hasNext();){var i=e.next(),s=t.createLineString(i.getCoordinates());n.add(s)}return t.buildGeometry(n)}}]),r}(),ho=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"rescale",value:function(){if(ee(arguments[0],je))for(var e=arguments[0],t=e.iterator();t.hasNext();){var n=t.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])&&Ge.out.println(i)}}},{key:"scale",value:function(){if(ee(arguments[0],je)){for(var e=arguments[0],t=new W(e.size()),n=e.iterator();n.hasNext();){var i=n.next();t.add(new Nt(this.scale(i.getCoordinates()),i.getData()))}return t}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=xe.removeRepeatedPoints(o);return v}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var e=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(e),e}},{key:"computeNodes",value:function(e){var t=e;this._isScaled&&(t=this.scale(e)),this._noder.computeNodes(t)}},{key:"interfaces_",get:function(){return[xi]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var e=arguments[0],t=arguments[1];r.constructor_.call(this,e,t,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}(),xs=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var t=e.next(),n=t.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 Ne("found endpt/interior pt intersection at index "+y+" :pt "+i)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();)for(var t=e.next(),n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkInteriorIntersections(t,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 k=0;k<v.length-1;k++)this.checkInteriorIntersections(s,y,o,k);else if(arguments.length===4){var S=arguments[0],C=arguments[1],F=arguments[2],A=arguments[3];if(S===F&&C===A)return null;var Z=S.getCoordinates()[C],j=S.getCoordinates()[C+1],J=F.getCoordinates()[A],ce=F.getCoordinates()[A+1];if(this._li.computeIntersection(Z,j,J,ce),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Z,j)||this.hasInteriorIntersection(this._li,J,ce)))throw new Ne("found non-noded intersection at "+Z+"-"+j+" and "+J+"-"+ce)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var t=e.next();this.checkCollapses(t)}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(e,t,n){for(var i=0;i<e.getIntersectionNum();i++){var s=e.getIntersection(i);if(!s.equals(t)&&!s.equals(n))return!0}return!1}},{key:"checkCollapse",value:function(e,t,n){if(e.equals(n))throw new Ne("found non-noded collapse at "+r.fact.createLineString([e,t,n]))}}],[{key:"constructor_",value:function(){this._li=new It,this._segStrings=null;var e=arguments[0];this._segStrings=e}}]),r}();xs.fact=new At;var Ii=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"intersectsScaled",value:function(e,t){var n=Math.min(e.x,t.x),i=Math.max(e.x,t.x),s=Math.min(e.y,t.y),o=Math.max(e.y,t.y),c=this._maxx<n||this._minx>i||this._maxy<s||this._miny>o;if(c)return!1;var v=this.intersectsToleranceSquare(e,t);return ie.isTrue(!(c&&v),"Found bad envelope test"),v}},{key:"initCorners",value:function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,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(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(e){return Math.round(e*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var e=r.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new ye(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(e,t){var n=!1,i=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!n||!i)||!!e.equals(this._pt)||!!t.equals(this._pt))))}},{key:"addSnappedNode",value:function(e,t){var n=e.getCoordinate(t),i=e.getCoordinate(t+1);return!!this.intersects(n,i)&&(e.addIntersection(this.getCoordinate(),t),!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 e=arguments[0],t=arguments[1],n=arguments[2];if(this._originalPt=e,this._pt=e,this._scaleFactor=t,this._li=n,t<=0)throw new D("Scale factor must be non-zero");t!==1&&(this._pt=new T(this.scale(e.x),this.scale(e.y)),this._p0Scaled=new T,this._p1Scaled=new T),this.initCorners(this._pt)}}]),r}();Ii.SAFE_ENV_EXPANSION_FACTOR=.75;var co=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 e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new be}}]),r}(),ks=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"snap",value:function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],s=t.getSafeEnvelope(),o=new Es(t,n,i);return this._index.query(s,new(function(){function c(){a(this,c)}return h(c,[{key:"interfaces_",get:function(){return[as]}},{key:"visitItem",value:function(v){v.select(s,o)}}]),c}())),o.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var e=arguments[0];this._index=e}}]),r}(),Es=function(r){g(t,r);var e=E(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return h(t,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof os))return L(d(t.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}}]),t}(co);ks.HotPixelSnapAction=Es;var fo=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"processIntersections",value:function(e,t,n,i){if(e===n&&t===i)return null;var s=e.getCoordinates()[t],o=e.getCoordinates()[t+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));e.addIntersections(this._li,t,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[ms]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new W}}]),r}(),go=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"checkCorrectness",value:function(e){var t=Nt.getNodedSubstrings(e),n=new xs(t);try{n.checkValid()}catch(i){if(!(i instanceof G))throw i;i.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return Nt.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(e,t){var n=this.findInteriorIntersections(e,t);this.computeIntersectionSnaps(n),this.computeVertexSnaps(e)}},{key:"findInteriorIntersections",value:function(e,t){var n=new fo(t);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(e),n.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(ee(arguments[0],je))for(var e=arguments[0],t=e.iterator();t.hasNext();){var n=t.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Nt)for(var i=arguments[0],s=i.getCoordinates(),o=0;o<s.length;o++){var c=new Ii(s[o],this._scaleFactor,this._li),v=this._pointSnapper.snap(c,i,o);v&&i.addIntersection(s[o],o)}}},{key:"computeNodes",value:function(e){this._nodedSegStrings=e,this._noder=new ki,this._pointSnapper=new ks(this._noder.getIndex()),this.snapRound(e,this._li)}},{key:"computeIntersectionSnaps",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next(),i=new Ii(n,this._scaleFactor,this._li);this._pointSnapper.snap(i)}}},{key:"interfaces_",get:function(){return[xi]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var e=arguments[0];this._pm=e,this._li=new It,this._li.setPrecisionModel(e),this._scaleFactor=e.getScale()}}]),r}(),Yt=function(){function r(){a(this,r),r.constructor_.apply(this,arguments)}return h(r,[{key:"bufferFixedPrecision",value:function(e){var t=new ho(new go(new Ue(1)),e.getScale()),n=new _s(this._bufParams);n.setWorkingPrecisionModel(e),n.setNoder(t),this._resultGeometry=n.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var e=r.MAX_PRECISION_DIGITS;e>=0;e--){try{this.bufferReducedPrecision(e)}catch(s){if(!(s instanceof nt))throw s;this._saveException=s}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var t=arguments[0],n=r.precisionScaleFactor(this._argGeom,this._distance,t),i=new Ue(n);this.bufferFixedPrecision(i)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===Ue.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(e){this._bufParams.setQuadrantSegments(e)}},{key:"bufferOriginalPrecision",value:function(){try{var e=new _s(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof Ne))throw t;this._saveException=t}}},{key:"getResultGeometry",value:function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(e){this._bufParams.setEndCapStyle(e)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new P,this._resultGeometry=null,this._saveException=null,arguments.length===1){var e=arguments[0];this._argGeom=e}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this._argGeom=t,this._bufParams=n}}},{key:"bufferOp",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new r(e),i=n.getResultGeometry(t);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 P&&arguments[0]instanceof $&&typeof arguments[1]=="number"){var k=arguments[0],S=arguments[1],C=arguments[2],F=new r(k,C),A=F.getResultGeometry(S);return A}}else if(arguments.length===4){var Z=arguments[0],j=arguments[1],J=arguments[2],ce=arguments[3],_e=new r(Z);_e.setQuadrantSegments(J),_e.setEndCapStyle(ce);var Se=_e.getResultGeometry(j);return Se}}},{key:"precisionScaleFactor",value:function(e,t,n){var i=e.getEnvelopeInternal(),s=Kt.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(t>0?t:0),o=n-Math.trunc(Math.log(s)/Math.log(10)+1);return Math.pow(10,o)}}]),r}();Yt.CAP_ROUND=P.CAP_ROUND,Yt.CAP_BUTT=P.CAP_FLAT,Yt.CAP_FLAT=P.CAP_FLAT,Yt.CAP_SQUARE=P.CAP_SQUARE,Yt.MAX_PRECISION_DIGITS=12;var vo=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Is=function(){function r(e){a(this,r),this.geometryFactory=e||new At}return h(r,[{key:"read",value:function(e){var t,n=(t=typeof e=="string"?JSON.parse(e):e).type;if(!Be[n])throw new Error("Unknown GeoJSON type: "+t.type);return vo.indexOf(n)!==-1?Be[n].call(this,t.coordinates):n==="GeometryCollection"?Be[n].call(this,t.geometries):Be[n].call(this,t)}},{key:"write",value:function(e){var t=e.getGeometryType();if(!Je[t])throw new Error("Geometry is not supported");return Je[t].call(this,e)}}]),r}(),Be={Feature:function(r){var e={};for(var t in r)e[t]=r[t];if(r.geometry){var n=r.geometry.type;if(!Be[n])throw new Error("Unknown GeoJSON type: "+r.type);e.geometry=this.read(r.geometry)}return r.bbox&&(e.bbox=Be.bbox.call(this,r.bbox)),e},FeatureCollection:function(r){var e={};if(r.features){e.features=[];for(var t=0;t<r.features.length;++t)e.features.push(this.read(r.features[t]))}return r.bbox&&(e.bbox=this.parse.bbox.call(this,r.bbox)),e},coordinates:function(r){for(var e=[],t=0;t<r.length;++t){var n=r[t];e.push(_(T,M(n)))}return e},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 e=_(T,M(r));return this.geometryFactory.createPoint(e)},MultiPoint:function(r){for(var e=[],t=0;t<r.length;++t)e.push(Be.Point.call(this,r[t]));return this.geometryFactory.createMultiPoint(e)},LineString:function(r){var e=Be.coordinates.call(this,r);return this.geometryFactory.createLineString(e)},MultiLineString:function(r){for(var e=[],t=0;t<r.length;++t)e.push(Be.LineString.call(this,r[t]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(r){for(var e=Be.coordinates.call(this,r[0]),t=this.geometryFactory.createLinearRing(e),n=[],i=1;i<r.length;++i){var s=r[i],o=Be.coordinates.call(this,s),c=this.geometryFactory.createLinearRing(o);n.push(c)}return this.geometryFactory.createPolygon(t,n)},MultiPolygon:function(r){for(var e=[],t=0;t<r.length;++t){var n=r[t];e.push(Be.Polygon.call(this,n))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(r){for(var e=[],t=0;t<r.length;++t){var n=r[t];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},Je={coordinate:function(r){var e=[r.x,r.y];return r.z&&e.push(r.z),r.m&&e.push(r.m),e},Point:function(r){return{type:"Point",coordinates:Je.coordinate.call(this,r.getCoordinate())}},MultiPoint:function(r){for(var e=[],t=0;t<r._geometries.length;++t){var n=r._geometries[t],i=Je.Point.call(this,n);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(r){for(var e=[],t=r.getCoordinates(),n=0;n<t.length;++n){var i=t[n];e.push(Je.coordinate.call(this,i))}return{type:"LineString",coordinates:e}},MultiLineString:function(r){for(var e=[],t=0;t<r._geometries.length;++t){var n=r._geometries[t],i=Je.LineString.call(this,n);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(r){var e=[],t=Je.LineString.call(this,r._shell);e.push(t.coordinates);for(var n=0;n<r._holes.length;++n){var i=r._holes[n],s=Je.LineString.call(this,i);e.push(s.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(r){for(var e=[],t=0;t<r._geometries.length;++t){var n=r._geometries[t],i=Je.Polygon.call(this,n);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(r){for(var e=[],t=0;t<r._geometries.length;++t){var n=r._geometries[t],i=n.getGeometryType();e.push(Je[i].call(this,n))}return{type:"GeometryCollection",geometries:e}}};return{BufferOp:Yt,GeoJSONReader:function(){function r(e){a(this,r),this.parser=new Is(e||new At)}return h(r,[{key:"read",value:function(e){return this.parser.read(e)}}]),r}(),GeoJSONWriter:function(){function r(){a(this,r),this.parser=new Is(this.geometryFactory)}return h(r,[{key:"write",value:function(e){return this.parser.write(e)}}]),r}()}})})(er);var wa=er.exports;const Sa=Na(wa);function ct(){return new yn}function yn(){this.reset()}yn.prototype={constructor:yn,reset:function(){this.s=this.t=0},add:function(l){tr(mn,l,this.t),tr(this,mn.s,this.s),this.s?this.t+=mn.t:this.s=mn.t},valueOf:function(){return this.s}};var mn=new yn;function tr(l,u,a){var f=l.s=u+a,h=f-u,g=f-h;l.t=u-g+(a-h)}var ge=1e-6,ue=Math.PI,Ze=ue/2,nr=ue/4,$e=ue*2,ft=180/ue,Fe=ue/180,ke=Math.abs,La=Math.atan,Rt=Math.atan2,de=Math.cos,pe=Math.sin,Ot=Math.sqrt;function ir(l){return l>1?0:l<-1?ue:Math.acos(l)}function dt(l){return l>1?Ze:l<-1?-Ze:Math.asin(l)}function $t(){}function dn(l,u){l&&sr.hasOwnProperty(l.type)&&sr[l.type](l,u)}var rr={Feature:function(l,u){dn(l.geometry,u)},FeatureCollection:function(l,u){for(var a=l.features,f=-1,h=a.length;++f<h;)dn(a[f].geometry,u)}},sr={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){Kn(l.coordinates,u,0)},MultiLineString:function(l,u){for(var a=l.coordinates,f=-1,h=a.length;++f<h;)Kn(a[f],u,0)},Polygon:function(l,u){ar(l.coordinates,u)},MultiPolygon:function(l,u){for(var a=l.coordinates,f=-1,h=a.length;++f<h;)ar(a[f],u)},GeometryCollection:function(l,u){for(var a=l.geometries,f=-1,h=a.length;++f<h;)dn(a[f],u)}};function Kn(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 ar(l,u){var a=-1,f=l.length;for(u.polygonStart();++a<f;)Kn(l[a],u,1);u.polygonEnd()}function Ta(l,u){l&&rr.hasOwnProperty(l.type)?rr[l.type](l,u):dn(l,u)}ct(),ct();function Jn(l){return[Rt(l[1],l[0]),dt(l[2])]}function bt(l){var u=l[0],a=l[1],f=de(a);return[f*de(u),f*pe(u),pe(a)]}function pn(l,u){return l[0]*u[0]+l[1]*u[1]+l[2]*u[2]}function _n(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 ei(l,u){l[0]+=u[0],l[1]+=u[1],l[2]+=u[2]}function xn(l,u){return[l[0]*u,l[1]*u,l[2]*u]}function ti(l){var u=Ot(l[0]*l[0]+l[1]*l[1]+l[2]*l[2]);l[0]/=u,l[1]/=u,l[2]/=u}ct();function ur(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 ni(l,u){return[l>ue?l-$e:l<-ue?l+$e:l,u]}ni.invert=ni;function Ca(l,u,a){return(l%=$e)?u||a?ur(lr(l),hr(u,a)):lr(l):u||a?hr(u,a):ni}function or(l){return function(u,a){return u+=l,[u>ue?u-$e:u<-ue?u+$e:u,a]}}function lr(l){var u=or(l);return u.invert=or(-l),u}function hr(l,u){var a=de(l),f=pe(l),h=de(u),g=pe(u);function d(p,w){var _=de(w),N=de(p)*_,m=pe(p)*_,I=pe(w),E=I*a+N*f;return[Rt(m*h-E*g,N*a-I*f),dt(E*h+m*g)]}return d.invert=function(p,w){var _=de(w),N=de(p)*_,m=pe(p)*_,I=pe(w),E=I*h-m*g;return[Rt(m*h+I*g,N*a+E*f),dt(E*a-N*f)]},d}function Ra(l,u,a,f,h,g){if(a){var d=de(u),p=pe(u),w=f*a;h==null?(h=u+f*$e,g=u-w/2):(h=cr(d,h),g=cr(d,g),(f>0?h<g:h>g)&&(h+=f*$e));for(var _,N=h;f>0?N>g:N<g;N-=w)_=Jn([d,-p*de(N),-p*pe(N)]),l.point(_[0],_[1])}}function cr(l,u){u=bt(u),u[0]-=l,ti(u);var a=ir(-u[1]);return((-u[2]<0?-a:a)+$e-ge)%$e}function fr(){var l=[],u;return{point:function(a,f){u.push([a,f])},lineStart:function(){l.push(u=[])},lineEnd:$t,rejoin:function(){l.length>1&&l.push(l.pop().concat(l.shift()))},result:function(){var a=l;return l=[],u=null,a}}}function Oa(l,u,a,f,h,g){var d=l[0],p=l[1],w=u[0],_=u[1],N=0,m=1,I=w-d,E=_-p,L;if(L=a-d,!(!I&&L>0)){if(L/=I,I<0){if(L<N)return;L<m&&(m=L)}else if(I>0){if(L>m)return;L>N&&(N=L)}if(L=h-d,!(!I&&L<0)){if(L/=I,I<0){if(L>m)return;L>N&&(N=L)}else if(I>0){if(L<N)return;L<m&&(m=L)}if(L=f-p,!(!E&&L>0)){if(L/=E,E<0){if(L<N)return;L<m&&(m=L)}else if(E>0){if(L>m)return;L>N&&(N=L)}if(L=g-p,!(!E&&L<0)){if(L/=E,E<0){if(L>m)return;L>N&&(N=L)}else if(E>0){if(L<N)return;L<m&&(m=L)}return N>0&&(l[0]=d+N*I,l[1]=p+N*E),m<1&&(u[0]=d+m*I,u[1]=p+m*E),!0}}}}}function kn(l,u){return ke(l[0]-u[0])<ge&&ke(l[1]-u[1])<ge}function En(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 gr(l,u,a,f,h){var g=[],d=[],p,w;if(l.forEach(function(L){if(!((M=L.length-1)<=0)){var M,R=L[0],O=L[M],b;if(kn(R,O)){for(h.lineStart(),p=0;p<M;++p)h.point((R=L[p])[0],R[1]);h.lineEnd();return}g.push(b=new En(R,L,null,!0)),d.push(b.o=new En(R,null,b,!1)),g.push(b=new En(O,L,null,!1)),d.push(b.o=new En(O,null,b,!0))}}),!!g.length){for(d.sort(u),vr(g),vr(d),p=0,w=d.length;p<w;++p)d[p].e=a=!a;for(var _=g[0],N,m;;){for(var I=_,E=!0;I.v;)if((I=I.n)===_)return;N=I.z,h.lineStart();do{if(I.v=I.o.v=!0,I.e){if(E)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(E)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,E=!E}while(!I.v);h.lineEnd()}}}function vr(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 yr(l,u){return l<u?-1:l>u?1:l>=u?0:NaN}function ba(l){return l.length===1&&(l=Ma(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 Ma(l){return function(u,a){return yr(l(u),a)}}ba(yr);function mr(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 jt=1e9,In=-jt;function Pa(l,u,a,f){function h(_,N){return l<=_&&_<=a&&u<=N&&N<=f}function g(_,N,m,I){var E=0,L=0;if(_==null||(E=d(_,m))!==(L=d(N,m))||w(_,N)<0^m>0)do I.point(E===0||E===3?l:a,E>1?f:u);while((E=(E+m+4)%4)!==L);else I.point(N[0],N[1])}function d(_,N){return ke(_[0]-l)<ge?N>0?0:3:ke(_[0]-a)<ge?N>0?2:1:ke(_[1]-u)<ge?N>0?1:0:N>0?3:2}function p(_,N){return w(_.x,N.x)}function w(_,N){var m=d(_,1),I=d(N,1);return m!==I?m-I:m===0?N[1]-_[1]:m===1?_[0]-N[0]:m===2?_[1]-N[1]:N[0]-_[0]}return function(_){var N=_,m=fr(),I,E,L,M,R,O,b,P,G,D,B,X={point:V,lineStart:re,lineEnd:oe,polygonStart:se,polygonEnd:te};function V(ne,le){h(ne,le)&&N.point(ne,le)}function U(){for(var ne=0,le=0,ve=E.length;le<ve;++le)for(var Ee=E[le],Ie=1,H=Ee.length,Te=Ee[0],Ne,Re,ie=Te[0],tt=Te[1];Ie<H;++Ie)Ne=ie,Re=tt,Te=Ee[Ie],ie=Te[0],tt=Te[1],Re<=f?tt>f&&(ie-Ne)*(f-Re)>(tt-Re)*(l-Ne)&&++ne:tt<=f&&(ie-Ne)*(f-Re)<(tt-Re)*(l-Ne)&&--ne;return ne}function se(){N=m,I=[],E=[],B=!0}function te(){var ne=U(),le=B&&ne,ve=(I=mr(I)).length;(le||ve)&&(_.polygonStart(),le&&(_.lineStart(),g(null,null,1,_),_.lineEnd()),ve&&gr(I,p,ne,g,_),_.polygonEnd()),N=_,I=E=L=null}function re(){X.point=z,E&&E.push(L=[]),D=!0,G=!1,b=P=NaN}function oe(){I&&(z(M,R),O&&G&&m.rejoin(),I.push(m.result())),X.point=V,G&&N.lineEnd()}function z(ne,le){var ve=h(ne,le);if(E&&L.push([ne,le]),D)M=ne,R=le,O=ve,D=!1,ve&&(N.lineStart(),N.point(ne,le));else if(ve&&G)N.point(ne,le);else{var Ee=[b=Math.max(In,Math.min(jt,b)),P=Math.max(In,Math.min(jt,P))],Ie=[ne=Math.max(In,Math.min(jt,ne)),le=Math.max(In,Math.min(jt,le))];Oa(Ee,Ie,l,u,a,f)?(G||(N.lineStart(),N.point(Ee[0],Ee[1])),N.point(Ie[0],Ie[1]),ve||N.lineEnd(),B=!1):ve&&(N.lineStart(),N.point(ne,le),B=!1)}b=ne,P=le,G=ve}return X}}var ii=ct();function Aa(l,u){var a=u[0],f=u[1],h=[pe(a),-de(a),0],g=0,d=0;ii.reset();for(var p=0,w=l.length;p<w;++p)if(N=(_=l[p]).length)for(var _,N,m=_[N-1],I=m[0],E=m[1]/2+nr,L=pe(E),M=de(E),R=0;R<N;++R,I=b,L=G,M=D,m=O){var O=_[R],b=O[0],P=O[1]/2+nr,G=pe(P),D=de(P),B=b-I,X=B>=0?1:-1,V=X*B,U=V>ue,se=L*G;if(ii.add(Rt(se*X*pe(V),M*D+se*de(V))),g+=U?B+X*$e:B,U^I>=a^b>=a){var te=_n(bt(m),bt(O));ti(te);var re=_n(h,te);ti(re);var oe=(U^B>=0?-1:1)*dt(re[2]);(f>oe||f===oe&&(te[0]||te[1]))&&(d+=U^B>=0?1:-1)}}return(g<-ge||g<ge&&ii<-ge)^d&1}ct();function dr(l){return l}ct(),ct();var Mt=1/0,Nn=Mt,Wt=-Mt,wn=Wt,pr={point:Da,lineStart:$t,lineEnd:$t,polygonStart:$t,polygonEnd:$t,result:function(){var l=[[Mt,Nn],[Wt,wn]];return Wt=wn=-(Nn=Mt=1/0),l}};function Da(l,u){l<Mt&&(Mt=l),l>Wt&&(Wt=l),u<Nn&&(Nn=u),u>wn&&(wn=u)}ct();function _r(l,u,a,f){return function(h,g){var d=u(g),p=h.invert(f[0],f[1]),w=fr(),_=u(w),N=!1,m,I,E,L={point:M,lineStart:O,lineEnd:b,polygonStart:function(){L.point=P,L.lineStart=G,L.lineEnd=D,I=[],m=[]},polygonEnd:function(){L.point=M,L.lineStart=O,L.lineEnd=b,I=mr(I);var B=Aa(m,p);I.length?(N||(g.polygonStart(),N=!0),gr(I,Ga,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 M(B,X){var V=h(B,X);l(B=V[0],X=V[1])&&g.point(B,X)}function R(B,X){var V=h(B,X);d.point(V[0],V[1])}function O(){L.point=R,d.lineStart()}function b(){L.point=M,d.lineEnd()}function P(B,X){E.push([B,X]);var V=h(B,X);_.point(V[0],V[1])}function G(){_.lineStart(),E=[]}function D(){P(E[0][0],E[0][1]),_.lineEnd();var B=_.clean(),X=w.result(),V,U=X.length,se,te,re;if(E.pop(),m.push(E),E=null,!!U){if(B&1){if(te=X[0],(se=te.length-1)>0){for(N||(g.polygonStart(),N=!0),g.lineStart(),V=0;V<se;++V)g.point((re=te[V])[0],re[1]);g.lineEnd()}return}U>1&&B&2&&X.push(X.pop().concat(X.shift())),I.push(X.filter(Fa))}}return L}}function Fa(l){return l.length>1}function Ga(l,u){return((l=l.x)[0]<0?l[1]-Ze-ge:Ze-l[1])-((u=u.x)[0]<0?u[1]-Ze-ge:Ze-u[1])}const xr=_r(function(){return!0},qa,za,[-ue,-Ze]);function qa(l){var u=NaN,a=NaN,f=NaN,h;return{lineStart:function(){l.lineStart(),h=1},point:function(g,d){var p=g>0?ue:-ue,w=ke(g-u);ke(w-ue)<ge?(l.point(u,a=(a+d)/2>0?Ze:-Ze),l.point(f,a),l.lineEnd(),l.lineStart(),l.point(p,a),l.point(g,a),h=0):f!==p&&w>=ue&&(ke(u-f)<ge&&(u-=f*ge),ke(g-p)<ge&&(g-=p*ge),a=Ya(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 Ya(l,u,a,f){var h,g,d=pe(l-a);return ke(d)>ge?La((pe(u)*(g=de(f))*pe(a)-pe(f)*(h=de(u))*pe(l))/(h*g*d)):(u+f)/2}function za(l,u,a,f){var h;if(l==null)h=a*Ze,f.point(-ue,h),f.point(0,h),f.point(ue,h),f.point(ue,0),f.point(ue,-h),f.point(0,-h),f.point(-ue,-h),f.point(-ue,0),f.point(-ue,h);else if(ke(l[0]-u[0])>ge){var g=l[0]<u[0]?ue:-ue;h=a*g/2,f.point(-g,h),f.point(0,h),f.point(g,h)}else f.point(u[0],u[1])}function Ba(l,u){var a=de(l),f=a>0,h=ke(a)>ge;function g(N,m,I,E){Ra(E,l,u,I,N,m)}function d(N,m){return de(N)*de(m)>a}function p(N){var m,I,E,L,M;return{lineStart:function(){L=E=!1,M=1},point:function(R,O){var b=[R,O],P,G=d(R,O),D=f?G?0:_(R,O):G?_(R+(R<0?ue:-ue),O):0;if(!m&&(L=E=G)&&N.lineStart(),G!==E&&(P=w(m,b),(!P||kn(m,P)||kn(b,P))&&(b[0]+=ge,b[1]+=ge,G=d(b[0],b[1]))),G!==E)M=0,G?(N.lineStart(),P=w(b,m),N.point(P[0],P[1])):(P=w(m,b),N.point(P[0],P[1]),N.lineEnd()),m=P;else if(h&&m&&f^G){var B;!(D&I)&&(B=w(b,m,!0))&&(M=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])))}G&&(!m||!kn(m,b))&&N.point(b[0],b[1]),m=b,E=G,I=D},lineEnd:function(){E&&N.lineEnd(),m=null},clean:function(){return M|(L&&E)<<1}}}function w(N,m,I){var E=bt(N),L=bt(m),M=[1,0,0],R=_n(E,L),O=pn(R,R),b=R[0],P=O-b*b;if(!P)return!I&&N;var G=a*O/P,D=-a*b/P,B=_n(M,R),X=xn(M,G),V=xn(R,D);ei(X,V);var U=B,se=pn(X,U),te=pn(U,U),re=se*se-te*(pn(X,X)-1);if(!(re<0)){var oe=Ot(re),z=xn(U,(-se-oe)/te);if(ei(z,X),z=Jn(z),!I)return z;var ne=N[0],le=m[0],ve=N[1],Ee=m[1],Ie;le<ne&&(Ie=ne,ne=le,le=Ie);var H=le-ne,Te=ke(H-ue)<ge,Ne=Te||H<ge;if(!Te&&Ee<ve&&(Ie=ve,ve=Ee,Ee=Ie),Ne?Te?ve+Ee>0^z[1]<(ke(z[0]-ne)<ge?ve:Ee):ve<=z[1]&&z[1]<=Ee:H>ue^(ne<=z[0]&&z[0]<=le)){var Re=xn(U,(-se+oe)/te);return ei(Re,X),[z,Jn(Re)]}}}function _(N,m){var I=f?l:ue-l,E=0;return N<-I?E|=1:N>I&&(E|=2),m<-I?E|=4:m>I&&(E|=8),E}return _r(d,p,g,f?[0,-l]:[-ue,l-ue])}function kr(l){return function(u){var a=new ri;for(var f in l)a[f]=l[f];return a.stream=u,a}}function ri(){}ri.prototype={constructor:ri,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 Er(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),Ta(a,l.stream(pr));var d=pr.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,_=+u[0][1]+(h-p*(d[1][1]+d[0][1]))/2;return g!=null&&l.clipExtent(g),l.scale(p*150).translate([w,_])}function Xa(l,u,a){return Er(l,[[0,0],u],a)}var Ir=16,Ua=de(30*Fe);function Nr(l,u){return+u?Ha(l,u):Va(l)}function Va(l){return kr({point:function(u,a){u=l(u,a),this.stream.point(u[0],u[1])}})}function Ha(l,u){function a(f,h,g,d,p,w,_,N,m,I,E,L,M,R){var O=_-f,b=N-h,P=O*O+b*b;if(P>4*u&&M--){var G=d+I,D=p+E,B=w+L,X=Ot(G*G+D*D+B*B),V=dt(B/=X),U=ke(ke(B)-1)<ge||ke(g-m)<ge?(g+m)/2:Rt(D,G),se=l(U,V),te=se[0],re=se[1],oe=te-f,z=re-h,ne=b*oe-O*z;(ne*ne/P>u||ke((O*oe+b*z)/P-.5)>.3||d*I+p*E+w*L<Ua)&&(a(f,h,g,d,p,w,te,re,U,G/=X,D/=X,B,M,R),R.point(te,re),a(te,re,U,G,D,B,_,N,m,I,E,L,M,R))}}return function(f){var h,g,d,p,w,_,N,m,I,E,L,M,R={point:O,lineStart:b,lineEnd:G,polygonStart:function(){f.polygonStart(),R.lineStart=D},polygonEnd:function(){f.polygonEnd(),R.lineStart=b}};function O(V,U){V=l(V,U),f.point(V[0],V[1])}function b(){m=NaN,R.point=P,f.lineStart()}function P(V,U){var se=bt([V,U]),te=l(V,U);a(m,I,N,E,L,M,m=te[0],I=te[1],N=V,E=se[0],L=se[1],M=se[2],Ir,f),f.point(m,I)}function G(){R.point=O,f.lineEnd()}function D(){b(),R.point=B,R.lineEnd=X}function B(V,U){P(h=V,U),g=m,d=I,p=E,w=L,_=M,R.point=P}function X(){a(m,I,N,E,L,M,g,d,h,p,w,_,Ir,f),R.lineEnd=G,G()}return R}}var Za=kr({point:function(l,u){this.stream.point(l*Fe,u*Fe)}});function $a(l){return ja(function(){return l})()}function ja(l){var u,a=150,f=480,h=250,g,d,p=0,w=0,_=0,N=0,m=0,I,E,L=null,M=xr,R=null,O,b,P,G=dr,D=.5,B=Nr(te,D),X,V;function U(z){return z=E(z[0]*Fe,z[1]*Fe),[z[0]*a+g,d-z[1]*a]}function se(z){return z=E.invert((z[0]-g)/a,(d-z[1])/a),z&&[z[0]*ft,z[1]*ft]}function te(z,ne){return z=u(z,ne),[z[0]*a+g,d-z[1]*a]}U.stream=function(z){return X&&V===z?X:X=Za(M(I,B(G(V=z))))},U.clipAngle=function(z){return arguments.length?(M=+z?Ba(L=z*Fe,6*Fe):(L=null,xr),oe()):L*ft},U.clipExtent=function(z){return arguments.length?(G=z==null?(R=O=b=P=null,dr):Pa(R=+z[0][0],O=+z[0][1],b=+z[1][0],P=+z[1][1]),oe()):R==null?null:[[R,O],[b,P]]},U.scale=function(z){return arguments.length?(a=+z,re()):a},U.translate=function(z){return arguments.length?(f=+z[0],h=+z[1],re()):[f,h]},U.center=function(z){return arguments.length?(p=z[0]%360*Fe,w=z[1]%360*Fe,re()):[p*ft,w*ft]},U.rotate=function(z){return arguments.length?(_=z[0]%360*Fe,N=z[1]%360*Fe,m=z.length>2?z[2]%360*Fe:0,re()):[_*ft,N*ft,m*ft]},U.precision=function(z){return arguments.length?(B=Nr(te,D=z*z),oe()):Ot(D)},U.fitExtent=function(z,ne){return Er(U,z,ne)},U.fitSize=function(z,ne){return Xa(U,z,ne)};function re(){E=ur(I=Ca(_,N,m),u);var z=u(p,w);return g=f-z[0]*a,d=h+z[1]*a,oe()}function oe(){return X=V=null,U}return function(){return u=l.apply(this,arguments),U.invert=u.invert&&se,re()}}function wr(l){return function(u,a){var f=de(u),h=de(a),g=l(f*h);return[g*h*pe(u),g*pe(a)]}}function Sr(l){return function(u,a){var f=Ot(u*u+a*a),h=l(f),g=pe(h),d=de(h);return[Rt(u*g,f*d),dt(f&&a*g/f)]}}var Wa=wr(function(l){return Ot(2/(1+l))});Wa.invert=Sr(function(l){return 2*dt(l/2)});var Lr=wr(function(l){return(l=ir(l))&&l/pe(l)});Lr.invert=Sr(function(l){return l});function Qa(){return $a(Lr).scale(79.4188).clipAngle(180-.001)}function Tr(l,u){return[l,u]}Tr.invert=Tr;var{BufferOp:Ka,GeoJSONReader:Ja,GeoJSONWriter:eu}=Sa;function tu(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 fn(l,function(d){var p=Sn(d,u,f,h);p&&g.push(p)}),mt(g);case"FeatureCollection":return Vi(l,function(d){var p=Sn(d,u,f,h);p&&Vi(p,function(w){w&&g.push(w)})}),mt(g)}return Sn(l,u,f,h)}function Sn(l,u,a,f){var h=l.properties||{},g=l.type==="Feature"?l.geometry:l;if(g.type==="GeometryCollection"){var d=[];return fn(l,function(M){var R=Sn(M,u,a,f);R&&d.push(R)}),mt(d)}var p=nu(g),w={type:g.type,coordinates:Rr(g.coordinates,p)},_=new Ja,N=_.read(w),m=Ls(Ts(u,a),"meters"),I=Ka.bufferOp(N,m,f),E=new eu;if(I=E.write(I),!Cr(I.coordinates)){var L={type:I.type,coordinates:Or(I.coordinates,p)};return Bt(L,h)}}function Cr(l){return Array.isArray(l[0])?Cr(l[0]):isNaN(l[0])}function Rr(l,u){return typeof l[0]!="object"?u(l):l.map(function(a){return Rr(a,u)})}function Or(l,u){return typeof l[0]!="object"?u.invert(l):l.map(function(a){return Or(a,u)})}function nu(l){var u=Ea(l).geometry.coordinates,a=[-u[0],-u[1]];return Qa().rotate(a).scale(fe)}var iu=tu;function ru(l){const u=[];if(fn(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=Xi.difference(u[0],...u.slice(1));return f.length===0?null:f.length===1?qn(f[0],a):Li(f,a)}var su=ru;function br(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 Mr(l,u){const a=su(mt([qn([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),l]));if(!a)return;a.properties={isMask:"y"};const f=iu(l,0);if(f){if(f.geometry.type==="Polygon")for(const h of f.geometry.coordinates)br(h);else for(const h of f.geometry.coordinates)for(const g of h)br(g);u(mt([f,a]))}}const Pr=mt([]);function au(l,u,a=!0,f=!0,h={},g={},d={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let p;const w=[];let _,N,m;function I(){!l.getSource("full-geom")&&(d!=null&&d.fill||d!=null&&d.line)&&l.addSource("full-geom",{type:"geojson",data:Pr}),!l.getLayer("full-geom-fill")&&(d!=null&&d.fill)&&l.addLayer({...d==null?void 0:d.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),!l.getLayer("full-geom-line")&&(d!=null&&d.line)&&l.addLayer({...d==null?void 0:d.line,id:"full-geom-line",type:"line",source:"full-geom"}),m&&M(m)}l.loaded()?I():l.once("load",()=>{I()}),l.on("styledata",()=>{I()});const E=R=>{p==null||p({type:"mapClick",coordinates:[R.lngLat.lng,R.lngLat.lat]})};function L(R=!1){if(!u)throw new Error;const O=document.createElement("div");return R&&O.classList.add("marker-interactive"),new xa({props:{displayIn:"maplibre"},target:O}),new u.Marker({element:O,offset:[1,-13]})}function M(R){var O;m=R,(O=l.getSource("full-geom"))==null||O.setData(R)}return{setEventHandler(R){R?(p=R,l.on("click",E)):(p=void 0,l.off("click",E))},flyTo(R,O){l.flyTo({center:R,zoom:O,...h})},fitBounds(R,O,b){l.fitBounds([[R[0],R[1]],[R[2],R[3]]],{padding:O,maxZoom:b,...g})},indicateReverse(R){l.getCanvasContainer().style.cursor=R?"crosshair":""},setReverseMarker(R){!u||!a||(N?R?N.setLngLat(R):(N.remove(),N=void 0):R&&(N=(typeof a=="object"?new u.Marker(a):L()).setLngLat(R).addTo(l),N.getElement().classList.add("marker-reverse")))},setMarkers(R,O){if(a){for(const b of w)b.remove();if(w.length=0,M(Pr),!!u){if(O){let b=!1;if(O.geometry.type==="GeometryCollection"){const P=O.geometry.geometries.filter(G=>G.type==="Polygon"||G.type==="MultiPolygon");e:if(P.length>0){const G=ea(mt(P.map(D=>Bt(D))));if(!G)break e;Mr({...O,geometry:G.geometry},M),b=!0}else{const G=O.geometry.geometries.filter(D=>D.type==="LineString"||D.type==="MultiLineString");G.length>0&&(M({...O,geometry:{type:"GeometryCollection",geometries:G}}),b=!0)}}if(!b){if(O.geometry.type==="Polygon"||O.geometry.type==="MultiPolygon")Mr(O,M);else if(O.geometry.type==="LineString"||O.geometry.type==="MultiLineString"){M(O);return}}a&&w.push((typeof a=="object"?new u.Marker(a):L()).setLngLat(O.center).addTo(l))}if(f)for(const b of R??[]){if(b===O)continue;const P=(typeof f=="object"?new u.Marker(f):L(!0)).setLngLat(b.center).setPopup(new u.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(b.place_type[0]==="reverse"?b.place_name:b.place_name.replace(/,.*/,""))).addTo(l),G=P.getElement();G.addEventListener("click",D=>{D.stopPropagation(),p==null||p({type:"markerClick",id:b.id})}),G.addEventListener("mouseenter",()=>{p==null||p({type:"markerMouseEnter",id:b.id}),P.togglePopup()}),G.addEventListener("mouseleave",()=>{p==null||p({type:"markerMouseLeave",id:b.id}),P.togglePopup()}),w.push(P)}}}},setSelectedMarker(R){_&&_.getElement().classList.toggle("marker-selected",!1),_=R>-1?w[R]:void 0,_==null||_.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const R=l.getCenter();return[l.getZoom(),R.lng,R.lat]}}}Ae.createMapLibreGlMapController=au,Object.defineProperty(Ae,Symbol.toStringTag,{value:"Module"})});
|
|
21
|
+
***************************************************************************** */function Zt(i,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(g){return c([f,g])}}function c(f){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,r&&(o=f[0]&2?r.return:f[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,f[1])).done)return o;switch(r=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++,r=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(i,e)}catch(g){f=[6,g],r=0}finally{n=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}var z=function(){function i(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return i}();function Wt(i,t){return i>t?1:i<t?-1:0}function F(i,t,e){for(var n=new z(null,null),r=n,o=n;;){var u=e(i,t.key);if(u<0){if(t.left===null)break;if(e(i,t.left.key)<0){var s=t.left;if(t.left=s.right,s.right=t,t=s,t.left===null)break}o.left=t,o=t,t=t.left}else if(u>0){if(t.right===null)break;if(e(i,t.right.key)>0){var s=t.right;if(t.right=s.left,s.left=t,t=s,t.right===null)break}r.right=t,r=t,t=t.right}else break}return r.right=t.left,o.left=t.right,t.left=n.right,t.right=n.left,t}function ot(i,t,e,n){var r=new z(i,t);if(e===null)return r.left=r.right=null,r;e=F(i,e,n);var o=n(i,e.key);return o<0?(r.left=e.left,r.right=e,e.left=null):o>=0&&(r.right=e.right,r.left=e,e.right=null),r}function Et(i,t,e){var n=null,r=null;if(t){t=F(i,t,e);var o=e(t.key,i);o===0?(n=t.left,r=t.right):o<0?(r=t.right,t.right=null,n=t):(n=t.left,t.left=null,r=t)}return{left:n,right:r}}function Jt(i,t,e){return t===null?i:(i===null||(t=F(i.key,t,e),t.left=i),t)}function st(i,t,e,n,r){if(i){n(""+t+(e?"└── ":"├── ")+r(i)+`
|
|
22
|
+
`);var o=t+(e?" ":"│ ");i.left&&st(i.left,o,!1,n,r),i.right&&st(i.right,o,!0,n,r)}}var lt=function(){function i(t){t===void 0&&(t=Wt),this._root=null,this._size=0,this._comparator=t}return i.prototype.insert=function(t,e){return this._size++,this._root=ot(t,e,this._root,this._comparator)},i.prototype.add=function(t,e){var n=new z(t,e);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,o=F(t,this._root,r),u=r(t,o.key);return u===0?this._root=o:(u<0?(n.left=o.left,n.right=o,o.left=null):u>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},i.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},i.prototype._remove=function(t,e,n){var r;if(e===null)return null;e=F(t,e,n);var o=n(t,e.key);return o===0?(e.left===null?r=e.right:(r=F(t,e.left,n),r.right=e.right),this._size--,r):e},i.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=F(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},i.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(r===0)return e;r<0?e=e.left:e=e.right}return null},i.prototype.find=function(t){return this._root&&(this._root=F(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},i.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(r===0)return!0;r<0?e=e.left:e=e.right}return!1},i.prototype.forEach=function(t,e){for(var n=this._root,r=[],o=!1;!o;)n!==null?(r.push(n),n=n.left):r.length!==0?(n=r.pop(),t.call(e,n),n=n.right):o=!0;return this},i.prototype.range=function(t,e,n,r){for(var o=[],u=this._comparator,s=this._root,c;o.length!==0||s;)if(s)o.push(s),s=s.left;else{if(s=o.pop(),c=u(s.key,e),c>0)break;if(u(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},i.prototype.keys=function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t},i.prototype.values=function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t},i.prototype.min=function(){return this._root?this.minNode(this._root).key:null},i.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},i.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},i.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},i.prototype.at=function(t){for(var e=this._root,n=!1,r=0,o=[];!n;)if(e)o.push(e),e=e.left;else if(o.length>0){if(e=o.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},i.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 r=this._comparator;e;){var o=r(t.key,e.key);if(o===0)break;o<0?(n=e,e=e.left):e=e.right}return n},i.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 r=this._comparator;e;){var o=r(t.key,e.key);if(o===0)break;o<0?e=e.left:(n=e,e=e.right)}return n},i.prototype.clear=function(){return this._root=null,this._size=0,this},i.prototype.toList=function(){return Ht(this._root)},i.prototype.load=function(t,e,n){e===void 0&&(e=[]),n===void 0&&(n=!1);var r=t.length,o=this._comparator;if(n&&ct(t,e,0,r-1,o),this._root===null)this._root=ut(t,e,0,r),this._size=r;else{var u=te(this.toList(),Kt(t,e),o);r=this._size+r,this._root=ft({head:u},0,r)}return this},i.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(i.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),i.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var e=[];return st(this._root,"",!0,function(n){return e.push(n)},t),e.join("")},i.prototype.update=function(t,e,n){var r=this._comparator,o=Et(t,this._root,r),u=o.left,s=o.right;r(t,e)<0?s=ot(e,n,s,r):u=ot(e,n,u,r),this._root=Jt(u,s,r)},i.prototype.split=function(t){return Et(t,this._root,this._comparator)},i.prototype[Symbol.iterator]=function(){var t,e,n;return Zt(this,function(r){switch(r.label){case 0:t=this._root,e=[],n=!1,r.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 r.sent(),t=t.right,[3,5];case 4:n=!0,r.label=5;case 5:return[3,1];case 6:return[2]}})},i}();function ut(i,t,e,n){var r=n-e;if(r>0){var o=e+Math.floor(r/2),u=i[o],s=t[o],c=new z(u,s);return c.left=ut(i,t,e,o),c.right=ut(i,t,o+1,n),c}return null}function Kt(i,t){for(var e=new z(null,null),n=e,r=0;r<i.length;r++)n=n.next=new z(i[r],t[r]);return n.next=null,e.next}function Ht(i){for(var t=i,e=[],n=!1,r=new z(null,null),o=r;!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,r.next}function ft(i,t,e){var n=e-t;if(n>0){var r=t+Math.floor(n/2),o=ft(i,t,r),u=i.head;return u.left=o,i.head=i.head.next,u.right=ft(i,r+1,e),u}return null}function te(i,t,e){for(var n=new z(null,null),r=n,o=i,u=t;o!==null&&u!==null;)e(o.key,u.key)<0?(r.next=o,o=o.next):(r.next=u,u=u.next),r=r.next;return o!==null?r.next=o:u!==null&&(r.next=u),n.next}function ct(i,t,e,n,r){if(!(e>=n)){for(var o=i[e+n>>1],u=e-1,s=n+1;;){do u++;while(r(i[u],o)<0);do s--;while(r(i[s],o)>0);if(u>=s)break;var c=i[u];i[u]=i[s],i[s]=c,c=t[u],t[u]=t[s],t[s]=c}ct(i,t,e,s,r),ct(i,t,s+1,n,r)}}const N=11102230246251565e-32,_=134217729,ee=(3+8*N)*N;function ht(i,t,e,n,r){let o,u,s,c,f=t[0],g=n[0],l=0,h=0;g>f==g>-f?(o=f,f=t[++l]):(o=g,g=n[++h]);let a=0;if(l<i&&h<e)for(g>f==g>-f?(u=f+o,s=o-(u-f),f=t[++l]):(u=g+o,s=o-(u-g),g=n[++h]),o=u,s!==0&&(r[a++]=s);l<i&&h<e;)g>f==g>-f?(u=o+f,c=u-o,s=o-(u-c)+(f-c),f=t[++l]):(u=o+g,c=u-o,s=o-(u-c)+(g-c),g=n[++h]),o=u,s!==0&&(r[a++]=s);for(;l<i;)u=o+f,c=u-o,s=o-(u-c)+(f-c),f=t[++l],o=u,s!==0&&(r[a++]=s);for(;h<e;)u=o+g,c=u-o,s=o-(u-c)+(g-c),g=n[++h],o=u,s!==0&&(r[a++]=s);return(o!==0||a===0)&&(r[a++]=o),a}function ne(i,t){let e=t[0];for(let n=1;n<i;n++)e+=t[n];return e}function G(i){return new Float64Array(i)}const ie=(3+16*N)*N,re=(2+12*N)*N,oe=(9+64*N)*N*N,U=G(4),mt=G(8),bt=G(12),_t=G(16),P=G(4);function se(i,t,e,n,r,o,u){let s,c,f,g,l,h,a,d,x,y,p,v,E,w,m,S,k,M;const I=i-r,$=e-r,A=t-o,O=n-o;w=I*O,h=_*I,a=h-(h-I),d=I-a,h=_*O,x=h-(h-O),y=O-x,m=d*y-(w-a*x-d*x-a*y),S=A*$,h=_*A,a=h-(h-A),d=A-a,h=_*$,x=h-(h-$),y=$-x,k=d*y-(S-a*x-d*x-a*y),p=m-k,l=m-p,U[0]=m-(p+l)+(l-k),v=w+p,l=v-w,E=w-(v-l)+(p-l),p=E-S,l=E-p,U[1]=E-(p+l)+(l-S),M=v+p,l=M-v,U[2]=v-(M-l)+(p-l),U[3]=M;let B=ne(4,U),H=re*u;if(B>=H||-B>=H||(l=i-I,s=i-(I+l)+(l-r),l=e-$,f=e-($+l)+(l-r),l=t-A,c=t-(A+l)+(l-o),l=n-O,g=n-(O+l)+(l-o),s===0&&c===0&&f===0&&g===0)||(H=oe*u+ee*Math.abs(B),B+=I*g+O*s-(A*f+$*c),B>=H||-B>=H))return B;w=s*O,h=_*s,a=h-(h-s),d=s-a,h=_*O,x=h-(h-O),y=O-x,m=d*y-(w-a*x-d*x-a*y),S=c*$,h=_*c,a=h-(h-c),d=c-a,h=_*$,x=h-(h-$),y=$-x,k=d*y-(S-a*x-d*x-a*y),p=m-k,l=m-p,P[0]=m-(p+l)+(l-k),v=w+p,l=v-w,E=w-(v-l)+(p-l),p=E-S,l=E-p,P[1]=E-(p+l)+(l-S),M=v+p,l=M-v,P[2]=v-(M-l)+(p-l),P[3]=M;const Ve=ht(4,U,4,P,mt);w=I*g,h=_*I,a=h-(h-I),d=I-a,h=_*g,x=h-(h-g),y=g-x,m=d*y-(w-a*x-d*x-a*y),S=A*f,h=_*A,a=h-(h-A),d=A-a,h=_*f,x=h-(h-f),y=f-x,k=d*y-(S-a*x-d*x-a*y),p=m-k,l=m-p,P[0]=m-(p+l)+(l-k),v=w+p,l=v-w,E=w-(v-l)+(p-l),p=E-S,l=E-p,P[1]=E-(p+l)+(l-S),M=v+p,l=M-v,P[2]=v-(M-l)+(p-l),P[3]=M;const Ge=ht(Ve,mt,4,P,bt);w=s*g,h=_*s,a=h-(h-s),d=s-a,h=_*g,x=h-(h-g),y=g-x,m=d*y-(w-a*x-d*x-a*y),S=c*f,h=_*c,a=h-(h-c),d=c-a,h=_*f,x=h-(h-f),y=f-x,k=d*y-(S-a*x-d*x-a*y),p=m-k,l=m-p,P[0]=m-(p+l)+(l-k),v=w+p,l=v-w,E=w-(v-l)+(p-l),p=E-S,l=E-p,P[1]=E-(p+l)+(l-S),M=v+p,l=M-v,P[2]=v-(M-l)+(p-l),P[3]=M;const Ze=ht(Ge,bt,4,P,_t);return _t[Ze-1]}function le(i,t,e,n,r,o){const u=(t-o)*(e-r),s=(i-r)*(n-o),c=u-s,f=Math.abs(u+s);return Math.abs(c)>=ie*f?c:-se(i,t,e,n,r,o,f)}const Z=(i,t)=>i.ll.x<=t.x&&t.x<=i.ur.x&&i.ll.y<=t.y&&t.y<=i.ur.y,at=(i,t)=>{if(t.ur.x<i.ll.x||i.ur.x<t.ll.x||t.ur.y<i.ll.y||i.ur.y<t.ll.y)return null;const e=i.ll.x<t.ll.x?t.ll.x:i.ll.x,n=i.ur.x<t.ur.x?i.ur.x:t.ur.x,r=i.ll.y<t.ll.y?t.ll.y:i.ll.y,o=i.ur.y<t.ur.y?i.ur.y:t.ur.y;return{ll:{x:e,y:r},ur:{x:n,y:o}}};let j=Number.EPSILON;j===void 0&&(j=Math.pow(2,-52));const ue=j*j,St=(i,t)=>{if(-j<i&&i<j&&-j<t&&t<j)return 0;const e=i-t;return e*e<ue*i*t?0:i<t?-1:1};class fe{constructor(){this.reset()}reset(){this.xRounder=new Mt,this.yRounder=new Mt}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class Mt{constructor(){this.tree=new lt,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(n!==null&&St(e.key,n.key)===0)return this.tree.remove(t),n.key;const r=this.tree.next(e);return r!==null&&St(e.key,r.key)===0?(this.tree.remove(t),r.key):t}}const W=new fe,tt=(i,t)=>i.x*t.y-i.y*t.x,Pt=(i,t)=>i.x*t.x+i.y*t.y,Lt=(i,t,e)=>{const n=le(i.x,i.y,t.x,t.y,e.x,e.y);return n>0?-1:n<0?1:0},et=i=>Math.sqrt(Pt(i,i)),ce=(i,t,e)=>{const n={x:t.x-i.x,y:t.y-i.y},r={x:e.x-i.x,y:e.y-i.y};return tt(r,n)/et(r)/et(n)},he=(i,t,e)=>{const n={x:t.x-i.x,y:t.y-i.y},r={x:e.x-i.x,y:e.y-i.y};return Pt(r,n)/et(r)/et(n)},Rt=(i,t,e)=>t.y===0?null:{x:i.x+t.x/t.y*(e-i.y),y:e},kt=(i,t,e)=>t.x===0?null:{x:e,y:i.y+t.y/t.x*(e-i.x)},ae=(i,t,e,n)=>{if(t.x===0)return kt(e,n,i.x);if(n.x===0)return kt(i,t,e.x);if(t.y===0)return Rt(e,n,i.y);if(n.y===0)return Rt(i,t,e.y);const r=tt(t,n);if(r==0)return null;const o={x:e.x-i.x,y:e.y-i.y},u=tt(o,t)/r,s=tt(o,n)/r,c=i.x+s*t.x,f=e.x+u*n.x,g=i.y+s*t.y,l=e.y+u*n.y,h=(c+f)/2,a=(g+l)/2;return{x:h,y:a}};class R{static compare(t,e){const n=R.comparePoints(t.point,e.point);return n!==0?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:q.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,r=e.length;n<r;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 r=e+1;r<t;r++){const o=this.point.events[r];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 r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}getLeftmostComparator(t){const e=new Map,n=r=>{const o=r.otherSE;e.set(r,{sine:ce(this.point,t.point,o.point),cosine:he(this.point,t.point,o.point)})};return(r,o)=>{e.has(r)||n(r),e.has(o)||n(o);const{sine:u,cosine:s}=e.get(r),{sine:c,cosine:f}=e.get(o);return u>=0&&c>=0?s<f?1:s>f?-1:0:u<0&&c<0?s<f?-1:s>f?1:0:c<u?-1:c>u?1:0}}}let ge=0;class q{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,o=t.rightSE.point.x,u=e.rightSE.point.x;if(u<n)return 1;if(o<r)return-1;const s=t.leftSE.point.y,c=e.leftSE.point.y,f=t.rightSE.point.y,g=e.rightSE.point.y;if(n<r){if(c<s&&c<f)return 1;if(c>s&&c>f)return-1;const l=t.comparePoint(e.leftSE.point);if(l<0)return 1;if(l>0)return-1;const h=e.comparePoint(t.rightSE.point);return h!==0?h:-1}if(n>r){if(s<c&&s<g)return-1;if(s>c&&s>g)return 1;const l=e.comparePoint(t.leftSE.point);if(l!==0)return l;const h=t.comparePoint(e.rightSE.point);return h<0?1:h>0?-1:1}if(s<c)return-1;if(s>c)return 1;if(o<u){const l=e.comparePoint(t.rightSE.point);if(l!==0)return l}if(o>u){const l=t.comparePoint(e.rightSE.point);if(l<0)return 1;if(l>0)return-1}if(o!==u){const l=f-s,h=o-n,a=g-c,d=u-r;if(l>h&&a<d)return 1;if(l<h&&a>d)return-1}return o>u?1:o<u||f<g?-1:f>g?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++ge,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=r}static fromRing(t,e,n){let r,o,u;const s=R.comparePoints(t,e);if(s<0)r=t,o=e,u=1;else if(s>0)r=e,o=t,u=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const c=new R(r,!0),f=new R(o,!1);return new q(c,f,[n],[u])}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,r=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)/r.y,u=e.x+o*r.x;if(t.x===u)return 0;const s=(t.x-e.x)/r.x,c=e.y+s*r.y;return t.y===c?0:t.y<c?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=at(e,n);if(r===null)return null;const o=this.leftSE.point,u=this.rightSE.point,s=t.leftSE.point,c=t.rightSE.point,f=Z(e,s)&&this.comparePoint(s)===0,g=Z(n,o)&&t.comparePoint(o)===0,l=Z(e,c)&&this.comparePoint(c)===0,h=Z(n,u)&&t.comparePoint(u)===0;if(g&&f)return h&&!l?u:!h&&l?c:null;if(g)return l&&o.x===c.x&&o.y===c.y?null:o;if(f)return h&&u.x===s.x&&u.y===s.y?null:s;if(h&&l)return null;if(h)return u;if(l)return c;const a=ae(o,this.vector(),s,t.vector());return a===null||!Z(r,a)?null:W.round(a.x,a.y)}split(t){const e=[],n=t.events!==void 0,r=new R(t,!0),o=new R(t,!1),u=this.rightSE;this.replaceRightSE(o),e.push(o),e.push(r);const s=new q(r,u,this.rings.slice(),this.windings.slice());return R.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),R.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.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 r=q.compare(e,n);if(r!==0){if(r>0){const o=e;e=n,n=o}if(e.prev===n){const o=e;e=n,n=o}for(let o=0,u=n.rings.length;o<u;o++){const s=n.rings[o],c=n.windings[o],f=e.rings.indexOf(s);f===-1?(e.rings.push(s),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,r=this._afterState.multiPolys;for(let s=0,c=this.rings.length;s<c;s++){const f=this.rings[s],g=this.windings[s],l=e.indexOf(f);l===-1?(e.push(f),n.push(g)):n[l]+=g}const o=[],u=[];for(let s=0,c=e.length;s<c;s++){if(n[s]===0)continue;const f=e[s],g=f.poly;if(u.indexOf(g)===-1)if(f.isExterior)o.push(g);else{u.indexOf(g)===-1&&u.push(g);const l=o.indexOf(f.poly);l!==-1&&o.splice(l,1)}}for(let s=0,c=o.length;s<c;s++){const f=o[s].multiPoly;r.indexOf(f)===-1&&r.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(C.type){case"union":{const n=t.length===0,r=e.length===0;this._isInResult=n!==r;break}case"intersection":{let n,r;t.length<e.length?(n=t.length,r=e.length):(n=e.length,r=t.length),this._isInResult=r===C.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2===1;break}case"difference":{const n=r=>r.length===1&&r[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${C.type}`)}return this._isInResult}}class Ct{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 r=W.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let o=r;for(let u=1,s=t.length;u<s;u++){if(typeof t[u][0]!="number"||typeof t[u][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let c=W.round(t[u][0],t[u][1]);c.x===o.x&&c.y===o.y||(this.segments.push(q.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)}(r.x!==o.x||r.y!==o.y)&&this.segments.push(q.fromRing(o,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}class pe{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ct(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,r=t.length;n<r;n++){const o=new Ct(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 r=this.interiorRings[e].getSweepEvents();for(let o=0,u=r.length;o<u;o++)t.push(r[o])}return t}}class It{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,r=t.length;n<r;n++){const o=new pe(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 r=this.polys[e].getSweepEvents();for(let o=0,u=r.length;o<u;o++)t.push(r[o])}return t}}class nt{static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const o=t[n];if(!o.isInResult()||o.ringOut)continue;let u=null,s=o.leftSE,c=o.rightSE;const f=[s],g=s.point,l=[];for(;u=s,s=c,f.push(s),s.point!==g;)for(;;){const h=s.getAvailableLinkedEvents();if(h.length===0){const x=f[0].point,y=f[f.length-1].point;throw new Error(`Unable to complete output ring starting at [${x.x}, ${x.y}]. Last matching segment found ends at [${y.x}, ${y.y}].`)}if(h.length===1){c=h[0].otherSE;break}let a=null;for(let x=0,y=l.length;x<y;x++)if(l[x].point===s.point){a=x;break}if(a!==null){const x=l.splice(a)[0],y=f.splice(x.index);y.unshift(y[0].otherSE),e.push(new nt(y.reverse()));continue}l.push({index:f.length,point:s.point});const d=s.getLeftmostComparator(u);c=h.sort(d)[0].otherSE;break}e.push(new nt(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,g=this.events.length-1;f<g;f++){const l=this.events[f].point,h=this.events[f+1].point;Lt(l,t,h)!==0&&(e.push(l),t=l)}if(e.length===1)return null;const n=e[0],r=e[1];Lt(n,t,r)===0&&e.shift(),e.push(e[0]);const o=this.isExteriorRing()?1:-1,u=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,c=[];for(let f=u;f!=s;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 r=1,o=this.events.length;r<o;r++){const u=this.events[r];R.compare(t,u)>0&&(t=u)}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 $t{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 r=this.interiorRings[e].getGeom();r!==null&&t.push(r)}return t}}class ye{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 r=this.polys[e].getGeom();r!==null&&t.push(r)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const o=t[n];if(!o.poly)if(o.isExteriorRing())e.push(new $t(o));else{const u=o.enclosingRing();u.poly||e.push(new $t(u)),u.poly.addInterior(o)}}return e}}class de{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:q.compare;this.queue=t,this.tree=new lt(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 r=t.isLeft?this.tree.add(e):this.tree.find(e);if(!r)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=r,u=r,s,c;for(;s===void 0;)o=this.tree.prev(o),o===null?s=null:o.key.consumedBy===void 0&&(s=o.key);for(;c===void 0;)u=this.tree.next(u),u===null?c=null:u.key.consumedBy===void 0&&(c=u.key);if(t.isLeft){let f=null;if(s){const l=s.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(f=l),!s.isAnEndpoint(l))){const h=this._splitSafely(s,l);for(let a=0,d=h.length;a<d;a++)n.push(h[a])}}let g=null;if(c){const l=c.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(g=l),!c.isAnEndpoint(l))){const h=this._splitSafely(c,l);for(let a=0,d=h.length;a<d;a++)n.push(h[a])}}if(f!==null||g!==null){let l=null;f===null?l=g:g===null?l=f:l=R.comparePoints(f,g)<=0?f:g,this.queue.remove(e.rightSE),n.push(e.rightSE);const h=e.split(l);for(let a=0,d=h.length;a<d;a++)n.push(h[a])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&c){const f=s.getIntersection(c);if(f!==null){if(!s.isAnEndpoint(f)){const g=this._splitSafely(s,f);for(let l=0,h=g.length;l<h;l++)n.push(g[l])}if(!c.isAnEndpoint(f)){const g=this._splitSafely(c,f);for(let l=0,h=g.length;l<h;l++)n.push(g[l])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const r=t.split(e);return r.push(n),t.consumedBy===void 0&&this.tree.add(t),r}}const At=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,xe=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class ve{run(t,e,n){C.type=t,W.reset();const r=[new It(e,!0)];for(let l=0,h=n.length;l<h;l++)r.push(new It(n[l],!1));if(C.numMultiPolys=r.length,C.type==="difference"){const l=r[0];let h=1;for(;h<r.length;)at(r[h].bbox,l.bbox)!==null?h++:r.splice(h,1)}if(C.type==="intersection")for(let l=0,h=r.length;l<h;l++){const a=r[l];for(let d=l+1,x=r.length;d<x;d++)if(at(a.bbox,r[d].bbox)===null)return[]}const o=new lt(R.compare);for(let l=0,h=r.length;l<h;l++){const a=r[l].getSweepEvents();for(let d=0,x=a.length;d<x;d++)if(o.insert(a[d]),o.size>At)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const u=new de(o);let s=o.size,c=o.pop();for(;c;){const l=c.key;if(o.size===s){const a=l.segment;throw new Error(`Unable to pop() ${l.isLeft?"left":"right"} SweepEvent [${l.point.x}, ${l.point.y}] from segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] from queue.`)}if(o.size>At)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(u.segments.length>xe)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const h=u.process(l);for(let a=0,d=h.length;a<d;a++){const x=h[a];x.consumedBy===void 0&&o.insert(x)}s=o.size,c=o.pop()}W.reset();const f=nt.factory(u.segments);return new ye(f).getGeom()}}const C=new ve;var Ot={union:function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("union",i,e)},intersection:function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("intersection",i,e)},xor:function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("xor",i,e)},difference:function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("difference",i,e)}};function Nt(i,t,e){if(i!==null)for(var n,r,o,u,s,c,f,g=0,l=0,h,a=i.type,d=a==="FeatureCollection",x=a==="Feature",y=d?i.features.length:1,p=0;p<y;p++){f=d?i.features[p].geometry:x?i.geometry:i,h=f?f.type==="GeometryCollection":!1,s=h?f.geometries.length:1;for(var v=0;v<s;v++){var E=0,w=0;if(u=h?f.geometries[v]:f,u!==null){c=u.coordinates;var m=u.type;switch(g=0,m){case null:break;case"Point":if(t(c,l,p,E,w)===!1)return!1;l++,E++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],l,p,E,w)===!1)return!1;l++,m==="MultiPoint"&&E++}m==="LineString"&&E++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(r=0;r<c[n].length-g;r++){if(t(c[n][r],l,p,E,w)===!1)return!1;l++}m==="MultiLineString"&&E++,m==="Polygon"&&w++}m==="Polygon"&&E++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(w=0,r=0;r<c[n].length;r++){for(o=0;o<c[n][r].length-g;o++){if(t(c[n][r][o],l,p,E,w)===!1)return!1;l++}w++}E++}break;case"GeometryCollection":for(n=0;n<u.geometries.length;n++)if(Nt(u.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function gt(i,t){var e,n,r,o,u,s,c,f,g,l,h=0,a=i.type==="FeatureCollection",d=i.type==="Feature",x=a?i.features.length:1;for(e=0;e<x;e++){for(s=a?i.features[e].geometry:d?i.geometry:i,f=a?i.features[e].properties:d?i.properties:{},g=a?i.features[e].bbox:d?i.bbox:void 0,l=a?i.features[e].id:d?i.id:void 0,c=s?s.type==="GeometryCollection":!1,u=c?s.geometries.length:1,r=0;r<u;r++){if(o=c?s.geometries[r]:s,o===null){if(t(null,h,f,g,l)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,h,f,g,l)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],h,f,g,l)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function we(i,t){gt(i,function(e,n,r,o,u){var s=e===null?null:e.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(b(e,r,{bbox:o,id:u}),n,0)===!1?!1:void 0}var c;switch(s){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 g=e.coordinates[f],l={type:c,coordinates:g};if(t(b(l,r),n,f)===!1)return!1}})}function Ee(i,t={}){const e=[];if(gt(i,r=>{e.push(r.coordinates)}),e.length<2)throw new Error("Must have at least 2 geometries");const n=Ot.union(e[0],...e.slice(1));return n.length===0?null:n.length===1?T(n[0],t.properties):wt(n,t.properties)}var Bt=Ee;function J(){}function Tt(i){return i()}function zt(){return Object.create(null)}function it(i){i.forEach(Tt)}function Ft(i){return typeof i=="function"}function me(i,t){return i!=i?t==t:i!==t||i&&typeof i=="object"||typeof i=="function"}function be(i){return Object.keys(i).length===0}function _e(i,t){i.appendChild(t)}function Se(i,t,e){i.insertBefore(t,e||null)}function jt(i){i.parentNode&&i.parentNode.removeChild(i)}function qt(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Q(i,t,e){e==null?i.removeAttribute(t):i.getAttribute(t)!==e&&i.setAttribute(t,e)}function Me(i){return Array.from(i.childNodes)}function rt(i,t,e){i.classList.toggle(t,!!e)}let pt;function K(i){pt=i}const Y=[],Qt=[];let D=[];const Ut=[],Pe=Promise.resolve();let yt=!1;function Le(){yt||(yt=!0,Pe.then(Yt))}function dt(i){D.push(i)}const xt=new Set;let X=0;function Yt(){if(X!==0)return;const i=pt;do{try{for(;X<Y.length;){const t=Y[X];X++,K(t),Re(t.$$)}}catch(t){throw Y.length=0,X=0,t}for(K(null),Y.length=0,X=0;Qt.length;)Qt.pop()();for(let t=0;t<D.length;t+=1){const e=D[t];xt.has(e)||(xt.add(e),e())}D.length=0}while(Y.length);for(;Ut.length;)Ut.pop()();yt=!1,xt.clear(),K(i)}function Re(i){if(i.fragment!==null){i.update(),it(i.before_update);const t=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,t),i.after_update.forEach(dt)}}function ke(i){const t=[],e=[];D.forEach(n=>i.indexOf(n)===-1?t.push(n):e.push(n)),e.forEach(n=>n()),D=t}const Ce=new Set;function Ie(i,t){i&&i.i&&(Ce.delete(i),i.i(t))}function $e(i,t,e){const{fragment:n,after_update:r}=i.$$;n&&n.m(t,e),dt(()=>{const o=i.$$.on_mount.map(Tt).filter(Ft);i.$$.on_destroy?i.$$.on_destroy.push(...o):it(o),i.$$.on_mount=[]}),r.forEach(dt)}function Ae(i,t){const e=i.$$;e.fragment!==null&&(ke(e.after_update),it(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Oe(i,t){i.$$.dirty[0]===-1&&(Y.push(i),Le(),i.$$.dirty.fill(0)),i.$$.dirty[t/31|0]|=1<<t%31}function Ne(i,t,e,n,r,o,u=null,s=[-1]){const c=pt;K(i);const f=i.$$={fragment:null,ctx:[],props:o,update:J,not_equal:r,bound:zt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:zt(),dirty:s,skip_bound:!1,root:t.target||c.$$.root};u&&u(f.root);let g=!1;if(f.ctx=e?e(i,t.props||{},(l,h,...a)=>{const d=a.length?a[0]:h;return f.ctx&&r(f.ctx[l],f.ctx[l]=d)&&(!f.skip_bound&&f.bound[l]&&f.bound[l](d),g&&Oe(i,l)),h}):[],f.update(),g=!0,it(f.before_update),f.fragment=n?n(f.ctx):!1,t.target){if(t.hydrate){const l=Me(t.target);f.fragment&&f.fragment.l(l),l.forEach(jt)}else f.fragment&&f.fragment.c();t.intro&&Ie(i.$$.fragment),$e(i,t.target,t.anchor),Yt()}K(c)}class Be{constructor(){vt(this,"$$");vt(this,"$$set")}$destroy(){Ae(this,1),this.$destroy=J}$on(t,e){if(!Ft(e))return J;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const r=n.indexOf(e);r!==-1&&n.splice(r,1)}}$set(t){this.$$set&&!be(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Te="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Te);function ze(i){let t,e,n;return{c(){t=qt("svg"),e=qt("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=i[0]==="list"?20:void 0),Q(t,"viewBox","0 0 70 85"),Q(t,"fill","none"),Q(t,"class","svelte-gzo3ar"),rt(t,"in-map",i[0]!=="list"),rt(t,"list-icon",i[0]==="list")},m(r,o){Se(r,t,o),_e(t,e)},p(r,[o]){o&1&&n!==(n=r[0]==="list"?20:void 0)&&Q(t,"width",n),o&1&&rt(t,"in-map",r[0]!=="list"),o&1&&rt(t,"list-icon",r[0]==="list")},i:J,o:J,d(r){r&&jt(t)}}}function Fe(i,t,e){let{displayIn:n}=t;return i.$$set=r=>{"displayIn"in r&&e(0,n=r.displayIn)},[n]}class je extends Be{constructor(t){super(),Ne(this,t,Fe,ze,me,{displayIn:0})}}function qe(i,t={}){if(i.bbox!=null&&t.recompute!==!0)return i.bbox;const e=[1/0,1/0,-1/0,-1/0];return Nt(i,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 Dt=qe;function Qe(i){const t=[];if(gt(i,r=>{t.push(r.coordinates)}),t.length<2)throw new Error("Must have at least two features");const e=i.features[0].properties||{},n=Ot.difference(t[0],...t.slice(1));return n.length===0?null:n.length===1?T(n[0],e):wt(n,e)}var Ue=Qe;function Ye(i){if(!i)throw new Error("geojson is required");var t=[];return we(i,function(e){t.push(e)}),V(t)}var De=Ye;function Xt(i){const t=[...i];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 Vt(i,t){const e=Ue(V([T([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),i]));if(!e)return;e.properties={isMask:!0};const n=Xt(Dt(i)),r=(n[2]-n[0])/360/1e3,o=n[0]<-180,u=n[2]>180,s=De(i);if(s.features.length>1&&(o||u))for(const c of s.features){const f=Xt(Dt(c));if(u&&f[0]<-180+r)for(const g of c.geometry.coordinates)for(const l of g)l[0]+=360-r;if(o&&f[2]>180-r)for(const g of c.geometry.coordinates)for(const l of g)l[0]-=360-r}t(V([s.features.length<2?i:Bt(s)??i,e]))}const Gt=V([]);function Xe(i,t,e=!0,n=!0,r={},o={},u={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let s;const c=[];let f,g,l;function h(){!i.getSource("full-geom")&&(u!=null&&u.fill||u!=null&&u.line)&&i.addSource("full-geom",{type:"geojson",data:Gt}),!i.getLayer("full-geom-fill")&&(u!=null&&u.fill)&&i.addLayer({...u==null?void 0:u.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),!i.getLayer("full-geom-line")&&(u!=null&&u.line)&&i.addLayer({...u==null?void 0:u.line,id:"full-geom-line",type:"line",source:"full-geom"}),l&&x(l)}i.loaded()?h():i.once("load",()=>{h()}),i.on("styledata",()=>{h()});const a=y=>{s==null||s({type:"mapClick",coordinates:[y.lngLat.lng,y.lngLat.lat]})};function d(y=!1){if(!t)throw new Error;const p=document.createElement("div");return y&&p.classList.add("marker-interactive"),new je({props:{displayIn:"maplibre"},target:p}),new t.Marker({element:p,offset:[1,-13]})}function x(y){var p;l=y,y&&((p=i.getSource("full-geom"))==null||p.setData(y))}return{setEventHandler(y){y?(s=y,i.on("click",a)):(s=void 0,i.off("click",a))},flyTo(y,p){i.flyTo({center:y,...p?{zoom:p}:{},...r})},fitBounds(y,p,v){i.fitBounds([[y[0],y[1]],[y[2],y[3]]],{padding:p,...v?{maxZoom:v}:{},...o})},indicateReverse(y){i.getCanvasContainer().style.cursor=y?"crosshair":""},setReverseMarker(y){!t||!e||(g?y?g.setLngLat(y):(g.remove(),g=void 0):y&&(g=(typeof e=="object"?new t.Marker(e):d()).setLngLat(y).addTo(i),g.getElement().classList.add("marker-reverse")))},setMarkers(y,p){if(e){for(const v of c)v.remove();if(c.length=0,x(Gt),!!t){if(p){let v=!1;if(p.geometry.type==="GeometryCollection"){const E=p.geometry.geometries.filter(w=>w.type==="Polygon"||w.type==="MultiPolygon");t:if(E.length>0){const w=Bt(V(E.map(m=>b(m))));if(!w)break t;Vt({...p,geometry:w.geometry},x),v=!0}else{const w=p.geometry.geometries.filter(m=>m.type==="LineString"||m.type==="MultiLineString");w.length>0&&(x({...p,geometry:{type:"GeometryCollection",geometries:w}}),v=!0)}}if(!v){if(p.geometry.type==="Polygon"||p.geometry.type==="MultiPolygon")Vt(p,x);else if(p.geometry.type==="LineString"||p.geometry.type==="MultiLineString"){x(p);return}}e&&c.push((typeof e=="object"?new t.Marker(e):d()).setLngLat(p.center).addTo(i))}if(n)for(const v of y??[]){if(v===p)continue;const E=(typeof n=="object"?new t.Marker(n):d(!0)).setLngLat(v.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(v.place_type[0]==="reverse"?v.place_name:v.place_name.replace(/,.*/,""))).addTo(i),w=E.getElement();w.addEventListener("click",m=>{m.stopPropagation(),s==null||s({type:"markerClick",id:v.id})}),w.addEventListener("mouseenter",()=>{s==null||s({type:"markerMouseEnter",id:v.id}),E.togglePopup()}),w.addEventListener("mouseleave",()=>{s==null||s({type:"markerMouseLeave",id:v.id}),E.togglePopup()}),c.push(E)}}}},setSelectedMarker(y){f&&f.getElement().classList.toggle("marker-selected",!1),f=y>-1?c[y]:void 0,f==null||f.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const y=i.getCenter();return[i.getZoom(),y.lng,y.lat]}}}L.createMapLibreGlMapController=Xe,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
|
|
29
23
|
//# sourceMappingURL=maplibregl-controller.umd.js.map
|