Skip to content

Instantly share code, notes, and snippets.

@rveciana
Last active September 13, 2019 10:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rveciana/cb60b88d5b42ab50a5073e09f78a960d to your computer and use it in GitHub Desktop.
Save rveciana/cb60b88d5b42ab50a5073e09f78a960d to your computer and use it in GitHub Desktop.
Coastal Vignette with D3js
licence: mit

This example shows how to genrate a Coastal Vignette from a simple topojson using the jsts library and D3js.

I took the idea from this tweet by John Nelson. The mapping style is taken from this other tutorial by William Knowles.

By playing with the number of lines and their color, distance, thickness, opacity and dashing, the possibilities to style the map are really nice.

Using the jsts library was the easiest way I found, altough the integration with d3js is not easy. Maybe using WKT instead of GeoJSON as an input would be nicer. Also, if your geometries cross the -180 meridian, the buffer lines go crazy. This should be fixed too.

<!DOCTYPE html>
<meta charset="utf-8">
<style>
.buffer {
fill: none;
}
</style>
<body>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script type="text/javascript" src="jsts.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script>
var width = 960,
height = 500;
var projection = d3.geoMercator()
.rotate([-17, -39.7])
.scale(1500);
var path = d3.geoPath()
.projection(projection);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height)
.style("background-color","#d6ecfa");
d3.json("land.topo.json", function(error, coast) {
var data = topojson.merge(coast, coast.objects.land.geometries);
var reader = new jsts.io.GeoJSONReader();
var input = reader.read(data);
var bufferList = [];
[0.1, 0.2, 0.4, 0.6, 0.8, 1.3].forEach(function(dist){
bufferList.push(input.buffer(dist))
});
svg.append("path")
.attr("class", "map")
.datum(data)
.attr("d", path)
.style("fill", "#c0c7bf")
.style("stroke", "#d6ded5")
.style("stroke-width", "1.6");
bufferList.forEach(function(buffer, i){
svg.selectAll(".buffer .buffer"+i)
.data(getBufferCoords(buffer))
.enter()
.append("path")
.attr("d", d3.line())
.attr("class", "buffer buffer"+i)
.style("stroke","#9cd1f2")
.style("stroke-width", (1.4 - 0.14*i)+"px")
.style("stroke-dasharray","15 "+i+" 20 "+i)
.style("stroke-opacity", 1-(i/6));
});
});
function getBufferCoords(buffer){
var bufferPolygons = [];
var geometries;
if ('geometries' in buffer){
buffer.geometries.forEach(function(geom){
bufferPolygons = bufferPolygons.concat(getGeomPolygons(geom));
});
} else {
bufferPolygons = bufferPolygons.concat(getGeomPolygons(buffer));
}
return bufferPolygons;
}
function getGeomPolygons(geom){
var geomBufferPolygons = [];
var bufferedPoly = geom.shell.points.coordinates.map(function(pr) {
return projection([pr.x, pr.y]);
});
geomBufferPolygons.push(bufferedPoly);
geom.holes.forEach(function(hole){
bufferedPoly = hole.points.coordinates.map(function(pr) {
return projection([pr.x, pr.y]);
});
geomBufferPolygons.push(bufferedPoly);
});
return geomBufferPolygons;
}
</script>
/**
* JSTS. See https://github.com/bjornharrtell/jsts
* https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EDLv1.txt
* https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EPLv1.txt
* https://github.com/bjornharrtell/jsts/blob/master/LICENSE_LICENSE_ES6_COLLECTIONS.txt
* @license
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.jsts=t.jsts||{})}(this,function(t){"use strict";function e(){}function n(){}function i(){}function r(){}function s(){}function o(){}function a(){}function u(t){this.name="RuntimeException",this.message=t,this.stack=(new Error).stack,Error.call(this,t)}function l(){if(0===arguments.length)u.call(this);else if(1===arguments.length){var t=arguments[0];u.call(this,t)}}function h(){}function c(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)c.call(this,0,0);else if(1===arguments.length){var t=arguments[0];c.call(this,t.x,t.y,t.z)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];c.call(this,e,n,c.NULL_ORDINATE)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];this.x=i,this.y=r,this.z=s}}function f(){if(this.dimensionsToTest=2,0===arguments.length)f.call(this,2);else if(1===arguments.length){var t=arguments[0];if(2!==t&&3!==t)throw new n("only 2 or 3 dimensions may be specified");this.dimensionsToTest=t}}function g(){}function d(){}function p(t){this.message=t||""}function m(){}function v(t){this.message=t||""}function y(t){this.message=t||""}function x(){this.array_=[],arguments[0]instanceof d&&this.addAll(arguments[0])}function E(){if(x.apply(this),0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.ensureCapacity(t.length),this.add(t,!0)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.ensureCapacity(e.length),this.add(e,n)}}function I(){if(this.minx=null,this.maxx=null,this.miny=null,this.maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof c){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof I){var e=arguments[0];this.init(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];this.init(r,s,o,a)}}function N(){}function C(){N.call(this,"Projective point not representable on the Cartesian plane.")}function S(){}function L(){}function w(t){this.str=t}function R(t){this.value=t}function T(){}function O(){if(this.hi=0,this.lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof O){var e=arguments[0];this.init(e)}else if("string"==typeof arguments[0]){var n=arguments[0];O.call(this,O.parse(n))}}else if(2===arguments.length){var i=arguments[0],r=arguments[1];this.init(i,r)}}function P(){}function b(){}function _(){}function M(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var e=arguments[0],n=arguments[1];this.x=e,this.y=n,this.w=1}else if(arguments[0]instanceof M&&arguments[1]instanceof M){var i=arguments[0],r=arguments[1];this.x=i.y*r.w-r.y*i.w,this.y=r.x*i.w-i.x*r.w,this.w=i.x*r.y-r.x*i.y}else if(arguments[0]instanceof c&&arguments[1]instanceof c){var s=arguments[0],o=arguments[1];this.x=s.y-o.y,this.y=o.x-s.x,this.w=s.x*o.y-o.x*s.y}}else if(3===arguments.length){var a=arguments[0],u=arguments[1],l=arguments[2];this.x=a,this.y=u,this.w=l}else if(4===arguments.length){var h=arguments[0],f=arguments[1],g=arguments[2],d=arguments[3],p=h.y-f.y,m=f.x-h.x,v=h.x*f.y-f.x*h.y,y=g.y-d.y,x=d.x-g.x,E=g.x*d.y-d.x*g.y;this.x=m*E-x*v,this.y=y*v-p*E,this.w=p*x-y*m}}function D(){}function A(){}function F(){this.envelope=null,this.factory=null,this.SRID=null,this.userData=null;var t=arguments[0];this.factory=t,this.SRID=t.getSRID()}function G(){}function q(){}function B(){}function V(){}function z(){}function k(){}function Y(){}function U(){}function X(){}function H(){}function W(){}function j(){}function K(){this.array_=[],arguments[0]instanceof d&&this.addAll(arguments[0])}function Z(t){return null==t?uo:t.color}function Q(t){return null==t?null:t.parent}function J(t,e){null!==t&&(t.color=e)}function $(t){return null==t?null:t.left}function tt(t){return null==t?null:t.right}function et(){this.root_=null,this.size_=0}function nt(){}function it(){}function rt(){this.array_=[],arguments[0]instanceof d&&this.addAll(arguments[0])}function st(){}function ot(){}function at(){}function ut(){}function lt(){this.geometries=null;var t=arguments[0],e=arguments[1];if(F.call(this,e),null===t&&(t=[]),F.hasNullElements(t))throw new n("geometries must not contain null elements");this.geometries=t}function ht(){var t=arguments[0],e=arguments[1];lt.call(this,t,e)}function ct(){if(this.geom=null,this.geomFact=null,this.bnRule=null,this.endpointMap=null,1===arguments.length){var t=arguments[0];ct.call(this,t,q.MOD2_BOUNDARY_RULE)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.geom=e,this.geomFact=e.getFactory(),this.bnRule=n}}function ft(){this.count=null}function gt(){}function dt(){}function pt(){}function mt(){}function vt(){}function yt(){}function xt(){}function Et(){}function It(){this.points=null;var t=arguments[0],e=arguments[1];F.call(this,e),this.init(t)}function Nt(){}function Ct(){this.coordinates=null;var t=arguments[0],e=arguments[1];F.call(this,e),this.init(t)}function St(){}function Lt(){this.shell=null,this.holes=null;var t=arguments[0],e=arguments[1],i=arguments[2];if(F.call(this,i),null===t&&(t=this.getFactory().createLinearRing()),null===e&&(e=[]),F.hasNullElements(e))throw new n("holes must not contain null elements");if(t.isEmpty()&&F.hasNonEmptyElements(e))throw new n("shell is empty but holes are not");this.shell=t,this.holes=e}function wt(){var t=arguments[0],e=arguments[1];lt.call(this,t,e)}function Rt(){if(arguments[0]instanceof c&&arguments[1]instanceof $t){var t=arguments[0],e=arguments[1];Rt.call(this,e.getCoordinateSequenceFactory().create(t),e)}else if(oo(arguments[0],b)&&arguments[1]instanceof $t){var n=arguments[0],i=arguments[1];It.call(this,n,i),this.validateConstruction()}}function Tt(){var t=arguments[0],e=arguments[1];lt.call(this,t,e)}function Ot(){if(this.factory=null,this.isUserDataCopied=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.factory=t}}function Pt(){}function bt(){}function _t(){}function Mt(){}function Dt(){if(this.dimension=3,this.coordinates=null,1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];Dt.call(this,t,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++)this.coordinates[n]=new c}else if(oo(arguments[0],b)){var i=arguments[0];if(null===i)return this.coordinates=new Array(0).fill(null),null;this.dimension=i.getDimension(),this.coordinates=new Array(i.size()).fill(null);for(var n=0;n<this.coordinates.length;n++)this.coordinates[n]=i.getCoordinateCopy(n)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var r=arguments[0],s=arguments[1];this.coordinates=r,this.dimension=s,null===r&&(this.coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var o=arguments[0],a=arguments[1];this.coordinates=new Array(o).fill(null),this.dimension=a;for(var n=0;n<o;n++)this.coordinates[n]=new c}}function At(){}function Ft(t,e){return t===e||t!==t&&e!==e}function Gt(t){this.add?t.forEach(this.add,this):t.forEach(function(t){this.set(t[0],t[1])},this)}function qt(t){return this.has(t)&&(this._keys.splice(ho,1),this._values.splice(ho,1),this._itp.forEach(function(t){ho<t[0]&&t[0]--})),ho>-1}function Bt(t){return this.has(t)?this._values[ho]:void 0}function Vt(t,e){if(this.objectOnly&&e!==Object(e))throw new TypeError("Invalid value used as weak collection key");if(e!==e||0===e)for(ho=t.length;ho--&&!Ft(t[ho],e););else ho=t.indexOf(e);return ho>-1}function zt(t){return Vt.call(this,this._keys,t)}function kt(t,e){return this.has(t)?this._values[ho]=e:this._values[this._keys.push(t)-1]=e,this}function Yt(){(this._keys||0).length=this._values.length=0}function Ut(){return Wt(this._itp,this._keys)}function Xt(){return Wt(this._itp,this._values)}function Ht(){return Wt(this._itp,this._keys,this._values)}function Wt(t,e,n){var i=[0],r=!1;return t.push(i),{next:function(){var s,o=i[0];return!r&&o<e.length?(s=n?[e[o],n[o]]:e[o],i[0]++):(r=!0,t.splice(t.indexOf(i),1)),{done:r,value:s}}}}function jt(){return this._values.length}function Kt(t,e){for(var n=this.entries();;){var i=n.next();if(i.done)break;t.call(e,i.value[1],i.value[0],this)}}function Zt(){this.map_=new go}function Qt(){if(this.modelType=null,this.scale=null,0===arguments.length)this.modelType=Qt.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof Jt){var t=arguments[0];this.modelType=t,t===Qt.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var e=arguments[0];this.modelType=Qt.FIXED,this.setScale(e)}else if(arguments[0]instanceof Qt){var n=arguments[0];this.modelType=n.modelType,this.scale=n.scale}}function Jt(){this.name=null;var t=arguments[0];this.name=t,Jt.nameToTypeMap.put(t,this)}function $t(){if(this.precisionModel=null,this.coordinateSequenceFactory=null,this.SRID=null,0===arguments.length)$t.call(this,new Qt,0);else if(1===arguments.length){if(oo(arguments[0],D)){var t=arguments[0];$t.call(this,new Qt,0,t)}else if(arguments[0]instanceof Qt){var e=arguments[0];$t.call(this,e,0,$t.getDefaultCoordinateSequenceFactory())}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];$t.call(this,n,i,$t.getDefaultCoordinateSequenceFactory())}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this.precisionModel=r,this.coordinateSequenceFactory=o,this.SRID=s}}function te(t){this.geometryFactory=t||new $t}function ee(t){this.parser=new te(t)}function ne(){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 c,this.intPt[1]=new c,this.pa=this.intPt[0],this.pb=this.intPt[1],this.result=0}function ie(){ne.apply(this)}function re(){}function se(){this.p=null,this.crossingCount=0,this.isPointOnSegment=!1;var t=arguments[0];this.p=t}function oe(){}function ae(){if(this.p0=null,this.p1=null,0===arguments.length)ae.call(this,new c,new c);else if(1===arguments.length){var t=arguments[0];ae.call(this,t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p0=e,this.p1=n}else if(4===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];ae.call(this,new c(i,r),new c(s,o))}}function ue(){if(this.matrix=null,0===arguments.length)this.matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(ot.FALSE);else if(1===arguments.length)if("string"==typeof arguments[0]){var t=arguments[0];ue.call(this),this.set(t)}else if(arguments[0]instanceof ue){var e=arguments[0];ue.call(this),this.matrix[S.INTERIOR][S.INTERIOR]=e.matrix[S.INTERIOR][S.INTERIOR],this.matrix[S.INTERIOR][S.BOUNDARY]=e.matrix[S.INTERIOR][S.BOUNDARY],this.matrix[S.INTERIOR][S.EXTERIOR]=e.matrix[S.INTERIOR][S.EXTERIOR],this.matrix[S.BOUNDARY][S.INTERIOR]=e.matrix[S.BOUNDARY][S.INTERIOR],this.matrix[S.BOUNDARY][S.BOUNDARY]=e.matrix[S.BOUNDARY][S.BOUNDARY],this.matrix[S.BOUNDARY][S.EXTERIOR]=e.matrix[S.BOUNDARY][S.EXTERIOR],this.matrix[S.EXTERIOR][S.INTERIOR]=e.matrix[S.EXTERIOR][S.INTERIOR],this.matrix[S.EXTERIOR][S.BOUNDARY]=e.matrix[S.EXTERIOR][S.BOUNDARY],this.matrix[S.EXTERIOR][S.EXTERIOR]=e.matrix[S.EXTERIOR][S.EXTERIOR]}}function le(){this.areaBasePt=null,this.triangleCent3=new c,this.areasum2=0,this.cg3=new c,this.lineCentSum=new c,this.totalLength=0,this.ptCount=0,this.ptCentSum=new c;var t=arguments[0];this.areaBasePt=null,this.add(t)}function he(t){this.message=t||""}function ce(){this.array_=[]}function fe(){this.treeSet=new rt,this.list=new x}function ge(){if(this.geomFactory=null,this.inputPts=null,1===arguments.length){var t=arguments[0];ge.call(this,ge.extractCoordinates(t),t.getFactory())}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.inputPts=fe.filterCoordinates(e),this.geomFactory=n}}function de(){this.origin=null;var t=arguments[0];this.origin=t}function pe(){this.inputGeom=null,this.factory=null,this.pruneEmptyGeometry=!0,this.preserveGeometryCollectionType=!0,this.preserveCollections=!1,this.preserveType=!1}function me(){if(this.snapTolerance=0,this.srcPts=null,this.seg=new ae,this.allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof It&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];me.call(this,t.getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var n=arguments[0],i=arguments[1];this.srcPts=n,this._isClosed=me.isClosed(n),this.snapTolerance=i}}function ve(){this.srcGeom=null;var t=arguments[0];this.srcGeom=t}function ye(){if(pe.apply(this),this.snapTolerance=null,this.snapPts=null,this.isSelfSnap=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this.snapTolerance=t,this.snapPts=e}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.snapTolerance=n,this.snapPts=i,this.isSelfSnap=r}}function xe(){this.isFirst=!0,this.commonMantissaBitsCount=53,this.commonBits=0,this.commonSignExp=null}function Ee(){this.commonCoord=null,this.ccFilter=new Ie}function Ie(){this.commonBitsX=new xe,this.commonBitsY=new xe}function Ne(){this.trans=null;var t=arguments[0];this.trans=t}function Ce(){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()}function Se(){if(this.boundaryRule=q.OGC_SFS_BOUNDARY_RULE,this.isIn=null,this.numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new n("Rule must be non-null");this.boundaryRule=t}}function Le(){}function we(){}function Re(){this.pts=null,this.data=null;var t=arguments[0],e=arguments[1];this.pts=t,this.data=e}function Te(){}function Oe(){this.bounds=null,this.item=null;var t=arguments[0],e=arguments[1];this.bounds=t,this.item=e}function Pe(){this._size=null,this.items=null,this._size=0,this.items=new x,this.items.add(null)}function be(){}function _e(){}function Me(){if(this.childBoundables=new x,this.bounds=null,this.level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.level=t}}function De(){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()}function Ae(){if(this.root=null,this.built=!1,this.itemBoundables=new x,this.nodeCapacity=null,0===arguments.length)Ae.call(this,Ae.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){var t=arguments[0];h.isTrue(t>1,"Node capacity must be greater than 1"),this.nodeCapacity=t}}function Fe(){}function Ge(){}function qe(){if(0===arguments.length)qe.call(this,qe.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){var t=arguments[0];Ae.call(this,t)}}function Be(){var t=arguments[0];Me.call(this,t)}function Ve(){}function ze(){this.segString=null,this.coord=null,this.segmentIndex=null,this.segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.segString=t,this.coord=new c(e),this.segmentIndex=n,this.segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))}function ke(){this.nodeMap=new et,this.edge=null;var t=arguments[0];this.edge=t}function Ye(){this.nodeList=null,this.edge=null,this.nodeIt=null,this.currNode=null,this.nextNode=null,this.currSegIndex=0;var t=arguments[0];this.nodeList=t,this.edge=t.getEdge(),this.nodeIt=t.iterator(),this.readNextNode()}function Ue(){}function Xe(){this.nodeList=new ke(this),this.pts=null,this.data=null;var t=arguments[0],e=arguments[1];this.pts=t,this.data=e}function He(){this.tempEnv1=new I,this.tempEnv2=new I,this.overlapSeg1=new ae,this.overlapSeg2=new ae}function We(){this.pts=null,this.start=null,this.end=null,this.env=null,this.context=null,this.id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.pts=t,this.start=e,this.end=n,this.context=i}function je(){}function Ke(){}function Ze(){}function Qe(){if(this.segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}}function Je(){if(this.monoChains=new x,this.index=new qe,this.idCounter=0,this.nodedSegStrings=null,this.nOverlaps=0,0===arguments.length);else if(1===arguments.length){var t=arguments[0];Qe.call(this,t)}}function $e(){He.apply(this),this.si=null;var t=arguments[0];this.si=t}function tn(){if(this.pt=null,1===arguments.length){var t=arguments[0];u.call(this,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];u.call(this,tn.msgWithCoord(e,n)),this.name="TopologyException",this.pt=new c(n)}}function en(){}function nn(){this.findAllIntersections=!1,this.isCheckEndSegmentsOnly=!1,this.li=null,this.interiorIntersection=null,this.intSegments=null,this.intersections=new x,this.intersectionCount=0,this.keepIntersections=!0;var t=arguments[0];this.li=t,this.interiorIntersection=null}function rn(){this.li=new ie,this.segStrings=null,this.findAllIntersections=!1,this.segInt=null,this._isValid=!0;var t=arguments[0];this.segStrings=t}function sn(){this.nv=null;var t=arguments[0];this.nv=new rn(sn.toSegmentStrings(t))}function on(){this.mapOp=null;var t=arguments[0];this.mapOp=t}function an(){}function un(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var e=arguments[0];this.init(1),this.location[an.ON]=e}else if(arguments[0]instanceof un){var n=arguments[0];if(this.init(n.location.length),null!==n)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this.init(3),this.location[an.ON]=r,this.location[an.LEFT]=s,this.location[an.RIGHT]=o}}function ln(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new un(t),this.elt[1]=new un(t)}else if(arguments[0]instanceof ln){var e=arguments[0];this.elt[0]=new un(e.elt[0]),this.elt[1]=new un(e.elt[1])}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.elt[0]=new un(S.NONE),this.elt[1]=new un(S.NONE),this.elt[n].setLocation(i)}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this.elt[0]=new un(r,s,o),this.elt[1]=new un(r,s,o)}else if(4===arguments.length){var a=arguments[0],u=arguments[1],l=arguments[2],h=arguments[3];this.elt[0]=new un(S.NONE,S.NONE,S.NONE),this.elt[1]=new un(S.NONE,S.NONE,S.NONE),this.elt[a].setLocations(u,l,h)}}function hn(){this.startDe=null,this.maxNodeDegree=-1,this.edges=new x,this.pts=new x,this.label=new ln(S.NONE),this.ring=null,this._isHole=null,this.shell=null,this.holes=new x,this.geometryFactory=null;var t=arguments[0],e=arguments[1];this.geometryFactory=e,this.computePoints(t),this.computeRing()}function cn(){var t=arguments[0],e=arguments[1];hn.call(this,t,e)}function fn(){var t=arguments[0],e=arguments[1];hn.call(this,t,e)}function gn(){if(this.label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.label=t}}function dn(){gn.apply(this),this.coord=null,this.edges=null;var t=arguments[0],e=arguments[1];this.coord=t,this.edges=e,this.label=new ln(0,S.NONE)}function pn(){this.nodeMap=new et,this.nodeFact=null;var t=arguments[0];this.nodeFact=t}function mn(){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,1===arguments.length){var t=arguments[0];this.edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2];mn.call(this,e,n,i,null)}else if(4===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];mn.call(this,r),this.init(s,o),this.label=a}}function vn(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this.sym=null,this.next=null,this.nextMin=null,this.edgeRing=null,this.minEdgeRing=null,this.depth=[0,-999,-999];var t=arguments[0],e=arguments[1];if(mn.call(this,t),this._isForward=e,e)this.init(t.getCoordinate(0),t.getCoordinate(1));else{var n=t.getNumPoints()-1;this.init(t.getCoordinate(n),t.getCoordinate(n-1))}this.computeDirectedLabel()}function yn(){}function xn(){if(this.edges=new x,this.nodes=null,this.edgeEndList=new x,0===arguments.length)this.nodes=new pn(new yn);else if(1===arguments.length){var t=arguments[0];this.nodes=new pn(t)}}function En(){this.geometryFactory=null,this.shellList=new x;var t=arguments[0];this.geometryFactory=t}function In(){this.op=null,this.geometryFactory=null,this.ptLocator=null,this.lineEdgesList=new x,this.resultLineList=new x;var t=arguments[0],e=arguments[1],n=arguments[2];this.op=t,this.geometryFactory=e,this.ptLocator=n}function Nn(){this.op=null,this.geometryFactory=null,this.resultPointList=new x;var t=arguments[0],e=arguments[1];arguments[2];this.op=t,this.geometryFactory=e}function Cn(){}function Sn(){this.geom=null;var t=arguments[0];this.geom=t}function Ln(){this.edgeMap=new et,this.edgeList=null,this.ptInAreaLocation=[S.NONE,S.NONE]}function wn(){Ln.apply(this),this.resultAreaEdgeList=null,this.label=null,this.SCANNING_FOR_INCOMING=1,this.LINKING_TO_OUTGOING=2}function Rn(){yn.apply(this)}function Tn(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e}function On(){if(this.label=null,this.xValue=null,this.eventType=null,this.insertEvent=null,this.deleteEventIndex=null,this.obj=null,2===arguments.length){var t=arguments[0],e=arguments[1];this.eventType=On.DELETE,this.xValue=t,this.insertEvent=e}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.eventType=On.INSERT,this.label=n,this.xValue=i,this.obj=r}}function Pn(){}function bn(){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}function _n(){Pn.apply(this),this.events=new x,this.nOverlaps=null}function Mn(){this.min=i.POSITIVE_INFINITY,this.max=i.NEGATIVE_INFINITY}function Dn(){}function An(){Mn.apply(this),this.item=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.min=t,this.max=e,this.item=n}function Fn(){Mn.apply(this),this.node1=null,this.node2=null;var t=arguments[0],e=arguments[1];this.node1=t,this.node2=e,this.buildExtent(this.node1,this.node2)}function Gn(){this.leaves=new x,this.root=null,this.level=0}function qn(){if(this.lines=null,this.isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this.lines=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.lines=e,this.isForcedToLineString=n}}function Bn(){this.items=new x}function Vn(){this.index=null;var t=arguments[0];if(!oo(t,St))throw new n("Argument must be Polygonal");this.index=new kn(t)}function zn(){this.counter=null;var t=arguments[0];this.counter=t}function kn(){this.index=new Gn;var t=arguments[0];this.init(t)}function Yn(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new c(t),this.segmentIndex=e,this.dist=n}function Un(){this.nodeMap=new et,this.edge=null;var t=arguments[0];this.edge=t}function Xn(){}function Hn(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new I,this.env2=new I;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Xn;this.startIndex=e.getChainStartIndices(this.pts)}function Wn(){this.depth=Array(2).fill().map(function(){return Array(3)});for(var t=0;t<2;t++)for(var e=0;e<3;e++)this.depth[t][e]=Wn.NULL_VALUE}function jn(){if(gn.apply(this),this.pts=null,this.env=null,this.eiList=new Un(this),this.name=null,this.mce=null,this._isIsolated=!0,this.depth=new Wn,this.depthDelta=0,1===arguments.length){var t=arguments[0];jn.call(this,t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.pts=e,this.label=n}}function Kn(){if(xn.apply(this),this.parentGeom=null,this.lineEdgeMap=new Zt,this.boundaryNodeRule=null,this.useBoundaryDeterminationRule=!0,this.argIndex=null,this.boundaryNodes=null,this._hasTooFewPoints=!1,this.invalidPoint=null,this.areaPtLocator=null,this.ptLocator=new Se,2===arguments.length){var t=arguments[0],e=arguments[1];Kn.call(this,t,e,q.OGC_SFS_BOUNDARY_RULE)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.argIndex=n,this.parentGeom=i,this.boundaryNodeRule=r,null!==i&&this.add(i)}}function Zn(){if(this.li=new ie,this.resultPrecisionModel=null,this.arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this.arg=new Array(1).fill(null),this.arg[0]=new Kn(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];Zn.call(this,e,n,q.OGC_SFS_BOUNDARY_RULE)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(r.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this.arg=new Array(2).fill(null),this.arg[0]=new Kn(0,i,s),this.arg[1]=new Kn(1,r,s)}}function Qn(){this.pts=null,this._orientation=null;var t=arguments[0];this.pts=t,this._orientation=Qn.orientation(t)}function Jn(){this.edges=new x,this.ocaMap=new et}function $n(){this.ptLocator=new Se,this.geomFact=null,this.resultGeom=null,this.graph=null,this.edgeList=new Jn,this.resultPolyList=new x,this.resultLineList=new x,this.resultPointList=new x;var t=arguments[0],e=arguments[1];Zn.call(this,t,e),this.graph=new xn(new Rn),this.geomFact=t.getFactory()}function ti(){this.geom=new Array(2).fill(null),this.snapTolerance=null,this.cbr=null;var t=arguments[0],e=arguments[1];this.geom[0]=t,this.geom[1]=e,this.computeSnapTolerance()}function ei(){this.geom=new Array(2).fill(null);var t=arguments[0],e=arguments[1];this.geom[0]=t,this.geom[1]=e}function ni(){this.factory=null,this.interiorPoint=null,this.maxWidth=0;var t=arguments[0];this.factory=t.getFactory(),this.add(t)}function ii(){this.poly=null,this.centreY=null,this.hiY=i.MAX_VALUE,this.loY=-i.MAX_VALUE;var t=arguments[0];this.poly=t,this.hiY=t.getEnvelopeInternal().getMaxY(),this.loY=t.getEnvelopeInternal().getMinY(),this.centreY=ni.avg(this.loY,this.hiY)}function ri(){this.centroid=null,this.minDistance=i.MAX_VALUE,this.interiorPoint=null;var t=arguments[0];this.centroid=t.getCentroid().getCoordinate(),this.addInterior(t),null===this.interiorPoint&&this.addEndpoints(t)}function si(){this.centroid=null,this.minDistance=i.MAX_VALUE,this.interiorPoint=null;var t=arguments[0];this.centroid=t.getCentroid().getCoordinate(),this.add(t)}function oi(){this.tempEnv1=new I,this.selectedSegment=new ae}function ai(){this.items=new x,this.subnode=[null,null]}function ui(){if(this.min=null,this.max=null,0===arguments.length)this.min=0,this.max=0;else if(1===arguments.length){var t=arguments[0];this.init(t.min,t.max)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.init(e,n)}}function li(){}function hi(t,e){var n,i,r,s,o={32:{d:127,c:128,b:0,a:0},64:{d:32752,c:0,b:0,a:0}},a={32:8,64:11}[t];if(s||(n=e<0||1/e<0,isFinite(e)||(s=o[t],n&&(s.d+=1<<t/4-1),i=Math.pow(2,a)-1,r=0)),!s){for(i={32:127,64:1023}[t],r=Math.abs(e);r>=2;)i++,r/=2;for(;r<1&&i>0;)i--,r*=2;i<=0&&(r/=2),32===t&&i>254&&(s={d:n?255:127,c:128,b:0,a:0},i=Math.pow(2,a)-1,r=0)}return i}function ci(){this.pt=0,this.level=0,this.interval=null;var t=arguments[0];this.computeKey(t)}function fi(){ai.apply(this),this.interval=null,this.centre=null,this.level=null;var t=arguments[0],e=arguments[1];this.interval=t,this.level=e,this.centre=(t.getMin()+t.getMax())/2}function gi(){}function di(){ai.apply(this)}function pi(){this.root=null,this.minExtent=1,this.root=new di}function mi(){}function vi(){this.ring=null,this.tree=null,this.crossings=0,this.interval=new ui;var t=arguments[0];this.ring=t,this.buildIndex()}function yi(){oi.apply(this),this.mcp=null,this.p=null;var t=arguments[0],e=arguments[1];this.mcp=t,this.p=e}function xi(){}function Ei(){this.p0=null,this.p1=null,this.p2=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.p0=t,this.p1=e,this.p2=n}function Ii(){this.input=null,this.extremalPts=null,this.centre=null,this.radius=0;var t=arguments[0];this.input=t}function Ni(){if(this.inputGeom=null,this.isConvex=null,this.convexHullPts=null,this.minBaseSeg=new ae,this.minWidthPt=null,this.minPtIndex=null,this.minWidth=0,1===arguments.length){var t=arguments[0];Ni.call(this,t,!1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.inputGeom=e,this.isConvex=n}}function Ci(){this.inputGeom=null,this.distanceTolerance=null;var t=arguments[0];this.inputGeom=t}function Si(){pe.apply(this),this.distanceTolerance=null;var t=arguments[0];this.distanceTolerance=t}function Li(){this._orig=null,this._sym=null,this._next=null;var t=arguments[0];this._orig=t}function wi(){this._isMarked=!1;var t=arguments[0];Li.call(this,t)}function Ri(){this.vertexMap=new Zt}function Ti(){this._isStart=!1;var t=arguments[0];wi.call(this,t)}function Oi(){Ri.apply(this)}function Pi(){this.result=null,this.factory=null,this.graph=null,this.lines=new x,this.nodeEdgeStack=new ce,this.ringStartEdge=null,this.graph=new Oi}function bi(){this.items=new x,this.subnode=new Array(4).fill(null)}function _i(){this.pt=new c,this.level=0,this.env=null;var t=arguments[0];this.computeKey(t)}function Mi(){bi.apply(this),this.env=null,this.centrex=null,this.centrey=null,this.level=null;var t=arguments[0],e=arguments[1];this.env=t,this.level=e,this.centrex=(t.getMinX()+t.getMaxX())/2,this.centrey=(t.getMinY()+t.getMaxY())/2}function Di(){bi.apply(this)}function Ai(){this.root=null,this.minExtent=1,this.root=new Di}function Fi(t){this.geometryFactory=t||new $t}function Gi(t){this.geometryFactory=t||new $t,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Fi(this.geometryFactory)}function qi(){this.parser=new Fi(this.geometryFactory)}function Bi(t){this.geometryFactory=t||new $t,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new te(this.geometryFactory)}function Vi(t){return[t.x,t.y]}function zi(t,e){this.geometryFactory=t||new $t,this.ol=e||"undefined"!=typeof ol&&ol}function ki(){if(this.noder=null,this.scaleFactor=null,this.offsetX=null,this.offsetY=null,this.isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];ki.call(this,t,e,0,0)}else if(4===arguments.length){var n=arguments[0],i=arguments[1];arguments[2],arguments[3];this.noder=n,this.scaleFactor=i,this.isScaled=!this.isIntegerPrecision()}}function Yi(){if(this.inputGeom=null,this.isClosedEndpointsInInterior=!0,this.nonSimpleLocation=null,1===arguments.length){var t=arguments[0];this.inputGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.inputGeom=e,this.isClosedEndpointsInInterior=!n.isInBoundary(2)}}function Ui(){this.pt=null,this.isClosed=null,this.degree=null;var t=arguments[0];this.pt=t,this.isClosed=!1,this.degree=0}function Xi(){if(this.quadrantSegments=Xi.DEFAULT_QUADRANT_SEGMENTS,this.endCapStyle=Xi.CAP_ROUND,this.joinStyle=Xi.JOIN_ROUND,this.mitreLimit=Xi.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,
this.simplifyFactor=Xi.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setQuadrantSegments(t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(n)}else if(4===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(r),this.setJoinStyle(s),this.setMitreLimit(o)}}function Hi(){this.minIndex=-1,this.minCoord=null,this.minDe=null,this.orientedDe=null}function Wi(){this.array_=[]}function ji(){this.finder=null,this.dirEdgeList=new x,this.nodes=new x,this.rightMostCoord=null,this.env=null,this.finder=new Hi}function Ki(){this.inputLine=null,this.distanceTol=null,this.isDeleted=null,this.angleOrientation=oe.COUNTERCLOCKWISE;var t=arguments[0];this.inputLine=t}function Zi(){this.ptList=null,this.precisionModel=null,this.minimimVertexDistance=0,this.ptList=new x}function Qi(){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 ae,this.seg1=new ae,this.offset0=new ae,this.offset1=new ae,this.side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this.precisionModel=t,this.bufParams=e,this.li=new ie,this.filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===Xi.JOIN_ROUND&&(this.closingSegLengthFactor=Qi.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}function Ji(){this.distance=0,this.precisionModel=null,this.bufParams=null;var t=arguments[0],e=arguments[1];this.precisionModel=t,this.bufParams=e}function $i(){this.subgraphs=null,this.seg=new ae,this.cga=new oe;var t=arguments[0];this.subgraphs=t}function tr(){this.upwardSeg=null,this.leftDepth=null;var t=arguments[0],e=arguments[1];this.upwardSeg=new ae(t),this.leftDepth=e}function er(){this.inputGeom=null,this.distance=null,this.curveBuilder=null,this.curveList=new x;var t=arguments[0],e=arguments[1],n=arguments[2];this.inputGeom=t,this.distance=e,this.curveBuilder=n}function nr(){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}function ir(){this.bufParams=null,this.workingPrecisionModel=null,this.workingNoder=null,this.geomFact=null,this.graph=null,this.edgeList=new Jn;var t=arguments[0];this.bufParams=t}function rr(){this.li=new ie,this.segStrings=null;var t=arguments[0];this.segStrings=t}function sr(){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],i=arguments[2];if(this.originalPt=t,this.pt=t,this.scaleFactor=e,this.li=i,e<=0)throw new n("Scale factor must be non-zero");1!==e&&(this.pt=new c(this.scale(t.x),this.scale(t.y)),this.p0Scaled=new c,this.p1Scaled=new c),this.initCorners(this.pt)}function or(){this.index=null;var t=arguments[0];this.index=t}function ar(){oi.apply(this),this.hotPixel=null,this.parentEdge=null,this.hotPixelVertexIndex=null,this._isNodeAdded=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this.hotPixel=t,this.parentEdge=e,this.hotPixelVertexIndex=n}function ur(){this.li=null,this.interiorIntersections=null;var t=arguments[0];this.li=t,this.interiorIntersections=new x}function lr(){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 ie,this.li.setPrecisionModel(t),this.scaleFactor=t.getScale()}function hr(){if(this.argGeom=null,this.distance=null,this.bufParams=new Xi,this.resultGeometry=null,this.saveException=null,1===arguments.length){var t=arguments[0];this.argGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.argGeom=e,this.bufParams=n}}function cr(){this.comps=null;var t=arguments[0];this.comps=t}function fr(){if(this.component=null,this.segIndex=null,this.pt=null,2===arguments.length){var t=arguments[0],e=arguments[1];fr.call(this,t,fr.INSIDE_AREA,e)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.component=n,this.segIndex=i,this.pt=r}}function gr(){this.pts=null;var t=arguments[0];this.pts=t}function dr(){this.locations=null;var t=arguments[0];this.locations=t}function pr(){if(this.geom=null,this.terminateDistance=0,this.ptLocator=new Se,this.minDistanceLocation=null,this.minDistance=i.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];pr.call(this,t,e,0)}else if(3===arguments.length){var n=arguments[0],r=arguments[1],s=arguments[2];this.geom=new Array(2).fill(null),this.geom[0]=n,this.geom[1]=r,this.terminateDistance=s}}function mr(){this.factory=null,this.directedEdges=new x,this.coordinates=null;var t=arguments[0];this.factory=t}function vr(){this._isMarked=!1,this._isVisited=!1,this.data=null}function yr(){vr.apply(this),this.parentEdge=null,this.from=null,this.to=null,this.p0=null,this.p1=null,this.sym=null,this.edgeDirection=null,this.quadrant=null,this.angle=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.from=t,this.to=e,this.edgeDirection=i,this.p0=t.getCoordinate(),this.p1=n;var r=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y;this.quadrant=je.quadrant(r,s),this.angle=Math.atan2(s,r)}function xr(){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];yr.call(this,t,e,n,i)}function Er(){if(vr.apply(this),this.dirEdge=null,0===arguments.length);else if(2===arguments.length){var t=arguments[0],e=arguments[1];this.setDirectedEdges(t,e)}}function Ir(){this.outEdges=new x,this.sorted=!1}function Nr(){if(vr.apply(this),this.pt=null,this.deStar=null,1===arguments.length){var t=arguments[0];Nr.call(this,t,new Ir)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.pt=e,this.deStar=n}}function Cr(){Er.apply(this),this.line=null;var t=arguments[0];this.line=t}function Sr(){this.nodeMap=new et}function Lr(){this.edges=new K,this.dirEdges=new K,this.nodeMap=new Sr}function wr(){Lr.apply(this)}function Rr(){this.graph=new wr,this.mergedLineStrings=null,this.factory=null,this.edgeStrings=null}function Tr(){this.edgeRing=null,this.next=null,this.label=-1;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];yr.call(this,t,e,n,i)}function Or(){Er.apply(this),this.line=null;var t=arguments[0];this.line=t}function Pr(){this.geometryFactory=new $t,this.geomGraph=null,this.disconnectedRingcoord=null;var t=arguments[0];this.geomGraph=t}function br(){}function _r(){if(this.edgeEnds=new x,1===arguments.length){var t=arguments[0];_r.call(this,null,t)}else if(2===arguments.length){var e=(arguments[0],arguments[1]);mn.call(this,e.getEdge(),e.getCoordinate(),e.getDirectedCoordinate(),new ln(e.getLabel())),this.insert(e)}}function Mr(){Ln.apply(this)}function Dr(){var t=arguments[0],e=arguments[1];dn.call(this,t,e)}function Ar(){yn.apply(this)}function Fr(){this.nodes=new pn(new Ar)}function Gr(){this.li=new ie,this.geomGraph=null,this.nodeGraph=new Fr,this.invalidPoint=null;var t=arguments[0];this.geomGraph=t}function qr(){this.graph=null,this.rings=new x,this.totalEnv=new I,this.index=null,this.nestedPt=null;var t=arguments[0];this.graph=t}function Br(){if(this.errorType=null,this.pt=null,1===arguments.length){var t=arguments[0];Br.call(this,t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.errorType=e,null!==n&&(this.pt=n.copy())}}function Vr(){this.parentGeometry=null,this.isSelfTouchingRingFormingHoleValid=!1,this.validErr=null;var t=arguments[0];this.parentGeometry=t}function zr(){this.factory=null,this.deList=new x,this.lowestEdge=null,this.ring=null,this.ringPts=null,this.holes=null,this.shell=null,this._isHole=null,this._isProcessed=!1,this._isIncludedSet=!1,this._isIncluded=!1;var t=arguments[0];this.factory=t}function kr(){}function Yr(){Lr.apply(this),this.factory=null;var t=arguments[0];this.factory=t}function Ur(){if(this.lineStringAdder=new Xr(this),this.graph=null,this.dangles=new x,this.cutEdges=new x,this.invalidRingLines=new x,this.holeList=null,this.shellList=null,this.polyList=null,this.isCheckingRingsValid=!0,this.extractOnlyPolygonal=null,this.geomFactory=null,0===arguments.length)Ur.call(this,!1);else if(1===arguments.length){var t=arguments[0];this.extractOnlyPolygonal=t}}function Xr(){this.p=null;var t=arguments[0];this.p=t}function Hr(){this.li=new ie,this.ptLocator=new Se,this.arg=null,this.nodes=new pn(new Ar),this.im=null,this.isolatedEdges=new x,this.invalidPoint=null;var t=arguments[0];this.arg=t}function Wr(){this.rectEnv=null;var t=arguments[0];this.rectEnv=t.getEnvelopeInternal()}function jr(){this.li=new ie,this.rectEnv=null,this.diagUp0=null,this.diagUp1=null,this.diagDown0=null,this.diagDown1=null;var t=arguments[0];this.rectEnv=t,this.diagUp0=new c(t.getMinX(),t.getMinY()),this.diagUp1=new c(t.getMaxX(),t.getMaxY()),this.diagDown0=new c(t.getMinX(),t.getMaxY()),this.diagDown1=new c(t.getMaxX(),t.getMinY())}function Kr(){this._isDone=!1}function Zr(){this.rectangle=null,this.rectEnv=null;var t=arguments[0];this.rectangle=t,this.rectEnv=t.getEnvelopeInternal()}function Qr(){Kr.apply(this),this.rectEnv=null,this._intersects=!1;var t=arguments[0];this.rectEnv=t}function Jr(){Kr.apply(this),this.rectSeq=null,this.rectEnv=null,this._containsPoint=!1;var t=arguments[0];this.rectSeq=t.getExteriorRing().getCoordinateSequence(),this.rectEnv=t.getEnvelopeInternal()}function $r(){Kr.apply(this),this.rectEnv=null,this.rectIntersector=null,this.hasIntersection=!1,this.p0=new c,this.p1=new c;var t=arguments[0];this.rectEnv=t.getEnvelopeInternal(),this.rectIntersector=new jr(this.rectEnv)}function ts(){if(this._relate=null,2===arguments.length){var t=arguments[0],e=arguments[1];Zn.call(this,t,e),this._relate=new Hr(this.arg)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];Zn.call(this,n,i,r),this._relate=new Hr(this.arg)}}function es(){this.geomFactory=null,this.skipEmpty=!1,this.inputGeoms=null;var t=arguments[0];this.geomFactory=es.extractFactory(t),this.inputGeoms=t}function ns(){this.pointGeom=null,this.otherGeom=null,this.geomFact=null;var t=arguments[0],e=arguments[1];this.pointGeom=t,this.otherGeom=e,this.geomFact=e.getFactory()}function is(){this.sortIndex=-1,this.comps=null;var t=arguments[0],e=arguments[1];this.sortIndex=t,this.comps=e}function rs(){this.inputPolys=null,this.geomFactory=null;var t=arguments[0];this.inputPolys=t,null===this.inputPolys&&(this.inputPolys=new x)}function ss(){if(this.polygons=new x,this.lines=new x,this.points=new x,this.geomFact=null,1===arguments.length){if(oo(arguments[0],d)){var t=arguments[0];this.extract(t)}else if(arguments[0]instanceof F){var e=arguments[0];this.extract(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.geomFact=i,this.extract(n)}}function os(){Ot.CoordinateOperation.apply(this),this.targetPM=null,this.removeCollapsed=!0;var t=arguments[0],e=arguments[1];this.targetPM=t,this.removeCollapsed=e}function as(){this.targetPM=null,this.removeCollapsed=!0,this.changePrecisionModel=!1,this.isPointwise=!1;var t=arguments[0];this.targetPM=t}function us(){this.pts=null,this.usePt=null,this.distanceTolerance=null,this.seg=new ae;var t=arguments[0];this.pts=t}function ls(){this.inputGeom=null,this.distanceTolerance=null,this.isEnsureValidTopology=!0;var t=arguments[0];this.inputGeom=t}function hs(){pe.apply(this),this.isEnsureValidTopology=!0,this.distanceTolerance=null;var t=arguments[0],e=arguments[1];this.isEnsureValidTopology=t,this.distanceTolerance=e}function cs(){if(this.parent=null,this.index=null,2===arguments.length){var t=arguments[0],e=arguments[1];cs.call(this,t,e,null,-1)}else if(4===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=arguments[3];ae.call(this,n,i),this.parent=r,this.index=s}}function fs(){if(this.parentLine=null,this.segs=null,this.resultSegs=new x,this.minimumSize=null,1===arguments.length){var t=arguments[0];fs.call(this,t,2)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.parentLine=e,this.minimumSize=n,this.init()}}function gs(){this.index=new Ai}function ds(){this.querySeg=null,this.items=new x;var t=arguments[0];this.querySeg=t}function ps(){this.li=new ie,this.inputIndex=new gs,this.outputIndex=new gs,this.line=null,this.linePts=null,this.distanceTolerance=0;var t=arguments[0],e=arguments[1];this.inputIndex=t,this.outputIndex=e}function ms(){this.inputIndex=new gs,this.outputIndex=new gs,this.distanceTolerance=0}function vs(){this.inputGeom=null,this.lineSimplifier=new ms,this.linestringMap=null;var t=arguments[0];this.inputGeom=t}function ys(){pe.apply(this),this.linestringMap=null;var t=arguments[0];this.linestringMap=t}function xs(){this.tps=null;var t=arguments[0];this.tps=t}function Es(){this.seg=null,this.segLen=null,this.splitPt=null,this.minimumLen=0;var t=arguments[0];this.seg=t,this.segLen=t.getLength()}function Is(){}function Ns(){}function Cs(){}function Ss(){if(this.p=null,1===arguments.length){var t=arguments[0];this.p=new c(t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p=new c(e,n)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];this.p=new c(i,r,s)}}function Ls(){this._isOnConstraint=null,this.constraint=null;var t=arguments[0];Ss.call(this,t)}function ws(){this._rot=null,this.vertex=null,this.next=null,this.data=null}function Rs(){this.subdiv=null,this.isUsingTolerance=!1;var t=arguments[0];this.subdiv=t,this.isUsingTolerance=t.getTolerance()>0}function Ts(){}function Os(){this.subdiv=null,this.lastEdge=null;var t=arguments[0];this.subdiv=t,this.init()}function Ps(){if(this.seg=null,1===arguments.length){if("string"==typeof arguments[0]){var t=arguments[0];u.call(this,t)}else if(arguments[0]instanceof ae){var e=arguments[0];u.call(this,"Locate failed to converge (at edge: "+e+"). Possible causes include invalid Subdivision topology or very close sites"),this.seg=new ae(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];u.call(this,Ps.msgWithSpatial(n,i)),this.seg=new ae(i)}}function bs(){}function _s(){this.visitedKey=0,this.quadEdges=new x,this.startingEdge=null,this.tolerance=null,this.edgeCoincidenceTolerance=null,this.frameVertex=new Array(3).fill(null),this.frameEnv=null,this.locator=null,this.seg=new ae,this.triEdges=new Array(3).fill(null);var t=arguments[0],e=arguments[1];this.tolerance=e,this.edgeCoincidenceTolerance=e/_s.EDGE_COINCIDENCE_TOL_FACTOR,this.createFrame(t),this.startingEdge=this.initSubdiv(),this.locator=new Os(this)}function Ms(){}function Ds(){this.triList=new x}function As(){this.triList=new x}function Fs(){this.coordList=new E,this.triCoords=new x}function Gs(){if(this.ls=null,this.data=null,2===arguments.length){var t=arguments[0],e=arguments[1];this.ls=new ae(t,e)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.ls=new ae(n,i),this.data=r}else if(6===arguments.length){var s=arguments[0],o=arguments[1],a=arguments[2],u=arguments[3],l=arguments[4],h=arguments[5];Gs.call(this,new c(s,o,a),new c(u,l,h))}else if(7===arguments.length){var f=arguments[0],g=arguments[1],d=arguments[2],p=arguments[3],m=arguments[4],v=arguments[5],y=arguments[6];Gs.call(this,new c(f,g,d),new c(p,m,v),y)}}function qs(){}function Bs(){if(this.p=null,this.data=null,this.left=null,this.right=null,this.count=null,2===arguments.length){var t=arguments[0],e=arguments[1];this.p=new c(t),this.left=null,this.right=null,this.count=1,this.data=e}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.p=new c(n,i),this.left=null,this.right=null,this.count=1,this.data=r}}function Vs(){if(this.root=null,this.numberOfNodes=null,this.tolerance=null,0===arguments.length)Vs.call(this,0);else if(1===arguments.length){var t=arguments[0];this.tolerance=t}}function zs(){this.tolerance=null,this.matchNode=null,this.matchDist=0,this.p=null;var t=arguments[0],e=arguments[1];this.p=t,this.tolerance=e}function ks(){this.initialVertices=null,this.segVertices=null,this.segments=new x,this.subdiv=null,this.incDel=null,this.convexHull=null,this.splitFinder=new Ns,this.kdt=null,this.vertexFactory=null,this.computeAreaEnv=null,this.splitPt=null,this.tolerance=null;var t=arguments[0],e=arguments[1];this.initialVertices=new x(t),this.tolerance=e,this.kdt=new Vs(e)}function Ys(){this.siteCoords=null,this.tolerance=0,this.subdiv=null}function Us(){this.siteCoords=null,this.constraintLines=null,this.tolerance=0,this.subdiv=null,this.constraintVertexMap=new et}function Xs(){this.siteCoords=null,this.tolerance=0,this.subdiv=null,this.clipEnv=null,this.diagramEnv=null}function Hs(){if(this.componentIndex=0,this.segmentIndex=0,this.segmentFraction=0,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.componentIndex=t.componentIndex,this.segmentIndex=t.segmentIndex,this.segmentFraction=t.segmentFraction}else if(2===arguments.length){var e=arguments[0],n=arguments[1];Hs.call(this,0,e,n)}else if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];this.componentIndex=i,this.segmentIndex=r,this.segmentFraction=s,this.normalize()}else if(4===arguments.length){var o=arguments[0],a=arguments[1],u=arguments[2],l=arguments[3];this.componentIndex=o,this.segmentIndex=a,this.segmentFraction=u,l&&this.normalize()}}function Ws(){if(this.linearGeom=null,this.numLines=null,this.currentLine=null,this.componentIndex=0,this.vertexIndex=0,1===arguments.length){var t=arguments[0];Ws.call(this,t,0,0)}else if(2===arguments.length){var e=arguments[0],i=arguments[1];Ws.call(this,e,i.getComponentIndex(),Ws.segmentEndVertexIndex(i))}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];if(!oo(r,nt))throw new n("Lineal geometry is required");this.linearGeom=r,this.numLines=r.getNumGeometries(),this.componentIndex=s,this.vertexIndex=o,this.loadCurrentLine()}}function js(){this.linearGeom=null;var t=arguments[0];this.linearGeom=t}function Ks(){this.linearGeom=null;var t=arguments[0];this.linearGeom=t}function Zs(){this.geomFact=null,this.lines=new x,this.coordList=null,this.ignoreInvalidLines=!1,this.fixInvalidLines=!1,this.lastPt=null;var t=arguments[0];this.geomFact=t}function Qs(){this.line=null;var t=arguments[0];this.line=t}function Js(){this.linearGeom=null;var t=arguments[0];this.linearGeom=t,this.checkGeometryType()}function $s(){this.linearGeom=null;var t=arguments[0];this.linearGeom=t}function to(){this.linearGeom=null;var t=arguments[0];this.linearGeom=t}function eo(){this.linearGeom=null;var t=arguments[0];this.linearGeom=t}function no(){}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(void 0===this||null===this)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,i=1 in arguments?parseInt(Number(arguments[1]),10)||0:0;i=i<0?Math.max(n+i,0):Math.min(i,n);var r=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(r=r<0?Math.max(n+arguments[2],0):Math.min(r,n);i<r;)e[i]=t,++i;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&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 io=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};io(e.prototype,{interfaces_:function(){return[]},getClass:function(){return e}}),e.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n},i.isNaN=function(t){return Number.isNaN(t)},i.doubleToLongBits=function(t){return t},i.longBitsToDouble=function(t){return t},i.isInfinite=function(t){return!Number.isFinite(t)},i.MAX_VALUE=Number.MAX_VALUE,u.prototype=Object.create(Error.prototype),u.prototype.constructor=Error;var ro=function(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t};ro(l,u),io(l.prototype,{interfaces_:function(){return[]},getClass:function(){return l}}),io(h.prototype,{interfaces_:function(){return[]},getClass:function(){return h}}),h.shouldNeverReachHere=function(){if(0===arguments.length)h.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new l("Should never reach here"+(null!==t?": "+t:""))}},h.isTrue=function(){if(1===arguments.length){var t=arguments[0];h.isTrue(t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!e)throw null===n?new l:new l(n)}},h.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];h.equals(t,e,null)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];if(!i.equals(n))throw new l("Expected "+n+" but encountered "+i+(null!==r?": "+r:""))}},io(c.prototype,{setOrdinate:function(t,e){switch(t){case c.X:this.x=e;break;case c.Y:this.y=e;break;case c.Z:this.z=e;break;default:throw new n("Invalid ordinate index: "+t)}},equals2D:function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var n=arguments[0],i=arguments[1];return!!e.equalsWithTolerance(this.x,n.x,i)&&!!e.equalsWithTolerance(this.y,n.y,i)}},getOrdinate:function(t){switch(t){case c.X:return this.x;case c.Y:return this.y;case c.Z:return this.z}throw new n("Invalid ordinate index: "+t)},equals3D:function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||i.isNaN(this.z)&&i.isNaN(t.z))},equals:function(t){return t instanceof c&&this.equals2D(t)},equalInZ:function(t,n){return e.equalsWithTolerance(this.z,t.z,n)},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},clone:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return h.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}},copy:function(){return new c(this)},toString:function(){return"("+this.x+", "+this.y+", "+this.z+")"},distance3D:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return Math.sqrt(e*e+n*n+i*i)},distance:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},hashCode:function(){var t=17;return t=37*t+c.hashCode(this.x),t=37*t+c.hashCode(this.y)},setCoordinate:function(t){this.x=t.x,this.y=t.y,this.z=t.z},interfaces_:function(){return[r,s,a]},getClass:function(){return c}}),c.hashCode=function(){if(1===arguments.length){var t=arguments[0],e=i.doubleToLongBits(t);return Math.trunc(e^e>>>32)}},io(f.prototype,{compare:function(t,e){var n=t,i=e,r=f.compare(n.x,i.x);if(0!==r)return r;var s=f.compare(n.y,i.y);return 0!==s?s:this.dimensionsToTest<=2?0:f.compare(n.z,i.z)},interfaces_:function(){return[o]},getClass:function(){return f}}),f.compare=function(t,e){return t<e?-1:t>e?1:i.isNaN(t)?i.isNaN(e)?0:-1:i.isNaN(e)?1:0},c.DimensionalComparator=f,c.serialVersionUID=0x5cbf2c235c7e5800,c.NULL_ORDINATE=i.NaN,c.X=0,c.Y=1,c.Z=2,g.prototype.hasNext=function(){},g.prototype.next=function(){},g.prototype.remove=function(){},d.prototype.add=function(){},d.prototype.addAll=function(){},d.prototype.isEmpty=function(){},d.prototype.iterator=function(){},d.prototype.size=function(){},d.prototype.toArray=function(){},d.prototype.remove=function(){},p.prototype=new Error,p.prototype.name="IndexOutOfBoundsException",m.prototype=Object.create(d.prototype),m.prototype.constructor=m,m.prototype.get=function(){},m.prototype.set=function(){},m.prototype.isEmpty=function(){},v.prototype=new Error,v.prototype.name="NoSuchElementException",y.prototype=new Error,y.prototype.name="OperationNotSupported",x.prototype=Object.create(m.prototype),x.prototype.constructor=x,x.prototype.ensureCapacity=function(){},x.prototype.interfaces_=function(){return[m,d]},x.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},x.prototype.clear=function(){this.array_=[]},x.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},x.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},x.prototype.iterator=function(){return new so(this)},x.prototype.get=function(t){if(t<0||t>=this.size())throw new p;return this.array_[t]},x.prototype.isEmpty=function(){return 0===this.array_.length},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},x.prototype.remove=function(t){for(var e=!1,n=0,i=this.array_.length;n<i;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e};var so=function(t){this.arrayList_=t,this.position_=0};so.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new v;return this.arrayList_.get(this.position_++)},so.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},so.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},so.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},ro(E,x),io(E.prototype,{getCoordinate:function(t){return this.get(t)},addAll:function(){if(2===arguments.length){for(var t=arguments[0],e=arguments[1],n=!1,i=t.iterator();i.hasNext();)this.add(i.next(),e),n=!0;return n}return x.prototype.addAll.apply(this,arguments)},clone:function(){for(var t=x.prototype.clone.call(this),e=0;e<this.size();e++)t.add(e,this.get(e).copy());return t},toCoordinateArray:function(){return this.toArray(E.coordArrayType)},add:function(){if(1===arguments.length){var t=arguments[0];x.prototype.add.call(this,t)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var e=arguments[0],n=arguments[1];return this.add(e,n,!0),!0}if(arguments[0]instanceof c&&"boolean"==typeof arguments[1]){var i=arguments[0],r=arguments[1];if(!r&&this.size()>=1){var s=this.get(this.size()-1);if(s.equals2D(i))return null}x.prototype.add.call(this,i)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var o=arguments[0],a=arguments[1];return this.add(o,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1],h=arguments[2];if(h)for(var f=0;f<u.length;f++)this.add(u[f],l);else for(var f=u.length-1;f>=0;f--)this.add(u[f],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof c){var g=arguments[0],d=arguments[1],p=arguments[2];if(!p){var m=this.size();if(m>0){if(g>0){var v=this.get(g-1);if(v.equals2D(d))return null}if(g<m){var y=this.get(g);if(y.equals2D(d))return null}}}x.prototype.add.call(this,g,d)}}else if(4===arguments.length){var E=arguments[0],I=arguments[1],N=arguments[2],C=arguments[3],S=1;N>C&&(S=-1);for(var f=N;f!==C;f+=S)this.add(E[f],I);return!0}},closeRing:function(){this.size()>0&&this.add(new c(this.get(0)),!1)},interfaces_:function(){return[]},getClass:function(){return E}}),E.coordArrayType=new Array(0).fill(null),io(I.prototype,{getArea:function(){return this.getWidth()*this.getHeight()},equals:function(t){if(!(t instanceof I))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()},intersection:function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new I;var e=this.minx>t.minx?this.minx:t.minx,n=this.miny>t.miny?this.miny:t.miny;return new I(e,this.maxx<t.maxx?this.maxx:t.maxx,n,this.maxy<t.maxy?this.maxy:t.maxy)},isNull:function(){return this.maxx<this.minx},getMaxX:function(){return this.maxx},covers:function(){if(1===arguments.length){if(arguments[0]instanceof c){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof I){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(2===arguments.length){var n=arguments[0],i=arguments[1];return!this.isNull()&&(n>=this.minx&&n<=this.maxx&&i>=this.miny&&i<=this.maxy)}},intersects:function(){if(1===arguments.length){if(arguments[0]instanceof I){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 c){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return!this.isNull()&&!(n>this.maxx||n<this.minx||i>this.maxy||i<this.miny)}},getMinY:function(){return this.miny},getMinX:function(){return this.minx},expandToInclude:function(){if(1===arguments.length){if(arguments[0]instanceof c){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof I){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(2===arguments.length){var n=arguments[0],i=arguments[1];this.isNull()?(this.minx=n,this.maxx=n,this.miny=i,this.maxy=i):(n<this.minx&&(this.minx=n),n>this.maxx&&(this.maxx=n),i<this.miny&&(this.miny=i),i>this.maxy&&(this.maxy=i))}},minExtent:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},getWidth:function(){return this.isNull()?0:this.maxx-this.minx},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},translate:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},toString:function(){return"Env["+this.minx+" : "+this.maxx+", "+this.miny+" : "+this.maxy+"]"},setToNull:function(){this.minx=0,this.maxx=-1,this.miny=0,this.maxy=-1},getHeight:function(){return this.isNull()?0:this.maxy-this.miny},maxExtent:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},expandBy:function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){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()}},contains:function(){if(1===arguments.length){if(arguments[0]instanceof I){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof c){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return this.covers(n,i)}},centre:function(){return this.isNull()?null:new c((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},init:function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof c){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof I){var e=arguments[0];this.minx=e.minx,this.maxx=e.maxx,this.miny=e.miny,this.maxy=e.maxy}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(4===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];r<s?(this.minx=r,this.maxx=s):(this.minx=s,this.maxx=r),o<a?(this.miny=o,this.maxy=a):(this.miny=a,this.maxy=o)}},getMaxY:function(){return this.maxy},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),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},hashCode:function(){var t=17;return t=37*t+c.hashCode(this.minx),t=37*t+c.hashCode(this.maxx),t=37*t+c.hashCode(this.miny),t=37*t+c.hashCode(this.maxy)},interfaces_:function(){return[r,a]},getClass:function(){return I}}),I.intersects=function(){if(3===arguments.length){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(4===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3],a=Math.min(s.x,o.x),u=Math.max(s.x,o.x),l=Math.min(i.x,r.x),h=Math.max(i.x,r.x);return!(l>u)&&(!(h<a)&&(a=Math.min(s.y,o.y),u=Math.max(s.y,o.y),l=Math.min(i.y,r.y),h=Math.max(i.y,r.y),!(l>u)&&!(h<a)))}},I.serialVersionUID=0x51845cd552189800,ro(C,N),io(C.prototype,{interfaces_:function(){return[]},getClass:function(){return C}}),io(S.prototype,{interfaces_:function(){return[]},getClass:function(){return S}}),S.toLocationSymbol=function(t){switch(t){case S.EXTERIOR:return"e";case S.BOUNDARY:return"b";case S.INTERIOR:return"i";case S.NONE:return"-"}throw new n("Unknown location value: "+t)},S.INTERIOR=0,S.BOUNDARY=1,S.EXTERIOR=2,S.NONE=-1;var oo=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1};io(L.prototype,{interfaces_:function(){return[]},getClass:function(){return L}}),L.log10=function(t){var e=Math.log(t);return i.isInfinite(e)?e:i.isNaN(e)?e:e/L.LOG_10},L.min=function(t,e,n,i){var r=t;return e<r&&(r=e),n<r&&(r=n),i<r&&(r=i),r},L.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],s=arguments[2];return i<r?r:i>s?s:i}},L.wrap=function(t,e){return t<0?e- -t%e:t%e},L.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}if(4===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3],i=r;return s>i&&(i=s),o>i&&(i=o),a>i&&(i=a),i}},L.average=function(t,e){return(t+e)/2},L.LOG_10=Math.log(10),w.prototype.append=function(t){this.str+=t},w.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},w.prototype.toString=function(t){return this.str},R.prototype.intValue=function(){return this.value},R.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},R.isNaN=function(t){return Number.isNaN(t)},T.isWhitespace=function(t){return t<=32&&t>=0||127==t},T.toUpperCase=function(t){return t.toUpperCase()},io(O.prototype,{le:function(t){return this.hi<t.hi||this.hi===t.hi&&this.lo<=t.lo},extractSignificantDigits:function(t,e){var n=this.abs(),i=O.magnitude(n.hi),r=O.TEN.pow(i);n=n.divide(r),n.gt(O.TEN)?(n=n.divide(O.TEN),i+=1):n.lt(O.ONE)&&(n=n.multiply(O.TEN),i-=1);for(var s=i+1,o=new w,a=O.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===s&&o.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,o.append(c),n=n.subtract(O.valueOf(l)).multiply(O.TEN),h&&n.selfAdd(O.TEN);var f=!0,g=O.magnitude(n.hi);if(g<0&&Math.abs(g)>=a-u&&(f=!1),!f)break}return e[0]=i,o.toString()},sqr:function(){return this.multiply(this)},doubleValue:function(){return this.hi+this.lo},subtract:function(){if(arguments[0]instanceof O){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},equals:function(){if(1===arguments.length){var t=arguments[0];return this.hi===t.hi&&this.lo===t.lo}},isZero:function(){return 0===this.hi&&0===this.lo},selfSubtract:function(){if(arguments[0]instanceof O){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t.hi,-t.lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},getSpecialNumberString:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},min:function(t){return this.le(t)?this:t},selfDivide:function(){if(1===arguments.length){if(arguments[0]instanceof O){var t=arguments[0];return this.selfDivide(t.hi,t.lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=null,s=null,o=null,a=null,u=null,l=null,h=null,c=null;return u=this.hi/n,l=O.SPLIT*u,r=l-u,c=O.SPLIT*n,r=l-r,s=u-r,o=c-n,h=u*n,o=c-o,a=n-o,c=r*o-h+r*a+s*o+s*a,l=(this.hi-h-c+this.lo-u*i)/n,c=u+l,this.hi=c,this.lo=u-c+l,this}},dump:function(){return"DD<"+this.hi+", "+this.lo+">"},divide:function(){if(arguments[0]instanceof O){var t=arguments[0],e=null,n=null,r=null,s=null,o=null,a=null,u=null,l=null;o=this.hi/t.hi,a=O.SPLIT*o,e=a-o,l=O.SPLIT*t.hi,e=a-e,n=o-e,r=l-t.hi,u=o*t.hi,r=l-r,s=t.hi-r,l=e*r-u+e*s+n*r+n*s,a=(this.hi-u-l+this.lo-o*t.lo)/t.hi,l=o+a;return new O(l,o-l+a)}if("number"==typeof arguments[0]){var h=arguments[0];return i.isNaN(h)?O.createNaN():O.copy(this).selfDivide(h,0)}},ge:function(t){return this.hi>t.hi||this.hi===t.hi&&this.lo>=t.lo},pow:function(t){if(0===t)return O.valueOf(1);var e=new O(this),n=O.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2==1&&n.selfMultiply(e),(i/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},ceil:function(){if(this.isNaN())return O.NaN;var t=Math.ceil(this.hi),e=0;return t===this.hi&&(e=Math.ceil(this.lo)),new O(t,e)},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},rint:function(){return this.isNaN()?this:this.add(.5).floor()},setValue:function(){if(arguments[0]instanceof O){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},max:function(t){return this.ge(t)?this:t},sqrt:function(){if(this.isZero())return O.valueOf(0);if(this.isNegative())return O.NaN;var t=1/Math.sqrt(this.hi),e=this.hi*t,n=O.valueOf(e),i=this.subtract(n.sqr()),r=i.hi*(.5*t);return n.add(r)},selfAdd:function(){if(1===arguments.length){if(arguments[0]instanceof O){var t=arguments[0];return this.selfAdd(t.hi,t.lo)}if("number"==typeof arguments[0]){var e=arguments[0],n=null,i=null,r=null,s=null,o=null,a=null;return r=this.hi+e,o=r-this.hi,s=r-o,s=e-o+(this.hi-s),a=s+this.lo,n=r+a,i=a+(r-n),this.hi=n+i,this.lo=i+(n-this.hi),this}}else if(2===arguments.length){var u=arguments[0],l=arguments[1],n=null,i=null,h=null,c=null,r=null,s=null,o=null,a=null;r=this.hi+u,h=this.lo+l,o=r-this.hi,a=h-this.lo,s=r-o,c=h-a,s=u-o+(this.hi-s),c=l-a+(this.lo-c),o=s+h,n=r+o,i=o+(r-n),o=c+i;var f=n+o,g=o+(n-f);return this.hi=f,this.lo=g,this}},selfMultiply:function(){if(1===arguments.length){if(arguments[0]instanceof O){var t=arguments[0];return this.selfMultiply(t.hi,t.lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=null,s=null,o=null,a=null,u=null,l=null;u=O.SPLIT*this.hi,r=u-this.hi,l=O.SPLIT*n,r=u-r,s=this.hi-r,o=l-n,u=this.hi*n,o=l-o,a=n-o,l=r*o-u+r*a+s*o+s*a+(this.hi*i+this.lo*n);var h=u+l;r=u-h;var c=l+r;return this.hi=h,this.lo=c,this}},selfSqr:function(){return this.selfMultiply(this)},floor:function(){if(this.isNaN())return O.NaN;var t=Math.floor(this.hi),e=0;return t===this.hi&&(e=Math.floor(this.lo)),new O(t,e)},negate:function(){return this.isNaN()?this:new O(-this.hi,-this.lo)},clone:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}},multiply:function(){if(arguments[0]instanceof O){var t=arguments[0];return t.isNaN()?O.createNaN():O.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return i.isNaN(e)?O.createNaN():O.copy(this).selfMultiply(e,0)}},isNaN:function(){return i.isNaN(this.hi)},intValue:function(){return Math.trunc(this.hi)},toString:function(){var t=O.magnitude(this.hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},toStandardNotation:function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),i=e[0]+1,r=n;if("."===n.charAt(0))r="0"+n;else if(i<0)r="0."+O.stringOfChar("0",-i)+n;else if(-1===n.indexOf(".")){var s=i-n.length,o=O.stringOfChar("0",s);r=n+o+".0"}return this.isNegative()?"-"+r:r},reciprocal:function(){var t=null,e=null,n=null,i=null,r=null,s=null,o=null,a=null;r=1/this.hi,s=O.SPLIT*r,t=s-r,a=O.SPLIT*this.hi,t=s-t,e=r-t,n=a-this.hi,o=r*this.hi,n=a-n,i=this.hi-n,a=t*n-o+t*i+e*n+e*i,s=(1-o-a-r*this.lo)/this.hi;var u=r+s;return new O(u,r-u+s)},toSciNotation:function(){if(this.isZero())return O.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),i=O.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new IllegalStateException("Found leading zero: "+n);var r="";n.length>1&&(r=n.substring(1));var s=n.charAt(0)+"."+r;return this.isNegative()?"-"+s+i:s+i},abs:function(){return this.isNaN()?O.NaN:this.isNegative()?this.negate():new O(this)},isPositive:function(){return this.hi>0||0===this.hi&&this.lo>0},lt:function(t){return this.hi<t.hi||this.hi===t.hi&&this.lo<t.lo},add:function(){if(arguments[0]instanceof O){var t=arguments[0];return O.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return O.copy(this).selfAdd(e)}},init:function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this.hi=t,this.lo=0}else if(arguments[0]instanceof O){var e=arguments[0];this.hi=e.hi,this.lo=e.lo}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];this.hi=n,this.lo=i}},gt:function(t){return this.hi>t.hi||this.hi===t.hi&&this.lo>t.lo},isNegative:function(){return this.hi<0||0===this.hi&&this.lo<0},trunc:function(){return this.isNaN()?O.NaN:this.isPositive()?this.floor():this.ceil()},signum:function(){return this.hi>0?1:this.hi<0?-1:this.lo>0?1:this.lo<0?-1:0},interfaces_:function(){return[a,r,s]},getClass:function(){return O}}),O.sqr=function(t){return O.valueOf(t).selfMultiply(t)},O.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return O.parse(t)}if("number"==typeof arguments[0]){return new O(arguments[0])}},O.sqrt=function(t){return O.valueOf(t).sqrt()},O.parse=function(t){for(var e=0,n=t.length;T.isWhitespace(t.charAt(e));)e++;var i=!1;if(e<n){var r=t.charAt(e);"-"!==r&&"+"!==r||(e++,"-"===r&&(i=!0))}for(var s=new O,o=0,a=0,u=0;;){if(e>=n)break;var l=t.charAt(e);if(e++,T.isDigit(l)){var h=l-"0";s.selfMultiply(O.TEN),s.selfAdd(h),o++}else{if("."!==l){if("e"===l||"E"===l){var c=t.substring(e);try{u=R.parseInt(c)}catch(e){throw e instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+c+" in string "+t):e}break}throw new NumberFormatException("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=o}}var f=s,g=o-a-u;if(0===g)f=s;else if(g>0){var d=O.TEN.pow(g);f=s.divide(d)}else if(g<0){var d=O.TEN.pow(-g);f=s.multiply(d)}return i?f.negate():f},O.createNaN=function(){return new O(i.NaN,i.NaN)},O.copy=function(t){return new O(t)},O.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),i=Math.trunc(Math.floor(n));return 10*Math.pow(10,i)<=e&&(i+=1),i},O.stringOfChar=function(t,e){for(var n=new w,i=0;i<e;i++)n.append(t);return n.toString()},O.PI=new O(3.141592653589793,1.2246467991473532e-16),O.TWO_PI=new O(6.283185307179586,2.4492935982947064e-16),O.PI_2=new O(1.5707963267948966,6.123233995736766e-17),O.E=new O(2.718281828459045,1.4456468917292502e-16),O.NaN=new O(i.NaN,i.NaN),O.EPS=1.23259516440783e-32,O.SPLIT=134217729,O.MAX_PRINT_DIGITS=32,O.TEN=O.valueOf(10),O.ONE=O.valueOf(1),O.SCI_NOT_EXPONENT_CHAR="E",O.SCI_NOT_ZERO="0.0E0",io(P.prototype,{interfaces_:function(){return[]},getClass:function(){return P}}),P.orientationIndex=function(t,e,n){var i=P.orientationIndexFilter(t,e,n);if(i<=1)return i;var r=O.valueOf(e.x).selfAdd(-t.x),s=O.valueOf(e.y).selfAdd(-t.y),o=O.valueOf(n.x).selfAdd(-e.x),a=O.valueOf(n.y).selfAdd(-e.y);return r.selfMultiply(a).selfSubtract(s.selfMultiply(o)).signum()},P.signOfDet2x2=function(t,e,n,i){return t.multiply(i).selfSubtract(e.multiply(n)).signum()},P.intersection=function(t,e,n,i){var r=O.valueOf(i.y).selfSubtract(n.y).selfMultiply(O.valueOf(e.x).selfSubtract(t.x)),s=O.valueOf(i.x).selfSubtract(n.x).selfMultiply(O.valueOf(e.y).selfSubtract(t.y)),o=r.subtract(s),a=O.valueOf(i.x).selfSubtract(n.x).selfMultiply(O.valueOf(t.y).selfSubtract(n.y)),u=O.valueOf(i.y).selfSubtract(n.y).selfMultiply(O.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u),h=l.selfDivide(o).doubleValue(),f=O.valueOf(t.x).selfAdd(O.valueOf(e.x).selfSubtract(t.x).selfMultiply(h)).doubleValue(),g=O.valueOf(e.x).selfSubtract(t.x).selfMultiply(O.valueOf(t.y).selfSubtract(n.y)),d=O.valueOf(e.y).selfSubtract(t.y).selfMultiply(O.valueOf(t.x).selfSubtract(n.x)),p=g.subtract(d),m=p.selfDivide(o).doubleValue();return new c(f,O.valueOf(n.y).selfAdd(O.valueOf(i.y).selfSubtract(n.y).selfMultiply(m)).doubleValue())},P.orientationIndexFilter=function(t,e,n){var i=null,r=(t.x-n.x)*(e.y-n.y),s=(t.y-n.y)*(e.x-n.x),o=r-s;if(r>0){if(s<=0)return P.signum(o);i=r+s}else{if(!(r<0))return P.signum(o);if(s>=0)return P.signum(o);i=-r-s}var a=P.DP_SAFE_EPSILON*i;return o>=a||-o>=a?P.signum(o):2},P.signum=function(t){return t>0?1:t<0?-1:0},P.DP_SAFE_EPSILON=1e-15,io(b.prototype,{setOrdinate:function(t,e,n){},size:function(){},getOrdinate:function(t,e){},getCoordinate:function(){if(1===arguments.length){arguments[0]}else if(2===arguments.length){arguments[0],arguments[1]}},getCoordinateCopy:function(t){},getDimension:function(){},getX:function(t){},clone:function(){},expandEnvelope:function(t){},copy:function(){},getY:function(t){},toCoordinateArray:function(){},interfaces_:function(){return[s]},getClass:function(){return b}}),b.X=0,b.Y=1,b.Z=2,b.M=3,_.arraycopy=function(t,e,n,i,r){for(var s=0,o=e;o<e+r;o++)n[i+s]=t[o],s++},_.getProperty=function(t){return{"line.separator":"\n"}[t]},io(M.prototype,{getY:function(){var t=this.y/this.w;if(i.isNaN(t)||i.isInfinite(t))throw new C;return t},getX:function(){var t=this.x/this.w;if(i.isNaN(t)||i.isInfinite(t))throw new C;return t},getCoordinate:function(){var t=new c;return t.x=this.getX(),t.y=this.getY(),t},interfaces_:function(){return[]},getClass:function(){return M}}),M.intersection=function(t,e,n,r){var s=t.y-e.y,o=e.x-t.x,a=t.x*e.y-e.x*t.y,u=n.y-r.y,l=r.x-n.x,h=n.x*r.y-r.x*n.y,f=o*h-l*a,g=u*a-s*h,d=s*l-u*o,p=f/d,m=g/d;if(i.isNaN(p)||i.isInfinite(p)||i.isNaN(m)||i.isInfinite(m))throw new C;return new c(p,m)},io(D.prototype,{create:function(){if(1===arguments.length){if(arguments[0]instanceof Array){arguments[0]}else if(oo(arguments[0],b)){arguments[0]}}else if(2===arguments.length){arguments[0],arguments[1]}},interfaces_:function(){return[]},getClass:function(){return D}}),io(A.prototype,{filter:function(t){},interfaces_:function(){return[]},getClass:function(){return A}}),io(F.prototype,{isGeometryCollection:function(){return this.getSortIndex()===F.SORTINDEX_GEOMETRYCOLLECTION},getFactory:function(){return this.factory},getGeometryN:function(t){return this},getArea:function(){return 0},isRectangle:function(){return!1},equals:function(){if(1===arguments.length){if(arguments[0]instanceof F){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof F))return!1;var n=e;return this.equalsExact(n)}}},equalsExact:function(t){return this===t||this.equalsExact(t,0)},geometryChanged:function(){this.apply(F.geometryChangedFilter)},geometryChangedAction:function(){this.envelope=null},equalsNorm:function(t){return null!==t&&this.norm().equalsExact(t.norm())},getLength:function(){return 0},getNumGeometries:function(){return 1},compareTo:function(){if(1===arguments.length){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(2===arguments.length){var n=arguments[0],i=arguments[1],e=n;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(n,i)}},getUserData:function(){return this.userData},getSRID:function(){return this.SRID},getEnvelope:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},checkNotGeometryCollection:function(t){if(t.getSortIndex()===F.SORTINDEX_GEOMETRYCOLLECTION)throw new n("This method does not support GeometryCollection arguments")},equal:function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},norm:function(){var t=this.copy();return t.normalize(),t},getPrecisionModel:function(){return this.factory.getPrecisionModel()},getEnvelopeInternal:function(){return null===this.envelope&&(this.envelope=this.computeEnvelopeInternal()),new I(this.envelope)},setSRID:function(t){this.SRID=t},setUserData:function(t){this.userData=t},compare:function(t,e){for(var n=t.iterator(),i=e.iterator();n.hasNext()&&i.hasNext();){var r=n.next(),s=i.next(),o=r.compareTo(s);if(0!==o)return o}return n.hasNext()?1:i.hasNext()?-1:0},hashCode:function(){return this.getEnvelopeInternal().hashCode()},isGeometryCollectionOrDerived:function(){return this.getSortIndex()===F.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===F.SORTINDEX_MULTIPOINT||this.getSortIndex()===F.SORTINDEX_MULTILINESTRING||this.getSortIndex()===F.SORTINDEX_MULTIPOLYGON},interfaces_:function(){return[s,r,a]},getClass:function(){return F}}),F.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},F.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},F.serialVersionUID=0x799ea46522854c00,F.SORTINDEX_POINT=0,F.SORTINDEX_MULTIPOINT=1,F.SORTINDEX_LINESTRING=2,F.SORTINDEX_LINEARRING=3,F.SORTINDEX_MULTILINESTRING=4,F.SORTINDEX_POLYGON=5,F.SORTINDEX_MULTIPOLYGON=6,F.SORTINDEX_GEOMETRYCOLLECTION=7,F.geometryChangedFilter={interfaces_:function(){return[A]},filter:function(t){t.geometryChangedAction()}},io(G.prototype,{filter:function(t){},interfaces_:function(){return[]},getClass:function(){return G}}),io(q.prototype,{isInBoundary:function(t){},interfaces_:function(){return[]},getClass:function(){return q}}),io(B.prototype,{isInBoundary:function(t){return t%2==1},interfaces_:function(){return[q]},getClass:function(){return B}}),io(V.prototype,{isInBoundary:function(t){return t>0},interfaces_:function(){return[q]},getClass:function(){return V}}),io(z.prototype,{isInBoundary:function(t){return t>1},interfaces_:function(){return[q]},getClass:function(){return z}}),io(k.prototype,{isInBoundary:function(t){return 1===t},interfaces_:function(){return[q]},getClass:function(){return k}}),q.Mod2BoundaryNodeRule=B,q.EndPointBoundaryNodeRule=V,q.MultiValentEndPointBoundaryNodeRule=z,q.MonoValentEndPointBoundaryNodeRule=k,q.MOD2_BOUNDARY_RULE=new B,q.ENDPOINT_BOUNDARY_RULE=new V,q.MULTIVALENT_ENDPOINT_BOUNDARY_RULE=new z,q.MONOVALENT_ENDPOINT_BOUNDARY_RULE=new k,q.OGC_SFS_BOUNDARY_RULE=q.MOD2_BOUNDARY_RULE,io(Y.prototype,{interfaces_:function(){return[]},getClass:function(){return Y}}),Y.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},Y.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var i=t[n];if(Y.indexOf(i,e)<0)return i}return null},Y.scroll=function(t,e){var n=Y.indexOf(e,t);if(n<0)return null;var i=new Array(t.length).fill(null);_.arraycopy(t,n,i,0,t.length-n),_.arraycopy(t,0,i,t.length-n,n),_.arraycopy(i,0,t,0,t.length)},Y.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(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(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];if(i===r)return!0;if(null===i||null===r)return!1;if(i.length!==r.length)return!1;for(var n=0;n<i.length;n++)if(0!==s.compare(i[n],r[n]))return!1;return!0}},Y.intersection=function(t,e){for(var n=new E,i=0;i<t.length;i++)e.intersects(t[i])&&n.add(t[i],!0);return n.toCoordinateArray()},Y.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},Y.removeRepeatedPoints=function(t){return Y.hasRepeatedPoints(t)?new E(t,!1).toCoordinateArray():t},Y.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),i=0;i<=n;i++){var r=t[i];t[i]=t[e-i],t[e-i]=r}},Y.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var i=new Array(e).fill(null);if(0===e)return i;for(var r=0,n=0;n<t.length;n++)null!==t[n]&&(i[r++]=t[n]);return i},Y.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new c(t[n]);return e}if(5===arguments.length)for(var i=arguments[0],r=arguments[1],s=arguments[2],o=arguments[3],a=arguments[4],n=0;n<a;n++)s[o+n]=new c(i[r+n])},Y.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var i=t[n],r=e[t.length-n-1];if(0!==i.compareTo(r))return!1}return!0},Y.envelope=function(t){for(var e=new I,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},Y.toCoordinateArray=function(t){return t.toArray(Y.coordArrayType)},Y.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},Y.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},Y.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,i=t[e].compareTo(t[n]);if(0!==i)return i}return 1},Y.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var i=t[n].compareTo(e[n]);if(0!==i)return i;n++}return n<e.length?-1:n<t.length?1:0},Y.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e},Y.extract=function(t,e,n){e=L.clamp(e,0,t.length),n=L.clamp(n,-1,t.length);var i=n-e+1;n<0&&(i=0),e>=t.length&&(i=0),n<e&&(i=0);var r=new Array(i).fill(null);if(0===i)return r;for(var s=0,o=e;o<=n;o++)r[s++]=t[o];return r},io(U.prototype,{compare:function(t,e){var n=t,i=e;return Y.compare(n,i)},interfaces_:function(){return[o]},getClass:function(){return U}}),io(X.prototype,{compare:function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(0===n.length)return 0;var r=Y.compare(n,i);return Y.isEqualReversed(n,i)?0:r},OLDcompare:function(t,e){var n=t,i=e;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(0===n.length)return 0;for(var r=Y.increasingDirection(n),s=Y.increasingDirection(i),o=r>0?0:n.length-1,a=s>0?0:n.length-1,u=0;u<n.length;u++){var l=n[o].compareTo(i[a]);if(0!==l)return l;o+=r,a+=s}return 0},interfaces_:function(){return[o]},getClass:function(){return X}}),Y.ForwardComparator=U,Y.BidirectionalComparator=X,Y.coordArrayType=new Array(0).fill(null),H.prototype.get=function(){},H.prototype.put=function(){},H.prototype.size=function(){},H.prototype.values=function(){},H.prototype.entrySet=function(){},W.prototype=new H,j.prototype=new d,j.prototype.contains=function(){},K.prototype=new j,K.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(this.array_[e]===t)return!0}return!1},K.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},K.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},K.prototype.remove=function(t){throw new javascript.util.OperationNotSupported},K.prototype.size=function(){return this.array_.length},K.prototype.isEmpty=function(){return 0===this.array_.length},K.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},K.prototype.iterator=function(){return new ao(this)};var ao=function(t){this.hashSet_=t,this.position_=0};ao.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new v;return this.hashSet_.array_[this.position_++]},ao.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},ao.prototype.remove=function(){throw new y};var uo=0;et.prototype=new W,et.prototype.get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},et.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:uo,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,i,r=this.root_;do{if(n=r,(i=t.compareTo(r.key))<0)r=r.left;else{if(!(i>0)){var s=r.value;return r.value=e,s}r=r.right}}while(null!==r);var o={key:t,left:null,right:null,value:e,parent:n,color:uo,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?n.left=o:n.right=o,this.fixAfterInsertion(o),this.size_++,null},et.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!=this.root_&&1==t.parent.color;)if(Q(t)==$(Q(Q(t)))){var e=tt(Q(Q(t)));1==Z(e)?(J(Q(t),uo),J(e,uo),J(Q(Q(t)),1),t=Q(Q(t))):(t==tt(Q(t))&&(t=Q(t),this.rotateLeft(t)),J(Q(t),uo),J(Q(Q(t)),1),this.rotateRight(Q(Q(t))))}else{var e=$(Q(Q(t)));1==Z(e)?(J(Q(t),uo),J(e,uo),J(Q(Q(t)),1),t=Q(Q(t))):(t==$(Q(t))&&(t=Q(t),this.rotateRight(t)),J(Q(t),uo),J(Q(Q(t)),1),this.rotateLeft(Q(Q(t))))}this.root_.color=uo},et.prototype.values=function(){var t=new x,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=et.successor(e));)t.add(e.value);return t},et.prototype.entrySet=function(){var t=new K,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=et.successor(e));)t.add(e);return t},et.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null==t.parent?this.root_=e:t.parent.left==t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},et.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null==t.parent?this.root_=e:t.parent.right==t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},et.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},et.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var e=t.parent,n=t;null!==e&&n===e.right;)n=e,e=e.parent;return e},et.prototype.size=function(){return this.size_},io(nt.prototype,{interfaces_:function(){return[]},getClass:function(){return nt}}),it.prototype=new j,rt.prototype=new it,rt.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},rt.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},rt.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},rt.prototype.remove=function(t){throw new y},rt.prototype.size=function(){return this.array_.length},rt.prototype.isEmpty=function(){return 0===this.array_.length},rt.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},rt.prototype.iterator=function(){return new lo(this)};var lo=function(t){this.treeSet_=t,this.position_=0};lo.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new v;return this.treeSet_.array_[this.position_++]},lo.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},lo.prototype.remove=function(){throw new y},st.sort=function(){var t,e,n,i,r=arguments[0];if(1===arguments.length)return i=function(t,e){return t.compareTo(e)},void r.sort(i);if(2===arguments.length)n=arguments[1],i=function(t,e){return n.compare(t,e)},r.sort(i);else{if(3===arguments.length){e=r.slice(arguments[1],arguments[2]),e.sort();var s=r.slice(0,arguments[1]).concat(e,r.slice(arguments[2],r.length));for(r.splice(0,r.length),t=0;t<s.length;t++)r.push(s[t]);return}if(4===arguments.length){for(e=r.slice(arguments[1],arguments[2]),n=arguments[3],i=function(t,e){return n.compare(t,e)},e.sort(i),s=r.slice(0,arguments[1]).concat(e,r.slice(arguments[2],r.length)),r.splice(0,r.length),t=0;t<s.length;t++)r.push(s[t]);return}}},st.asList=function(t){for(var e=new x,n=0,i=t.length;n<i;n++)e.add(t[n]);return e},io(ot.prototype,{interfaces_:function(){return[]},getClass:function(){return ot}}),ot.toDimensionSymbol=function(t){switch(t){case ot.FALSE:return ot.SYM_FALSE;case ot.TRUE:return ot.SYM_TRUE;case ot.DONTCARE:return ot.SYM_DONTCARE;case ot.P:return ot.SYM_P;case ot.L:return ot.SYM_L;case ot.A:return ot.SYM_A}throw new n("Unknown dimension value: "+t)},ot.toDimensionValue=function(t){switch(T.toUpperCase(t)){case ot.SYM_FALSE:return ot.FALSE;case ot.SYM_TRUE:return ot.TRUE;case ot.SYM_DONTCARE:return ot.DONTCARE;case ot.SYM_P:return ot.P;case ot.SYM_L:return ot.L;case ot.SYM_A:return ot.A}throw new n("Unknown dimension symbol: "+t)},ot.P=0,ot.L=1,ot.A=2,ot.FALSE=-1,ot.TRUE=-2,ot.DONTCARE=-3,ot.SYM_FALSE="F",ot.SYM_TRUE="T",ot.SYM_DONTCARE="*",ot.SYM_P="0",ot.SYM_L="1",ot.SYM_A="2",io(at.prototype,{filter:function(t){},interfaces_:function(){return[]},getClass:function(){return at}}),io(ut.prototype,{filter:function(t,e){},isDone:function(){},isGeometryChanged:function(){},interfaces_:function(){return[]},getClass:function(){return ut}}),ro(lt,F),io(lt.prototype,{computeEnvelopeInternal:function(){for(var t=new I,e=0;e<this.geometries.length;e++)t.expandToInclude(this.geometries[e].getEnvelopeInternal());return t},getGeometryN:function(t){return this.geometries[t]},getSortIndex:function(){return F.SORTINDEX_GEOMETRYCOLLECTION},getCoordinates:function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this.geometries.length;n++)for(var i=this.geometries[n].getCoordinates(),r=0;r<i.length;r++)e++,t[e]=i[r];return t},getArea:function(){for(var t=0,e=0;e<this.geometries.length;e++)t+=this.geometries[e].getArea();return t},equalsExact:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this.geometries.length!==n.geometries.length)return!1;for(var i=0;i<this.geometries.length;i++)if(!this.geometries[i].equalsExact(n.geometries[i],e))return!1;return!0}return F.prototype.equalsExact.apply(this,arguments)},normalize:function(){for(var t=0;t<this.geometries.length;t++)this.geometries[t].normalize();st.sort(this.geometries)},getCoordinate:function(){return this.isEmpty()?null:this.geometries[0].getCoordinate()},getBoundaryDimension:function(){for(var t=ot.FALSE,e=0;e<this.geometries.length;e++)t=Math.max(t,this.geometries[e].getBoundaryDimension());return t},getDimension:function(){for(var t=ot.FALSE,e=0;e<this.geometries.length;e++)t=Math.max(t,this.geometries[e].getDimension());return t},getLength:function(){for(var t=0,e=0;e<this.geometries.length;e++)t+=this.geometries[e].getLength();return t},getNumPoints:function(){for(var t=0,e=0;e<this.geometries.length;e++)t+=this.geometries[e].getNumPoints();return t},getNumGeometries:function(){return this.geometries.length},reverse:function(){for(var t=this.geometries.length,e=new Array(t).fill(null),n=0;n<this.geometries.length;n++)e[n]=this.geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},compareToSameClass:function(){if(1===arguments.length){var t=arguments[0],e=new rt(st.asList(this.geometries)),n=new rt(st.asList(t.geometries));return this.compare(e,n)}if(2===arguments.length){for(var i=arguments[0],r=arguments[1],s=i,o=this.getNumGeometries(),a=s.getNumGeometries(),u=0;u<o&&u<a;){var l=this.getGeometryN(u),h=s.getGeometryN(u),c=l.compareToSameClass(h,r);if(0!==c)return c;u++}return u<o?1:u<a?-1:0}},apply:function(){if(oo(arguments[0],G))for(var t=arguments[0],e=0;e<this.geometries.length;e++)this.geometries[e].apply(t);else if(oo(arguments[0],ut)){
var n=arguments[0];if(0===this.geometries.length)return null;for(var e=0;e<this.geometries.length&&(this.geometries[e].apply(n),!n.isDone());e++);n.isGeometryChanged()&&this.geometryChanged()}else if(oo(arguments[0],at)){var i=arguments[0];i.filter(this);for(var e=0;e<this.geometries.length;e++)this.geometries[e].apply(i)}else if(oo(arguments[0],A)){var r=arguments[0];r.filter(this);for(var e=0;e<this.geometries.length;e++)this.geometries[e].apply(r)}},getBoundary:function(){return this.checkNotGeometryCollection(this),h.shouldNeverReachHere(),null},clone:function(){var t=F.prototype.clone.call(this);t.geometries=new Array(this.geometries.length).fill(null);for(var e=0;e<this.geometries.length;e++)t.geometries[e]=this.geometries[e].clone();return t},getGeometryType:function(){return"GeometryCollection"},copy:function(){for(var t=new Array(this.geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this.geometries[e].copy();return new lt(t,this.factory)},isEmpty:function(){for(var t=0;t<this.geometries.length;t++)if(!this.geometries[t].isEmpty())return!1;return!0},interfaces_:function(){return[]},getClass:function(){return lt}}),lt.serialVersionUID=-0x4f07bcb1f857d800,ro(ht,lt),io(ht.prototype,{getSortIndex:function(){return F.SORTINDEX_MULTILINESTRING},equalsExact:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&lt.prototype.equalsExact.call(this,t,e)}return lt.prototype.equalsExact.apply(this,arguments)},getBoundaryDimension:function(){return this.isClosed()?ot.FALSE:0},isClosed:function(){if(this.isEmpty())return!1;for(var t=0;t<this.geometries.length;t++)if(!this.geometries[t].isClosed())return!1;return!0},getDimension:function(){return 1},reverse:function(){for(var t=this.geometries.length,e=new Array(t).fill(null),n=0;n<this.geometries.length;n++)e[t-1-n]=this.geometries[n].reverse();return this.getFactory().createMultiLineString(e)},getBoundary:function(){return new ct(this).getBoundary()},getGeometryType:function(){return"MultiLineString"},copy:function(){for(var t=new Array(this.geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this.geometries[e].copy();return new ht(t,this.factory)},interfaces_:function(){return[nt]},getClass:function(){return ht}}),ht.serialVersionUID=0x7155d2ab4afa8000,io(ct.prototype,{boundaryMultiLineString:function(t){if(this.geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this.geomFact.createPoint(e[0]):this.geomFact.createMultiPointFromCoords(e)},getBoundary:function(){return this.geom instanceof It?this.boundaryLineString(this.geom):this.geom instanceof ht?this.boundaryMultiLineString(this.geom):this.geom.getBoundary()},boundaryLineString:function(t){if(this.geom.isEmpty())return this.getEmptyMultiPoint();if(t.isClosed()){return this.bnRule.isInBoundary(2)?t.getStartPoint():this.geomFact.createMultiPoint()}return this.geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},getEmptyMultiPoint:function(){return this.geomFact.createMultiPoint()},computeBoundaryCoordinates:function(t){var e=new x;this.endpointMap=new et;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);0!==i.getNumPoints()&&(this.addEndpoint(i.getCoordinateN(0)),this.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var r=this.endpointMap.entrySet().iterator();r.hasNext();){var s=r.next(),o=s.getValue(),a=o.count;this.bnRule.isInBoundary(a)&&e.add(s.getKey())}return Y.toCoordinateArray(e)},addEndpoint:function(t){var e=this.endpointMap.get(t);null===e&&(e=new ft,this.endpointMap.put(t,e)),e.count++},interfaces_:function(){return[]},getClass:function(){return ct}}),ct.getBoundary=function(){if(1===arguments.length){var t=arguments[0],e=new ct(t);return e.getBoundary()}if(2===arguments.length){var n=arguments[0],i=arguments[1],e=new ct(n,i);return e.getBoundary()}},io(ft.prototype,{interfaces_:function(){return[]},getClass:function(){return ft}}),io(xt.prototype,{interfaces_:function(){return[]},getClass:function(){return xt}}),xt.chars=function(t,e){for(var n=new Array(e).fill(null),i=0;i<e;i++)n[i]=t;return new String(n)},xt.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new mt,n=new gt(e);return t.printStackTrace(n),e.toString()}if(2===arguments.length){for(var i=arguments[0],r=arguments[1],s="",o=new dt(xt.getStackTrace(i)),a=new yt(o),u=0;u<r;u++)try{s+=a.readLine()+xt.NEWLINE}catch(t){if(!(t instanceof vt))throw t;h.shouldNeverReachHere()}return s}},xt.split=function(t,e){for(var n=e.length,i=new x,r=""+t,s=r.indexOf(e);s>=0;){var o=r.substring(0,s);i.add(o),r=r.substring(s+n),s=r.indexOf(e)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),u=0;u<a.length;u++)a[u]=i.get(u);return a},xt.toString=function(){if(1===arguments.length){var t=arguments[0];return xt.SIMPLE_ORDINATE_FORMAT.format(t)}},xt.spaces=function(t){return xt.chars(" ",t)},xt.NEWLINE=_.getProperty("line.separator"),xt.SIMPLE_ORDINATE_FORMAT=new pt("0.#"),io(Et.prototype,{interfaces_:function(){return[]},getClass:function(){return Et}}),Et.copyCoord=function(t,e,n,i){for(var r=Math.min(t.getDimension(),n.getDimension()),s=0;s<r;s++)n.setOrdinate(i,s,t.getOrdinate(e,s))},Et.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,b.X)===t.getOrdinate(e-1,b.X)&&t.getOrdinate(0,b.Y)===t.getOrdinate(e-1,b.Y))},Et.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),s=0;s<n;s++)for(var o=0;o<r;o++){var a=t.getOrdinate(s,o),u=e.getOrdinate(s,o);if(t.getOrdinate(s,o)!==e.getOrdinate(s,o)&&(!i.isNaN(a)||!i.isNaN(u)))return!1}return!0},Et.extend=function(t,e,n){var i=t.create(n,e.getDimension()),r=e.size();if(Et.copy(e,0,i,0,r),r>0)for(var s=r;s<n;s++)Et.copy(e,r-1,i,s,1);return i},Et.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),i=0;i<=n;i++)Et.swap(t,i,e-i)},Et.swap=function(t,e,n){if(e===n)return null;for(var i=0;i<t.getDimension();i++){var r=t.getOrdinate(e,i);t.setOrdinate(e,i,t.getOrdinate(n,i)),t.setOrdinate(n,i,r)}},Et.copy=function(t,e,n,i,r){for(var s=0;s<r;s++)Et.copyCoord(t,e+s,n,i+s)},Et.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),i=new w;i.append("(");for(var r=0;r<e;r++){r>0&&i.append(" ");for(var s=0;s<n;s++)s>0&&i.append(","),i.append(xt.toString(t.getOrdinate(r,s)))}return i.append(")"),i.toString()}},Et.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Et.createClosedRing(t,e,4):e.getOrdinate(0,b.X)===e.getOrdinate(n-1,b.X)&&e.getOrdinate(0,b.Y)===e.getOrdinate(n-1,b.Y)?e:Et.createClosedRing(t,e,n+1)},Et.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),r=e.size();Et.copy(e,0,i,0,r);for(var s=r;s<n;s++)Et.copy(e,0,i,s,1);return i},ro(It,F),io(It.prototype,{computeEnvelopeInternal:function(){return this.isEmpty()?new I:this.points.expandEnvelope(new I)},isRing:function(){return this.isClosed()&&this.isSimple()},getSortIndex:function(){return F.SORTINDEX_LINESTRING},getCoordinates:function(){return this.points.toCoordinateArray()},equalsExact:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this.points.size()!==n.points.size())return!1;for(var i=0;i<this.points.size();i++)if(!this.equal(this.points.getCoordinate(i),n.points.getCoordinate(i),e))return!1;return!0}return F.prototype.equalsExact.apply(this,arguments)},normalize:function(){for(var t=0;t<Math.trunc(this.points.size()/2);t++){var e=this.points.size()-1-t;if(!this.points.getCoordinate(t).equals(this.points.getCoordinate(e)))return this.points.getCoordinate(t).compareTo(this.points.getCoordinate(e))>0&&Et.reverse(this.points),null}},getCoordinate:function(){return this.isEmpty()?null:this.points.getCoordinate(0)},getBoundaryDimension:function(){return this.isClosed()?ot.FALSE:0},isClosed:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},getEndPoint:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},getDimension:function(){return 1},getLength:function(){return oe.computeLength(this.points)},getNumPoints:function(){return this.points.size()},reverse:function(){var t=this.points.copy();return Et.reverse(t),this.getFactory().createLineString(t)},compareToSameClass:function(){if(1===arguments.length){for(var t=arguments[0],e=t,n=0,i=0;n<this.points.size()&&i<e.points.size();){var r=this.points.getCoordinate(n).compareTo(e.points.getCoordinate(i));if(0!==r)return r;n++,i++}return n<this.points.size()?1:i<e.points.size()?-1:0}if(2===arguments.length){var s=arguments[0],o=arguments[1],e=s;return o.compare(this.points,e.points)}},apply:function(){if(oo(arguments[0],G))for(var t=arguments[0],e=0;e<this.points.size();e++)t.filter(this.points.getCoordinate(e));else if(oo(arguments[0],ut)){var n=arguments[0];if(0===this.points.size())return null;for(var e=0;e<this.points.size()&&(n.filter(this.points,e),!n.isDone());e++);n.isGeometryChanged()&&this.geometryChanged()}else if(oo(arguments[0],at)){var i=arguments[0];i.filter(this)}else if(oo(arguments[0],A)){var r=arguments[0];r.filter(this)}},getBoundary:function(){return new ct(this).getBoundary()},isEquivalentClass:function(t){return t instanceof It},clone:function(){var t=F.prototype.clone.call(this);return t.points=this.points.clone(),t},getCoordinateN:function(t){return this.points.getCoordinate(t)},getGeometryType:function(){return"LineString"},copy:function(){return new It(this.points.copy(),this.factory)},getCoordinateSequence:function(){return this.points},isEmpty:function(){return 0===this.points.size()},init:function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new n("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this.points=t},isCoordinate:function(t){for(var e=0;e<this.points.size();e++)if(this.points.getCoordinate(e).equals(t))return!0;return!1},getStartPoint:function(){return this.isEmpty()?null:this.getPointN(0)},getPointN:function(t){return this.getFactory().createPoint(this.points.getCoordinate(t))},interfaces_:function(){return[nt]},getClass:function(){return It}}),It.serialVersionUID=0x2b2b51ba435c8e00,io(Nt.prototype,{interfaces_:function(){return[]},getClass:function(){return Nt}}),ro(Ct,F),io(Ct.prototype,{computeEnvelopeInternal:function(){if(this.isEmpty())return new I;var t=new I;return t.expandToInclude(this.coordinates.getX(0),this.coordinates.getY(0)),t},getSortIndex:function(){return F.SORTINDEX_POINT},getCoordinates:function(){return this.isEmpty()?[]:[this.getCoordinate()]},equalsExact:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&(!(!this.isEmpty()||!t.isEmpty())||this.isEmpty()===t.isEmpty()&&this.equal(t.getCoordinate(),this.getCoordinate(),e))}return F.prototype.equalsExact.apply(this,arguments)},normalize:function(){},getCoordinate:function(){return 0!==this.coordinates.size()?this.coordinates.getCoordinate(0):null},getBoundaryDimension:function(){return ot.FALSE},getDimension:function(){return 0},getNumPoints:function(){return this.isEmpty()?0:1},reverse:function(){return this.copy()},getX:function(){if(null===this.getCoordinate())throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x},compareToSameClass:function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getCoordinate().compareTo(e.getCoordinate())}if(2===arguments.length){var n=arguments[0],i=arguments[1],e=n;return i.compare(this.coordinates,e.coordinates)}},apply:function(){if(oo(arguments[0],G)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(oo(arguments[0],ut)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this.coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(oo(arguments[0],at)){var n=arguments[0];n.filter(this)}else if(oo(arguments[0],A)){var i=arguments[0];i.filter(this)}},getBoundary:function(){return this.getFactory().createGeometryCollection(null)},clone:function(){var t=F.prototype.clone.call(this);return t.coordinates=this.coordinates.clone(),t},getGeometryType:function(){return"Point"},copy:function(){return new Ct(this.coordinates.copy(),this.factory)},getCoordinateSequence:function(){return this.coordinates},getY:function(){if(null===this.getCoordinate())throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y},isEmpty:function(){return 0===this.coordinates.size()},init:function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),h.isTrue(t.size()<=1),this.coordinates=t},isSimple:function(){return!0},interfaces_:function(){return[Nt]},getClass:function(){return Ct}}),Ct.serialVersionUID=0x44077bad161cbc00,io(St.prototype,{interfaces_:function(){return[]},getClass:function(){return St}}),ro(Lt,F),io(Lt.prototype,{computeEnvelopeInternal:function(){return this.shell.getEnvelopeInternal()},getSortIndex:function(){return F.SORTINDEX_POLYGON},getCoordinates:function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this.shell.getCoordinates(),i=0;i<n.length;i++)e++,t[e]=n[i];for(var r=0;r<this.holes.length;r++)for(var s=this.holes[r].getCoordinates(),o=0;o<s.length;o++)e++,t[e]=s[o];return t},getArea:function(){var t=0;t+=Math.abs(oe.signedArea(this.shell.getCoordinateSequence()));for(var e=0;e<this.holes.length;e++)t-=Math.abs(oe.signedArea(this.holes[e].getCoordinateSequence()));return t},isRectangle:function(){if(0!==this.getNumInteriorRing())return!1;if(null===this.shell)return!1;if(5!==this.shell.getNumPoints())return!1;for(var t=this.shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var i=t.getX(n);if(i!==e.getMinX()&&i!==e.getMaxX())return!1;var r=t.getY(n);if(r!==e.getMinY()&&r!==e.getMaxY())return!1}for(var s=t.getX(0),o=t.getY(0),n=1;n<=4;n++){var i=t.getX(n),r=t.getY(n);if(i!==s===(r!==o))return!1;s=i,o=r}return!0},equalsExact:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t,i=this.shell,r=n.shell;if(!i.equalsExact(r,e))return!1;if(this.holes.length!==n.holes.length)return!1;for(var s=0;s<this.holes.length;s++)if(!this.holes[s].equalsExact(n.holes[s],e))return!1;return!0}return F.prototype.equalsExact.apply(this,arguments)},normalize:function(){if(0===arguments.length){this.normalize(this.shell,!0);for(var t=0;t<this.holes.length;t++)this.normalize(this.holes[t],!1);st.sort(this.holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var i=new Array(e.getCoordinates().length-1).fill(null);_.arraycopy(e.getCoordinates(),0,i,0,i.length);var r=Y.minCoordinate(e.getCoordinates());Y.scroll(i,r),_.arraycopy(i,0,e.getCoordinates(),0,i.length),e.getCoordinates()[i.length]=i[0],oe.isCCW(e.getCoordinates())===n&&Y.reverse(e.getCoordinates())}},getCoordinate:function(){return this.shell.getCoordinate()},getNumInteriorRing:function(){return this.holes.length},getBoundaryDimension:function(){return 1},getDimension:function(){return 2},getLength:function(){var t=0;t+=this.shell.getLength();for(var e=0;e<this.holes.length;e++)t+=this.holes[e].getLength();return t},getNumPoints:function(){for(var t=this.shell.getNumPoints(),e=0;e<this.holes.length;e++)t+=this.holes[e].getNumPoints();return t},reverse:function(){var t=this.copy();t.shell=this.shell.copy().reverse(),t.holes=new Array(this.holes.length).fill(null);for(var e=0;e<this.holes.length;e++)t.holes[e]=this.holes[e].copy().reverse();return t},convexHull:function(){return this.getExteriorRing().convexHull()},compareToSameClass:function(){if(1===arguments.length){var t=arguments[0],e=this.shell,n=t.shell;return e.compareToSameClass(n)}if(2===arguments.length){var i=arguments[0],r=arguments[1],s=i,e=this.shell,n=s.shell,o=e.compareToSameClass(n,r);if(0!==o)return o;for(var a=this.getNumInteriorRing(),u=s.getNumInteriorRing(),l=0;l<a&&l<u;){var h=this.getInteriorRingN(l),c=s.getInteriorRingN(l),f=h.compareToSameClass(c,r);if(0!==f)return f;l++}return l<a?1:l<u?-1:0}},apply:function(){if(oo(arguments[0],G)){var t=arguments[0];this.shell.apply(t);for(var e=0;e<this.holes.length;e++)this.holes[e].apply(t)}else if(oo(arguments[0],ut)){var n=arguments[0];if(this.shell.apply(n),!n.isDone())for(var e=0;e<this.holes.length&&(this.holes[e].apply(n),!n.isDone());e++);n.isGeometryChanged()&&this.geometryChanged()}else if(oo(arguments[0],at)){var i=arguments[0];i.filter(this)}else if(oo(arguments[0],A)){var r=arguments[0];r.filter(this),this.shell.apply(r);for(var e=0;e<this.holes.length;e++)this.holes[e].apply(r)}},getBoundary:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this.holes.length+1).fill(null);t[0]=this.shell;for(var e=0;e<this.holes.length;e++)t[e+1]=this.holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},clone:function(){var t=F.prototype.clone.call(this);t.shell=this.shell.clone(),t.holes=new Array(this.holes.length).fill(null);for(var e=0;e<this.holes.length;e++)t.holes[e]=this.holes[e].clone();return t},getGeometryType:function(){return"Polygon"},copy:function(){for(var t=this.shell.copy(),e=new Array(this.holes.length).fill(null),n=0;n<e.length;n++)e[n]=this.holes[n].copy();return new Lt(t,e,this.factory)},getExteriorRing:function(){return this.shell},isEmpty:function(){return this.shell.isEmpty()},getInteriorRingN:function(t){return this.holes[t]},interfaces_:function(){return[St]},getClass:function(){return Lt}}),Lt.serialVersionUID=-0x307ffefd8dc97200,ro(wt,lt),io(wt.prototype,{getSortIndex:function(){return F.SORTINDEX_MULTIPOINT},isValid:function(){return!0},equalsExact:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&lt.prototype.equalsExact.call(this,t,e)}return lt.prototype.equalsExact.apply(this,arguments)},getCoordinate:function(){if(1===arguments.length){var t=arguments[0];return this.geometries[t].getCoordinate()}return lt.prototype.getCoordinate.apply(this,arguments)},getBoundaryDimension:function(){return ot.FALSE},getDimension:function(){return 0},getBoundary:function(){return this.getFactory().createGeometryCollection(null)},getGeometryType:function(){return"MultiPoint"},copy:function(){for(var t=new Array(this.geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this.geometries[e].copy();return new wt(t,this.factory)},interfaces_:function(){return[Nt]},getClass:function(){return wt}}),wt.serialVersionUID=-0x6fb1ed4162e0fc00,ro(Rt,It),io(Rt.prototype,{getSortIndex:function(){return F.SORTINDEX_LINEARRING},getBoundaryDimension:function(){return ot.FALSE},isClosed:function(){return!!this.isEmpty()||It.prototype.isClosed.call(this)},reverse:function(){var t=this.points.copy();return Et.reverse(t),this.getFactory().createLinearRing(t)},validateConstruction:function(){if(!this.isEmpty()&&!It.prototype.isClosed.call(this))throw new n("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<Rt.MINIMUM_VALID_SIZE)throw new n("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},getGeometryType:function(){return"LinearRing"},copy:function(){return new Rt(this.points.copy(),this.factory)},interfaces_:function(){return[]},getClass:function(){return Rt}}),Rt.MINIMUM_VALID_SIZE=4,Rt.serialVersionUID=-0x3b229e262367a600,ro(Tt,lt),io(Tt.prototype,{getSortIndex:function(){return F.SORTINDEX_MULTIPOLYGON},equalsExact:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&lt.prototype.equalsExact.call(this,t,e)}return lt.prototype.equalsExact.apply(this,arguments)},getBoundaryDimension:function(){return 1},getDimension:function(){return 2},reverse:function(){for(var t=this.geometries.length,e=new Array(t).fill(null),n=0;n<this.geometries.length;n++)e[n]=this.geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},getBoundary:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new x,e=0;e<this.geometries.length;e++)for(var n=this.geometries[e],i=n.getBoundary(),r=0;r<i.getNumGeometries();r++)t.add(i.getGeometryN(r));var s=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(s))},getGeometryType:function(){return"MultiPolygon"},copy:function(){for(var t=new Array(this.geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this.geometries[e].copy();return new Tt(t,this.factory)},interfaces_:function(){return[St]},getClass:function(){return Tt}}),Tt.serialVersionUID=-0x7a5aa1369171980,io(Ot.prototype,{setCopyUserData:function(t){this.isUserDataCopied=t},edit:function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this.isUserDataCopied&&n.setUserData(t.getUserData()),n},editInternal:function(t,e){return null===this.factory&&(this.factory=t.getFactory()),t instanceof lt?this.editGeometryCollection(t,e):t instanceof Lt?this.editPolygon(t,e):t instanceof Ct?e.edit(t,this.factory):t instanceof It?e.edit(t,this.factory):(h.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},editGeometryCollection:function(t,e){for(var n=e.edit(t,this.factory),i=new x,r=0;r<n.getNumGeometries();r++){var s=this.edit(n.getGeometryN(r),e);null===s||s.isEmpty()||i.add(s)}return n.getClass()===wt?this.factory.createMultiPoint(i.toArray([])):n.getClass()===ht?this.factory.createMultiLineString(i.toArray([])):n.getClass()===Tt?this.factory.createMultiPolygon(i.toArray([])):this.factory.createGeometryCollection(i.toArray([]))},editPolygon:function(t,e){var n=e.edit(t,this.factory);if(null===n&&(n=this.factory.createPolygon(null)),n.isEmpty())return n;var i=this.edit(n.getExteriorRing(),e);if(null===i||i.isEmpty())return this.factory.createPolygon();for(var r=new x,s=0;s<n.getNumInteriorRing();s++){var o=this.edit(n.getInteriorRingN(s),e);null===o||o.isEmpty()||r.add(o)}return this.factory.createPolygon(i,r.toArray([]))},interfaces_:function(){return[]},getClass:function(){return Ot}}),Ot.GeometryEditorOperation=Pt,io(bt.prototype,{edit:function(t,e){return t},interfaces_:function(){return[Pt]},getClass:function(){return bt}}),io(_t.prototype,{edit:function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof Rt?e.createLinearRing(n):t instanceof It?e.createLineString(n):t instanceof Ct?n.length>0?e.createPoint(n[0]):e.createPoint():t},interfaces_:function(){return[Pt]},getClass:function(){return _t}}),io(Mt.prototype,{edit:function(t,e){return t instanceof Rt?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof It?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Ct?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},interfaces_:function(){return[Pt]},getClass:function(){return Mt}}),Ot.NoOpGeometryOperation=bt,Ot.CoordinateOperation=_t,Ot.CoordinateSequenceOperation=Mt,io(Dt.prototype,{setOrdinate:function(t,e,i){switch(e){case b.X:this.coordinates[t].x=i;break;case b.Y:this.coordinates[t].y=i;break;case b.Z:this.coordinates[t].z=i;break;default:throw new n("invalid ordinateIndex")}},size:function(){return this.coordinates.length},getOrdinate:function(t,e){switch(e){case b.X:return this.coordinates[t].x;case b.Y:return this.coordinates[t].y;case b.Z:return this.coordinates[t].z}return i.NaN},getCoordinate:function(){if(1===arguments.length){var t=arguments[0];return this.coordinates[t]}if(2===arguments.length){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}},getCoordinateCopy:function(t){return new c(this.coordinates[t])},getDimension:function(){return this.dimension},getX:function(t){return this.coordinates[t].x},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 Dt(t,this.dimension)},expandEnvelope:function(t){for(var e=0;e<this.coordinates.length;e++)t.expandToInclude(this.coordinates[e]);return t},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 Dt(t,this.dimension)},toString:function(){if(this.coordinates.length>0){var t=new w(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"()"},getY:function(t){return this.coordinates[t].y},toCoordinateArray:function(){return this.coordinates},interfaces_:function(){return[b,a]},getClass:function(){return Dt}}),Dt.serialVersionUID=-0xcb44a778db18e00,io(At.prototype,{readResolve:function(){return At.instance()},create:function(){if(1===arguments.length){if(arguments[0]instanceof Array){return new Dt(arguments[0])}if(oo(arguments[0],b)){return new Dt(arguments[0])}}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new Dt(t):new Dt(t,e)}},interfaces_:function(){return[D,a]},getClass:function(){return At}}),At.instance=function(){return At.instanceObject},At.serialVersionUID=-0x38e49fa6cf6f2e00,At.instanceObject=new At;var ho,co=Object.defineProperty,fo=function(t,e){function n(t){if(!this||this.constructor!==n)return new n(t);this._keys=[],this._values=[],this._itp=[],this.objectOnly=e,t&&Gt.call(this,t)}return e||co(t,"size",{get:jt}),t.constructor=n,n.prototype=t,n}({delete:qt,has:zt,get:Bt,set:kt,keys:Ut,values:Xt,entries:Ht,forEach:Kt,clear:Yt}),go="undefined"!=typeof Map&&Map.prototype.values?Map:fo;Zt.prototype=new H,Zt.prototype.get=function(t){return this.map_.get(t)||null},Zt.prototype.put=function(t,e){return this.map_.set(t,e),e},Zt.prototype.values=function(){for(var t=new x,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},Zt.prototype.entrySet=function(){var t=new K;return this.map_.entries().forEach(function(e){return t.add(e)}),t},Zt.prototype.size=function(){return this.map_.size()},io(Qt.prototype,{equals:function(t){if(!(t instanceof Qt))return!1;var e=t;return this.modelType===e.modelType&&this.scale===e.scale},compareTo:function(t){var e=t,n=this.getMaximumSignificantDigits(),i=e.getMaximumSignificantDigits();return new R(n).compareTo(new R(i))},getScale:function(){return this.scale},isFloating:function(){return this.modelType===Qt.FLOATING||this.modelType===Qt.FLOATING_SINGLE},getType:function(){return this.modelType},toString:function(){var t="UNKNOWN";return this.modelType===Qt.FLOATING?t="Floating":this.modelType===Qt.FLOATING_SINGLE?t="Floating-Single":this.modelType===Qt.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},makePrecise:function(){if("number"==typeof arguments[0]){var t=arguments[0];if(i.isNaN(t))return t;if(this.modelType===Qt.FLOATING_SINGLE){return t}return this.modelType===Qt.FIXED?Math.round(t*this.scale)/this.scale:t}if(arguments[0]instanceof c){var e=arguments[0];if(this.modelType===Qt.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},getMaximumSignificantDigits:function(){var t=16;return this.modelType===Qt.FLOATING?t=16:this.modelType===Qt.FLOATING_SINGLE?t=6:this.modelType===Qt.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},setScale:function(t){this.scale=Math.abs(t)},interfaces_:function(){return[a,r]},getClass:function(){return Qt}}),Qt.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},io(Jt.prototype,{readResolve:function(){return Jt.nameToTypeMap.get(this.name)},toString:function(){return this.name},interfaces_:function(){return[a]},getClass:function(){return Jt}}),Jt.serialVersionUID=-552860263173159e4,Jt.nameToTypeMap=new Zt,Qt.Type=Jt,Qt.serialVersionUID=0x6bee6404e9a25c00,Qt.FIXED=new Jt("FIXED"),Qt.FLOATING=new Jt("FLOATING"),Qt.FLOATING_SINGLE=new Jt("FLOATING SINGLE"),Qt.maximumPreciseValue=9007199254740992,io($t.prototype,{toGeometry:function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new c(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new c(t.getMinX(),t.getMinY()),new c(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new c(t.getMinX(),t.getMinY()),new c(t.getMinX(),t.getMaxY()),new c(t.getMaxX(),t.getMaxY()),new c(t.getMaxX(),t.getMinY()),new c(t.getMinX(),t.getMinY())]),null)},createLineString:function(){if(0===arguments.length)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLineString(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(oo(arguments[0],b)){return new It(arguments[0],this)}}},createMultiLineString:function(){if(0===arguments.length)return new ht(null,this);if(1===arguments.length){return new ht(arguments[0],this)}},buildGeometry:function(t){for(var e=null,n=!1,i=!1,r=t.iterator();r.hasNext();){var s=r.next(),o=s.getClass();null===e&&(e=o),o!==e&&(n=!0),s.isGeometryCollectionOrDerived()&&(i=!0)}if(null===e)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection($t.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Lt)return this.createMultiPolygon($t.toPolygonArray(t));if(a instanceof It)return this.createMultiLineString($t.toLineStringArray(t));if(a instanceof Ct)return this.createMultiPoint($t.toPointArray(t));h.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},createMultiPointFromCoords:function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},createPoint:function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof c){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(oo(arguments[0],b)){return new Ct(arguments[0],this)}}},getCoordinateSequenceFactory:function(){return this.coordinateSequenceFactory},createPolygon:function(){if(0===arguments.length)return new Lt(null,null,this);if(1===arguments.length){if(oo(arguments[0],b)){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 Rt){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){var i=arguments[0],r=arguments[1];return new Lt(i,r,this)}},getSRID:function(){return this.SRID},createGeometryCollection:function(){if(0===arguments.length)return new lt(null,this);if(1===arguments.length){return new lt(arguments[0],this)}},createGeometry:function(t){return new Ot(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return arguments[1],this.coordinateSequenceFactory.create(t)}}})},getPrecisionModel:function(){return this.precisionModel},createLinearRing:function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(oo(arguments[0],b)){return new Rt(arguments[0],this)}}},createMultiPolygon:function(){if(0===arguments.length)return new Tt(null,this);if(1===arguments.length){return new Tt(arguments[0],this)}},createMultiPoint:function(){if(0===arguments.length)return new wt(null,this);if(1===arguments.length){if(arguments[0]instanceof Array){return new wt(arguments[0],this)}if(arguments[0]instanceof Array){var t=arguments[0]
;return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(oo(arguments[0],b)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(e.size()).fill(null),i=0;i<e.size();i++){var r=this.getCoordinateSequenceFactory().create(1,e.getDimension());Et.copy(e,i,r,0,1),n[i]=this.createPoint(r)}return this.createMultiPoint(n)}}},interfaces_:function(){return[a]},getClass:function(){return $t}}),$t.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},$t.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},$t.getDefaultCoordinateSequenceFactory=function(){return At.instance()},$t.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},$t.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},$t.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},$t.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},$t.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},$t.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},$t.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},$t.serialVersionUID=-0x5ea75f2051eeb400;var po={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*$/};io(te.prototype,{read:function(t){var e,n,i;t=t.replace(/[\n\r]/g," ");var r=po.typeStr.exec(t);if(-1!==t.search("EMPTY")&&(r=po.emptyTypeStr.exec(t),r[2]=void 0),r&&(n=r[1].toLowerCase(),i=r[2],vo[n]&&(e=vo[n].apply(this,[i]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},write:function(t){return this.extractGeometry(t)},extractGeometry:function(t){var e=t.getGeometryType().toLowerCase();if(!mo[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+mo[e].apply(this,[t])+")"}});var mo={coordinate:function(t){return t.x+" "+t.y},point:function(t){return mo.coordinate.call(this,t.coordinates.coordinates[0])},multipoint:function(t){for(var e=[],n=0,i=t.geometries.length;n<i;++n)e.push("("+mo.point.apply(this,[t.geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,i=t.points.coordinates.length;n<i;++n)e.push(mo.coordinate.apply(this,[t.points.coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,i=t.points.coordinates.length;n<i;++n)e.push(mo.coordinate.apply(this,[t.points.coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,i=t.geometries.length;n<i;++n)e.push("("+mo.linestring.apply(this,[t.geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+mo.linestring.apply(this,[t.shell])+")");for(var n=0,i=t.holes.length;n<i;++n)e.push("("+mo.linestring.apply(this,[t.holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,i=t.geometries.length;n<i;++n)e.push("("+mo.polygon.apply(this,[t.geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,i=t.geometries.length;n<i;++n)e.push(this.extractGeometry(t.geometries[n]));return e.join(",")}},vo={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(po.spaces);return this.geometryFactory.createPoint(new c(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){if(void 0===t)return this.geometryFactory.createMultiPoint();for(var e,n=t.trim().split(","),i=[],r=0,s=n.length;r<s;++r)e=n[r].replace(po.trimParens,"$1"),i.push(vo.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(i)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),i=[],r=0,s=n.length;r<s;++r)e=n[r].trim().split(po.spaces),i.push(new c(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(i)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),i=[],r=0,s=n.length;r<s;++r)e=n[r].trim().split(po.spaces),i.push(new c(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(i)},multilinestring:function(t){if(void 0===t)return this.geometryFactory.createMultiLineString();for(var e,n=t.trim().split(po.parenComma),i=[],r=0,s=n.length;r<s;++r)e=n[r].replace(po.trimParens,"$1"),i.push(vo.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(i)},polygon:function(t){if(void 0===t)return this.geometryFactory.createPolygon();for(var e,n,i,r,s=t.trim().split(po.parenComma),o=[],a=0,u=s.length;a<u;++a)e=s[a].replace(po.trimParens,"$1"),n=vo.linestring.apply(this,[e]),i=this.geometryFactory.createLinearRing(n.points),0===a?r=i:o.push(i);return this.geometryFactory.createPolygon(r,o)},multipolygon:function(t){if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var e,n=t.trim().split(po.doubleParenComma),i=[],r=0,s=n.length;r<s;++r)e=n[r].replace(po.trimParens,"$1"),i.push(vo.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(i)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();t=t.replace(/,\s*([A-Za-z])/g,"|$1");for(var e=t.trim().split("|"),n=[],i=0,r=e.length;i<r;++i)n.push(this.read(e[i]));return this.geometryFactory.createGeometryCollection(n)}};io(ee.prototype,{write:function(t){return this.parser.write(t)}}),io(ee,{toLineString:function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"}}),io(ne.prototype,{getIndexAlongSegment:function(t,e){return this.computeIntLineIndex(),this.intLineIndex[t][e]},getTopologySummary:function(){var t=new w;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},computeIntersection:function(t,e,n,i){this.inputLines[0][0]=t,this.inputLines[0][1]=e,this.inputLines[1][0]=n,this.inputLines[1][1]=i,this.result=this.computeIntersect(t,e,n,i)},getIntersectionNum:function(){return this.result},computeIntLineIndex:function(){if(0===arguments.length)null===this.intLineIndex&&(this.intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){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)}},isProper:function(){return this.hasIntersection()&&this._isProper},setPrecisionModel:function(t){this.precisionModel=t},isInteriorIntersection:function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var t=arguments[0],e=0;e<this.result;e++)if(!this.intPt[e].equals2D(this.inputLines[t][0])&&!this.intPt[e].equals2D(this.inputLines[t][1]))return!0;return!1}},getIntersection:function(t){return this.intPt[t]},isEndPoint:function(){return this.hasIntersection()&&!this._isProper},hasIntersection:function(){return this.result!==ne.NO_INTERSECTION},getEdgeDistance:function(t,e){return ne.computeEdgeDistance(this.intPt[e],this.inputLines[t][0],this.inputLines[t][1])},isCollinear:function(){return this.result===ne.COLLINEAR_INTERSECTION},toString:function(){return ee.toLineString(this.inputLines[0][0],this.inputLines[0][1])+" - "+ee.toLineString(this.inputLines[1][0],this.inputLines[1][1])+this.getTopologySummary()},getEndpoint:function(t,e){return this.inputLines[t][e]},isIntersection:function(t){for(var e=0;e<this.result;e++)if(this.intPt[e].equals2D(t))return!0;return!1},getIntersectionAlongSegment:function(t,e){return this.computeIntLineIndex(),this.intPt[this.intLineIndex[t][e]]},interfaces_:function(){return[]},getClass:function(){return ne}}),ne.computeEdgeDistance=function(t,e,n){var i=Math.abs(n.x-e.x),r=Math.abs(n.y-e.y),s=-1;if(t.equals(e))s=0;else if(t.equals(n))s=i>r?i:r;else{var o=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);s=i>r?o:a,0!==s||t.equals(e)||(s=Math.max(o,a))}return h.isTrue(!(0===s&&!t.equals(e)),"Bad distance calculation"),s},ne.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,r=t.y-e.y,s=Math.sqrt(i*i+r*r);return h.isTrue(!(0===s&&!t.equals(e)),"Invalid distance calculation"),s},ne.DONT_INTERSECT=0,ne.DO_INTERSECT=1,ne.COLLINEAR=2,ne.NO_INTERSECTION=0,ne.POINT_INTERSECTION=1,ne.COLLINEAR_INTERSECTION=2,ro(ie,ne),io(ie.prototype,{isInSegmentEnvelopes:function(t){var e=new I(this.inputLines[0][0],this.inputLines[0][1]),n=new I(this.inputLines[1][0],this.inputLines[1][1]);return e.contains(t)&&n.contains(t)},computeIntersection:function(){if(3!==arguments.length)return ne.prototype.computeIntersection.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2];if(this._isProper=!1,I.intersects(e,n,t)&&0===oe.orientationIndex(e,n,t)&&0===oe.orientationIndex(n,e,t))return this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),this.result=ne.POINT_INTERSECTION,null;this.result=ne.NO_INTERSECTION},normalizeToMinimum:function(t,e,n,i,r){r.x=this.smallestInAbsValue(t.x,e.x,n.x,i.x),r.y=this.smallestInAbsValue(t.y,e.y,n.y,i.y),t.x-=r.x,t.y-=r.y,e.x-=r.x,e.y-=r.y,n.x-=r.x,n.y-=r.y,i.x-=r.x,i.y-=r.y},safeHCoordinateIntersection:function(t,e,n,i){var r=null;try{r=M.intersection(t,e,n,i)}catch(s){if(!(s instanceof C))throw s;r=ie.nearestEndpoint(t,e,n,i)}return r},intersection:function(t,e,n,i){var r=this.intersectionWithNormalization(t,e,n,i);return this.isInSegmentEnvelopes(r)||(r=new c(ie.nearestEndpoint(t,e,n,i))),null!==this.precisionModel&&this.precisionModel.makePrecise(r),r},smallestInAbsValue:function(t,e,n,i){var r=t,s=Math.abs(r);return Math.abs(e)<s&&(r=e,s=Math.abs(e)),Math.abs(n)<s&&(r=n,s=Math.abs(n)),Math.abs(i)<s&&(r=i),r},checkDD:function(t,e,n,i,r){var s=P.intersection(t,e,n,i),o=this.isInSegmentEnvelopes(s);_.out.println("DD in env = "+o+" --------------------- "+s),r.distance(s)>1e-4&&_.out.println("Distance = "+r.distance(s))},intersectionWithNormalization:function(t,e,n,i){var r=new c(t),s=new c(e),o=new c(n),a=new c(i),u=new c;this.normalizeToEnvCentre(r,s,o,a,u);var l=this.safeHCoordinateIntersection(r,s,o,a);return l.x+=u.x,l.y+=u.y,l},computeCollinearIntersection:function(t,e,n,i){var r=I.intersects(t,e,n),s=I.intersects(t,e,i),o=I.intersects(n,i,t),a=I.intersects(n,i,e);return r&&s?(this.intPt[0]=n,this.intPt[1]=i,ne.COLLINEAR_INTERSECTION):o&&a?(this.intPt[0]=t,this.intPt[1]=e,ne.COLLINEAR_INTERSECTION):r&&o?(this.intPt[0]=n,this.intPt[1]=t,!n.equals(t)||s||a?ne.COLLINEAR_INTERSECTION:ne.POINT_INTERSECTION):r&&a?(this.intPt[0]=n,this.intPt[1]=e,!n.equals(e)||s||o?ne.COLLINEAR_INTERSECTION:ne.POINT_INTERSECTION):s&&o?(this.intPt[0]=i,this.intPt[1]=t,!i.equals(t)||r||a?ne.COLLINEAR_INTERSECTION:ne.POINT_INTERSECTION):s&&a?(this.intPt[0]=i,this.intPt[1]=e,!i.equals(e)||r||o?ne.COLLINEAR_INTERSECTION:ne.POINT_INTERSECTION):ne.NO_INTERSECTION},normalizeToEnvCentre:function(t,e,n,i,r){var s=t.x<e.x?t.x:e.x,o=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.x<i.x?n.x:i.x,h=n.y<i.y?n.y:i.y,c=n.x>i.x?n.x:i.x,f=n.y>i.y?n.y:i.y,g=s>l?s:l,d=a<c?a:c,p=o>h?o:h,m=u<f?u:f,v=(g+d)/2,y=(p+m)/2;r.x=v,r.y=y,t.x-=r.x,t.y-=r.y,e.x-=r.x,e.y-=r.y,n.x-=r.x,n.y-=r.y,i.x-=r.x,i.y-=r.y},computeIntersect:function(t,e,n,i){if(this._isProper=!1,!I.intersects(t,e,n,i))return ne.NO_INTERSECTION;var r=oe.orientationIndex(t,e,n),s=oe.orientationIndex(t,e,i);if(r>0&&s>0||r<0&&s<0)return ne.NO_INTERSECTION;var o=oe.orientationIndex(n,i,t),a=oe.orientationIndex(n,i,e);return o>0&&a>0||o<0&&a<0?ne.NO_INTERSECTION:0===r&&0===s&&0===o&&0===a?this.computeCollinearIntersection(t,e,n,i):(0===r||0===s||0===o||0===a?(this._isProper=!1,t.equals2D(n)||t.equals2D(i)?this.intPt[0]=t:e.equals2D(n)||e.equals2D(i)?this.intPt[0]=e:0===r?this.intPt[0]=new c(n):0===s?this.intPt[0]=new c(i):0===o?this.intPt[0]=new c(t):0===a&&(this.intPt[0]=new c(e))):(this._isProper=!0,this.intPt[0]=this.intersection(t,e,n,i)),ne.POINT_INTERSECTION)},interfaces_:function(){return[]},getClass:function(){return ie}}),ie.nearestEndpoint=function(t,e,n,i){var r=t,s=oe.distancePointLine(t,n,i),o=oe.distancePointLine(e,n,i);return o<s&&(s=o,r=e),o=oe.distancePointLine(n,t,e),o<s&&(s=o,r=n),o=oe.distancePointLine(i,t,e),o<s&&(s=o,r=i),r},io(re.prototype,{interfaces_:function(){return[]},getClass:function(){return re}}),re.orientationIndex=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,s=n.x-e.x,o=n.y-e.y;return re.signOfDet2x2(i,r,s,o)},re.signOfDet2x2=function(t,e,n,i){var r=null,s=null,o=null,a=0;if(r=1,0===t||0===i)return 0===e||0===n?0:e>0?n>0?-r:r:n>0?r:-r;if(0===e||0===n)return i>0?t>0?r:-r:t>0?-r:r;if(0<e?0<i?e<=i||(r=-r,s=t,t=n,n=s,s=e,e=i,i=s):e<=-i?(r=-r,n=-n,i=-i):(s=t,t=-n,n=s,s=e,e=-i,i=s):0<i?-e<=i?(r=-r,t=-t,e=-e):(s=-t,t=n,n=s,s=-e,e=i,i=s):e>=i?(t=-t,e=-e,n=-n,i=-i):(r=-r,s=-t,t=-n,n=s,s=-e,e=-i,i=s),0<t){if(!(0<n))return r;if(!(t<=n))return r}else{if(0<n)return-r;if(!(t>=n))return-r;r=-r,t=-t,n=-n}for(;;){if(a+=1,o=Math.floor(n/t),n-=o*t,(i-=o*e)<0)return-r;if(i>e)return r;if(t>n+n){if(e<i+i)return r}else{if(e>i+i)return-r;n=t-n,i=e-i,r=-r}if(0===i)return 0===n?0:-r;if(0===n)return r;if(o=Math.floor(t/n),t-=o*n,(e-=o*i)<0)return r;if(e>i)return-r;if(n>t+t){if(i<e+e)return-r}else{if(i>e+e)return r;t=n-t,e=i-e,r=-r}if(0===e)return 0===t?0:r;if(0===t)return-r}},io(se.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,i=e.x;return n>i&&(n=e.x,i=t.x),this.p.x>=n&&this.p.x<=i&&(this.isPointOnSegment=!0),null}if(t.y>this.p.y&&e.y<=this.p.y||e.y>this.p.y&&t.y<=this.p.y){var r=t.x-this.p.x,s=t.y-this.p.y,o=e.x-this.p.x,a=e.y-this.p.y,u=re.signOfDet2x2(r,s,o,a);if(0===u)return this.isPointOnSegment=!0,null;a<s&&(u=-u),u>0&&this.crossingCount++}},isPointInPolygon:function(){return this.getLocation()!==S.EXTERIOR},getLocation:function(){return this.isPointOnSegment?S.BOUNDARY:this.crossingCount%2==1?S.INTERIOR:S.EXTERIOR},isOnSegment:function(){return this.isPointOnSegment},interfaces_:function(){return[]},getClass:function(){return se}}),se.locatePointInRing=function(){if(arguments[0]instanceof c&&oo(arguments[1],b)){for(var t=arguments[0],e=arguments[1],n=new se(t),i=new c,r=new c,s=1;s<e.size();s++)if(e.getCoordinate(s,i),e.getCoordinate(s-1,r),n.countSegment(i,r),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof c&&arguments[1]instanceof Array){for(var o=arguments[0],a=arguments[1],n=new se(o),s=1;s<a.length;s++){var i=a[s],r=a[s-1];if(n.countSegment(i,r),n.isOnSegment())return n.getLocation()}return n.getLocation()}},io(oe.prototype,{interfaces_:function(){return[]},getClass:function(){return oe}}),oe.orientationIndex=function(t,e,n){return P.orientationIndex(t,e,n)},oe.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,i=1;i<t.length-1;i++){var r=t[i].x-n,s=t[i+1].y;e+=r*(t[i-1].y-s)}return e/2}if(oo(arguments[0],b)){var o=arguments[0],a=o.size();if(a<3)return 0;var u=new c,l=new c,h=new c;o.getCoordinate(0,l),o.getCoordinate(1,h);var n=l.x;h.x-=n;for(var e=0,i=1;i<a-1;i++)u.y=l.y,l.x=h.x,l.y=h.y,o.getCoordinate(i+1,h),h.x-=n,e+=l.x*(u.y-h.y);return e/2}},oe.distanceLineLine=function(t,e,n,i){if(t.equals(e))return oe.distancePointLine(t,n,i);if(n.equals(i))return oe.distancePointLine(i,t,e);var r=!1;if(I.intersects(t,e,n,i)){var s=(e.x-t.x)*(i.y-n.y)-(e.y-t.y)*(i.x-n.x);if(0===s)r=!0;else{var o=(t.y-n.y)*(i.x-n.x)-(t.x-n.x)*(i.y-n.y),a=(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y),u=a/s,l=o/s;(l<0||l>1||u<0||u>1)&&(r=!0)}}else r=!0;return r?L.min(oe.distancePointLine(t,n,i),oe.distancePointLine(e,n,i),oe.distancePointLine(n,t,e),oe.distancePointLine(i,t,e)):0},oe.isPointInRing=function(t,e){return oe.locatePointInRing(t,e)!==S.EXTERIOR},oe.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new c;t.getCoordinate(0,i);for(var r=i.x,s=i.y,o=1;o<e;o++){t.getCoordinate(o,i);var a=i.x,u=i.y,l=a-r,h=u-s;n+=Math.sqrt(l*l+h*h),r=a,s=u}return n},oe.isCCW=function(t){var e=t.length-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");for(var i=t[0],r=0,s=1;s<=e;s++){var o=t[s];o.y>i.y&&(i=o,r=s)}var a=r;do{(a-=1)<0&&(a=e)}while(t[a].equals2D(i)&&a!==r);var u=r;do{u=(u+1)%e}while(t[u].equals2D(i)&&u!==r);var l=t[a],h=t[u];if(l.equals2D(i)||h.equals2D(i)||l.equals2D(h))return!1;var c=oe.computeOrientation(l,i,h);return 0===c?l.x>h.x:c>0},oe.locatePointInRing=function(t,e){return se.locatePointInRing(t,e)},oe.distancePointLinePerpendicular=function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),r=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(r)*Math.sqrt(i)},oe.computeOrientation=function(t,e,n){return oe.orientationIndex(t,e,n)},oe.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new n("Line array must contain at least one vertex");for(var i=t.distance(e[0]),r=0;r<e.length-1;r++){var s=oe.distancePointLine(t,e[r],e[r+1]);s<i&&(i=s)}return i}if(3===arguments.length){var o=arguments[0],a=arguments[1],u=arguments[2];if(a.x===u.x&&a.y===u.y)return o.distance(a);var l=(u.x-a.x)*(u.x-a.x)+(u.y-a.y)*(u.y-a.y),h=((o.x-a.x)*(u.x-a.x)+(o.y-a.y)*(u.y-a.y))/l;if(h<=0)return o.distance(a);if(h>=1)return o.distance(u);var c=((a.y-o.y)*(u.x-a.x)-(a.x-o.x)*(u.y-a.y))/l;return Math.abs(c)*Math.sqrt(l)}},oe.isOnLine=function(t,e){for(var n=new ie,i=1;i<e.length;i++){var r=e[i-1],s=e[i];if(n.computeIntersection(t,r,s),n.hasIntersection())return!0}return!1},oe.CLOCKWISE=-1,oe.RIGHT=oe.CLOCKWISE,oe.COUNTERCLOCKWISE=1,oe.LEFT=oe.COUNTERCLOCKWISE,oe.COLLINEAR=0,oe.STRAIGHT=oe.COLLINEAR,io(ae.prototype,{minX:function(){return Math.min(this.p0.x,this.p1.x)},orientationIndex:function(){if(arguments[0]instanceof ae){var t=arguments[0],e=oe.orientationIndex(this.p0,this.p1,t.p0),n=oe.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0?Math.max(e,n):e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof c){var i=arguments[0];return oe.orientationIndex(this.p0,this.p1,i)}},toGeometry:function(t){return t.createLineString([this.p0,this.p1])},isVertical:function(){return this.p0.x===this.p1.x},equals:function(t){if(!(t instanceof ae))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},intersection:function(t){var e=new ie;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},project:function(){if(arguments[0]instanceof c){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new c(t);var e=this.projectionFactor(t),n=new c;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 ae){var i=arguments[0],r=this.projectionFactor(i.p0),s=this.projectionFactor(i.p1);if(r>=1&&s>=1)return null;if(r<=0&&s<=0)return null;var o=this.project(i.p0);r<0&&(o=this.p0),r>1&&(o=this.p1);var a=this.project(i.p1);return s<0&&(a=this.p0),s>1&&(a=this.p1),new ae(o,a)}},normalize:function(){this.p1.compareTo(this.p0)<0&&this.reverse()},angle:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},getCoordinate:function(t){return 0===t?this.p0:this.p1},distancePerpendicular:function(t){return oe.distancePointLinePerpendicular(t,this.p0,this.p1)},minY:function(){return Math.min(this.p0.y,this.p1.y)},midPoint:function(){return ae.midPoint(this.p0,this.p1)},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?i.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},closestPoints:function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=i.MAX_VALUE,s=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var a=this.closestPoint(t.p1);(s=a.distance(t.p1))<r&&(r=s,n[0]=a,n[1]=t.p1);var u=t.closestPoint(this.p0);(s=u.distance(this.p0))<r&&(r=s,n[0]=this.p0,n[1]=u);var l=t.closestPoint(this.p1);return s=l.distance(this.p1),s<r&&(r=s,n[0]=this.p1,n[1]=l),n},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},maxX:function(){return Math.max(this.p0.x,this.p1.x)},getLength:function(){return this.p0.distance(this.p1)},compareTo:function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},reverse:function(){var t=this.p0;this.p0=this.p1,this.p1=t},equalsTopo:function(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)},lineIntersection:function(t){try{return M.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof C))throw t}return null},maxY:function(){return Math.max(this.p0.y,this.p1.y)},pointAlongOffset:function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),i=this.p0.y+t*(this.p1.y-this.p0.y),r=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,o=Math.sqrt(r*r+s*s),a=0,u=0;if(0!==e){if(o<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");a=e*r/o,u=e*s/o}return new c(n-u,i+a)},setCoordinates:function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){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}},segmentFraction:function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||i.isNaN(e))&&(e=1),e},toString:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},isHorizontal:function(){return this.p0.y===this.p1.y},distance:function(){if(arguments[0]instanceof ae){var t=arguments[0];return oe.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof c){var e=arguments[0];return oe.distancePointLine(e,this.p0,this.p1)}},pointAlong:function(t){var e=new c;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},hashCode:function(){var t=java.lang.Double.doubleToLongBits(this.p0.x);t^=31*java.lang.Double.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=java.lang.Double.doubleToLongBits(this.p1.x);return n^=31*java.lang.Double.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)},interfaces_:function(){return[r,a]},getClass:function(){return ae}}),ae.midPoint=function(t,e){return new c((t.x+e.x)/2,(t.y+e.y)/2)},ae.serialVersionUID=0x2d2172135f411c00,io(ue.prototype,{isIntersects:function(){return!this.isDisjoint()},isCovers:function(){return(ue.isTrue(this.matrix[S.INTERIOR][S.INTERIOR])||ue.isTrue(this.matrix[S.INTERIOR][S.BOUNDARY])||ue.isTrue(this.matrix[S.BOUNDARY][S.INTERIOR])||ue.isTrue(this.matrix[S.BOUNDARY][S.BOUNDARY]))&&this.matrix[S.EXTERIOR][S.INTERIOR]===ot.FALSE&&this.matrix[S.EXTERIOR][S.BOUNDARY]===ot.FALSE},isCoveredBy:function(){return(ue.isTrue(this.matrix[S.INTERIOR][S.INTERIOR])||ue.isTrue(this.matrix[S.INTERIOR][S.BOUNDARY])||ue.isTrue(this.matrix[S.BOUNDARY][S.INTERIOR])||ue.isTrue(this.matrix[S.BOUNDARY][S.BOUNDARY]))&&this.matrix[S.INTERIOR][S.EXTERIOR]===ot.FALSE&&this.matrix[S.BOUNDARY][S.EXTERIOR]===ot.FALSE},set:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),i=e%3;this.matrix[n][i]=ot.toDimensionValue(t.charAt(e))}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this.matrix[r][s]=o}},isContains:function(){return ue.isTrue(this.matrix[S.INTERIOR][S.INTERIOR])&&this.matrix[S.EXTERIOR][S.INTERIOR]===ot.FALSE&&this.matrix[S.EXTERIOR][S.BOUNDARY]===ot.FALSE},setAtLeast:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),i=e%3;this.setAtLeast(n,i,ot.toDimensionValue(t.charAt(e)))}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];this.matrix[r][s]<o&&(this.matrix[r][s]=o)}},setAtLeastIfValid:function(t,e,n){t>=0&&e>=0&&this.setAtLeast(t,e,n)},isWithin:function(){return ue.isTrue(this.matrix[S.INTERIOR][S.INTERIOR])&&this.matrix[S.INTERIOR][S.EXTERIOR]===ot.FALSE&&this.matrix[S.BOUNDARY][S.EXTERIOR]===ot.FALSE},isTouches:function(t,e){return t>e?this.isTouches(e,t):(t===ot.A&&e===ot.A||t===ot.L&&e===ot.L||t===ot.L&&e===ot.A||t===ot.P&&e===ot.A||t===ot.P&&e===ot.L)&&(this.matrix[S.INTERIOR][S.INTERIOR]===ot.FALSE&&(ue.isTrue(this.matrix[S.INTERIOR][S.BOUNDARY])||ue.isTrue(this.matrix[S.BOUNDARY][S.INTERIOR])||ue.isTrue(this.matrix[S.BOUNDARY][S.BOUNDARY])))},isOverlaps:function(t,e){return t===ot.P&&e===ot.P||t===ot.A&&e===ot.A?ue.isTrue(this.matrix[S.INTERIOR][S.INTERIOR])&&ue.isTrue(this.matrix[S.INTERIOR][S.EXTERIOR])&&ue.isTrue(this.matrix[S.EXTERIOR][S.INTERIOR]):t===ot.L&&e===ot.L&&(1===this.matrix[S.INTERIOR][S.INTERIOR]&&ue.isTrue(this.matrix[S.INTERIOR][S.EXTERIOR])&&ue.isTrue(this.matrix[S.EXTERIOR][S.INTERIOR]))},isEquals:function(t,e){return t===e&&(ue.isTrue(this.matrix[S.INTERIOR][S.INTERIOR])&&this.matrix[S.INTERIOR][S.EXTERIOR]===ot.FALSE&&this.matrix[S.BOUNDARY][S.EXTERIOR]===ot.FALSE&&this.matrix[S.EXTERIOR][S.INTERIOR]===ot.FALSE&&this.matrix[S.EXTERIOR][S.BOUNDARY]===ot.FALSE)},toString:function(){for(var t=new w("123456789"),e=0;e<3;e++)for(var n=0;n<3;n++)t.setCharAt(3*e+n,ot.toDimensionSymbol(this.matrix[e][n]));return t.toString()},setAll:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this.matrix[e][n]=t},get:function(t,e){return this.matrix[t][e]},transpose:function(){var t=this.matrix[1][0];return this.matrix[1][0]=this.matrix[0][1],this.matrix[0][1]=t,t=this.matrix[2][0],this.matrix[2][0]=this.matrix[0][2],this.matrix[0][2]=t,t=this.matrix[2][1],this.matrix[2][1]=this.matrix[1][2],this.matrix[1][2]=t,this},matches:function(t){if(9!==t.length)throw new n("Should be length 9: "+t);for(var e=0;e<3;e++)for(var i=0;i<3;i++)if(!ue.matches(this.matrix[e][i],t.charAt(3*e+i)))return!1;return!0},add:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this.setAtLeast(e,n,t.get(e,n))},isDisjoint:function(){return this.matrix[S.INTERIOR][S.INTERIOR]===ot.FALSE&&this.matrix[S.INTERIOR][S.BOUNDARY]===ot.FALSE&&this.matrix[S.BOUNDARY][S.INTERIOR]===ot.FALSE&&this.matrix[S.BOUNDARY][S.BOUNDARY]===ot.FALSE},isCrosses:function(t,e){return t===ot.P&&e===ot.L||t===ot.P&&e===ot.A||t===ot.L&&e===ot.A?ue.isTrue(this.matrix[S.INTERIOR][S.INTERIOR])&&ue.isTrue(this.matrix[S.INTERIOR][S.EXTERIOR]):t===ot.L&&e===ot.P||t===ot.A&&e===ot.P||t===ot.A&&e===ot.L?ue.isTrue(this.matrix[S.INTERIOR][S.INTERIOR])&&ue.isTrue(this.matrix[S.EXTERIOR][S.INTERIOR]):t===ot.L&&e===ot.L&&0===this.matrix[S.INTERIOR][S.INTERIOR]},interfaces_:function(){return[s]},getClass:function(){return ue}}),ue.matches=function(){if(Number.isInteger(arguments[0])&&"string"==typeof arguments[1]){var t=arguments[0],e=arguments[1];return e===ot.SYM_DONTCARE||(e===ot.SYM_TRUE&&(t>=0||t===ot.TRUE)||(e===ot.SYM_FALSE&&t===ot.FALSE||(e===ot.SYM_P&&t===ot.P||(e===ot.SYM_L&&t===ot.L||e===ot.SYM_A&&t===ot.A))))}if("string"==typeof arguments[0]&&"string"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return new ue(n).matches(i)}},ue.isTrue=function(t){return t>=0||t===ot.TRUE};var yo=Object.freeze({Coordinate:c,CoordinateList:E,Envelope:I,LineSegment:ae,GeometryFactory:$t,Geometry:F,Point:Ct,LineString:It,LinearRing:Rt,Polygon:Lt,GeometryCollection:lt,MultiPoint:wt,MultiLineString:ht,MultiPolygon:Tt,Dimension:ot,IntersectionMatrix:ue,PrecisionModel:Qt});io(le.prototype,{addPoint:function(t){this.ptCount+=1,this.ptCentSum.x+=t.x,this.ptCentSum.y+=t.y},setBasePoint:function(t){null===this.areaBasePt&&(this.areaBasePt=t)},addLineSegments:function(t){for(var e=0,n=0;n<t.length-1;n++){var i=t[n].distance(t[n+1]);if(0!==i){e+=i;var r=(t[n].x+t[n+1].x)/2;this.lineCentSum.x+=i*r;var s=(t[n].y+t[n+1].y)/2;this.lineCentSum.y+=i*s}}this.totalLength+=e,0===e&&t.length>0&&this.addPoint(t[0])},addHole:function(t){for(var e=oe.isCCW(t),n=0;n<t.length-1;n++)this.addTriangle(this.areaBasePt,t[n],t[n+1],e);this.addLineSegments(t)},getCentroid:function(){var t=new c;if(Math.abs(this.areasum2)>0)t.x=this.cg3.x/3/this.areasum2,t.y=this.cg3.y/3/this.areasum2;else if(this.totalLength>0)t.x=this.lineCentSum.x/this.totalLength,t.y=this.lineCentSum.y/this.totalLength;else{if(!(this.ptCount>0))return null;t.x=this.ptCentSum.x/this.ptCount,t.y=this.ptCentSum.y/this.ptCount}return t},addShell:function(t){t.length>0&&this.setBasePoint(t[0]);for(var e=!oe.isCCW(t),n=0;n<t.length-1;n++)this.addTriangle(this.areaBasePt,t[n],t[n+1],e);this.addLineSegments(t)},addTriangle:function(t,e,n,i){var r=i?1:-1;le.centroid3(t,e,n,this.triangleCent3);var s=le.area2(t,e,n);this.cg3.x+=r*s*this.triangleCent3.x,this.cg3.y+=r*s*this.triangleCent3.y,this.areasum2+=r*s},add:function(){if(arguments[0]instanceof Lt){var t=arguments[0];this.addShell(t.getExteriorRing().getCoordinates());for(var e=0;e<t.getNumInteriorRing();e++)this.addHole(t.getInteriorRingN(e).getCoordinates())}else if(arguments[0]instanceof F){var n=arguments[0];if(n.isEmpty())return null;if(n instanceof Ct)this.addPoint(n.getCoordinate());else if(n instanceof It)this.addLineSegments(n.getCoordinates());else if(n instanceof Lt){var i=n;this.add(i)}else if(n instanceof lt)for(var r=n,e=0;e<r.getNumGeometries();e++)this.add(r.getGeometryN(e))}},interfaces_:function(){return[]},getClass:function(){return le}}),le.area2=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(n.x-t.x)*(e.y-t.y)},le.centroid3=function(t,e,n,i){return i.x=t.x+e.x+n.x,i.y=t.y+e.y+n.y,null},le.getCentroid=function(t){return new le(t).getCentroid()},he.prototype=new Error,he.prototype.name="EmptyStackException",ce.prototype=new m,ce.prototype.add=function(t){return this.array_.push(t),!0},ce.prototype.get=function(t){if(t<0||t>=this.size())throw new IndexOutOfBoundsException;return this.array_[t]},ce.prototype.push=function(t){return this.array_.push(t),t},ce.prototype.pop=function(t){if(0===this.array_.length)throw new he;return this.array_.pop()},ce.prototype.peek=function(){if(0===this.array_.length)throw new he;return this.array_[this.array_.length-1]},ce.prototype.empty=function(){return 0===this.array_.length},ce.prototype.isEmpty=function(){return this.empty()},ce.prototype.search=function(t){return this.array_.indexOf(t)},ce.prototype.size=function(){return this.array_.length},ce.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},io(fe.prototype,{filter:function(t){this.treeSet.contains(t)||(this.list.add(t),this.treeSet.add(t))},getCoordinates:function(){var t=new Array(this.list.size()).fill(null);return this.list.toArray(t)},interfaces_:function(){return[G]},getClass:function(){return fe}}),fe.filterCoordinates=function(t){for(var e=new fe,n=0;n<t.length;n++)e.filter(t[n]);return e.getCoordinates()},io(ge.prototype,{preSort:function(t){for(var e=null,n=1;n<t.length;n++)(t[n].y<t[0].y||t[n].y===t[0].y&&t[n].x<t[0].x)&&(e=t[0],t[0]=t[n],t[n]=e);return st.sort(t,1,t.length,new de(t[0])),t},computeOctRing:function(t){var e=this.computeOctPts(t),n=new E;return n.add(e,!1),n.size()<3?null:(n.closeRing(),n.toCoordinateArray())},lineOrPolygon:function(t){if(t=this.cleanRing(t),3===t.length)return this.geomFactory.createLineString([t[0],t[1]]);var e=this.geomFactory.createLinearRing(t);return this.geomFactory.createPolygon(e,null)},cleanRing:function(t){h.equals(t[0],t[t.length-1]);for(var e=new x,n=null,i=0;i<=t.length-2;i++){var r=t[i],s=t[i+1];r.equals(s)||(null!==n&&this.isBetween(n,r,s)||(e.add(r),n=r))}e.add(t[t.length-1]);var o=new Array(e.size()).fill(null);return e.toArray(o)},isBetween:function(t,e,n){if(0!==oe.computeOrientation(t,e,n))return!1;if(t.x!==n.x){
if(t.x<=e.x&&e.x<=n.x)return!0;if(n.x<=e.x&&e.x<=t.x)return!0}if(t.y!==n.y){if(t.y<=e.y&&e.y<=n.y)return!0;if(n.y<=e.y&&e.y<=t.y)return!0}return!1},reduce:function(t){var e=this.computeOctRing(t);if(null===e)return t;for(var n=new rt,i=0;i<e.length;i++)n.add(e[i]);for(var i=0;i<t.length;i++)oe.isPointInRing(t[i],e)||n.add(t[i]);var r=Y.toCoordinateArray(n);return r.length<3?this.padArray3(r):r},getConvexHull:function(){if(0===this.inputPts.length)return this.geomFactory.createGeometryCollection(null);if(1===this.inputPts.length)return this.geomFactory.createPoint(this.inputPts[0]);if(2===this.inputPts.length)return this.geomFactory.createLineString(this.inputPts);var t=this.inputPts;this.inputPts.length>50&&(t=this.reduce(this.inputPts));var e=this.preSort(t),n=this.grahamScan(e),i=this.toCoordinateArray(n);return this.lineOrPolygon(i)},padArray3:function(t){for(var e=new Array(3).fill(null),n=0;n<e.length;n++)n<t.length?e[n]=t[n]:e[n]=t[0];return e},computeOctPts:function(t){for(var e=new Array(8).fill(null),n=0;n<e.length;n++)e[n]=t[0];for(var i=1;i<t.length;i++)t[i].x<e[0].x&&(e[0]=t[i]),t[i].x-t[i].y<e[1].x-e[1].y&&(e[1]=t[i]),t[i].y>e[2].y&&(e[2]=t[i]),t[i].x+t[i].y>e[3].x+e[3].y&&(e[3]=t[i]),t[i].x>e[4].x&&(e[4]=t[i]),t[i].x-t[i].y>e[5].x-e[5].y&&(e[5]=t[i]),t[i].y<e[6].y&&(e[6]=t[i]),t[i].x+t[i].y<e[7].x+e[7].y&&(e[7]=t[i]);return e},toCoordinateArray:function(t){for(var e=new Array(t.size()).fill(null),n=0;n<t.size();n++){var i=t.get(n);e[n]=i}return e},grahamScan:function(t){var e=null,n=new ce;e=n.push(t[0]),e=n.push(t[1]),e=n.push(t[2]);for(var i=3;i<t.length;i++){for(e=n.pop();!n.empty()&&oe.computeOrientation(n.peek(),e,t[i])>0;)e=n.pop();e=n.push(e),e=n.push(t[i])}return e=n.push(t[0]),n},interfaces_:function(){return[]},getClass:function(){return ge}}),ge.extractCoordinates=function(t){var e=new fe;return t.apply(e),e.getCoordinates()},io(de.prototype,{compare:function(t,e){var n=t,i=e;return de.polarCompare(this.origin,n,i)},interfaces_:function(){return[o]},getClass:function(){return de}}),de.polarCompare=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,s=n.x-t.x,o=n.y-t.y,a=oe.computeOrientation(t,e,n);if(a===oe.COUNTERCLOCKWISE)return 1;if(a===oe.CLOCKWISE)return-1;var u=i*i+r*r,l=s*s+o*o;return u<l?-1:u>l?1:0},ge.RadialComparator=de,io(pe.prototype,{transformPoint:function(t,e){return this.factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},transformPolygon:function(t,e){var n=!0,i=this.transformLinearRing(t.getExteriorRing(),t);null!==i&&i instanceof Rt&&!i.isEmpty()||(n=!1);for(var r=new x,s=0;s<t.getNumInteriorRing();s++){var o=this.transformLinearRing(t.getInteriorRingN(s),t);null===o||o.isEmpty()||(o instanceof Rt||(n=!1),r.add(o))}if(n)return this.factory.createPolygon(i,r.toArray([]));var a=new x;return null!==i&&a.add(i),a.addAll(r),this.factory.buildGeometry(a)},createCoordinateSequence:function(t){return this.factory.getCoordinateSequenceFactory().create(t)},getInputGeometry:function(){return this.inputGeom},transformMultiLineString:function(t,e){for(var n=new x,i=0;i<t.getNumGeometries();i++){var r=this.transformLineString(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this.factory.buildGeometry(n)},transformCoordinates:function(t,e){return this.copy(t)},transformLineString:function(t,e){return this.factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},transformMultiPoint:function(t,e){for(var n=new x,i=0;i<t.getNumGeometries();i++){var r=this.transformPoint(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this.factory.buildGeometry(n)},transformMultiPolygon:function(t,e){for(var n=new x,i=0;i<t.getNumGeometries();i++){var r=this.transformPolygon(t.getGeometryN(i),t);null!==r&&(r.isEmpty()||n.add(r))}return this.factory.buildGeometry(n)},copy:function(t){return t.copy()},transformGeometryCollection:function(t,e){for(var n=new x,i=0;i<t.getNumGeometries();i++){var r=this.transform(t.getGeometryN(i));null!==r&&(this.pruneEmptyGeometry&&r.isEmpty()||n.add(r))}return this.preserveGeometryCollectionType?this.factory.createGeometryCollection($t.toGeometryArray(n)):this.factory.buildGeometry(n)},transform:function(t){if(this.inputGeom=t,this.factory=t.getFactory(),t instanceof Ct)return this.transformPoint(t,null);if(t instanceof wt)return this.transformMultiPoint(t,null);if(t instanceof Rt)return this.transformLinearRing(t,null);if(t instanceof It)return this.transformLineString(t,null);if(t instanceof ht)return this.transformMultiLineString(t,null);if(t instanceof Lt)return this.transformPolygon(t,null);if(t instanceof Tt)return this.transformMultiPolygon(t,null);if(t instanceof lt)return this.transformGeometryCollection(t,null);throw new n("Unknown Geometry subtype: "+t.getClass().getName())},transformLinearRing:function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this.factory.createLinearRing(null);var i=n.size();return i>0&&i<4&&!this.preserveType?this.factory.createLineString(n):this.factory.createLinearRing(n)},interfaces_:function(){return[]},getClass:function(){return pe}}),io(me.prototype,{snapVertices:function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),i=0;i<n;i++){var r=t.get(i),s=this.findSnapForVertex(r,e);null!==s&&(t.set(i,new c(s)),0===i&&this._isClosed&&t.set(t.size()-1,new c(s)))}},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},snapTo:function(t){var e=new E(this.srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},snapSegments:function(t,e){if(0===e.length)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var i=0;i<n;i++){var r=e[i],s=this.findSegmentIndexToSnap(r,t);s>=0&&t.add(s+1,new c(r),!1)}},findSegmentIndexToSnap:function(t,e){for(var n=i.MAX_VALUE,r=-1,s=0;s<e.size()-1;s++){if(this.seg.p0=e.get(s),this.seg.p1=e.get(s+1),this.seg.p0.equals2D(t)||this.seg.p1.equals2D(t)){if(this.allowSnappingToSourceVertices)continue;return-1}var o=this.seg.distance(t);o<this.snapTolerance&&o<n&&(n=o,r=s)}return r},setAllowSnappingToSourceVertices:function(t){this.allowSnappingToSourceVertices=t},interfaces_:function(){return[]},getClass:function(){return me}}),me.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])},io(ve.prototype,{snapTo:function(t,e){return new ye(e,this.extractTargetCoordinates(t)).transform(this.srcGeom)},snapToSelf:function(t,e){var n=this.extractTargetCoordinates(this.srcGeom),i=new ye(t,n,!0),r=i.transform(this.srcGeom),s=r;return e&&oo(s,St)&&(s=r.buffer(0)),s},computeSnapTolerance:function(t){return this.computeMinimumSegmentLength(t)/10},extractTargetCoordinates:function(t){for(var e=new rt,n=t.getCoordinates(),i=0;i<n.length;i++)e.add(n[i]);return e.toArray(new Array(0).fill(null))},computeMinimumSegmentLength:function(t){for(var e=i.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},interfaces_:function(){return[]},getClass:function(){return ve}}),ve.snap=function(t,e,n){var i=new Array(2).fill(null),r=new ve(t);i[0]=r.snapTo(e,n);var s=new ve(e);return i[1]=s.snapTo(i[0],n),i},ve.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=ve.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===Qt.FIXED){var i=1/n.getScale()*2/1.415;i>e&&(e=i)}return e}if(2===arguments.length){var r=arguments[0],s=arguments[1];return Math.min(ve.computeOverlaySnapTolerance(r),ve.computeOverlaySnapTolerance(s))}},ve.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*ve.SNAP_PRECISION_FACTOR},ve.snapToSelf=function(t,e,n){return new ve(t).snapToSelf(e,n)},ve.SNAP_PRECISION_FACTOR=1e-9,ro(ye,pe),io(ye.prototype,{snapLine:function(t,e){var n=new me(t,this.snapTolerance);return n.setAllowSnappingToSourceVertices(this.isSelfSnap),n.snapTo(e)},transformCoordinates:function(t,e){var n=t.toCoordinateArray(),i=this.snapLine(n,this.snapPts);return this.factory.getCoordinateSequenceFactory().create(i)},interfaces_:function(){return[]},getClass:function(){return ye}}),io(xe.prototype,{getCommon:function(){return i.longBitsToDouble(this.commonBits)},add:function(t){var e=i.doubleToLongBits(t);return this.isFirst?(this.commonBits=e,this.commonSignExp=xe.signExpBits(this.commonBits),this.isFirst=!1,null):xe.signExpBits(e)!==this.commonSignExp?(this.commonBits=0,null):(this.commonMantissaBitsCount=xe.numCommonMostSigMantissaBits(this.commonBits,e),void(this.commonBits=xe.zeroLowerBits(this.commonBits,64-(12+this.commonMantissaBitsCount))))},toString:function(){if(1===arguments.length){var t=arguments[0],e=i.longBitsToDouble(t),n=Long.toBinaryString(t),r="0000000000000000000000000000000000000000000000000000000000000000"+n,s=r.substring(r.length-64);return s.substring(0,1)+" "+s.substring(1,12)+"(exp) "+s.substring(12)+" [ "+e+" ]"}},interfaces_:function(){return[]},getClass:function(){return xe}}),xe.getBit=function(t,e){return 0!=(t&1<<e)?1:0},xe.signExpBits=function(t){return t>>52},xe.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},xe.numCommonMostSigMantissaBits=function(t,e){for(var n=0,i=52;i>=0;i--){if(xe.getBit(t,i)!==xe.getBit(e,i))return n;n++}return 52},io(Ee.prototype,{addCommonBits:function(t){var e=new Ne(this.commonCoord);t.apply(e),t.geometryChanged()},removeCommonBits:function(t){if(0===this.commonCoord.x&&0===this.commonCoord.y)return t;var e=new c(this.commonCoord);e.x=-e.x,e.y=-e.y;var n=new Ne(e);return t.apply(n),t.geometryChanged(),t},getCommonCoordinate:function(){return this.commonCoord},add:function(t){t.apply(this.ccFilter),this.commonCoord=this.ccFilter.getCommonCoordinate()},interfaces_:function(){return[]},getClass:function(){return Ee}}),io(Ie.prototype,{filter:function(t){this.commonBitsX.add(t.x),this.commonBitsY.add(t.y)},getCommonCoordinate:function(){return new c(this.commonBitsX.getCommon(),this.commonBitsY.getCommon())},interfaces_:function(){return[G]},getClass:function(){return Ie}}),io(Ne.prototype,{filter:function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,i=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,i)},isDone:function(){return!1},isGeometryChanged:function(){return!0},interfaces_:function(){return[ut]},getClass:function(){return Ne}}),Ee.CommonCoordinateFilter=Ie,Ee.Translater=Ne,io(Ce.prototype,{next:function(){if(this.atStart)return this.atStart=!1,Ce.isAtomic(this.parent)&&this.index++,this.parent;if(null!==this.subcollectionIterator){if(this.subcollectionIterator.hasNext())return this.subcollectionIterator.next();this.subcollectionIterator=null}if(this.index>=this.max)throw new v;var t=this.parent.getGeometryN(this.index++);return t instanceof lt?(this.subcollectionIterator=new Ce(t),this.subcollectionIterator.next()):t},remove:function(){throw new UnsupportedOperationException(this.getClass().getName())},hasNext:function(){if(this.atStart)return!0;if(null!==this.subcollectionIterator){if(this.subcollectionIterator.hasNext())return!0;this.subcollectionIterator=null}return!(this.index>=this.max)},interfaces_:function(){return[g]},getClass:function(){return Ce}}),Ce.isAtomic=function(t){return!(t instanceof lt)},io(Se.prototype,{locateInternal:function(){if(arguments[0]instanceof c&&arguments[1]instanceof Lt){var t=arguments[0],e=arguments[1];if(e.isEmpty())return S.EXTERIOR;var n=e.getExteriorRing(),i=this.locateInPolygonRing(t,n);if(i===S.EXTERIOR)return S.EXTERIOR;if(i===S.BOUNDARY)return S.BOUNDARY;for(var r=0;r<e.getNumInteriorRing();r++){var s=e.getInteriorRingN(r),o=this.locateInPolygonRing(t,s);if(o===S.INTERIOR)return S.EXTERIOR;if(o===S.BOUNDARY)return S.BOUNDARY}return S.INTERIOR}if(arguments[0]instanceof c&&arguments[1]instanceof It){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return S.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?oe.isOnLine(a,l)?S.INTERIOR:S.EXTERIOR:S.BOUNDARY}if(arguments[0]instanceof c&&arguments[1]instanceof Ct){var h=arguments[0];return arguments[1].getCoordinate().equals2D(h)?S.INTERIOR:S.EXTERIOR}},locateInPolygonRing:function(t,e){return e.getEnvelopeInternal().intersects(t)?oe.locatePointInRing(t,e.getCoordinates()):S.EXTERIOR},intersects:function(t,e){return this.locate(t,e)!==S.EXTERIOR},updateLocationInfo:function(t){t===S.INTERIOR&&(this.isIn=!0),t===S.BOUNDARY&&this.numBoundaries++},computeLocation:function(t,e){if(e instanceof Ct&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof It)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Lt)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof ht)for(var n=e,i=0;i<n.getNumGeometries();i++){var r=n.getGeometryN(i);this.updateLocationInfo(this.locateInternal(t,r))}else if(e instanceof Tt)for(var s=e,i=0;i<s.getNumGeometries();i++){var o=s.getGeometryN(i);this.updateLocationInfo(this.locateInternal(t,o))}else if(e instanceof lt)for(var a=new Ce(e);a.hasNext();){var u=a.next();u!==e&&this.computeLocation(t,u)}},locate:function(t,e){return e.isEmpty()?S.EXTERIOR:e instanceof It?this.locateInternal(t,e):e instanceof Lt?this.locateInternal(t,e):(this.isIn=!1,this.numBoundaries=0,this.computeLocation(t,e),this.boundaryRule.isInBoundary(this.numBoundaries)?S.BOUNDARY:this.numBoundaries>0||this.isIn?S.INTERIOR:S.EXTERIOR)},interfaces_:function(){return[]},getClass:function(){return Se}}),io(Le.prototype,{interfaces_:function(){return[]},getClass:function(){return Le}}),Le.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Cannot compute the octant for point ( "+t+", "+e+" )");var i=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?i>=r?0:1:i>=r?7:6:e>=0?i>=r?3:2:i>=r?4:5}if(arguments[0]instanceof c&&arguments[1]instanceof c){var s=arguments[0],o=arguments[1],a=o.x-s.x,u=o.y-s.y;if(0===a&&0===u)throw new n("Cannot compute the octant for two identical points "+s);return Le.octant(a,u)}},io(we.prototype,{getCoordinates:function(){},size:function(){},getCoordinate:function(t){},isClosed:function(){},setData:function(t){},getData:function(){},interfaces_:function(){return[]},getClass:function(){return we}}),io(Re.prototype,{getCoordinates:function(){return this.pts},size:function(){return this.pts.length},getCoordinate:function(t){return this.pts[t]},isClosed:function(){return this.pts[0].equals(this.pts[this.pts.length-1])},getSegmentOctant:function(t){return t===this.pts.length-1?-1:Le.octant(this.getCoordinate(t),this.getCoordinate(t+1))},setData:function(t){this.data=t},getData:function(){return this.data},toString:function(){return ee.toLineString(new Dt(this.pts))},interfaces_:function(){return[we]},getClass:function(){return Re}}),io(Te.prototype,{getBounds:function(){},interfaces_:function(){return[]},getClass:function(){return Te}}),io(Oe.prototype,{getItem:function(){return this.item},getBounds:function(){return this.bounds},interfaces_:function(){return[Te,a]},getClass:function(){return Oe}}),io(Pe.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},size:function(){return this._size},reorder:function(t){for(var e=null,n=this.items.get(t);2*t<=this._size&&(e=2*t,e!==this._size&&this.items.get(e+1).compareTo(this.items.get(e))<0&&e++,this.items.get(e).compareTo(n)<0);t=e)this.items.set(t,this.items.get(e));this.items.set(t,n)},clear:function(){this._size=0,this.items.clear()},isEmpty:function(){return 0===this._size},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)},interfaces_:function(){return[]},getClass:function(){return Pe}}),io(be.prototype,{visitItem:function(t){},interfaces_:function(){return[]},getClass:function(){return be}}),io(_e.prototype,{insert:function(t,e){},remove:function(t,e){},query:function(){if(1===arguments.length){arguments[0]}else if(2===arguments.length){arguments[0],arguments[1]}},interfaces_:function(){return[]},getClass:function(){return _e}}),io(Me.prototype,{getLevel:function(){return this.level},size:function(){return this.childBoundables.size()},getChildBoundables:function(){return this.childBoundables},addChildBoundable:function(t){h.isTrue(null===this.bounds),this.childBoundables.add(t)},isEmpty:function(){return this.childBoundables.isEmpty()},getBounds:function(){return null===this.bounds&&(this.bounds=this.computeBounds()),this.bounds},interfaces_:function(){return[Te,a]},getClass:function(){return Me}}),Me.serialVersionUID=0x5a1e55ec41369800;var xo={reverseOrder:function(){return{compare:function(t,e){return e.compareTo(t)}}},min:function(t){return xo.sort(t),t.get(0)},sort:function(t,e){var n=t.toArray();e?st.sort(n,e):st.sort(n);for(var i=t.iterator(),r=0,s=n.length;r<s;r++)i.next(),i.set(n[r])},singletonList:function(t){var e=new x;return e.add(t),e}};io(De.prototype,{expandToQueue:function(t,e){var i=De.isComposite(this.boundable1),r=De.isComposite(this.boundable2);if(i&&r)return De.area(this.boundable1)>De.area(this.boundable2)?(this.expand(this.boundable1,this.boundable2,t,e),null):(this.expand(this.boundable2,this.boundable1,t,e),null);if(i)return this.expand(this.boundable1,this.boundable2,t,e),null;if(r)return this.expand(this.boundable2,this.boundable1,t,e),null;throw new n("neither boundable is composite")},isLeaves:function(){return!(De.isComposite(this.boundable1)||De.isComposite(this.boundable2))},compareTo:function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},expand:function(t,e,n,i){for(var r=t.getChildBoundables(),s=r.iterator();s.hasNext();){var o=s.next(),a=new De(o,e,this.itemDistance);a.getDistance()<i&&n.add(a)}},getBoundable:function(t){return 0===t?this.boundable1:this.boundable2},getDistance:function(){return this._distance},distance:function(){return this.isLeaves()?this.itemDistance.distance(this.boundable1,this.boundable2):this.boundable1.getBounds().distance(this.boundable2.getBounds())},interfaces_:function(){return[r]},getClass:function(){return De}}),De.area=function(t){return t.getBounds().getArea()},De.isComposite=function(t){return t instanceof Me},io(Ae.prototype,{getNodeCapacity:function(){return this.nodeCapacity},lastNode:function(t){return t.get(t.size()-1)},size:function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this.root));if(1===arguments.length){for(var t=arguments[0],e=0,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof Me?e+=this.size(i):i instanceof Oe&&(e+=1)}return e}},removeItem:function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof Oe&&r.getItem()===e&&(n=r)}return null!==n&&(t.getChildBoundables().remove(n),!0)},itemsTree:function(){if(0===arguments.length){this.build();var t=this.itemsTree(this.root);return null===t?new x:t}if(1===arguments.length){for(var e=arguments[0],n=new x,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();if(r instanceof Me){var s=this.itemsTree(r);null!==s&&n.add(s)}else r instanceof Oe?n.add(r.getItem()):h.shouldNeverReachHere()}return n.size()<=0?null:n}},insert:function(t,e){h.isTrue(!this.built,"Cannot insert items into an STR packed R-tree after it has been built."),this.itemBoundables.add(new Oe(t,e))},boundablesAtLevel:function(){if(1===arguments.length){var t=arguments[0],e=new x;return this.boundablesAtLevel(t,this.root,e),e}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];if(h.isTrue(n>-2),i.getLevel()===n)return r.add(i),null;for(var s=i.getChildBoundables().iterator();s.hasNext();){var o=s.next();o instanceof Me?this.boundablesAtLevel(n,o,r):(h.isTrue(o instanceof Oe),-1===n&&r.add(o))}return null}},query:function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new x;return this.isEmpty()?e:(this.getIntersectsOp().intersects(this.root.getBounds(),t)&&this.query(t,this.root,e),e)}if(2===arguments.length){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this.root.getBounds(),n)&&this.query(n,this.root,i)}else if(3===arguments.length)if(oo(arguments[2],be)&&arguments[0]instanceof Object&&arguments[1]instanceof Me)for(var r=arguments[0],s=arguments[1],o=arguments[2],a=s.getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);this.getIntersectsOp().intersects(l.getBounds(),r)&&(l instanceof Me?this.query(r,l,o):l instanceof Oe?o.visitItem(l.getItem()):h.shouldNeverReachHere())}else if(oo(arguments[2],m)&&arguments[0]instanceof Object&&arguments[1]instanceof Me)for(var c=arguments[0],f=arguments[1],g=arguments[2],a=f.getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);this.getIntersectsOp().intersects(l.getBounds(),c)&&(l instanceof Me?this.query(c,l,g):l instanceof Oe?g.add(l.getItem()):h.shouldNeverReachHere())}},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},getRoot:function(){return this.build(),this.root},remove:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this.root.getBounds(),t)&&this.remove(t,this.root,e)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=this.removeItem(i,r);if(s)return!0;for(var o=null,a=i.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&(u instanceof Me&&(s=this.remove(n,u,r)))){o=u;break}}return null!==o&&o.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(o),s}},createHigherLevels:function(t,e){h.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},depth:function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this.root));if(1===arguments.length){for(var t=arguments[0],e=0,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof Me){var r=this.depth(i);r>e&&(e=r)}}return e+1}},createParentBoundables:function(t,e){h.isTrue(!t.isEmpty());var n=new x;n.add(this.createNode(e));var i=new x(t);xo.sort(i,this.getComparator());for(var r=i.iterator();r.hasNext();){var s=r.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(s)}return n},isEmpty:function(){return this.built?this.root.isEmpty():this.itemBoundables.isEmpty()},interfaces_:function(){return[a]},getClass:function(){return Ae}}),Ae.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},Ae.IntersectsOp=Fe,Ae.serialVersionUID=-0x35ef64c82d4c5400,Ae.DEFAULT_NODE_CAPACITY=10,io(Ge.prototype,{distance:function(t,e){},interfaces_:function(){return[]},getClass:function(){return Ge}}),ro(qe,Ae),io(qe.prototype,{createParentBoundablesFromVerticalSlices:function(t,e){h.isTrue(t.length>0);for(var n=new x,i=0;i<t.length;i++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[i],e));return n},createNode:function(t){return new Be(t)},size:function(){return 0===arguments.length?Ae.prototype.size.call(this):Ae.prototype.size.apply(this,arguments)},insert:function(){if(2!==arguments.length)return Ae.prototype.insert.apply(this,arguments);var t=arguments[0],e=arguments[1];if(t.isNull())return null;Ae.prototype.insert.call(this,t,e)},getIntersectsOp:function(){return qe.intersectsOp},verticalSlices:function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),i=new Array(e).fill(null),r=t.iterator(),s=0;s<e;s++){i[s]=new x;for(var o=0;r.hasNext()&&o<n;){var a=r.next();i[s].add(a),o++}}return i},query:function(){if(1===arguments.length){var t=arguments[0];return Ae.prototype.query.call(this,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];Ae.prototype.query.call(this,e,n)}else if(3===arguments.length)if(oo(arguments[2],be)&&arguments[0]instanceof Object&&arguments[1]instanceof Me){var i=arguments[0],r=arguments[1],s=arguments[2];Ae.prototype.query.call(this,i,r,s)}else if(oo(arguments[2],m)&&arguments[0]instanceof Object&&arguments[1]instanceof Me){var o=arguments[0],a=arguments[1],u=arguments[2];Ae.prototype.query.call(this,o,a,u)}},getComparator:function(){return qe.yComparator},createParentBoundablesFromVerticalSlice:function(t,e){return Ae.prototype.createParentBoundables.call(this,t,e)},remove:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return Ae.prototype.remove.call(this,t,e)}return Ae.prototype.remove.apply(this,arguments)},depth:function(){return 0===arguments.length?Ae.prototype.depth.call(this):Ae.prototype.depth.apply(this,arguments)},createParentBoundables:function(t,e){h.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new x(t);xo.sort(i,qe.xComparator);var r=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(r,e)},nearestNeighbour:function(){if(1===arguments.length){if(oo(arguments[0],Ge)){var t=arguments[0],e=new De(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(e)}if(arguments[0]instanceof De){var n=arguments[0];return this.nearestNeighbour(n,i.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof qe&&oo(arguments[1],Ge)){var r=arguments[0],s=arguments[1],e=new De(this.getRoot(),r.getRoot(),s);return this.nearestNeighbour(e)}if(arguments[0]instanceof De&&"number"==typeof arguments[1]){var o=arguments[0],a=arguments[1],u=a,l=null,h=new Pe;for(h.add(o);!h.isEmpty()&&u>0;){var c=h.poll(),f=c.getDistance();if(f>=u)break;c.isLeaves()?(u=f,l=c):c.expandToQueue(h,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var g=arguments[0],d=arguments[1],p=arguments[2],m=new Oe(g,d),e=new De(this.getRoot(),m,p);return this.nearestNeighbour(e)[0]}},interfaces_:function(){return[_e,a]},getClass:function(){return qe}}),qe.centreX=function(t){return qe.avg(t.getMinX(),t.getMaxX())},qe.avg=function(t,e){return(t+e)/2},qe.centreY=function(t){return qe.avg(t.getMinY(),t.getMaxY())},ro(Be,Me),io(Be.prototype,{computeBounds:function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new I(n.getBounds()):t.expandToInclude(n.getBounds())}return t},interfaces_:function(){return[]},getClass:function(){return Be}}),qe.STRtreeNode=Be,qe.serialVersionUID=0x39920f7d5f261e0,qe.xComparator={interfaces_:function(){return[o]},compare:function(t,e){return Ae.compareDoubles(qe.centreX(t.getBounds()),qe.centreX(e.getBounds()))}},qe.yComparator={interfaces_:function(){return[o]},compare:function(t,e){return Ae.compareDoubles(qe.centreY(t.getBounds()),qe.centreY(e.getBounds()))}},qe.intersectsOp={interfaces_:function(){return[IntersectsOp]},intersects:function(t,e){return t.intersects(e)}},qe.DEFAULT_NODE_CAPACITY=10,io(Ve.prototype,{interfaces_:function(){return[]},getClass:function(){return Ve}}),Ve.relativeSign=function(t,e){return t<e?-1:t>e?1:0},Ve.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=Ve.relativeSign(e.x,n.x),r=Ve.relativeSign(e.y,n.y);switch(t){case 0:return Ve.compareValue(i,r);case 1:return Ve.compareValue(r,i);case 2:return Ve.compareValue(r,-i);case 3:return Ve.compareValue(-i,r);case 4:return Ve.compareValue(-i,-r);case 5:return Ve.compareValue(-r,-i);case 6:return Ve.compareValue(-r,i);case 7:return Ve.compareValue(i,-r)}return h.shouldNeverReachHere("invalid octant value"),0},Ve.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0},io(ze.prototype,{getCoordinate:function(){return this.coord},print:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},compareTo:function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:Ve.compare(this.segmentOctant,this.coord,e.coord)},isEndPoint:function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},isInterior:function(){return this._isInterior},interfaces_:function(){return[r]},getClass:function(){return ze}}),io(ke.prototype,{getSplitCoordinates:function(){var t=new E;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next();this.addEdgeCoordinates(n,i,t),n=i}return t.toCoordinateArray()},addCollapsedNodes:function(){var t=new x;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)}},print:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},findCollapsesFromExistingVertices:function(t){for(var e=0;e<this.edge.size()-2;e++){var n=this.edge.getCoordinate(e),i=(this.edge.getCoordinate(e+1),this.edge.getCoordinate(e+2));n.equals2D(i)&&t.add(new R(e+1))}},addEdgeCoordinates:function(t,e,n){var i=e.segmentIndex-t.segmentIndex+2,r=this.edge.getCoordinate(e.segmentIndex),s=e.isInterior()||!e.coord.equals2D(r);s||i--;n.add(new c(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this.edge.getCoordinate(o));s&&n.add(new c(e.coord))},iterator:function(){return this.nodeMap.values().iterator()},addSplitEdges:function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),r=this.createSplitEdge(n,i);t.add(r),n=i}},findCollapseIndex:function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var i=e.segmentIndex-t.segmentIndex;return e.isInterior()||i--,1===i&&(n[0]=t.segmentIndex+1,!0)},findCollapsesFromInsertedNodes:function(t){for(var e=new Array(1).fill(null),n=this.iterator(),i=n.next();n.hasNext();){var r=n.next();this.findCollapseIndex(i,r,e)&&t.add(new R(e[0])),i=r}},getEdge:function(){return this.edge},addEndpoints:function(){var t=this.edge.size()-1;this.add(this.edge.getCoordinate(0),0),this.add(this.edge.getCoordinate(t),t)},createSplitEdge:function(t,e){var n=e.segmentIndex-t.segmentIndex+2,i=this.edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(i);r||n--;var s=new Array(n).fill(null),o=0;s[o++]=new c(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)s[o++]=this.edge.getCoordinate(a);return r&&(s[o]=new c(e.coord)),new Xe(s,this.edge.getData())},add:function(t,e){var n=new ze(this.edge,t,e,this.edge.getSegmentOctant(e)),i=this.nodeMap.get(n);return null!==i?(h.isTrue(i.coord.equals2D(t),"Found equal nodes with different coordinates"),i):(this.nodeMap.put(n,n),n)},checkSplitEdgesCorrectness:function(t){var e=this.edge.getCoordinates(),n=t.get(0),i=n.getCoordinate(0);if(!i.equals2D(e[0]))throw new u("bad split edge start point at "+i);var r=t.get(t.size()-1),s=r.getCoordinates(),o=s[s.length-1];if(!o.equals2D(e[e.length-1]))throw new u("bad split edge end point at "+o)},interfaces_:function(){return[]},getClass:function(){return ke}}),io(Ye.prototype,{next:function(){return null===this.currNode?(this.currNode=this.nextNode,this.currSegIndex=this.currNode.segmentIndex,this.readNextNode(),this.currNode):null===this.nextNode?null:this.nextNode.segmentIndex===this.currNode.segmentIndex?(this.currNode=this.nextNode,this.currSegIndex=this.currNode.segmentIndex,this.readNextNode(),this.currNode):(this.nextNode.segmentIndex,this.currNode.segmentIndex,null)},remove:function(){throw new UnsupportedOperationException(this.getClass().getName())},hasNext:function(){return null!==this.nextNode},readNextNode:function(){this.nodeIt.hasNext()?this.nextNode=this.nodeIt.next():this.nextNode=null},interfaces_:function(){return[g]},getClass:function(){return Ye}}),io(Ue.prototype,{addIntersection:function(t,e){},interfaces_:function(){return[we]},getClass:function(){return Ue}}),
io(Xe.prototype,{getCoordinates:function(){return this.pts},size:function(){return this.pts.length},getCoordinate:function(t){return this.pts[t]},isClosed:function(){return this.pts[0].equals(this.pts[this.pts.length-1])},getSegmentOctant:function(t){return t===this.pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},setData:function(t){this.data=t},safeOctant:function(t,e){return t.equals2D(e)?0:Le.octant(t,e)},getData:function(){return this.data},addIntersection:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[0],i=arguments[1],r=(arguments[2],arguments[3]),s=new c(n.getIntersection(r));this.addIntersection(s,i)}},toString:function(){return ee.toLineString(new Dt(this.pts))},getNodeList:function(){return this.nodeList},addIntersectionNode:function(t,e){var n=e,i=n+1;if(i<this.pts.length){var r=this.pts[i];t.equals2D(r)&&(n=i)}return this.nodeList.add(t,n)},addIntersections:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)},interfaces_:function(){return[Ue]},getClass:function(){return Xe}}),Xe.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new x;return Xe.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[0],i=arguments[1],r=n.iterator();r.hasNext();){var s=r.next();s.getNodeList().addSplitEdges(i)}},io(He.prototype,{overlap:function(){if(2===arguments.length){arguments[0],arguments[1]}else if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];t.getLineSegment(e,this.overlapSeg1),n.getLineSegment(i,this.overlapSeg2),this.overlap(this.overlapSeg1,this.overlapSeg2)}},interfaces_:function(){return[]},getClass:function(){return He}}),io(We.prototype,{getLineSegment:function(t,e){e.p0=this.pts[t],e.p1=this.pts[t+1]},computeSelect:function(t,e,n,i){var r=this.pts[e],s=this.pts[n];if(i.tempEnv1.init(r,s),n-e==1)return i.select(this,e),null;if(!t.intersects(i.tempEnv1))return null;var o=Math.trunc((e+n)/2);e<o&&this.computeSelect(t,e,o,i),o<n&&this.computeSelect(t,o,n,i)},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},computeOverlaps:function(t,e){this.computeOverlapsInternal(this.start,this.end,t,t.start,t.end,e)},setId:function(t){this.id=t},select:function(t,e){this.computeSelect(t,this.start,this.end,e)},getEnvelope:function(){if(null===this.env){var t=this.pts[this.start],e=this.pts[this.end];this.env=new I(t,e)}return this.env},getEndIndex:function(){return this.end},getStartIndex:function(){return this.start},getContext:function(){return this.context},getId:function(){return this.id},computeOverlapsInternal:function(t,e,n,i,r,s){var o=this.pts[t],a=this.pts[e],u=n.pts[i],l=n.pts[r];if(e-t==1&&r-i==1)return s.overlap(this,t,n,i),null;if(s.tempEnv1.init(o,a),s.tempEnv2.init(u,l),!s.tempEnv1.intersects(s.tempEnv2))return null;var h=Math.trunc((t+e)/2),c=Math.trunc((i+r)/2);t<h&&(i<c&&this.computeOverlapsInternal(t,h,n,i,c,s),c<r&&this.computeOverlapsInternal(t,h,n,c,r,s)),h<e&&(i<c&&this.computeOverlapsInternal(h,e,n,i,c,s),c<r&&this.computeOverlapsInternal(h,e,n,c,r,s))},interfaces_:function(){return[]},getClass:function(){return We}}),io(je.prototype,{interfaces_:function(){return[]},getClass:function(){return je}}),je.isNorthern=function(t){return t===je.NE||t===je.NW},je.isOpposite=function(t,e){return t!==e&&2==(t-e+4)%4},je.commonHalfPlane=function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var n=t<e?t:e,i=t>e?t:e;return 0===n&&3===i?3:n},je.isInHalfPlane=function(t,e){return e===je.SE?t===je.SE||t===je.SW:t===e||t===e+1},je.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?je.NE:je.SE:e>=0?je.NW:je.SW}if(arguments[0]instanceof c&&arguments[1]instanceof c){var i=arguments[0],r=arguments[1];if(r.x===i.x&&r.y===i.y)throw new n("Cannot compute the quadrant for two identical points "+i);return r.x>=i.x?r.y>=i.y?je.NE:je.SE:r.y>=i.y?je.NW:je.SW}},je.NE=0,je.NW=1,je.SW=2,je.SE=3,io(Ke.prototype,{interfaces_:function(){return[]},getClass:function(){return Ke}}),Ke.getChainStartIndices=function(t){var e=0,n=new x;n.add(new R(e));do{var i=Ke.findChainEnd(t,e);n.add(new R(i)),e=i}while(e<t.length-1);return Ke.toIntArray(n)},Ke.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 i=je.quadrant(t[n],t[n+1]),r=e+1;r<t.length;){if(!t[r-1].equals2D(t[r])){if(je.quadrant(t[r-1],t[r])!==i)break}r++}return r-1},Ke.getChains=function(){if(1===arguments.length){var t=arguments[0];return Ke.getChains(t,null)}if(2===arguments.length){for(var e=arguments[0],n=arguments[1],i=new x,r=Ke.getChainStartIndices(e),s=0;s<r.length-1;s++){var o=new We(e,r[s],r[s+1],n);i.add(o)}return i}},Ke.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},io(Ze.prototype,{computeNodes:function(t){},getNodedSubstrings:function(){},interfaces_:function(){return[]},getClass:function(){return Ze}}),io(Qe.prototype,{setSegmentIntersector:function(t){this.segInt=t},interfaces_:function(){return[Ze]},getClass:function(){return Qe}}),ro(Je,Qe),io(Je.prototype,{getMonotoneChains:function(){return this.monoChains},getNodedSubstrings:function(){return Xe.getNodedSubstrings(this.nodedSegStrings)},getIndex:function(){return this.index},add:function(t){for(var e=Ke.getChains(t.getCoordinates(),t),n=e.iterator();n.hasNext();){var i=n.next();i.setId(this.idCounter++),this.index.insert(i.getEnvelope(),i),this.monoChains.add(i)}},computeNodes:function(t){this.nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},intersectChains:function(){for(var t=new $e(this.segInt),e=this.monoChains.iterator();e.hasNext();)for(var n=e.next(),i=this.index.query(n.getEnvelope()),r=i.iterator();r.hasNext();){var s=r.next();if(s.getId()>n.getId()&&(n.computeOverlaps(s,t),this.nOverlaps++),this.segInt.isDone())return null}},interfaces_:function(){return[]},getClass:function(){return Je}}),ro($e,He),io($e.prototype,{overlap:function(){if(4!==arguments.length)return He.prototype.overlap.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3],r=t.getContext(),s=n.getContext();this.si.processIntersections(r,e,s,i)},interfaces_:function(){return[]},getClass:function(){return $e}}),Je.SegmentOverlapAction=$e,ro(tn,u),io(tn.prototype,{getCoordinate:function(){return this.pt},interfaces_:function(){return[]},getClass:function(){return tn}}),tn.msgWithCoord=function(t,e){return null!==e?t+" [ "+e+" ]":t},io(en.prototype,{processIntersections:function(t,e,n,i){},isDone:function(){},interfaces_:function(){return[]},getClass:function(){return en}}),io(nn.prototype,{getInteriorIntersection:function(){return this.interiorIntersection},setCheckEndSegmentsOnly:function(t){this.isCheckEndSegmentsOnly=t},getIntersectionSegments:function(){return this.intSegments},count:function(){return this.intersectionCount},getIntersections:function(){return this.intersections},setFindAllIntersections:function(t){this.findAllIntersections=t},setKeepIntersections:function(t){this.keepIntersections=t},processIntersections:function(t,e,n,i){if(!this.findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===i)return null;if(this.isCheckEndSegmentsOnly){if(!(this.isEndSegment(t,e)||this.isEndSegment(n,i)))return null}var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this.li.computeIntersection(r,s,o,a),this.li.hasIntersection()&&this.li.isInteriorIntersection()&&(this.intSegments=new Array(4).fill(null),this.intSegments[0]=r,this.intSegments[1]=s,this.intSegments[2]=o,this.intSegments[3]=a,this.interiorIntersection=this.li.getIntersection(0),this.keepIntersections&&this.intersections.add(this.interiorIntersection),this.intersectionCount++)},isEndSegment:function(t,e){return 0===e||e>=t.size()-2},hasIntersection:function(){return null!==this.interiorIntersection},isDone:function(){return!this.findAllIntersections&&null!==this.interiorIntersection},interfaces_:function(){return[en]},getClass:function(){return nn}}),nn.createAllIntersectionsFinder=function(t){var e=new nn(t);return e.setFindAllIntersections(!0),e},nn.createAnyIntersectionFinder=function(t){return new nn(t)},nn.createIntersectionCounter=function(t){var e=new nn(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e},io(rn.prototype,{execute:function(){if(null!==this.segInt)return null;this.checkInteriorIntersections()},getIntersections:function(){return this.segInt.getIntersections()},isValid:function(){return this.execute(),this._isValid},setFindAllIntersections:function(t){this.findAllIntersections=t},checkInteriorIntersections:function(){this._isValid=!0,this.segInt=new nn(this.li),this.segInt.setFindAllIntersections(this.findAllIntersections);var t=new Je;if(t.setSegmentIntersector(this.segInt),t.computeNodes(this.segStrings),this.segInt.hasIntersection())return this._isValid=!1,null},checkValid:function(){if(this.execute(),!this._isValid)throw new tn(this.getErrorMessage(),this.segInt.getInteriorIntersection())},getErrorMessage:function(){if(this._isValid)return"no intersections found";var t=this.segInt.getIntersectionSegments();return"found non-noded intersection between "+ee.toLineString(t[0],t[1])+" and "+ee.toLineString(t[2],t[3])},interfaces_:function(){return[]},getClass:function(){return rn}}),rn.computeIntersections=function(t){var e=new rn(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()},io(sn.prototype,{checkValid:function(){this.nv.checkValid()},interfaces_:function(){return[]},getClass:function(){return sn}}),sn.toSegmentStrings=function(t){for(var e=new x,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Re(i.getCoordinates(),i))}return e},sn.checkValid=function(t){new sn(t).checkValid()},io(on.prototype,{map:function(t){for(var e=new x,n=0;n<t.getNumGeometries();n++){var i=this.mapOp.map(t.getGeometryN(n));i.isEmpty()||e.add(i)}return t.getFactory().createGeometryCollection($t.toGeometryArray(e))},interfaces_:function(){return[]},getClass:function(){return on}}),on.map=function(t,e){return new on(e).map(t)},io(an.prototype,{interfaces_:function(){return[]},getClass:function(){return an}}),an.opposite=function(t){return t===an.LEFT?an.RIGHT:t===an.RIGHT?an.LEFT:t},an.ON=0,an.LEFT=1,an.RIGHT=2,io(un.prototype,{setAllLocations:function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},isNull:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==S.NONE)return!1;return!0},setAllLocationsIfNull:function(t){for(var e=0;e<this.location.length;e++)this.location[e]===S.NONE&&(this.location[e]=t)},isLine:function(){return 1===this.location.length},merge:function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[an.ON]=this.location[an.ON],e[an.LEFT]=S.NONE,e[an.RIGHT]=S.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===S.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},getLocations:function(){return this.location},flip:function(){if(this.location.length<=1)return null;var t=this.location[an.LEFT];this.location[an.LEFT]=this.location[an.RIGHT],this.location[an.RIGHT]=t},toString:function(){var t=new w;return this.location.length>1&&t.append(S.toLocationSymbol(this.location[an.LEFT])),t.append(S.toLocationSymbol(this.location[an.ON])),this.location.length>1&&t.append(S.toLocationSymbol(this.location[an.RIGHT])),t.toString()},setLocations:function(t,e,n){this.location[an.ON]=t,this.location[an.LEFT]=e,this.location[an.RIGHT]=n},get:function(t){return t<this.location.length?this.location[t]:S.NONE},isArea:function(){return this.location.length>1},isAnyNull:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===S.NONE)return!0;return!1},setLocation:function(){if(1===arguments.length){var t=arguments[0];this.setLocation(an.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},init:function(t){this.location=new Array(t).fill(null),this.setAllLocations(S.NONE)},isEqualOnSide:function(t,e){return this.location[e]===t.location[e]},allPositionsEqual:function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},interfaces_:function(){return[]},getClass:function(){return un}}),io(ln.prototype,{getGeometryCount:function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},setAllLocations:function(t,e){this.elt[t].setAllLocations(e)},isNull:function(t){return this.elt[t].isNull()},setAllLocationsIfNull:function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},isLine:function(t){return this.elt[t].isLine()},merge:function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new un(t.elt[e]):this.elt[e].merge(t.elt[e])},flip:function(){this.elt[0].flip(),this.elt[1].flip()},getLocation:function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(an.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},toString:function(){var t=new w;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},isArea:function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},isAnyNull:function(t){return this.elt[t].isAnyNull()},setLocation:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(an.ON,e)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.elt[n].setLocation(i,r)}},isEqualOnSide:function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},allPositionsEqual:function(t,e){return this.elt[t].allPositionsEqual(e)},toLine:function(t){this.elt[t].isArea()&&(this.elt[t]=new un(this.elt[t].location[0]))},interfaces_:function(){return[]},getClass:function(){return ln}}),ln.toLineLabel=function(t){for(var e=new ln(S.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e},io(hn.prototype,{computeRing:function(){if(null!==this.ring)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=oe.isCCW(this.ring.getCoordinates())},isIsolated:function(){return 1===this.label.getGeometryCount()},computePoints:function(t){this.startDe=t;var e=t,n=!0;do{if(null===e)throw new tn("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new tn("Directed Edge visited twice during ring-building at "+e.getCoordinate());this.edges.add(e);var i=e.getLabel();h.isTrue(i.isArea()),this.mergeLabel(i),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this.startDe)},getLinearRing:function(){return this.ring},getCoordinate:function(t){return this.pts.get(t)},computeMaxNodeDegree:function(){this.maxNodeDegree=0;var t=this.startDe;do{var e=t.getNode(),n=e.getEdges().getOutgoingDegree(this);n>this.maxNodeDegree&&(this.maxNodeDegree=n),t=this.getNext(t)}while(t!==this.startDe);this.maxNodeDegree*=2},addPoints:function(t,e,n){var i=t.getCoordinates();if(e){var r=1;n&&(r=0);for(var s=r;s<i.length;s++)this.pts.add(i[s])}else{var r=i.length-2;n&&(r=i.length-1);for(var s=r;s>=0;s--)this.pts.add(i[s])}},isHole:function(){return this._isHole},setInResult:function(){var t=this.startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this.startDe)},containsPoint:function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!oe.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this.holes.iterator();n.hasNext();){if(n.next().containsPoint(t))return!1}return!0},addHole:function(t){this.holes.add(t)},isShell:function(){return null===this.shell},getLabel:function(){return this.label},getEdges:function(){return this.edges},getMaxNodeDegree:function(){return this.maxNodeDegree<0&&this.computeMaxNodeDegree(),this.maxNodeDegree},getShell:function(){return this.shell},mergeLabel:function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=e.getLocation(n,an.RIGHT);if(i===S.NONE)return null;if(this.label.getLocation(n)===S.NONE)return this.label.setLocation(n,i),null}},setShell:function(t){this.shell=t,null!==t&&t.addHole(this)},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)},interfaces_:function(){return[]},getClass:function(){return hn}}),ro(cn,hn),io(cn.prototype,{setEdgeRing:function(t,e){t.setMinEdgeRing(e)},getNext:function(t){return t.getNextMin()},interfaces_:function(){return[]},getClass:function(){return cn}}),ro(fn,hn),io(fn.prototype,{buildMinimalRings:function(){var t=new x,e=this.startDe;do{if(null===e.getMinEdgeRing()){var n=new cn(e,this.geometryFactory);t.add(n)}e=e.getNext()}while(e!==this.startDe);return t},setEdgeRing:function(t,e){t.setEdgeRing(e)},linkDirectedEdgesForMinimalEdgeRings:function(){var t=this.startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this.startDe)},getNext:function(t){return t.getNext()},interfaces_:function(){return[]},getClass:function(){return fn}}),io(gn.prototype,{setVisited:function(t){this._isVisited=t},setInResult:function(t){this._isInResult=t},isCovered:function(){return this._isCovered},isCoveredSet:function(){return this._isCoveredSet},setLabel:function(t){this.label=t},getLabel:function(){return this.label},setCovered:function(t){this._isCovered=t,this._isCoveredSet=!0},updateIM:function(t){h.isTrue(this.label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},isInResult:function(){return this._isInResult},isVisited:function(){return this._isVisited},interfaces_:function(){return[]},getClass:function(){return gn}}),ro(dn,gn),io(dn.prototype,{isIncidentEdgeInResult:function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1},isIsolated:function(){return 1===this.label.getGeometryCount()},getCoordinate:function(){return this.coord},print:function(t){t.println("node "+this.coord+" lbl: "+this.label)},computeIM:function(t){},computeMergedLocation:function(t,e){var n=S.NONE;if(n=this.label.getLocation(e),!t.isNull(e)){var i=t.getLocation(e);n!==S.BOUNDARY&&(n=i)}return n},setLabel:function(){if(2!==arguments.length)return gn.prototype.setLabel.apply(this,arguments);var t=arguments[0],e=arguments[1];null===this.label?this.label=new ln(t,e):this.label.setLocation(t,e)},getEdges:function(){return this.edges},mergeLabel:function(){if(arguments[0]instanceof dn){var t=arguments[0];this.mergeLabel(t.label)}else if(arguments[0]instanceof ln)for(var e=arguments[0],n=0;n<2;n++){var i=this.computeMergedLocation(e,n),r=this.label.getLocation(n);r===S.NONE&&this.label.setLocation(n,i)}},add:function(t){this.edges.insert(t),t.setNode(this)},setLabelBoundary:function(t){if(null===this.label)return null;var e=S.NONE;null!==this.label&&(e=this.label.getLocation(t));var n=null;switch(e){case S.BOUNDARY:n=S.INTERIOR;break;case S.INTERIOR:default:n=S.BOUNDARY}this.label.setLocation(t,n)},interfaces_:function(){return[]},getClass:function(){return dn}}),io(pn.prototype,{find:function(t){return this.nodeMap.get(t)},addNode:function(){if(arguments[0]instanceof c){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof dn){var n=arguments[0],e=this.nodeMap.get(n.getCoordinate());return null===e?(this.nodeMap.put(n.getCoordinate(),n),n):(e.mergeLabel(n),e)}},print:function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},iterator:function(){return this.nodeMap.values().iterator()},values:function(){return this.nodeMap.values()},getBoundaryNodes:function(t){for(var e=new x,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===S.BOUNDARY&&e.add(i)}return e},add:function(t){var e=t.getCoordinate();this.addNode(e).add(t)},interfaces_:function(){return[]},getClass:function(){return pn}}),io(mn.prototype,{compareDirection:function(t){return this.dx===t.dx&&this.dy===t.dy?0:this.quadrant>t.quadrant?1:this.quadrant<t.quadrant?-1:oe.computeOrientation(t.p0,t.p1,this.p1)},getDy:function(){return this.dy},getCoordinate:function(){return this.p0},setNode:function(t){this.node=t},print:function(t){var e=Math.atan2(this.dy,this.dx),n=this.getClass().getName(),i=n.lastIndexOf("."),r=n.substring(i+1);t.print(" "+r+": "+this.p0+" - "+this.p1+" "+this.quadrant+":"+e+" "+this.label)},compareTo:function(t){var e=t;return this.compareDirection(e)},getDirectedCoordinate:function(){return this.p1},getDx:function(){return this.dx},getLabel:function(){return this.label},getEdge:function(){return this.edge},getQuadrant:function(){return this.quadrant},getNode:function(){return this.node},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},computeLabel:function(t){},init:function(t,e){this.p0=t,this.p1=e,this.dx=e.x-t.x,this.dy=e.y-t.y,this.quadrant=je.quadrant(this.dx,this.dy),h.isTrue(!(0===this.dx&&0===this.dy),"EdgeEnd with identical endpoints found")},interfaces_:function(){return[r]},getClass:function(){return mn}}),ro(vn,mn),io(vn.prototype,{getNextMin:function(){return this.nextMin},getDepth:function(t){return this.depth[t]},setVisited:function(t){this._isVisited=t},computeDirectedLabel:function(){this.label=new ln(this.edge.getLabel()),this._isForward||this.label.flip()},getNext:function(){return this.next},setDepth:function(t,e){if(-999!==this.depth[t]&&this.depth[t]!==e)throw new tn("assigned depths do not match",this.getCoordinate());this.depth[t]=e},isInteriorAreaEdge:function(){for(var t=!0,e=0;e<2;e++)this.label.isArea(e)&&this.label.getLocation(e,an.LEFT)===S.INTERIOR&&this.label.getLocation(e,an.RIGHT)===S.INTERIOR||(t=!1);return t},setNextMin:function(t){this.nextMin=t},print:function(t){mn.prototype.print.call(this,t),t.print(" "+this.depth[an.LEFT]+"/"+this.depth[an.RIGHT]),t.print(" ("+this.getDepthDelta()+")"),this._isInResult&&t.print(" inResult")},setMinEdgeRing:function(t){this.minEdgeRing=t},isLineEdge:function(){var t=this.label.isLine(0)||this.label.isLine(1),e=!this.label.isArea(0)||this.label.allPositionsEqual(0,S.EXTERIOR),n=!this.label.isArea(1)||this.label.allPositionsEqual(1,S.EXTERIOR);return t&&e&&n},setEdgeRing:function(t){this.edgeRing=t},getMinEdgeRing:function(){return this.minEdgeRing},getDepthDelta:function(){var t=this.edge.getDepthDelta();return this._isForward||(t=-t),t},setInResult:function(t){this._isInResult=t},getSym:function(){return this.sym},isForward:function(){return this._isForward},getEdge:function(){return this.edge},printEdge:function(t){this.print(t),t.print(" "),this._isForward?this.edge.print(t):this.edge.printReverse(t)},setSym:function(t){this.sym=t},setVisitedEdge:function(t){this.setVisited(t),this.sym.setVisited(t)},setEdgeDepths:function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var i=1;t===an.LEFT&&(i=-1);var r=an.opposite(t),s=n*i,o=e+s;this.setDepth(t,e),this.setDepth(r,o)},getEdgeRing:function(){return this.edgeRing},isInResult:function(){return this._isInResult},setNext:function(t){this.next=t},isVisited:function(){return this._isVisited},interfaces_:function(){return[]},getClass:function(){return vn}}),vn.depthFactor=function(t,e){return t===S.EXTERIOR&&e===S.INTERIOR?1:t===S.INTERIOR&&e===S.EXTERIOR?-1:0},io(yn.prototype,{createNode:function(t){return new dn(t,null)},interfaces_:function(){return[]},getClass:function(){return yn}}),io(xn.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)}},find:function(t){return this.nodes.find(t)},addNode:function(){if(arguments[0]instanceof dn){var t=arguments[0];return this.nodes.addNode(t)}if(arguments[0]instanceof c){var e=arguments[0];return this.nodes.addNode(e)}},getNodeIterator:function(){return this.nodes.iterator()},linkResultDirectedEdges:function(){for(var t=this.nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},debugPrintln:function(t){_.out.println(t)},isBoundaryNode:function(t,e){var n=this.nodes.find(e);if(null===n)return!1;var i=n.getLabel();return null!==i&&i.getLocation(t)===S.BOUNDARY},linkAllDirectedEdges:function(){for(var t=this.nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},matchInSameDirection:function(t,e,n,i){return!!t.equals(n)&&(oe.computeOrientation(t,e,i)===oe.COLLINEAR&&je.quadrant(t,e)===je.quadrant(n,i))},getEdgeEnds:function(){return this.edgeEndList},debugPrint:function(t){_.out.print(t)},getEdgeIterator:function(){return this.edges.iterator()},findEdgeInSameDirection:function(t,e){for(var n=0;n<this.edges.size();n++){var i=this.edges.get(n),r=i.getCoordinates();if(this.matchInSameDirection(t,e,r[0],r[1]))return i;if(this.matchInSameDirection(t,e,r[r.length-1],r[r.length-2]))return i}return null},insertEdge:function(t){this.edges.add(t)},findEdgeEnd:function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},addEdges:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.edges.add(n);var i=new vn(n,!0),r=new vn(n,!1);i.setSym(r),r.setSym(i),this.add(i),this.add(r)}},add:function(t){this.nodes.add(t),this.edgeEndList.add(t)},getNodes:function(){return this.nodes.values()},findEdge:function(t,e){for(var n=0;n<this.edges.size();n++){var i=this.edges.get(n),r=i.getCoordinates();if(t.equals(r[0])&&e.equals(r[1]))return i}return null},interfaces_:function(){return[]},getClass:function(){return xn}}),xn.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}},io(En.prototype,{sortShellsAndHoles:function(t,e,n){for(var i=t.iterator();i.hasNext();){var r=i.next();r.isHole()?n.add(r):e.add(r)}},computePolygons:function(t){for(var e=new x,n=t.iterator();n.hasNext();){var i=n.next(),r=i.toPolygon(this.geometryFactory);e.add(r)}return e},placeFreeHoles:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();if(null===i.getShell()){var r=this.findEdgeRingContaining(i,t);if(null===r)throw new tn("unable to assign hole to a shell",i.getCoordinate(0));i.setShell(r)}}},buildMinimalEdgeRings:function(t,e,n){for(var i=new x,r=t.iterator();r.hasNext();){var s=r.next();if(s.getMaxNodeDegree()>2){s.linkDirectedEdgesForMinimalEdgeRings();var o=s.buildMinimalRings(),a=this.findShell(o);null!==a?(this.placePolygonHoles(a,o),e.add(a)):n.addAll(o)}else i.add(s)}return i},containsPoint:function(t){for(var e=this.shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},buildMaximalEdgeRings:function(t){for(var e=new x,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&null===i.getEdgeRing()){var r=new fn(i,this.geometryFactory);e.add(r),r.setInResult()}}return e},placePolygonHoles:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}},getPolygons:function(){return this.computePolygons(this.shellList)},findEdgeRingContaining:function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),s=null,o=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),h=l.getEnvelopeInternal();null!==s&&(o=s.getLinearRing().getEnvelopeInternal());var c=!1;h.contains(i)&&oe.isPointInRing(r,l.getCoordinates())&&(c=!0),c&&(null===s||o.contains(h))&&(s=u)}return s},findShell:function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,e++)}return h.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},add:function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0],n=arguments[1];xn.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),r=new x,s=this.buildMinimalEdgeRings(i,this.shellList,r);this.sortShellsAndHoles(s,this.shellList,r),this.placeFreeHoles(this.shellList,r)}},interfaces_:function(){return[]},getClass:function(){return En}}),io(In.prototype,{collectLines:function(t){for(var e=this.op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next();this.collectLineEdge(n,t,this.lineEdgesList),this.collectBoundaryTouchEdge(n,t,this.lineEdgesList)}},labelIsolatedLine:function(t,e){var n=this.ptLocator.locate(t.getCoordinate(),this.op.getArgGeometry(e));t.getLabel().setLocation(e,n)},build:function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this.resultLineList},collectLineEdge:function(t,e,n){var i=t.getLabel(),r=t.getEdge();t.isLineEdge()&&(t.isVisited()||!$n.isResultOfOp(i,e)||r.isCovered()||(n.add(r),t.setVisitedEdge(!0)))},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(),i=n.getEdge();if(n.isLineEdge()&&!i.isCoveredSet()){var r=this.op.isCoveredByA(n.getCoordinate());i.setCovered(r)}}},labelIsolatedLines:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=n.getLabel();n.isIsolated()&&(i.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},buildLines:function(t){for(var e=this.lineEdgesList.iterator();e.hasNext();){var n=e.next(),i=(n.getLabel(),this.geometryFactory.createLineString(n.getCoordinates()));this.resultLineList.add(i),n.setInResult(!0)}},collectBoundaryTouchEdge:function(t,e,n){var i=t.getLabel();return t.isLineEdge()?null:t.isVisited()?null:t.isInteriorAreaEdge()?null:t.getEdge().isInResult()?null:(h.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void($n.isResultOfOp(i,e)&&e===$n.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},interfaces_:function(){return[]},getClass:function(){return In}}),io(Nn.prototype,{filterCoveredNodeToPoint:function(t){var e=t.getCoordinate();if(!this.op.isCoveredByLA(e)){var n=this.geometryFactory.createPoint(e);this.resultPointList.add(n)}},extractNonCoveredResultNodes:function(t){for(var e=this.op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!n.isInResult()&&(!n.isIncidentEdgeInResult()&&(0===n.getEdges().getDegree()||t===$n.INTERSECTION))){var i=n.getLabel();$n.isResultOfOp(i,t)&&this.filterCoveredNodeToPoint(n)}}},build:function(t){return this.extractNonCoveredResultNodes(t),this.resultPointList},interfaces_:function(){return[]},getClass:function(){return Nn}}),io(Cn.prototype,{locate:function(t){},interfaces_:function(){return[]},getClass:function(){return Cn}}),io(Sn.prototype,{locate:function(t){return Sn.locate(t,this.geom)},interfaces_:function(){return[Cn]},getClass:function(){return Sn}}),Sn.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&oe.isPointInRing(t,e.getCoordinates())},Sn.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!Sn.isPointInRing(t,n))return!1
;for(var i=0;i<e.getNumInteriorRing();i++){var r=e.getInteriorRingN(i);if(Sn.isPointInRing(t,r))return!1}return!0},Sn.containsPoint=function(t,e){if(e instanceof Lt)return Sn.containsPointInPolygon(t,e);if(e instanceof lt)for(var n=new Ce(e);n.hasNext();){var i=n.next();if(i!==e&&Sn.containsPoint(t,i))return!0}return!1},Sn.locate=function(t,e){return e.isEmpty()?S.EXTERIOR:Sn.containsPoint(t,e)?S.INTERIOR:S.EXTERIOR},io(Ln.prototype,{getNextCW:function(t){this.getEdges();var e=this.edgeList.indexOf(t),n=e-1;return 0===e&&(n=this.edgeList.size()-1),this.edgeList.get(n)},propagateSideLabels:function(t){for(var e=S.NONE,n=this.iterator();n.hasNext();){var i=n.next(),r=i.getLabel();r.isArea(t)&&r.getLocation(t,an.LEFT)!==S.NONE&&(e=r.getLocation(t,an.LEFT))}if(e===S.NONE)return null;for(var s=e,n=this.iterator();n.hasNext();){var i=n.next(),r=i.getLabel();if(r.getLocation(t,an.ON)===S.NONE&&r.setLocation(t,an.ON,s),r.isArea(t)){var o=r.getLocation(t,an.LEFT),a=r.getLocation(t,an.RIGHT);if(a!==S.NONE){if(a!==s)throw new tn("side location conflict",i.getCoordinate());o===S.NONE&&h.shouldNeverReachHere("found single null side (at "+i.getCoordinate()+")"),s=o}else h.isTrue(r.getLocation(t,an.LEFT)===S.NONE,"found single null side"),r.setLocation(t,an.RIGHT,s),r.setLocation(t,an.LEFT,s)}}},getCoordinate:function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},print:function(t){_.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},isAreaLabelsConsistent:function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},checkAreaLabelsConsistent:function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,i=e.get(n).getLabel(),r=i.getLocation(t,an.LEFT);h.isTrue(r!==S.NONE,"Found unlabelled area edge");for(var s=r,o=this.iterator();o.hasNext();){var a=o.next(),u=a.getLabel();h.isTrue(u.isArea(t),"Found non-area edge");var l=u.getLocation(t,an.LEFT),c=u.getLocation(t,an.RIGHT);if(l===c)return!1;if(c!==s)return!1;s=l}return!0},findIndex:function(t){this.iterator();for(var e=0;e<this.edgeList.size();e++){if(this.edgeList.get(e)===t)return e}return-1},iterator:function(){return this.getEdges().iterator()},getEdges:function(){return null===this.edgeList&&(this.edgeList=new x(this.edgeMap.values())),this.edgeList},getLocation:function(t,e,n){return this.ptInAreaLocation[t]===S.NONE&&(this.ptInAreaLocation[t]=Sn.locate(e,n[t].getGeometry())),this.ptInAreaLocation[t]},toString:function(){var t=new w;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()},computeEdgeEndLabels:function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},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 i=n.next(),r=i.getLabel(),s=0;s<2;s++)r.isLine(s)&&r.getLocation(s)===S.BOUNDARY&&(e[s]=!0);for(var n=this.iterator();n.hasNext();)for(var i=n.next(),r=i.getLabel(),s=0;s<2;s++)if(r.isAnyNull(s)){var o=S.NONE;if(e[s])o=S.EXTERIOR;else{var a=i.getCoordinate();o=this.getLocation(s,a,t)}r.setAllLocationsIfNull(s,o)}},getDegree:function(){return this.edgeMap.size()},insertEdgeEnd:function(t,e){this.edgeMap.put(t,e),this.edgeList=null},interfaces_:function(){return[]},getClass:function(){return Ln}}),ro(wn,Ln),io(wn.prototype,{linkResultDirectedEdges:function(){this.getResultAreaEdges();for(var t=null,e=null,n=this.SCANNING_FOR_INCOMING,i=0;i<this.resultAreaEdgeList.size();i++){var r=this.resultAreaEdgeList.get(i),s=r.getSym();if(r.getLabel().isArea())switch(null===t&&r.isInResult()&&(t=r),n){case this.SCANNING_FOR_INCOMING:if(!s.isInResult())continue;e=s,n=this.LINKING_TO_OUTGOING;break;case this.LINKING_TO_OUTGOING:if(!r.isInResult())continue;e.setNext(r),n=this.SCANNING_FOR_INCOMING}}if(n===this.LINKING_TO_OUTGOING){if(null===t)throw new tn("no outgoing dirEdge found",this.getCoordinate());h.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}},insert:function(t){var e=t;this.insertEdgeEnd(e,e)},getRightmostEdge:function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var i=t.get(e-1),r=n.getQuadrant(),s=i.getQuadrant();if(je.isNorthern(r)&&je.isNorthern(s))return n;if(!je.isNorthern(r)&&!je.isNorthern(s))return i;return 0!==n.getDy()?n:0!==i.getDy()?i:(h.shouldNeverReachHere("found two horizontal edges incident on node"),null)},print:function(t){_.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},getResultAreaEdges:function(){if(null!==this.resultAreaEdgeList)return this.resultAreaEdgeList;this.resultAreaEdgeList=new x;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this.resultAreaEdgeList.add(e)}return this.resultAreaEdgeList},updateLabelling:function(t){for(var e=this.iterator();e.hasNext();){var n=e.next(),i=n.getLabel();i.setAllLocationsIfNull(0,t.getLocation(0)),i.setAllLocationsIfNull(1,t.getLocation(1))}},linkAllDirectedEdges:function(){this.getEdges();for(var t=null,e=null,n=this.edgeList.size()-1;n>=0;n--){var i=this.edgeList.get(n),r=i.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=i}e.setNext(t)},computeDepths:function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=(t.getLabel(),t.getDepth(an.LEFT)),i=t.getDepth(an.RIGHT),r=this.computeDepths(e+1,this.edgeList.size(),n);if(this.computeDepths(0,e,r)!==i)throw new tn("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var s=arguments[0],o=arguments[1],a=arguments[2],u=a,l=s;l<o;l++){var h=this.edgeList.get(l);h.getLabel();h.setEdgeDepths(an.RIGHT,u),u=h.getDepth(an.LEFT)}return u}},mergeSymLabels:function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},linkMinimalDirectedEdges:function(t){for(var e=null,n=null,i=this.SCANNING_FOR_INCOMING,r=this.resultAreaEdgeList.size()-1;r>=0;r--){var s=this.resultAreaEdgeList.get(r),o=s.getSym();switch(null===e&&s.getEdgeRing()===t&&(e=s),i){case this.SCANNING_FOR_INCOMING:if(o.getEdgeRing()!==t)continue;n=o,i=this.LINKING_TO_OUTGOING;break;case this.LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;n.setNextMin(s),i=this.SCANNING_FOR_INCOMING}}i===this.LINKING_TO_OUTGOING&&(h.isTrue(null!==e,"found null for first outgoing dirEdge"),h.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))},getOutgoingDegree:function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){var n=e.next();n.isInResult()&&t++}return t}if(1===arguments.length){for(var i=arguments[0],t=0,e=this.iterator();e.hasNext();){var n=e.next();n.getEdgeRing()===i&&t++}return t}},getLabel:function(){return this.label},findCoveredLineEdges:function(){for(var t=S.NONE,e=this.iterator();e.hasNext();){var n=e.next(),i=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=S.INTERIOR;break}if(i.isInResult()){t=S.EXTERIOR;break}}}if(t===S.NONE)return null;for(var r=t,e=this.iterator();e.hasNext();){var n=e.next(),i=n.getSym();n.isLineEdge()?n.getEdge().setCovered(r===S.INTERIOR):(n.isInResult()&&(r=S.EXTERIOR),i.isInResult()&&(r=S.INTERIOR))}},computeLabelling:function(t){Ln.prototype.computeLabelling.call(this,t),this.label=new ln(S.NONE);for(var e=this.iterator();e.hasNext();)for(var n=e.next(),i=n.getEdge(),r=i.getLabel(),s=0;s<2;s++){var o=r.getLocation(s);o!==S.INTERIOR&&o!==S.BOUNDARY||this.label.setLocation(s,S.INTERIOR)}},interfaces_:function(){return[]},getClass:function(){return wn}}),ro(Rn,yn),io(Rn.prototype,{createNode:function(t){return new dn(t,new wn)},interfaces_:function(){return[]},getClass:function(){return Rn}}),io(Tn.prototype,{computeIntersections:function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},interfaces_:function(){return[]},getClass:function(){return Tn}}),io(On.prototype,{isDelete:function(){return this.eventType===On.DELETE},setDeleteEventIndex:function(t){this.deleteEventIndex=t},getObject:function(){return this.obj},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},getInsertEvent:function(){return this.insertEvent},isInsert:function(){return this.eventType===On.INSERT},isSameLabel:function(t){return null!==this.label&&this.label===t.label},getDeleteEventIndex:function(){return this.deleteEventIndex},interfaces_:function(){return[r]},getClass:function(){return On}}),On.INSERT=1,On.DELETE=2,io(Pn.prototype,{interfaces_:function(){return[]},getClass:function(){return Pn}}),io(bn.prototype,{isTrivialIntersection:function(t,e,n,i){if(t===n&&1===this.li.getIntersectionNum()){if(bn.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var r=t.getNumPoints()-1;if(0===e&&i===r||0===i&&e===r)return!0}}return!1},getProperIntersectionPoint:function(){return this.properIntersectionPoint},setIsDoneIfProperInt:function(t){this.isDoneWhenProperInt=t},hasProperInteriorIntersection:function(){return this.hasProperInterior},isBoundaryPointInternal:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next(),r=i.getCoordinate();if(t.isIntersection(r))return!0}return!1},hasProperIntersection:function(){return this.hasProper},hasIntersection:function(){return this._hasIntersection},isDone:function(){return this._isDone},isBoundaryPoint:function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},setBoundaryNodes:function(t,e){this.bdyNodes=new Array(2).fill(null),this.bdyNodes[0]=t,this.bdyNodes[1]=e},addIntersections:function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this.li.computeIntersection(r,s,o,a),this.li.hasIntersection()&&(this.recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this.numIntersections++,this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,!this.includeProper&&this.li.isProper()||(t.addIntersections(this.li,e,0),n.addIntersections(this.li,i,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))))},interfaces_:function(){return[]},getClass:function(){return bn}}),bn.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},ro(_n,Pn),io(_n.prototype,{prepareEvents:function(){xo.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},computeIntersections:function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof bn&&oo(arguments[0],m)&&oo(arguments[1],m)){var i=arguments[0],r=arguments[1],s=arguments[2];this.addEdges(i,i),this.addEdges(r,r),this.computeIntersections(s)}else if("boolean"==typeof arguments[2]&&oo(arguments[0],m)&&arguments[1]instanceof bn){var o=arguments[0],a=arguments[1],u=arguments[2];u?this.addEdges(o,null):this.addEdges(o),this.computeIntersections(a)}},addEdge:function(t,e){for(var n=t.getMonotoneChainEdge(),i=n.getStartIndexes(),r=0;r<i.length-1;r++){var s=new Tn(n,r),o=new On(e,n.getMinX(r),s);this.events.add(o),this.events.add(new On(n.getMaxX(r),o))}},processOverlaps:function(t,e,n,i){for(var r=n.getObject(),s=t;s<e;s++){var o=this.events.get(s);if(o.isInsert()){var a=o.getObject();n.isSameLabel(o)||(r.computeIntersections(a,i),this.nOverlaps++)}}},addEdges:function(){if(1===arguments.length)for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.addEdge(n,n)}else if(2===arguments.length)for(var i=arguments[0],r=arguments[1],e=i.iterator();e.hasNext();){var n=e.next();this.addEdge(n,r)}},interfaces_:function(){return[]},getClass:function(){return _n}}),io(Mn.prototype,{getMin:function(){return this.min},intersects:function(t,e){return!(this.min>e||this.max<t)},getMax:function(){return this.max},toString:function(){return ee.toLineString(new c(this.min,0),new c(this.max,0))},interfaces_:function(){return[]},getClass:function(){return Mn}}),io(Dn.prototype,{compare:function(t,e){var n=t,i=e,r=(n.min+n.max)/2,s=(i.min+i.max)/2;return r<s?-1:r>s?1:0},interfaces_:function(){return[o]},getClass:function(){return Dn}}),Mn.NodeComparator=Dn,ro(An,Mn),io(An.prototype,{query:function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this.item)},interfaces_:function(){return[]},getClass:function(){return An}}),ro(Fn,Mn),io(Fn.prototype,{buildExtent:function(t,e){this.min=Math.min(t.min,e.min),this.max=Math.max(t.max,e.max)},query:function(t,e,n){if(!this.intersects(t,e))return null;null!==this.node1&&this.node1.query(t,e,n),null!==this.node2&&this.node2.query(t,e,n)},interfaces_:function(){return[]},getClass:function(){return Fn}}),io(Gn.prototype,{buildTree:function(){xo.sort(this.leaves,new IntervalRTreeNode.NodeComparator);for(var t=this.leaves,e=null,n=new x;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},insert:function(t,e,n){if(null!==this.root)throw new IllegalStateException("Index cannot be added to once it has been queried");this.leaves.add(new An(t,e,n))},query:function(t,e,n){this.init(),this.root.query(t,e,n)},buildRoot:function(){if(null!==this.root)return null;this.root=this.buildTree()},printNode:function(t){_.out.println(ee.toLineString(new c(t.min,this.level),new c(t.max,this.level)))},init:function(){if(null!==this.root)return null;this.buildRoot()},buildLevel:function(t,e){this.level++,e.clear();for(var n=0;n<t.size();n+=2){var i=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(i);else{var r=new Fn(t.get(n),t.get(n+1));e.add(r)}}},interfaces_:function(){return[]},getClass:function(){return Gn}}),io(qn.prototype,{filter:function(t){if(this.isForcedToLineString&&t instanceof Rt){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this.lines.add(e),null}t instanceof It&&this.lines.add(t)},setForceToLineString:function(t){this.isForcedToLineString=t},interfaces_:function(){return[A]},getClass:function(){return qn}}),qn.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(qn.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(qn.getLines(e,n))}},qn.getLines=function(){if(1===arguments.length){var t=arguments[0];return qn.getLines(t,!1)}if(2===arguments.length){if(oo(arguments[0],d)&&oo(arguments[1],d)){for(var e=arguments[0],n=arguments[1],i=e.iterator();i.hasNext();){var r=i.next();qn.getLines(r,n)}return n}if(arguments[0]instanceof F&&"boolean"==typeof arguments[1]){var s=arguments[0],o=arguments[1],a=new x;return s.apply(new qn(a,o)),a}if(arguments[0]instanceof F&&oo(arguments[1],d)){var u=arguments[0],l=arguments[1];return u instanceof It?l.add(u):u.apply(new qn(l)),l}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&oo(arguments[0],d)&&oo(arguments[1],d)){for(var h=arguments[0],c=arguments[1],f=arguments[2],i=h.iterator();i.hasNext();){var r=i.next();qn.getLines(r,c,f)}return c}if("boolean"==typeof arguments[2]&&arguments[0]instanceof F&&oo(arguments[1],d)){var g=arguments[0],p=arguments[1],m=arguments[2];return g.apply(new qn(p,m)),p}}},io(Bn.prototype,{visitItem:function(t){this.items.add(t)},getItems:function(){return this.items},interfaces_:function(){return[be]},getClass:function(){return Bn}}),io(Vn.prototype,{locate:function(t){var e=new se(t),n=new zn(e);return this.index.query(t.y,t.y,n),e.getLocation()},interfaces_:function(){return[Cn]},getClass:function(){return Vn}}),io(zn.prototype,{visitItem:function(t){var e=t;this.counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},interfaces_:function(){return[be]},getClass:function(){return zn}}),io(kn.prototype,{init:function(t){for(var e=qn.getLines(t),n=e.iterator();n.hasNext();){var i=n.next(),r=i.getCoordinates();this.addLine(r)}},addLine:function(t){for(var e=1;e<t.length;e++){var n=new ae(t[e-1],t[e]),i=Math.min(n.p0.y,n.p1.y),r=Math.max(n.p0.y,n.p1.y);this.index.insert(i,r,n)}},query:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new Bn;return this.index.query(t,e,n),n.getItems()}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];this.index.query(i,r,s)}},interfaces_:function(){return[]},getClass:function(){return kn}}),Vn.SegmentVisitor=zn,Vn.IntervalIndexedGeometry=kn,io(Yn.prototype,{getSegmentIndex:function(){return this.segmentIndex},getCoordinate:function(){return this.coord},print:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},compareTo:function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},isEndPoint:function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},toString:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},getDistance:function(){return this.dist},compare:function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},interfaces_:function(){return[r]},getClass:function(){return Yn}}),io(Un.prototype,{print:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},iterator:function(){return this.nodeMap.values().iterator()},addSplitEdges:function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),r=this.createSplitEdge(n,i);t.add(r),n=i}},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)},createSplitEdge:function(t,e){var n=e.segmentIndex-t.segmentIndex+2,i=this.edge.pts[e.segmentIndex],r=e.dist>0||!e.coord.equals2D(i);r||n--;var s=new Array(n).fill(null),o=0;s[o++]=new c(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)s[o++]=this.edge.pts[a];return r&&(s[o]=e.coord),new jn(s,new ln(this.edge.label))},add:function(t,e,n){var i=new Yn(t,e,n),r=this.nodeMap.get(i);return null!==r?r:(this.nodeMap.put(i,i),i)},isIntersection:function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},interfaces_:function(){return[]},getClass:function(){return Un}}),io(Xn.prototype,{getChainStartIndices:function(t){var e=0,n=new x;n.add(new R(e));do{var i=this.findChainEnd(t,e);n.add(new R(i)),e=i}while(e<t.length-1);return Xn.toIntArray(n)},findChainEnd:function(t,e){for(var n=je.quadrant(t[e],t[e+1]),i=e+1;i<t.length;){if(je.quadrant(t[i-1],t[i])!==n)break;i++}return i-1},interfaces_:function(){return[]},getClass:function(){return Xn}}),Xn.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},io(Hn.prototype,{getCoordinates:function(){return this.pts},getMaxX:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},getMinX:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},computeIntersectsForChain:function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],i)}else if(6===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],h=this.pts[r],c=this.pts[s],f=o.pts[a],g=o.pts[u];if(s-r==1&&u-a==1)return l.addIntersections(this.e,r,o.e,a),null;if(this.env1.init(h,c),this.env2.init(f,g),!this.env1.intersects(this.env2))return null;var d=Math.trunc((r+s)/2),p=Math.trunc((a+u)/2);r<d&&(a<p&&this.computeIntersectsForChain(r,d,o,a,p,l),p<u&&this.computeIntersectsForChain(r,d,o,p,u,l)),d<s&&(a<p&&this.computeIntersectsForChain(d,s,o,a,p,l),p<u&&this.computeIntersectsForChain(d,s,o,p,u,l))}},getStartIndexes:function(){return this.startIndex},computeIntersects:function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var i=0;i<t.startIndex.length-1;i++)this.computeIntersectsForChain(n,t,i,e)},interfaces_:function(){return[]},getClass:function(){return Hn}}),io(Wn.prototype,{getDepth:function(t,e){return this.depth[t][e]},setDepth:function(t,e,n){this.depth[t][e]=n},isNull:function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this.depth[t][e]!==Wn.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this.depth[n][1]===Wn.NULL_VALUE}if(2===arguments.length){var i=arguments[0],r=arguments[1];return this.depth[i][r]===Wn.NULL_VALUE}},normalize:function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this.depth[t][1];this.depth[t][2]<e&&(e=this.depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var i=0;this.depth[t][n]>e&&(i=1),this.depth[t][n]=i}}},getDelta:function(t){return this.depth[t][an.RIGHT]-this.depth[t][an.LEFT]},getLocation:function(t,e){return this.depth[t][e]<=0?S.EXTERIOR:S.INTERIOR},toString:function(){return"A: "+this.depth[0][1]+","+this.depth[0][2]+" B: "+this.depth[1][1]+","+this.depth[1][2]},add:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var i=t.getLocation(e,n);i!==S.EXTERIOR&&i!==S.INTERIOR||(this.isNull(e,n)?this.depth[e][n]=Wn.depthAtLocation(i):this.depth[e][n]+=Wn.depthAtLocation(i))}else if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];o===S.INTERIOR&&this.depth[r][s]++}},interfaces_:function(){return[]},getClass:function(){return Wn}}),Wn.depthAtLocation=function(t){return t===S.EXTERIOR?0:t===S.INTERIOR?1:Wn.NULL_VALUE},Wn.NULL_VALUE=-1,ro(jn,gn),io(jn.prototype,{getDepth:function(){return this.depth},getCollapsedEdge:function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new jn(t,ln.toLineLabel(this.label))},isIsolated:function(){return this._isIsolated},getCoordinates:function(){return this.pts},setIsolated:function(t){this._isIsolated=t},setName:function(t){this.name=t},equals:function(t){if(!(t instanceof jn))return!1;var e=t;if(this.pts.length!==e.pts.length)return!1;for(var n=!0,i=!0,r=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(e.pts[s])||(n=!1),this.pts[s].equals2D(e.pts[--r])||(i=!1),!n&&!i)return!1;return!0},getCoordinate:function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},print:function(t){t.print("edge "+this.name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this.label+" "+this.depthDelta)},computeIM:function(t){jn.updateIM(this.label,t)},isCollapsed:function(){return!!this.label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},isClosed:function(){return this.pts[0].equals(this.pts[this.pts.length-1])},getMaximumSegmentIndex:function(){return this.pts.length-1},getDepthDelta:function(){return this.depthDelta},getNumPoints:function(){return this.pts.length},printReverse:function(t){t.print("edge "+this.name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},getMonotoneChainEdge:function(){return null===this.mce&&(this.mce=new Hn(this)),this.mce},getEnvelope:function(){if(null===this.env){this.env=new I;for(var t=0;t<this.pts.length;t++)this.env.expandToInclude(this.pts[t])}return this.env},addIntersection:function(t,e,n,i){var r=new c(t.getIntersection(i)),s=e,o=t.getEdgeDistance(n,i),a=s+1;if(a<this.pts.length){var u=this.pts[a];r.equals2D(u)&&(s=a,o=0)}this.eiList.add(r,s,o)},toString:function(){var t=new w;t.append("edge "+this.name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this.label+" "+this.depthDelta),t.toString()},isPointwiseEqual:function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},setDepthDelta:function(t){this.depthDelta=t},getEdgeIntersectionList:function(){return this.eiList},addIntersections:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)},interfaces_:function(){return[]},getClass:function(){return jn}}),jn.updateIM=function(){if(2!==arguments.length)return gn.prototype.updateIM.apply(this,arguments);var t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,an.ON),t.getLocation(1,an.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,an.LEFT),t.getLocation(1,an.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,an.RIGHT),t.getLocation(1,an.RIGHT),2))},ro(Kn,xn),io(Kn.prototype,{insertBoundaryPoint:function(t,e){var n=this.nodes.addNode(e),i=n.getLabel(),r=1,s=S.NONE;(s=i.getLocation(t,an.ON))===S.BOUNDARY&&r++;var o=Kn.determineBoundary(this.boundaryNodeRule,r);i.setLocation(t,o)},computeSelfNodes:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=new bn(n,!0,!1);s.setIsDoneIfProperInt(r);var o=this.createEdgeSetIntersector(),a=this.parentGeom instanceof Rt||this.parentGeom instanceof Lt||this.parentGeom instanceof Tt,u=i||!a;return o.computeIntersections(this.edges,s,u),this.addSelfIntersectionNodes(this.argIndex),s}},computeSplitEdges:function(t){for(var e=this.edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},computeEdgeIntersections:function(t,e,n){var i=new bn(e,n,!0);return i.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this.edges,t.edges,i),i},getGeometry:function(){return this.parentGeom},getBoundaryNodeRule:function(){return this.boundaryNodeRule},hasTooFewPoints:function(){return this._hasTooFewPoints},addPoint:function(){if(arguments[0]instanceof Ct){var t=arguments[0],e=t.getCoordinate();this.insertPoint(this.argIndex,e,S.INTERIOR)}else if(arguments[0]instanceof c){var n=arguments[0];this.insertPoint(this.argIndex,n,S.INTERIOR)}},addPolygon:function(t){this.addPolygonRing(t.getExteriorRing(),S.EXTERIOR,S.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,S.INTERIOR,S.EXTERIOR)}},addEdge:function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this.argIndex,e[0],S.BOUNDARY),this.insertPoint(this.argIndex,e[e.length-1],S.BOUNDARY)},addLineString:function(t){var e=Y.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this.invalidPoint=e[0],null;var n=new jn(e,new ln(this.argIndex,S.INTERIOR));this.lineEdgeMap.put(t,n),this.insertEdge(n),h.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this.argIndex,e[0]),this.insertBoundaryPoint(this.argIndex,e[e.length-1])},getInvalidPoint:function(){return this.invalidPoint},getBoundaryPoints:function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,i=t.iterator();i.hasNext();){var r=i.next();e[n++]=r.getCoordinate().copy()}return e},getBoundaryNodes:function(){return null===this.boundaryNodes&&(this.boundaryNodes=this.nodes.getBoundaryNodes(this.argIndex)),this.boundaryNodes},addSelfIntersectionNode:function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===S.BOUNDARY&&this.useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},addPolygonRing:function(t,e,n){if(t.isEmpty())return null;var i=Y.removeRepeatedPoints(t.getCoordinates());if(i.length<4)return this._hasTooFewPoints=!0,this.invalidPoint=i[0],null;var r=e,s=n;oe.isCCW(i)&&(r=n,s=e);var o=new jn(i,new ln(this.argIndex,S.BOUNDARY,r,s));this.lineEdgeMap.put(t,o),this.insertEdge(o),this.insertPoint(this.argIndex,i[0],S.BOUNDARY)},insertPoint:function(t,e,n){var i=this.nodes.addNode(e),r=i.getLabel();null===r?i.label=new ln(t,n):r.setLocation(t,n)},createEdgeSetIntersector:function(){return new _n},addSelfIntersectionNodes:function(t){for(var e=this.edges.iterator();e.hasNext();)for(var n=e.next(),i=n.getLabel().getLocation(t),r=n.eiList.iterator();r.hasNext();){var s=r.next();this.addSelfIntersectionNode(t,s.coord,i)}},add:function(){if(1!==arguments.length)return xn.prototype.add.apply(this,arguments);var t=arguments[0];if(t.isEmpty())return null;if(t instanceof Tt&&(this.useBoundaryDeterminationRule=!1),t instanceof Lt)this.addPolygon(t);else if(t instanceof It)this.addLineString(t);else if(t instanceof Ct)this.addPoint(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof ht)this.addCollection(t);else if(t instanceof Tt)this.addCollection(t);else{if(!(t instanceof lt))throw new UnsupportedOperationException(t.getClass().getName());this.addCollection(t)}},addCollection:function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},locate:function(t){return oo(this.parentGeom,St)&&this.parentGeom.getNumGeometries()>50?(null===this.areaPtLocator&&(this.areaPtLocator=new Vn(this.parentGeom)),this.areaPtLocator.locate(t)):this.ptLocator.locate(t,this.parentGeom)},findEdge:function(){if(1===arguments.length){var t=arguments[0];return this.lineEdgeMap.get(t)}return xn.prototype.findEdge.apply(this,arguments)},interfaces_:function(){return[]},getClass:function(){return Kn}}),Kn.determineBoundary=function(t,e){return t.isInBoundary(e)?S.BOUNDARY:S.INTERIOR},io(Zn.prototype,{getArgGeometry:function(t){return this.arg[t].getGeometry()},setComputationPrecision:function(t){this.resultPrecisionModel=t,this.li.setPrecisionModel(this.resultPrecisionModel)},interfaces_:function(){return[]},getClass:function(){return Zn}}),io(Qn.prototype,{compareTo:function(t){var e=t;return Qn.compareOriented(this.pts,this._orientation,e.pts,e._orientation)},interfaces_:function(){return[r]},getClass:function(){return Qn}}),Qn.orientation=function(t){return 1===Y.increasingDirection(t)},Qn.compareOriented=function(t,e,n,i){for(var r=e?1:-1,s=i?1:-1,o=e?t.length:-1,a=i?n.length:-1,u=e?0:t.length-1,l=i?0:n.length-1;;){var h=t[u].compareTo(n[l]);if(0!==h)return h;u+=r,l+=s;var c=u===o,f=l===a;if(c&&!f)return-1;if(!c&&f)return 1;if(c&&f)return 0}},io(Jn.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 i=n.getCoordinates(),r=0;r<i.length;r++)r>0&&t.print(","),t.print(i[r].x+" "+i[r].y);t.println(")")}t.print(") ")},addAll:function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},findEdgeIndex:function(t){for(var e=0;e<this.edges.size();e++)if(this.edges.get(e).equals(t))return e;return-1},iterator:function(){return this.edges.iterator()},getEdges:function(){return this.edges},get:function(t){return this.edges.get(t)},findEqualEdge:function(t){var e=new Qn(t.getCoordinates());return this.ocaMap.get(e)},add:function(t){this.edges.add(t);var e=new Qn(t.getCoordinates());this.ocaMap.put(e,t)},interfaces_:function(){return[]},getClass:function(){return Jn}}),ro($n,Zn),io($n.prototype,{insertUniqueEdge:function(t){var e=this.edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new ln(t.getLabel()),i.flip());var r=e.getDepth();r.isNull()&&r.add(n),r.add(i),n.merge(i)}else this.edgeList.add(t)},getGraph:function(){return this.graph},cancelDuplicateResultEdges:function(){for(var t=this.graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},isCoveredByLA:function(t){
return!!this.isCovered(t,this.resultLineList)||!!this.isCovered(t,this.resultPolyList)},computeGeometry:function(t,e,n,i){var r=new x;return r.addAll(t),r.addAll(e),r.addAll(n),r.isEmpty()?$n.createEmptyResult(i,this.arg[0].getGeometry(),this.arg[1].getGeometry(),this.geomFact):this.geomFact.buildGeometry(r)},mergeSymLabels:function(){for(var t=this.graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},isCovered:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();if(this.ptLocator.locate(t,i)!==S.EXTERIOR)return!0}return!1},replaceCollapsedEdges:function(){for(var t=new x,e=this.edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this.edgeList.addAll(t)},updateNodeLabelling:function(){for(var t=this.graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},getResultGeometry:function(t){return this.computeOverlay(t),this.resultGeom},insertUniqueEdges:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},computeOverlay:function(t){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 e=new x;this.arg[0].computeSplitEdges(e),this.arg[1].computeSplitEdges(e);this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),sn.checkValid(this.edgeList.getEdges()),this.graph.addEdges(this.edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new En(this.geomFact);n.add(this.graph),this.resultPolyList=n.getPolygons();var i=new In(this,this.geomFact,this.ptLocator);this.resultLineList=i.build(t);var r=new Nn(this,this.geomFact,this.ptLocator);this.resultPointList=r.build(t),this.resultGeom=this.computeGeometry(this.resultPointList,this.resultLineList,this.resultPolyList,t)},labelIncompleteNode:function(t,e){var n=this.ptLocator.locate(t.getCoordinate(),this.arg[e].getGeometry());t.getLabel().setLocation(e,n)},copyPoints:function(t){for(var e=this.arg[t].getNodeIterator();e.hasNext();){var n=e.next();this.graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},findResultAreaEdges:function(t){for(var e=this.graph.getEdgeEnds().iterator();e.hasNext();){var n=e.next(),i=n.getLabel();i.isArea()&&!n.isInteriorAreaEdge()&&$n.isResultOfOp(i.getLocation(0,an.RIGHT),i.getLocation(1,an.RIGHT),t)&&n.setInResult(!0)}},computeLabelsFromDepths:function(){for(var t=this.edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),i=e.getDepth();if(!i.isNull()){i.normalize();for(var r=0;r<2;r++)n.isNull(r)||!n.isArea()||i.isNull(r)||(0===i.getDelta(r)?n.toLine(r):(h.isTrue(!i.isNull(r,an.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(r,an.LEFT,i.getLocation(r,an.LEFT)),h.isTrue(!i.isNull(r,an.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(r,an.RIGHT,i.getLocation(r,an.RIGHT))))}}},computeLabelling:function(){for(var t=this.graph.getNodes().iterator();t.hasNext();){t.next().getEdges().computeLabelling(this.arg)}this.mergeSymLabels(),this.updateNodeLabelling()},labelIncompleteNodes:function(){for(var t=0,e=this.graph.getNodes().iterator();e.hasNext();){var n=e.next(),i=n.getLabel();n.isIsolated()&&(t++,i.isNull(0)?this.labelIncompleteNode(n,0):this.labelIncompleteNode(n,1)),n.getEdges().updateLabelling(i)}},isCoveredByA:function(t){return!!this.isCovered(t,this.resultPolyList)},interfaces_:function(){return[]},getClass:function(){return $n}}),$n.overlayOp=function(t,e,n){return new $n(t,e).getResultGeometry(n)},$n.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return $n.createEmptyResult($n.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return on.map(t,{interfaces_:function(){return[MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ei.overlayOp(t,e,$n.INTERSECTION)},$n.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return $n.createEmptyResult($n.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ei.overlayOp(t,e,$n.SYMDIFFERENCE)},$n.resultDimension=function(t,e,n){var i=e.getDimension(),r=n.getDimension(),s=-1;switch(t){case $n.INTERSECTION:s=Math.min(i,r);break;case $n.UNION:s=Math.max(i,r);break;case $n.DIFFERENCE:s=i;break;case $n.SYMDIFFERENCE:s=Math.max(i,r)}return s},$n.createEmptyResult=function(t,e,n,i){var r=null;switch($n.resultDimension(t,e,n)){case-1:r=i.createGeometryCollection(new Array(0).fill(null));break;case 0:r=i.createPoint();break;case 1:r=i.createLineString();break;case 2:r=i.createPolygon()}return r},$n.difference=function(t,e){return t.isEmpty()?$n.createEmptyResult($n.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ei.overlayOp(t,e,$n.DIFFERENCE))},$n.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),i=t.getLocation(1);return $n.isResultOfOp(n,i,e)}if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];switch(r===S.BOUNDARY&&(r=S.INTERIOR),s===S.BOUNDARY&&(s=S.INTERIOR),o){case $n.INTERSECTION:return r===S.INTERIOR&&s===S.INTERIOR;case $n.UNION:return r===S.INTERIOR||s===S.INTERIOR;case $n.DIFFERENCE:return r===S.INTERIOR&&s!==S.INTERIOR;case $n.SYMDIFFERENCE:return r===S.INTERIOR&&s!==S.INTERIOR||r!==S.INTERIOR&&s===S.INTERIOR}return!1}},$n.INTERSECTION=1,$n.UNION=2,$n.DIFFERENCE=3,$n.SYMDIFFERENCE=4,io(ti.prototype,{selfSnap:function(t){return new ve(t).snapTo(t,this.snapTolerance)},removeCommonBits:function(t){this.cbr=new Ee,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},prepareResult:function(t){return this.cbr.addCommonBits(t),t},getResultGeometry:function(t){var e=this.snap(this.geom),n=$n.overlayOp(e[0],e[1],t);return this.prepareResult(n)},checkValid:function(t){t.isValid()||_.out.println("Snapped geometry is invalid")},computeSnapTolerance:function(){this.snapTolerance=ve.computeOverlaySnapTolerance(this.geom[0],this.geom[1])},snap:function(t){var e=this.removeCommonBits(t);return ve.snap(e[0],e[1],this.snapTolerance)},interfaces_:function(){return[]},getClass:function(){return ti}}),ti.overlayOp=function(t,e,n){return new ti(t,e).getResultGeometry(n)},ti.union=function(t,e){return ti.overlayOp(t,e,$n.UNION)},ti.intersection=function(t,e){return ti.overlayOp(t,e,$n.INTERSECTION)},ti.symDifference=function(t,e){return ti.overlayOp(t,e,$n.SYMDIFFERENCE)},ti.difference=function(t,e){return ti.overlayOp(t,e,$n.DIFFERENCE)},io(ei.prototype,{getResultGeometry:function(t){var e=null,n=!1,i=null;try{e=$n.overlayOp(this.geom[0],this.geom[1],t);n=!0}catch(t){if(!(t instanceof u))throw t;i=t}if(!n)try{e=ti.overlayOp(this.geom[0],this.geom[1],t)}catch(t){throw t instanceof u?i:t}return e},interfaces_:function(){return[]},getClass:function(){return ei}}),ei.overlayOp=function(t,e,n){return new ei(t,e).getResultGeometry(n)},ei.union=function(t,e){return ei.overlayOp(t,e,$n.UNION)},ei.intersection=function(t,e){return ei.overlayOp(t,e,$n.INTERSECTION)},ei.symDifference=function(t,e){return ei.overlayOp(t,e,$n.SYMDIFFERENCE)},ei.difference=function(t,e){return ei.overlayOp(t,e,$n.DIFFERENCE)},io(ni.prototype,{addPolygon:function(t){if(t.isEmpty())return null;var e=null,n=0,i=this.horizontalBisector(t);if(0===i.getLength())n=0,e=i.getCoordinate();else{var r=ei.overlayOp(i,t,$n.INTERSECTION),s=this.widestGeometry(r);n=s.getEnvelopeInternal().getWidth(),e=ni.centre(s.getEnvelopeInternal())}(null===this.interiorPoint||n>this.maxWidth)&&(this.interiorPoint=e,this.maxWidth=n)},getInteriorPoint:function(){return this.interiorPoint},widestGeometry:function(){if(arguments[0]instanceof lt){var t=arguments[0];if(t.isEmpty())return t;for(var e=t.getGeometryN(0),n=1;n<t.getNumGeometries();n++)t.getGeometryN(n).getEnvelopeInternal().getWidth()>e.getEnvelopeInternal().getWidth()&&(e=t.getGeometryN(n));return e}if(arguments[0]instanceof F){var i=arguments[0];return i instanceof lt?this.widestGeometry(i):i}},horizontalBisector:function(t){var e=t.getEnvelopeInternal(),n=ii.getBisectorY(t);return this.factory.createLineString([new c(e.getMinX(),n),new c(e.getMaxX(),n)])},add:function(t){if(t instanceof Lt)this.addPolygon(t);else if(t instanceof lt)for(var e=t,n=0;n<e.getNumGeometries();n++)this.add(e.getGeometryN(n))},interfaces_:function(){return[]},getClass:function(){return ni}}),ni.centre=function(t){return new c(ni.avg(t.getMinX(),t.getMaxX()),ni.avg(t.getMinY(),t.getMaxY()))},ni.avg=function(t,e){return(t+e)/2},io(ii.prototype,{updateInterval:function(t){t<=this.centreY?t>this.loY&&(this.loY=t):t>this.centreY&&t<this.hiY&&(this.hiY=t)},getBisectorY:function(){this.process(this.poly.getExteriorRing());for(var t=0;t<this.poly.getNumInteriorRing();t++)this.process(this.poly.getInteriorRingN(t));return ni.avg(this.hiY,this.loY)},process:function(t){for(var e=t.getCoordinateSequence(),n=0;n<e.size();n++){var i=e.getY(n);this.updateInterval(i)}},interfaces_:function(){return[]},getClass:function(){return ii}}),ii.getBisectorY=function(t){return new ii(t).getBisectorY()},ni.SafeBisectorFinder=ii,io(ri.prototype,{addEndpoints:function(){if(arguments[0]instanceof F){var t=arguments[0];if(t instanceof It)this.addEndpoints(t.getCoordinates());else if(t instanceof lt)for(var e=t,n=0;n<e.getNumGeometries();n++)this.addEndpoints(e.getGeometryN(n))}else if(arguments[0]instanceof Array){var i=arguments[0];this.add(i[0]),this.add(i[i.length-1])}},getInteriorPoint:function(){return this.interiorPoint},addInterior:function(){if(arguments[0]instanceof F){var t=arguments[0];if(t instanceof It)this.addInterior(t.getCoordinates());else if(t instanceof lt)for(var e=t,n=0;n<e.getNumGeometries();n++)this.addInterior(e.getGeometryN(n))}else if(arguments[0]instanceof Array)for(var i=arguments[0],n=1;n<i.length-1;n++)this.add(i[n])},add:function(t){var e=t.distance(this.centroid);e<this.minDistance&&(this.interiorPoint=new c(t),this.minDistance=e)},interfaces_:function(){return[]},getClass:function(){return ri}}),io(si.prototype,{getInteriorPoint:function(){return this.interiorPoint},add:function(){if(arguments[0]instanceof F){var t=arguments[0];if(t instanceof Ct)this.add(t.getCoordinate());else if(t instanceof lt)for(var e=t,n=0;n<e.getNumGeometries();n++)this.add(e.getGeometryN(n))}else if(arguments[0]instanceof c){var i=arguments[0],r=i.distance(this.centroid);r<this.minDistance&&(this.interiorPoint=new c(i),this.minDistance=r)}},interfaces_:function(){return[]},getClass:function(){return si}}),io(oi.prototype,{select:function(){if(1===arguments.length){arguments[0]}else if(2===arguments.length){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}},interfaces_:function(){return[]},getClass:function(){return oi}}),io(ai.prototype,{hasChildren:function(){for(var t=0;t<2;t++)if(null!==this.subnode[t])return!0;return!1},isPrunable:function(){return!(this.hasChildren()||this.hasItems())},addAllItems:function(t){t.addAll(this.items);for(var e=0;e<2;e++)null!==this.subnode[e]&&this.subnode[e].addAllItems(t);return t},size:function(){for(var t=0,e=0;e<2;e++)null!==this.subnode[e]&&(t+=this.subnode[e].size());return t+this.items.size()},addAllItemsFromOverlapping:function(t,e){if(null!==t&&!this.isSearchMatch(t))return null;e.addAll(this.items),null!==this.subnode[0]&&this.subnode[0].addAllItemsFromOverlapping(t,e),null!==this.subnode[1]&&this.subnode[1].addAllItemsFromOverlapping(t,e)},hasItems:function(){return!this.items.isEmpty()},remove:function(t,e){if(!this.isSearchMatch(t))return!1;for(var n=!1,i=0;i<2;i++)if(null!==this.subnode[i]&&(n=this.subnode[i].remove(t,e))){this.subnode[i].isPrunable()&&(this.subnode[i]=null);break}return n||(n=this.items.remove(e))},getItems:function(){return this.items},depth:function(){for(var t=0,e=0;e<2;e++)if(null!==this.subnode[e]){var n=this.subnode[e].depth();n>t&&(t=n)}return t+1},nodeSize:function(){for(var t=0,e=0;e<2;e++)null!==this.subnode[e]&&(t+=this.subnode[e].nodeSize());return t+1},add:function(t){this.items.add(t)},interfaces_:function(){return[]},getClass:function(){return ai}}),ai.getSubnodeIndex=function(t,e){var n=-1;return t.min>=e&&(n=1),t.max<=e&&(n=0),n},io(ui.prototype,{expandToInclude:function(t){t.max>this.max&&(this.max=t.max),t.min<this.min&&(this.min=t.min)},getWidth:function(){return this.max-this.min},overlaps:function(){if(1===arguments.length){var t=arguments[0];return this.overlaps(t.min,t.max)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return!(this.min>n||this.max<e)}},getMin:function(){return this.min},toString:function(){return"["+this.min+", "+this.max+"]"},contains:function(){if(1===arguments.length){if(arguments[0]instanceof ui){var t=arguments[0];return this.contains(t.min,t.max)}if("number"==typeof arguments[0]){var e=arguments[0];return e>=this.min&&e<=this.max}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];return n>=this.min&&i<=this.max}},init:function(t,e){this.min=t,this.max=e,t>e&&(this.min=e,this.max=t)},getMax:function(){return this.max},interfaces_:function(){return[]},getClass:function(){return ui}}),li.exponent=function(t){return hi(64,t)-1023},li.powerOf2=function(t){return Math.pow(2,t)},io(ci.prototype,{getInterval:function(){return this.interval},getLevel:function(){return this.level},computeKey:function(t){for(this.level=ci.computeLevel(t),this.interval=new ui,this.computeInterval(this.level,t);!this.interval.contains(t);)this.level+=1,this.computeInterval(this.level,t)},computeInterval:function(t,e){var n=li.powerOf2(t);this.pt=Math.floor(e.getMin()/n)*n,this.interval.init(this.pt,this.pt+n)},getPoint:function(){return this.pt},interfaces_:function(){return[]},getClass:function(){return ci}}),ci.computeLevel=function(t){var e=t.getWidth();return li.exponent(e)+1},ro(fi,ai),io(fi.prototype,{getInterval:function(){return this.interval},find:function(t){var e=ai.getSubnodeIndex(t,this.centre);if(-1===e)return this;if(null!==this.subnode[e]){return this.subnode[e].find(t)}return this},insert:function(t){h.isTrue(null===this.interval||this.interval.contains(t.interval));var e=ai.getSubnodeIndex(t.interval,this.centre);if(t.level===this.level-1)this.subnode[e]=t;else{var n=this.createSubnode(e);n.insert(t),this.subnode[e]=n}},isSearchMatch:function(t){return t.overlaps(this.interval)},getSubnode:function(t){return null===this.subnode[t]&&(this.subnode[t]=this.createSubnode(t)),this.subnode[t]},getNode:function(t){var e=ai.getSubnodeIndex(t,this.centre);if(-1!==e){return this.getSubnode(e).getNode(t)}return this},createSubnode:function(t){var e=0,n=0;switch(t){case 0:e=this.interval.getMin(),n=this.centre;break;case 1:e=this.centre,n=this.interval.getMax()}return new fi(new ui(e,n),this.level-1)},interfaces_:function(){return[]},getClass:function(){return fi}}),fi.createNode=function(t){var e=new ci(t);return new fi(e.getInterval(),e.getLevel())},fi.createExpanded=function(t,e){var n=new ui(e);null!==t&&n.expandToInclude(t.interval);var i=fi.createNode(n);return null!==t&&i.insert(t),i},io(gi.prototype,{interfaces_:function(){return[]},getClass:function(){return gi}});gi.isZeroWidth=function(t,e){var n=e-t;if(0===n)return!0;var i=Math.max(Math.abs(t),Math.abs(e)),r=n/i;return li.exponent(r)<=gi.MIN_BINARY_EXPONENT},gi.MIN_BINARY_EXPONENT=-50,ro(di,ai),io(di.prototype,{insert:function(t,e){var n=ai.getSubnodeIndex(t,di.origin);if(-1===n)return this.add(e),null;var i=this.subnode[n];if(null===i||!i.getInterval().contains(t)){var r=fi.createExpanded(i,t);this.subnode[n]=r}this.insertContained(this.subnode[n],t,e)},isSearchMatch:function(t){return!0},insertContained:function(t,e,n){h.isTrue(t.getInterval().contains(e));var i=gi.isZeroWidth(e.getMin(),e.getMax()),r=null;r=i?t.find(e):t.getNode(e),r.add(n)},interfaces_:function(){return[]},getClass:function(){return di}}),di.origin=0,io(pi.prototype,{size:function(){return null!==this.root?this.root.size():0},insert:function(t,e){this.collectStats(t);var n=pi.ensureExtent(t,this.minExtent);this.root.insert(n,e)},query:function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];return this.query(new ui(t,t))}if(arguments[0]instanceof ui){var e=arguments[0],n=new x;return this.query(e,n),n}}else if(2===arguments.length){var i=arguments[0],r=arguments[1];this.root.addAllItemsFromOverlapping(i,r)}},iterator:function(){var t=new x;return this.root.addAllItems(t),t.iterator()},remove:function(t,e){var n=pi.ensureExtent(t,this.minExtent);return this.root.remove(n,e)},collectStats:function(t){var e=t.getWidth();e<this.minExtent&&e>0&&(this.minExtent=e)},depth:function(){return null!==this.root?this.root.depth():0},nodeSize:function(){return null!==this.root?this.root.nodeSize():0},interfaces_:function(){return[]},getClass:function(){return pi}}),pi.ensureExtent=function(t,e){var n=t.getMin(),i=t.getMax();return n!==i?t:(n===i&&(n-=e/2,i=n+e/2),new ui(n,i))},io(mi.prototype,{isInside:function(t){},interfaces_:function(){return[]},getClass:function(){return mi}}),io(vi.prototype,{testLineSegment:function(t,e){var n=null,i=null,r=null,s=null,o=e.p0,a=e.p1;n=o.x-t.x,i=o.y-t.y,r=a.x-t.x,s=a.y-t.y,(i>0&&s<=0||s>0&&i<=0)&&0<re.signOfDet2x2(n,i,r,s)/(s-i)&&this.crossings++},buildIndex:function(){this.tree=new pi;for(var t=Y.removeRepeatedPoints(this.ring.getCoordinates()),e=Ke.getChains(t),n=0;n<e.size();n++){var i=e.get(n),r=i.getEnvelope();this.interval.min=r.getMinY(),this.interval.max=r.getMaxY(),this.tree.insert(this.interval,i)}},testMonotoneChain:function(t,e,n){n.select(t,e)},isInside:function(t){this.crossings=0;var e=new I(i.NEGATIVE_INFINITY,i.POSITIVE_INFINITY,t.y,t.y);this.interval.min=t.y,this.interval.max=t.y;for(var n=this.tree.query(this.interval),r=new yi(this,t),s=n.iterator();s.hasNext();){var o=s.next();this.testMonotoneChain(e,r,o)}return this.crossings%2==1},interfaces_:function(){return[mi]},getClass:function(){return vi}}),ro(yi,oi),io(yi.prototype,{select:function(){if(1!==arguments.length)return oi.prototype.select.apply(this,arguments);var t=arguments[0];this.mcp.testLineSegment(this.p,t)},interfaces_:function(){return[]},getClass:function(){return yi}}),vi.MCSelecter=yi,io(xi.prototype,{interfaces_:function(){return[]},getClass:function(){return xi}}),xi.toDegrees=function(t){return 180*t/Math.PI},xi.normalize=function(t){for(;t>Math.PI;)t-=xi.PI_TIMES_2;for(;t<=-Math.PI;)t+=xi.PI_TIMES_2;return t},xi.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],i=n.x-e.x,r=n.y-e.y;return Math.atan2(r,i)}},xi.isAcute=function(t,e,n){var i=t.x-e.x,r=t.y-e.y;return i*(n.x-e.x)+r*(n.y-e.y)>0},xi.isObtuse=function(t,e,n){var i=t.x-e.x,r=t.y-e.y;return i*(n.x-e.x)+r*(n.y-e.y)<0},xi.interiorAngle=function(t,e,n){var i=xi.angle(e,t),r=xi.angle(e,n);return Math.abs(r-i)},xi.normalizePositive=function(t){if(t<0){for(;t<0;)t+=xi.PI_TIMES_2;t>=xi.PI_TIMES_2&&(t=0)}else{for(;t>=xi.PI_TIMES_2;)t-=xi.PI_TIMES_2;t<0&&(t=0)}return t},xi.angleBetween=function(t,e,n){var i=xi.angle(e,t),r=xi.angle(e,n);return xi.diff(i,r)},xi.diff=function(t,e){var n=null;return n=t<e?e-t:t-e,n>Math.PI&&(n=2*Math.PI-n),n},xi.toRadians=function(t){return t*Math.PI/180},xi.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?xi.COUNTERCLOCKWISE:n<0?xi.CLOCKWISE:xi.NONE},xi.angleBetweenOriented=function(t,e,n){var i=xi.angle(e,t),r=xi.angle(e,n),s=r-i;return s<=-Math.PI?s+xi.PI_TIMES_2:s>Math.PI?s-xi.PI_TIMES_2:s},xi.PI_TIMES_2=2*Math.PI,xi.PI_OVER_2=Math.PI/2,xi.PI_OVER_4=Math.PI/4,xi.COUNTERCLOCKWISE=oe.COUNTERCLOCKWISE,xi.CLOCKWISE=oe.CLOCKWISE,xi.NONE=oe.COLLINEAR,io(Ei.prototype,{area:function(){return Ei.area(this.p0,this.p1,this.p2)},signedArea:function(){return Ei.signedArea(this.p0,this.p1,this.p2)},interpolateZ:function(t){if(null===t)throw new n("Supplied point is null.");return Ei.interpolateZ(t,this.p0,this.p1,this.p2)},longestSideLength:function(){return Ei.longestSideLength(this.p0,this.p1,this.p2)},isAcute:function(){return Ei.isAcute(this.p0,this.p1,this.p2)},circumcentre:function(){return Ei.circumcentre(this.p0,this.p1,this.p2)},area3D:function(){return Ei.area3D(this.p0,this.p1,this.p2)},centroid:function(){return Ei.centroid(this.p0,this.p1,this.p2)},inCentre:function(){return Ei.inCentre(this.p0,this.p1,this.p2)},interfaces_:function(){return[]},getClass:function(){return Ei}}),Ei.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)},Ei.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Ei.det=function(t,e,n,i){return t*i-e*n},Ei.interpolateZ=function(t,e,n,i){var r=e.x,s=e.y,o=n.x-r,a=i.x-r,u=n.y-s,l=i.y-s,h=o*l-a*u,c=t.x-r,f=t.y-s,g=(l*c-a*f)/h,d=(-u*c+o*f)/h;return e.z+g*(n.z-e.z)+d*(i.z-e.z)},Ei.longestSideLength=function(t,e,n){var i=t.distance(e),r=e.distance(n),s=n.distance(t),o=i;return r>o&&(o=r),s>o&&(o=s),o},Ei.isAcute=function(t,e,n){return!!xi.isAcute(t,e,n)&&(!!xi.isAcute(e,n,t)&&!!xi.isAcute(n,t,e))},Ei.circumcentre=function(t,e,n){var i=n.x,r=n.y,s=t.x-i,o=t.y-r,a=e.x-i,u=e.y-r,l=2*Ei.det(s,o,a,u);return new c(i-Ei.det(o,s*s+o*o,u,a*a+u*u)/l,r+Ei.det(s,s*s+o*o,a,a*a+u*u)/l)},Ei.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y;return new M(new M(t.x+n/2,t.y+i/2,1),new M(t.x-i+n/2,t.y+n+i/2,1))},Ei.angleBisector=function(t,e,n){var i=e.distance(t),r=e.distance(n),s=i/(i+r),o=n.x-t.x,a=n.y-t.y;return new c(t.x+s*o,t.y+s*a)},Ei.area3D=function(t,e,n){var i=e.x-t.x,r=e.y-t.y,s=e.z-t.z,o=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=r*u-s*a,h=s*o-i*u,c=i*a-r*o,f=l*l+h*h+c*c;return Math.sqrt(f)/2},Ei.centroid=function(t,e,n){return new c((t.x+e.x+n.x)/3,(t.y+e.y+n.y)/3)},Ei.inCentre=function(t,e,n){var i=e.distance(n),r=t.distance(n),s=t.distance(e),o=i+r+s;return new c((i*t.x+r*e.x+s*n.x)/o,(i*t.y+r*e.y+s*n.y)/o)},io(Ii.prototype,{getRadius:function(){return this.compute(),this.radius},getDiameter:function(){switch(this.compute(),this.extremalPts.length){case 0:return this.input.getFactory().createLineString();case 1:return this.input.getFactory().createPoint(this.centre)}var t=this.extremalPts[0],e=this.extremalPts[1];return this.input.getFactory().createLineString([t,e])},getExtremalPoints:function(){return this.compute(),this.extremalPts},computeCirclePoints:function(){if(this.input.isEmpty())return this.extremalPts=new Array(0).fill(null),null;if(1===this.input.getNumPoints()){var t=this.input.getCoordinates();return this.extremalPts=[new c(t[0])],null}var e=this.input.convexHull(),n=e.getCoordinates(),t=n;if(n[0].equals2D(n[n.length-1])&&(t=new Array(n.length-1).fill(null),Y.copyDeep(n,0,t,0,n.length-1)),t.length<=2)return this.extremalPts=Y.copyDeep(t),null;for(var i=Ii.lowestPoint(t),r=Ii.pointWitMinAngleWithX(t,i),s=0;s<t.length;s++){var o=Ii.pointWithMinAngleWithSegment(t,i,r);if(xi.isObtuse(i,o,r))return this.extremalPts=[new c(i),new c(r)],null;if(xi.isObtuse(o,i,r))i=o;else{if(!xi.isObtuse(o,r,i))return this.extremalPts=[new c(i),new c(r),new c(o)],null;r=o}}h.shouldNeverReachHere("Logic failure in Minimum Bounding Circle algorithm!")},compute:function(){if(null!==this.extremalPts)return null;this.computeCirclePoints(),this.computeCentre(),null!==this.centre&&(this.radius=this.centre.distance(this.extremalPts[0]))},getFarthestPoints:function(){switch(this.compute(),this.extremalPts.length){case 0:return this.input.getFactory().createLineString();case 1:return this.input.getFactory().createPoint(this.centre)}var t=this.extremalPts[0],e=this.extremalPts[this.extremalPts.length-1];return this.input.getFactory().createLineString([t,e])},getCircle:function(){if(this.compute(),null===this.centre)return this.input.getFactory().createPolygon();var t=this.input.getFactory().createPoint(this.centre);return 0===this.radius?t:t.buffer(this.radius)},getCentre:function(){return this.compute(),this.centre},computeCentre:function(){switch(this.extremalPts.length){case 0:this.centre=null;break;case 1:this.centre=this.extremalPts[0];break;case 2:this.centre=new c((this.extremalPts[0].x+this.extremalPts[1].x)/2,(this.extremalPts[0].y+this.extremalPts[1].y)/2);break;case 3:this.centre=Ei.circumcentre(this.extremalPts[0],this.extremalPts[1],this.extremalPts[2])}},interfaces_:function(){return[]},getClass:function(){return Ii}}),Ii.pointWitMinAngleWithX=function(t,e){for(var n=i.MAX_VALUE,r=null,s=0;s<t.length;s++){var o=t[s];if(o!==e){var a=o.x-e.x,u=o.y-e.y;u<0&&(u=-u);var l=Math.sqrt(a*a+u*u),h=u/l;h<n&&(n=h,r=o)}}return r},Ii.lowestPoint=function(t){for(var e=t[0],n=1;n<t.length;n++)t[n].y<e.y&&(e=t[n]);return e},Ii.pointWithMinAngleWithSegment=function(t,e,n){for(var r=i.MAX_VALUE,s=null,o=0;o<t.length;o++){var a=t[o];if(a!==e&&a!==n){var u=xi.angleBetween(e,a,n);u<r&&(r=u,s=a)}}return s},io(Ni.prototype,{getWidthCoordinate:function(){return this.computeMinimumDiameter(),this.minWidthPt},getSupportingSegment:function(){return this.computeMinimumDiameter(),this.inputGeom.getFactory().createLineString([this.minBaseSeg.p0,this.minBaseSeg.p1])},getDiameter:function(){if(this.computeMinimumDiameter(),null===this.minWidthPt)return this.inputGeom.getFactory().createLineString(null);var t=this.minBaseSeg.project(this.minWidthPt);return this.inputGeom.getFactory().createLineString([t,this.minWidthPt])},computeWidthConvex:function(t){this.convexHullPts=t instanceof Lt?t.getExteriorRing().getCoordinates():t.getCoordinates(),0===this.convexHullPts.length?(this.minWidth=0,this.minWidthPt=null,this.minBaseSeg=null):1===this.convexHullPts.length?(this.minWidth=0,this.minWidthPt=this.convexHullPts[0],this.minBaseSeg.p0=this.convexHullPts[0],this.minBaseSeg.p1=this.convexHullPts[0]):2===this.convexHullPts.length||3===this.convexHullPts.length?(this.minWidth=0,this.minWidthPt=this.convexHullPts[0],this.minBaseSeg.p0=this.convexHullPts[0],this.minBaseSeg.p1=this.convexHullPts[1]):this.computeConvexRingMinDiameter(this.convexHullPts)},computeConvexRingMinDiameter:function(t){this.minWidth=i.MAX_VALUE;for(var e=1,n=new ae,r=0;r<t.length-1;r++)n.p0=t[r],n.p1=t[r+1],e=this.findMaxPerpDistance(t,n,e)},computeMinimumDiameter:function(){if(null!==this.minWidthPt)return null;if(this.isConvex)this.computeWidthConvex(this.inputGeom);else{var t=new ge(this.inputGeom).getConvexHull();this.computeWidthConvex(t)}},getLength:function(){return this.computeMinimumDiameter(),this.minWidth},findMaxPerpDistance:function(t,e,n){for(var i=e.distancePerpendicular(t[n]),r=i,s=n,o=s;r>=i;)i=r,s=o,o=Ni.nextIndex(t,s),r=e.distancePerpendicular(t[o]);return i<this.minWidth&&(this.minPtIndex=s,this.minWidth=i,this.minWidthPt=t[this.minPtIndex],this.minBaseSeg=new ae(e)),s},getMinimumRectangle:function(){if(this.computeMinimumDiameter(),0===this.minWidth)return this.minBaseSeg.p0.equals2D(this.minBaseSeg.p1)?this.inputGeom.getFactory().createPoint(this.minBaseSeg.p0):this.minBaseSeg.toGeometry(this.inputGeom.getFactory());for(var t=this.minBaseSeg.p1.x-this.minBaseSeg.p0.x,e=this.minBaseSeg.p1.y-this.minBaseSeg.p0.y,n=i.MAX_VALUE,r=-i.MAX_VALUE,s=i.MAX_VALUE,o=-i.MAX_VALUE,a=0;a<this.convexHullPts.length;a++){var u=Ni.computeC(t,e,this.convexHullPts[a]);u>r&&(r=u),u<n&&(n=u);var l=Ni.computeC(-e,t,this.convexHullPts[a]);l>o&&(o=l),l<s&&(s=l)}var h=Ni.computeSegmentForLine(-t,-e,o),c=Ni.computeSegmentForLine(-t,-e,s),f=Ni.computeSegmentForLine(-e,t,r),g=Ni.computeSegmentForLine(-e,t,n),d=f.lineIntersection(h),p=g.lineIntersection(h),m=g.lineIntersection(c),v=f.lineIntersection(c),y=this.inputGeom.getFactory().createLinearRing([d,p,m,v,d]);return this.inputGeom.getFactory().createPolygon(y,null)},interfaces_:function(){return[]},getClass:function(){return Ni}}),Ni.nextIndex=function(t,e){return e++,e>=t.length&&(e=0),e},Ni.computeC=function(t,e,n){return t*n.y-e*n.x},Ni.getMinimumDiameter=function(t){return new Ni(t).getDiameter()},Ni.getMinimumRectangle=function(t){return new Ni(t).getMinimumRectangle()},Ni.computeSegmentForLine=function(t,e,n){var i=null,r=null;return Math.abs(e)>Math.abs(t)?(i=new c(0,n/e),r=new c(1,n/e-t/e)):(i=new c(n/t,0),r=new c(n/t-e/t,1)),new ae(i,r)};var Eo=Object.freeze({Centroid:le,CGAlgorithms:oe,ConvexHull:ge,InteriorPointArea:ni,InteriorPointLine:ri,InteriorPointPoint:si,RobustLineIntersector:ie,MCPointInRing:vi,MinimumBoundingCircle:Ii,MinimumDiameter:Ni});io(Ci.prototype,{getResultGeometry:function(){return new Si(this.distanceTolerance).transform(this.inputGeom)},setDistanceTolerance:function(t){if(t<=0)throw new n("Tolerance must be positive");this.distanceTolerance=t},interfaces_:function(){return[]},getClass:function(){return Ci}}),Ci.densifyPoints=function(t,e,n){for(var i=new ae,r=new E,s=0;s<t.length-1;s++){i.p0=t[s],i.p1=t[s+1],r.add(i.p0,!1);var o=i.getLength(),a=Math.trunc(o/e)+1;if(a>1)for(var u=o/a,l=1;l<a;l++){var h=l*u/o,c=i.pointAlong(h);n.makePrecise(c),r.add(c,!1)}}return r.add(t[t.length-1],!1),r.toCoordinateArray()},Ci.densify=function(t,e){var n=new Ci(t);return n.setDistanceTolerance(e),n.getResultGeometry()},ro(Si,pe),io(Si.prototype,{transformMultiPolygon:function(t,e){var n=pe.prototype.transformMultiPolygon.call(this,t,e);return this.createValidArea(n)},transformPolygon:function(t,e){var n=pe.prototype.transformPolygon.call(this,t,e);return e instanceof Tt?n:this.createValidArea(n)},transformCoordinates:function(t,e){var n=t.toCoordinateArray(),i=Ci.densifyPoints(n,this.distanceTolerance,e.getPrecisionModel());return e instanceof It&&1===i.length&&(i=new Array(0).fill(null)),this.factory.getCoordinateSequenceFactory().create(i)},createValidArea:function(t){return t.buffer(0)},interfaces_:function(){return[]},getClass:function(){return Si}}),Ci.DensifyTransformer=Si;var Io=Object.freeze({Densifier:Ci});io(Li.prototype,{find:function(t){var e=this;do{if(null===e)return null;if(e.dest().equals2D(t))return e;e=e.oNext()}while(e!==this);return null},dest:function(){return this._sym._orig},oNext:function(){return this._sym._next},insert:function(t){if(this.oNext()===this)return this.insertAfter(t),null;var e=this.compareTo(t),n=this;do{var i=n.oNext();if(i.compareTo(t)!==e||i===this)return n.insertAfter(t),null;n=i}while(n!==this);h.shouldNeverReachHere()},insertAfter:function(t){h.equals(this._orig,t.orig());var e=this.oNext();this._sym.setNext(t),t.sym().setNext(e)},degree:function(){var t=0,e=this;do{t++,e=e.oNext()}while(e!==this);return t},equals:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this._orig.equals2D(t)&&this._sym._orig.equals(e)}},deltaY:function(){return this._sym._orig.y-this._orig.y},sym:function(){return this._sym},prev:function(){return this._sym.next()._sym},compareAngularDirection:function(t){var e=this.deltaX(),n=this.deltaY(),i=t.deltaX(),r=t.deltaY();if(e===i&&n===r)return 0;var s=je.quadrant(e,n),o=je.quadrant(i,r);return s>o?1:s<o?-1:oe.computeOrientation(t._orig,t.dest(),this.dest())},prevNode:function(){for(var t=this;2===t.degree();)if((t=t.prev())===this)return null;return t},compareTo:function(t){var e=t;return this.compareAngularDirection(e)},next:function(){return this._next},setSym:function(t){this._sym=t},orig:function(){return this._orig},toString:function(){return"HE("+this._orig.x+" "+this._orig.y+", "+this._sym._orig.x+" "+this._sym._orig.y+")"},setNext:function(t){this._next=t},init:function(t){this.setSym(t),t.setSym(this),this.setNext(t),t.setNext(this)},deltaX:function(){return this._sym._orig.x-this._orig.x},interfaces_:function(){return[]},getClass:function(){return Li}}),Li.init=function(t,e){
if(null!==t._sym||null!==e._sym||null!==t._next||null!==e._next)throw new IllegalStateException("Edges are already initialized");return t.init(e),t},Li.create=function(t,e){var n=new Li(t),i=new Li(e);return n.init(i),n},ro(wi,Li),io(wi.prototype,{mark:function(){this._isMarked=!0},setMark:function(t){this._isMarked=t},isMarked:function(){return this._isMarked},interfaces_:function(){return[]},getClass:function(){return wi}}),wi.setMarkBoth=function(t,e){t.setMark(e),t.sym().setMark(e)},wi.isMarked=function(t){return t.isMarked()},wi.setMark=function(t,e){t.setMark(e)},wi.markBoth=function(t){t.mark(),t.sym().mark()},wi.mark=function(t){t.mark()},io(Ri.prototype,{insert:function(t,e,n){var i=this.create(t,e);null!==n?n.insert(i):this.vertexMap.put(t,i);var r=this.vertexMap.get(e);return null!==r?r.insert(i.sym()):this.vertexMap.put(e,i.sym()),i},create:function(t,e){var n=this.createEdge(t),i=this.createEdge(e);return Li.init(n,i),n},createEdge:function(t){return new Li(t)},addEdge:function(t,e){if(!Ri.isValidEdge(t,e))return null;var n=this.vertexMap.get(t),i=null;return null!==n&&(i=n.find(e)),null!==i?i:this.insert(t,e,n)},getVertexEdges:function(){return this.vertexMap.values()},findEdge:function(t,e){var n=this.vertexMap.get(t);return null===n?null:n.find(e)},interfaces_:function(){return[]},getClass:function(){return Ri}}),Ri.isValidEdge=function(t,e){return 0!==e.compareTo(t)},ro(Ti,wi),io(Ti.prototype,{setStart:function(){this._isStart=!0},isStart:function(){return this._isStart},interfaces_:function(){return[]},getClass:function(){return Ti}}),ro(Oi,Ri),io(Oi.prototype,{createEdge:function(t){return new Ti(t)},interfaces_:function(){return[]},getClass:function(){return Oi}}),io(Pi.prototype,{addLine:function(t){this.lines.add(this.factory.createLineString(t.toCoordinateArray()))},updateRingStartEdge:function(t){return t.isStart()||(t=t.sym(),t.isStart())?null===this.ringStartEdge?(this.ringStartEdge=t,null):void(t.orig().compareTo(this.ringStartEdge.orig())<0&&(this.ringStartEdge=t)):null},getResult:function(){return null===this.result&&this.computeResult(),this.result},process:function(t){var e=t.prevNode();null===e&&(e=t),this.stackEdges(e),this.buildLines()},buildRing:function(t){var e=new E,n=t;for(e.add(n.orig().copy(),!1);2===n.sym().degree();){var i=n.next();if(i===t)break;e.add(i.orig().copy(),!1),n=i}e.add(n.dest().copy(),!1),this.addLine(e)},buildLine:function(t){var e=new E,n=t;for(this.ringStartEdge=null,wi.markBoth(n),e.add(n.orig().copy(),!1);2===n.sym().degree();){this.updateRingStartEdge(n);var i=n.next();if(i===t)return this.buildRing(this.ringStartEdge),null;e.add(i.orig().copy(),!1),n=i,wi.markBoth(n)}e.add(n.dest().copy(),!1),this.stackEdges(n.sym()),this.addLine(e)},stackEdges:function(t){var e=t;do{wi.isMarked(e)||this.nodeEdgeStack.add(e),e=e.oNext()}while(e!==t)},computeResult:function(){for(var t=this.graph.getVertexEdges(),e=t.iterator();e.hasNext();){var n=e.next();wi.isMarked(n)||this.process(n)}this.result=this.factory.buildGeometry(this.lines)},buildLines:function(){for(;!this.nodeEdgeStack.empty();){var t=this.nodeEdgeStack.pop();wi.isMarked(t)||this.buildLine(t)}},add:function(){if(arguments[0]instanceof F){arguments[0].apply({interfaces_:function(){return[A]},filter:function(t){t instanceof It&&this.add(t)}})}else if(oo(arguments[0],d))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.add(n)}else if(arguments[0]instanceof It){var i=arguments[0];null===this.factory&&(this.factory=i.getFactory());for(var r=i.getCoordinateSequence(),s=!1,e=1;e<r.size();e++){var o=this.graph.addEdge(r.getCoordinate(e-1),r.getCoordinate(e));null!==o&&(s||(o.setStart(),s=!0))}}},interfaces_:function(){return[]},getClass:function(){return Pi}}),Pi.dissolve=function(t){var e=new Pi;return e.add(t),e.getResult()};var No=Object.freeze({LineDissolver:Pi}),Co=Object.freeze({GeometryGraph:Kn});io(bi.prototype,{hasChildren:function(){for(var t=0;t<4;t++)if(null!==this.subnode[t])return!0;return!1},isPrunable:function(){return!(this.hasChildren()||this.hasItems())},addAllItems:function(t){t.addAll(this.items);for(var e=0;e<4;e++)null!==this.subnode[e]&&this.subnode[e].addAllItems(t);return t},getNodeCount:function(){for(var t=0,e=0;e<4;e++)null!==this.subnode[e]&&(t+=this.subnode[e].size());return t+1},size:function(){for(var t=0,e=0;e<4;e++)null!==this.subnode[e]&&(t+=this.subnode[e].size());return t+this.items.size()},addAllItemsFromOverlapping:function(t,e){if(!this.isSearchMatch(t))return null;e.addAll(this.items);for(var n=0;n<4;n++)null!==this.subnode[n]&&this.subnode[n].addAllItemsFromOverlapping(t,e)},visitItems:function(t,e){for(var n=this.items.iterator();n.hasNext();)e.visitItem(n.next())},hasItems:function(){return!this.items.isEmpty()},remove:function(t,e){if(!this.isSearchMatch(t))return!1;for(var n=!1,i=0;i<4;i++)if(null!==this.subnode[i]&&(n=this.subnode[i].remove(t,e))){this.subnode[i].isPrunable()&&(this.subnode[i]=null);break}return n||(n=this.items.remove(e))},visit:function(t,e){if(!this.isSearchMatch(t))return null;this.visitItems(t,e);for(var n=0;n<4;n++)null!==this.subnode[n]&&this.subnode[n].visit(t,e)},getItems:function(){return this.items},depth:function(){for(var t=0,e=0;e<4;e++)if(null!==this.subnode[e]){var n=this.subnode[e].depth();n>t&&(t=n)}return t+1},isEmpty:function(){var t=!0;this.items.isEmpty()||(t=!1);for(var e=0;e<4;e++)null!==this.subnode[e]&&(this.subnode[e].isEmpty()||(t=!1));return t},add:function(t){this.items.add(t)},interfaces_:function(){return[a]},getClass:function(){return bi}}),bi.getSubnodeIndex=function(t,e,n){var i=-1;return t.getMinX()>=e&&(t.getMinY()>=n&&(i=3),t.getMaxY()<=n&&(i=1)),t.getMaxX()<=e&&(t.getMinY()>=n&&(i=2),t.getMaxY()<=n&&(i=0)),i},io(_i.prototype,{getLevel:function(){return this.level},computeKey:function(){if(1===arguments.length){var t=arguments[0];for(this.level=_i.computeQuadLevel(t),this.env=new I,this.computeKey(this.level,t);!this.env.contains(t);)this.level+=1,this.computeKey(this.level,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=li.powerOf2(e);this.pt.x=Math.floor(n.getMinX()/i)*i,this.pt.y=Math.floor(n.getMinY()/i)*i,this.env.init(this.pt.x,this.pt.x+i,this.pt.y,this.pt.y+i)}},getEnvelope:function(){return this.env},getCentre:function(){return new c((this.env.getMinX()+this.env.getMaxX())/2,(this.env.getMinY()+this.env.getMaxY())/2)},getPoint:function(){return this.pt},interfaces_:function(){return[]},getClass:function(){return _i}}),_i.computeQuadLevel=function(t){var e=t.getWidth(),n=t.getHeight(),i=e>n?e:n;return li.exponent(i)+1},ro(Mi,bi),io(Mi.prototype,{find:function(t){var e=bi.getSubnodeIndex(t,this.centrex,this.centrey);if(-1===e)return this;if(null!==this.subnode[e]){return this.subnode[e].find(t)}return this},isSearchMatch:function(t){return this.env.intersects(t)},getSubnode:function(t){return null===this.subnode[t]&&(this.subnode[t]=this.createSubnode(t)),this.subnode[t]},getEnvelope:function(){return this.env},getNode:function(t){var e=bi.getSubnodeIndex(t,this.centrex,this.centrey);if(-1!==e){return this.getSubnode(e).getNode(t)}return this},createSubnode:function(t){var e=0,n=0,i=0,r=0;switch(t){case 0:e=this.env.getMinX(),n=this.centrex,i=this.env.getMinY(),r=this.centrey;break;case 1:e=this.centrex,n=this.env.getMaxX(),i=this.env.getMinY(),r=this.centrey;break;case 2:e=this.env.getMinX(),n=this.centrex,i=this.centrey,r=this.env.getMaxY();break;case 3:e=this.centrex,n=this.env.getMaxX(),i=this.centrey,r=this.env.getMaxY()}return new Mi(new I(e,n,i,r),this.level-1)},insertNode:function(t){h.isTrue(null===this.env||this.env.contains(t.env));var e=bi.getSubnodeIndex(t.env,this.centrex,this.centrey);if(t.level===this.level-1)this.subnode[e]=t;else{var n=this.createSubnode(e);n.insertNode(t),this.subnode[e]=n}},interfaces_:function(){return[]},getClass:function(){return Mi}}),Mi.createNode=function(t){var e=new _i(t);return new Mi(e.getEnvelope(),e.getLevel())},Mi.createExpanded=function(t,e){var n=new I(e);null!==t&&n.expandToInclude(t.env);var i=Mi.createNode(n);return null!==t&&i.insertNode(t),i},ro(Di,bi),io(Di.prototype,{insert:function(t,e){var n=bi.getSubnodeIndex(t,Di.origin.x,Di.origin.y);if(-1===n)return this.add(e),null;var i=this.subnode[n];if(null===i||!i.getEnvelope().contains(t)){var r=Mi.createExpanded(i,t);this.subnode[n]=r}this.insertContained(this.subnode[n],t,e)},isSearchMatch:function(t){return!0},insertContained:function(t,e,n){h.isTrue(t.getEnvelope().contains(e));var i=gi.isZeroWidth(e.getMinX(),e.getMaxX()),r=gi.isZeroWidth(e.getMinY(),e.getMaxY()),s=null;s=i||r?t.find(e):t.getNode(e),s.add(n)},interfaces_:function(){return[]},getClass:function(){return Di}}),Di.origin=new c(0,0),io(Ai.prototype,{size:function(){return null!==this.root?this.root.size():0},insert:function(t,e){this.collectStats(t);var n=Ai.ensureExtent(t,this.minExtent);this.root.insert(n,e)},query:function(){if(1===arguments.length){var t=arguments[0],e=new Bn;return this.query(t,e),e.getItems()}if(2===arguments.length){var n=arguments[0],i=arguments[1];this.root.visit(n,i)}},queryAll:function(){var t=new x;return this.root.addAllItems(t),t},remove:function(t,e){var n=Ai.ensureExtent(t,this.minExtent);return this.root.remove(n,e)},collectStats:function(t){var e=t.getWidth();e<this.minExtent&&e>0&&(this.minExtent=e);var n=t.getHeight();n<this.minExtent&&n>0&&(this.minExtent=n)},depth:function(){return null!==this.root?this.root.depth():0},isEmpty:function(){return null===this.root},interfaces_:function(){return[_e,a]},getClass:function(){return Ai}}),Ai.ensureExtent=function(t,e){var n=t.getMinX(),i=t.getMaxX(),r=t.getMinY(),s=t.getMaxY();return n!==i&&r!==s?t:(n===i&&(n-=e/2,i=n+e/2),r===s&&(r-=e/2,s=r+e/2),new I(n,i,r,s))},Ai.serialVersionUID=-0x678b60c967a25400;var So=Object.freeze({Quadtree:Ai}),Lo=Object.freeze({STRtree:qe}),wo=Object.freeze({quadtree:So,strtree:Lo}),Ro=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];io(Fi.prototype,{read:function(t){var e=void 0;e="string"==typeof t?JSON.parse(t):t;var n=e.type;if(!To[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Ro.indexOf(n)?To[n].apply(this,[e.coordinates]):"GeometryCollection"===n?To[n].apply(this,[e.geometries]):To[n].apply(this,[e])},write:function(t){var e=t.getGeometryType();if(!Oo[e])throw new Error("Geometry is not supported");return Oo[e].apply(this,[t])}});var To={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var i=t.geometry.type;if(!To[i])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=To.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 i=t[n];e.push(new c(i[0],i[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new c(t[0],t[1]),new c(t[2],t[1]),new c(t[2],t[3]),new c(t[0],t[3]),new c(t[0],t[1])])},Point:function(t){var e=new c(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(To.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=To.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(To.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=To.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),i=[],r=1;r<t.length;++r){var s=t[r],o=To.coordinates.apply(this,[s]),a=this.geometryFactory.createLinearRing(o);i.push(a)}return this.geometryFactory.createPolygon(n,i)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(To.Polygon.apply(this,[i]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(this.read(i))}return this.geometryFactory.createGeometryCollection(e)}},Oo={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:Oo.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t.geometries.length;++n){var i=t.geometries[n],r=Oo.Point.apply(this,[i]);e.push(r.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),i=0;i<n.length;++i){var r=n[i];e.push(Oo.coordinate.apply(this,[r]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t.geometries.length;++n){var i=t.geometries[n],r=Oo.LineString.apply(this,[i]);e.push(r.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=Oo.LineString.apply(this,[t.shell]);e.push(n.coordinates);for(var i=0;i<t.holes.length;++i){var r=t.holes[i],s=Oo.LineString.apply(this,[r]);e.push(s.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t.geometries.length;++n){var i=t.geometries[n],r=Oo.Polygon.apply(this,[i]);e.push(r.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t.geometries.length;++n){var i=t.geometries[n],r=i.getGeometryType();e.push(Oo[r].apply(this,[i]))}return{type:"GeometryCollection",geometries:e}}};io(Gi.prototype,{read:function(t){var e=this.parser.read(t);return this.precisionModel.getType()===Qt.FIXED&&this.reducePrecision(e),e},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])}}),io(qi.prototype,{write:function(t){return this.parser.write(t)}}),io(Bi.prototype,{read:function(t){var e=this.parser.read(t);return this.precisionModel.getType()===Qt.FIXED&&this.reducePrecision(e),e},reducePrecision:function(t){if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(var e=0,n=t.points.coordinates.length;e<n;e++)this.precisionModel.makePrecise(t.points.coordinates[e]);else if(t.geometries)for(var i=0,r=t.geometries.length;i<r;i++)this.reducePrecision(t.geometries[i])}}),io(zi.prototype,{read:function(t){var e=this.ol;return t instanceof e.geom.Point?this.convertFromPoint(t):t instanceof e.geom.LineString?this.convertFromLineString(t):t instanceof e.geom.LinearRing?this.convertFromLinearRing(t):t instanceof e.geom.Polygon?this.convertFromPolygon(t):t instanceof e.geom.MultiPoint?this.convertFromMultiPoint(t):t instanceof e.geom.MultiLineString?this.convertFromMultiLineString(t):t instanceof e.geom.MultiPolygon?this.convertFromMultiPolygon(t):t instanceof e.geom.GeometryCollection?this.convertFromCollection(t):void 0},convertFromPoint:function(t){var e=t.getCoordinates();return this.geometryFactory.createPoint(new c(e[0],e[1]))},convertFromLineString:function(t){return this.geometryFactory.createLineString(t.getCoordinates().map(function(t){return new c(t[0],t[1])}))},convertFromLinearRing:function(t){return this.geometryFactory.createLinearRing(t.getCoordinates().map(function(t){return new c(t[0],t[1])}))},convertFromPolygon:function(t){for(var e=t.getLinearRings(),n=null,i=[],r=0;r<e.length;r++){var s=this.convertFromLinearRing(e[r]);0===r?n=s:i.push(s)}return this.geometryFactory.createPolygon(n,i)},convertFromMultiPoint:function(t){var e=t.getPoints().map(function(t){return this.convertFromPoint(t)},this);return this.geometryFactory.createMultiPoint(e)},convertFromMultiLineString:function(t){var e=t.getLineStrings().map(function(t){return this.convertFromLineString(t)},this);return this.geometryFactory.createMultiLineString(e)},convertFromMultiPolygon:function(t){var e=t.getPolygons().map(function(t){return this.convertFromPolygon(t)},this);return this.geometryFactory.createMultiPolygon(e)},convertFromCollection:function(t){var e=t.getGeometries().map(function(t){return this.read(t)},this);return this.geometryFactory.createGeometryCollection(e)},write:function(t){return"Point"===t.getGeometryType()?this.convertToPoint(t.getCoordinate()):"LineString"===t.getGeometryType()?this.convertToLineString(t):"LinearRing"===t.getGeometryType()?this.convertToLinearRing(t):"Polygon"===t.getGeometryType()?this.convertToPolygon(t):"MultiPoint"===t.getGeometryType()?this.convertToMultiPoint(t):"MultiLineString"===t.getGeometryType()?this.convertToMultiLineString(t):"MultiPolygon"===t.getGeometryType()?this.convertToMultiPolygon(t):"GeometryCollection"===t.getGeometryType()?this.convertToCollection(t):void 0},convertToPoint:function(t){return new this.ol.geom.Point([t.x,t.y])},convertToLineString:function(t){var e=t.points.coordinates.map(Vi);return new this.ol.geom.LineString(e)},convertToLinearRing:function(t){var e=t.points.coordinates.map(Vi);return new this.ol.geom.LinearRing(e)},convertToPolygon:function(t){for(var e=[t.shell.points.coordinates.map(Vi)],n=0;n<t.holes.length;n++)e.push(t.holes[n].points.coordinates.map(Vi));return new this.ol.geom.Polygon(e)},convertToMultiPoint:function(t){return new this.ol.geom.MultiPoint(t.getCoordinates().map(Vi))},convertToMultiLineString:function(t){for(var e=[],n=0;n<t.geometries.length;n++)e.push(this.convertToLineString(t.geometries[n]).getCoordinates());return new this.ol.geom.MultiLineString(e)},convertToMultiPolygon:function(t){for(var e=[],n=0;n<t.geometries.length;n++)e.push(this.convertToPolygon(t.geometries[n]).getCoordinates());return new this.ol.geom.MultiPolygon(e)},convertToCollection:function(t){for(var e=[],n=0;n<t.geometries.length;n++){var i=t.geometries[n];e.push(this.write(i))}return new this.ol.geom.GeometryCollection(e)}});var Po=Object.freeze({GeoJSONReader:Gi,GeoJSONWriter:qi,OL3Parser:zi,WKTReader:Bi,WKTWriter:ee});io(ki.prototype,{rescale:function(){if(oo(arguments[0],d))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){var i=arguments[0];2===i.length&&(new c(i[0]),new c(i[1]));for(var e=0;e<i.length;e++)i[e].x=i[e].x/this.scaleFactor+this.offsetX,i[e].y=i[e].y/this.scaleFactor+this.offsetY;2===i.length&&i[0].equals2D(i[1])&&_.out.println(i)}},scale:function(){if(oo(arguments[0],d)){for(var t=arguments[0],e=new x,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Xe(this.scale(i.getCoordinates()),i.getData()))}return e}if(arguments[0]instanceof Array){for(var r=arguments[0],s=new Array(r.length).fill(null),n=0;n<r.length;n++)s[n]=new c(Math.round((r[n].x-this.offsetX)*this.scaleFactor),Math.round((r[n].y-this.offsetY)*this.scaleFactor),r[n].z);return Y.removeRepeatedPoints(s)}},isIntegerPrecision:function(){return 1===this.scaleFactor},getNodedSubstrings:function(){var t=this.noder.getNodedSubstrings();return this.isScaled&&this.rescale(t),t},computeNodes:function(t){var e=t;this.isScaled&&(e=this.scale(t)),this.noder.computeNodes(e)},interfaces_:function(){return[Ze]},getClass:function(){return ki}});var bo=Object.freeze({MCIndexNoder:Je,ScaledNoder:ki,SegmentString:we});io(Yi.prototype,{isSimpleMultiPoint:function(t){if(t.isEmpty())return!0;for(var e=new rt,n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n),r=i.getCoordinate();if(e.contains(r))return this.nonSimpleLocation=r,!1;e.add(r)}return!0},isSimplePolygonal:function(t){for(var e=qn.getLines(t),n=e.iterator();n.hasNext();){var i=n.next();if(!this.isSimpleLinearGeometry(i))return!1}return!0},hasClosedEndpointIntersection:function(t){for(var e=new et,n=t.getEdgeIterator();n.hasNext();){var i=n.next(),r=(i.getMaximumSegmentIndex(),i.isClosed()),s=i.getCoordinate(0);this.addEndpoint(e,s,r);var o=i.getCoordinate(i.getNumPoints()-1);this.addEndpoint(e,o,r)}for(var n=e.values().iterator();n.hasNext();){var a=n.next();if(a.isClosed&&2!==a.degree)return this.nonSimpleLocation=a.getCoordinate(),!0}return!1},getNonSimpleLocation:function(){return this.nonSimpleLocation},isSimpleLinearGeometry:function(t){if(t.isEmpty())return!0;var e=new Kn(0,t),n=new ie,i=e.computeSelfNodes(n,!0);return!i.hasIntersection()||(i.hasProperIntersection()?(this.nonSimpleLocation=i.getProperIntersectionPoint(),!1):!this.hasNonEndpointIntersection(e)&&(!this.isClosedEndpointsInInterior||!this.hasClosedEndpointIntersection(e)))},hasNonEndpointIntersection:function(t){for(var e=t.getEdgeIterator();e.hasNext();)for(var n=e.next(),i=n.getMaximumSegmentIndex(),r=n.getEdgeIntersectionList().iterator();r.hasNext();){var s=r.next();if(!s.isEndPoint(i))return this.nonSimpleLocation=s.getCoordinate(),!0}return!1},addEndpoint:function(t,e,n){var i=t.get(e);null===i&&(i=new Ui(e),t.put(e,i)),i.addEndpoint(n)},computeSimple:function(t){return this.nonSimpleLocation=null,!!t.isEmpty()||(t instanceof It?this.isSimpleLinearGeometry(t):t instanceof ht?this.isSimpleLinearGeometry(t):t instanceof wt?this.isSimpleMultiPoint(t):oo(t,St)?this.isSimplePolygonal(t):!(t instanceof lt)||this.isSimpleGeometryCollection(t))},isSimple:function(){return this.nonSimpleLocation=null,this.computeSimple(this.inputGeom)},isSimpleGeometryCollection:function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);if(!this.computeSimple(n))return!1}return!0},interfaces_:function(){return[]},getClass:function(){return Yi}}),io(Ui.prototype,{addEndpoint:function(t){this.degree++,this.isClosed|=t},getCoordinate:function(){return this.pt},interfaces_:function(){return[]},getClass:function(){return Ui}}),Yi.EndpointInfo=Ui,io(Xi.prototype,{getEndCapStyle:function(){return this.endCapStyle},isSingleSided:function(){return this._isSingleSided},setQuadrantSegments:function(t){this.quadrantSegments=t,0===this.quadrantSegments&&(this.joinStyle=Xi.JOIN_BEVEL),this.quadrantSegments<0&&(this.joinStyle=Xi.JOIN_MITRE,this.mitreLimit=Math.abs(this.quadrantSegments)),t<=0&&(this.quadrantSegments=1),this.joinStyle!==Xi.JOIN_ROUND&&(this.quadrantSegments=Xi.DEFAULT_QUADRANT_SEGMENTS)},getJoinStyle:function(){return this.joinStyle},setJoinStyle:function(t){this.joinStyle=t},setSimplifyFactor:function(t){this.simplifyFactor=t<0?0:t},getSimplifyFactor:function(){return this.simplifyFactor},getQuadrantSegments:function(){return this.quadrantSegments},setEndCapStyle:function(t){this.endCapStyle=t},getMitreLimit:function(){return this.mitreLimit},setMitreLimit:function(t){this.mitreLimit=t},setSingleSided:function(t){this._isSingleSided=t},interfaces_:function(){return[]},getClass:function(){return Xi}}),Xi.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},Xi.CAP_ROUND=1,Xi.CAP_FLAT=2,Xi.CAP_SQUARE=3,Xi.JOIN_ROUND=1,Xi.JOIN_MITRE=2,Xi.JOIN_BEVEL=3,Xi.DEFAULT_QUADRANT_SEGMENTS=8,Xi.DEFAULT_MITRE_LIMIT=5,Xi.DEFAULT_SIMPLIFY_FACTOR=.01,io(Hi.prototype,{getCoordinate:function(){return this.minCoord},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},findRightmostEdgeAtVertex:function(){var t=this.minDe.getEdge().getCoordinates();h.isTrue(this.minIndex>0&&this.minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this.minIndex-1],n=t[this.minIndex+1],i=oe.computeOrientation(this.minCoord,n,e),r=!1;e.y<this.minCoord.y&&n.y<this.minCoord.y&&i===oe.COUNTERCLOCKWISE?r=!0:e.y>this.minCoord.y&&n.y>this.minCoord.y&&i===oe.CLOCKWISE&&(r=!0),r&&(this.minIndex=this.minIndex-1)},getRightmostSideOfSegment:function(t,e){var n=t.getEdge(),i=n.getCoordinates();if(e<0||e+1>=i.length)return-1;if(i[e].y===i[e+1].y)return-1;var r=an.LEFT;return i[e].y<i[e+1].y&&(r=an.RIGHT),r},getEdge:function(){return this.orientedDe},checkForRightmostCoordinate:function(t){for(var e=t.getEdge().getCoordinates(),n=0;n<e.length-1;n++)(null===this.minCoord||e[n].x>this.minCoord.x)&&(this.minDe=t,this.minIndex=n,this.minCoord=e[n])},findRightmostEdgeAtNode:function(){var t=this.minDe.getNode(),e=t.getEdges();this.minDe=e.getRightmostEdge(),this.minDe.isForward()||(this.minDe=this.minDe.getSym(),this.minIndex=this.minDe.getEdge().getCoordinates().length-1)},findEdge:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}h.isTrue(0!==this.minIndex||this.minCoord.equals(this.minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this.minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this.orientedDe=this.minDe,this.getRightmostSide(this.minDe,this.minIndex)===an.LEFT&&(this.orientedDe=this.minDe.getSym())},interfaces_:function(){return[]},getClass:function(){return Hi}}),Wi.prototype.addLast=function(t){this.array_.push(t)},Wi.prototype.removeFirst=function(){return this.array_.shift()},Wi.prototype.isEmpty=function(){return 0===this.array_.length},io(ji.prototype,{clearVisitedEdges:function(){for(var t=this.dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},getRightmostCoordinate:function(){return this.rightMostCoord},computeNodeDepth:function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var i=n.next();if(i.isVisited()||i.getSym().isVisited()){e=i;break}}if(null===e)throw new tn("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var n=t.getEdges().iterator();n.hasNext();){var i=n.next();i.setVisited(!0),this.copySymDepths(i)}},computeDepth:function(t){this.clearVisitedEdges();var e=this.finder.getEdge();e.getNode(),e.getLabel();e.setEdgeDepths(an.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},create:function(t){this.addReachable(t),this.finder.findEdge(this.dirEdgeList),this.rightMostCoord=this.finder.getCoordinate()},findResultEdges:function(){for(var t=this.dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(an.RIGHT)>=1&&e.getDepth(an.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},computeDepths:function(t){var e=new K,n=new Wi,i=t.getNode();for(n.addLast(i),e.add(i),t.setVisited(!0);!n.isEmpty();){var r=n.removeFirst();e.add(r),this.computeNodeDepth(r);for(var s=r.getEdges().iterator();s.hasNext();){var o=s.next(),a=o.getSym();if(!a.isVisited()){var u=a.getNode();e.contains(u)||(n.addLast(u),e.add(u))}}}},compareTo:function(t){var e=t;return this.rightMostCoord.x<e.rightMostCoord.x?-1:this.rightMostCoord.x>e.rightMostCoord.x?1:0},getEnvelope:function(){if(null===this.env){for(var t=new I,e=this.dirEdgeList.iterator();e.hasNext();)for(var n=e.next(),i=n.getEdge().getCoordinates(),r=0;r<i.length-1;r++)t.expandToInclude(i[r]);this.env=t}return this.env},addReachable:function(t){var e=new ce;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},copySymDepths:function(t){var e=t.getSym();e.setDepth(an.LEFT,t.getDepth(an.RIGHT)),e.setDepth(an.RIGHT,t.getDepth(an.LEFT))},add:function(t,e){t.setVisited(!0),this.nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var i=n.next();this.dirEdgeList.add(i);var r=i.getSym(),s=r.getNode();s.isVisited()||e.push(s)}},getNodes:function(){return this.nodes},getDirectedEdges:function(){return this.dirEdgeList},interfaces_:function(){return[r]},getClass:function(){return ji}}),io(Ki.prototype,{isDeletable:function(t,e,n,i){var r=this.inputLine[t],s=this.inputLine[e],o=this.inputLine[n];return!!this.isConcave(r,s,o)&&(!!this.isShallow(r,s,o,i)&&this.isShallowSampled(r,s,t,n,i))},deleteShallowConcavities:function(){for(var t=1,e=(this.inputLine.length,this.findNextNonDeletedIndex(t)),n=this.findNextNonDeletedIndex(e),i=!1;n<this.inputLine.length;){var r=!1;this.isDeletable(t,e,n,this.distanceTol)&&(this.isDeleted[e]=Ki.DELETE,r=!0,i=!0),t=r?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return i},isShallowConcavity:function(t,e,n,i){return oe.computeOrientation(t,e,n)===this.angleOrientation&&oe.distancePointLine(e,t,n)<i},isShallowSampled:function(t,e,n,i,r){var s=Math.trunc((i-n)/Ki.NUM_PTS_TO_CHECK);s<=0&&(s=1);for(var o=n;o<i;o+=s)if(!this.isShallow(t,e,this.inputLine[o],r))return!1;return!0},isConcave:function(t,e,n){return oe.computeOrientation(t,e,n)===this.angleOrientation},simplify:function(t){this.distanceTol=Math.abs(t),t<0&&(this.angleOrientation=oe.CLOCKWISE),this.isDeleted=new Array(this.inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},findNextNonDeletedIndex:function(t){for(var e=t+1;e<this.inputLine.length&&this.isDeleted[e]===Ki.DELETE;)e++;return e},isShallow:function(t,e,n,i){return oe.distancePointLine(e,t,n)<i},collapseLine:function(){for(var t=new E,e=0;e<this.inputLine.length;e++)this.isDeleted[e]!==Ki.DELETE&&t.add(this.inputLine[e]);return t.toCoordinateArray()},interfaces_:function(){return[]},getClass:function(){return Ki}}),Ki.simplify=function(t,e){return new Ki(t).simplify(e)},Ki.INIT=0,Ki.DELETE=1,Ki.KEEP=1,Ki.NUM_PTS_TO_CHECK=10,io(Zi.prototype,{getCoordinates:function(){return this.ptList.toArray(Zi.COORDINATE_ARRAY_TYPE)},setPrecisionModel:function(t){this.precisionModel=t},addPt:function(t){var e=new c(t);if(this.precisionModel.makePrecise(e),this.isRedundant(e))return null;this.ptList.add(e)},reverse:function(){},addPts:function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var n=t.length-1;n>=0;n--)this.addPt(t[n])},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},toString:function(){return(new $t).createLineString(this.getCoordinates()).toString()},closeRing:function(){if(this.ptList.size()<1)return null;var t=new c(this.ptList.get(0)),e=this.ptList.get(this.ptList.size()-1);if(this.ptList.size()>=2&&this.ptList.get(this.ptList.size()-2),t.equals(e))return null;this.ptList.add(t)},setMinimumVertexDistance:function(t){this.minimimVertexDistance=t},interfaces_:function(){return[]},getClass:function(){return Zi}}),Zi.COORDINATE_ARRAY_TYPE=new Array(0).fill(null),io(Qi.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=oe.computeOrientation(this.s0,this.s1,this.s2),i=n===oe.CLOCKWISE&&this.side===an.LEFT||n===oe.COUNTERCLOCKWISE&&this.side===an.RIGHT;0===n?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},addLineEndCap:function(t,e){var n=new ae(t,e),i=new ae;this.computeOffsetSegment(n,an.LEFT,this.distance,i);var r=new ae;this.computeOffsetSegment(n,an.RIGHT,this.distance,r);var s=e.x-t.x,o=e.y-t.y,a=Math.atan2(o,s);switch(this.bufParams.getEndCapStyle()){case Xi.CAP_ROUND:this.segList.addPt(i.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,oe.CLOCKWISE,this.distance),this.segList.addPt(r.p1);break;case Xi.CAP_FLAT:this.segList.addPt(i.p1),this.segList.addPt(r.p1);break;case Xi.CAP_SQUARE:var u=new c;u.x=Math.abs(this.distance)*Math.cos(a),u.y=Math.abs(this.distance)*Math.sin(a);var l=new c(i.p1.x+u.x,i.p1.y+u.y),h=new c(r.p1.x+u.x,r.p1.y+u.y);this.segList.addPt(l),this.segList.addPt(h)}},getCoordinates:function(){return this.segList.getCoordinates()},addMitreJoin:function(t,e,n,i){var r=!0,s=null;try{s=M.intersection(e.p0,e.p1,n.p0,n.p1);(i<=0?1:s.distance(t)/Math.abs(i))>this.bufParams.getMitreLimit()&&(r=!1)}catch(t){if(!(t instanceof C))throw t;s=new c(0,0),r=!1}r?this.segList.addPt(s):this.addLimitedMitreJoin(e,n,i,this.bufParams.getMitreLimit())},addFilletCorner:function(t,e,n,i,r){var s=e.x-t.x,o=e.y-t.y,a=Math.atan2(o,s),u=n.x-t.x,l=n.y-t.y,h=Math.atan2(l,u);i===oe.CLOCKWISE?a<=h&&(a+=2*Math.PI):a>=h&&(a-=2*Math.PI),this.segList.addPt(e),this.addFilletArc(t,a,h,i,r),this.segList.addPt(n)},
addOutsideTurn:function(t,e){if(this.offset0.p1.distance(this.offset1.p0)<this.distance*Qi.OFFSET_SEGMENT_SEPARATION_FACTOR)return this.segList.addPt(this.offset0.p1),null;this.bufParams.getJoinStyle()===Xi.JOIN_MITRE?this.addMitreJoin(this.s1,this.offset0,this.offset1,this.distance):this.bufParams.getJoinStyle()===Xi.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))},createSquare:function(t){this.segList.addPt(new c(t.x+this.distance,t.y+this.distance)),this.segList.addPt(new c(t.x+this.distance,t.y-this.distance)),this.segList.addPt(new c(t.x-this.distance,t.y-this.distance)),this.segList.addPt(new c(t.x-this.distance,t.y+this.distance)),this.segList.closeRing()},addSegments:function(t,e){this.segList.addPts(t,e)},addFirstSegment:function(){this.segList.addPt(this.offset1.p0)},addLastSegment:function(){this.segList.addPt(this.offset1.p1)},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)},addLimitedMitreJoin:function(t,e,n,i){var r=this.seg0.p1,s=xi.angle(r,this.seg0.p0),o=(xi.angle(r,this.seg1.p1),xi.angleBetweenOriented(this.seg0.p0,r,this.seg1.p1)),a=o/2,u=xi.normalize(s+a),l=xi.normalize(u+Math.PI),h=i*n,f=h*Math.abs(Math.sin(a)),g=n-f,d=r.x+h*Math.cos(l),p=r.y+h*Math.sin(l),m=new c(d,p),v=new ae(r,m),y=v.pointAlongOffset(1,g),x=v.pointAlongOffset(1,-g);this.side===an.LEFT?(this.segList.addPt(y),this.segList.addPt(x)):(this.segList.addPt(x),this.segList.addPt(y))},computeOffsetSegment:function(t,e,n,i){var r=e===an.LEFT?1:-1,s=t.p1.x-t.p0.x,o=t.p1.y-t.p0.y,a=Math.sqrt(s*s+o*o),u=r*n*s/a,l=r*n*o/a;i.p0.x=t.p0.x-l,i.p0.y=t.p0.y+u,i.p1.x=t.p1.x-l,i.p1.y=t.p1.y+u},addFilletArc:function(t,e,n,i,r){var s=i===oe.CLOCKWISE?-1:1,o=Math.abs(e-n),a=Math.trunc(o/this.filletAngleQuantum+.5);if(a<1)return null;var u=null,l=null;u=0,l=o/a;for(var h=u,f=new c;h<o;){var g=e+s*h;f.x=t.x+r*Math.cos(g),f.y=t.y+r*Math.sin(g),this.segList.addPt(f),h+=l}},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*Qi.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 c((this.closingSegLengthFactor*this.offset0.p1.x+this.s1.x)/(this.closingSegLengthFactor+1),(this.closingSegLengthFactor*this.offset0.p1.y+this.s1.y)/(this.closingSegLengthFactor+1));this.segList.addPt(n);var i=new c((this.closingSegLengthFactor*this.offset1.p0.x+this.s1.x)/(this.closingSegLengthFactor+1),(this.closingSegLengthFactor*this.offset1.p0.y+this.s1.y)/(this.closingSegLengthFactor+1));this.segList.addPt(i)}else this.segList.addPt(this.s1);this.segList.addPt(this.offset1.p0)}},createCircle:function(t){var e=new c(t.x+this.distance,t.y);this.segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this.distance),this.segList.closeRing()},addBevelJoin:function(t,e){this.segList.addPt(t.p1),this.segList.addPt(e.p0)},init:function(t){this.distance=t,this.maxCurveSegmentError=t*(1-Math.cos(this.filletAngleQuantum/2)),this.segList=new Zi,this.segList.setPrecisionModel(this.precisionModel),this.segList.setMinimumVertexDistance(t*Qi.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},addCollinear:function(t){this.li.computeIntersection(this.s0,this.s1,this.s1,this.s2),this.li.getIntersectionNum()>=2&&(this.bufParams.getJoinStyle()===Xi.JOIN_BEVEL||this.bufParams.getJoinStyle()===Xi.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,oe.CLOCKWISE,this.distance))},closeRing:function(){this.segList.closeRing()},hasNarrowConcaveAngle:function(){return this._hasNarrowConcaveAngle},interfaces_:function(){return[]},getClass:function(){return Qi}}),Qi.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Qi.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Qi.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Qi.MAX_CLOSING_SEG_LEN_FACTOR=80,io(Ji.prototype,{getOffsetCurve:function(t,e){if(this.distance=e,0===e)return null;var n=e<0,i=Math.abs(e),r=this.getSegGen(i);t.length<=1?this.computePointCurve(t[0],r):this.computeOffsetCurve(t,n,r);var s=r.getCoordinates();return n&&Y.reverse(s),s},computeSingleSidedBufferCurve:function(t,e,n){var i=this.simplifyTolerance(this.distance);if(e){n.addSegments(t,!0);var r=Ki.simplify(t,-i),s=r.length-1;n.initSideSegments(r[s],r[s-1],an.LEFT),n.addFirstSegment();for(var o=s-2;o>=0;o--)n.addNextSegment(r[o],!0)}else{n.addSegments(t,!1);var a=Ki.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],an.LEFT),n.addFirstSegment();for(var o=2;o<=u;o++)n.addNextSegment(a[o],!0)}n.addLastSegment(),n.closeRing()},computeRingBufferCurve:function(t,e,n){var i=this.simplifyTolerance(this.distance);e===an.RIGHT&&(i=-i);var r=Ki.simplify(t,i),s=r.length-1;n.initSideSegments(r[s-1],r[0],e);for(var o=1;o<=s;o++){var a=1!==o;n.addNextSegment(r[o],a)}n.closeRing()},computeLineBufferCurve:function(t,e){var n=this.simplifyTolerance(this.distance),i=Ki.simplify(t,n),r=i.length-1;e.initSideSegments(i[0],i[1],an.LEFT);for(var s=2;s<=r;s++)e.addNextSegment(i[s],!0);e.addLastSegment(),e.addLineEndCap(i[r-1],i[r]);var o=Ki.simplify(t,-n),a=o.length-1;e.initSideSegments(o[a],o[a-1],an.LEFT);for(var s=a-2;s>=0;s--)e.addNextSegment(o[s],!0);e.addLastSegment(),e.addLineEndCap(o[1],o[0]),e.closeRing()},computePointCurve:function(t,e){switch(this.bufParams.getEndCapStyle()){case Xi.CAP_ROUND:e.createCircle(t);break;case Xi.CAP_SQUARE:e.createSquare(t)}},getLineCurve:function(t,e){if(this.distance=e,e<0&&!this.bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),i=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],i);else if(this.bufParams.isSingleSided()){var r=e<0;this.computeSingleSidedBufferCurve(t,r,i)}else this.computeLineBufferCurve(t,i);return i.getCoordinates()},getBufferParameters:function(){return this.bufParams},simplifyTolerance:function(t){return t*this.bufParams.getSimplifyFactor()},getRingCurve:function(t,e,n){if(this.distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return Ji.copyCoordinates(t);var i=this.getSegGen(n);return this.computeRingBufferCurve(t,e,i),i.getCoordinates()},computeOffsetCurve:function(t,e,n){var i=this.simplifyTolerance(this.distance);if(e){var r=Ki.simplify(t,-i),s=r.length-1;n.initSideSegments(r[s],r[s-1],an.LEFT),n.addFirstSegment();for(var o=s-2;o>=0;o--)n.addNextSegment(r[o],!0)}else{var a=Ki.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],an.LEFT),n.addFirstSegment();for(var o=2;o<=u;o++)n.addNextSegment(a[o],!0)}n.addLastSegment()},getSegGen:function(t){return new Qi(this.precisionModel,this.bufParams,t)},interfaces_:function(){return[]},getClass:function(){return Ji}}),Ji.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new c(t[n]);return e},io($i.prototype,{findStabbedSegments:function(){if(1===arguments.length){for(var t=arguments[0],e=new x,n=this.subgraphs.iterator();n.hasNext();){var i=n.next(),r=i.getEnvelope();t.y<r.getMinY()||t.y>r.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3===arguments.length)if(oo(arguments[2],m)&&arguments[0]instanceof c&&arguments[1]instanceof vn)for(var s=arguments[0],o=arguments[1],a=arguments[2],u=o.getEdge().getCoordinates(),n=0;n<u.length-1;n++){this.seg.p0=u[n],this.seg.p1=u[n+1],this.seg.p0.y>this.seg.p1.y&&this.seg.reverse();var l=Math.max(this.seg.p0.x,this.seg.p1.x);if(!(l<s.x)&&!(this.seg.isHorizontal()||s.y<this.seg.p0.y||s.y>this.seg.p1.y||oe.computeOrientation(this.seg.p0,this.seg.p1,s)===oe.RIGHT)){var h=o.getDepth(an.LEFT);this.seg.p0.equals(u[n])||(h=o.getDepth(an.RIGHT));var f=new tr(this.seg,h);a.add(f)}}else if(oo(arguments[2],m)&&arguments[0]instanceof c&&oo(arguments[1],m))for(var g=arguments[0],d=arguments[1],p=arguments[2],n=d.iterator();n.hasNext();){var v=n.next();v.isForward()&&this.findStabbedSegments(g,v,p)}},getDepth:function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:xo.min(e).leftDepth},interfaces_:function(){return[]},getClass:function(){return $i}}),io(tr.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 0!==n?n:(n=-1*e.upwardSeg.orientationIndex(this.upwardSeg),0!==n?n:this.upwardSeg.compareTo(e.upwardSeg))},compareX:function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},toString:function(){return this.upwardSeg.toString()},interfaces_:function(){return[r]},getClass:function(){return tr}}),$i.DepthSegment=tr,io(er.prototype,{addPoint:function(t){if(this.distance<=0)return null;var e=t.getCoordinates(),n=this.curveBuilder.getLineCurve(e,this.distance);this.addCurve(n,S.EXTERIOR,S.INTERIOR)},addPolygon:function(t){var e=this.distance,n=an.LEFT;this.distance<0&&(e=-this.distance,n=an.RIGHT);var i=t.getExteriorRing(),r=Y.removeRepeatedPoints(i.getCoordinates());if(this.distance<0&&this.isErodedCompletely(i,this.distance))return null;if(this.distance<=0&&r.length<3)return null;this.addPolygonRing(r,e,n,S.EXTERIOR,S.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var o=t.getInteriorRingN(s),a=Y.removeRepeatedPoints(o.getCoordinates());this.distance>0&&this.isErodedCompletely(o,-this.distance)||this.addPolygonRing(a,e,an.opposite(n),S.INTERIOR,S.EXTERIOR)}},isTriangleErodedCompletely:function(t,e){var n=new Ei(t[0],t[1],t[2]),i=n.inCentre();return oe.distancePointLine(i,n.p0,n.p1)<Math.abs(e)},addLineString:function(t){if(this.distance<=0&&!this.curveBuilder.getBufferParameters().isSingleSided())return null;var e=Y.removeRepeatedPoints(t.getCoordinates()),n=this.curveBuilder.getLineCurve(e,this.distance);this.addCurve(n,S.EXTERIOR,S.INTERIOR)},addCurve:function(t,e,n){if(null===t||t.length<2)return null;var i=new Xe(t,new ln(0,S.BOUNDARY,e,n));this.curveList.add(i)},getCurves:function(){return this.add(this.inputGeom),this.curveList},addPolygonRing:function(t,e,n,i,r){if(0===e&&t.length<Rt.MINIMUM_VALID_SIZE)return null;var s=i,o=r;t.length>=Rt.MINIMUM_VALID_SIZE&&oe.isCCW(t)&&(s=r,o=i,n=an.opposite(n));var a=this.curveBuilder.getRingCurve(t,n,e);this.addCurve(a,s,o)},add:function(t){if(t.isEmpty())return null;if(t instanceof Lt)this.addPolygon(t);else if(t instanceof It)this.addLineString(t);else if(t instanceof Ct)this.addPoint(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof ht)this.addCollection(t);else if(t instanceof Tt)this.addCollection(t);else{if(!(t instanceof lt))throw new UnsupportedOperationException(t.getClass().getName());this.addCollection(t)}},isErodedCompletely:function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var i=t.getEnvelopeInternal(),r=Math.min(i.getHeight(),i.getWidth());return e<0&&2*Math.abs(e)>r},addCollection:function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},interfaces_:function(){return[]},getClass:function(){return er}}),io(nr.prototype,{isTrivialIntersection:function(t,e,n,i){if(t===n&&1===this.li.getIntersectionNum()){if(nr.isAdjacentSegments(e,i))return!0;if(t.isClosed()){var r=t.size()-1;if(0===e&&i===r||0===i&&e===r)return!0}}return!1},getProperIntersectionPoint:function(){return this.properIntersectionPoint},hasProperInteriorIntersection:function(){return this.hasProperInterior},getLineIntersector:function(){return this.li},hasProperIntersection:function(){return this.hasProper},processIntersections:function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=n.getCoordinates()[i],a=n.getCoordinates()[i+1];this.li.computeIntersection(r,s,o,a),this.li.hasIntersection()&&(this.numIntersections++,this.li.isInteriorIntersection()&&(this.numInteriorIntersections++,this.hasInterior=!0),this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,t.addIntersections(this.li,e,0),n.addIntersections(this.li,i,1),this.li.isProper()&&(this.numProperIntersections++,this.hasProper=!0,this.hasProperInterior=!0)))},hasIntersection:function(){return this._hasIntersection},isDone:function(){return!1},hasInteriorIntersection:function(){return this.hasInterior},interfaces_:function(){return[en]},getClass:function(){return nr}}),nr.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},io(ir.prototype,{setWorkingPrecisionModel:function(t){this.workingPrecisionModel=t},insertUniqueEdge:function(t){var e=this.edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),i=t.getLabel();e.isPointwiseEqual(t)||(i=new ln(t.getLabel()),i.flip()),n.merge(i);var r=ir.depthDelta(i),s=e.getDepthDelta(),o=s+r;e.setDepthDelta(o)}else this.edgeList.add(t),t.setDepthDelta(ir.depthDelta(t.getLabel()))},buildSubgraphs:function(t,e){for(var n=new x,i=t.iterator();i.hasNext();){var r=i.next(),s=r.getRightmostCoordinate(),o=new $i(n),a=o.getDepth(s);r.computeDepth(a),r.findResultEdges(),n.add(r),e.add(r.getDirectedEdges(),r.getNodes())}},createSubgraphs:function(t){for(var e=new x,n=t.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var r=new ji;r.create(i),e.add(r)}}return xo.sort(e,xo.reverseOrder()),e},createEmptyResultGeometry:function(){return this.geomFact.createPolygon()},getNoder:function(t){if(null!==this.workingNoder)return this.workingNoder;var e=new Je,n=new ie;return n.setPrecisionModel(t),e.setSegmentIntersector(new nr(n)),e},buffer:function(t,e){var n=this.workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this.geomFact=t.getFactory();var i=new Ji(n,this.bufParams),r=new er(t,e,i),s=r.getCurves();if(s.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(s,n),this.graph=new xn(new Rn),this.graph.addEdges(this.edgeList.getEdges());var o=this.createSubgraphs(this.graph),a=new En(this.geomFact);this.buildSubgraphs(o,a);var u=a.getPolygons();return u.size()<=0?this.createEmptyResultGeometry():this.geomFact.buildGeometry(u)},computeNodedEdges:function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var i=n.getNodedSubstrings(),r=i.iterator();r.hasNext();){var s=r.next(),o=s.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var a=s.getData(),u=new jn(s.getCoordinates(),new ln(a));this.insertUniqueEdge(u)}}},setNoder:function(t){this.workingNoder=t},interfaces_:function(){return[]},getClass:function(){return ir}}),ir.depthDelta=function(t){var e=t.getLocation(0,an.LEFT),n=t.getLocation(0,an.RIGHT);return e===S.INTERIOR&&n===S.EXTERIOR?1:e===S.EXTERIOR&&n===S.INTERIOR?-1:0},ir.convertSegStrings=function(t){for(var e=new $t,n=new x;t.hasNext();){var i=t.next(),r=e.createLineString(i.getCoordinates());n.add(r)}return e.buildGeometry(n)},io(rr.prototype,{checkEndPtVertexIntersections:function(){if(0===arguments.length)for(var t=this.segStrings.iterator();t.hasNext();){var e=t.next(),n=e.getCoordinates();this.checkEndPtVertexIntersections(n[0],this.segStrings),this.checkEndPtVertexIntersections(n[n.length-1],this.segStrings)}else if(2===arguments.length)for(var i=arguments[0],r=arguments[1],t=r.iterator();t.hasNext();)for(var e=t.next(),n=e.getCoordinates(),s=1;s<n.length-1;s++)if(n[s].equals(i))throw new u("found endpt/interior pt intersection at index "+s+" :pt "+i)},checkInteriorIntersections:function(){if(0===arguments.length)for(var t=this.segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this.segStrings.iterator();n.hasNext();){var i=n.next();this.checkInteriorIntersections(e,i)}else if(2===arguments.length)for(var r=arguments[0],s=arguments[1],o=r.getCoordinates(),a=s.getCoordinates(),l=0;l<o.length-1;l++)for(var h=0;h<a.length-1;h++)this.checkInteriorIntersections(r,l,s,h);else if(4===arguments.length){var c=arguments[0],f=arguments[1],g=arguments[2],d=arguments[3];if(c===g&&f===d)return null;var p=c.getCoordinates()[f],m=c.getCoordinates()[f+1],v=g.getCoordinates()[d],y=g.getCoordinates()[d+1];if(this.li.computeIntersection(p,m,v,y),this.li.hasIntersection()&&(this.li.isProper()||this.hasInteriorIntersection(this.li,p,m)||this.hasInteriorIntersection(this.li,v,y)))throw new u("found non-noded intersection at "+p+"-"+m+" and "+v+"-"+y)}},checkValid:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},checkCollapses:function(){if(0===arguments.length)for(var t=this.segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var n=arguments[0],i=n.getCoordinates(),t=0;t<i.length-2;t++)this.checkCollapse(i[t],i[t+1],i[t+2])},hasInteriorIntersection:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++){var r=t.getIntersection(i);if(!r.equals(e)&&!r.equals(n))return!0}return!1},checkCollapse:function(t,e,n){if(t.equals(n))throw new u("found non-noded collapse at "+rr.fact.createLineString([t,e,n]))},interfaces_:function(){return[]},getClass:function(){return rr}}),rr.fact=new $t,io(sr.prototype,{intersectsScaled:function(t,e){var n=Math.min(t.x,e.x),i=Math.max(t.x,e.x),r=Math.min(t.y,e.y),s=Math.max(t.y,e.y),o=this.maxx<n||this.minx>i||this.maxy<r||this.miny>s;if(o)return!1;var a=this.intersectsToleranceSquare(t,e);return h.isTrue(!(o&&a),"Found bad envelope test"),a},initCorners:function(t){this.minx=t.x-.5,this.maxx=t.x+.5,this.miny=t.y-.5,this.maxy=t.y+.5,this.corner[0]=new c(this.maxx,this.maxy),this.corner[1]=new c(this.minx,this.maxy),this.corner[2]=new c(this.minx,this.miny),this.corner[3]=new c(this.maxx,this.miny)},intersects:function(t,e){return 1===this.scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this.p0Scaled),this.copyScaled(e,this.p1Scaled),this.intersectsScaled(this.p0Scaled,this.p1Scaled))},scale:function(t){return Math.round(t*this.scaleFactor)},getCoordinate:function(){return this.originalPt},copyScaled:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},getSafeEnvelope:function(){if(null===this.safeEnv){var t=sr.SAFE_ENV_EXPANSION_FACTOR/this.scaleFactor;this.safeEnv=new I(this.originalPt.x-t,this.originalPt.x+t,this.originalPt.y-t,this.originalPt.y+t)}return this.safeEnv},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())))},intersectsToleranceSquare:function(t,e){var n=!1,i=!1;return this.li.computeIntersection(t,e,this.corner[0],this.corner[1]),!!this.li.isProper()||(this.li.computeIntersection(t,e,this.corner[1],this.corner[2]),!!this.li.isProper()||(this.li.hasIntersection()&&(n=!0),this.li.computeIntersection(t,e,this.corner[2],this.corner[3]),!!this.li.isProper()||(this.li.hasIntersection()&&(i=!0),this.li.computeIntersection(t,e,this.corner[3],this.corner[0]),!!this.li.isProper()||(!(!n||!i)||(!!t.equals(this.pt)||!!e.equals(this.pt))))))},addSnappedNode:function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return!!this.intersects(n,i)&&(t.addIntersection(this.getCoordinate(),e),!0)},interfaces_:function(){return[]},getClass:function(){return sr}}),sr.SAFE_ENV_EXPANSION_FACTOR=.75,io(or.prototype,{snap:function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2],r=e.getSafeEnvelope(),s=new ar(e,n,i);return this.index.query(r,{interfaces_:function(){return[be]},visitItem:function(t){t.select(r,s)}}),s.isNodeAdded()}},interfaces_:function(){return[]},getClass:function(){return or}}),ro(ar,oi),io(ar.prototype,{isNodeAdded:function(){return this._isNodeAdded},select:function(){if(2!==arguments.length)return oi.prototype.select.apply(this,arguments);var t=arguments[0],e=arguments[1],n=t.getContext();if(null!==this.parentEdge&&n===this.parentEdge&&e===this.hotPixelVertexIndex)return null;this._isNodeAdded=this.hotPixel.addSnappedNode(n,e)},interfaces_:function(){return[]},getClass:function(){return ar}}),or.HotPixelSnapAction=ar,io(ur.prototype,{processIntersections:function(t,e,n,i){if(t===n&&e===i)return null;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=n.getCoordinates()[i],a=n.getCoordinates()[i+1];if(this.li.computeIntersection(r,s,o,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,i,1)}},isDone:function(){return!1},getInteriorIntersections:function(){return this.interiorIntersections},interfaces_:function(){return[en]},getClass:function(){return ur}}),io(lr.prototype,{checkCorrectness:function(t){var e=Xe.getNodedSubstrings(t),n=new rr(e);try{n.checkValid()}catch(t){if(!(t instanceof N))throw t;t.printStackTrace()}},getNodedSubstrings:function(){return Xe.getNodedSubstrings(this.nodedSegStrings)},snapRound:function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},findInteriorIntersections:function(t,e){var n=new ur(e);return this.noder.setSegmentIntersector(n),this.noder.computeNodes(t),n.getInteriorIntersections()},computeVertexSnaps:function(){if(oo(arguments[0],d))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Xe)for(var i=arguments[0],r=i.getCoordinates(),s=0;s<r.length;s++){var o=new sr(r[s],this.scaleFactor,this.li),a=this.pointSnapper.snap(o,i,s);a&&i.addIntersection(r[s],s)}},computeNodes:function(t){this.nodedSegStrings=t,this.noder=new Je,this.pointSnapper=new or(this.noder.getIndex()),this.snapRound(t,this.li)},computeIntersectionSnaps:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=new sr(n,this.scaleFactor,this.li);this.pointSnapper.snap(i)}},interfaces_:function(){return[Ze]},getClass:function(){return lr}}),io(hr.prototype,{bufferFixedPrecision:function(t){var e=new ki(new lr(new Qt(1)),t.getScale()),n=new ir(this.bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this.resultGeometry=n.buffer(this.argGeom,this.distance)},bufferReducedPrecision:function(){if(0===arguments.length){for(var t=hr.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(t){if(!(t instanceof tn))throw t;this.saveException=t}if(null!==this.resultGeometry)return null}throw this.saveException}if(1===arguments.length){var e=arguments[0],n=hr.precisionScaleFactor(this.argGeom,this.distance,e),i=new Qt(n);this.bufferFixedPrecision(i)}},computeGeometry:function(){if(this.bufferOriginalPrecision(),null!==this.resultGeometry)return null;var t=this.argGeom.getFactory().getPrecisionModel();t.getType()===Qt.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},setQuadrantSegments:function(t){this.bufParams.setQuadrantSegments(t)},bufferOriginalPrecision:function(){try{var t=new ir(this.bufParams);this.resultGeometry=t.buffer(this.argGeom,this.distance)}catch(t){if(!(t instanceof u))throw t;this.saveException=t}},getResultGeometry:function(t){return this.distance=t,this.computeGeometry(),this.resultGeometry},setEndCapStyle:function(t){this.bufParams.setEndCapStyle(t)},interfaces_:function(){return[]},getClass:function(){return hr}}),hr.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new hr(t),i=n.getResultGeometry(e);return i}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof F&&"number"==typeof arguments[1]){var r=arguments[0],s=arguments[1],o=arguments[2],a=new hr(r);a.setQuadrantSegments(o);var i=a.getResultGeometry(s);return i}if(arguments[2]instanceof Xi&&arguments[0]instanceof F&&"number"==typeof arguments[1]){var u=arguments[0],l=arguments[1],h=arguments[2],a=new hr(u,h),i=a.getResultGeometry(l);return i}}else if(4===arguments.length){var c=arguments[0],f=arguments[1],g=arguments[2],d=arguments[3],a=new hr(c);a.setQuadrantSegments(g),a.setEndCapStyle(d);var i=a.getResultGeometry(f);return i}},hr.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),r=L.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY())),s=e>0?e:0,o=r+2*s,a=Math.trunc(Math.log(o)/Math.log(10)+1),u=n-a;return Math.pow(10,u)},hr.CAP_ROUND=Xi.CAP_ROUND,hr.CAP_BUTT=Xi.CAP_FLAT,hr.CAP_FLAT=Xi.CAP_FLAT,hr.CAP_SQUARE=Xi.CAP_SQUARE,hr.MAX_PRECISION_DIGITS=12;var _o=Object.freeze({BufferOp:hr,BufferParameters:Xi});io(cr.prototype,{filter:function(t){t instanceof Lt&&this.comps.add(t)},interfaces_:function(){return[at]},getClass:function(){return cr}}),cr.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return cr.getPolygons(t,new x)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Lt?n.add(e):e instanceof lt&&e.apply(new cr(n)),n}},io(fr.prototype,{isInsideArea:function(){return this.segIndex===fr.INSIDE_AREA},getCoordinate:function(){return this.pt},getGeometryComponent:function(){return this.component},getSegmentIndex:function(){return this.segIndex},interfaces_:function(){return[]},getClass:function(){return fr}}),fr.INSIDE_AREA=-1,io(gr.prototype,{filter:function(t){t instanceof Ct&&this.pts.add(t)},interfaces_:function(){return[at]},getClass:function(){return gr}}),gr.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Ct?xo.singletonList(t):gr.getPoints(t,new x)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Ct?n.add(e):e instanceof lt&&e.apply(new gr(n)),n}},io(dr.prototype,{filter:function(t){(t instanceof Ct||t instanceof It||t instanceof Lt)&&this.locations.add(new fr(t,0,t.getCoordinate()))},interfaces_:function(){return[at]},getClass:function(){return dr}}),dr.getLocations=function(t){var e=new x;return t.apply(new dr(e)),e},io(pr.prototype,{computeContainmentDistance:function(){if(0===arguments.length){var t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this.minDistance<=this.terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],i=1-e,r=cr.getPolygons(this.geom[e]);if(r.size()>0){var s=dr.getLocations(this.geom[i]);if(this.computeContainmentDistance(s,r,n),this.minDistance<=this.terminateDistance)return this.minDistanceLocation[i]=n[0],this.minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&oo(arguments[0],m)&&oo(arguments[1],m)){for(var o=arguments[0],a=arguments[1],u=arguments[2],l=0;l<o.size();l++)for(var h=o.get(l),c=0;c<a.size();c++)if(this.computeContainmentDistance(h,a.get(c),u),this.minDistance<=this.terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof fr&&arguments[1]instanceof Lt){var f=arguments[0],g=arguments[1],d=arguments[2],p=f.getCoordinate();if(S.EXTERIOR!==this.ptLocator.locate(p,g))return this.minDistance=0,d[0]=f,d[1]=new fr(g,p),null}},computeMinDistanceLinesPoints:function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),s=0;s<e.size();s++){var o=e.get(s);if(this.computeMinDistance(r,o,n),this.minDistance<=this.terminateDistance)return null}},computeFacetDistance:function(){var t=new Array(2).fill(null),e=qn.getLines(this.geom[0]),n=qn.getLines(this.geom[1]),i=gr.getPoints(this.geom[0]),r=gr.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,r,t),this.updateMinDistance(t,!1),this.minDistance<=this.terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,i,t),this.updateMinDistance(t,!0),this.minDistance<=this.terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(i,r,t),void this.updateMinDistance(t,!1))))},nearestLocations:function(){return this.computeMinDistance(),this.minDistanceLocation},updateMinDistance:function(t,e){if(null===t[0])return null;e?(this.minDistanceLocation[0]=t[1],this.minDistanceLocation[1]=t[0]):(this.minDistanceLocation[0]=t[0],this.minDistanceLocation[1]=t[1])},nearestPoints:function(){return this.computeMinDistance(),[this.minDistanceLocation[0].getCoordinate(),this.minDistanceLocation[1].getCoordinate()]},computeMinDistance:function(){if(0===arguments.length){if(null!==this.minDistanceLocation)return null;if(this.minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this.minDistance<=this.terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof It&&arguments[1]instanceof Ct){var t=arguments[0],e=arguments[1],n=arguments[2];if(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>this.minDistance)return null;for(var i=t.getCoordinates(),r=e.getCoordinate(),s=0;s<i.length-1;s++){var o=oe.distancePointLine(r,i[s],i[s+1]);if(o<this.minDistance){this.minDistance=o;var a=new ae(i[s],i[s+1]),u=a.closestPoint(r);n[0]=new fr(t,s,u),n[1]=new fr(e,0,r)}if(this.minDistance<=this.terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof It&&arguments[1]instanceof It){var l=arguments[0],h=arguments[1],c=arguments[2];if(l.getEnvelopeInternal().distance(h.getEnvelopeInternal())>this.minDistance)return null;for(var i=l.getCoordinates(),f=h.getCoordinates(),s=0;s<i.length-1;s++)for(var g=0;g<f.length-1;g++){var o=oe.distanceLineLine(i[s],i[s+1],f[g],f[g+1]);if(o<this.minDistance){this.minDistance=o;var d=new ae(i[s],i[s+1]),p=new ae(f[g],f[g+1]),m=d.closestPoints(p);c[0]=new fr(l,s,m[0]),c[1]=new fr(h,g,m[1])}if(this.minDistance<=this.terminateDistance)return null}}},computeMinDistancePoints:function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),s=0;s<e.size();s++){var o=e.get(s),a=r.getCoordinate().distance(o.getCoordinate());if(a<this.minDistance&&(this.minDistance=a,n[0]=new fr(r,0,r.getCoordinate()),n[1]=new fr(o,0,o.getCoordinate())),this.minDistance<=this.terminateDistance)return null}},distance:function(){if(null===this.geom[0]||null===this.geom[1])throw new n("null geometries are not supported");return this.geom[0].isEmpty()||this.geom[1].isEmpty()?0:(this.computeMinDistance(),this.minDistance)},computeMinDistanceLines:function(t,e,n){for(var i=0;i<t.size();i++)for(var r=t.get(i),s=0;s<e.size();s++){var o=e.get(s);if(this.computeMinDistance(r,o,n),this.minDistance<=this.terminateDistance)return null}},interfaces_:function(){return[]},getClass:function(){return pr}}),pr.distance=function(t,e){return new pr(t,e).distance()},pr.isWithinDistance=function(t,e,n){return new pr(t,e,n).distance()<=n},pr.nearestPoints=function(t,e){return new pr(t,e).nearestPoints()};var Mo=Object.freeze({DistanceOp:pr});io(mr.prototype,{getCoordinates:function(){if(null===this.coordinates){for(var t=0,e=0,n=new E,i=this.directedEdges.iterator();i.hasNext();){var r=i.next();r.getEdgeDirection()?t++:e++,n.add(r.getEdge().getLine().getCoordinates(),!1,r.getEdgeDirection())}this.coordinates=n.toCoordinateArray(),e>t&&Y.reverse(this.coordinates)}return this.coordinates},toLineString:function(){return this.factory.createLineString(this.getCoordinates())},add:function(t){this.directedEdges.add(t)},interfaces_:function(){return[]},getClass:function(){return mr}}),io(vr.prototype,{setVisited:function(t){this._isVisited=t},isMarked:function(){return this._isMarked},setData:function(t){this.data=t},getData:function(){return this.data},setMarked:function(t){this._isMarked=t},getContext:function(){return this.data},isVisited:function(){
return this._isVisited},setContext:function(t){this.data=t},interfaces_:function(){return[]},getClass:function(){return vr}}),vr.getComponentWithVisitedState=function(t,e){for(;t.hasNext();){var n=t.next();if(n.isVisited()===e)return n}return null},vr.setVisited=function(t,e){for(;t.hasNext();){t.next().setVisited(e)}},vr.setMarked=function(t,e){for(;t.hasNext();){t.next().setMarked(e)}},ro(yr,vr),io(yr.prototype,{isRemoved:function(){return null===this.parentEdge},compareDirection:function(t){return this.quadrant>t.quadrant?1:this.quadrant<t.quadrant?-1:oe.computeOrientation(t.p0,t.p1,this.p1)},getCoordinate:function(){return this.from.getCoordinate()},print:function(t){var e=this.getClass().getName(),n=e.lastIndexOf("."),i=e.substring(n+1);t.print(" "+i+": "+this.p0+" - "+this.p1+" "+this.quadrant+":"+this.angle)},getDirectionPt:function(){return this.p1},getAngle:function(){return this.angle},compareTo:function(t){var e=t;return this.compareDirection(e)},getFromNode:function(){return this.from},getSym:function(){return this.sym},setEdge:function(t){this.parentEdge=t},remove:function(){this.sym=null,this.parentEdge=null},getEdge:function(){return this.parentEdge},getQuadrant:function(){return this.quadrant},setSym:function(t){this.sym=t},getToNode:function(){return this.to},getEdgeDirection:function(){return this.edgeDirection},interfaces_:function(){return[r]},getClass:function(){return yr}}),yr.toEdges=function(t){for(var e=new x,n=t.iterator();n.hasNext();)e.add(n.next().parentEdge);return e},ro(xr,yr),io(xr.prototype,{getNext:function(){return 2!==this.getToNode().getDegree()?null:this.getToNode().getOutEdges().getEdges().get(0)===this.getSym()?this.getToNode().getOutEdges().getEdges().get(1):(h.isTrue(this.getToNode().getOutEdges().getEdges().get(1)===this.getSym()),this.getToNode().getOutEdges().getEdges().get(0))},interfaces_:function(){return[]},getClass:function(){return xr}}),ro(Er,vr),io(Er.prototype,{isRemoved:function(){return null===this.dirEdge},setDirectedEdges:function(t,e){this.dirEdge=[t,e],t.setEdge(this),e.setEdge(this),t.setSym(e),e.setSym(t),t.getFromNode().addOutEdge(t),e.getFromNode().addOutEdge(e)},getDirEdge:function(){if(Number.isInteger(arguments[0])){var t=arguments[0];return this.dirEdge[t]}if(arguments[0]instanceof Nr){var e=arguments[0];return this.dirEdge[0].getFromNode()===e?this.dirEdge[0]:this.dirEdge[1].getFromNode()===e?this.dirEdge[1]:null}},remove:function(){this.dirEdge=null},getOppositeNode:function(t){return this.dirEdge[0].getFromNode()===t?this.dirEdge[0].getToNode():this.dirEdge[1].getFromNode()===t?this.dirEdge[1].getToNode():null},interfaces_:function(){return[]},getClass:function(){return Er}}),io(Ir.prototype,{getNextEdge:function(t){var e=this.getIndex(t);return this.outEdges.get(this.getIndex(e+1))},getCoordinate:function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},iterator:function(){return this.sortEdges(),this.outEdges.iterator()},sortEdges:function(){this.sorted||(xo.sort(this.outEdges),this.sorted=!0)},remove:function(t){this.outEdges.remove(t)},getEdges:function(){return this.sortEdges(),this.outEdges},getNextCWEdge:function(t){var e=this.getIndex(t);return this.outEdges.get(this.getIndex(e-1))},getIndex:function(){if(arguments[0]instanceof Er){var t=arguments[0];this.sortEdges();for(var e=0;e<this.outEdges.size();e++){var n=this.outEdges.get(e);if(n.getEdge()===t)return e}return-1}if(arguments[0]instanceof yr){var i=arguments[0];this.sortEdges();for(var e=0;e<this.outEdges.size();e++){var n=this.outEdges.get(e);if(n===i)return e}return-1}if(Number.isInteger(arguments[0])){var r=arguments[0],s=r%this.outEdges.size();return s<0&&(s+=this.outEdges.size()),s}},add:function(t){this.outEdges.add(t),this.sorted=!1},getDegree:function(){return this.outEdges.size()},interfaces_:function(){return[]},getClass:function(){return Ir}}),ro(Nr,vr),io(Nr.prototype,{isRemoved:function(){return null===this.pt},addOutEdge:function(t){this.deStar.add(t)},getCoordinate:function(){return this.pt},getOutEdges:function(){return this.deStar},remove:function(){if(0===arguments.length)this.pt=null;else if(1===arguments.length){var t=arguments[0];this.deStar.remove(t)}},getIndex:function(t){return this.deStar.getIndex(t)},getDegree:function(){return this.deStar.getDegree()},interfaces_:function(){return[]},getClass:function(){return Nr}}),Nr.getEdgesBetween=function(t,e){var n=yr.toEdges(t.getOutEdges().getEdges()),i=new K(n),r=yr.toEdges(e.getOutEdges().getEdges());return i.retainAll(r),i},ro(Cr,Er),io(Cr.prototype,{getLine:function(){return this.line},interfaces_:function(){return[]},getClass:function(){return Cr}}),io(Sr.prototype,{find:function(t){return this.nodeMap.get(t)},iterator:function(){return this.nodeMap.values().iterator()},remove:function(t){return this.nodeMap.remove(t)},values:function(){return this.nodeMap.values()},add:function(t){return this.nodeMap.put(t.getCoordinate(),t),t},interfaces_:function(){return[]},getClass:function(){return Sr}}),io(Lr.prototype,{findNodesOfDegree:function(t){for(var e=new x,n=this.nodeIterator();n.hasNext();){var i=n.next();i.getDegree()===t&&e.add(i)}return e},dirEdgeIterator:function(){return this.dirEdges.iterator()},edgeIterator:function(){return this.edges.iterator()},remove:function(){if(arguments[0]instanceof Er){var t=arguments[0];this.remove(t.getDirEdge(0)),this.remove(t.getDirEdge(1)),this.edges.remove(t),t.remove()}else if(arguments[0]instanceof yr){var e=arguments[0],n=e.getSym();null!==n&&n.setSym(null),e.getFromNode().remove(e),e.remove(),this.dirEdges.remove(e)}else if(arguments[0]instanceof Nr){for(var i=arguments[0],r=i.getOutEdges().getEdges(),s=r.iterator();s.hasNext();){var o=s.next(),n=o.getSym();null!==n&&this.remove(n),this.dirEdges.remove(o);var a=o.getEdge();null!==a&&this.edges.remove(a)}this.nodeMap.remove(i.getCoordinate()),i.remove()}},findNode:function(t){return this.nodeMap.find(t)},getEdges:function(){return this.edges},nodeIterator:function(){return this.nodeMap.iterator()},contains:function(){if(arguments[0]instanceof Er){var t=arguments[0];return this.edges.contains(t)}if(arguments[0]instanceof yr){var e=arguments[0];return this.dirEdges.contains(e)}},add:function(){if(arguments[0]instanceof Nr){var t=arguments[0];this.nodeMap.add(t)}else if(arguments[0]instanceof Er){var e=arguments[0];this.edges.add(e),this.add(e.getDirEdge(0)),this.add(e.getDirEdge(1))}else if(arguments[0]instanceof yr){var n=arguments[0];this.dirEdges.add(n)}},getNodes:function(){return this.nodeMap.values()},interfaces_:function(){return[]},getClass:function(){return Lr}}),ro(wr,Lr),io(wr.prototype,{addEdge:function(t){if(t.isEmpty())return null;var e=Y.removeRepeatedPoints(t.getCoordinates());if(e.length<=1)return null;var n=e[0],i=e[e.length-1],r=this.getNode(n),s=this.getNode(i),o=new xr(r,s,e[1],!0),a=new xr(s,r,e[e.length-2],!1),u=new Cr(t);u.setDirectedEdges(o,a),this.add(u)},getNode:function(t){var e=this.findNode(t);return null===e&&(e=new Nr(t),this.add(e)),e},interfaces_:function(){return[]},getClass:function(){return wr}}),io(Rr.prototype,{buildEdgeStringsForUnprocessedNodes:function(){for(var t=this.graph.getNodes().iterator();t.hasNext();){var e=t.next();e.isMarked()||(h.isTrue(2===e.getDegree()),this.buildEdgeStringsStartingAt(e),e.setMarked(!0))}},buildEdgeStringsForNonDegree2Nodes:function(){for(var t=this.graph.getNodes().iterator();t.hasNext();){var e=t.next();2!==e.getDegree()&&(this.buildEdgeStringsStartingAt(e),e.setMarked(!0))}},buildEdgeStringsForObviousStartNodes:function(){this.buildEdgeStringsForNonDegree2Nodes()},getMergedLineStrings:function(){return this.merge(),this.mergedLineStrings},buildEdgeStringsStartingAt:function(t){for(var e=t.getOutEdges().iterator();e.hasNext();){var n=e.next();n.getEdge().isMarked()||this.edgeStrings.add(this.buildEdgeStringStartingWith(n))}},merge:function(){if(null!==this.mergedLineStrings)return null;vr.setMarked(this.graph.nodeIterator(),!1),vr.setMarked(this.graph.edgeIterator(),!1),this.edgeStrings=new x,this.buildEdgeStringsForObviousStartNodes(),this.buildEdgeStringsForIsolatedLoops(),this.mergedLineStrings=new x;for(var t=this.edgeStrings.iterator();t.hasNext();){var e=t.next();this.mergedLineStrings.add(e.toLineString())}},buildEdgeStringStartingWith:function(t){var e=new mr(this.factory),n=t;do{e.add(n),n.getEdge().setMarked(!0),n=n.getNext()}while(null!==n&&n!==t);return e},add:function(){if(arguments[0]instanceof F){arguments[0].apply({interfaces_:function(){return[A]},filter:function(t){t instanceof It&&this.add(t)}})}else if(oo(arguments[0],d)){var t=arguments[0];this.mergedLineStrings=null;for(var e=t.iterator();e.hasNext();){var n=e.next();this.add(n)}}else if(arguments[0]instanceof It){var i=arguments[0];null===this.factory&&(this.factory=i.getFactory()),this.graph.addEdge(i)}},buildEdgeStringsForIsolatedLoops:function(){this.buildEdgeStringsForUnprocessedNodes()},interfaces_:function(){return[]},getClass:function(){return Rr}});var Do=Object.freeze({LineMerger:Rr}),Ao=Object.freeze({OverlayOp:$n});ro(Tr,yr),io(Tr.prototype,{getNext:function(){return this.next},isInRing:function(){return null!==this.edgeRing},setRing:function(t){this.edgeRing=t},setLabel:function(t){this.label=t},getLabel:function(){return this.label},setNext:function(t){this.next=t},getRing:function(){return this.edgeRing},interfaces_:function(){return[]},getClass:function(){return Tr}}),ro(Or,Er),io(Or.prototype,{getLine:function(){return this.line},interfaces_:function(){return[]},getClass:function(){return Or}}),io(Pr.prototype,{visitInteriorRing:function(t,e){var n=t.getCoordinates(),i=n[0],r=Pr.findDifferentPoint(n,i),s=e.findEdgeInSameDirection(i,r),o=e.findEdgeEnd(s),a=null;o.getLabel().getLocation(0,an.RIGHT)===S.INTERIOR?a=o:o.getSym().getLabel().getLocation(0,an.RIGHT)===S.INTERIOR&&(a=o.getSym()),h.isTrue(null!==a,"unable to find dirEdge with Interior on RHS"),this.visitLinkedDirectedEdges(a)},visitShellInteriors:function(t,e){if(t instanceof Lt){var n=t;this.visitInteriorRing(n.getExteriorRing(),e)}if(t instanceof Tt)for(var i=t,r=0;r<i.getNumGeometries();r++){var n=i.getGeometryN(r);this.visitInteriorRing(n.getExteriorRing(),e)}},getCoordinate:function(){return this.disconnectedRingcoord},setInteriorEdgesInResult:function(t){for(var e=t.getEdgeEnds().iterator();e.hasNext();){var n=e.next();n.getLabel().getLocation(0,an.RIGHT)===S.INTERIOR&&n.setInResult(!0)}},visitLinkedDirectedEdges:function(t){var e=t,n=t;do{h.isTrue(null!==n,"found null Directed Edge"),n.setVisited(!0),n=n.getNext()}while(n!==e)},buildEdgeRings:function(t){for(var e=new x,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&null===i.getEdgeRing()){var r=new fn(i,this.geometryFactory);r.linkDirectedEdgesForMinimalEdgeRings();var s=r.buildMinimalRings();e.addAll(s)}}return e},hasUnvisitedShellEdge:function(t){for(var e=0;e<t.size();e++){var n=t.get(e);if(!n.isHole()){var i=n.getEdges(),r=i.get(0);if(r.getLabel().getLocation(0,an.RIGHT)===S.INTERIOR)for(var s=0;s<i.size();s++)if(r=i.get(s),!r.isVisited())return this.disconnectedRingcoord=r.getCoordinate(),!0}}return!1},isInteriorsConnected:function(){var t=new x;this.geomGraph.computeSplitEdges(t);var e=new xn(new Rn);e.addEdges(t),this.setInteriorEdgesInResult(e),e.linkResultDirectedEdges();var n=this.buildEdgeRings(e.getEdgeEnds());return this.visitShellInteriors(this.geomGraph.getGeometry(),e),!this.hasUnvisitedShellEdge(n)},interfaces_:function(){return[]},getClass:function(){return Pr}}),Pr.findDifferentPoint=function(t,e){for(var n=0;n<t.length;n++)if(!t[n].equals(e))return t[n];return null},io(br.prototype,{createEdgeEndForNext:function(t,e,n,i){var r=n.segmentIndex+1;if(r>=t.getNumPoints()&&null===i)return null;var s=t.getCoordinate(r);null!==i&&i.segmentIndex===n.segmentIndex&&(s=i.coord);var o=new mn(t,n.coord,s,new ln(t.getLabel()));e.add(o)},createEdgeEndForPrev:function(t,e,n,i){var r=n.segmentIndex;if(0===n.dist){if(0===r)return null;r--}var s=t.getCoordinate(r);null!==i&&i.segmentIndex>=r&&(s=i.coord);var o=new ln(t.getLabel());o.flip();var a=new mn(t,n.coord,s,o);e.add(a)},computeEdgeEnds:function(){if(1===arguments.length){for(var t=arguments[0],e=new x,n=t;n.hasNext();){var i=n.next();this.computeEdgeEnds(i,e)}return e}if(2===arguments.length){var r=arguments[0],s=arguments[1],o=r.getEdgeIntersectionList();o.addEndpoints();var a=o.iterator(),u=null,l=null;if(!a.hasNext())return null;var h=a.next();do{u=l,l=h,h=null,a.hasNext()&&(h=a.next()),null!==l&&(this.createEdgeEndForPrev(r,s,l,u),this.createEdgeEndForNext(r,s,l,h))}while(null!==l)}},interfaces_:function(){return[]},getClass:function(){return br}}),ro(_r,mn),io(_r.prototype,{insert:function(t){this.edgeEnds.add(t)},print:function(t){t.println("EdgeEndBundle--\x3e Label: "+this.label);for(var e=this.iterator();e.hasNext();){e.next().print(t),t.println()}},iterator:function(){return this.edgeEnds.iterator()},getEdgeEnds:function(){return this.edgeEnds},computeLabelOn:function(t,e){for(var n=0,i=!1,r=this.iterator();r.hasNext();){var s=r.next(),o=s.getLabel().getLocation(t);o===S.BOUNDARY&&n++,o===S.INTERIOR&&(i=!0)}var o=S.NONE;i&&(o=S.INTERIOR),n>0&&(o=Kn.determineBoundary(e,n)),this.label.setLocation(t,o)},computeLabelSide:function(t,e){for(var n=this.iterator();n.hasNext();){var i=n.next();if(i.getLabel().isArea()){var r=i.getLabel().getLocation(t,e);if(r===S.INTERIOR)return this.label.setLocation(t,e,S.INTERIOR),null;r===S.EXTERIOR&&this.label.setLocation(t,e,S.EXTERIOR)}}},getLabel:function(){return this.label},computeLabelSides:function(t){this.computeLabelSide(t,an.LEFT),this.computeLabelSide(t,an.RIGHT)},updateIM:function(t){jn.updateIM(this.label,t)},computeLabel:function(t){for(var e=!1,n=this.iterator();n.hasNext();){n.next().getLabel().isArea()&&(e=!0)}this.label=e?new ln(S.NONE,S.NONE,S.NONE):new ln(S.NONE);for(var i=0;i<2;i++)this.computeLabelOn(i,t),e&&this.computeLabelSides(i)},interfaces_:function(){return[]},getClass:function(){return _r}}),ro(Mr,Ln),io(Mr.prototype,{updateIM:function(t){for(var e=this.iterator();e.hasNext();){e.next().updateIM(t)}},insert:function(t){var e=this.edgeMap.get(t);null===e?(e=new _r(t),this.insertEdgeEnd(t,e)):e.insert(t)},interfaces_:function(){return[]},getClass:function(){return Mr}}),ro(Dr,dn),io(Dr.prototype,{updateIMFromEdges:function(t){this.edges.updateIM(t)},computeIM:function(t){t.setAtLeastIfValid(this.label.getLocation(0),this.label.getLocation(1),0)},interfaces_:function(){return[]},getClass:function(){return Dr}}),ro(Ar,yn),io(Ar.prototype,{createNode:function(t){return new Dr(t,new Mr)},interfaces_:function(){return[]},getClass:function(){return Ar}}),io(Fr.prototype,{insertEdgeEnds:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.nodes.add(n)}},getNodeIterator:function(){return this.nodes.iterator()},copyNodesAndLabels:function(t,e){for(var n=t.getNodeIterator();n.hasNext();){var i=n.next();this.nodes.addNode(i.getCoordinate()).setLabel(e,i.getLabel().getLocation(e))}},build:function(t){this.computeIntersectionNodes(t,0),this.copyNodesAndLabels(t,0);var e=new br,n=e.computeEdgeEnds(t.getEdgeIterator());this.insertEdgeEnds(n)},computeIntersectionNodes:function(t,e){for(var n=t.getEdgeIterator();n.hasNext();)for(var i=n.next(),r=i.getLabel().getLocation(e),s=i.getEdgeIntersectionList().iterator();s.hasNext();){var o=s.next(),a=this.nodes.addNode(o.coord);r===S.BOUNDARY?a.setLabelBoundary(e):a.getLabel().isNull(e)&&a.setLabel(e,S.INTERIOR)}},interfaces_:function(){return[]},getClass:function(){return Fr}}),io(Gr.prototype,{isNodeEdgeAreaLabelsConsistent:function(){for(var t=this.nodeGraph.getNodeIterator();t.hasNext();){var e=t.next();if(!e.getEdges().isAreaLabelsConsistent(this.geomGraph))return this.invalidPoint=e.getCoordinate().copy(),!1}return!0},getInvalidPoint:function(){return this.invalidPoint},hasDuplicateRings:function(){for(var t=this.nodeGraph.getNodeIterator();t.hasNext();)for(var e=t.next(),n=e.getEdges().iterator();n.hasNext();){var i=n.next();if(i.getEdgeEnds().size()>1)return this.invalidPoint=i.getEdge().getCoordinate(0),!0}return!1},isNodeConsistentArea:function(){var t=this.geomGraph.computeSelfNodes(this.li,!0,!0);return t.hasProperIntersection()?(this.invalidPoint=t.getProperIntersectionPoint(),!1):(this.nodeGraph.build(this.geomGraph),this.isNodeEdgeAreaLabelsConsistent())},interfaces_:function(){return[]},getClass:function(){return Gr}}),io(qr.prototype,{buildIndex:function(){this.index=new qe;for(var t=0;t<this.rings.size();t++){var e=this.rings.get(t),n=e.getEnvelopeInternal();this.index.insert(n,e)}},getNestedPoint:function(){return this.nestedPt},isNonNested:function(){this.buildIndex();for(var t=0;t<this.rings.size();t++)for(var e=this.rings.get(t),n=e.getCoordinates(),i=this.index.query(e.getEnvelopeInternal()),r=0;r<i.size();r++){var s=i.get(r),o=s.getCoordinates();if(e!==s&&e.getEnvelopeInternal().intersects(s.getEnvelopeInternal())){var a=Vr.findPtNotNode(n,s,this.graph);if(null!==a){var u=oe.isPointInRing(a,o);if(u)return this.nestedPt=a,!1}}}return!0},add:function(t){this.rings.add(t),this.totalEnv.expandToInclude(t.getEnvelopeInternal())},interfaces_:function(){return[]},getClass:function(){return qr}}),io(Br.prototype,{getErrorType:function(){return this.errorType},getMessage:function(){return Br.errMsg[this.errorType]},getCoordinate:function(){return this.pt},toString:function(){var t="";return null!==this.pt&&(t=" at or near point "+this.pt),this.getMessage()+t},interfaces_:function(){return[]},getClass:function(){return Br}}),Br.ERROR=0,Br.REPEATED_POINT=1,Br.HOLE_OUTSIDE_SHELL=2,Br.NESTED_HOLES=3,Br.DISCONNECTED_INTERIOR=4,Br.SELF_INTERSECTION=5,Br.RING_SELF_INTERSECTION=6,Br.NESTED_SHELLS=7,Br.DUPLICATE_RINGS=8,Br.TOO_FEW_POINTS=9,Br.INVALID_COORDINATE=10,Br.RING_NOT_CLOSED=11,Br.errMsg=["Topology Validation Error","Repeated Point","Hole lies outside shell","Holes are nested","Interior is disconnected","Self-intersection","Ring Self-intersection","Nested shells","Duplicate Rings","Too few distinct points in geometry component","Invalid Coordinate","Ring is not closed"],io(Vr.prototype,{checkInvalidCoordinates:function(){if(arguments[0]instanceof Array){for(var t=arguments[0],e=0;e<t.length;e++)if(!Vr.isValid(t[e]))return this.validErr=new Br(Br.INVALID_COORDINATE,t[e]),null}else if(arguments[0]instanceof Lt){var n=arguments[0];if(this.checkInvalidCoordinates(n.getExteriorRing().getCoordinates()),null!==this.validErr)return null;for(var e=0;e<n.getNumInteriorRing();e++)if(this.checkInvalidCoordinates(n.getInteriorRingN(e).getCoordinates()),null!==this.validErr)return null}},checkHolesNotNested:function(t,e){for(var n=new qr(e),i=0;i<t.getNumInteriorRing();i++){var r=t.getInteriorRingN(i);n.add(r)}n.isNonNested()||(this.validErr=new Br(Br.NESTED_HOLES,n.getNestedPoint()))},checkConsistentArea:function(t){var e=new Gr(t);if(!e.isNodeConsistentArea())return this.validErr=new Br(Br.SELF_INTERSECTION,e.getInvalidPoint()),null;e.hasDuplicateRings()&&(this.validErr=new Br(Br.DUPLICATE_RINGS,e.getInvalidPoint()))},isValid:function(){return this.checkValid(this.parentGeometry),null===this.validErr},checkShellInsideHole:function(t,e,n){var i=t.getCoordinates(),r=e.getCoordinates(),s=Vr.findPtNotNode(i,e,n);if(null!==s){if(!oe.isPointInRing(s,r))return s}var o=Vr.findPtNotNode(r,t,n);if(null!==o){return oe.isPointInRing(o,i)?o:null}return h.shouldNeverReachHere("points in shell and hole appear to be equal"),null},checkNoSelfIntersectingRings:function(t){for(var e=t.getEdgeIterator();e.hasNext();){var n=e.next();if(this.checkNoSelfIntersectingRing(n.getEdgeIntersectionList()),null!==this.validErr)return null}},checkConnectedInteriors:function(t){var e=new Pr(t);e.isInteriorsConnected()||(this.validErr=new Br(Br.DISCONNECTED_INTERIOR,e.getCoordinate()))},checkNoSelfIntersectingRing:function(t){for(var e=new rt,n=!0,i=t.iterator();i.hasNext();){var r=i.next();if(n)n=!1;else{if(e.contains(r.coord))return this.validErr=new Br(Br.RING_SELF_INTERSECTION,r.coord),null;e.add(r.coord)}}},checkHolesInShell:function(t,e){for(var n=t.getExteriorRing(),i=new vi(n),r=0;r<t.getNumInteriorRing();r++){var s=t.getInteriorRingN(r),o=Vr.findPtNotNode(s.getCoordinates(),n,e);if(null===o)return null;if(!i.isInside(o))return this.validErr=new Br(Br.HOLE_OUTSIDE_SHELL,o),null}},checkTooFewPoints:function(t){if(t.hasTooFewPoints())return this.validErr=new Br(Br.TOO_FEW_POINTS,t.getInvalidPoint()),null},getValidationError:function(){return this.checkValid(this.parentGeometry),this.validErr},checkValid:function(){if(arguments[0]instanceof Ct){var t=arguments[0];this.checkInvalidCoordinates(t.getCoordinates())}else if(arguments[0]instanceof wt){var e=arguments[0];this.checkInvalidCoordinates(e.getCoordinates())}else if(arguments[0]instanceof Rt){var n=arguments[0];if(this.checkInvalidCoordinates(n.getCoordinates()),null!==this.validErr)return null;if(this.checkClosedRing(n),null!==this.validErr)return null;var i=new Kn(0,n);if(this.checkTooFewPoints(i),null!==this.validErr)return null;var r=new ie;i.computeSelfNodes(r,!0,!0),this.checkNoSelfIntersectingRings(i)}else if(arguments[0]instanceof It){var s=arguments[0];if(this.checkInvalidCoordinates(s.getCoordinates()),null!==this.validErr)return null;var i=new Kn(0,s);this.checkTooFewPoints(i)}else if(arguments[0]instanceof Lt){var o=arguments[0];if(this.checkInvalidCoordinates(o),null!==this.validErr)return null;if(this.checkClosedRings(o),null!==this.validErr)return null;var i=new Kn(0,o);if(this.checkTooFewPoints(i),null!==this.validErr)return null;if(this.checkConsistentArea(i),null!==this.validErr)return null;if(!this.isSelfTouchingRingFormingHoleValid&&(this.checkNoSelfIntersectingRings(i),null!==this.validErr))return null;if(this.checkHolesInShell(o,i),null!==this.validErr)return null;if(this.checkHolesNotNested(o,i),null!==this.validErr)return null;this.checkConnectedInteriors(i)}else if(arguments[0]instanceof Tt){for(var a=arguments[0],u=0;u<a.getNumGeometries();u++){var l=a.getGeometryN(u);if(this.checkInvalidCoordinates(l),null!==this.validErr)return null;if(this.checkClosedRings(l),null!==this.validErr)return null}var i=new Kn(0,a);if(this.checkTooFewPoints(i),null!==this.validErr)return null;if(this.checkConsistentArea(i),null!==this.validErr)return null;if(!this.isSelfTouchingRingFormingHoleValid&&(this.checkNoSelfIntersectingRings(i),null!==this.validErr))return null;for(var u=0;u<a.getNumGeometries();u++){var l=a.getGeometryN(u);if(this.checkHolesInShell(l,i),null!==this.validErr)return null}for(var u=0;u<a.getNumGeometries();u++){var l=a.getGeometryN(u);if(this.checkHolesNotNested(l,i),null!==this.validErr)return null}if(this.checkShellsNotNested(a,i),null!==this.validErr)return null;this.checkConnectedInteriors(i)}else if(arguments[0]instanceof lt)for(var h=arguments[0],u=0;u<h.getNumGeometries();u++){var c=h.getGeometryN(u);if(this.checkValid(c),null!==this.validErr)return null}else if(arguments[0]instanceof F){var f=arguments[0];if(this.validErr=null,f.isEmpty())return null;if(f instanceof Ct)this.checkValid(f);else if(f instanceof wt)this.checkValid(f);else if(f instanceof Rt)this.checkValid(f);else if(f instanceof It)this.checkValid(f);else if(f instanceof Lt)this.checkValid(f);else if(f instanceof Tt)this.checkValid(f);else{if(!(f instanceof lt))throw new UnsupportedOperationException(f.getClass().getName());this.checkValid(f)}}},setSelfTouchingRingFormingHoleValid:function(t){this.isSelfTouchingRingFormingHoleValid=t},checkShellNotNested:function(t,e,n){var i=t.getCoordinates(),r=e.getExteriorRing(),s=r.getCoordinates(),o=Vr.findPtNotNode(i,r,n);if(null===o)return null;if(!oe.isPointInRing(o,s))return null;if(e.getNumInteriorRing()<=0)return this.validErr=new Br(Br.NESTED_SHELLS,o),null;for(var a=null,u=0;u<e.getNumInteriorRing();u++){var l=e.getInteriorRingN(u);if(null===(a=this.checkShellInsideHole(t,l,n)))return null}this.validErr=new Br(Br.NESTED_SHELLS,a)},checkClosedRings:function(t){if(this.checkClosedRing(t.getExteriorRing()),null!==this.validErr)return null;for(var e=0;e<t.getNumInteriorRing();e++)if(this.checkClosedRing(t.getInteriorRingN(e)),null!==this.validErr)return null},checkClosedRing:function(t){if(!t.isClosed()){var e=null;t.getNumPoints()>=1&&(e=t.getCoordinateN(0)),this.validErr=new Br(Br.RING_NOT_CLOSED,e)}},checkShellsNotNested:function(t,e){for(var n=0;n<t.getNumGeometries();n++)for(var i=t.getGeometryN(n),r=i.getExteriorRing(),s=0;s<t.getNumGeometries();s++)if(n!==s){var o=t.getGeometryN(s);if(this.checkShellNotNested(r,o,e),null!==this.validErr)return null}},interfaces_:function(){return[]},getClass:function(){return Vr}}),Vr.findPtNotNode=function(t,e,n){for(var i=n.findEdge(e),r=i.getEdgeIntersectionList(),s=0;s<t.length;s++){var o=t[s];if(!r.isIntersection(o))return o}return null},Vr.isValid=function(){if(arguments[0]instanceof F){return new Vr(arguments[0]).isValid()}if(arguments[0]instanceof c){var t=arguments[0];return!i.isNaN(t.x)&&(!i.isInfinite(t.x)&&(!i.isNaN(t.y)&&!i.isInfinite(t.y)))}},io(zr.prototype,{isIncluded:function(){return this._isIncluded},getCoordinates:function(){if(null===this.ringPts){for(var t=new E,e=this.deList.iterator();e.hasNext();){var n=e.next(),i=n.getEdge();zr.addEdge(i.getLine().getCoordinates(),n.getEdgeDirection(),t)}this.ringPts=t.toCoordinateArray()}return this.ringPts},isIncludedSet:function(){return this._isIncludedSet},isValid:function(){return this.getCoordinates(),!(this.ringPts.length<=3)&&(this.getRing(),Vr.isValid(this.ring))},build:function(t){var e=t;do{this.add(e),e.setRing(this),e=e.getNext(),h.isTrue(null!==e,"found null DE in ring"),h.isTrue(e===t||!e.isInRing(),"found DE already in ring")}while(e!==t)},isOuterHole:function(){return!!this._isHole&&!this.hasShell()},getPolygon:function(){var t=null;if(null!==this.holes){t=new Array(this.holes.size()).fill(null);for(var e=0;e<this.holes.size();e++)t[e]=this.holes.get(e)}return this.factory.createPolygon(this.ring,t)},isHole:function(){return this._isHole},isProcessed:function(){return this._isProcessed},addHole:function(){if(arguments[0]instanceof Rt){var t=arguments[0];null===this.holes&&(this.holes=new x),this.holes.add(t)}else if(arguments[0]instanceof zr){var e=arguments[0];e.setShell(this);var n=e.getRing();null===this.holes&&(this.holes=new x),this.holes.add(n)}},setIncluded:function(t){this._isIncluded=t,this._isIncludedSet=!0},getOuterHole:function(){if(this.isHole())return null;for(var t=0;t<this.deList.size();t++){var e=this.deList.get(t),n=e.getSym().getRing();if(n.isOuterHole())return n}return null},computeHole:function(){var t=this.getRing();this._isHole=oe.isCCW(t.getCoordinates())},hasShell:function(){return null!==this.shell},isOuterShell:function(){return null!==this.getOuterHole()},getLineString:function(){return this.getCoordinates(),this.factory.createLineString(this.ringPts)},toString:function(){return ee.toLineString(new Dt(this.getCoordinates()))},getShell:function(){return this.isHole()?this.shell:this},add:function(t){this.deList.add(t)},getRing:function(){if(null!==this.ring)return this.ring;this.getCoordinates(),this.ringPts.length<3&&_.out.println(this.ringPts);try{this.ring=this.factory.createLinearRing(this.ringPts)}catch(t){if(!(t instanceof N))throw t;_.out.println(this.ringPts)}return this.ring},updateIncluded:function(){if(this.isHole())return null;for(var t=0;t<this.deList.size();t++){var e=this.deList.get(t),n=e.getSym().getRing().getShell();if(null!==n&&n.isIncludedSet())return this.setIncluded(!n.isIncluded()),null}},setShell:function(t){this.shell=t},setProcessed:function(t){this._isProcessed=t},interfaces_:function(){return[]},getClass:function(){return zr}}),zr.findDirEdgesInRing=function(t){var e=t,n=new x;do{n.add(e),e=e.getNext(),h.isTrue(null!==e,"found null DE in ring"),h.isTrue(e===t||!e.isInRing(),"found DE already in ring")}while(e!==t);return n},zr.addEdge=function(t,e,n){if(e)for(var i=0;i<t.length;i++)n.add(t[i],!1);else for(var i=t.length-1;i>=0;i--)n.add(t[i],!1)},zr.findEdgeRingContaining=function(t,e){for(var n=t.getRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),s=null,o=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getRing(),h=l.getEnvelopeInternal();if(!h.equals(i)&&h.contains(i)){r=Y.ptNotInList(n.getCoordinates(),l.getCoordinates());var c=!1;oe.isPointInRing(r,l.getCoordinates())&&(c=!0),c&&(null===s||o.contains(h))&&(s=u,o=s.getRing().getEnvelopeInternal())}}return s},io(kr.prototype,{compare:function(t,e){var n=t,i=e;return n.getRing().getEnvelope().compareTo(i.getRing().getEnvelope())},interfaces_:function(){return[o]},getClass:function(){return kr}}),zr.EnvelopeComparator=kr,ro(Yr,Lr),io(Yr.prototype,{findEdgeRing:function(t){var e=new zr(this.factory);return e.build(t),e},computeDepthParity:function(){if(0===arguments.length)for(;;){return null}else if(1===arguments.length){arguments[0]}},computeNextCWEdges:function(){for(var t=this.nodeIterator();t.hasNext();){var e=t.next();Yr.computeNextCWEdges(e)}},addEdge:function(t){if(t.isEmpty())return null;var e=Y.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return null;var n=e[0],i=e[e.length-1],r=this.getNode(n),s=this.getNode(i),o=new Tr(r,s,e[1],!0),a=new Tr(s,r,e[e.length-2],!1),u=new Or(t);u.setDirectedEdges(o,a),this.add(u)},deleteCutEdges:function(){this.computeNextCWEdges(),Yr.findLabeledEdgeRings(this.dirEdges);for(var t=new x,e=this.dirEdges.iterator();e.hasNext();){var n=e.next();if(!n.isMarked()){var i=n.getSym();if(n.getLabel()===i.getLabel()){n.setMarked(!0),i.setMarked(!0);var r=n.getEdge();t.add(r.getLine())}}}return t},getEdgeRings:function(){this.computeNextCWEdges(),Yr.label(this.dirEdges,-1);var t=Yr.findLabeledEdgeRings(this.dirEdges);this.convertMaximalToMinimalEdgeRings(t);for(var e=new x,n=this.dirEdges.iterator();n.hasNext();){var i=n.next();if(!i.isMarked()&&!i.isInRing()){var r=this.findEdgeRing(i);e.add(r)}}return e},getNode:function(t){var e=this.findNode(t);return null===e&&(e=new Nr(t),this.add(e)),e},convertMaximalToMinimalEdgeRings:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=n.getLabel(),r=Yr.findIntersectionNodes(n,i);if(null!==r)for(var s=r.iterator();s.hasNext();){var o=s.next();Yr.computeNextCCWEdges(o,i)}}},deleteDangles:function(){for(var t=this.findNodesOfDegree(1),e=new K,n=new ce,i=t.iterator();i.hasNext();)n.push(i.next());for(;!n.isEmpty();){var r=n.pop();Yr.deleteAllEdges(r);for(var s=r.getOutEdges().getEdges(),i=s.iterator();i.hasNext();){var o=i.next();o.setMarked(!0);var a=o.getSym();null!==a&&a.setMarked(!0);var u=o.getEdge();e.add(u.getLine());var l=o.getToNode();1===Yr.getDegreeNonDeleted(l)&&n.push(l)}}return e},interfaces_:function(){return[]},getClass:function(){return Yr}}),Yr.findLabeledEdgeRings=function(t){for(var e=new x,n=1,i=t.iterator();i.hasNext();){var r=i.next();if(!r.isMarked()&&!(r.getLabel()>=0)){e.add(r);var s=zr.findDirEdgesInRing(r);Yr.label(s,n),n++}}return e},Yr.getDegreeNonDeleted=function(t){for(var e=t.getOutEdges().getEdges(),n=0,i=e.iterator();i.hasNext();){i.next().isMarked()||n++}return n},Yr.deleteAllEdges=function(t){for(var e=t.getOutEdges().getEdges(),n=e.iterator();n.hasNext();){var i=n.next();i.setMarked(!0);var r=i.getSym();null!==r&&r.setMarked(!0)}},Yr.label=function(t,e){for(var n=t.iterator();n.hasNext();){n.next().setLabel(e)}},Yr.computeNextCWEdges=function(t){for(var e=t.getOutEdges(),n=null,i=null,r=e.getEdges().iterator();r.hasNext();){var s=r.next();if(!s.isMarked()){if(null===n&&(n=s),null!==i){var o=i.getSym();o.setNext(s)}i=s}}if(null!==i){var o=i.getSym();o.setNext(n)}},Yr.computeNextCCWEdges=function(t,e){for(var n=t.getOutEdges(),i=null,r=null,s=n.getEdges(),o=s.size()-1;o>=0;o--){var a=s.get(o),u=a.getSym(),l=null;a.getLabel()===e&&(l=a);var c=null;u.getLabel()===e&&(c=u),null===l&&null===c||(null!==c&&(r=c),null!==l&&(null!==r&&(r.setNext(l),r=null),null===i&&(i=l)))}null!==r&&(h.isTrue(null!==i),r.setNext(i))},Yr.getDegree=function(t,e){
for(var n=t.getOutEdges().getEdges(),i=0,r=n.iterator();r.hasNext();){r.next().getLabel()===e&&i++}return i},Yr.findIntersectionNodes=function(t,e){var n=t,i=null;do{var r=n.getFromNode();Yr.getDegree(r,e)>1&&(null===i&&(i=new x),i.add(r)),n=n.getNext(),h.isTrue(null!==n,"found null DE in ring"),h.isTrue(n===t||!n.isInRing(),"found DE already in ring")}while(n!==t);return i},io(Ur.prototype,{getGeometry:function(){return null===this.geomFactory&&(this.geomFactory=new $t),this.polygonize(),this.extractOnlyPolygonal?this.geomFactory.buildGeometry(this.polyList):this.geomFactory.createGeometryCollection($t.toGeometryArray(this.polyList))},getInvalidRingLines:function(){return this.polygonize(),this.invalidRingLines},findValidRings:function(t,e,n){for(var i=t.iterator();i.hasNext();){var r=i.next();r.isValid()?e.add(r):n.add(r.getLineString())}},polygonize:function(){if(null!==this.polyList)return null;if(this.polyList=new x,null===this.graph)return null;this.dangles=this.graph.deleteDangles(),this.cutEdges=this.graph.deleteCutEdges();var t=this.graph.getEdgeRings(),e=new x;this.invalidRingLines=new x,this.isCheckingRingsValid?this.findValidRings(t,e,this.invalidRingLines):e=t,this.findShellsAndHoles(e),Ur.assignHolesToShells(this.holeList,this.shellList),xo.sort(this.shellList,new zr.EnvelopeComparator);var n=!0;this.extractOnlyPolygonal&&(Ur.findDisjointShells(this.shellList),n=!1),this.polyList=Ur.extractPolygons(this.shellList,n)},getDangles:function(){return this.polygonize(),this.dangles},getCutEdges:function(){return this.polygonize(),this.cutEdges},getPolygons:function(){return this.polygonize(),this.polyList},add:function(){if(oo(arguments[0],d))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.add(n)}else if(arguments[0]instanceof It){var i=arguments[0];this.geomFactory=i.getFactory(),null===this.graph&&(this.graph=new Yr(this.geomFactory)),this.graph.addEdge(i)}else if(arguments[0]instanceof F){var r=arguments[0];r.apply(this.lineStringAdder)}},setCheckRingsValid:function(t){this.isCheckingRingsValid=t},findShellsAndHoles:function(t){this.holeList=new x,this.shellList=new x;for(var e=t.iterator();e.hasNext();){var n=e.next();n.computeHole(),n.isHole()?this.holeList.add(n):this.shellList.add(n)}},interfaces_:function(){return[]},getClass:function(){return Ur}}),Ur.findOuterShells=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=n.getOuterHole();null===i||i.isProcessed()||(n.setIncluded(!0),i.setProcessed(!0))}},Ur.extractPolygons=function(t,e){for(var n=new x,i=t.iterator();i.hasNext();){var r=i.next();(e||r.isIncluded())&&n.add(r.getPolygon())}return n},Ur.assignHolesToShells=function(t,e){for(var n=t.iterator();n.hasNext();){var i=n.next();Ur.assignHoleToShell(i,e)}},Ur.assignHoleToShell=function(t,e){var n=zr.findEdgeRingContaining(t,e);null!==n&&n.addHole(t)},Ur.findDisjointShells=function(t){Ur.findOuterShells(t);var e=null;do{e=!1;for(var n=t.iterator();n.hasNext();){var i=n.next();i.isIncludedSet()||(i.updateIncluded(),i.isIncludedSet()||(e=!0))}}while(e)},io(Xr.prototype,{filter:function(t){t instanceof It&&this.p.add(t)},interfaces_:function(){return[A]},getClass:function(){return Xr}}),Ur.LineStringAdder=Xr;var Fo=Object.freeze({Polygonizer:Ur});io(Hr.prototype,{insertEdgeEnds:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.nodes.add(n)}},computeProperIntersectionIM:function(t,e){var n=this.arg[0].getGeometry().getDimension(),i=this.arg[1].getGeometry().getDimension(),r=t.hasProperIntersection(),s=t.hasProperInteriorIntersection();2===n&&2===i?r&&e.setAtLeast("212101212"):2===n&&1===i?(r&&e.setAtLeast("FFF0FFFF2"),s&&e.setAtLeast("1FFFFF1FF")):1===n&&2===i?(r&&e.setAtLeast("F0FFFFFF2"),s&&e.setAtLeast("1F1FFFFFF")):1===n&&1===i&&s&&e.setAtLeast("0FFFFFFFF")},labelIsolatedEdges:function(t,e){for(var n=this.arg[t].getEdgeIterator();n.hasNext();){var i=n.next();i.isIsolated()&&(this.labelIsolatedEdge(i,e,this.arg[e].getGeometry()),this.isolatedEdges.add(i))}},labelIsolatedEdge:function(t,e,n){if(n.getDimension()>0){var i=this.ptLocator.locate(t.getCoordinate(),n);t.getLabel().setAllLocations(e,i)}else t.getLabel().setAllLocations(e,S.EXTERIOR)},computeIM:function(){var t=new ue;if(t.set(S.EXTERIOR,S.EXTERIOR,2),!this.arg[0].getGeometry().getEnvelopeInternal().intersects(this.arg[1].getGeometry().getEnvelopeInternal()))return this.computeDisjointIM(t),t;this.arg[0].computeSelfNodes(this.li,!1),this.arg[1].computeSelfNodes(this.li,!1);var e=this.arg[0].computeEdgeIntersections(this.arg[1],this.li,!1);this.computeIntersectionNodes(0),this.computeIntersectionNodes(1),this.copyNodesAndLabels(0),this.copyNodesAndLabels(1),this.labelIsolatedNodes(),this.computeProperIntersectionIM(e,t);var n=new br,i=n.computeEdgeEnds(this.arg[0].getEdgeIterator());this.insertEdgeEnds(i);var r=n.computeEdgeEnds(this.arg[1].getEdgeIterator());return this.insertEdgeEnds(r),this.labelNodeEdges(),this.labelIsolatedEdges(0,1),this.labelIsolatedEdges(1,0),this.updateIM(t),t},labelNodeEdges:function(){for(var t=this.nodes.iterator();t.hasNext();){t.next().getEdges().computeLabelling(this.arg)}},copyNodesAndLabels:function(t){for(var e=this.arg[t].getNodeIterator();e.hasNext();){var n=e.next();this.nodes.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},labelIntersectionNodes:function(t){for(var e=this.arg[t].getEdgeIterator();e.hasNext();)for(var n=e.next(),i=n.getLabel().getLocation(t),r=n.getEdgeIntersectionList().iterator();r.hasNext();){var s=r.next(),o=this.nodes.find(s.coord);o.getLabel().isNull(t)&&(i===S.BOUNDARY?o.setLabelBoundary(t):o.setLabel(t,S.INTERIOR))}},labelIsolatedNode:function(t,e){var n=this.ptLocator.locate(t.getCoordinate(),this.arg[e].getGeometry());t.getLabel().setAllLocations(e,n)},computeIntersectionNodes:function(t){for(var e=this.arg[t].getEdgeIterator();e.hasNext();)for(var n=e.next(),i=n.getLabel().getLocation(t),r=n.getEdgeIntersectionList().iterator();r.hasNext();){var s=r.next(),o=this.nodes.addNode(s.coord);i===S.BOUNDARY?o.setLabelBoundary(t):o.getLabel().isNull(t)&&o.setLabel(t,S.INTERIOR)}},labelIsolatedNodes:function(){for(var t=this.nodes.iterator();t.hasNext();){var e=t.next(),n=e.getLabel();h.isTrue(n.getGeometryCount()>0,"node with empty label found"),e.isIsolated()&&(n.isNull(0)?this.labelIsolatedNode(e,0):this.labelIsolatedNode(e,1))}},updateIM:function(t){for(var e=this.isolatedEdges.iterator();e.hasNext();){e.next().updateIM(t)}for(var n=this.nodes.iterator();n.hasNext();){var i=n.next();i.updateIM(t),i.updateIMFromEdges(t)}},computeDisjointIM:function(t){var e=this.arg[0].getGeometry();e.isEmpty()||(t.set(S.INTERIOR,S.EXTERIOR,e.getDimension()),t.set(S.BOUNDARY,S.EXTERIOR,e.getBoundaryDimension()));var n=this.arg[1].getGeometry();n.isEmpty()||(t.set(S.EXTERIOR,S.INTERIOR,n.getDimension()),t.set(S.EXTERIOR,S.BOUNDARY,n.getBoundaryDimension()))},interfaces_:function(){return[]},getClass:function(){return Hr}}),io(Wr.prototype,{isContainedInBoundary:function(t){if(t instanceof Lt)return!1;if(t instanceof Ct)return this.isPointContainedInBoundary(t);if(t instanceof It)return this.isLineStringContainedInBoundary(t);for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);if(!this.isContainedInBoundary(n))return!1}return!0},isLineSegmentContainedInBoundary:function(t,e){if(t.equals(e))return this.isPointContainedInBoundary(t);if(t.x===e.x){if(t.x===this.rectEnv.getMinX()||t.x===this.rectEnv.getMaxX())return!0}else if(t.y===e.y&&(t.y===this.rectEnv.getMinY()||t.y===this.rectEnv.getMaxY()))return!0;return!1},isLineStringContainedInBoundary:function(t){for(var e=t.getCoordinateSequence(),n=new c,i=new c,r=0;r<e.size()-1;r++)if(e.getCoordinate(r,n),e.getCoordinate(r+1,i),!this.isLineSegmentContainedInBoundary(n,i))return!1;return!0},isPointContainedInBoundary:function(){if(arguments[0]instanceof Ct){var t=arguments[0];return this.isPointContainedInBoundary(t.getCoordinate())}if(arguments[0]instanceof c){var e=arguments[0];return e.x===this.rectEnv.getMinX()||e.x===this.rectEnv.getMaxX()||e.y===this.rectEnv.getMinY()||e.y===this.rectEnv.getMaxY()}},contains:function(t){return!!this.rectEnv.contains(t.getEnvelopeInternal())&&!this.isContainedInBoundary(t)},interfaces_:function(){return[]},getClass:function(){return Wr}}),Wr.contains=function(t,e){return new Wr(t).contains(e)},io(jr.prototype,{intersects:function(t,e){var n=new I(t,e);if(!this.rectEnv.intersects(n))return!1;if(this.rectEnv.intersects(t))return!0;if(this.rectEnv.intersects(e))return!0;if(t.compareTo(e)>0){var i=t;t=e,e=i}var r=!1;return e.y>t.y&&(r=!0),r?this.li.computeIntersection(t,e,this.diagDown0,this.diagDown1):this.li.computeIntersection(t,e,this.diagUp0,this.diagUp1),!!this.li.hasIntersection()},interfaces_:function(){return[]},getClass:function(){return jr}}),io(Kr.prototype,{applyTo:function(t){for(var e=0;e<t.getNumGeometries()&&!this._isDone;e++){var n=t.getGeometryN(e);if(n instanceof lt)this.applyTo(n);else if(this.visit(n),this.isDone())return this._isDone=!0,null}},interfaces_:function(){return[]},getClass:function(){return Kr}}),io(Zr.prototype,{intersects:function(t){if(!this.rectEnv.intersects(t.getEnvelopeInternal()))return!1;var e=new Qr(this.rectEnv);if(e.applyTo(t),e.intersects())return!0;var n=new Jr(this.rectangle);if(n.applyTo(t),n.containsPoint())return!0;var i=new $r(this.rectangle);return i.applyTo(t),!!i.intersects()},interfaces_:function(){return[]},getClass:function(){return Zr}}),Zr.intersects=function(t,e){return new Zr(t).intersects(e)},ro(Qr,Kr),io(Qr.prototype,{isDone:function(){return!0===this._intersects},visit:function(t){var e=t.getEnvelopeInternal();return this.rectEnv.intersects(e)?this.rectEnv.contains(e)?(this._intersects=!0,null):e.getMinX()>=this.rectEnv.getMinX()&&e.getMaxX()<=this.rectEnv.getMaxX()?(this._intersects=!0,null):e.getMinY()>=this.rectEnv.getMinY()&&e.getMaxY()<=this.rectEnv.getMaxY()?(this._intersects=!0,null):void 0:null},intersects:function(){return this._intersects},interfaces_:function(){return[]},getClass:function(){return Qr}}),ro(Jr,Kr),io(Jr.prototype,{isDone:function(){return!0===this._containsPoint},visit:function(t){if(!(t instanceof Lt))return null;var e=t.getEnvelopeInternal();if(!this.rectEnv.intersects(e))return null;for(var n=new c,i=0;i<4;i++)if(this.rectSeq.getCoordinate(i,n),e.contains(n)&&Sn.containsPointInPolygon(n,t))return this._containsPoint=!0,null},containsPoint:function(){return this._containsPoint},interfaces_:function(){return[]},getClass:function(){return Jr}}),ro($r,Kr),io($r.prototype,{intersects:function(){return this.hasIntersection},isDone:function(){return!0===this.hasIntersection},visit:function(t){var e=t.getEnvelopeInternal();if(!this.rectEnv.intersects(e))return null;var n=qn.getLines(t);this.checkIntersectionWithLineStrings(n)},checkIntersectionWithLineStrings:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();if(this.checkIntersectionWithSegments(n),this.hasIntersection)return null}},checkIntersectionWithSegments:function(t){for(var e=t.getCoordinateSequence(),n=1;n<e.size();n++)if(e.getCoordinate(n-1,this.p0),e.getCoordinate(n,this.p1),this.rectIntersector.intersects(this.p0,this.p1))return this.hasIntersection=!0,null},interfaces_:function(){return[]},getClass:function(){return $r}}),ro(ts,Zn),io(ts.prototype,{getIntersectionMatrix:function(){return this._relate.computeIM()},interfaces_:function(){return[]},getClass:function(){return ts}}),ts.covers=function(t,e){return!!t.getEnvelopeInternal().covers(e.getEnvelopeInternal())&&(!!t.isRectangle()||ts.relate(t,e).isCovers())},ts.intersects=function(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&(t.isRectangle()?Zr.intersects(t,e):e.isRectangle()?Zr.intersects(e,t):ts.relate(t,e).isIntersects())},ts.touches=function(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&ts.relate(t,e).isTouches(t.getDimension(),e.getDimension())},ts.within=function(t,e){return e.contains(t)},ts.coveredBy=function(t,e){return ts.covers(e,t)},ts.relate=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new ts(t,e),i=n.getIntersectionMatrix();return i}if(3===arguments.length){if("string"==typeof arguments[2]&&arguments[0]instanceof F&&arguments[1]instanceof F){var r=arguments[0],s=arguments[1],o=arguments[2];return ts.relateWithCheck(r,s).matches(o)}if(oo(arguments[2],q)&&arguments[0]instanceof F&&arguments[1]instanceof F){var a=arguments[0],u=arguments[1],l=arguments[2],n=new ts(a,u,l),i=n.getIntersectionMatrix();return i}}},ts.overlaps=function(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&ts.relate(t,e).isOverlaps(t.getDimension(),e.getDimension())},ts.disjoint=function(t,e){return!t.intersects(e)},ts.relateWithCheck=function(t,e){return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ts.relate(t,e)},ts.crosses=function(t,e){return!!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal())&&ts.relate(t,e).isCrosses(t.getDimension(),e.getDimension())},ts.contains=function(t,e){return!!t.getEnvelopeInternal().contains(e.getEnvelopeInternal())&&(t.isRectangle()?Wr.contains(t,e):ts.relate(t,e).isContains())};var Go=Object.freeze({RelateOp:ts});io(es.prototype,{extractElements:function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var i=t.getGeometryN(n);this.skipEmpty&&i.isEmpty()||e.add(i)}},combine:function(){for(var t=new x,e=this.inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this.geomFactory?this.geomFactory.createGeometryCollection(null):null:this.geomFactory.buildGeometry(t)},interfaces_:function(){return[]},getClass:function(){return es}}),es.combine=function(){if(1===arguments.length){var t=arguments[0],e=new es(t);return e.combine()}if(2===arguments.length){var n=arguments[0],i=arguments[1],e=new es(es.createList(n,i));return e.combine()}if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2],e=new es(es.createList(r,s,o));return e.combine()}},es.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},es.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new x;return n.add(t),n.add(e),n}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],n=new x;return n.add(i),n.add(r),n.add(s),n}},io(ns.prototype,{union:function(){for(var t=new Se,e=new rt,n=0;n<this.pointGeom.getNumGeometries();n++){var i=this.pointGeom.getGeometryN(n),r=i.getCoordinate();t.locate(r,this.otherGeom)===S.EXTERIOR&&e.add(r)}if(0===e.size())return this.otherGeom;var s=null,o=Y.toCoordinateArray(e);return s=1===o.length?this.geomFact.createPoint(o[0]):this.geomFact.createMultiPointFromCoords(o),es.combine(s,this.otherGeom)},interfaces_:function(){return[]},getClass:function(){return ns}}),ns.union=function(t,e){return new ns(t,e).union()},io(is.prototype,{filter:function(t){-1!==this.sortIndex&&t.getSortIndex()!==this.sortIndex||this.comps.add(t)},interfaces_:function(){return[at]},getClass:function(){return is}}),is.extract=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return is.extract(t,e,new x)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];return n.getSortIndex()===i?r.add(n):n instanceof lt&&n.apply(new is(i,r)),r}},io(rs.prototype,{reduceToGeometries:function(t){for(var e=new x,n=t.iterator();n.hasNext();){var i=n.next(),r=null;oo(i,m)?r=this.unionTree(i):i instanceof F&&(r=i),e.add(r)}return e},extractByEnvelope:function(t,e,n){for(var i=new x,r=0;r<e.getNumGeometries();r++){var s=e.getGeometryN(r);s.getEnvelopeInternal().intersects(t)?i.add(s):n.add(s)}return this.geomFactory.buildGeometry(i)},unionOptimized:function(t,e){var n=t.getEnvelopeInternal(),i=e.getEnvelopeInternal();if(!n.intersects(i)){return es.combine(t,e)}if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var r=n.intersection(i);return this.unionUsingEnvelopeIntersection(t,e,r)},union:function(){if(null===this.inputPolys)throw new IllegalStateException("union() method cannot be called twice");if(this.inputPolys.isEmpty())return null;this.geomFactory=this.inputPolys.iterator().next().getFactory();for(var t=new qe(rs.STRTREE_NODE_CAPACITY),e=this.inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this.inputPolys=null;var i=t.itemsTree();return this.unionTree(i)},binaryUnion:function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],n=arguments[1],i=arguments[2];if(i-n<=1){var r=rs.getGeometry(e,n);return this.unionSafe(r,null)}if(i-n==2)return this.unionSafe(rs.getGeometry(e,n),rs.getGeometry(e,n+1));var s=Math.trunc((i+n)/2),r=this.binaryUnion(e,n,s),o=this.binaryUnion(e,s,i);return this.unionSafe(r,o)}},repeatedUnion:function(t){for(var e=null,n=t.iterator();n.hasNext();){var i=n.next();e=null===e?i.copy():e.union(i)}return e},unionSafe:function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},unionActual:function(t,e){return rs.restrictToPolygons(t.union(e))},unionTree:function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},unionUsingEnvelopeIntersection:function(t,e,n){var i=new x,r=this.extractByEnvelope(n,t,i),s=this.extractByEnvelope(n,e,i),o=this.unionActual(r,s);return i.add(o),es.combine(i)},bufferUnion:function(){if(1===arguments.length){var t=arguments[0],e=t.get(0).getFactory(),n=e.buildGeometry(t),i=n.buffer(0);return i}if(2===arguments.length){var r=arguments[0],s=arguments[1],e=r.getFactory(),n=e.createGeometryCollection([r,s]),i=n.buffer(0);return i}},interfaces_:function(){return[]},getClass:function(){return rs}}),rs.restrictToPolygons=function(t){if(oo(t,St))return t;var e=cr.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon($t.toPolygonArray(e))},rs.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},rs.union=function(t){return new rs(t).union()},rs.STRTREE_NODE_CAPACITY=4,io(ss.prototype,{unionNoOpt:function(t){var e=this.geomFact.createPoint();return ei.overlayOp(t,e,$n.UNION)},unionWithNull:function(t,e){return null===t&&null===e?null:null===e?t:null===t?e:t.union(e)},extract:function(){if(oo(arguments[0],d))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.extract(n)}else if(arguments[0]instanceof F){var i=arguments[0];null===this.geomFact&&(this.geomFact=i.getFactory()),is.extract(i,F.SORTINDEX_POLYGON,this.polygons),is.extract(i,F.SORTINDEX_LINESTRING,this.lines),is.extract(i,F.SORTINDEX_POINT,this.points)}},union:function(){if(null===this.geomFact)return null;var t=null;if(this.points.size()>0){var e=this.geomFact.buildGeometry(this.points);t=this.unionNoOpt(e)}var n=null;if(this.lines.size()>0){var i=this.geomFact.buildGeometry(this.lines);n=this.unionNoOpt(i)}var r=null;this.polygons.size()>0&&(r=rs.union(this.polygons));var s=this.unionWithNull(n,r),o=null;return o=null===t?s:null===s?t:ns.union(t,s),null===o?this.geomFact.createGeometryCollection():o},interfaces_:function(){return[]},getClass:function(){return ss}}),ss.union=function(){if(1===arguments.length){if(oo(arguments[0],d)){var t=arguments[0],e=new ss(t);return e.union()}if(arguments[0]instanceof F){var n=arguments[0],e=new ss(n);return e.union()}}else if(2===arguments.length){var i=arguments[0],r=arguments[1],e=new ss(i,r);return e.union()}};var qo=Object.freeze({UnaryUnionOp:ss}),Bo=Object.freeze({IsValidOp:Vr,ConsistentAreaTester:Gr}),Vo=Object.freeze({BoundaryOp:ct,IsSimpleOp:Yi,buffer:_o,distance:Mo,linemerge:Do,overlay:Ao,polygonize:Fo,relate:Go,union:qo,valid:Bo});ro(os,Ot.CoordinateOperation),io(os.prototype,{editCoordinates:function(t,e){if(0===t.length)return null;for(var n=new Array(t.length).fill(null),i=0;i<t.length;i++){var r=new c(t[i]);this.targetPM.makePrecise(r),n[i]=r}var s=new E(n,!1),o=s.toCoordinateArray(),a=0;e instanceof It&&(a=2),e instanceof Rt&&(a=4);var u=n;return this.removeCollapsed&&(u=null),o.length<a?u:o},interfaces_:function(){return[]},getClass:function(){return os}}),io(as.prototype,{fixPolygonalTopology:function(t){var e=t;this.changePrecisionModel||(e=this.changePM(t,this.targetPM));var n=e.buffer(0),i=n;return this.changePrecisionModel||(i=this.changePM(n,t.getPrecisionModel())),i},reducePointwise:function(t){var e=null;if(this.changePrecisionModel){e=new Ot(this.createFactory(t.getFactory(),this.targetPM))}else e=new Ot;var n=this.removeCollapsed;return t.getDimension()>=2&&(n=!0),e.edit(t,new os(this.targetPM,n))},changePM:function(t,e){return this.createEditor(t.getFactory(),e).edit(t,new Ot.NoOpGeometryOperation)},setRemoveCollapsedComponents:function(t){this.removeCollapsed=t},createFactory:function(t,e){return new $t(e,t.getSRID(),t.getCoordinateSequenceFactory())},setChangePrecisionModel:function(t){this.changePrecisionModel=t},reduce:function(t){var e=this.reducePointwise(t);return this.isPointwise?e:oo(e,St)?e.isValid()?e:this.fixPolygonalTopology(e):e},setPointwise:function(t){this.isPointwise=t},createEditor:function(t,e){return t.getPrecisionModel()===e?new Ot:new Ot(this.createFactory(t,e))},interfaces_:function(){return[]},getClass:function(){return as}}),as.reduce=function(t,e){return new as(e).reduce(t)},as.reducePointwise=function(t,e){var n=new as(e);return n.setPointwise(!0),n.reduce(t)};var zo=Object.freeze({GeometryPrecisionReducer:as});io(us.prototype,{simplifySection:function(t,e){if(t+1===e)return null;this.seg.p0=this.pts[t],this.seg.p1=this.pts[e];for(var n=-1,i=t,r=t+1;r<e;r++){var s=this.seg.distance(this.pts[r]);s>n&&(n=s,i=r)}if(n<=this.distanceTolerance)for(var r=t+1;r<e;r++)this.usePt[r]=!1;else this.simplifySection(t,i),this.simplifySection(i,e)},setDistanceTolerance:function(t){this.distanceTolerance=t},simplify:function(){this.usePt=new Array(this.pts.length).fill(null);for(var t=0;t<this.pts.length;t++)this.usePt[t]=!0;this.simplifySection(0,this.pts.length-1);for(var e=new E,t=0;t<this.pts.length;t++)this.usePt[t]&&e.add(new c(this.pts[t]));return e.toCoordinateArray()},interfaces_:function(){return[]},getClass:function(){return us}}),us.simplify=function(t,e){var n=new us(t);return n.setDistanceTolerance(e),n.simplify()},io(ls.prototype,{setEnsureValid:function(t){this.isEnsureValidTopology=t},getResultGeometry:function(){return this.inputGeom.isEmpty()?this.inputGeom.copy():new hs(this.isEnsureValidTopology,this.distanceTolerance).transform(this.inputGeom)},setDistanceTolerance:function(t){if(t<0)throw new n("Tolerance must be non-negative");this.distanceTolerance=t},interfaces_:function(){return[]},getClass:function(){return ls}}),ls.simplify=function(t,e){var n=new ls(t);return n.setDistanceTolerance(e),n.getResultGeometry()},ro(hs,pe),io(hs.prototype,{transformPolygon:function(t,e){if(t.isEmpty())return null;var n=pe.prototype.transformPolygon.call(this,t,e);return e instanceof Tt?n:this.createValidArea(n)},createValidArea:function(t){return this.isEnsureValidTopology?t.buffer(0):t},transformCoordinates:function(t,e){var n=t.toCoordinateArray(),i=null;return i=0===n.length?new Array(0).fill(null):us.simplify(n,this.distanceTolerance),this.factory.getCoordinateSequenceFactory().create(i)},transformMultiPolygon:function(t,e){var n=pe.prototype.transformMultiPolygon.call(this,t,e);return this.createValidArea(n)},transformLinearRing:function(t,e){var n=e instanceof Lt,i=pe.prototype.transformLinearRing.call(this,t,e);return!n||i instanceof Rt?i:null},interfaces_:function(){return[]},getClass:function(){return hs}}),ls.DPTransformer=hs,ro(cs,ae),io(cs.prototype,{getIndex:function(){return this.index},getParent:function(){return this.parent},interfaces_:function(){return[]},getClass:function(){return cs}}),io(fs.prototype,{addToResult:function(t){this.resultSegs.add(t)},asLineString:function(){return this.parentLine.getFactory().createLineString(fs.extractCoordinates(this.resultSegs))},getResultSize:function(){var t=this.resultSegs.size();return 0===t?0:t+1},getParent:function(){return this.parentLine},getSegment:function(t){return this.segs[t]},getParentCoordinates:function(){return this.parentLine.getCoordinates()},getMinimumSize:function(){return this.minimumSize},asLinearRing:function(){return this.parentLine.getFactory().createLinearRing(fs.extractCoordinates(this.resultSegs))},getSegments:function(){return this.segs},init:function(){var t=this.parentLine.getCoordinates();this.segs=new Array(t.length-1).fill(null);for(var e=0;e<t.length-1;e++){var n=new cs(t[e],t[e+1],this.parentLine,e);this.segs[e]=n}},getResultCoordinates:function(){return fs.extractCoordinates(this.resultSegs)},interfaces_:function(){return[]},getClass:function(){return fs}}),fs.extractCoordinates=function(t){for(var e=new Array(t.size()+1).fill(null),n=null,i=0;i<t.size();i++)n=t.get(i),e[i]=n.p0;return e[e.length-1]=n.p1,e},io(gs.prototype,{remove:function(t){this.index.remove(new I(t.p0,t.p1),t)},add:function(){if(arguments[0]instanceof fs)for(var t=arguments[0],e=t.getSegments(),n=0;n<e.length;n++){var i=e[n];this.add(i)}else if(arguments[0]instanceof ae){var r=arguments[0];this.index.insert(new I(r.p0,r.p1),r)}},query:function(t){var e=new I(t.p0,t.p1),n=new ds(t);return this.index.query(e,n),n.getItems()},interfaces_:function(){return[]},getClass:function(){return gs}}),io(ds.prototype,{visitItem:function(t){var e=t;I.intersects(e.p0,e.p1,this.querySeg.p0,this.querySeg.p1)&&this.items.add(t)},getItems:function(){return this.items},interfaces_:function(){return[be]},getClass:function(){return ds}}),io(ps.prototype,{flatten:function(t,e){var n=this.linePts[t],i=this.linePts[e],r=new ae(n,i);return this.remove(this.line,t,e),this.outputIndex.add(r),r},hasBadIntersection:function(t,e,n){return!!this.hasBadOutputIntersection(n)||!!this.hasBadInputIntersection(t,e,n)},setDistanceTolerance:function(t){this.distanceTolerance=t},simplifySection:function(t,e,n){n+=1;var i=new Array(2).fill(null);if(t+1===e){var r=this.line.getSegment(t);return this.line.addToResult(r),null}var s=!0;if(this.line.getResultSize()<this.line.getMinimumSize()){n+1<this.line.getMinimumSize()&&(s=!1)}var o=new Array(1).fill(null),a=this.findFurthestPoint(this.linePts,t,e,o);o[0]>this.distanceTolerance&&(s=!1);var u=new ae;if(u.p0=this.linePts[t],u.p1=this.linePts[e],i[0]=t,i[1]=e,this.hasBadIntersection(this.line,i,u)&&(s=!1),s){var r=this.flatten(t,e);return this.line.addToResult(r),null}this.simplifySection(t,a,n),this.simplifySection(a,e,n)},hasBadOutputIntersection:function(t){for(var e=this.outputIndex.query(t),n=e.iterator();n.hasNext();){var i=n.next();if(this.hasInteriorIntersection(i,t))return!0}return!1},findFurthestPoint:function(t,e,n,i){var r=new ae;r.p0=t[e],r.p1=t[n];for(var s=-1,o=e,a=e+1;a<n;a++){var u=t[a],l=r.distance(u);l>s&&(s=l,o=a)}return i[0]=s,o},simplify:function(t){this.line=t,this.linePts=t.getParentCoordinates(),this.simplifySection(0,this.linePts.length-1,0)},remove:function(t,e,n){for(var i=e;i<n;i++){var r=t.getSegment(i);this.inputIndex.remove(r)}},hasInteriorIntersection:function(t,e){return this.li.computeIntersection(t.p0,t.p1,e.p0,e.p1),this.li.isInteriorIntersection()},hasBadInputIntersection:function(t,e,n){for(var i=this.inputIndex.query(n),r=i.iterator();r.hasNext();){var s=r.next();if(this.hasInteriorIntersection(s,n)){if(ps.isInLineSection(t,e,s))continue;return!0}}return!1},interfaces_:function(){return[]},getClass:function(){return ps}}),ps.isInLineSection=function(t,e,n){if(n.getParent()!==t.getParent())return!1;var i=n.getIndex();return i>=e[0]&&i<e[1]},io(ms.prototype,{setDistanceTolerance:function(t){this.distanceTolerance=t},simplify:function(t){for(var e=t.iterator();e.hasNext();)this.inputIndex.add(e.next());for(var e=t.iterator();e.hasNext();){var n=new ps(this.inputIndex,this.outputIndex);n.setDistanceTolerance(this.distanceTolerance),n.simplify(e.next())}},interfaces_:function(){return[]},getClass:function(){return ms}}),io(vs.prototype,{getResultGeometry:function(){return this.inputGeom.isEmpty()?this.inputGeom.copy():(this.linestringMap=new Zt,this.inputGeom.apply(new xs(this)),this.lineSimplifier.simplify(this.linestringMap.values()),new ys(this.linestringMap).transform(this.inputGeom))},setDistanceTolerance:function(t){if(t<0)throw new n("Tolerance must be non-negative");this.lineSimplifier.setDistanceTolerance(t)},interfaces_:function(){return[]},getClass:function(){return vs}}),vs.simplify=function(t,e){var n=new vs(t);return n.setDistanceTolerance(e),n.getResultGeometry()},ro(ys,pe),io(ys.prototype,{transformCoordinates:function(t,e){if(0===t.size())return null;if(e instanceof It){var n=this.linestringMap.get(e);return this.createCoordinateSequence(n.getResultCoordinates())}return pe.prototype.transformCoordinates.call(this,t,e)},interfaces_:function(){return[]},getClass:function(){return ys}}),io(xs.prototype,{filter:function(t){if(t instanceof It){var e=t;if(e.isEmpty())return null;var n=e.isClosed()?4:2,i=new fs(e,n);this.tps.linestringMap.put(e,i)}},interfaces_:function(){return[A]},getClass:function(){return xs}}),vs.LineStringTransformer=ys,vs.LineStringMapBuilderFilter=xs;var ko=Object.freeze({DouglasPeuckerSimplifier:ls,TopologyPreservingSimplifier:vs});io(Es.prototype,{splitAt:function(){if(1===arguments.length){var t=arguments[0],e=this.minimumLen/this.segLen;if(t.distance(this.seg.p0)<this.minimumLen)return this.splitPt=this.seg.pointAlong(e),null;if(t.distance(this.seg.p1)<this.minimumLen)return this.splitPt=Es.pointAlongReverse(this.seg,e),null;this.splitPt=t}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=this.getConstrainedLength(n),s=r/this.segLen;i.equals2D(this.seg.p0)?this.splitPt=this.seg.pointAlong(s):this.splitPt=Es.pointAlongReverse(this.seg,s)}},setMinimumLength:function(t){this.minimumLen=t},getConstrainedLength:function(t){return t<this.minimumLen?this.minimumLen:t},getSplitPoint:function(){return this.splitPt},interfaces_:function(){return[]},getClass:function(){return Es}}),Es.pointAlongReverse=function(t,e){var n=new c;return n.x=t.p1.x-e*(t.p1.x-t.p0.x),n.y=t.p1.y-e*(t.p1.y-t.p0.y),n},io(Is.prototype,{findSplitPoint:function(t,e){},interfaces_:function(){return[]},getClass:function(){return Is}}),io(Ns.prototype,{findSplitPoint:function(t,e){var n=t.getLineSegment(),i=n.getLength(),r=i/2,s=new Es(n),o=Ns.projectedSplitPoint(t,e),a=2*o.distance(e)*.8,u=a;return u>r&&(u=r),s.setMinimumLength(u),s.splitAt(o),s.getSplitPoint()},interfaces_:function(){return[Is]},getClass:function(){return Ns}}),Ns.projectedSplitPoint=function(t,e){return t.getLineSegment().project(e)},io(Cs.prototype,{interfaces_:function(){return[]},getClass:function(){return Cs}}),Cs.triArea=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(e.y-t.y)*(n.x-t.x)},Cs.isInCircleDDNormalized=function(t,e,n,i){var r=O.valueOf(t.x).selfSubtract(i.x),s=O.valueOf(t.y).selfSubtract(i.y),o=O.valueOf(e.x).selfSubtract(i.x),a=O.valueOf(e.y).selfSubtract(i.y),u=O.valueOf(n.x).selfSubtract(i.x),l=O.valueOf(n.y).selfSubtract(i.y),h=r.multiply(a).selfSubtract(o.multiply(s)),c=o.multiply(l).selfSubtract(u.multiply(a)),f=u.multiply(s).selfSubtract(r.multiply(l)),g=r.multiply(r).selfAdd(s.multiply(s)),d=o.multiply(o).selfAdd(a.multiply(a)),p=u.multiply(u).selfAdd(l.multiply(l));return g.selfMultiply(c).selfAdd(d.selfMultiply(f)).selfAdd(p.selfMultiply(h)).doubleValue()>0},Cs.checkRobustInCircle=function(t,e,n,i){var r=Cs.isInCircleNonRobust(t,e,n,i),s=Cs.isInCircleDDSlow(t,e,n,i),o=Cs.isInCircleCC(t,e,n,i),a=Ei.circumcentre(t,e,n);_.out.println("p radius diff a = "+Math.abs(i.distance(a)-t.distance(a))/t.distance(a)),r===s&&r===o||(_.out.println("inCircle robustness failure (double result = "+r+", DD result = "+s+", CC result = "+o+")"),_.out.println(ee.toLineString(new Dt([t,e,n,i]))),_.out.println("Circumcentre = "+ee.toPoint(a)+" radius = "+t.distance(a)),_.out.println("p radius diff a = "+Math.abs(i.distance(a)/t.distance(a)-1)),
_.out.println("p radius diff b = "+Math.abs(i.distance(a)/e.distance(a)-1)),_.out.println("p radius diff c = "+Math.abs(i.distance(a)/n.distance(a)-1)),_.out.println())},Cs.isInCircleDDFast=function(t,e,n,i){var r=O.sqr(t.x).selfAdd(O.sqr(t.y)).selfMultiply(Cs.triAreaDDFast(e,n,i)),s=O.sqr(e.x).selfAdd(O.sqr(e.y)).selfMultiply(Cs.triAreaDDFast(t,n,i)),o=O.sqr(n.x).selfAdd(O.sqr(n.y)).selfMultiply(Cs.triAreaDDFast(t,e,i)),a=O.sqr(i.x).selfAdd(O.sqr(i.y)).selfMultiply(Cs.triAreaDDFast(t,e,n));return r.selfSubtract(s).selfAdd(o).selfSubtract(a).doubleValue()>0},Cs.isInCircleCC=function(t,e,n,i){var r=Ei.circumcentre(t,e,n),s=t.distance(r);return i.distance(r)-s<=0},Cs.isInCircleNormalized=function(t,e,n,i){var r=t.x-i.x,s=t.y-i.y,o=e.x-i.x,a=e.y-i.y,u=n.x-i.x,l=n.y-i.y;return(r*r+s*s)*(o*l-u*a)+(o*o+a*a)*(u*s-r*l)+(u*u+l*l)*(r*a-o*s)>0},Cs.isInCircleDDSlow=function(t,e,n,i){var r=O.valueOf(i.x),s=O.valueOf(i.y),o=O.valueOf(t.x),a=O.valueOf(t.y),u=O.valueOf(e.x),l=O.valueOf(e.y),h=O.valueOf(n.x),c=O.valueOf(n.y),f=o.multiply(o).add(a.multiply(a)).multiply(Cs.triAreaDDSlow(u,l,h,c,r,s)),g=u.multiply(u).add(l.multiply(l)).multiply(Cs.triAreaDDSlow(o,a,h,c,r,s)),d=h.multiply(h).add(c.multiply(c)).multiply(Cs.triAreaDDSlow(o,a,u,l,r,s)),p=r.multiply(r).add(s.multiply(s)).multiply(Cs.triAreaDDSlow(o,a,u,l,h,c));return f.subtract(g).add(d).subtract(p).doubleValue()>0},Cs.isInCircleNonRobust=function(t,e,n,i){return(t.x*t.x+t.y*t.y)*Cs.triArea(e,n,i)-(e.x*e.x+e.y*e.y)*Cs.triArea(t,n,i)+(n.x*n.x+n.y*n.y)*Cs.triArea(t,e,i)-(i.x*i.x+i.y*i.y)*Cs.triArea(t,e,n)>0},Cs.isInCircleRobust=function(t,e,n,i){return Cs.isInCircleNormalized(t,e,n,i)},Cs.triAreaDDSlow=function(t,e,n,i,r,s){return n.subtract(t).multiply(s.subtract(e)).subtract(i.subtract(e).multiply(r.subtract(t)))},Cs.triAreaDDFast=function(t,e,n){var i=O.valueOf(e.x).selfSubtract(t.x).selfMultiply(O.valueOf(n.y).selfSubtract(t.y)),r=O.valueOf(e.y).selfSubtract(t.y).selfMultiply(O.valueOf(n.x).selfSubtract(t.x));return i.selfSubtract(r)},io(Ss.prototype,{circleCenter:function(t,e){var n=new Ss(this.getX(),this.getY()),i=this.bisector(n,t),r=this.bisector(t,e),s=new M(i,r),o=null;try{o=new Ss(s.getX(),s.getY())}catch(i){if(!(i instanceof C))throw i;_.err.println("a: "+n+" b: "+t+" c: "+e),_.err.println(i)}return o},dot:function(t){return this.p.x*t.getX()+this.p.y*t.getY()},magn:function(){return Math.sqrt(this.p.x*this.p.x+this.p.y*this.p.y)},getZ:function(){return this.p.z},bisector:function(t,e){var n=e.getX()-t.getX(),i=e.getY()-t.getY();return new M(new M(t.getX()+n/2,t.getY()+i/2,1),new M(t.getX()-i+n/2,t.getY()+n+i/2,1))},equals:function(){if(1===arguments.length){var t=arguments[0];return this.p.x===t.getX()&&this.p.y===t.getY()}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.p.distance(e.getCoordinate())<n}},getCoordinate:function(){return this.p},isInCircle:function(t,e,n){return Cs.isInCircleRobust(t.p,e.p,n.p,this.p)},interpolateZValue:function(t,e,n){var i=t.getX(),r=t.getY(),s=e.getX()-i,o=n.getX()-i,a=e.getY()-r,u=n.getY()-r,l=s*u-o*a,h=this.getX()-i,c=this.getY()-r,f=(u*h-o*c)/l,g=(-a*h+s*c)/l;return t.getZ()+f*(e.getZ()-t.getZ())+g*(n.getZ()-t.getZ())},midPoint:function(t){return new Ss((this.p.x+t.getX())/2,(this.p.y+t.getY())/2,(this.p.z+t.getZ())/2)},rightOf:function(t){return this.isCCW(t.dest(),t.orig())},isCCW:function(t,e){return(t.p.x-this.p.x)*(e.p.y-this.p.y)-(t.p.y-this.p.y)*(e.p.x-this.p.x)>0},getX:function(){return this.p.x},crossProduct:function(t){return this.p.x*t.getY()-this.p.y*t.getX()},setZ:function(t){this.p.z=t},times:function(t){return new Ss(t*this.p.x,t*this.p.y)},cross:function(){return new Ss(this.p.y,-this.p.x)},leftOf:function(t){return this.isCCW(t.orig(),t.dest())},toString:function(){return"POINT ("+this.p.x+" "+this.p.y+")"},sub:function(t){return new Ss(this.p.x-t.getX(),this.p.y-t.getY())},getY:function(){return this.p.y},classify:function(t,e){var n=this,i=e.sub(t),r=n.sub(t),s=i.crossProduct(r);return s>0?Ss.LEFT:s<0?Ss.RIGHT:i.getX()*r.getX()<0||i.getY()*r.getY()<0?Ss.BEHIND:i.magn()<r.magn()?Ss.BEYOND:t.equals(n)?Ss.ORIGIN:e.equals(n)?Ss.DESTINATION:Ss.BETWEEN},sum:function(t){return new Ss(this.p.x+t.getX(),this.p.y+t.getY())},distance:function(t,e){return Math.sqrt(Math.pow(e.getX()-t.getX(),2)+Math.pow(e.getY()-t.getY(),2))},circumRadiusRatio:function(t,e){var n=this.circleCenter(t,e),i=this.distance(n,t),r=this.distance(this,t),s=this.distance(t,e);return s<r&&(r=s),s=this.distance(e,this),s<r&&(r=s),i/r},interfaces_:function(){return[]},getClass:function(){return Ss}}),Ss.interpolateZ=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=e.distance(n),r=t.distance(e),s=n.z-e.z;return e.z+s*(r/i)}if(4===arguments.length){var o=arguments[0],a=arguments[1],u=arguments[2],l=arguments[3],h=a.x,c=a.y,f=u.x-h,g=l.x-h,d=u.y-c,p=l.y-c,m=f*p-g*d,v=o.x-h,y=o.y-c,x=(p*v-g*y)/m,E=(-d*v+f*y)/m;return a.z+x*(u.z-a.z)+E*(l.z-a.z)}},Ss.LEFT=0,Ss.RIGHT=1,Ss.BEYOND=2,Ss.BEHIND=3,Ss.BETWEEN=4,Ss.ORIGIN=5,Ss.DESTINATION=6,ro(Ls,Ss),io(Ls.prototype,{getConstraint:function(){return this.constraint},setOnConstraint:function(t){this._isOnConstraint=t},merge:function(t){t._isOnConstraint&&(this._isOnConstraint=!0,this.constraint=t.constraint)},isOnConstraint:function(){return this._isOnConstraint},setConstraint:function(t){this._isOnConstraint=!0,this.constraint=t},interfaces_:function(){return[]},getClass:function(){return Ls}}),io(ws.prototype,{equalsNonOriented:function(t){return!!this.equalsOriented(t)||!!this.equalsOriented(t.sym())},toLineSegment:function(){return new ae(this.vertex.getCoordinate(),this.dest().getCoordinate())},dest:function(){return this.sym().orig()},oNext:function(){return this.next},equalsOriented:function(t){return!(!this.orig().getCoordinate().equals2D(t.orig().getCoordinate())||!this.dest().getCoordinate().equals2D(t.dest().getCoordinate()))},dNext:function(){return this.sym().oNext().sym()},lPrev:function(){return this.next.sym()},rPrev:function(){return this.sym().oNext()},rot:function(){return this._rot},oPrev:function(){return this._rot.next._rot},sym:function(){return this._rot._rot},setOrig:function(t){this.vertex=t},lNext:function(){return this.invRot().oNext().rot()},getLength:function(){return this.orig().getCoordinate().distance(this.dest().getCoordinate())},invRot:function(){return this._rot.sym()},setDest:function(t){this.sym().setOrig(t)},setData:function(t){this.data=t},getData:function(){return this.data},delete:function(){this._rot=null},orig:function(){return this.vertex},rNext:function(){return this._rot.next.invRot()},toString:function(){var t=this.vertex.getCoordinate(),e=this.dest().getCoordinate();return ee.toLineString(t,e)},isLive:function(){return null!==this._rot},getPrimary:function(){return this.orig().getCoordinate().compareTo(this.dest().getCoordinate())<=0?this:this.sym()},dPrev:function(){return this.invRot().oNext().invRot()},setNext:function(t){this.next=t},interfaces_:function(){return[]},getClass:function(){return ws}}),ws.makeEdge=function(t,e){var n=new ws,i=new ws,r=new ws,s=new ws;n._rot=i,i._rot=r,r._rot=s,s._rot=n,n.setNext(n),i.setNext(s),r.setNext(r),s.setNext(i);var o=n;return o.setOrig(t),o.setDest(e),o},ws.swap=function(t){var e=t.oPrev(),n=t.sym().oPrev();ws.splice(t,e),ws.splice(t.sym(),n),ws.splice(t,e.lNext()),ws.splice(t.sym(),n.lNext()),t.setOrig(e.dest()),t.setDest(n.dest())},ws.splice=function(t,e){var n=t.oNext().rot(),i=e.oNext().rot(),r=e.oNext(),s=t.oNext(),o=i.oNext(),a=n.oNext();t.setNext(r),e.setNext(s),n.setNext(o),i.setNext(a)},ws.connect=function(t,e){var n=ws.makeEdge(t.dest(),e.orig());return ws.splice(n,t.lNext()),ws.splice(n.sym(),e),n},io(Rs.prototype,{insertSite:function(t){var e=this.subdiv.locate(t);if(this.subdiv.isVertexOfEdge(e,t))return e;this.subdiv.isOnEdge(e,t.getCoordinate())&&(e=e.oPrev(),this.subdiv.delete(e.oNext()));var n=this.subdiv.makeEdge(e.orig(),t);ws.splice(n,e);var i=n;do{n=this.subdiv.connect(e,n.sym()),e=n.oPrev()}while(e.lNext()!==i);for(;;){var r=e.oPrev();if(r.dest().rightOf(e)&&t.isInCircle(e.orig(),r.dest(),e.dest()))ws.swap(e),e=e.oPrev();else{if(e.oNext()===i)return n;e=e.oNext().lPrev()}}},insertSites:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertSite(n)}},interfaces_:function(){return[]},getClass:function(){return Rs}}),io(Ts.prototype,{locate:function(t){},interfaces_:function(){return[]},getClass:function(){return Ts}}),io(Os.prototype,{init:function(){this.lastEdge=this.findEdge()},locate:function(t){this.lastEdge.isLive()||this.init();var e=this.subdiv.locateFromEdge(t,this.lastEdge);return this.lastEdge=e,e},findEdge:function(){return this.subdiv.getEdges().iterator().next()},interfaces_:function(){return[Ts]},getClass:function(){return Os}}),ro(Ps,u),io(Ps.prototype,{getSegment:function(){return this.seg},interfaces_:function(){return[]},getClass:function(){return Ps}}),Ps.msgWithSpatial=function(t,e){return null!==e?t+" [ "+e+" ]":t},io(bs.prototype,{visit:function(t){},interfaces_:function(){return[]},getClass:function(){return bs}}),io(_s.prototype,{getTriangleVertices:function(t){var e=new As;return this.visitTriangles(e,t),e.getTriangleVertices()},isFrameVertex:function(t){return!!t.equals(this.frameVertex[0])||(!!t.equals(this.frameVertex[1])||!!t.equals(this.frameVertex[2]))},isVertexOfEdge:function(t,e){return!(!e.equals(t.orig(),this.tolerance)&&!e.equals(t.dest(),this.tolerance))},connect:function(t,e){var n=ws.connect(t,e);return this.quadEdges.add(n),n},getVoronoiCellPolygon:function(t,e){var n=new x,i=t;do{var r=t.rot().orig().getCoordinate();n.add(r),t=t.oPrev()}while(t!==i);var s=new E;s.addAll(n,!1),s.closeRing(),s.size()<4&&(_.out.println(s),s.add(s.get(s.size()-1),!0));var o=s.toCoordinateArray(),a=e.createPolygon(e.createLinearRing(o),null),u=i.orig();return a.setUserData(u.getCoordinate()),a},setLocator:function(t){this.locator=t},initSubdiv:function(){var t=this.makeEdge(this.frameVertex[0],this.frameVertex[1]),e=this.makeEdge(this.frameVertex[1],this.frameVertex[2]);ws.splice(t.sym(),e);var n=this.makeEdge(this.frameVertex[2],this.frameVertex[0]);return ws.splice(e.sym(),n),ws.splice(n.sym(),t),t},isFrameBorderEdge:function(t){var e=new Array(3).fill(null);_s.getTriangleEdges(t,e);var n=new Array(3).fill(null);_s.getTriangleEdges(t.sym(),n);var i=t.lNext().dest();if(this.isFrameVertex(i))return!0;var r=t.sym().lNext().dest();return!!this.isFrameVertex(r)},makeEdge:function(t,e){var n=ws.makeEdge(t,e);return this.quadEdges.add(n),n},visitTriangles:function(t,e){this.visitedKey++;var n=new ce;n.push(this.startingEdge);for(var i=new K;!n.empty();){var r=n.pop();if(!i.contains(r)){var s=this.fetchTriangleToVisit(r,n,e,i);null!==s&&t.visit(s)}}},isFrameEdge:function(t){return!(!this.isFrameVertex(t.orig())&&!this.isFrameVertex(t.dest()))},isOnEdge:function(t,e){return this.seg.setCoordinates(t.orig().getCoordinate(),t.dest().getCoordinate()),this.seg.distance(e)<this.edgeCoincidenceTolerance},getEnvelope:function(){return new I(this.frameEnv)},createFrame:function(t){var e=t.getWidth(),n=t.getHeight(),i=0;i=e>n?10*e:10*n,this.frameVertex[0]=new Ss((t.getMaxX()+t.getMinX())/2,t.getMaxY()+i),this.frameVertex[1]=new Ss(t.getMinX()-i,t.getMinY()-i),this.frameVertex[2]=new Ss(t.getMaxX()+i,t.getMinY()-i),this.frameEnv=new I(this.frameVertex[0].getCoordinate(),this.frameVertex[1].getCoordinate()),this.frameEnv.expandToInclude(this.frameVertex[2].getCoordinate())},getTriangleCoordinates:function(t){var e=new Fs;return this.visitTriangles(e,t),e.getTriangles()},getVertices:function(t){for(var e=new K,n=this.quadEdges.iterator();n.hasNext();){var i=n.next(),r=i.orig();!t&&this.isFrameVertex(r)||e.add(r);var s=i.dest();!t&&this.isFrameVertex(s)||e.add(s)}return e},fetchTriangleToVisit:function(t,e,n,i){var r=t,s=0,o=!1;do{this.triEdges[s]=r,this.isFrameEdge(r)&&(o=!0);var a=r.sym();i.contains(a)||e.push(a),i.add(r),s++,r=r.lNext()}while(r!==t);return o&&!n?null:this.triEdges},getEdges:function(){if(0===arguments.length)return this.quadEdges;if(1===arguments.length){for(var t=arguments[0],e=this.getPrimaryEdges(!1),n=new Array(e.size()).fill(null),i=0,r=e.iterator();r.hasNext();){var s=r.next();n[i++]=t.createLineString([s.orig().getCoordinate(),s.dest().getCoordinate()])}return t.createMultiLineString(n)}},getVertexUniqueEdges:function(t){for(var e=new x,n=new K,i=this.quadEdges.iterator();i.hasNext();){var r=i.next(),s=r.orig();n.contains(s)||(n.add(s),!t&&this.isFrameVertex(s)||e.add(r));var o=r.sym(),a=o.orig();n.contains(a)||(n.add(a),!t&&this.isFrameVertex(a)||e.add(o))}return e},getTriangleEdges:function(t){var e=new Ds;return this.visitTriangles(e,t),e.getTriangleEdges()},getPrimaryEdges:function(t){this.visitedKey++;var e=new x,n=new ce;n.push(this.startingEdge);for(var i=new K;!n.empty();){var r=n.pop();if(!i.contains(r)){var s=r.getPrimary();!t&&this.isFrameEdge(s)||e.add(s),n.push(r.oNext()),n.push(r.sym().oNext()),i.add(r),i.add(r.sym())}}return e},delete:function(t){ws.splice(t,t.oPrev()),ws.splice(t.sym(),t.sym().oPrev());var e=t.sym(),n=t.rot(),i=t.rot().sym();this.quadEdges.remove(t),this.quadEdges.remove(e),this.quadEdges.remove(n),this.quadEdges.remove(i),t.delete(),e.delete(),n.delete(),i.delete()},locateFromEdge:function(t,e){for(var n=0,i=this.quadEdges.size(),r=e;;){if(++n>i)throw new Ps(r.toLineSegment());if(t.equals(r.orig())||t.equals(r.dest()))break;if(t.rightOf(r))r=r.sym();else if(t.rightOf(r.oNext())){if(t.rightOf(r.dPrev()))break;r=r.dPrev()}else r=r.oNext()}return r},getTolerance:function(){return this.tolerance},getVoronoiCellPolygons:function(t){this.visitTriangles(new Ms,!0);for(var e=new x,n=this.getVertexUniqueEdges(!1),i=n.iterator();i.hasNext();){var r=i.next();e.add(this.getVoronoiCellPolygon(r,t))}return e},getVoronoiDiagram:function(t){var e=this.getVoronoiCellPolygons(t);return t.createGeometryCollection($t.toGeometryArray(e))},getTriangles:function(t){for(var e=this.getTriangleCoordinates(!1),n=new Array(e.size()).fill(null),i=0,r=e.iterator();r.hasNext();){var s=r.next();n[i++]=t.createPolygon(t.createLinearRing(s),null)}return t.createGeometryCollection(n)},insertSite:function(t){var e=this.locate(t);if(t.equals(e.orig(),this.tolerance)||t.equals(e.dest(),this.tolerance))return e;var n=this.makeEdge(e.orig(),t);ws.splice(n,e);var i=n;do{n=this.connect(e,n.sym()),e=n.oPrev()}while(e.lNext()!==i);return i},locate:function(){if(1===arguments.length){if(arguments[0]instanceof Ss){var t=arguments[0];return this.locator.locate(t)}if(arguments[0]instanceof c){var e=arguments[0];return this.locator.locate(new Ss(e))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=this.locator.locate(new Ss(n));if(null===r)return null;var s=r;r.dest().getCoordinate().equals2D(n)&&(s=r.sym());var o=s;do{if(o.dest().getCoordinate().equals2D(i))return o;o=o.oNext()}while(o!==s);return null}},interfaces_:function(){return[]},getClass:function(){return _s}}),_s.getTriangleEdges=function(t,e){if(e[0]=t,e[1]=e[0].lNext(),e[2]=e[1].lNext(),e[2].lNext()!==e[0])throw new n("Edges do not form a triangle")},io(Ms.prototype,{visit:function(t){for(var e=t[0].orig().getCoordinate(),n=t[1].orig().getCoordinate(),i=t[2].orig().getCoordinate(),r=Ei.circumcentre(e,n,i),s=new Ss(r),o=0;o<3;o++)t[o].rot().setOrig(s)},interfaces_:function(){return[bs]},getClass:function(){return Ms}}),io(Ds.prototype,{getTriangleEdges:function(){return this.triList},visit:function(t){this.triList.add(t.clone())},interfaces_:function(){return[bs]},getClass:function(){return Ds}}),io(As.prototype,{visit:function(t){this.triList.add([t[0].orig(),t[1].orig(),t[2].orig()])},getTriangleVertices:function(){return this.triList},interfaces_:function(){return[bs]},getClass:function(){return As}}),io(Fs.prototype,{checkTriangleSize:function(t){t.length>=2?ee.toLineString(t[0],t[1]):t.length>=1&&ee.toPoint(t[0])},visit:function(t){this.coordList.clear();for(var e=0;e<3;e++){var n=t[e].orig();this.coordList.add(n.getCoordinate())}if(this.coordList.size()>0){this.coordList.closeRing();var i=this.coordList.toCoordinateArray();if(4!==i.length)return null;this.triCoords.add(i)}},getTriangles:function(){return this.triCoords},interfaces_:function(){return[bs]},getClass:function(){return Fs}}),_s.TriangleCircumcentreVisitor=Ms,_s.TriangleEdgesListVisitor=Ds,_s.TriangleVertexListVisitor=As,_s.TriangleCoordinatesVisitor=Fs,_s.EDGE_COINCIDENCE_TOL_FACTOR=1e3,io(Gs.prototype,{getLineSegment:function(){return this.ls},getEndZ:function(){return this.ls.getCoordinate(1).z},getStartZ:function(){return this.ls.getCoordinate(0).z},intersection:function(t){return this.ls.intersection(t.getLineSegment())},getStart:function(){return this.ls.getCoordinate(0)},getEnd:function(){return this.ls.getCoordinate(1)},getEndY:function(){return this.ls.getCoordinate(1).y},getStartX:function(){return this.ls.getCoordinate(0).x},equalsTopo:function(t){return this.ls.equalsTopo(t.getLineSegment())},getStartY:function(){return this.ls.getCoordinate(0).y},setData:function(t){this.data=t},getData:function(){return this.data},getEndX:function(){return this.ls.getCoordinate(1).x},toString:function(){return this.ls.toString()},interfaces_:function(){return[]},getClass:function(){return Gs}}),io(qs.prototype,{visit:function(t){},interfaces_:function(){return[]},getClass:function(){return qs}}),io(Bs.prototype,{isRepeated:function(){return this.count>1},getRight:function(){return this.right},getCoordinate:function(){return this.p},setLeft:function(t){this.left=t},getX:function(){return this.p.x},getData:function(){return this.data},getCount:function(){return this.count},getLeft:function(){return this.left},getY:function(){return this.p.y},increment:function(){this.count=this.count+1},setRight:function(t){this.right=t},interfaces_:function(){return[]},getClass:function(){return Bs}}),io(Vs.prototype,{insert:function(){if(1===arguments.length){var t=arguments[0];return this.insert(t,null)}if(2===arguments.length){var e=arguments[0],n=arguments[1];if(null===this.root)return this.root=new Bs(e,n),this.root;if(this.tolerance>0){var i=this.findBestMatchNode(e);if(null!==i)return i.increment(),i}return this.insertExact(e,n)}},query:function(){if(1===arguments.length){var t=arguments[0],e=new x;return this.query(t,e),e}if(2===arguments.length)if(arguments[0]instanceof I&&oo(arguments[1],m)){var n=arguments[0],i=arguments[1];this.queryNode(this.root,n,!0,{interfaces_:function(){return[qs]},visit:function(t){i.add(t)}})}else if(arguments[0]instanceof I&&oo(arguments[1],qs)){var r=arguments[0],s=arguments[1];this.queryNode(this.root,r,!0,s)}},queryNode:function(t,e,n,i){if(null===t)return null;var r=null,s=null,o=null;n?(r=e.getMinX(),s=e.getMaxX(),o=t.getX()):(r=e.getMinY(),s=e.getMaxY(),o=t.getY());var a=r<o,u=o<=s;a&&this.queryNode(t.getLeft(),e,!n,i),e.contains(t.getCoordinate())&&i.visit(t),u&&this.queryNode(t.getRight(),e,!n,i)},findBestMatchNode:function(t){var e=new zs(t,this.tolerance);return this.query(e.queryEnvelope(),e),e.getNode()},isEmpty:function(){return null===this.root},insertExact:function(t,e){for(var n=this.root,i=this.root,r=!0,s=!0;null!==n;){if(null!==n){if(t.distance(n.getCoordinate())<=this.tolerance)return n.increment(),n}s=r?t.x<n.getX():t.y<n.getY(),i=n,n=s?n.getLeft():n.getRight(),r=!r}this.numberOfNodes=this.numberOfNodes+1;var o=new Bs(t,e);return s?i.setLeft(o):i.setRight(o),o},interfaces_:function(){return[]},getClass:function(){return Vs}}),Vs.toCoordinates=function(){if(1===arguments.length){var t=arguments[0];return Vs.toCoordinates(t,!1)}if(2===arguments.length){for(var e=arguments[0],n=arguments[1],i=new E,r=e.iterator();r.hasNext();)for(var s=r.next(),o=n?s.getCount():1,a=0;a<o;a++)i.add(s.getCoordinate(),!0);return i.toCoordinateArray()}},io(zs.prototype,{visit:function(t){var e=this.p.distance(t.getCoordinate());if(!(e<=this.tolerance))return null;var n=!1;(null===this.matchNode||e<this.matchDist||null!==this.matchNode&&e===this.matchDist&&t.getCoordinate().compareTo(this.matchNode.getCoordinate())<1)&&(n=!0),n&&(this.matchNode=t,this.matchDist=e)},queryEnvelope:function(){var t=new I(this.p);return t.expandBy(this.tolerance),t},getNode:function(){return this.matchNode},interfaces_:function(){return[qs]},getClass:function(){return zs}}),Vs.BestMatchVisitor=zs,io(ks.prototype,{getInitialVertices:function(){return this.initialVertices},getKDT:function(){return this.kdt},enforceConstraints:function(){this.addConstraintVertices();var t=0,e=0;do{e=this.enforceGabriel(this.segments),t++}while(e>0&&t<ks.MAX_SPLIT_ITER)},insertSites:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertSite(n)}},getVertexFactory:function(){return this.vertexFactory},getPointArray:function(){for(var t=new Array(this.initialVertices.size()+this.segVertices.size()).fill(null),e=0,n=this.initialVertices.iterator();n.hasNext();){var i=n.next();t[e++]=i.getCoordinate()}for(var r=this.segVertices.iterator();r.hasNext();){var i=r.next();t[e++]=i.getCoordinate()}return t},setConstraints:function(t,e){this.segments=t,this.segVertices=e},computeConvexHull:function(){var t=new $t,e=this.getPointArray(),n=new ge(e,t);this.convexHull=n.getConvexHull()},addConstraintVertices:function(){this.computeConvexHull(),this.insertSites(this.segVertices)},findNonGabrielPoint:function(t){var e=t.getStart(),n=t.getEnd(),r=new c((e.x+n.x)/2,(e.y+n.y)/2),s=e.distance(r),o=new I(r);o.expandBy(s);for(var a=this.kdt.query(o),u=null,l=i.MAX_VALUE,h=a.iterator();h.hasNext();){var f=h.next(),g=f.getCoordinate();if(!g.equals2D(e)&&!g.equals2D(n)){var d=r.distance(g);if(d<s){var p=d;(null===u||p<l)&&(u=g,l=p)}}}return u},getConstraintSegments:function(){return this.segments},setSplitPointFinder:function(t){this.splitFinder=t},getConvexHull:function(){return this.convexHull},getTolerance:function(){return this.tolerance},enforceGabriel:function(t){for(var e=new x,n=0,i=new x,r=t.iterator();r.hasNext();){var s=r.next(),o=this.findNonGabrielPoint(s);if(null!==o){this.splitPt=this.splitFinder.findSplitPoint(s,o);var a=this.createVertex(this.splitPt,s),u=(this.insertSite(a),new Gs(s.getStartX(),s.getStartY(),s.getStartZ(),a.getX(),a.getY(),a.getZ(),s.getData())),l=new Gs(a.getX(),a.getY(),a.getZ(),s.getEndX(),s.getEndY(),s.getEndZ(),s.getData());e.add(u),e.add(l),i.add(s),n+=1}}return t.removeAll(i),t.addAll(e),n},createVertex:function(){if(1===arguments.length){var t=arguments[0],e=null;return e=null!==this.vertexFactory?this.vertexFactory.createVertex(t,null):new Ls(t)}if(2===arguments.length){var n=arguments[0],i=arguments[1],e=null;return e=null!==this.vertexFactory?this.vertexFactory.createVertex(n,i):new Ls(n),e.setOnConstraint(!0),e}},getSubdivision:function(){return this.subdiv},computeBoundingBox:function(){var t=ks.computeVertexEnvelope(this.initialVertices),e=ks.computeVertexEnvelope(this.segVertices),n=new I(t);n.expandToInclude(e);var i=.2*n.getWidth(),r=.2*n.getHeight(),s=Math.max(i,r);this.computeAreaEnv=new I(n),this.computeAreaEnv.expandBy(s)},setVertexFactory:function(t){this.vertexFactory=t},formInitialDelaunay:function(){this.computeBoundingBox(),this.subdiv=new _s(this.computeAreaEnv,this.tolerance),this.subdiv.setLocator(new Os(this.subdiv)),this.incDel=new Rs(this.subdiv),this.insertSites(this.initialVertices)},insertSite:function(){if(arguments[0]instanceof Ls){var t=arguments[0],e=this.kdt.insert(t.getCoordinate(),t);if(e.isRepeated()){var n=e.getData();return n.merge(t),n}return this.incDel.insertSite(t),t}if(arguments[0]instanceof c){var i=arguments[0];this.insertSite(this.createVertex(i))}},interfaces_:function(){return[]},getClass:function(){return ks}}),ks.computeVertexEnvelope=function(t){for(var e=new I,n=t.iterator();n.hasNext();){var i=n.next();e.expandToInclude(i.getCoordinate())}return e},ks.MAX_SPLIT_ITER=99,io(Ys.prototype,{create:function(){if(null!==this.subdiv)return null;var t=Ys.envelope(this.siteCoords),e=Ys.toVertices(this.siteCoords);this.subdiv=new _s(t,this.tolerance),new Rs(this.subdiv).insertSites(e)},setTolerance:function(t){this.tolerance=t},setSites:function(){if(arguments[0]instanceof F){var t=arguments[0];this.siteCoords=Ys.extractUniqueCoordinates(t)}else if(oo(arguments[0],d)){var e=arguments[0];this.siteCoords=Ys.unique(Y.toCoordinateArray(e))}},getEdges:function(t){return this.create(),this.subdiv.getEdges(t)},getSubdivision:function(){return this.create(),this.subdiv},getTriangles:function(t){return this.create(),this.subdiv.getTriangles(t)},interfaces_:function(){return[]},getClass:function(){return Ys}}),Ys.extractUniqueCoordinates=function(t){if(null===t)return new E;var e=t.getCoordinates();return Ys.unique(e)},Ys.envelope=function(t){for(var e=new I,n=t.iterator();n.hasNext();){var i=n.next();e.expandToInclude(i)}return e},Ys.unique=function(t){var e=Y.copyDeep(t);return st.sort(e),new E(e,!1)},Ys.toVertices=function(t){for(var e=new x,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Ss(i))}return e},io(Us.prototype,{createSiteVertices:function(t){for(var e=new x,n=t.iterator();n.hasNext();){var i=n.next();this.constraintVertexMap.containsKey(i)||e.add(new Ls(i))}return e},create:function(){if(null!==this.subdiv)return null;var t=Ys.envelope(this.siteCoords),e=new x;null!==this.constraintLines&&(t.expandToInclude(this.constraintLines.getEnvelopeInternal()),this.createVertices(this.constraintLines),e=Us.createConstraintSegments(this.constraintLines));var n=this.createSiteVertices(this.siteCoords),i=new ks(n,this.tolerance);i.setConstraints(e,new x(this.constraintVertexMap.values())),i.formInitialDelaunay(),i.enforceConstraints(),this.subdiv=i.getSubdivision()},setTolerance:function(t){this.tolerance=t},setConstraints:function(t){this.constraintLines=t},setSites:function(t){this.siteCoords=Ys.extractUniqueCoordinates(t)},getEdges:function(t){return this.create(),this.subdiv.getEdges(t)},getSubdivision:function(){return this.create(),this.subdiv},getTriangles:function(t){return this.create(),this.subdiv.getTriangles(t)},createVertices:function(t){for(var e=t.getCoordinates(),n=0;n<e.length;n++){var i=new Ls(e[n]);this.constraintVertexMap.put(e[n],i)}},interfaces_:function(){return[]},getClass:function(){return Us}}),Us.createConstraintSegments=function(){if(1===arguments.length){for(var t=arguments[0],e=qn.getLines(t),n=new x,i=e.iterator();i.hasNext();){var r=i.next();Us.createConstraintSegments(r,n)}return n}if(2===arguments.length)for(var s=arguments[0],o=arguments[1],a=s.getCoordinates(),i=1;i<a.length;i++)o.add(new Gs(a[i-1],a[i]))},io(Xs.prototype,{create:function(){if(null!==this.subdiv)return null;var t=Ys.envelope(this.siteCoords);this.diagramEnv=t;var e=Math.max(this.diagramEnv.getWidth(),this.diagramEnv.getHeight());this.diagramEnv.expandBy(e),null!==this.clipEnv&&this.diagramEnv.expandToInclude(this.clipEnv);var n=Ys.toVertices(this.siteCoords);this.subdiv=new _s(t,this.tolerance),new Rs(this.subdiv).insertSites(n)},getDiagram:function(t){this.create();var e=this.subdiv.getVoronoiDiagram(t);return Xs.clipGeometryCollection(e,this.diagramEnv)},setTolerance:function(t){this.tolerance=t},setSites:function(){if(arguments[0]instanceof F){var t=arguments[0];this.siteCoords=Ys.extractUniqueCoordinates(t)}else if(oo(arguments[0],d)){var e=arguments[0];this.siteCoords=Ys.unique(Y.toCoordinateArray(e))}},setClipEnvelope:function(t){this.clipEnv=t},getSubdivision:function(){return this.create(),this.subdiv},interfaces_:function(){return[]},getClass:function(){return Xs}}),Xs.clipGeometryCollection=function(t,e){for(var n=t.getFactory().toGeometry(e),i=new x,r=0;r<t.getNumGeometries();r++){var s=t.getGeometryN(r),o=null;e.contains(s.getEnvelopeInternal())?o=s:e.intersects(s.getEnvelopeInternal())&&(o=n.intersection(s),o.setUserData(s.getUserData())),null===o||o.isEmpty()||i.add(o)}return t.getFactory().createGeometryCollection($t.toGeometryArray(i))};var Yo=Object.freeze({Vertex:Ss}),Uo=Object.freeze({ConformingDelaunayTriangulationBuilder:Us,DelaunayTriangulationBuilder:Ys,VoronoiDiagramBuilder:Xs,quadedge:Yo});io(Hs.prototype,{getSegmentIndex:function(){return this.segmentIndex},getComponentIndex:function(){return this.componentIndex},isEndpoint:function(t){var e=t.getGeometryN(this.componentIndex),n=e.getNumPoints()-1;return this.segmentIndex>=n||this.segmentIndex===n&&this.segmentFraction>=1},isValid:function(t){if(this.componentIndex<0||this.componentIndex>=t.getNumGeometries())return!1;var e=t.getGeometryN(this.componentIndex);return!(this.segmentIndex<0||this.segmentIndex>e.getNumPoints())&&((this.segmentIndex!==e.getNumPoints()||0===this.segmentFraction)&&!(this.segmentFraction<0||this.segmentFraction>1))},normalize:function(){this.segmentFraction<0&&(this.segmentFraction=0),this.segmentFraction>1&&(this.segmentFraction=1),this.componentIndex<0&&(this.componentIndex=0,this.segmentIndex=0,this.segmentFraction=0),this.segmentIndex<0&&(this.segmentIndex=0,this.segmentFraction=0),1===this.segmentFraction&&(this.segmentFraction=0,this.segmentIndex+=1)},toLowest:function(t){var e=t.getGeometryN(this.componentIndex),n=e.getNumPoints()-1;return this.segmentIndex<n?this:new Hs(this.componentIndex,n,1,!1)},getCoordinate:function(t){var e=t.getGeometryN(this.componentIndex),n=e.getCoordinateN(this.segmentIndex);if(this.segmentIndex>=e.getNumPoints()-1)return n;var i=e.getCoordinateN(this.segmentIndex+1);return Hs.pointAlongSegmentByFraction(n,i,this.segmentFraction)},getSegmentFraction:function(){return this.segmentFraction},getSegment:function(t){var e=t.getGeometryN(this.componentIndex),n=e.getCoordinateN(this.segmentIndex);if(this.segmentIndex>=e.getNumPoints()-1){return new ae(e.getCoordinateN(e.getNumPoints()-2),n)}return new ae(n,e.getCoordinateN(this.segmentIndex+1))},clamp:function(t){if(this.componentIndex>=t.getNumGeometries())return this.setToEnd(t),null;if(this.segmentIndex>=t.getNumPoints()){var e=t.getGeometryN(this.componentIndex);this.segmentIndex=e.getNumPoints()-1,this.segmentFraction=1}},setToEnd:function(t){this.componentIndex=t.getNumGeometries()-1;var e=t.getGeometryN(this.componentIndex);this.segmentIndex=e.getNumPoints()-1,this.segmentFraction=1},compareTo:function(t){var e=t;return this.componentIndex<e.componentIndex?-1:this.componentIndex>e.componentIndex?1:this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.segmentFraction<e.segmentFraction?-1:this.segmentFraction>e.segmentFraction?1:0},clone:function(){return new Hs(this.componentIndex,this.segmentIndex,this.segmentFraction)},toString:function(){return"LinearLoc["+this.componentIndex+", "+this.segmentIndex+", "+this.segmentFraction+"]"},isOnSameSegment:function(t){return this.componentIndex===t.componentIndex&&(this.segmentIndex===t.segmentIndex||(t.segmentIndex-this.segmentIndex==1&&0===t.segmentFraction||this.segmentIndex-t.segmentIndex==1&&0===this.segmentFraction))},snapToVertex:function(t,e){if(this.segmentFraction<=0||this.segmentFraction>=1)return null;var n=this.getSegmentLength(t),i=this.segmentFraction*n,r=n-i;i<=r&&i<e?this.segmentFraction=0:r<=i&&r<e&&(this.segmentFraction=1)},compareLocationValues:function(t,e,n){return this.componentIndex<t?-1:this.componentIndex>t?1:this.segmentIndex<e?-1:this.segmentIndex>e?1:this.segmentFraction<n?-1:this.segmentFraction>n?1:0},getSegmentLength:function(t){var e=t.getGeometryN(this.componentIndex),n=this.segmentIndex;this.segmentIndex>=e.getNumPoints()-1&&(n=e.getNumPoints()-2);var i=e.getCoordinateN(n),r=e.getCoordinateN(n+1);return i.distance(r)},isVertex:function(){return this.segmentFraction<=0||this.segmentFraction>=1},interfaces_:function(){return[r]},getClass:function(){return Hs}}),Hs.getEndLocation=function(t){var e=new Hs;return e.setToEnd(t),e},Hs.pointAlongSegmentByFraction=function(t,e,n){return n<=0?t:n>=1?e:new c((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y,(e.z-t.z)*n+t.z)},Hs.compareLocationValues=function(t,e,n,i,r,s){return t<i?-1:t>i?1:e<r?-1:e>r?1:n<s?-1:n>s?1:0},io(Ws.prototype,{getComponentIndex:function(){
return this.componentIndex},getLine:function(){return this.currentLine},getVertexIndex:function(){return this.vertexIndex},getSegmentEnd:function(){return this.vertexIndex<this.getLine().getNumPoints()-1?this.currentLine.getCoordinateN(this.vertexIndex+1):null},next:function(){if(!this.hasNext())return null;++this.vertexIndex>=this.currentLine.getNumPoints()&&(this.componentIndex++,this.loadCurrentLine(),this.vertexIndex=0)},loadCurrentLine:function(){if(this.componentIndex>=this.numLines)return this.currentLine=null,null;this.currentLine=this.linearGeom.getGeometryN(this.componentIndex)},getSegmentStart:function(){return this.currentLine.getCoordinateN(this.vertexIndex)},isEndOfLine:function(){return!(this.componentIndex>=this.numLines)&&!(this.vertexIndex<this.currentLine.getNumPoints()-1)},hasNext:function(){return!(this.componentIndex>=this.numLines)&&!(this.componentIndex===this.numLines-1&&this.vertexIndex>=this.currentLine.getNumPoints())},interfaces_:function(){return[]},getClass:function(){return Ws}}),Ws.segmentEndVertexIndex=function(t){return t.getSegmentFraction()>0?t.getSegmentIndex()+1:t.getSegmentIndex()},io(js.prototype,{indexOf:function(t){return this.indexOfFromStart(t,null)},indexOfFromStart:function(t,e){for(var n=i.MAX_VALUE,r=0,s=0,o=-1,a=new ae,u=new Ws(this.linearGeom);u.hasNext();u.next())if(!u.isEndOfLine()){a.p0=u.getSegmentStart(),a.p1=u.getSegmentEnd();var l=a.distance(t),h=a.segmentFraction(t),c=u.getComponentIndex(),f=u.getVertexIndex();l<n&&(null===e||e.compareLocationValues(c,f,h)<0)&&(r=c,s=f,o=h,n=l)}return n===i.MAX_VALUE?new Hs(e):new Hs(r,s,o)},indexOfAfter:function(t,e){if(null===e)return this.indexOf(t);var n=Hs.getEndLocation(this.linearGeom);if(n.compareTo(e)<=0)return n;var i=this.indexOfFromStart(t,e);return h.isTrue(i.compareTo(e)>=0,"computed location is before specified minimum location"),i},interfaces_:function(){return[]},getClass:function(){return js}}),js.indexOf=function(t,e){return new js(t).indexOf(e)},js.indexOfAfter=function(t,e,n){return new js(t).indexOfAfter(e,n)},io(Ks.prototype,{indicesOf:function(t){var e=t.getGeometryN(0).getCoordinateN(0),n=t.getGeometryN(t.getNumGeometries()-1),i=n.getCoordinateN(n.getNumPoints()-1),r=new js(this.linearGeom),s=new Array(2).fill(null);return s[0]=r.indexOf(e),0===t.getLength()?s[1]=s[0].clone():s[1]=r.indexOfAfter(i,s[0]),s},interfaces_:function(){return[]},getClass:function(){return Ks}}),Ks.indicesOf=function(t,e){return new Ks(t).indicesOf(e)},io(Zs.prototype,{getGeometry:function(){return this.endLine(),this.geomFact.buildGeometry(this.lines)},getLastCoordinate:function(){return this.lastPt},endLine:function(){if(null===this.coordList)return null;if(this.ignoreInvalidLines&&this.coordList.size()<2)return this.coordList=null,null;var t=this.coordList.toCoordinateArray(),e=t;this.fixInvalidLines&&(e=this.validCoordinateSequence(t)),this.coordList=null;var i=null;try{i=this.geomFact.createLineString(e)}catch(t){if(!(t instanceof n))throw t;if(!this.ignoreInvalidLines)throw t}null!==i&&this.lines.add(i)},setFixInvalidLines:function(t){this.fixInvalidLines=t},add:function(){if(1===arguments.length){var t=arguments[0];this.add(t,!0)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];null===this.coordList&&(this.coordList=new E),this.coordList.add(e,n),this.lastPt=e}},setIgnoreInvalidLines:function(t){this.ignoreInvalidLines=t},validCoordinateSequence:function(t){return t.length>=2?t:[t[0],t[0]]},interfaces_:function(){return[]},getClass:function(){return Zs}}),io(Qs.prototype,{computeLinear:function(t,e){var n=new Zs(this.line.getFactory());n.setFixInvalidLines(!0),t.isVertex()||n.add(t.getCoordinate(this.line));for(var i=new Ws(this.line,t);i.hasNext()&&!(e.compareLocationValues(i.getComponentIndex(),i.getVertexIndex(),0)<0);i.next()){var r=i.getSegmentStart();n.add(r),i.isEndOfLine()&&n.endLine()}return e.isVertex()||n.add(e.getCoordinate(this.line)),n.getGeometry()},computeLine:function(t,e){var n=this.line.getCoordinates(),i=new E,r=t.getSegmentIndex();t.getSegmentFraction()>0&&(r+=1);var s=e.getSegmentIndex();1===e.getSegmentFraction()&&(s+=1),s>=n.length&&(s=n.length-1),t.isVertex()||i.add(t.getCoordinate(this.line));for(var o=r;o<=s;o++)i.add(n[o]);e.isVertex()||i.add(e.getCoordinate(this.line)),i.size()<=0&&i.add(t.getCoordinate(this.line));var a=i.toCoordinateArray();return a.length<=1&&(a=[a[0],a[0]]),this.line.getFactory().createLineString(a)},extract:function(t,e){return e.compareTo(t)<0?this.reverse(this.computeLinear(e,t)):this.computeLinear(t,e)},reverse:function(t){return t instanceof It?t.reverse():t instanceof ht?t.reverse():(h.shouldNeverReachHere("non-linear geometry encountered"),null)},interfaces_:function(){return[]},getClass:function(){return Qs}}),Qs.extract=function(t,e,n){return new Qs(t).extract(e,n)},io(Js.prototype,{clampIndex:function(t){var e=t.clone();return e.clamp(this.linearGeom),e},project:function(t){return js.indexOf(this.linearGeom,t)},checkGeometryType:function(){if(!(this.linearGeom instanceof It||this.linearGeom instanceof ht))throw new n("Input geometry must be linear")},extractPoint:function(){if(1===arguments.length){return arguments[0].getCoordinate(this.linearGeom)}if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.toLowest(this.linearGeom);return n.getSegment(this.linearGeom).pointAlongOffset(n.getSegmentFraction(),e)}},isValidIndex:function(t){return t.isValid(this.linearGeom)},getEndIndex:function(){return Hs.getEndLocation(this.linearGeom)},getStartIndex:function(){return new Hs},indexOfAfter:function(t,e){return js.indexOfAfter(this.linearGeom,t,e)},extractLine:function(t,e){return Qs.extract(this.linearGeom,t,e)},indexOf:function(t){return js.indexOf(this.linearGeom,t)},indicesOf:function(t){return Ks.indicesOf(this.linearGeom,t)},interfaces_:function(){return[]},getClass:function(){return Js}}),io($s.prototype,{indexOf:function(t){return this.indexOfFromStart(t,-1)},indexOfFromStart:function(t,e){for(var n=i.MAX_VALUE,r=e,s=0,o=new ae,a=new Ws(this.linearGeom);a.hasNext();){if(!a.isEndOfLine()){o.p0=a.getSegmentStart(),o.p1=a.getSegmentEnd();var u=o.distance(t),l=this.segmentNearestMeasure(o,t,s);u<n&&l>e&&(r=l,n=u),s+=o.getLength()}a.next()}return r},indexOfAfter:function(t,e){if(e<0)return this.indexOf(t);var n=this.linearGeom.getLength();if(n<e)return n;var i=this.indexOfFromStart(t,e);return h.isTrue(i>=e,"computed index is before specified minimum index"),i},segmentNearestMeasure:function(t,e,n){var i=t.projectionFactor(e);return i<=0?n:i<=1?n+i*t.getLength():n+t.getLength()},interfaces_:function(){return[]},getClass:function(){return $s}}),$s.indexOf=function(t,e){return new $s(t).indexOf(e)},$s.indexOfAfter=function(t,e,n){return new $s(t).indexOfAfter(e,n)},io(to.prototype,{getLength:function(t){for(var e=0,n=new Ws(this.linearGeom);n.hasNext();){if(!n.isEndOfLine()){var i=n.getSegmentStart(),r=n.getSegmentEnd(),s=r.distance(i);if(t.getComponentIndex()===n.getComponentIndex()&&t.getSegmentIndex()===n.getVertexIndex())return e+s*t.getSegmentFraction();e+=s}n.next()}return e},resolveHigher:function(t){if(!t.isEndpoint(this.linearGeom))return t;var e=t.getComponentIndex();if(e>=this.linearGeom.getNumGeometries()-1)return t;do{e++}while(e<this.linearGeom.getNumGeometries()-1&&0===this.linearGeom.getGeometryN(e).getLength());return new Hs(e,0,0)},getLocation:function(){if(1===arguments.length){var t=arguments[0];return this.getLocation(t,!0)}if(2===arguments.length){var e=arguments[0],n=arguments[1],i=e;if(e<0){i=this.linearGeom.getLength()+e}var r=this.getLocationForward(i);return n?r:this.resolveHigher(r)}},getLocationForward:function(t){if(t<=0)return new Hs;for(var e=0,n=new Ws(this.linearGeom);n.hasNext();){if(n.isEndOfLine()){if(e===t){var i=n.getComponentIndex(),r=n.getVertexIndex();return new Hs(i,r,0)}}else{var s=n.getSegmentStart(),o=n.getSegmentEnd(),a=o.distance(s);if(e+a>t){var u=(t-e)/a,i=n.getComponentIndex(),r=n.getVertexIndex();return new Hs(i,r,u)}e+=a}n.next()}return Hs.getEndLocation(this.linearGeom)},interfaces_:function(){return[]},getClass:function(){return to}}),to.getLength=function(t,e){return new to(t).getLength(e)},to.getLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new to(t);return n.getLocation(e)}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],n=new to(i);return n.getLocation(r,s)}},io(eo.prototype,{clampIndex:function(t){var e=this.positiveIndex(t),n=this.getStartIndex();if(e<n)return n;var i=this.getEndIndex();return e>i?i:e},locationOf:function(){if(1===arguments.length){var t=arguments[0];return to.getLocation(this.linearGeom,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return to.getLocation(this.linearGeom,e,n)}},project:function(t){return $s.indexOf(this.linearGeom,t)},positiveIndex:function(t){return t>=0?t:this.linearGeom.getLength()+t},extractPoint:function(){if(1===arguments.length){var t=arguments[0],e=to.getLocation(this.linearGeom,t);return e.getCoordinate(this.linearGeom)}if(2===arguments.length){var n=arguments[0],i=arguments[1],e=to.getLocation(this.linearGeom,n),r=e.toLowest(this.linearGeom);return r.getSegment(this.linearGeom).pointAlongOffset(r.getSegmentFraction(),i)}},isValidIndex:function(t){return t>=this.getStartIndex()&&t<=this.getEndIndex()},getEndIndex:function(){return this.linearGeom.getLength()},getStartIndex:function(){return 0},indexOfAfter:function(t,e){return $s.indexOfAfter(this.linearGeom,t,e)},extractLine:function(t,e){var n=(new Js(this.linearGeom),this.clampIndex(t)),i=this.clampIndex(e),r=n===i,s=this.locationOf(n,r),o=this.locationOf(i);return Qs.extract(this.linearGeom,s,o)},indexOf:function(t){return $s.indexOf(this.linearGeom,t)},indicesOf:function(t){var e=Ks.indicesOf(this.linearGeom,t);return[to.getLength(this.linearGeom,e[0]),to.getLength(this.linearGeom,e[1])]},interfaces_:function(){return[]},getClass:function(){return eo}});var Xo=Object.freeze({LengthIndexedLine:eo,LengthLocationMap:to,LinearGeometryBuilder:Zs,LinearIterator:Ws,LinearLocation:Hs,LocationIndexedLine:Js});io(no.prototype,{interfaces_:function(){return[]},getClass:function(){return no}}),no.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return $n.createEmptyResult($n.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),ei.overlayOp(t,e,$n.UNION)},io(F.prototype,{equalsTopo:function(t){return!!this.getEnvelopeInternal().equals(t.getEnvelopeInternal())&&ts.relate(this,t).isEquals(this.getDimension(),t.getDimension())},union:function(){if(0===arguments.length)return ss.union(this);if(1===arguments.length){var t=arguments[0];return no.union(this,t)}},isValid:function(){return Vr.isValid(this)},intersection:function(t){if(this.isEmpty()||t.isEmpty())return $n.createEmptyResult($n.INTERSECTION,this,t,this.factory);if(this.isGeometryCollection()){var e=t;return on.map(this,{interfaces_:function(){return[MapOp]},map:function(t){return t.intersection(e)}})}return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),ei.overlayOp(this,t,$n.INTERSECTION)},covers:function(t){return ts.covers(this,t)},coveredBy:function(t){return ts.coveredBy(this,t)},touches:function(t){return ts.touches(this,t)},intersects:function(t){return ts.intersects(this,t)},within:function(t){return ts.within(this,t)},overlaps:function(t){return ts.overlaps(this,t)},disjoint:function(t){return ts.disjoint(this,t)},crosses:function(t){return ts.crosses(this,t)},buffer:function(){if(1===arguments.length){var t=arguments[0];return hr.bufferOp(this,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return hr.bufferOp(this,e,n)}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];return hr.bufferOp(this,i,r,s)}},convexHull:function(){return new ge(this).getConvexHull()},relate:function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return ts.relate.apply(ts,[this].concat(e))},getCentroid:function(){if(this.isEmpty())return this.factory.createPoint();var t=le.getCentroid(this);return this.createPointFromInternalCoord(t,this)},getInteriorPoint:function(){if(this.isEmpty())return this.factory.createPoint();var t=null,e=this.getDimension();if(0===e){var n=new si(this);t=n.getInteriorPoint()}else if(1===e){var n=new ri(this);t=n.getInteriorPoint()}else{var n=new ni(this);t=n.getInteriorPoint()}return this.createPointFromInternalCoord(t,this)},symDifference:function(t){if(this.isEmpty()||t.isEmpty()){if(this.isEmpty()&&t.isEmpty())return $n.createEmptyResult($n.SYMDIFFERENCE,this,t,this.factory);if(this.isEmpty())return t.copy();if(t.isEmpty())return this.copy()}return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),ei.overlayOp(this,t,$n.SYMDIFFERENCE)},createPointFromInternalCoord:function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},toText:function(){return(new ee).write(this)},toString:function(){this.toText()},contains:function(t){return ts.contains(this,t)},difference:function(t){return this.isEmpty()?$n.createEmptyResult($n.DIFFERENCE,this,t,this.factory):t.isEmpty()?this.copy():(this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),ei.overlayOp(this,t,$n.DIFFERENCE))},isSimple:function(){return new Yi(this).isSimple()},isWithinDistance:function(t,e){return!(this.getEnvelopeInternal().distance(t.getEnvelopeInternal())>e)&&pr.isWithinDistance(this,t,e)},distance:function(t){return pr.distance(this,t)},isEquivalentClass:function(t){return this.getClass()===t.getClass()}});t.version="1.4.0 (93f117d)",t.algorithm=Eo,t.densify=Io,t.dissolve=No,t.geom=yo,t.geomgraph=Co,t.index=wo,t.io=Po,t.noding=bo,t.operation=Vo,t.precision=zo,t.simplify=ko,t.triangulate=Uo,t.linearref=Xo,Object.defineProperty(t,"__esModule",{value:!0})});
//# sourceMappingURL=jsts.min.js.map
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment