/** * 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 n(){}function i(){}function r(t,e){this.low=0|e,this.high=0|t}function s(){}var o,a,u,l,h,c,f;function g(){}function d(){}function _(){}function p(){}function m(t){this.name="RuntimeException",this.message=t,this.stack=(new Error).stack,Error.call(this,t)}function v(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t}function y(){if(0===arguments.length)m.call(this);else if(1===arguments.length){var t=arguments[0];m.call(this,t)}}function x(){}function E(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)E.call(this,0,0);else if(1===arguments.length){var t=arguments[0];E.call(this,t.x,t.y,t.z)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];E.call(this,e,n,E.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 I(){if(this._dimensionsToTest=2,0===arguments.length)I.call(this,2);else if(1===arguments.length){var t=arguments[0];if(2!==t&&3!==t)throw new i("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}function N(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1}function C(){}function S(){}function L(t){this.message=t||""}function w(){}function R(t){this.message=t||""}function T(t){this.message=t||""}function P(){this.array_=[],arguments[0]instanceof S&&this.addAll(arguments[0])}"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;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);i0;n>>>=1)e+=(t.high&n)===n?"1":"0";for(n=2147483648;n>0;n>>>=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?(h=2146435072,c=new Float64Array(1),f=new Int32Array(c.buffer),s.doubleToLongBits=function(t){c[0]=t;var e=0|f[0],n=0|f[1];return(n&h)===h&&0!=(1048575&n)&&0!==e&&(e=0,n=2146959360),new r(n,e)},s.longBitsToDouble=function(t){return f[0]=t.low,f[1]=t.high,c[0]}):(o=Math.log2,a=Math.floor,u=Math.pow,l=function(){for(var t=53;t>0;t--){var e=u(2,t)-1;if(a(o(e))+1===t)return e}return 0}(),s.doubleToLongBits=function(t){var e,n,i,s,h,c,f,g,d;if(t<0||1/t===Number.NEGATIVE_INFINITY?(c=1<<31,t=-t):c=0,0===t)return new r(g=c,d=0);if(t===1/0)return new r(g=2146435072|c,d=0);if(t!=t)return new r(g=2146959360,d=0);if(s=0,d=0,(e=a(t))>1)if(e<=l)(s=a(o(e)))<=20?(d=0,g=e<<20-s&1048575):(d=e%(n=u(2,i=s-20))<<32-i,g=e/n&1048575);else for(i=e,d=0;0!==(i=a(n=i/2));)s++,d>>>=1,d|=(1&g)<<31,g>>>=1,n!==i&&(g|=524288);if(f=s+1023,h=0===e,e=t-e,s<52&&0!==e)for(i=0;;){if((n=2*e)>=1?(e=n-1,h?(f--,h=!1):(i<<=1,i|=1,s++)):(e=n,h?0==--f&&(s++,h=!1):(i<<=1,s++)),20===s)g|=i,i=0;else if(52===s){d|=i;break}if(1===n){s<20?g|=i<<20-s:s<52&&(d|=i<<52-s);break}}return g|=f<<20,new r(g|=c,d)},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+=u(2,-a)),e>>>=1;for(e=1<<31,a=21;a<=52;a++)o&e&&(r+=u(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*u(2,i)}),m.prototype=Object.create(Error.prototype),m.prototype.constructor=Error,v(y,m),e(y.prototype,{interfaces_:function(){return[]},getClass:function(){return y}}),e(x.prototype,{interfaces_:function(){return[]},getClass:function(){return x}}),x.shouldNeverReachHere=function(){if(0===arguments.length)x.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new y("Should never reach here"+(null!==t?": "+t:""))}},x.isTrue=function(){if(1===arguments.length){var t=arguments[0];x.isTrue(t,null)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!e)throw null===n?new y:new y(n)}},x.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];x.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 y("Expected "+n+" but encountered "+i+(null!==r?": "+r:""))}},e(E.prototype,{setOrdinate:function(t,e){switch(t){case E.X:this.x=e;break;case E.Y:this.y=e;break;case E.Z:this.z=e;break;default:throw new i("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],i=arguments[1];return!!n.equalsWithTolerance(this.x,e.x,i)&&!!n.equalsWithTolerance(this.y,e.y,i)}},getOrdinate:function(t){switch(t){case E.X:return this.x;case E.Y:return this.y;case E.Z:return this.z}throw new i("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 E&&this.equals2D(t)},equalInZ:function(t,e){return n.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 x.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}},copy:function(){return new E(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+E.hashCode(this.x))+E.hashCode(this.y)},setCoordinate:function(t){this.x=t.x,this.y=t.y,this.z=t.z},interfaces_:function(){return[g,d,p]},getClass:function(){return E}}),E.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(I.prototype,{compare:function(t,e){var n=t,i=e,r=I.compare(n.x,i.x);if(0!==r)return r;var s=I.compare(n.y,i.y);return 0!==s?s:this._dimensionsToTest<=2?0:I.compare(n.z,i.z)},interfaces_:function(){return[_]},getClass:function(){return I}}),I.compare=function(t,e){return te?1:s.isNaN(t)?s.isNaN(e)?0:-1:s.isNaN(e)?1:0},E.DimensionalComparator=I,E.serialVersionUID=0x5cbf2c235c7e5800,E.NULL_ORDINATE=s.NaN,E.X=0,E.Y=1,E.Z=2,C.prototype.hasNext=function(){},C.prototype.next=function(){},C.prototype.remove=function(){},S.prototype.add=function(){},S.prototype.addAll=function(){},S.prototype.isEmpty=function(){},S.prototype.iterator=function(){},S.prototype.size=function(){},S.prototype.toArray=function(){},S.prototype.remove=function(){},L.prototype=new Error,L.prototype.name="IndexOutOfBoundsException",w.prototype=Object.create(S.prototype),w.prototype.constructor=w,w.prototype.get=function(){},w.prototype.set=function(){},w.prototype.isEmpty=function(){},R.prototype=new Error,R.prototype.name="NoSuchElementException",T.prototype=new Error,T.prototype.name="OperationNotSupported",P.prototype=Object.create(w.prototype),P.prototype.constructor=P,P.prototype.ensureCapacity=function(){},P.prototype.interfaces_=function(){return[w,S]},P.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],0,arguments[1]),!0},P.prototype.clear=function(){this.array_=[]},P.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},P.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},P.prototype.iterator=function(){return new O(this)},P.prototype.get=function(t){if(t<0||t>=this.size())throw new L;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;e=1)if(this.get(this.size()-1).equals2D(i))return null;P.prototype.add.call(this,i)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var r=arguments[0],s=arguments[1];return this.add(r,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var o=arguments[0],a=arguments[1];if(arguments[2])for(var u=0;u=0;u--)this.add(o[u],a);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof E){var l=arguments[0],h=arguments[1];if(!arguments[2]){var c=this.size();if(c>0){if(l>0)if(this.get(l-1).equals2D(h))return null;if(l_&&(p=-1);for(u=d;u!==_;u+=p)this.add(f[u],g);return!0}},closeRing:function(){this.size()>0&&this.add(new E(this.get(0)),!1)},interfaces_:function(){return[]},getClass:function(){return b}}),b.coordArrayType=new Array(0).fill(null),e(M.prototype,{getArea:function(){return this.getWidth()*this.getHeight()},equals:function(t){if(!(t instanceof M))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 M;var e=this._minx>t._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 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 M){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof E){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 E((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 E){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+E.hashCode(this._minx))+E.hashCode(this._maxx))+E.hashCode(this._miny))+E.hashCode(this._maxy)},interfaces_:function(){return[g,p]},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!(l>u)&&(!(hu)&&!(ht?1:0},G.isNaN=function(t){return Number.isNaN(t)},q.isWhitespace=function(t){return t<=32&&t>=0||127==t},q.toUpperCase=function(t){return t.toUpperCase()},e(B.prototype,{le:function(t){return this._hi9?(h=!0,c="9"):c="0"+l,o.append(c),n=n.subtract(B.valueOf(l)).multiply(B.TEN),h&&n.selfAdd(B.TEN);var f=!0,g=B.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 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],o=null,a=null,u=null,l=null;return n=this._hi/r._hi,o=(u=B.SPLIT*n)-n,l=B.SPLIT*r._hi,t=n-(o=u-o),a=l-r._hi,i=n*r._hi,l=o*(a=l-a)-i+o*(e=r._hi-a)+t*a+t*e,new B(l=n+(u=(this._hi-i-l+this._lo-n*r._lo)/r._hi),n-l+u)}if("number"==typeof arguments[0]){var h=arguments[0];return s.isNaN(h)?B.createNaN():B.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 B.valueOf(1);var e=new B(this),n=B.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 B.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new B(t,e)},compareTo:function(t){var e=t;return this._hie._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),s=l-o+(this._hi-s),c=h-a+(this._lo-c);var f=(n=r+(o=s+u))+(o=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 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."+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;n=1/this._hi,r=(o=B.SPLIT*n)-n,a=B.SPLIT*this._hi,t=n-(r=o-r),s=a-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="";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()?B.NaN:this.isNegative()?this.negate():new B(this)},isPositive:function(){return this._hi>0||0===this._hi&&this._lo>0},lt:function(t){return this._hit._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 this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},interfaces_:function(){return[p,g,d]},getClass:function(){return B}}),B.sqr=function(t){return B.valueOf(t).selfMultiply(t)},B.valueOf=function(){if("string"==typeof arguments[0]){var t=arguments[0];return B.parse(t)}if("number"==typeof arguments[0])return new B(arguments[0])},B.sqrt=function(t){return B.valueOf(t).sqrt()},B.parse=function(t){for(var e=0,n=t.length;q.isWhitespace(t.charAt(e));)e++;var i=!1;if(e=n);){var l=t.charAt(e);if(e++,q.isDigit(l)){var h=l-"0";s.selfMultiply(B.TEN),s.selfAdd(h),o++}else{if("."!==l){if("e"===l||"E"===l){var c=t.substring(e);try{u=G.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=B.TEN.pow(g);f=s.divide(d)}else if(g<0){d=B.TEN.pow(-g);f=s.multiply(d)}return i?f.negate():f},B.createNaN=function(){return new B(s.NaN,s.NaN)},B.copy=function(t){return new B(t)},B.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},B.stringOfChar=function(t,e){for(var n=new F,i=0;i0){if(s<=0)return V.signum(o);i=r+s}else{if(!(r<0))return V.signum(o);if(s>=0)return V.signum(o);i=-r-s}var a=V.DP_SAFE_EPSILON*i;return o>=a||-o>=a?V.signum(o):2},V.signum=function(t){return t>0?1:t<0?-1:0},V.DP_SAFE_EPSILON=1e-15,e(z.prototype,{interfaces_:function(){return[]},getClass:function(){return z}}),z.index=function(t,e,n){return V.orientationIndex(t,e,n)},z.isCCW=function(t){var e=t.length-1;if(e<3)throw new i("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,s=1;s<=e;s++){var o=t[s];o.y>n.y&&(n=o,r=s)}var a=r;do{(a-=1)<0&&(a=e)}while(t[a].equals2D(n)&&a!==r);var u=r;do{u=(u+1)%e}while(t[u].equals2D(n)&&u!==r);var l=t[a],h=t[u];if(l.equals2D(n)||h.equals2D(n)||l.equals2D(h))return!1;var c=z.index(l,n,h);return 0===c?l.x>h.x:c>0},z.CLOCKWISE=-1,z.RIGHT=z.CLOCKWISE,z.COUNTERCLOCKWISE=1,z.LEFT=z.COUNTERCLOCKWISE,z.COLLINEAR=0,z.STRAIGHT=z.COLLINEAR,Y.arraycopy=function(t,e,n,i,r){for(var s=0,o=e;on?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 is?s:i}},U.wrap=function(t,e){return t<0?e- -t%e:t%e},U.max=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return e>(i=t)&&(i=e),n>i&&(i=n),i}if(4===arguments.length){var i,r=arguments[0],s=arguments[1],o=arguments[2],a=arguments[3];return s>(i=r)&&(i=s),o>i&&(i=o),a>i&&(i=a),i}},U.average=function(t,e){return(t+e)/2},U.LOG_10=Math.log(10),e(X.prototype,{interfaces_:function(){return[]},getClass:function(){return X}}),X.segmentToSegment=function(t,e,n,i){if(t.equals(e))return X.pointToSegment(t,n,i);if(n.equals(i))return X.pointToSegment(i,t,e);var r=!1;if(M.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))/s,u=o/s;(u<0||u>1||a<0||a>1)&&(r=!0)}}else r=!0;return r?U.min(X.pointToSegment(t,n,i),X.pointToSegment(e,n,i),X.pointToSegment(n,t,e),X.pointToSegment(i,t,e)):0},X.pointToSegment=function(t,e,n){if(e.x===n.x&&e.y===n.y)return t.distance(e);var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),r=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/i;if(r<=0)return t.distance(e);if(r>=1)return t.distance(n);var s=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i;return Math.abs(s)*Math.sqrt(i)},X.pointToLinePerpendicular=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)},X.pointToSegmentString=function(t,e){if(0===e.length)throw new i("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r0},interfaces_:function(){return[Q]},getClass:function(){return $}}),e(tt.prototype,{isInBoundary:function(t){return t>1},interfaces_:function(){return[Q]},getClass:function(){return tt}}),e(et.prototype,{isInBoundary:function(t){return 1===t},interfaces_:function(){return[Q]},getClass:function(){return et}}),Q.Mod2BoundaryNodeRule=J,Q.EndPointBoundaryNodeRule=$,Q.MultiValentEndPointBoundaryNodeRule=tt,Q.MonoValentEndPointBoundaryNodeRule=et,Q.MOD2_BOUNDARY_RULE=new J,Q.ENDPOINT_BOUNDARY_RULE=new $,Q.MULTIVALENT_ENDPOINT_BOUNDARY_RULE=new tt,Q.MONOVALENT_ENDPOINT_BOUNDARY_RULE=new et,Q.OGC_SFS_BOUNDARY_RULE=Q.MOD2_BOUNDARY_RULE,e(nt.prototype,{interfaces_:function(){return[]},getClass:function(){return nt}}),nt.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},nt.ptNotInList=function(t,e){for(var n=0;n=t?e:[]},nt.indexOf=function(t,e){for(var n=0;n0)&&(e=t[n]);return e},nt.extract=function(t,e,n){e=U.clamp(e,0,t.length);var i=(n=U.clamp(n,-1,t.length))-e+1;n<0&&(i=0),e>=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=r>0?0:n.length-1,a=s>0?0:n.length-1,u=0;u0))return e.value;e=e.right}}return null},pt.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:ht,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:ht,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},pt.prototype.fixAfterInsertion=function(t){for(t.color=1;null!=t&&t!=this.root_&&1==t.parent.color;){var e;if(ft(t)==dt(ft(ft(t))))1==ct(e=_t(ft(ft(t))))?(gt(ft(t),ht),gt(e,ht),gt(ft(ft(t)),1),t=ft(ft(t))):(t==_t(ft(t))&&(t=ft(t),this.rotateLeft(t)),gt(ft(t),ht),gt(ft(ft(t)),1),this.rotateRight(ft(ft(t))));else 1==ct(e=dt(ft(ft(t))))?(gt(ft(t),ht),gt(e,ht),gt(ft(ft(t)),1),t=ft(ft(t))):(t==dt(ft(t))&&(t=ft(t),this.rotateRight(t)),gt(ft(t),ht),gt(ft(ft(t)),1),this.rotateLeft(ft(ft(t))))}this.root_.color=ht},pt.prototype.values=function(){var t=new P,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=pt.successor(e));)t.add(e.value);return t},pt.prototype.entrySet=function(){var t=new ut,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=pt.successor(e));)t.add(e);return t},pt.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}},pt.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}},pt.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},pt.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}e=t.parent;for(var n=t;null!==e&&n===e.right;)n=e,e=e.parent;return e},pt.prototype.size=function(){return this.size_},e(mt.prototype,{interfaces_:function(){return[]},getClass:function(){return mt}}),vt.prototype=new at,yt.prototype=new vt,yt.prototype.contains=function(t){for(var e=0,n=this.array_.length;e=0;){var o=r.substring(0,s);i.add(o),s=(r=r.substring(s+n)).indexOf(e)}r.length>0&&i.add(r);for(var a=new Array(i.size()).fill(null),u=0;u0)for(var s=r;s0&&i.append(" ");for(var s=0;s0&&i.append(","),i.append(bt.toString(t.getOrdinate(r,s)))}return i.append(")"),i.toString()}},Dt.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?Dt.createClosedRing(t,e,4):e.getOrdinate(0,H.X)===e.getOrdinate(n-1,H.X)&&e.getOrdinate(0,H.Y)===e.getOrdinate(n-1,H.Y)?e:Dt.createClosedRing(t,e,n+1)},Dt.createClosedRing=function(t,e,n){var i=t.create(n,e.getDimension()),r=e.size();Dt.copy(e,0,i,0,r);for(var s=r;s0){var n=this._points.copy();Dt.reverse(n),this._points=n}return null}}},getCoordinate:function(){return this.isEmpty()?null:this._points.getCoordinate(0)},getBoundaryDimension:function(){return this.isClosed()?Nt.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)},getTypeCode:function(){return K.TYPECODE_LINESTRING},getDimension:function(){return 1},getLength:function(){return Pt.ofLine(this._points)},getNumPoints:function(){return this._points.size()},reverse:function(){var t=this._points.copy();return Dt.reverse(t),this.getFactory().createLineString(t)},compareToSameClass:function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e= 2)");this._points=t},isCoordinate:function(t){for(var e=0;e=1&&this.getCoordinateSequence().size()= 4)")},getGeometryType:function(){return K.TYPENAME_LINEARRING},copy:function(){return new Yt(this._points.copy(),this._factory)},interfaces_:function(){return[]},getClass:function(){return Yt}}),Yt.MINIMUM_VALID_SIZE=4,Yt.serialVersionUID=-0x3b229e262367a600,v(kt,Lt),e(kt.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;n0){var t=new Mt(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e3&&(e=3),e<2?new Kt(t):new Kt(t,e)}},interfaces_:function(){return[W,p]},getClass:function(){return Zt}}),Zt.instance=function(){return Zt.instanceObject},Zt.serialVersionUID=-0x38e49fa6cf6f2e00,Zt.instanceObject=new Zt;var Qt=Object.defineProperty;var Jt=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&&function(t){this.add?t.forEach(this.add,this):t.forEach(function(t){this.set(t[0],t[1])},this)}.call(this,t)}e||Qt(t,"size",{get:te});return t.constructor=n,n.prototype=t,n}({delete:function(t){this.has(t)&&(this._keys.splice(xt,1),this._values.splice(xt,1),this._itp.forEach(function(t){xt-1},has:function(t){return function(t,e){if(this.objectOnly&&e!==Object(e))throw new TypeError("Invalid value used as weak collection key");if(e!=e||0===e)for(xt=t.length;xt--&&(n=t[xt],i=e,n!==i&&(n==n||i==i)););else xt=t.indexOf(e);var n,i;return xt>-1}.call(this,this._keys,t)},get:function(t){return this.has(t)?this._values[xt]:void 0},set:function(t,e){return this.has(t)?this._values[xt]=e:this._values[this._keys.push(t)-1]=e,this},keys:function(){return $t(this._itp,this._keys)},values:function(){return $t(this._itp,this._values)},entries:function(){return $t(this._itp,this._keys,this._values)},forEach:function(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)}},clear:function(){(this._keys||0).length=this._values.length=0}});function $t(t,e,n){var i=[0],r=!1;return t.push(i),{next:function(){var s,o=i[0];return!r&&o=0?t:e},e(re.prototype,{readResolve:function(){return re.nameToTypeMap.get(this._name)},toString:function(){return this._name},interfaces_:function(){return[p]},getClass:function(){return re}}),re.serialVersionUID=-552860263173159e4,re.nameToTypeMap=new ne,ie.Type=re,ie.serialVersionUID=0x6bee6404e9a25c00,ie.FIXED=new re("FIXED"),ie.FLOATING=new re("FLOATING"),ie.FLOATING_SINGLE=new re("FLOATING SINGLE"),ie.maximumPreciseValue=9007199254740992,e(se.prototype,{toGeometry:function(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new E(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new E(t.getMinX(),t.getMinY()),new E(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new E(t.getMinX(),t.getMinY()),new E(t.getMinX(),t.getMaxY()),new E(t.getMaxX(),t.getMaxY()),new E(t.getMaxX(),t.getMinY()),new E(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(N(arguments[0],H))return new At(arguments[0],this)}},createMultiLineString:function(){return 0===arguments.length?new wt(null,this):1===arguments.length?new wt(arguments[0],this):void 0},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 instanceof Lt&&(i=!0)}if(null===e)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(se.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Vt)return this.createMultiPolygon(se.toPolygonArray(t));if(a instanceof At)return this.createMultiLineString(se.toLineStringArray(t));if(a instanceof Gt)return this.createMultiPoint(se.toPointArray(t));x.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 E){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(N(arguments[0],H))return new Gt(arguments[0],this)}},getCoordinateSequenceFactory:function(){return this._coordinateSequenceFactory},createPolygon:function(){if(0===arguments.length)return this.createPolygon(null,null);if(1===arguments.length){if(N(arguments[0],H)){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 Yt){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){return new Vt(arguments[0],arguments[1],this)}},getSRID:function(){return this._SRID},createGeometryCollection:function(){return 0===arguments.length?new Lt(null,this):1===arguments.length?new Lt(arguments[0],this):void 0},createGeometry:function(t){return new Ut(this).edit(t,{edit:function(){if(2===arguments.length&&arguments[1]instanceof K&&N(arguments[0],H)){var t=arguments[0];return 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(N(arguments[0],H))return new Yt(arguments[0],this)}},createMultiPolygon:function(){return 0===arguments.length?new kt(null,this):1===arguments.length?new kt(arguments[0],this):void 0},createMultiPoint:function(){if(0===arguments.length)return new zt(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new zt(arguments[0],this);if(N(arguments[0],H)){var t=arguments[0];if(null===t)return this.createMultiPoint(new Array(0).fill(null));for(var e=new Array(t.size()).fill(null),n=0;nthis.getEdgeDistance(t,1)?(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;er?i:r;else{var o=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(s=i>r?o:a)||t.equals(e)||(s=Math.max(o,a))}return x.isTrue(!(0===s&&!t.equals(e)),"Bad distance calculation"),s},ce.nonRobustComputeEdgeDistance=function(t,e,n){var i=t.x-e.x,r=t.y-e.y,s=Math.sqrt(i*i+r*r);return x.isTrue(!(0===s&&!t.equals(e)),"Invalid distance calculation"),s},ce.DONT_INTERSECT=0,ce.DO_INTERSECT=1,ce.COLLINEAR=2,ce.NO_INTERSECTION=0,ce.POINT_INTERSECTION=1,ce.COLLINEAR_INTERSECTION=2,v(fe,ce),e(fe.prototype,{isInSegmentEnvelopes:function(t){var e=new M(this._inputLines[0][0],this._inputLines[0][1]),n=new M(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},computeIntersection:function(){if(3!==arguments.length)return ce.prototype.computeIntersection.apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2];if(this._isProper=!1,M.intersects(e,n,t)&&0===z.index(e,n,t)&&0===z.index(n,e,t))return this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),this._result=ce.POINT_INTERSECTION,null;this._result=ce.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=k.intersection(t,e,n,i)}catch(s){if(!(s instanceof A))throw s;r=fe.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 E(fe.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)1e-4&&Y.out.println("Distance = "+r.distance(s))},intersectionWithNormalization:function(t,e,n,i){var r=new E(t),s=new E(e),o=new E(n),a=new E(i),u=new E;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=M.intersects(t,e,n),s=M.intersects(t,e,i),o=M.intersects(n,i,t),a=M.intersects(n,i,e);return r&&s?(this._intPt[0]=n,this._intPt[1]=i,ce.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=t,this._intPt[1]=e,ce.COLLINEAR_INTERSECTION):r&&o?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||s||a?ce.COLLINEAR_INTERSECTION:ce.POINT_INTERSECTION):r&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||o?ce.COLLINEAR_INTERSECTION:ce.POINT_INTERSECTION):s&&o?(this._intPt[0]=i,this._intPt[1]=t,!i.equals(t)||r||a?ce.COLLINEAR_INTERSECTION:ce.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||r||o?ce.COLLINEAR_INTERSECTION:ce.POINT_INTERSECTION):ce.NO_INTERSECTION},normalizeToEnvCentre:function(t,e,n,i,r){var s=t.xe.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.xi.x?n.x:i.x,f=n.y>i.y?n.y:i.y,g=((s>l?s:l)+(ah?o:h)+(u0&&s>0||r<0&&s<0)return ce.NO_INTERSECTION;var o=z.index(n,i,t),a=z.index(n,i,e);return o>0&&a>0||o<0&&a<0?ce.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 E(n):0===s?this._intPt[0]=new E(i):0===o?this._intPt[0]=new E(t):0===a&&(this._intPt[0]=new E(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,n,i)),ce.POINT_INTERSECTION)},interfaces_:function(){return[]},getClass:function(){return fe}}),fe.nearestEndpoint=function(t,e,n,i){var r=t,s=X.pointToSegment(t,n,i),o=X.pointToSegment(e,n,i);return o=0&&n>=0?Math.max(e,n):e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof E){var i=arguments[0];return z.index(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 ge))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},intersection:function(t){var e=new fe;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},project:function(){if(arguments[0]instanceof E){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new E(t);var e=this.projectionFactor(t),n=new E;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 ge){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 ge(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 X.pointToLinePerpendicular(t,this.p0,this.p1)},minY:function(){return Math.min(this.p0.y,this.p1.y)},midPoint:function(){return ge.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,i=e*e+n*n;return i<=0?s.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i},closestPoints:function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),i=s.MAX_VALUE,r=null,o=this.closestPoint(t.p0);i=o.distance(t.p0),n[0]=o,n[1]=t.p0;var a=this.closestPoint(t.p1);(r=a.distance(t.p1))0&&e<1?this.project(t):this.p0.distance(t)1||s.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 ge){var t=arguments[0];return X.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof E){var e=arguments[0];return X.pointToSegment(e,this.p0,this.p1)}},pointAlong:function(t){var e=new E;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[g,p]},getClass:function(){return ge}}),ge.midPoint=function(t,e){return new E((t.x+e.x)/2,(t.y+e.y)/2)},ge.serialVersionUID=0x2d2172135f411c00,e(de.prototype,{interfaces_:function(){return[]},getClass:function(){return de}}),de.toLocationSymbol=function(t){switch(t){case de.EXTERIOR:return"e";case de.BOUNDARY:return"b";case de.INTERIOR:return"i";case de.NONE:return"-"}throw new i("Unknown location value: "+t)},de.INTERIOR=0,de.BOUNDARY=1,de.EXTERIOR=2,de.NONE=-1,e(_e.prototype,{isIntersects:function(){return!this.isDisjoint()},isCovers:function(){return(_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])||_e.isTrue(this._matrix[de.INTERIOR][de.BOUNDARY])||_e.isTrue(this._matrix[de.BOUNDARY][de.INTERIOR])||_e.isTrue(this._matrix[de.BOUNDARY][de.BOUNDARY]))&&this._matrix[de.EXTERIOR][de.INTERIOR]===Nt.FALSE&&this._matrix[de.EXTERIOR][de.BOUNDARY]===Nt.FALSE},isCoveredBy:function(){return(_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])||_e.isTrue(this._matrix[de.INTERIOR][de.BOUNDARY])||_e.isTrue(this._matrix[de.BOUNDARY][de.INTERIOR])||_e.isTrue(this._matrix[de.BOUNDARY][de.BOUNDARY]))&&this._matrix[de.INTERIOR][de.EXTERIOR]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.EXTERIOR]===Nt.FALSE},set:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e=0&&e>=0&&this.setAtLeast(t,e,n)},isWithin:function(){return _e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&this._matrix[de.INTERIOR][de.EXTERIOR]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.EXTERIOR]===Nt.FALSE},isTouches:function(t,e){return t>e?this.isTouches(e,t):(t===Nt.A&&e===Nt.A||t===Nt.L&&e===Nt.L||t===Nt.L&&e===Nt.A||t===Nt.P&&e===Nt.A||t===Nt.P&&e===Nt.L)&&(this._matrix[de.INTERIOR][de.INTERIOR]===Nt.FALSE&&(_e.isTrue(this._matrix[de.INTERIOR][de.BOUNDARY])||_e.isTrue(this._matrix[de.BOUNDARY][de.INTERIOR])||_e.isTrue(this._matrix[de.BOUNDARY][de.BOUNDARY])))},isOverlaps:function(t,e){return t===Nt.P&&e===Nt.P||t===Nt.A&&e===Nt.A?_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&_e.isTrue(this._matrix[de.INTERIOR][de.EXTERIOR])&&_e.isTrue(this._matrix[de.EXTERIOR][de.INTERIOR]):t===Nt.L&&e===Nt.L&&(1===this._matrix[de.INTERIOR][de.INTERIOR]&&_e.isTrue(this._matrix[de.INTERIOR][de.EXTERIOR])&&_e.isTrue(this._matrix[de.EXTERIOR][de.INTERIOR]))},isEquals:function(t,e){return t===e&&(_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&this._matrix[de.INTERIOR][de.EXTERIOR]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.EXTERIOR]===Nt.FALSE&&this._matrix[de.EXTERIOR][de.INTERIOR]===Nt.FALSE&&this._matrix[de.EXTERIOR][de.BOUNDARY]===Nt.FALSE)},toString:function(){for(var t=new Mt("123456789"),e=0;e<3;e++)for(var n=0;n<3;n++)t.setCharAt(3*e+n,Nt.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 i("Should be length 9: "+t);for(var e=0;e<3;e++)for(var n=0;n<3;n++)if(!_e.matches(this._matrix[e][n],t.charAt(3*e+n)))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[de.INTERIOR][de.INTERIOR]===Nt.FALSE&&this._matrix[de.INTERIOR][de.BOUNDARY]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.INTERIOR]===Nt.FALSE&&this._matrix[de.BOUNDARY][de.BOUNDARY]===Nt.FALSE},isCrosses:function(t,e){return t===Nt.P&&e===Nt.L||t===Nt.P&&e===Nt.A||t===Nt.L&&e===Nt.A?_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&_e.isTrue(this._matrix[de.INTERIOR][de.EXTERIOR]):t===Nt.L&&e===Nt.P||t===Nt.A&&e===Nt.P||t===Nt.A&&e===Nt.L?_e.isTrue(this._matrix[de.INTERIOR][de.INTERIOR])&&_e.isTrue(this._matrix[de.EXTERIOR][de.INTERIOR]):t===Nt.L&&e===Nt.L&&0===this._matrix[de.INTERIOR][de.INTERIOR]},interfaces_:function(){return[d]},getClass:function(){return _e}}),_e.matches=function(){if(Number.isInteger(arguments[0])&&"string"==typeof arguments[1]){var t=arguments[0],e=arguments[1];return e===Nt.SYM_DONTCARE||(e===Nt.SYM_TRUE&&(t>=0||t===Nt.TRUE)||(e===Nt.SYM_FALSE&&t===Nt.FALSE||(e===Nt.SYM_P&&t===Nt.P||(e===Nt.SYM_L&&t===Nt.L||e===Nt.SYM_A&&t===Nt.A))))}if("string"==typeof arguments[0]&&"string"==typeof arguments[1]){var n=arguments[0],i=arguments[1];return new _e(n).matches(i)}},_e.isTrue=function(t){return t>=0||t===Nt.TRUE},e(pe.prototype,{interfaces_:function(){return[]},getClass:function(){return pe}}),pe.toDegrees=function(t){return 180*t/Math.PI},pe.normalize=function(t){for(;t>Math.PI;)t-=pe.PI_TIMES_2;for(;t<=-Math.PI;)t+=pe.PI_TIMES_2;return t},pe.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)}},pe.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},pe.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},pe.interiorAngle=function(t,e,n){var i=pe.angle(e,t),r=pe.angle(e,n);return Math.abs(r-i)},pe.normalizePositive=function(t){if(t<0){for(;t<0;)t+=pe.PI_TIMES_2;t>=pe.PI_TIMES_2&&(t=0)}else{for(;t>=pe.PI_TIMES_2;)t-=pe.PI_TIMES_2;t<0&&(t=0)}return t},pe.angleBetween=function(t,e,n){var i=pe.angle(e,t),r=pe.angle(e,n);return pe.diff(i,r)},pe.diff=function(t,e){var n=null;return(n=tMath.PI&&(n=2*Math.PI-n),n},pe.toRadians=function(t){return t*Math.PI/180},pe.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?pe.COUNTERCLOCKWISE:n<0?pe.CLOCKWISE:pe.NONE},pe.angleBetweenOriented=function(t,e,n){var i=pe.angle(e,t),r=pe.angle(e,n)-i;return r<=-Math.PI?r+pe.PI_TIMES_2:r>Math.PI?r-pe.PI_TIMES_2:r},pe.PI_TIMES_2=2*Math.PI,pe.PI_OVER_2=Math.PI/2,pe.PI_OVER_4=Math.PI/4,pe.COUNTERCLOCKWISE=z.COUNTERCLOCKWISE,pe.CLOCKWISE=z.CLOCKWISE,pe.NONE=z.COLLINEAR,e(me.prototype,{area:function(){return me.area(this.p0,this.p1,this.p2)},signedArea:function(){return me.signedArea(this.p0,this.p1,this.p2)},interpolateZ:function(t){if(null===t)throw new i("Supplied point is null.");return me.interpolateZ(t,this.p0,this.p1,this.p2)},longestSideLength:function(){return me.longestSideLength(this.p0,this.p1,this.p2)},isAcute:function(){return me.isAcute(this.p0,this.p1,this.p2)},circumcentre:function(){return me.circumcentre(this.p0,this.p1,this.p2)},area3D:function(){return me.area3D(this.p0,this.p1,this.p2)},centroid:function(){return me.centroid(this.p0,this.p1,this.p2)},inCentre:function(){return me.inCentre(this.p0,this.p1,this.p2)},interfaces_:function(){return[]},getClass:function(){return me}}),me.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)},me.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},me.det=function(t,e,n,i){return t*i-e*n},me.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)},me.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},me.isAcute=function(t,e,n){return!!pe.isAcute(t,e,n)&&(!!pe.isAcute(e,n,t)&&!!pe.isAcute(n,t,e))},me.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*me.det(s,o,a,u);return new E(i-me.det(o,s*s+o*o,u,a*a+u*u)/l,r+me.det(s,s*s+o*o,a,a*a+u*u)/l)},me.perpendicularBisector=function(t,e){var n=e.x-t.x,i=e.y-t.y;return new k(new k(t.x+n/2,t.y+i/2,1),new k(t.x-i+n/2,t.y+n+i/2,1))},me.angleBisector=function(t,e,n){var i=e.distance(t),r=i/(i+e.distance(n)),s=n.x-t.x,o=n.y-t.y;return new E(t.x+r*s,t.y+r*o)},me.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},me.centroid=function(t,e,n){return new E((t.x+e.x+n.x)/3,(t.y+e.y+n.y)/3)},me.inCentre=function(t,e,n){var i=e.distance(n),r=t.distance(n),s=t.distance(e),o=i+r+s;return new E((i*t.x+r*e.x+s*n.x)/o,(i*t.y+r*e.y+s*n.y)/o)};var ve=Object.freeze({Coordinate:E,CoordinateList:b,Envelope:M,LineSegment:ge,GeometryFactory:se,Geometry:K,Point:Gt,LineString:At,LinearRing:Yt,Polygon:Vt,GeometryCollection:Lt,MultiPoint:zt,MultiLineString:wt,MultiPolygon:kt,Dimension:Nt,IntersectionMatrix:_e,PrecisionModel:ie,Location:de,Triangle:me});function ye(){this._pt=[new E,new E],this._distance=s.NaN,this._isNull=!0}function xe(){}function Ee(){this._g0=null,this._g1=null,this._ptDist=new ye,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e}function Ie(){this._maxPtDist=new ye,this._minPtDist=new ye,this._euclideanDist=new xe,this._geom=null;var t=arguments[0];this._geom=t}function Ne(){this._maxPtDist=new ye,this._minPtDist=new ye,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))}function Ce(){}function Se(){}function Le(){this._min=s.POSITIVE_INFINITY,this._max=s.NEGATIVE_INFINITY}function we(){}function Re(){Le.apply(this),this._item=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._min=t,this._max=e,this._item=n}e(ye.prototype,{getCoordinates:function(){return this._pt},getCoordinate:function(t){return this._pt[t]},setMinimum:function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var i=e.distance(n);ithis._distance&&this.initialize(e,n,i)}},interfaces_:function(){return[]},getClass:function(){return ye}}),e(xe.prototype,{interfaces_:function(){return[]},getClass:function(){return xe}}),xe.computeDistance=function(){if(arguments[2]instanceof ye&&arguments[0]instanceof At&&arguments[1]instanceof E)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=new ge,r=t.getCoordinates(),s=0;s1||t<=0)throw new i("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},compute:function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},distance:function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},computeOrientedDistance:function(t,e,n){var i=new Ie(e);if(t.apply(i),n.setMaximum(i.getMaxPointDistance()),this._densifyFrac>0){var r=new Ne(e,this._densifyFrac);t.apply(r),n.setMaximum(r.getMaxPointDistance())}},orientedDistance:function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},interfaces_:function(){return[]},getClass:function(){return Ee}}),Ee.distance=function(){if(2===arguments.length)return(t=new Ee(arguments[0],arguments[1])).distance();if(3===arguments.length){var t,e=arguments[0],n=arguments[1],i=arguments[2];return(t=new Ee(e,n)).setDensifyFraction(i),t.distance()}},e(Ie.prototype,{filter:function(t){this._minPtDist.initialize(),xe.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},getMaxPointDistance:function(){return this._maxPtDist},interfaces_:function(){return[Z]},getClass:function(){return Ie}}),e(Ne.prototype,{filter:function(t,e){if(0===e)return null;for(var n=t.getCoordinate(e-1),i=t.getCoordinate(e),r=(i.x-n.x)/this._numSubSegs,s=(i.y-n.y)/this._numSubSegs,o=0;oe||this._maxs?1:0},interfaces_:function(){return[_]},getClass:function(){return we}}),Le.NodeComparator=we,v(Re,Le),e(Re.prototype,{query:function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},interfaces_:function(){return[]},getClass:function(){return Re}});var Te={reverseOrder:function(){return{compare:function(t,e){return e.compareTo(t)}}},min:function(t){return Te.sort(t),t.get(0)},sort:function(t,e){var n=t.toArray();e?It.sort(n,e):It.sort(n);for(var i=t.iterator(),r=0,s=n.length;ri&&(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=z.index(t,e,this._p);if(r===z.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 Be(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[C]},getClass:function(){return Be}}),Be.isAtomic=function(t){return!(t instanceof Lt)},e(Ve.prototype,{locate:function(t){return Ve.locate(t,this._geom)},interfaces_:function(){return[Se]},getClass:function(){return Ve}}),Ve.locatePointInPolygon=function(t,e){if(e.isEmpty())return de.EXTERIOR;var n=e.getExteriorRing(),i=Ve.locatePointInRing(t,n);if(i!==de.INTERIOR)return i;for(var r=0;r0&&this.addPoint(t[0])},addHole:function(t){for(var e=z.isCCW(t),n=0;n0)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.setAreaBasePoint(t[0]);for(var e=!z.isCCW(t),n=0;n1||a<0||a>1)&&(r=!0)}}else r=!0;return r?U.min(He.distancePointLine(t,n,i),He.distancePointLine(e,n,i),He.distancePointLine(n,t,e),He.distancePointLine(i,t,e)):0},He.isPointInRing=function(t,e){return He.locatePointInRing(t,e)!==de.EXTERIOR},He.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new E;t.getCoordinate(0,i);for(var r=i.x,s=i.y,o=1;on.y&&(n=o,r=s)}var a=r;do{(a-=1)<0&&(a=e)}while(t[a].equals2D(n)&&a!==r);var u=r;do{u=(u+1)%e}while(t[u].equals2D(n)&&u!==r);var l=t[a],h=t[u];if(l.equals2D(n)||h.equals2D(n)||l.equals2D(h))return!1;var c=He.computeOrientation(l,n,h);return 0===c?l.x>h.x:c>0},He.locatePointInRing=function(t,e){return De.locatePointInRing(t,e)},He.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)},He.computeOrientation=function(t,e,n){return He.orientationIndex(t,e,n)},He.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new i("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r=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)}},He.isOnLine=function(t,e){for(var n=new fe,i=1;i=this.size())throw new IndexOutOfBoundsException;return this.array_[t]},je.prototype.push=function(t){return this.array_.push(t),t},je.prototype.pop=function(t){if(0===this.array_.length)throw new We;return this.array_.pop()},je.prototype.peek=function(){if(0===this.array_.length)throw new We;return this.array_[this.array_.length-1]},je.prototype.empty=function(){return 0===this.array_.length},je.prototype.isEmpty=function(){return this.empty()},je.prototype.search=function(t){return this.array_.indexOf(t)},je.prototype.size=function(){return this.array_.length},je.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e50&&(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;ne[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].y0;)e=n.pop();n.push(e),n.push(t[i])}return n.push(t[0]),n},interfaces_:function(){return[]},getClass:function(){return Ze}}),Ze.extractCoordinates=function(t){var e=new Ke;return t.apply(e),e.getCoordinates()},e(Qe.prototype,{compare:function(t,e){var n=t,i=e;return Qe.polarCompare(this._origin,n,i)},interfaces_:function(){return[_]},getClass:function(){return Qe}}),Qe.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=z.index(t,e,n);if(a===z.COUNTERCLOCKWISE)return 1;if(a===z.CLOCKWISE)return-1;var u=i*i+r*r,l=s*s+o*o;return ul?1:0},Ze.RadialComparator=Qe,e(Je.prototype,{addPolygon:function(t){if(t.isEmpty())return null;var e=null,n=null,i=this.horizontalBisector(t);if(0===i.getLength())n=0,e=i.getCoordinate();else{var r=i.intersection(t),s=this.widestGeometry(r);n=s.getEnvelopeInternal().getWidth(),e=Je.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;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=$e.getBisectorY(t);return this._factory.createLineString([new E(e.getMinX(),n),new E(e.getMaxX(),n)])},add:function(t){if(t instanceof Vt)this.addPolygon(t);else if(t instanceof Lt)for(var e=t,n=0;nthis._loY&&(this._loY=t):t>this._centreY&&tt&&(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 rn}}),rn.getSubnodeIndex=function(t,e){var n=-1;return t.min>=e&&(n=1),t.max<=e&&(n=0),n},e(sn.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,t>e&&(this.min=e,this.max=t)},getMax:function(){return this.max},interfaces_:function(){return[]},getClass:function(){return sn}}),on.exponent=function(t){return function(t,e){var n,i,r,s,o={32:8,64:11}[t];s||(n=e<0||1/e<0,isFinite(e)||(s={32:{d:127,c:128,b:0,a:0},64:{d:32752,c:0,b:0,a:0}}[t],n&&(s.d+=1<=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,o)-1,r=0)}return i}(64,t)-1023},on.powerOf2=function(t){return Math.pow(2,t)},e(an.prototype,{getInterval:function(){return this._interval},getLevel:function(){return this._level},computeKey:function(t){for(this._level=an.computeLevel(t),this._interval=new sn,this.computeInterval(this._level,t);!this._interval.contains(t);)this._level+=1,this.computeInterval(this._level,t)},computeInterval:function(t,e){var n=on.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 an}}),an.computeLevel=function(t){var e=t.getWidth();return on.exponent(e)+1},v(un,rn),e(un.prototype,{getInterval:function(){return this._interval},find:function(t){var e=rn.getSubnodeIndex(t,this._centre);return-1===e?this:null!==this._subnode[e]?this._subnode[e].find(t):this},insert:function(t){x.isTrue(null===this._interval||this._interval.contains(t._interval));var e=rn.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=rn.getSubnodeIndex(t,this._centre);return-1!==e?this.getSubnode(e).getNode(t):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 un(new sn(e,n),this._level-1)},interfaces_:function(){return[]},getClass:function(){return un}}),un.createNode=function(t){var e=new an(t);return new un(e.getInterval(),e.getLevel())},un.createExpanded=function(t,e){var n=new sn(e);null!==t&&n.expandToInclude(t._interval);var i=un.createNode(n);return null!==t&&i.insert(t),i},e(ln.prototype,{interfaces_:function(){return[]},getClass:function(){return ln}}),ln.isZeroWidth=function(t,e){var n=e-t;if(0===n)return!0;var i=n/Math.max(Math.abs(t),Math.abs(e));return on.exponent(i)<=ln.MIN_BINARY_EXPONENT},ln.MIN_BINARY_EXPONENT=-50,v(hn,rn),e(hn.prototype,{insert:function(t,e){var n=rn.getSubnodeIndex(t,hn.origin);if(-1===n)return this.add(e),null;var i=this._subnode[n];if(null===i||!i.getInterval().contains(t)){var r=un.createExpanded(i,t);this._subnode[n]=r}this.insertContained(this._subnode[n],t,e)},isSearchMatch:function(t){return!0},insertContained:function(t,e,n){x.isTrue(t.getInterval().contains(e));(ln.isZeroWidth(e.getMin(),e.getMax())?t.find(e):t.getNode(e)).add(n)},interfaces_:function(){return[]},getClass:function(){return hn}}),hn.origin=0,e(cn.prototype,{size:function(){return null!==this._root?this._root.size():0},insert:function(t,e){this.collectStats(t);var n=cn.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 sn(t,t))}if(arguments[0]instanceof sn){var e=arguments[0],n=new P;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 P;return this._root.addAllItems(t),t.iterator()},remove:function(t,e){var n=cn.ensureExtent(t,this._minExtent);return this._root.remove(n,e)},collectStats:function(t){var e=t.getWidth();e0&&(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 cn}}),cn.ensureExtent=function(t,e){var n=t.getMin(),i=t.getMax();return n!==i?t:(n===i&&(i=(n-=e/2)+e/2),new sn(n,i))},e(fn.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(n-e==1)return i.select(this,e),null;if(!t.intersects(r,s))return null;var o=Math.trunc((e+n)/2);ee?t:e)?3:n},gn.isInHalfPlane=function(t,e){return e===gn.SE?t===gn.SE||t===gn.SW:t===e||t===e+1},gn.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 i("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?gn.NE:gn.SE:e>=0?gn.NW:gn.SW}if(arguments[0]instanceof E&&arguments[1]instanceof E){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new i("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?gn.NE:gn.SE:r.y>=n.y?gn.NW:gn.SW}},gn.NE=0,gn.NW=1,gn.SW=2,gn.SE=3,e(dn.prototype,{interfaces_:function(){return[]},getClass:function(){return dn}}),dn.getChainStartIndices=function(t){var e=0,n=new P;n.add(new G(e));do{var i=dn.findChainEnd(t,e);n.add(new G(i)),e=i}while(e=t.length-1)return t.length-1;for(var i=gn.quadrant(t[n],t[n+1]),r=e+1;r0?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=i?(t=-t,e=-e,n=-n,i=-i):(r=-r,s=-t,t=-n,n=s,s=-e,e=-i,i=s),0=n))return-r;r=-r,t=-t,n=-n}for(;;){if(n-=(o=Math.floor(n/t))*t,(i-=o*e)<0)return-r;if(i>e)return r;if(t>n+n){if(ei+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(t-=(o=Math.floor(t/n))*n,(e-=o*i)<0)return r;if(e>i)return-r;if(n>t+t){if(ie+e)return r;t=n-t,e=i-e,r=-r}if(0===e)return 0===t?0:r;if(0===t)return-r}},e(pn.prototype,{isInside:function(t){},interfaces_:function(){return[]},getClass:function(){return pn}}),e(mn.prototype,{testLineSegment:function(t,e){var n,i,r,s,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<_n.signOfDet2x2(n,i,r,s)/(s-i)&&this._crossings++},buildIndex:function(){this._tree=new cn;for(var t=nt.removeRepeatedPoints(this._ring.getCoordinates()),e=dn.getChains(t),n=0;n=i;)i=r,s=o,o=xn.nextIndex(t,s),r=e.distancePerpendicular(t[o]);return ii&&(i=u),uo&&(o=l),l=t.length&&(e=0),e},xn.computeC=function(t,e,n){return t*n.y-e*n.x},xn.getMinimumDiameter=function(t){return new xn(t).getDiameter()},xn.getMinimumRectangle=function(t){return new xn(t).getMinimumRectangle()},xn.computeSegmentForLine=function(t,e,n){var i=null,r=null;return Math.abs(e)>Math.abs(t)?(i=new E(0,n/e),r=new E(1,n/e-t/e)):(i=new E(n/t,0),r=new E(n/t-e/t,1)),new ge(i,r)};var En=Object.freeze({Angle:pe,Centroid:Xe,CGAlgorithms:He,ConvexHull:Ze,Distance:X,InteriorPointArea:Je,InteriorPointLine:tn,InteriorPointPoint:en,RobustLineIntersector:fe,MCPointInRing:mn,MinimumBoundingCircle:yn,MinimumDiameter:xn});function In(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1}function Nn(){this._inputGeom=null,this._distanceTolerance=null;var t=arguments[0];this._inputGeom=t}function Cn(){In.apply(this),this.distanceTolerance=null;var t=arguments[0];this.distanceTolerance=t}e(In.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 Yt&&!i.isEmpty()||(n=!1);for(var r=new P,s=0;s0&&i<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},interfaces_:function(){return[]},getClass:function(){return In}}),e(Nn.prototype,{getResultGeometry:function(){return new Cn(this._distanceTolerance).transform(this._inputGeom)},setDistanceTolerance:function(t){if(t<=0)throw new i("Tolerance must be positive");this._distanceTolerance=t},interfaces_:function(){return[]},getClass:function(){return Nn}}),Nn.densifyPoints=function(t,e,n){for(var i=new ge,r=new b,s=0;s1)for(var u=o/a,l=1;lo?1:s0||this._isIn?de.INTERIOR:de.EXTERIOR)},interfaces_:function(){return[]},getClass:function(){return Mn}}),e(Dn.prototype,{interfaces_:function(){return[]},getClass:function(){return Dn}}),Dn.opposite=function(t){return t===Dn.LEFT?Dn.RIGHT:t===Dn.RIGHT?Dn.LEFT:t},Dn.ON=0,Dn.LEFT=1,Dn.RIGHT=2,e(An.prototype,{computeIntersections:function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},interfaces_:function(){return[]},getClass:function(){return An}}),e(Fn.prototype,{isDelete:function(){return this._eventType===Fn.DELETE},setDeleteEventIndex:function(t){this._deleteEventIndex=t},getObject:function(){return this._obj},compareTo:function(t){var e=t;return this._xValuee._xValue?1:this._eventTypee._eventType?1:0},getInsertEvent:function(){return this._insertEvent},isInsert:function(){return this._eventType===Fn.INSERT},isSameLabel:function(t){return null!==this._label&&this._label===t._label},getDeleteEventIndex:function(){return this._deleteEventIndex},interfaces_:function(){return[g]},getClass:function(){return Fn}}),Fn.INSERT=1,Fn.DELETE=2,e(Gn.prototype,{interfaces_:function(){return[]},getClass:function(){return Gn}}),e(qn.prototype,{isTrivialIntersection:function(t,e,n,i){if(t===n&&1===this._li.getIntersectionNum()){if(qn.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 qn}}),qn.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)},v(Bn,Gn),e(Bn.prototype,{prepareEvents:function(){Te.sort(this.events);for(var t=0;tthis.location.length){var e=new Array(3).fill(null);e[Dn.ON]=this.location[Dn.ON],e[Dn.LEFT]=de.NONE,e[Dn.RIGHT]=de.NONE,this.location=e}for(var n=0;n1&&t.append(de.toLocationSymbol(this.location[Dn.LEFT])),t.append(de.toLocationSymbol(this.location[Dn.ON])),this.location.length>1&&t.append(de.toLocationSymbol(this.location[Dn.RIGHT])),t.toString()},setLocations:function(t,e,n){this.location[Dn.ON]=t,this.location[Dn.LEFT]=e,this.location[Dn.RIGHT]=n},get:function(t){return t1},isAnyNull:function(){for(var t=0;t0||!e.coord.equals2D(i);r||n--;var s=new Array(n).fill(null),o=0;s[o++]=new E(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 zn(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 kn}}),e(Un.prototype,{getChainStartIndices:function(t){var e=0,n=new P;n.add(new G(e));do{var i=this.findChainEnd(t,e);n.add(new G(i)),e=i}while(en?e:n},getMinX:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return ee&&(i=1),this._depth[t][n]=i}}},getDelta:function(t){return this._depth[t][Dn.RIGHT]-this._depth[t][Dn.LEFT]},getLocation:function(t,e){return this._depth[t][e]<=0?de.EXTERIOR:de.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!==de.EXTERIOR&&i!==de.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=Hn.depthAtLocation(i):this._depth[e][n]+=Hn.depthAtLocation(i))}else if(3===arguments.length){var r=arguments[0],s=arguments[1];arguments[2]===de.INTERIOR&&this._depth[r][s]++}},interfaces_:function(){return[]},getClass:function(){return Hn}}),Hn.depthAtLocation=function(t){return t===de.EXTERIOR?0:t===de.INTERIOR?1:Hn.NULL_VALUE},Hn.NULL_VALUE=-1,e(Wn.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){x.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 Wn}}),v(jn,Wn),e(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,zn.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;s0?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;e0&&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 Xn(this)),this._mce},getEnvelope:function(){if(null===this._env){this._env=new M;for(var t=0;t0&&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;et._quadrant?1:this._quadrant=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===de.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},addPolygonRing:function(t,e,n){if(t.isEmpty())return null;var i=nt.removeRepeatedPoints(t.getCoordinates());if(i.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=i[0],null;var r=e,s=n;z.isCCW(i)&&(r=n,s=e);var o=new jn(i,new zn(this._argIndex,de.BOUNDARY,r,s));this._lineEdgeMap.put(t,o),this.insertEdge(o),this.insertPoint(this._argIndex,i[0],de.BOUNDARY)},insertPoint:function(t,e,n){var i=this._nodes.addNode(e),r=i.getLabel();null===r?i._label=new zn(t,n):r.setLocation(t,n)},createEdgeSetIntersector:function(){return new Bn},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&&arguments[0]instanceof K))return ei.prototype.add.apply(this,arguments);var t=arguments[0];if(t.isEmpty())return null;if(t instanceof kt&&(this._useBoundaryDeterminationRule=!1),t instanceof Vt)this.addPolygon(t);else if(t instanceof At)this.addLineString(t);else if(t instanceof Gt)this.addPoint(t);else if(t instanceof zt)this.addCollection(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof kt)this.addCollection(t);else{if(!(t instanceof Lt))throw new UnsupportedOperationException(t.getClass().getName());this.addCollection(t)}},addCollection:function(t){for(var e=0;e50?(null===this._areaPtLocator&&(this._areaPtLocator=new Ae(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},findEdge:function(){if(1===arguments.length&&arguments[0]instanceof At){var t=arguments[0];return this._lineEdgeMap.get(t)}return ei.prototype.findEdge.apply(this,arguments)},interfaces_:function(){return[]},getClass:function(){return ni}}),ni.determineBoundary=function(t,e){return t.isInBoundary(e)?de.BOUNDARY:de.INTERIOR};var ii=Object.freeze({GeometryGraph:ni});function ri(){}function si(){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 E(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 E(n,i),this._left=null,this._right=null,this._count=1,this._data=r}}function oi(){if(this._root=null,this._numberOfNodes=null,this._tolerance=null,0===arguments.length)oi.call(this,0);else if(1===arguments.length){var t=arguments[0];this._tolerance=t}}function ai(){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}e(ri.prototype,{visit:function(t){},interfaces_:function(){return[]},getClass:function(){return ri}}),e(si.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 si}}),e(oi.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 si(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 P;return this.query(t,e),e}if(2===arguments.length)if(arguments[0]instanceof M&&N(arguments[1],w)){var n=arguments[0],i=arguments[1];this.queryNode(this._root,n,!0,{interfaces_:function(){return[ri]},visit:function(t){i.add(t)}})}else if(arguments[0]instanceof M&&N(arguments[1],ri)){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=o<=s;rt&&(t=n)}return t+1},isEmpty:function(){var t=!0;if(this._items.isEmpty()){for(var e=0;e<4;e++)if(null!==this._subnode[e]&&!this._subnode[e].isEmpty()){t=!1;break}}else t=!1;return t},add:function(t){this._items.add(t)},interfaces_:function(){return[p]},getClass:function(){return li}}),li.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},e(hi.prototype,{getLevel:function(){return this._level},computeKey:function(){if(1===arguments.length){var t=arguments[0];for(this._level=hi.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=on.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 E((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 hi}}),hi.computeQuadLevel=function(t){var e=t.getWidth(),n=t.getHeight(),i=e>n?e:n;return on.exponent(i)+1},v(ci,li),e(ci.prototype,{find:function(t){var e=li.getSubnodeIndex(t,this._centrex,this._centrey);return-1===e?this:null!==this._subnode[e]?this._subnode[e].find(t):this},isSearchMatch:function(t){return null!==t&&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=li.getSubnodeIndex(t,this._centrex,this._centrey);return-1!==e?this.getSubnode(e).getNode(t):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 ci(new M(e,n,i,r),this._level-1)},insertNode:function(t){x.isTrue(null===this._env||this._env.contains(t._env));var e=li.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 ci}}),ci.createNode=function(t){var e=new hi(t);return new ci(e.getEnvelope(),e.getLevel())},ci.createExpanded=function(t,e){var n=new M(e);null!==t&&n.expandToInclude(t._env);var i=ci.createNode(n);return null!==t&&i.insertNode(t),i},v(fi,li),e(fi.prototype,{insert:function(t,e){var n=li.getSubnodeIndex(t,fi.origin.x,fi.origin.y);if(-1===n)return this.add(e),null;var i=this._subnode[n];if(null===i||!i.getEnvelope().contains(t)){var r=ci.createExpanded(i,t);this._subnode[n]=r}this.insertContained(this._subnode[n],t,e)},isSearchMatch:function(t){return!0},insertContained:function(t,e,n){x.isTrue(t.getEnvelope().contains(e));var i=ln.isZeroWidth(e.getMinX(),e.getMaxX()),r=ln.isZeroWidth(e.getMinY(),e.getMaxY());(i||r?t.find(e):t.getNode(e)).add(n)},interfaces_:function(){return[]},getClass:function(){return fi}}),fi.origin=new E(0,0),e(gi.prototype,{insert:function(t,e){},remove:function(t,e){},query:function(){},interfaces_:function(){return[]},getClass:function(){return gi}}),e(di.prototype,{size:function(){return null!==this._root?this._root.size():0},insert:function(t,e){this.collectStats(t);var n=di.ensureExtent(t,this._minExtent);this._root.insert(n,e)},query:function(){if(1===arguments.length){var t=arguments[0],e=new Me;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 P;return this._root.addAllItems(t),t},remove:function(t,e){var n=di.ensureExtent(t,this._minExtent);return this._root.remove(n,e)},collectStats:function(t){var e=t.getWidth();e0&&(this._minExtent=e);var n=t.getHeight();n0&&(this._minExtent=n)},depth:function(){return null!==this._root?this._root.depth():0},isEmpty:function(){return null===this._root||this._root.isEmpty()},interfaces_:function(){return[gi,p]},getClass:function(){return di}}),di.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&&(i=(n-=e/2)+e/2),r===s&&(s=(r-=e/2)+e/2),new M(n,i,r,s))},di.serialVersionUID=-0x678b60c967a25400;var _i=Object.freeze({Quadtree:di});function pi(){}function mi(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}function vi(){this._size=null,this._items=null,this._size=0,this._items=new P,this._items.add(null)}function yi(){this.normalOrder=null;var t=arguments[0];this.normalOrder=t}function xi(){if(this._childBoundables=new P,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}}function Ei(){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 Ii(){if(this._root=null,this._built=!1,this._itemBoundables=new P,this._nodeCapacity=null,0===arguments.length)Ii.call(this,Ii.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){var t=arguments[0];x.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}function Ni(){}function Ci(){if(0===arguments.length)Ci.call(this,Ci.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){var t=arguments[0];Ii.call(this,t)}}function Si(){var t=arguments[0];xi.call(this,t)}e(pi.prototype,{getBounds:function(){},interfaces_:function(){return[]},getClass:function(){return pi}}),e(mi.prototype,{getItem:function(){return this._item},getBounds:function(){return this._bounds},interfaces_:function(){return[pi,p]},getClass:function(){return mi}}),e(vi.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)!==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 vi}}),e(yi.prototype,{compare:function(t,e){var n=t.getDistance(),i=e.getDistance();return this.normalOrder?n>i?1:n===i?0:-1:n>i?-1:n===i?0:1},interfaces_:function(){return[_,p]},getClass:function(){return yi}}),e(xi.prototype,{getLevel:function(){return this._level},size:function(){return this._childBoundables.size()},getChildBoundables:function(){return this._childBoundables},addChildBoundable:function(t){x.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[pi,p]},getClass:function(){return xi}}),xi.serialVersionUID=0x5a1e55ec41369800,e(Ei.prototype,{expandToQueue:function(t,e){var n=Ei.isComposite(this._boundable1),r=Ei.isComposite(this._boundable2);if(n&&r)return Ei.area(this._boundable1)>Ei.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new i("neither boundable is composite")},isLeaves:function(){return!(Ei.isComposite(this._boundable1)||Ei.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 Ei(r.next(),e,this._itemDistance);s.getDistance()-2),i.getLevel()===n)return r.add(i),null;for(var s=i.getChildBoundables().iterator();s.hasNext();){var o=s.next();o instanceof xi?this.boundablesAtLevel(n,o,r):(x.isTrue(o instanceof mi),-1===n&&r.add(o))}return null}},query:function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new P;return this.isEmpty()?e:(this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(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.queryInternal(n,this._root,i)}},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 xi&&(s=this.remove(n,u,r)))){o=u;break}}return null!==o&&o.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(o),s}},createHigherLevels:function(t,e){x.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=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof xi){var i=this.depth(n);i>t&&(t=i)}}return t+1}},createParentBoundables:function(t,e){x.isTrue(!t.isEmpty());var n=new P;n.add(this.createNode(e));var i=new P(t);Te.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[p]},getClass:function(){return Ii}}),Ii.compareDoubles=function(t,e){return t>e?1:t0);for(var n=new P,i=0;i0;){if((E=(x=_.poll()).getDistance())>=a)break;x.isLeaves()?(a=E,u=x):x.expandToQueue(_,a)}return[u.getBoundable(0).getItem(),u.getBoundable(1).getItem()]}if(arguments[0]instanceof Ei&&Number.isInteger(arguments[1])){var l=arguments[0],h=arguments[1];return this.nearestNeighbour(l,s.POSITIVE_INFINITY,h)}}else if(3===arguments.length){if(N(arguments[2],Ni)&&arguments[0]instanceof M&&arguments[1]instanceof Object){var c=arguments[0],f=arguments[1],g=arguments[2],d=new mi(c,f);e=new Ei(this.getRoot(),d,g);return this.nearestNeighbour(e)[0]}if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ei&&"number"==typeof arguments[1]){var _,p=arguments[0],m=arguments[1],v=arguments[2];a=m;(_=new vi).add(p);for(var y=new java.util.PriorityQueuenew yi(!1);!_.isEmpty()&&a>=0;){var x,E;if((E=(x=_.poll()).getDistance())>=a)break;x.isLeaves()?y.size()E&&(y.poll(),y.add(x)),a=y.peek().getDistance()):x.expandToQueue(_,a)}return Ci.getItems(y)}}else if(4===arguments.length){var I=arguments[0],C=arguments[1],S=arguments[2],L=arguments[3];d=new mi(I,C),e=new Ei(this.getRoot(),d,S);return this.nearestNeighbour(e,L)}},interfaces_:function(){return[gi,p]},getClass:function(){return Ci}}),Ci.centreX=function(t){return Ci.avg(t.getMinX(),t.getMaxX())},Ci.avg=function(t,e){return(t+e)/2},Ci.getItems=function(t){for(var e=new Array(t.size()).fill(null),n=t.iterator(),i=0;n.hasNext();)e[i]=n.next().getBoundable(0).getItem(),i++;return e},Ci.centreY=function(t){return Ci.avg(t.getMinY(),t.getMaxY())},v(Si,xi),e(Si.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 Si}}),Ci.STRtreeNode=Si,Ci.serialVersionUID=0x39920f7d5f261e0,Ci.xComparator={interfaces_:function(){return[_]},compare:function(t,e){return Ii.compareDoubles(Ci.centreX(t.getBounds()),Ci.centreX(e.getBounds()))}},Ci.yComparator={interfaces_:function(){return[_]},compare:function(t,e){return Ii.compareDoubles(Ci.centreY(t.getBounds()),Ci.centreY(e.getBounds()))}},Ci.intersectsOp={interfaces_:function(){return[IntersectsOp]},intersects:function(t,e){return t.intersects(e)}},Ci.DEFAULT_NODE_CAPACITY=10;var Li=Object.freeze({STRtree:Ci}),wi=Object.freeze({kdtree:ui,quadtree:_i,strtree:Li}),Ri=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];function Ti(t){this.geometryFactory=t||new se}e(Ti.prototype,{read:function(t){var e=void 0,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!Pi[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==Ri.indexOf(n)?Pi[n].call(this,e.coordinates):"GeometryCollection"===n?Pi[n].call(this,e.geometries):Pi[n].call(this,e)},write:function(t){var e=t.getGeometryType();if(!Oi[e])throw new Error("Geometry is not supported");return Oi[e].call(this,t)}});var Pi={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var i=t.geometry.type;if(!Pi[i])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Pi.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;ne?1:0},qi.compare=function(t,e,n){if(e.equals2D(n))return 0;var i=qi.relativeSign(e.x,n.x),r=qi.relativeSign(e.y,n.y);switch(t){case 0:return qi.compareValue(i,r);case 1:return qi.compareValue(r,i);case 2:return qi.compareValue(r,-i);case 3:return qi.compareValue(-i,r);case 4:return qi.compareValue(-i,-r);case 5:return qi.compareValue(-r,-i);case 6:return qi.compareValue(-r,i);case 7:return qi.compareValue(i,-r)}return x.shouldNeverReachHere("invalid octant value"),0},qi.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0},e(Bi.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.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:qi.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[g]},getClass:function(){return Bi}}),e(Vi.prototype,{getSplitCoordinates:function(){var t=new b;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 P;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=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof E&&arguments[1]instanceof E){var s=arguments[0],o=arguments[1],a=o.x-s.x,u=o.y-s.y;if(0===a&&0===u)throw new i("Cannot compute the octant for two identical points "+s);return Yi.octant(a,u)}},e(ki.prototype,{getCoordinates:function(){},size:function(){},getCoordinate:function(t){},isClosed:function(){},setData:function(t){},getData:function(){},interfaces_:function(){return[]},getClass:function(){return ki}}),e(Ui.prototype,{addIntersection:function(t,e){},interfaces_:function(){return[ki]},getClass:function(){return Ui}}),e(Xi.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:Yi.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 E(n.getIntersection(r));this.addIntersection(s,i)}},toString:function(){return he.toLineString(new Kt(this._pts))},getNodeList:function(){return this._nodeList},addIntersectionNode:function(t,e){var n=e,i=n+1;if(in.getId()&&(n.computeOverlaps(r,t),this._nOverlaps++),this._segInt.isDone())return null}},interfaces_:function(){return[]},getClass:function(){return Ki}}),v(Zi,Hi),e(Zi.prototype,{overlap:function(){if(4!==arguments.length)return Hi.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 Zi}}),Ki.SegmentOverlapAction=Zi,e(Qi.prototype,{rescale:function(){if(N(arguments[0],S))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 E(n[0]),new E(n[1]));for(t=0;t=8&&e.getJoinStyle()===er.JOIN_ROUND&&(this._closingSegLengthFactor=cr.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}function fr(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}function gr(){this._subgraphs=null,this._seg=new ge;var t=arguments[0];this._subgraphs=t}function dr(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new ge(t),this._leftDepth=e}function _r(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new P;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n}function pr(){this._edgeMap=new pt,this._edgeList=null,this._ptInAreaLocation=[de.NONE,de.NONE]}function mr(){pr.apply(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}function vr(){ti.apply(this)}function yr(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=yr.orientation(t)}function xr(){this._edges=new P,this._ocaMap=new pt}function Er(){}function Ir(){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 Nr(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new xr;var t=arguments[0];this._bufParams=t}function Cr(){this._li=new fe,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],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new i("Scale factor must be non-zero");1!==e&&(this._pt=new E(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new E,this._p1Scaled=new E),this.initCorners(this._pt)}function Lr(){this._index=null;var t=arguments[0];this._index=t}function wr(){nn.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 Rr(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new P}function Tr(){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 fe,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()}function Pr(){if(this._argGeom=null,this._distance=null,this._bufParams=new er,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}}e($i.prototype,{isSimpleMultiPoint:function(t){if(t.isEmpty())return!0;for(var e=new yt,n=0;n0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&i===z.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=Dn.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)}x.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)===Dn.LEFT&&(this._orientedDe=this._minDe.getSym())},interfaces_:function(){return[]},getClass:function(){return nr}}),ir.prototype.addLast=function(t){this.array_.push(t)},ir.prototype.removeFirst=function(){return this.array_.shift()},ir.prototype.isEmpty=function(){return 0===this.array_.length},e(rr.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 Jn("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(Dn.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(Dn.RIGHT)>=1&&e.getDepth(Dn.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},computeDepths:function(t){var e=new ut,n=new ir,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;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(!qe.isInRing(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,Dn.RIGHT);if(i===de.NONE)return null;if(this._label.getLocation(n)===de.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;n2){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 P,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&null===i.getEdgeRing()){var r=new ar(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)&&qe.isInRing(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 x.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];ei.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),r=new P,s=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(s,this._shellList,r),this.placeFreeHoles(this._shellList,r)}},interfaces_:function(){return[]},getClass:function(){return ur}}),e(lr.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=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)=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 hr}}),hr.COORDINATE_ARRAY_TYPE=new Array(0).fill(null),e(cr.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=z.index(this._s0,this._s1,this._s2),i=n===z.CLOCKWISE&&this._side===Dn.LEFT||n===z.COUNTERCLOCKWISE&&this._side===Dn.RIGHT;0===n?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},addLineEndCap:function(t,e){var n=new ge(t,e),i=new ge;this.computeOffsetSegment(n,Dn.LEFT,this._distance,i);var r=new ge;this.computeOffsetSegment(n,Dn.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 er.CAP_ROUND:this._segList.addPt(i.p1),this.addDirectedFillet(e,a+Math.PI/2,a-Math.PI/2,z.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case er.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case er.CAP_SQUARE:var u=new E;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new E(i.p1.x+u.x,i.p1.y+u.y),h=new E(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=k.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 A))throw t;s=new E(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)=h&&(a-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,a,h,i,r),this._segList.addPt(n)},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=pe.angle(r,this._seg0.p0),o=(pe.angle(r,this._seg1.p1),pe.angleBetweenOriented(this._seg0.p0,r,this._seg1.p1)/2),a=pe.normalize(s+o),u=pe.normalize(a+Math.PI),l=i*n,h=n-l*Math.abs(Math.sin(o)),c=new ge(r,new E(r.x+l*Math.cos(u),r.y+l*Math.sin(u))),f=c.pointAlongOffset(1,h),g=c.pointAlongOffset(1,-h);this._side===Dn.LEFT?(this._segList.addPt(f),this._segList.addPt(g)):(this._segList.addPt(g),this._segList.addPt(f))},addDirectedFillet:function(t,e,n,i,r){var s=i===z.CLOCKWISE?-1:1,o=Math.abs(e-n),a=Math.trunc(o/this._filletAngleQuantum+.5);if(a<1)return null;var u;u=o/a;for(var l=0,h=new E;l0){var n=new E((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 E((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 E(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(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 hr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*cr.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()===er.JOIN_BEVEL||this._bufParams.getJoinStyle()===er.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,z.CLOCKWISE,this._distance))},closeRing:function(){this._segList.closeRing()},hasNarrowConcaveAngle:function(){return this._hasNarrowConcaveAngle},interfaces_:function(){return[]},getClass:function(){return cr}}),cr.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,cr.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,cr.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,cr.MAX_CLOSING_SEG_LEN_FACTOR=80,e(fr.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&&nt.reverse(s),s},computeSingleSidedBufferCurve:function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var r=lr.simplify(t,-i),s=r.length-1;n.initSideSegments(r[s],r[s-1],Dn.LEFT),n.addFirstSegment();for(var o=s-2;o>=0;o--)n.addNextSegment(r[o],!0)}else{n.addSegments(t,!1);var a=lr.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],Dn.LEFT),n.addFirstSegment();for(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===Dn.RIGHT&&(i=-i);var r=lr.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=lr.simplify(t,n),r=i.length-1;e.initSideSegments(i[0],i[1],Dn.LEFT);for(var s=2;s<=r;s++)e.addNextSegment(i[s],!0);e.addLastSegment(),e.addLineEndCap(i[r-1],i[r]);var o=lr.simplify(t,-n),a=o.length-1;e.initSideSegments(o[a],o[a-1],Dn.LEFT);for(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 er.CAP_ROUND:e.createCircle(t);break;case er.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 fr.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=lr.simplify(t,-i),s=r.length-1;n.initSideSegments(r[s],r[s-1],Dn.LEFT),n.addFirstSegment();for(var o=s-2;o>=0;o--)n.addNextSegment(r[o],!0)}else{var a=lr.simplify(t,i),u=a.length-1;n.initSideSegments(a[0],a[1],Dn.LEFT),n.addFirstSegment();for(o=2;o<=u;o++)n.addNextSegment(a[o],!0)}n.addLastSegment()},getSegGen:function(t){return new cr(this._precisionModel,this._bufParams,t)},interfaces_:function(){return[]},getClass:function(){return fr}}),fr.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;nr.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3===arguments.length)if(N(arguments[2],w)&&arguments[0]instanceof E&&arguments[1]instanceof $n){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||z.index(this._seg.p0,this._seg.p1,s)===z.RIGHT)){var l=o.getDepth(Dn.LEFT);this._seg.p0.equals(u[n])||(l=o.getDepth(Dn.RIGHT));var h=new dr(this._seg,l);a.add(h)}}}else if(N(arguments[2],w)&&arguments[0]instanceof E&&N(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:Te.min(e)._leftDepth},interfaces_:function(){return[]},getClass:function(){return gr}}),e(dr.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[g]},getClass:function(){return dr}}),gr.DepthSegment=dr,e(_r.prototype,{addPoint:function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,de.EXTERIOR,de.INTERIOR)},addPolygon:function(t){var e=this._distance,n=Dn.LEFT;this._distance<0&&(e=-this._distance,n=Dn.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,de.EXTERIOR,de.INTERIOR);for(var s=0;s0&&this.isErodedCompletely(o,-this._distance)||this.addPolygonRing(a,e,Dn.opposite(n),de.INTERIOR,de.EXTERIOR)}},isTriangleErodedCompletely:function(t,e){var n=new me(t[0],t[1],t[2]),i=n.inCentre();return X.pointToSegment(i,n.p0,n.p1)=Yt.MINIMUM_VALID_SIZE&&z.isCCW(t)&&(s=r,o=i,n=Dn.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 Vt)this.addPolygon(t);else if(t instanceof At)this.addLineString(t);else if(t instanceof Gt)this.addPoint(t);else if(t instanceof zt)this.addCollection(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof kt)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=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(Dn.LEFT)),i=t.getDepth(Dn.RIGHT),r=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,r)!==i)throw new Jn("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var s=arguments[0],o=arguments[1],a=arguments[2],u=s;u=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&&(x.isTrue(null!==e,"found null for first outgoing dirEdge"),x.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();){e.next().isInResult()&&t++}return t}if(1===arguments.length){var n=arguments[0];for(t=0,e=this.iterator();e.hasNext();){e.next().getEdgeRing()===n&&t++}return t}},getLabel:function(){return this._label},findCoveredLineEdges:function(){for(var t=de.NONE,e=this.iterator();e.hasNext();){var n=(r=e.next()).getSym();if(!r.isLineEdge()){if(r.isInResult()){t=de.INTERIOR;break}if(n.isInResult()){t=de.EXTERIOR;break}}}if(t===de.NONE)return null;var i=t;for(e=this.iterator();e.hasNext();){var r;n=(r=e.next()).getSym();r.isLineEdge()?r.getEdge().setCovered(i===de.INTERIOR):(r.isInResult()&&(i=de.EXTERIOR),n.isInResult()&&(i=de.INTERIOR))}},computeLabelling:function(t){pr.prototype.computeLabelling.call(this,t),this._label=new zn(de.NONE);for(var e=this.iterator();e.hasNext();)for(var n=e.next().getEdge().getLabel(),i=0;i<2;i++){var r=n.getLocation(i);r!==de.INTERIOR&&r!==de.BOUNDARY||this._label.setLocation(i,de.INTERIOR)}},interfaces_:function(){return[]},getClass:function(){return mr}}),v(vr,ti),e(vr.prototype,{createNode:function(t){return new Kn(t,new mr)},interfaces_:function(){return[]},getClass:function(){return vr}}),e(yr.prototype,{compareTo:function(t){var e=t;return yr.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},interfaces_:function(){return[g]},getClass:function(){return yr}}),yr.orientation=function(t){return 1===nt.increasingDirection(t)},yr.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;var c=(u+=r)===o,f=(l+=s)===a;if(c&&!f)return-1;if(!c&&f)return 1;if(c&&f)return 0}},e(xr.prototype,{print:function(t){t.print("MULTILINESTRING ( ");for(var e=0;e0&&t.print(","),t.print("(");for(var i=n.getCoordinates(),r=0;r0&&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;ei||this._maxys;if(o)return!1;var a=this.intersectsToleranceSquare(t,e);return x.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 E(this._maxx,this._maxy),this._corner[1]=new E(this._minx,this._maxy),this._corner[2]=new E(this._minx,this._miny),this._corner[3]=new E(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 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 Sr}}),Sr.SAFE_ENV_EXPANSION_FACTOR=.75,e(Lr.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 wr(e,n,i);return this._index.query(r,{interfaces_:function(){return[Ce]},visitItem:function(t){t.select(r,s)}}),s.isNodeAdded()}},interfaces_:function(){return[]},getClass:function(){return Lr}}),v(wr,nn),e(wr.prototype,{isNodeAdded:function(){return this._isNodeAdded},select:function(){if(!(2===arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof fn))return nn.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 wr}}),Lr.HotPixelSnapAction=wr,e(Rr.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=0;t--){try{this.bufferReducedPrecision(t)}catch(t){if(!(t instanceof Jn))throw t;this._saveException=t}if(null!==this._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var e=arguments[0],n=new ie(Pr.precisionScaleFactor(this._argGeom,this._distance,e));this.bufferFixedPrecision(n)}},computeGeometry:function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===ie.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},setQuadrantSegments:function(t){this._bufParams.setQuadrantSegments(t)},bufferOriginalPrecision:function(){try{var t=new Nr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof m))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 Pr}}),Pr.bufferOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new Pr(t).getResultGeometry(e)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof K&&"number"==typeof arguments[1]){var n=arguments[0],i=arguments[1],r=arguments[2];return(a=new Pr(n)).setQuadrantSegments(r),a.getResultGeometry(i)}if(arguments[2]instanceof er&&arguments[0]instanceof K&&"number"==typeof arguments[1]){var s=arguments[0],o=arguments[1];return(a=new Pr(s,arguments[2])).getResultGeometry(o)}}else if(4===arguments.length){var a,u=arguments[0],l=arguments[1],h=arguments[2],c=arguments[3];return(a=new Pr(u)).setQuadrantSegments(h),a.setEndCapStyle(c),a.getResultGeometry(l)}},Pr.precisionScaleFactor=function(t,e,n){var i=t.getEnvelopeInternal(),r=U.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(e>0?e:0),s=n-Math.trunc(Math.log(r)/Math.log(10)+1);return Math.pow(10,s)},Pr.CAP_ROUND=er.CAP_ROUND,Pr.CAP_BUTT=er.CAP_FLAT,Pr.CAP_FLAT=er.CAP_FLAT,Pr.CAP_SQUARE=er.CAP_SQUARE,Pr.MAX_PRECISION_DIGITS=12;var Or=Object.freeze({BufferOp:Pr,BufferParameters:er});function br(){this._comps=null;var t=arguments[0];this._comps=t}function Mr(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){var t=arguments[0],e=arguments[1];Mr.call(this,t,Mr.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 Dr(){this._pts=null;var t=arguments[0];this._pts=t}function Ar(){this._locations=null;var t=arguments[0];this._locations=t}function Fr(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Mn,this._minDistanceLocation=null,this._minDistance=s.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];Fr.call(this,t,e,0)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i,this._terminateDistance=r}}e(br.prototype,{filter:function(t){t instanceof Vt&&this._comps.add(t)},interfaces_:function(){return[Ct]},getClass:function(){return br}}),br.getPolygons=function(){if(1===arguments.length){var t=arguments[0];return br.getPolygons(t,new P)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Vt?n.add(e):e instanceof Lt&&e.apply(new br(n)),n}},e(Mr.prototype,{isInsideArea:function(){return this._segIndex===Mr.INSIDE_AREA},getCoordinate:function(){return this._pt},getGeometryComponent:function(){return this._component},getSegmentIndex:function(){return this._segIndex},interfaces_:function(){return[]},getClass:function(){return Mr}}),Mr.INSIDE_AREA=-1,e(Dr.prototype,{filter:function(t){t instanceof Gt&&this._pts.add(t)},interfaces_:function(){return[Ct]},getClass:function(){return Dr}}),Dr.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Gt?Te.singletonList(t):Dr.getPoints(t,new P)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Gt?n.add(e):e instanceof Lt&&e.apply(new Dr(n)),n}},e(Ar.prototype,{filter:function(t){(t instanceof Gt||t instanceof At||t instanceof Vt)&&this._locations.add(new Mr(t,0,t.getCoordinate()))},interfaces_:function(){return[Ct]},getClass:function(){return Ar}}),Ar.getLocations=function(t){var e=new P;return t.apply(new Ar(e)),e},e(Fr.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=this._geom[e];if(i.getDimension()<2)return null;var r=1-e,s=br.getPolygons(i);if(s.size()>0){var o=Ar.getLocations(this._geom[r]);if(this.computeContainmentDistance(o,s,n),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[r]=n[0],this._minDistanceLocation[e]=n[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&N(arguments[0],w)&&N(arguments[1],w)){for(var a=arguments[0],u=arguments[1],l=arguments[2],h=0;hthis._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;sn)&&new Fr(t,e,n).distance()<=n},Fr.nearestPoints=function(t,e){return new Fr(t,e).nearestPoints()};var Gr=Object.freeze({DistanceOp:Fr});function qr(){this._factory=null,this._directedEdges=new P,this._coordinates=null;var t=arguments[0];this._factory=t}function Br(){this._isMarked=!1,this._isVisited=!1,this._data=null}function Vr(){Br.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=gn.quadrant(r,s),this._angle=Math.atan2(s,r)}function zr(){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];Vr.call(this,t,e,n,i)}function Yr(){if(Br.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 kr(){this._outEdges=new P,this._sorted=!1}function Ur(){if(Br.apply(this),this._pt=null,this._deStar=null,1===arguments.length){var t=arguments[0];Ur.call(this,t,new kr)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._pt=e,this._deStar=n}}function Xr(){Yr.apply(this),this._line=null;var t=arguments[0];this._line=t}function Hr(){this._nodeMap=new pt}function Wr(){this._edges=new ut,this._dirEdges=new ut,this._nodeMap=new Hr}function jr(){Wr.apply(this)}function Kr(){this._graph=new jr,this._mergedLineStrings=null,this._factory=null,this._edgeStrings=null}e(qr.prototype,{getCoordinates:function(){if(null===this._coordinates){for(var t=0,e=0,n=new b,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&&nt.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 qr}}),e(Br.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 Br}}),Br.getComponentWithVisitedState=function(t,e){for(;t.hasNext();){var n=t.next();if(n.isVisited()===e)return n}return null},Br.setVisited=function(t,e){for(;t.hasNext();){t.next().setVisited(e)}},Br.setMarked=function(t,e){for(;t.hasNext();){t.next().setMarked(e)}},v(Vr,Br),e(Vr.prototype,{isRemoved:function(){return null===this._parentEdge},compareDirection:function(t){return this._quadrant>t._quadrant?1:this._quadrant=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ni(0,i,s),this._arg[1]=new ni(1,r,s)}}function ds(){this._ptLocator=new Mn,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new xr,this._resultPolyList=new P,this._resultLineList=new P,this._resultPointList=new P;var t=arguments[0],e=arguments[1];gs.call(this,t,e),this._graph=new ei(new vr),this._geomFact=t.getFactory()}e(Qr.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:Yi.octant(this.getCoordinate(t),this.getCoordinate(t+1))},setData:function(t){this._data=t},getData:function(){return this._data},toString:function(){return he.toLineString(new Kt(this._pts))},interfaces_:function(){return[ki]},getClass:function(){return Qr}}),e(Jr.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&&!(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[Er]},getClass:function(){return Jr}}),Jr.createAllIntersectionsFinder=function(t){var e=new Jr(t);return e.setFindAllIntersections(!0),e},Jr.createAnyIntersectionFinder=function(t){return new Jr(t)},Jr.createIntersectionCounter=function(t){var e=new Jr(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e},e($r.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 Jr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new Ki;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 Jn(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 "+he.toLineString(t[0],t[1])+" and "+he.toLineString(t[2],t[3])},interfaces_:function(){return[]},getClass:function(){return $r}}),$r.computeIntersections=function(t){var e=new $r(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()},e(ts.prototype,{checkValid:function(){this._nv.checkValid()},interfaces_:function(){return[]},getClass:function(){return ts}}),ts.toSegmentStrings=function(t){for(var e=new P,n=t.iterator();n.hasNext();){var i=n.next();e.add(new Qr(i.getCoordinates(),i))}return e},ts.checkValid=function(t){new ts(t).checkValid()},e(es.prototype,{map:function(t){for(var e=new P,n=0;n=0&&t.add(s+1,new E(r),!1)}},findSegmentIndexToSnap:function(t,e){for(var n=s.MAX_VALUE,i=-1,r=0;re&&(e=i)}return e}if(2===arguments.length){var r=arguments[0],s=arguments[1];return Math.min(ss.computeOverlaySnapTolerance(r),ss.computeOverlaySnapTolerance(s))}},ss.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*ss.SNAP_PRECISION_FACTOR},ss.snapToSelf=function(t,e,n){return new ss(t).snapToSelf(e,n)},ss.SNAP_PRECISION_FACTOR=1e-9,v(os,In),e(os.prototype,{snapLine:function(t,e){var n=new rs(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 os}}),e(as.prototype,{getCommon:function(){return s.longBitsToDouble(this._commonBits)},add:function(t){var e=s.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=as.signExpBits(this._commonBits),this._isFirst=!1,null):as.signExpBits(e)!==this._commonSignExp?(this._commonBits.high=0,this._commonBits.low=0,null):(this._commonMantissaBitsCount=as.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=as.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},toString:function(){if(1===arguments.length){var t=arguments[0],e=s.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+r.toBinaryString(t),i=n.substring(n.length-64);return i.substring(0,1)+" "+i.substring(1,12)+"(exp) "+i.substring(12)+" [ "+e+" ]"}},interfaces_:function(){return[]},getClass:function(){return as}}),as.getBit=function(t,e){var n=1<>>20},as.zeroLowerBits=function(t,e){var n="low";if(e>32&&(t.low=0,e%=32,n="high"),e>0){var i=e<32?~((1<=0;i--){if(as.getBit(t,i)!==as.getBit(e,i))return n;n++}return 52},e(us.prototype,{addCommonBits:function(t){var e=new hs(this._commonCoord);t.apply(e),t.geometryChanged()},removeCommonBits:function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new E(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new hs(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 us}}),e(ls.prototype,{filter:function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},getCommonCoordinate:function(){return new E(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},interfaces_:function(){return[Z]},getClass:function(){return ls}}),e(hs.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[St]},getClass:function(){return hs}}),us.CommonCoordinateFilter=ls,us.Translater=hs,e(cs.prototype,{selfSnap:function(t){return new ss(t).snapTo(t,this._snapTolerance)},removeCommonBits:function(t){this._cbr=new us,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=ds.overlayOp(e[0],e[1],t);return this.prepareResult(n)},checkValid:function(t){t.isValid()||Y.out.println("Snapped geometry is invalid")},computeSnapTolerance:function(){this._snapTolerance=ss.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},snap:function(t){var e=this.removeCommonBits(t);return ss.snap(e[0],e[1],this._snapTolerance)},interfaces_:function(){return[]},getClass:function(){return cs}}),cs.overlayOp=function(t,e,n){return new cs(t,e).getResultGeometry(n)},cs.union=function(t,e){return cs.overlayOp(t,e,ds.UNION)},cs.intersection=function(t,e){return cs.overlayOp(t,e,ds.INTERSECTION)},cs.symDifference=function(t,e){return cs.overlayOp(t,e,ds.SYMDIFFERENCE)},cs.difference=function(t,e){return cs.overlayOp(t,e,ds.DIFFERENCE)},e(fs.prototype,{getResultGeometry:function(t){var e=null,n=!1,i=null;try{e=ds.overlayOp(this._geom[0],this._geom[1],t);n=!0}catch(t){if(!(t instanceof m))throw t;i=t}if(!n)try{e=cs.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof m?i:t}return e},interfaces_:function(){return[]},getClass:function(){return fs}}),fs.overlayOp=function(t,e,n){return new fs(t,e).getResultGeometry(n)},fs.union=function(t,e){return fs.overlayOp(t,e,ds.UNION)},fs.intersection=function(t,e){return fs.overlayOp(t,e,ds.INTERSECTION)},fs.symDifference=function(t,e){return fs.overlayOp(t,e,ds.SYMDIFFERENCE)},fs.difference=function(t,e){return fs.overlayOp(t,e,ds.DIFFERENCE)},e(gs.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 gs}}),v(ds,gs),e(ds.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 zn(t.getLabel())).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 P;return r.addAll(t),r.addAll(e),r.addAll(n),r.isEmpty()?ds.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)!==de.EXTERIOR)return!0}return!1},replaceCollapsedEdges:function(){for(var t=new P,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 P;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),ts.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new ur(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var i=new ns(this,this._geomFact,this._ptLocator);this._resultLineList=i.build(t);var r=new is(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()&&ds.isResultOfOp(i.getLocation(0,Dn.RIGHT),i.getLocation(1,Dn.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):(x.isTrue(!i.isNull(r,Dn.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(r,Dn.LEFT,i.getLocation(r,Dn.LEFT)),x.isTrue(!i.isNull(r,Dn.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(r,Dn.RIGHT,i.getLocation(r,Dn.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=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},isCoveredByA:function(t){return!!this.isCovered(t,this._resultPolyList)},interfaces_:function(){return[]},getClass:function(){return ds}}),ds.overlayOp=function(t,e,n){return new ds(t,e).getResultGeometry(n)},ds.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ds.createEmptyResult(ds.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new i("This method does not support GeometryCollection arguments");return fs.overlayOp(t,e,ds.UNION)},ds.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return ds.createEmptyResult(ds.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return es.map(t,{interfaces_:function(){return[MapOp]},map:function(t){return t.intersection(n)}})}if(t.isGeometryCollection()||e.isGeometryCollection())throw new i("This method does not support GeometryCollection arguments");return fs.overlayOp(t,e,ds.INTERSECTION)},ds.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ds.createEmptyResult(ds.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new i("This method does not support GeometryCollection arguments");return fs.overlayOp(t,e,ds.SYMDIFFERENCE)},ds.resultDimension=function(t,e,n){var i=e.getDimension(),r=n.getDimension(),s=-1;switch(t){case ds.INTERSECTION:s=Math.min(i,r);break;case ds.UNION:s=Math.max(i,r);break;case ds.DIFFERENCE:s=i;break;case ds.SYMDIFFERENCE:s=Math.max(i,r)}return s},ds.createEmptyResult=function(t,e,n,i){var r=null;switch(ds.resultDimension(t,e,n)){case-1:r=i.createGeometryCollection();break;case 0:r=i.createPoint();break;case 1:r=i.createLineString();break;case 2:r=i.createPolygon()}return r},ds.difference=function(t,e){if(t.isEmpty())return ds.createEmptyResult(ds.DIFFERENCE,t,e,t.getFactory());if(e.isEmpty())return t.copy();if(t.isGeometryCollection()||e.isGeometryCollection())throw new i("This method does not support GeometryCollection arguments");return fs.overlayOp(t,e,ds.DIFFERENCE)},ds.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),i=t.getLocation(1);return ds.isResultOfOp(n,i,e)}if(3===arguments.length){var r=arguments[0],s=arguments[1],o=arguments[2];switch(r===de.BOUNDARY&&(r=de.INTERIOR),s===de.BOUNDARY&&(s=de.INTERIOR),o){case ds.INTERSECTION:return r===de.INTERIOR&&s===de.INTERIOR;case ds.UNION:return r===de.INTERIOR||s===de.INTERIOR;case ds.DIFFERENCE:return r===de.INTERIOR&&s!==de.INTERIOR;case ds.SYMDIFFERENCE:return r===de.INTERIOR&&s!==de.INTERIOR||r!==de.INTERIOR&&s===de.INTERIOR}return!1}},ds.INTERSECTION=1,ds.UNION=2,ds.DIFFERENCE=3,ds.SYMDIFFERENCE=4;var _s=Object.freeze({OverlayOp:ds});function ps(){this._edgeRing=null,this._next=null,this._label=-1;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];Vr.call(this,t,e,n,i)}function ms(){Yr.apply(this),this._line=null;var t=arguments[0];this._line=t}function vs(){this._factory=null,this._deList=new P,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 ys(){}function xs(){Wr.apply(this),this._factory=null;var t=arguments[0];this._factory=t}function Es(){if(this._lineStringAdder=new Is(this),this._graph=null,this._dangles=new P,this._cutEdges=new P,this._invalidRingLines=new P,this._holeList=null,this._shellList=null,this._polyList=null,this._isCheckingRingsValid=!0,this._extractOnlyPolygonal=null,this._geomFactory=null,0===arguments.length)Es.call(this,!1);else if(1===arguments.length){var t=arguments[0];this._extractOnlyPolygonal=t}}function Is(){this.p=null;var t=arguments[0];this.p=t}v(ps,Vr),e(ps.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 ps}}),v(ms,Yr),e(ms.prototype,{getLine:function(){return this._line},interfaces_:function(){return[]},getClass:function(){return ms}}),e(vs.prototype,{isIncluded:function(){return this._isIncluded},getCoordinates:function(){if(null===this._ringPts){for(var t=new b,e=this._deList.iterator();e.hasNext();){var n=e.next(),i=n.getEdge();vs.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(),this._ring.isValid())},build:function(t){var e=t;do{this.add(e),e.setRing(this),e=e.getNext(),x.isTrue(null!==e,"found null DE in ring"),x.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=0;i--)n.add(t[i],!1)},vs.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=nt.ptNotInList(n.getCoordinates(),l.getCoordinates());var c=!1;qe.isInRing(r,l.getCoordinates())&&(c=!0),c&&(null===s||o.contains(h))&&(o=(s=u).getRing().getEnvelopeInternal())}}return s},e(ys.prototype,{compare:function(t,e){var n=e;return t.getRing().getEnvelope().compareTo(n.getRing().getEnvelope())},interfaces_:function(){return[_]},getClass:function(){return ys}}),vs.EnvelopeComparator=ys,v(xs,Wr),e(xs.prototype,{findEdgeRing:function(t){var e=new vs(this._factory);return e.build(t),e},computeDepthParity:function(){if(0===arguments.length)for(;;){return null}else arguments.length},computeNextCWEdges:function(){for(var t=this.nodeIterator();t.hasNext();){var e=t.next();xs.computeNextCWEdges(e)}},addEdge:function(t){if(t.isEmpty())return null;var e=nt.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 ps(r,s,e[1],!0),a=new ps(s,r,e[e.length-2],!1),u=new ms(t);u.setDirectedEdges(o,a),this.add(u)},deleteCutEdges:function(){this.computeNextCWEdges(),xs.findLabeledEdgeRings(this._dirEdges);for(var t=new P,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(),xs.label(this._dirEdges,-1);var t=xs.findLabeledEdgeRings(this._dirEdges);this.convertMaximalToMinimalEdgeRings(t);for(var e=new P,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 Ur(t),this.add(e)),e},convertMaximalToMinimalEdgeRings:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),i=n.getLabel(),r=xs.findIntersectionNodes(n,i);if(null!==r)for(var s=r.iterator();s.hasNext();){var o=s.next();xs.computeNextCCWEdges(o,i)}}},deleteDangles:function(){for(var t=this.findNodesOfDegree(1),e=new ut,n=new je,i=t.iterator();i.hasNext();)n.push(i.next());for(;!n.isEmpty();){var r=n.pop();xs.deleteAllEdges(r);for(i=r.getOutEdges().getEdges().iterator();i.hasNext();){var s=i.next();s.setMarked(!0);var o=s.getSym();null!==o&&o.setMarked(!0);var a=s.getEdge();e.add(a.getLine());var u=s.getToNode();1===xs.getDegreeNonDeleted(u)&&n.push(u)}}return e},interfaces_:function(){return[]},getClass:function(){return xs}}),xs.findLabeledEdgeRings=function(t){for(var e=new P,n=1,i=t.iterator();i.hasNext();){var r=i.next();if(!r.isMarked()&&!(r.getLabel()>=0)){e.add(r);var s=vs.findDirEdgesInRing(r);xs.label(s,n),n++}}return e},xs.getDegreeNonDeleted=function(t){for(var e=0,n=t.getOutEdges().getEdges().iterator();n.hasNext();){n.next().isMarked()||e++}return e},xs.deleteAllEdges=function(t){for(var e=t.getOutEdges().getEdges().iterator();e.hasNext();){var n=e.next();n.setMarked(!0);var i=n.getSym();null!==i&&i.setMarked(!0)}},xs.label=function(t,e){for(var n=t.iterator();n.hasNext();){n.next().setLabel(e)}},xs.computeNextCWEdges=function(t){for(var e=null,n=null,i=t.getOutEdges().getEdges().iterator();i.hasNext();){var r=i.next();if(!r.isMarked()){if(null===e&&(e=r),null!==n)n.getSym().setNext(r);n=r}}null!==n&&n.getSym().setNext(e)},xs.computeNextCCWEdges=function(t,e){for(var n=null,i=null,r=t.getOutEdges().getEdges(),s=r.size()-1;s>=0;s--){var o=r.get(s),a=o.getSym(),u=null;o.getLabel()===e&&(u=o);var l=null;a.getLabel()===e&&(l=a),null===u&&null===l||(null!==l&&(i=l),null!==u&&(null!==i&&(i.setNext(u),i=null),null===n&&(n=u)))}null!==i&&(x.isTrue(null!==n),i.setNext(n))},xs.getDegree=function(t,e){for(var n=0,i=t.getOutEdges().getEdges().iterator();i.hasNext();){i.next().getLabel()===e&&n++}return n},xs.findIntersectionNodes=function(t,e){var n=t,i=null;do{var r=n.getFromNode();xs.getDegree(r,e)>1&&(null===i&&(i=new P),i.add(r)),n=n.getNext(),x.isTrue(null!==n,"found null DE in ring"),x.isTrue(n===t||!n.isInRing(),"found DE already in ring")}while(n!==t);return i},e(Es.prototype,{getGeometry:function(){return null===this._geomFactory&&(this._geomFactory=new se),this.polygonize(),this._extractOnlyPolygonal?this._geomFactory.buildGeometry(this._polyList):this._geomFactory.createGeometryCollection(se.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 P,null===this._graph)return null;this._dangles=this._graph.deleteDangles(),this._cutEdges=this._graph.deleteCutEdges();var t=this._graph.getEdgeRings(),e=new P;this._invalidRingLines=new P,this._isCheckingRingsValid?this.findValidRings(t,e,this._invalidRingLines):e=t,this.findShellsAndHoles(e),Es.assignHolesToShells(this._holeList,this._shellList),Te.sort(this._shellList,new vs.EnvelopeComparator);var n=!0;this._extractOnlyPolygonal&&(Es.findDisjointShells(this._shellList),n=!1),this._polyList=Es.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(N(arguments[0],S))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.add(e)}else if(arguments[0]instanceof At){var n=arguments[0];this._geomFactory=n.getFactory(),null===this._graph&&(this._graph=new xs(this._geomFactory)),this._graph.addEdge(n)}else if(arguments[0]instanceof K){arguments[0].apply(this._lineStringAdder)}},setCheckRingsValid:function(t){this._isCheckingRingsValid=t},findShellsAndHoles:function(t){this._holeList=new P,this._shellList=new P;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 Es}}),Es.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))}},Es.extractPolygons=function(t,e){for(var n=new P,i=t.iterator();i.hasNext();){var r=i.next();(e||r.isIncluded())&&n.add(r.getPolygon())}return n},Es.assignHolesToShells=function(t,e){for(var n=t.iterator();n.hasNext();){var i=n.next();Es.assignHoleToShell(i,e)}},Es.assignHoleToShell=function(t,e){var n=vs.findEdgeRingContaining(t,e);null!==n&&n.addHole(t)},Es.findDisjointShells=function(t){Es.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)},e(Is.prototype,{filter:function(t){t instanceof At&&this.p.add(t)},interfaces_:function(){return[j]},getClass:function(){return Is}}),Es.LineStringAdder=Is;var Ns=Object.freeze({Polygonizer:Es});function Cs(){}function Ss(){if(this._edgeEnds=new P,1===arguments.length){var t=arguments[0];Ss.call(this,null,t)}else if(2===arguments.length){arguments[0];var e=arguments[1];Qn.call(this,e.getEdge(),e.getCoordinate(),e.getDirectedCoordinate(),new zn(e.getLabel())),this.insert(e)}}function Ls(){pr.apply(this)}function ws(){var t=arguments[0],e=arguments[1];Kn.call(this,t,e)}function Rs(){ti.apply(this)}function Ts(){this._li=new fe,this._ptLocator=new Mn,this._arg=null,this._nodes=new Zn(new Rs),this._im=null,this._isolatedEdges=new P,this._invalidPoint=null;var t=arguments[0];this._arg=t}function Ps(){this._rectEnv=null;var t=arguments[0];this._rectEnv=t.getEnvelopeInternal()}function Os(){this._li=new fe,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 E(t.getMinX(),t.getMinY()),this._diagUp1=new E(t.getMaxX(),t.getMaxY()),this._diagDown0=new E(t.getMinX(),t.getMaxY()),this._diagDown1=new E(t.getMaxX(),t.getMinY())}function bs(){this._isDone=!1}function Ms(){this._rectangle=null,this._rectEnv=null;var t=arguments[0];this._rectangle=t,this._rectEnv=t.getEnvelopeInternal()}function Ds(){bs.apply(this),this._rectEnv=null,this._intersects=!1;var t=arguments[0];this._rectEnv=t}function As(){bs.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 Fs(){bs.apply(this),this._rectEnv=null,this._rectIntersector=null,this._hasIntersection=!1,this._p0=new E,this._p1=new E;var t=arguments[0];this._rectEnv=t.getEnvelopeInternal(),this._rectIntersector=new Os(this._rectEnv)}function Gs(){if(this._relate=null,2===arguments.length){var t=arguments[0],e=arguments[1];gs.call(this,t,e),this._relate=new Ts(this._arg)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];gs.call(this,n,i,r),this._relate=new Ts(this._arg)}}e(Cs.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 Qn(t,n.coord,s,new zn(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 zn(t.getLabel());o.flip();var a=new Qn(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;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 Cs}}),v(Ss,Qn),e(Ss.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))===de.BOUNDARY&&n++,s===de.INTERIOR&&(i=!0)}var s=de.NONE;i&&(s=de.INTERIOR),n>0&&(s=ni.determineBoundary(e,n)),this._label.setLocation(t,s)},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===de.INTERIOR)return this._label.setLocation(t,e,de.INTERIOR),null;r===de.EXTERIOR&&this._label.setLocation(t,e,de.EXTERIOR)}}},getLabel:function(){return this._label},computeLabelSides:function(t){this.computeLabelSide(t,Dn.LEFT),this.computeLabelSide(t,Dn.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 zn(de.NONE,de.NONE,de.NONE):new zn(de.NONE);for(var i=0;i<2;i++)this.computeLabelOn(i,t),e&&this.computeLabelSides(i)},interfaces_:function(){return[]},getClass:function(){return Ss}}),v(Ls,pr),e(Ls.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 Ss(t),this.insertEdgeEnd(t,e)):e.insert(t)},interfaces_:function(){return[]},getClass:function(){return Ls}}),v(ws,Kn),e(ws.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 ws}}),v(Rs,ti),e(Rs.prototype,{createNode:function(t){return new ws(t,new Ls)},interfaces_:function(){return[]},getClass:function(){return Rs}}),e(Ts.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,de.EXTERIOR)},computeIM:function(){var t=new _e;if(t.set(de.EXTERIOR,de.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 Cs,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===de.BOUNDARY?o.setLabelBoundary(t):o.setLabel(t,de.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===de.BOUNDARY?o.setLabelBoundary(t):o.getLabel().isNull(t)&&o.setLabel(t,de.INTERIOR)}},labelIsolatedNodes:function(){for(var t=this._nodes.iterator();t.hasNext();){var e=t.next(),n=e.getLabel();x.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(de.INTERIOR,de.EXTERIOR,e.getDimension()),t.set(de.BOUNDARY,de.EXTERIOR,e.getBoundaryDimension()));var n=this._arg[1].getGeometry();n.isEmpty()||(t.set(de.EXTERIOR,de.INTERIOR,n.getDimension()),t.set(de.EXTERIOR,de.BOUNDARY,n.getBoundaryDimension()))},interfaces_:function(){return[]},getClass:function(){return Ts}}),e(Ps.prototype,{isContainedInBoundary:function(t){if(t instanceof Vt)return!1;if(t instanceof Gt)return this.isPointContainedInBoundary(t);if(t instanceof At)return this.isLineStringContainedInBoundary(t);for(var e=0;e0){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 Os}}),e(bs.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 Ds}}),v(As,bs),e(As.prototype,{isDone:function(){return!0===this._containsPoint},visit:function(t){if(!(t instanceof Vt))return null;var e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;for(var n=new E,i=0;i<4;i++)if(this._rectSeq.getCoordinate(i,n),e.contains(n)&&Ve.containsPointInPolygon(n,t))return this._containsPoint=!0,null},containsPoint:function(){return this._containsPoint},interfaces_:function(){return[]},getClass:function(){return As}}),v(Fs,bs),e(Fs.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=be.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;n0)&&(!!t.getEnvelopeInternal().covers(e.getEnvelopeInternal())&&(!!t.isRectangle()||new Gs(t,e).getIntersectionMatrix().isCovers())))},Gs.intersects=function(t,e){if(!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal()))return!1;if(t.isRectangle())return Ms.intersects(t,e);if(e.isRectangle())return Ms.intersects(e,t);if(t.isGeometryCollection()||e.isGeometryCollection()){for(var n=0;n0)&&(!!t.getEnvelopeInternal().contains(e.getEnvelopeInternal())&&(t.isRectangle()?Ps.contains(t,e):new Gs(t,e).getIntersectionMatrix().isContains())))};var qs=Object.freeze({RelateOp:Gs});function Bs(){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null;var t=arguments[0];this._geomFactory=Bs.extractFactory(t),this._inputGeoms=t}function Vs(){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 zs(){this._geometryType=null,this._comps=null;var t=arguments[0],e=arguments[1];this._geometryType=t,this._comps=e}function Ys(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new P)}function ks(){if(this._polygons=new P,this._lines=new P,this._points=new P,this._geomFact=null,1===arguments.length){if(N(arguments[0],S)){var t=arguments[0];this.extract(t)}else if(arguments[0]instanceof K){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)}}e(Bs.prototype,{extractElements:function(t,e){if(null===t)return null;for(var n=0;n=t.size()?null:t.get(e)},Ys.union=function(t){return new Ys(t).union()},Ys.STRTREE_NODE_CAPACITY=4,e(ks.prototype,{unionNoOpt:function(t){var e=this._geomFact.createPoint();return fs.overlayOp(t,e,ds.UNION)},unionWithNull:function(t,e){return null===t&&null===e?null:null===e?t:null===t?e:t.union(e)},extract:function(){if(N(arguments[0],S))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()),zs.extract(n,K.TYPENAME_POLYGON,this._polygons),zs.extract(n,K.TYPENAME_LINESTRING,this._lines),zs.extract(n,K.TYPENAME_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=Ys.union(this._polygons));var s=this.unionWithNull(n,r),o=null;return o=null===t?s:null===s?t:Vs.union(t,s),null===o?this._geomFact.createGeometryCollection():o},interfaces_:function(){return[]},getClass:function(){return ks}}),ks.union=function(){if(1===arguments.length){if(N(arguments[0],S))return new ks(arguments[0]).union();if(arguments[0]instanceof K)return new ks(arguments[0]).union()}else if(2===arguments.length){return new ks(arguments[0],arguments[1]).union()}};var Us=Object.freeze({UnaryUnionOp:ks});function Xs(){this._geometryFactory=new se,this._geomGraph=null,this._disconnectedRingcoord=null;var t=arguments[0];this._geomGraph=t}function Hs(){this._nodes=new Zn(new Rs)}function Ws(){this._li=new fe,this._geomGraph=null,this._nodeGraph=new Hs,this._invalidPoint=null;var t=arguments[0];this._geomGraph=t}function js(){this._graph=null,this._rings=new P,this._totalEnv=new M,this._index=null,this._nestedPt=null;var t=arguments[0];this._graph=t}function Ks(){if(this._errorType=null,this._pt=null,1===arguments.length){var t=arguments[0];Ks.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 Zs(){this._parentGeometry=null,this._isSelfTouchingRingFormingHoleValid=!1,this._validErr=null;var t=arguments[0];this._parentGeometry=t}e(Xs.prototype,{visitInteriorRing:function(t,e){var n=t.getCoordinates(),i=n[0],r=Xs.findDifferentPoint(n,i),s=e.findEdgeInSameDirection(i,r),o=e.findEdgeEnd(s),a=null;o.getLabel().getLocation(0,Dn.RIGHT)===de.INTERIOR?a=o:o.getSym().getLabel().getLocation(0,Dn.RIGHT)===de.INTERIOR&&(a=o.getSym()),x.isTrue(null!==a,"unable to find dirEdge with Interior on RHS"),this.visitLinkedDirectedEdges(a)},visitShellInteriors:function(t,e){if(t instanceof Vt){var n=t;this.visitInteriorRing(n.getExteriorRing(),e)}if(t instanceof kt)for(var i=t,r=0;r1)return this._invalidPoint=n.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 Ws}}),e(js.prototype,{buildIndex:function(){this._index=new Ci;for(var t=0;t=1&&(e=t.getCoordinateN(0)),this._validErr=new Ks(Ks.RING_NOT_CLOSED,e)}},checkShellsNotNested:function(t,e){for(var n=0;n=2&&(n=!0),e.edit(t,new $s(this._targetPM,n))},changePM:function(t,e){return this.createEditor(t.getFactory(),e).edit(t,new Ut.NoOpGeometryOperation)},setRemoveCollapsedComponents:function(t){this._removeCollapsed=t},createFactory:function(t,e){return new se(e,t.getSRID(),t.getCoordinateSequenceFactory())},setChangePrecisionModel:function(t){this._changePrecisionModel=t},reduce:function(t){var e=this.reducePointwise(t);return this._isPointwise?e:N(e,Bt)?Zs.isValid(e)?e:this.fixPolygonalTopology(e):e},setPointwise:function(t){this._isPointwise=t},createEditor:function(t,e){return t.getPrecisionModel()===e?new Ut:new Ut(this.createFactory(t,e))},interfaces_:function(){return[]},getClass:function(){return to}}),to.reduce=function(t,e){return new to(e).reduce(t)},to.reducePointwise=function(t,e){var n=new to(e);return n.setPointwise(!0),n.reduce(t)};var eo=Object.freeze({GeometryPrecisionReducer:to});function no(){this._pts=null,this._usePt=null,this._distanceTolerance=null,this._seg=new ge;var t=arguments[0];this._pts=t}function io(){this._inputGeom=null,this._distanceTolerance=null,this._isEnsureValidTopology=!0;var t=arguments[0];this._inputGeom=t}function ro(){In.apply(this),this._isEnsureValidTopology=!0,this._distanceTolerance=null;var t=arguments[0],e=arguments[1];this._isEnsureValidTopology=t,this._distanceTolerance=e}function so(){if(this._parent=null,this._index=null,2===arguments.length){var t=arguments[0],e=arguments[1];so.call(this,t,e,null,-1)}else if(4===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=arguments[3];ge.call(this,n,i),this._parent=r,this._index=s}}function oo(){if(this._parentLine=null,this._segs=null,this._resultSegs=new P,this._minimumSize=null,1===arguments.length){var t=arguments[0];oo.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 ao(){this._index=new di}function uo(){this._querySeg=null,this._items=new P;var t=arguments[0];this._querySeg=t}function lo(){this._li=new fe,this._inputIndex=new ao,this._outputIndex=new ao,this._line=null,this._linePts=null,this._distanceTolerance=0;var t=arguments[0],e=arguments[1];this._inputIndex=t,this._outputIndex=e}function ho(){this._inputIndex=new ao,this._outputIndex=new ao,this._distanceTolerance=0}function co(){this._inputGeom=null,this._lineSimplifier=new ho,this._linestringMap=null;var t=arguments[0];this._inputGeom=t}function fo(){In.apply(this),this._linestringMap=null;var t=arguments[0];this._linestringMap=t}function go(){this.tps=null;var t=arguments[0];this.tps=t}e(no.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;rn&&(n=s,i=r)}if(n<=this._distanceTolerance)for(r=t+1;rthis._distanceTolerance&&(s=!1);var u=new ge;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 ge;r.p0=t[e],r.p1=t[n];for(var s=-1,o=e,a=e+1;as&&(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=e[0]&&i0}function Co(){}function So(){this._subdiv=null,this._lastEdge=null;var t=arguments[0];this._subdiv=t,this.init()}function Lo(){if(this._seg=null,1===arguments.length){if("string"==typeof arguments[0]){var t=arguments[0];m.call(this,t)}else if(arguments[0]instanceof ge){var e=arguments[0];m.call(this,"Locate failed to converge (at edge: "+e+"). Possible causes include invalid Subdivision topology or very close sites"),this._seg=new ge(e)}}else if(2===arguments.length){var n=arguments[0],i=arguments[1];m.call(this,Lo.msgWithSpatial(n,i)),this._seg=new ge(i)}}function wo(){}function Ro(){this._visitedKey=0,this._quadEdges=new P,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 ge,this._triEdges=new Array(3).fill(null);var t=arguments[0],e=arguments[1];this._tolerance=e,this._edgeCoincidenceTolerance=e/Ro.EDGE_COINCIDENCE_TOL_FACTOR,this.createFrame(t),this._startingEdge=this.initSubdiv(),this._locator=new So(this)}function To(){}function Po(){this._triList=new P}function Oo(){this._triList=new P}function bo(){this._coordList=new b,this._triCoords=new P}function Mo(){if(this._ls=null,this._data=null,2===arguments.length){var t=arguments[0],e=arguments[1];this._ls=new ge(t,e)}else if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this._ls=new ge(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];Mo.call(this,new E(s,o,a),new E(u,l,h))}else if(7===arguments.length){var c=arguments[0],f=arguments[1],g=arguments[2],d=arguments[3],_=arguments[4],p=arguments[5],m=arguments[6];Mo.call(this,new E(c,f,g),new E(d,_,p),m)}}function Do(){this._initialVertices=null,this._segVertices=null,this._segments=new P,this._subdiv=null,this._incDel=null,this._convexHull=null,this._splitFinder=new vo,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 P(t),this._tolerance=e,this._kdt=new oi(e)}function Ao(){this._siteCoords=null,this._tolerance=0,this._subdiv=null}function Fo(){this._siteCoords=null,this._constraintLines=null,this._tolerance=0,this._subdiv=null,this._constraintVertexMap=new pt}function Go(){this._siteCoords=null,this._tolerance=0,this._subdiv=null,this._clipEnv=null,this._diagramEnv=null}e(po.prototype,{splitAt:function(){if(1===arguments.length){var t=arguments[0],e=this._minimumLen/this._segLen;if(t.distance(this._seg.p0)i&&(o=i),r.setMinimumLength(o),r.splitAt(s),r.getSplitPoint()},interfaces_:function(){return[mo]},getClass:function(){return vo}}),vo.projectedSplitPoint=function(t,e){return t.getLineSegment().project(e)},e(yo.prototype,{interfaces_:function(){return[]},getClass:function(){return yo}}),yo.triArea=function(t,e,n){return(e.x-t.x)*(n.y-t.y)-(e.y-t.y)*(n.x-t.x)},yo.isInCircleDDNormalized=function(t,e,n,i){var r=B.valueOf(t.x).selfSubtract(i.x),s=B.valueOf(t.y).selfSubtract(i.y),o=B.valueOf(e.x).selfSubtract(i.x),a=B.valueOf(e.y).selfSubtract(i.y),u=B.valueOf(n.x).selfSubtract(i.x),l=B.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)),_=u.multiply(u).selfAdd(l.multiply(l));return g.selfMultiply(c).selfAdd(d.selfMultiply(f)).selfAdd(_.selfMultiply(h)).doubleValue()>0},yo.checkRobustInCircle=function(t,e,n,i){var r=yo.isInCircleNonRobust(t,e,n,i),s=yo.isInCircleDDSlow(t,e,n,i),o=yo.isInCircleCC(t,e,n,i),a=me.circumcentre(t,e,n);Y.out.println("p radius diff a = "+Math.abs(i.distance(a)-t.distance(a))/t.distance(a)),r===s&&r===o||(Y.out.println("inCircle robustness failure (double result = "+r+", DD result = "+s+", CC result = "+o+")"),Y.out.println(he.toLineString(new Kt([t,e,n,i]))),Y.out.println("Circumcentre = "+he.toPoint(a)+" radius = "+t.distance(a)),Y.out.println("p radius diff a = "+Math.abs(i.distance(a)/t.distance(a)-1)),Y.out.println("p radius diff b = "+Math.abs(i.distance(a)/e.distance(a)-1)),Y.out.println("p radius diff c = "+Math.abs(i.distance(a)/n.distance(a)-1)),Y.out.println())},yo.isInCircleDDFast=function(t,e,n,i){var r=B.sqr(t.x).selfAdd(B.sqr(t.y)).selfMultiply(yo.triAreaDDFast(e,n,i)),s=B.sqr(e.x).selfAdd(B.sqr(e.y)).selfMultiply(yo.triAreaDDFast(t,n,i)),o=B.sqr(n.x).selfAdd(B.sqr(n.y)).selfMultiply(yo.triAreaDDFast(t,e,i)),a=B.sqr(i.x).selfAdd(B.sqr(i.y)).selfMultiply(yo.triAreaDDFast(t,e,n));return r.selfSubtract(s).selfAdd(o).selfSubtract(a).doubleValue()>0},yo.isInCircleCC=function(t,e,n,i){var r=me.circumcentre(t,e,n),s=t.distance(r);return i.distance(r)-s<=0},yo.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},yo.isInCircleDDSlow=function(t,e,n,i){var r=B.valueOf(i.x),s=B.valueOf(i.y),o=B.valueOf(t.x),a=B.valueOf(t.y),u=B.valueOf(e.x),l=B.valueOf(e.y),h=B.valueOf(n.x),c=B.valueOf(n.y),f=o.multiply(o).add(a.multiply(a)).multiply(yo.triAreaDDSlow(u,l,h,c,r,s)),g=u.multiply(u).add(l.multiply(l)).multiply(yo.triAreaDDSlow(o,a,h,c,r,s)),d=h.multiply(h).add(c.multiply(c)).multiply(yo.triAreaDDSlow(o,a,u,l,r,s)),_=r.multiply(r).add(s.multiply(s)).multiply(yo.triAreaDDSlow(o,a,u,l,h,c));return f.subtract(g).add(d).subtract(_).doubleValue()>0},yo.isInCircleNonRobust=function(t,e,n,i){return(t.x*t.x+t.y*t.y)*yo.triArea(e,n,i)-(e.x*e.x+e.y*e.y)*yo.triArea(t,n,i)+(n.x*n.x+n.y*n.y)*yo.triArea(t,e,i)-(i.x*i.x+i.y*i.y)*yo.triArea(t,e,n)>0},yo.isInCircleRobust=function(t,e,n,i){return yo.isInCircleNormalized(t,e,n,i)},yo.triAreaDDSlow=function(t,e,n,i,r,s){return n.subtract(t).multiply(s.subtract(e)).subtract(i.subtract(e).multiply(r.subtract(t)))},yo.triAreaDDFast=function(t,e,n){var i=B.valueOf(e.x).selfSubtract(t.x).selfMultiply(B.valueOf(n.y).selfSubtract(t.y)),r=B.valueOf(e.y).selfSubtract(t.y).selfMultiply(B.valueOf(n.x).selfSubtract(t.x));return i.selfSubtract(r)},e(xo.prototype,{circleCenter:function(t,e){var n=new xo(this.getX(),this.getY()),i=new k(this.bisector(n,t),this.bisector(t,e)),r=null;try{r=new xo(i.getX(),i.getY())}catch(i){if(!(i instanceof A))throw i;Y.err.println("a: "+n+" b: "+t+" c: "+e),Y.err.println(i)}return r},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 k(new k(t.getX()+n/2,t.getY()+i/2,1),new k(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())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 xo(t*this._p.x,t*this._p.y)},cross:function(){return new xo(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 xo(this._p.x-t.getX(),this._p.y-t.getY())},getY:function(){return this._p.y},classify:function(t,e){var n=e.sub(t),i=this.sub(t),r=n.crossProduct(i);return r>0?xo.LEFT:r<0?xo.RIGHT:n.getX()*i.getX()<0||n.getY()*i.getY()<0?xo.BEHIND:n.magn()n?10*e:10*n,this._frameVertex[0]=new xo((t.getMaxX()+t.getMinX())/2,t.getMaxY()+i),this._frameVertex[1]=new xo(t.getMinX()-i,t.getMinY()-i),this._frameVertex[2]=new xo(t.getMaxX()+i,t.getMinY()-i),this._frameEnv=new M(this._frameVertex[0].getCoordinate(),this._frameVertex[1].getCoordinate()),this._frameEnv.expandToInclude(this._frameVertex[2].getCoordinate())},getTriangleCoordinates:function(t){var e=new bo;return this.visitTriangles(e,t),e.getTriangles()},getVertices:function(t){for(var e=new ut,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 P,n=new ut,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 Po;return this.visitTriangles(e,t),e.getTriangleEdges()},getPrimaryEdges:function(t){this._visitedKey++;var e=new P,n=new je;n.push(this._startingEdge);for(var i=new ut;!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){Io.splice(t,t.oPrev()),Io.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 Lo(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 To,!0);for(var e=new P,n=this.getVertexUniqueEdges(!1).iterator();n.hasNext();){var i=n.next();e.add(this.getVoronoiCellPolygon(i,t))}return e},getVoronoiDiagram:function(t){var e=this.getVoronoiCellPolygons(t);return t.createGeometryCollection(se.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))}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);Io.splice(n,e);var i=n;do{e=(n=this.connect(e,n.sym())).oPrev()}while(e.lNext()!==i);return i},locate:function(){if(1===arguments.length){if(arguments[0]instanceof xo){var t=arguments[0];return this._locator.locate(t)}if(arguments[0]instanceof E){var e=arguments[0];return this._locator.locate(new xo(e))}}else if(2===arguments.length){var n=arguments[0],i=arguments[1],r=this._locator.locate(new xo(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 Ro}}),Ro.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 i("Edges do not form a triangle")},e(To.prototype,{visit:function(t){for(var e=t[0].orig().getCoordinate(),n=t[1].orig().getCoordinate(),i=t[2].orig().getCoordinate(),r=new xo(me.circumcentre(e,n,i)),s=0;s<3;s++)t[s].rot().setOrig(r)},interfaces_:function(){return[wo]},getClass:function(){return To}}),e(Po.prototype,{getTriangleEdges:function(){return this._triList},visit:function(t){this._triList.add(t)},interfaces_:function(){return[wo]},getClass:function(){return Po}}),e(Oo.prototype,{visit:function(t){this._triList.add([t[0].orig(),t[1].orig(),t[2].orig()])},getTriangleVertices:function(){return this._triList},interfaces_:function(){return[wo]},getClass:function(){return Oo}}),e(bo.prototype,{checkTriangleSize:function(t){t.length>=2?he.toLineString(t[0],t[1]):t.length>=1&&he.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[wo]},getClass:function(){return bo}}),Ro.TriangleCircumcentreVisitor=To,Ro.TriangleEdgesListVisitor=Po,Ro.TriangleVertexListVisitor=Oo,Ro.TriangleCoordinatesVisitor=bo,Ro.EDGE_COINCIDENCE_TOL_FACTOR=1e3,e(Mo.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 Mo}}),e(Do.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=e||this._segmentIndex===e&&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).getNumPoints()-1;return this._segmentIndex=e.getNumPoints()-1)return n;var i=e.getCoordinateN(this._segmentIndex+1);return Vo.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 ge(e.getCoordinateN(e.getNumPoints()-2),n):new ge(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 Vo(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&&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||this._segmentFraction>=1},interfaces_:function(){return[g]},getClass:function(){return Vo}}),Vo.getEndLocation=function(t){var e=new Vo;return e.setToEnd(t),e},Vo.pointAlongSegmentByFraction=function(t,e,n){return n<=0?t:n>=1?e:new E((e.x-t.x)*n+t.x,(e.y-t.y)*n+t.y,(e.z-t.z)*n+t.z)},Vo.compareLocationValues=function(t,e,n,i,r,s){return ti?1:er?1:ns?1:0},e(zo.prototype,{getComponentIndex:function(){return this._componentIndex},getLine:function(){return this._currentLine},getVertexIndex:function(){return this._vertexIndex},getSegmentEnd:function(){return 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._numLines)&&!(this._componentIndex===this._numLines-1&&this._vertexIndex>=this._currentLine.getNumPoints())},interfaces_:function(){return[]},getClass:function(){return zo}}),zo.segmentEndVertexIndex=function(t){return t.getSegmentFraction()>0?t.getSegmentIndex()+1:t.getSegmentIndex()},e(Yo.prototype,{indexOf:function(t){return this.indexOfFromStart(t,null)},indexOfFromStart:function(t,e){for(var n=s.MAX_VALUE,i=0,r=0,o=-1,a=new ge,u=new zo(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=0,"computed location is before specified minimum location"),i},interfaces_:function(){return[]},getClass:function(){return Yo}}),Yo.indexOf=function(t,e){return new Yo(t).indexOf(e)},Yo.indexOfAfter=function(t,e,n){return new Yo(t).indexOfAfter(e,n)},e(ko.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 Yo(this._linearGeom),s=new Array(2).fill(null);return s[0]=r.indexOf(e),0===t.getLength()?s[1]=s[0].copy():s[1]=r.indexOfAfter(i,s[0]),s},interfaces_:function(){return[]},getClass:function(){return ko}}),ko.indicesOf=function(t,e){return new ko(t).indicesOf(e)},e(Uo.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 n=null;try{n=this._geomFact.createLineString(e)}catch(t){if(!(t instanceof i))throw t;if(!this._ignoreInvalidLines)throw t}null!==n&&this._lines.add(n)},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 b),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 Uo}}),e(Xo.prototype,{computeLinear:function(t,e){var n=new Uo(this._line.getFactory());n.setFixInvalidLines(!0),t.isVertex()||n.add(t.getCoordinate(this._line));for(var i=new zo(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 b,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 At?t.reverse():t instanceof wt?t.reverse():(x.shouldNeverReachHere("non-linear geometry encountered"),null)},interfaces_:function(){return[]},getClass:function(){return Xo}}),Xo.extract=function(t,e,n){return new Xo(t).extract(e,n)},e(Ho.prototype,{clampIndex:function(t){var e=t.copy();return e.clamp(this._linearGeom),e},project:function(t){return Yo.indexOf(this._linearGeom,t)},checkGeometryType:function(){if(!(this._linearGeom instanceof At||this._linearGeom instanceof wt))throw new i("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 Vo.getEndLocation(this._linearGeom)},getStartIndex:function(){return new Vo},indexOfAfter:function(t,e){return Yo.indexOfAfter(this._linearGeom,t,e)},extractLine:function(t,e){return Xo.extract(this._linearGeom,t,e)},indexOf:function(t){return Yo.indexOf(this._linearGeom,t)},indicesOf:function(t){return ko.indicesOf(this._linearGeom,t)},interfaces_:function(){return[]},getClass:function(){return Ho}}),e(Wo.prototype,{indexOf:function(t){return this.indexOfFromStart(t,-1)},indexOfFromStart:function(t,e){for(var n=s.MAX_VALUE,i=e,r=0,o=new ge,a=new zo(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,r);ue&&(i=l,n=u),r+=o.getLength()}a.next()}return i},indexOfAfter:function(t,e){if(e<0)return this.indexOf(t);var n=this._linearGeom.getLength();if(n=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 Wo}}),Wo.indexOf=function(t,e){return new Wo(t).indexOf(e)},Wo.indexOfAfter=function(t,e,n){return new Wo(t).indexOfAfter(e,n)},e(jo.prototype,{getLength:function(t){for(var e=0,n=new zo(this._linearGeom);n.hasNext();){if(!n.isEndOfLine()){var i=n.getSegmentStart(),r=n.getSegmentEnd().distance(i);if(t.getComponentIndex()===n.getComponentIndex()&&t.getSegmentIndex()===n.getVertexIndex())return e+r*t.getSegmentFraction();e+=r}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(et){var s=(t-e)/r;return new Vo(n.getComponentIndex(),n.getVertexIndex(),s)}e+=r}n.next()}return Vo.getEndLocation(this._linearGeom)},interfaces_:function(){return[]},getClass:function(){return jo}}),jo.getLength=function(t,e){return new jo(t).getLength(e)},jo.getLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new jo(t).getLocation(e)}if(3===arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];return new jo(n).getLocation(i,r)}},e(Ko.prototype,{clampIndex:function(t){var e=this.positiveIndex(t),n=this.getStartIndex();if(ei?i:e},locationOf:function(){if(1===arguments.length){var t=arguments[0];return jo.getLocation(this._linearGeom,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return jo.getLocation(this._linearGeom,e,n)}},project:function(t){return Wo.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];return jo.getLocation(this._linearGeom,t).getCoordinate(this._linearGeom)}if(2===arguments.length){var e=arguments[0],n=arguments[1],i=jo.getLocation(this._linearGeom,e).toLowest(this._linearGeom);return i.getSegment(this._linearGeom).pointAlongOffset(i.getSegmentFraction(),n)}},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 Wo.indexOfAfter(this._linearGeom,t,e)},extractLine:function(t,e){new Ho(this._linearGeom);var n=this.clampIndex(t),i=this.clampIndex(e),r=n===i,s=this.locationOf(n,r),o=this.locationOf(i);return Xo.extract(this._linearGeom,s,o)},indexOf:function(t){return Wo.indexOf(this._linearGeom,t)},indicesOf:function(t){var e=ko.indicesOf(this._linearGeom,t);return[jo.getLength(this._linearGeom,e[0]),jo.getLength(this._linearGeom,e[1])]},interfaces_:function(){return[]},getClass:function(){return Ko}});var Zo=Object.freeze({LengthIndexedLine:Ko,LengthLocationMap:jo,LinearGeometryBuilder:Uo,LinearIterator:zo,LinearLocation:Vo,LocationIndexedLine:Ho});function Qo(){}e(Qo.prototype,{interfaces_:function(){return[]},getClass:function(){return Qo}}),Qo.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return ds.createEmptyResult(ds.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),fs.overlayOp(t,e,ds.UNION)},e(K.prototype,{equalsTopo:function(t){return!!this.getEnvelopeInternal().equals(t.getEnvelopeInternal())&&Gs.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 Qo.union(this,t)}},isValid:function(){return Zs.isValid(this)},intersection:function(t){if(this.isEmpty()||t.isEmpty())return ds.createEmptyResult(ds.INTERSECTION,this,t,this._factory);if(this.isGeometryCollection()){var e=t;return es.map(this,{interfaces_:function(){return[MapOp]},map:function(t){return t.intersection(e)}})}return this.checkNotGeometryCollection(this),this.checkNotGeometryCollection(t),fs.overlayOp(this,t,ds.INTERSECTION)},covers:function(t){return Gs.covers(this,t)},coveredBy:function(t){return Gs.covers(t,this)},touches:function(t){return Gs.touches(this,t)},intersects:function(t){return Gs.intersects(this,t)},within:function(t){return Gs.within(this,t)},overlaps:function(t){return Gs.overlaps(this,t)},disjoint:function(t){return Gs.disjoint(this,t)},crosses:function(t){return Gs.crosses(this,t)},buffer:function(){if(1===arguments.length){var t=arguments[0];return Pr.bufferOp(this,t)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return Pr.bufferOp(this,e,n)}if(3===arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];return Pr.bufferOp(this,i,r,s)}},convexHull:function(){return new Ze(this).getConvexHull()},relate:function(){for(var t=arguments.length,e=Array(t),n=0;ne)&&Fr.isWithinDistance(this,t,e)},distance:function(t){return Fr.distance(this,t)},isEquivalentClass:function(t){return this.getClass()===t.getClass()}});t.version="1.6.0 (ac4d0f6)",t.algorithm=En,t.densify=Sn,t.dissolve=bn,t.geom=ve,t.geomgraph=ii,t.index=wi,t.io=Gi,t.noding=Ji,t.operation=Js,t.precision=eo,t.simplify=_o,t.triangulate=Bo,t.linearref=Zo,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=jsts.min.js.map