/** * 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={})}(this,function(t){"use strict";function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function i(){}function c(){}function h(t,e){this.low=0|e,this.high=0|t}function S(){}var f,g,d,_,r,s,o;function n(){}function a(){}function u(){}function l(){}function v(t){this.name="RuntimeException",this.message=t,this.stack=(new Error).stack,Error.call(this,t)}function p(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t}function m(){if(0===arguments.length)v.call(this);else if(1===arguments.length){var t=arguments[0];v.call(this,t)}}function y(){}function x(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)x.call(this,0,0);else if(1===arguments.length){var t=arguments[0];x.call(this,t.x,t.y,t.z)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];x.call(this,e,n,x.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 E(){if(this._dimensionsToTest=2,0===arguments.length)E.call(this,2);else if(1===arguments.length){var t=arguments[0];if(2!==t&&3!==t)throw new c("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}function L(t,e){return t.interfaces_&&-1>>=1)e+=(t.high&n)===n?"1":"0";for(n=2147483648;0>>=1)e+=(t.low&n)===n?"1":"0";return e},S.isNaN=function(t){return Number.isNaN(t)},S.isInfinite=function(t){return!Number.isFinite(t)},S.MAX_VALUE=Number.MAX_VALUE,"function"==typeof Float64Array&&"function"==typeof Int32Array?(r=2146435072,s=new Float64Array(1),o=new Int32Array(s.buffer),S.doubleToLongBits=function(t){s[0]=t;var e=0|o[0],n=0|o[1];return(n&r)===r&&0!=(1048575&n)&&0!==e&&(e=0,n=2146959360),new h(n,e)},S.longBitsToDouble=function(t){return o[0]=t.low,o[1]=t.high,s[0]}):(f=Math.log2,g=Math.floor,d=Math.pow,_=function(){for(var t=53;0>>=1,l|=(1&u)<<31,u>>>=1,n!==i&&(u|=524288);if(a=r+1023,s=0===e,e=t-e,r<52&&0!==e)for(i=0;;){if(1<=(n=2*e)?(e=n-1,s?(a--,s=!1):(i<<=1,i|=1,r++)):(e=n,s?0==--a&&(r++,s=!1):(i<<=1,r++)),20===r)u|=i,i=0;else if(52===r){l|=i;break}if(1===n){r<20?u|=i<<20-r:r<52&&(l|=i<<52-r);break}}return u|=a<<20,new h(u|=o,l)},S.longBitsToDouble=function(t){var e,n,i,r,s=t.high,o=t.low;n=s&1<<31?-1:1,i=((2146435072&s)>>20)-1023,r=0,e=1<<19;for(var a=1;a<=20;a++)s&e&&(r+=d(2,-a)),e>>>=1;for(e=1<<31,a=21;a<=52;a++)o&e&&(r+=d(2,-a)),e>>>=1;if(-1023===i){if(0===r)return 0*n;i=-1022}else{if(1024===i)return 0===r?n/0:NaN;r+=1}return n*r*d(2,i)}),(v.prototype=Object.create(Error.prototype)).constructor=Error,p(m,v),e(m.prototype,{interfaces_:function(){return[]},getClass:function(){return m}}),e(y.prototype,{interfaces_:function(){return[]},getClass:function(){return y}}),y.shouldNeverReachHere=function(){if(0===arguments.length)y.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new m("Should never reach here"+(null!==t?": "+t:""))}},y.isTrue=function(){if(1===arguments.length){var t=arguments[0];y.isTrue(t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!e)throw null===n?new m:new m(n)}},y.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];y.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 m("Expected "+n+" but encountered "+i+(null!==r?": "+r:""))}},e(x.prototype,{setOrdinate:function(t,e){switch(t){case x.X:this.x=e;break;case x.Y:this.y=e;break;case x.Z:this.z=e;break;default:throw new c("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 e=arguments[0],n=arguments[1];return!!i.equalsWithTolerance(this.x,e.x,n)&&!!i.equalsWithTolerance(this.y,e.y,n)}},getOrdinate:function(t){switch(t){case x.X:return this.x;case x.Y:return this.y;case x.Z:return this.z}throw new c("Invalid ordinate index: "+t)},equals3D:function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||S.isNaN(this.z)&&S.isNaN(t.z))},equals:function(t){return t instanceof x&&this.equals2D(t)},equalInZ:function(t,e){return i.equalsWithTolerance(this.z,t.z,e)},compareTo:function(t){var e=t;return this.xe.x?1:this.ye.y?1:0},clone:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return y.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}},copy:function(){return new x(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=37*t+x.hashCode(this.x))+x.hashCode(this.y)},setCoordinate:function(t){this.x=t.x,this.y=t.y,this.z=t.z},interfaces_:function(){return[n,a,l]},getClass:function(){return x}}),x.hashCode=function(){if(1===arguments.length&&"number"==typeof arguments[0]){var t=arguments[0],e=S.doubleToLongBits(t);return Math.trunc(e^e>>>32)}},e(E.prototype,{compare:function(t,e){var n=t,i=e,r=E.compare(n.x,i.x);if(0!==r)return r;var s=E.compare(n.y,i.y);return 0!==s?s:this._dimensionsToTest<=2?0:E.compare(n.z,i.z)},interfaces_:function(){return[u]},getClass:function(){return E}}),E.compare=function(t,e){return t=this.size())throw new C;return this.array_[t]},P.prototype.isEmpty=function(){return 0===this.array_.length},P.prototype.size=function(){return this.array_.length},P.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;et._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny;return new M(e,this._maxx=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 M){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx)&&(!((n.x>i.x?n.x:i.x)this._maxy)&&!((n.y>i.y?n.y:i.y)this._maxx||rthis._maxy||sthis._maxx&&(this._maxx=e._maxx),e._minythis._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):(nthis._maxx&&(this._maxx=n),ithis._maxy&&(this._maxy=i))}},minExtent:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._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 ethis._maxx||this._miny>this._maxy)&&this.setToNull()}},contains:function(){if(1===arguments.length){if(arguments[0]instanceof M){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof x){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 x((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 x){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof M){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];rt._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._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=37*(t=37*(t=37*t+x.hashCode(this._minx))+x.hashCode(this._maxx))+x.hashCode(this._miny))+x.hashCode(this._maxy)},interfaces_:function(){return[n,l]},getClass:function(){return M}}),M.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.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!(ut?1:0},G.isNaN=function(t){return Number.isNaN(t)},q.isWhitespace=function(t){return t<=32&&0<=t||127==t},q.toUpperCase=function(t){return t.toUpperCase()},e(B.prototype,{le:function(t){return this._hi=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 B){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&&arguments[0]instanceof B){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 B){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 B){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,i,r,s,o=arguments[0],a=arguments[1],u=null,l=null,h=null,c=null;return r=this._hi/o,c=(u=(h=B.SPLIT*r)-(u=h-r))*(l=(c=B.SPLIT*o)-(l=c-o))-(s=r*o)+u*(i=o-l)+(n=r-u)*l+n*i,c=r+(h=(this._hi-s-c+this._lo-r*a)/o),this._hi=c,this._lo=r-c+h,this}},dump:function(){return"DD<"+this._hi+", "+this._lo+">"},divide:function(){if(arguments[0]instanceof B){var t,e,n,i,r=arguments[0],s=null,o=null,a=null,u=null;return t=(n=this._hi/r._hi)-(s=(a=B.SPLIT*n)-(s=a-n)),u=s*(o=(u=B.SPLIT*r._hi)-(o=u-r._hi))-(i=n*r._hi)+s*(e=r._hi-o)+t*o+t*e,new B(u=n+(a=(this._hi-i-u+this._lo-n*r._lo)/r._hi),n-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return S.isNaN(l)?B.createNaN():B.copy(this).selfDivide(l,0)}},ge:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo},pow:function(t){if(0===t)return B.valueOf(1);var e=new B(this),n=B.valueOf(1),i=Math.abs(t);if(1e._hi?1:this._loe._lo?1:0},rint:function(){return this.isNaN()?this:this.add(.5).floor()},setValue:function(){if(arguments[0]instanceof B){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 B.valueOf(0);if(this.isNegative())return B.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=B.valueOf(e),i=this.subtract(n.sqr())._hi*(.5*t);return n.add(i)},selfAdd:function(){if(1===arguments.length){if(arguments[0]instanceof B){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 s=(r=this._hi+e)-(o=r-this._hi),i=(a=(s=e-o+(this._hi-s))+this._lo)+(r-(n=r+a)),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(2===arguments.length){var u,l=arguments[0],h=arguments[1],c=(n=null,i=null,null);r=null,s=null,o=null,a=null;r=this._hi+l,u=this._lo+h,s=r-(o=r-this._hi),c=u-(a=u-this._lo);var f=(n=r+(o=(s=l-o+(this._hi-s))+u))+(o=(c=h-a+(this._lo-c))+(i=o+(r-n))),g=o+(n-f);return this._hi=f,this._lo=g,this}},selfMultiply:function(){if(1===arguments.length){if(arguments[0]instanceof B){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,i,r=arguments[0],s=arguments[1],o=null,a=null,u=null,l=null;o=(u=B.SPLIT*this._hi)-this._hi,l=B.SPLIT*r,o=u-o,n=this._hi-o,a=l-r;var h=(u=this._hi*r)+(l=o*(a=l-a)-u+o*(i=r-a)+n*a+n*i+(this._hi*s+this._lo*r)),c=l+(o=u-h);return this._hi=h,this._lo=c,this}},selfSqr:function(){return this.selfMultiply(this)},floor:function(){if(this.isNaN())return B.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new B(t,e)},negate:function(){return this.isNaN()?this:new B(-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 B){var t=arguments[0];return t.isNaN()?B.createNaN():B.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return S.isNaN(e)?B.createNaN():B.copy(this).selfMultiply(e,0)}},isNaN:function(){return S.isNaN(this._hi)},intValue:function(){return Math.trunc(this._hi)},toString:function(){var t=B.magnitude(this._hi);return-3<=t&&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."+B.stringOfChar("0",-i)+n;else if(-1===n.indexOf(".")){var s=i-n.length;r=n+B.stringOfChar("0",s)+".0"}return this.isNegative()?"-"+r:r},reciprocal:function(){var t,e,n,i,r=null,s=null,o=null,a=null;t=(n=1/this._hi)-(r=(o=B.SPLIT*n)-(r=o-n)),s=(a=B.SPLIT*this._hi)-this._hi;var u=n+(o=(1-(i=n*this._hi)-(a=r*(s=a-s)-i+r*(e=this._hi-s)+t*s+t*e)-n*this._lo)/this._hi);return new B(u,n-u+o)},toSciNotation:function(){if(this.isZero())return B.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=B.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new IllegalStateException("Found leading zero: "+n);var r="";1t._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()?B.NaN:this.isPositive()?this.floor():this.ceil()},signum:function(){return 0n.y&&(n=s,i=r)}for(var o=i;(o-=1)<0&&(o=e),t[o].equals2D(n)&&o!==i;);for(var a=i;t[a=(a+1)%e].equals2D(n)&&a!==i;);var u=t[o],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var h=V.index(u,n,l);return 0===h?u.x>l.x:0=t?e:[]},nt.indexOf=function(t,e){for(var n=0;n=t.length&&(i=0),ni.length)return 1;if(0===n.length)return 0;var r=nt.compare(n,i);return nt.isEqualReversed(n,i)?0:r},OLDcompare:function(t,e){var n=t,i=e;if(n.lengthi.length)return 1;if(0===n.length)return 0;for(var r=nt.increasingDirection(n),s=nt.increasingDirection(i),o=0= 2)");this._points=t},isCoordinate:function(t){for(var e=0;e= 4)")},getGeometryType:function(){return K.TYPENAME_LINEARRING},copy:function(){return new Ht(this._points.copy(),this._factory)},interfaces_:function(){return[]},getClass:function(){return Ht}}),Ht.MINIMUM_VALID_SIZE=4,Ht.serialVersionUID=-0x3b229e262367a600,p(Wt,Lt),e(Wt.prototype,{equalsExact:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof K){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},getTypeCode:function(){return K.TYPECODE_MULTIPOLYGON},getDimension:function(){return 2},reverse:function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n>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[n,l]},getClass:function(){return me}}),me.midPoint=function(t,e){return new x((t.x+e.x)/2,(t.y+e.y)/2)},me.serialVersionUID=0x2d2172135f411c00,e(ve.prototype,{interfaces_:function(){return[]},getClass:function(){return ve}}),ve.toLocationSymbol=function(t){switch(t){case ve.EXTERIOR:return"e";case ve.BOUNDARY:return"b";case ve.INTERIOR:return"i";case ve.NONE:return"-"}throw new c("Unknown location value: "+t)},ve.INTERIOR=0,ve.BOUNDARY=1,ve.EXTERIOR=2,ve.NONE=-1,e(ye.prototype,{isIntersects:function(){return!this.isDisjoint()},isCovers:function(){return(ye.isTrue(this._matrix[ve.INTERIOR][ve.INTERIOR])||ye.isTrue(this._matrix[ve.INTERIOR][ve.BOUNDARY])||ye.isTrue(this._matrix[ve.BOUNDARY][ve.INTERIOR])||ye.isTrue(this._matrix[ve.BOUNDARY][ve.BOUNDARY]))&&this._matrix[ve.EXTERIOR][ve.INTERIOR]===Nt.FALSE&&this._matrix[ve.EXTERIOR][ve.BOUNDARY]===Nt.FALSE},isCoveredBy:function(){return(ye.isTrue(this._matrix[ve.INTERIOR][ve.INTERIOR])||ye.isTrue(this._matrix[ve.INTERIOR][ve.BOUNDARY])||ye.isTrue(this._matrix[ve.BOUNDARY][ve.INTERIOR])||ye.isTrue(this._matrix[ve.BOUNDARY][ve.BOUNDARY]))&&this._matrix[ve.INTERIOR][ve.EXTERIOR]===Nt.FALSE&&this._matrix[ve.BOUNDARY][ve.EXTERIOR]===Nt.FALSE},set:function(){if(1===arguments.length)for(var t=arguments[0],e=0;eMath.PI;)t-=xe.PI_TIMES_2;for(;t<=-Math.PI;)t+=xe.PI_TIMES_2;return t},xe.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)}},xe.isAcute=function(t,e,n){var i=t.x-e.x,r=t.y-e.y;return 0Math.PI&&(n=2*Math.PI-n),n},xe.toRadians=function(t){return t*Math.PI/180},xe.getTurn=function(t,e){var n=Math.sin(e-t);return 0Math.PI?r-xe.PI_TIMES_2:r},xe.PI_TIMES_2=2*Math.PI,xe.PI_OVER_2=Math.PI/2,xe.PI_OVER_4=Math.PI/4,xe.COUNTERCLOCKWISE=V.COUNTERCLOCKWISE,xe.CLOCKWISE=V.CLOCKWISE,xe.NONE=V.COLLINEAR,e(Ee.prototype,{area:function(){return Ee.area(this.p0,this.p1,this.p2)},signedArea:function(){return Ee.signedArea(this.p0,this.p1,this.p2)},interpolateZ:function(t){if(null===t)throw new c("Supplied point is null.");return Ee.interpolateZ(t,this.p0,this.p1,this.p2)},longestSideLength:function(){return Ee.longestSideLength(this.p0,this.p1,this.p2)},isAcute:function(){return Ee.isAcute(this.p0,this.p1,this.p2)},circumcentre:function(){return Ee.circumcentre(this.p0,this.p1,this.p2)},area3D:function(){return Ee.area3D(this.p0,this.p1,this.p2)},centroid:function(){return Ee.centroid(this.p0,this.p1,this.p2)},inCentre:function(){return Ee.inCentre(this.p0,this.p1,this.p2)},interfaces_:function(){return[]},getClass:function(){return Ee}}),Ee.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)},Ee.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Ee.det=function(t,e,n,i){return t*i-e*n},Ee.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)},Ee.longestSideLength=function(t,e,n){var i=t.distance(e),r=e.distance(n),s=n.distance(t),o=i;return othis._distance&&this.initialize(e,n,i)}},interfaces_:function(){return[]},getClass:function(){return Ne}}),e(Ce.prototype,{interfaces_:function(){return[]},getClass:function(){return Ce}}),Ce.computeDistance=function(){if(arguments[2]instanceof Ne&&arguments[0]instanceof Bt&&arguments[1]instanceof x)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new me,r=t.getCoordinates(),s=0;se||this._max=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=V.index(t,e,this._p);if(r===V.COLLINEAR)return this._isPointOnSegment=!0,null;e.y=this._max)throw new R;var t=this._parent.getGeometryN(this._index++);return t instanceof Lt?(this._subcollectionIterator=new Ue(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[I]},getClass:function(){return Ue}}),Ue.isAtomic=function(t){return!(t instanceof Lt)},e(Xe.prototype,{locate:function(t){return Xe.locate(t,this._geom)},interfaces_:function(){return[Pe]},getClass:function(){return Xe}}),Xe.locatePointInPolygon=function(t,e){if(e.isEmpty())return ve.EXTERIOR;var n=e.getExteriorRing(),i=Xe.locatePointInRing(t,n);if(i!==ve.INTERIOR)return i;for(var r=0;rn.y&&(n=s,i=r)}for(var o=i;(o-=1)<0&&(o=e),t[o].equals2D(n)&&o!==i;);for(var a=i;t[a=(a+1)%e].equals2D(n)&&a!==i;);var u=t[o],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var h=$e.computeOrientation(u,n,l);return 0===h?u.x>l.x:0=this.size())throw new IndexOutOfBoundsException;return this.array_[t]},en.prototype.push=function(t){return this.array_.push(t),t},en.prototype.pop=function(t){if(0===this.array_.length)throw new tn;return this.array_.pop()},en.prototype.peek=function(){if(0===this.array_.length)throw new tn;return this.array_[this.array_.length-1]},en.prototype.empty=function(){return 0===this.array_.length},en.prototype.isEmpty=function(){return this.empty()},en.prototype.search=function(t){return this.array_.indexOf(t)},en.prototype.size=function(){return this.array_.length},en.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;ee[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].ythis._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;ne.getEnvelopeInternal().getWidth()&&(e=t.getGeometryN(n));return e}if(arguments[0]instanceof K){var i=arguments[0];return i instanceof Lt?this.widestGeometry(i):i}},horizontalBisector:function(t){var e=t.getEnvelopeInternal(),n=an.getBisectorY(t);return this._factory.createLineString([new x(e.getMinX(),n),new x(e.getMaxX(),n)])},add:function(t){if(t instanceof Ut)this.addPolygon(t);else if(t instanceof Lt)for(var e=t,n=0;nthis._loY&&(this._loY=t):t>this._centreY&&t=e&&(n=1),t.max<=e&&(n=0),n},e(fn.prototype,{expandToInclude:function(t){t.max>this.max&&(this.max=t.max),t.minn||this.max=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)=n.x?i.y>=n.y?xn.NE:xn.SE:i.y>=n.y?xn.NW:xn.SW}},xn.NE=0,xn.NW=1,xn.SW=2,xn.SE=3,e(En.prototype,{interfaces_:function(){return[]},getClass:function(){return En}}),En.getChainStartIndices=function(t){var e=0,n=new P;n.add(new G(e));do{var i=En.findChainEnd(t,e);n.add(new G(i)),e=i}while(e=t.length-1)return t.length-1;for(var i=xn.quadrant(t[n],t[n+1]),r=e+1;r=t.length&&(e=0),e},wn.computeC=function(t,e,n){return t*n.y-e*n.x},wn.getMinimumDiameter=function(t){return new wn(t).getDiameter()},wn.getMinimumRectangle=function(t){return new wn(t).getMinimumRectangle()},wn.computeSegmentForLine=function(t,e,n){var i=null,r=null;return Math.abs(e)>Math.abs(t)?(i=new x(0,n/e),r=new x(1,n/e-t/e)):(i=new x(n/t,0),r=new x(n/t-e/t,1)),new me(i,r)};var Rn=Object.freeze({distance:Re,locate:He,match:Qe,Angle:xe,Centroid:Je,CGAlgorithms:$e,ConvexHull:rn,Distance:X,InteriorPointArea:on,InteriorPointLine:un,InteriorPointPoint:ln,RobustLineIntersector:pe,MCPointInRing:Cn,MinimumBoundingCircle:Ln,MinimumDiameter:wn});function Tn(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1}function Pn(){this._inputGeom=null,this._distanceTolerance=null;var t=arguments[0];this._inputGeom=t}function On(){Tn.apply(this),this.distanceTolerance=null;var t=arguments[0];this.distanceTolerance=t}e(Tn.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 Ht&&!i.isEmpty()||(n=!1);for(var r=new P,s=0;se._xValue?1:this._eventTypee._eventType?1:0},getInsertEvent:function(){return this._insertEvent},isInsert:function(){return this._eventType===kn.INSERT},isSameLabel:function(t){return null!==this._label&&this._label===t._label},getDeleteEventIndex:function(){return this._deleteEventIndex},interfaces_:function(){return[n]},getClass:function(){return kn}}),kn.INSERT=1,kn.DELETE=2,e(Un.prototype,{interfaces_:function(){return[]},getClass:function(){return Un}}),e(Xn.prototype,{isTrivialIntersection:function(t,e,n,i){if(t===n&&1===this._li.getIntersectionNum()){if(Xn.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().getCoordinate();if(t.isIntersection(i))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 Xn}}),Xn.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},p(Hn,Un),e(Hn.prototype,{prepareEvents:function(){De.sort(this.events);for(var t=0;tthis.location.length){var e=new Array(3).fill(null);e[Vn.ON]=this.location[Vn.ON],e[Vn.LEFT]=ve.NONE,e[Vn.RIGHT]=ve.NONE,this.location=e}for(var n=0;ne&&(i=1),this._depth[t][n]=i}}},getDelta:function(t){return this._depth[t][Vn.RIGHT]-this._depth[t][Vn.LEFT]},getLocation:function(t,e){return this._depth[t][e]<=0?ve.EXTERIOR:ve.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!==ve.EXTERIOR&&i!==ve.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=$n.depthAtLocation(i):this._depth[e][n]+=$n.depthAtLocation(i))}else if(3===arguments.length){var r=arguments[0],s=arguments[1];arguments[2]===ve.INTERIOR&&this._depth[r][s]++}},interfaces_:function(){return[]},getClass:function(){return $n}}),$n.depthAtLocation=function(t){return t===ve.EXTERIOR?0:t===ve.INTERIOR?1:$n.NULL_VALUE},$n.NULL_VALUE=-1,e(ti.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){y.isTrue(2<=this._label.getGeometryCount(),"found partial label"),this.computeIM(t)},isInResult:function(){return this._isInResult},isVisited:function(){return this._isVisited},interfaces_:function(){return[]},getClass:function(){return ti}}),p(ei,ti),e(ei.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 ei(t,jn.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 ei))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;st._quadrant?1:this._quadrant=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},e(mi.prototype,{getLevel:function(){return this._level},computeKey:function(){if(1===arguments.length){var t=arguments[0];for(this._level=mi.computeQuadLevel(t),this._env=new M,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=gn.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 x((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 mi}}),mi.computeQuadLevel=function(t){var e=t.getWidth(),n=t.getHeight();return gn.exponent(nwi.area(this._boundable2)?this.expand(this._boundable1,this._boundable2,t,e):this.expand(this._boundable2,this._boundable1,t,e),null;if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(i)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new c("neither boundable is composite")},isLeaves:function(){return!(wi.isComposite(this._boundable1)||wi.isComposite(this._boundable2))},compareTo:function(t){var e=t;return this._distancee._distance?1:0},expand:function(t,e,n,i){for(var r=t.getChildBoundables().iterator();r.hasNext();){var s=new wi(r.next(),e,this._itemDistance);s.getDistance()x&&(v.poll(),v.add(y)),o=v.peek().getDistance();else y.expandToQueue(d,o)}return Pi.getItems(v)}}else if(4===arguments.length){var E=arguments[0],I=arguments[1],N=arguments[2],C=arguments[3];g=new Ci(E,I),e=new wi(this.getRoot(),g,N);return this.nearestNeighbour(e,C)}},interfaces_:function(){return[xi,l]},getClass:function(){return Pi}}),Pi.centreX=function(t){return Pi.avg(t.getMinX(),t.getMaxX())},Pi.avg=function(t,e){return(t+e)/2},Pi.getItems=function(t){for(var e=new Array(t.size()).fill(null),n=0;!t.isEmpty();){var i=t.poll();e[n]=i.getBoundable(0).getItem(),n++}return e},Pi.centreY=function(t){return Pi.avg(t.getMinY(),t.getMaxY())},p(Oi,Li),e(Oi.prototype,{computeBounds:function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new M(n.getBounds()):t.expandToInclude(n.getBounds())}return t},interfaces_:function(){return[]},getClass:function(){return Oi}}),Pi.STRtreeNode=Oi,Pi.serialVersionUID=0x39920f7d5f261e0,Pi.xComparator={interfaces_:function(){return[u]},compare:function(t,e){return Ri.compareDoubles(Pi.centreX(t.getBounds()),Pi.centreX(e.getBounds()))}},Pi.yComparator={interfaces_:function(){return[u]},compare:function(t,e){return Ri.compareDoubles(Pi.centreY(t.getBounds()),Pi.centreY(e.getBounds()))}},Pi.intersectsOp={interfaces_:function(){return[IntersectsOp]},intersects:function(t,e){return t.intersects(e)}},Pi.DEFAULT_NODE_CAPACITY=10;var bi=Object.freeze({STRtree:Pi}),Mi=Object.freeze({kdtree:_i,quadtree:Ii,strtree:bi}),Di=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];function Ai(t){this.geometryFactory=t||new le}e(Ai.prototype,{read:function(t){var e=void 0,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!Fi[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Di.indexOf(n)?Fi[n].call(this,e.coordinates):"GeometryCollection"===n?Fi[n].call(this,e.geometries):Fi[n].call(this,e)},write:function(t){var e=t.getGeometryType();if(!Gi[e])throw new Error("Geometry is not supported");return Gi[e].call(this,t)}});var Fi={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var i=t.geometry.type;if(!Fi[i])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Fi.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;nn.getId()&&(n.computeOverlaps(r,t),this._nOverlaps++),this._segInt.isDone())return null}},interfaces_:function(){return[]},getClass:function(){return er}}),p(nr,Ji),e(nr.prototype,{overlap:function(){if(4!==arguments.length)return Ji.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 nr}}),er.SegmentOverlapAction=nr,e(ir.prototype,{rescale:function(){if(L(arguments[0],N))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){var n=arguments[0];2===n.length&&(new x(n[0]),new x(n[1]));for(t=0;tthis._minCoord.y&&n.y>this._minCoord.y&&i===V.CLOCKWISE&&(r=!0),r&&(this._minIndex=this._minIndex-1)},getRightmostSideOfSegment:function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var i=Vn.LEFT;return n[e].ythis._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])},findRightmostEdgeAtNode:function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},findEdge:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}y.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)===Vn.LEFT&&(this._orientedDe=this._minDe.getSym())},interfaces_:function(){return[]},getClass:function(){return ur}}),lr.prototype.addLast=function(t){this.array_.push(t)},lr.prototype.removeFirst=function(){return this.array_.shift()},lr.prototype.isEmpty=function(){return 0===this.array_.length},e(hr.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();){if((i=n.next()).isVisited()||i.getSym().isVisited()){e=i;break}}if(null===e)throw new si("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(n=t.getEdges().iterator();n.hasNext();){var i;(i=n.next()).setVisited(!0),this.copySymDepths(i)}},computeDepth:function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.getNode(),e.getLabel();e.setEdgeDepths(Vn.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();1<=e.getDepth(Vn.RIGHT)&&e.getDepth(Vn.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},computeDepths:function(t){var e=new ut,n=new lr,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().getSym();if(!o.isVisited()){var a=o.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},compareTo:function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0},getEnvelope:function(){if(null===this._env){for(var t=new M,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),i=0;ithis._maxNodeDegree&&(this._maxNodeDegree=e),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;sthis._bufParams.getMitreLimit()&&(r=!1)}catch(t){if(!(t instanceof A))throw t;s=new x(0,0),r=!1}r?this._segList.addPt(s):this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())},addOutsideTurn:function(t,e){if(this._offset0.p1.distance(this._offset1.p0)r.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3===arguments.length)if(L(arguments[2],w)&&arguments[0]instanceof x&&arguments[1]instanceof oi){var s=arguments[0],o=arguments[1],a=arguments[2],u=o.getEdge().getCoordinates();for(n=0;nthis._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)this._seg.p1.y||V.index(this._seg.p0,this._seg.p1,s)===V.RIGHT)){var l=o.getDepth(Vn.LEFT);this._seg.p0.equals(u[n])||(l=o.getDepth(Vn.RIGHT));var h=new xr(this._seg,l);a.add(h)}}}else if(L(arguments[2],w)&&arguments[0]instanceof x&&L(arguments[1],w)){var c=arguments[0],f=arguments[1],g=arguments[2];for(n=f.iterator();n.hasNext();){var d=n.next();d.isForward()&&this.findStabbedSegments(c,d,g)}}},getDepth:function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:De.min(e)._leftDepth},interfaces_:function(){return[]},getClass:function(){return yr}}),e(xr.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:0!==(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?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[n]},getClass:function(){return xr}}),yr.DepthSegment=xr,e(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,ve.EXTERIOR,ve.INTERIOR)},addPolygon:function(t){var e=this._distance,n=Vn.LEFT;this._distance<0&&(e=-this._distance,n=Vn.RIGHT);var i=t.getExteriorRing(),r=nt.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,ve.EXTERIOR,ve.INTERIOR);for(var s=0;s=Ht.MINIMUM_VALID_SIZE&&V.isCCW(t)&&(s=r,o=i,n=Vn.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 Ut)this.addPolygon(t);else if(t instanceof Bt)this.addLineString(t);else if(t instanceof Vt)this.addPoint(t);else if(t instanceof Xt)this.addCollection(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof Wt)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;ei||this._maxys;if(o)return!1;var a=this.intersectsToleranceSquare(t,e);return y.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 x(this._maxx,this._maxy),this._corner[1]=new x(this._minx,this._maxy),this._corner[2]=new x(this._minx,this._miny),this._corner[3]=new x(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=Or.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new M(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 Or}}),Or.SAFE_ENV_EXPANSION_FACTOR=.75,e(br.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 Mr(e,n,i);return this._index.query(r,{interfaces_:function(){return[Te]},visitItem:function(t){t.select(r,s)}}),s.isNodeAdded()}},interfaces_:function(){return[]},getClass:function(){return br}}),p(Mr,hn),e(Mr.prototype,{isNodeAdded:function(){return this._isNodeAdded},select:function(){if(!(2===arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof yn))return hn.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 Mr}}),br.HotPixelSnapAction=Mr,e(Dr.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;uthis._minDistance)return null;for(var i=t.getCoordinates(),r=e.getCoordinate(),s=0;sthis._minDistance)return null;i=a.getCoordinates();var h=u.getCoordinates();for(s=0;st._quadrant?1:this._quadrant=t.size()-2},hasIntersection:function(){return null!==this._interiorIntersection},isDone:function(){return!this._findAllIntersections&&null!==this._interiorIntersection},interfaces_:function(){return[wr]},getClass:function(){return rs}}),rs.createAllIntersectionsFinder=function(t){var e=new rs(t);return e.setFindAllIntersections(!0),e},rs.createAnyIntersectionFinder=function(t){return new rs(t)},rs.createIntersectionCounter=function(t){var e=new rs(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e},e(ss.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 rs(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new er;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 si(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 "+de.toLineString(t[0],t[1])+" and "+de.toLineString(t[2],t[3])},interfaces_:function(){return[]},getClass:function(){return ss}}),ss.computeIntersections=function(t){var e=new ss(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()},e(os.prototype,{checkValid:function(){this._nv.checkValid()},interfaces_:function(){return[]},getClass:function(){return os}}),os.toSegmentStrings=function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next();e.add(new is(i.getCoordinates(),i))}return e},os.checkValid=function(t){new os(t).checkValid()},e(as.prototype,{map:function(t){for(var e=new P,n=0;n>>20},gs.zeroLowerBits=function(t,e){var n="low";if(32=t.getNumPoints()&&null===i)return null;var s=t.getCoordinate(r);null!==i&&i.segmentIndex===n.segmentIndex&&(s=i.coord);var o=new ri(t,n.coord,s,new jn(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 jn(t.getLabel());o.flip();var a=new ri(t,n.coord,s,o);e.add(a)},computeEdgeEnds:function(){if(1===arguments.length){for(var t=arguments[0],e=new P,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;for(var h=a.next();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)),null!==l;);}},interfaces_:function(){return[]},getClass:function(){return Ps}}),p(Os,ri),e(Os.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();){(s=r.next().getLabel().getLocation(t))===ve.BOUNDARY&&n++,s===ve.INTERIOR&&(i=!0)}var s=ve.NONE;i&&(s=ve.INTERIOR),0t.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 Gs}}),e(qs.prototype,{applyTo:function(t){for(var e=0;e=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 zs}}),p(Vs,qs),e(Vs.prototype,{isDone:function(){return!0===this._containsPoint},visit:function(t){if(!(t instanceof Ut))return null;var e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;for(var n=new x,i=0;i<4;i++)if(this._rectSeq.getCoordinate(i,n),e.contains(n)&&Xe.containsPointInPolygon(n,t))return this._containsPoint=!0,null},containsPoint:function(){return this._containsPoint},interfaces_:function(){return[]},getClass:function(){return Vs}}),p(Ys,qs),e(Ys.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=Ge.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=t.size()?null:t.get(e)},js.union=function(t){return new js(t).union()},js.STRTREE_NODE_CAPACITY=4,e(Ks.prototype,{unionNoOpt:function(t){var e=this._geomFact.createPoint();return vs.overlayOp(t,e,xs.UNION)},unionWithNull:function(t,e){return null===t&&null===e?null:null===e?t:null===t?e:t.union(e)},extract:function(){if(L(arguments[0],N))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.extract(e)}else if(arguments[0]instanceof K){var n=arguments[0];null===this._geomFact&&(this._geomFact=n.getFactory()),Ws.extract(n,K.TYPENAME_POLYGON,this._polygons),Ws.extract(n,K.TYPENAME_LINESTRING,this._lines),Ws.extract(n,K.TYPENAME_POINT,this._points)}},union:function(){if(null===this._geomFact)return null;var t=null;if(0this._distanceTolerance&&(s=!1);var u=new me;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){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).iterator();e.hasNext();){var n=e.next();if(this.hasInteriorIntersection(n,t))return!0}return!1},findFurthestPoint:function(t,e,n,i){var r=new me;r.p0=t[e],r.p1=t[n];for(var s=-1,o=e,a=e+1;a=e[0]&&i=e||this._segmentIndex===e&&1<=this._segmentFraction},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||1=e.getNumPoints()-1)return n;var i=e.getCoordinateN(this._segmentIndex+1);return Ho.pointAlongSegmentByFraction(n,i,this._segmentFraction)},getSegmentFraction:function(){return this._segmentFraction},getSegment:function(t){var e=t.getGeometryN(this._componentIndex),n=e.getCoordinateN(this._segmentIndex);return this._segmentIndex>=e.getNumPoints()-1?new me(e.getCoordinateN(e.getNumPoints()-2),n):new me(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._componentIndexe._componentIndex?1:this._segmentIndexe._segmentIndex?1:this._segmentFractione._segmentFraction?1:0},copy:function(){return new Ho(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||1<=this._segmentFraction)return null;var n=this.getSegmentLength(t),i=this._segmentFraction*n,r=n-i;i<=r&&it?1:this._segmentIndexe?1:this._segmentFractionn?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||1<=this._segmentFraction},interfaces_:function(){return[n]},getClass:function(){return Ho}}),Ho.getEndLocation=function(t){var e=new Ho;return e.setToEnd(t),e},Ho.pointAlongSegmentByFraction=function(t,e,n){return n<=0?t:1<=n?e:new x((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y,(e.z-t.z)*n+t.z)},Ho.compareLocationValues=function(t,e,n,i,r,s){return t=this._currentLine.getNumPoints()&&(this._componentIndex++,this.loadCurrentLine(),this._vertexIndex=0)},loadCurrentLine:function(){if(this._componentIndex>=this._numLines)return this._currentLine=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._numLines)&&!(this._componentIndex===this._numLines-1&&this._vertexIndex>=this._currentLine.getNumPoints())},interfaces_:function(){return[]},getClass:function(){return Wo}}),Wo.segmentEndVertexIndex=function(t){return 0=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 Bt?t.reverse():t instanceof wt?t.reverse():(y.shouldNeverReachHere("non-linear geometry encountered"),null)},interfaces_:function(){return[]},getClass:function(){return Qo}}),Qo.extract=function(t,e,n){return new Qo(t).extract(e,n)},e(Jo.prototype,{clampIndex:function(t){var e=t.copy();return e.clamp(this._linearGeom),e},project:function(t){return jo.indexOf(this._linearGeom,t)},checkGeometryType:function(){if(!(this._linearGeom instanceof Bt||this._linearGeom instanceof wt))throw new c("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 Ho.getEndLocation(this._linearGeom)},getStartIndex:function(){return new Ho},indexOfAfter:function(t,e){return jo.indexOfAfter(this._linearGeom,t,e)},extractLine:function(t,e){return Qo.extract(this._linearGeom,t,e)},indexOf:function(t){return jo.indexOf(this._linearGeom,t)},indicesOf:function(t){return Ko.indicesOf(this._linearGeom,t)},interfaces_:function(){return[]},getClass:function(){return Jo}}),e($o.prototype,{indexOf:function(t){return this.indexOfFromStart(t,-1)},indexOfFromStart:function(t,e){for(var n=S.MAX_VALUE,i=e,r=0,s=new me,o=new Wo(this._linearGeom);o.hasNext();){if(!o.isEndOfLine()){s.p0=o.getSegmentStart(),s.p1=o.getSegmentEnd();var a=s.distance(t),u=this.segmentNearestMeasure(s,t,r);a=this._linearGeom.getNumGeometries()-1)return t;for(;++e=this.getStartIndex()&&t<=this.getEndIndex()},getEndIndex:function(){return this._linearGeom.getLength()},getStartIndex:function(){return 0},indexOfAfter:function(t,e){return $o.indexOfAfter(this._linearGeom,t,e)},extractLine:function(t,e){new Jo(this._linearGeom);var n=this.clampIndex(t),i=this.clampIndex(e),r=n===i,s=this.locationOf(n,r),o=this.locationOf(i);return Qo.extract(this._linearGeom,s,o)},indexOf:function(t){return $o.indexOf(this._linearGeom,t)},indicesOf:function(t){var e=Ko.indicesOf(this._linearGeom,t);return[ta.getLength(this._linearGeom,e[0]),ta.getLength(this._linearGeom,e[1])]},interfaces_:function(){return[]},getClass:function(){return ea}});var na=Object.freeze({LengthIndexedLine:ea,LengthLocationMap:ta,LinearGeometryBuilder:Zo,LinearIterator:Wo,LinearLocation:Ho,LocationIndexedLine:Jo});function ia(){}e(ia.prototype,{interfaces_:function(){return[]},getClass:function(){return ia}}),ia.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return xs.createEmptyResult(xs.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),vs.overlayOp(t,e,xs.UNION)},e(K.prototype,{equalsTopo:function(t){return!!this.getEnvelopeInternal().equals(t.getEnvelopeInternal())&&ks.relate(this,t).isEquals(this.getDimension(),t.getDimension())},union:function(){if(0===arguments.length)return Ks.union(this);if(1===arguments.length){var t=arguments[0];return ia.union(this,t)}},isValid:function(){return no.isValid(this)},intersection:function(t){if(this.isEmpty()||t.isEmpty())return xs.createEmptyResult(xs.INTERSECTION,this,t,this._factory);if(this.isGeometryCollection()){var e=t;return as.map(this,{interfaces_:function(){return[MapOp]},map:function(t){return t.intersection(e)}})}return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),vs.overlayOp(this,t,xs.INTERSECTION)},covers:function(t){return ks.covers(this,t)},coveredBy:function(t){return ks.covers(t,this)},touches:function(t){return ks.touches(this,t)},intersects:function(t){return ks.intersects(this,t)},within:function(t){return ks.contains(t,this)},overlaps:function(t){return ks.overlaps(this,t)},disjoint:function(t){return ks.disjoint(this,t)},crosses:function(t){return ks.crosses(this,t)},buffer:function(){if(1===arguments.length){var t=arguments[0];return Fr.bufferOp(this,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return Fr.bufferOp(this,e,n)}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];return Fr.bufferOp(this,i,r,s)}},convexHull:function(){return new rn(this).getConvexHull()},relate:function(){for(var t=arguments.length,e=Array(t),n=0;n