1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
| (()=>{var lg={};(function(N,tr){tr(N.turf={})})(lg,function(N){"use strict";var tr=63710088e-1,Qs={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260511392e-6,inches:39.37*tr,kilometers:6371.0088,kilometres:6371.0088,meters:tr,metres:tr,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:tr/1852,radians:1,yards:6967335223679999e-9},Jl={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/tr,yards:1.0936133},$s={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Te(t,e,n){n===void 0&&(n={});var r={type:"Feature"};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function Zl(t,e,n){switch(t){case"Point":return ft(e).geometry;case"LineString":return Wt(e).geometry;case"Polygon":return ct(e).geometry;case"MultiPoint":return ta(e).geometry;case"MultiLineString":return yi(e).geometry;case"MultiPolygon":return xr(e).geometry;default:throw new Error(t+" is invalid")}}function ft(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ge(t[0])||!Ge(t[1]))throw new Error("coordinates must contain numbers");return Te({type:"Point",coordinates:t},e,n)}function Kl(t,e,n){return n===void 0&&(n={}),nt(t.map(function(r){return ft(r,e)}),n)}function ct(t,e,n){n===void 0&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return Te({type:"Polygon",coordinates:t},e,n)}function Ql(t,e,n){return n===void 0&&(n={}),nt(t.map(function(r){return ct(r,e)}),n)}function Wt(t,e,n){if(n===void 0&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return Te({type:"LineString",coordinates:t},e,n)}function $l(t,e,n){return n===void 0&&(n={}),nt(t.map(function(r){return Wt(r,e)}),n)}function nt(t,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function yi(t,e,n){return n===void 0&&(n={}),Te({type:"MultiLineString",coordinates:t},e,n)}function ta(t,e,n){return n===void 0&&(n={}),Te({type:"MultiPoint",coordinates:t},e,n)}function xr(t,e,n){return n===void 0&&(n={}),Te({type:"MultiPolygon",coordinates:t},e,n)}function au(t,e,n){return n===void 0&&(n={}),Te({type:"GeometryCollection",geometries:t},e,n)}function tc(t,e){if(e===void 0&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function co(t,e){e===void 0&&(e="kilometers");var n=Qs[e];if(!n)throw new Error(e+" units is invalid");return t*n}function ki(t,e){e===void 0&&(e="kilometers");var n=Qs[e];if(!n)throw new Error(e+" units is invalid");return t/n}function ea(t,e){return mi(ki(t,e))}function Gi(t){var e=t%360;return e<0&&(e+=360),e}function mi(t){return 180*(t%(2*Math.PI))/Math.PI}function ke(t){return t%360*Math.PI/180}function qi(t,e,n){if(e===void 0&&(e="kilometers"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("length must be a positive number");return co(ki(t,e),n)}function ec(t,e,n){if(e===void 0&&(e="meters"),n===void 0&&(n="kilometers"),!(t>=0))throw new Error("area must be a positive number");var r=$s[e];if(!r)throw new Error("invalid original units");var i=$s[n];if(!i)throw new Error("invalid final units");return t/r*i}function Ge(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}function Qt(t){return!!t&&t.constructor===Object}function nc(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!Ge(e))throw new Error("bbox must only contain numbers")})}function rc(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}var cg=Object.freeze({__proto__:null,earthRadius:tr,factors:Qs,unitsFactors:Jl,areaFactors:$s,feature:Te,geometry:Zl,point:ft,points:Kl,polygon:ct,polygons:Ql,lineString:Wt,lineStrings:$l,featureCollection:nt,multiLineString:yi,multiPoint:ta,multiPolygon:xr,geometryCollection:au,round:tc,radiansToLength:co,lengthToRadians:ki,lengthToDegrees:ea,bearingToAzimuth:Gi,radiansToDegrees:mi,degreesToRadians:ke,convertLength:qi,convertArea:ec,isNumber:Ge,isObject:Qt,validateBBox:nc,validateId:rc});function re(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function it(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function uu(t){if(t.length>1&&Ge(t[0])&&Ge(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return uu(t[0]);throw new Error("coordinates must only contain numbers")}function ic(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function ts(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function ti(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||t.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(var r=0,i=t.features;r<i.length;r++){var o=i[r];if(!o||o.type!=="Feature"||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}function ae(t){return t.type==="Feature"?t.geometry:t}function wn(t,e){return t.type==="FeatureCollection"?"FeatureCollection":t.type==="GeometryCollection"?"GeometryCollection":t.type==="Feature"&&t.geometry!==null?t.geometry.type:t.type}var hg=Object.freeze({__proto__:null,getCoord:re,getCoords:it,containsNumber:uu,geojsonType:ic,featureOf:ts,collectionOf:ti,getGeom:ae,getType:wn});function Ce(t,e,n){if(t!==null)for(var r,i,o,s,a,u,l,h,c=0,p=0,d=t.type,g=d==="FeatureCollection",m=d==="Feature",f=g?t.features.length:1,_=0;_<f;_++){a=(h=!!(l=g?t.features[_].geometry:m?t.geometry:t)&&l.type==="GeometryCollection")?l.geometries.length:1;for(var I=0;I<a;I++){var y=0,v=0;if((s=h?l.geometries[I]:l)!==null){u=s.coordinates;var x=s.type;switch(c=!n||x!=="Polygon"&&x!=="MultiPolygon"?0:1,x){case null:break;case"Point":if(e(u,p,_,y,v)===!1)return!1;p++,y++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(e(u[r],p,_,y,v)===!1)return!1;p++,x==="MultiPoint"&&y++}x==="LineString"&&y++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-c;i++){if(e(u[r][i],p,_,y,v)===!1)return!1;p++}x==="MultiLineString"&&y++,x==="Polygon"&&v++}x==="Polygon"&&y++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(v=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-c;o++){if(e(u[r][i][o],p,_,y,v)===!1)return!1;p++}v++}y++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(Ce(s.geometries[r],e,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function lu(t,e,n,r){var i=n;return Ce(t,function(o,s,a,u,l){i=s===0&&n===void 0?o:e(i,o,s,a,u,l)},r),i}function cu(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&e(t.features[n].properties,n)!==!1;n++);break;case"Feature":e(t.properties,0)}}function oc(t,e,n){var r=n;return cu(t,function(i,o){r=o===0&&n===void 0?i:e(r,i,o)}),r}function Zt(t,e){if(t.type==="Feature")e(t,0);else if(t.type==="FeatureCollection")for(var n=0;n<t.features.length&&e(t.features[n],n)!==!1;n++);}function hu(t,e,n){var r=n;return Zt(t,function(i,o){r=o===0&&n===void 0?i:e(r,i,o)}),r}function vi(t){var e=[];return Ce(t,function(n){e.push(n)}),e}function zn(t,e){var n,r,i,o,s,a,u,l,h,c,p=0,d=t.type==="FeatureCollection",g=t.type==="Feature",m=d?t.features.length:1;for(n=0;n<m;n++){for(a=d?t.features[n].geometry:g?t.geometry:t,l=d?t.features[n].properties:g?t.properties:{},h=d?t.features[n].bbox:g?t.bbox:void 0,c=d?t.features[n].id:g?t.id:void 0,s=(u=!!a&&a.type==="GeometryCollection")?a.geometries.length:1,i=0;i<s;i++)if((o=u?a.geometries[i]:a)!==null)switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(e(o,p,l,h,c)===!1)return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(e(o.geometries[r],p,l,h,c)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}else if(e(null,p,l,h,c)===!1)return!1;p++}}function pu(t,e,n){var r=n;return zn(t,function(i,o,s,a,u){r=o===0&&n===void 0?i:e(r,i,o,s,a,u)}),r}function Ee(t,e){zn(t,function(n,r,i,o,s){var a,u=n===null?null:n.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return e(Te(n,i,{bbox:o,id:s}),r,0)!==!1&&void 0}switch(u){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var l=0;l<n.coordinates.length;l++){var h=n.coordinates[l];if(e(Te({type:a,coordinates:h},i),r,l)===!1)return!1}})}function sc(t,e,n){var r=n;return Ee(t,function(i,o,s){r=o===0&&s===0&&n===void 0?i:e(r,i,o,s)}),r}function ei(t,e){Ee(t,function(n,r,i){var o=0;if(n.geometry){var s=n.geometry.type;if(s!=="Point"&&s!=="MultiPoint"){var a,u=0,l=0,h=0;return Ce(n,function(c,p,d,g,m){if(a===void 0||r>u||g>l||m>h)return a=c,u=r,l=g,h=m,void(o=0);var f=Wt([a,c],n.properties);if(e(f,r,i,m,o)===!1)return!1;o++,a=c})!==!1&&void 0}}})}function fu(t,e,n){var r=n,i=!1;return ei(t,function(o,s,a,u,l){r=i===!1&&n===void 0?o:e(r,o,s,a,u,l),i=!0}),r}function gu(t,e){if(!t)throw new Error("geojson is required");Ee(t,function(n,r,i){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(e(Wt(s[a],n.properties),r,i,a)===!1)return!1}}})}function du(t,e,n){var r=n;return gu(t,function(i,o,s,a){r=o===0&&n===void 0?i:e(r,i,o,s,a)}),r}function ac(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(n===null)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),Wt([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),Wt([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),Wt([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),Wt([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function uc(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(n===null)return null;var u=n.coordinates;switch(n.type){case"Point":return ft(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),ft(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),ft(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),ft(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),ft(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),ft(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var pg=Object.freeze({__proto__:null,coordEach:Ce,coordReduce:lu,propEach:cu,propReduce:oc,featureEach:Zt,featureReduce:hu,coordAll:vi,geomEach:zn,geomReduce:pu,flattenEach:Ee,flattenReduce:sc,segmentEach:ei,segmentReduce:fu,lineEach:gu,lineReduce:du,findSegment:ac,findPoint:uc});function ye(t){var e=[1/0,1/0,-1/0,-1/0];return Ce(t,function(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}ye.default=ye;/*
| object-assign
| (c) Sindre Sorhus
| @license MIT
| */var lc=Object.getOwnPropertySymbols,fg=Object.prototype.hasOwnProperty,gg=Object.prototype.propertyIsEnumerable;function dg(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var yu=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if(Object.getOwnPropertyNames(e).map(function(i){return e[i]}).join("")!=="0123456789")return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(i){r[i]=i}),Object.keys(Object.assign({},r)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}()?Object.assign:function(t,e){for(var n,r,i=dg(t),o=1;o<arguments.length;o++){for(var s in n=Object(arguments[o]))fg.call(n,s)&&(i[s]=n[s]);if(lc){r=lc(n);for(var a=0;a<r.length;a++)gg.call(n,r[a])&&(i[r[a]]=n[r[a]])}}return i},cc={successCallback:null,verbose:!1},na={};/**
| * @license GNU Affero General Public License.
| * Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
| * v. 1.2.0
| * https://github.com/RaumZeit/MarchingSquares.js
| *
| * MarchingSquaresJS is free software: you can redistribute it and/or modify
| * it under the terms of the GNU Affero General Public License as published by
| * the Free Software Foundation, either version 3 of the License, or
| * (at your option) any later version.
| *
| * MarchingSquaresJS is distributed in the hope that it will be useful,
| * but WITHOUT ANY WARRANTY; without even the implied warranty of
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| * GNU Affero General Public License for more details.
| *
| * As additional permission under GNU Affero General Public License version 3
| * section 7, third-party projects (personal or commercial) may distribute,
| * include, or link against UNMODIFIED VERSIONS of MarchingSquaresJS without the
| * requirement that said third-party project for that reason alone becomes
| * subject to any requirement of the GNU Affero General Public License version 3.
| * Any modifications to MarchingSquaresJS, however, must be shared with the public
| * and made available.
| *
| * In summary this:
| * - allows you to use MarchingSquaresJS at no cost
| * - allows you to use MarchingSquaresJS for both personal and commercial purposes
| * - allows you to distribute UNMODIFIED VERSIONS of MarchingSquaresJS under any
| * license as long as this license notice is included
| * - enables you to keep the source code of your program that uses MarchingSquaresJS
| * undisclosed
| * - forces you to share any modifications you have made to MarchingSquaresJS,
| * e.g. bug-fixes
| *
| * You should have received a copy of the GNU Affero General Public License
| * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
| */function yg(t,e,n){n=n||{};for(var r=Object.keys(cc),i=0;i<r.length;i++){var o=r[i],s=n[o];s=s??cc[o],na[o]=s}na.verbose&&console.log("MarchingSquaresJS-isoContours: computing isocontour for "+e);var a=function(u){var l=[],h=0,c=1e-7;return u.cells.forEach(function(p,d){p.forEach(function(g,m){if(g!==void 0&&(b=g).cval!==5&&b.cval!==10&&!hc(g)){var f=function(E,T,C){var D,M,B=E.length,O=[],R=[0,0,1,1,0,0,0,0,-1,0,1,1,-1,0,-1,0],P=[0,-1,0,0,1,1,1,1,0,-1,0,0,0,-1,0,0],F=["none","left","bottom","left","right","none","bottom","left","top","top","none","top","right","right","bottom","none"],k=["none","bottom","right","right","top","top","top","top","left","bottom","right","right","left","bottom","left","none"],q=E[T][C],S=q.cval,V=F[S],j=mu(q,V);O.push([C+j[0],T+j[1]]),V=k[S],j=mu(q,V),O.push([C+j[0],T+j[1]]),pc(q);for(var tt=C+R[S],at=T+P[S],Jt=S;tt>=0&&at>=0&&at<B&&(tt!=C||at!=T)&&(q=E[at][tt])!==void 0;){if((S=q.cval)===0||S===15)return{path:O,info:"mergeable"};V=k[S],D=R[S],M=P[S],S!==5&&S!==10||(S===5?q.flipped?P[Jt]===-1?(V="left",D=-1,M=0):(V="right",D=1,M=0):R[Jt]===-1&&(V="bottom",D=0,M=-1):S===10&&(q.flipped?R[Jt]===-1?(V="top",D=0,M=1):(V="bottom",D=0,M=-1):P[Jt]===1&&(V="left",D=-1,M=0))),j=mu(q,V),O.push([tt+j[0],at+j[1]]),pc(q),tt+=D,at+=M,Jt=S}return{path:O,info:"closed"}}(u.cells,d,m),_=!1;if(f.info==="mergeable"){for(var I=f.path[f.path.length-1][0],y=f.path[f.path.length-1][1],v=h-1;v>=0;v--)if(Math.abs(l[v][0][0]-I)<=c&&Math.abs(l[v][0][1]-y)<=c){for(var x=f.path.length-2;x>=0;--x)l[v].unshift(f.path[x]);_=!0;break}}_||(l[h++]=f.path)}var b})}),l}(function(u,l){for(var h=u.length-1,c=u[0].length-1,p={rows:h,cols:c,cells:[]},d=0;d<h;++d){p.cells[d]=[];for(var g=0;g<c;++g){var m=0,f=u[d+1][g],_=u[d+1][g+1],I=u[d][g+1],y=u[d][g];if(!(isNaN(f)||isNaN(_)||isNaN(I)||isNaN(y))){m|=f>=l?8:0,m|=_>=l?4:0,m|=I>=l?2:0;var v,x,b,E,T=!1;if((m|=y>=l?1:0)===5||m===10){var C=(f+_+I+y)/4;m===5&&C<l?(m=10,T=!0):m===10&&C<l&&(m=5,T=!0)}m!==0&&m!==15&&(v=x=b=E=.5,m===1?(b=1-ee(l,f,y),x=1-ee(l,I,y)):m===2?(x=ee(l,y,I),E=1-ee(l,_,I)):m===3?(b=1-ee(l,f,y),E=1-ee(l,_,I)):m===4?(v=ee(l,f,_),E=ee(l,I,_)):m===5?(v=ee(l,f,_),E=ee(l,I,_),x=1-ee(l,I,y),b=1-ee(l,f,y)):m===6?(x=ee(l,y,I),v=ee(l,f,_)):m===7?(b=1-ee(l,f,y),v=ee(l,f,_)):m===8?(b=ee(l,y,f),v=1-ee(l,_,f)):m===9?(x=1-ee(l,I,y),v=1-ee(l,_,f)):m===10?(v=1-ee(l,_,f),E=1-ee(l,_,I),x=ee(l,y,I),b=ee(l,y,f)):m===11?(v=1-ee(l,_,f),E=1-ee(l,_,I)):m===12?(b=ee(l,y,f),E=ee(l,I,_)):m===13?(x=1-ee(l,I,y),E=ee(l,I,_)):m===14?(b=ee(l,y,f),x=ee(l,y,I)):console.log("MarchingSquaresJS-isoContours: Illegal cval detected: "+m),p.cells[d][g]={cval:m,flipped:T,top:v,right:E,bottom:x,left:b})}}}return p}(t,e));return typeof na.successCallback=="function"&&na.successCallback(a),a}function ee(t,e,n){return(t-e)/(n-e)}function hc(t){return t.cval===0||t.cval===15}function pc(t){hc(t)||t.cval===5||t.cval===10||(t.cval=15)}function mu(t,e){return e==="top"?[t.top,1]:e==="bottom"?[t.bottom,0]:e==="right"?[1,t.right]:e==="left"?[0,t.left]:void 0}function mg(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;ti(t,"Point","input must contain Points");for(var o=function(p,d){var g={};return Zt(p,function(m){var f=it(m)[1];g[f]||(g[f]=[]),g[f].push(m)}),Object.keys(g).map(function(m){return g[m].sort(function(f,_){return it(f)[0]-it(_)[0]})}).sort(function(m,f){return d?it(m[0])[1]-it(f[0])[1]:it(f[0])[1]-it(m[0])[1]})}(t,r),s=[],a=0;a<o.length;a++){for(var u=o[a],l=[],h=0;h<u.length;h++){var c=u[h];c.properties[n]?l.push(c.properties[n]):l.push(0),i===!0&&(c.properties.matrixPosition=[a,h])}s.push(l)}return s}var fc=gc,vg=gc;function gc(t,e,n,r,i){dc(t,e,n||0,r||t.length-1,i||_g)}function dc(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,s=e-n+1,a=Math.log(o),u=.5*Math.exp(2*a/3),l=.5*Math.sqrt(a*u*(o-u)/o)*(s-o/2<0?-1:1);dc(t,e,Math.max(n,Math.floor(e-s*u/o+l)),Math.min(r,Math.floor(e+(o-s)*u/o+l)),i)}var h=t[e],c=n,p=r;for(es(t,n,e),i(t[r],h)>0&&es(t,n,r);c<p;){for(es(t,c,p),c++,p--;i(t[c],h)<0;)c++;for(;i(t[p],h)>0;)p--}i(t[n],h)===0?es(t,n,p):es(t,++p,r),p<=e&&(n=p+1),e<=p&&(r=p-1)}}function es(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function _g(t,e){return t<e?-1:t>e?1:0}fc.default=vg;var un=ns,xg=ns;function ns(t,e){if(!(this instanceof ns))return new ns(t,e);this._maxEntries=Math.max(4,t||9),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),e&&this._initFormat(e),this.clear()}function Eg(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r<e.length;r++)if(n(t,e[r]))return r;return-1}function ho(t,e){rs(t,0,t.children.length,e,t)}function rs(t,e,n,r,i){i||(i=po(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o,s=e;s<n;s++)o=t.children[s],is(i,t.leaf?r(o):o);return i}function is(t,e){return t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),t}function yc(t,e){return t.minX-e.minX}function mc(t,e){return t.minY-e.minY}function vu(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function ra(t){return t.maxX-t.minX+(t.maxY-t.minY)}function _u(t,e){return t.minX<=e.minX&&t.minY<=e.minY&&e.maxX<=t.maxX&&e.maxY<=t.maxY}function ia(t,e){return e.minX<=t.maxX&&e.minY<=t.maxY&&e.maxX>=t.minX&&e.maxY>=t.minY}function po(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function vc(t,e,n,r,i){for(var o,s=[e,n];s.length;)(n=s.pop())-(e=s.pop())<=r||(o=e+Math.ceil((n-e)/r/2)*r,fc(t,o,e,n,i),s.push(e,o,o,n))}function Dr(t){var e={exports:{}};return t(e,e.exports),e.exports}ns.prototype={all:function(){return this._all(this.data,[])},search:function(t){var e=this.data,n=[],r=this.toBBox;if(!ia(t,e))return n;for(var i,o,s,a,u=[];e;){for(i=0,o=e.children.length;i<o;i++)s=e.children[i],ia(t,a=e.leaf?r(s):s)&&(e.leaf?n.push(s):_u(t,a)?this._all(s,n):u.push(s));e=u.pop()}return n},collides:function(t){var e=this.data,n=this.toBBox;if(!ia(t,e))return!1;for(var r,i,o,s,a=[];e;){for(r=0,i=e.children.length;r<i;r++)if(o=e.children[r],ia(t,s=e.leaf?n(o):o)){if(e.leaf||_u(t,s))return!0;a.push(o)}e=a.pop()}return!1},load:function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var e=0,n=t.length;e<n;e++)this.insert(t[e]);return this}var r=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===r.height)this._splitRoot(this.data,r);else{if(this.data.height<r.height){var i=this.data;this.data=r,r=i}this._insert(r,this.data.height-r.height-1,!0)}else this.data=r;return this},insert:function(t){return t&&this._insert(t,this.data.height-1),this},clear:function(){return this.data=po([]),this},remove:function(t,e){if(!t)return this;for(var n,r,i,o,s=this.data,a=this.toBBox(t),u=[],l=[];s||u.length;){if(s||(s=u.pop(),r=u[u.length-1],n=l.pop(),o=!0),s.leaf&&(i=Eg(t,s.children,e))!==-1)return s.children.splice(i,1),u.push(s),this._condense(u),this;o||s.leaf||!_u(s,a)?r?(n++,s=r.children[n],o=!1):s=null:(u.push(s),l.push(n),n=0,r=s,s=s.children[0])}return this},toBBox:function(t){return t},compareMinX:yc,compareMinY:mc,toJSON:function(){return this.data},fromJSON:function(t){return this.data=t,this},_all:function(t,e){for(var n=[];t;)t.leaf?e.push.apply(e,t.children):n.push.apply(n,t.children),t=n.pop();return e},_build:function(t,e,n,r){var i,o=n-e+1,s=this._maxEntries;if(o<=s)return ho(i=po(t.slice(e,n+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(o)/Math.log(s)),s=Math.ceil(o/Math.pow(s,r-1))),(i=po([])).leaf=!1,i.height=r;var a,u,l,h,c=Math.ceil(o/s),p=c*Math.ceil(Math.sqrt(s));for(vc(t,e,n,p,this.compareMinX),a=e;a<=n;a+=p)for(vc(t,a,l=Math.min(a+p-1,n),c,this.compareMinY),u=a;u<=l;u+=c)h=Math.min(u+c-1,l),i.children.push(this._build(t,u,h,r-1));return ho(i,this.toBBox),i},_chooseSubtree:function(t,e,n,r){for(var i,o,s,a,u,l,h,c,p,d;r.push(e),!e.leaf&&r.length-1!==n;){for(h=c=1/0,i=0,o=e.children.length;i<o;i++)u=vu(s=e.children[i]),p=t,d=s,(l=(Math.max(d.maxX,p.maxX)-Math.min(d.minX,p.minX))*(Math.max(d.maxY,p.maxY)-Math.min(d.minY,p.minY))-u)<c?(c=l,h=u<h?u:h,a=s):l===c&&u<h&&(h=u,a=s);e=a||e.children[0]}return e},_insert:function(t,e,n){var r=this.toBBox,i=n?t:r(t),o=[],s=this._chooseSubtree(i,this.data,e,o);for(s.children.push(t),is(s,i);e>=0&&o[e].children.length>this._maxEntries;)this._split(o,e),e--;this._adjustParentBBoxes(i,o,e)},_split:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),s=po(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,ho(n,this.toBBox),ho(s,this.toBBox),e?t[e-1].children.push(s):this._splitRoot(n,s)},_splitRoot:function(t,e){this.data=po([t,e]),this.data.height=t.height+1,this.data.leaf=!1,ho(this.data,this.toBBox)},_chooseSplitIndex:function(t,e,n){var r,i,o,s,a,u,l,h,c,p,d,g,m,f;for(u=l=1/0,r=e;r<=n-e;r++)i=rs(t,0,r,this.toBBox),o=rs(t,r,n,this.toBBox),c=i,p=o,d=void 0,g=void 0,m=void 0,f=void 0,d=Math.max(c.minX,p.minX),g=Math.max(c.minY,p.minY),m=Math.min(c.maxX,p.maxX),f=Math.min(c.maxY,p.maxY),s=Math.max(0,m-d)*Math.max(0,f-g),a=vu(i)+vu(o),s<u?(u=s,h=r,l=a<l?a:l):s===u&&a<l&&(l=a,h=r);return h},_chooseSplitAxis:function(t,e,n){var r=t.leaf?this.compareMinX:yc,i=t.leaf?this.compareMinY:mc;this._allDistMargin(t,e,n,r)<this._allDistMargin(t,e,n,i)&&t.children.sort(r)},_allDistMargin:function(t,e,n,r){t.children.sort(r);var i,o,s=this.toBBox,a=rs(t,0,e,s),u=rs(t,n-e,n,s),l=ra(a)+ra(u);for(i=e;i<n-e;i++)o=t.children[i],is(a,t.leaf?s(o):o),l+=ra(a);for(i=n-e-1;i>=e;i--)o=t.children[i],is(u,t.leaf?s(o):o),l+=ra(u);return l},_adjustParentBBoxes:function(t,e,n){for(var r=n;r>=0;r--)is(e[r],t)},_condense:function(t){for(var e,n=t.length-1;n>=0;n--)t[n].children.length===0?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():ho(t[n],this.toBBox)},_initFormat:function(t){var e=["return a"," - b",";"];this.compareMinX=new Function("a","b",e.join(t[0])),this.compareMinY=new Function("a","b",e.join(t[1])),this.toBBox=new Function("a","return {minX: a"+t[0]+", minY: a"+t[1]+", maxX: a"+t[2]+", maxY: a"+t[3]+"};")}},un.default=xg;var oa=function(t,e,n){var r=t*e,i=_c*t,o=i-(i-t),s=t-o,a=_c*e,u=a-(a-e),l=e-u,h=s*l-(r-o*u-s*u-o*l);return n?(n[0]=h,n[1]=r,n):[h,r]},_c=+(Math.pow(2,27)+1),bg=function(t,e){var n=0|t.length,r=0|e.length;if(n===1&&r===1)return function(b,E){var T=b+E,C=T-b,D=b-(T-C)+(E-C);return D?[D,T]:[T]}(t[0],e[0]);var i,o,s=new Array(n+r),a=0,u=0,l=0,h=Math.abs,c=t[u],p=h(c),d=e[l],g=h(d);p<g?(o=c,(u+=1)<n&&(c=t[u],p=h(c))):(o=d,(l+=1)<r&&(d=e[l],g=h(d))),u<n&&p<g||l>=r?(i=c,(u+=1)<n&&(c=t[u],p=h(c))):(i=d,(l+=1)<r&&(d=e[l],g=h(d)));for(var m,f,_=i+o,I=_-i,y=o-I,v=y,x=_;u<n&&l<r;)p<g?(i=c,(u+=1)<n&&(c=t[u],p=h(c))):(i=d,(l+=1)<r&&(d=e[l],g=h(d))),(y=(o=v)-(I=(_=i+o)-i))&&(s[a++]=y),v=x-((m=x+_)-(f=m-x))+(_-f),x=m;for(;u<n;)(y=(o=v)-(I=(_=(i=c)+o)-i))&&(s[a++]=y),v=x-((m=x+_)-(f=m-x))+(_-f),x=m,(u+=1)<n&&(c=t[u]);for(;l<r;)(y=(o=v)-(I=(_=(i=d)+o)-i))&&(s[a++]=y),v=x-((m=x+_)-(f=m-x))+(_-f),x=m,(l+=1)<r&&(d=e[l]);return v&&(s[a++]=v),x&&(s[a++]=x),a||(s[a++]=0),s.length=a,s},wg=function(t,e,n){var r=t+e,i=r-t,o=e-i,s=t-(r-i);return n?(n[0]=s+o,n[1]=r,n):[s+o,r]},Ig=function(t,e){var n=t.length;if(n===1){var r=oa(t[0],e);return r[0]?r:[r[1]]}var i=new Array(2*n),o=[.1,.1],s=[.1,.1],a=0;oa(t[0],e,o),o[0]&&(i[a++]=o[0]);for(var u=1;u<n;++u){oa(t[u],e,s);var l=o[1];wg(l,s[0],o),o[0]&&(i[a++]=o[0]);var h=s[1],c=o[1],p=h+c,d=c-(p-h);o[1]=p,d&&(i[a++]=d)}return o[1]&&(i[a++]=o[1]),a===0&&(i[a++]=0),i.length=a,i},Sg=function(t,e){var n=0|t.length,r=0|e.length;if(n===1&&r===1)return function(b,E){var T=b+E,C=T-b,D=b-(T-C)+(E-C);return D?[D,T]:[T]}(t[0],-e[0]);var i,o,s=new Array(n+r),a=0,u=0,l=0,h=Math.abs,c=t[u],p=h(c),d=-e[l],g=h(d);p<g?(o=c,(u+=1)<n&&(c=t[u],p=h(c))):(o=d,(l+=1)<r&&(d=-e[l],g=h(d))),u<n&&p<g||l>=r?(i=c,(u+=1)<n&&(c=t[u],p=h(c))):(i=d,(l+=1)<r&&(d=-e[l],g=h(d)));for(var m,f,_=i+o,I=_-i,y=o-I,v=y,x=_;u<n&&l<r;)p<g?(i=c,(u+=1)<n&&(c=t[u],p=h(c))):(i=d,(l+=1)<r&&(d=-e[l],g=h(d))),(y=(o=v)-(I=(_=i+o)-i))&&(s[a++]=y),v=x-((m=x+_)-(f=m-x))+(_-f),x=m;for(;u<n;)(y=(o=v)-(I=(_=(i=c)+o)-i))&&(s[a++]=y),v=x-((m=x+_)-(f=m-x))+(_-f),x=m,(u+=1)<n&&(c=t[u]);for(;l<r;)(y=(o=v)-(I=(_=(i=d)+o)-i))&&(s[a++]=y),v=x-((m=x+_)-(f=m-x))+(_-f),x=m,(l+=1)<r&&(d=-e[l]);return v&&(s[a++]=v),x&&(s[a++]=x),a||(s[a++]=0),s.length=a,s},xc=Dr(function(t){function e(l,h){for(var c=new Array(l.length-1),p=1;p<l.length;++p)for(var d=c[p-1]=new Array(l.length-1),g=0,m=0;g<l.length;++g)g!==h&&(d[m++]=l[p][g]);return c}function n(l){if(l.length===1)return l[0];if(l.length===2)return["sum(",l[0],",",l[1],")"].join("");var h=l.length>>1;return["sum(",n(l.slice(0,h)),",",n(l.slice(h)),")"].join("")}function r(l){if(l.length===2)return[["sum(prod(",l[0][0],",",l[1][1],"),prod(-",l[0][1],",",l[1][0],"))"].join("")];for(var h=[],c=0;c<l.length;++c)h.push(["scale(",n(r(e(l,c))),",",(p=c,1&p?"-":""),l[0][c],")"].join(""));return h;var p}function i(l){for(var h=[],c=[],p=function(y){for(var v=new Array(y),x=0;x<y;++x){v[x]=new Array(y);for(var b=0;b<y;++b)v[x][b]=["m",b,"[",y-x-1,"]"].join("")}return v}(l),d=[],g=0;g<l;++g)(1&g)==0?h.push.apply(h,r(e(p,g))):c.push.apply(c,r(e(p,g))),d.push("m"+g);var m=n(h),f=n(c),_="orientation"+l+"Exact",I=["function ",_,"(",d.join(),"){var p=",m,",n=",f,",d=sub(p,n);return d[d.length-1];};return ",_].join("");return new Function("sum","prod","scale","sub",I)(bg,oa,Ig,Sg)}var o=i(3),s=i(4),a=[function(){return 0},function(){return 0},function(l,h){return h[0]-l[0]},function(l,h,c){var p,d=(l[1]-c[1])*(h[0]-c[0]),g=(l[0]-c[0])*(h[1]-c[1]),m=d-g;if(d>0){if(g<=0)return m;p=d+g}else{if(!(d<0)||g>=0)return m;p=-(d+g)}var f=33306690738754716e-32*p;return m>=f||m<=-f?m:o(l,h,c)},function(l,h,c,p){var d=l[0]-p[0],g=h[0]-p[0],m=c[0]-p[0],f=l[1]-p[1],_=h[1]-p[1],I=c[1]-p[1],y=l[2]-p[2],v=h[2]-p[2],x=c[2]-p[2],b=g*I,E=m*_,T=m*f,C=d*I,D=d*_,M=g*f,B=y*(b-E)+v*(T-C)+x*(D-M),O=7771561172376103e-31*((Math.abs(b)+Math.abs(E))*Math.abs(y)+(Math.abs(T)+Math.abs(C))*Math.abs(v)+(Math.abs(D)+Math.abs(M))*Math.abs(x));return B>O||-B>O?B:s(l,h,c,p)}];function u(l){var h=a[l.length];return h||(h=a[l.length]=i(l.length)),h.apply(void 0,l)}(function(){for(;a.length<=5;)a.push(i(a.length));for(var l=[],h=["slow"],c=0;c<=5;++c)l.push("a"+c),h.push("o"+c);var p=["function getOrientation(",l.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(c=2;c<=5;++c)p.push("case ",c,":return o",c,"(",l.slice(0,c).join(),");");p.push("}var s=new Array(arguments.length);for(var i=0;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),h.push(p.join(""));var d=Function.apply(void 0,h);for(t.exports=d.apply(void 0,[u].concat(a)),c=0;c<=5;++c)t.exports[c]=a[c]})()}),Cg=function(t){var e=t.length;if(e<3){for(var n=new Array(e),r=0;r<e;++r)n[r]=r;return e===2&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:n}var i=new Array(e);for(r=0;r<e;++r)i[r]=r;i.sort(function(d,g){var m=t[d][0]-t[g][0];return m||t[d][1]-t[g][1]});var o=[i[0],i[1]],s=[i[0],i[1]];for(r=2;r<e;++r){for(var a=i[r],u=t[a],l=o.length;l>1&&Ec(t[o[l-2]],t[o[l-1]],u)<=0;)l-=1,o.pop();for(o.push(a),l=s.length;l>1&&Ec(t[s[l-2]],t[s[l-1]],u)>=0;)l-=1,s.pop();s.push(a)}n=new Array(s.length+o.length-2);for(var h=0,c=(r=0,o.length);r<c;++r)n[h++]=o[r];for(var p=s.length-2;p>0;--p)n[h++]=s[p];return n},Ec=xc[3],bc=os,Ng=os;function os(t,e){if(!(this instanceof os))return new os(t,e);if(this.data=t||[],this.length=this.data.length,this.compare=e||Pg,this.length>0)for(var n=(this.length>>1)-1;n>=0;n--)this._down(n)}function Pg(t,e){return t<e?-1:t>e?1:0}os.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r},_down:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),s=o+1,a=e[o];if(s<this.length&&n(e[s],a)<0&&(o=s,a=e[s]),n(a,i)>=0)break;e[t]=a,t=o}e[t]=i}},bc.default=Ng;var Mg=function(t,e){for(var n=t[0],r=t[1],i=!1,o=0,s=e.length-1;o<e.length;s=o++){var a=e[o][0],u=e[o][1],l=e[s][0],h=e[s][1];u>r!=h>r&&n<(l-a)*(r-u)/(h-u)+a&&(i=!i)}return i},sa=xc[3],wc=Ic,Lg=Ic;function Ic(t,e,n){e=Math.max(0,e===void 0?2:e),n=n||0;for(var r,i=function(I){for(var y=I[0],v=I[0],x=I[0],b=I[0],E=0;E<I.length;E++){var T=I[E];T[0]<y[0]&&(y=T),T[0]>x[0]&&(x=T),T[1]<v[1]&&(v=T),T[1]>b[1]&&(b=T)}var C=[y,v,x,b],D=C.slice();for(E=0;E<I.length;E++)Mg(I[E],C)||D.push(I[E]);var M=Cg(D),B=[];for(E=0;E<M.length;E++)B.push(D[M[E]]);return B}(t),o=un(16,["[0]","[1]","[0]","[1]"]).load(t),s=[],a=0;a<i.length;a++){var u=i[a];o.remove(u),r=Nc(u,r),s.push(r)}var l=un(16);for(a=0;a<s.length;a++)l.insert(xu(s[a]));for(var h=e*e,c=n*n;s.length;){var p=s.shift(),d=p.p,g=p.next.p,m=Eu(d,g);if(!(m<c)){var f=m/h;(u=Og(o,p.prev.p,d,g,p.next.next.p,f,l))&&Math.min(Eu(u,d),Eu(u,g))<=f&&(s.push(p),s.push(Nc(u,p)),o.remove(u),l.remove(p),l.insert(xu(p)),l.insert(xu(p.next)))}}p=r;var _=[];do _.push(p.p),p=p.next;while(p!==r);return _.push(p.p),_}function Og(t,e,n,r,i,o,s){for(var a=new bc(null,Rg),u=t.data;u;){for(var l=0;l<u.children.length;l++){var h=u.children[l],c=u.leaf?bu(h,n,r):Tg(n,r,h);c>o||a.push({node:h,dist:c})}for(;a.length&&!a.peek().node.children;){var p=a.pop(),d=p.node,g=bu(d,e,n),m=bu(d,r,i);if(p.dist<g&&p.dist<m&&Cc(n,d,s)&&Cc(r,d,s))return d}(u=a.pop())&&(u=u.node)}return null}function Rg(t,e){return t.dist-e.dist}function Tg(t,e,n){if(Sc(t,n)||Sc(e,n))return 0;var r=aa(t[0],t[1],e[0],e[1],n.minX,n.minY,n.maxX,n.minY);if(r===0)return 0;var i=aa(t[0],t[1],e[0],e[1],n.minX,n.minY,n.minX,n.maxY);if(i===0)return 0;var o=aa(t[0],t[1],e[0],e[1],n.maxX,n.minY,n.maxX,n.maxY);if(o===0)return 0;var s=aa(t[0],t[1],e[0],e[1],n.minX,n.maxY,n.maxX,n.maxY);return s===0?0:Math.min(r,i,o,s)}function Sc(t,e){return t[0]>=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function Cc(t,e,n){for(var r,i,o,s,a=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),l=Math.max(t[0],e[0]),h=Math.max(t[1],e[1]),c=n.search({minX:a,minY:u,maxX:l,maxY:h}),p=0;p<c.length;p++)if(r=c[p].p,i=c[p].next.p,o=t,r!==(s=e)&&i!==o&&sa(r,i,o)>0!=sa(r,i,s)>0&&sa(o,s,r)>0!=sa(o,s,i)>0)return!1;return!0}function xu(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function Nc(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function Eu(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function bu(t,e,n){var r=e[0],i=e[1],o=n[0]-r,s=n[1]-i;if(o!==0||s!==0){var a=((t[0]-r)*o+(t[1]-i)*s)/(o*o+s*s);a>1?(r=n[0],i=n[1]):a>0&&(r+=o*a,i+=s*a)}return(o=t[0]-r)*o+(s=t[1]-i)*s}function aa(t,e,n,r,i,o,s,a){var u,l,h,c,p=n-t,d=r-e,g=s-i,m=a-o,f=t-i,_=e-o,I=p*p+d*d,y=p*g+d*m,v=g*g+m*m,x=p*f+d*_,b=g*f+m*_,E=I*v-y*y,T=E,C=E;E===0?(l=0,T=1,c=b,C=v):(c=I*b-y*x,(l=y*b-v*x)<0?(l=0,c=b,C=v):l>T&&(l=T,c=b+y,C=v)),c<0?(c=0,-x<0?l=0:-x>I?l=T:(l=-x,T=I)):c>C&&(c=C,-x+y<0?l=0:-x+y>I?l=T:(l=-x+y,T=I));var D=(1-(h=c===0?0:c/C))*i+h*s-((1-(u=l===0?0:l/T))*t+u*n),M=(1-h)*o+h*a-((1-u)*e+u*r);return D*D+M*M}function Pc(t,e){e===void 0&&(e={}),e.concavity=e.concavity||1/0;var n=[];if(Ce(t,function(i){n.push([i[0],i[1]])}),!n.length)return null;var r=wc(n,e.concavity);return r.length>3?ct([r]):null}function le(t,e,n){if(n===void 0&&(n={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=re(t),i=ae(e),o=i.type,s=e.bbox,a=i.coordinates;if(s&&function(p,d){return d[0]<=p[0]&&d[1]<=p[1]&&d[2]>=p[0]&&d[3]>=p[1]}(r,s)===!1)return!1;o==="Polygon"&&(a=[a]);for(var u=!1,l=0;l<a.length&&!u;l++)if(Mc(r,a[l][0],n.ignoreBoundary)){for(var h=!1,c=1;c<a[l].length&&!h;)Mc(r,a[l][c],!n.ignoreBoundary)&&(h=!0),c++;h||(u=!0)}return u}function Mc(t,e,n){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var i=0,o=e.length-1;i<e.length;o=i++){var s=e[i][0],a=e[i][1],u=e[o][0],l=e[o][1];if(t[1]*(s-u)+a*(u-t[0])+l*(t[0]-s)==0&&(s-t[0])*(u-t[0])<=0&&(a-t[1])*(l-t[1])<=0)return!n;a>t[1]!=l>t[1]&&t[0]<(u-s)*(t[1]-a)/(l-a)+s&&(r=!r)}return r}function wu(t,e){var n=[];return Zt(t,function(r){var i=!1;zn(e,function(o){le(r,o)&&(i=!0)}),i&&n.push(r)}),nt(n)}function $t(t,e,n){n===void 0&&(n={});var r=re(t),i=re(e),o=ke(i[1]-r[1]),s=ke(i[0]-r[0]),a=ke(r[1]),u=ke(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(u);return co(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}function Lc(t,e){var n=!1;return nt(function(r){if(r.length<3)return[];r.sort(Ag);for(var i,o,s,a,u,l,h=r.length-1,c=r[h].x,p=r[0].x,d=r[h].y,g=d,m=1e-12;h--;)r[h].y<d&&(d=r[h].y),r[h].y>g&&(g=r[h].y);var f,_=p-c,I=g-d,y=_>I?_:I,v=.5*(p+c),x=.5*(g+d),b=[new Oc({__sentinel:!0,x:v-20*y,y:x-y},{__sentinel:!0,x:v,y:x+20*y},{__sentinel:!0,x:v+20*y,y:x-y})],E=[],T=[];for(h=r.length;h--;){for(T.length=0,f=b.length;f--;)(_=r[h].x-b[f].x)>0&&_*_>b[f].r?(E.push(b[f]),b.splice(f,1)):_*_+(I=r[h].y-b[f].y)*I>b[f].r||(T.push(b[f].a,b[f].b,b[f].b,b[f].c,b[f].c,b[f].a),b.splice(f,1));for(Dg(T),f=T.length;f;)o=T[--f],i=T[--f],s=r[h],a=o.x-i.x,u=o.y-i.y,l=2*(a*(s.y-o.y)-u*(s.x-o.x)),Math.abs(l)>m&&b.push(new Oc(i,o,s))}for(Array.prototype.push.apply(E,b),h=E.length;h--;)(E[h].a.__sentinel||E[h].b.__sentinel||E[h].c.__sentinel)&&E.splice(h,1);return E}(t.features.map(function(r){var i={x:r.geometry.coordinates[0],y:r.geometry.coordinates[1]};return e?i.z=r.properties[e]:r.geometry.coordinates.length===3&&(n=!0,i.z=r.geometry.coordinates[2]),i})).map(function(r){var i=[r.a.x,r.a.y],o=[r.b.x,r.b.y],s=[r.c.x,r.c.y],a={};return n?(i.push(r.a.z),o.push(r.b.z),s.push(r.c.z)):a={a:r.a.z,b:r.b.z,c:r.c.z},ct([[i,o,s,i]],a)}))}wc.default=Lg;var Oc=function(t,e,n){this.a=t,this.b=e,this.c=n;var r,i,o=e.x-t.x,s=e.y-t.y,a=n.x-t.x,u=n.y-t.y,l=o*(t.x+e.x)+s*(t.y+e.y),h=a*(t.x+n.x)+u*(t.y+n.y),c=2*(o*(n.y-e.y)-s*(n.x-e.x));this.x=(u*l-s*h)/c,this.y=(o*h-a*l)/c,r=this.x-t.x,i=this.y-t.y,this.r=r*r+i*i};function Ag(t,e){return e.x-t.x}function Dg(t){var e,n,r,i,o,s=t.length;t:for(;s;)for(n=t[--s],e=t[--s],r=s;r;)if(o=t[--r],e===(i=t[--r])&&n===o||e===o&&n===i){t.splice(s,2),t.splice(r,2),s-=2;continue t}}function Ye(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Rc(t);case"FeatureCollection":return function(e){var n={type:"FeatureCollection"};return Object.keys(e).forEach(function(r){switch(r){case"type":case"features":return;default:n[r]=e[r]}}),n.features=e.features.map(function(r){return Rc(r)}),n}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Iu(t);default:throw new Error("unknown GeoJSON type")}}function Rc(t){var e={type:"Feature"};return Object.keys(t).forEach(function(n){switch(n){case"type":case"properties":case"geometry":return;default:e[n]=t[n]}}),e.properties=Tc(t.properties),e.geometry=Iu(t.geometry),e}function Tc(t){var e={};return t&&Object.keys(t).forEach(function(n){var r=t[n];typeof r=="object"?r===null?e[n]=null:Array.isArray(r)?e[n]=r.map(function(i){return i}):e[n]=Tc(r):e[n]=r}),e}function Iu(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),t.type==="GeometryCollection"?(e.geometries=t.geometries.map(function(n){return Iu(n)}),e):(e.coordinates=Ac(t.coordinates),e)}function Ac(t){var e=t;return typeof e[0]!="object"?e.slice():e.map(function(n){return Ac(n)})}function Fg(t,e){if(e===void 0&&(e={}),!Qt(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if(wn(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");n!==!1&&n!==void 0||(t=Ye(t));var r=[],i=du(t,function(o,s){var a=function(u,l){var h,c=u.geometry.coordinates,p=l.geometry.coordinates,d=ua(c[0]),g=ua(c[c.length-1]),m=ua(p[0]),f=ua(p[p.length-1]);if(d===f)h=p.concat(c.slice(1));else if(m===g)h=c.concat(p.slice(1));else if(d===m)h=c.slice(1).reverse().concat(p);else{if(g!==f)return null;h=c.concat(p.reverse().slice(1))}return Wt(h)}(o,s);return a||(r.push(o),s)});return i&&r.push(i),r.length?r.length===1?r[0]:yi(r.map(function(o){return o.coordinates})):null}function ua(t){return t[0].toString()+","+t[1].toString()}function kg(t){return t}function Dc(t,e){var n=function(l){if(l==null)return kg;var h,c,p=l.scale[0],d=l.scale[1],g=l.translate[0],m=l.translate[1];return function(f,_){_||(h=c=0);var I=2,y=f.length,v=new Array(y);for(v[0]=(h+=f[0])*p+g,v[1]=(c+=f[1])*d+m;I<y;)v[I]=f[I],++I;return v}}(t.transform),r=t.arcs;function i(l,h){h.length&&h.pop();for(var c=r[l<0?~l:l],p=0,d=c.length;p<d;++p)h.push(n(c[p],p));l<0&&function(g,m){for(var f,_=g.length,I=_-m;I<--_;)f=g[I],g[I++]=g[_],g[_]=f}(h,d)}function o(l){return n(l)}function s(l){for(var h=[],c=0,p=l.length;c<p;++c)i(l[c],h);return h.length<2&&h.push(h[0]),h}function a(l){for(var h=s(l);h.length<4;)h.push(h[0]);return h}function u(l){return l.map(a)}return function l(h){var c,p=h.type;switch(p){case"GeometryCollection":return{type:p,geometries:h.geometries.map(l)};case"Point":c=o(h.coordinates);break;case"MultiPoint":c=h.coordinates.map(o);break;case"LineString":c=s(h.arcs);break;case"MultiLineString":c=h.arcs.map(s);break;case"Polygon":c=u(h.arcs);break;case"MultiPolygon":c=h.arcs.map(u);break;default:return null}return{type:p,coordinates:c}}(e)}function Gg(t,e){var n={},r={},i={},o=[],s=-1;function a(u,l){for(var h in u){var c=u[h];delete l[c.start],delete c.start,delete c.end,c.forEach(function(p){n[p<0?~p:p]=1}),o.push(c)}}return e.forEach(function(u,l){var h,c=t.arcs[u<0?~u:u];c.length<3&&!c[1][0]&&!c[1][1]&&(h=e[++s],e[s]=u,e[l]=h)}),e.forEach(function(u){var l,h,c=function(f){var _,I=t.arcs[f<0?~f:f],y=I[0];return t.transform?(_=[0,0],I.forEach(function(v){_[0]+=v[0],_[1]+=v[1]})):_=I[I.length-1],f<0?[_,y]:[y,_]}(u),p=c[0],d=c[1];if(l=i[p])if(delete i[l.end],l.push(u),l.end=d,h=r[d]){delete r[h.start];var g=h===l?l:l.concat(h);r[g.start=l.start]=i[g.end=h.end]=g}else r[l.start]=i[l.end]=l;else if(l=r[d])if(delete r[l.start],l.unshift(u),l.start=p,h=i[p]){delete i[h.end];var m=h===l?l:h.concat(l);r[m.start=h.start]=i[m.end=l.end]=m}else r[l.start]=i[l.end]=l;else r[(l=[u]).start=p]=i[l.end=d]=l}),a(i,r),a(r,i),e.forEach(function(u){n[u<0?~u:u]||o.push([u])}),o}function qg(t,e){var n={},r=[],i=[];function o(a){a.forEach(function(u){u.forEach(function(l){(n[l=l<0?~l:l]||(n[l]=[])).push(a)})}),r.push(a)}function s(a){return function(u){for(var l,h=-1,c=u.length,p=u[c-1],d=0;++h<c;)l=p,p=u[h],d+=l[0]*p[1]-l[1]*p[0];return Math.abs(d)}(Dc(t,{type:"Polygon",arcs:[a]}).coordinates[0])}return e.forEach(function a(u){switch(u.type){case"GeometryCollection":u.geometries.forEach(a);break;case"Polygon":o(u.arcs);break;case"MultiPolygon":u.arcs.forEach(o)}}),r.forEach(function(a){if(!a._){var u=[],l=[a];for(a._=1,i.push(u);a=l.pop();)u.push(a),a.forEach(function(h){h.forEach(function(c){n[c<0?~c:c].forEach(function(p){p._||(p._=1,l.push(p))})})})}}),r.forEach(function(a){delete a._}),{type:"MultiPolygon",arcs:i.map(function(a){var u,l=[];if(a.forEach(function(g){g.forEach(function(m){m.forEach(function(f){n[f<0?~f:f].length<2&&l.push(f)})})}),(u=(l=Gg(t,l)).length)>1)for(var h,c,p=1,d=s(l[0]);p<u;++p)(h=s(l[p]))>d&&(c=l[0],l[0]=l[p],l[p]=c,d=h);return l}).filter(function(a){return a.length>0})}}var la=Object.prototype.hasOwnProperty;function Su(t,e,n,r,i,o){arguments.length===3&&(r=o=Array,i=null);for(var s=new r(t=1<<Math.max(4,Math.ceil(Math.log(t)/Math.LN2))),a=new o(t),u=t-1,l=0;l<t;++l)s[l]=i;function h(g,m){for(var f=e(g)&u,_=s[f],I=0;_!=i;){if(n(_,g))return a[f]=m;if(++I>=t)throw new Error("full hashmap");_=s[f=f+1&u]}return s[f]=g,a[f]=m,m}function c(g,m){for(var f=e(g)&u,_=s[f],I=0;_!=i;){if(n(_,g))return a[f];if(++I>=t)throw new Error("full hashmap");_=s[f=f+1&u]}return s[f]=g,a[f]=m,m}function p(g,m){for(var f=e(g)&u,_=s[f],I=0;_!=i;){if(n(_,g))return a[f];if(++I>=t)break;_=s[f=f+1&u]}return m}function d(){for(var g=[],m=0,f=s.length;m<f;++m){var _=s[m];_!=i&&g.push(_)}return g}return{set:h,maybeSet:c,get:p,keys:d}}function Bi(t,e){return t[0]===e[0]&&t[1]===e[1]}var Fc=new ArrayBuffer(16),kc=new Float64Array(Fc),ca=new Uint32Array(Fc);function Cu(t){kc[0]=t[0],kc[1]=t[1];var e=ca[0]^ca[1];return 2147483647&(e=e<<5^e>>7^ca[2]^ca[3])}function Bg(t){var e,n,r,i,o=t.coordinates,s=t.lines,a=t.rings,u=function(){for(var C=Su(1.4*o.length,x,b,Int32Array,-1,Int32Array),D=new Int32Array(o.length),M=0,B=o.length;M<B;++M)D[M]=C.maybeSet(M,M);return D}(),l=new Int32Array(o.length),h=new Int32Array(o.length),c=new Int32Array(o.length),p=new Int8Array(o.length),d=0;for(e=0,n=o.length;e<n;++e)l[e]=h[e]=c[e]=-1;for(e=0,n=s.length;e<n;++e){var g=s[e],m=g[0],f=g[1];for(r=u[m],i=u[++m],++d,p[r]=1;++m<=f;)v(e,r,r=i,i=u[m]);++d,p[i]=1}for(e=0,n=o.length;e<n;++e)l[e]=-1;for(e=0,n=a.length;e<n;++e){var _=a[e],I=_[0]+1,y=_[1];for(v(e,u[y-1],r=u[I-1],i=u[I]);++I<=y;)v(e,r,r=i,i=u[I])}function v(C,D,M,B){if(l[M]!==C){l[M]=C;var O=h[M];if(O>=0){var R=c[M];O===D&&R===B||O===B&&R===D||(++d,p[M]=1)}else h[M]=D,c[M]=B}}function x(C){return Cu(o[C])}function b(C,D){return Bi(o[C],o[D])}l=h=c=null;var E,T=function(C,D,M,B,O){arguments.length===3&&(B=Array,O=null);for(var R=new B(C=1<<Math.max(4,Math.ceil(Math.log(C)/Math.LN2))),P=C-1,F=0;F<C;++F)R[F]=O;function k(V){for(var j=D(V)&P,tt=R[j],at=0;tt!=O;){if(M(tt,V))return!0;if(++at>=C)throw new Error("full hashset");tt=R[j=j+1&P]}return R[j]=V,!0}function q(V){for(var j=D(V)&P,tt=R[j],at=0;tt!=O;){if(M(tt,V))return!0;if(++at>=C)break;tt=R[j=j+1&P]}return!1}function S(){for(var V=[],j=0,tt=R.length;j<tt;++j){var at=R[j];at!=O&&V.push(at)}return V}return{add:k,has:q,values:S}}(1.4*d,Cu,Bi);for(e=0,n=o.length;e<n;++e)p[E=u[e]]&&T.add(o[E]);return T}function zg(t,e,n,r){Nu(t,e,n),Nu(t,e,e+r),Nu(t,e+r,n)}function Nu(t,e,n){for(var r,i=e+(n---e>>1);e<i;++e,--n)r=t[e],t[e]=t[n],t[n]=r}function jg(t){var e,n,r={};for(e in t)r[e]=(n=t[e])==null?{type:null}:(n.type==="FeatureCollection"?Ug:n.type==="Feature"?Gc:Pu)(n);return r}function Ug(t){var e={type:"GeometryCollection",geometries:t.features.map(Gc)};return t.bbox!=null&&(e.bbox=t.bbox),e}function Gc(t){var e,n=Pu(t.geometry);for(e in t.id!=null&&(n.id=t.id),t.bbox!=null&&(n.bbox=t.bbox),t.properties){n.properties=t.properties;break}return n}function Pu(t){if(t==null)return{type:null};var e=t.type==="GeometryCollection"?{type:"GeometryCollection",geometries:t.geometries.map(Pu)}:t.type==="Point"||t.type==="MultiPoint"?{type:t.type,coordinates:t.coordinates}:{type:t.type,arcs:t.coordinates};return t.bbox!=null&&(e.bbox=t.bbox),e}function Vg(t,e){var n=function(p){var d=1/0,g=1/0,m=-1/0,f=-1/0;function _(E){E!=null&&la.call(I,E.type)&&I[E.type](E)}var I={GeometryCollection:function(E){E.geometries.forEach(_)},Point:function(E){y(E.coordinates)},MultiPoint:function(E){E.coordinates.forEach(y)},LineString:function(E){v(E.arcs)},MultiLineString:function(E){E.arcs.forEach(v)},Polygon:function(E){E.arcs.forEach(v)},MultiPolygon:function(E){E.arcs.forEach(x)}};function y(E){var T=E[0],C=E[1];T<d&&(d=T),T>m&&(m=T),C<g&&(g=C),C>f&&(f=C)}function v(E){E.forEach(y)}function x(E){E.forEach(v)}for(var b in p)_(p[b]);return m>=d&&f>=g?[d,g,m,f]:void 0}(t=jg(t)),r=e>0&&n&&function(p,d,g){var m=d[0],f=d[1],_=d[2],I=d[3],y=_-m?(g-1)/(_-m):1,v=I-f?(g-1)/(I-f):1;function x(O){return[Math.round((O[0]-m)*y),Math.round((O[1]-f)*v)]}function b(O,R){for(var P,F,k,q,S,V=-1,j=0,tt=O.length,at=new Array(tt);++V<tt;)P=O[V],q=Math.round((P[0]-m)*y),S=Math.round((P[1]-f)*v),q===F&&S===k||(at[j++]=[F=q,k=S]);for(at.length=j;j<R;)j=at.push([at[0][0],at[0][1]]);return at}function E(O){return b(O,2)}function T(O){return b(O,4)}function C(O){return O.map(T)}function D(O){O!=null&&la.call(M,O.type)&&M[O.type](O)}var M={GeometryCollection:function(O){O.geometries.forEach(D)},Point:function(O){O.coordinates=x(O.coordinates)},MultiPoint:function(O){O.coordinates=O.coordinates.map(x)},LineString:function(O){O.arcs=E(O.arcs)},MultiLineString:function(O){O.arcs=O.arcs.map(E)},Polygon:function(O){O.arcs=C(O.arcs)},MultiPolygon:function(O){O.arcs=O.arcs.map(C)}};for(var B in p)D(p[B]);return{scale:[1/y,1/v],translate:[m,f]}}(t,n,e),i=function(p){var d,g,m,f,_=p.coordinates,I=p.lines,y=p.rings,v=I.length+y.length;for(delete p.lines,delete p.rings,m=0,f=I.length;m<f;++m)for(d=I[m];d=d.next;)++v;for(m=0,f=y.length;m<f;++m)for(g=y[m];g=g.next;)++v;var x=Su(2*v*1.4,Cu,Bi),b=p.arcs=[];for(m=0,f=I.length;m<f;++m){d=I[m];do E(d);while(d=d.next)}for(m=0,f=y.length;m<f;++m)if((g=y[m]).next)do E(g);while(g=g.next);else T(g);function E(R){var P,F,k,q,S,V,j,tt;if(k=x.get(P=_[R[0]])){for(j=0,tt=k.length;j<tt;++j)if(C(q=k[j],R))return R[0]=q[0],void(R[1]=q[1])}if(S=x.get(F=_[R[1]])){for(j=0,tt=S.length;j<tt;++j)if(D(V=S[j],R))return R[1]=V[0],void(R[0]=V[1])}k?k.push(R):x.set(P,[R]),S?S.push(R):x.set(F,[R]),b.push(R)}function T(R){var P,F,k,q,S;if(F=x.get(_[R[0]]))for(q=0,S=F.length;q<S;++q){if(M(k=F[q],R))return R[0]=k[0],void(R[1]=k[1]);if(B(k,R))return R[0]=k[1],void(R[1]=k[0])}if(F=x.get(P=_[R[0]+O(R)]))for(q=0,S=F.length;q<S;++q){if(M(k=F[q],R))return R[0]=k[0],void(R[1]=k[1]);if(B(k,R))return R[0]=k[1],void(R[1]=k[0])}F?F.push(R):x.set(P,[R]),b.push(R)}function C(R,P){var F=R[0],k=P[0],q=R[1];if(F-q!=k-P[1])return!1;for(;F<=q;++F,++k)if(!Bi(_[F],_[k]))return!1;return!0}function D(R,P){var F=R[0],k=P[0],q=R[1],S=P[1];if(F-q!=k-S)return!1;for(;F<=q;++F,--S)if(!Bi(_[F],_[S]))return!1;return!0}function M(R,P){var F=R[0],k=P[0],q=R[1]-F;if(q!==P[1]-k)return!1;for(var S=O(R),V=O(P),j=0;j<q;++j)if(!Bi(_[F+(j+S)%q],_[k+(j+V)%q]))return!1;return!0}function B(R,P){var F=R[0],k=P[0],q=R[1],S=P[1],V=q-F;if(V!==S-k)return!1;for(var j=O(R),tt=V-O(P),at=0;at<V;++at)if(!Bi(_[F+(at+j)%V],_[S-(at+tt)%V]))return!1;return!0}function O(R){for(var P=R[0],F=R[1],k=P,q=k,S=_[k];++k<F;){var V=_[k];(V[0]<S[0]||V[0]===S[0]&&V[1]<S[1])&&(q=k,S=V)}return q-P}return p}(function(p){var d,g,m,f=Bg(p),_=p.coordinates,I=p.lines,y=p.rings;for(g=0,m=I.length;g<m;++g)for(var v=I[g],x=v[0],b=v[1];++x<b;)f.has(_[x])&&(d={0:x,1:v[1]},v[1]=x,v=v.next=d);for(g=0,m=y.length;g<m;++g)for(var E=y[g],T=E[0],C=T,D=E[1],M=f.has(_[T]);++C<D;)f.has(_[C])&&(M?(d={0:C,1:E[1]},E[1]=C,E=E.next=d):(zg(_,T,D,D-C),_[D]=_[T],M=!0,C=T));return p}(function(p){var d=-1,g=[],m=[],f=[];function _(E){E&&la.call(I,E.type)&&I[E.type](E)}var I={GeometryCollection:function(E){E.geometries.forEach(_)},LineString:function(E){E.arcs=y(E.arcs)},MultiLineString:function(E){E.arcs=E.arcs.map(y)},Polygon:function(E){E.arcs=E.arcs.map(v)},MultiPolygon:function(E){E.arcs=E.arcs.map(x)}};function y(E){for(var T=0,C=E.length;T<C;++T)f[++d]=E[T];var D={0:d-C+1,1:d};return g.push(D),D}function v(E){for(var T=0,C=E.length;T<C;++T)f[++d]=E[T];var D={0:d-C+1,1:d};return m.push(D),D}function x(E){return E.map(v)}for(var b in p)_(p[b]);return{type:"Topology",coordinates:f,lines:g,rings:m,objects:p}}(t))),o=i.coordinates,s=Su(1.4*i.arcs.length,Xg,Yg);function a(p){p&&la.call(u,p.type)&&u[p.type](p)}t=i.objects,i.bbox=n,i.arcs=i.arcs.map(function(p,d){return s.set(p,d),o.slice(p[0],p[1]+1)}),delete i.coordinates,o=null;var u={GeometryCollection:function(p){p.geometries.forEach(a)},LineString:function(p){p.arcs=l(p.arcs)},MultiLineString:function(p){p.arcs=p.arcs.map(l)},Polygon:function(p){p.arcs=p.arcs.map(l)},MultiPolygon:function(p){p.arcs=p.arcs.map(h)}};function l(p){var d=[];do{var g=s.get(p);d.push(p[0]<p[1]?g:~g)}while(p=p.next);return d}function h(p){return p.map(l)}for(var c in t)a(t[c]);return r&&(i.transform=r,i.arcs=function(p){for(var d=-1,g=p.length;++d<g;){for(var m,f,_=p[d],I=0,y=1,v=_.length,x=_[0],b=x[0],E=x[1];++I<v;)m=(x=_[I])[0],f=x[1],m===b&&f===E||(_[y++]=[m-b,f-E],b=m,E=f);y===1&&(_[y++]=[0,0]),_.length=y}return p}(i.arcs)),i}function Xg(t){var e,n=t[0],r=t[1];return r<n&&(e=n,n=r,r=e),n+31*r}function Yg(t,e){var n,r=t[0],i=t[1],o=e[0],s=e[1];return i<r&&(n=r,r=i,i=n),s<o&&(n=o,o=s,s=n),r===o&&i===s}function Hg(t,e){if(e===void 0&&(e={}),wn(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");e.mutate!==!1&&e.mutate!==void 0||(t=Ye(t));var n=[];Ee(t,function(i){n.push(i.geometry)});var r=Vg({geoms:au(n).geometry});return function(i){return Dc(i,qg.apply(this,arguments))}(r,r.objects.geoms.geometries)}function Wg(t,e){if(e===void 0&&(e={}),!Qt(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if(wn(t)!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");n!==!1&&n!==void 0||(t=Ye(t));var r=function(o){var s={};Ee(o,function(u){s[u.geometry.type]=!0});var a=Object.keys(s);return a.length===1?a[0]:null}(t);if(!r)throw new Error("geojson must be homogenous");var i=t;switch(r){case"LineString":return Fg(i,e);case"Polygon":return Hg(i,e);default:throw new Error(r+" is not supported")}}function zi(t,e){e===void 0&&(e={});var n=typeof e=="object"?e.mutate:e;if(!t)throw new Error("geojson is required");var r=wn(t),i=[];switch(r){case"LineString":i=Mu(t);break;case"MultiLineString":case"Polygon":it(t).forEach(function(s){i.push(Mu(s))});break;case"MultiPolygon":it(t).forEach(function(s){var a=[];s.forEach(function(u){a.push(Mu(u))}),i.push(a)});break;case"Point":return t;case"MultiPoint":var o={};it(t).forEach(function(s){var a=s.join("-");o.hasOwnProperty(a)||(i.push(s),o[a]=!0)});break;default:throw new Error(r+" geometry not supported")}return t.coordinates?n===!0?(t.coordinates=i,t):{type:r,coordinates:i}:n===!0?(t.geometry.coordinates=i,t):Te({type:r,coordinates:i},t.properties,{bbox:t.bbox,id:t.id})}function Mu(t){var e=it(t);if(e.length===2&&!qc(e[0],e[1]))return e;var n=[],r=e.length-1,i=n.length;n.push(e[0]);for(var o=1;o<r;o++){var s=n[n.length-1];e[o][0]===s[0]&&e[o][1]===s[1]||(n.push(e[o]),(i=n.length)>2&&Bc(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1))}if(n.push(e[e.length-1]),i=n.length,qc(e[0],e[e.length-1])&&i<4)throw new Error("invalid polygon");return Bc(n[i-3],n[i-1],n[i-2])&&n.splice(n.length-2,1),n}function qc(t,e){return t[0]===e[0]&&t[1]===e[1]}function Bc(t,e,n){var r=n[0],i=n[1],o=t[0],s=t[1],a=e[0],u=e[1],l=a-o,h=u-s;return(r-o)*h-(i-s)*l===0&&(Math.abs(l)>=Math.abs(h)?l>0?o<=r&&r<=a:a<=r&&r<=o:h>0?s<=i&&i<=u:u<=i&&i<=s)}function Jg(t,e,n){var r=e.x,i=e.y,o=n.x-r,s=n.y-i;if(o!==0||s!==0){var a=((t.x-r)*o+(t.y-i)*s)/(o*o+s*s);a>1?(r=n.x,i=n.y):a>0&&(r+=o*a,i+=s*a)}return(o=t.x-r)*o+(s=t.y-i)*s}function Lu(t,e,n,r,i){for(var o,s=r,a=e+1;a<n;a++){var u=Jg(t[a],t[e],t[n]);u>s&&(o=a,s=u)}s>r&&(o-e>1&&Lu(t,e,o,r,i),i.push(t[o]),n-o>1&&Lu(t,o,n,r,i))}function Zg(t,e){var n=t.length-1,r=[t[0]];return Lu(t,0,n,e,r),r.push(t[n]),r}function Ou(t,e,n){if(t.length<=2)return t;var r=e!==void 0?e*e:1;return t=Zg(t=n?t:function(i,o){for(var s,a,u,l,h,c=i[0],p=[c],d=1,g=i.length;d<g;d++)s=i[d],u=c,l=void 0,h=void 0,l=(a=s).x-u.x,h=a.y-u.y,l*l+h*h>o&&(p.push(s),c=s);return c!==s&&p.push(s),p}(t,r),r)}function zc(t,e,n){return Ou(t.map(function(r){return{x:r[0],y:r[1],z:r[2]}}),e,n).map(function(r){return r.z?[r.x,r.y,r.z]:[r.x,r.y]})}function jc(t,e,n){return t.map(function(r){var i=r.map(function(s){return{x:s[0],y:s[1]}});if(i.length<4)throw new Error("invalid polygon");for(var o=Ou(i,e,n).map(function(s){return[s.x,s.y]});!Kg(o);)o=Ou(i,e-=.01*e,n).map(function(s){return[s.x,s.y]});return o[o.length-1][0]===o[0][0]&&o[o.length-1][1]===o[0][1]||o.push(o[0]),o})}function Kg(t){return!(t.length<3)&&!(t.length===3&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}var Qg=function(){function t(e){this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var n=0;n<this.length;n++)this.points[n].z=this.points[n].z||0;for(n=0;n<this.length-1;n++){var r=this.points[n],i=this.points[n+1];this.centers.push({x:(r.x+i.x)/2,y:(r.y+i.y)/2,z:(r.z+i.z)/2})}for(this.controls.push([this.points[0],this.points[0]]),n=0;n<this.centers.length-1;n++){var o=this.points[n+1].x-(this.centers[n].x+this.centers[n+1].x)/2,s=this.points[n+1].y-(this.centers[n].y+this.centers[n+1].y)/2,a=this.points[n+1].z-(this.centers[n].y+this.centers[n+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[n+1].x+this.sharpness*(this.centers[n].x+o),y:(1-this.sharpness)*this.points[n+1].y+this.sharpness*(this.centers[n].y+s),z:(1-this.sharpness)*this.points[n+1].z+this.sharpness*(this.centers[n].z+a)},{x:(1-this.sharpness)*this.points[n+1].x+this.sharpness*(this.centers[n+1].x+o),y:(1-this.sharpness)*this.points[n+1].y+this.sharpness*(this.centers[n+1].y+s),z:(1-this.sharpness)*this.points[n+1].z+this.sharpness*(this.centers[n+1].z+a)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return t.prototype.cacheSteps=function(e){var n=[],r=this.pos(0);n.push(0);for(var i=0;i<this.duration;i+=10){var o=this.pos(i);Math.sqrt((o.x-r.x)*(o.x-r.x)+(o.y-r.y)*(o.y-r.y)+(o.z-r.z)*(o.z-r.z))>e&&(n.push(i),r=o)}return n},t.prototype.vector=function(e){var n=this.pos(e+10),r=this.pos(e-10);return{angle:180*Math.atan2(n.y-r.y,n.x-r.x)/3.14,speed:Math.sqrt((r.x-n.x)*(r.x-n.x)+(r.y-n.y)*(r.y-n.y)+(r.z-n.z)*(r.z-n.z))}},t.prototype.pos=function(e){var n=e-this.delay;n<0&&(n=0),n>this.duration&&(n=this.duration-1);var r=n/this.duration;if(r>=1)return this.points[this.length-1];var i=Math.floor((this.points.length-1)*r);return function(o,s,a,u,l){var h=function(c){var p=c*c;return[p*c,3*p*(1-c),3*c*(1-c)*(1-c),(1-c)*(1-c)*(1-c)]}(o);return{x:l.x*h[0]+u.x*h[1]+a.x*h[2]+s.x*h[3],y:l.y*h[0]+u.y*h[1]+a.y*h[2]+s.y*h[3],z:l.z*h[0]+u.z*h[1]+a.z*h[2]+s.z*h[3]}}((this.length-1)*r-i,this.points[i],this.controls[i][1],this.controls[i+1][0],this.points[i+1])},t}();function Uc(t,e){e===void 0&&(e={});for(var n=e.resolution||1e4,r=e.sharpness||.85,i=[],o=ae(t).coordinates.map(function(l){return{x:l[0],y:l[1]}}),s=new Qg({duration:n,points:o,sharpness:r}),a=function(l){var h=s.pos(l);Math.floor(l/100)%2==0&&i.push([h.x,h.y])},u=0;u<s.duration;u+=10)a(u);return a(s.duration),Wt(i,e.properties)}function Ru(t,e){e===void 0&&(e={});var n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(t.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[n,r];return ct([[s,[i,r],[i,o],[n,o],s]],e.properties,{bbox:t,id:e.id})}function Vc(t){return Ru(ye(t))}function Xc(t){var e=t[0],n=t[1],r=t[2],i=t[3];if($t(t.slice(0,2),[r,n])>=$t(t.slice(0,2),[e,i])){var o=(n+i)/2;return[e,o-(r-e)/2,r,o+(r-e)/2]}var s=(e+r)/2;return[s-(i-n)/2,n,s+(i-n)/2,i]}function Fr(t,e,n,r){r===void 0&&(r={});var i=re(t),o=ke(i[0]),s=ke(i[1]),a=ke(n),u=ki(e,r.units),l=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(a));return ft([mi(o+Math.atan2(Math.sin(a)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(l))),mi(l)],r.properties)}function Tu(t,e,n){n===void 0&&(n={});for(var r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&t.type==="Feature"&&t.properties?t.properties:{},o=[],s=0;s<r;s++)o.push(Fr(t,e,-360*s/r,n).geometry.coordinates);return o.push(o[0]),ct([o],i)}function ni(t,e,n){if(n===void 0&&(n={}),n.final===!0)return function(c,p){var d=ni(p,c);return d=(d+180)%360}(t,e);var r=re(t),i=re(e),o=ke(r[0]),s=ke(i[0]),a=ke(r[1]),u=ke(i[1]),l=Math.sin(s-o)*Math.cos(u),h=Math.cos(a)*Math.sin(u)-Math.sin(a)*Math.cos(u)*Math.cos(s-o);return mi(Math.atan2(l,h))}function ha(t,e){e===void 0&&(e={});var n=ye(t);return ft([(n[0]+n[2])/2,(n[1]+n[3])/2],e.properties,e)}function _i(t,e){e===void 0&&(e={});var n=0,r=0,i=0;return Ce(t,function(o){n+=o[0],r+=o[1],i++},!0),ft([n/i,r/i],e.properties)}function pa(t){var e=[];return t.type==="FeatureCollection"?Zt(t,function(n){Ce(n,function(r){e.push(ft(r,n.properties))})}):Ce(t,function(n){e.push(ft(n,t.properties))}),nt(e)}var Yc=fa,$g=fa;function fa(t,e,n){n=n||2;var r,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*n:t.length,p=Hc(t,0,c,n,!0),d=[];if(!p)return d;if(h&&(p=function(m,f,_,I){var y,v,x,b=[];for(y=0,v=f.length;y<v;y++)(x=Hc(m,f[y]*I,y<v-1?f[y+1]*I:m.length,I,!1))===x.next&&(x.steiner=!0),b.push(sd(x));for(b.sort(id),y=0;y<b.length;y++)od(b[y],_),_=ss(_,_.next);return _}(t,e,p,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var g=n;g<c;g+=n)(a=t[g])<r&&(r=a),(u=t[g+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=(l=Math.max(o-r,s-i))!==0?1/l:0}return as(p,d,n,r,i,l),d}function Hc(t,e,n,r,i){var o,s;if(i===Fu(t,e,n,r)>0)for(o=e;o<n;o+=r)s=Zc(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=Zc(o,t[o],t[o+1],s);return s&&ji(s,s.next)&&(ls(s),s=s.next),s}function ss(t,e){if(!t)return t;e||(e=t);var n,r=t;do if(n=!1,r.steiner||!ji(r,r.next)&&ln(r.prev,r,r.next)!==0)r=r.next;else{if(ls(r),(r=e=r.prev)===r.next)break;n=!0}while(n||r!==e);return e}function as(t,e,n,r,i,o,s){if(t){!s&&o&&function(h,c,p,d){var g=h;do g.z===null&&(g.z=Au(g.x,g.y,c,p,d)),g.prevZ=g.prev,g.nextZ=g.next,g=g.next;while(g!==h);g.prevZ.nextZ=null,g.prevZ=null,function(m){var f,_,I,y,v,x,b,E,T=1;do{for(_=m,m=null,v=null,x=0;_;){for(x++,I=_,b=0,f=0;f<T&&(b++,I=I.nextZ);f++);for(E=T;b>0||E>0&&I;)b!==0&&(E===0||!I||_.z<=I.z)?(y=_,_=_.nextZ,b--):(y=I,I=I.nextZ,E--),v?v.nextZ=y:m=y,y.prevZ=v,v=y;_=I}v.nextZ=null,T*=2}while(x>1)}(g)}(t,r,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?ed(t,r,i,o):td(t))e.push(a.i/n),e.push(t.i/n),e.push(u.i/n),ls(t),t=u.next,l=u.next;else if((t=u)===l){s?s===1?as(t=nd(t,e,n),e,n,r,i,o,2):s===2&&rd(t,e,n,r,i,o):as(ss(t),e,n,r,i,o,1);break}}}function td(t){var e=t.prev,n=t,r=t.next;if(ln(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(fo(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&ln(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function ed(t,e,n,r){var i=t.prev,o=t,s=t.next;if(ln(i,o,s)>=0)return!1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,u=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,l=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,c=Au(a,u,e,n,r),p=Au(l,h,e,n,r),d=t.prevZ,g=t.nextZ;d&&d.z>=c&&g&&g.z<=p;){if(d!==t.prev&&d!==t.next&&fo(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&ln(d.prev,d,d.next)>=0||(d=d.prevZ,g!==t.prev&&g!==t.next&&fo(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&ln(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;d&&d.z>=c;){if(d!==t.prev&&d!==t.next&&fo(i.x,i.y,o.x,o.y,s.x,s.y,d.x,d.y)&&ln(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;g&&g.z<=p;){if(g!==t.prev&&g!==t.next&&fo(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&ln(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function nd(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!ji(i,o)&&Wc(i,r,r.next,o)&&us(i,o)&&us(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),ls(r),ls(r.next),r=t=o),r=r.next}while(r!==t);return r}function rd(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ad(s,a)){var u=Jc(s,a);return s=ss(s,s.next),u=ss(u,u.next),as(s,e,n,r,i,o),void as(u,e,n,r,i,o)}a=a.next}s=s.next}while(s!==t)}function id(t,e){return t.x-e.x}function od(t,e){if(e=function(r,i){var o,s=i,a=r.x,u=r.y,l=-1/0;do{if(u<=s.y&&u>=s.next.y&&s.next.y!==s.y){var h=s.x+(u-s.y)*(s.next.x-s.x)/(s.next.y-s.y);if(h<=a&&h>l){if(l=h,h===a){if(u===s.y)return s;if(u===s.next.y)return s.next}o=s.x<s.next.x?s:s.next}}s=s.next}while(s!==i);if(!o)return null;if(a===l)return o.prev;var c,p=o,d=o.x,g=o.y,m=1/0;for(s=o.next;s!==p;)a>=s.x&&s.x>=d&&a!==s.x&&fo(u<g?a:l,u,d,g,u<g?l:a,u,s.x,s.y)&&((c=Math.abs(u-s.y)/(a-s.x))<m||c===m&&s.x>o.x)&&us(s,r)&&(o=s,m=c),s=s.next;return o}(t,e)){var n=Jc(e,t);ss(n,n.next)}}function Au(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function sd(t){var e=t,n=t;do e.x<n.x&&(n=e),e=e.next;while(e!==t);return n}function fo(t,e,n,r,i,o,s,a){return(i-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(r-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function ad(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(n,r){var i=n;do{if(i.i!==n.i&&i.next.i!==n.i&&i.i!==r.i&&i.next.i!==r.i&&Wc(i,i.next,n,r))return!0;i=i.next}while(i!==n);return!1}(t,e)&&us(t,e)&&us(e,t)&&function(n,r){var i=n,o=!1,s=(n.x+r.x)/2,a=(n.y+r.y)/2;do i.y>a!=i.next.y>a&&i.next.y!==i.y&&s<(i.next.x-i.x)*(a-i.y)/(i.next.y-i.y)+i.x&&(o=!o),i=i.next;while(i!==n);return o}(t,e)}function ln(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function ji(t,e){return t.x===e.x&&t.y===e.y}function Wc(t,e,n,r){return!!(ji(t,e)&&ji(n,r)||ji(t,r)&&ji(n,e))||ln(t,e,n)>0!=ln(t,e,r)>0&&ln(n,r,t)>0!=ln(n,r,e)>0}function us(t,e){return ln(t.prev,t,t.next)<0?ln(t,e,t.next)>=0&&ln(t,t.prev,e)>=0:ln(t,e,t.prev)<0||ln(t,t.next,e)<0}function Jc(t,e){var n=new Du(t.i,t.x,t.y),r=new Du(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Zc(t,e,n,r){var i=new Du(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function ls(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Du(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Fu(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}function Kc(t){var e=function(a){for(var u=a[0][0].length,l={vertices:[],holes:[],dimensions:u},h=0,c=0;c<a.length;c++){for(var p=0;p<a[c].length;p++)for(var d=0;d<u;d++)l.vertices.push(a[c][p][d]);c>0&&(h+=a[c-1].length,l.holes.push(h))}return l}(t),n=Yc(e.vertices,e.holes,2),r=[],i=[];n.forEach(function(a,u){var l=n[u];i.push([e.vertices[2*l],e.vertices[2*l+1]])});for(var o=0;o<i.length;o+=3){var s=i.slice(o,o+3);s.push(i[o]),r.push(ct([s]))}return r}function ga(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var n,r=1/0,i=0;return Zt(e,function(o,s){var a=$t(t,o);a<r&&(i=s,r=a)}),(n=Ye(e.features[i])).properties.featureIndex=i,n.properties.distanceToPoint=r,n}function Ui(t){if(!t)throw new Error("geojson is required");var e=[];return Ee(t,function(n){(function(r,i){var o=[],s=r.geometry;if(s!==null){switch(s.type){case"Polygon":o=it(s);break;case"LineString":o=[it(s)]}o.forEach(function(a){(function(u,l){var h=[];return u.reduce(function(c,p){var d=Wt([c,p],l);return d.bbox=function(g,m){var f=g[0],_=g[1],I=m[0],y=m[1];return[f<I?f:I,_<y?_:y,f>I?f:I,_>y?_:y]}(c,p),h.push(d),p}),h})(a,r.properties).forEach(function(u){u.id=i.length,i.push(u)})})}})(n,e)}),nt(e)}fa.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Fu(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,h=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Fu(t,l,h,n))}var c=0;for(a=0;a<r.length;a+=3){var p=r[a]*n,d=r[a+1]*n,g=r[a+2]*n;c+=Math.abs((t[p]-t[g])*(t[d+1]-t[p+1])-(t[p]-t[d])*(t[g+1]-t[p+1]))}return s===0&&c===0?0:Math.abs((c-s)/s)},fa.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n},Yc.default=$g;var Ke=Dr(function(t,e){function n(g,m,f){f===void 0&&(f={});var _={type:"Feature"};return(f.id===0||f.id)&&(_.id=f.id),f.bbox&&(_.bbox=f.bbox),_.properties=m||{},_.geometry=g,_}function r(g,m,f){if(f===void 0&&(f={}),!g)throw new Error("coordinates is required");if(!Array.isArray(g))throw new Error("coordinates must be an Array");if(g.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!d(g[0])||!d(g[1]))throw new Error("coordinates must contain numbers");return n({type:"Point",coordinates:g},m,f)}function i(g,m,f){f===void 0&&(f={});for(var _=0,I=g;_<I.length;_++){var y=I[_];if(y.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var v=0;v<y[y.length-1].length;v++)if(y[y.length-1][v]!==y[0][v])throw new Error("First and last Position are not equivalent.")}return n({type:"Polygon",coordinates:g},m,f)}function o(g,m,f){if(f===void 0&&(f={}),g.length<2)throw new Error("coordinates must be an array of two or more positions");return n({type:"LineString",coordinates:g},m,f)}function s(g,m){m===void 0&&(m={});var f={type:"FeatureCollection"};return m.id&&(f.id=m.id),m.bbox&&(f.bbox=m.bbox),f.features=g,f}function a(g,m,f){return f===void 0&&(f={}),n({type:"MultiLineString",coordinates:g},m,f)}function u(g,m,f){return f===void 0&&(f={}),n({type:"MultiPoint",coordinates:g},m,f)}function l(g,m,f){return f===void 0&&(f={}),n({type:"MultiPolygon",coordinates:g},m,f)}function h(g,m){m===void 0&&(m="kilometers");var f=e.factors[m];if(!f)throw new Error(m+" units is invalid");return g*f}function c(g,m){m===void 0&&(m="kilometers");var f=e.factors[m];if(!f)throw new Error(m+" units is invalid");return g/f}function p(g){return 180*(g%(2*Math.PI))/Math.PI}function d(g){return!isNaN(g)&&g!==null&&!Array.isArray(g)}Object.defineProperty(e,"__esModule",{value:!0}),e.earthRadius=63710088e-1,e.factors={centimeters:100*e.earthRadius,centimetres:100*e.earthRadius,degrees:e.earthRadius/111325,feet:3.28084*e.earthRadius,inches:39.37*e.earthRadius,kilometers:e.earthRadius/1e3,kilometres:e.earthRadius/1e3,meters:e.earthRadius,metres:e.earthRadius,miles:e.earthRadius/1609.344,millimeters:1e3*e.earthRadius,millimetres:1e3*e.earthRadius,nauticalmiles:e.earthRadius/1852,radians:1,yards:1.0936*e.earthRadius},e.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:.001,kilometres:.001,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/e.earthRadius,yards:1.0936133},e.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046},e.feature=n,e.geometry=function(g,m,f){switch(g){case"Point":return r(m).geometry;case"LineString":return o(m).geometry;case"Polygon":return i(m).geometry;case"MultiPoint":return u(m).geometry;case"MultiLineString":return a(m).geometry;case"MultiPolygon":return l(m).geometry;default:throw new Error(g+" is invalid")}},e.point=r,e.points=function(g,m,f){return f===void 0&&(f={}),s(g.map(function(_){return r(_,m)}),f)},e.polygon=i,e.polygons=function(g,m,f){return f===void 0&&(f={}),s(g.map(function(_){return i(_,m)}),f)},e.lineString=o,e.lineStrings=function(g,m,f){return f===void 0&&(f={}),s(g.map(function(_){return o(_,m)}),f)},e.featureCollection=s,e.multiLineString=a,e.multiPoint=u,e.multiPolygon=l,e.geometryCollection=function(g,m,f){return f===void 0&&(f={}),n({type:"GeometryCollection",geometries:g},m,f)},e.round=function(g,m){if(m===void 0&&(m=0),m&&!(m>=0))throw new Error("precision must be a positive number");var f=Math.pow(10,m||0);return Math.round(g*f)/f},e.radiansToLength=h,e.lengthToRadians=c,e.lengthToDegrees=function(g,m){return p(c(g,m))},e.bearingToAzimuth=function(g){var m=g%360;return m<0&&(m+=360),m},e.radiansToDegrees=p,e.degreesToRadians=function(g){return g%360*Math.PI/180},e.convertLength=function(g,m,f){if(m===void 0&&(m="kilometers"),f===void 0&&(f="kilometers"),!(g>=0))throw new Error("length must be a positive number");return h(c(g,m),f)},e.convertArea=function(g,m,f){if(m===void 0&&(m="meters"),f===void 0&&(f="kilometers"),!(g>=0))throw new Error("area must be a positive number");var _=e.areaFactors[m];if(!_)throw new Error("invalid original units");var I=e.areaFactors[f];if(!I)throw new Error("invalid final units");return g/_*I},e.isNumber=d,e.isObject=function(g){return!!g&&g.constructor===Object},e.validateBBox=function(g){if(!g)throw new Error("bbox is required");if(!Array.isArray(g))throw new Error("bbox must be an Array");if(g.length!==4&&g.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");g.forEach(function(m){if(!d(m))throw new Error("bbox must only contain numbers")})},e.validateId=function(g){if(!g)throw new Error("id is required");if(["string","number"].indexOf(typeof g)===-1)throw new Error("id must be a number or a string")}});function cs(t,e,n){if(t!==null)for(var r,i,o,s,a,u,l,h,c=0,p=0,d=t.type,g=d==="FeatureCollection",m=d==="Feature",f=g?t.features.length:1,_=0;_<f;_++){a=(h=!!(l=g?t.features[_].geometry:m?t.geometry:t)&&l.type==="GeometryCollection")?l.geometries.length:1;for(var I=0;I<a;I++){var y=0,v=0;if((s=h?l.geometries[I]:l)!==null){u=s.coordinates;var x=s.type;switch(c=!n||x!=="Polygon"&&x!=="MultiPolygon"?0:1,x){case null:break;case"Point":if(e(u,p,_,y,v)===!1)return!1;p++,y++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(e(u[r],p,_,y,v)===!1)return!1;p++,x==="MultiPoint"&&y++}x==="LineString"&&y++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-c;i++){if(e(u[r][i],p,_,y,v)===!1)return!1;p++}x==="MultiLineString"&&y++,x==="Polygon"&&v++}x==="Polygon"&&y++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(v=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-c;o++){if(e(u[r][i][o],p,_,y,v)===!1)return!1;p++}v++}y++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(cs(s.geometries[r],e,n)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Qc(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&e(t.features[n].properties,n)!==!1;n++);break;case"Feature":e(t.properties,0)}}function $c(t,e){if(t.type==="Feature")e(t,0);else if(t.type==="FeatureCollection")for(var n=0;n<t.features.length&&e(t.features[n],n)!==!1;n++);}function ku(t,e){var n,r,i,o,s,a,u,l,h,c,p=0,d=t.type==="FeatureCollection",g=t.type==="Feature",m=d?t.features.length:1;for(n=0;n<m;n++){for(a=d?t.features[n].geometry:g?t.geometry:t,l=d?t.features[n].properties:g?t.properties:{},h=d?t.features[n].bbox:g?t.bbox:void 0,c=d?t.features[n].id:g?t.id:void 0,s=(u=!!a&&a.type==="GeometryCollection")?a.geometries.length:1,i=0;i<s;i++)if((o=u?a.geometries[i]:a)!==null)switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(e(o,p,l,h,c)===!1)return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(e(o.geometries[r],p,l,h,c)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}else if(e(null,p,l,h,c)===!1)return!1;p++}}function da(t,e){ku(t,function(n,r,i,o,s){var a,u=n===null?null:n.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return e(Ke.feature(n,i,{bbox:o,id:s}),r,0)!==!1&&void 0}switch(u){case"MultiPoint":a="Point";break;case"MultiLineString":a="LineString";break;case"MultiPolygon":a="Polygon"}for(var l=0;l<n.coordinates.length;l++){var h={type:a,coordinates:n.coordinates[l]};if(e(Ke.feature(h,i),r,l)===!1)return!1}})}function th(t,e){da(t,function(n,r,i){var o=0;if(n.geometry){var s=n.geometry.type;if(s!=="Point"&&s!=="MultiPoint"){var a,u=0,l=0,h=0;return cs(n,function(c,p,d,g,m){if(a===void 0||r>u||g>l||m>h)return a=c,u=r,l=g,h=m,void(o=0);var f=Ke.lineString([a,c],n.properties);if(e(f,r,i,m,o)===!1)return!1;o++,a=c})!==!1&&void 0}}})}function eh(t,e){if(!t)throw new Error("geojson is required");da(t,function(n,r,i){if(n.geometry!==null){var o=n.geometry.type,s=n.geometry.coordinates;switch(o){case"LineString":if(e(n,r,i,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(e(Ke.lineString(s[a],n.properties),r,i,a)===!1)return!1}}})}var ud=cs,ld=function(t,e,n,r){var i=n;return cs(t,function(o,s,a,u,l){i=s===0&&n===void 0?o:e(i,o,s,a,u,l)},r),i},cd=Qc,hd=function(t,e,n){var r=n;return Qc(t,function(i,o){r=o===0&&n===void 0?i:e(r,i,o)}),r},pd=$c,fd=function(t,e,n){var r=n;return $c(t,function(i,o){r=o===0&&n===void 0?i:e(r,i,o)}),r},gd=function(t){var e=[];return cs(t,function(n){e.push(n)}),e},dd=ku,yd=function(t,e,n){var r=n;return ku(t,function(i,o,s,a,u){r=o===0&&n===void 0?i:e(r,i,o,s,a,u)}),r},md=da,vd=function(t,e,n){var r=n;return da(t,function(i,o,s){r=o===0&&s===0&&n===void 0?i:e(r,i,o,s)}),r},_d=th,xd=function(t,e,n){var r=n,i=!1;return th(t,function(o,s,a,u,l){r=i===!1&&n===void 0?o:e(r,o,s,a,u,l),i=!0}),r},Ed=eh,bd=function(t,e,n){var r=n;return eh(t,function(i,o,s,a){r=o===0&&n===void 0?i:e(r,i,o,s,a)}),r},wd=function(t,e){if(e=e||{},!Ke.isObject(e))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(n===null)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),Ke.lineString([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),Ke.lineString([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),Ke.lineString([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),Ke.lineString([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")},Id=function(t,e){if(e=e||{},!Ke.isObject(e))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(n===null)return null;var u=n.coordinates;switch(n.type){case"Point":return Ke.point(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),Ke.point(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),Ke.point(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),Ke.point(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),Ke.point(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),Ke.point(u[i][o][s],a,e)}throw new Error("geojson is invalid")},Gu=Object.defineProperty({coordEach:ud,coordReduce:ld,propEach:cd,propReduce:hd,featureEach:pd,featureReduce:fd,coordAll:gd,geomEach:dd,geomReduce:yd,flattenEach:md,flattenReduce:vd,segmentEach:_d,segmentReduce:xd,lineEach:Ed,lineReduce:bd,findSegment:wd,findPoint:Id},"__esModule",{value:!0});function qu(t){var e=[1/0,1/0,-1/0,-1/0];return Gu.coordEach(t,function(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}qu.default=qu;var Sd=qu,go=Object.defineProperty({default:Sd},"__esModule",{value:!0}).default,Cd=Gu.featureEach,nh=(Gu.coordEach,Ke.polygon,Ke.featureCollection);function rh(t){var e=un(t);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:go(n),un.prototype.insert.call(this,n)},e.load=function(n){var r=[];return Array.isArray(n)?n.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:go(i),r.push(i)}):Cd(n,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:go(i),r.push(i)}),un.prototype.load.call(this,r)},e.remove=function(n,r){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:go(n),un.prototype.remove.call(this,n,r)},e.clear=function(){return un.prototype.clear.call(this)},e.search=function(n){var r=un.prototype.search.call(this,this.toBBox(n));return nh(r)},e.collides=function(n){return un.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=un.prototype.all.call(this);return nh(n)},e.toJSON=function(){return un.prototype.toJSON.call(this)},e.fromJSON=function(n){return un.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var r;if(n.bbox)r=n.bbox;else if(Array.isArray(n)&&n.length===4)r=n;else if(Array.isArray(n)&&n.length===6)r=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")r=go(n);else{if(n.type!=="FeatureCollection")throw new Error("invalid geojson");r=go(n)}return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}var yo=rh,Nd=rh;function kr(t,e){var n={},r=[];if(t.type==="LineString"&&(t=Te(t)),e.type==="LineString"&&(e=Te(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var i=ih(t,e);return i&&r.push(i),nt(r)}var o=yo();return o.load(Ui(e)),Zt(Ui(t),function(s){Zt(o.search(s),function(a){var u=ih(s,a);if(u){var l=it(u).join(",");n[l]||(n[l]=!0,r.push(u))}})}),nt(r)}function ih(t,e){var n=it(t),r=it(e);if(n.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(r.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var i=n[0][0],o=n[0][1],s=n[1][0],a=n[1][1],u=r[0][0],l=r[0][1],h=r[1][0],c=r[1][1],p=(c-l)*(s-i)-(h-u)*(a-o),d=(h-u)*(o-l)-(c-l)*(i-u),g=(s-i)*(o-l)-(a-o)*(i-u);if(p===0)return null;var m=d/p,f=g/p;return m>=0&&m<=1&&f>=0&&f<=1?ft([i+m*(s-i),o+m*(a-o)]):null}function ri(t,e,n){n===void 0&&(n={});var r=ft([1/0,1/0],{dist:1/0}),i=0;return Ee(t,function(o){for(var s=it(o),a=0;a<s.length-1;a++){var u=ft(s[a]);u.properties.dist=$t(e,u,n);var l=ft(s[a+1]);l.properties.dist=$t(e,l,n);var h=$t(u,l,n),c=Math.max(u.properties.dist,l.properties.dist),p=ni(u,l),d=Fr(e,c,p+90,n),g=Fr(e,c,p-90,n),m=kr(Wt([d.geometry.coordinates,g.geometry.coordinates]),Wt([u.geometry.coordinates,l.geometry.coordinates])),f=null;m.features.length>0&&((f=m.features[0]).properties.dist=$t(e,f,n),f.properties.location=i+$t(u,f,n)),u.properties.dist<r.properties.dist&&((r=u).properties.index=a,r.properties.location=i),l.properties.dist<r.properties.dist&&((r=l).properties.index=a+1,r.properties.location=i+h),f&&f.properties.dist<r.properties.dist&&((r=f).properties.index=a),i+=h}}),r}function ya(t,e,n){n===void 0&&(n={});var r=re(t),i=re(e);return i[0]+=i[0]-r[0]>180?-360:r[0]-i[0]>180?360:0,qi(function(o,s,a){var u=a=a===void 0?tr:Number(a),l=o[1]*Math.PI/180,h=s[1]*Math.PI/180,c=h-l,p=Math.abs(s[0]-o[0])*Math.PI/180;p>Math.PI&&(p-=2*Math.PI);var d=Math.log(Math.tan(h/2+Math.PI/4)/Math.tan(l/2+Math.PI/4)),g=Math.abs(d)>1e-11?c/d:Math.cos(l);return Math.sqrt(c*c+g*g*p*p)*u}(r,i),"meters",n.units)}function oh(t,e,n){if(n===void 0&&(n={}),n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=ft(t):t.type==="Point"?t=Te(t):ts(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=Wt(e):e.type==="LineString"?e=Te(e):ts(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return ei(e,function(o){var s=o.geometry.coordinates[0],a=o.geometry.coordinates[1],u=function(l,h,c,p){var d=[c[0]-h[0],c[1]-h[1]],g=sh([l[0]-h[0],l[1]-h[1]],d);if(g<=0)return Bu(l,h,{method:p.method,units:"degrees"});var m=sh(d,d);if(m<=g)return Bu(l,c,{method:p.method,units:"degrees"});var f=g/m,_=[h[0]+f*d[0],h[1]+f*d[1]];return Bu(l,_,{method:p.method,units:"degrees"})}(i,s,a,n);u<r&&(r=u)}),qi(r,"degrees",n.units)}function sh(t,e){return t[0]*e[0]+t[1]*e[1]}function Bu(t,e,n){return n.method==="planar"?ya(t,e,n):$t(t,e,n)}function Pd(t,e,n,r,i,o,s,a){var u,l,h,c,p={x:null,y:null,onLine1:!1,onLine2:!1};return(u=(a-o)*(n-t)-(s-i)*(r-e))===0?p.x!==null&&p.y!==null&&p:(c=(n-t)*(l=e-o)-(r-e)*(h=t-i),l=((s-i)*l-(a-o)*h)/u,h=c/u,p.x=t+l*(n-t),p.y=e+l*(r-e),l>=0&&l<=1&&(p.onLine1=!0),h>=0&&h<=1&&(p.onLine2=!0),!(!p.onLine1||!p.onLine2)&&[p.x,p.y])}function ah(t){for(var e=function(p){return p.type!=="FeatureCollection"?p.type!=="Feature"?nt([Te(p)]):nt([p]):p}(t),n=ha(e),r=!1,i=0;!r&&i<e.features.length;){var o,s=e.features[i].geometry,a=!1;if(s.type==="Point")n.geometry.coordinates[0]===s.coordinates[0]&&n.geometry.coordinates[1]===s.coordinates[1]&&(r=!0);else if(s.type==="MultiPoint"){var u=!1;for(o=0;!u&&o<s.coordinates.length;)n.geometry.coordinates[0]===s.coordinates[o][0]&&n.geometry.coordinates[1]===s.coordinates[o][1]&&(r=!0,u=!0),o++}else if(s.type==="LineString")for(o=0;!a&&o<s.coordinates.length-1;)uh(n.geometry.coordinates[0],n.geometry.coordinates[1],s.coordinates[o][0],s.coordinates[o][1],s.coordinates[o+1][0],s.coordinates[o+1][1])&&(a=!0,r=!0),o++;else if(s.type==="MultiLineString")for(var l=0;l<s.coordinates.length;){a=!1,o=0;for(var h=s.coordinates[l];!a&&o<h.length-1;)uh(n.geometry.coordinates[0],n.geometry.coordinates[1],h[o][0],h[o][1],h[o+1][0],h[o+1][1])&&(a=!0,r=!0),o++;l++}else s.type!=="Polygon"&&s.type!=="MultiPolygon"||le(n,s)&&(r=!0);i++}if(r)return n;var c=nt([]);for(i=0;i<e.features.length;i++)c.features=c.features.concat(pa(e.features[i]).features);return ft(ga(n,c).geometry.coordinates)}function uh(t,e,n,r,i,o){return Math.sqrt((i-n)*(i-n)+(o-r)*(o-r))===Math.sqrt((t-n)*(t-n)+(e-r)*(e-r))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}yo.default=Nd;var lh=6378137;function zu(t){return pu(t,function(e,n){return e+function(r){var i,o=0;switch(r.type){case"Polygon":return ch(r.coordinates);case"MultiPolygon":for(i=0;i<r.coordinates.length;i++)o+=ch(r.coordinates[i]);return o;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(n)},0)}function ch(t){var e=0;if(t&&t.length>0){e+=Math.abs(hh(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(hh(t[n]))}return e}function hh(t){var e,n,r,i,o,s,a=0,u=t.length;if(u>2){for(s=0;s<u;s++)s===u-2?(r=u-2,i=u-1,o=0):s===u-1?(r=u-1,i=0,o=1):(r=s,i=s+1,o=s+2),e=t[r],n=t[i],a+=(ju(t[o][0])-ju(e[0]))*Math.sin(ju(n[1]));a=a*lh*lh/2}return a}function ju(t){return t*Math.PI/180}function Uu(t,e){return e===void 0&&(e={}),fu(t,function(n,r){var i=r.geometry.coordinates;return n+$t(i[0],i[1],e)},0)}function ph(t,e,n,r){if(!Qt(r=r||{}))throw new Error("options is invalid");var i,o=[];if(t.type==="Feature")i=t.geometry.coordinates;else{if(t.type!=="LineString")throw new Error("input must be a LineString Feature or Geometry");i=t.coordinates}for(var s,a,u,l=i.length,h=0,c=0;c<i.length&&!(e>=h&&c===i.length-1);c++){if(h>e&&o.length===0){if(!(s=e-h))return o.push(i[c]),Wt(o);a=ni(i[c],i[c-1])-180,u=Fr(i[c],s,a,r),o.push(u.geometry.coordinates)}if(h>=n)return(s=n-h)?(a=ni(i[c],i[c-1])-180,u=Fr(i[c],s,a,r),o.push(u.geometry.coordinates),Wt(o)):(o.push(i[c]),Wt(o));if(h>=e&&o.push(i[c]),c===i.length-1)return Wt(o);h+=$t(i[c],i[c+1],r)}if(h<e&&i.length===l)throw new Error("Start position is beyond line");var p=i[i.length-1];return Wt([p,p])}function Rn(t,e,n){n===void 0&&(n={});for(var r=re(t),i=it(e),o=0;o<i.length-1;o++){var s=!1;if(n.ignoreEndVertices&&(o===0&&(s="start"),o===i.length-2&&(s="end"),o===0&&o+1===i.length-1&&(s="both")),Md(i[o],i[o+1],r,s,n.epsilon===void 0?null:n.epsilon))return!0}return!1}function Md(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],u=t[1],l=e[0],h=e[1],c=l-a,p=h-u,d=(n[0]-a)*p-(n[1]-u)*c;if(i!==null){if(Math.abs(d)>i)return!1}else if(d!==0)return!1;return r?r==="start"?Math.abs(c)>=Math.abs(p)?c>0?a<o&&o<=l:l<=o&&o<a:p>0?u<s&&s<=h:h<=s&&s<u:r==="end"?Math.abs(c)>=Math.abs(p)?c>0?a<=o&&o<l:l<o&&o<=a:p>0?u<=s&&s<h:h<s&&s<=u:r==="both"&&(Math.abs(c)>=Math.abs(p)?c>0?a<o&&o<l:l<o&&o<a:p>0?u<s&&s<h:h<s&&s<u):Math.abs(c)>=Math.abs(p)?c>0?a<=o&&o<=l:l<=o&&o<=a:p>0?u<=s&&s<=h:h<=s&&s<=u}function fh(t,e){var n=ae(t),r=ae(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(s,a){var u,l=!1;for(u=0;u<a.coordinates.length;u++)if(dh(a.coordinates[u],s.coordinates)){l=!0;break}return l}(n,r);case"LineString":return Rn(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return le(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return function(s,a){for(var u=0;u<s.coordinates.length;u++){for(var l=!1,h=0;h<a.coordinates.length;h++)dh(s.coordinates[u],a.coordinates[h])&&(l=!0);if(!l)return!1}return!0}(n,r);case"LineString":return function(s,a){for(var u=!1,l=0;l<s.coordinates.length;l++){if(!Rn(s.coordinates[l],a))return!1;u||(u=Rn(s.coordinates[l],a,{ignoreEndVertices:!0}))}return u}(n,r);case"Polygon":case"MultiPolygon":return function(s,a){for(var u=!0,l=!1,h=0;h<s.coordinates.length;h++){if(!(l=le(s.coordinates[1],a))){u=!1;break}l=le(s.coordinates[1],a,{ignoreBoundary:!0})}return u&&l}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(s,a){for(var u=0;u<s.coordinates.length;u++)if(!Rn(s.coordinates[u],a))return!1;return!0}(n,r);case"Polygon":case"MultiPolygon":return function(s,a){var u=ye(a),l=ye(s);if(!gh(u,l))return!1;for(var h=!1,c=0;c<s.coordinates.length-1;c++){if(!le(s.coordinates[c],a))return!1;h||(h=le(s.coordinates[c],a,{ignoreBoundary:!0})),!h&&(h=le(Ld(s.coordinates[c],s.coordinates[c+1]),a,{ignoreBoundary:!0}))}return h}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(s,a){var u=ye(s);if(!gh(ye(a),u))return!1;for(var l=0;l<s.coordinates[0].length;l++)if(!le(s.coordinates[0][l],a))return!1;return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function gh(t,e){return!(t[0]>e[0])&&!(t[2]<e[2])&&!(t[1]>e[1])&&!(t[3]<e[3])}function dh(t,e){return t[0]===e[0]&&t[1]===e[1]}function Ld(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function yh(t,e,n){n===void 0&&(n={}),n.mask&&!n.units&&(n.units="kilometers");for(var r=[],i=t[0],o=t[1],s=t[2],a=t[3],u=e/$t([i,o],[s,o],n)*(s-i),l=e/$t([i,o],[i,a],n)*(a-o),h=s-i,c=a-o,p=Math.floor(h/u),d=(c-Math.floor(c/l)*l)/2,g=i+(h-p*u)/2;g<=s;){for(var m=o+d;m<=a;){var f=ft([g,m],n.properties);n.mask?fh(f,n.mask)&&r.push(f):r.push(f),m+=l}g+=u}return nt(r)}function mh(t,e){e===void 0&&(e={});var n=e.precision,r=e.coordinates,i=e.mutate;if(n=n==null||isNaN(n)?6:n,r=r==null||isNaN(r)?3:r,!t)throw new Error("<geojson> is required");if(typeof n!="number")throw new Error("<precision> must be a number");if(typeof r!="number")throw new Error("<coordinates> must be a number");i!==!1&&i!==void 0||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return Ce(t,function(s){(function(a,u,l){a.length>l&&a.splice(l,a.length);for(var h=0;h<a.length;h++)a[h]=Math.round(a[h]*u)/u})(s,o,r)}),t}function Od(t,e,n){if(t.geometry.type!=="Polygon")throw new Error("The input feature must be a Polygon");n===void 0&&(n=1);var r=t.geometry.coordinates,i=[],o={};if(n){for(var s=[],a=0;a<r.length;a++)for(var u=0;u<r[a].length-1;u++)s.push(m(a,u));var l=un();l.load(s)}for(var h=0;h<r.length;h++)for(var c=0;c<r[h].length-1;c++)if(n)l.search(m(h,c)).forEach(function(f){var _=f.ring,I=f.edge;g(h,c,_,I)});else for(var p=0;p<r.length;p++)for(var d=0;d<r[p].length-1;d++)g(h,c,p,d);return e||(i={type:"Feature",geometry:{type:"MultiPoint",coordinates:i}}),i;function g(f,_,I,y){var v,x,b=r[f][_],E=r[f][_+1],T=r[I][y],C=r[I][y+1],D=function(O,R,P,F){if(hs(O,P)||hs(O,F)||hs(R,P)||hs(F,P))return null;var k=O[0],q=O[1],S=R[0],V=R[1],j=P[0],tt=P[1],at=F[0],Jt=F[1],se=(k-S)*(tt-Jt)-(q-V)*(j-at);return se===0?null:[((k*V-q*S)*(j-at)-(k-S)*(j*Jt-tt*at))/se,((k*V-q*S)*(tt-Jt)-(q-V)*(j*Jt-tt*at))/se]}(b,E,T,C);if(D!==null&&(v=E[0]!==b[0]?(D[0]-b[0])/(E[0]-b[0]):(D[1]-b[1])/(E[1]-b[1]),x=C[0]!==T[0]?(D[0]-T[0])/(C[0]-T[0]):(D[1]-T[1])/(C[1]-T[1]),!(v>=1||v<=0||x>=1||x<=0))){var M=D,B=!o[M];B&&(o[M]=!0),e?i.push(e(D,f,_,b,E,v,I,y,T,C,x,B)):i.push(D)}}function m(f,_){var I,y,v,x,b=r[f][_],E=r[f][_+1];return b[0]<E[0]?(I=b[0],y=E[0]):(I=E[0],y=b[0]),b[1]<E[1]?(v=b[1],x=E[1]):(v=E[1],x=b[1]),{minX:I,minY:v,maxX:y,maxY:x,ring:f,edge:_}}}function hs(t,e){if(!t||!e||t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!hs(t[n],e[n]))return!1}else if(t[n]!==e[n])return!1;return!0}var vh=function(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i},_h=function(t,e,n,r,i,o,s){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=n,this.nxtIsectAlongRingAndEdge1=r,this.nxtIsectAlongRingAndEdge2=i,this.ringAndEdge1Walkable=o,this.ringAndEdge2Walkable=s};function ma(t,e){if(e===void 0&&(e=!0),t.length!=3)throw new Error("This function requires an array of three points [x,y]");return(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])>=0==e}function Rd(t){for(var e=0,n=0;n<t.length-1;n++)t[n][0]<t[e][0]&&(e=n);if(ma([t[mo(e-1,t.length-1)],t[e],t[mo(e+1,t.length-1)]],!0))var r=1;else r=-1;return r}function ps(t,e){if(!t||!e||t.length!=e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!ps(t[n],e[n]))return!1}else if(t[n]!=e[n])return!1;return!0}function mo(t,e){return(t%e+e)%e}var xh=Math.PI/180,Eh=180/Math.PI,fs=function(t,e){this.lon=t,this.lat=e,this.x=xh*t,this.y=xh*e};fs.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},fs.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new fs(e,t)};var bh=function(){this.coords=[],this.length=0};bh.prototype.move_to=function(t){this.length++,this.coords.push(t)};var Vu=function(t){this.properties=t||{},this.geometries=[]};Vu.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;e<this.geometries.length;e++)t.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:t},type:"Feature",properties:this.properties}},Vu.prototype.wkt=function(){for(var t="",e="LINESTRING(",n=function(i){e+=i[0]+" "+i[1]+","},r=0;r<this.geometries.length;r++){if(this.geometries[r].coords.length===0)return"LINESTRING(empty)";this.geometries[r].coords.forEach(n),t+=e.substring(0,e.length-1)+")"}return t};var Xu=function(t,e,n){if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||e.x===void 0||e.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new fs(t.x,t.y),this.end=new fs(e.x,e.y),this.properties=n||{};var r=this.start.x-this.end.x,i=this.start.y-this.end.y,o=Math.pow(Math.sin(i/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(r/2),2);if(this.g=2*Math.asin(Math.sqrt(o)),this.g===Math.PI)throw new Error("it appears "+t.view()+" and "+e.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+t+" and "+e)};function wh(t,e){var n=[],r=yo();return Ee(e,function(i){if(n.forEach(function(a,u){a.id=u}),n.length){var o=r.search(i);if(o.features.length){var s=Ih(i,o);n=n.filter(function(a){return a.id!==s.id}),r.remove(s),Zt(Yu(s,i),function(a){n.push(a),r.insert(a)})}}else(n=Yu(t,i).features).forEach(function(a){a.bbox||(a.bbox=Xc(ye(a)))}),r.load(nt(n))}),nt(n)}function Yu(t,e){var n=[],r=it(t)[0],i=it(t)[t.geometry.coordinates.length-1];if(Hu(r,re(e))||Hu(i,re(e)))return nt([t]);var o=yo(),s=Ui(t);o.load(s);var a=o.search(e);if(!a.features.length)return nt([t]);var u=Ih(e,a),l=hu(s,function(h,c,p){var d=it(c)[1],g=re(e);return p===u.id?(h.push(g),n.push(Wt(h)),Hu(g,d)?[g]:[g,d]):(h.push(d),h)},[r]);return l.length>1&&n.push(Wt(l)),nt(n)}function Ih(t,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var n,r=1/0;return Zt(e,function(i){var o=ri(i,t).properties.dist;o<r&&(n=i,r=o)}),n}function Hu(t,e){return t[0]===e[0]&&t[1]===e[1]}function Sh(t,e,n,r,i){i===void 0&&(i={});var o=i.steps||64,s=Ch(n),a=Ch(r),u=Array.isArray(t)||t.type!=="Feature"?{}:t.properties;if(s===a)return Wt(Tu(t,e,i).geometry.coordinates[0],u);for(var l=s,h=s<a?a:a+360,c=l,p=[],d=0;c<h;)p.push(Fr(t,e,c,i).geometry.coordinates),c=l+360*++d/o;return c>h&&p.push(Fr(t,e,h,i).geometry.coordinates),Wt(p,u)}function Ch(t){var e=t%360;return e<0&&(e+=360),e}function gs(t,e){e===void 0&&(e={});var n=ae(t);switch(e.properties||t.type!=="Feature"||(e.properties=t.properties),n.type){case"Polygon":return Nh(n,e);case"MultiPolygon":return function(r,i){i===void 0&&(i={});var o=ae(r).coordinates,s=i.properties?i.properties:r.type==="Feature"?r.properties:{},a=[];return o.forEach(function(u){a.push(Ph(u,s))}),nt(a)}(n,e);default:throw new Error("invalid poly")}}function Nh(t,e){return e===void 0&&(e={}),Ph(ae(t).coordinates,e.properties?e.properties:t.type==="Feature"?t.properties:{})}function Ph(t,e){return t.length>1?yi(t,e):Wt(t[0],e)}function Mh(t,e){var n,r,i;e===void 0&&(e={});var o=e.properties,s=(n=e.autoComplete)===null||n===void 0||n,a=(r=e.orderCoords)===null||r===void 0||r;switch((i=e.mutate)!==null&&i!==void 0&&i||(t=Ye(t)),t.type){case"FeatureCollection":var u=[];return t.features.forEach(function(l){u.push(it(Lh(l,{},s,a)))}),xr(u,o);default:return Lh(t,o,s,a)}}function Lh(t,e,n,r){e=e||(t.type==="Feature"?t.properties:{});var i=ae(t),o=i.coordinates,s=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(s){case"LineString":return n&&(o=Oh(o)),ct([o],e);case"MultiLineString":var a=[],u=0;return o.forEach(function(l){if(n&&(l=Oh(l)),r){var h=function(c){var p=c[0],d=c[1],g=c[2],m=c[3];return Math.abs(p-g)*Math.abs(d-m)}(ye(Wt(l)));h>u?(a.unshift(l),u=h):a.push(l)}else a.push(l)}),ct(a,e);default:throw new Error("geometry type "+s+" is not supported")}}function Oh(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],s=i[1];return n===o&&r===s||t.push(e),t}function Td(t,e){var n,r,i,o,s,a,u;for(r=1;r<=8;r*=2){for(n=[],o=!(vo(i=t[t.length-1],e)&r),s=0;s<t.length;s++)(u=!(vo(a=t[s],e)&r))!==o&&n.push(Wu(i,a,r,e)),u&&n.push(a),i=a,o=u;if(!(t=n).length)break}return n}function Wu(t,e,n,r){return 8&n?[t[0]+(e[0]-t[0])*(r[3]-t[1])/(e[1]-t[1]),r[3]]:4&n?[t[0]+(e[0]-t[0])*(r[1]-t[1])/(e[1]-t[1]),r[1]]:2&n?[r[2],t[1]+(e[1]-t[1])*(r[2]-t[0])/(e[0]-t[0])]:1&n?[r[0],t[1]+(e[1]-t[1])*(r[0]-t[0])/(e[0]-t[0])]:null}function vo(t,e){var n=0;return t[0]<e[0]?n|=1:t[0]>e[2]&&(n|=2),t[1]<e[1]?n|=4:t[1]>e[3]&&(n|=8),n}function Rh(t,e){for(var n=[],r=0,i=t;r<i.length;r++){var o=Td(i[r],e);o.length>0&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),o.length>=4&&n.push(o))}return n}Xu.prototype.interpolate=function(t){var e=Math.sin((1-t)*this.g)/Math.sin(this.g),n=Math.sin(t*this.g)/Math.sin(this.g),r=e*Math.cos(this.start.y)*Math.cos(this.start.x)+n*Math.cos(this.end.y)*Math.cos(this.end.x),i=e*Math.cos(this.start.y)*Math.sin(this.start.x)+n*Math.cos(this.end.y)*Math.sin(this.end.x),o=e*Math.sin(this.start.y)+n*Math.sin(this.end.y),s=Eh*Math.atan2(o,Math.sqrt(Math.pow(r,2)+Math.pow(i,2)));return[Eh*Math.atan2(i,r),s]},Xu.prototype.Arc=function(t,e){var n=[];if(!t||t<=2)n.push([this.start.lon,this.start.lat]),n.push([this.end.lon,this.end.lat]);else for(var r=1/(t-1),i=0;i<t;++i){var o=r*i,s=this.interpolate(o);n.push(s)}for(var a=!1,u=0,l=e&&e.offset?e.offset:10,h=180-l,c=-180+l,p=360-l,d=1;d<n.length;++d){var g=n[d-1][0],m=n[d][0],f=Math.abs(m-g);f>p&&(m>h&&g<c||g>h&&m<c)?a=!0:f>u&&(u=f)}var _=[];if(a&&u<l){var I=[];_.push(I);for(var y=0;y<n.length;++y){var v=parseFloat(n[y][0]);if(y>0&&Math.abs(v-n[y-1][0])>p){var x=parseFloat(n[y-1][0]),b=parseFloat(n[y-1][1]),E=parseFloat(n[y][0]),T=parseFloat(n[y][1]);if(x>-180&&x<c&&E===180&&y+1<n.length&&n[y-1][0]>-180&&n[y-1][0]<c){I.push([-180,n[y][1]]),y++,I.push([n[y][0],n[y][1]]);continue}if(x>h&&x<180&&E===-180&&y+1<n.length&&n[y-1][0]>h&&n[y-1][0]<180){I.push([180,n[y][1]]),y++,I.push([n[y][0],n[y][1]]);continue}if(x<c&&E>h){var C=x;x=E,E=C;var D=b;b=T,T=D}if(x>h&&E<c&&(E+=360),x<=180&&E>=180&&x<E){var M=(180-x)/(E-x),B=M*T+(1-M)*b;I.push([n[y-1][0]>h?180:-180,B]),(I=[]).push([n[y-1][0]>h?-180:180,B]),_.push(I)}else I=[],_.push(I);I.push([v,n[y][1]])}else I.push([n[y][0],n[y][1]])}}else{var O=[];_.push(O);for(var R=0;R<n.length;++R)O.push([n[R][0],n[R][1]])}for(var P=new Vu(this.properties),F=0;F<_.length;++F){var k=new bh;P.geometries.push(k);for(var q=_[F],S=0;S<q.length;++S)k.move_to(q[S])}return P};var Th=Dr(function(t,e){function n(r){var i=[];for(var o in r)i.push(o);return i}(t.exports=typeof Object.keys=="function"?Object.keys:n).shim=n}),Ah=Dr(function(t,e){var n=function(){return Object.prototype.toString.call(arguments)}()=="[object Arguments]";function r(o){return Object.prototype.toString.call(o)=="[object Arguments]"}function i(o){return o&&typeof o=="object"&&typeof o.length=="number"&&Object.prototype.hasOwnProperty.call(o,"callee")&&!Object.prototype.propertyIsEnumerable.call(o,"callee")||!1}(e=t.exports=n?r:i).supported=r,e.unsupported=i}),_o=Dr(function(t){var e=Array.prototype.slice,n=t.exports=function(o,s,a){return a||(a={}),o===s||(o instanceof Date&&s instanceof Date?o.getTime()===s.getTime():!o||!s||typeof o!="object"&&typeof s!="object"?a.strict?o===s:o==s:function(u,l,h){var c,p;if(r(u)||r(l)||u.prototype!==l.prototype)return!1;if(Ah(u))return!!Ah(l)&&(u=e.call(u),l=e.call(l),n(u,l,h));if(i(u)){if(!i(l)||u.length!==l.length)return!1;for(c=0;c<u.length;c++)if(u[c]!==l[c])return!1;return!0}try{var d=Th(u),g=Th(l)}catch{return!1}if(d.length!=g.length)return!1;for(d.sort(),g.sort(),c=d.length-1;c>=0;c--)if(d[c]!=g[c])return!1;for(c=d.length-1;c>=0;c--)if(p=d[c],!n(u[p],l[p],h))return!1;return typeof u==typeof l}(o,s,a))};function r(o){return o==null}function i(o){return!(!o||typeof o!="object"||typeof o.length!="number")&&typeof o.copy=="function"&&typeof o.slice=="function"&&!(o.length>0&&typeof o[0]!="number")}});function Dh(t,e,n){if(n===void 0&&(n={}),!Qt(n=n||{}))throw new Error("options is invalid");var r,i=n.tolerance||0,o=[],s=yo(),a=Ui(t);return s.load(a),ei(e,function(u){var l=!1;u&&(Zt(s.search(u),function(h){if(l===!1){var c=it(u).sort(),p=it(h).sort();_o(c,p)||(i===0?Rn(c[0],h)&&Rn(c[1],h):ri(h,c[0]).properties.dist<=i&&ri(h,c[1]).properties.dist<=i)?(l=!0,r=r?Fh(r,u):u):(i===0?Rn(p[0],u)&&Rn(p[1],u):ri(u,p[0]).properties.dist<=i&&ri(u,p[1]).properties.dist<=i)&&(r=r?Fh(r,h):h)}}),l===!1&&r&&(o.push(r),r=void 0))}),r&&o.push(r),nt(o)}function Fh(t,e){var n=it(e),r=it(t),i=r[0],o=r[r.length-1],s=t.geometry.coordinates;return _o(n[0],i)?s.unshift(n[1]):_o(n[0],o)?s.push(n[1]):_o(n[1],i)?s.unshift(n[0]):_o(n[1],o)&&s.push(n[0]),t}function kh(t){var e=t%360;return e<0&&(e+=360),e}function Vi(t,e,n){var r;return n===void 0&&(n={}),(r=n.final?Gh(re(e),re(t)):Gh(re(t),re(e)))>180?-(360-r):r}function Gh(t,e){var n=ke(t[1]),r=ke(e[1]),i=ke(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4));return(mi(Math.atan2(i,o))+360)%360}function xo(t,e,n,r){r===void 0&&(r={});var i=e<0,o=qi(Math.abs(e),r.units,"meters");i&&(o=-Math.abs(o));var s=re(t),a=function(u,l,h,c){c=c===void 0?tr:Number(c);var p=l/c,d=u[0]*Math.PI/180,g=ke(u[1]),m=ke(h),f=p*Math.cos(m),_=g+f;Math.abs(_)>Math.PI/2&&(_=_>0?Math.PI-_:-Math.PI-_);var I=Math.log(Math.tan(_/2+Math.PI/4)/Math.tan(g/2+Math.PI/4)),y=Math.abs(I)>1e-11?f/I:Math.cos(g),v=p*Math.sin(m)/y;return[(180*(d+v)/Math.PI+540)%360-180,180*_/Math.PI]}(s,o,n);return a[0]+=a[0]-s[0]>180?-360:s[0]-a[0]>180?360:0,ft(a,r.properties)}function qh(t,e,n,r,i,o){for(var s=0;s<t.length;s++){var a=t[s],u=t[s+1];s===t.length-1&&(u=t[0]),r=ds(a,u,e),n<=0&&r>0?ds(e,a,i)<0||(i=a):n>0&&r<=0&&(Ad(e,a,o)||(o=a)),n=r}return[i,o]}function Ad(t,e,n){return ds(t,e,n)>0}function ds(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}function va(t){for(var e,n,r=it(t),i=0,o=1;o<r.length;)e=n||r[0],i+=((n=r[o])[0]-e[0])*(n[1]+e[1]),o++;return i>0}function _a(t,e){switch(t.type==="Feature"?t.geometry.type:t.type){case"GeometryCollection":return zn(t,function(n){_a(n,e)}),t;case"LineString":return Bh(it(t),e),t;case"Polygon":return zh(it(t),e),t;case"MultiLineString":return it(t).forEach(function(n){Bh(n,e)}),t;case"MultiPolygon":return it(t).forEach(function(n){zh(n,e)}),t;case"Point":case"MultiPoint":return t}}function Bh(t,e){va(t)===e&&t.reverse()}function zh(t,e){va(t[0])!==e&&t[0].reverse();for(var n=1;n<t.length;n++)va(t[n])===e&&t[n].reverse()}function Dd(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;ti(t,"Point","input must contain Points");for(var o=function(p,d){var g={};return Zt(p,function(m){var f=it(m)[1];g[f]||(g[f]=[]),g[f].push(m)}),Object.keys(g).map(function(m){return g[m].sort(function(f,_){return it(f)[0]-it(_)[0]})}).sort(function(m,f){return d?it(m[0])[1]-it(f[0])[1]:it(f[0])[1]-it(m[0])[1]})}(t,r),s=[],a=0;a<o.length;a++){for(var u=o[a],l=[],h=0;h<u.length;h++){var c=u[h];c.properties[n]?l.push(c.properties[n]):l.push(0),i===!0&&(c.properties.matrixPosition=[a,h])}s.push(l)}return s}var jh={successCallback:null,verbose:!1,polygons:!1},Xi={};function Fd(t,e,n,r){r=r||{};for(var i=Object.keys(jh),o=0;o<i.length;o++){var s=i[o],a=r[s];a=a??jh[s],Xi[s]=a}Xi.verbose&&console.log("MarchingSquaresJS-isoBands: computing isobands for ["+e+":"+(e+n)+"]");var u,l=function(h,c,p){for(var d=h.length-1,g=h[0].length-1,m={rows:d,cols:g,cells:[]},f=c+Math.abs(p),_=0;_<d;++_){m.cells[_]=[];for(var I=0;I<g;++I){var y=0,v=h[_+1][I],x=h[_+1][I+1],b=h[_][I+1],E=h[_][I];if(!(isNaN(v)||isNaN(x)||isNaN(b)||isNaN(E))){y|=v<c?0:v>f?128:64,y|=x<c?0:x>f?32:16,y|=b<c?0:b>f?8:4;var T=+(y|=E<c?0:E>f?2:1),C=0;if(y===17||y===18||y===33||y===34||y===38||y===68||y===72||y===98||y===102||y===132||y===136||y===137||y===152||y===153){var D=(v+x+b+E)/4;C=D>f?2:D<c?0:1,y===34?C===1?y=35:C===0&&(y=136):y===136?C===1?(y=35,C=4):C===0&&(y=34):y===17?C===1?(y=155,C=4):C===0&&(y=153):y===68?C===1?(y=103,C=4):C===0&&(y=102):y===153?C===1&&(y=155):y===102?C===1&&(y=103):y===152?C<2&&(y=156,C=1):y===137?C<2&&(y=139,C=1):y===98?C<2&&(y=99,C=1):y===38?C<2&&(y=39,C=1):y===18?C>0?(y=156,C=4):y=152:y===33?C>0?(y=139,C=4):y=137:y===72?C>0?(y=99,C=4):y=98:y===132&&(C>0?(y=39,C=4):y=38)}if(y!=0&&y!=170){var M,B,O,R,P,F,k,q;M=B=O=R=P=F=k=q=.5;var S=[];y===1?(O=1-w(c,b,E),q=1-w(c,v,E),S.push(K[y])):y===169?(O=w(f,E,b),q=w(f,E,v),S.push(K[y])):y===4?(F=1-w(c,x,b),R=w(c,E,b),S.push(H[y])):y===166?(F=w(f,b,x),R=1-w(f,b,E),S.push(H[y])):y===16?(P=w(c,b,x),B=w(c,v,x),S.push(W[y])):y===154?(P=1-w(f,x,b),B=1-w(f,x,v),S.push(W[y])):y===64?(k=w(c,E,v),M=1-w(c,x,v),S.push(rt[y])):y===106?(k=1-w(f,v,E),M=w(f,v,x),S.push(rt[y])):y===168?(R=w(f,E,b),O=w(c,E,b),q=w(c,E,v),k=w(f,E,v),S.push(Q[y]),S.push(K[y])):y===2?(R=1-w(c,b,E),O=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),S.push(Q[y]),S.push(K[y])):y===162?(P=w(f,b,x),F=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),S.push(Q[y]),S.push(K[y])):y===8?(P=1-w(c,x,b),F=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),S.push(W[y]),S.push(H[y])):y===138?(P=1-w(c,x,b),F=1-w(f,x,b),M=1-w(f,x,v),B=1-w(c,x,v),S.push(W[y]),S.push(H[y])):y===32?(P=w(f,b,x),F=w(c,b,x),M=w(c,v,x),B=w(f,v,x),S.push(W[y]),S.push(H[y])):y===42?(q=1-w(f,v,E),k=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x),S.push(ot[y]),S.push(rt[y])):y===128&&(q=w(c,E,v),k=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v),S.push(ot[y]),S.push(rt[y])),y===5?(F=1-w(c,x,b),q=1-w(c,v,E),S.push(H[y])):y===165?(F=w(f,b,x),q=w(f,E,v),S.push(H[y])):y===20?(R=w(c,E,b),B=w(c,v,x),S.push(Q[y])):y===150?(R=1-w(f,b,E),B=1-w(f,x,v),S.push(Q[y])):y===80?(P=w(c,b,x),k=w(c,E,v),S.push(W[y])):y===90?(P=1-w(f,x,b),k=1-w(f,v,E),S.push(W[y])):y===65?(O=1-w(c,b,E),M=1-w(c,x,v),S.push(K[y])):y===105?(O=w(f,E,b),M=w(f,v,x),S.push(K[y])):y===160?(P=w(f,b,x),F=w(c,b,x),q=w(c,E,v),k=w(f,E,v),S.push(W[y]),S.push(H[y])):y===10?(P=1-w(c,x,b),F=1-w(f,x,b),q=1-w(f,v,E),k=1-w(c,v,E),S.push(W[y]),S.push(H[y])):y===130?(R=1-w(c,b,E),O=1-w(f,b,E),M=1-w(f,x,v),B=1-w(c,x,v),S.push(Q[y]),S.push(K[y])):y===40?(R=w(f,E,b),O=w(c,E,b),M=w(c,v,x),B=w(f,v,x),S.push(Q[y]),S.push(K[y])):y===101?(F=w(f,b,x),M=w(f,v,x),S.push(H[y])):y===69?(F=1-w(c,x,b),M=1-w(c,x,v),S.push(H[y])):y===149?(q=w(f,E,v),B=1-w(f,x,v),S.push(ot[y])):y===21?(q=1-w(c,v,E),B=w(c,v,x),S.push(ot[y])):y===86?(R=1-w(f,b,E),k=1-w(f,v,E),S.push(Q[y])):y===84?(R=w(c,E,b),k=w(c,E,v),S.push(Q[y])):y===89?(P=1-w(f,x,b),O=w(f,E,b),S.push(K[y])):y===81?(P=w(c,b,x),O=1-w(c,b,E),S.push(K[y])):y===96?(P=w(f,b,x),F=w(c,b,x),k=w(c,E,v),M=w(f,v,x),S.push(W[y]),S.push(H[y])):y===74?(P=1-w(c,x,b),F=1-w(f,x,b),k=1-w(f,v,E),M=1-w(c,x,v),S.push(W[y]),S.push(H[y])):y===24?(P=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),B=w(c,v,x),S.push(W[y]),S.push(K[y])):y===146?(P=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),B=1-w(f,x,v),S.push(W[y]),S.push(K[y])):y===6?(F=1-w(c,x,b),R=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),S.push(H[y]),S.push(Q[y])):y===164?(F=w(f,b,x),R=w(c,E,b),q=w(c,E,v),k=w(f,E,v),S.push(H[y]),S.push(Q[y])):y===129?(O=1-w(c,b,E),q=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v),S.push(K[y]),S.push(ot[y])):y===41?(O=w(f,E,b),q=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x),S.push(K[y]),S.push(ot[y])):y===66?(R=1-w(c,b,E),O=1-w(f,b,E),k=1-w(f,v,E),M=1-w(c,x,v),S.push(Q[y]),S.push(K[y])):y===104?(R=w(f,E,b),O=w(c,E,b),k=w(c,E,v),M=w(f,v,x),S.push(K[y]),S.push(jt[y])):y===144?(P=w(c,b,x),q=w(c,E,v),k=w(f,E,v),B=1-w(f,x,v),S.push(W[y]),S.push(rt[y])):y===26?(P=1-w(f,x,b),q=1-w(f,v,E),k=1-w(c,v,E),B=w(c,v,x),S.push(W[y]),S.push(rt[y])):y===36?(F=w(f,b,x),R=w(c,E,b),M=w(c,v,x),B=w(f,v,x),S.push(H[y]),S.push(Q[y])):y===134?(F=1-w(c,x,b),R=1-w(f,b,E),M=1-w(f,x,v),B=1-w(c,x,v),S.push(H[y]),S.push(Q[y])):y===9?(P=1-w(c,x,b),F=1-w(f,x,b),O=w(f,E,b),q=1-w(c,v,E),S.push(W[y]),S.push(H[y])):y===161?(P=w(f,b,x),F=w(c,b,x),O=1-w(c,b,E),q=w(f,E,v),S.push(W[y]),S.push(H[y])):y===37?(F=w(f,b,x),q=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x),S.push(H[y]),S.push(ot[y])):y===133?(F=1-w(c,x,b),q=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v),S.push(H[y]),S.push(ot[y])):y===148?(R=w(c,E,b),q=w(c,E,v),k=w(f,E,v),B=1-w(f,x,v),S.push(Q[y]),S.push(rt[y])):y===22?(R=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),B=w(c,v,x),S.push(Q[y]),S.push(rt[y])):y===82?(P=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),k=1-w(f,v,E),S.push(W[y]),S.push(K[y])):y===88?(P=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),k=w(c,E,v),S.push(W[y]),S.push(K[y])):y===73?(P=1-w(c,x,b),F=1-w(f,x,b),O=w(f,E,b),M=1-w(c,x,v),S.push(W[y]),S.push(H[y])):y===97?(P=w(f,b,x),F=w(c,b,x),O=1-w(c,b,E),M=w(f,v,x),S.push(W[y]),S.push(H[y])):y===145?(P=w(c,b,x),O=1-w(c,b,E),q=w(f,E,v),B=1-w(f,x,v),S.push(W[y]),S.push(ot[y])):y===25?(P=1-w(f,x,b),O=w(f,E,b),q=1-w(c,v,E),B=w(c,v,x),S.push(W[y]),S.push(ot[y])):y===70?(F=1-w(c,x,b),R=1-w(f,b,E),k=1-w(f,v,E),M=1-w(c,x,v),S.push(H[y]),S.push(Q[y])):y===100?(F=w(f,b,x),R=w(c,E,b),k=w(c,E,v),M=w(f,v,x),S.push(H[y]),S.push(Q[y])):y===34?(C===0?(P=1-w(c,x,b),F=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),q=w(c,E,v),k=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v)):(P=w(f,b,x),F=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x)),S.push(W[y]),S.push(H[y]),S.push(ot[y]),S.push(rt[y])):y===35?(C===4?(P=1-w(c,x,b),F=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),q=w(c,E,v),k=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v)):(P=w(f,b,x),F=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x)),S.push(W[y]),S.push(H[y]),S.push(K[y]),S.push(rt[y])):y===136?(C===0?(P=w(f,b,x),F=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x)):(P=1-w(c,x,b),F=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),q=w(c,E,v),k=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v)),S.push(W[y]),S.push(H[y]),S.push(ot[y]),S.push(rt[y])):y===153?(C===0?(P=w(c,b,x),O=1-w(c,b,E),q=1-w(c,v,E),B=w(c,v,x)):(P=1-w(f,x,b),O=w(f,E,b),q=w(f,E,v),B=1-w(f,x,v)),S.push(W[y]),S.push(K[y])):y===102?(C===0?(F=1-w(c,x,b),R=w(c,E,b),k=w(c,E,v),M=1-w(c,x,v)):(F=w(f,b,x),R=1-w(f,b,E),k=1-w(f,v,E),M=w(f,v,x)),S.push(H[y]),S.push(rt[y])):y===155?(C===4?(P=w(c,b,x),O=1-w(c,b,E),q=1-w(c,v,E),B=w(c,v,x)):(P=1-w(f,x,b),O=w(f,E,b),q=w(f,E,v),B=1-w(f,x,v)),S.push(W[y]),S.push(ot[y])):y===103?(C===4?(F=1-w(c,x,b),R=w(c,E,b),k=w(c,E,v),M=1-w(c,x,v)):(F=w(f,b,x),R=1-w(f,b,E),k=1-w(f,v,E),M=w(f,v,x)),S.push(H[y]),S.push(Q[y])):y===152?(C===0?(P=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),B=w(c,v,x)):(P=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),q=w(c,E,v),k=w(f,E,v),B=1-w(f,x,v)),S.push(W[y]),S.push(Q[y]),S.push(K[y])):y===156?(C===4?(P=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),B=w(c,v,x)):(P=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),q=w(c,E,v),k=w(f,E,v),B=1-w(f,x,v)),S.push(W[y]),S.push(K[y]),S.push(rt[y])):y===137?(C===0?(P=w(f,b,x),F=w(c,b,x),O=1-w(c,b,E),q=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x)):(P=1-w(c,x,b),F=1-w(f,x,b),O=w(f,E,b),q=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v)),S.push(W[y]),S.push(H[y]),S.push(K[y])):y===139?(C===4?(P=w(f,b,x),F=w(c,b,x),O=1-w(c,b,E),q=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x)):(P=1-w(c,x,b),F=1-w(f,x,b),O=w(f,E,b),q=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v)),S.push(W[y]),S.push(H[y]),S.push(ot[y])):y===98?(C===0?(P=1-w(c,x,b),F=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),k=w(c,E,v),M=1-w(c,x,v)):(P=w(f,b,x),F=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),k=1-w(f,v,E),M=w(f,v,x)),S.push(W[y]),S.push(H[y]),S.push(rt[y])):y===99?(C===4?(P=1-w(c,x,b),F=1-w(f,x,b),R=w(f,E,b),O=w(c,E,b),k=w(c,E,v),M=1-w(c,x,v)):(P=w(f,b,x),F=w(c,b,x),R=1-w(c,b,E),O=1-w(f,b,E),k=1-w(f,v,E),M=w(f,v,x)),S.push(W[y]),S.push(H[y]),S.push(K[y])):y===38?(C===0?(F=1-w(c,x,b),R=w(c,E,b),q=w(c,E,v),k=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v)):(F=w(f,b,x),R=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x)),S.push(H[y]),S.push(ot[y]),S.push(rt[y])):y===39?(C===4?(F=1-w(c,x,b),R=w(c,E,b),q=w(c,E,v),k=w(f,E,v),M=1-w(f,x,v),B=1-w(c,x,v)):(F=w(f,b,x),R=1-w(f,b,E),q=1-w(f,v,E),k=1-w(c,v,E),M=w(c,v,x),B=w(f,v,x)),S.push(H[y]),S.push(Q[y]),S.push(rt[y])):y===85&&(P=1,F=0,R=1,O=0,q=0,k=1,M=0,B=1),(M<0||M>1||B<0||B>1||P<0||P>1||R<0||R>1||q<0||q>1||k<0||k>1)&&console.log("MarchingSquaresJS-isoBands: "+y+" "+T+" "+v+","+x+","+b+","+E+" "+C+" "+M+" "+B+" "+P+" "+F+" "+R+" "+O+" "+q+" "+k),m.cells[_][I]={cval:y,cval_real:T,flipped:C,topleft:M,topright:B,righttop:P,rightbottom:F,bottomright:R,bottomleft:O,leftbottom:q,lefttop:k,edges:S}}}}}return m}(t,e,n);return Xi.polygons?(Xi.verbose&&console.log("MarchingSquaresJS-isoBands: returning single polygons for each grid cell"),u=function(h){var c=[],p=0;return h.cells.forEach(function(d,g){d.forEach(function(m,f){if(m!==void 0){var _=Y[m.cval](m);typeof _=="object"&&rl(_)?typeof _[0]=="object"&&rl(_[0])?typeof _[0][0]=="object"&&rl(_[0][0])?_.forEach(function(I){I.forEach(function(y){y[0]+=f,y[1]+=g}),c[p++]=I}):(_.forEach(function(I){I[0]+=f,I[1]+=g}),c[p++]=_):console.log("MarchingSquaresJS-isoBands: bandcell polygon with malformed coordinates"):console.log("MarchingSquaresJS-isoBands: bandcell polygon with null coordinates")}})}),c}(l)):(Xi.verbose&&console.log("MarchingSquaresJS-isoBands: returning polygon paths for entire data grid"),u=function(h){for(var c=[],p=h.rows,d=h.cols,g=[],m=0;m<p;m++)for(var f=0;f<d;f++)if(h.cells[m][f]!==void 0&&h.cells[m][f].edges.length>0){var _=Gd(h.cells[m][f]),I=null,y=f,v=m;_!==null&&g.push([_.p[0]+y,_.p[1]+v]);do{if((I=qd(h.cells[v][y],_.x,_.y,_.o))===null)break;if(g.push([I.p[0]+y,I.p[1]+v]),y+=I.x,_=I,(v+=I.y)<0||v>=p||y<0||y>=d||h.cells[v][y]===void 0){var x=kd(h,y-=I.x,v-=I.y,I.x,I.y,I.o);if(x===null)break;x.path.forEach(function(b){g.push(b)}),y=x.i,v=x.j,_=x}}while(h.cells[v][y]!==void 0&&h.cells[v][y].edges.length>0);c.push(g),g=[],h.cells[m][f].edges.length>0&&f--}return c}(l)),typeof Xi.successCallback=="function"&&Xi.successCallback(u),u}var cn=64,Er=16,vt=[],_t=[],xt=[],Et=[],bt=[],wt=[],It=[],St=[],Ct=[],Nt=[],Pt=[],Mt=[],Lt=[],Ot=[],Rt=[],Tt=[],At=[],Dt=[],Ft=[],kt=[],Gt=[],qt=[],Bt=[],zt=[];It[85]=Nt[85]=-1,St[85]=Pt[85]=0,Ct[85]=Mt[85]=1,Ft[85]=qt[85]=1,kt[85]=Bt[85]=0,Gt[85]=zt[85]=1,vt[85]=Et[85]=0,_t[85]=bt[85]=-1,xt[85]=Rt[85]=0,Tt[85]=Lt[85]=0,At[85]=Ot[85]=1,wt[85]=Dt[85]=1,qt[1]=qt[169]=0,Bt[1]=Bt[169]=-1,zt[1]=zt[169]=0,Lt[1]=Lt[169]=-1,Ot[1]=Ot[169]=0,Rt[1]=Rt[169]=0,Nt[4]=Nt[166]=0,Pt[4]=Pt[166]=-1,Mt[4]=Mt[166]=1,Tt[4]=Tt[166]=1,At[4]=At[166]=0,Dt[4]=Dt[166]=0,It[16]=It[154]=0,St[16]=St[154]=1,Ct[16]=Ct[154]=1,Et[16]=Et[154]=1,bt[16]=bt[154]=0,wt[16]=wt[154]=1,Ft[64]=Ft[106]=0,kt[64]=kt[106]=1,Gt[64]=Gt[106]=0,vt[64]=vt[106]=-1,_t[64]=_t[106]=0,xt[64]=xt[106]=1,Ft[2]=Ft[168]=0,kt[2]=kt[168]=-1,Gt[2]=Gt[168]=1,qt[2]=qt[168]=0,Bt[2]=Bt[168]=-1,zt[2]=zt[168]=0,Lt[2]=Lt[168]=-1,Ot[2]=Ot[168]=0,Rt[2]=Rt[168]=0,Tt[2]=Tt[168]=-1,At[2]=At[168]=0,Dt[2]=Dt[168]=1,It[8]=It[162]=0,St[8]=St[162]=-1,Ct[8]=Ct[162]=0,Nt[8]=Nt[162]=0,Pt[8]=Pt[162]=-1,Mt[8]=Mt[162]=1,Lt[8]=Lt[162]=1,Ot[8]=Ot[162]=0,Rt[8]=Rt[162]=1,Tt[8]=Tt[162]=1,At[8]=At[162]=0,Dt[8]=Dt[162]=0,It[32]=It[138]=0,St[32]=St[138]=1,Ct[32]=Ct[138]=1,Nt[32]=Nt[138]=0,Pt[32]=Pt[138]=1,Mt[32]=Mt[138]=0,vt[32]=vt[138]=1,_t[32]=_t[138]=0,xt[32]=xt[138]=0,Et[32]=Et[138]=1,bt[32]=bt[138]=0,wt[32]=wt[138]=1,qt[128]=qt[42]=0,Bt[128]=Bt[42]=1,zt[128]=zt[42]=1,Ft[128]=Ft[42]=0,kt[128]=kt[42]=1,Gt[128]=Gt[42]=0,vt[128]=vt[42]=-1,_t[128]=_t[42]=0,xt[128]=xt[42]=1,Et[128]=Et[42]=-1,bt[128]=bt[42]=0,wt[128]=wt[42]=0,Nt[5]=Nt[165]=-1,Pt[5]=Pt[165]=0,Mt[5]=Mt[165]=0,qt[5]=qt[165]=1,Bt[5]=Bt[165]=0,zt[5]=zt[165]=0,Tt[20]=Tt[150]=0,At[20]=At[150]=1,Dt[20]=Dt[150]=1,Et[20]=Et[150]=0,bt[20]=bt[150]=-1,wt[20]=wt[150]=1,It[80]=It[90]=-1,St[80]=St[90]=0,Ct[80]=Ct[90]=1,Ft[80]=Ft[90]=1,kt[80]=kt[90]=0,Gt[80]=Gt[90]=1,Lt[65]=Lt[105]=0,Ot[65]=Ot[105]=1,Rt[65]=Rt[105]=0,vt[65]=vt[105]=0,_t[65]=_t[105]=-1,xt[65]=xt[105]=0,It[160]=It[10]=-1,St[160]=St[10]=0,Ct[160]=Ct[10]=1,Nt[160]=Nt[10]=-1,Pt[160]=Pt[10]=0,Mt[160]=Mt[10]=0,qt[160]=qt[10]=1,Bt[160]=Bt[10]=0,zt[160]=zt[10]=0,Ft[160]=Ft[10]=1,kt[160]=kt[10]=0,Gt[160]=Gt[10]=1,Tt[130]=Tt[40]=0,At[130]=At[40]=1,Dt[130]=Dt[40]=1,Lt[130]=Lt[40]=0,Ot[130]=Ot[40]=1,Rt[130]=Rt[40]=0,vt[130]=vt[40]=0,_t[130]=_t[40]=-1,xt[130]=xt[40]=0,Et[130]=Et[40]=0,bt[130]=bt[40]=-1,wt[130]=wt[40]=1,Nt[37]=Nt[133]=0,Pt[37]=Pt[133]=1,Mt[37]=Mt[133]=1,qt[37]=qt[133]=0,Bt[37]=Bt[133]=1,zt[37]=zt[133]=0,vt[37]=vt[133]=-1,_t[37]=_t[133]=0,xt[37]=xt[133]=0,Et[37]=Et[133]=1,bt[37]=bt[133]=0,wt[37]=wt[133]=0,Tt[148]=Tt[22]=-1,At[148]=At[22]=0,Dt[148]=Dt[22]=0,qt[148]=qt[22]=0,Bt[148]=Bt[22]=-1,zt[148]=zt[22]=1,Ft[148]=Ft[22]=0,kt[148]=kt[22]=1,Gt[148]=Gt[22]=1,Et[148]=Et[22]=-1,bt[148]=bt[22]=0,wt[148]=wt[22]=1,It[82]=It[88]=0,St[82]=St[88]=-1,Ct[82]=Ct[88]=1,Tt[82]=Tt[88]=1,At[82]=At[88]=0,Dt[82]=Dt[88]=1,Lt[82]=Lt[88]=-1,Ot[82]=Ot[88]=0,Rt[82]=Rt[88]=1,Ft[82]=Ft[88]=0,kt[82]=kt[88]=-1,Gt[82]=Gt[88]=0,It[73]=It[97]=0,St[73]=St[97]=1,Ct[73]=Ct[97]=0,Nt[73]=Nt[97]=0,Pt[73]=Pt[97]=-1,Mt[73]=Mt[97]=0,Lt[73]=Lt[97]=1,Ot[73]=Ot[97]=0,Rt[73]=Rt[97]=0,vt[73]=vt[97]=1,_t[73]=_t[97]=0,xt[73]=xt[97]=1,It[145]=It[25]=0,St[145]=St[25]=-1,Ct[145]=Ct[25]=0,Lt[145]=Lt[25]=1,Ot[145]=Ot[25]=0,Rt[145]=Rt[25]=1,qt[145]=qt[25]=0,Bt[145]=Bt[25]=1,zt[145]=zt[25]=1,Et[145]=Et[25]=-1,bt[145]=bt[25]=0,wt[145]=wt[25]=0,Nt[70]=Nt[100]=0,Pt[70]=Pt[100]=1,Mt[70]=Mt[100]=0,Tt[70]=Tt[100]=-1,At[70]=At[100]=0,Dt[70]=Dt[100]=1,Ft[70]=Ft[100]=0,kt[70]=kt[100]=-1,Gt[70]=Gt[100]=1,vt[70]=vt[100]=1,_t[70]=_t[100]=0,xt[70]=xt[100]=0,Nt[101]=Nt[69]=0,Pt[101]=Pt[69]=1,Mt[101]=Mt[69]=0,vt[101]=vt[69]=1,_t[101]=_t[69]=0,xt[101]=xt[69]=0,qt[149]=qt[21]=0,Bt[149]=Bt[21]=1,zt[149]=zt[21]=1,Et[149]=Et[21]=-1,bt[149]=bt[21]=0,wt[149]=wt[21]=0,Tt[86]=Tt[84]=-1,At[86]=At[84]=0,Dt[86]=Dt[84]=1,Ft[86]=Ft[84]=0,kt[86]=kt[84]=-1,Gt[86]=Gt[84]=1,It[89]=It[81]=0,St[89]=St[81]=-1,Ct[89]=Ct[81]=0,Lt[89]=Lt[81]=1,Ot[89]=Ot[81]=0,Rt[89]=Rt[81]=1,It[96]=It[74]=0,St[96]=St[74]=1,Ct[96]=Ct[74]=0,Nt[96]=Nt[74]=-1,Pt[96]=Pt[74]=0,Mt[96]=Mt[74]=1,Ft[96]=Ft[74]=1,kt[96]=kt[74]=0,Gt[96]=Gt[74]=0,vt[96]=vt[74]=1,_t[96]=_t[74]=0,xt[96]=xt[74]=1,It[24]=It[146]=0,St[24]=St[146]=-1,Ct[24]=Ct[146]=1,Tt[24]=Tt[146]=1,At[24]=At[146]=0,Dt[24]=Dt[146]=1,Lt[24]=Lt[146]=0,Ot[24]=Ot[146]=1,Rt[24]=Rt[146]=1,Et[24]=Et[146]=0,bt[24]=bt[146]=-1,wt[24]=wt[146]=0,Nt[6]=Nt[164]=-1,Pt[6]=Pt[164]=0,Mt[6]=Mt[164]=1,Tt[6]=Tt[164]=-1,At[6]=At[164]=0,Dt[6]=Dt[164]=0,qt[6]=qt[164]=0,Bt[6]=Bt[164]=-1,zt[6]=zt[164]=1,Ft[6]=Ft[164]=1,kt[6]=kt[164]=0,Gt[6]=Gt[164]=0,Lt[129]=Lt[41]=0,Ot[129]=Ot[41]=1,Rt[129]=Rt[41]=1,qt[129]=qt[41]=0,Bt[129]=Bt[41]=1,zt[129]=zt[41]=0,vt[129]=vt[41]=-1,_t[129]=_t[41]=0,xt[129]=xt[41]=0,Et[129]=Et[41]=0,bt[129]=bt[41]=-1,wt[129]=wt[41]=0,Tt[66]=Tt[104]=0,At[66]=At[104]=1,Dt[66]=Dt[104]=0,Lt[66]=Lt[104]=-1,Ot[66]=Ot[104]=0,Rt[66]=Rt[104]=1,Ft[66]=Ft[104]=0,kt[66]=kt[104]=-1,Gt[66]=Gt[104]=0,vt[66]=vt[104]=0,_t[66]=_t[104]=-1,xt[66]=xt[104]=1,It[144]=It[26]=-1,St[144]=St[26]=0,Ct[144]=Ct[26]=0,qt[144]=qt[26]=1,Bt[144]=Bt[26]=0,zt[144]=zt[26]=1,Ft[144]=Ft[26]=0,kt[144]=kt[26]=1,Gt[144]=Gt[26]=1,Et[144]=Et[26]=-1,bt[144]=bt[26]=0,wt[144]=wt[26]=1,Nt[36]=Nt[134]=0,Pt[36]=Pt[134]=1,Mt[36]=Mt[134]=1,Tt[36]=Tt[134]=0,At[36]=At[134]=1,Dt[36]=Dt[134]=0,vt[36]=vt[134]=0,_t[36]=_t[134]=-1,xt[36]=xt[134]=1,Et[36]=Et[134]=1,bt[36]=bt[134]=0,wt[36]=wt[134]=0,It[9]=It[161]=-1,St[9]=St[161]=0,Ct[9]=Ct[161]=0,Nt[9]=Nt[161]=0,Pt[9]=Pt[161]=-1,Mt[9]=Mt[161]=0,Lt[9]=Lt[161]=1,Ot[9]=Ot[161]=0,Rt[9]=Rt[161]=0,qt[9]=qt[161]=1,Bt[9]=Bt[161]=0,zt[9]=zt[161]=1,It[136]=0,St[136]=1,Ct[136]=1,Nt[136]=0,Pt[136]=1,Mt[136]=0,Tt[136]=-1,At[136]=0,Dt[136]=1,Lt[136]=-1,Ot[136]=0,Rt[136]=0,qt[136]=0,Bt[136]=-1,zt[136]=0,Ft[136]=0,kt[136]=-1,Gt[136]=1,vt[136]=1,_t[136]=0,xt[136]=0,Et[136]=1,bt[136]=0,wt[136]=1,It[34]=0,St[34]=-1,Ct[34]=0,Nt[34]=0,Pt[34]=-1,Mt[34]=1,Tt[34]=1,At[34]=0,Dt[34]=0,Lt[34]=1,Ot[34]=0,Rt[34]=1,qt[34]=0,Bt[34]=1,zt[34]=1,Ft[34]=0,kt[34]=1,Gt[34]=0,vt[34]=-1,_t[34]=0,xt[34]=1,Et[34]=-1,bt[34]=0,wt[34]=0,It[35]=0,St[35]=1,Ct[35]=1,Nt[35]=0,Pt[35]=-1,Mt[35]=1,Tt[35]=1,At[35]=0,Dt[35]=0,Lt[35]=-1,Ot[35]=0,Rt[35]=0,qt[35]=0,Bt[35]=-1,zt[35]=0,Ft[35]=0,kt[35]=1,Gt[35]=0,vt[35]=-1,_t[35]=0,xt[35]=1,Et[35]=1,bt[35]=0,wt[35]=1,It[153]=0,St[153]=1,Ct[153]=1,Lt[153]=-1,Ot[153]=0,Rt[153]=0,qt[153]=0,Bt[153]=-1,zt[153]=0,Et[153]=1,bt[153]=0,wt[153]=1,Nt[102]=0,Pt[102]=-1,Mt[102]=1,Tt[102]=1,At[102]=0,Dt[102]=0,Ft[102]=0,kt[102]=1,Gt[102]=0,vt[102]=-1,_t[102]=0,xt[102]=1,It[155]=0,St[155]=-1,Ct[155]=0,Lt[155]=1,Ot[155]=0,Rt[155]=1,qt[155]=0,Bt[155]=1,zt[155]=1,Et[155]=-1,bt[155]=0,wt[155]=0,Nt[103]=0,Pt[103]=1,Mt[103]=0,Tt[103]=-1,At[103]=0,Dt[103]=1,Ft[103]=0,kt[103]=-1,Gt[103]=1,vt[103]=1,_t[103]=0,xt[103]=0,It[152]=0,St[152]=1,Ct[152]=1,Tt[152]=-1,At[152]=0,Dt[152]=1,Lt[152]=-1,Ot[152]=0,Rt[152]=0,qt[152]=0,Bt[152]=-1,zt[152]=0,Ft[152]=0,kt[152]=-1,Gt[152]=1,Et[152]=1,bt[152]=0,wt[152]=1,It[156]=0,St[156]=-1,Ct[156]=1,Tt[156]=1,At[156]=0,Dt[156]=1,Lt[156]=-1,Ot[156]=0,Rt[156]=0,qt[156]=0,Bt[156]=-1,zt[156]=0,Ft[156]=0,kt[156]=1,Gt[156]=1,Et[156]=-1,bt[156]=0,wt[156]=1,It[137]=0,St[137]=1,Ct[137]=1,Nt[137]=0,Pt[137]=1,Mt[137]=0,Lt[137]=-1,Ot[137]=0,Rt[137]=0,qt[137]=0,Bt[137]=-1,zt[137]=0,vt[137]=1,_t[137]=0,xt[137]=0,Et[137]=1,bt[137]=0,wt[137]=1,It[139]=0,St[139]=1,Ct[139]=1,Nt[139]=0,Pt[139]=-1,Mt[139]=0,Lt[139]=1,Ot[139]=0,Rt[139]=0,qt[139]=0,Bt[139]=1,zt[139]=0,vt[139]=-1,_t[139]=0,xt[139]=0,Et[139]=1,bt[139]=0,wt[139]=1,It[98]=0,St[98]=-1,Ct[98]=0,Nt[98]=0,Pt[98]=-1,Mt[98]=1,Tt[98]=1,At[98]=0,Dt[98]=0,Lt[98]=1,Ot[98]=0,Rt[98]=1,Ft[98]=0,kt[98]=1,Gt[98]=0,vt[98]=-1,_t[98]=0,xt[98]=1,It[99]=0,St[99]=1,Ct[99]=0,Nt[99]=0,Pt[99]=-1,Mt[99]=1,Tt[99]=1,At[99]=0,Dt[99]=0,Lt[99]=-1,Ot[99]=0,Rt[99]=1,Ft[99]=0,kt[99]=-1,Gt[99]=0,vt[99]=1,_t[99]=0,xt[99]=1,Nt[38]=0,Pt[38]=-1,Mt[38]=1,Tt[38]=1,At[38]=0,Dt[38]=0,qt[38]=0,Bt[38]=1,zt[38]=1,Ft[38]=0,kt[38]=1,Gt[38]=0,vt[38]=-1,_t[38]=0,xt[38]=1,Et[38]=-1,bt[38]=0,wt[38]=0,Nt[39]=0,Pt[39]=1,Mt[39]=1,Tt[39]=-1,At[39]=0,Dt[39]=0,qt[39]=0,Bt[39]=-1,zt[39]=1,Ft[39]=0,kt[39]=1,Gt[39]=0,vt[39]=-1,_t[39]=0,xt[39]=1,Et[39]=1,bt[39]=0,wt[39]=0;var Ju=function(t){return[[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Zu=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0]]},Ku=function(t){return[[t.topright,1],[1,1],[1,t.righttop]]},Qu=function(t){return[[0,t.lefttop],[0,1],[t.topleft,1]]},$u=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop]]},tl=function(t){return[[t.bottomright,0],[t.bottomleft,0],[1,t.righttop],[1,t.rightbottom]]},el=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.topleft,1],[t.topright,1]]},nl=function(t){return[[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},W=[],H=[],Q=[],K=[],ot=[],rt=[],jt=[],Ut=[];K[1]=ot[1]=18,K[169]=ot[169]=18,Q[4]=H[4]=12,Q[166]=H[166]=12,W[16]=Ut[16]=4,W[154]=Ut[154]=4,rt[64]=jt[64]=22,rt[106]=jt[106]=22,Q[2]=rt[2]=17,K[2]=ot[2]=18,Q[168]=rt[168]=17,K[168]=ot[168]=18,W[8]=K[8]=9,H[8]=Q[8]=12,W[162]=K[162]=9,H[162]=Q[162]=12,W[32]=Ut[32]=4,H[32]=jt[32]=1,W[138]=Ut[138]=4,H[138]=jt[138]=1,ot[128]=Ut[128]=21,rt[128]=jt[128]=22,ot[42]=Ut[42]=21,rt[42]=jt[42]=22,H[5]=ot[5]=14,H[165]=ot[165]=14,Q[20]=Ut[20]=6,Q[150]=Ut[150]=6,W[80]=rt[80]=11,W[90]=rt[90]=11,K[65]=jt[65]=3,K[105]=jt[105]=3,W[160]=rt[160]=11,H[160]=ot[160]=14,W[10]=rt[10]=11,H[10]=ot[10]=14,Q[130]=Ut[130]=6,K[130]=jt[130]=3,Q[40]=Ut[40]=6,K[40]=jt[40]=3,H[101]=jt[101]=1,H[69]=jt[69]=1,ot[149]=Ut[149]=21,ot[21]=Ut[21]=21,Q[86]=rt[86]=17,Q[84]=rt[84]=17,W[89]=K[89]=9,W[81]=K[81]=9,W[96]=jt[96]=0,H[96]=rt[96]=15,W[74]=jt[74]=0,H[74]=rt[74]=15,W[24]=Q[24]=8,K[24]=Ut[24]=7,W[146]=Q[146]=8,K[146]=Ut[146]=7,H[6]=rt[6]=15,Q[6]=ot[6]=16,H[164]=rt[164]=15,Q[164]=ot[164]=16,K[129]=Ut[129]=7,ot[129]=jt[129]=20,K[41]=Ut[41]=7,ot[41]=jt[41]=20,Q[66]=jt[66]=2,K[66]=rt[66]=19,Q[104]=jt[104]=2,K[104]=rt[104]=19,W[144]=ot[144]=10,rt[144]=Ut[144]=23,W[26]=ot[26]=10,rt[26]=Ut[26]=23,H[36]=Ut[36]=5,Q[36]=jt[36]=2,H[134]=Ut[134]=5,Q[134]=jt[134]=2,W[9]=ot[9]=10,H[9]=K[9]=13,W[161]=ot[161]=10,H[161]=K[161]=13,H[37]=Ut[37]=5,ot[37]=jt[37]=20,H[133]=Ut[133]=5,ot[133]=jt[133]=20,Q[148]=ot[148]=16,rt[148]=Ut[148]=23,Q[22]=ot[22]=16,rt[22]=Ut[22]=23,W[82]=Q[82]=8,K[82]=rt[82]=19,W[88]=Q[88]=8,K[88]=rt[88]=19,W[73]=jt[73]=0,H[73]=K[73]=13,W[97]=jt[97]=0,H[97]=K[97]=13,W[145]=K[145]=9,ot[145]=Ut[145]=21,W[25]=K[25]=9,ot[25]=Ut[25]=21,H[70]=jt[70]=1,Q[70]=rt[70]=17,H[100]=jt[100]=1,Q[100]=rt[100]=17,W[34]=K[34]=9,H[34]=Q[34]=12,ot[34]=Ut[34]=21,rt[34]=jt[34]=22,W[136]=Ut[136]=4,H[136]=jt[136]=1,Q[136]=rt[136]=17,K[136]=ot[136]=18,W[35]=Ut[35]=4,H[35]=Q[35]=12,K[35]=ot[35]=18,rt[35]=jt[35]=22,W[153]=Ut[153]=4,K[153]=ot[153]=18,H[102]=Q[102]=12,rt[102]=jt[102]=22,W[155]=K[155]=9,ot[155]=Ut[155]=23,H[103]=jt[103]=1,Q[103]=rt[103]=17,W[152]=Ut[152]=4,Q[152]=rt[152]=17,K[152]=ot[152]=18,W[156]=Q[156]=8,K[156]=ot[156]=18,rt[156]=Ut[156]=23,W[137]=Ut[137]=4,H[137]=jt[137]=1,K[137]=ot[137]=18,W[139]=Ut[139]=4,H[139]=K[139]=13,ot[139]=jt[139]=20,W[98]=K[98]=9,H[98]=Q[98]=12,rt[98]=jt[98]=22,W[99]=jt[99]=0,H[99]=Q[99]=12,K[99]=rt[99]=19,H[38]=Q[38]=12,ot[38]=Ut[38]=21,rt[38]=jt[38]=22,H[39]=Ut[39]=5,Q[39]=ot[39]=16,rt[39]=jt[39]=22;var Y=[];function w(t,e,n){return(t-e)/(n-e)}function rl(t){return t.constructor.toString().indexOf("Array")>-1}function kd(t,e,n,r,i,o){for(var s=t.cells[n][e],a=s.cval_real,u=e+r,l=n+i,h=[],c=!1;!c;){if(t.cells[l]===void 0||t.cells[l][u]===void 0)if(l-=i,u-=r,a=(s=t.cells[l][u]).cval_real,i===-1)if(o===0)if(1&a)h.push([u,l]),r=-1,i=0,o=0;else{if(!(4&a)){h.push([u+s.bottomright,l]),r=0,i=1,o=1,c=!0;break}h.push([u+1,l]),r=1,i=0,o=0}else{if(!(1&a)){if(4&a){h.push([u+s.bottomright,l]),r=0,i=1,o=1,c=!0;break}h.push([u+s.bottomleft,l]),r=0,i=1,o=0,c=!0;break}h.push([u,l]),r=-1,i=0,o=0}else if(i===1)if(o===0){if(!(a&Er)){if(a&cn){h.push([u+s.topleft,l+1]),r=0,i=-1,o=0,c=!0;break}h.push([u+s.topright,l+1]),r=0,i=-1,o=1,c=!0;break}h.push([u+1,l+1]),r=1,i=0,o=1}else h.push([u+1,l+1]),r=1,i=0,o=1;else if(r===-1)if(o===0){if(!(a&cn)){if(1&a){h.push([u,l+s.leftbottom]),r=1,i=0,o=0,c=!0;break}h.push([u,l+s.lefttop]),r=1,i=0,o=1,c=!0;break}h.push([u,l+1]),r=0,i=1,o=0}else{if(!(a&cn)){console.log("MarchingSquaresJS-isoBands: wtf");break}h.push([u,l+1]),r=0,i=1,o=0}else{if(r!==1){console.log("MarchingSquaresJS-isoBands: we came from nowhere!");break}if(o===0){if(!(4&a)){h.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,c=!0;break}h.push([u+1,l]),r=0,i=-1,o=1}else{if(!(4&a)){if(a&Er){h.push([u+1,l+s.righttop]),r=-1,i=0,o=1;break}h.push([u+1,l+s.rightbottom]),r=-1,i=0,o=0,c=!0;break}h.push([u+1,l]),r=0,i=-1,o=1}}else if(a=(s=t.cells[l][u]).cval_real,r===-1)if(o===0)if(t.cells[l-1]!==void 0&&t.cells[l-1][u]!==void 0)r=0,i=-1,o=1;else{if(!(1&a)){h.push([u+s.bottomright,l]),r=0,i=1,o=1,c=!0;break}h.push([u,l])}else{if(!(a&cn)){console.log("MarchingSquaresJS-isoBands: found entry from top at "+u+","+l);break}console.log("MarchingSquaresJS-isoBands: proceeding in x-direction!")}else if(r===1){if(o===0){console.log("MarchingSquaresJS-isoBands: wtf");break}if(t.cells[l+1]!==void 0&&t.cells[l+1][u]!==void 0)r=0,i=1,o=0;else{if(!(a&Er)){h.push([u+s.topleft,l+1]),r=0,i=-1,o=0,c=!0;break}h.push([u+1,l+1]),r=1,i=0,o=1}}else if(i===-1){if(o!==1){console.log("MarchingSquaresJS-isoBands: wtf");break}if(t.cells[l][u+1]!==void 0)r=1,i=0,o=1;else{if(!(4&a)){h.push([u+1,l+s.righttop]),r=-1,i=0,o=1,c=!0;break}h.push([u+1,l]),r=0,i=-1,o=1}}else{if(i!==1){console.log("MarchingSquaresJS-isoBands: where did we came from???");break}if(o!==0){console.log("MarchingSquaresJS-isoBands: wtf");break}if(t.cells[l][u-1]!==void 0)r=-1,i=0,o=0;else{if(!(a&cn)){h.push([u,l+s.leftbottom]),r=1,i=0,o=0,c=!0;break}h.push([u,l+1]),r=0,i=1,o=0}}if(l+=i,(u+=r)===e&&l===n)break}return{path:h,i:u,j:l,x:r,y:i,o}}function Gd(t){if(t.edges.length>0){var e=t.edges[t.edges.length-1],n=t.cval_real;switch(e){case 0:return n&Er?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 1:return 4&n?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 2:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topleft,1],x:0,y:-1,o:0};case 3:return 1&n?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 4:return n&Er?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 5:return 4&n?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 6:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};case 7:return 1&n?{p:[t.topright,1],x:0,y:-1,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 8:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.righttop],x:-1,y:0,o:1};case 9:return 1&n?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 10:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.righttop],x:-1,y:0,o:1};case 11:return n&cn?{p:[1,t.righttop],x:-1,y:0,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 12:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 13:return 1&n?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 14:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[1,t.rightbottom],x:-1,y:0,o:0};case 15:return n&cn?{p:[1,t.rightbottom],x:-1,y:0,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 16:return 4&n?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 17:return n&cn?{p:[t.bottomright,0],x:0,y:1,o:1}:{p:[0,t.lefttop],x:1,y:0,o:1};case 18:return 1&n?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.bottomleft,0],x:0,y:1,o:0};case 19:return n&cn?{p:[t.bottomleft,0],x:0,y:1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 20:return n&cn?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.leftbottom],x:1,y:0,o:0};case 21:return n&Er?{p:[0,t.leftbottom],x:1,y:0,o:0}:{p:[t.topright,1],x:0,y:-1,o:1};case 22:return n&cn?{p:[t.topleft,1],x:0,y:-1,o:0}:{p:[0,t.lefttop],x:1,y:0,o:1};case 23:return n&Er?{p:[0,t.lefttop],x:1,y:0,o:1}:{p:[t.topright,1],x:0,y:-1,o:1};default:console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t)}}return null}function qd(t,e,n,r){var i,o,s,a,u,l=t.cval;switch(e){case-1:switch(r){case 0:i=H[l],s=Nt[l],a=Pt[l],u=Mt[l];break;default:i=W[l],s=It[l],a=St[l],u=Ct[l]}break;case 1:switch(r){case 0:i=ot[l],s=qt[l],a=Bt[l],u=zt[l];break;default:i=rt[l],s=Ft[l],a=kt[l],u=Gt[l]}break;default:switch(n){case-1:switch(r){case 0:i=jt[l],s=vt[l],a=_t[l],u=xt[l];break;default:i=Ut[l],s=Et[l],a=bt[l],u=wt[l]}break;case 1:switch(r){case 0:i=K[l],s=Lt[l],a=Ot[l],u=Rt[l];break;default:i=Q[l],s=Tt[l],a=At[l],u=Dt[l]}}}if(o=t.edges.indexOf(i),t.edges[o]===void 0)return null;switch(function(h,c){delete h.edges[c];for(var p=c+1;p<h.edges.length;p++)h.edges[p-1]=h.edges[p];h.edges.pop()}(t,o),l=t.cval_real,i){case 0:l&Er?(e=t.topleft,n=1):(e=1,n=t.righttop);break;case 1:4&l?(e=1,n=t.rightbottom):(e=t.topleft,n=1);break;case 2:4&l?(e=t.topleft,n=1):(e=t.bottomright,n=0);break;case 3:1&l?(e=t.bottomleft,n=0):(e=t.topleft,n=1);break;case 4:l&Er?(e=t.topright,n=1):(e=1,n=t.righttop);break;case 5:4&l?(e=1,n=t.rightbottom):(e=t.topright,n=1);break;case 6:4&l?(e=t.topright,n=1):(e=t.bottomright,n=0);break;case 7:1&l?(e=t.bottomleft,n=0):(e=t.topright,n=1);break;case 8:4&l?(e=1,n=t.righttop):(e=t.bottomright,n=0);break;case 9:1&l?(e=t.bottomleft,n=0):(e=1,n=t.righttop);break;case 10:1&l?(e=1,n=t.righttop):(e=0,n=t.leftbottom);break;case 11:l&cn?(e=0,n=t.lefttop):(e=1,n=t.righttop);break;case 12:4&l?(e=1,n=t.rightbottom):(e=t.bottomright,n=0);break;case 13:1&l?(e=t.bottomleft,n=0):(e=1,n=t.rightbottom);break;case 14:1&l?(e=1,n=t.rightbottom):(e=0,n=t.leftbottom);break;case 15:l&cn?(e=0,n=t.lefttop):(e=1,n=t.rightbottom);break;case 16:4&l?(e=0,n=t.leftbottom):(e=t.bottomright,n=0);break;case 17:l&cn?(e=0,n=t.lefttop):(e=t.bottomright,n=0);break;case 18:1&l?(e=t.bottomleft,n=0):(e=0,n=t.leftbottom);break;case 19:l&cn?(e=0,n=t.lefttop):(e=t.bottomleft,n=0);break;case 20:l&cn?(e=0,n=t.leftbottom):(e=t.topleft,n=1);break;case 21:l&Er?(e=t.topright,n=1):(e=0,n=t.leftbottom);break;case 22:l&cn?(e=0,n=t.lefttop):(e=t.topleft,n=1);break;case 23:l&Er?(e=t.topright,n=1):(e=0,n=t.lefttop);break;default:return console.log("MarchingSquaresJS-isoBands: edge index out of range!"),console.log(t),null}return e!==void 0&&n!==void 0&&s!==void 0&&a!==void 0&&u!==void 0||(console.log("MarchingSquaresJS-isoBands: undefined value!"),console.log(t),console.log(e+" "+n+" "+s+" "+a+" "+u)),{p:[e,n],x:s,y:a,o:u}}function Bd(t){var e=[],n=[];t.forEach(function(i){var o=zu(ct([i]));n.push(o),e.push({ring:i,area:o})}),n.sort(function(i,o){return o-i});var r=[];return n.forEach(function(i){for(var o=0;o<e.length;o++)if(e[o].area===i){r.push(e[o].ring),e.splice(o,1);break}}),r}function zd(t){for(var e=t.map(function(a){return{lrCoordinates:a,grouped:!1}}),n=[];!Ud(e);)for(var r=0;r<e.length;r++)if(!e[r].grouped){var i=[];i.push(e[r].lrCoordinates),e[r].grouped=!0;for(var o=ct([e[r].lrCoordinates]),s=r+1;s<e.length;s++)e[s].grouped||jd(ct([e[s].lrCoordinates]),o)&&(i.push(e[s].lrCoordinates),e[s].grouped=!0);n.push(i)}return n}function jd(t,e){for(var n=pa(t),r=0;r<n.features.length;r++)if(!le(n.features[r],e))return!1;return!0}function Ud(t){for(var e=0;e<t.length;e++)if(t[e].grouped===!1)return!1;return!0}function Uh(t,e,n){if(!Qt(n=n||{}))throw new Error("options is invalid");var r=n.pivot,i=n.mutate;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("angle is required");return e===0||(r||(r=_i(t)),i!==!1&&i!==void 0||(t=Ye(t)),Ce(t,function(o){var s=Vi(r,o)+e,a=ya(r,o),u=it(xo(r,a,s));o[0]=u[0],o[1]=u[1]})),t}function Vh(t,e,n){if(!Qt(n=n||{}))throw new Error("options is invalid");var r=n.origin,i=n.mutate;if(!t)throw new Error("geojson required");if(typeof e!="number"||e===0)throw new Error("invalid factor");var o=Array.isArray(r)||typeof r=="object";return i!==!0&&(t=Ye(t)),t.type!=="FeatureCollection"||o?Xh(t,e,r):(Zt(t,function(s,a){t.features[a]=Xh(s,e,r)}),t)}function Xh(t,e,n){var r=wn(t)==="Point";return n=function(i,o){if(o==null&&(o="centroid"),Array.isArray(o)||typeof o=="object")return re(o);var s=i.bbox?i.bbox:ye(i),a=s[0],u=s[1],l=s[2],h=s[3];switch(o){case"sw":case"southwest":case"westsouth":case"bottomleft":return ft([a,u]);case"se":case"southeast":case"eastsouth":case"bottomright":return ft([l,u]);case"nw":case"northwest":case"westnorth":case"topleft":return ft([a,h]);case"ne":case"northeast":case"eastnorth":case"topright":return ft([l,h]);case"center":return ha(i);case void 0:case null:case"centroid":return _i(i);default:throw new Error("invalid origin")}}(t,n),e===1||r||Ce(t,function(i){var o=ya(n,i),s=Vi(n,i),a=it(xo(n,o*e,s));i[0]=a[0],i[1]=a[1],i.length===3&&(i[2]*=e)}),t}function xa(t){var e=t[0],n=t[1];return[n[0]-e[0],n[1]-e[1]]}function il(t,e){return t[0]*e[1]-e[0]*t[1]}function Vd(t,e){return!function(n,r){return il(xa(n),xa(r))===0}(t,e)&&function(n,r){var i,o,s=n[0],a=xa(n),u=r[0],l=xa(r),h=il(a,l);return function(c,p){return[c[0]+p[0],c[1]+p[1]]}(s,function(c,p){return[c*p[0],c*p[1]]}(il((o=s,[(i=u)[0]-o[0],i[1]-o[1]]),l)/h,a))}(t,e)}function Yh(t,e,n){var r=[],i=ea(e,n),o=it(t),s=[];return o.forEach(function(a,u){if(u!==o.length-1){var l=(p=a,d=o[u+1],g=i,m=Math.sqrt((p[0]-d[0])*(p[0]-d[0])+(p[1]-d[1])*(p[1]-d[1])),f=p[0]+g*(d[1]-p[1])/m,_=d[0]+g*(d[1]-p[1])/m,I=p[1]+g*(p[0]-d[0])/m,y=d[1]+g*(p[0]-d[0])/m,[[f,I],[_,y]]);if(r.push(l),u>0){var h=r[u-1],c=Vd(l,h);c!==!1&&(h[1]=c,l[0]=c),s.push(h[0]),u===o.length-2&&(s.push(l[0]),s.push(l[1]))}o.length===2&&(s.push(l[0]),s.push(l[1]))}var p,d,g,m,f,_,I,y}),Wt(s,t.properties)}function ol(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0];return function(s){return(s>0)-(s<0)||+s}(r*(n[1]-e[1])-o*i)}function Hh(t,e){return e.geometry.coordinates[0].every(function(n){return le(ft(n),t)})}Y[1]=Y[169]=Ju,Y[4]=Y[166]=Zu,Y[16]=Y[154]=Ku,Y[64]=Y[106]=Qu,Y[168]=Y[2]=$u,Y[162]=Y[8]=tl,Y[138]=Y[32]=el,Y[42]=Y[128]=nl,Y[5]=Y[165]=function(t){return[[0,0],[0,t.leftbottom],[1,t.rightbottom],[1,0]]},Y[20]=Y[150]=function(t){return[[1,0],[t.bottomright,0],[t.topright,1],[1,1]]},Y[80]=Y[90]=function(t){return[[1,1],[1,t.righttop],[0,t.lefttop],[0,1]]},Y[65]=Y[105]=function(t){return[[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Y[160]=Y[10]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.leftbottom],[0,t.lefttop]]},Y[130]=Y[40]=function(t){return[[t.topleft,1],[t.topright,1],[t.bottomright,0],[t.bottomleft,0]]},Y[85]=function(){return[[0,0],[0,1],[1,1],[1,0]]},Y[101]=Y[69]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,1],[t.topleft,1]]},Y[149]=Y[21]=function(t){return[[t.topright,1],[1,1],[1,0],[0,0],[0,t.leftbottom]]},Y[86]=Y[84]=function(t){return[[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[1,1]]},Y[89]=Y[81]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,1]]},Y[96]=Y[74]=function(t){return[[1,t.righttop],[1,t.rightbottom],[0,t.lefttop],[0,1],[t.topleft,1]]},Y[24]=Y[146]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[t.topright,1]]},Y[6]=Y[164]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop]]},Y[129]=Y[41]=function(t){return[[t.topright,1],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1]]},Y[66]=Y[104]=function(t){return[[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Y[144]=Y[26]=function(t){return[[1,1],[1,t.righttop],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Y[36]=Y[134]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[t.topleft,1],[t.topright,1]]},Y[9]=Y[161]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom]]},Y[37]=Y[133]=function(t){return[[1,t.rightbottom],[1,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Y[148]=Y[22]=function(t){return[[1,1],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Y[82]=Y[88]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1]]},Y[73]=Y[97]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,1],[t.topleft,1]]},Y[145]=Y[25]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Y[70]=Y[100]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Y[34]=function(t){return[nl(t),tl(t)]},Y[35]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]},Y[136]=function(t){return[el(t),$u(t)]},Y[153]=function(t){return[Ku(t),Ju(t)]},Y[102]=function(t){return[Zu(t),Qu(t)]},Y[155]=function(t){return[[1,1],[1,t.righttop],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topright,1]]},Y[103]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Y[152]=function(t){return[Ku(t),$u(t)]},Y[156]=function(t){return[[1,1],[1,t.righttop],[t.bottomright,0],[t.bottomleft,0],[0,t.leftbottom],[0,t.lefttop],[t.topright,1]]},Y[137]=function(t){return[el(t),Ju(t)]},Y[139]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomleft,0],[0,0],[0,t.leftbottom],[t.topleft,1],[t.topright,1]]},Y[98]=function(t){return[tl(t),Qu(t)]},Y[99]=function(t){return[[1,t.righttop],[1,t.rightbottom],[t.bottomright,0],[t.bottomleft,0],[0,t.lefttop],[0,1],[t.topleft,1]]},Y[38]=function(t){return[Zu(t),nl(t)]},Y[39]=function(t){return[[1,t.rightbottom],[1,0],[t.bottomright,0],[0,t.leftbottom],[0,t.lefttop],[t.topleft,1],[t.topright,1]]};var Wh=function(){function t(e){this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return t.buildId=function(e){return e.join(",")},t.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(n){return n.from.id!==e.from.id})},t.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(n){return n.to.id!==e.to.id})},t.prototype.addOuterEdge=function(e){this.outerEdges.push(e),this.outerEdgesSorted=!1},t.prototype.sortOuterEdges=function(){var e=this;this.outerEdgesSorted||(this.outerEdges.sort(function(n,r){var i=n.to,o=r.to;if(i.coordinates[0]-e.coordinates[0]>=0&&o.coordinates[0]-e.coordinates[0]<0)return 1;if(i.coordinates[0]-e.coordinates[0]<0&&o.coordinates[0]-e.coordinates[0]>=0)return-1;if(i.coordinates[0]-e.coordinates[0]==0&&o.coordinates[0]-e.coordinates[0]==0)return i.coordinates[1]-e.coordinates[1]>=0||o.coordinates[1]-e.coordinates[1]>=0?i.coordinates[1]-o.coordinates[1]:o.coordinates[1]-i.coordinates[1];var s=ol(e.coordinates,i.coordinates,o.coordinates);return s<0?1:s>0?-1:Math.pow(i.coordinates[0]-e.coordinates[0],2)+Math.pow(i.coordinates[1]-e.coordinates[1],2)-(Math.pow(o.coordinates[0]-e.coordinates[0],2)+Math.pow(o.coordinates[1]-e.coordinates[1],2))}),this.outerEdgesSorted=!0)},t.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},t.prototype.getOuterEdge=function(e){return this.sortOuterEdges(),this.outerEdges[e]},t.prototype.addInnerEdge=function(e){this.innerEdges.push(e)},t}(),Xd=function(){function t(e,n){this.from=e,this.to=n,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return t.prototype.getSymetric=function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric},t.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},t.prototype.isEqual=function(e){return this.from.id===e.from.id&&this.to.id===e.to.id},t.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},t.prototype.toLineString=function(){return Wt([this.from.coordinates,this.to.coordinates])},t.prototype.compareTo=function(e){return ol(e.from.coordinates,e.to.coordinates,this.to.coordinates)},t}(),Jh=function(){function t(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return t.prototype.push=function(e){this[this.edges.length]=e,this.edges.push(e),this.polygon=this.envelope=void 0},t.prototype.get=function(e){return this.edges[e]},Object.defineProperty(t.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),t.prototype.forEach=function(e){this.edges.forEach(e)},t.prototype.map=function(e){return this.edges.map(e)},t.prototype.some=function(e){return this.edges.some(e)},t.prototype.isValid=function(){return!0},t.prototype.isHole=function(){var e=this,n=this.edges.reduce(function(s,a,u){return a.from.coordinates[1]>e.edges[s].from.coordinates[1]&&(s=u),s},0),r=(n===0?this.length:n)-1,i=(n+1)%this.length,o=ol(this.edges[r].from.coordinates,this.edges[n].from.coordinates,this.edges[i].from.coordinates);return o===0?this.edges[r].from.coordinates[0]>this.edges[i].from.coordinates[0]:o>0},t.prototype.toMultiPoint=function(){return ta(this.edges.map(function(e){return e.from.coordinates}))},t.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var e=this.edges.map(function(n){return n.from.coordinates});return e.push(this.edges[0].from.coordinates),this.polygon=ct([e])},t.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Vc(this.toPolygon())},t.findEdgeRingContaining=function(e,n){var r,i,o=e.getEnvelope();return n.forEach(function(s){var a,u,l,h,c,p,d=s.getEnvelope();if(i&&(r=i.getEnvelope()),u=o,l=(a=d).geometry.coordinates.map(function(m){return m[0]}),h=a.geometry.coordinates.map(function(m){return m[1]}),c=u.geometry.coordinates.map(function(m){return m[0]}),p=u.geometry.coordinates.map(function(m){return m[1]}),(Math.max(null,l)!==Math.max(null,c)||Math.max(null,h)!==Math.max(null,p)||Math.min(null,l)!==Math.min(null,c)||Math.min(null,h)!==Math.min(null,p))&&Hh(d,o)){var g=e.map(function(m){return m.from.coordinates}).find(function(m){return!s.some(function(f){return _=m,I=f.from.coordinates,_[0]===I[0]&&_[1]===I[1];var _,I})});g&&s.inside(ft(g))&&(i&&!Hh(r,d)||(i=s))}}),i},t.prototype.inside=function(e){return le(e,this.toPolygon())},t}(),Yd=function(){function t(){this.edges=[],this.nodes={}}return t.fromGeoJson=function(e){(function(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type '"+r.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")})(e);var n=new t;return Ee(e,function(r){ts(r,"LineString","Graph::fromGeoJson"),lu(r,function(i,o){if(i){var s=n.getNode(i),a=n.getNode(o);n.addEdge(s,a)}return o})}),n},t.prototype.getNode=function(e){var n=Wh.buildId(e),r=this.nodes[n];return r||(r=this.nodes[n]=new Wh(e)),r},t.prototype.addEdge=function(e,n){var r=new Xd(e,n),i=r.getSymetric();this.edges.push(r),this.edges.push(i)},t.prototype.deleteDangles=function(){var e=this;Object.keys(this.nodes).map(function(n){return e.nodes[n]}).forEach(function(n){return e._removeIfDangle(n)})},t.prototype._removeIfDangle=function(e){var n=this;if(e.innerEdges.length<=1){var r=e.getOuterEdges().map(function(i){return i.to});this.removeNode(e),r.forEach(function(i){return n._removeIfDangle(i)})}},t.prototype.deleteCutEdges=function(){var e=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(n){n.label===n.symetric.label&&(e.removeEdge(n.symetric),e.removeEdge(n))})},t.prototype._computeNextCWEdges=function(e){var n=this;e===void 0?Object.keys(this.nodes).forEach(function(r){return n._computeNextCWEdges(n.nodes[r])}):e.getOuterEdges().forEach(function(r,i){e.getOuterEdge((i===0?e.getOuterEdges().length:i)-1).symetric.next=r})},t.prototype._computeNextCCWEdges=function(e,n){for(var r,i,o=e.getOuterEdges(),s=o.length-1;s>=0;--s){var a=o[s],u=a.symetric,l=void 0,h=void 0;a.label===n&&(l=a),u.label===n&&(h=u),l&&h&&(h&&(i=h),l&&(i&&(i.next=l,i=void 0),r||(r=l)))}i&&(i.next=r)},t.prototype._findLabeledEdgeRings=function(){var e=[],n=0;return this.edges.forEach(function(r){if(!(r.label>=0)){e.push(r);var i=r;do i.label=n,i=i.next;while(!r.isEqual(i));n++}}),e},t.prototype.getEdgeRings=function(){var e=this;this._computeNextCWEdges(),this.edges.forEach(function(r){r.label=void 0}),this._findLabeledEdgeRings().forEach(function(r){e._findIntersectionNodes(r).forEach(function(i){e._computeNextCCWEdges(i,r.label)})});var n=[];return this.edges.forEach(function(r){r.ring||n.push(e._findEdgeRing(r))}),n},t.prototype._findIntersectionNodes=function(e){var n=[],r=e,i=function(){var o=0;r.from.getOuterEdges().forEach(function(s){s.label===e.label&&++o}),o>1&&n.push(r.from),r=r.next};do i();while(!e.isEqual(r));return n},t.prototype._findEdgeRing=function(e){var n=e,r=new Jh;do r.push(n),n.ring=r,n=n.next;while(!e.isEqual(n));return r},t.prototype.removeNode=function(e){var n=this;e.getOuterEdges().forEach(function(r){return n.removeEdge(r)}),e.innerEdges.forEach(function(r){return n.removeEdge(r)}),delete this.nodes[e.id]},t.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(n){return!n.isEqual(e)}),e.deleteEdge()},t}();function Zh(t,e){var n=!0;return Ee(t,function(r){Ee(e,function(i){if(n===!1)return!1;n=function(o,s){switch(o.type){case"Point":switch(s.type){case"Point":return a=o.coordinates,u=s.coordinates,!(a[0]===u[0]&&a[1]===u[1]);case"LineString":return!Kh(s,o);case"Polygon":return!le(o,s)}break;case"LineString":switch(s.type){case"Point":return!Kh(o,s);case"LineString":return!function(l,h){return kr(l,h).features.length>0}(o,s);case"Polygon":return!Qh(s,o)}break;case"Polygon":switch(s.type){case"Point":return!le(s,o);case"LineString":return!Qh(o,s);case"Polygon":return!function(l,h){for(var c=0,p=l.coordinates[0];c<p.length;c++)if(le(p[c],h))return!0;for(var d=0,g=h.coordinates[0];d<g.length;d++)if(le(g[d],l))return!0;return kr(gs(l),gs(h)).features.length>0}(s,o)}}var a,u;return!1}(r.geometry,i.geometry)})}),n}function Kh(t,e){for(var n=0;n<t.coordinates.length-1;n++)if(Hd(t.coordinates[n],t.coordinates[n+1],e.coordinates))return!0;return!1}function Qh(t,e){for(var n=0,r=e.coordinates;n<r.length;n++)if(le(r[n],t))return!0;return kr(e,gs(t)).features.length>0}function Hd(t,e,n){var r=n[0]-t[0],i=n[1]-t[1],o=e[0]-t[0],s=e[1]-t[1];return r*s-i*o==0&&(Math.abs(o)>=Math.abs(s)?o>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:s>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1])}function $h(t,e){return!(t[0]>e[0])&&!(t[2]<e[2])&&!(t[1]>e[1])&&!(t[3]<e[3])}function sl(t,e){return t[0]===e[0]&&t[1]===e[1]}function Wd(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function tp(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&!n&&!r;){for(var s=0;s<e.coordinates.length-1;s++){var a=!0;s!==0&&s!==e.coordinates.length-2||(a=!1),rp(e.coordinates[s],e.coordinates[s+1],t.coordinates[o],a)?n=!0:r=!0}o++}return n&&r}function ep(t,e){return kr(t,Nh(e)).features.length>0}function np(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o<i&&(!n||!r);o++)le(ft(t.coordinates[o]),e)?n=!0:r=!0;return r&&n}function rp(t,e,n,r){var i=n[0]-t[0],o=n[1]-t[1],s=e[0]-t[0],a=e[1]-t[1];return i*a-o*s==0&&(r?Math.abs(s)>=Math.abs(a)?s>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:a>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(s)>=Math.abs(a)?s>0?t[0]<n[0]&&n[0]<e[0]:e[0]<n[0]&&n[0]<t[0]:a>0?t[1]<n[1]&&n[1]<e[1]:e[1]<n[1]&&n[1]<t[1])}var Gr=function(t){this.precision=t&&t.precision?t.precision:17,this.direction=!(!t||!t.direction)&&t.direction,this.pseudoNode=!(!t||!t.pseudoNode)&&t.pseudoNode,this.objectComparator=t&&t.objectComparator?t.objectComparator:Jd};function ip(t){return t.coordinates.map(function(e){return{type:t.type.replace("Multi",""),coordinates:e}})}function op(t,e){return t.hasOwnProperty("coordinates")?t.coordinates.length===e.coordinates.length:t.length===e.length}function Jd(t,e){return _o(t,e,{strict:!0})}Gr.prototype.compare=function(t,e){if(t.type!==e.type||!op(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates,0,!1);case"Polygon":return this.comparePolygon(t,e);case"Feature":return this.compareFeature(t,e);default:if(t.type.indexOf("Multi")===0){var n=this,r=ip(t),i=ip(e);return r.every(function(o){return this.some(function(s){return n.compare(o,s)})},i)}}return!1},Gr.prototype.compareCoord=function(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n].toFixed(this.precision)!==e[n].toFixed(this.precision))return!1;return!0},Gr.prototype.compareLine=function(t,e,n,r){if(!op(t,e))return!1;var i=this.pseudoNode?t:this.removePseudo(t),o=this.pseudoNode?e:this.removePseudo(e);if(!r||this.compareCoord(i[0],o[0])||(o=this.fixStartIndex(o,i))){var s=this.compareCoord(i[n],o[n]);return this.direction||s?this.comparePath(i,o):!!this.compareCoord(i[n],o[o.length-(1+n)])&&this.comparePath(i.slice().reverse(),o)}},Gr.prototype.fixStartIndex=function(t,e){for(var n,r=-1,i=0;i<t.length;i++)if(this.compareCoord(t[i],e[0])){r=i;break}return r>=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n},Gr.prototype.comparePath=function(t,e){var n=this;return t.every(function(r,i){return n.compareCoord(r,this[i])},e)},Gr.prototype.comparePolygon=function(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var n=t.coordinates.slice(1,t.coordinates.length),r=e.coordinates.slice(1,e.coordinates.length),i=this;return n.every(function(o){return this.some(function(s){return i.compareLine(o,s,1,!0)})},r)}return!1},Gr.prototype.compareFeature=function(t,e){return!(t.id!==e.id||!this.objectComparator(t.properties,e.properties)||!this.compareBBox(t,e))&&this.compare(t.geometry,e.geometry)},Gr.prototype.compareBBox=function(t,e){return!!(!t.bbox&&!e.bbox||t.bbox&&e.bbox&&this.compareCoord(t.bbox,e.bbox))},Gr.prototype.removePseudo=function(t){return t};var sp=Gr;function ap(t,e){var n=ae(t),r=ae(e),i=n.type,o=r.type;if(i==="MultiPoint"&&o!=="MultiPoint"||(i==="LineString"||i==="MultiLineString")&&o!=="LineString"&&o!=="MultiLineString"||(i==="Polygon"||i==="MultiPolygon")&&o!=="Polygon"&&o!=="MultiPolygon")throw new Error("features must be of the same type");if(i==="Point")throw new Error("Point geometry not supported");if(new sp({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<n.coordinates.length;a++)for(var u=0;u<r.coordinates.length;u++){var l=n.coordinates[a],h=r.coordinates[u];if(l[0]===h[0]&&l[1]===h[1])return!0}return!1;case"LineString":case"MultiLineString":ei(t,function(c){ei(e,function(p){Dh(c,p).features.length&&s++})});break;case"Polygon":case"MultiPolygon":ei(t,function(c){ei(e,function(p){kr(c,p).features.length&&s++})})}return s>0}function up(t,e){var n=!1;return Ee(t,function(r){Ee(e,function(i){if(n===!0)return!0;n=!Zh(r.geometry,i.geometry)})}),n}var Zd=Dr(function(t){function e(n,r,i,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(n,r,i,o)}e.prototype.run=function(n,r,i,o){this._init(n,r,i,o);for(var s=0;s<this._datasetLength;s++)if(this._visited[s]!==1){this._visited[s]=1;var a=this._regionQuery(s);if(a.length<this.minPts)this.noise.push(s);else{var u=this.clusters.length;this.clusters.push([]),this._addToCluster(s,u),this._expandCluster(u,a)}}return this.clusters},e.prototype._init=function(n,r,i,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this.noise=[],this._datasetLength=n.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}r&&(this.epsilon=r),i&&(this.minPts=i),o&&(this.distance=o)},e.prototype._expandCluster=function(n,r){for(var i=0;i<r.length;i++){var o=r[i];if(this._visited[o]!==1){this._visited[o]=1;var s=this._regionQuery(o);s.length>=this.minPts&&(r=this._mergeArrays(r,s))}this._assigned[o]!==1&&this._addToCluster(o,n)}},e.prototype._addToCluster=function(n,r){this.clusters[r].push(n),this._assigned[n]=1},e.prototype._regionQuery=function(n){for(var r=[],i=0;i<this._datasetLength;i++)this.distance(this.dataset[n],this.dataset[i])<this.epsilon&&r.push(i);return r},e.prototype._mergeArrays=function(n,r){for(var i=r.length,o=0;o<i;o++){var s=r[o];n.indexOf(s)<0&&n.push(s)}return n},e.prototype._euclideanDistance=function(n,r){for(var i=0,o=Math.min(n.length,r.length);o--;)i+=(n[o]-r[o])*(n[o]-r[o]);return Math.sqrt(i)},t.exports&&(t.exports=e)}),Kd=Dr(function(t){function e(n,r,i){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,r,i)}e.prototype.init=function(n,r,i){this.assignments=[],this.centroids=[],n!==void 0&&(this.dataset=n),r!==void 0&&(this.k=r),i!==void 0&&(this.distance=i)},e.prototype.run=function(n,r){this.init(n,r);for(var i=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var s=!0;s;){s=this.assign();for(var a=0;a<this.k;a++){for(var u=new Array(p),l=0,h=0;h<p;h++)u[h]=0;for(var c=0;c<i;c++){var p=this.dataset[c].length;if(a===this.assignments[c]){for(h=0;h<p;h++)u[h]+=this.dataset[c][h];l++}}if(l>0){for(h=0;h<p;h++)u[h]/=l;this.centroids[a]=u}else this.centroids[a]=this.randomCentroid(),s=!0}}return this.getClusters()},e.prototype.randomCentroid=function(){var n,r,i=this.dataset.length-1;do r=Math.round(Math.random()*i),n=this.dataset[r];while(this.centroids.indexOf(n)>=0);return n},e.prototype.assign=function(){for(var n,r=!1,i=this.dataset.length,o=0;o<i;o++)(n=this.argmin(this.dataset[o],this.centroids,this.distance))!=this.assignments[o]&&(this.assignments[o]=n,r=!0);return r},e.prototype.getClusters=function(){for(var n,r=new Array(this.k),i=0;i<this.assignments.length;i++)r[n=this.assignments[i]]===void 0&&(r[n]=[]),r[n].push(i);return r},e.prototype.argmin=function(n,r,i){for(var o,s=Number.MAX_VALUE,a=0,u=r.length,l=0;l<u;l++)(o=i(n,r[l]))<s&&(s=o,a=l);return a},e.prototype.distance=function(n,r){for(var i=0,o=Math.min(n.length,r.length);o--;){var s=n[o]-r[o];i+=s*s}return Math.sqrt(i)},t.exports&&(t.exports=e)}),lp=Dr(function(t){function e(n,r,i){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,r,i)}e.prototype.insert=function(n,r){for(var i=this._queue.length,o=i;o--;){var s=this._priorities[o];this._sorting==="desc"?r>s&&(i=o):r<s&&(i=o)}this._insertAt(n,r,i)},e.prototype.remove=function(n){for(var r=this._queue.length;r--;)if(n===this._queue[r]){this._queue.splice(r,1),this._priorities.splice(r,1);break}},e.prototype.forEach=function(n){this._queue.forEach(n)},e.prototype.getElements=function(){return this._queue},e.prototype.getElementPriority=function(n){return this._priorities[n]},e.prototype.getPriorities=function(){return this._priorities},e.prototype.getElementsWithPriorities=function(){for(var n=[],r=0,i=this._queue.length;r<i;r++)n.push([this._queue[r],this._priorities[r]]);return n},e.prototype._init=function(n,r,i){if(n&&r){if(this._queue=[],this._priorities=[],n.length!==r.length)throw new Error("Arrays must have the same length");for(var o=0;o<n.length;o++)this.insert(n[o],r[o])}i&&(this._sorting=i)},e.prototype._insertAt=function(n,r,i){this._queue.length===i?(this._queue.push(n),this._priorities.push(r)):(this._queue.splice(i,0,n),this._priorities.splice(i,0,r))},t.exports&&(t.exports=e)}),Qd=Dr(function(t){if(t.exports)var e=lp;function n(r,i,o,s){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,i,o,s)}n.prototype.run=function(r,i,o,s){this._init(r,i,o,s);for(var a=0,u=this.dataset.length;a<u;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var l=this.clusters.length-1;this._orderedList.push(a);var h=new e(null,null,"asc"),c=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,c,h),this._expandCluster(l,h))}return this.clusters},n.prototype.getReachabilityPlot=function(){for(var r=[],i=0,o=this._orderedList.length;i<o;i++){var s=this._orderedList[i],a=this._reachability[s];r.push([s,a])}return r},n.prototype._init=function(r,i,o,s){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}i&&(this.epsilon=i),o&&(this.minPts=o),s&&(this.distance=s)},n.prototype._updateQueue=function(r,i,o){var s=this;this._coreDistance=this._distanceToCore(r),i.forEach(function(a){if(s._processed[a]===void 0){var u=s.distance(s.dataset[r],s.dataset[a]),l=Math.max(s._coreDistance,u);s._reachability[a]===void 0?(s._reachability[a]=l,o.insert(a,l)):l<s._reachability[a]&&(s._reachability[a]=l,o.remove(a),o.insert(a,l))}})},n.prototype._expandCluster=function(r,i){for(var o=i.getElements(),s=0,a=o.length;s<a;s++){var u=o[s];if(this._processed[u]===void 0){var l=this._regionQuery(u);this._processed[u]=1,this.clusters[r].push(u),this._orderedList.push(u),this._distanceToCore(u)!==void 0&&(this._updateQueue(u,l,i),this._expandCluster(r,i))}}},n.prototype._distanceToCore=function(r){for(var i=this.epsilon,o=0;o<i;o++)if(this._regionQuery(r,o).length>=this.minPts)return o},n.prototype._regionQuery=function(r,i){i=i||this.epsilon;for(var o=[],s=0,a=this.dataset.length;s<a;s++)this.distance(this.dataset[r],this.dataset[s])<i&&o.push(s);return o},n.prototype._euclideanDistance=function(r,i){for(var o=0,s=Math.min(r.length,i.length);s--;)o+=(r[s]-i[s])*(r[s]-i[s]);return Math.sqrt(o)},t.exports&&(t.exports=n)}),$d=Dr(function(t){t.exports&&(t.exports={DBSCAN:Zd,KMEANS:Kd,OPTICS:Qd,PriorityQueue:lp})}),cp=function(t,e,n){for(var r=t.length,i=0,o=0;o<r;o++){var s=(t[o]||0)-(e[o]||0);i+=s*s}return n?Math.sqrt(i):i},t0=cp,e0=function(t,e,n){var r=Math.abs(t-e);return n?r:r*r},n0=cp,r0=function(t,e){for(var n={},r=[],i=e<<2,o=t.length,s=t[0].length>0;r.length<e&&i-- >0;){var a=t[Math.floor(Math.random()*o)],u=s?a.join("_"):""+a;n[u]||(n[u]=!0,r.push(a))}if(r.length<e)throw new Error("Error initializating clusters");return r},i0=function(t,e){var n=t[0].length?t0:e0,r=[],i=t.length,o=t[0].length>0,s=t[Math.floor(Math.random()*i)];for(o&&s.join("_"),r.push(s);r.length<e;){for(var a=[],u=r.length,l=0,h=[],c=0;c<i;c++){for(var p=1/0,d=0;d<u;d++){var g=n(t[c],r[d]);g<=p&&(p=g)}a[c]=p}for(var m=0;m<i;m++)l+=a[m];for(var f=0;f<i;f++)h[f]={i:f,v:t[f],pr:a[f]/l,cs:0};h.sort(function(v,x){return v.pr-x.pr}),h[0].cs=h[0].pr;for(var _=1;_<i;_++)h[_].cs=h[_-1].cs+h[_].pr;for(var I=Math.random(),y=0;y<i-1&&h[y++].cs<I;);r.push(h[y-1].v)}return r};function hp(t,e,n){n=n||[];for(var r=0;r<t;r++)n[r]=e;return n}var o0=function(t,e,n,r){var i=[],o=[],s=[],a=[],u=!1,l=r||1e4,h=t.length,c=t[0].length,p=c>0,d=[];if(n)i=n=="kmrand"?r0(t,e):n=="kmpp"?i0(t,e):n;else for(var g={};i.length<e;){var m=Math.floor(Math.random()*h);g[m]||(g[m]=!0,i.push(t[m]))}do{hp(e,0,d);for(var f=0;f<h;f++){for(var _=1/0,I=0,y=0;y<e;y++)(a=p?n0(t[f],i[y]):Math.abs(t[f]-i[y]))<=_&&(_=a,I=y);s[f]=I,d[I]++}for(var v=[],x=(o=[],0);x<e;x++)v[x]=p?hp(c,0,v[x]):0,o[x]=i[x];if(p){for(var b=0;b<e;b++)i[b]=[];for(var E=0;E<h;E++)for(var T=v[s[E]],C=t[E],D=0;D<c;D++)T[D]+=C[D];u=!0;for(var M=0;M<e;M++){for(var B=i[M],O=v[M],R=o[M],P=d[M],F=0;F<c;F++)B[F]=O[F]/P||0;if(u){for(var k=0;k<c;k++)if(R[k]!=B[k]){u=!1;break}}}}else{for(var q=0;q<h;q++)v[s[q]]+=t[q];for(var S=0;S<e;S++)i[S]=v[S]/d[S]||0;u=!0;for(var V=0;V<e;V++)if(o[V]!=i[V]){u=!1;break}}u=u||--l<=0}while(!u);return{it:1e4-l,k:e,idxs:s,centroids:i}};function s0(t,e){return Gi(Vi(t[0],t[1]))===Gi(Vi(e[0],e[1]))}function pp(t,e){if(t.geometry&&t.geometry.type)return t.geometry.type;if(t.type)return t.type;throw new Error("Invalid GeoJSON object for "+e)}function fp(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}var Ea={search:function(t,e,n,r){t.cleanDirty();var i=(r=r||{}).heuristic||Ea.heuristics.manhattan,o=r.closest||!1,s=new gp(function(m){return m.f}),a=e;for(e.h=i(e,n),s.push(e);s.size()>0;){var u=s.pop();if(u===n)return fp(u);u.closed=!0;for(var l=t.neighbors(u),h=0,c=l.length;h<c;++h){var p=l[h];if(!p.closed&&!p.isWall()){var d=u.g+p.getCost(u),g=p.visited;(!g||d<p.g)&&(p.visited=!0,p.parent=u,p.h=p.h||i(p,n),p.g=d,p.f=p.g+p.h,t.markDirty(p),o&&(p.h<a.h||p.h===a.h&&p.g<a.g)&&(a=p),g?s.rescoreElement(p):s.push(p))}}}return o?fp(a):[]},heuristics:{manhattan:function(t,e){return Math.abs(e.x-t.x)+Math.abs(e.y-t.y)},diagonal:function(t,e){var n=Math.sqrt(2),r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return 1*(r+i)+(n-2)*Math.min(r,i)}},cleanNode:function(t){t.f=0,t.g=0,t.h=0,t.visited=!1,t.closed=!1,t.parent=null}};function Eo(t,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var n=0;n<t.length;n++){this.grid[n]=[];for(var r=0,i=t[n];r<i.length;r++){var o=new ba(n,r,i[r]);this.grid[n][r]=o,this.nodes.push(o)}}this.init()}function ba(t,e,n){this.x=t,this.y=e,this.weight=n}function gp(t){this.content=[],this.scoreFunction=t}function a0(t,e){for(var n=0;n<e.features.length;n++)if(le(t,e.features[n]))return!0;return!1}function dp(t){return function(){return t}}function u0(t){return t[0]}function l0(t){return t[1]}function wa(){this._=null}function Ia(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function ys(t,e){var n=e,r=e.R,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.R=r.L,n.R&&(n.R.U=n),r.L=n}function ms(t,e){var n=e,r=e.L,i=n.U;i?i.L===n?i.L=r:i.R=r:t._=r,r.U=i,n.U=r,n.L=r.R,n.L&&(n.L.U=n),r.R=n}function yp(t){for(;t.L;)t=t.L;return t}function vs(t,e,n,r){var i=[null,null],o=mn.push(i)-1;return i.left=t,i.right=e,n&&Sa(i,t,e,n),r&&Sa(i,e,t,r),jn[t.index].halfedges.push(o),jn[e.index].halfedges.push(o),i}function _s(t,e,n){var r=[e,n];return r.left=t,r}function Sa(t,e,n,r){t[0]||t[1]?t.left===n?t[1]=r:t[0]=r:(t[0]=r,t.left=e,t.right=n)}function c0(t,e,n,r,i){var o,s=t[0],a=t[1],u=s[0],l=s[1],h=0,c=1,p=a[0]-u,d=a[1]-l;if(o=e-u,p||!(o>0)){if(o/=p,p<0){if(o<h)return;o<c&&(c=o)}else if(p>0){if(o>c)return;o>h&&(h=o)}if(o=r-u,p||!(o<0)){if(o/=p,p<0){if(o>c)return;o>h&&(h=o)}else if(p>0){if(o<h)return;o<c&&(c=o)}if(o=n-l,d||!(o>0)){if(o/=d,d<0){if(o<h)return;o<c&&(c=o)}else if(d>0){if(o>c)return;o>h&&(h=o)}if(o=i-l,d||!(o<0)){if(o/=d,d<0){if(o>c)return;o>h&&(h=o)}else if(d>0){if(o<h)return;o<c&&(c=o)}return!(h>0||c<1)||(h>0&&(t[0]=[u+h*p,l+h*d]),c<1&&(t[1]=[u+c*p,l+c*d]),!0)}}}}}function h0(t,e,n,r,i){var o=t[1];if(o)return!0;var s,a,u=t[0],l=t.left,h=t.right,c=l[0],p=l[1],d=h[0],g=h[1],m=(c+d)/2,f=(p+g)/2;if(g===p){if(m<e||m>=r)return;if(c>d){if(u){if(u[1]>=i)return}else u=[m,n];o=[m,i]}else{if(u){if(u[1]<n)return}else u=[m,i];o=[m,n]}}else if(a=f-(s=(c-d)/(g-p))*m,s<-1||s>1)if(c>d){if(u){if(u[1]>=i)return}else u=[(n-a)/s,n];o=[(i-a)/s,i]}else{if(u){if(u[1]<n)return}else u=[(i-a)/s,i];o=[(n-a)/s,n]}else if(p<g){if(u){if(u[0]>=r)return}else u=[e,s*e+a];o=[r,s*r+a]}else{if(u){if(u[0]<e)return}else u=[r,s*r+a];o=[e,s*e+a]}return t[0]=u,t[1]=o,!0}function p0(t,e){var n=t.site,r=e.left,i=e.right;return n===i&&(i=r,r=n),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(n===r?(r=e[1],i=e[0]):(r=e[0],i=e[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function mp(t,e){return e[+(e.left!==t.site)]}function f0(t,e){return e[+(e.left===t.site)]}Eo.prototype.init=function(){this.dirtyNodes=[];for(var t=0;t<this.nodes.length;t++)Ea.cleanNode(this.nodes[t])},Eo.prototype.cleanDirty=function(){for(var t=0;t<this.dirtyNodes.length;t++)Ea.cleanNode(this.dirtyNodes[t]);this.dirtyNodes=[]},Eo.prototype.markDirty=function(t){this.dirtyNodes.push(t)},Eo.prototype.neighbors=function(t){var e=[],n=t.x,r=t.y,i=this.grid;return i[n-1]&&i[n-1][r]&&e.push(i[n-1][r]),i[n+1]&&i[n+1][r]&&e.push(i[n+1][r]),i[n]&&i[n][r-1]&&e.push(i[n][r-1]),i[n]&&i[n][r+1]&&e.push(i[n][r+1]),this.diagonal&&(i[n-1]&&i[n-1][r-1]&&e.push(i[n-1][r-1]),i[n+1]&&i[n+1][r-1]&&e.push(i[n+1][r-1]),i[n-1]&&i[n-1][r+1]&&e.push(i[n-1][r+1]),i[n+1]&&i[n+1][r+1]&&e.push(i[n+1][r+1])),e},Eo.prototype.toString=function(){for(var t,e,n,r,i=[],o=this.grid,s=0,a=o.length;s<a;s++){for(t=[],n=0,r=(e=o[s]).length;n<r;n++)t.push(e[n].weight);i.push(t.join(" "))}return i.join(`
| `)},ba.prototype.toString=function(){return"["+this.x+" "+this.y+"]"},ba.prototype.getCost=function(t){return t&&t.x!==this.x&&t.y!==this.y?1.41421*this.weight:this.weight},ba.prototype.isWall=function(){return this.weight===0},gp.prototype={push:function(t){this.content.push(t),this.sinkDown(this.content.length-1)},pop:function(){var t=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)<this.scoreFunction(t)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(t){this.sinkDown(this.content.indexOf(t))},sinkDown:function(t){for(var e=this.content[t];t>0;){var n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)<this.scoreFunction(r)))break;this.content[n]=e,this.content[t]=r,t=n}},bubbleUp:function(t){for(var e=this.content.length,n=this.content[t],r=this.scoreFunction(n);;){var i,o=t+1<<1,s=o-1,a=null;if(s<e){var u=this.content[s];(i=this.scoreFunction(u))<r&&(a=s)}if(o<e){var l=this.content[o];this.scoreFunction(l)<(a===null?r:i)&&(a=o)}if(a===null)break;this.content[t]=this.content[a],this.content[a]=n,t=a}}},wa.prototype={constructor:wa,insert:function(t,e){var n,r,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=yp(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(r=n.U).L?(i=r.R)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.R&&(ys(this,n),n=(t=n).U),n.C=!1,r.C=!0,ms(this,r)):(i=r.L)&&i.C?(n.C=i.C=!1,r.C=!0,t=r):(t===n.L&&(ms(this,n),n=(t=n).U),n.C=!1,r.C=!0,ys(this,r)),n=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,n,r,i=t.U,o=t.L,s=t.R;if(n=o?s?yp(s):o:s,i?i.L===t?i.L=n:i.R=n:this._=n,o&&s?(r=n.C,n.C=t.C,n.L=o,o.U=n,n!==s?(i=n.U,n.U=t.U,t=n.R,i.L=t,n.R=s,s.U=n):(n.U=i,i=n,t=n.R)):(r=t.C,t=n),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,ys(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,ms(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,ys(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,ms(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,ys(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,ms(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var al,vp=[];function g0(){Ia(this),this.x=this.y=this.arc=this.site=this.cy=null}function bo(t){var e=t.P,n=t.N;if(e&&n){var r=e.site,i=t.site,o=n.site;if(r!==o){var s=i[0],a=i[1],u=r[0]-s,l=r[1]-a,h=o[0]-s,c=o[1]-a,p=2*(u*c-l*h);if(!(p>=-_0)){var d=u*u+l*l,g=h*h+c*c,m=(c*d-l*g)/p,f=(u*g-h*d)/p,_=vp.pop()||new g0;_.arc=t,_.site=i,_.x=m+s,_.y=(_.cy=f+a)+Math.sqrt(m*m+f*f),t.circle=_;for(var I=null,y=xs._;y;)if(_.y<y.y||_.y===y.y&&_.x<=y.x){if(!y.L){I=y.P;break}y=y.L}else{if(!y.R){I=y;break}y=y.R}xs.insert(I,_),I||(al=_)}}}}function wo(t){var e=t.circle;e&&(e.P||(al=e.N),xs.remove(e),vp.push(e),Ia(e),t.circle=null)}var _p=[];function d0(){Ia(this),this.edge=this.site=this.circle=null}function xp(t){var e=_p.pop()||new d0;return e.site=t,e}function ul(t){wo(t),Io.remove(t),_p.push(t),Ia(t)}function y0(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,s=t.N,a=[t];ul(t);for(var u=o;u.circle&&Math.abs(n-u.circle.x)<ce&&Math.abs(r-u.circle.cy)<ce;)o=u.P,a.unshift(u),ul(u),u=o;a.unshift(u),wo(u);for(var l=s;l.circle&&Math.abs(n-l.circle.x)<ce&&Math.abs(r-l.circle.cy)<ce;)s=l.N,a.push(l),ul(l),l=s;a.push(l),wo(l);var h,c=a.length;for(h=1;h<c;++h)l=a[h],u=a[h-1],Sa(l.edge,u.site,l.site,i);u=a[0],(l=a[c-1]).edge=vs(u.site,l.site,null,i),bo(u),bo(l)}function m0(t){for(var e,n,r,i,o=t[0],s=t[1],a=Io._;a;)if((r=Ep(a,s)-o)>ce)a=a.L;else{if(!((i=o-v0(a,s))>ce)){r>-ce?(e=a.P,n=a):i>-ce?(e=a,n=a.N):e=n=a;break}if(!a.R){e=a;break}a=a.R}(function(x){jn[x.index]={site:x,halfedges:[]}})(t);var u=xp(t);if(Io.insert(e,u),e||n){if(e===n)return wo(e),n=xp(e.site),Io.insert(u,n),u.edge=n.edge=vs(e.site,u.site),bo(e),void bo(n);if(n){wo(e),wo(n);var l=e.site,h=l[0],c=l[1],p=t[0]-h,d=t[1]-c,g=n.site,m=g[0]-h,f=g[1]-c,_=2*(p*f-d*m),I=p*p+d*d,y=m*m+f*f,v=[(f*I-d*y)/_+h,(p*y-m*I)/_+c];Sa(n.edge,l,g,v),u.edge=vs(l,t,null,v),n.edge=vs(t,g,null,v),bo(e),bo(n)}else u.edge=vs(e.site,u.site)}}function Ep(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var s=t.P;if(!s)return-1/0;var a=(n=s.site)[0],u=n[1],l=u-e;if(!l)return a;var h=a-r,c=1/o-1/l,p=h/l;return c?(-p+Math.sqrt(p*p-2*c*(h*h/(-2*l)-u+l/2+i-o/2)))/c+r:(r+a)/2}function v0(t,e){var n=t.N;if(n)return Ep(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var Io,jn,xs,mn,ce=1e-6,_0=1e-12;function x0(t,e){return e[1]-t[1]||e[0]-t[0]}function ll(t,e){var n,r,i,o=t.sort(x0).pop();for(mn=[],jn=new Array(t.length),Io=new wa,xs=new wa;;)if(i=al,o&&(!i||o[1]<i.y||o[1]===i.y&&o[0]<i.x))o[0]===n&&o[1]===r||(m0(o),n=o[0],r=o[1]),o=t.pop();else{if(!i)break;y0(i.arc)}if(function(){for(var h,c,p,d,g=0,m=jn.length;g<m;++g)if((h=jn[g])&&(d=(c=h.halfedges).length)){var f=new Array(d),_=new Array(d);for(p=0;p<d;++p)f[p]=p,_[p]=p0(h,mn[c[p]]);for(f.sort(function(I,y){return _[y]-_[I]}),p=0;p<d;++p)_[p]=c[f[p]];for(p=0;p<d;++p)c[p]=_[p]}}(),e){var s=+e[0][0],a=+e[0][1],u=+e[1][0],l=+e[1][1];(function(h,c,p,d){for(var g,m=mn.length;m--;)h0(g=mn[m],h,c,p,d)&&c0(g,h,c,p,d)&&(Math.abs(g[0][0]-g[1][0])>ce||Math.abs(g[0][1]-g[1][1])>ce)||delete mn[m]})(s,a,u,l),function(h,c,p,d){var g,m,f,_,I,y,v,x,b,E,T,C,D=jn.length,M=!0;for(g=0;g<D;++g)if(m=jn[g]){for(f=m.site,_=(I=m.halfedges).length;_--;)mn[I[_]]||I.splice(_,1);for(_=0,y=I.length;_<y;)T=(E=f0(m,mn[I[_]]))[0],C=E[1],x=(v=mp(m,mn[I[++_%y]]))[0],b=v[1],(Math.abs(T-x)>ce||Math.abs(C-b)>ce)&&(I.splice(_,0,mn.push(_s(f,E,Math.abs(T-h)<ce&&d-C>ce?[h,Math.abs(x-h)<ce?b:d]:Math.abs(C-d)<ce&&p-T>ce?[Math.abs(b-d)<ce?x:p,d]:Math.abs(T-p)<ce&&C-c>ce?[p,Math.abs(x-p)<ce?b:c]:Math.abs(C-c)<ce&&T-h>ce?[Math.abs(b-c)<ce?x:h,c]:null))-1),++y);y&&(M=!1)}if(M){var B,O,R,P=1/0;for(g=0,M=null;g<D;++g)(m=jn[g])&&(R=(B=(f=m.site)[0]-h)*B+(O=f[1]-c)*O)<P&&(P=R,M=m);if(M){var F=[h,c],k=[h,d],q=[p,d],S=[p,c];M.halfedges.push(mn.push(_s(f=M.site,F,k))-1,mn.push(_s(f,k,q))-1,mn.push(_s(f,q,S))-1,mn.push(_s(f,S,F))-1)}}for(g=0;g<D;++g)(m=jn[g])&&(m.halfedges.length||delete jn[g])}(s,a,u,l)}this.edges=mn,this.cells=jn,Io=xs=mn=jn=null}function E0(t){return(t=t.slice()).push(t[0]),ct([t])}function bp(t,e,n,r){var i=(r=r||{}).steps||64,o=r.units||"kilometers",s=r.angle||0,a=r.pivot||t,u=r.properties||t.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!n)throw new Error("ySemiAxis is required");if(!Qt(r))throw new Error("options must be an object");if(!Ge(i))throw new Error("steps must be a number");if(!Ge(s))throw new Error("angle must be a number");var l=re(t);if(o==="degrees")var h=ke(s);else e=xo(t,e,90,{units:o}),n=xo(t,n,0,{units:o}),e=re(e)[0]-l[0],n=re(n)[1]-l[1];for(var c=[],p=0;p<i;p+=1){var d=-360*p/i,g=e*n/Math.sqrt(Math.pow(n,2)+Math.pow(e,2)*Math.pow(wp(d),2)),m=e*n/Math.sqrt(Math.pow(e,2)+Math.pow(n,2)/Math.pow(wp(d),2));if(d<-90&&d>=-270&&(g=-g),d<-180&&d>=-360&&(m=-m),o==="degrees"){var f=g*Math.cos(h)+m*Math.sin(h),_=m*Math.cos(h)-g*Math.sin(h);g=f,m=_}c.push([g+l[0],m+l[1]])}return c.push(c[0]),o==="degrees"?ct([c],u):Uh(ct([c],u),s,{pivot:a})}function wp(t){var e=t*Math.PI/180;return Math.tan(e)}function cl(t,e){e===void 0&&(e={});var n=0,r=0,i=0;return zn(t,function(o,s,a){var u=e.weight?a?.[e.weight]:void 0;if(!Ge(u=u??1))throw new Error("weight value must be a number for feature index "+s);(u=Number(u))>0&&Ce(o,function(l){n+=l[0]*u,r+=l[1]*u,i+=u})}),ft([n/i,r/i],e.properties,e)}function Ip(t,e,n,r,i){var o=r.tolerance||.001,s=0,a=0,u=0,l=0;if(Zt(n,function(p){var d,g=(d=p.properties)===null||d===void 0?void 0:d.weight,m=g??1;if(!Ge(m=Number(m)))throw new Error("weight value must be a number");if(m>0){l+=1;var f=m*$t(p,t);f===0&&(f=1);var _=m/f;s+=p.geometry.coordinates[0]*_,a+=p.geometry.coordinates[1]*_,u+=_}}),l<1)throw new Error("no features to measure");var h=s/u,c=a/u;return l===1||i===0||Math.abs(h-e[0])<o&&Math.abs(c-e[1])<o?ft([h,c],{medianCandidates:r.medianCandidates}):(r.medianCandidates.push([h,c]),Ip([h,c],t,n,r,i-1))}function Sp(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}function b0(t,e){var n=0,r=0;Ce(t,function(i,o,s,a,u){u>n&&(n=u,r=o,e.push([]));var l=o-r,h=t.coordinates[u][l+1],c=i[0],p=i[1],d=h[0],g=h[1];e[u].push([.75*c+.25*d,.75*p+.25*g]),e[u].push([.25*c+.75*d,.25*p+.75*g])},!0),e.forEach(function(i){i.push(i[0])})}function w0(t,e){var n=0,r=0,i=0;Ce(t,function(o,s,a,u,l){u>i&&(i=u,r=s,e.push([[]])),l>n&&(n=l,r=s,e[u].push([]));var h=s-r,c=t.coordinates[u][l][h+1],p=o[0],d=o[1],g=c[0],m=c[1];e[u][l].push([.75*p+.25*g,.75*d+.25*m]),e[u][l].push([.25*p+.75*g,.25*d+.75*m])},!0),e.forEach(function(o){o.forEach(function(s){s.push(s[0])})})}function I0(t,e,n){n===void 0&&(n=2);var r=re(t),i=re(e),o=r[0]-i[0],s=r[1]-i[1];return n===1?Math.abs(o)+Math.abs(s):Math.pow(Math.pow(o,n)+Math.pow(s,n),1/n)}function Cp(t,e){var n=(e=e||{}).threshold||1e4,r=e.p||2,i=e.binary||!1,o=e.alpha||-1,s=e.standardization||!1,a=[];Zt(t,function(d){a.push(_i(d))});for(var u=[],l=0;l<a.length;l++)u[l]=[];for(l=0;l<a.length;l++)for(var h=l;h<a.length;h++){l===h&&(u[l][h]=0);var c=I0(a[l],a[h],r);u[l][h]=c,u[h][l]=c}for(l=0;l<a.length;l++)for(h=0;h<a.length;h++)(c=u[l][h])!==0&&(u[l][h]=i?c<=n?1:0:c<=n?Math.pow(c,o):0);if(s)for(l=0;l<a.length;l++){var p=u[l].reduce(function(d,g){return d+g},0);for(h=0;h<a.length;h++)u[l][h]=u[l][h]/p}return u}function Np(t){for(var e=0,n=0,r=t;n<r.length;n++)e+=r[n];return e/t.length}function Pp(t,e){return e===void 0&&(e={}),Lp(t,"mercator",e)}function Mp(t,e){return e===void 0&&(e={}),Lp(t,"wgs84",e)}function Lp(t,e,n){n===void 0&&(n={});var r=(n=n||{}).mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&Ge(t[0])?t=e==="mercator"?Op(t):Rp(t):(r!==!0&&(t=Ye(t)),Ce(t,function(i){var o=e==="mercator"?Op(i):Rp(i);i[0]=o[0],i[1]=o[1]})),t}function Op(t){var e=Math.PI/180,n=6378137,r=20037508342789244e-9,i=[n*(Math.abs(t[0])<=180?t[0]:t[0]-360*function(o){return o<0?-1:o>0?1:0}(t[0]))*e,n*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function Rp(t){var e=180/Math.PI,n=6378137;return[t[0]*e/n,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/n)))*e]}ll.prototype={constructor:ll,polygons:function(){var t=this.edges;return this.cells.map(function(e){var n=e.halfedges.map(function(r){return mp(e,t[r])});return n.data=e.site.data,n})},triangles:function(){var t=[],e=this.edges;return this.cells.forEach(function(n,r){if(o=(i=n.halfedges).length)for(var i,o,s,a,u,l,h=n.site,c=-1,p=e[i[o-1]],d=p.left===h?p.right:p.left;++c<o;)s=d,d=(p=e[i[c]]).left===h?p.right:p.left,s&&d&&r<s.index&&r<d.index&&(u=s,l=d,((a=h)[0]-l[0])*(u[1]-a[1])-(a[0]-u[0])*(l[1]-a[1])<0)&&t.push([h.data,s.data,d.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,e,n){for(var r,i,o=this,s=o._found||0,a=o.cells.length;!(i=o.cells[s]);)if(++s>=a)return null;var u=t-i.site[0],l=e-i.site[1],h=u*u+l*l;do i=o.cells[r=s],s=null,i.halfedges.forEach(function(c){var p=o.edges[c],d=p.left;if(d!==i.site&&d||(d=p.right)){var g=t-d[0],m=e-d[1],f=g*g+m*m;f<h&&(h=f,s=d.index)}});while(s!==null);return o._found=r,n==null||h<=n*n?i.site:null}};var S0=Object.freeze({__proto__:null,toMercator:Pp,toWgs84:Mp});function Es(t){return Array.isArray(t)?kp(t):t&&t.bbox?kp(t.bbox):[360*Fp(),180*Fp()]}function Tp(t,e){e===void 0&&(e={}),t==null&&(t=1);for(var n=[],r=0;r<t;r++)n.push(ft(Es(e.bbox)));return nt(n)}function Ap(t,e){e===void 0&&(e={}),t==null&&(t=1),Ge(e.num_vertices)&&e.num_vertices!==void 0||(e.num_vertices=10),Ge(e.max_radial_length)&&e.max_radial_length!==void 0||(e.max_radial_length=10);for(var n=[],r=function(o){var s,a=[],u=Array.apply(null,new Array(e.num_vertices+1)).map(Math.random);u.forEach(function(l,h,c){c[h]=h>0?l+c[h-1]:l}),u.forEach(function(l){l=2*l*Math.PI/u[u.length-1];var h=Math.random();a.push([h*(e.max_radial_length||10)*Math.sin(l),h*(e.max_radial_length||10)*Math.cos(l)])}),a[a.length-1]=a[0],a=a.map((s=Es(e.bbox),function(l){return[l[0]+s[0],l[1]+s[1]]})),n.push(ct([a]))},i=0;i<t;i++)r();return nt(n)}function Dp(t,e){if(e===void 0&&(e={}),!Qt(e=e||{}))throw new Error("options is invalid");var n=e.bbox,r=e.num_vertices,i=e.max_length,o=e.max_rotation;t==null&&(t=1),(!Ge(r)||r===void 0||r<2)&&(r=10),Ge(i)&&i!==void 0||(i=1e-4),Ge(o)&&o!==void 0||(o=Math.PI/8);for(var s=[],a=0;a<t;a++){for(var u=[Es(n)],l=0;l<r-1;l++){var h=(l===0?2*Math.random()*Math.PI:Math.tan((u[l][1]-u[l-1][1])/(u[l][0]-u[l-1][0])))+(Math.random()-.5)*o*2,c=Math.random()*i;u.push([u[l][0]+c*Math.cos(h),u[l][1]+c*Math.sin(h)])}s.push(Wt(u))}return nt(s)}function Fp(){return Math.random()-.5}function kp(t){return[Math.random()*(t[2]-t[0])+t[0],Math.random()*(t[3]-t[1])+t[1]]}var C0=Object.freeze({__proto__:null,randomPosition:Es,randomPoint:Tp,randomPolygon:Ap,randomLineString:Dp});function Gp(t,e){if(!t)throw new Error("geojson is required");if(t.type!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(e==null)throw new Error("filter is required");var n=[];return Zt(t,function(r){Ca(r.properties,e)&&n.push(r)}),nt(n)}function hl(t,e,n){if(!t)throw new Error("geojson is required");if(t.type!=="FeatureCollection")throw new Error("geojson must be a FeatureCollection");if(e==null)throw new Error("property is required");for(var r=pl(t,e),i=Object.keys(r),o=0;o<i.length;o++){for(var s=i[o],a=r[s],u=[],l=0;l<a.length;l++)u.push(t.features[a[l]]);n(nt(u),s,o)}}function qp(t,e,n,r){var i=r;return hl(t,e,function(o,s,a){i=a===0&&r===void 0?o:n(i,o,s,a)}),i}function pl(t,e){var n={};return Zt(t,function(r,i){var o=r.properties||{};if(o.hasOwnProperty(String(e))){var s=o[e];n.hasOwnProperty(s)?n[s].push(i):n[s]=[i]}}),n}function Ca(t,e){if(t===void 0)return!1;var n=typeof e;if(n==="number"||n==="string")return t.hasOwnProperty(e);if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(!Ca(t,e[r]))return!1;return!0}return fl(t,e)}function fl(t,e){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r];if(t[i]!==e[i])return!1}return!0}function Bp(t,e){if(!e)return{};if(!e.length)return{};for(var n={},r=0;r<e.length;r++){var i=e[r];t.hasOwnProperty(i)&&(n[i]=t[i])}return n}var N0=Object.freeze({__proto__:null,getCluster:Gp,clusterEach:hl,clusterReduce:qp,createBins:pl,applyFilter:Ca,propertiesContainsFilter:fl,filterProperties:Bp}),xi=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};/**
| * splaytree v3.1.0
| * Fast Splay tree for Node and browser
| *
| * @author Alexander Milevski <info@w8r.name>
| * @license MIT
| * @preserve
| */function P0(t,e){return t>e?1:t<e?-1:0}function Ei(t,e,n){for(var r=new xi(null,null),i=r,o=r;;){var s=n(t,e.key);if(s<0){if(e.left===null)break;if(n(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,(e=a).left===null)break}o.left=e,o=e,e=e.left}else{if(!(s>0)||e.right===null||n(t,e.right.key)>0&&(a=e.right,e.right=a.left,a.left=e,(e=a).right===null))break;i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function gl(t,e,n,r){var i=new xi(t,e);if(n===null)return i.left=i.right=null,i;var o=r(t,(n=Ei(t,n,r)).key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function zp(t,e,n){var r=null,i=null;if(e){var o=n((e=Ei(t,e,n)).key,t);o===0?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function dl(t,e,n,r,i){if(t){r(e+(n?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+i(t)+`
| `);var o=e+(n?" ":"\u2502 ");t.left&&dl(t.left,o,!1,r,i),t.right&&dl(t.right,o,!0,r,i)}}var yl=function(){function t(e){e===void 0&&(e=P0),this._root=null,this._size=0,this._comparator=e}return t.prototype.insert=function(e,n){return this._size++,this._root=gl(e,n,this._root,this._comparator)},t.prototype.add=function(e,n){var r=new xi(e,n);this._root===null&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,o=Ei(e,this._root,i),s=i(e,o.key);return s===0?this._root=o:(s<0?(r.left=o.left,r.right=o,o.left=null):s>0&&(r.right=o.right,r.left=o,o.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},t.prototype._remove=function(e,n,r){var i;return n===null?null:r(e,(n=Ei(e,n,r)).key)===0?(n.left===null?i=n.right:(i=Ei(e,n.left,r)).right=n.right,this._size--,i):n},t.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=Ei(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},t.prototype.findStatic=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return n;n=i<0?n.left:n.right}return null},t.prototype.find=function(e){return this._root&&(this._root=Ei(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},t.prototype.contains=function(e){for(var n=this._root,r=this._comparator;n;){var i=r(e,n.key);if(i===0)return!0;n=i<0?n.left:n.right}return!1},t.prototype.forEach=function(e,n){for(var r=this._root,i=[],o=!1;!o;)r!==null?(i.push(r),r=r.left):i.length!==0?(r=i.pop(),e.call(n,r),r=r.right):o=!0;return this},t.prototype.range=function(e,n,r,i){for(var o=[],s=this._comparator,a=this._root;o.length!==0||a;)if(a)o.push(a),a=a.left;else{if(s((a=o.pop()).key,n)>0)break;if(s(a.key,e)>=0&&r.call(i,a))return this;a=a.right}return this},t.prototype.keys=function(){var e=[];return this.forEach(function(n){var r=n.key;return e.push(r)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(n){var r=n.data;return e.push(r)}),e},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},t.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},t.prototype.at=function(e){for(var n=this._root,r=!1,i=0,o=[];!r;)if(n)o.push(n),n=n.left;else if(o.length>0){if(n=o.pop(),i===e)return n;i++,n=n.right}else r=!0;return null},t.prototype.next=function(e){var n=this._root,r=null;if(e.right){for(r=e.right;r.left;)r=r.left;return r}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?(r=n,n=n.left):n=n.right}return r},t.prototype.prev=function(e){var n=this._root,r=null;if(e.left!==null){for(r=e.left;r.right;)r=r.right;return r}for(var i=this._comparator;n;){var o=i(e.key,n.key);if(o===0)break;o<0?n=n.left:(r=n,n=n.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(e){for(var n=e,r=[],i=!1,o=new xi(null,null),s=o;!i;)n?(r.push(n),n=n.left):r.length>0?n=(n=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}(this._root)},t.prototype.load=function(e,n,r){n===void 0&&(n=[]),r===void 0&&(r=!1);var i=e.length,o=this._comparator;if(r&&_l(e,n,0,i-1,o),this._root===null)this._root=ml(e,n,0,i),this._size=i;else{var s=function(a,u,l){for(var h=new xi(null,null),c=h,p=a,d=u;p!==null&&d!==null;)l(p.key,d.key)<0?(c.next=p,p=p.next):(c.next=d,d=d.next),c=c.next;return p!==null?c.next=p:d!==null&&(c.next=d),h.next}(this.toList(),function(a,u){for(var l=new xi(null,null),h=l,c=0;c<a.length;c++)h=h.next=new xi(a[c],u[c]);return h.next=null,l.next}(e,n),o);i=this._size+i,this._root=vl({head:s},0,i)}return this},t.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(e){e===void 0&&(e=function(r){return String(r.key)});var n=[];return dl(this._root,"",!0,function(r){return n.push(r)},e),n.join("")},t.prototype.update=function(e,n,r){var i=this._comparator,o=zp(e,this._root,i),s=o.left,a=o.right;i(e,n)<0?a=gl(n,r,a,i):s=gl(n,r,s,i),this._root=function(u,l,h){return l===null?u:(u===null||((l=Ei(u.key,l,h)).left=u),l)}(s,a,i)},t.prototype.split=function(e){return zp(e,this._root,this._comparator)},t}();function ml(t,e,n,r){var i=r-n;if(i>0){var o=n+Math.floor(i/2),s=t[o],a=e[o],u=new xi(s,a);return u.left=ml(t,e,n,o),u.right=ml(t,e,o+1,r),u}return null}function vl(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=vl(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=vl(t,i+1,n),s}return null}function _l(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do s++;while(i(t[s],o)<0);do a--;while(i(t[a],o)>0);if(s>=a)break;var u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}_l(t,e,n,a,i),_l(t,e,a+1,r,i)}}function er(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jp(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function In(t,e,n){return e&&jp(t.prototype,e),n&&jp(t,n),t}var bs=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},xl=function(t,e){if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;var n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},bi=Number.EPSILON;bi===void 0&&(bi=Math.pow(2,-52));var M0=bi*bi,El=function(t,e){if(-bi<t&&t<bi&&-bi<e&&e<bi)return 0;var n=t-e;return n*n<M0*t*e?0:t<e?-1:1},L0=function(){function t(){er(this,t),this.reset()}return In(t,[{key:"reset",value:function(){this.xRounder=new Up,this.yRounder=new Up}},{key:"round",value:function(e,n){return{x:this.xRounder.round(e),y:this.yRounder.round(n)}}}]),t}(),Up=function(){function t(){er(this,t),this.tree=new yl,this.round(0)}return In(t,[{key:"round",value:function(e){var n=this.tree.add(e),r=this.tree.prev(n);if(r!==null&&El(n.key,r.key)===0)return this.tree.remove(e),r.key;var i=this.tree.next(n);return i!==null&&El(n.key,i.key)===0?(this.tree.remove(e),i.key):e}}]),t}(),ws=new L0,Is=function(t,e){return t.x*e.y-t.y*e.x},Vp=function(t,e){return t.x*e.x+t.y*e.y},Xp=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=Is(r,i);return El(o,0)},Na=function(t){return Math.sqrt(Vp(t,t))},O0=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return Vp(i,r)/Na(i)/Na(r)},Yp=function(t,e,n){return e.y===0?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},Hp=function(t,e,n){return e.x===0?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},qr=function(){function t(e,n){er(this,t),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return In(t,null,[{key:"compare",value:function(e,n){var r=t.comparePoints(e.point,n.point);return r!==0?r:(e.point!==n.point&&e.link(n),e.isLeft!==n.isLeft?e.isLeft?1:-1:Pa.compare(e.segment,n.segment))}},{key:"comparePoints",value:function(e,n){return e.x<n.x?-1:e.x>n.x?1:e.y<n.y?-1:e.y>n.y?1:0}}]),In(t,[{key:"link",value:function(e){if(e.point===this.point)throw new Error("Tried to link already linked events");for(var n=e.point.events,r=0,i=n.length;r<i;r++){var o=n[r];this.point.events.push(o),o.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var e=this.point.events.length,n=0;n<e;n++){var r=this.point.events[n];if(r.segment.consumedBy===void 0)for(var i=n+1;i<e;i++){var o=this.point.events[i];o.consumedBy===void 0&&r.otherSE.point.events===o.otherSE.point.events&&r.segment.consume(o.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var e=[],n=0,r=this.point.events.length;n<r;n++){var i=this.point.events[n];i!==this&&!i.segment.ringOut&&i.segment.isInResult()&&e.push(i)}return e}},{key:"getLeftmostComparator",value:function(e){var n=this,r=new Map,i=function(o){var s,a,u,l,h,c=o.otherSE;r.set(o,{sine:(s=n.point,a=e.point,u=c.point,l={x:a.x-s.x,y:a.y-s.y},h={x:u.x-s.x,y:u.y-s.y},Is(h,l)/Na(h)/Na(l)),cosine:O0(n.point,e.point,c.point)})};return function(o,s){r.has(o)||i(o),r.has(s)||i(s);var a=r.get(o),u=a.sine,l=a.cosine,h=r.get(s),c=h.sine,p=h.cosine;return u>=0&&c>=0?l<p?1:l>p?-1:0:u<0&&c<0?l<p?-1:l>p?1:0:c<u?-1:c>u?1:0}}}]),t}(),R0=0,Pa=function(){function t(e,n,r,i){er(this,t),this.id=++R0,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return In(t,null,[{key:"compare",value:function(e,n){var r=e.leftSE.point.x,i=n.leftSE.point.x,o=e.rightSE.point.x,s=n.rightSE.point.x;if(s<r)return 1;if(o<i)return-1;var a=e.leftSE.point.y,u=n.leftSE.point.y,l=e.rightSE.point.y,h=n.rightSE.point.y;if(r<i){if(u<a&&u<l)return 1;if(u>a&&u>l)return-1;var c=e.comparePoint(n.leftSE.point);if(c<0)return 1;if(c>0)return-1;var p=n.comparePoint(e.rightSE.point);return p!==0?p:-1}if(r>i){if(a<u&&a<h)return-1;if(a>u&&a>h)return 1;var d=n.comparePoint(e.leftSE.point);if(d!==0)return d;var g=e.comparePoint(n.rightSE.point);return g<0?1:g>0?-1:1}if(a<u)return-1;if(a>u)return 1;if(o<s){var m=n.comparePoint(e.rightSE.point);if(m!==0)return m}if(o>s){var f=e.comparePoint(n.rightSE.point);if(f<0)return 1;if(f>0)return-1}if(o!==s){var _=l-a,I=o-r,y=h-u,v=s-i;if(_>I&&y<v)return 1;if(_<I&&y>v)return-1}return o>s?1:o<s||l<h?-1:l>h?1:e.id<n.id?-1:e.id>n.id?1:0}}]),In(t,[{key:"replaceRightSE",value:function(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var e=this.leftSE.point.y,n=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e<n?e:n},ur:{x:this.rightSE.point.x,y:e>n?e:n}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(e){return e.x===this.leftSE.point.x&&e.y===this.leftSE.point.y||e.x===this.rightSE.point.x&&e.y===this.rightSE.point.y}},{key:"comparePoint",value:function(e){if(this.isAnEndpoint(e))return 0;var n=this.leftSE.point,r=this.rightSE.point,i=this.vector();if(n.x===r.x)return e.x===n.x?0:e.x<n.x?1:-1;var o=(e.y-n.y)/i.y,s=n.x+o*i.x;if(e.x===s)return 0;var a=(e.x-n.x)/i.x,u=n.y+a*i.y;return e.y===u?0:e.y<u?-1:1}},{key:"getIntersection",value:function(e){var n=this.bbox(),r=e.bbox(),i=xl(n,r);if(i===null)return null;var o=this.leftSE.point,s=this.rightSE.point,a=e.leftSE.point,u=e.rightSE.point,l=bs(n,a)&&this.comparePoint(a)===0,h=bs(r,o)&&e.comparePoint(o)===0,c=bs(n,u)&&this.comparePoint(u)===0,p=bs(r,s)&&e.comparePoint(s)===0;if(h&&l)return p&&!c?s:!p&&c?u:null;if(h)return c&&o.x===u.x&&o.y===u.y?null:o;if(l)return p&&s.x===a.x&&s.y===a.y?null:a;if(p&&c)return null;if(p)return s;if(c)return u;var d=function(g,m,f,_){if(m.x===0)return Hp(f,_,g.x);if(_.x===0)return Hp(g,m,f.x);if(m.y===0)return Yp(f,_,g.y);if(_.y===0)return Yp(g,m,f.y);var I=Is(m,_);if(I==0)return null;var y={x:f.x-g.x,y:f.y-g.y},v=Is(y,m)/I,x=Is(y,_)/I;return{x:(g.x+x*m.x+(f.x+v*_.x))/2,y:(g.y+x*m.y+(f.y+v*_.y))/2}}(o,this.vector(),a,e.vector());return d===null?null:bs(i,d)?ws.round(d.x,d.y):null}},{key:"split",value:function(e){var n=[],r=e.events!==void 0,i=new qr(e,!0),o=new qr(e,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return qr.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),qr.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var n=0,r=this.windings.length;n<r;n++)this.windings[n]*=-1}},{key:"consume",value:function(e){for(var n=this,r=e;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var i=t.compare(n,r);if(i!==0){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var a=0,u=r.rings.length;a<u;a++){var l=r.rings[a],h=r.windings[a],c=n.rings.indexOf(l);c===-1?(n.rings.push(l),n.windings.push(h)):n.windings[c]+=h}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return this._prevInResult!==void 0||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(this.prev){var e=this.prev.consumedBy||this.prev;this._beforeState=e.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};for(var n=this._afterState.rings,r=this._afterState.windings,i=this._afterState.multiPolys,o=0,s=this.rings.length;o<s;o++){var a=this.rings[o],u=this.windings[o],l=n.indexOf(a);l===-1?(n.push(a),r.push(u)):r[l]+=u}for(var h=[],c=[],p=0,d=n.length;p<d;p++)if(r[p]!==0){var g=n[p],m=g.poly;if(c.indexOf(m)===-1)if(g.isExterior)h.push(m);else{c.indexOf(m)===-1&&c.push(m);var f=h.indexOf(g.poly);f!==-1&&h.splice(f,1)}}for(var _=0,I=h.length;_<I;_++){var y=h[_].multiPoly;i.indexOf(y)===-1&&i.push(y)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var e=this.beforeState().multiPolys,n=this.afterState().multiPolys;switch(Br.type){case"union":var r=e.length===0,i=n.length===0;this._isInResult=r!==i;break;case"intersection":var o,s;e.length<n.length?(o=e.length,s=n.length):(o=n.length,s=e.length),this._isInResult=s===Br.numMultiPolys&&o<s;break;case"xor":var a=Math.abs(e.length-n.length);this._isInResult=a%2==1;break;case"difference":var u=function(l){return l.length===1&&l[0].isSubject};this._isInResult=u(e)!==u(n);break;default:throw new Error("Unrecognized operation type found ".concat(Br.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,n,r){var i,o,s,a=qr.comparePoints(e,n);if(a<0)i=e,o=n,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=n,o=e,s=-1}return new t(new qr(i,!0),new qr(o,!1),[r],[s])}}]),t}(),Wp=function(){function t(e,n,r){if(er(this,t),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=ws.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if(typeof e[s][0]!="number"||typeof e[s][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=ws.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(Pa.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(Pa.fromRing(o,i,this))}return In(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.segments.length;n<r;n++){var i=this.segments[n];e.push(i.leftSE),e.push(i.rightSE)}return e}}]),t}(),T0=function(){function t(e,n){if(er(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Wp(e[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(var r=1,i=e.length;r<i;r++){var o=new Wp(e[r],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=n}return In(t,[{key:"getSweepEvents",value:function(){for(var e=this.exteriorRing.getSweepEvents(),n=0,r=this.interiorRings.length;n<r;n++)for(var i=this.interiorRings[n].getSweepEvents(),o=0,s=i.length;o<s;o++)e.push(i[o]);return e}}]),t}(),Jp=function(){function t(e,n){if(er(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var r=0,i=e.length;r<i;r++){var o=new T0(e[r],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=n}return In(t,[{key:"getSweepEvents",value:function(){for(var e=[],n=0,r=this.polys.length;n<r;n++)for(var i=this.polys[n].getSweepEvents(),o=0,s=i.length;o<s;o++)e.push(i[o]);return e}}]),t}(),A0=function(){function t(e){er(this,t),this.events=e;for(var n=0,r=e.length;n<r;n++)e[n].segment.ringOut=this;this.poly=null}return In(t,null,[{key:"factory",value:function(e){for(var n=[],r=0,i=e.length;r<i;r++){var o=e[r];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],h=a.point,c=[];s=a,a=u,l.push(a),a.point!==h;)for(;;){var p=a.getAvailableLinkedEvents();if(p.length===0){var d=l[0].point,g=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(d.x,",")+" ".concat(d.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(p.length===1){u=p[0].otherSE;break}for(var m=null,f=0,_=c.length;f<_;f++)if(c[f].point===a.point){m=f;break}if(m===null){c.push({index:l.length,point:a.point});var I=a.getLeftmostComparator(s);u=p.sort(I)[0].otherSE;break}var y=c.splice(m)[0],v=l.splice(y.index);v.unshift(v[0].otherSE),n.push(new t(v.reverse()))}n.push(new t(l))}}return n}}]),In(t,[{key:"getGeom",value:function(){for(var e=this.events[0].point,n=[e],r=1,i=this.events.length-1;r<i;r++){var o=this.events[r].point,s=this.events[r+1].point;Xp(o,e,s)!==0&&(n.push(o),e=o)}if(n.length===1)return null;var a=n[0],u=n[1];Xp(a,e,u)===0&&n.shift(),n.push(n[0]);for(var l=this.isExteriorRing()?1:-1,h=this.isExteriorRing()?0:n.length-1,c=this.isExteriorRing()?n.length:-1,p=[],d=h;d!=c;d+=l)p.push([n[d].x,n[d].y]);return p}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var e=this.enclosingRing();this._isExteriorRing=!e||!e.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var e=this.events[0],n=1,r=this.events.length;n<r;n++){var i=this.events[n];qr.compare(e,i)>0&&(e=i)}for(var o=e.segment.prevInResult(),s=o?o.prevInResult():null;;){if(!o)return null;if(!s)return o.ringOut;if(s.ringOut!==o.ringOut)return s.ringOut.enclosingRing()!==o.ringOut?o.ringOut:o.ringOut.enclosingRing();o=s.prevInResult(),s=o?o.prevInResult():null}}}]),t}(),Zp=function(){function t(e){er(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return In(t,[{key:"addInterior",value:function(e){this.interiorRings.push(e),e.poly=this}},{key:"getGeom",value:function(){var e=[this.exteriorRing.getGeom()];if(e[0]===null)return null;for(var n=0,r=this.interiorRings.length;n<r;n++){var i=this.interiorRings[n].getGeom();i!==null&&e.push(i)}return e}}]),t}(),D0=function(){function t(e){er(this,t),this.rings=e,this.polys=this._composePolys(e)}return In(t,[{key:"getGeom",value:function(){for(var e=[],n=0,r=this.polys.length;n<r;n++){var i=this.polys[n].getGeom();i!==null&&e.push(i)}return e}},{key:"_composePolys",value:function(e){for(var n=[],r=0,i=e.length;r<i;r++){var o=e[r];if(!o.poly)if(o.isExteriorRing())n.push(new Zp(o));else{var s=o.enclosingRing();s.poly||n.push(new Zp(s)),s.poly.addInterior(o)}}return n}}]),t}(),F0=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pa.compare;er(this,t),this.queue=e,this.tree=new yl(n),this.segments=[]}return In(t,[{key:"process",value:function(e){var n=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.remove(e.otherSE):this.tree.remove(n),r;var i=e.isLeft?this.tree.insert(n):this.tree.find(n);if(!i)throw new Error("Unable to find segment #".concat(n.id," ")+"[".concat(n.leftSE.point.x,", ").concat(n.leftSE.point.y,"] -> ")+"[".concat(n.rightSE.point.x,", ").concat(n.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var o=i,s=i,a=void 0,u=void 0;a===void 0;)(o=this.tree.prev(o))===null?a=null:o.key.consumedBy===void 0&&(a=o.key);for(;u===void 0;)(s=this.tree.next(s))===null?u=null:s.key.consumedBy===void 0&&(u=s.key);if(e.isLeft){var l=null;if(a){var h=a.getIntersection(n);if(h!==null&&(n.isAnEndpoint(h)||(l=h),!a.isAnEndpoint(h)))for(var c=this._splitSafely(a,h),p=0,d=c.length;p<d;p++)r.push(c[p])}var g=null;if(u){var m=u.getIntersection(n);if(m!==null&&(n.isAnEndpoint(m)||(g=m),!u.isAnEndpoint(m)))for(var f=this._splitSafely(u,m),_=0,I=f.length;_<I;_++)r.push(f[_])}if(l!==null||g!==null){var y=null;l===null?y=g:g===null?y=l:y=qr.comparePoints(l,g)<=0?l:g,this.queue.remove(n.rightSE),r.push(n.rightSE);for(var v=n.split(y),x=0,b=v.length;x<b;x++)r.push(v[x])}r.length>0?(this.tree.remove(n),r.push(e)):(this.segments.push(n),n.prev=a)}else{if(a&&u){var E=a.getIntersection(u);if(E!==null){if(!a.isAnEndpoint(E))for(var T=this._splitSafely(a,E),C=0,D=T.length;C<D;C++)r.push(T[C]);if(!u.isAnEndpoint(E))for(var M=this._splitSafely(u,E),B=0,O=M.length;B<O;B++)r.push(M[B])}}this.tree.remove(n)}return r}},{key:"_splitSafely",value:function(e,n){this.tree.remove(e);var r=e.rightSE;this.queue.remove(r);var i=e.split(n);return i.push(r),e.consumedBy===void 0&&this.tree.insert(e),i}}]),t}(),Kp=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,k0=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Br=new(function(){function t(){er(this,t)}return In(t,[{key:"run",value:function(e,n,r){Br.type=e,ws.reset();for(var i=[new Jp(n,!0)],o=0,s=r.length;o<s;o++)i.push(new Jp(r[o],!1));if(Br.numMultiPolys=i.length,Br.type==="difference")for(var a=i[0],u=1;u<i.length;)xl(i[u].bbox,a.bbox)!==null?u++:i.splice(u,1);if(Br.type==="intersection"){for(var l=0,h=i.length;l<h;l++)for(var c=i[l],p=l+1,d=i.length;p<d;p++)if(xl(c.bbox,i[p].bbox)===null)return[]}for(var g=new yl(qr.compare),m=0,f=i.length;m<f;m++)for(var _=i[m].getSweepEvents(),I=0,y=_.length;I<y;I++)if(g.insert(_[I]),g.size>Kp)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var v=new F0(g),x=g.size,b=g.pop();b;){var E=b.key;if(g.size===x){var T=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(T.id," ")+"[".concat(T.leftSE.point.x,", ").concat(T.leftSE.point.y,"] -> ")+"[".concat(T.rightSE.point.x,", ").concat(T.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(g.size>Kp)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(v.segments.length>k0)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var C=v.process(E),D=0,M=C.length;D<M;D++){var B=C[D];B.consumedBy===void 0&&g.insert(B)}x=g.size,b=g.pop()}ws.reset();var O=A0.factory(v.segments);return new D0(O).getGeom()}}]),t}()),G0=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Br.run("union",t,n)},q0=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Br.run("intersection",t,n)},B0=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Br.run("difference",t,n)};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(this==null)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=1 in arguments&&parseInt(Number(arguments[1]),10)||0;r=r<0?Math.max(n+r,0):Math.min(r,n);var i=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:n;for(i=i<0?Math.max(n+arguments[2],0):Math.min(i,n);r<i;)e[r]=t,++r;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return typeof t=="number"&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var Yi=function(){};Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi},Yi.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var he=function(t){function e(n){t.call(this,n),this.name="IllegalArgumentException",this.message=n,this.stack=new t().stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),st=function(){},Qp={MAX_VALUE:{configurable:!0}};st.isNaN=function(t){return Number.isNaN(t)},st.doubleToLongBits=function(t){return t},st.longBitsToDouble=function(t){return t},st.isInfinite=function(t){return!Number.isFinite(t)},Qp.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(st,Qp);var Tn=function(){},Ma=function(){},So=function(){};function An(){}var L=function t(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(arguments.length===1){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},Hi={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};L.prototype.setOrdinate=function(t,e){switch(t){case L.X:this.x=e;break;case L.Y:this.y=e;break;case L.Z:this.z=e;break;default:throw new he("Invalid ordinate index: "+t)}},L.prototype.equals2D=function(){if(arguments.length===1){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(arguments.length===2){var e=arguments[0],n=arguments[1];return!!Yi.equalsWithTolerance(this.x,e.x,n)&&!!Yi.equalsWithTolerance(this.y,e.y,n)}},L.prototype.getOrdinate=function(t){switch(t){case L.X:return this.x;case L.Y:return this.y;case L.Z:return this.z}throw new he("Invalid ordinate index: "+t)},L.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||st.isNaN(this.z))&&st.isNaN(t.z)},L.prototype.equals=function(t){return t instanceof L&&this.equals2D(t)},L.prototype.equalInZ=function(t,e){return Yi.equalsWithTolerance(this.z,t.z,e)},L.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},L.prototype.clone=function(){},L.prototype.copy=function(){return new L(this)},L.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},L.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},L.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},L.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+L.hashCode(this.x))+L.hashCode(this.y)},L.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},L.prototype.interfaces_=function(){return[Tn,Ma,An]},L.prototype.getClass=function(){return L},L.hashCode=function(){if(arguments.length===1){var t=arguments[0],e=st.doubleToLongBits(t);return Math.trunc((e^e)>>>32)}},Hi.DimensionalComparator.get=function(){return ii},Hi.serialVersionUID.get=function(){return 6683108902428367e3},Hi.NULL_ORDINATE.get=function(){return st.NaN},Hi.X.get=function(){return 0},Hi.Y.get=function(){return 1},Hi.Z.get=function(){return 2},Object.defineProperties(L,Hi);var ii=function(t){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new he("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}}};ii.prototype.compare=function(t,e){var n=t,r=e,i=ii.compare(n.x,r.x);if(i!==0)return i;var o=ii.compare(n.y,r.y);return o!==0?o:this._dimensionsToTest<=2?0:ii.compare(n.z,r.z)},ii.prototype.interfaces_=function(){return[So]},ii.prototype.getClass=function(){return ii},ii.compare=function(t,e){return t<e?-1:t>e?1:st.isNaN(t)?st.isNaN(e)?0:-1:st.isNaN(e)?1:0};var Co=function(){};Co.prototype.create=function(){},Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co};var A=function(){},Ss={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};A.prototype.interfaces_=function(){return[]},A.prototype.getClass=function(){return A},A.toLocationSymbol=function(t){switch(t){case A.EXTERIOR:return"e";case A.BOUNDARY:return"b";case A.INTERIOR:return"i";case A.NONE:return"-"}throw new he("Unknown location value: "+t)},Ss.INTERIOR.get=function(){return 0},Ss.BOUNDARY.get=function(){return 1},Ss.EXTERIOR.get=function(){return 2},Ss.NONE.get=function(){return-1},Object.defineProperties(A,Ss);var et=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},Sn=function(){},$p={LOG_10:{configurable:!0}};Sn.prototype.interfaces_=function(){return[]},Sn.prototype.getClass=function(){return Sn},Sn.log10=function(t){var e=Math.log(t);return st.isInfinite(e)||st.isNaN(e)?e:e/Sn.LOG_10},Sn.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},Sn.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return r<i?i:r>o?o:r}},Sn.wrap=function(t,e){return t<0?e- -t%e:t%e},Sn.max=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t;return e>r&&(r=e),n>r&&(r=n),r}if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=i;return o>u&&(u=o),s>u&&(u=s),a>u&&(u=a),u}},Sn.average=function(t,e){return(t+e)/2},$p.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(Sn,$p);var nr=function(t){this.str=t};nr.prototype.append=function(t){this.str+=t},nr.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},nr.prototype.toString=function(t){return this.str};var rr=function(t){this.value=t};rr.prototype.intValue=function(){return this.value},rr.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},rr.isNaN=function(t){return Number.isNaN(t)};var Cs=function(){};Cs.isWhitespace=function(t){return t<=32&&t>=0||t===127},Cs.toUpperCase=function(t){return t.toUpperCase()};var G=function t(){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 t){var n=arguments[0];this.init(n)}else if(typeof arguments[0]=="string"){var r=arguments[0];t.call(this,t.parse(r))}}else if(arguments.length===2){var i=arguments[0],o=arguments[1];this.init(i,o)}},Un={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};G.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},G.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=G.magnitude(n._hi),i=G.TEN.pow(r);(n=n.divide(i)).gt(G.TEN)?(n=n.divide(G.TEN),r+=1):n.lt(G.ONE)&&(n=n.multiply(G.TEN),r-=1);for(var o=r+1,s=new nr,a=G.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(n._hi);if(l<0)break;var h=!1,c=0;l>9?(h=!0,c="9"):c="0"+l,s.append(c),n=n.subtract(G.valueOf(l)).multiply(G.TEN),h&&n.selfAdd(G.TEN);var p=!0,d=G.magnitude(n._hi);if(d<0&&Math.abs(d)>=a-u&&(p=!1),!p)break}return e[0]=r,s.toString()},G.prototype.sqr=function(){return this.multiply(this)},G.prototype.doubleValue=function(){return this._hi+this._lo},G.prototype.subtract=function(){if(arguments[0]instanceof G){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}},G.prototype.equals=function(){if(arguments.length===1){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},G.prototype.isZero=function(){return this._hi===0&&this._lo===0},G.prototype.selfSubtract=function(){if(arguments[0]instanceof G){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},G.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},G.prototype.min=function(t){return this.le(t)?this:t},G.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof G){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,o=null,s=null,a=null,u=null,l=null,h=null,c=null;return u=this._hi/n,c=(i=(l=G.SPLIT*u)-(i=l-u))*(s=(c=G.SPLIT*n)-(s=c-n))-(h=u*n)+i*(a=n-s)+(o=u-i)*s+o*a,c=u+(l=(this._hi-h-c+this._lo-u*r)/n),this._hi=c,this._lo=u-c+l,this}},G.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},G.prototype.divide=function(){if(arguments[0]instanceof G){var t=arguments[0],e=null,n=null,r=null,i=null,o=null,s=null,a=null,u=null;n=(o=this._hi/t._hi)-(e=(s=G.SPLIT*o)-(e=s-o)),u=e*(r=(u=G.SPLIT*t._hi)-(r=u-t._hi))-(a=o*t._hi)+e*(i=t._hi-r)+n*r+n*i;var l=u=o+(s=(this._hi-a-u+this._lo-o*t._lo)/t._hi),h=o-u+s;return new G(l,h)}if(typeof arguments[0]=="number"){var c=arguments[0];return st.isNaN(c)?G.createNaN():G.copy(this).selfDivide(c,0)}},G.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},G.prototype.pow=function(t){if(t===0)return G.valueOf(1);var e=new G(this),n=G.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},G.prototype.ceil=function(){if(this.isNaN())return G.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new G(t,e)},G.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},G.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},G.prototype.setValue=function(){if(arguments[0]instanceof G){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}},G.prototype.max=function(t){return this.ge(t)?this:t},G.prototype.sqrt=function(){if(this.isZero())return G.valueOf(0);if(this.isNegative())return G.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=G.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},G.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof G){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0],n=null,r=null,i=null,o=null,s=null,a=null;return o=(i=this._hi+e)-(s=i-this._hi),r=(a=(o=e-s+(this._hi-o))+this._lo)+(i-(n=i+a)),this._hi=n+r,this._lo=r+(n-this._hi),this}}else if(arguments.length===2){var u=arguments[0],l=arguments[1],h=null,c=null,p=null,d=null,g=null,m=null,f=null;d=this._hi+u,c=this._lo+l,g=d-(m=d-this._hi),p=c-(f=c-this._lo);var _=(h=d+(m=(g=u-m+(this._hi-g))+c))+(m=(p=l-f+(this._lo-p))+(m+(d-h))),I=m+(h-_);return this._hi=_,this._lo=I,this}},G.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof G){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=null,o=null,s=null,a=null,u=null,l=null;i=(u=G.SPLIT*this._hi)-this._hi,l=G.SPLIT*n,i=u-i,o=this._hi-i,s=l-n;var h=(u=this._hi*n)+(l=i*(s=l-s)-u+i*(a=n-s)+o*s+o*a+(this._hi*r+this._lo*n)),c=l+(i=u-h);return this._hi=h,this._lo=c,this}},G.prototype.selfSqr=function(){return this.selfMultiply(this)},G.prototype.floor=function(){if(this.isNaN())return G.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new G(t,e)},G.prototype.negate=function(){return this.isNaN()?this:new G(-this._hi,-this._lo)},G.prototype.clone=function(){},G.prototype.multiply=function(){if(arguments[0]instanceof G){var t=arguments[0];return t.isNaN()?G.createNaN():G.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return st.isNaN(e)?G.createNaN():G.copy(this).selfMultiply(e,0)}},G.prototype.isNaN=function(){return st.isNaN(this._hi)},G.prototype.intValue=function(){return Math.trunc(this._hi)},G.prototype.toString=function(){var t=G.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},G.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if(n.charAt(0)===".")i="0"+n;else if(r<0)i="0."+G.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var o=r-n.length;i=n+G.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},G.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=G.SPLIT*n)-(i=s-n)),o=(a=G.SPLIT*this._hi)-this._hi;var u=n+(s=(1-(r=n*this._hi)-(a=i*(o=a-o)-r+i*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new G(u,n-u+s)},G.prototype.toSciNotation=function(){if(this.isZero())return G.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=G.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},G.prototype.abs=function(){return this.isNaN()?G.NaN:this.isNegative()?this.negate():new G(this)},G.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},G.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},G.prototype.add=function(){if(arguments[0]instanceof G){var t=arguments[0];return G.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return G.copy(this).selfAdd(e)}},G.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof G){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this._hi=n,this._lo=r}},G.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},G.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},G.prototype.trunc=function(){return this.isNaN()?G.NaN:this.isPositive()?this.floor():this.ceil()},G.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},G.prototype.interfaces_=function(){return[An,Tn,Ma]},G.prototype.getClass=function(){return G},G.sqr=function(t){return G.valueOf(t).selfMultiply(t)},G.valueOf=function(){if(typeof arguments[0]=="string"){var t=arguments[0];return G.parse(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return new G(e)}},G.sqrt=function(t){return G.valueOf(t).sqrt()},G.parse=function(t){for(var e=0,n=t.length;Cs.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var i=t.charAt(e);i!=="-"&&i!=="+"||(e++,i==="-"&&(r=!0))}for(var o=new G,s=0,a=0,u=0;!(e>=n);){var l=t.charAt(e);if(e++,Cs.isDigit(l)){var h=l-"0";o.selfMultiply(G.TEN),o.selfAdd(h),s++}else{if(l!=="."){if(l==="e"||l==="E"){var c=t.substring(e);try{u=rr.parseInt(c)}catch(f){throw f instanceof Error?new Error("Invalid exponent "+c+" in string "+t):f}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var p=o,d=s-a-u;if(d===0)p=o;else if(d>0){var g=G.TEN.pow(d);p=o.divide(g)}else if(d<0){var m=G.TEN.pow(-d);p=o.multiply(m)}return r?p.negate():p},G.createNaN=function(){return new G(st.NaN,st.NaN)},G.copy=function(t){return new G(t)},G.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r},G.stringOfChar=function(t,e){for(var n=new nr,r=0;r<e;r++)n.append(t);return n.toString()},Un.PI.get=function(){return new G(3.141592653589793,12246467991473532e-32)},Un.TWO_PI.get=function(){return new G(6.283185307179586,24492935982947064e-32)},Un.PI_2.get=function(){return new G(1.5707963267948966,6123233995736766e-32)},Un.E.get=function(){return new G(2.718281828459045,14456468917292502e-32)},Un.NaN.get=function(){return new G(st.NaN,st.NaN)},Un.EPS.get=function(){return 123259516440783e-46},Un.SPLIT.get=function(){return 134217729},Un.MAX_PRINT_DIGITS.get=function(){return 32},Un.TEN.get=function(){return G.valueOf(10)},Un.ONE.get=function(){return G.valueOf(1)},Un.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Un.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(G,Un);var hn=function(){},tf={DP_SAFE_EPSILON:{configurable:!0}};hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn},hn.orientationIndex=function(t,e,n){var r=hn.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=G.valueOf(e.x).selfAdd(-t.x),o=G.valueOf(e.y).selfAdd(-t.y),s=G.valueOf(n.x).selfAdd(-e.x),a=G.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},hn.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},hn.intersection=function(t,e,n,r){var i=G.valueOf(r.y).selfSubtract(n.y).selfMultiply(G.valueOf(e.x).selfSubtract(t.x)),o=G.valueOf(r.x).selfSubtract(n.x).selfMultiply(G.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=G.valueOf(r.x).selfSubtract(n.x).selfMultiply(G.valueOf(t.y).selfSubtract(n.y)),u=G.valueOf(r.y).selfSubtract(n.y).selfMultiply(G.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u).selfDivide(s).doubleValue(),h=G.valueOf(t.x).selfAdd(G.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),c=G.valueOf(e.x).selfSubtract(t.x).selfMultiply(G.valueOf(t.y).selfSubtract(n.y)),p=G.valueOf(e.y).selfSubtract(t.y).selfMultiply(G.valueOf(t.x).selfSubtract(n.x)),d=c.subtract(p).selfDivide(s).doubleValue(),g=G.valueOf(n.y).selfAdd(G.valueOf(r.y).selfSubtract(n.y).selfMultiply(d)).doubleValue();return new L(h,g)},hn.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=i-o;if(i>0){if(o<=0)return hn.signum(s);r=i+o}else{if(!(i<0)||o>=0)return hn.signum(s);r=-i-o}var a=hn.DP_SAFE_EPSILON*r;return s>=a||-s>=a?hn.signum(s):2},hn.signum=function(t){return t>0?1:t<0?-1:0},tf.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(hn,tf);var mt=function(){},Ns={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ns.X.get=function(){return 0},Ns.Y.get=function(){return 1},Ns.Z.get=function(){return 2},Ns.M.get=function(){return 3},mt.prototype.setOrdinate=function(t,e,n){},mt.prototype.size=function(){},mt.prototype.getOrdinate=function(t,e){},mt.prototype.getCoordinate=function(){},mt.prototype.getCoordinateCopy=function(t){},mt.prototype.getDimension=function(){},mt.prototype.getX=function(t){},mt.prototype.clone=function(){},mt.prototype.expandEnvelope=function(t){},mt.prototype.copy=function(){},mt.prototype.getY=function(t){},mt.prototype.toCoordinateArray=function(){},mt.prototype.interfaces_=function(){return[Ma]},mt.prototype.getClass=function(){return mt},Object.defineProperties(mt,Ns);var ef=function(){},No=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ef),qe=function(){};qe.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},qe.getProperty=function(t){return{"line.separator":`
| `}[t]};var Vn=function t(){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 n=arguments[0],r=arguments[1];this.x=n,this.y=r,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof L&&arguments[1]instanceof L){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(arguments.length===3){var u=arguments[0],l=arguments[1],h=arguments[2];this.x=u,this.y=l,this.w=h}else if(arguments.length===4){var c=arguments[0],p=arguments[1],d=arguments[2],g=arguments[3],m=c.y-p.y,f=p.x-c.x,_=c.x*p.y-p.x*c.y,I=d.y-g.y,y=g.x-d.x,v=d.x*g.y-g.x*d.y;this.x=f*v-y*_,this.y=I*_-m*v,this.w=m*y-I*f}};Vn.prototype.getY=function(){var t=this.y/this.w;if(st.isNaN(t)||st.isInfinite(t))throw new No;return t},Vn.prototype.getX=function(){var t=this.x/this.w;if(st.isNaN(t)||st.isInfinite(t))throw new No;return t},Vn.prototype.getCoordinate=function(){var t=new L;return t.x=this.getX(),t.y=this.getY(),t},Vn.prototype.interfaces_=function(){return[]},Vn.prototype.getClass=function(){return Vn},Vn.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-r.y,u=r.x-n.x,l=n.x*r.y-r.x*n.y,h=i*u-a*o,c=(o*l-u*s)/h,p=(a*s-i*l)/h;if(st.isNaN(c)||st.isInfinite(c)||st.isNaN(p)||st.isInfinite(p))throw new No;return new L(c,p)};var J=function t(){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 L){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},nf={serialVersionUID:{configurable:!0}};J.prototype.getArea=function(){return this.getWidth()*this.getHeight()},J.prototype.equals=function(t){if(!(t instanceof J))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},J.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new J;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new J(e,r,n,i)},J.prototype.isNull=function(){return this._maxx<this._minx},J.prototype.getMaxX=function(){return this._maxx},J.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof L){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof J){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}},J.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof J){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof L){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},J.prototype.getMinY=function(){return this._miny},J.prototype.getMinX=function(){return this._minx},J.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof L){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof J){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}},J.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},J.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},J.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},J.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},J.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},J.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},J.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},J.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},J.prototype.expandBy=function(){if(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},J.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof J){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof L){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},J.prototype.centre=function(){return this.isNull()?null:new L((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},J.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof L){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof J){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},J.prototype.getMaxY=function(){return this._maxy},J.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),e===0?n:n===0?e:Math.sqrt(e*e+n*n)},J.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+L.hashCode(this._minx))+L.hashCode(this._maxx))+L.hashCode(this._miny))+L.hashCode(this._maxy)},J.prototype.interfaces_=function(){return[Tn,An]},J.prototype.getClass=function(){return J},J.intersects=function(){if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(arguments.length===4){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(r.x,i.x),h=Math.max(r.x,i.x);return!(l>u)&&!(h<a)&&(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(r.y,i.y),h=Math.max(r.y,i.y),!(l>u)&&!(h<a))}},nf.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(J,nf);var ir={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},La=function(t){this.geometryFactory=t||new pt};La.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=ir.typeStr.exec(t);if(t.search("EMPTY")!==-1&&((i=ir.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],Po[n]&&(e=Po[n].apply(this,[r]))),e===void 0)throw new Error("Could not parse WKT "+t);return e},La.prototype.write=function(t){return this.extractGeometry(t)},La.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!zr[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+zr[e].apply(this,[t])+")"};var zr={coordinate:function(t){return t.x+" "+t.y},point:function(t){return zr.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+zr.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(zr.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(zr.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+zr.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+zr.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+zr.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+zr.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},Po={point:function(t){if(t===void 0)return this.geometryFactory.createPoint();var e=t.trim().split(ir.spaces);return this.geometryFactory.createPoint(new L(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(t===void 0)return this.geometryFactory.createMultiPoint();for(var n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(ir.trimParens,"$1"),r.push(Po.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(r)},linestring:function(t){if(t===void 0)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(ir.spaces),r.push(new L(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(r)},linearring:function(t){if(t===void 0)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(ir.spaces),r.push(new L(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){var e;if(t===void 0)return this.geometryFactory.createMultiLineString();for(var n=t.trim().split(ir.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(ir.trimParens,"$1"),r.push(Po.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){var e,n,r;if(t===void 0)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(ir.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(ir.trimParens,"$1"),n=Po.linestring.apply(this,[e]),r=this.geometryFactory.createLinearRing(n._points),a===0?i=r:s.push(r);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(t===void 0)return this.geometryFactory.createMultiPolygon();for(var n=t.trim().split(ir.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(ir.trimParens,"$1"),r.push(Po.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(r)},geometrycollection:function(t){if(t===void 0)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),n=[],r=0,i=e.length;r<i;++r)n.push(this.read(e[r]));return this.geometryFactory.createGeometryCollection(n)}},Xn=function(t){this.parser=new La(t)};Xn.prototype.write=function(t){return this.parser.write(t)},Xn.toLineString=function(t,e){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var jr=function(t){function e(n){t.call(this,n),this.name="RuntimeException",this.message=n,this.stack=new t().stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),Oa=function(t){function e(){if(t.call(this),arguments.length===0)t.call(this);else if(arguments.length===1){var n=arguments[0];t.call(this,n)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jr),lt=function(){};lt.prototype.interfaces_=function(){return[]},lt.prototype.getClass=function(){return lt},lt.shouldNeverReachHere=function(){if(arguments.length===0)lt.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new Oa("Should never reach here"+(t!==null?": "+t:""))}},lt.isTrue=function(){var t;if(arguments.length===1)lt.isTrue(arguments[0],null);else if(arguments.length===2&&(t=arguments[1],!arguments[0]))throw t===null?new Oa:new Oa(t)},lt.equals=function(){var t,e,n;if(arguments.length===2)lt.equals(t=arguments[0],e=arguments[1],null);else if(arguments.length===3&&(t=arguments[0],n=arguments[2],!(e=arguments[1]).equals(t)))throw new Oa("Expected "+t+" but encountered "+e+(n!==null?": "+n:""))};var pe=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 L,this._intPt[1]=new L,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Wi={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};pe.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},pe.prototype.getTopologySummary=function(){var t=new nr;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},pe.prototype.computeIntersection=function(t,e,n,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)},pe.prototype.getIntersectionNum=function(){return this._result},pe.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var t=arguments[0],e=this.getEdgeDistance(t,0),n=this.getEdgeDistance(t,1);e>n?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},pe.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},pe.prototype.setPrecisionModel=function(t){this._precisionModel=t},pe.prototype.isInteriorIntersection=function(){var t=this;if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var e=arguments[0],n=0;n<this._result;n++)if(!t._intPt[n].equals2D(t._inputLines[e][0])&&!t._intPt[n].equals2D(t._inputLines[e][1]))return!0;return!1}},pe.prototype.getIntersection=function(t){return this._intPt[t]},pe.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},pe.prototype.hasIntersection=function(){return this._result!==pe.NO_INTERSECTION},pe.prototype.getEdgeDistance=function(t,e){return pe.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},pe.prototype.isCollinear=function(){return this._result===pe.COLLINEAR_INTERSECTION},pe.prototype.toString=function(){return Xn.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Xn.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},pe.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},pe.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},pe.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe},pe.computeEdgeDistance=function(t,e,n){var r=Math.abs(n.x-e.x),i=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=r>i?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);(o=r>i?s:a)!==0||t.equals(e)||(o=Math.max(s,a))}return lt.isTrue(!(o===0&&!t.equals(e)),"Bad distance calculation"),o},pe.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return lt.isTrue(!(o===0&&!t.equals(e)),"Invalid distance calculation"),o},Wi.DONT_INTERSECT.get=function(){return 0},Wi.DO_INTERSECT.get=function(){return 1},Wi.COLLINEAR.get=function(){return 2},Wi.NO_INTERSECTION.get=function(){return 0},Wi.POINT_INTERSECTION.get=function(){return 1},Wi.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(pe,Wi);var wi=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(n){var r=new J(this._inputLines[0][0],this._inputLines[0][1]),i=new J(this._inputLines[1][0],this._inputLines[1][1]);return r.contains(n)&&i.contains(n)},e.prototype.computeIntersection=function(){if(arguments.length!==3)return t.prototype.computeIntersection.apply(this,arguments);var n=arguments[0],r=arguments[1],i=arguments[2];if(this._isProper=!1,J.intersects(r,i,n)&&X.orientationIndex(r,i,n)===0&&X.orientationIndex(i,r,n)===0)return this._isProper=!0,(n.equals(r)||n.equals(i))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(n,r,i,o,s){s.x=this.smallestInAbsValue(n.x,r.x,i.x,o.x),s.y=this.smallestInAbsValue(n.y,r.y,i.y,o.y),n.x-=s.x,n.y-=s.y,r.x-=s.x,r.y-=s.y,i.x-=s.x,i.y-=s.y,o.x-=s.x,o.y-=s.y},e.prototype.safeHCoordinateIntersection=function(n,r,i,o){var s=null;try{s=Vn.intersection(n,r,i,o)}catch(a){if(!(a instanceof No))throw a;s=e.nearestEndpoint(n,r,i,o)}return s},e.prototype.intersection=function(n,r,i,o){var s=this.intersectionWithNormalization(n,r,i,o);return this.isInSegmentEnvelopes(s)||(s=new L(e.nearestEndpoint(n,r,i,o))),this._precisionModel!==null&&this._precisionModel.makePrecise(s),s},e.prototype.smallestInAbsValue=function(n,r,i,o){var s=n,a=Math.abs(s);return Math.abs(r)<a&&(s=r,a=Math.abs(r)),Math.abs(i)<a&&(s=i,a=Math.abs(i)),Math.abs(o)<a&&(s=o),s},e.prototype.checkDD=function(n,r,i,o,s){var a=hn.intersection(n,r,i,o),u=this.isInSegmentEnvelopes(a);qe.out.println("DD in env = "+u+" --------------------- "+a),s.distance(a)>1e-4&&qe.out.println("Distance = "+s.distance(a))},e.prototype.intersectionWithNormalization=function(n,r,i,o){var s=new L(n),a=new L(r),u=new L(i),l=new L(o),h=new L;this.normalizeToEnvCentre(s,a,u,l,h);var c=this.safeHCoordinateIntersection(s,a,u,l);return c.x+=h.x,c.y+=h.y,c},e.prototype.computeCollinearIntersection=function(n,r,i,o){var s=J.intersects(n,r,i),a=J.intersects(n,r,o),u=J.intersects(i,o,n),l=J.intersects(i,o,r);return s&&a?(this._intPt[0]=i,this._intPt[1]=o,t.COLLINEAR_INTERSECTION):u&&l?(this._intPt[0]=n,this._intPt[1]=r,t.COLLINEAR_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=n,!i.equals(n)||a||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&l?(this._intPt[0]=i,this._intPt[1]=r,!i.equals(r)||a||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):a&&u?(this._intPt[0]=o,this._intPt[1]=n,!o.equals(n)||s||l?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):a&&l?(this._intPt[0]=o,this._intPt[1]=r,!o.equals(r)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(n,r,i,o,s){var a=n.x<r.x?n.x:r.x,u=n.y<r.y?n.y:r.y,l=n.x>r.x?n.x:r.x,h=n.y>r.y?n.y:r.y,c=i.x<o.x?i.x:o.x,p=i.y<o.y?i.y:o.y,d=i.x>o.x?i.x:o.x,g=i.y>o.y?i.y:o.y,m=((a>c?a:c)+(l<d?l:d))/2,f=((u>p?u:p)+(h<g?h:g))/2;s.x=m,s.y=f,n.x-=s.x,n.y-=s.y,r.x-=s.x,r.y-=s.y,i.x-=s.x,i.y-=s.y,o.x-=s.x,o.y-=s.y},e.prototype.computeIntersect=function(n,r,i,o){if(this._isProper=!1,!J.intersects(n,r,i,o))return t.NO_INTERSECTION;var s=X.orientationIndex(n,r,i),a=X.orientationIndex(n,r,o);if(s>0&&a>0||s<0&&a<0)return t.NO_INTERSECTION;var u=X.orientationIndex(i,o,n),l=X.orientationIndex(i,o,r);return u>0&&l>0||u<0&&l<0?t.NO_INTERSECTION:s===0&&a===0&&u===0&&l===0?this.computeCollinearIntersection(n,r,i,o):(s===0||a===0||u===0||l===0?(this._isProper=!1,n.equals2D(i)||n.equals2D(o)?this._intPt[0]=n:r.equals2D(i)||r.equals2D(o)?this._intPt[0]=r:s===0?this._intPt[0]=new L(i):a===0?this._intPt[0]=new L(o):u===0?this._intPt[0]=new L(n):l===0&&(this._intPt[0]=new L(r))):(this._isProper=!0,this._intPt[0]=this.intersection(n,r,i,o)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(n,r,i,o){var s=n,a=X.distancePointLine(n,i,o),u=X.distancePointLine(r,i,o);return u<a&&(a=u,s=r),(u=X.distancePointLine(i,n,r))<a&&(a=u,s=i),(u=X.distancePointLine(o,n,r))<a&&(a=u,s=o),s},e}(pe),Ji=function(){};Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},Ji.orientationIndex=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return Ji.signOfDet2x2(r,i,o,s)},Ji.signOfDet2x2=function(t,e,n,r){var i=null,o=null,s=null;if(i=1,t===0||r===0)return e===0||n===0?0:e>0?n>0?-i:i:n>0?i:-i;if(e===0||n===0)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):e<=-r?(i=-i,n=-n,r=-r):(o=t,t=-n,n=o,o=e,e=-r,r=o):r>0?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,r=o),t>0){if(!(n>0)||!(t<=n))return i}else{if(n>0||!(t>=n))return-i;i=-i,t=-t,n=-n}for(;;){if((r-=(s=Math.floor(n/t))*e)<0)return-i;if(r>e)return i;if(t>(n-=s*t)+n){if(e<r+r)return i}else{if(e>r+r)return-i;n=t-n,r=e-r,i=-i}if(r===0)return n===0?0:-i;if(n===0||(e-=(s=Math.floor(t/n))*r)<0)return i;if(e>r)return-i;if(n>(t-=s*n)+t){if(r<e+e)return-i}else{if(r>e+e)return i;t=n-t,e=r-e,i=-i}if(e===0)return t===0?0:i;if(t===0)return-i}};var or=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};or.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,r=e.x;return n>r&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=Ji.signOfDet2x2(i,o,s,a);if(u===0)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},or.prototype.isPointInPolygon=function(){return this.getLocation()!==A.EXTERIOR},or.prototype.getLocation=function(){return this._isPointOnSegment?A.BOUNDARY:this._crossingCount%2==1?A.INTERIOR:A.EXTERIOR},or.prototype.isOnSegment=function(){return this._isPointOnSegment},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or},or.locatePointInRing=function(){if(arguments[0]instanceof L&&et(arguments[1],mt)){for(var t=arguments[0],e=arguments[1],n=new or(t),r=new L,i=new L,o=1;o<e.size();o++)if(e.getCoordinate(o,r),e.getCoordinate(o-1,i),n.countSegment(r,i),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof L&&arguments[1]instanceof Array){for(var s=arguments[0],a=arguments[1],u=new or(s),l=1;l<a.length;l++){var h=a[l],c=a[l-1];if(u.countSegment(h,c),u.isOnSegment())return u.getLocation()}return u.getLocation()}};var X=function(){},Zi={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};X.prototype.interfaces_=function(){return[]},X.prototype.getClass=function(){return X},X.orientationIndex=function(t,e,n){return hn.orientationIndex(t,e,n)},X.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,r=1;r<t.length-1;r++){var i=t[r].x-n,o=t[r+1].y,s=t[r-1].y;e+=i*(s-o)}return e/2}if(et(arguments[0],mt)){var a=arguments[0],u=a.size();if(u<3)return 0;var l=new L,h=new L,c=new L;a.getCoordinate(0,h),a.getCoordinate(1,c);var p=h.x;c.x-=p;for(var d=0,g=1;g<u-1;g++)l.y=h.y,h.x=c.x,h.y=c.y,a.getCoordinate(g+1,c),c.x-=p,d+=h.x*(l.y-c.y);return d/2}},X.distanceLineLine=function(t,e,n,r){if(t.equals(e))return X.distancePointLine(t,n,r);if(n.equals(r))return X.distancePointLine(r,t,e);var i=!1;if(J.intersects(t,e,n,r)){var o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(o===0)i=!0;else{var s=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?Sn.min(X.distancePointLine(t,n,r),X.distancePointLine(e,n,r),X.distancePointLine(n,t,e),X.distancePointLine(r,t,e)):0},X.isPointInRing=function(t,e){return X.locatePointInRing(t,e)!==A.EXTERIOR},X.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new L;t.getCoordinate(0,r);for(var i=r.x,o=r.y,s=1;s<e;s++){t.getCoordinate(s,r);var a=r.x,u=r.y,l=a-i,h=u-o;n+=Math.sqrt(l*l+h*h),i=a,o=u}return n},X.isCCW=function(t){var e=t.length-1;if(e<3)throw new he("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,i=1;i<=e;i++){var o=t[i];o.y>n.y&&(n=o,r=i)}var s=r;do(s-=1)<0&&(s=e);while(t[s].equals2D(n)&&s!==r);var a=r;do a=(a+1)%e;while(t[a].equals2D(n)&&a!==r);var u=t[s],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var h=X.computeOrientation(u,n,l),c=!1;return c=h===0?u.x>l.x:h>0,c},X.locatePointInRing=function(t,e){return or.locatePointInRing(t,e)},X.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)},X.computeOrientation=function(t,e,n){return X.orientationIndex(t,e,n)},X.distancePointLine=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(e.length===0)throw new he("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=X.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}return n}if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var h=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(h)*Math.sqrt(u)}},X.isOnLine=function(t,e){for(var n=new wi,r=1;r<e.length;r++){var i=e[r-1],o=e[r];if(n.computeIntersection(t,i,o),n.hasIntersection())return!0}return!1},Zi.CLOCKWISE.get=function(){return-1},Zi.RIGHT.get=function(){return X.CLOCKWISE},Zi.COUNTERCLOCKWISE.get=function(){return 1},Zi.LEFT.get=function(){return X.COUNTERCLOCKWISE},Zi.COLLINEAR.get=function(){return 0},Zi.STRAIGHT.get=function(){return X.COLLINEAR},Object.defineProperties(X,Zi);var Ur=function(){};Ur.prototype.filter=function(t){},Ur.prototype.interfaces_=function(){return[]},Ur.prototype.getClass=function(){return Ur};var $=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},br={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};$.prototype.isGeometryCollection=function(){return this.getSortIndex()===$.SORTINDEX_GEOMETRYCOLLECTION},$.prototype.getFactory=function(){return this._factory},$.prototype.getGeometryN=function(t){return this},$.prototype.getArea=function(){return 0},$.prototype.isRectangle=function(){return!1},$.prototype.equals=function(){if(arguments[0]instanceof $){var t=arguments[0];return t!==null&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof $))return!1;var n=e;return this.equalsExact(n)}},$.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},$.prototype.geometryChanged=function(){this.apply($.geometryChangedFilter)},$.prototype.geometryChangedAction=function(){this._envelope=null},$.prototype.equalsNorm=function(t){return t!==null&&this.norm().equalsExact(t.norm())},$.prototype.getLength=function(){return 0},$.prototype.getNumGeometries=function(){return 1},$.prototype.compareTo=function(){if(arguments.length===1){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,r)}},$.prototype.getUserData=function(){return this._userData},$.prototype.getSRID=function(){return this._SRID},$.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},$.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===$.SORTINDEX_GEOMETRYCOLLECTION)throw new he("This method does not support GeometryCollection arguments")},$.prototype.equal=function(t,e,n){return n===0?t.equals(e):t.distance(e)<=n},$.prototype.norm=function(){var t=this.copy();return t.normalize(),t},$.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},$.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new J(this._envelope)},$.prototype.setSRID=function(t){this._SRID=t},$.prototype.setUserData=function(t){this._userData=t},$.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),s=i.compareTo(o);if(s!==0)return s}return n.hasNext()?1:r.hasNext()?-1:0},$.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},$.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===$.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===$.SORTINDEX_MULTIPOINT||this.getSortIndex()===$.SORTINDEX_MULTILINESTRING||this.getSortIndex()===$.SORTINDEX_MULTIPOLYGON},$.prototype.interfaces_=function(){return[Ma,Tn,An]},$.prototype.getClass=function(){return $},$.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},$.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(t[e]===null)return!0;return!1},br.serialVersionUID.get=function(){return 8763622679187377e3},br.SORTINDEX_POINT.get=function(){return 0},br.SORTINDEX_MULTIPOINT.get=function(){return 1},br.SORTINDEX_LINESTRING.get=function(){return 2},br.SORTINDEX_LINEARRING.get=function(){return 3},br.SORTINDEX_MULTILINESTRING.get=function(){return 4},br.SORTINDEX_POLYGON.get=function(){return 5},br.SORTINDEX_MULTIPOLYGON.get=function(){return 6},br.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},br.geometryChangedFilter.get=function(){return bl},Object.defineProperties($,br);var bl=function(){};bl.interfaces_=function(){return[Ur]},bl.filter=function(t){t.geometryChangedAction()};var wr=function(){};wr.prototype.filter=function(t){},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr};var Dn=function(){},Vr={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Dn.prototype.isInBoundary=function(t){},Dn.prototype.interfaces_=function(){return[]},Dn.prototype.getClass=function(){return Dn},Vr.Mod2BoundaryNodeRule.get=function(){return Mo},Vr.EndPointBoundaryNodeRule.get=function(){return Lo},Vr.MultiValentEndPointBoundaryNodeRule.get=function(){return Oo},Vr.MonoValentEndPointBoundaryNodeRule.get=function(){return Ro},Vr.MOD2_BOUNDARY_RULE.get=function(){return new Mo},Vr.ENDPOINT_BOUNDARY_RULE.get=function(){return new Lo},Vr.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Oo},Vr.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ro},Vr.OGC_SFS_BOUNDARY_RULE.get=function(){return Dn.MOD2_BOUNDARY_RULE},Object.defineProperties(Dn,Vr);var Mo=function(){};Mo.prototype.isInBoundary=function(t){return t%2==1},Mo.prototype.interfaces_=function(){return[Dn]},Mo.prototype.getClass=function(){return Mo};var Lo=function(){};Lo.prototype.isInBoundary=function(t){return t>0},Lo.prototype.interfaces_=function(){return[Dn]},Lo.prototype.getClass=function(){return Lo};var Oo=function(){};Oo.prototype.isInBoundary=function(t){return t>1},Oo.prototype.interfaces_=function(){return[Dn]},Oo.prototype.getClass=function(){return Oo};var Ro=function(){};Ro.prototype.isInBoundary=function(t){return t===1},Ro.prototype.interfaces_=function(){return[Dn]},Ro.prototype.getClass=function(){return Ro};var Ne=function(){};function wl(t){this.message=t||""}Ne.prototype.add=function(){},Ne.prototype.addAll=function(){},Ne.prototype.isEmpty=function(){},Ne.prototype.iterator=function(){},Ne.prototype.size=function(){},Ne.prototype.toArray=function(){},Ne.prototype.remove=function(){},wl.prototype=new Error,wl.prototype.name="IndexOutOfBoundsException";var To=function(){};To.prototype.hasNext=function(){},To.prototype.next=function(){},To.prototype.remove=function(){};var Yn=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(Ne);function Ao(t){this.message=t||""}Ao.prototype=new Error,Ao.prototype.name="NoSuchElementException";var U=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Ne&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,Ne]},e.prototype.add=function(n){return arguments.length===1?this.array_.push(n):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(n){for(var r=n.iterator();r.hasNext();)this.add(r.next());return!0},e.prototype.set=function(n,r){var i=this.array_[n];return this.array_[n]=r,i},e.prototype.iterator=function(){return new z0(this)},e.prototype.get=function(n){if(n<0||n>=this.size())throw new wl;return this.array_[n]},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var n=[],r=0,i=this.array_.length;r<i;r++)n.push(this.array_[r]);return n},e.prototype.remove=function(n){for(var r=!1,i=0,o=this.array_.length;i<o;i++)if(this.array_[i]===n){this.array_.splice(i,1),r=!0;break}return r},e}(Yn),z0=function(t){function e(n){t.call(this),this.arrayList_=n,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new Ao;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(n){return this.arrayList_.set(this.position_-1,n)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}(To),Ps=function(t){function e(){if(t.call(this),arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.ensureCapacity(r.length),this.add(r,!0)}else if(arguments.length===2){var i=arguments[0],o=arguments[1];this.ensureCapacity(i.length),this.add(i,o)}}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={coordArrayType:{configurable:!0}};return n.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(r){return this.get(r)},e.prototype.addAll=function(){var r=this;if(arguments.length===2){for(var i=arguments[0],o=arguments[1],s=!1,a=i.iterator();a.hasNext();)r.add(a.next(),o),s=!0;return s}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var r=t.prototype.clone.call(this),i=0;i<this.size();i++)r.add(i,this.get(i).copy());return r},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var r=this;if(arguments.length===1){var i=arguments[0];t.prototype.add.call(this,i)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var o=arguments[0],s=arguments[1];return this.add(o,s,!0),!0}if(arguments[0]instanceof L&&typeof arguments[1]=="boolean"){var a=arguments[0],u=arguments[1];if(!u&&this.size()>=1){var l=this.get(this.size()-1);if(l.equals2D(a))return null}t.prototype.add.call(this,a)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var h=arguments[0],c=arguments[1];return this.add(h,c),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var p=arguments[0],d=arguments[1],g=arguments[2];if(g)for(var m=0;m<p.length;m++)r.add(p[m],d);else for(var f=p.length-1;f>=0;f--)r.add(p[f],d);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof L){var _=arguments[0],I=arguments[1],y=arguments[2];if(!y){var v=this.size();if(v>0){if(_>0){var x=this.get(_-1);if(x.equals2D(I))return null}if(_<v){var b=this.get(_);if(b.equals2D(I))return null}}}t.prototype.add.call(this,_,I)}}else if(arguments.length===4){var E=arguments[0],T=arguments[1],C=arguments[2],D=arguments[3],M=1;C>D&&(M=-1);for(var B=C;B!==D;B+=M)r.add(E[B],T);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new L(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(U),ht=function(){},Ra={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Ra.ForwardComparator.get=function(){return Ms},Ra.BidirectionalComparator.get=function(){return Do},Ra.coordArrayType.get=function(){return new Array(0).fill(null)},ht.prototype.interfaces_=function(){return[]},ht.prototype.getClass=function(){return ht},ht.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},ht.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(ht.indexOf(r,e)<0)return r}return null},ht.scroll=function(t,e){var n=ht.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);qe.arraycopy(t,n,r,0,t.length-n),qe.arraycopy(t,0,r,t.length-n,n),qe.arraycopy(r,0,t,0,t.length)},ht.equals=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(t===null||e===null||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];if(r===i)return!0;if(r===null||i===null||r.length!==i.length)return!1;for(var s=0;s<r.length;s++)if(o.compare(r[s],i[s])!==0)return!1;return!0}},ht.intersection=function(t,e){for(var n=new Ps,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},ht.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},ht.removeRepeatedPoints=function(t){return ht.hasRepeatedPoints(t)?new Ps(t,!1).toCoordinateArray():t},ht.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var i=t[r];t[r]=t[e-r],t[e-r]=i}},ht.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)t[n]!==null&&e++;var r=new Array(e).fill(null);if(e===0)return r;for(var i=0,o=0;o<t.length;o++)t[o]!==null&&(r[i++]=t[o]);return r},ht.copyDeep=function(){if(arguments.length===1){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new L(t[n]);return e}if(arguments.length===5)for(var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new L(r[i+u])},ht.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=e[t.length-n-1];if(r.compareTo(i)!==0)return!1}return!0},ht.envelope=function(t){for(var e=new J,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},ht.toCoordinateArray=function(t){return t.toArray(ht.coordArrayType)},ht.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},ht.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},ht.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(r!==0)return r}return 1},ht.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(r!==0)return r;n++}return n<e.length?-1:n<t.length?1:0},ht.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(e===null||e.compareTo(t[n])>0)&&(e=t[n]);return e},ht.extract=function(t,e,n){e=Sn.clamp(e,0,t.length);var r=(n=Sn.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array(r).fill(null);if(r===0)return i;for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(ht,Ra);var Ms=function(){};Ms.prototype.compare=function(t,e){return ht.compare(t,e)},Ms.prototype.interfaces_=function(){return[So]},Ms.prototype.getClass=function(){return Ms};var Do=function(){};Do.prototype.compare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(n.length===0)return 0;var i=ht.compare(n,r);return ht.isEqualReversed(n,r)?0:i},Do.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(n.length===0)return 0;for(var i=ht.increasingDirection(n),o=ht.increasingDirection(r),s=i>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u<n.length;u++){var l=n[s].compareTo(r[a]);if(l!==0)return l;s+=i,a+=o}return 0},Do.prototype.interfaces_=function(){return[So]},Do.prototype.getClass=function(){return Do};var Ki=function(){};Ki.prototype.get=function(){},Ki.prototype.put=function(){},Ki.prototype.size=function(){},Ki.prototype.values=function(){},Ki.prototype.entrySet=function(){};var j0=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Ki);function Ls(t){this.message=t||""}function Ta(){}Ls.prototype=new Error,Ls.prototype.name="OperationNotSupported",Ta.prototype=new Ne,Ta.prototype.contains=function(){};var Il=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof Ne&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(n){for(var r=0,i=this.array_.length;r<i;r++)if(this.array_[r]===n)return!0;return!1},e.prototype.add=function(n){return!this.contains(n)&&(this.array_.push(n),!0)},e.prototype.addAll=function(n){for(var r=n.iterator();r.hasNext();)this.add(r.next());return!0},e.prototype.remove=function(n){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return this.array_.length===0},e.prototype.toArray=function(){for(var n=[],r=0,i=this.array_.length;r<i;r++)n.push(this.array_[r]);return n},e.prototype.iterator=function(){return new U0(this)},e}(Ta),U0=function(t){function e(n){t.call(this),this.hashSet_=n,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new Ao;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new Ls},e}(To);function rf(t){return t===null?0:t.color}function ie(t){return t===null?null:t.parent}function Xr(t,e){t!==null&&(t.color=e)}function Sl(t){return t===null?null:t.left}function of(t){return t===null?null:t.right}function He(){this.root_=null,this.size_=0}He.prototype=new j0,He.prototype.get=function(t){for(var e=this.root_;e!==null;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},He.prototype.put=function(t,e){if(this.root_===null)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(r>0)){var o=i.value;return i.value=e,o}i=i.right}while(i!==null);var s={key:t,left:null,right:null,value:e,parent:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},He.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;t!=null&&t!==this.root_&&t.parent.color===1;)if(ie(t)===Sl(ie(ie(t)))){var n=of(ie(ie(t)));rf(n)===1?(Xr(ie(t),0),Xr(n,0),Xr(ie(ie(t)),1),t=ie(ie(t))):(t===of(ie(t))&&(t=ie(t),e.rotateLeft(t)),Xr(ie(t),0),Xr(ie(ie(t)),1),e.rotateRight(ie(ie(t))))}else{var r=Sl(ie(ie(t)));rf(r)===1?(Xr(ie(t),0),Xr(r,0),Xr(ie(ie(t)),1),t=ie(ie(t))):(t===Sl(ie(t))&&(t=ie(t),e.rotateRight(t)),Xr(ie(t),0),Xr(ie(ie(t)),1),e.rotateLeft(ie(ie(t))))}this.root_.color=0},He.prototype.values=function(){var t=new U,e=this.getFirstEntry();if(e!==null)for(t.add(e.value);(e=He.successor(e))!==null;)t.add(e.value);return t},He.prototype.entrySet=function(){var t=new Il,e=this.getFirstEntry();if(e!==null)for(t.add(e);(e=He.successor(e))!==null;)t.add(e);return t},He.prototype.rotateLeft=function(t){if(t!=null){var e=t.right;t.right=e.left,e.left!=null&&(e.left.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},He.prototype.rotateRight=function(t){if(t!=null){var e=t.left;t.left=e.right,e.right!=null&&(e.right.parent=t),e.parent=t.parent,t.parent===null?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},He.prototype.getFirstEntry=function(){var t=this.root_;if(t!=null)for(;t.left!=null;)t=t.left;return t},He.successor=function(t){if(t===null)return null;if(t.right!==null){for(var e=t.right;e.left!==null;)e=e.left;return e}for(var n=t.parent,r=t;n!==null&&r===n.right;)r=n,n=n.parent;return n},He.prototype.size=function(){return this.size_};var Os=function(){};function sf(){}function sr(){this.array_=[],arguments[0]instanceof Ne&&this.addAll(arguments[0])}Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os},sf.prototype=new Ta,sr.prototype=new sf,sr.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++)if(this.array_[e].compareTo(t)===0)return!0;return!1},sr.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++)if(this.array_[e].compareTo(t)===1)return this.array_.splice(e,0,t),!0;return this.array_.push(t),!0},sr.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},sr.prototype.remove=function(t){throw new Ls},sr.prototype.size=function(){return this.array_.length},sr.prototype.isEmpty=function(){return this.array_.length===0},sr.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},sr.prototype.iterator=function(){return new Aa(this)};var Aa=function(t){this.treeSet_=t,this.position_=0};Aa.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new Ao;return this.treeSet_.array_[this.position_++]},Aa.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Aa.prototype.remove=function(){throw new Ls};var Ii=function(){};Ii.sort=function(){var t,e,n,r,i=arguments[0];if(arguments.length===1)r=function(s,a){return s.compareTo(a)},i.sort(r);else if(arguments.length===2)n=arguments[1],r=function(s,a){return n.compare(s,a)},i.sort(r);else if(arguments.length===3){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(arguments.length===4)for(e=i.slice(arguments[1],arguments[2]),n=arguments[3],r=function(s,a){return n.compare(s,a)},e.sort(r),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},Ii.asList=function(t){for(var e=new U,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};var Vt=function(){},Hn={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Hn.P.get=function(){return 0},Hn.L.get=function(){return 1},Hn.A.get=function(){return 2},Hn.FALSE.get=function(){return-1},Hn.TRUE.get=function(){return-2},Hn.DONTCARE.get=function(){return-3},Hn.SYM_FALSE.get=function(){return"F"},Hn.SYM_TRUE.get=function(){return"T"},Hn.SYM_DONTCARE.get=function(){return"*"},Hn.SYM_P.get=function(){return"0"},Hn.SYM_L.get=function(){return"1"},Hn.SYM_A.get=function(){return"2"},Vt.prototype.interfaces_=function(){return[]},Vt.prototype.getClass=function(){return Vt},Vt.toDimensionSymbol=function(t){switch(t){case Vt.FALSE:return Vt.SYM_FALSE;case Vt.TRUE:return Vt.SYM_TRUE;case Vt.DONTCARE:return Vt.SYM_DONTCARE;case Vt.P:return Vt.SYM_P;case Vt.L:return Vt.SYM_L;case Vt.A:return Vt.SYM_A}throw new he("Unknown dimension value: "+t)},Vt.toDimensionValue=function(t){switch(Cs.toUpperCase(t)){case Vt.SYM_FALSE:return Vt.FALSE;case Vt.SYM_TRUE:return Vt.TRUE;case Vt.SYM_DONTCARE:return Vt.DONTCARE;case Vt.SYM_P:return Vt.P;case Vt.SYM_L:return Vt.L;case Vt.SYM_A:return Vt.A}throw new he("Unknown dimension symbol: "+t)},Object.defineProperties(Vt,Hn);var ar=function(){};ar.prototype.filter=function(t){},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar};var Wn=function(){};Wn.prototype.filter=function(t,e){},Wn.prototype.isDone=function(){},Wn.prototype.isGeometryChanged=function(){},Wn.prototype.interfaces_=function(){return[]},Wn.prototype.getClass=function(){return Wn};var Qe=function(t){function e(r,i){if(t.call(this,i),this._geometries=r||[],t.hasNullElements(this._geometries))throw new he("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var r=new J,i=0;i<this._geometries.length;i++)r.expandToInclude(this._geometries[i].getEnvelopeInternal());return r},e.prototype.getGeometryN=function(r){return this._geometries[r]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var r=new Array(this.getNumPoints()).fill(null),i=-1,o=0;o<this._geometries.length;o++)for(var s=this._geometries[o].getCoordinates(),a=0;a<s.length;a++)r[++i]=s[a];return r},e.prototype.getArea=function(){for(var r=0,i=0;i<this._geometries.length;i++)r+=this._geometries[i].getArea();return r},e.prototype.equalsExact=function(){var r=this;if(arguments.length===2){var i=arguments[0],o=arguments[1];if(!this.isEquivalentClass(i))return!1;var s=i;if(this._geometries.length!==s._geometries.length)return!1;for(var a=0;a<this._geometries.length;a++)if(!r._geometries[a].equalsExact(s._geometries[a],o))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var r=0;r<this._geometries.length;r++)this._geometries[r].normalize();Ii.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var r=Vt.FALSE,i=0;i<this._geometries.length;i++)r=Math.max(r,this._geometries[i].getBoundaryDimension());return r},e.prototype.getDimension=function(){for(var r=Vt.FALSE,i=0;i<this._geometries.length;i++)r=Math.max(r,this._geometries[i].getDimension());return r},e.prototype.getLength=function(){for(var r=0,i=0;i<this._geometries.length;i++)r+=this._geometries[i].getLength();return r},e.prototype.getNumPoints=function(){for(var r=0,i=0;i<this._geometries.length;i++)r+=this._geometries[i].getNumPoints();return r},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var r=this._geometries.length,i=new Array(r).fill(null),o=0;o<this._geometries.length;o++)i[o]=this._geometries[o].reverse();return this.getFactory().createGeometryCollection(i)},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){var i=arguments[0],o=new sr(Ii.asList(this._geometries)),s=new sr(Ii.asList(i._geometries));return this.compare(o,s)}if(arguments.length===2){for(var a=arguments[0],u=arguments[1],l=a,h=this.getNumGeometries(),c=l.getNumGeometries(),p=0;p<h&&p<c;){var d=r.getGeometryN(p),g=l.getGeometryN(p),m=d.compareToSameClass(g,u);if(m!==0)return m;p++}return p<h?1:p<c?-1:0}},e.prototype.apply=function(){var r=this;if(et(arguments[0],wr))for(var i=arguments[0],o=0;o<this._geometries.length;o++)r._geometries[o].apply(i);else if(et(arguments[0],Wn)){var s=arguments[0];if(this._geometries.length===0)return null;for(var a=0;a<this._geometries.length&&(r._geometries[a].apply(s),!s.isDone());a++);s.isGeometryChanged()&&this.geometryChanged()}else if(et(arguments[0],ar)){var u=arguments[0];u.filter(this);for(var l=0;l<this._geometries.length;l++)r._geometries[l].apply(u)}else if(et(arguments[0],Ur)){var h=arguments[0];h.filter(this);for(var c=0;c<this._geometries.length;c++)r._geometries[c].apply(h)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),lt.shouldNeverReachHere(),null},e.prototype.clone=function(){var r=t.prototype.clone.call(this);r._geometries=new Array(this._geometries.length).fill(null);for(var i=0;i<this._geometries.length;i++)r._geometries[i]=this._geometries[i].clone();return r},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var r=new Array(this._geometries.length).fill(null),i=0;i<r.length;i++)r[i]=this._geometries[i].copy();return new e(r,this._factory)},e.prototype.isEmpty=function(){for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(e,n),e}($),Si=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return $.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return!!this.isEquivalentClass(r)&&t.prototype.equalsExact.call(this,r,i)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Vt.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var r=this._geometries.length,i=new Array(r).fill(null),o=0;o<this._geometries.length;o++)i[r-1-o]=this._geometries[o].reverse();return this.getFactory().createMultiLineString(i)},e.prototype.getBoundary=function(){return new Fn(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var r=new Array(this._geometries.length).fill(null),i=0;i<r.length;i++)r[i]=this._geometries[i].copy();return new e(r,this._factory)},e.prototype.interfaces_=function(){return[Os]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(e,n),e}(Qe),Fn=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var t=arguments[0],e=Dn.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r}};Fn.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return e.length===1?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},Fn.prototype.getBoundary=function(){return this._geom instanceof ge?this.boundaryLineString(this._geom):this._geom instanceof Si?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Fn.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},Fn.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Fn.prototype.computeBoundaryCoordinates=function(t){var e=this,n=new U;this._endpointMap=new He;for(var r=0;r<t.getNumGeometries();r++){var i=t.getGeometryN(r);i.getNumPoints()!==0&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&n.add(s.getKey())}return ht.toCoordinateArray(n)},Fn.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);e===null&&(e=new Da,this._endpointMap.put(t,e)),e.count++},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.getBoundary=function(){if(arguments.length===1){var t=arguments[0],e=new Fn(t);return e.getBoundary()}if(arguments.length===2){var n=arguments[0],r=arguments[1],i=new Fn(n,r);return i.getBoundary()}};var Da=function(){this.count=null};function V0(){}function X0(){}Da.prototype.interfaces_=function(){return[]},Da.prototype.getClass=function(){return Da};var Y0=function(){};function H0(){}function W0(){}function J0(){}var kn=function(){},Cl={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},kn.getStackTrace=function(){if(arguments.length===1){var t=arguments[0],e=new H0,n=new V0(e);return t.printStackTrace(n),e.toString()}if(arguments.length===2){for(var r=arguments[0],i=arguments[1],o="",s=new X0(kn.getStackTrace(r)),a=new J0(s),u=0;u<i;u++)try{o+=a.readLine()+kn.NEWLINE}catch(l){if(!(l instanceof W0))throw l;lt.shouldNeverReachHere()}return o}},kn.split=function(t,e){for(var n=e.length,r=new U,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}i.length>0&&r.add(i);for(var a=new Array(r.size()).fill(null),u=0;u<a.length;u++)a[u]=r.get(u);return a},kn.toString=function(){if(arguments.length===1){var t=arguments[0];return kn.SIMPLE_ORDINATE_FORMAT.format(t)}},kn.spaces=function(t){return kn.chars(" ",t)},Cl.NEWLINE.get=function(){return qe.getProperty("line.separator")},Cl.SIMPLE_ORDINATE_FORMAT.get=function(){return new Y0("0.#")},Object.defineProperties(kn,Cl);var me=function(){};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.copyCoord=function(t,e,n,r){for(var i=Math.min(t.getDimension(),n.getDimension()),o=0;o<i;o++)n.setOrdinate(r,o,t.getOrdinate(e,o))},me.isRing=function(t){var e=t.size();return e===0||!(e<=3)&&t.getOrdinate(0,mt.X)===t.getOrdinate(e-1,mt.X)&&t.getOrdinate(0,mt.Y)===t.getOrdinate(e-1,mt.Y)},me.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),i=0;i<n;i++)for(var o=0;o<r;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!st.isNaN(s)||!st.isNaN(a)))return!1}return!0},me.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(me.copy(e,0,r,0,i),i>0)for(var o=i;o<n;o++)me.copy(e,i-1,r,o,1);return r},me.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)me.swap(t,r,e-r)},me.swap=function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var i=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,i)}},me.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)me.copyCoord(t,e+o,n,r+o)},me.toString=function(){if(arguments.length===1){var t=arguments[0],e=t.size();if(e===0)return"()";var n=t.getDimension(),r=new nr;r.append("(");for(var i=0;i<e;i++){i>0&&r.append(" ");for(var o=0;o<n;o++)o>0&&r.append(","),r.append(kn.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},me.ensureValidRing=function(t,e){var n=e.size();return n===0?e:n<=3?me.createClosedRing(t,e,4):e.getOrdinate(0,mt.X)===e.getOrdinate(n-1,mt.X)&&e.getOrdinate(0,mt.Y)===e.getOrdinate(n-1,mt.Y)?e:me.createClosedRing(t,e,n+1)},me.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();me.copy(e,0,r,0,i);for(var o=i;o<n;o++)me.copy(e,0,r,o,1);return r};var ge=function(t){function e(r,i){t.call(this,i),this._points=null,this.init(r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new J:this._points.expandEnvelope(new J)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){var r=this;if(arguments.length===2){var i=arguments[0],o=arguments[1];if(!this.isEquivalentClass(i))return!1;var s=i;if(this._points.size()!==s._points.size())return!1;for(var a=0;a<this._points.size();a++)if(!r.equal(r._points.getCoordinate(a),s._points.getCoordinate(a),o))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var r=this,i=0;i<Math.trunc(this._points.size()/2);i++){var o=r._points.size()-1-i;if(!r._points.getCoordinate(i).equals(r._points.getCoordinate(o)))return r._points.getCoordinate(i).compareTo(r._points.getCoordinate(o))>0&&me.reverse(r._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?Vt.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return X.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var r=this._points.copy();return me.reverse(r),this.getFactory().createLineString(r)},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){for(var i=arguments[0],o=i,s=0,a=0;s<this._points.size()&&a<o._points.size();){var u=r._points.getCoordinate(s).compareTo(o._points.getCoordinate(a));if(u!==0)return u;s++,a++}return s<this._points.size()?1:a<o._points.size()?-1:0}if(arguments.length===2){var l=arguments[0],h=arguments[1],c=l;return h.compare(this._points,c._points)}},e.prototype.apply=function(){var r=this;if(et(arguments[0],wr))for(var i=arguments[0],o=0;o<this._points.size();o++)i.filter(r._points.getCoordinate(o));else if(et(arguments[0],Wn)){var s=arguments[0];if(this._points.size()===0)return null;for(var a=0;a<this._points.size()&&(s.filter(r._points,a),!s.isDone());a++);s.isGeometryChanged()&&this.geometryChanged()}else if(et(arguments[0],ar)){var u=arguments[0];u.filter(this)}else if(et(arguments[0],Ur)){var l=arguments[0];l.filter(this)}},e.prototype.getBoundary=function(){return new Fn(this).getBoundary()},e.prototype.isEquivalentClass=function(r){return r instanceof e},e.prototype.clone=function(){var r=t.prototype.clone.call(this);return r._points=this._points.clone(),r},e.prototype.getCoordinateN=function(r){return this._points.getCoordinate(r)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return this._points.size()===0},e.prototype.init=function(r){if(r===null&&(r=this.getFactory().getCoordinateSequenceFactory().create([])),r.size()===1)throw new he("Invalid number of points in LineString (found "+r.size()+" - must be 0 or >= 2)");this._points=r},e.prototype.isCoordinate=function(r){for(var i=0;i<this._points.size();i++)if(this._points.getCoordinate(i).equals(r))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(r){return this.getFactory().createPoint(this._points.getCoordinate(r))},e.prototype.interfaces_=function(){return[Os]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}($),Rs=function(){};Rs.prototype.interfaces_=function(){return[]},Rs.prototype.getClass=function(){return Rs};var vn=function(t){function e(r,i){t.call(this,i),this._coordinates=r||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new J;var r=new J;return r.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),r},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return!!this.isEquivalentClass(r)&&(!(!this.isEmpty()||!r.isEmpty())||this.isEmpty()===r.isEmpty()&&this.equal(r.getCoordinate(),this.getCoordinate(),i))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return Vt.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(arguments.length===1){var r=arguments[0],i=r;return this.getCoordinate().compareTo(i.getCoordinate())}if(arguments.length===2){var o=arguments[0],s=arguments[1],a=o;return s.compare(this._coordinates,a._coordinates)}},e.prototype.apply=function(){if(et(arguments[0],wr)){var r=arguments[0];if(this.isEmpty())return null;r.filter(this.getCoordinate())}else if(et(arguments[0],Wn)){var i=arguments[0];if(this.isEmpty())return null;i.filter(this._coordinates,0),i.isGeometryChanged()&&this.geometryChanged()}else if(et(arguments[0],ar)){var o=arguments[0];o.filter(this)}else if(et(arguments[0],Ur)){var s=arguments[0];s.filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var r=t.prototype.clone.call(this);return r._coordinates=this._coordinates.clone(),r},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return this._coordinates.size()===0},e.prototype.init=function(r){r===null&&(r=this.getFactory().getCoordinateSequenceFactory().create([])),lt.isTrue(r.size()<=1),this._coordinates=r},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[Rs]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(e,n),e}($),oi=function(){};oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi};var Pe=function(t){function e(r,i,o){if(t.call(this,o),this._shell=null,this._holes=null,r===null&&(r=this.getFactory().createLinearRing()),i===null&&(i=[]),t.hasNullElements(i))throw new he("holes must not contain null elements");if(r.isEmpty()&&t.hasNonEmptyElements(i))throw new he("shell is empty but holes are not");this._shell=r,this._holes=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var r=new Array(this.getNumPoints()).fill(null),i=-1,o=this._shell.getCoordinates(),s=0;s<o.length;s++)r[++i]=o[s];for(var a=0;a<this._holes.length;a++)for(var u=this._holes[a].getCoordinates(),l=0;l<u.length;l++)r[++i]=u[l];return r},e.prototype.getArea=function(){var r=0;r+=Math.abs(X.signedArea(this._shell.getCoordinateSequence()));for(var i=0;i<this._holes.length;i++)r-=Math.abs(X.signedArea(this._holes[i].getCoordinateSequence()));return r},e.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var r=this._shell.getCoordinateSequence(),i=this.getEnvelopeInternal(),o=0;o<5;o++){var s=r.getX(o);if(s!==i.getMinX()&&s!==i.getMaxX())return!1;var a=r.getY(o);if(a!==i.getMinY()&&a!==i.getMaxY())return!1}for(var u=r.getX(0),l=r.getY(0),h=1;h<=4;h++){var c=r.getX(h),p=r.getY(h);if(c!==u==(p!==l))return!1;u=c,l=p}return!0},e.prototype.equalsExact=function(){var r=this;if(arguments.length===2){var i=arguments[0],o=arguments[1];if(!this.isEquivalentClass(i))return!1;var s=i,a=this._shell,u=s._shell;if(!a.equalsExact(u,o)||this._holes.length!==s._holes.length)return!1;for(var l=0;l<this._holes.length;l++)if(!r._holes[l].equalsExact(s._holes[l],o))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){var r=this;if(arguments.length===0){this.normalize(this._shell,!0);for(var i=0;i<this._holes.length;i++)r.normalize(r._holes[i],!1);Ii.sort(this._holes)}else if(arguments.length===2){var o=arguments[0],s=arguments[1];if(o.isEmpty())return null;var a=new Array(o.getCoordinates().length-1).fill(null);qe.arraycopy(o.getCoordinates(),0,a,0,a.length);var u=ht.minCoordinate(o.getCoordinates());ht.scroll(a,u),qe.arraycopy(a,0,o.getCoordinates(),0,a.length),o.getCoordinates()[a.length]=a[0],X.isCCW(o.getCoordinates())===s&&ht.reverse(o.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var r=0;r+=this._shell.getLength();for(var i=0;i<this._holes.length;i++)r+=this._holes[i].getLength();return r},e.prototype.getNumPoints=function(){for(var r=this._shell.getNumPoints(),i=0;i<this._holes.length;i++)r+=this._holes[i].getNumPoints();return r},e.prototype.reverse=function(){var r=this.copy();r._shell=this._shell.copy().reverse(),r._holes=new Array(this._holes.length).fill(null);for(var i=0;i<this._holes.length;i++)r._holes[i]=this._holes[i].copy().reverse();return r},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){var r=this;if(arguments.length===1){var i=arguments[0],o=this._shell,s=i._shell;return o.compareToSameClass(s)}if(arguments.length===2){var a=arguments[0],u=arguments[1],l=a,h=this._shell,c=l._shell,p=h.compareToSameClass(c,u);if(p!==0)return p;for(var d=this.getNumInteriorRing(),g=l.getNumInteriorRing(),m=0;m<d&&m<g;){var f=r.getInteriorRingN(m),_=l.getInteriorRingN(m),I=f.compareToSameClass(_,u);if(I!==0)return I;m++}return m<d?1:m<g?-1:0}},e.prototype.apply=function(r){var i=this;if(et(r,wr)){this._shell.apply(r);for(var o=0;o<this._holes.length;o++)i._holes[o].apply(r)}else if(et(r,Wn)){if(this._shell.apply(r),!r.isDone())for(var s=0;s<this._holes.length&&(i._holes[s].apply(r),!r.isDone());s++);r.isGeometryChanged()&&this.geometryChanged()}else if(et(r,ar))r.filter(this);else if(et(r,Ur)){r.filter(this),this._shell.apply(r);for(var a=0;a<this._holes.length;a++)i._holes[a].apply(r)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var r=new Array(this._holes.length+1).fill(null);r[0]=this._shell;for(var i=0;i<this._holes.length;i++)r[i+1]=this._holes[i];return r.length<=1?this.getFactory().createLinearRing(r[0].getCoordinateSequence()):this.getFactory().createMultiLineString(r)},e.prototype.clone=function(){var r=t.prototype.clone.call(this);r._shell=this._shell.clone(),r._holes=new Array(this._holes.length).fill(null);for(var i=0;i<this._holes.length;i++)r._holes[i]=this._holes[i].clone();return r},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var r=this._shell.copy(),i=new Array(this._holes.length).fill(null),o=0;o<i.length;o++)i[o]=this._holes[o].copy();return new e(r,i,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(r){return this._holes[r]},e.prototype.interfaces_=function(){return[oi]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}($),Fo=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return $.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return!!this.isEquivalentClass(r)&&t.prototype.equalsExact.call(this,r,i)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(arguments.length===1){var r=arguments[0];return this._geometries[r].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return Vt.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var r=new Array(this._geometries.length).fill(null),i=0;i<r.length;i++)r[i]=this._geometries[i].copy();return new e(r,this._factory)},e.prototype.interfaces_=function(){return[Rs]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(e,n),e}(Qe),Ir=function(t){function e(r,i){r instanceof L&&i instanceof pt&&(r=i.getCoordinateSequenceFactory().create(r)),t.call(this,r,i),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return $.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return Vt.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var r=this._points.copy();return me.reverse(r),this.getFactory().createLinearRing(r)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new he("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new he("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(ge),Sr=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return $.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return!!this.isEquivalentClass(r)&&t.prototype.equalsExact.call(this,r,i)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var r=this._geometries.length,i=new Array(r).fill(null),o=0;o<this._geometries.length;o++)i[o]=this._geometries[o].reverse();return this.getFactory().createMultiPolygon(i)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var r=new U,i=0;i<this._geometries.length;i++)for(var o=this._geometries[i].getBoundary(),s=0;s<o.getNumGeometries();s++)r.add(o.getGeometryN(s));var a=new Array(r.size()).fill(null);return this.getFactory().createMultiLineString(r.toArray(a))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var r=new Array(this._geometries.length).fill(null),i=0;i<r.length;i++)r[i]=this._geometries[i].copy();return new e(r,this._factory)},e.prototype.interfaces_=function(){return[oi]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(Qe),Gn=function(t){this._factory=t||null,this._isUserDataCopied=!1},Fa={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Gn.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Gn.prototype.edit=function(t,e){if(t===null)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Gn.prototype.editInternal=function(t,e){return this._factory===null&&(this._factory=t.getFactory()),t instanceof Qe?this.editGeometryCollection(t,e):t instanceof Pe?this.editPolygon(t,e):t instanceof vn||t instanceof ge?e.edit(t,this._factory):(lt.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Gn.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new U,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);o===null||o.isEmpty()||r.add(o)}return n.getClass()===Fo?this._factory.createMultiPoint(r.toArray([])):n.getClass()===Si?this._factory.createMultiLineString(r.toArray([])):n.getClass()===Sr?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},Gn.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if(n===null&&(n=this._factory.createPolygon(null)),n.isEmpty())return n;var r=this.edit(n.getExteriorRing(),e);if(r===null||r.isEmpty())return this._factory.createPolygon();for(var i=new U,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);s===null||s.isEmpty()||i.add(s)}return this._factory.createPolygon(r,i.toArray([]))},Gn.prototype.interfaces_=function(){return[]},Gn.prototype.getClass=function(){return Gn},Gn.GeometryEditorOperation=function(){},Fa.NoOpGeometryOperation.get=function(){return Ts},Fa.CoordinateOperation.get=function(){return As},Fa.CoordinateSequenceOperation.get=function(){return Ds},Object.defineProperties(Gn,Fa);var Ts=function(){};Ts.prototype.edit=function(t,e){return t},Ts.prototype.interfaces_=function(){return[Gn.GeometryEditorOperation]},Ts.prototype.getClass=function(){return Ts};var As=function(){};As.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return n===null?t:t instanceof Ir?e.createLinearRing(n):t instanceof ge?e.createLineString(n):t instanceof vn?n.length>0?e.createPoint(n[0]):e.createPoint():t},As.prototype.interfaces_=function(){return[Gn.GeometryEditorOperation]},As.prototype.getClass=function(){return As};var Ds=function(){};Ds.prototype.edit=function(t,e){return t instanceof Ir?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof ge?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof vn?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},Ds.prototype.interfaces_=function(){return[Gn.GeometryEditorOperation]},Ds.prototype.getClass=function(){return Ds};var ve=function(){var t=this;if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)t._coordinates[n]=new L}else if(et(arguments[0],mt)){var r=arguments[0];if(r===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=r.getDimension(),this._coordinates=new Array(r.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=r.getCoordinateCopy(i)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,o===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new L}}},af={serialVersionUID:{configurable:!0}};ve.prototype.setOrdinate=function(t,e,n){switch(e){case mt.X:this._coordinates[t].x=n;break;case mt.Y:this._coordinates[t].y=n;break;case mt.Z:this._coordinates[t].z=n;break;default:throw new he("invalid ordinateIndex")}},ve.prototype.size=function(){return this._coordinates.length},ve.prototype.getOrdinate=function(t,e){switch(e){case mt.X:return this._coordinates[t].x;case mt.Y:return this._coordinates[t].y;case mt.Z:return this._coordinates[t].z}return st.NaN},ve.prototype.getCoordinate=function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}if(arguments.length===2){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},ve.prototype.getCoordinateCopy=function(t){return new L(this._coordinates[t])},ve.prototype.getDimension=function(){return this._dimension},ve.prototype.getX=function(t){return this._coordinates[t].x},ve.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new ve(t,this._dimension)},ve.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},ve.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new ve(t,this._dimension)},ve.prototype.toString=function(){if(this._coordinates.length>0){var t=new nr(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},ve.prototype.getY=function(t){return this._coordinates[t].y},ve.prototype.toCoordinateArray=function(){return this._coordinates},ve.prototype.interfaces_=function(){return[mt,An]},ve.prototype.getClass=function(){return ve},af.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(ve,af);var Cr=function(){},Nl={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};Cr.prototype.readResolve=function(){return Cr.instance()},Cr.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return new ve(t)}if(et(arguments[0],mt)){var e=arguments[0];return new ve(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return r>3&&(r=3),r<2?new ve(n):new ve(n,r)}},Cr.prototype.interfaces_=function(){return[Co,An]},Cr.prototype.getClass=function(){return Cr},Cr.instance=function(){return Cr.instanceObject},Nl.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Nl.instanceObject.get=function(){return new Cr},Object.defineProperties(Cr,Nl);var uf=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(n){return this.map_.get(n)||null},e.prototype.put=function(n,r){return this.map_.set(n,r),r},e.prototype.values=function(){for(var n=new U,r=this.map_.values(),i=r.next();!i.done;)n.add(i.value),i=r.next();return n},e.prototype.entrySet=function(){var n=new Il;return this.map_.entries().forEach(function(r){return n.add(r)}),n},e.prototype.size=function(){return this.map_.size()},e}(Ki),Xt=function t(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=t.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ur){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}}},Pl={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};Xt.prototype.equals=function(t){if(!(t instanceof Xt))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},Xt.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new rr(n).compareTo(new rr(r))},Xt.prototype.getScale=function(){return this._scale},Xt.prototype.isFloating=function(){return this._modelType===Xt.FLOATING||this._modelType===Xt.FLOATING_SINGLE},Xt.prototype.getType=function(){return this._modelType},Xt.prototype.toString=function(){var t="UNKNOWN";return this._modelType===Xt.FLOATING?t="Floating":this._modelType===Xt.FLOATING_SINGLE?t="Floating-Single":this._modelType===Xt.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},Xt.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var t=arguments[0];return st.isNaN(t)||this._modelType===Xt.FLOATING_SINGLE?t:this._modelType===Xt.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof L){var e=arguments[0];if(this._modelType===Xt.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},Xt.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===Xt.FLOATING?t=16:this._modelType===Xt.FLOATING_SINGLE?t=6:this._modelType===Xt.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},Xt.prototype.setScale=function(t){this._scale=Math.abs(t)},Xt.prototype.interfaces_=function(){return[An,Tn]},Xt.prototype.getClass=function(){return Xt},Xt.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},Pl.serialVersionUID.get=function(){return 7777263578777804e3},Pl.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(Xt,Pl);var ur=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},Ml={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ur.prototype.readResolve=function(){return ur.nameToTypeMap.get(this._name)},ur.prototype.toString=function(){return this._name},ur.prototype.interfaces_=function(){return[An]},ur.prototype.getClass=function(){return ur},Ml.serialVersionUID.get=function(){return-552860263173159e4},Ml.nameToTypeMap.get=function(){return new uf},Object.defineProperties(ur,Ml),Xt.Type=ur,Xt.FIXED=new ur("FIXED"),Xt.FLOATING=new ur("FLOATING"),Xt.FLOATING_SINGLE=new ur("FLOATING SINGLE");var pt=function t(){this._precisionModel=new Xt,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?et(arguments[0],Co)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof Xt&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},lf={serialVersionUID:{configurable:!0}};pt.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new L(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new L(t.getMinX(),t.getMinY()),new L(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new L(t.getMinX(),t.getMinY()),new L(t.getMinX(),t.getMaxY()),new L(t.getMaxX(),t.getMaxY()),new L(t.getMaxX(),t.getMinY()),new L(t.getMinX(),t.getMinY())]),null)},pt.prototype.createLineString=function(t){return t?t instanceof Array?new ge(this.getCoordinateSequenceFactory().create(t),this):et(t,mt)?new ge(t,this):void 0:new ge(this.getCoordinateSequenceFactory().create([]),this)},pt.prototype.createMultiLineString=function(){if(arguments.length===0)return new Si(null,this);if(arguments.length===1){var t=arguments[0];return new Si(t,this)}},pt.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();e===null&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(pt.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Pe)return this.createMultiPolygon(pt.toPolygonArray(t));if(a instanceof ge)return this.createMultiLineString(pt.toLineStringArray(t));if(a instanceof vn)return this.createMultiPoint(pt.toPointArray(t));lt.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},pt.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)},pt.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof L){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(et(arguments[0],mt)){var e=arguments[0];return new vn(e,this)}}},pt.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},pt.prototype.createPolygon=function(){if(arguments.length===0)return new Pe(null,null,this);if(arguments.length===1){if(et(arguments[0],mt)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Ir){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Pe(r,i,this)}},pt.prototype.getSRID=function(){return this._SRID},pt.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Qe(null,this);if(arguments.length===1){var t=arguments[0];return new Qe(t,this)}},pt.prototype.createGeometry=function(t){return new Gn(this).edit(t,{edit:function(){if(arguments.length===2){var e=arguments[0];return this._coordinateSequenceFactory.create(e)}}})},pt.prototype.getPrecisionModel=function(){return this._precisionModel},pt.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(et(arguments[0],mt)){var e=arguments[0];return new Ir(e,this)}}},pt.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Sr(null,this);if(arguments.length===1){var t=arguments[0];return new Sr(t,this)}},pt.prototype.createMultiPoint=function(){var t=this;if(arguments.length===0)return new Fo(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Fo(e,this)}if(arguments[0]instanceof Array){var n=arguments[0];return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(et(arguments[0],mt)){var r=arguments[0];if(r===null)return this.createMultiPoint(new Array(0).fill(null));for(var i=new Array(r.size()).fill(null),o=0;o<r.size();o++){var s=t.getCoordinateSequenceFactory().create(1,r.getDimension());me.copy(r,o,s,0,1),i[o]=t.createPoint(s)}return this.createMultiPoint(i)}}},pt.prototype.interfaces_=function(){return[An]},pt.prototype.getClass=function(){return pt},pt.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pt.toGeometryArray=function(t){if(t===null)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},pt.getDefaultCoordinateSequenceFactory=function(){return Cr.instance()},pt.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pt.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pt.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pt.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pt.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pt.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},pt.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},lf.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(pt,lf);var Z0=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],ka=function(t){this.geometryFactory=t||new pt};ka.prototype.read=function(t){var e,n=(e=typeof t=="string"?JSON.parse(t):t).type;if(!lr[n])throw new Error("Unknown GeoJSON type: "+e.type);return Z0.indexOf(n)!==-1?lr[n].apply(this,[e.coordinates]):n==="GeometryCollection"?lr[n].apply(this,[e.geometries]):lr[n].apply(this,[e])},ka.prototype.write=function(t){var e=t.getGeometryType();if(!Yr[e])throw new Error("Geometry is not supported");return Yr[e].apply(this,[t])};var lr={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!lr[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=lr.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(new L(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new L(t[0],t[1]),new L(t[2],t[1]),new L(t[2],t[3]),new L(t[0],t[3]),new L(t[0],t[1])])},Point:function(t){var e=new L(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(lr.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=lr.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(lr.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=lr.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=lr.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);r.push(a)}return this.geometryFactory.createPolygon(n,r)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(lr.Polygon.apply(this,[r]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(this.read(r))}return this.geometryFactory.createGeometryCollection(e)}},Yr={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Yr.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=Yr.Point.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),r=0;r<n.length;++r){var i=n[r];e.push(Yr.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=Yr.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=Yr.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=Yr.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=Yr.Polygon.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=r.getGeometryType();e.push(Yr[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},Ll=function(t){this.geometryFactory=t||new pt,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new ka(this.geometryFactory)};Ll.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===Xt.FIXED&&this.reducePrecision(e),e},Ll.prototype.reducePrecision=function(t){var e,n;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,n=t.points.length;e<n;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;e<n;e++)this.reducePrecision(t.geometries[e])};var cf=function(){this.parser=new ka(this.geometryFactory)};cf.prototype.write=function(t){return this.parser.write(t)};var z=function(){},Ga={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function qa(t){this.message=t||""}function cr(){this.array_=[]}z.prototype.interfaces_=function(){return[]},z.prototype.getClass=function(){return z},z.opposite=function(t){return t===z.LEFT?z.RIGHT:t===z.RIGHT?z.LEFT:t},Ga.ON.get=function(){return 0},Ga.LEFT.get=function(){return 1},Ga.RIGHT.get=function(){return 2},Object.defineProperties(z,Ga),qa.prototype=new Error,qa.prototype.name="EmptyStackException",cr.prototype=new Yn,cr.prototype.add=function(t){return this.array_.push(t),!0},cr.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},cr.prototype.push=function(t){return this.array_.push(t),t},cr.prototype.pop=function(t){if(this.array_.length===0)throw new qa;return this.array_.pop()},cr.prototype.peek=function(){if(this.array_.length===0)throw new qa;return this.array_[this.array_.length-1]},cr.prototype.empty=function(){return this.array_.length===0},cr.prototype.isEmpty=function(){return this.empty()},cr.prototype.search=function(t){return this.array_.indexOf(t)},cr.prototype.size=function(){return this.array_.length},cr.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};var hr=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};hr.prototype.getCoordinate=function(){return this._minCoord},hr.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},hr.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();lt.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],r=X.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===X.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===X.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},hr.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length||n[e].y===n[e+1].y)return-1;var r=z.LEFT;return n[e].y<n[e+1].y&&(r=z.RIGHT),r},hr.prototype.getEdge=function(){return this._orientedDe},hr.prototype.checkForRightmostCoordinate=function(t){for(var e=this,n=t.getEdge().getCoordinates(),r=0;r<n.length-1;r++)(e._minCoord===null||n[r].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])},hr.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},hr.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}lt.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)===z.LEFT&&(this._orientedDe=this._minDe.getSym())},hr.prototype.interfaces_=function(){return[]},hr.prototype.getClass=function(){return hr};var Hr=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new L(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(n,r){return r?n:n+" [ "+r+" ]"},e}(jr),Ba=function(){this.array_=[]};Ba.prototype.addLast=function(t){this.array_.push(t)},Ba.prototype.removeFirst=function(){return this.array_.shift()},Ba.prototype.isEmpty=function(){return this.array_.length===0};var $e=function(){this._finder=null,this._dirEdgeList=new U,this._nodes=new U,this._rightMostCoord=null,this._env=null,this._finder=new hr};$e.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)},$e.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},$e.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var r=n.next();if(r.isVisited()||r.getSym().isVisited()){e=r;break}}if(e===null)throw new Hr("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},$e.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(z.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},$e.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},$e.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(z.RIGHT)>=1&&e.getDepth(z.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},$e.prototype.computeDepths=function(t){var e=new Il,n=new Ba,r=t.getNode();for(n.addLast(r),e.add(r),t.setVisited(!0);!n.isEmpty();){var i=n.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},$e.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},$e.prototype.getEnvelope=function(){if(this._env===null){for(var t=new J,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r<n.length-1;r++)t.expandToInclude(n[r]);this._env=t}return this._env},$e.prototype.addReachable=function(t){var e=new cr;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},$e.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(z.LEFT,t.getDepth(z.RIGHT)),e.setDepth(z.RIGHT,t.getDepth(z.LEFT))},$e.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next();this._dirEdgeList.add(r);var i=r.getSym().getNode();i.isVisited()||e.push(i)}},$e.prototype.getNodes=function(){return this._nodes},$e.prototype.getDirectedEdges=function(){return this._dirEdgeList},$e.prototype.interfaces_=function(){return[Tn]},$e.prototype.getClass=function(){return $e};var oe=function t(){var e=this;if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];this.init(n.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[z.ON]=r}else if(arguments[0]instanceof t){var i=arguments[0];if(this.init(i.location.length),i!==null)for(var o=0;o<this.location.length;o++)e.location[o]=i.location[o]}}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];this.init(3),this.location[z.ON]=s,this.location[z.LEFT]=a,this.location[z.RIGHT]=u}};oe.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},oe.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==A.NONE)return!1;return!0},oe.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===A.NONE&&(this.location[e]=t)},oe.prototype.isLine=function(){return this.location.length===1},oe.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[z.ON]=this.location[z.ON],e[z.LEFT]=A.NONE,e[z.RIGHT]=A.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===A.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},oe.prototype.getLocations=function(){return this.location},oe.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[z.LEFT];this.location[z.LEFT]=this.location[z.RIGHT],this.location[z.RIGHT]=t},oe.prototype.toString=function(){var t=new nr;return this.location.length>1&&t.append(A.toLocationSymbol(this.location[z.LEFT])),t.append(A.toLocationSymbol(this.location[z.ON])),this.location.length>1&&t.append(A.toLocationSymbol(this.location[z.RIGHT])),t.toString()},oe.prototype.setLocations=function(t,e,n){this.location[z.ON]=t,this.location[z.LEFT]=e,this.location[z.RIGHT]=n},oe.prototype.get=function(t){return t<this.location.length?this.location[t]:A.NONE},oe.prototype.isArea=function(){return this.location.length>1},oe.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===A.NONE)return!0;return!1},oe.prototype.setLocation=function(){if(arguments.length===1){var t=arguments[0];this.setLocation(z.ON,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.location[e]=n}},oe.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(A.NONE)},oe.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},oe.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},oe.prototype.interfaces_=function(){return[]},oe.prototype.getClass=function(){return oe};var Kt=function t(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new oe(e),this.elt[1]=new oe(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.elt[0]=new oe(n.elt[0]),this.elt[1]=new oe(n.elt[1])}}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.elt[0]=new oe(A.NONE),this.elt[1]=new oe(A.NONE),this.elt[r].setLocation(i)}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new oe(o,s,a),this.elt[1]=new oe(o,s,a)}else if(arguments.length===4){var u=arguments[0],l=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new oe(A.NONE,A.NONE,A.NONE),this.elt[1]=new oe(A.NONE,A.NONE,A.NONE),this.elt[u].setLocations(l,h,c)}};Kt.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},Kt.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},Kt.prototype.isNull=function(t){return this.elt[t].isNull()},Kt.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},Kt.prototype.isLine=function(t){return this.elt[t].isLine()},Kt.prototype.merge=function(t){for(var e=this,n=0;n<2;n++)e.elt[n]===null&&t.elt[n]!==null?e.elt[n]=new oe(t.elt[n]):e.elt[n].merge(t.elt[n])},Kt.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},Kt.prototype.getLocation=function(){if(arguments.length===1){var t=arguments[0];return this.elt[t].get(z.ON)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},Kt.prototype.toString=function(){var t=new nr;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},Kt.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}},Kt.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},Kt.prototype.setLocation=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(z.ON,e)}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this.elt[n].setLocation(r,i)}},Kt.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},Kt.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},Kt.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new oe(this.elt[t].location[0]))},Kt.prototype.interfaces_=function(){return[]},Kt.prototype.getClass=function(){return Kt},Kt.toLineLabel=function(t){for(var e=new Kt(A.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var be=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new U,this._pts=new U,this._label=new Kt(A.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new U,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};be.prototype.computeRing=function(){if(this._ring!==null)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=X.isCCW(this._ring.getCoordinates())},be.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},be.prototype.computePoints=function(t){var e=this;this._startDe=t;var n=t,r=!0;do{if(n===null)throw new Hr("Found null DirectedEdge");if(n.getEdgeRing()===e)throw new Hr("Directed Edge visited twice during ring-building at "+n.getCoordinate());e._edges.add(n);var i=n.getLabel();lt.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(n.getEdge(),n.isForward(),r),r=!1,e.setEdgeRing(n,e),n=e.getNext(n)}while(n!==this._startDe)},be.prototype.getLinearRing=function(){return this._ring},be.prototype.getCoordinate=function(t){return this._pts.get(t)},be.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var n=e.getNode().getEdges().getOutgoingDegree(t);n>t._maxNodeDegree&&(t._maxNodeDegree=n),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},be.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o<r.length;o++)this._pts.add(r[o])}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;a>=0;a--)this._pts.add(r[a])}},be.prototype.isHole=function(){return this._isHole},be.prototype.setInResult=function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)},be.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t)||!X.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0},be.prototype.addHole=function(t){this._holes.add(t)},be.prototype.isShell=function(){return this._shell===null},be.prototype.getLabel=function(){return this._label},be.prototype.getEdges=function(){return this._edges},be.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},be.prototype.getShell=function(){return this._shell},be.prototype.mergeLabel=function(){if(arguments.length===1){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=e.getLocation(n,z.RIGHT);if(r===A.NONE)return null;if(this._label.getLocation(n)===A.NONE)return this._label.setLocation(n,r),null}},be.prototype.setShell=function(t){this._shell=t,t!==null&&t.addHole(this)},be.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},be.prototype.interfaces_=function(){return[]},be.prototype.getClass=function(){return be};var K0=function(t){function e(){var n=arguments[0],r=arguments[1];t.call(this,n,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(n,r){n.setMinEdgeRing(r)},e.prototype.getNext=function(n){return n.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(be),Q0=function(t){function e(){var n=arguments[0],r=arguments[1];t.call(this,n,r)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var n=new U,r=this._startDe;do{if(r.getMinEdgeRing()===null){var i=new K0(r,this._geometryFactory);n.add(i)}r=r.getNext()}while(r!==this._startDe);return n},e.prototype.setEdgeRing=function(n,r){n.setEdgeRing(r)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var n=this._startDe;do n.getNode().getEdges().linkMinimalDirectedEdges(this),n=n.getNext();while(n!==this._startDe)},e.prototype.getNext=function(n){return n.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(be),Cn=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._label=t}}};Cn.prototype.setVisited=function(t){this._isVisited=t},Cn.prototype.setInResult=function(t){this._isInResult=t},Cn.prototype.isCovered=function(){return this._isCovered},Cn.prototype.isCoveredSet=function(){return this._isCoveredSet},Cn.prototype.setLabel=function(t){this._label=t},Cn.prototype.getLabel=function(){return this._label},Cn.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},Cn.prototype.updateIM=function(t){lt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},Cn.prototype.isInResult=function(){return this._isInResult},Cn.prototype.isVisited=function(){return this._isVisited},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var za=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var n=arguments[0],r=arguments[1];this._coord=n,this._edges=r,this._label=new Kt(0,A.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();)if(n.next().getEdge().isInResult())return!0;return!1},e.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(n){n.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(n){},e.prototype.computeMergedLocation=function(n,r){var i=A.NONE;if(i=this._label.getLocation(r),!n.isNull(r)){var o=n.getLocation(r);i!==A.BOUNDARY&&(i=o)}return i},e.prototype.setLabel=function(){if(arguments.length!==2)return t.prototype.setLabel.apply(this,arguments);var n=arguments[0],r=arguments[1];this._label===null?this._label=new Kt(n,r):this._label.setLocation(n,r)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var n=this;if(arguments[0]instanceof e){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof Kt)for(var i=arguments[0],o=0;o<2;o++){var s=n.computeMergedLocation(i,o),a=n._label.getLocation(o);a===A.NONE&&n._label.setLocation(o,s)}},e.prototype.add=function(n){this._edges.insert(n),n.setNode(this)},e.prototype.setLabelBoundary=function(n){if(this._label===null)return null;var r=A.NONE;this._label!==null&&(r=this._label.getLocation(n));var i=null;switch(r){case A.BOUNDARY:i=A.INTERIOR;break;case A.INTERIOR:default:i=A.BOUNDARY}this._label.setLocation(n,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Cn),pr=function(){this.nodeMap=new He,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};pr.prototype.find=function(t){return this.nodeMap.get(t)},pr.prototype.addNode=function(){if(arguments[0]instanceof L){var t=arguments[0],e=this.nodeMap.get(t);return e===null&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof za){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return r===null?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},pr.prototype.print=function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)},pr.prototype.iterator=function(){return this.nodeMap.values().iterator()},pr.prototype.values=function(){return this.nodeMap.values()},pr.prototype.getBoundaryNodes=function(t){for(var e=new U,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===A.BOUNDARY&&e.add(r)}return e},pr.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr};var te=function(){},Fs={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};te.prototype.interfaces_=function(){return[]},te.prototype.getClass=function(){return te},te.isNorthern=function(t){return t===te.NE||t===te.NW},te.isOpposite=function(t,e){return t!==e&&(t-e+4)%4===2},te.commonHalfPlane=function(t,e){if(t===e)return t;if((t-e+4)%4===2)return-1;var n=t<e?t:e;return n===0&&(t>e?t:e)===3?3:n},te.isInHalfPlane=function(t,e){return e===te.SE?t===te.SE||t===te.SW:t===e||t===e+1},te.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new he("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?te.NE:te.SE:e>=0?te.NW:te.SW}if(arguments[0]instanceof L&&arguments[1]instanceof L){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new he("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?te.NE:te.SE:r.y>=n.y?te.NW:te.SW}},Fs.NE.get=function(){return 0},Fs.NW.get=function(){return 1},Fs.SW.get=function(){return 2},Fs.SE.get=function(){return 3},Object.defineProperties(te,Fs);var We=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=null;this._edge=e,this.init(n,r),this._label=i}else if(arguments.length===4){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this._edge=o,this.init(s,a),this._label=u}};We.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:X.computeOrientation(t._p0,t._p1,this._p1)},We.prototype.getDy=function(){return this._dy},We.prototype.getCoordinate=function(){return this._p0},We.prototype.setNode=function(t){this._node=t},We.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),i=n.substring(r+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},We.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},We.prototype.getDirectedCoordinate=function(){return this._p1},We.prototype.getDx=function(){return this._dx},We.prototype.getLabel=function(){return this._label},We.prototype.getEdge=function(){return this._edge},We.prototype.getQuadrant=function(){return this._quadrant},We.prototype.getNode=function(){return this._node},We.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},We.prototype.computeLabel=function(t){},We.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=te.quadrant(this._dx,this._dy),lt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},We.prototype.interfaces_=function(){return[Tn]},We.prototype.getClass=function(){return We};var Ol=function(t){function e(){var n=arguments[0],r=arguments[1];if(t.call(this,n),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],this._isForward=r,r)this.init(n.getCoordinate(0),n.getCoordinate(1));else{var i=n.getNumPoints()-1;this.init(n.getCoordinate(i),n.getCoordinate(i-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(n){return this._depth[n]},e.prototype.setVisited=function(n){this._isVisited=n},e.prototype.computeDirectedLabel=function(){this._label=new Kt(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(n,r){if(this._depth[n]!==-999&&this._depth[n]!==r)throw new Hr("assigned depths do not match",this.getCoordinate());this._depth[n]=r},e.prototype.isInteriorAreaEdge=function(){for(var n=this,r=!0,i=0;i<2;i++)n._label.isArea(i)&&n._label.getLocation(i,z.LEFT)===A.INTERIOR&&n._label.getLocation(i,z.RIGHT)===A.INTERIOR||(r=!1);return r},e.prototype.setNextMin=function(n){this._nextMin=n},e.prototype.print=function(n){t.prototype.print.call(this,n),n.print(" "+this._depth[z.LEFT]+"/"+this._depth[z.RIGHT]),n.print(" ("+this.getDepthDelta()+")"),this._isInResult&&n.print(" inResult")},e.prototype.setMinEdgeRing=function(n){this._minEdgeRing=n},e.prototype.isLineEdge=function(){var n=this._label.isLine(0)||this._label.isLine(1),r=!this._label.isArea(0)||this._label.allPositionsEqual(0,A.EXTERIOR),i=!this._label.isArea(1)||this._label.allPositionsEqual(1,A.EXTERIOR);return n&&r&&i},e.prototype.setEdgeRing=function(n){this._edgeRing=n},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var n=this._edge.getDepthDelta();return this._isForward||(n=-n),n},e.prototype.setInResult=function(n){this._isInResult=n},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(n){this.print(n),n.print(" "),this._isForward?this._edge.print(n):this._edge.printReverse(n)},e.prototype.setSym=function(n){this._sym=n},e.prototype.setVisitedEdge=function(n){this.setVisited(n),this._sym.setVisited(n)},e.prototype.setEdgeDepths=function(n,r){var i=this.getEdge().getDepthDelta();this._isForward||(i=-i);var o=1;n===z.LEFT&&(o=-1);var s=z.opposite(n),a=r+i*o;this.setDepth(n,r),this.setDepth(s,a)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(n){this._next=n},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(n,r){return n===A.EXTERIOR&&r===A.INTERIOR?1:n===A.INTERIOR&&r===A.EXTERIOR?-1:0},e}(We),ko=function(){};ko.prototype.createNode=function(t){return new za(t,null)},ko.prototype.interfaces_=function(){return[]},ko.prototype.getClass=function(){return ko};var fe=function(){if(this._edges=new U,this._nodes=null,this._edgeEndList=new U,arguments.length===0)this._nodes=new pr(new ko);else if(arguments.length===1){var t=arguments[0];this._nodes=new pr(t)}};fe.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}},fe.prototype.find=function(t){return this._nodes.find(t)},fe.prototype.addNode=function(){if(arguments[0]instanceof za){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof L){var e=arguments[0];return this._nodes.addNode(e)}},fe.prototype.getNodeIterator=function(){return this._nodes.iterator()},fe.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()},fe.prototype.debugPrintln=function(t){qe.out.println(t)},fe.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(n===null)return!1;var r=n.getLabel();return r!==null&&r.getLocation(t)===A.BOUNDARY},fe.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()},fe.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&X.computeOrientation(t,e,r)===X.COLLINEAR&&te.quadrant(t,e)===te.quadrant(n,r)},fe.prototype.getEdgeEnds=function(){return this._edgeEndList},fe.prototype.debugPrint=function(t){qe.out.print(t)},fe.prototype.getEdgeIterator=function(){return this._edges.iterator()},fe.prototype.findEdgeInSameDirection=function(t,e){for(var n=this,r=0;r<this._edges.size();r++){var i=n._edges.get(r),o=i.getCoordinates();if(n.matchInSameDirection(t,e,o[0],o[1])||n.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},fe.prototype.insertEdge=function(t){this._edges.add(t)},fe.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},fe.prototype.addEdges=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();e._edges.add(r);var i=new Ol(r,!0),o=new Ol(r,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},fe.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},fe.prototype.getNodes=function(){return this._nodes.values()},fe.prototype.findEdge=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return r}return null},fe.prototype.interfaces_=function(){return[]},fe.prototype.getClass=function(){return fe},fe.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()};var _n=function(){this._geometryFactory=null,this._shellList=new U;var t=arguments[0];this._geometryFactory=t};_n.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();i.isHole()?n.add(i):e.add(i)}},_n.prototype.computePolygons=function(t){for(var e=new U,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},_n.prototype.placeFreeHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(r.getShell()===null){var i=this.findEdgeRingContaining(r,t);if(i===null)throw new Hr("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},_n.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new U,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);a!==null?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else r.add(o)}return r},_n.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();)if(e.next().containsPoint(t))return!0;return!1},_n.prototype.buildMaximalEdgeRings=function(t){for(var e=new U,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var i=new Q0(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},_n.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},_n.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},_n.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),h=l.getEnvelopeInternal();o!==null&&(s=o.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(r)&&X.isPointInRing(i,l.getCoordinates())&&(c=!0),c&&(o===null||s.contains(h))&&(o=u)}return o},_n.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return lt.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},_n.prototype.add=function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];fe.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new U,o=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n};var Go=function(){};Go.prototype.getBounds=function(){},Go.prototype.interfaces_=function(){return[]},Go.prototype.getClass=function(){return Go};var Jn=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};Jn.prototype.getItem=function(){return this._item},Jn.prototype.getBounds=function(){return this._bounds},Jn.prototype.interfaces_=function(){return[Go,An]},Jn.prototype.getClass=function(){return Jn};var Wr=function(){this._size=null,this._items=null,this._size=0,this._items=new U,this._items.add(null)};Wr.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},Wr.prototype.size=function(){return this._size},Wr.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);2*t<=this._size&&((n=2*t)!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)},Wr.prototype.clear=function(){this._size=0,this._items.clear()},Wr.prototype.isEmpty=function(){return this._size===0},Wr.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var si=function(){};si.prototype.visitItem=function(t){},si.prototype.interfaces_=function(){return[]},si.prototype.getClass=function(){return si};var Qi=function(){};Qi.prototype.insert=function(t,e){},Qi.prototype.remove=function(t,e){},Qi.prototype.query=function(){},Qi.prototype.interfaces_=function(){return[]},Qi.prototype.getClass=function(){return Qi};var Me=function(){if(this._childBoundables=new U,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this._level=t}}},hf={serialVersionUID:{configurable:!0}};Me.prototype.getLevel=function(){return this._level},Me.prototype.size=function(){return this._childBoundables.size()},Me.prototype.getChildBoundables=function(){return this._childBoundables},Me.prototype.addChildBoundable=function(t){lt.isTrue(this._bounds===null),this._childBoundables.add(t)},Me.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Me.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Me.prototype.interfaces_=function(){return[Go,An]},Me.prototype.getClass=function(){return Me},hf.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Me,hf);var Zn=function(){};Zn.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},Zn.min=function(t){return Zn.sort(t),t.get(0)},Zn.sort=function(t,e){var n=t.toArray();e?Ii.sort(n,e):Ii.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},Zn.singletonList=function(t){var e=new U;return e.add(t),e};var we=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};we.prototype.expandToQueue=function(t,e){var n=we.isComposite(this._boundable1),r=we.isComposite(this._boundable2);if(n&&r)return we.area(this._boundable1)>we.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new he("neither boundable is composite")},we.prototype.isLeaves=function(){return!(we.isComposite(this._boundable1)||we.isComposite(this._boundable2))},we.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},we.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new we(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},we.prototype.getBoundable=function(t){return t===0?this._boundable1:this._boundable2},we.prototype.getDistance=function(){return this._distance},we.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},we.prototype.interfaces_=function(){return[Tn]},we.prototype.getClass=function(){return we},we.area=function(t){return t.getBounds().getArea()},we.isComposite=function(t){return t instanceof Me};var Ae=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new U,this._nodeCapacity=null,arguments.length===0){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(arguments.length===1){var n=arguments[0];lt.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},ja={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Ae.prototype.getNodeCapacity=function(){return this._nodeCapacity},Ae.prototype.lastNode=function(t){return t.get(t.size()-1)},Ae.prototype.size=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Me?n+=t.size(i):i instanceof Jn&&(n+=1)}return n}},Ae.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof Jn&&i.getItem()===e&&(n=i)}return n!==null&&(t.getChildBoundables().remove(n),!0)},Ae.prototype.itemsTree=function(){var t=this;if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new U:e}if(arguments.length===1){for(var n=arguments[0],r=new U,i=n.getChildBoundables().iterator();i.hasNext();){var o=i.next();if(o instanceof Me){var s=t.itemsTree(o);s!==null&&r.add(s)}else o instanceof Jn?r.add(o.getItem()):lt.shouldNeverReachHere()}return r.size()<=0?null:r}},Ae.prototype.insert=function(t,e){lt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Jn(t,e))},Ae.prototype.boundablesAtLevel=function(){var t=this;if(arguments.length===1){var e=arguments[0],n=new U;return this.boundablesAtLevel(e,this._root,n),n}if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];if(lt.isTrue(r>-2),i.getLevel()===r)return o.add(i),null;for(var s=i.getChildBoundables().iterator();s.hasNext();){var a=s.next();a instanceof Me?t.boundablesAtLevel(r,a,o):(lt.isTrue(a instanceof Jn),r===-1&&o.add(a))}return null}},Ae.prototype.query=function(){var t=this;if(arguments.length===1){var e=arguments[0];this.build();var n=new U;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}if(arguments.length===2){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(arguments.length===3){if(et(arguments[2],si)&&arguments[0]instanceof Object&&arguments[1]instanceof Me)for(var o=arguments[0],s=arguments[1],a=arguments[2],u=s.getChildBoundables(),l=0;l<u.size();l++){var h=u.get(l);t.getIntersectsOp().intersects(h.getBounds(),o)&&(h instanceof Me?t.query(o,h,a):h instanceof Jn?a.visitItem(h.getItem()):lt.shouldNeverReachHere())}else if(et(arguments[2],Yn)&&arguments[0]instanceof Object&&arguments[1]instanceof Me)for(var c=arguments[0],p=arguments[1],d=arguments[2],g=p.getChildBoundables(),m=0;m<g.size();m++){var f=g.get(m);t.getIntersectsOp().intersects(f.getBounds(),c)&&(f instanceof Me?t.query(c,f,d):f instanceof Jn?d.add(f.getItem()):lt.shouldNeverReachHere())}}},Ae.prototype.build=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},Ae.prototype.getRoot=function(){return this.build(),this._root},Ae.prototype.remove=function(){var t=this;if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.remove(e,this._root,n)}if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2],s=this.removeItem(i,o);if(s)return!0;for(var a=null,u=i.getChildBoundables().iterator();u.hasNext();){var l=u.next();if(t.getIntersectsOp().intersects(l.getBounds(),r)&&l instanceof Me&&(s=t.remove(r,l,o))){a=l;break}}return a!==null&&a.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(a),s}},Ae.prototype.createHigherLevels=function(t,e){lt.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return n.size()===1?n.get(0):this.createHigherLevels(n,e+1)},Ae.prototype.depth=function(){var t=this;if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var e=arguments[0],n=0,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof Me){var o=t.depth(i);o>n&&(n=o)}}return n+1}},Ae.prototype.createParentBoundables=function(t,e){var n=this;lt.isTrue(!t.isEmpty());var r=new U;r.add(this.createNode(e));var i=new U(t);Zn.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(s)}return r},Ae.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Ae.prototype.interfaces_=function(){return[An]},Ae.prototype.getClass=function(){return Ae},Ae.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},ja.IntersectsOp.get=function(){return $0},ja.serialVersionUID.get=function(){return-3886435814360241e3},ja.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Ae,ja);var $0=function(){},qo=function(){};qo.prototype.distance=function(t,e){},qo.prototype.interfaces_=function(){return[]},qo.prototype.getClass=function(){return qo};var pf=function(t){function e(r){r=r||e.DEFAULT_NODE_CAPACITY,t.call(this,r)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(r,i){lt.isTrue(r.length>0);for(var o=new U,s=0;s<r.length;s++)o.addAll(this.createParentBoundablesFromVerticalSlice(r[s],i));return o},e.prototype.createNode=function(r){return new ff(r)},e.prototype.size=function(){return arguments.length===0?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(arguments.length!==2)return t.prototype.insert.apply(this,arguments);var r=arguments[0],i=arguments[1];if(r.isNull())return null;t.prototype.insert.call(this,r,i)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(r,i){for(var o=Math.trunc(Math.ceil(r.size()/i)),s=new Array(i).fill(null),a=r.iterator(),u=0;u<i;u++){s[u]=new U;for(var l=0;a.hasNext()&&l<o;){var h=a.next();s[u].add(h),l++}}return s},e.prototype.query=function(){if(arguments.length===1){var r=arguments[0];return t.prototype.query.call(this,r)}if(arguments.length===2){var i=arguments[0],o=arguments[1];t.prototype.query.call(this,i,o)}else if(arguments.length===3){if(et(arguments[2],si)&&arguments[0]instanceof Object&&arguments[1]instanceof Me){var s=arguments[0],a=arguments[1],u=arguments[2];t.prototype.query.call(this,s,a,u)}else if(et(arguments[2],Yn)&&arguments[0]instanceof Object&&arguments[1]instanceof Me){var l=arguments[0],h=arguments[1],c=arguments[2];t.prototype.query.call(this,l,h,c)}}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(r,i){return t.prototype.createParentBoundables.call(this,r,i)},e.prototype.remove=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return t.prototype.remove.call(this,r,i)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return arguments.length===0?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(r,i){lt.isTrue(!r.isEmpty());var o=Math.trunc(Math.ceil(r.size()/this.getNodeCapacity())),s=new U(r);Zn.sort(s,e.xComparator);var a=this.verticalSlices(s,Math.trunc(Math.ceil(Math.sqrt(o))));return this.createParentBoundablesFromVerticalSlices(a,i)},e.prototype.nearestNeighbour=function(){if(arguments.length===1){if(et(arguments[0],qo)){var r=arguments[0],i=new we(this.getRoot(),this.getRoot(),r);return this.nearestNeighbour(i)}if(arguments[0]instanceof we){var o=arguments[0];return this.nearestNeighbour(o,st.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof e&&et(arguments[1],qo)){var s=arguments[0],a=arguments[1],u=new we(this.getRoot(),s.getRoot(),a);return this.nearestNeighbour(u)}if(arguments[0]instanceof we&&typeof arguments[1]=="number"){var l=arguments[0],h=arguments[1],c=h,p=null,d=new Wr;for(d.add(l);!d.isEmpty()&&c>0;){var g=d.poll(),m=g.getDistance();if(m>=c)break;g.isLeaves()?(c=m,p=g):g.expandToQueue(d,c)}return[p.getBoundable(0).getItem(),p.getBoundable(1).getItem()]}}else if(arguments.length===3){var f=arguments[0],_=arguments[1],I=arguments[2],y=new Jn(f,_),v=new we(this.getRoot(),y,I);return this.nearestNeighbour(v)[0]}},e.prototype.interfaces_=function(){return[Qi,An]},e.prototype.getClass=function(){return e},e.centreX=function(r){return e.avg(r.getMinX(),r.getMaxX())},e.avg=function(r,i){return(r+i)/2},e.centreY=function(r){return e.avg(r.getMinY(),r.getMaxY())},n.STRtreeNode.get=function(){return ff},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[So]},compare:function(r,i){return t.compareDoubles(e.centreX(r.getBounds()),e.centreX(i.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[So]},compare:function(r,i){return t.compareDoubles(e.centreY(r.getBounds()),e.centreY(i.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(r,i){return r.intersects(i)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(Ae),ff=function(t){function e(){var n=arguments[0];t.call(this,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var n=null,r=this.getChildBoundables().iterator();r.hasNext();){var i=r.next();n===null?n=new J(i.getBounds()):n.expandToInclude(i.getBounds())}return n},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Me),pn=function(){};pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},pn.relativeSign=function(t,e){return t<e?-1:t>e?1:0},pn.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=pn.relativeSign(e.x,n.x),i=pn.relativeSign(e.y,n.y);switch(t){case 0:return pn.compareValue(r,i);case 1:return pn.compareValue(i,r);case 2:return pn.compareValue(i,-r);case 3:return pn.compareValue(-r,i);case 4:return pn.compareValue(-r,-i);case 5:return pn.compareValue(-i,-r);case 6:return pn.compareValue(-i,r);case 7:return pn.compareValue(r,-i)}return lt.shouldNeverReachHere("invalid octant value"),0},pn.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var ai=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new L(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};ai.prototype.getCoordinate=function(){return this.coord},ai.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},ai.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:pn.compare(this._segmentOctant,this.coord,e.coord)},ai.prototype.isEndPoint=function(t){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===t},ai.prototype.isInterior=function(){return this._isInterior},ai.prototype.interfaces_=function(){return[Tn]},ai.prototype.getClass=function(){return ai};var tn=function(){this._nodeMap=new He,this._edge=null;var t=arguments[0];this._edge=t};tn.prototype.getSplitCoordinates=function(){var t=new Ps;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.addEdgeCoordinates(n,r,t),n=r}return t.toCoordinateArray()},tn.prototype.addCollapsedNodes=function(){var t=new U;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},tn.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},tn.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),r=this._edge.getCoordinate(e+2);n.equals2D(r)&&t.add(new rr(e+1))}},tn.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new L(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new L(e.coord))},tn.prototype.iterator=function(){return this._nodeMap.values().iterator()},tn.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},tn.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var r=e.segmentIndex-t.segmentIndex;return e.isInterior()||r--,r===1&&(n[0]=t.segmentIndex+1,!0)},tn.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();this.findCollapseIndex(r,i,e)&&t.add(new rr(e[0])),r=i}},tn.prototype.getEdge=function(){return this._edge},tn.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},tn.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new L(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new L(e.coord)),new _e(o,this._edge.getData())},tn.prototype.add=function(t,e){var n=new ai(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return r!==null?(lt.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},tn.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new jr("bad split edge start point at "+n);var r=t.get(t.size()-1).getCoordinates(),i=r[r.length-1];if(!i.equals2D(e[e.length-1]))throw new jr("bad split edge end point at "+i)},tn.prototype.interfaces_=function(){return[]},tn.prototype.getClass=function(){return tn};var $i=function(){};$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},$i.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new he("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof L&&arguments[1]instanceof L){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(s===0&&a===0)throw new he("Cannot compute the octant for two identical points "+i);return $i.octant(s,a)}};var Nr=function(){};Nr.prototype.getCoordinates=function(){},Nr.prototype.size=function(){},Nr.prototype.getCoordinate=function(t){},Nr.prototype.isClosed=function(){},Nr.prototype.setData=function(t){},Nr.prototype.getData=function(){},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var ks=function(){};ks.prototype.addIntersection=function(t,e){},ks.prototype.interfaces_=function(){return[Nr]},ks.prototype.getClass=function(){return ks};var _e=function(){this._nodeList=new tn(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};_e.prototype.getCoordinates=function(){return this._pts},_e.prototype.size=function(){return this._pts.length},_e.prototype.getCoordinate=function(t){return this._pts[t]},_e.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},_e.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},_e.prototype.setData=function(t){this._data=t},_e.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:$i.octant(t,e)},_e.prototype.getData=function(){return this._data},_e.prototype.addIntersection=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[3],o=new L(n.getIntersection(i));this.addIntersection(o,r)}},_e.prototype.toString=function(){return Xn.toLineString(new ve(this._pts))},_e.prototype.getNodeList=function(){return this._nodeList},_e.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r<this._pts.length){var i=this._pts[r];t.equals2D(i)&&(n=r)}return this._nodeList.add(t,n)},_e.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},_e.prototype.interfaces_=function(){return[ks]},_e.prototype.getClass=function(){return _e},_e.getNodedSubstrings=function(){if(arguments.length===1){var t=arguments[0],e=new U;return _e.getNodedSubstrings(t,e),e}if(arguments.length===2)for(var n=arguments[0],r=arguments[1],i=n.iterator();i.hasNext();){var o=i.next();o.getNodeList().addSplitEdges(r)}};var Z=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new L,this.p1=new L;else if(arguments.length===1){var t=arguments[0];this.p0=new L(t.p0),this.p1=new L(t.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this.p0=new L(e,n),this.p1=new L(r,i)}},gf={serialVersionUID:{configurable:!0}};Z.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Z.prototype.orientationIndex=function(){if(arguments[0]instanceof Z){var t=arguments[0],e=X.orientationIndex(this.p0,this.p1,t.p0),n=X.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof L){var r=arguments[0];return X.orientationIndex(this.p0,this.p1,r)}},Z.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},Z.prototype.isVertical=function(){return this.p0.x===this.p1.x},Z.prototype.equals=function(t){if(!(t instanceof Z))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},Z.prototype.intersection=function(t){var e=new wi;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},Z.prototype.project=function(){if(arguments[0]instanceof L){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new L(t);var e=this.projectionFactor(t),n=new L;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof Z){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(i>=1&&o>=1||i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new Z(s,a)}},Z.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Z.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Z.prototype.getCoordinate=function(t){return t===0?this.p0:this.p1},Z.prototype.distancePerpendicular=function(t){return X.distancePointLinePerpendicular(t,this.p0,this.p1)},Z.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Z.prototype.midPoint=function(){return Z.midPoint(this.p0,this.p1)},Z.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?st.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},Z.prototype.closestPoints=function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=st.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<r&&(r=i,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<r&&(r=i,n[0]=this.p0,n[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<r&&(r=i,n[0]=this.p1,n[1]=u),n},Z.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},Z.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Z.prototype.getLength=function(){return this.p0.distance(this.p1)},Z.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return n!==0?n:this.p1.compareTo(e.p1)},Z.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},Z.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},Z.prototype.lineIntersection=function(t){try{return Vn.intersection(this.p0,this.p1,t.p0,t.p1)}catch(e){if(!(e instanceof No))throw e}return null},Z.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Z.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,u=0;if(e!==0){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,u=e*o/s}return new L(n-u,r+a)},Z.prototype.setCoordinates=function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},Z.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||st.isNaN(e))&&(e=1),e},Z.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Z.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Z.prototype.distance=function(){if(arguments[0]instanceof Z){var t=arguments[0];return X.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof L){var e=arguments[0];return X.distancePointLine(e,this.p0,this.p1)}},Z.prototype.pointAlong=function(t){var e=new L;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},Z.prototype.hashCode=function(){var t=st.doubleToLongBits(this.p0.x);t^=31*st.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=st.doubleToLongBits(this.p1.x);return n^=31*st.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))},Z.prototype.interfaces_=function(){return[Tn,An]},Z.prototype.getClass=function(){return Z},Z.midPoint=function(t,e){return new L((t.x+e.x)/2,(t.y+e.y)/2)},gf.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Z,gf);var Gs=function(){this.tempEnv1=new J,this.tempEnv2=new J,this._overlapSeg1=new Z,this._overlapSeg2=new Z};Gs.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},Gs.prototype.interfaces_=function(){return[]},Gs.prototype.getClass=function(){return Gs};var xn=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};xn.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},xn.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e<s&&this.computeSelect(t,e,s,r),s<n&&this.computeSelect(t,s,n,r)},xn.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t},xn.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},xn.prototype.setId=function(t){this._id=t},xn.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},xn.prototype.getEnvelope=function(){if(this._env===null){var t=this._pts[this._start],e=this._pts[this._end];this._env=new J(t,e)}return this._env},xn.prototype.getEndIndex=function(){return this._end},xn.prototype.getStartIndex=function(){return this._start},xn.prototype.getContext=function(){return this._context},xn.prototype.getId=function(){return this._id},xn.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],u=n._pts[r],l=n._pts[i];if(e-t==1&&i-r==1)return o.overlap(this,t,n,r),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((r+i)/2);t<h&&(r<c&&this.computeOverlapsInternal(t,h,n,r,c,o),c<i&&this.computeOverlapsInternal(t,h,n,c,i,o)),h<e&&(r<c&&this.computeOverlapsInternal(h,e,n,r,c,o),c<i&&this.computeOverlapsInternal(h,e,n,c,i,o))},xn.prototype.interfaces_=function(){return[]},xn.prototype.getClass=function(){return xn};var fr=function(){};fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},fr.getChainStartIndices=function(t){var e=0,n=new U;n.add(new rr(e));do{var r=fr.findChainEnd(t,e);n.add(new rr(r)),e=r}while(e<t.length-1);return fr.toIntArray(n)},fr.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var r=te.quadrant(t[n],t[n+1]),i=e+1;i<t.length&&!(!t[i-1].equals2D(t[i])&&te.quadrant(t[i-1],t[i])!==r);)i++;return i-1},fr.getChains=function(){if(arguments.length===1){var t=arguments[0];return fr.getChains(t,null)}if(arguments.length===2){for(var e=arguments[0],n=arguments[1],r=new U,i=fr.getChainStartIndices(e),o=0;o<i.length-1;o++){var s=new xn(e,i[o],i[o+1],n);r.add(s)}return r}},fr.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Ci=function(){};Ci.prototype.computeNodes=function(t){},Ci.prototype.getNodedSubstrings=function(){},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var qs=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setSegmentIntersector(t)}}};qs.prototype.setSegmentIntersector=function(t){this._segInt=t},qs.prototype.interfaces_=function(){return[Ci]},qs.prototype.getClass=function(){return qs};var Rl=function(t){function e(r){r?t.call(this,r):t.call(this),this._monoChains=new U,this._index=new pf,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return _e.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(r){for(var i=this,o=fr.getChains(r.getCoordinates(),r).iterator();o.hasNext();){var s=o.next();s.setId(i._idCounter++),i._index.insert(s.getEnvelope(),s),i._monoChains.add(s)}},e.prototype.computeNodes=function(r){this._nodedSegStrings=r;for(var i=r.iterator();i.hasNext();)this.add(i.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var r=this,i=new df(this._segInt),o=this._monoChains.iterator();o.hasNext();)for(var s=o.next(),a=r._index.query(s.getEnvelope()).iterator();a.hasNext();){var u=a.next();if(u.getId()>s.getId()&&(s.computeOverlaps(u,i),r._nOverlaps++),r._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return df},Object.defineProperties(e,n),e}(qs),df=function(t){function e(){t.call(this),this._si=null;var n=arguments[0];this._si=n}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(arguments.length!==4)return t.prototype.overlap.apply(this,arguments);var n=arguments[0],r=arguments[1],i=arguments[2],o=arguments[3],s=n.getContext(),a=i.getContext();this._si.processIntersections(s,r,a,o)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Gs),Yt=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(arguments.length===4){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}}},Jr={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};Yt.prototype.getEndCapStyle=function(){return this._endCapStyle},Yt.prototype.isSingleSided=function(){return this._isSingleSided},Yt.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=Yt.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Yt.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==Yt.JOIN_ROUND&&(this._quadrantSegments=Yt.DEFAULT_QUADRANT_SEGMENTS)},Yt.prototype.getJoinStyle=function(){return this._joinStyle},Yt.prototype.setJoinStyle=function(t){this._joinStyle=t},Yt.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},Yt.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Yt.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Yt.prototype.setEndCapStyle=function(t){this._endCapStyle=t},Yt.prototype.getMitreLimit=function(){return this._mitreLimit},Yt.prototype.setMitreLimit=function(t){this._mitreLimit=t},Yt.prototype.setSingleSided=function(t){this._isSingleSided=t},Yt.prototype.interfaces_=function(){return[]},Yt.prototype.getClass=function(){return Yt},Yt.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},Jr.CAP_ROUND.get=function(){return 1},Jr.CAP_FLAT.get=function(){return 2},Jr.CAP_SQUARE.get=function(){return 3},Jr.JOIN_ROUND.get=function(){return 1},Jr.JOIN_MITRE.get=function(){return 2},Jr.JOIN_BEVEL.get=function(){return 3},Jr.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Jr.DEFAULT_MITRE_LIMIT.get=function(){return 5},Jr.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Yt,Jr);var de=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=X.COUNTERCLOCKWISE,this._inputLine=t||null},Bs={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};de.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r)},de.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r<this._inputLine.length;){var o=!1;t.isDeletable(e,n,r,t._distanceTol)&&(t._isDeleted[n]=de.DELETE,o=!0,i=!0),e=o?r:n,n=t.findNextNonDeletedIndex(e),r=t.findNextNonDeletedIndex(n)}return i},de.prototype.isShallowConcavity=function(t,e,n,r){return X.computeOrientation(t,e,n)===this._angleOrientation&&X.distancePointLine(e,t,n)<r},de.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/de.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s<r;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},de.prototype.isConcave=function(t,e,n){var r=X.computeOrientation(t,e,n)===this._angleOrientation;return r},de.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=X.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do e=this.deleteShallowConcavities();while(e);return this.collapseLine()},de.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===de.DELETE;)e++;return e},de.prototype.isShallow=function(t,e,n,r){return X.distancePointLine(e,t,n)<r},de.prototype.collapseLine=function(){for(var t=new Ps,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==de.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},de.prototype.interfaces_=function(){return[]},de.prototype.getClass=function(){return de},de.simplify=function(t,e){return new de(t).simplify(e)},Bs.INIT.get=function(){return 0},Bs.DELETE.get=function(){return 1},Bs.KEEP.get=function(){return 1},Bs.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(de,Bs);var Nn=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new U},yf={COORDINATE_ARRAY_TYPE:{configurable:!0}};Nn.prototype.getCoordinates=function(){return this._ptList.toArray(Nn.COORDINATE_ARRAY_TYPE)},Nn.prototype.setPrecisionModel=function(t){this._precisionModel=t},Nn.prototype.addPt=function(t){var e=new L(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},Nn.prototype.revere=function(){},Nn.prototype.addPts=function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var r=t.length-1;r>=0;r--)this.addPt(t[r])},Nn.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},Nn.prototype.toString=function(){return new pt().createLineString(this.getCoordinates()).toString()},Nn.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new L(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},Nn.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},Nn.prototype.interfaces_=function(){return[]},Nn.prototype.getClass=function(){return Nn},yf.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Nn,yf);var dt=function(){},to={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt},dt.toDegrees=function(t){return 180*t/Math.PI},dt.normalize=function(t){for(;t>Math.PI;)t-=dt.PI_TIMES_2;for(;t<=-Math.PI;)t+=dt.PI_TIMES_2;return t},dt.angle=function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},dt.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)>0},dt.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0},dt.interiorAngle=function(t,e,n){var r=dt.angle(e,t),i=dt.angle(e,n);return Math.abs(i-r)},dt.normalizePositive=function(t){if(t<0){for(;t<0;)t+=dt.PI_TIMES_2;t>=dt.PI_TIMES_2&&(t=0)}else{for(;t>=dt.PI_TIMES_2;)t-=dt.PI_TIMES_2;t<0&&(t=0)}return t},dt.angleBetween=function(t,e,n){var r=dt.angle(e,t),i=dt.angle(e,n);return dt.diff(r,i)},dt.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},dt.toRadians=function(t){return t*Math.PI/180},dt.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?dt.COUNTERCLOCKWISE:n<0?dt.CLOCKWISE:dt.NONE},dt.angleBetweenOriented=function(t,e,n){var r=dt.angle(e,t),i=dt.angle(e,n)-r;return i<=-Math.PI?i+dt.PI_TIMES_2:i>Math.PI?i-dt.PI_TIMES_2:i},to.PI_TIMES_2.get=function(){return 2*Math.PI},to.PI_OVER_2.get=function(){return Math.PI/2},to.PI_OVER_4.get=function(){return Math.PI/4},to.COUNTERCLOCKWISE.get=function(){return X.COUNTERCLOCKWISE},to.CLOCKWISE.get=function(){return X.CLOCKWISE},to.NONE.get=function(){return X.COLLINEAR},Object.defineProperties(dt,to);var ue=function t(){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 Z,this._seg1=new Z,this._offset0=new Z,this._offset1=new Z,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new wi,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===Yt.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},zs={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};ue.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=X.computeOrientation(this._s0,this._s1,this._s2),r=n===X.CLOCKWISE&&this._side===z.LEFT||n===X.COUNTERCLOCKWISE&&this._side===z.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},ue.prototype.addLineEndCap=function(t,e){var n=new Z(t,e),r=new Z;this.computeOffsetSegment(n,z.LEFT,this._distance,r);var i=new Z;this.computeOffsetSegment(n,z.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case Yt.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,X.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case Yt.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case Yt.CAP_SQUARE:var u=new L;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new L(r.p1.x+u.x,r.p1.y+u.y),h=new L(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(h)}},ue.prototype.getCoordinates=function(){return this._segList.getCoordinates()},ue.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=Vn.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs(r))>this._bufParams.getMitreLimit()&&(i=!1)}catch(s){if(!(s instanceof No))throw s;o=new L(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},ue.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,l=n.y-t.y,h=Math.atan2(l,u);r===X.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,h,r,i),this._segList.addPt(n)},ue.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*ue.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Yt.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Yt.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},ue.prototype.createSquare=function(t){this._segList.addPt(new L(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new L(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new L(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new L(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},ue.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},ue.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},ue.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},ue.prototype.initSideSegments=function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)},ue.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=dt.angle(i,this._seg0.p0),s=dt.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=dt.normalize(o+s),u=dt.normalize(a+Math.PI),l=r*n,h=n-l*Math.abs(Math.sin(s)),c=i.x+l*Math.cos(u),p=i.y+l*Math.sin(u),d=new L(c,p),g=new Z(i,d),m=g.pointAlongOffset(1,h),f=g.pointAlongOffset(1,-h);this._side===z.LEFT?(this._segList.addPt(m),this._segList.addPt(f)):(this._segList.addPt(f),this._segList.addPt(m))},ue.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===z.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=i*n*o/a,l=i*n*s/a;r.p0.x=t.p0.x-l,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-l,r.p1.y=t.p1.y+u},ue.prototype.addFilletArc=function(t,e,n,r,i){var o=r===X.CLOCKWISE?-1:1,s=Math.abs(e-n),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,h=new L;l<s;){var c=e+o*l;h.x=t.x+i*Math.cos(c),h.y=t.y+i*Math.sin(c),this._segList.addPt(h),l+=u}},ue.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*ue.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 L((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 r=new L((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(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},ue.prototype.createCircle=function(t){var e=new L(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},ue.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},ue.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Nn,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*ue.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},ue.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Yt.JOIN_BEVEL||this._bufParams.getJoinStyle()===Yt.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,X.CLOCKWISE,this._distance))},ue.prototype.closeRing=function(){this._segList.closeRing()},ue.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},ue.prototype.interfaces_=function(){return[]},ue.prototype.getClass=function(){return ue},zs.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},zs.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},zs.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},zs.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(ue,zs);var fn=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};fn.prototype.getOffsetCurve=function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&ht.reverse(o),o},fn.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=de.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],z.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=de.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],z.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},fn.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===z.RIGHT&&(r=-r);var i=de.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=s!==1;n.addNextSegment(i[s],a)}n.closeRing()},fn.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=de.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],z.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=de.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],z.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},fn.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case Yt.CAP_ROUND:e.createCircle(t);break;case Yt.CAP_SQUARE:e.createSquare(t)}},fn.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided()||e===0)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()},fn.prototype.getBufferParameters=function(){return this._bufParams},fn.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},fn.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return fn.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},fn.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=de.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],z.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{var a=de.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],z.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},fn.prototype.getSegGen=function(t){return new ue(this._precisionModel,this._bufParams,t)},fn.prototype.interfaces_=function(){return[]},fn.prototype.getClass=function(){return fn},fn.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new L(t[n]);return e};var eo=function(){this._subgraphs=null,this._seg=new Z,this._cga=new X;var t=arguments[0];this._subgraphs=t},mf={DepthSegment:{configurable:!0}};eo.prototype.findStabbedSegments=function(){var t=this;if(arguments.length===1){for(var e=arguments[0],n=new U,r=this._subgraphs.iterator();r.hasNext();){var i=r.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}if(arguments.length===3){if(et(arguments[2],Yn)&&arguments[0]instanceof L&&arguments[1]instanceof Ol)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),h=0;h<l.length-1;h++){t._seg.p0=l[h],t._seg.p1=l[h+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse();var c=Math.max(t._seg.p0.x,t._seg.p1.x);if(!(c<s.x)&&!(t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||X.computeOrientation(t._seg.p0,t._seg.p1,s)===X.RIGHT)){var p=a.getDepth(z.LEFT);t._seg.p0.equals(l[h])||(p=a.getDepth(z.RIGHT));var d=new Ni(t._seg,p);u.add(d)}}else if(et(arguments[2],Yn)&&arguments[0]instanceof L&&et(arguments[1],Yn))for(var g=arguments[0],m=arguments[1],f=arguments[2],_=m.iterator();_.hasNext();){var I=_.next();I.isForward()&&t.findStabbedSegments(g,I,f)}}},eo.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return e.size()===0?0:Zn.min(e)._leftDepth},eo.prototype.interfaces_=function(){return[]},eo.prototype.getClass=function(){return eo},mf.DepthSegment.get=function(){return Ni},Object.defineProperties(eo,mf);var Ni=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new Z(t),this._leftDepth=e};Ni.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return n!==0||(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))!==0?n:this._upwardSeg.compareTo(e._upwardSeg)},Ni.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return n!==0?n:t.p1.compareTo(e.p1)},Ni.prototype.toString=function(){return this._upwardSeg.toString()},Ni.prototype.interfaces_=function(){return[Tn]},Ni.prototype.getClass=function(){return Ni};var Ht=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Ht.prototype.area=function(){return Ht.area(this.p0,this.p1,this.p2)},Ht.prototype.signedArea=function(){return Ht.signedArea(this.p0,this.p1,this.p2)},Ht.prototype.interpolateZ=function(t){if(t===null)throw new he("Supplied point is null.");return Ht.interpolateZ(t,this.p0,this.p1,this.p2)},Ht.prototype.longestSideLength=function(){return Ht.longestSideLength(this.p0,this.p1,this.p2)},Ht.prototype.isAcute=function(){return Ht.isAcute(this.p0,this.p1,this.p2)},Ht.prototype.circumcentre=function(){return Ht.circumcentre(this.p0,this.p1,this.p2)},Ht.prototype.area3D=function(){return Ht.area3D(this.p0,this.p1,this.p2)},Ht.prototype.centroid=function(){return Ht.centroid(this.p0,this.p1,this.p2)},Ht.prototype.inCentre=function(){return Ht.inCentre(this.p0,this.p1,this.p2)},Ht.prototype.interfaces_=function(){return[]},Ht.prototype.getClass=function(){return Ht},Ht.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},Ht.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Ht.det=function(t,e,n,r){return t*r-e*n},Ht.interpolateZ=function(t,e,n,r){var i=e.x,o=e.y,s=n.x-i,a=r.x-i,u=n.y-o,l=r.y-o,h=s*l-a*u,c=t.x-i,p=t.y-o,d=(l*c-a*p)/h,g=(-u*c+s*p)/h;return e.z+d*(n.z-e.z)+g*(r.z-e.z)},Ht.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return i>s&&(s=i),o>s&&(s=o),s},Ht.isAcute=function(t,e,n){return!!dt.isAcute(t,e,n)&&!!dt.isAcute(e,n,t)&&!!dt.isAcute(n,t,e)},Ht.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,u=e.y-i,l=2*Ht.det(o,s,a,u),h=Ht.det(s,o*o+s*s,u,a*a+u*u),c=Ht.det(o,o*o+s*s,a,a*a+u*u);return new L(r-h/l,i+c/l)},Ht.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Vn(t.x+n/2,t.y+r/2,1),o=new Vn(t.x-r+n/2,t.y+n+r/2,1);return new Vn(i,o)},Ht.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new L(t.x+i*o,t.y+i*s)},Ht.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=i*u-o*a,h=o*s-r*u,c=r*a-i*s,p=l*l+h*h+c*c,d=Math.sqrt(p)/2;return d},Ht.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new L(r,i)},Ht.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,u=(r*t.y+i*e.y+o*n.y)/s;return new L(a,u)};var qn=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new U;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};qn.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,A.EXTERIOR,A.INTERIOR)},qn.prototype.addPolygon=function(t){var e=this,n=this._distance,r=z.LEFT;this._distance<0&&(n=-this._distance,r=z.RIGHT);var i=t.getExteriorRing(),o=ht.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,n,r,A.EXTERIOR,A.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=ht.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,n,z.opposite(r),A.INTERIOR,A.EXTERIOR)}},qn.prototype.isTriangleErodedCompletely=function(t,e){var n=new Ht(t[0],t[1],t[2]),r=n.inCentre();return X.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},qn.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=ht.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,A.EXTERIOR,A.INTERIOR)},qn.prototype.addCurve=function(t,e,n){if(t===null||t.length<2)return null;var r=new _e(t,new Kt(0,A.BOUNDARY,e,n));this._curveList.add(r)},qn.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},qn.prototype.addPolygonRing=function(t,e,n,r,i){if(e===0&&t.length<Ir.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=Ir.MINIMUM_VALID_SIZE&&X.isCCW(t)&&(o=i,s=r,n=z.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},qn.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Pe?this.addPolygon(t):t instanceof ge?this.addLineString(t):t instanceof vn?this.addPoint(t):(t instanceof Fo||t instanceof Si||t instanceof Sr||t instanceof Qe)&&this.addCollection(t)},qn.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(n.length===4)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},qn.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},qn.prototype.interfaces_=function(){return[]},qn.prototype.getClass=function(){return qn};var Bo=function(){};Bo.prototype.locate=function(t){},Bo.prototype.interfaces_=function(){return[]},Bo.prototype.getClass=function(){return Bo};var Pr=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Pr.prototype.next=function(){if(this._atStart)return this._atStart=!1,Pr.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 Ao;var t=this._parent.getGeometryN(this._index++);return t instanceof Qe?(this._subcollectionIterator=new Pr(t),this._subcollectionIterator.next()):t},Pr.prototype.remove=function(){throw new Error(this.getClass().getName())},Pr.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Pr.prototype.interfaces_=function(){return[To]},Pr.prototype.getClass=function(){return Pr},Pr.isAtomic=function(t){return!(t instanceof Qe)};var Pn=function(){this._geom=null;var t=arguments[0];this._geom=t};Pn.prototype.locate=function(t){return Pn.locate(t,this._geom)},Pn.prototype.interfaces_=function(){return[Bo]},Pn.prototype.getClass=function(){return Pn},Pn.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&X.isPointInRing(t,e.getCoordinates())},Pn.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Pn.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(Pn.isPointInRing(t,i))return!1}return!0},Pn.containsPoint=function(t,e){if(e instanceof Pe)return Pn.containsPointInPolygon(t,e);if(e instanceof Qe)for(var n=new Pr(e);n.hasNext();){var r=n.next();if(r!==e&&Pn.containsPoint(t,r))return!0}return!1},Pn.locate=function(t,e){return e.isEmpty()?A.EXTERIOR:Pn.containsPoint(t,e)?A.INTERIOR:A.EXTERIOR};var Je=function(){this._edgeMap=new He,this._edgeList=null,this._ptInAreaLocation=[A.NONE,A.NONE]};Je.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return e===0&&(n=this._edgeList.size()-1),this._edgeList.get(n)},Je.prototype.propagateSideLabels=function(t){for(var e=A.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,z.LEFT)!==A.NONE&&(e=r.getLocation(t,z.LEFT))}if(e===A.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,z.ON)===A.NONE&&a.setLocation(t,z.ON,i),a.isArea(t)){var u=a.getLocation(t,z.LEFT),l=a.getLocation(t,z.RIGHT);if(l!==A.NONE){if(l!==i)throw new Hr("side location conflict",s.getCoordinate());u===A.NONE&<.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else lt.isTrue(a.getLocation(t,z.LEFT)===A.NONE,"found single null side"),a.setLocation(t,z.RIGHT,i),a.setLocation(t,z.LEFT,i)}}},Je.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},Je.prototype.print=function(t){qe.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)},Je.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Je.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,r=e.get(n).getLabel().getLocation(t,z.LEFT);lt.isTrue(r!==A.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();lt.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,z.LEFT),u=s.getLocation(t,z.RIGHT);if(a===u||u!==i)return!1;i=a}return!0},Je.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return-1},Je.prototype.iterator=function(){return this.getEdges().iterator()},Je.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new U(this._edgeMap.values())),this._edgeList},Je.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===A.NONE&&(this._ptInAreaLocation[t]=Pn.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},Je.prototype.toString=function(){var t=new nr;t.append("EdgeEndStar: "+this.getCoordinate()),t.append(`
| `);for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append(`
| `)}return t.toString()},Je.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)},Je.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var r=n.next().getLabel(),i=0;i<2;i++)r.isLine(i)&&r.getLocation(i)===A.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=A.NONE;if(e[u])l=A.EXTERIOR;else{var h=s.getCoordinate();l=this.getLocation(u,h,t)}a.setAllLocationsIfNull(u,l)}},Je.prototype.getDegree=function(){return this._edgeMap.size()},Je.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},Je.prototype.interfaces_=function(){return[]},Je.prototype.getClass=function(){return Je};var ty=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var n=this;this.getResultAreaEdges();for(var r=null,i=null,o=this._SCANNING_FOR_INCOMING,s=0;s<this._resultAreaEdgeList.size();s++){var a=n._resultAreaEdgeList.get(s),u=a.getSym();if(a.getLabel().isArea())switch(r===null&&a.isInResult()&&(r=a),o){case n._SCANNING_FOR_INCOMING:if(!u.isInResult())continue;i=u,o=n._LINKING_TO_OUTGOING;break;case n._LINKING_TO_OUTGOING:if(!a.isInResult())continue;i.setNext(a),o=n._SCANNING_FOR_INCOMING}}if(o===this._LINKING_TO_OUTGOING){if(r===null)throw new Hr("no outgoing dirEdge found",this.getCoordinate());lt.isTrue(r.isInResult(),"unable to link last incoming dirEdge"),i.setNext(r)}},e.prototype.insert=function(n){var r=n;this.insertEdgeEnd(r,r)},e.prototype.getRightmostEdge=function(){var n=this.getEdges(),r=n.size();if(r<1)return null;var i=n.get(0);if(r===1)return i;var o=n.get(r-1),s=i.getQuadrant(),a=o.getQuadrant();return te.isNorthern(s)&&te.isNorthern(a)?i:te.isNorthern(s)||te.isNorthern(a)?i.getDy()!==0?i:o.getDy()!==0?o:(lt.shouldNeverReachHere("found two horizontal edges incident on node"),null):o},e.prototype.print=function(n){qe.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var r=this.iterator();r.hasNext();){var i=r.next();n.print("out "),i.print(n),n.println(),n.print("in "),i.getSym().print(n),n.println()}},e.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new U;for(var n=this.iterator();n.hasNext();){var r=n.next();(r.isInResult()||r.getSym().isInResult())&&this._resultAreaEdgeList.add(r)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(n){for(var r=this.iterator();r.hasNext();){var i=r.next().getLabel();i.setAllLocationsIfNull(0,n.getLocation(0)),i.setAllLocationsIfNull(1,n.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var n=null,r=null,i=this._edgeList.size()-1;i>=0;i--){var o=this._edgeList.get(i),s=o.getSym();r===null&&(r=s),n!==null&&s.setNext(n),n=o}r.setNext(n)},e.prototype.computeDepths=function(){var n=this;if(arguments.length===1){var r=arguments[0],i=this.findIndex(r),o=r.getDepth(z.LEFT),s=r.getDepth(z.RIGHT),a=this.computeDepths(i+1,this._edgeList.size(),o),u=this.computeDepths(0,i,a);if(u!==s)throw new Hr("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var l=arguments[0],h=arguments[1],c=arguments[2],p=c,d=l;d<h;d++){var g=n._edgeList.get(d);g.setEdgeDepths(z.RIGHT,p),p=g.getDepth(z.LEFT)}return p}},e.prototype.mergeSymLabels=function(){for(var n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().merge(r.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(n){for(var r=this,i=null,o=null,s=this._SCANNING_FOR_INCOMING,a=this._resultAreaEdgeList.size()-1;a>=0;a--){var u=r._resultAreaEdgeList.get(a),l=u.getSym();switch(i===null&&u.getEdgeRing()===n&&(i=u),s){case r._SCANNING_FOR_INCOMING:if(l.getEdgeRing()!==n)continue;o=l,s=r._LINKING_TO_OUTGOING;break;case r._LINKING_TO_OUTGOING:if(u.getEdgeRing()!==n)continue;o.setNextMin(u),s=r._SCANNING_FOR_INCOMING}}s===this._LINKING_TO_OUTGOING&&(lt.isTrue(i!==null,"found null for first outgoing dirEdge"),lt.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),o.setNextMin(i))},e.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var n=0,r=this.iterator();r.hasNext();){var i=r.next();i.isInResult()&&n++}return n}if(arguments.length===1){for(var o=arguments[0],s=0,a=this.iterator();a.hasNext();){var u=a.next();u.getEdgeRing()===o&&s++}return s}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var n=A.NONE,r=this.iterator();r.hasNext();){var i=r.next(),o=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){n=A.INTERIOR;break}if(o.isInResult()){n=A.EXTERIOR;break}}}if(n===A.NONE)return null;for(var s=n,a=this.iterator();a.hasNext();){var u=a.next(),l=u.getSym();u.isLineEdge()?u.getEdge().setCovered(s===A.INTERIOR):(u.isInResult()&&(s=A.EXTERIOR),l.isInResult()&&(s=A.INTERIOR))}},e.prototype.computeLabelling=function(n){t.prototype.computeLabelling.call(this,n),this._label=new Kt(A.NONE);for(var r=this.iterator();r.hasNext();)for(var i=r.next().getEdge().getLabel(),o=0;o<2;o++){var s=i.getLocation(o);s!==A.INTERIOR&&s!==A.BOUNDARY||this._label.setLocation(o,A.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Je),vf=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(n){return new za(n,new ty)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ko),ui=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};ui.prototype.compareTo=function(t){var e=t;return ui.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},ui.prototype.interfaces_=function(){return[Tn]},ui.prototype.getClass=function(){return ui},ui.orientation=function(t){return ht.increasingDirection(t)===1},ui.compareOriented=function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,s=e?t.length:-1,a=r?n.length:-1,u=e?0:t.length-1,l=r?0:n.length-1;;){var h=t[u].compareTo(n[l]);if(h!==0)return h;var c=(u+=i)===s,p=(l+=o)===a;if(c&&!p)return-1;if(!c&&p)return 1;if(c&&p)return 0}};var Kn=function(){this._edges=new U,this._ocaMap=new He};Kn.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i<r.length;i++)i>0&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")},Kn.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},Kn.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},Kn.prototype.iterator=function(){return this._edges.iterator()},Kn.prototype.getEdges=function(){return this._edges},Kn.prototype.get=function(t){return this._edges.get(t)},Kn.prototype.findEqualEdge=function(t){var e=new ui(t.getCoordinates());return this._ocaMap.get(e)},Kn.prototype.add=function(t){this._edges.add(t);var e=new ui(t.getCoordinates());this._ocaMap.put(e,t)},Kn.prototype.interfaces_=function(){return[]},Kn.prototype.getClass=function(){return Kn};var Pi=function(){};Pi.prototype.processIntersections=function(t,e,n,r){},Pi.prototype.isDone=function(){},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var Mn=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};Mn.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Mn.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.size()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1},Mn.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Mn.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Mn.prototype.getLineIntersector=function(){return this._li},Mn.prototype.hasProperIntersection=function(){return this._hasProper},Mn.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Mn.prototype.hasIntersection=function(){return this._hasIntersection},Mn.prototype.isDone=function(){return!1},Mn.prototype.hasInteriorIntersection=function(){return this._hasInterior},Mn.prototype.interfaces_=function(){return[Pi]},Mn.prototype.getClass=function(){return Mn},Mn.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var gr=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new L(t),this.segmentIndex=e,this.dist=n};gr.prototype.getSegmentIndex=function(){return this.segmentIndex},gr.prototype.getCoordinate=function(){return this.coord},gr.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},gr.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},gr.prototype.isEndPoint=function(t){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===t},gr.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},gr.prototype.getDistance=function(){return this.dist},gr.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},gr.prototype.interfaces_=function(){return[Tn]},gr.prototype.getClass=function(){return gr};var Mr=function(){this._nodeMap=new He,this.edge=null;var t=arguments[0];this.edge=t};Mr.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)},Mr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Mr.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},Mr.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Mr.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new L(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new Ua(o,new Kt(this.edge._label))},Mr.prototype.add=function(t,e,n){var r=new gr(t,e,n),i=this._nodeMap.get(r);return i!==null?i:(this._nodeMap.put(r,r),r)},Mr.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr};var Mi=function(){};Mi.prototype.getChainStartIndices=function(t){var e=0,n=new U;n.add(new rr(e));do{var r=this.findChainEnd(t,e);n.add(new rr(r)),e=r}while(e<t.length-1);return Mi.toIntArray(n)},Mi.prototype.findChainEnd=function(t,e){for(var n=te.quadrant(t[e],t[e+1]),r=e+1;r<t.length&&te.quadrant(t[r-1],t[r])===n;)r++;return r-1},Mi.prototype.interfaces_=function(){return[]},Mi.prototype.getClass=function(){return Mi},Mi.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Zr=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new J,this.env2=new J;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Mi;this.startIndex=e.getChainStartIndices(this.pts)};Zr.prototype.getCoordinates=function(){return this.pts},Zr.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},Zr.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},Zr.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],r)}else if(arguments.length===6){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],h=this.pts[i],c=this.pts[o],p=s.pts[a],d=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(h,c),this.env2.init(p,d),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),m=Math.trunc((a+u)/2);i<g&&(a<m&&this.computeIntersectsForChain(i,g,s,a,m,l),m<u&&this.computeIntersectsForChain(i,g,s,m,u,l)),g<o&&(a<m&&this.computeIntersectsForChain(g,o,s,a,m,l),m<u&&this.computeIntersectsForChain(g,o,s,m,u,l))}},Zr.prototype.getStartIndexes=function(){return this.startIndex},Zr.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var r=0;r<t.startIndex.length-1;r++)this.computeIntersectsForChain(n,t,r,e)},Zr.prototype.interfaces_=function(){return[]},Zr.prototype.getClass=function(){return Zr};var Be=function t(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var n=0;n<3;n++)this._depth[e][n]=t.NULL_VALUE},_f={NULL_VALUE:{configurable:!0}};Be.prototype.getDepth=function(t,e){return this._depth[t][e]},Be.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},Be.prototype.isNull=function(){var t=this;if(arguments.length===0){for(var e=0;e<2;e++)for(var n=0;n<3;n++)if(t._depth[e][n]!==Be.NULL_VALUE)return!1;return!0}if(arguments.length===1){var r=arguments[0];return this._depth[r][1]===Be.NULL_VALUE}if(arguments.length===2){var i=arguments[0],o=arguments[1];return this._depth[i][o]===Be.NULL_VALUE}},Be.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var n=t._depth[e][1];t._depth[e][2]<n&&(n=t._depth[e][2]),n<0&&(n=0);for(var r=1;r<3;r++){var i=0;t._depth[e][r]>n&&(i=1),t._depth[e][r]=i}}},Be.prototype.getDelta=function(t){return this._depth[t][z.RIGHT]-this._depth[t][z.LEFT]},Be.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?A.EXTERIOR:A.INTERIOR},Be.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Be.prototype.add=function(){var t=this;if(arguments.length===1)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);i!==A.EXTERIOR&&i!==A.INTERIOR||(t.isNull(n,r)?t._depth[n][r]=Be.depthAtLocation(i):t._depth[n][r]+=Be.depthAtLocation(i))}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];a===A.INTERIOR&&this._depth[o][s]++}},Be.prototype.interfaces_=function(){return[]},Be.prototype.getClass=function(){return Be},Be.depthAtLocation=function(t){return t===A.EXTERIOR?0:t===A.INTERIOR?1:Be.NULL_VALUE},_f.NULL_VALUE.get=function(){return-1},Object.defineProperties(Be,_f);var Ua=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Mr(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Be,this._depthDelta=0,arguments.length===1){var n=arguments[0];e.call(this,n,null)}else if(arguments.length===2){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var n=new Array(2).fill(null);return n[0]=this.pts[0],n[1]=this.pts[1],new e(n,Kt.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(n){this._isIsolated=n},e.prototype.setName=function(n){this._name=n},e.prototype.equals=function(n){if(!(n instanceof e))return!1;var r=n;if(this.pts.length!==r.pts.length)return!1;for(var i=!0,o=!0,s=this.pts.length,a=0;a<this.pts.length;a++)if(this.pts[a].equals2D(r.pts[a])||(i=!1),this.pts[a].equals2D(r.pts[--s])||(o=!1),!i&&!o)return!1;return!0},e.prototype.getCoordinate=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]}},e.prototype.print=function(n){n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var r=0;r<this.pts.length;r++)r>0&&n.print(","),n.print(this.pts[r].x+" "+this.pts[r].y);n.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(n){e.updateIM(this._label,n)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(n){n.print("edge "+this._name+": ");for(var r=this.pts.length-1;r>=0;r--)n.print(this.pts[r]+" ");n.println("")},e.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new Zr(this)),this._mce},e.prototype.getEnvelope=function(){if(this._env===null){this._env=new J;for(var n=0;n<this.pts.length;n++)this._env.expandToInclude(this.pts[n])}return this._env},e.prototype.addIntersection=function(n,r,i,o){var s=new L(n.getIntersection(o)),a=r,u=n.getEdgeDistance(i,o),l=a+1;if(l<this.pts.length){var h=this.pts[l];s.equals2D(h)&&(a=l,u=0)}this.eiList.add(s,a,u)},e.prototype.toString=function(){var n=new nr;n.append("edge "+this._name+": "),n.append("LINESTRING (");for(var r=0;r<this.pts.length;r++)r>0&&n.append(","),n.append(this.pts[r].x+" "+this.pts[r].y);return n.append(") "+this._label+" "+this._depthDelta),n.toString()},e.prototype.isPointwiseEqual=function(n){if(this.pts.length!==n.pts.length)return!1;for(var r=0;r<this.pts.length;r++)if(!this.pts[r].equals2D(n.pts[r]))return!1;return!0},e.prototype.setDepthDelta=function(n){this._depthDelta=n},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(n,r,i){for(var o=0;o<n.getIntersectionNum();o++)this.addIntersection(n,r,i,o)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(arguments.length!==2)return t.prototype.updateIM.apply(this,arguments);var n=arguments[0],r=arguments[1];r.setAtLeastIfValid(n.getLocation(0,z.ON),n.getLocation(1,z.ON),1),n.isArea()&&(r.setAtLeastIfValid(n.getLocation(0,z.LEFT),n.getLocation(1,z.LEFT),2),r.setAtLeastIfValid(n.getLocation(0,z.RIGHT),n.getLocation(1,z.RIGHT),2))},e}(Cn),en=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Kn,this._bufParams=t||null};en.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},en.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new Kt(t.getLabel())).flip(),n.merge(r);var i=en.depthDelta(r),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(en.depthDelta(t.getLabel()))},en.prototype.buildSubgraphs=function(t,e){for(var n=new U,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new eo(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},en.prototype.createSubgraphs=function(t){for(var e=new U,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new $e;i.create(r),e.add(i)}}return Zn.sort(e,Zn.reverseOrder()),e},en.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},en.prototype.getNoder=function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new Rl,n=new wi;return n.setPrecisionModel(t),e.setSegmentIntersector(new Mn(n)),e},en.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;n===null&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new fn(n,this._bufParams),i=new qn(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new fe(new vf),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new _n(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},en.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var i=r.next(),o=i.getCoordinates();if(o.length!==2||!o[0].equals2D(o[1])){var s=i.getData(),a=new Ua(i.getCoordinates(),new Kt(s));this.insertUniqueEdge(a)}}},en.prototype.setNoder=function(t){this._workingNoder=t},en.prototype.interfaces_=function(){return[]},en.prototype.getClass=function(){return en},en.depthDelta=function(t){var e=t.getLocation(0,z.LEFT),n=t.getLocation(0,z.RIGHT);return e===A.INTERIOR&&n===A.EXTERIOR?1:e===A.EXTERIOR&&n===A.INTERIOR?-1:0},en.convertSegStrings=function(t){for(var e=new pt,n=new U;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var li=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var n=arguments[0],r=arguments[1],i=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=r,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};li.prototype.rescale=function(){var t=this;if(et(arguments[0],Ne))for(var e=arguments[0],n=e.iterator();n.hasNext();){var r=n.next();t.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var i=arguments[0],o=0;o<i.length;o++)i[o].x=i[o].x/t._scaleFactor+t._offsetX,i[o].y=i[o].y/t._scaleFactor+t._offsetY;i.length===2&&i[0].equals2D(i[1])&&qe.out.println(i)}},li.prototype.scale=function(){var t=this;if(et(arguments[0],Ne)){for(var e=arguments[0],n=new U,r=e.iterator();r.hasNext();){var i=r.next();n.add(new _e(t.scale(i.getCoordinates()),i.getData()))}return n}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new L(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);var u=ht.removeRepeatedPoints(s);return u}},li.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},li.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},li.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},li.prototype.interfaces_=function(){return[Ci]},li.prototype.getClass=function(){return li};var dr=function(){this._li=new wi,this._segStrings=null;var t=arguments[0];this._segStrings=t},xf={fact:{configurable:!0}};dr.prototype.checkEndPtVertexIntersections=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next(),r=n.getCoordinates();t.checkEndPtVertexIntersections(r[0],t._segStrings),t.checkEndPtVertexIntersections(r[r.length-1],t._segStrings)}else if(arguments.length===2){for(var i=arguments[0],o=arguments[1],s=o.iterator();s.hasNext();)for(var a=s.next(),u=a.getCoordinates(),l=1;l<u.length-1;l++)if(u[l].equals(i))throw new jr("found endpt/interior pt intersection at index "+l+" :pt "+i)}},dr.prototype.checkInteriorIntersections=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();)for(var n=e.next(),r=this._segStrings.iterator();r.hasNext();){var i=r.next();t.checkInteriorIntersections(n,i)}else if(arguments.length===2)for(var o=arguments[0],s=arguments[1],a=o.getCoordinates(),u=s.getCoordinates(),l=0;l<a.length-1;l++)for(var h=0;h<u.length-1;h++)t.checkInteriorIntersections(o,l,s,h);else if(arguments.length===4){var c=arguments[0],p=arguments[1],d=arguments[2],g=arguments[3];if(c===d&&p===g)return null;var m=c.getCoordinates()[p],f=c.getCoordinates()[p+1],_=d.getCoordinates()[g],I=d.getCoordinates()[g+1];if(this._li.computeIntersection(m,f,_,I),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,m,f)||this.hasInteriorIntersection(this._li,_,I)))throw new jr("found non-noded intersection at "+m+"-"+f+" and "+_+"-"+I)}},dr.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},dr.prototype.checkCollapses=function(){var t=this;if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next();t.checkCollapses(n)}else if(arguments.length===1)for(var r=arguments[0],i=r.getCoordinates(),o=0;o<i.length-2;o++)t.checkCollapse(i[o],i[o+1],i[o+2])},dr.prototype.hasInteriorIntersection=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var i=t.getIntersection(r);if(!i.equals(e)&&!i.equals(n))return!0}return!1},dr.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new jr("found non-noded collapse at "+dr.fact.createLineString([t,e,n]))},dr.prototype.interfaces_=function(){return[]},dr.prototype.getClass=function(){return dr},xf.fact.get=function(){return new pt},Object.defineProperties(dr,xf);var gn=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new he("Scale factor must be non-zero");e!==1&&(this._pt=new L(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new L,this._p1Scaled=new L),this.initCorners(this._pt)},Ef={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};gn.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return lt.isTrue(!(s&&a),"Found bad envelope test"),a},gn.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new L(this._maxx,this._maxy),this._corner[1]=new L(this._minx,this._maxy),this._corner[2]=new L(this._minx,this._miny),this._corner[3]=new L(this._maxx,this._miny)},gn.prototype.intersects=function(t,e){return this._scaleFactor===1?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},gn.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},gn.prototype.getCoordinate=function(){return this._originalPt},gn.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},gn.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var t=gn.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new J(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},gn.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},gn.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!n||!r)||!!t.equals(this._pt)||!!e.equals(this._pt))))},gn.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)},gn.prototype.interfaces_=function(){return[]},gn.prototype.getClass=function(){return gn},Ef.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(gn,Ef);var js=function(){this.tempEnv1=new J,this.selectedSegment=new Z};js.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}}},js.prototype.interfaces_=function(){return[]},js.prototype.getClass=function(){return js};var zo=function(){this._index=null;var t=arguments[0];this._index=t},bf={HotPixelSnapAction:{configurable:!0}};zo.prototype.snap=function(){if(arguments.length===1){var t=arguments[0];return this.snap(t,null,-1)}if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),o=new wf(e,n,r);return this._index.query(i,{interfaces_:function(){return[si]},visitItem:function(s){s.select(i,o)}}),o.isNodeAdded()}},zo.prototype.interfaces_=function(){return[]},zo.prototype.getClass=function(){return zo},bf.HotPixelSnapAction.get=function(){return wf},Object.defineProperties(zo,bf);var wf=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],r=arguments[1],i=arguments[2];this._hotPixel=n,this._parentEdge=r,this._hotPixelVertexIndex=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(arguments.length!==2)return t.prototype.select.apply(this,arguments);var n=arguments[0],r=arguments[1],i=n.getContext();if(this._parentEdge!==null&&i===this._parentEdge&&r===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(i,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(js),no=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new U};no.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)}},no.prototype.isDone=function(){return!1},no.prototype.getInteriorIntersections=function(){return this._interiorIntersections},no.prototype.interfaces_=function(){return[Pi]},no.prototype.getClass=function(){return no};var Lr=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new wi,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};Lr.prototype.checkCorrectness=function(t){var e=_e.getNodedSubstrings(t),n=new dr(e);try{n.checkValid()}catch(r){if(!(r instanceof ef))throw r;r.printStackTrace()}},Lr.prototype.getNodedSubstrings=function(){return _e.getNodedSubstrings(this._nodedSegStrings)},Lr.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},Lr.prototype.findInteriorIntersections=function(t,e){var n=new no(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},Lr.prototype.computeVertexSnaps=function(){var t=this;if(et(arguments[0],Ne))for(var e=arguments[0],n=e.iterator();n.hasNext();){var r=n.next();t.computeVertexSnaps(r)}else if(arguments[0]instanceof _e)for(var i=arguments[0],o=i.getCoordinates(),s=0;s<o.length;s++){var a=new gn(o[s],t._scaleFactor,t._li),u=t._pointSnapper.snap(a,i,s);u&&i.addIntersection(o[s],s)}},Lr.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new Rl,this._pointSnapper=new zo(this._noder.getIndex()),this.snapRound(t,this._li)},Lr.prototype.computeIntersectionSnaps=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next(),i=new gn(r,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},Lr.prototype.interfaces_=function(){return[Ci]},Lr.prototype.getClass=function(){return Lr};var ze=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Yt,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}},jo={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};ze.prototype.bufferFixedPrecision=function(t){var e=new li(new Lr(new Xt(1)),t.getScale()),n=new en(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},ze.prototype.bufferReducedPrecision=function(){var t=this;if(arguments.length===0){for(var e=ze.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(o){if(!(o instanceof Hr))throw o;t._saveException=o}if(t._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var n=arguments[0],r=ze.precisionScaleFactor(this._argGeom,this._distance,n),i=new Xt(r);this.bufferFixedPrecision(i)}},ze.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Xt.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},ze.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},ze.prototype.bufferOriginalPrecision=function(){try{var t=new en(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof jr))throw e;this._saveException=e}},ze.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},ze.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},ze.prototype.interfaces_=function(){return[]},ze.prototype.getClass=function(){return ze},ze.bufferOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new ze(t),r=n.getResultGeometry(e);return r}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof $&&typeof arguments[1]=="number"){var i=arguments[0],o=arguments[1],s=arguments[2],a=new ze(i);a.setQuadrantSegments(s);var u=a.getResultGeometry(o);return u}if(arguments[2]instanceof Yt&&arguments[0]instanceof $&&typeof arguments[1]=="number"){var l=arguments[0],h=arguments[1],c=arguments[2],p=new ze(l,c),d=p.getResultGeometry(h);return d}}else if(arguments.length===4){var g=arguments[0],m=arguments[1],f=arguments[2],_=arguments[3],I=new ze(g);I.setQuadrantSegments(f),I.setEndCapStyle(_);var y=I.getResultGeometry(m);return y}},ze.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=Sn.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},jo.CAP_ROUND.get=function(){return Yt.CAP_ROUND},jo.CAP_BUTT.get=function(){return Yt.CAP_FLAT},jo.CAP_FLAT.get=function(){return Yt.CAP_FLAT},jo.CAP_SQUARE.get=function(){return Yt.CAP_SQUARE},jo.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(ze,jo);var nn=function(){this._pt=[new L,new L],this._distance=st.NaN,this._isNull=!0};nn.prototype.getCoordinates=function(){return this._pt},nn.prototype.getCoordinate=function(t){return this._pt[t]},nn.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},nn.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},nn.prototype.getDistance=function(){return this._distance},nn.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},nn.prototype.interfaces_=function(){return[]},nn.prototype.getClass=function(){return nn};var Or=function(){};Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or},Or.computeDistance=function(){if(arguments[2]instanceof nn&&arguments[0]instanceof ge&&arguments[1]instanceof L)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getCoordinates(),i=new Z,o=0;o<r.length-1;o++){i.setCoordinates(r[o],r[o+1]);var s=i.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof nn&&arguments[0]instanceof Pe&&arguments[1]instanceof L){var a=arguments[0],u=arguments[1],l=arguments[2];Or.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)Or.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof nn&&arguments[0]instanceof $&&arguments[1]instanceof L){var c=arguments[0],p=arguments[1],d=arguments[2];if(c instanceof ge)Or.computeDistance(c,p,d);else if(c instanceof Pe)Or.computeDistance(c,p,d);else if(c instanceof Qe)for(var g=c,m=0;m<g.getNumGeometries();m++){var f=g.getGeometryN(m);Or.computeDistance(f,p,d)}else d.setMinimum(c.getCoordinate(),p)}else if(arguments[2]instanceof nn&&arguments[0]instanceof Z&&arguments[1]instanceof L){var _=arguments[0],I=arguments[1],y=arguments[2],v=_.closestPoint(I);y.setMinimum(v,I)}};var Li=function(t){this._maxPtDist=new nn,this._inputGeom=t||null},Tl={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Li.prototype.computeMaxMidpointDistance=function(t){var e=new ci(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Li.prototype.computeMaxVertexDistance=function(t){var e=new ro(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},Li.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},Li.prototype.getDistancePoints=function(){return this._maxPtDist},Li.prototype.interfaces_=function(){return[]},Li.prototype.getClass=function(){return Li},Tl.MaxPointDistanceFilter.get=function(){return ro},Tl.MaxMidpointDistanceFilter.get=function(){return ci},Object.defineProperties(Li,Tl);var ro=function(t){this._maxPtDist=new nn,this._minPtDist=new nn,this._geom=t||null};ro.prototype.filter=function(t){this._minPtDist.initialize(),Or.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ro.prototype.getMaxPointDistance=function(){return this._maxPtDist},ro.prototype.interfaces_=function(){return[wr]},ro.prototype.getClass=function(){return ro};var ci=function(t){this._maxPtDist=new nn,this._minPtDist=new nn,this._geom=t||null};ci.prototype.filter=function(t,e){if(e===0)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new L((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),Or.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ci.prototype.isDone=function(){return!1},ci.prototype.isGeometryChanged=function(){return!1},ci.prototype.getMaxPointDistance=function(){return this._maxPtDist},ci.prototype.interfaces_=function(){return[Wn]},ci.prototype.getClass=function(){return ci};var Kr=function(t){this._comps=t||null};Kr.prototype.filter=function(t){t instanceof Pe&&this._comps.add(t)},Kr.prototype.interfaces_=function(){return[ar]},Kr.prototype.getClass=function(){return Kr},Kr.getPolygons=function(){if(arguments.length===1){var t=arguments[0];return Kr.getPolygons(t,new U)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof Pe?n.add(e):e instanceof Qe&&e.apply(new Kr(n)),n}};var je=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var t=arguments[0];this._lines=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};je.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Ir){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof ge&&this._lines.add(t)},je.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},je.prototype.interfaces_=function(){return[Ur]},je.prototype.getClass=function(){return je},je.getGeometry=function(){if(arguments.length===1){var t=arguments[0];return t.getFactory().buildGeometry(je.getLines(t))}if(arguments.length===2){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(je.getLines(e,n))}},je.getLines=function(){if(arguments.length===1){var t=arguments[0];return je.getLines(t,!1)}if(arguments.length===2){if(et(arguments[0],Ne)&&et(arguments[1],Ne)){for(var e=arguments[0],n=arguments[1],r=e.iterator();r.hasNext();){var i=r.next();je.getLines(i,n)}return n}if(arguments[0]instanceof $&&typeof arguments[1]=="boolean"){var o=arguments[0],s=arguments[1],a=new U;return o.apply(new je(a,s)),a}if(arguments[0]instanceof $&&et(arguments[1],Ne)){var u=arguments[0],l=arguments[1];return u instanceof ge?l.add(u):u.apply(new je(l)),l}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&et(arguments[0],Ne)&&et(arguments[1],Ne)){for(var h=arguments[0],c=arguments[1],p=arguments[2],d=h.iterator();d.hasNext();){var g=d.next();je.getLines(g,c,p)}return c}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof $&&et(arguments[1],Ne)){var m=arguments[0],f=arguments[1],_=arguments[2];return m.apply(new je(f,_)),f}}};var Qn=function(){if(this._boundaryRule=Dn.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var t=arguments[0];if(t===null)throw new he("Rule must be non-null");this._boundaryRule=t}}};Qn.prototype.locateInternal=function(){var t=this;if(arguments[0]instanceof L&&arguments[1]instanceof Pe){var e=arguments[0],n=arguments[1];if(n.isEmpty())return A.EXTERIOR;var r=n.getExteriorRing(),i=this.locateInPolygonRing(e,r);if(i===A.EXTERIOR)return A.EXTERIOR;if(i===A.BOUNDARY)return A.BOUNDARY;for(var o=0;o<n.getNumInteriorRing();o++){var s=n.getInteriorRingN(o),a=t.locateInPolygonRing(e,s);if(a===A.INTERIOR)return A.EXTERIOR;if(a===A.BOUNDARY)return A.BOUNDARY}return A.INTERIOR}if(arguments[0]instanceof L&&arguments[1]instanceof ge){var u=arguments[0],l=arguments[1];if(!l.getEnvelopeInternal().intersects(u))return A.EXTERIOR;var h=l.getCoordinates();return l.isClosed()||!u.equals(h[0])&&!u.equals(h[h.length-1])?X.isOnLine(u,h)?A.INTERIOR:A.EXTERIOR:A.BOUNDARY}if(arguments[0]instanceof L&&arguments[1]instanceof vn){var c=arguments[0],p=arguments[1],d=p.getCoordinate();return d.equals2D(c)?A.INTERIOR:A.EXTERIOR}},Qn.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?X.locatePointInRing(t,e.getCoordinates()):A.EXTERIOR},Qn.prototype.intersects=function(t,e){return this.locate(t,e)!==A.EXTERIOR},Qn.prototype.updateLocationInfo=function(t){t===A.INTERIOR&&(this._isIn=!0),t===A.BOUNDARY&&this._numBoundaries++},Qn.prototype.computeLocation=function(t,e){var n=this;if(e instanceof vn&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof ge)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Pe)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Si)for(var r=e,i=0;i<r.getNumGeometries();i++){var o=r.getGeometryN(i);n.updateLocationInfo(n.locateInternal(t,o))}else if(e instanceof Sr)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);n.updateLocationInfo(n.locateInternal(t,u))}else if(e instanceof Qe)for(var l=new Pr(e);l.hasNext();){var h=l.next();h!==e&&n.computeLocation(t,h)}},Qn.prototype.locate=function(t,e){return e.isEmpty()?A.EXTERIOR:e instanceof ge||e instanceof Pe?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?A.BOUNDARY:this._numBoundaries>0||this._isIn?A.INTERIOR:A.EXTERIOR)},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn};var rn=function t(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var e=arguments[0],n=arguments[1];t.call(this,e,t.INSIDE_AREA,n)}else if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._component=r,this._segIndex=i,this._pt=o}},If={INSIDE_AREA:{configurable:!0}};rn.prototype.isInsideArea=function(){return this._segIndex===rn.INSIDE_AREA},rn.prototype.getCoordinate=function(){return this._pt},rn.prototype.getGeometryComponent=function(){return this._component},rn.prototype.getSegmentIndex=function(){return this._segIndex},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},If.INSIDE_AREA.get=function(){return-1},Object.defineProperties(rn,If);var hi=function(t){this._pts=t||null};hi.prototype.filter=function(t){t instanceof vn&&this._pts.add(t)},hi.prototype.interfaces_=function(){return[ar]},hi.prototype.getClass=function(){return hi},hi.getPoints=function(){if(arguments.length===1){var t=arguments[0];return t instanceof vn?Zn.singletonList(t):hi.getPoints(t,new U)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return e instanceof vn?n.add(e):e instanceof Qe&&e.apply(new hi(n)),n}};var io=function(){this._locations=null;var t=arguments[0];this._locations=t};io.prototype.filter=function(t){(t instanceof vn||t instanceof ge||t instanceof Pe)&&this._locations.add(new rn(t,0,t.getCoordinate()))},io.prototype.interfaces_=function(){return[ar]},io.prototype.getClass=function(){return io},io.getLocations=function(t){var e=new U;return t.apply(new io(e)),e};var Ue=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Qn,this._minDistanceLocation=null,this._minDistance=st.MAX_VALUE,arguments.length===2){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};Ue.prototype.computeContainmentDistance=function(){var t=this;if(arguments.length===0){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(arguments.length===2){var n=arguments[0],r=arguments[1],i=1-n,o=Kr.getPolygons(this._geom[n]);if(o.size()>0){var s=io.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&et(arguments[0],Yn)&&et(arguments[1],Yn)){for(var a=arguments[0],u=arguments[1],l=arguments[2],h=0;h<a.size();h++)for(var c=a.get(h),p=0;p<u.size();p++)if(t.computeContainmentDistance(c,u.get(p),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof rn&&arguments[1]instanceof Pe){var d=arguments[0],g=arguments[1],m=arguments[2],f=d.getCoordinate();if(A.EXTERIOR!==this._ptLocator.locate(f,g))return this._minDistance=0,m[0]=d,m[1]=new rn(g,f),null}}},Ue.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},Ue.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=je.getLines(this._geom[0]),n=je.getLines(this._geom[1]),r=hi.getPoints(this._geom[0]),i=hi.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},Ue.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},Ue.prototype.updateMinDistance=function(t,e){if(t[0]===null)return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},Ue.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},Ue.prototype.computeMinDistance=function(){var t=this;if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof ge&&arguments[1]instanceof vn){var e=arguments[0],n=arguments[1],r=arguments[2];if(e.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=n.getCoordinate(),s=0;s<i.length-1;s++){var a=X.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new Z(i[s],i[s+1]),l=u.closestPoint(o);r[0]=new rn(e,s,l),r[1]=new rn(n,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof ge&&arguments[1]instanceof ge){var h=arguments[0],c=arguments[1],p=arguments[2];if(h.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var d=h.getCoordinates(),g=c.getCoordinates(),m=0;m<d.length-1;m++)for(var f=0;f<g.length-1;f++){var _=X.distanceLineLine(d[m],d[m+1],g[f],g[f+1]);if(_<t._minDistance){t._minDistance=_;var I=new Z(d[m],d[m+1]),y=new Z(g[f],g[f+1]),v=I.closestPoints(y);p[0]=new rn(h,m,v[0]),p[1]=new rn(c,f,v[1])}if(t._minDistance<=t._terminateDistance)return null}}}},Ue.prototype.computeMinDistancePoints=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<r._minDistance&&(r._minDistance=u,n[0]=new rn(o,0,o.getCoordinate()),n[1]=new rn(a,0,a.getCoordinate())),r._minDistance<=r._terminateDistance)return null}},Ue.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new he("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},Ue.prototype.computeMinDistanceLines=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},Ue.prototype.interfaces_=function(){return[]},Ue.prototype.getClass=function(){return Ue},Ue.distance=function(t,e){return new Ue(t,e).distance()},Ue.isWithinDistance=function(t,e,n){return new Ue(t,e,n).distance()<=n},Ue.nearestPoints=function(t,e){return new Ue(t,e).nearestPoints()};var Ze=function(){this._pt=[new L,new L],this._distance=st.NaN,this._isNull=!0};Ze.prototype.getCoordinates=function(){return this._pt},Ze.prototype.getCoordinate=function(t){return this._pt[t]},Ze.prototype.setMinimum=function(){if(arguments.length===1){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},Ze.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(arguments.length===3){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},Ze.prototype.toString=function(){return Xn.toLineString(this._pt[0],this._pt[1])},Ze.prototype.getDistance=function(){return this._distance},Ze.prototype.setMaximum=function(){if(arguments.length===1){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(arguments.length===2){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},Ze.prototype.interfaces_=function(){return[]},Ze.prototype.getClass=function(){return Ze};var yr=function(){};yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.computeDistance=function(){if(arguments[2]instanceof Ze&&arguments[0]instanceof ge&&arguments[1]instanceof L)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new Z,i=t.getCoordinates(),o=0;o<i.length-1;o++){r.setCoordinates(i[o],i[o+1]);var s=r.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof Ze&&arguments[0]instanceof Pe&&arguments[1]instanceof L){var a=arguments[0],u=arguments[1],l=arguments[2];yr.computeDistance(a.getExteriorRing(),u,l);for(var h=0;h<a.getNumInteriorRing();h++)yr.computeDistance(a.getInteriorRingN(h),u,l)}else if(arguments[2]instanceof Ze&&arguments[0]instanceof $&&arguments[1]instanceof L){var c=arguments[0],p=arguments[1],d=arguments[2];if(c instanceof ge)yr.computeDistance(c,p,d);else if(c instanceof Pe)yr.computeDistance(c,p,d);else if(c instanceof Qe)for(var g=c,m=0;m<g.getNumGeometries();m++){var f=g.getGeometryN(m);yr.computeDistance(f,p,d)}else d.setMinimum(c.getCoordinate(),p)}else if(arguments[2]instanceof Ze&&arguments[0]instanceof Z&&arguments[1]instanceof L){var _=arguments[0],I=arguments[1],y=arguments[2],v=_.closestPoint(I);y.setMinimum(v,I)}};var Bn=function(){this._g0=null,this._g1=null,this._ptDist=new Ze,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},Al={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Bn.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Bn.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new he("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Bn.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Bn.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Bn.prototype.computeOrientedDistance=function(t,e,n){var r=new oo(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new pi(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},Bn.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Bn.prototype.interfaces_=function(){return[]},Bn.prototype.getClass=function(){return Bn},Bn.distance=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Bn(t,e);return n.distance()}if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2],s=new Bn(r,i);return s.setDensifyFraction(o),s.distance()}},Al.MaxPointDistanceFilter.get=function(){return oo},Al.MaxDensifiedByFractionDistanceFilter.get=function(){return pi},Object.defineProperties(Bn,Al);var oo=function(){this._maxPtDist=new Ze,this._minPtDist=new Ze,this._euclideanDist=new yr,this._geom=null;var t=arguments[0];this._geom=t};oo.prototype.filter=function(t){this._minPtDist.initialize(),yr.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},oo.prototype.getMaxPointDistance=function(){return this._maxPtDist},oo.prototype.interfaces_=function(){return[wr]},oo.prototype.getClass=function(){return oo};var pi=function(){this._maxPtDist=new Ze,this._minPtDist=new Ze,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};pi.prototype.filter=function(t,e){var n=this;if(e===0)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-r.x)/this._numSubSegs,s=(i.y-r.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=r.x+a*o,l=r.y+a*s,h=new L(u,l);n._minPtDist.initialize(),yr.computeDistance(n._geom,h,n._minPtDist),n._maxPtDist.setMaximum(n._minPtDist)}},pi.prototype.isDone=function(){return!1},pi.prototype.isGeometryChanged=function(){return!1},pi.prototype.getMaxPointDistance=function(){return this._maxPtDist},pi.prototype.interfaces_=function(){return[Wn]},pi.prototype.getClass=function(){return pi};var En=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},Dl={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};En.prototype.checkMaximumDistance=function(t,e,n){var r=new Bn(e,t);if(r.setDensifyFraction(.25),this._maxDistanceFound=r.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Xn.toLineString(i[0],i[1])+")"}},En.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=En.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),En.VERBOSE&&qe.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},En.prototype.checkNegativeValid=function(){if(!(this._input instanceof Pe||this._input instanceof Sr||this._input instanceof Qe))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},En.prototype.getErrorIndicator=function(){return this._errorIndicator},En.prototype.checkMinimumDistance=function(t,e,n){var r=new Ue(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound<n){this._isValid=!1;var i=r.nearestPoints();this._errorLocation=r.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Xn.toLineString(i[0],i[1])+" )"}},En.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},En.prototype.getErrorLocation=function(){return this._errorLocation},En.prototype.getPolygonLines=function(t){for(var e=new U,n=new je(e),r=Kr.getPolygons(t).iterator();r.hasNext();)r.next().apply(n);return t.getFactory().buildGeometry(e)},En.prototype.getErrorMessage=function(){return this._errMsg},En.prototype.interfaces_=function(){return[]},En.prototype.getClass=function(){return En},Dl.VERBOSE.get=function(){return!1},Dl.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(En,Dl);var Ve=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},Fl={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Ve.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Ve.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Ve.MAX_ENV_DIFF_FRAC;t===0&&(t=.001);var e=new J(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new J(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},Ve.prototype.checkDistance=function(){var t=new En(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},Ve.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Ve.prototype.checkPolygonal=function(){this._result instanceof Pe||this._result instanceof Sr||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Ve.prototype.getErrorIndicator=function(){return this._errorIndicator},Ve.prototype.getErrorLocation=function(){return this._errorLocation},Ve.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Ve.prototype.report=function(t){if(!Ve.VERBOSE)return null;qe.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Ve.prototype.getErrorMessage=function(){return this._errorMsg},Ve.prototype.interfaces_=function(){return[]},Ve.prototype.getClass=function(){return Ve},Ve.isValidMsg=function(t,e,n){var r=new Ve(t,e,n);return r.isValid()?null:r.getErrorMessage()},Ve.isValid=function(t,e,n){return!!new Ve(t,e,n).isValid()},Fl.VERBOSE.get=function(){return!1},Fl.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Ve,Fl);var mr=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};mr.prototype.getCoordinates=function(){return this._pts},mr.prototype.size=function(){return this._pts.length},mr.prototype.getCoordinate=function(t){return this._pts[t]},mr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},mr.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:$i.octant(this.getCoordinate(t),this.getCoordinate(t+1))},mr.prototype.setData=function(t){this._data=t},mr.prototype.getData=function(){return this._data},mr.prototype.toString=function(){return Xn.toLineString(new ve(this._pts))},mr.prototype.interfaces_=function(){return[Nr]},mr.prototype.getClass=function(){return mr};var De=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new U,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};De.prototype.getInteriorIntersection=function(){return this._interiorIntersection},De.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},De.prototype.getIntersectionSegments=function(){return this._intSegments},De.prototype.count=function(){return this._intersectionCount},De.prototype.getIntersections=function(){return this._intersections},De.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},De.prototype.setKeepIntersections=function(t){this._keepIntersections=t},De.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection()||t===n&&e===r||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(n,r)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},De.prototype.isEndSegment=function(t,e){return e===0||e>=t.size()-2},De.prototype.hasIntersection=function(){return this._interiorIntersection!==null},De.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},De.prototype.interfaces_=function(){return[Pi]},De.prototype.getClass=function(){return De},De.createAllIntersectionsFinder=function(t){var e=new De(t);return e.setFindAllIntersections(!0),e},De.createAnyIntersectionFinder=function(t){return new De(t)},De.createIntersectionCounter=function(t){var e=new De(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var $n=function(){this._li=new wi,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};$n.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},$n.prototype.getIntersections=function(){return this._segInt.getIntersections()},$n.prototype.isValid=function(){return this.execute(),this._isValid},$n.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},$n.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new De(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Rl;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},$n.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Hr(this.getErrorMessage(),this._segInt.getInteriorIntersection())},$n.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Xn.toLineString(t[0],t[1])+" and "+Xn.toLineString(t[2],t[3])},$n.prototype.interfaces_=function(){return[]},$n.prototype.getClass=function(){return $n},$n.computeIntersections=function(t){var e=new $n(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Oi=function t(){this._nv=null;var e=arguments[0];this._nv=new $n(t.toSegmentStrings(e))};Oi.prototype.checkValid=function(){this._nv.checkValid()},Oi.prototype.interfaces_=function(){return[]},Oi.prototype.getClass=function(){return Oi},Oi.toSegmentStrings=function(t){for(var e=new U,n=t.iterator();n.hasNext();){var r=n.next();e.add(new mr(r.getCoordinates(),r))}return e},Oi.checkValid=function(t){new Oi(t).checkValid()};var so=function(t){this._mapOp=t};so.prototype.map=function(t){for(var e=new U,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(pt.toGeometryArray(e))},so.prototype.interfaces_=function(){return[]},so.prototype.getClass=function(){return so},so.map=function(t,e){return new so(e).map(t)};var vr=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new U,this._resultLineList=new U;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};vr.prototype.collectLines=function(t){for(var e=this,n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var r=n.next();e.collectLineEdge(r,t,e._lineEdgesList),e.collectBoundaryTouchEdge(r,t,e._lineEdgesList)}},vr.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},vr.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},vr.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!ut.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},vr.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getEdge();if(n.isLineEdge()&&!r.isCoveredSet()){var i=this._op.isCoveredByA(n.getCoordinate());r.setCovered(i)}}},vr.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=n.getLabel();n.isIsolated()&&(r.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},vr.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),r=this._geometryFactory.createLineString(n.getCoordinates());this._resultLineList.add(r),n.setInResult(!0)}},vr.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(lt.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(ut.isResultOfOp(r,e)&&e===ut.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},vr.prototype.interfaces_=function(){return[]},vr.prototype.getClass=function(){return vr};var ao=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new U;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};ao.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},ao.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!n.isInResult()&&!n.isIncidentEdgeInResult()&&(n.getEdges().getDegree()===0||t===ut.INTERSECTION)){var r=n.getLabel();ut.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},ao.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},ao.prototype.interfaces_=function(){return[]},ao.prototype.getClass=function(){return ao};var dn=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};dn.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},dn.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);r!==null&&r instanceof Ir&&!r.isEmpty()||(n=!1);for(var i=new U,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);s===null||s.isEmpty()||(s instanceof Ir||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new U;return r!==null&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},dn.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},dn.prototype.getInputGeometry=function(){return this._inputGeom},dn.prototype.transformMultiLineString=function(t,e){for(var n=new U,r=0;r<t.getNumGeometries();r++){var i=this.transformLineString(t.getGeometryN(r),t);i!==null&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},dn.prototype.transformCoordinates=function(t,e){return this.copy(t)},dn.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},dn.prototype.transformMultiPoint=function(t,e){for(var n=new U,r=0;r<t.getNumGeometries();r++){var i=this.transformPoint(t.getGeometryN(r),t);i!==null&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},dn.prototype.transformMultiPolygon=function(t,e){for(var n=new U,r=0;r<t.getNumGeometries();r++){var i=this.transformPolygon(t.getGeometryN(r),t);i!==null&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},dn.prototype.copy=function(t){return t.copy()},dn.prototype.transformGeometryCollection=function(t,e){for(var n=new U,r=0;r<t.getNumGeometries();r++){var i=this.transform(t.getGeometryN(r));i!==null&&(this._pruneEmptyGeometry&&i.isEmpty()||n.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(pt.toGeometryArray(n)):this._factory.buildGeometry(n)},dn.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof vn)return this.transformPoint(t,null);if(t instanceof Fo)return this.transformMultiPoint(t,null);if(t instanceof Ir)return this.transformLinearRing(t,null);if(t instanceof ge)return this.transformLineString(t,null);if(t instanceof Si)return this.transformMultiLineString(t,null);if(t instanceof Pe)return this.transformPolygon(t,null);if(t instanceof Sr)return this.transformMultiPolygon(t,null);if(t instanceof Qe)return this.transformGeometryCollection(t,null);throw new he("Unknown Geometry subtype: "+t.getClass().getName())},dn.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(n===null)return this._factory.createLinearRing(null);var r=n.size();return r>0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn};var Rr=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Z,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof ge&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];t.call(this,e.getCoordinates(),n)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];this._srcPts=r,this._isClosed=t.isClosed(r),this._snapTolerance=i}};Rr.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get(r),o=this.findSnapForVertex(i,e);o!==null&&(t.set(r,new L(o)),r===0&&this._isClosed&&t.set(t.size()-1,new L(o)))}},Rr.prototype.findSnapForVertex=function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e[n]))return null;if(t.distance(e[n])<this._snapTolerance)return e[n]}return null},Rr.prototype.snapTo=function(t){var e=new Ps(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},Rr.prototype.snapSegments=function(t,e){if(e.length===0)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var r=0;r<n;r++){var i=e[r],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new L(i),!1)}},Rr.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=st.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(n._seg.p0=e.get(o),n._seg.p1=e.get(o+1),n._seg.p0.equals2D(t)||n._seg.p1.equals2D(t)){if(n._allowSnappingToSourceVertices)continue;return-1}var s=n._seg.distance(t);s<n._snapTolerance&&s<r&&(r=s,i=o)}return i},Rr.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var xe=function(t){this._srcGeom=t||null},Sf={SNAP_PRECISION_FACTOR:{configurable:!0}};xe.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Cf(e,n).transform(this._srcGeom)},xe.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Cf(t,n,!0).transform(this._srcGeom),i=r;return e&&et(i,oi)&&(i=r.buffer(0)),i},xe.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},xe.prototype.extractTargetCoordinates=function(t){for(var e=new sr,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},xe.prototype.computeMinimumSegmentLength=function(t){for(var e=st.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},xe.prototype.interfaces_=function(){return[]},xe.prototype.getClass=function(){return xe},xe.snap=function(t,e,n){var r=new Array(2).fill(null),i=new xe(t);r[0]=i.snapTo(e,n);var o=new xe(e);return r[1]=o.snapTo(r[0],n),r},xe.computeOverlaySnapTolerance=function(){if(arguments.length===1){var t=arguments[0],e=xe.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===Xt.FIXED){var r=1/n.getScale()*2/1.415;r>e&&(e=r)}return e}if(arguments.length===2){var i=arguments[0],o=arguments[1];return Math.min(xe.computeOverlaySnapTolerance(i),xe.computeOverlaySnapTolerance(o))}},xe.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*xe.SNAP_PRECISION_FACTOR},xe.snapToSelf=function(t,e,n){return new xe(t).snapToSelf(e,n)},Sf.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(xe,Sf);var Cf=function(t){function e(n,r,i){t.call(this),this._snapTolerance=n||null,this._snapPts=r||null,this._isSelfSnap=i!==void 0&&i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(n,r){var i=new Rr(n,this._snapTolerance);return i.setAllowSnappingToSourceVertices(this._isSelfSnap),i.snapTo(r)},e.prototype.transformCoordinates=function(n,r){var i=n.toCoordinateArray(),o=this.snapLine(i,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(o)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(dn),on=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};on.prototype.getCommon=function(){return st.longBitsToDouble(this._commonBits)},on.prototype.add=function(t){var e=st.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=on.signExpBits(this._commonBits),this._isFirst=!1,null):on.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=on.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=on.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},on.prototype.toString=function(){if(arguments.length===1){var t=arguments[0],e=st.longBitsToDouble(t),n=st.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,i=r.substring(r.length-64),o=i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]";return o}},on.prototype.interfaces_=function(){return[]},on.prototype.getClass=function(){return on},on.getBit=function(t,e){return(t&1<<e)!=0?1:0},on.signExpBits=function(t){return t>>52},on.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},on.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;r>=0;r--){if(on.getBit(t,r)!==on.getBit(e,r))return n;n++}return 52};var fi=function(){this._commonCoord=null,this._ccFilter=new uo},kl={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};fi.prototype.addCommonBits=function(t){var e=new gi(this._commonCoord);t.apply(e),t.geometryChanged()},fi.prototype.removeCommonBits=function(t){if(this._commonCoord.x===0&&this._commonCoord.y===0)return t;var e=new L(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new gi(e);return t.apply(n),t.geometryChanged(),t},fi.prototype.getCommonCoordinate=function(){return this._commonCoord},fi.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},fi.prototype.interfaces_=function(){return[]},fi.prototype.getClass=function(){return fi},kl.CommonCoordinateFilter.get=function(){return uo},kl.Translater.get=function(){return gi},Object.defineProperties(fi,kl);var uo=function(){this._commonBitsX=new on,this._commonBitsY=new on};uo.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},uo.prototype.getCommonCoordinate=function(){return new L(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},uo.prototype.interfaces_=function(){return[wr]},uo.prototype.getClass=function(){return uo};var gi=function(){this.trans=null;var t=arguments[0];this.trans=t};gi.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)},gi.prototype.isDone=function(){return!1},gi.prototype.isGeometryChanged=function(){return!0},gi.prototype.interfaces_=function(){return[Wn]},gi.prototype.getClass=function(){return gi};var Fe=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};Fe.prototype.selfSnap=function(t){return new xe(t).snapTo(t,this._snapTolerance)},Fe.prototype.removeCommonBits=function(t){this._cbr=new fi,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},Fe.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},Fe.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=ut.overlayOp(e[0],e[1],t);return this.prepareResult(n)},Fe.prototype.checkValid=function(t){t.isValid()||qe.out.println("Snapped geometry is invalid")},Fe.prototype.computeSnapTolerance=function(){this._snapTolerance=xe.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Fe.prototype.snap=function(t){var e=this.removeCommonBits(t);return xe.snap(e[0],e[1],this._snapTolerance)},Fe.prototype.interfaces_=function(){return[]},Fe.prototype.getClass=function(){return Fe},Fe.overlayOp=function(t,e,n){return new Fe(t,e).getResultGeometry(n)},Fe.union=function(t,e){return Fe.overlayOp(t,e,ut.UNION)},Fe.intersection=function(t,e){return Fe.overlayOp(t,e,ut.INTERSECTION)},Fe.symDifference=function(t,e){return Fe.overlayOp(t,e,ut.SYMDIFFERENCE)},Fe.difference=function(t,e){return Fe.overlayOp(t,e,ut.DIFFERENCE)};var sn=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};sn.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=ut.overlayOp(this._geom[0],this._geom[1],t),n=!0}catch(i){if(!(i instanceof jr))throw i;r=i}if(!n)try{e=Fe.overlayOp(this._geom[0],this._geom[1],t)}catch(i){throw i instanceof jr?r:i}return e},sn.prototype.interfaces_=function(){return[]},sn.prototype.getClass=function(){return sn},sn.overlayOp=function(t,e,n){return new sn(t,e).getResultGeometry(n)},sn.union=function(t,e){return sn.overlayOp(t,e,ut.UNION)},sn.intersection=function(t,e){return sn.overlayOp(t,e,ut.INTERSECTION)},sn.symDifference=function(t,e){return sn.overlayOp(t,e,ut.SYMDIFFERENCE)},sn.difference=function(t,e){return sn.overlayOp(t,e,ut.DIFFERENCE)};var Us=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};Us.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},Us.prototype.interfaces_=function(){return[]},Us.prototype.getClass=function(){return Us};var bn=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},Gl={INSERT:{configurable:!0},DELETE:{configurable:!0}};bn.prototype.isDelete=function(){return this._eventType===bn.DELETE},bn.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},bn.prototype.getObject=function(){return this._obj},bn.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},bn.prototype.getInsertEvent=function(){return this._insertEvent},bn.prototype.isInsert=function(){return this._eventType===bn.INSERT},bn.prototype.isSameLabel=function(t){return this._label!==null&&this._label===t._label},bn.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},bn.prototype.interfaces_=function(){return[Tn]},bn.prototype.getClass=function(){return bn},Gl.INSERT.get=function(){return 1},Gl.DELETE.get=function(){return 2},Object.defineProperties(bn,Gl);var Va=function(){};Va.prototype.interfaces_=function(){return[]},Va.prototype.getClass=function(){return Va};var Xe=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};Xe.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(Xe.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(e===0&&r===i||r===0&&e===i)return!0}}return!1},Xe.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Xe.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},Xe.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Xe.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection(r))return!0}return!1},Xe.prototype.hasProperIntersection=function(){return this._hasProper},Xe.prototype.hasIntersection=function(){return this._hasIntersection},Xe.prototype.isDone=function(){return this._isDone},Xe.prototype.isBoundaryPoint=function(t,e){return e!==null&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},Xe.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},Xe.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Xe.prototype.interfaces_=function(){return[]},Xe.prototype.getClass=function(){return Xe},Xe.isAdjacentSegments=function(t,e){return Math.abs(t-e)===1};var ey=function(t){function e(){t.call(this),this.events=new U,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){Zn.sort(this.events);for(var n=0;n<this.events.size();n++){var r=this.events.get(n);r.isDelete()&&r.getInsertEvent().setDeleteEventIndex(n)}},e.prototype.computeIntersections=function(){var n=this;if(arguments.length===1){var r=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var i=0;i<this.events.size();i++){var o=n.events.get(i);if(o.isInsert()&&n.processOverlaps(i,o.getDeleteEventIndex(),o,r),r.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Xe&&et(arguments[0],Yn)&&et(arguments[1],Yn)){var s=arguments[0],a=arguments[1],u=arguments[2];this.addEdges(s,s),this.addEdges(a,a),this.computeIntersections(u)}else if(typeof arguments[2]=="boolean"&&et(arguments[0],Yn)&&arguments[1]instanceof Xe){var l=arguments[0],h=arguments[1],c=arguments[2];c?this.addEdges(l,null):this.addEdges(l),this.computeIntersections(h)}}},e.prototype.addEdge=function(n,r){for(var i=n.getMonotoneChainEdge(),o=i.getStartIndexes(),s=0;s<o.length-1;s++){var a=new Us(i,s),u=new bn(r,i.getMinX(s),a);this.events.add(u),this.events.add(new bn(i.getMaxX(s),u))}},e.prototype.processOverlaps=function(n,r,i,o){for(var s=i.getObject(),a=n;a<r;a++){var u=this.events.get(a);if(u.isInsert()){var l=u.getObject();i.isSameLabel(u)||(s.computeIntersections(l,o),this.nOverlaps++)}}},e.prototype.addEdges=function(){var n=this;if(arguments.length===1)for(var r=arguments[0],i=r.iterator();i.hasNext();){var o=i.next();n.addEdge(o,o)}else if(arguments.length===2)for(var s=arguments[0],a=arguments[1],u=s.iterator();u.hasNext();){var l=u.next();n.addEdge(l,a)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Va),Tr=function(){this._min=st.POSITIVE_INFINITY,this._max=st.NEGATIVE_INFINITY},Nf={NodeComparator:{configurable:!0}};Tr.prototype.getMin=function(){return this._min},Tr.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},Tr.prototype.getMax=function(){return this._max},Tr.prototype.toString=function(){return Xn.toLineString(new L(this._min,0),new L(this._max,0))},Tr.prototype.interfaces_=function(){return[]},Tr.prototype.getClass=function(){return Tr},Nf.NodeComparator.get=function(){return Vs},Object.defineProperties(Tr,Nf);var Vs=function(){};Vs.prototype.compare=function(t,e){var n=t,r=e,i=(n._min+n._max)/2,o=(r._min+r._max)/2;return i<o?-1:i>o?1:0},Vs.prototype.interfaces_=function(){return[So]},Vs.prototype.getClass=function(){return Vs};var ny=function(t){function e(){t.call(this),this._item=null;var n=arguments[0],r=arguments[1],i=arguments[2];this._min=n,this._max=r,this._item=i}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;i.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Tr),ry=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var n=arguments[0],r=arguments[1];this._node1=n,this._node2=r,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(n,r){this._min=Math.min(n._min,r._min),this._max=Math.max(n._max,r._max)},e.prototype.query=function(n,r,i){if(!this.intersects(n,r))return null;this._node1!==null&&this._node1.query(n,r,i),this._node2!==null&&this._node2.query(n,r,i)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Tr),Ar=function(){this._leaves=new U,this._root=null,this._level=0};Ar.prototype.buildTree=function(){Zn.sort(this._leaves,new Tr.NodeComparator);for(var t=this._leaves,e=null,n=new U;;){if(this.buildLevel(t,n),n.size()===1)return n.get(0);e=t,t=n,n=e}},Ar.prototype.insert=function(t,e,n){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new ny(t,e,n))},Ar.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},Ar.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},Ar.prototype.printNode=function(t){qe.out.println(Xn.toLineString(new L(t._min,this._level),new L(t._max,this._level)))},Ar.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},Ar.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r=t.get(n);if((n+1<t.size()?t.get(n):null)===null)e.add(r);else{var i=new ry(t.get(n),t.get(n+1));e.add(i)}}},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar};var Uo=function(){this._items=new U};Uo.prototype.visitItem=function(t){this._items.add(t)},Uo.prototype.getItems=function(){return this._items},Uo.prototype.interfaces_=function(){return[si]},Uo.prototype.getClass=function(){return Uo};var Vo=function(){this._index=null;var t=arguments[0];if(!et(t,oi))throw new he("Argument must be Polygonal");this._index=new Ri(t)},ql={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};Vo.prototype.locate=function(t){var e=new or(t),n=new Xo(e);return this._index.query(t.y,t.y,n),e.getLocation()},Vo.prototype.interfaces_=function(){return[Bo]},Vo.prototype.getClass=function(){return Vo},ql.SegmentVisitor.get=function(){return Xo},ql.IntervalIndexedGeometry.get=function(){return Ri},Object.defineProperties(Vo,ql);var Xo=function(){this._counter=null;var t=arguments[0];this._counter=t};Xo.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},Xo.prototype.interfaces_=function(){return[si]},Xo.prototype.getClass=function(){return Xo};var Ri=function(){this._index=new Ar;var t=arguments[0];this.init(t)};Ri.prototype.init=function(t){for(var e=je.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},Ri.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new Z(t[e-1],t[e]),r=Math.min(n.p0.y,n.p1.y),i=Math.max(n.p0.y,n.p1.y);this._index.insert(r,i,n)}},Ri.prototype.query=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new Uo;return this._index.query(t,e,n),n.getItems()}if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2];this._index.query(r,i,o)}},Ri.prototype.interfaces_=function(){return[]},Ri.prototype.getClass=function(){return Ri};var Xs=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new uf,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Qn,arguments.length===2){var n=arguments[0],r=arguments[1],i=Dn.OGC_SFS_BOUNDARY_RULE;this._argIndex=n,this._parentGeom=r,this._boundaryNodeRule=i,r!==null&&this.add(r)}else if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2];this._argIndex=o,this._parentGeom=s,this._boundaryNodeRule=a,s!==null&&this.add(s)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(n,r){var i=this._nodes.addNode(r).getLabel(),o=1;i.getLocation(n,z.ON)===A.BOUNDARY&&o++;var s=e.determineBoundary(this._boundaryNodeRule,o);i.setLocation(n,s)},e.prototype.computeSelfNodes=function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.computeSelfNodes(n,r,!1)}if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2],a=new Xe(i,!0,!1);a.setIsDoneIfProperInt(s);var u=this.createEdgeSetIntersector(),l=this._parentGeom instanceof Ir||this._parentGeom instanceof Pe||this._parentGeom instanceof Sr,h=o||!l;return u.computeIntersections(this._edges,a,h),this.addSelfIntersectionNodes(this._argIndex),a}},e.prototype.computeSplitEdges=function(n){for(var r=this._edges.iterator();r.hasNext();)r.next().eiList.addSplitEdges(n)},e.prototype.computeEdgeIntersections=function(n,r,i){var o=new Xe(r,i,!0);return o.setBoundaryNodes(this.getBoundaryNodes(),n.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,n._edges,o),o},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof vn){var n=arguments[0],r=n.getCoordinate();this.insertPoint(this._argIndex,r,A.INTERIOR)}else if(arguments[0]instanceof L){var i=arguments[0];this.insertPoint(this._argIndex,i,A.INTERIOR)}},e.prototype.addPolygon=function(n){this.addPolygonRing(n.getExteriorRing(),A.EXTERIOR,A.INTERIOR);for(var r=0;r<n.getNumInteriorRing();r++){var i=n.getInteriorRingN(r);this.addPolygonRing(i,A.INTERIOR,A.EXTERIOR)}},e.prototype.addEdge=function(n){this.insertEdge(n);var r=n.getCoordinates();this.insertPoint(this._argIndex,r[0],A.BOUNDARY),this.insertPoint(this._argIndex,r[r.length-1],A.BOUNDARY)},e.prototype.addLineString=function(n){var r=ht.removeRepeatedPoints(n.getCoordinates());if(r.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=new Ua(r,new Kt(this._argIndex,A.INTERIOR));this._lineEdgeMap.put(n,i),this.insertEdge(i),lt.isTrue(r.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,r[0]),this.insertBoundaryPoint(this._argIndex,r[r.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var n=this.getBoundaryNodes(),r=new Array(n.size()).fill(null),i=0,o=n.iterator();o.hasNext();){var s=o.next();r[i++]=s.getCoordinate().copy()}return r},e.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(n,r,i){if(this.isBoundaryNode(n,r))return null;i===A.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(n,r):this.insertPoint(n,r,i)},e.prototype.addPolygonRing=function(n,r,i){if(n.isEmpty())return null;var o=ht.removeRepeatedPoints(n.getCoordinates());if(o.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=o[0],null;var s=r,a=i;X.isCCW(o)&&(s=i,a=r);var u=new Ua(o,new Kt(this._argIndex,A.BOUNDARY,s,a));this._lineEdgeMap.put(n,u),this.insertEdge(u),this.insertPoint(this._argIndex,o[0],A.BOUNDARY)},e.prototype.insertPoint=function(n,r,i){var o=this._nodes.addNode(r),s=o.getLabel();s===null?o._label=new Kt(n,i):s.setLocation(n,i)},e.prototype.createEdgeSetIntersector=function(){return new ey},e.prototype.addSelfIntersectionNodes=function(n){for(var r=this._edges.iterator();r.hasNext();)for(var i=r.next(),o=i.getLabel().getLocation(n),s=i.eiList.iterator();s.hasNext();){var a=s.next();this.addSelfIntersectionNode(n,a.coord,o)}},e.prototype.add=function(){if(arguments.length!==1)return t.prototype.add.apply(this,arguments);var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Sr&&(this._useBoundaryDeterminationRule=!1),n instanceof Pe)this.addPolygon(n);else if(n instanceof ge)this.addLineString(n);else if(n instanceof vn)this.addPoint(n);else if(n instanceof Fo)this.addCollection(n);else if(n instanceof Si)this.addCollection(n);else if(n instanceof Sr)this.addCollection(n);else{if(!(n instanceof Qe))throw new Error(n.getClass().getName());this.addCollection(n)}},e.prototype.addCollection=function(n){for(var r=0;r<n.getNumGeometries();r++){var i=n.getGeometryN(r);this.add(i)}},e.prototype.locate=function(n){return et(this._parentGeom,oi)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new Vo(this._parentGeom)),this._areaPtLocator.locate(n)):this._ptLocator.locate(n,this._parentGeom)},e.prototype.findEdge=function(){if(arguments.length===1){var n=arguments[0];return this._lineEdgeMap.get(n)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(n,r){return n.isInBoundary(r)?A.BOUNDARY:A.INTERIOR},e}(fe),Yo=function(){if(this._li=new wi,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Xs(0,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1],r=Dn.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Xs(0,e,r),this._arg[1]=new Xs(1,n,r)}else if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Xs(0,i,s),this._arg[1]=new Xs(1,o,s)}};Yo.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},Yo.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},Yo.prototype.interfaces_=function(){return[]},Yo.prototype.getClass=function(){return Yo};var Ti=function(){};Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.map=function(){if(arguments[0]instanceof $&&et(arguments[1],Ti.MapOp)){for(var t=arguments[0],e=arguments[1],n=new U,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));i!==null&&n.add(i)}return t.getFactory().buildGeometry(n)}if(et(arguments[0],Ne)&&et(arguments[1],Ti.MapOp)){for(var o=arguments[0],s=arguments[1],a=new U,u=o.iterator();u.hasNext();){var l=u.next(),h=s.map(l);h!==null&&a.add(h)}return a}},Ti.MapOp=function(){};var ut=function(t){function e(){var n=arguments[0],r=arguments[1];t.call(this,n,r),this._ptLocator=new Qn,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Kn,this._resultPolyList=new U,this._resultLineList=new U,this._resultPointList=new U,this._graph=new fe(new vf),this._geomFact=n.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(n){var r=this._edgeList.findEqualEdge(n);if(r!==null){var i=r.getLabel(),o=n.getLabel();r.isPointwiseEqual(n)||(o=new Kt(n.getLabel())).flip();var s=r.getDepth();s.isNull()&&s.add(i),s.add(o),i.merge(o)}else this._edgeList.add(n)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var r=n.next(),i=r.getSym();r.isInResult()&&i.isInResult()&&(r.setInResult(!1),i.setInResult(!1))}},e.prototype.isCoveredByLA=function(n){return!!this.isCovered(n,this._resultLineList)||!!this.isCovered(n,this._resultPolyList)},e.prototype.computeGeometry=function(n,r,i,o){var s=new U;return s.addAll(n),s.addAll(r),s.addAll(i),s.isEmpty()?e.createEmptyResult(o,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(s)},e.prototype.mergeSymLabels=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();)n.next().getEdges().mergeSymLabels()},e.prototype.isCovered=function(n,r){for(var i=r.iterator();i.hasNext();){var o=i.next();if(this._ptLocator.locate(n,o)!==A.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var n=new U,r=this._edgeList.iterator();r.hasNext();){var i=r.next();i.isCollapsed()&&(r.remove(),n.add(i.getCollapsedEdge()))}this._edgeList.addAll(n)},e.prototype.updateNodeLabelling=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();){var r=n.next(),i=r.getEdges().getLabel();r.getLabel().merge(i)}},e.prototype.getResultGeometry=function(n){return this.computeOverlay(n),this._resultGeom},e.prototype.insertUniqueEdges=function(n){for(var r=n.iterator();r.hasNext();){var i=r.next();this.insertUniqueEdge(i)}},e.prototype.computeOverlay=function(n){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var r=new U;this._arg[0].computeSplitEdges(r),this._arg[1].computeSplitEdges(r),this.insertUniqueEdges(r),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Oi.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(n),this.cancelDuplicateResultEdges();var i=new _n(this._geomFact);i.add(this._graph),this._resultPolyList=i.getPolygons();var o=new vr(this,this._geomFact,this._ptLocator);this._resultLineList=o.build(n);var s=new ao(this,this._geomFact,this._ptLocator);this._resultPointList=s.build(n),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,n)},e.prototype.labelIncompleteNode=function(n,r){var i=this._ptLocator.locate(n.getCoordinate(),this._arg[r].getGeometry());n.getLabel().setLocation(r,i)},e.prototype.copyPoints=function(n){for(var r=this._arg[n].getNodeIterator();r.hasNext();){var i=r.next();this._graph.addNode(i.getCoordinate()).setLabel(n,i.getLabel().getLocation(n))}},e.prototype.findResultAreaEdges=function(n){for(var r=this._graph.getEdgeEnds().iterator();r.hasNext();){var i=r.next(),o=i.getLabel();o.isArea()&&!i.isInteriorAreaEdge()&&e.isResultOfOp(o.getLocation(0,z.RIGHT),o.getLocation(1,z.RIGHT),n)&&i.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var n=this._edgeList.iterator();n.hasNext();){var r=n.next(),i=r.getLabel(),o=r.getDepth();if(!o.isNull()){o.normalize();for(var s=0;s<2;s++)i.isNull(s)||!i.isArea()||o.isNull(s)||(o.getDelta(s)===0?i.toLine(s):(lt.isTrue(!o.isNull(s,z.LEFT),"depth of LEFT side has not been initialized"),i.setLocation(s,z.LEFT,o.getLocation(s,z.LEFT)),lt.isTrue(!o.isNull(s,z.RIGHT),"depth of RIGHT side has not been initialized"),i.setLocation(s,z.RIGHT,o.getLocation(s,z.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();)n.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var n=this._graph.getNodes().iterator();n.hasNext();){var r=n.next(),i=r.getLabel();r.isIsolated()&&(i.isNull(0)?this.labelIncompleteNode(r,0):this.labelIncompleteNode(r,1)),r.getEdges().updateLabelling(i)}},e.prototype.isCoveredByA=function(n){return!!this.isCovered(n,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Yo);ut.overlayOp=function(t,e,n){return new ut(t,e).getResultGeometry(n)},ut.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return ut.createEmptyResult(ut.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return so.map(t,{interfaces_:function(){return[Ti.MapOp]},map:function(r){return r.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),sn.overlayOp(t,e,ut.INTERSECTION)},ut.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ut.createEmptyResult(ut.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),sn.overlayOp(t,e,ut.SYMDIFFERENCE)},ut.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case ut.INTERSECTION:o=Math.min(r,i);break;case ut.UNION:o=Math.max(r,i);break;case ut.DIFFERENCE:o=r;break;case ut.SYMDIFFERENCE:o=Math.max(r,i)}return o},ut.createEmptyResult=function(t,e,n,r){var i=null;switch(ut.resultDimension(t,e,n)){case-1:i=r.createGeometryCollection(new Array(0).fill(null));break;case 0:i=r.createPoint();break;case 1:i=r.createLineString();break;case 2:i=r.createPolygon()}return i},ut.difference=function(t,e){return t.isEmpty()?ut.createEmptyResult(ut.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),sn.overlayOp(t,e,ut.DIFFERENCE))},ut.isResultOfOp=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return ut.isResultOfOp(n,r,e)}if(arguments.length===3){var i=arguments[0],o=arguments[1],s=arguments[2];switch(i===A.BOUNDARY&&(i=A.INTERIOR),o===A.BOUNDARY&&(o=A.INTERIOR),s){case ut.INTERSECTION:return i===A.INTERIOR&&o===A.INTERIOR;case ut.UNION:return i===A.INTERIOR||o===A.INTERIOR;case ut.DIFFERENCE:return i===A.INTERIOR&&o!==A.INTERIOR;case ut.SYMDIFFERENCE:return i===A.INTERIOR&&o!==A.INTERIOR||i!==A.INTERIOR&&o===A.INTERIOR}return!1}},ut.INTERSECTION=1,ut.UNION=2,ut.DIFFERENCE=3,ut.SYMDIFFERENCE=4;var di=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Qn,this._seg=new Z;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};di.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,n=0;n<this._linework.getNumGeometries();n++)for(var r=e._linework.getGeometryN(n).getCoordinateSequence(),i=0;i<r.size()-1;i++)if(r.getCoordinate(i,e._seg.p0),r.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0;return!1},di.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?A.BOUNDARY:this._ptLocator.locate(t,this._g)},di.prototype.extractLinework=function(t){var e=new Ho;t.apply(e);var n=e.getLinework(),r=pt.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},di.prototype.interfaces_=function(){return[]},di.prototype.getClass=function(){return di};var Ho=function(){this._linework=null,this._linework=new U};Ho.prototype.getLinework=function(){return this._linework},Ho.prototype.filter=function(t){if(t instanceof Pe){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},Ho.prototype.interfaces_=function(){return[ar]},Ho.prototype.getClass=function(){return Ho};var Ai=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};Ai.prototype.extractPoints=function(t,e,n){for(var r=t.getCoordinates(),i=0;i<r.length-1;i++)this.computeOffsetPoints(r[i],r[i+1],e,n)},Ai.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},Ai.prototype.getPoints=function(t){for(var e=new U,n=je.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},Ai.prototype.computeOffsetPoints=function(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=n*i/s,u=n*o/s,l=(e.x+t.x)/2,h=(e.y+t.y)/2;if(this._doLeft){var c=new L(l-u,h+a);r.add(c)}if(this._doRight){var p=new L(l+u,h-a);r.add(p)}},Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai};var Ln=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new U;var e=arguments[0],n=arguments[1],r=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=[e,n,r],this._locFinder=[new di(this._geom[0],this._boundaryDistanceTolerance),new di(this._geom[1],this._boundaryDistanceTolerance),new di(this._geom[2],this._boundaryDistanceTolerance)]},Pf={TOLERANCE:{configurable:!0}};Ln.prototype.reportResult=function(t,e,n){qe.out.println("Overlay result invalid - A:"+A.toLocationSymbol(e[0])+" B:"+A.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+A.toLocationSymbol(e[2]))},Ln.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},Ln.prototype.checkValid=function(){var t=this;if(arguments.length===1){for(var e=arguments[0],n=0;n<this._testCoords.size();n++){var r=t._testCoords.get(n);if(!t.checkValid(e,r))return t._invalidLocation=r,!1}return!0}if(arguments.length===2){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!Ln.hasLocation(this._location,A.BOUNDARY)||this.isValidResult(i,this._location)}},Ln.prototype.addTestPts=function(t){var e=new Ai(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},Ln.prototype.isValidResult=function(t,e){var n=ut.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===A.INTERIOR);return r||this.reportResult(t,e,n),r},Ln.prototype.getInvalidLocation=function(){return this._invalidLocation},Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Ln.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},Ln.computeBoundaryDistanceTolerance=function(t,e){return Math.min(xe.computeSizeBasedSnapTolerance(t),xe.computeSizeBasedSnapTolerance(e))},Ln.isValid=function(t,e,n,r){return new Ln(t,e,r).isValid(n)},Pf.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(Ln,Pf);var On=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};On.prototype.extractElements=function(t,e){if(t===null)return null;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);this._skipEmpty&&r.isEmpty()||e.add(r)}},On.prototype.combine=function(){for(var t=new U,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return t.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},On.combine=function(){if(arguments.length===1){var t=arguments[0],e=new On(t);return e.combine()}if(arguments.length===2){var n=arguments[0],r=arguments[1],i=new On(On.createList(n,r));return i.combine()}if(arguments.length===3){var o=arguments[0],s=arguments[1],a=arguments[2],u=new On(On.createList(o,s,a));return u.combine()}},On.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},On.createList=function(){if(arguments.length===2){var t=arguments[0],e=arguments[1],n=new U;return n.add(t),n.add(e),n}if(arguments.length===3){var r=arguments[0],i=arguments[1],o=arguments[2],s=new U;return s.add(r),s.add(i),s.add(o),s}};var Ie=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,this._inputPolys===null&&(this._inputPolys=new U)},Mf={STRTREE_NODE_CAPACITY:{configurable:!0}};Ie.prototype.reduceToGeometries=function(t){for(var e=new U,n=t.iterator();n.hasNext();){var r=n.next(),i=null;et(r,Yn)?i=this.unionTree(r):r instanceof $&&(i=r),e.add(i)}return e},Ie.prototype.extractByEnvelope=function(t,e,n){for(var r=new U,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?r.add(o):n.add(o)}return this._geomFactory.buildGeometry(r)},Ie.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return On.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection(r);return this.unionUsingEnvelopeIntersection(t,e,i)},Ie.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new pf(Ie.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var r=t.itemsTree();return this.unionTree(r)},Ie.prototype.binaryUnion=function(){if(arguments.length===1){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2];if(r-n<=1){var i=Ie.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(Ie.getGeometry(e,n),Ie.getGeometry(e,n+1));var o=Math.trunc((r+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,r);return this.unionSafe(s,a)}},Ie.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var r=n.next();e=e===null?r.copy():e.union(r)}return e},Ie.prototype.unionSafe=function(t,e){return t===null&&e===null?null:t===null?e.copy():e===null?t.copy():this.unionOptimized(t,e)},Ie.prototype.unionActual=function(t,e){return Ie.restrictToPolygons(t.union(e))},Ie.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},Ie.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new U,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),On.combine(r)},Ie.prototype.bufferUnion=function(){if(arguments.length===1){var t=arguments[0],e=t.get(0).getFactory(),n=e.buildGeometry(t),r=n.buffer(0);return r}if(arguments.length===2){var i=arguments[0],o=arguments[1],s=i.getFactory(),a=s.createGeometryCollection([i,o]),u=a.buffer(0);return u}},Ie.prototype.interfaces_=function(){return[]},Ie.prototype.getClass=function(){return Ie},Ie.restrictToPolygons=function(t){if(et(t,oi))return t;var e=Kr.getPolygons(t);return e.size()===1?e.get(0):t.getFactory().createMultiPolygon(pt.toPolygonArray(e))},Ie.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},Ie.union=function(t){return new Ie(t).union()},Mf.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(Ie,Mf);var Xa=function(){};function Di(){return new Ya}function Ya(){this.reset()}Xa.prototype.interfaces_=function(){return[]},Xa.prototype.getClass=function(){return Xa},Xa.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ut.createEmptyResult(ut.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),sn.overlayOp(t,e,ut.UNION)},Ya.prototype={constructor:Ya,reset:function(){this.s=this.t=0},add:function(t){Lf(Ha,t,this.t),Lf(this,Ha.s,this.s),this.s?this.t+=Ha.t:this.s=Ha.t},valueOf:function(){return this.s}};var Ha=new Ya;function Lf(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var Se=1e-6,ne=Math.PI,Qr=ne/2,Of=ne/4,$r=2*ne,Fi=180/ne,_r=ne/180,an=Math.abs,iy=Math.atan,Wo=Math.atan2,Le=Math.cos,Oe=Math.sin,Ys=Math.sqrt;function Rf(t){return t>1?0:t<-1?ne:Math.acos(t)}function Jo(t){return t>1?Qr:t<-1?-Qr:Math.asin(t)}function Hs(){}function Wa(t,e){t&&Af.hasOwnProperty(t.type)&&Af[t.type](t,e)}var Tf={Feature:function(t,e){Wa(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Wa(n[r].geometry,e)}},Af={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Bl(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Bl(n[r],e,0)},Polygon:function(t,e){Df(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Df(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Wa(n[r],e)}};function Bl(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Df(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Bl(t[n],e,1);e.polygonEnd()}Di(),Di();function zl(t){return[Wo(t[1],t[0]),Jo(t[2])]}function Zo(t){var e=t[0],n=t[1],r=Le(n);return[r*Le(e),r*Oe(e),Oe(n)]}function Ja(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Za(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function jl(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Ka(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Ul(t){var e=Ys(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}Di();function Ff(t,e){function n(r,i){return r=t(r,i),e(r[0],r[1])}return t.invert&&e.invert&&(n.invert=function(r,i){return(r=e.invert(r,i))&&t.invert(r[0],r[1])}),n}function Vl(t,e){return[t>ne?t-$r:t<-ne?t+$r:t,e]}function kf(t){return function(e,n){return[(e+=t)>ne?e-$r:e<-ne?e+$r:e,n]}}function Gf(t){var e=kf(t);return e.invert=kf(-t),e}function qf(t,e){var n=Le(t),r=Oe(t),i=Le(e),o=Oe(e);function s(a,u){var l=Le(u),h=Le(a)*l,c=Oe(a)*l,p=Oe(u),d=p*n+h*r;return[Wo(c*i-d*o,h*n-p*r),Jo(d*i+c*o)]}return s.invert=function(a,u){var l=Le(u),h=Le(a)*l,c=Oe(a)*l,p=Oe(u),d=p*i-c*o;return[Wo(c*i+p*o,h*n+d*r),Jo(d*n-h*r)]},s}function Bf(t,e){(e=Zo(e))[0]-=t,Ul(e);var n=Rf(-e[1]);return((-e[2]<0?-n:n)+$r-Se)%$r}function zf(){var t,e=[];return{point:function(n,r){t.push([n,r])},lineStart:function(){e.push(t=[])},lineEnd:Hs,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Qa(t,e){return an(t[0]-e[0])<Se&&an(t[1]-e[1])<Se}function $a(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function jf(t,e,n,r,i){var o,s,a=[],u=[];if(t.forEach(function(g){if(!((m=g.length-1)<=0)){var m,f,_=g[0],I=g[m];if(Qa(_,I)){for(i.lineStart(),o=0;o<m;++o)i.point((_=g[o])[0],_[1]);i.lineEnd()}else a.push(f=new $a(_,g,null,!0)),u.push(f.o=new $a(_,null,f,!1)),a.push(f=new $a(I,g,null,!1)),u.push(f.o=new $a(I,null,f,!0))}}),a.length){for(u.sort(e),Uf(a),Uf(u),o=0,s=u.length;o<s;++o)u[o].e=n=!n;for(var l,h,c=a[0];;){for(var p=c,d=!0;p.v;)if((p=p.n)===c)return;l=p.z,i.lineStart();do{if(p.v=p.o.v=!0,p.e){if(d)for(o=0,s=l.length;o<s;++o)i.point((h=l[o])[0],h[1]);else r(p.x,p.n.x,1,i);p=p.n}else{if(d)for(l=p.p.z,o=l.length-1;o>=0;--o)i.point((h=l[o])[0],h[1]);else r(p.x,p.p.x,-1,i);p=p.p}l=(p=p.o).z,d=!d}while(!p.v);i.lineEnd()}}}function Uf(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function Vf(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}Vl.invert=Vl;var Xl,Xf;(Xl=Vf).length===1&&(Xf=Xl,Xl=function(t,e){return Vf(Xf(t),e)});function Yf(t){for(var e,n,r,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(n=new Array(s);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--s]=r[e];return n}var Ws=1e9,tu=-Ws;function oy(t,e,n,r){function i(l,h){return t<=l&&l<=n&&e<=h&&h<=r}function o(l,h,c,p){var d=0,g=0;if(l==null||(d=s(l,c))!==(g=s(h,c))||u(l,h)<0^c>0)do p.point(d===0||d===3?t:n,d>1?r:e);while((d=(d+c+4)%4)!==g);else p.point(h[0],h[1])}function s(l,h){return an(l[0]-t)<Se?h>0?0:3:an(l[0]-n)<Se?h>0?2:1:an(l[1]-e)<Se?h>0?1:0:h>0?3:2}function a(l,h){return u(l.x,h.x)}function u(l,h){var c=s(l,1),p=s(h,1);return c!==p?c-p:c===0?h[1]-l[1]:c===1?l[0]-h[0]:c===2?l[1]-h[1]:h[0]-l[0]}return function(l){var h,c,p,d,g,m,f,_,I,y,v,x=l,b=zf(),E={point:T,lineStart:function(){E.point=C,c&&c.push(p=[]),y=!0,I=!1,f=_=NaN},lineEnd:function(){h&&(C(d,g),m&&I&&b.rejoin(),h.push(b.result())),E.point=T,I&&x.lineEnd()},polygonStart:function(){x=b,h=[],c=[],v=!0},polygonEnd:function(){var D=function(){for(var O=0,R=0,P=c.length;R<P;++R)for(var F,k,q=c[R],S=1,V=q.length,j=q[0],tt=j[0],at=j[1];S<V;++S)F=tt,k=at,tt=(j=q[S])[0],at=j[1],k<=r?at>r&&(tt-F)*(r-k)>(at-k)*(t-F)&&++O:at<=r&&(tt-F)*(r-k)<(at-k)*(t-F)&&--O;return O}(),M=v&&D,B=(h=Yf(h)).length;(M||B)&&(l.polygonStart(),M&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),B&&jf(h,a,D,o,l),l.polygonEnd()),x=l,h=c=p=null}};function T(D,M){i(D,M)&&x.point(D,M)}function C(D,M){var B=i(D,M);if(c&&p.push([D,M]),y)d=D,g=M,m=B,y=!1,B&&(x.lineStart(),x.point(D,M));else if(B&&I)x.point(D,M);else{var O=[f=Math.max(tu,Math.min(Ws,f)),_=Math.max(tu,Math.min(Ws,_))],R=[D=Math.max(tu,Math.min(Ws,D)),M=Math.max(tu,Math.min(Ws,M))];(function(P,F,k,q,S,V){var j,tt=P[0],at=P[1],Jt=0,se=1,gt=F[0]-tt,yt=F[1]-at;if(j=k-tt,gt||!(j>0)){if(j/=gt,gt<0){if(j<Jt)return;j<se&&(se=j)}else if(gt>0){if(j>se)return;j>Jt&&(Jt=j)}if(j=S-tt,gt||!(j<0)){if(j/=gt,gt<0){if(j>se)return;j>Jt&&(Jt=j)}else if(gt>0){if(j<Jt)return;j<se&&(se=j)}if(j=q-at,yt||!(j>0)){if(j/=yt,yt<0){if(j<Jt)return;j<se&&(se=j)}else if(yt>0){if(j>se)return;j>Jt&&(Jt=j)}if(j=V-at,yt||!(j<0)){if(j/=yt,yt<0){if(j>se)return;j>Jt&&(Jt=j)}else if(yt>0){if(j<Jt)return;j<se&&(se=j)}return Jt>0&&(P[0]=tt+Jt*gt,P[1]=at+Jt*yt),se<1&&(F[0]=tt+se*gt,F[1]=at+se*yt),!0}}}}})(O,R,t,e,n,r)?(I||(x.lineStart(),x.point(O[0],O[1])),x.point(R[0],R[1]),B||x.lineEnd(),v=!1):B&&(x.lineStart(),x.point(D,M),v=!1)}f=D,_=M,I=B}return E}}var Yl=Di();Di();function Hf(t){return t}Di(),Di();var Ko=1/0,eu=Ko,Js=-Ko,nu=Js,Wf={point:function(t,e){t<Ko&&(Ko=t),t>Js&&(Js=t),e<eu&&(eu=e),e>nu&&(nu=e)},lineStart:Hs,lineEnd:Hs,polygonStart:Hs,polygonEnd:Hs,result:function(){var t=[[Ko,eu],[Js,nu]];return Js=nu=-(eu=Ko=1/0),t}};Di();function Jf(t,e,n,r){return function(i,o){var s,a,u,l=e(o),h=i.invert(r[0],r[1]),c=zf(),p=e(c),d=!1,g={point:m,lineStart:_,lineEnd:I,polygonStart:function(){g.point=y,g.lineStart=v,g.lineEnd=x,a=[],s=[]},polygonEnd:function(){g.point=m,g.lineStart=_,g.lineEnd=I,a=Yf(a);var b=function(E,T){var C=T[0],D=T[1],M=[Oe(C),-Le(C),0],B=0,O=0;Yl.reset();for(var R=0,P=E.length;R<P;++R)if(k=(F=E[R]).length)for(var F,k,q=F[k-1],S=q[0],V=q[1]/2+Of,j=Oe(V),tt=Le(V),at=0;at<k;++at,S=se,j=yt,tt=yn,q=Jt){var Jt=F[at],se=Jt[0],gt=Jt[1]/2+Of,yt=Oe(gt),yn=Le(gt),Re=se-S,lo=Re>=0?1:-1,Ks=lo*Re,Qo=Ks>ne,iu=j*yt;if(Yl.add(Wo(iu*lo*Oe(Ks),tt*yn+iu*Le(Ks))),B+=Qo?Re+lo*$r:Re,Qo^S>=C^se>=C){var $o=Za(Zo(q),Zo(Jt));Ul($o);var ou=Za(M,$o);Ul(ou);var su=(Qo^Re>=0?-1:1)*Jo(ou[2]);(D>su||D===su&&($o[0]||$o[1]))&&(O+=Qo^Re>=0?1:-1)}}return(B<-1e-6||B<Se&&Yl<-1e-6)^1&O}(s,h);a.length?(d||(o.polygonStart(),d=!0),jf(a,ay,b,n,o)):b&&(d||(o.polygonStart(),d=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),d&&(o.polygonEnd(),d=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function m(b,E){var T=i(b,E);t(b=T[0],E=T[1])&&o.point(b,E)}function f(b,E){var T=i(b,E);l.point(T[0],T[1])}function _(){g.point=f,l.lineStart()}function I(){g.point=m,l.lineEnd()}function y(b,E){u.push([b,E]);var T=i(b,E);p.point(T[0],T[1])}function v(){p.lineStart(),u=[]}function x(){y(u[0][0],u[0][1]),p.lineEnd();var b,E,T,C,D=p.clean(),M=c.result(),B=M.length;if(u.pop(),s.push(u),u=null,B)if(1&D){if((E=(T=M[0]).length-1)>0){for(d||(o.polygonStart(),d=!0),o.lineStart(),b=0;b<E;++b)o.point((C=T[b])[0],C[1]);o.lineEnd()}}else B>1&&2&D&&M.push(M.pop().concat(M.shift())),a.push(M.filter(sy))}return g}}function sy(t){return t.length>1}function ay(t,e){return((t=t.x)[0]<0?t[1]-Qr-Se:Qr-t[1])-((e=e.x)[0]<0?e[1]-Qr-Se:Qr-e[1])}var Zf=Jf(function(){return!0},function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?ne:-ne,u=an(o-n);an(u-ne)<Se?(t.point(n,r=(r+s)/2>0?Qr:-Qr),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=ne&&(an(n-i)<Se&&(n-=i*Se),an(o-a)<Se&&(o-=a*Se),r=function(l,h,c,p){var d,g,m=Oe(l-c);return an(m)>Se?iy((Oe(h)*(g=Le(p))*Oe(c)-Oe(p)*(d=Le(h))*Oe(l))/(d*g*m)):(h+p)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}},function(t,e,n,r){var i;if(t==null)i=n*Qr,r.point(-ne,i),r.point(0,i),r.point(ne,i),r.point(ne,0),r.point(ne,-i),r.point(0,-i),r.point(-ne,-i),r.point(-ne,0),r.point(-ne,i);else if(an(t[0]-e[0])>Se){var o=t[0]<e[0]?ne:-ne;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])},[-ne,-Qr]);function uy(t,e){var n=Le(t),r=n>0,i=an(n)>Se;function o(u,l){return Le(u)*Le(l)>n}function s(u,l,h){var c=[1,0,0],p=Za(Zo(u),Zo(l)),d=Ja(p,p),g=p[0],m=d-g*g;if(!m)return!h&&u;var f=n*d/m,_=-n*g/m,I=Za(c,p),y=Ka(c,f);jl(y,Ka(p,_));var v=I,x=Ja(y,v),b=Ja(v,v),E=x*x-b*(Ja(y,y)-1);if(!(E<0)){var T=Ys(E),C=Ka(v,(-x-T)/b);if(jl(C,y),C=zl(C),!h)return C;var D,M=u[0],B=l[0],O=u[1],R=l[1];B<M&&(D=M,M=B,B=D);var P=B-M,F=an(P-ne)<Se;if(!F&&R<O&&(D=O,O=R,R=D),F||P<Se?F?O+R>0^C[1]<(an(C[0]-M)<Se?O:R):O<=C[1]&&C[1]<=R:P>ne^(M<=C[0]&&C[0]<=B)){var k=Ka(v,(-x+T)/b);return jl(k,y),[C,zl(k)]}}}function a(u,l){var h=r?t:ne-t,c=0;return u<-h?c|=1:u>h&&(c|=2),l<-h?c|=4:l>h&&(c|=8),c}return Jf(o,function(u){var l,h,c,p,d;return{lineStart:function(){p=c=!1,d=1},point:function(g,m){var f,_=[g,m],I=o(g,m),y=r?I?0:a(g,m):I?a(g+(g<0?ne:-ne),m):0;if(!l&&(p=c=I)&&u.lineStart(),I!==c&&(!(f=s(l,_))||Qa(l,f)||Qa(_,f))&&(_[0]+=Se,_[1]+=Se,I=o(_[0],_[1])),I!==c)d=0,I?(u.lineStart(),f=s(_,l),u.point(f[0],f[1])):(f=s(l,_),u.point(f[0],f[1]),u.lineEnd()),l=f;else if(i&&l&&r^I){var v;y&h||!(v=s(_,l,!0))||(d=0,r?(u.lineStart(),u.point(v[0][0],v[0][1]),u.point(v[1][0],v[1][1]),u.lineEnd()):(u.point(v[1][0],v[1][1]),u.lineEnd(),u.lineStart(),u.point(v[0][0],v[0][1])))}!I||l&&Qa(l,_)||u.point(_[0],_[1]),l=_,c=I,h=y},lineEnd:function(){c&&u.lineEnd(),l=null},clean:function(){return d|(p&&c)<<1}}},function(u,l,h,c){(function(p,d,g,m,f,_){if(g){var I=Le(d),y=Oe(d),v=m*g;f==null?(f=d+m*$r,_=d-v/2):(f=Bf(I,f),_=Bf(I,_),(m>0?f<_:f>_)&&(f+=m*$r));for(var x,b=f;m>0?b>_:b<_;b-=v)x=zl([I,-y*Le(b),-y*Oe(b)]),p.point(x[0],x[1])}})(c,t,e,h,u,l)},r?[0,-t]:[-ne,t-ne])}function Kf(t){return function(e){var n=new Hl;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Hl(){}function Qf(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),o!=null&&t.clipExtent(null),function(h,c){h&&Tf.hasOwnProperty(h.type)?Tf[h.type](h,c):Wa(h,c)}(n,t.stream(Wf));var s=Wf.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(r-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return o!=null&&t.clipExtent(o),t.scale(150*a).translate([u,l])}Hl.prototype={constructor:Hl,point:function(t,e){this.stream.point(t,e)},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()}};var ly=Le(30*_r);function $f(t,e){return+e?function(n,r){function i(o,s,a,u,l,h,c,p,d,g,m,f,_,I){var y=c-o,v=p-s,x=y*y+v*v;if(x>4*r&&_--){var b=u+g,E=l+m,T=h+f,C=Ys(b*b+E*E+T*T),D=Jo(T/=C),M=an(an(T)-1)<Se||an(a-d)<Se?(a+d)/2:Wo(E,b),B=n(M,D),O=B[0],R=B[1],P=O-o,F=R-s,k=v*P-y*F;(k*k/x>r||an((y*P+v*F)/x-.5)>.3||u*g+l*m+h*f<ly)&&(i(o,s,a,u,l,h,O,R,M,b/=C,E/=C,T,_,I),I.point(O,R),i(O,R,M,b,E,T,c,p,d,g,m,f,_,I))}}return function(o){var s,a,u,l,h,c,p,d,g,m,f,_,I={point:y,lineStart:v,lineEnd:b,polygonStart:function(){o.polygonStart(),I.lineStart=E},polygonEnd:function(){o.polygonEnd(),I.lineStart=v}};function y(D,M){D=n(D,M),o.point(D[0],D[1])}function v(){d=NaN,I.point=x,o.lineStart()}function x(D,M){var B=Zo([D,M]),O=n(D,M);i(d,g,p,m,f,_,d=O[0],g=O[1],p=D,m=B[0],f=B[1],_=B[2],16,o),o.point(d,g)}function b(){I.point=y,o.lineEnd()}function E(){v(),I.point=T,I.lineEnd=C}function T(D,M){x(s=D,M),a=d,u=g,l=m,h=f,c=_,I.point=x}function C(){i(d,g,p,m,f,_,a,u,s,l,h,c,16,o),I.lineEnd=b,b()}return I}}(t,e):function(n){return Kf({point:function(r,i){r=n(r,i),this.stream.point(r[0],r[1])}})}(t)}var cy=Kf({point:function(t,e){this.stream.point(t*_r,e*_r)}});function hy(t){return function(e){var n,r,i,o,s,a,u,l,h,c,p=150,d=480,g=250,m=0,f=0,_=0,I=0,y=0,v=null,x=Zf,b=null,E=Hf,T=.5,C=$f(B,T);function D(P){return[(P=s(P[0]*_r,P[1]*_r))[0]*p+r,i-P[1]*p]}function M(P){return(P=s.invert((P[0]-r)/p,(i-P[1])/p))&&[P[0]*Fi,P[1]*Fi]}function B(P,F){return[(P=n(P,F))[0]*p+r,i-P[1]*p]}function O(){s=Ff(o=function(F,k,q){return(F%=$r)?k||q?Ff(Gf(F),qf(k,q)):Gf(F):k||q?qf(k,q):Vl}(_,I,y),n);var P=n(m,f);return r=d-P[0]*p,i=g+P[1]*p,R()}function R(){return h=c=null,D}return D.stream=function(P){return h&&c===P?h:h=cy(x(o,C(E(c=P))))},D.clipAngle=function(P){return arguments.length?(x=+P?uy(v=P*_r,6*_r):(v=null,Zf),R()):v*Fi},D.clipExtent=function(P){return arguments.length?(E=P==null?(b=a=u=l=null,Hf):oy(b=+P[0][0],a=+P[0][1],u=+P[1][0],l=+P[1][1]),R()):b==null?null:[[b,a],[u,l]]},D.scale=function(P){return arguments.length?(p=+P,O()):p},D.translate=function(P){return arguments.length?(d=+P[0],g=+P[1],O()):[d,g]},D.center=function(P){return arguments.length?(m=P[0]%360*_r,f=P[1]%360*_r,O()):[m*Fi,f*Fi]},D.rotate=function(P){return arguments.length?(_=P[0]%360*_r,I=P[1]%360*_r,y=P.length>2?P[2]%360*_r:0,O()):[_*Fi,I*Fi,y*Fi]},D.precision=function(P){return arguments.length?(C=$f(B,T=P*P),R()):Ys(T)},D.fitExtent=function(P,F){return Qf(D,P,F)},D.fitSize=function(P,F){return function(k,q,S){return Qf(k,[[0,0],q],S)}(D,P,F)},function(){return n=e.apply(this,arguments),D.invert=n.invert&&M,O()}}(function(){return t})()}var tg=function(t){return function(e,n){var r=Le(e),i=Le(n),o=t(r*i);return[o*i*Oe(e),o*Oe(n)]}}(function(t){return(t=Rf(t))&&t/Oe(t)});function py(){return hy(tg).scale(79.4188).clipAngle(179.999)}function ru(t,e,n,r){var i=t.properties||{},o=t.type==="Feature"?t.geometry:t;if(o.type==="GeometryCollection"){var s=[];return zn(t,function(p){var d=ru(p,e,n,r);d&&s.push(d)}),nt(s)}var a=function(p){var d=ha(p).geometry.coordinates,g=[-d[0],-d[1]];return py().rotate(g).scale(tr)}(o),u={type:o.type,coordinates:ng(o.coordinates,a)},l=new Ll().read(u),h=co(ki(e,n),"meters"),c=ze.bufferOp(l,h,r);if(!eg((c=new cf().write(c)).coordinates))return Te({type:c.type,coordinates:rg(c.coordinates,a)},i)}function eg(t){return Array.isArray(t[0])?eg(t[0]):isNaN(t[0])}function ng(t,e){return typeof t[0]!="object"?e(t):t.map(function(n){return ng(n,e)})}function rg(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(n){return rg(n,e)})}function Wl(t,e,n){n===void 0&&(n={});var r=ae(t),i=ae(e),o=G0(r.coordinates,i.coordinates);return o.length===0?null:o.length===1?ct(o[0],n.properties):xr(o,n.properties)}function Zs(t,e,n){n===void 0&&(n={});var r=ae(t),i=ae(e),o=q0(r.coordinates,i.coordinates);return o.length===0?null:o.length===1?ct(o[0],n.properties):xr(o,n.properties)}/**
| * @license get-closest https://github.com/cosmosio/get-closest
| *
| * The MIT License (MIT)
| *
| * Copyright (c) 2014-2017 Olivier Scherrer <pode.fr@gmail.com>
| */function fy(t,e){return function(n,r,i){var o,s;if(!Array.isArray(r))throw new Error("Get closest expects an array as second argument");return r.forEach(function(a,u){var l=i(a,n);l>=0&&(s===void 0||l<s)&&(s=l,o=u)}),o}(t,e,function(n,r){return n-r})}function gy(t,e){return kr(Wt(vi(t)),Wt(vi(e))).features.length>0}function ig(t,e,n){n===void 0&&(n={});var r=JSON.stringify(n.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,h=2*e/$t([i,u],[s,u],n)*(s-i),c=2*e/$t([l,o],[l,a],n)*(a-o),p=h/2,d=2*p,g=Math.sqrt(3)/2*c,m=s-i,f=a-o,_=3/4*d,I=g,y=(m-d)/(d-p/2),v=Math.floor(y),x=(v*_-p/2-m)/2-p/2+_/2,b=Math.floor((f-g)/g),E=(f-b*g)/2,T=b*g-f>g/2;T&&(E-=g/4);for(var C=[],D=[],M=0;M<6;M++){var B=2*Math.PI/6*M;C.push(Math.cos(B)),D.push(Math.sin(B))}for(var O=[],R=0;R<=v;R++)for(var P=0;P<=b;P++){var F=R%2==1;if((P!==0||!F)&&(P!==0||!T)){var k=R*_+i-x,q=P*I+o+E;if(F&&(q-=g/2),n.triangles===!0)yy([k,q],h/2,c/2,JSON.parse(r),C,D).forEach(function(V){n.mask?Zs(n.mask,V)&&O.push(V):O.push(V)});else{var S=dy([k,q],h/2,c/2,JSON.parse(r),C,D);n.mask?Zs(n.mask,S)&&O.push(S):O.push(S)}}}return nt(O)}function dy(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+n*o[a];s.push([u,l])}return s.push(s[0].slice()),ct([s],r)}function yy(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+n*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),u.push(t),s.push(ct([u],r))}return s}function og(t){if(t.features.length<=1)return t;var e=function(i){var o=un(),s=[];return Ee(i,function(a,u){var l=ye(a);s.push({minX:l[0],minY:l[1],maxX:l[2],maxY:l[3],geojson:a,index:u})}),o.load(s),o}(t),n=[],r={};return Ee(t,function(i,o){if(r[o])return!0;for(e.remove({index:o},sg),r[o]=!0;;){var s=ye(i),a=e.search({minX:s[0],minY:s[1],maxX:s[2],maxY:s[3]});if(a.length>0)for(var u=a.map(function(c){return r[c.index]=!0,e.remove({index:c.index},sg),c.geojson}),l=0,h=u.length;l<h;l++)i=Wl(i,u[l]);if(a.length===0)break}n.push(i)}),nt(n)}function sg(t,e){return t.index===e.index}function ag(t,e,n){return n===void 0&&(n={}),function(r,i,o,s){s===void 0&&(s={});for(var a=[],u=r[0],l=r[1],h=r[2],c=r[3],p=i/$t([u,l],[h,l],s)*(h-u),d=o/$t([u,l],[u,c],s)*(c-l),g=h-u,m=c-l,f=Math.floor(g/p),_=Math.floor(m/d),I=(m-_*d)/2,y=u+(g-f*p)/2,v=0;v<f;v++){for(var x=l+I,b=0;b<_;b++){var E=ct([[[y,x],[y,x+d],[y+p,x+d],[y+p,x],[y,x]]],s.properties);s.mask?up(s.mask,E)&&a.push(E):a.push(E),x+=d}y+=p}return nt(a)}(t,e,e,n)}function ug(t,e,n){n===void 0&&(n={});for(var r=[],i=e/$t([t[0],t[1]],[t[2],t[1]],n)*(t[2]-t[0]),o=e/$t([t[0],t[1]],[t[0],t[3]],n)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var h=null,c=null;s%2==0&&u%2==0?(h=ct([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),c=ct([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)):s%2==0&&u%2==1?(h=ct([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties),c=ct([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties)):u%2==0&&s%2==1?(h=ct([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties),c=ct([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties)):u%2==1&&s%2==1&&(h=ct([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),c=ct([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)),n.mask?(Zs(n.mask,h)&&r.push(h),Zs(n.mask,c)&&r.push(c)):(r.push(h),r.push(c)),l+=o,u++}s++,a+=i}return nt(r)}tg.invert=function(t){return function(e,n){var r=Ys(e*e+n*n),i=t(r),o=Oe(i),s=Le(i);return[Wo(e*o,r*s),Jo(r&&n*o/r)]}}(function(t){return t}),N.along=function(t,e,n){n===void 0&&(n={});for(var r=ae(t).coordinates,i=0,o=0;o<r.length&&!(e>=i&&o===r.length-1);o++){if(i>=e){var s=e-i;if(s){var a=ni(r[o],r[o-1])-180;return Fr(r[o],s,a,n)}return ft(r[o])}i+=$t(r[o],r[o+1],n)}return ft(r[r.length-1])},N.angle=function(t,e,n,r){if(r===void 0&&(r={}),!Qt(r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!n)throw new Error("endPoint is required");var i=t,o=e,s=n,a=Gi(r.mercator!==!0?ni(i,o):Vi(i,o)),u=Gi(r.mercator!==!0?ni(s,o):Vi(s,o)),l=Math.abs(a-u);return r.explementary===!0?360-l:l},N.applyFilter=Ca,N.area=zu,N.areaFactors=$s,N.bbox=ye,N.bboxClip=function(t,e){var n=ae(t),r=n.type,i=t.type==="Feature"?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":var s=[];return r==="LineString"&&(o=[o]),o.forEach(function(a){(function(u,l,h){var c,p,d,g,m,f=u.length,_=vo(u[0],l),I=[];for(h||(h=[]),c=1;c<f;c++){for(g=u[c-1],p=d=vo(m=u[c],l);;){if(!(_|p)){I.push(g),p!==d?(I.push(m),c<f-1&&(h.push(I),I=[])):c===f-1&&I.push(m);break}if(_&p)break;_?_=vo(g=Wu(g,m,_,l),l):p=vo(m=Wu(g,m,p,l),l)}_=d}I.length&&h.push(I)})(a,e,s)}),s.length===1?Wt(s[0],i):yi(s,i);case"Polygon":return ct(Rh(o,e),i);case"MultiPolygon":return xr(o.map(function(a){return Rh(a,e)}),i);default:throw new Error("geometry "+r+" not supported")}},N.bboxPolygon=Ru,N.bearing=ni,N.bearingToAngle=Gi,N.bearingToAzimuth=Gi,N.bezier=Uc,N.bezierSpline=Uc,N.booleanClockwise=va,N.booleanContains=function(t,e){var n=ae(t),r=ae(e),i=n.type,o=r.type,s=n.coordinates,a=r.coordinates;switch(i){case"Point":switch(o){case"Point":return sl(s,a);default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"Point":return function(u,l){var h,c=!1;for(h=0;h<u.coordinates.length;h++)if(sl(u.coordinates[h],l.coordinates)){c=!0;break}return c}(n,r);case"MultiPoint":return function(u,l){for(var h=0,c=l.coordinates;h<c.length;h++){for(var p=c[h],d=!1,g=0,m=u.coordinates;g<m.length;g++)if(sl(p,m[g])){d=!0;break}if(!d)return!1}return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return Rn(r,n,{ignoreEndVertices:!0});case"LineString":return function(u,l){for(var h=!1,c=0,p=l.coordinates;c<p.length;c++){var d=p[c];if(Rn({type:"Point",coordinates:d},u,{ignoreEndVertices:!0})&&(h=!0),!Rn({type:"Point",coordinates:d},u,{ignoreEndVertices:!1}))return!1}return h}(n,r);case"MultiPoint":return function(u,l){for(var h=!1,c=0,p=l.coordinates;c<p.length;c++){var d=p[c];if(Rn(d,u,{ignoreEndVertices:!0})&&(h=!0),!Rn(d,u))return!1}return!!h}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return le(r,n,{ignoreBoundary:!0});case"LineString":return function(u,l){var h=!1,c=0,p=ye(u),d=ye(l);if(!$h(p,d))return!1;for(;c<l.coordinates.length-1;c++)if(le({type:"Point",coordinates:Wd(l.coordinates[c],l.coordinates[c+1])},u,{ignoreBoundary:!0})){h=!0;break}return h}(n,r);case"Polygon":return function(u,l){if(u.type==="Feature"&&u.geometry===null||l.type==="Feature"&&l.geometry===null)return!1;var h=ye(u),c=ye(l);if(!$h(h,c))return!1;for(var p=ae(l).coordinates,d=0,g=p;d<g.length;d++)for(var m=0,f=g[d];m<f.length;m++)if(!le(f[m],u))return!1;return!0}(n,r);case"MultiPoint":return function(u,l){for(var h=0,c=l.coordinates;h<c.length;h++)if(!le(c[h],u,{ignoreBoundary:!0}))return!1;return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},N.booleanCrosses=function(t,e){var n=ae(t),r=ae(e),i=n.type,o=r.type;switch(i){case"MultiPoint":switch(o){case"LineString":return tp(n,r);case"Polygon":return np(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return tp(r,n);case"LineString":return function(s,a){if(kr(s,a).features.length>0)for(var u=0;u<s.coordinates.length-1;u++)for(var l=0;l<a.coordinates.length-1;l++){var h=!0;if(l!==0&&l!==a.coordinates.length-2||(h=!1),rp(s.coordinates[u],s.coordinates[u+1],a.coordinates[l],h))return!0}return!1}(n,r);case"Polygon":return ep(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return np(r,n);case"LineString":return ep(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},N.booleanDisjoint=Zh,N.booleanEqual=function(t,e){return ae(t).type===ae(e).type&&new sp({precision:6}).compare(zi(t),zi(e))},N.booleanIntersects=up,N.booleanOverlap=ap,N.booleanParallel=function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if(pp(t,"line1")!=="LineString")throw new Error("line1 must be a LineString");if(pp(e,"line2")!=="LineString")throw new Error("line2 must be a LineString");for(var n=Ui(zi(t)).features,r=Ui(zi(e)).features,i=0;i<n.length;i++){var o=n[i].geometry.coordinates;if(!r[i])break;if(!s0(o,r[i].geometry.coordinates))return!1}return!0},N.booleanPointInPolygon=le,N.booleanPointOnLine=Rn,N.booleanWithin=fh,N.buffer=function(t,e,n){var r=(n=n||{}).units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if(typeof n!="object")throw new Error("options must be an object");if(typeof i!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return zn(t,function(s){var a=ru(s,e,r,i);a&&o.push(a)}),nt(o);case"FeatureCollection":return Zt(t,function(s){var a=ru(s,e,r,i);a&&Zt(a,function(u){u&&o.push(u)})}),nt(o)}return ru(t,e,r,i)},N.center=ha,N.centerMean=cl,N.centerMedian=function(t,e){if(e===void 0&&(e={}),!Qt(e=e||{}))throw new Error("options is invalid");var n=e.counter||10;if(!Ge(n))throw new Error("counter must be a number");var r=e.weight,i=cl(t,{weight:e.weight}),o=nt([]);Zt(t,function(a){var u;o.features.push(_i(a,{properties:{weight:(u=a.properties)===null||u===void 0?void 0:u[r]}}))});var s={tolerance:e.tolerance,medianCandidates:[]};return Ip(i.geometry.coordinates,[0,0],o,s,n)},N.centerOfMass=function t(e,n){switch(n===void 0&&(n={}),wn(e)){case"Point":return ft(re(e),n.properties);case"Polygon":var r=[];Ce(e,function(v){r.push(v)});var i,o,s,a,u,l,h,c,p=_i(e,{properties:n.properties}),d=p.geometry.coordinates,g=0,m=0,f=0,_=r.map(function(v){return[v[0]-d[0],v[1]-d[1]]});for(i=0;i<r.length-1;i++)a=(o=_[i])[0],l=o[1],u=(s=_[i+1])[0],f+=c=a*(h=s[1])-u*l,g+=(a+u)*c,m+=(l+h)*c;if(f===0)return p;var I=1/(6*(.5*f));return ft([d[0]+I*g,d[1]+I*m],n.properties);default:var y=Pc(e);return y?t(y,{properties:n.properties}):_i(e,{properties:n.properties})}},N.centroid=_i,N.circle=Tu,N.cleanCoords=zi,N.clone=Ye,N.clusterEach=hl,N.clusterReduce=qp,N.clusters=N0,N.clustersDbscan=function(t,e,n){n===void 0&&(n={}),n.mutate!==!0&&(t=Ye(t)),n.minPoints=n.minPoints||3;var r=new $d.DBSCAN,i=r.run(vi(t),qi(e,n.units),n.minPoints,$t),o=-1;return i.forEach(function(s){o++,s.forEach(function(a){var u=t.features[a];u.properties||(u.properties={}),u.properties.cluster=o,u.properties.dbscan="core"})}),r.noise.forEach(function(s){var a=t.features[s];a.properties||(a.properties={}),a.properties.cluster?a.properties.dbscan="edge":a.properties.dbscan="noise"}),t},N.clustersKmeans=function(t,e){e===void 0&&(e={});var n=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(n/2)),e.numberOfClusters>n&&(e.numberOfClusters=n),e.mutate!==!0&&(t=Ye(t));var r=vi(t),i=r.slice(0,e.numberOfClusters),o=o0(r,e.numberOfClusters,i),s={};return o.centroids.forEach(function(a,u){s[u]=a}),Zt(t,function(a,u){var l=o.idxs[u];a.properties.cluster=l,a.properties.centroid=s[l]}),t},N.collect=function(t,e,n,r){var i=un(6),o=e.features.map(function(s){var a;return{minX:s.geometry.coordinates[0],minY:s.geometry.coordinates[1],maxX:s.geometry.coordinates[0],maxY:s.geometry.coordinates[1],property:(a=s.properties)===null||a===void 0?void 0:a[n]}});return i.load(o),t.features.forEach(function(s){s.properties||(s.properties={});var a=ye(s),u=i.search({minX:a[0],minY:a[1],maxX:a[2],maxY:a[3]}),l=[];u.forEach(function(h){le([h.minX,h.minY],s)&&l.push(h.property)}),s.properties[r]=l}),t},N.collectionOf=ti,N.combine=function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Zt(t,function(n){var r,i,o,s;switch((s=n.geometry)===null||s===void 0?void 0:s.type){case"Point":e.MultiPoint.coordinates.push(n.geometry.coordinates),e.MultiPoint.properties.push(n.properties);break;case"MultiPoint":(r=e.MultiPoint.coordinates).push.apply(r,n.geometry.coordinates),e.MultiPoint.properties.push(n.properties);break;case"LineString":e.MultiLineString.coordinates.push(n.geometry.coordinates),e.MultiLineString.properties.push(n.properties);break;case"MultiLineString":(i=e.MultiLineString.coordinates).push.apply(i,n.geometry.coordinates),e.MultiLineString.properties.push(n.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(n.geometry.coordinates),e.MultiPolygon.properties.push(n.properties);break;case"MultiPolygon":(o=e.MultiPolygon.coordinates).push.apply(o,n.geometry.coordinates),e.MultiPolygon.properties.push(n.properties)}}),nt(Object.keys(e).filter(function(n){return e[n].coordinates.length}).sort().map(function(n){return Te({type:n,coordinates:e[n].coordinates},{collectedProperties:e[n].properties})}))},N.concave=function(t,e){e===void 0&&(e={});var n=e.maxEdge||1/0,r=Lc(function(o){var s=[],a={};return Zt(o,function(u){if(u.geometry){var l=u.geometry.coordinates.join("-");a.hasOwnProperty(l)||(s.push(u),a[l]=!0)}}),nt(s)}(t));if(r.features=r.features.filter(function(o){var s=o.geometry.coordinates[0][0],a=o.geometry.coordinates[0][1],u=o.geometry.coordinates[0][2],l=$t(s,a,e),h=$t(a,u,e),c=$t(s,u,e);return l<=n&&h<=n&&c<=n}),r.features.length<1)return null;var i=Wg(r);return i.coordinates.length===1&&(i.coordinates=i.coordinates[0],i.type="Polygon"),Te(i)},N.containsNumber=uu,N.convertArea=ec,N.convertDistance=qi,N.convertLength=qi,N.convex=Pc,N.coordAll=vi,N.coordEach=Ce,N.coordReduce=lu,N.createBins=pl,N.degrees2radians=ke,N.degreesToRadians=ke,N.destination=Fr,N.difference=function(t,e){var n=ae(t),r=ae(e),i=t.properties||{},o=B0(n.coordinates,r.coordinates);return o.length===0?null:o.length===1?ct(o[0],i):xr(o,i)},N.dissolve=function(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n=e.propertyName;ti(t,"Polygon","dissolve");var r=Ye(t),i=r.features,o=[];i.forEach(function(h,c){h.properties.origIndexPosition=c});var s=yo();for(var a in s.load(r),i){var u=i[a],l=!1;if(s.search(u).features.forEach(function(h){u=i[a];var c=h.properties.origIndexPosition;if(o.length>0&&c!==0)if(c>o[o.length-1])c-=o.length;else{var p=fy(c,o);p!==0&&(c-=p)}if(c!==+a){var d=i[c];d&&u&&(n!==void 0&&d.properties[n]!==u.properties[n]||ap(u,d)&&gy(u,d)&&(i[a]=Wl(u,d),o.push(h.properties.origIndexPosition),o.sort(function(g,m){return g-m}),s.remove(h),i.splice(c,1),u.properties.origIndexPosition=a,s.remove(u,function(g,m){return g.properties.origIndexPosition===m.properties.origIndexPosition}),l=!0))}}),l){if(!u)continue;u.properties.origIndexPosition=a,s.insert(u),a--}}return i.forEach(function(h){delete h.properties.origIndexPosition,delete h.bbox}),r},N.distance=$t,N.distanceToDegrees=ea,N.distanceToRadians=ki,N.distanceWeight=Cp,N.earthRadius=tr,N.ellipse=bp,N.envelope=Vc,N.explode=pa,N.factors=Qs,N.feature=Te,N.featureCollection=nt,N.featureEach=Zt,N.featureOf=ts,N.featureReduce=hu,N.filterProperties=Bp,N.findPoint=uc,N.findSegment=ac,N.flatten=function(t){if(!t)throw new Error("geojson is required");var e=[];return Ee(t,function(n){e.push(n)}),nt(e)},N.flattenEach=Ee,N.flattenReduce=sc,N.flip=function(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if(!t)throw new Error("geojson is required");return n!==!1&&n!==void 0||(t=Ye(t)),Ce(t,function(r){var i=r[0],o=r[1];r[0]=o,r[1]=i}),t},N.geojsonType=ic,N.geomEach=zn,N.geomReduce=pu,N.geometry=Zl,N.geometryCollection=au,N.getCluster=Gp,N.getCoord=re,N.getCoords=it,N.getGeom=ae,N.getType=wn,N.greatCircle=function(t,e,n){if(typeof(n=n||{})!="object")throw new Error("options is invalid");var r=n.properties,i=n.npoints,o=n.offset;return t=re(t),e=re(e),r=r||{},i=i||100,o=o||10,new Xu({x:t[0],y:t[1]},{x:e[0],y:e[1]},r).Arc(i,{offset:o}).json()},N.helpers=cg,N.hexGrid=ig,N.inside=le,N.interpolate=function(t,e,n){if(typeof(n=n||{})!="object")throw new Error("options is invalid");var r=n.gridType,i=n.property,o=n.weight;if(!t)throw new Error("points is required");if(ti(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(o!==void 0&&typeof o!="number")throw new Error("weight must be a number");i=i||"elevation",r=r||"square",o=o||1;var s,a=ye(t);switch(r){case"point":case"points":s=yh(a,e,n);break;case"square":case"squares":s=ag(a,e,n);break;case"hex":case"hexes":s=ig(a,e,n);break;case"triangle":case"triangles":s=ug(a,e,n);break;default:throw new Error("invalid gridType")}var u=[];return Zt(s,function(l){var h=0,c=0;Zt(t,function(d){var g,m=$t(r==="point"?l:_i(l),d,n);if(i!==void 0&&(g=d.properties[i]),g===void 0&&(g=d.geometry.coordinates[2]),g===void 0)throw new Error("zValue is missing");m===0&&(h=g);var f=1/Math.pow(m,o);c+=f,h+=f*g});var p=Ye(l);p.properties[i]=h/c,u.push(p)}),nt(u)},N.intersect=Zs,N.invariant=hg,N.isNumber=Ge,N.isObject=Qt,N.isobands=function(t,e,n){if(!Qt(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(ti(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!Qt(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=Dd(t,{zProperty:r,flip:!0}),a=function(u,l,h){for(var c=[],p=1;p<l.length;p++){var d=+l[p-1],g=+l[p],m=zd(Bd(Fd(u,d,g-d))),f={};f.groupedRings=m,f[h]=d+"-"+g,c.push(f)}return c}(s,e,r);return nt((a=function(u,l,h){var c=ye(h),p=c[2]-c[0],d=c[3]-c[1],g=c[0],m=c[1],f=l[0].length-1,_=l.length-1,I=p/f,y=d/_,v=function(x){x[0]=x[0]*I+g,x[1]=x[1]*y+m};return u.forEach(function(x){x.groupedRings.forEach(function(b){b.forEach(function(E){E.forEach(v)})})}),u}(a,s,t)).map(function(u,l){if(o[l]&&!Qt(o[l]))throw new Error("Each mappedProperty is required to be an Object");var h=yu({},i,o[l]);return h[r]=u[r],xr(u.groupedRings,h)}))},N.isolines=function(t,e,n){if(!Qt(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(ti(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!Qt(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=mg(t,{zProperty:r,flip:!0});return nt(function(a,u,l){var h=ye(l),c=h[2]-h[0],p=h[3]-h[1],d=h[0],g=h[1],m=u[0].length-1,f=u.length-1,_=c/m,I=p/f,y=function(v){v[0]=v[0]*_+d,v[1]=v[1]*I+g};return a.forEach(function(v){Ce(v,y)}),a}(function(a,u,l,h,c){for(var p=[],d=1;d<u.length;d++){var g=+u[d],m=yu({},h,c[d]);m[l]=g;var f=yi(yg(a,g),m);p.push(f)}return p}(s,e,r,i,o),s,t))},N.kinks=function(t){var e,n,r={type:"FeatureCollection",features:[]};if((n=t.type==="Feature"?t.geometry:t).type==="LineString")e=[n.coordinates];else if(n.type==="MultiLineString")e=n.coordinates;else if(n.type==="MultiPolygon")e=[].concat.apply([],n.coordinates);else{if(n.type!=="Polygon")throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=n.coordinates}return e.forEach(function(i){e.forEach(function(o){for(var s=0;s<i.length-1;s++)for(var a=s;a<o.length-1;a++)if(!(i===o&&(Math.abs(s-a)===1||s===0&&a===i.length-2&&i[s][0]===i[i.length-1][0]&&i[s][1]===i[i.length-1][1]))){var u=Pd(i[s][0],i[s][1],i[s+1][0],i[s+1][1],o[a][0],o[a][1],o[a+1][0],o[a+1][1]);u&&r.features.push(ft([u[0],u[1]]))}})}),r},N.length=Uu,N.lengthToDegrees=ea,N.lengthToRadians=ki,N.lineArc=Sh,N.lineChunk=function(t,e,n){if(!Qt(n=n||{}))throw new Error("options is invalid");var r=n.units,i=n.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Ee(t,function(s){i&&(s.geometry.coordinates=s.geometry.coordinates.reverse()),function(a,u,l,h){var c=Uu(a,{units:l});if(c<=u)return h(a);var p=c/u;Number.isInteger(p)||(p=Math.floor(p)+1);for(var d=0;d<p;d++)h(ph(a,u*d,u*(d+1),{units:l}),d)}(s,e,r,function(a){o.push(a)})}),nt(o)},N.lineDistance=Uu,N.lineEach=gu,N.lineIntersect=kr,N.lineOffset=function(t,e,n){if(!Qt(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("distance is required");var i=wn(t),o=t.properties;switch(i){case"LineString":return Yh(t,e,r);case"MultiLineString":var s=[];return Ee(t,function(a){s.push(Yh(a,e,r).geometry.coordinates)}),yi(s,o);default:throw new Error("geometry "+i+" is not supported")}},N.lineOverlap=Dh,N.lineReduce=du,N.lineSegment=Ui,N.lineSlice=function(t,e,n){var r=it(n);if(wn(n)!=="LineString")throw new Error("line must be a LineString");for(var i,o=ri(n,t),s=ri(n,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(r[u]);return a.push(i[1].geometry.coordinates),Wt(a,n.properties)},N.lineSliceAlong=ph,N.lineSplit=function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var n=wn(t),r=wn(e);if(n!=="LineString")throw new Error("line must be LineString");if(r==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(r==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var i=mh(e,{precision:7});switch(r){case"Point":return Yu(t,i);case"MultiPoint":return wh(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return wh(t,kr(t,i))}},N.lineString=Wt,N.lineStringToPolygon=Mh,N.lineStrings=$l,N.lineToPolygon=Mh,N.mask=function(t,e){var n,r,i=function(u){var l=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]];return ct(u&&u.geometry.coordinates||l)}(e),o=(n=[],r=[],Ee(t,function(u){var l=u.geometry.coordinates,h=l[0],c=l.slice(1);n.push(ct([h])),c.forEach(function(p){r.push(ct([p]))})}),[nt(n),nt(r)]),s=o[0],a=o[1];return function(u,l,h){var c=[];return c.push(u.geometry.coordinates[0]),Ee(l,function(p){c.push(p.geometry.coordinates[0])}),Ee(h,function(p){c.push(p.geometry.coordinates[0])}),ct(c)}(i,s=og(s),a=og(a))},N.meta=pg,N.midpoint=function(t,e){return Fr(t,$t(t,e)/2,ni(t,e))},N.moranIndex=function(t,e){var n=e.inputField,r=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=Cp(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:r}),a=[];Zt(t,function(b){var E=b.properties||{};a.push(E[n])});for(var u=Np(a),l=function(b){for(var E=Np(b),T=0,C=0,D=b;C<D.length;C++){var M=D[C];T+=Math.pow(M-E,2)}return T/b.length}(a),h=0,c=0,p=0,d=0,g=s.length,m=0;m<g;m++){for(var f=0,_=0;_<g;_++)h+=s[m][_]*(a[m]-u)*(a[_]-u),c+=s[m][_],p+=Math.pow(s[m][_]+s[_][m],2),f+=s[m][_]+s[_][m];d+=Math.pow(f,2)}var I=h/c/l,y=-1/(g-1),v=(g*g*(p*=.5)-g*d+c*c*3)/((g-1)*(g+1)*(c*c))-y*y,x=Math.sqrt(v);return{expectedMoranIndex:y,moranIndex:I,stdNorm:x,zNorm:(I-y)/x}},N.multiLineString=yi,N.multiPoint=ta,N.multiPolygon=xr,N.nearest=ga,N.nearestPoint=ga,N.nearestPointOnLine=ri,N.nearestPointToLine=function(t,e,n){n===void 0&&(n={});var r=n.units,i=n.properties||{},o=function(u){var l=[];switch(u.geometry?u.geometry.type:u.type){case"GeometryCollection":return zn(u,function(h){h.type==="Point"&&l.push({type:"Feature",properties:{},geometry:h})}),{type:"FeatureCollection",features:l};case"FeatureCollection":return u.features=u.features.filter(function(h){return h.geometry.type==="Point"}),u;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if(wn(e)!=="LineString")throw new Error("line must be a LineString");var s=1/0,a=null;return Zt(o,function(u){var l=oh(u,e,{units:r});l<s&&(s=l,a=u)}),a&&(a.properties=yu({dist:s},a.properties,i)),a},N.planepoint=function(t,e){var n=re(t),r=ae(e).coordinates[0];if(r.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=n[0],l=n[1],h=r[0][0],c=r[0][1],p=o!==void 0?o:r[0][2],d=r[1][0],g=r[1][1],m=s!==void 0?s:r[1][2],f=r[2][0],_=r[2][1],I=a!==void 0?a:r[2][2];return(I*(u-h)*(l-g)+p*(u-d)*(l-_)+m*(u-f)*(l-c)-m*(u-h)*(l-_)-I*(u-d)*(l-c)-p*(u-f)*(l-g))/((u-h)*(l-g)+(u-d)*(l-_)+(u-f)*(l-c)-(u-h)*(l-_)-(u-d)*(l-c)-(u-f)*(l-g))},N.point=ft,N.pointGrid=yh,N.pointOnFeature=ah,N.pointOnLine=ri,N.pointOnSurface=ah,N.pointToLineDistance=oh,N.points=Kl,N.pointsWithinPolygon=wu,N.polygon=ct,N.polygonSmooth=function(t,e){var n=[],r=e.iterations||1;if(!t)throw new Error("inputPolys is required");return zn(t,function(i,o,s){var a,u,l;switch(i.type){case"Polygon":a=[[]];for(var h=0;h<r;h++)l=[[]],u=i,h>0&&(u=ct(a).geometry),b0(u,l),a=l.slice(0);n.push(ct(a,s));break;case"MultiPolygon":a=[[[]]];for(var c=0;c<r;c++)l=[[[]]],u=i,c>0&&(u=xr(a).geometry),w0(u,l),a=l.slice(0);n.push(xr(a,s));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}}),nt(n)},N.polygonTangents=function(t,e){var n,r,i,o,s=it(t),a=it(e),u=ye(e),l=0,h=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(h=ga(t,pa(e))).properties.featureIndex),wn(e)){case"Polygon":n=a[0][l],r=a[0][0],h!==null&&h.geometry.coordinates[1]<s[1]&&(r=a[0][l]),o=ds(a[0][0],a[0][a[0].length-1],s);var c=qh(a[0],s,o,i,n,r);n=c[0],r=c[1];break;case"MultiPolygon":for(var p=0,d=0,g=0,m=0;m<a[0].length;m++){p=m;for(var f=!1,_=0;_<a[0][m].length;_++){if(d=_,g===l){f=!0;break}g++}if(f)break}n=a[0][p][d],r=a[0][p][d],o=ds(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach(function(I){var y=qh(I[0],s,o,i,n,r);n=y[0],r=y[1]})}return nt([ft(n),ft(r)])},N.polygonToLine=gs,N.polygonToLineString=gs,N.polygonize=function(t){var e=Yd.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=[];return e.getEdgeRings().filter(function(i){return i.isValid()}).forEach(function(i){i.isHole()?n.push(i):r.push(i)}),n.forEach(function(i){Jh.findEdgeRingContaining(i,r)&&r.push(i)}),nt(r.map(function(i){return i.toPolygon()}))},N.polygons=Ql,N.projection=S0,N.propEach=cu,N.propReduce=oc,N.propertiesContainsFilter=fl,N.radians2degrees=mi,N.radiansToDegrees=mi,N.radiansToDistance=co,N.radiansToLength=co,N.random=C0,N.randomLineString=Dp,N.randomPoint=Tp,N.randomPolygon=Ap,N.randomPosition=Es,N.rewind=function(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if(typeof n!="boolean")throw new Error("<reverse> must be a boolean");if(typeof r!="boolean")throw new Error("<mutate> must be a boolean");r===!1&&(t=Ye(t));var i=[];switch(t.type){case"GeometryCollection":return zn(t,function(o){_a(o,n)}),t;case"FeatureCollection":return Zt(t,function(o){Zt(_a(o,n),function(s){i.push(s)})}),nt(i)}return _a(t,n)},N.rhumbBearing=Vi,N.rhumbDestination=xo,N.rhumbDistance=ya,N.round=tc,N.sample=function(t,e){if(!t)throw new Error("featurecollection is required");if(e==null)throw new Error("num is required");if(typeof e!="number")throw new Error("num must be a number");return nt(function(n,r){for(var i,o,s=n.slice(0),a=n.length,u=a-r;a-- >u;)i=s[o=Math.floor((a+1)*Math.random())],s[o]=s[a],s[a]=i;return s.slice(u)}(t.features,e))},N.sector=function(t,e,n,r,i){if(!Qt(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(n==null)throw new Error("bearing1 is required");if(r==null)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if(typeof i!="object")throw new Error("options must be an object");if(kh(n)===kh(r))return Tu(t,e,i);var s=it(t),a=Sh(t,e,n,r,i),u=[[s]];return Ce(a,function(l){u[0].push(l)}),u[0].push(s),ct(u,o)},N.segmentEach=ei,N.segmentReduce=fu,N.shortestPath=function(t,e,n){if(!Qt(n=n||{}))throw new Error("options is invalid");var r=n.resolution,i=n.minDistance,o=n.obstacles||nt([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(r&&!Ge(r)||r<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=re(t),a=re(e);switch(t=ft(s),e=ft(a),wn(o)){case"FeatureCollection":if(o.features.length===0)return Wt([s,a]);break;case"Polygon":o=nt([Te(ae(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=ye(Vh(Ru(ye(u)),1.15));r||(r=$t([l[0],l[1]],[l[2],l[1]],n)/100),u.features.pop(),u.features.pop();for(var h=l[0],c=l[1],p=l[2],d=l[3],g=r/$t([h,c],[p,c],n)*(p-h),m=r/$t([h,c],[h,d],n)*(d-c),f=p-h,_=d-c,I=Math.floor(f/g),y=Math.floor(_/m),v=(f-I*g)/2,x=[],b=[],E=[],T=[],C=1/0,D=1/0,M=d-(_-y*m)/2,B=0;M>=c;){for(var O=[],R=[],P=h+v,F=0;P<=p;){var k=ft([P,M]),q=a0(k,o);O.push(q?0:1),R.push(P+"|"+M);var S=$t(k,t);!q&&S<C&&(C=S,E={x:F,y:B});var V=$t(k,e);!q&&V<D&&(D=V,T={x:F,y:B}),P+=g,F++}b.push(O),x.push(R),M-=m,B++}var j=new Eo(b,{diagonal:!0}),tt=j.grid[E.y][E.x],at=j.grid[T.y][T.x],Jt=Ea.search(j,tt,at),se=[s];return Jt.forEach(function(gt){var yt=x[gt.x][gt.y].split("|");se.push([+yt[0],+yt[1]])}),se.push(a),zi(Wt(se))},N.simplify=function(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n=e.tolerance!==void 0?e.tolerance:1,r=e.highQuality||!1,i=e.mutate||!1;if(!t)throw new Error("geojson is required");if(n&&n<0)throw new Error("invalid tolerance");return i!==!0&&(t=Ye(t)),zn(t,function(o){(function(s,a,u){var l=s.type;if(l==="Point"||l==="MultiPoint")return s;zi(s,!0);var h=s.coordinates;switch(l){case"LineString":s.coordinates=zc(h,a,u);break;case"MultiLineString":s.coordinates=h.map(function(c){return zc(c,a,u)});break;case"Polygon":s.coordinates=jc(h,a,u);break;case"MultiPolygon":s.coordinates=h.map(function(c){return jc(c,a,u)})}})(o,n,r)}),t},N.square=Xc,N.squareGrid=ag,N.standardDeviationalEllipse=function(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n=e.steps||64,r=e.weight,i=e.properties||{};if(!Ge(n))throw new Error("steps must be a number");if(!Qt(i))throw new Error("properties must be a number");var o=vi(t).length,s=cl(t,{weight:r}),a=0,u=0,l=0;Zt(t,function(E){var T=E.properties[r]||1,C=Sp(it(E),it(s));a+=Math.pow(C.x,2)*T,u+=Math.pow(C.y,2)*T,l+=C.x*C.y*T});var h=a-u,c=Math.sqrt(Math.pow(h,2)+4*Math.pow(l,2)),p=2*l,d=Math.atan((h+c)/p),g=180*d/Math.PI,m=0,f=0,_=0;Zt(t,function(E){var T=E.properties[r]||1,C=Sp(it(E),it(s));m+=Math.pow(C.x*Math.cos(d)-C.y*Math.sin(d),2)*T,f+=Math.pow(C.x*Math.sin(d)+C.y*Math.cos(d),2)*T,_+=T});var I=Math.sqrt(2*m/_),y=Math.sqrt(2*f/_),v=bp(s,I,y,{units:"degrees",angle:g,steps:n,properties:i}),x=wu(t,nt([v])),b={meanCenterCoordinates:it(s),semiMajorAxis:I,semiMinorAxis:y,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*vi(x).length/o};return v.properties.standardDeviationalEllipse=b,v},N.tag=function(t,e,n,r){return t=Ye(t),e=Ye(e),Zt(t,function(i){i.properties||(i.properties={}),Zt(e,function(o){i.properties[r]===void 0&&le(i,o)&&(i.properties[r]=o.properties[n])})}),t},N.tesselate=function(t){if(!t.geometry||t.geometry.type!=="Polygon"&&t.geometry.type!=="MultiPolygon")throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return t.geometry.type==="Polygon"?e.features=Kc(t.geometry.coordinates):t.geometry.coordinates.forEach(function(n){e.features=e.features.concat(Kc(n))}),e},N.tin=Lc,N.toMercator=Pp,N.toWgs84=Mp,N.transformRotate=Uh,N.transformScale=Vh,N.transformTranslate=function(t,e,n,r){if(!Qt(r=r||{}))throw new Error("options is invalid");var i=r.units,o=r.zTranslation,s=r.mutate;if(!t)throw new Error("geojson is required");if(e==null||isNaN(e))throw new Error("distance is required");if(o&&typeof o!="number"&&isNaN(o))throw new Error("zTranslation is not a number");if(o=o!==void 0?o:0,e===0&&o===0)return t;if(n==null||isNaN(n))throw new Error("direction is required");return e<0&&(e=-e,n+=180),s!==!1&&s!==void 0||(t=Ye(t)),Ce(t,function(a){var u=it(xo(a,e,n,{units:i}));a[0]=u[0],a[1]=u[1],o&&a.length===3&&(a[2]+=o)}),t},N.triangleGrid=ug,N.truncate=mh,N.union=Wl,N.unitsFactors=Jl,N.unkinkPolygon=function(t){var e=[];return Ee(t,function(n){n.geometry.type==="Polygon"&&Zt(function(r){if(r.type!="Feature")throw new Error("The input must a geojson object of type Feature");if(r.geometry===void 0||r.geometry==null)throw new Error("The input must a geojson object with a non-empty geometry");if(r.geometry.type!="Polygon")throw new Error("The input must be a geojson Polygon");for(var i=r.geometry.coordinates.length,o=[],s=0;s<i;s++){var a=r.geometry.coordinates[s];ps(a[0],a[a.length-1])||a.push(a[0]),o.push.apply(o,a.slice(0,a.length-1))}if(!function(gt){for(var yt={},yn=1,Re=0,lo=gt.length;Re<lo;++Re){if(yt.hasOwnProperty(gt[Re])){yn=0;break}yt[gt[Re]]=1}return yn}(o))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var u=o.length,l=Od(r,function(gt,yt,yn,Re,lo,Ks,Qo,iu,$o,ou,su,my){return[gt,yt,yn,Re,lo,Ks,Qo,iu,$o,ou,su,my]}),h=l.length;if(h==0){var c=[];for(s=0;s<i;s++)c.push(ct([r.geometry.coordinates[s]],{parent:-1,winding:Rd(r.geometry.coordinates[s])}));var p=nt(c);return at(),Jt(),p}var d=[],g=[];for(s=0;s<i;s++){d.push([]);for(var m=0;m<r.geometry.coordinates[s].length-1;m++)d[s].push([new vh(r.geometry.coordinates[s][mo(m+1,r.geometry.coordinates[s].length-1)],1,[s,m],[s,mo(m+1,r.geometry.coordinates[s].length-1)],void 0)]),g.push(new _h(r.geometry.coordinates[s][m],[s,mo(m-1,r.geometry.coordinates[s].length-1)],[s,m],void 0,void 0,!1,!0))}for(s=0;s<h;s++)d[l[s][1]][l[s][2]].push(new vh(l[s][0],l[s][5],[l[s][1],l[s][2]],[l[s][6],l[s][7]],void 0)),l[s][11]&&g.push(new _h(l[s][0],[l[s][1],l[s][2]],[l[s][6],l[s][7]],void 0,void 0,!0,!0));var f=g.length;for(s=0;s<d.length;s++)for(m=0;m<d[s].length;m++)d[s][m].sort(function(gt,yt){return gt.param<yt.param?-1:1});var _=[];for(s=0;s<f;s++)_.push({minX:g[s].coord[0],minY:g[s].coord[1],maxX:g[s].coord[0],maxY:g[s].coord[1],index:s});var I=un();for(I.load(_),s=0;s<d.length;s++)for(m=0;m<d[s].length;m++)for(var y=0;y<d[s][m].length;y++){x=y==d[s][m].length-1?d[s][mo(m+1,r.geometry.coordinates[s].length-1)][0].coord:d[s][m][y+1].coord;var v=I.search({minX:x[0],minY:x[1],maxX:x[0],maxY:x[1]})[0];d[s][m][y].nxtIsectAlongEdgeIn=v.index}for(s=0;s<d.length;s++)for(m=0;m<d[s].length;m++)for(y=0;y<d[s][m].length;y++){var x=d[s][m][y].coord,b=(v=I.search({minX:x[0],minY:x[1],maxX:x[0],maxY:x[1]})[0]).index;b<u?g[b].nxtIsectAlongRingAndEdge2=d[s][m][y].nxtIsectAlongEdgeIn:ps(g[b].ringAndEdge1,d[s][m][y].ringAndEdgeIn)?g[b].nxtIsectAlongRingAndEdge1=d[s][m][y].nxtIsectAlongEdgeIn:g[b].nxtIsectAlongRingAndEdge2=d[s][m][y].nxtIsectAlongEdgeIn}var E=[];for(s=0,m=0;m<i;m++){var T=s;for(y=0;y<r.geometry.coordinates[m].length-1;y++)g[s].coord[0]<g[T].coord[0]&&(T=s),s++;var C=g[T].nxtIsectAlongRingAndEdge2;for(y=0;y<g.length;y++)if(g[y].nxtIsectAlongRingAndEdge1==T||g[y].nxtIsectAlongRingAndEdge2==T){var D=y;break}var M=ma([g[D].coord,g[T].coord,g[C].coord],!0)?1:-1;E.push({isect:T,parent:-1,winding:M})}for(E.sort(function(gt,yt){return g[gt.isect].coord>g[yt.isect].coord?-1:1}),c=[];E.length>0;){var B=E.pop(),O=B.isect,R=B.parent,P=B.winding,F=c.length,k=[g[O].coord],q=O;if(g[O].ringAndEdge1Walkable)var S=g[O].ringAndEdge1,V=g[O].nxtIsectAlongRingAndEdge1;else S=g[O].ringAndEdge2,V=g[O].nxtIsectAlongRingAndEdge2;for(;!ps(g[O].coord,g[V].coord);){k.push(g[V].coord);var j=void 0;for(s=0;s<E.length;s++)if(E[s].isect==V){j=s;break}if(j!=null&&E.splice(j,1),ps(S,g[V].ringAndEdge1)){if(S=g[V].ringAndEdge2,g[V].ringAndEdge2Walkable=!1,g[V].ringAndEdge1Walkable){var tt={isect:V};ma([g[q].coord,g[V].coord,g[g[V].nxtIsectAlongRingAndEdge2].coord],P==1)?(tt.parent=R,tt.winding=-P):(tt.parent=F,tt.winding=P),E.push(tt)}q=V,V=g[V].nxtIsectAlongRingAndEdge2}else S=g[V].ringAndEdge1,g[V].ringAndEdge1Walkable=!1,g[V].ringAndEdge2Walkable&&(tt={isect:V},ma([g[q].coord,g[V].coord,g[g[V].nxtIsectAlongRingAndEdge1].coord],P==1)?(tt.parent=R,tt.winding=-P):(tt.parent=F,tt.winding=P),E.push(tt)),q=V,V=g[V].nxtIsectAlongRingAndEdge1}k.push(g[V].coord),c.push(ct([k],{index:F,parent:R,winding:P,netWinding:void 0}))}function at(){for(var gt=[],yt=0;yt<p.features.length;yt++)p.features[yt].properties.parent==-1&>.push(yt);if(gt.length>1)for(yt=0;yt<gt.length;yt++){for(var yn=-1,Re=0;Re<p.features.length;Re++)gt[yt]!=Re&&le(p.features[gt[yt]].geometry.coordinates[0][0],p.features[Re],{ignoreBoundary:!0})&&zu(p.features[Re])<1/0&&(yn=Re);p.features[gt[yt]].properties.parent=yn}}function Jt(){for(var gt=0;gt<p.features.length;gt++)if(p.features[gt].properties.parent==-1){var yt=p.features[gt].properties.winding;p.features[gt].properties.netWinding=yt,se(gt,yt)}}function se(gt,yt){for(var yn=0;yn<p.features.length;yn++)if(p.features[yn].properties.parent==gt){var Re=yt+p.features[yn].properties.winding;p.features[yn].properties.netWinding=Re,se(yn,Re)}}return p=nt(c),at(),Jt(),p}(n),function(r){e.push(ct(r.geometry.coordinates,n.properties))})}),nt(e)},N.validateBBox=nc,N.validateId=rc,N.voronoi=function(t,e){if(!Qt(e=e||{}))throw new Error("options is invalid");var n=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(n))throw new Error("bbox is invalid");return ti(t,"Point","points"),nt(function(){var r=u0,i=l0,o=null;function s(a){return new ll(a.map(function(u,l){var h=[Math.round(r(u,l,a)/ce)*ce,Math.round(i(u,l,a)/ce)*ce];return h.index=l,h.data=u,h}),o)}return s.polygons=function(a){return s(a).polygons()},s.links=function(a){return s(a).links()},s.triangles=function(a){return s(a).triangles()},s.x=function(a){return arguments.length?(r=typeof a=="function"?a:dp(+a),s):r},s.y=function(a){return arguments.length?(i=typeof a=="function"?a:dp(+a),s):i},s.extent=function(a){return arguments.length?(o=a==null?null:[[+a[0][0],+a[0][1]],[+a[1][0],+a[1][1]]],s):o&&[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},s.size=function(a){return arguments.length?(o=a==null?null:[[0,0],[+a[0],+a[1]]],s):o&&[o[1][0]-o[0][0],o[1][1]-o[0][1]]},s}().x(function(r){return r.geometry.coordinates[0]}).y(function(r){return r.geometry.coordinates[1]}).extent([[n[0],n[1]],[n[2],n[3]]]).polygons(t.features).map(E0))},N.within=wu,Object.defineProperty(N,"__esModule",{value:!0})});var vy=lg.turf;})();
|
|