!function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="e518bf81-fc1d-4230-9962-0b4d4b7d3259",t._sentryDebugIdIdentifier="sentry-dbid-e518bf81-fc1d-4230-9962-0b4d4b7d3259")}catch(t){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[284],{33602:function(t){var e;e=function(){"use strict";function t(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function n(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}function i(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}function r(t){return(r=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(t){return!1}}function o(t,e,n){return(o=a()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&s(r,n.prototype),r}).apply(null,arguments)}function u(t){var e="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return o(t,arguments,r(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,t)})(t)}function l(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t){var e=a();return function(){var n,i=r(t);return n=e?Reflect.construct(i,arguments,r(this).constructor):i.apply(this,arguments),function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw TypeError("Derived constructors may only return object or undefined");return l(t)}(this,n)}}function c(t,e,n){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var i=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=r(t)););return t}(t,e);if(i){var s=Object.getOwnPropertyDescriptor(i,e);return s.get?s.get.call(n):s.value}})(t,e,n||t)}function f(t){return function(t){if(Array.isArray(t))return g(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||v(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){if(t){if("string"==typeof t)return g(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(t,e):void 0}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function y(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=v(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,r=function(){};return{s:r,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){o=!0,s=t},f:function(){try{a||null==n.return||n.return()}finally{if(o)throw s}}}}var d=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=e.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=e.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==e.JOIN_ROUND&&(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(t){this._joinStyle=t}},{key:"setSimplifyFactor",value:function(t){this._simplifyFactor=t<0?0:t}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(t){this._endCapStyle=t}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(t){this._mitreLimit=t}},{key:"setSingleSided",value:function(t){this._isSingleSided=t}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,0==arguments.length);else if(1==arguments.length){var t=arguments[0];this.setQuadrantSegments(t)}else if(2==arguments.length){var n=arguments[0],i=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(i)}else if(4==arguments.length){var r=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(s),this.setJoinStyle(a),this.setMitreLimit(o)}}},{key:"bufferDistanceError",value:function(t){return 1-Math.cos(Math.PI/2/t/2)}}]),e}();d.CAP_ROUND=1,d.CAP_FLAT=2,d.CAP_SQUARE=3,d.JOIN_ROUND=1,d.JOIN_MITRE=2,d.JOIN_BEVEL=3,d.DEFAULT_QUADRANT_SEGMENTS=8,d.DEFAULT_MITRE_LIMIT=5,d.DEFAULT_SIMPLIFY_FACTOR=.01;var _=function(e){i(s,e);var r=h(s);function s(e){var n;return t(this,s),(n=r.call(this,e)).name="Exception",n}return n(s,[{key:"toString",value:function(){return this.message}}]),s}(u(Error)),p=function(e){i(r,e);var n=h(r);function r(e){var i;return t(this,r),(i=n.call(this,e)).name="IllegalArgumentException",i}return r}(_),m=function(){function e(){t(this,e)}return n(e,[{key:"filter",value:function(t){}}]),e}();function k(){}function x(){}function I(){}var E,N,T,S,L,C,R=function(){function e(){t(this,e)}return n(e,null,[{key:"equalsWithTolerance",value:function(t,e,n){return Math.abs(t-e)<=n}}]),e}(),O=function(){function e(n,i){t(this,e),this.low=i||0,this.high=n||0}return n(e,null,[{key:"toBinaryString",value:function(t){var e,n="";for(e=0x80000000;e>0;e>>>=1)n+=(t.high&e)===e?"1":"0";for(e=0x80000000;e>0;e>>>=1)n+=(t.low&e)===e?"1":"0";return n}}]),e}();function w(){}function b(){}w.NaN=NaN,w.isNaN=function(t){return Number.isNaN(t)},w.isInfinite=function(t){return!Number.isFinite(t)},w.MAX_VALUE=Number.MAX_VALUE,w.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,w.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,"function"==typeof Float64Array&&"function"==typeof Int32Array?(C=new Int32Array((L=new Float64Array(1)).buffer),w.doubleToLongBits=function(t){L[0]=t;var e=0|C[0],n=0|C[1];return(0x7ff00000&n)==0x7ff00000&&0!=(1048575&n)&&0!==e&&(e=0,n=0x7ff80000),new O(n,e)},w.longBitsToDouble=function(t){return C[0]=t.low,C[1]=t.high,L[0]}):(E=Math.log2,N=Math.floor,T=Math.pow,S=function(){for(var t=53;t>0;t--){var e=T(2,t)-1;if(N(E(e))+1===t)return e}return 0}(),w.doubleToLongBits=function(t){var e,n,i,r,s,a,o,u,l;if(t<0||1/t===Number.NEGATIVE_INFINITY?(a=-0x80000000,t=-t):a=0,0===t)return new O(u=a,l=0);if(t===1/0)return new O(u=0x7ff00000|a,l=0);if(t!=t)return new O(u=0x7ff80000,l=0);if(r=0,l=0,(e=N(t))>1){if(e<=S)(r=N(E(e)))<=20?(l=0,u=e<<20-r&1048575):(l=e%(n=T(2,i=r-20))<<32-i,u=e/n&1048575);else for(i=e,l=0;0!==(i=N(n=i/2));)r++,l>>>=1,l|=(1&u)<<31,u>>>=1,n!==i&&(u|=524288)}if(o=r+1023,s=0===e,e=t-e,r<52&&0!==e)for(i=0;;){if((n=2*e)>=1?(e=n-1,s?(o--,s=!1):(i<<=1,i|=1,r++)):(e=n,s?0==--o&&(r++,s=!1):(i<<=1,r++)),20===r)u|=i,i=0;else if(52===r){l|=i;break}if(1===n){r<20?u|=i<<20-r:r<52&&(l|=i<<52-r);break}}return u|=o<<20,new O(u|=a,l)},w.longBitsToDouble=function(t){var e,n,i,r,s=t.high,a=t.low,o=-0x80000000&s?-1:1;for(i=((0x7ff00000&s)>>20)-1023,r=0,n=524288,e=1;e<=20;e++)s&n&&(r+=T(2,-e)),n>>>=1;for(n=-0x80000000,e=21;e<=52;e++)a&n&&(r+=T(2,-e)),n>>>=1;if(-1023===i){if(0===r)return 0*o;i=-1022}else{if(1024===i)return 0===r?o/0:NaN;r+=1}return o*r*T(2,i)});var M=function(e){i(r,e);var n=h(r);function r(e){var i;return t(this,r),(i=n.call(this,e)).name="RuntimeException",i}return r}(_),P=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,null,[{key:"constructor_",value:function(){if(0==arguments.length)M.constructor_.call(this);else if(1==arguments.length){var t=arguments[0];M.constructor_.call(this,t)}}}]),s}(M),A=function(){function e(){t(this,e)}return n(e,null,[{key:"shouldNeverReachHere",value:function(){if(0==arguments.length)e.shouldNeverReachHere(null);else if(1==arguments.length){var t=arguments[0];throw new P("Should never reach here"+(null!==t?": "+t:""))}}},{key:"isTrue",value:function(){if(1==arguments.length){var t=arguments[0];e.isTrue(t,null)}else if(2==arguments.length){var n=arguments[0],i=arguments[1];if(!n)throw null===i?new P:new P(i)}}},{key:"equals",value:function(){if(2==arguments.length){var t=arguments[0],n=arguments[1];e.equals(t,n,null)}else if(3==arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];if(!r.equals(i))throw new P("Expected "+i+" but encountered "+r+(null!==s?": "+s:""))}}}]),e}(),D=new ArrayBuffer(8),F=new Float64Array(D),G=new Int32Array(D),q=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getM",value:function(){return w.NaN}},{key:"setOrdinate",value:function(t,n){switch(t){case e.X:this.x=n;break;case e.Y:this.y=n;break;case e.Z:this.setZ(n);break;default:throw new p("Invalid ordinate index: "+t)}}},{key:"equals2D",value:function(){if(1==arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2==arguments.length){var e=arguments[0],n=arguments[1];return!!R.equalsWithTolerance(this.x,e.x,n)&&!!R.equalsWithTolerance(this.y,e.y,n)}}},{key:"setM",value:function(t){throw new p("Invalid ordinate index: "+e.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(t){switch(t){case e.X:return this.x;case e.Y:return this.y;case e.Z:return this.getZ()}throw new p("Invalid ordinate index: "+t)}},{key:"equals3D",value:function(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||w.isNaN(this.getZ())&&w.isNaN(t.getZ()))}},{key:"equals",value:function(t){return t instanceof e&&this.equals2D(t)}},{key:"equalInZ",value:function(t,e){return R.equalsWithTolerance(this.getZ(),t.getZ(),e)}},{key:"setX",value:function(t){this.x=t}},{key:"compareTo",value:function(t){return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(t){this.z=t}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return A.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}},{key:"copy",value:function(){return new e(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(t){var e=this.x-t.x,n=this.y-t.y,i=this.getZ()-t.getZ();return Math.sqrt(e*e+n*n+i*i)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(t){this.y=t}},{key:"distance",value:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){return 37*(629+e.hashCode(this.x))+e.hashCode(this.y)}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}},{key:"interfaces_",get:function(){return[k,x,I]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,0==arguments.length)e.constructor_.call(this,0,0);else if(1==arguments.length){var t=arguments[0];e.constructor_.call(this,t.x,t.y,t.getZ())}else if(2==arguments.length){var n=arguments[0],i=arguments[1];e.constructor_.call(this,n,i,e.NULL_ORDINATE)}else if(3==arguments.length){var r=arguments[0],s=arguments[1],a=arguments[2];this.x=r,this.y=s,this.z=a}}},{key:"hashCode",value:function(t){return F[0]=t,G[0]^G[1]}}]),e}(),Y=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"compare",value:function(t,n){var i=e.compare(t.x,n.x);if(0!==i)return i;var r=e.compare(t.y,n.y);return 0!==r?r:this._dimensionsToTest<=2?0:e.compare(t.getZ(),n.getZ())}},{key:"interfaces_",get:function(){return[b]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,0==arguments.length)e.constructor_.call(this,2);else if(1==arguments.length){var t=arguments[0];if(2!==t&&3!==t)throw new p("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}},{key:"compare",value:function(t,e){return t<e?-1:t>e?1:w.isNaN(t)?w.isNaN(e)?0:-1:w.isNaN(e)?1:0}}]),e}();q.DimensionalComparator=Y,q.NULL_ORDINATE=w.NaN,q.X=0,q.Y=1,q.Z=2,q.M=3;var z=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(t){return t instanceof e&&(this.isNull()?t.isNull():this._maxx===t.getMaxX()&&this._maxy===t.getMaxY()&&this._minx===t.getMinX()&&this._miny===t.getMinY())}},{key:"intersection",value:function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new e;var n=this._minx>t._minx?this._minx:t._minx,i=this._miny>t._miny?this._miny:t._miny;return new e(n,this._maxx<t._maxx?this._maxx:t._maxx,i,this._maxy<t._maxy?this._maxy:t._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(1==arguments.length){if(arguments[0]instanceof q){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof e){var n=arguments[0];return!this.isNull()&&!n.isNull()&&n.getMinX()>=this._minx&&n.getMaxX()<=this._maxx&&n.getMinY()>=this._miny&&n.getMaxY()<=this._maxy}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];return!this.isNull()&&i>=this._minx&&i<=this._maxx&&r>=this._miny&&r<=this._maxy}}},{key:"intersects",value:function(){if(1==arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof q){var n=arguments[0];return this.intersects(n.x,n.y)}}else if(2==arguments.length){if(arguments[0]instanceof q&&arguments[1]instanceof q){var i=arguments[0],r=arguments[1];return!this.isNull()&&!((i.x<r.x?i.x:r.x)>this._maxx)&&!((i.x>r.x?i.x:r.x)<this._minx)&&!((i.y<r.y?i.y:r.y)>this._maxy)&&!((i.y>r.y?i.y:r.y)<this._miny)}if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||a>this._maxy||a<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return Math.sqrt(t*t+e*e)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(1==arguments.length){if(arguments[0]instanceof q){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof e){var n=arguments[0];if(n.isNull())return null;this.isNull()?(this._minx=n.getMinX(),this._maxx=n.getMaxX(),this._miny=n.getMinY(),this._maxy=n.getMaxY()):(n._minx<this._minx&&(this._minx=n._minx),n._maxx>this._maxx&&(this._maxx=n._maxx),n._miny<this._miny&&(this._miny=n._miny),n._maxy>this._maxy&&(this._maxy=n._maxy))}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];this.isNull()?(this._minx=i,this._maxx=i,this._miny=r,this._maxy=r):(i<this._minx&&(this._minx=i),i>this._maxx&&(this._maxx=i),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(t){return this.isNull()?t.isNull()?0:-1:t.isNull()?1:this._minx<t._minx?-1:this._minx>t._minx?1:this._miny<t._miny?-1:this._miny>t._miny?1:this._maxx<t._maxx?-1:this._maxx>t._maxx?1:this._maxy<t._maxy?-1:this._maxy>t._maxy?1:0}},{key:"translate",value:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}},{key:"copy",value:function(){return new e(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(t){return!(!this.isNull()&&!t.isNull())||t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e}},{key:"expandBy",value: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()}}},{key:"contains",value:function(){if(1==arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof q){var n=arguments[0];return this.covers(n)}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];return this.covers(i,r)}}},{key:"centre",value:function(){return this.isNull()?null:new q((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(0==arguments.length)this.setToNull();else if(1==arguments.length){if(arguments[0]instanceof q){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof e){var n=arguments[0];this._minx=n._minx,this._maxx=n._maxx,this._miny=n._miny,this._maxy=n._maxy}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];this.init(i.x,r.x,i.y,r.y)}else if(4==arguments.length){var s=arguments[0],a=arguments[1],o=arguments[2],u=arguments[3];s<a?(this._minx=s,this._maxx=a):(this._minx=a,this._maxx=s),o<u?(this._miny=o,this._maxy=u):(this._miny=u,this._maxy=o)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){return 37*(37*(37*(629+q.hashCode(this._minx))+q.hashCode(this._maxx))+q.hashCode(this._miny))+q.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[k,I]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0==arguments.length)this.init();else if(1==arguments.length){if(arguments[0]instanceof q){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];this.init(i.x,r.x,i.y,r.y)}else if(4==arguments.length){var s=arguments[0],a=arguments[1],o=arguments[2],u=arguments[3];this.init(s,a,o,u)}}},{key:"intersects",value:function(){if(3==arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(4==arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],a=arguments[3],o=Math.min(s.x,a.x),u=Math.max(s.x,a.x),l=Math.min(i.x,r.x),h=Math.max(i.x,r.x);return!(l>u)&&!(h<o)&&(o=Math.min(s.y,a.y),u=Math.max(s.y,a.y),l=Math.min(i.y,r.y),h=Math.max(i.y,r.y),!(l>u)&&!(h<o))}}}]),e}(),X=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===e.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(t){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(t){return this===t||this.equalsExact(t,0)}},{key:"geometryChanged",value:function(){this.apply(e.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(t){return null!==t&&this.norm().equalsExact(t.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var t;if(1==arguments.length){var e=arguments[0];return t=e,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(e)}if(2==arguments.length){var n=arguments[0],i=arguments[1];return t=n,this.getTypeCode()!==t.getTypeCode()?this.getTypeCode()-t.getTypeCode():this.isEmpty()&&t.isEmpty()?0:this.isEmpty()?-1:t.isEmpty()?1:this.compareToSameClass(n,i)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(t){if(t.getTypeCode()===e.TYPECODE_GEOMETRYCOLLECTION)throw new p("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n}},{key:"norm",value:function(){var t=this.copy();return t.normalize(),t}},{key:"reverse",value:function(){var t=this.reverseInternal();return null!=this.envelope&&(t.envelope=this.envelope.copy()),t.setSRID(this.getSRID()),t}},{key:"copy",value:function(){var t=this.copyInternal();return t.envelope=null==this._envelope?null:this._envelope.copy(),t._SRID=this._SRID,t._userData=this._userData,t}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new z(this._envelope)}},{key:"setSRID",value:function(t){this._SRID=t}},{key:"setUserData",value:function(t){this._userData=t}},{key:"compare",value:function(t,e){for(var n=t.iterator(),i=e.iterator();n.hasNext()&&i.hasNext();){var r=n.next(),s=i.next(),a=r.compareTo(s);if(0!==a)return a}return n.hasNext()?1:i.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(t){return this.getClass()===t.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===e.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===e.TYPECODE_MULTIPOINT||this.getTypeCode()===e.TYPECODE_MULTILINESTRING||this.getTypeCode()===e.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[x,k,I]}},{key:"getClass",value:function(){return e}}],[{key:"hasNonEmptyElements",value:function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1}}]),e}();X.constructor_=function(t){t&&(this._envelope=null,this._userData=null,this._factory=t,this._SRID=t.getSRID())},X.TYPECODE_POINT=0,X.TYPECODE_MULTIPOINT=1,X.TYPECODE_LINESTRING=2,X.TYPECODE_LINEARRING=3,X.TYPECODE_MULTILINESTRING=4,X.TYPECODE_POLYGON=5,X.TYPECODE_MULTIPOLYGON=6,X.TYPECODE_GEOMETRYCOLLECTION=7,X.TYPENAME_POINT="Point",X.TYPENAME_MULTIPOINT="MultiPoint",X.TYPENAME_LINESTRING="LineString",X.TYPENAME_LINEARRING="LinearRing",X.TYPENAME_MULTILINESTRING="MultiLineString",X.TYPENAME_POLYGON="Polygon",X.TYPENAME_MULTIPOLYGON="MultiPolygon",X.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",X.geometryChangedFilter={get interfaces_(){return[m]},filter:function(t){t.geometryChangedAction()}};var B=function(){function e(){t(this,e)}return n(e,null,[{key:"toLocationSymbol",value:function(t){switch(t){case e.EXTERIOR:return"e";case e.BOUNDARY:return"b";case e.INTERIOR:return"i";case e.NONE:return"-"}throw new p("Unknown location value: "+t)}}]),e}();B.INTERIOR=0,B.BOUNDARY=1,B.EXTERIOR=2,B.NONE=-1;var U=function(){function e(){t(this,e)}return n(e,[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}]),e}(),V=function(e){i(r,e);var n=h(r);function r(e){var i;return t(this,r),(i=n.call(this,e)).name="NoSuchElementException",i}return r}(_),H=function(e){i(r,e);var n=h(r);function r(e){var i;return t(this,r),(i=n.call(this,e)).name="UnsupportedOperationException",i}return r}(_),Z=function(e){i(s,e);var r=h(s);function s(){return t(this,s),r.apply(this,arguments)}return n(s,[{key:"contains",value:function(){}}]),s}(U),W=function(e,r){i(a,e);var s=h(a);function a(e){var n;return t(this,a),(n=s.call(this)).map=new Map,e instanceof U&&n.addAll(e),n}return n(a,[{key:"contains",value:function(t){var e=t.hashCode?t.hashCode():t;return!!this.map.has(e)}},{key:"add",value:function(t){var e=t.hashCode?t.hashCode():t;return!this.map.has(e)&&!!this.map.set(e,t)}},{key:"addAll",value:function(t){var e,n=y(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.add(i)}}catch(t){n.e(t)}finally{n.f()}return!0}},{key:"remove",value:function(){throw new H}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return 0===this.map.size}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new j(this.map)}},{key:r,value:function(){return this.map}}]),a}(Z,Symbol.iterator),j=function(){function e(n){t(this,e),this.iterator=n.values();var i=this.iterator.next(),r=i.done,s=i.value;this.done=r,this.value=s}return n(e,[{key:"next",value:function(){if(this.done)throw new V;var t=this.value,e=this.iterator.next(),n=e.done,i=e.value;return this.done=n,this.value=i,t}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new H}}]),e}(),K=function(){function e(){t(this,e)}return n(e,null,[{key:"opposite",value:function(t){return t===e.LEFT?e.RIGHT:t===e.RIGHT?e.LEFT:t}}]),e}();K.ON=0,K.LEFT=1,K.RIGHT=2;var J=function(e){i(r,e);var n=h(r);function r(e){var i;return t(this,r),(i=n.call(this,e)).name="EmptyStackException",i}return r}(_),Q=function(e){i(r,e);var n=h(r);function r(e){var i;return t(this,r),(i=n.call(this,e)).name="IndexOutOfBoundsException",i}return r}(_),$=function(e){i(s,e);var r=h(s);function s(){return t(this,s),r.apply(this,arguments)}return n(s,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}]),s}(U),tt=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),(e=r.call(this)).array=[],e}return n(s,[{key:"add",value:function(t){return this.array.push(t),!0}},{key:"get",value:function(t){if(t<0||t>=this.size())throw new Q;return this.array[t]}},{key:"push",value:function(t){return this.array.push(t),t}},{key:"pop",value:function(){if(0===this.array.length)throw new J;return this.array.pop()}},{key:"peek",value:function(){if(0===this.array.length)throw new J;return this.array[this.array.length-1]}},{key:"empty",value:function(){return 0===this.array.length}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(t){return this.array.indexOf(t)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}]),s}($);function te(t,e){return t.interfaces_&&t.interfaces_.indexOf(e)>-1}var tn=function(){function e(n){t(this,e),this.str=n}return n(e,[{key:"append",value:function(t){this.str+=t}},{key:"setCharAt",value:function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}},{key:"toString",value:function(){return this.str}}]),e}(),ti=function(){function e(n){t(this,e),this.value=n}return n(e,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(t){return this.value<t?-1:this.value>t?1:0}}],[{key:"compare",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"isNan",value:function(t){return Number.isNaN(t)}},{key:"valueOf",value:function(t){return new e(t)}}]),e}(),tr=function(){function e(){t(this,e)}return n(e,null,[{key:"isWhitespace",value:function(t){return t<=32&&t>=0||127===t}},{key:"toUpperCase",value:function(t){return t.toUpperCase()}}]),e}(),ts=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"le",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo}},{key:"extractSignificantDigits",value:function(t,n){var i=this.abs(),r=e.magnitude(i._hi),s=e.TEN.pow(r);(i=i.divide(s)).gt(e.TEN)?(i=i.divide(e.TEN),r+=1):i.lt(e.ONE)&&(i=i.multiply(e.TEN),r-=1);for(var a=r+1,o=new tn,u=e.MAX_PRINT_DIGITS-1,l=0;l<=u;l++){t&&l===a&&o.append(".");var h=Math.trunc(i._hi);if(h<0)break;var c=!1,f=0;h>9?(c=!0,f="9"):f="0"+h,o.append(f),i=i.subtract(e.valueOf(h)).multiply(e.TEN),c&&i.selfAdd(e.TEN);var v=!0,g=e.magnitude(i._hi);if(g<0&&Math.abs(g)>=u-l&&(v=!1),!v)break}return n[0]=r,o.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var n=arguments[0];return this.add(-n)}}},{key:"equals",value:function(){if(1==arguments.length&&arguments[0]instanceof e){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}},{key:"isZero",value:function(){return 0===this._hi&&0===this._lo}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(t){return this.le(t)?this:t}},{key:"selfDivide",value:function(){if(1==arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var n=arguments[0];return this.selfDivide(n,0)}}else if(2==arguments.length){var i=arguments[0],r=arguments[1],s=null,a=null,o=null,u=null,l=null,h=null,c=null,f=null;return l=this._hi/i,f=(s=(h=e.SPLIT*l)-(s=h-l))*(o=(f=e.SPLIT*i)-(o=f-i))-(c=l*i)+s*(u=i-o)+(a=l-s)*o+a*u,f=l+(h=(this._hi-c-f+this._lo-l*r)/i),this._hi=f,this._lo=l-f+h,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof e){var t=arguments[0],n=null,i=null,r=null,s=null,a=null,o=null,u=null,l=null;return i=(a=this._hi/t._hi)-(n=(o=e.SPLIT*a)-(n=o-a)),l=n*(r=(l=e.SPLIT*t._hi)-(r=l-t._hi))-(u=a*t._hi)+n*(s=t._hi-r)+i*r+i*s,new e(l=a+(o=(this._hi-u-l+this._lo-a*t._lo)/t._hi),a-l+o)}if("number"==typeof arguments[0]){var h=arguments[0];return w.isNaN(h)?e.createNaN():e.copy(this).selfDivide(h,0)}}},{key:"ge",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}},{key:"pow",value:function(t){if(0===t)return e.valueOf(1);var n=new e(this),i=e.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&i.selfMultiply(n),(r/=2)>0&&(n=n.sqr());else i=n;return t<0?i.reciprocal():i}},{key:"ceil",value:function(){if(this.isNaN())return e.NaN;var t=Math.ceil(this._hi),n=0;return t===this._hi&&(n=Math.ceil(this._lo)),new e(t,n)}},{key:"compareTo",value:function(t){return this._hi<t._hi?-1:this._hi>t._hi?1:this._lo<t._lo?-1:this._lo>t._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var n=arguments[0];return this.init(n),this}}},{key:"max",value:function(t){return this.ge(t)?this:t}},{key:"sqrt",value:function(){if(this.isZero())return e.valueOf(0);if(this.isNegative())return e.NaN;var t=1/Math.sqrt(this._hi),n=this._hi*t,i=e.valueOf(n),r=this.subtract(i.sqr())._hi*(.5*t);return i.add(r)}},{key:"selfAdd",value:function(){if(1==arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var n=arguments[0],i=null,r=null,s=null,a=null,o=null,u=null;return a=(s=this._hi+n)-(o=s-this._hi),r=(u=(a=n-o+(this._hi-a))+this._lo)+(s-(i=s+u)),this._hi=i+r,this._lo=r+(i-this._hi),this}}else if(2==arguments.length){var l=arguments[0],h=arguments[1],c=null,f=null,v=null,g=null,y=null,d=null,_=null;g=this._hi+l,f=this._lo+h,y=g-(d=g-this._hi),v=f-(_=f-this._lo);var p=(c=g+(d=(y=l-d+(this._hi-y))+f))+(d=(v=h-_+(this._lo-v))+(d+(g-c))),m=d+(c-p);return this._hi=p,this._lo=m,this}}},{key:"selfMultiply",value:function(){if(1==arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var n=arguments[0];return this.selfMultiply(n,0)}}else if(2==arguments.length){var i=arguments[0],r=arguments[1],s=null,a=null,o=null,u=null,l=null,h=null;s=(l=e.SPLIT*this._hi)-this._hi,h=e.SPLIT*i,s=l-s,a=this._hi-s,o=h-i;var c=(l=this._hi*i)+(h=s*(o=h-o)-l+s*(u=i-o)+a*o+a*u+(this._hi*r+this._lo*i)),f=h+(s=l-c);return this._hi=c,this._lo=f,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return e.NaN;var t=Math.floor(this._hi),n=0;return t===this._hi&&(n=Math.floor(this._lo)),new e(t,n)}},{key:"negate",value:function(){return this.isNaN()?this:new e(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}},{key:"multiply",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return t.isNaN()?e.createNaN():e.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var n=arguments[0];return w.isNaN(n)?e.createNaN():e.copy(this).selfMultiply(n,0)}}},{key:"isNaN",value:function(){return w.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var t=e.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var t=this.getSpecialNumberString();if(null!==t)return t;var n=[,].fill(null),i=this.extractSignificantDigits(!0,n),r=n[0]+1,s=i;if("."===i.charAt(0))s="0"+i;else if(r<0)s="0."+e.stringOfChar("0",-r)+i;else if(-1===i.indexOf(".")){var a=r-i.length;s=i+e.stringOfChar("0",a)+".0"}return this.isNegative()?"-"+s:s}},{key:"reciprocal",value:function(){var t,n,i,r,s=null,a=null,o=null,u=null;t=(i=1/this._hi)-(s=(o=e.SPLIT*i)-(s=o-i)),a=(u=e.SPLIT*this._hi)-this._hi;var l=i+(o=(1-(r=i*this._hi)-(u=s*(a=u-a)-r+s*(n=this._hi-a)+t*a+t*n)-i*this._lo)/this._hi);return new e(l,i-l+o)}},{key:"toSciNotation",value:function(){if(this.isZero())return e.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var n=[,].fill(null),i=this.extractSignificantDigits(!1,n),r=e.SCI_NOT_EXPONENT_CHAR+n[0];if("0"===i.charAt(0))throw new IllegalStateException("Found leading zero: "+i);var s="";i.length>1&&(s=i.substring(1));var a=i.charAt(0)+"."+s;return this.isNegative()?"-"+a+r:a+r}},{key:"abs",value:function(){return this.isNaN()?e.NaN:this.isNegative()?this.negate():new e(this)}},{key:"isPositive",value:function(){return this._hi>0||0===this._hi&&this._lo>0}},{key:"lt",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<t._lo}},{key:"add",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return e.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var n=arguments[0];return e.copy(this).selfAdd(n)}}},{key:"init",value:function(){if(1==arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof e){var n=arguments[0];this._hi=n._hi,this._lo=n._lo}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];this._hi=i,this._lo=r}}},{key:"gt",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>t._lo}},{key:"isNegative",value:function(){return this._hi<0||0===this._hi&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?e.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[I,k,x]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,0==arguments.length)this.init(0);else if(1==arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){var i=arguments[0];e.constructor_.call(this,e.parse(i))}}else if(2==arguments.length){var r=arguments[0],s=arguments[1];this.init(r,s)}}},{key:"determinant",value:function(){if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],n=arguments[1],i=arguments[2],r=arguments[3];return e.determinant(e.valueOf(t),e.valueOf(n),e.valueOf(i),e.valueOf(r))}if(arguments[3]instanceof e&&arguments[2]instanceof e&&arguments[0]instanceof e&&arguments[1]instanceof e){var s=arguments[0],a=arguments[1],o=arguments[2],u=arguments[3];return s.multiply(u).selfSubtract(a.multiply(o))}}},{key:"sqr",value:function(t){return e.valueOf(t).selfMultiply(t)}},{key:"valueOf",value:function(){if("string"==typeof arguments[0]){var t=arguments[0];return e.parse(t)}if("number"==typeof arguments[0]){var n=arguments[0];return new e(n)}}},{key:"sqrt",value:function(t){return e.valueOf(t).sqrt()}},{key:"parse",value:function(t){for(var n=0,i=t.length;tr.isWhitespace(t.charAt(n));)n++;var r=!1;if(n<i){var s=t.charAt(n);"-"!==s&&"+"!==s||(n++,"-"===s&&(r=!0))}for(var a=new e,o=0,u=0,l=0,h=!1;!(n>=i);){var c=t.charAt(n);if(n++,tr.isDigit(c)){var f=c-"0";a.selfMultiply(e.TEN),a.selfAdd(f),o++}else{if("."!==c){if("e"===c||"E"===c){var v=t.substring(n);try{l=ti.parseInt(v)}catch(e){throw e instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+v+" in string "+t):e}break}throw new NumberFormatException("Unexpected character '"+c+"' at position "+n+" in string "+t)}u=o,h=!0}}var g=a;h||(u=o);var y=o-u-l;if(0===y)g=a;else if(y>0){var d=e.TEN.pow(y);g=a.divide(d)}else if(y<0){var _=e.TEN.pow(-y);g=a.multiply(_)}return r?g.negate():g}},{key:"createNaN",value:function(){return new e(w.NaN,w.NaN)}},{key:"copy",value:function(t){return new e(t)}},{key:"magnitude",value:function(t){var e=Math.abs(t),n=Math.trunc(Math.floor(Math.log(e)/Math.log(10)));return 10*Math.pow(10,n)<=e&&(n+=1),n}},{key:"stringOfChar",value:function(t,e){for(var n=new tn,i=0;i<e;i++)n.append(t);return n.toString()}}]),e}();ts.PI=new ts(3.141592653589793,12246467991473532e-32),ts.TWO_PI=new ts(6.283185307179586,24492935982947064e-32),ts.PI_2=new ts(1.5707963267948966,6123233995736766e-32),ts.E=new ts(2.718281828459045,14456468917292502e-32),ts.NaN=new ts(w.NaN,w.NaN),ts.EPS=123259516440783e-46,ts.SPLIT=0x8000001,ts.MAX_PRINT_DIGITS=32,ts.TEN=ts.valueOf(10),ts.ONE=ts.valueOf(1),ts.SCI_NOT_EXPONENT_CHAR="E",ts.SCI_NOT_ZERO="0.0E0";var ta=function(){function e(){t(this,e)}return n(e,null,[{key:"orientationIndex",value:function(t,n,i){var r=e.orientationIndexFilter(t,n,i);if(r<=1)return r;var s=ts.valueOf(n.x).selfAdd(-t.x),a=ts.valueOf(n.y).selfAdd(-t.y),o=ts.valueOf(i.x).selfAdd(-n.x),u=ts.valueOf(i.y).selfAdd(-n.y);return s.selfMultiply(u).selfSubtract(a.selfMultiply(o)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof ts&&arguments[2]instanceof ts&&arguments[0]instanceof ts&&arguments[1]instanceof ts){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];return t.multiply(i).selfSubtract(e.multiply(n)).signum()}if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var r=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3],u=ts.valueOf(r),l=ts.valueOf(s),h=ts.valueOf(a),c=ts.valueOf(o);return u.multiply(c).selfSubtract(l.multiply(h)).signum()}}},{key:"intersection",value:function(t,e,n,i){var r=new ts(t.y).selfSubtract(e.y),s=new ts(e.x).selfSubtract(t.x),a=new ts(t.x).selfMultiply(e.y).selfSubtract(new ts(e.x).selfMultiply(t.y)),o=new ts(n.y).selfSubtract(i.y),u=new ts(i.x).selfSubtract(n.x),l=new ts(n.x).selfMultiply(i.y).selfSubtract(new ts(i.x).selfMultiply(n.y)),h=s.multiply(l).selfSubtract(u.multiply(a)),c=o.multiply(a).selfSubtract(r.multiply(l)),f=r.multiply(u).selfSubtract(o.multiply(s)),v=h.selfDivide(f).doubleValue(),g=c.selfDivide(f).doubleValue();return w.isNaN(v)||w.isInfinite(v)||w.isNaN(g)||w.isInfinite(g)?null:new q(v,g)}},{key:"orientationIndexFilter",value:function(t,n,i){var r=null,s=(t.x-i.x)*(n.y-i.y),a=(t.y-i.y)*(n.x-i.x),o=s-a;if(s>0){if(a<=0)return e.signum(o);r=s+a}else{if(!(s<0)||a>=0)return e.signum(o);r=-s-a}var u=e.DP_SAFE_EPSILON*r;return o>=u||-o>=u?e.signum(o):2}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}}]),e}();ta.DP_SAFE_EPSILON=1e-15;var to=function(){function e(){t(this,e)}return n(e,[{key:"getM",value:function(t){if(this.hasM()){var e=this.getDimension()-this.getMeasures();return this.getOrdinate(t,e)}return w.NaN}},{key:"setOrdinate",value:function(t,e,n){}},{key:"getZ",value:function(t){return this.hasZ()?this.getOrdinate(t,2):w.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(t,e){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(t){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(t){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(t){}},{key:"copy",value:function(){}},{key:"getY",value:function(t){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[x]}}]),e}();to.X=0,to.Y=1,to.Z=2,to.M=3;var tu=function(){function e(){t(this,e)}return n(e,null,[{key:"index",value:function(t,e,n){return ta.orientationIndex(t,e,n)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var t=arguments[0],n=t.length-1;if(n<3)throw new p("Ring has fewer than 4 points, so orientation cannot be determined");for(var i=t[0],r=0,s=1;s<=n;s++){var a=t[s];a.y>i.y&&(i=a,r=s)}var o=r;do(o-=1)<0&&(o=n);while(t[o].equals2D(i)&&o!==r);var u=r;do u=(u+1)%n;while(t[u].equals2D(i)&&u!==r);var l=t[o],h=t[u];if(l.equals2D(i)||h.equals2D(i)||l.equals2D(h))return!1;var c=e.index(l,i,h);return 0===c?l.x>h.x:c>0}if(te(arguments[0],to)){var f=arguments[0],v=f.size()-1;if(v<3)throw new p("Ring has fewer than 4 points, so orientation cannot be determined");for(var g=f.getCoordinate(0),y=0,d=1;d<=v;d++){var _=f.getCoordinate(d);_.y>g.y&&(g=_,y=d)}var m=null,k=y;do(k-=1)<0&&(k=v),m=f.getCoordinate(k);while(m.equals2D(g)&&k!==y);var x=null,I=y;do I=(I+1)%v,x=f.getCoordinate(I);while(x.equals2D(g)&&I!==y);if(m.equals2D(g)||x.equals2D(g)||m.equals2D(x))return!1;var E=e.index(m,g,x);return 0===E?m.x>x.x:E>0}}}]),e}();tu.CLOCKWISE=-1,tu.RIGHT=tu.CLOCKWISE,tu.COUNTERCLOCKWISE=1,tu.LEFT=tu.COUNTERCLOCKWISE,tu.COLLINEAR=0,tu.STRAIGHT=tu.COLLINEAR;var tl=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n}},{key:"findRightmostEdgeAtVertex",value:function(){var t=this._minDe.getEdge().getCoordinates();A.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],i=tu.index(this._minCoord,n,e),r=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&i===tu.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&i===tu.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length||n[e].y===n[e+1].y)return -1;var i=K.LEFT;return n[e].y<n[e+1].y&&(i=K.RIGHT),i}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(t){for(var e=t.getEdge().getCoordinates(),n=0;n<e.length-1;n++)(null===this._minCoord||e[n].x>this._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])}},{key:"findRightmostEdgeAtNode",value: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)}},{key:"findEdge",value:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}A.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)===K.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}]),e}(),th=function(e){i(s,e);var r=h(s);function s(e,n){var i;return t(this,s),(i=r.call(this,n?e+" [ "+n+" ]":e)).pt=n?new q(n):void 0,i.name="TopologyException",i}return n(s,[{key:"getCoordinate",value:function(){return this.pt}}]),s}(M),tc=function(){function e(){t(this,e),this.array=[]}return n(e,[{key:"addLast",value:function(t){this.array.push(t)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return 0===this.array.length}}]),e}(),tf=function(e,r){i(a,e);var s=h(a);function a(e){var n;return t(this,a),(n=s.call(this)).array=[],e instanceof U&&n.addAll(e),n}return n(a,[{key:"interfaces_",get:function(){return[$,U]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(t){return 1==arguments.length?this.array.push(t):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(t){var e,n=y(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.array.push(i)}}catch(t){n.e(t)}finally{n.f()}}},{key:"set",value:function(t,e){var n=this.array[t];return this.array[t]=e,n}},{key:"iterator",value:function(){return new tv(this)}},{key:"get",value:function(t){if(t<0||t>=this.size())throw new Q;return this.array[t]}},{key:"isEmpty",value:function(){return 0===this.array.length}},{key:"sort",value:function(t){t?this.array.sort(function(e,n){return t.compare(e,n)}):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(t){for(var e=0,n=this.array.length;e<n;e++)if(this.array[e]===t)return!!this.array.splice(e,1);return!1}},{key:r,value:function(){return this.array.values()}}]),a}($,Symbol.iterator),tv=function(){function e(n){t(this,e),this.arrayList=n,this.position=0}return n(e,[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new V;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(t){return this.arrayList.set(this.position-1,t)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}]),e}(),tg=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"clearVisitedEdges",value:function(){for(var t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var i=n.next();if(i.isVisited()||i.getSym().isVisited()){e=i;break}}if(null===e)throw new th("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var r=t.getEdges().iterator();r.hasNext();){var s=r.next();s.setVisited(!0),this.copySymDepths(s)}}},{key:"computeDepth",value:function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.getNode(),e.getLabel(),e.setEdgeDepths(K.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)}},{key:"create",value:function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(K.RIGHT)>=1&&0>=e.getDepth(K.LEFT)&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}}},{key:"computeDepths",value:function(t){var e=new W,n=new tc,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 a=s.next().getSym();if(!a.isVisited()){var o=a.getNode();e.contains(o)||(n.addLast(o),e.add(o))}}}}},{key:"compareTo",value:function(t){return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(null===this._env){for(var t=new z,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),i=0;i<n.length-1;i++)t.expandToInclude(n[i]);this._env=t}return this._env}},{key:"addReachable",value:function(t){var e=new tt;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}}},{key:"copySymDepths",value:function(t){var e=t.getSym();e.setDepth(K.LEFT,t.getDepth(K.RIGHT)),e.setDepth(K.RIGHT,t.getDepth(K.LEFT))}},{key:"add",value:function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var i=n.next();this._dirEdgeList.add(i);var r=i.getSym().getNode();r.isVisited()||e.push(r)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new tf,this._nodes=new tf,this._rightMostCoord=null,this._env=null,this._finder=new tl}}]),e}(),ty=function(){function e(){t(this,e)}return n(e,null,[{key:"intersection",value:function(t,e,n,i){var r=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,o=t.y>e.y?t.y:e.y,u=n.x<i.x?n.x:i.x,l=n.y<i.y?n.y:i.y,h=n.x>i.x?n.x:i.x,c=n.y>i.y?n.y:i.y,f=((r>u?r:u)+(a<h?a:h))/2,v=((s>l?s:l)+(o<c?o:c))/2,g=t.x-f,y=t.y-v,d=e.x-f,_=e.y-v,p=n.x-f,m=n.y-v,k=i.x-f,x=i.y-v,I=y-_,E=d-g,N=g*_-d*y,T=m-x,S=k-p,L=p*x-k*m,C=I*S-T*E,R=(E*L-S*N)/C,O=(T*N-I*L)/C;return w.isNaN(R)||w.isInfinite(R)||w.isNaN(O)||w.isInfinite(O)?null:new q(R+f,O+v)}}]),e}(),td=function(){function e(){t(this,e)}return n(e,null,[{key:"arraycopy",value:function(t,e,n,i,r){for(var s=0,a=e;a<e+r;a++)n[i+s]=t[a],s++}},{key:"getProperty",value:function(t){return({"line.separator":"\n"})[t]}}]),e}(),t_=function(){function e(){t(this,e)}return n(e,null,[{key:"log10",value:function(t){var n=Math.log(t);return w.isInfinite(n)||w.isNaN(n)?n:n/e.LOG_10}},{key:"min",value:function(t,e,n,i){var r=t;return e<r&&(r=e),n<r&&(r=n),i<r&&(r=i),r}},{key:"clamp",value:function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],r=arguments[1],s=arguments[2];return i<r?r:i>s?s:i}}},{key:"wrap",value:function(t,e){return t<0?e- -t%e:t%e}},{key:"max",value:function(){if(3==arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=t;return e>i&&(i=e),n>i&&(i=n),i}if(4==arguments.length){var r=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3],u=r;return s>u&&(u=s),a>u&&(u=a),o>u&&(u=o),u}}},{key:"average",value:function(t,e){return(t+e)/2}}]),e}();t_.LOG_10=Math.log(10);var tp=function(){function e(){t(this,e)}return n(e,null,[{key:"segmentToSegment",value:function(t,n,i,r){if(t.equals(n))return e.pointToSegment(t,i,r);if(i.equals(r))return e.pointToSegment(r,t,n);var s=!1;if(z.intersects(t,n,i,r)){var a=(n.x-t.x)*(r.y-i.y)-(n.y-t.y)*(r.x-i.x);if(0===a)s=!0;else{var o=(t.y-i.y)*(r.x-i.x)-(t.x-i.x)*(r.y-i.y),u=((t.y-i.y)*(n.x-t.x)-(t.x-i.x)*(n.y-t.y))/a,l=o/a;(l<0||l>1||u<0||u>1)&&(s=!0)}}else s=!0;return s?t_.min(e.pointToSegment(t,i,r),e.pointToSegment(n,i,r),e.pointToSegment(i,t,n),e.pointToSegment(r,t,n)):0}},{key:"pointToSegment",value: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;return r<=0?t.distance(e):r>=1?t.distance(n):Math.abs(((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i)*Math.sqrt(i)}},{key:"pointToLinePerpendicular",value:function(t,e,n){var i=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y);return Math.abs(((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/i)*Math.sqrt(i)}},{key:"pointToSegmentString",value:function(t,n){if(0===n.length)throw new p("Line array must contain at least one vertex");for(var i=t.distance(n[0]),r=0;r<n.length-1;r++){var s=e.pointToSegment(t,n[r],n[r+1]);s<i&&(i=s)}return i}}]),e}(),tm=function(){function e(){t(this,e)}return n(e,[{key:"create",value:function(){if(1==arguments.length)arguments[0]instanceof Array||te(arguments[0],to);else if(2==arguments.length);else if(3==arguments.length){var t=arguments[0],e=arguments[1];return this.create(t,e)}}}]),e}(),tk=function(){function e(){t(this,e)}return n(e,[{key:"filter",value:function(t){}}]),e}(),tx=function(){function e(){t(this,e)}return n(e,null,[{key:"ofLine",value:function(t){var e=t.size();if(e<=1)return 0;var n=0,i=new q;t.getCoordinate(0,i);for(var r=i.x,s=i.y,a=1;a<e;a++){t.getCoordinate(a,i);var o=i.x,u=i.y,l=o-r,h=u-s;n+=Math.sqrt(l*l+h*h),r=o,s=u}return n}}]),e}(),tI=function e(){t(this,e)},tE=function(){function e(){t(this,e)}return n(e,null,[{key:"copyCoord",value:function(t,e,n,i){for(var r=Math.min(t.getDimension(),n.getDimension()),s=0;s<r;s++)n.setOrdinate(i,s,t.getOrdinate(e,s))}},{key:"isRing",value:function(t){var e=t.size();return 0===e||!(e<=3)&&t.getOrdinate(0,to.X)===t.getOrdinate(e-1,to.X)&&t.getOrdinate(0,to.Y)===t.getOrdinate(e-1,to.Y)}},{key:"scroll",value:function(){if(2==arguments.length){if(te(arguments[0],to)&&Number.isInteger(arguments[1])){var t=arguments[0],n=arguments[1];e.scroll(t,n,e.isRing(t))}else if(te(arguments[0],to)&&arguments[1]instanceof q){var i=arguments[0],r=arguments[1],s=e.indexOf(r,i);if(s<=0)return null;e.scroll(i,s)}}else if(3==arguments.length){var a=arguments[0],o=arguments[1],u=arguments[2];if(o<=0)return null;for(var l=a.copy(),h=u?a.size()-1:a.size(),c=0;c<h;c++)for(var f=0;f<a.getDimension();f++)a.setOrdinate(c,f,l.getOrdinate((o+c)%h,f));if(u)for(var v=0;v<a.getDimension();v++)a.setOrdinate(h,v,a.getOrdinate(0,v))}}},{key:"isEqual",value:function(t,e){var n=t.size();if(n!==e.size())return!1;for(var i=Math.min(t.getDimension(),e.getDimension()),r=0;r<n;r++)for(var s=0;s<i;s++){var a=t.getOrdinate(r,s),o=e.getOrdinate(r,s);if(t.getOrdinate(r,s)!==e.getOrdinate(r,s)&&(!w.isNaN(a)||!w.isNaN(o)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(1==arguments.length){var t=arguments[0];return e.minCoordinateIndex(t,0,t.size()-1)}if(3==arguments.length){for(var n=arguments[0],i=arguments[1],r=arguments[2],s=-1,a=null,o=i;o<=r;o++){var u=n.getCoordinate(o);(null===a||a.compareTo(u)>0)&&(a=u,s=o)}return s}}},{key:"extend",value:function(t,n,i){var r=t.create(i,n.getDimension()),s=n.size();if(e.copy(n,0,r,0,s),s>0)for(var a=s;a<i;a++)e.copy(n,s-1,r,a,1);return r}},{key:"reverse",value:function(t){for(var n=t.size()-1,i=Math.trunc(n/2),r=0;r<=i;r++)e.swap(t,r,n-r)}},{key:"swap",value:function(t,e,n){if(e===n)return null;for(var i=0;i<t.getDimension();i++){var r=t.getOrdinate(e,i);t.setOrdinate(e,i,t.getOrdinate(n,i)),t.setOrdinate(n,i,r)}}},{key:"copy",value:function(t,n,i,r,s){for(var a=0;a<s;a++)e.copyCoord(t,n+a,i,r+a)}},{key:"ensureValidRing",value:function(t,n){var i=n.size();return 0===i?n:i<=3?e.createClosedRing(t,n,4):n.getOrdinate(0,to.X)===n.getOrdinate(i-1,to.X)&&n.getOrdinate(0,to.Y)===n.getOrdinate(i-1,to.Y)?n:e.createClosedRing(t,n,i+1)}},{key:"indexOf",value:function(t,e){for(var n=0;n<e.size();n++)if(t.x===e.getOrdinate(n,to.X)&&t.y===e.getOrdinate(n,to.Y))return n;return -1}},{key:"createClosedRing",value:function(t,n,i){var r=t.create(i,n.getDimension()),s=n.size();e.copy(n,0,r,0,s);for(var a=s;a<i;a++)e.copy(n,0,r,a,1);return r}},{key:"minCoordinate",value:function(t){for(var e=null,n=0;n<t.size();n++){var i=t.getCoordinate(n);(null===e||e.compareTo(i)>0)&&(e=i)}return e}}]),e}(),tN=function(){function e(){t(this,e)}return n(e,null,[{key:"toDimensionSymbol",value:function(t){switch(t){case e.FALSE:return e.SYM_FALSE;case e.TRUE:return e.SYM_TRUE;case e.DONTCARE:return e.SYM_DONTCARE;case e.P:return e.SYM_P;case e.L:return e.SYM_L;case e.A:return e.SYM_A}throw new p("Unknown dimension value: "+t)}},{key:"toDimensionValue",value:function(t){switch(tr.toUpperCase(t)){case e.SYM_FALSE:return e.FALSE;case e.SYM_TRUE:return e.TRUE;case e.SYM_DONTCARE:return e.DONTCARE;case e.SYM_P:return e.P;case e.SYM_L:return e.L;case e.SYM_A:return e.A}throw new p("Unknown dimension symbol: "+t)}}]),e}();tN.P=0,tN.L=1,tN.A=2,tN.FALSE=-1,tN.TRUE=-2,tN.DONTCARE=-3,tN.SYM_FALSE="F",tN.SYM_TRUE="T",tN.SYM_DONTCARE="*",tN.SYM_P="0",tN.SYM_L="1",tN.SYM_A="2";var tT=function(){function e(){t(this,e)}return n(e,[{key:"filter",value:function(t){}}]),e}(),tS=function(){function e(){t(this,e)}return n(e,[{key:"filter",value:function(t,e){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),e}(),tL=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new z:this._points.expandEnvelope(new z)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new a(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(2==arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof X){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t)||this._points.size()!==t._points.size())return!1;for(var n=0;n<this._points.size();n++)if(!this.equal(this._points.getCoordinate(n),t._points.getCoordinate(n),e))return!1;return!0}return c(r(a.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var t=0;t<Math.trunc(this._points.size()/2);t++){var e=this._points.size()-1-t;if(!this._points.getCoordinate(t).equals(this._points.getCoordinate(e))){if(this._points.getCoordinate(t).compareTo(this._points.getCoordinate(e))>0){var n=this._points.copy();tE.reverse(n),this._points=n}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?tN.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var t=this._points.copy();return tE.reverse(t),this.getFactory().createLineString(t)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return X.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return tx.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(1==arguments.length){for(var t=arguments[0],e=0,n=0;e<this._points.size()&&n<t._points.size();){var i=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==i)return i;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2==arguments.length){var r=arguments[0],s=arguments[1];return s.compare(this._points,r._points)}}},{key:"apply",value:function(){if(te(arguments[0],tk))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(te(arguments[0],tS)){var n=arguments[0];if(0===this._points.size())return null;for(var i=0;i<this._points.size()&&(n.filter(this._points,i),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(te(arguments[0],tT)){var r=arguments[0];r.filter(this)}else if(te(arguments[0],m)){var s=arguments[0];s.filter(this)}}},{key:"getBoundary",value:function(){throw new H}},{key:"isEquivalentClass",value:function(t){return t instanceof a}},{key:"getCoordinateN",value:function(t){return this._points.getCoordinate(t)}},{key:"getGeometryType",value:function(){return X.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return 0===this._points.size()}},{key:"init",value:function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new p("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t}},{key:"isCoordinate",value:function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))}},{key:"interfaces_",get:function(){return[tI]}}],[{key:"constructor_",value:function(){if(this._points=null,0==arguments.length);else if(2==arguments.length){var t=arguments[0],e=arguments[1];X.constructor_.call(this,e),this.init(t)}}}]),a}(X),tC=function e(){t(this,e)},tR=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new z;var t=new z;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new a(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(2==arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof X){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&(!(!this.isEmpty()||!t.isEmpty())||this.isEmpty()===t.isEmpty()&&this.equal(t.getCoordinate(),this.getCoordinate(),e))}return c(r(a.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return tN.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return X.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(null===this.getCoordinate())throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(1==arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2==arguments.length){var e=arguments[0],n=arguments[1];return n.compare(this._coordinates,e._coordinates)}}},{key:"apply",value:function(){if(te(arguments[0],tk)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(te(arguments[0],tS)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(te(arguments[0],tT)){var n=arguments[0];n.filter(this)}else if(te(arguments[0],m)){var i=arguments[0];i.filter(this)}}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return X.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(null===this.getCoordinate())throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return 0===this._coordinates.size()}},{key:"init",value:function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),A.isTrue(1>=t.size()),this._coordinates=t}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[tC]}}],[{key:"constructor_",value:function(){this._coordinates=null;var t=arguments[0],e=arguments[1];X.constructor_.call(this,e),this.init(t)}}]),a}(X),tO=function(){function e(){t(this,e)}return n(e,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];return Math.abs(e.ofRingSigned(t))}if(te(arguments[0],to)){var n=arguments[0];return Math.abs(e.ofRingSigned(n))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,i=1;i<t.length-1;i++){var r=t[i].x-n,s=t[i+1].y;e+=r*(t[i-1].y-s)}return e/2}if(te(arguments[0],to)){var a=arguments[0],o=a.size();if(o<3)return 0;var u=new q,l=new q,h=new q;a.getCoordinate(0,l),a.getCoordinate(1,h);var c=l.x;h.x-=c;for(var f=0,v=1;v<o-1;v++)u.y=l.y,l.x=h.x,l.y=h.y,a.getCoordinate(v+1,h),h.x-=c,f+=l.x*(u.y-h.y);return f/2}}}]),e}(),tw=function(){function e(){t(this,e)}return n(e,null,[{key:"sort",value:function(){var t=arguments,e=arguments[0];if(1==arguments.length)e.sort(function(t,e){return t.compareTo(e)});else if(2==arguments.length)e.sort(function(e,n){return t[1].compare(e,n)});else if(3==arguments.length){var n=e.slice(arguments[1],arguments[2]);n.sort();var i=e.slice(0,arguments[1]).concat(n,e.slice(arguments[2],e.length));e.splice(0,e.length);var r,s=y(i);try{for(s.s();!(r=s.n()).done;){var a=r.value;e.push(a)}}catch(t){s.e(t)}finally{s.f()}}else if(4==arguments.length){var o=e.slice(arguments[1],arguments[2]);o.sort(function(e,n){return t[3].compare(e,n)});var u=e.slice(0,arguments[1]).concat(o,e.slice(arguments[2],e.length));e.splice(0,e.length);var l,h=y(u);try{for(h.s();!(l=h.n()).done;){var c=l.value;e.push(c)}}catch(t){h.e(t)}finally{h.f()}}}},{key:"asList",value:function(t){var e,n=new tf,i=y(t);try{for(i.s();!(e=i.n()).done;){var r=e.value;n.add(r)}}catch(t){i.e(t)}finally{i.f()}return n}},{key:"copyOf",value:function(t,e){return t.slice(0,e)}}]),e}(),tb=function e(){t(this,e)},tM=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var t=Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),i=0;i<n.length;i++)t[++e]=n[i];for(var r=0;r<this._holes.length;r++)for(var s=this._holes[r].getCoordinates(),a=0;a<s.length;a++)t[++e]=s[a];return t}},{key:"getArea",value:function(){var t;t=0+tO.ofRing(this._shell.getCoordinateSequence());for(var e=0;e<this._holes.length;e++)t-=tO.ofRing(this._holes[e].getCoordinateSequence());return t}},{key:"copyInternal",value:function(){for(var t=this._shell.copy(),e=Array(this._holes.length).fill(null),n=0;n<this._holes.length;n++)e[n]=this._holes[n].copy();return new a(t,e,this._factory)}},{key:"isRectangle",value:function(){if(0!==this.getNumInteriorRing()||null===this._shell||5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var i=t.getX(n);if(i!==e.getMinX()&&i!==e.getMaxX())return!1;var r=t.getY(n);if(r!==e.getMinY()&&r!==e.getMaxY())return!1}for(var s=t.getX(0),a=t.getY(0),o=1;o<=4;o++){var u=t.getX(o),l=t.getY(o);if(u!==s==(l!==a))return!1;s=u,a=l}return!0}},{key:"equalsExact",value:function(){if(2==arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof X){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=this._shell,i=t._shell;if(!n.equalsExact(i,e)||this._holes.length!==t._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(t._holes[s],e))return!1;return!0}return c(r(a.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){if(0==arguments.length){this._shell=this.normalized(this._shell,!0);for(var t=0;t<this._holes.length;t++)this._holes[t]=this.normalized(this._holes[t],!1);tw.sort(this._holes)}else if(2==arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var i=e.getCoordinateSequence(),r=tE.minCoordinateIndex(i,0,i.size()-2);tE.scroll(i,r,!0),tu.isCCW(i)===n&&tE.reverse(i)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var t=this.getExteriorRing().reverse(),e=Array(this.getNumInteriorRing()).fill(null),n=0;n<e.length;n++)e[n]=this.getInteriorRingN(n).reverse();return this.getFactory().createPolygon(t,e)}},{key:"getTypeCode",value:function(){return X.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var t;t=0+this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t}},{key:"getNumPoints",value:function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(t,e){var n=t.copy();return this.normalize(n,e),n}},{key:"compareToSameClass",value:function(){if(1==arguments.length){var t=arguments[0],e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2==arguments.length){var i=arguments[0],r=arguments[1],s=this._shell,a=i._shell,o=s.compareToSameClass(a,r);if(0!==o)return o;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),h=0;h<u&&h<l;){var c=this.getInteriorRingN(h),f=i.getInteriorRingN(h),v=c.compareToSameClass(f,r);if(0!==v)return v;h++}return h<u?1:h<l?-1:0}}},{key:"apply",value:function(){if(te(arguments[0],tk)){var t=arguments[0];this._shell.apply(t);for(var e=0;e<this._holes.length;e++)this._holes[e].apply(t)}else if(te(arguments[0],tS)){var n=arguments[0];if(this._shell.apply(n),!n.isDone())for(var i=0;i<this._holes.length&&(this._holes[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(te(arguments[0],tT)){var r=arguments[0];r.filter(this)}else if(te(arguments[0],m)){var s=arguments[0];s.filter(this),this._shell.apply(s);for(var a=0;a<this._holes.length;a++)this._holes[a].apply(s)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)}},{key:"getGeometryType",value:function(){return X.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(t){return this._holes[t]}},{key:"interfaces_",get:function(){return[tb]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(X.constructor_.call(this,n),null===t&&(t=this.getFactory().createLinearRing()),null===e&&(e=[]),X.hasNullElements(e))throw new p("holes must not contain null elements");if(t.isEmpty()&&X.hasNonEmptyElements(e))throw new p("shell is empty but holes are not");this._shell=t,this._holes=e}}]),a}(X),tP=function(e){i(s,e);var r=h(s);function s(e){var n;return t(this,s),(n=r.call(this)).array=[],e instanceof U&&n.addAll(e),n}return n(s,[{key:"contains",value:function(t){var e,n=y(this.array);try{for(n.s();!(e=n.n()).done;)if(0===e.value.compareTo(t))return!0}catch(t){n.e(t)}finally{n.f()}return!1}},{key:"add",value:function(t){if(this.contains(t))return!1;for(var e=0,n=this.array.length;e<n;e++)if(1===this.array[e].compareTo(t))return!!this.array.splice(e,0,t);return this.array.push(t),!0}},{key:"addAll",value:function(t){var e,n=y(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;this.add(i)}}catch(t){n.e(t)}finally{n.f()}return!0}},{key:"remove",value:function(){throw new H}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return 0===this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new tA(this.array)}}]),s}(function(e){i(r,e);var n=h(r);function r(){return t(this,r),n.apply(this,arguments)}return r}(Z)),tA=function(){function e(n){t(this,e),this.array=n,this.position=0}return n(e,[{key:"next",value:function(){if(this.position===this.array.length)throw new V;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new H}}]),e}(),tD=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"computeEnvelopeInternal",value:function(){for(var t=new z,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t}},{key:"getGeometryN",value:function(t){return this._geometries[t]}},{key:"getCoordinates",value:function(){for(var t=Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var i=this._geometries[n].getCoordinates(),r=0;r<i.length;r++)t[++e]=i[r];return t}},{key:"getArea",value:function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t}},{key:"copyInternal",value:function(){for(var t=Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new a(t,this._factory)}},{key:"equalsExact",value:function(){if(2==arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof X){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t)||this._geometries.length!==t._geometries.length)return!1;for(var n=0;n<this._geometries.length;n++)if(!this._geometries[n].equalsExact(t._geometries[n],e))return!1;return!0}return c(r(a.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();tw.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var t=tN.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t}},{key:"reverseInternal",value:function(){for(var t=this._geometries.length,e=new tf(t),n=0;n<t;n++)e.add(this._geometries[n].reverse());return this.getFactory().buildGeometry(e)}},{key:"getTypeCode",value:function(){return X.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var t=tN.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t}},{key:"getLength",value:function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t}},{key:"getNumPoints",value:function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(1==arguments.length){var t=arguments[0],e=new tP(tw.asList(this._geometries)),n=new tP(tw.asList(t._geometries));return this.compare(e,n)}if(2==arguments.length){for(var i=arguments[0],r=arguments[1],s=this.getNumGeometries(),a=i.getNumGeometries(),o=0;o<s&&o<a;){var u=this.getGeometryN(o),l=i.getGeometryN(o),h=u.compareToSameClass(l,r);if(0!==h)return h;o++}return o<s?1:o<a?-1:0}}},{key:"apply",value:function(){if(te(arguments[0],tk))for(var t=arguments[0],e=0;e<this._geometries.length;e++)this._geometries[e].apply(t);else if(te(arguments[0],tS)){var n=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(this._geometries[i].apply(n),!n.isDone());i++);n.isGeometryChanged()&&this.geometryChanged()}else if(te(arguments[0],tT)){var r=arguments[0];r.filter(this);for(var s=0;s<this._geometries.length;s++)this._geometries[s].apply(r)}else if(te(arguments[0],m)){var a=arguments[0];a.filter(this);for(var o=0;o<this._geometries.length;o++)this._geometries[o].apply(a)}}},{key:"getBoundary",value:function(){return X.checkNotGeometryCollection(this),A.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return X.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,0==arguments.length);else if(2==arguments.length){var t=arguments[0],e=arguments[1];if(X.constructor_.call(this,e),null===t&&(t=[]),X.hasNullElements(t))throw new p("geometries must not contain null elements");this._geometries=t}}}]),a}(X),tF=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"copyInternal",value:function(){for(var t=Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new a(t,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(2==arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof X){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&c(r(a.prototype),"equalsExact",this).call(this,t,e)}return c(r(a.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(1==arguments.length&&Number.isInteger(arguments[0])){var t=arguments[0];return this._geometries[t].getCoordinate()}return c(r(a.prototype),"getCoordinate",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return tN.FALSE}},{key:"getTypeCode",value:function(){return X.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return X.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[tC]}}],[{key:"constructor_",value:function(){var t=arguments[0],e=arguments[1];tD.constructor_.call(this,t,e)}}]),a}(tD),tG=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"copyInternal",value:function(){return new a(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return tN.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||c(r(a.prototype),"isClosed",this).call(this)}},{key:"reverseInternal",value:function(){var t=this._points.copy();return tE.reverse(t),this.getFactory().createLinearRing(t)}},{key:"getTypeCode",value:function(){return X.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!c(r(a.prototype),"isClosed",this).call(this))throw new p("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<a.MINIMUM_VALID_SIZE)throw new p("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return X.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var t=arguments[0],e=arguments[1];tL.constructor_.call(this,t,e),this.validateConstruction()}}]),a}(tL);tG.MINIMUM_VALID_SIZE=4;var tq=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,[{key:"setOrdinate",value:function(t,e){switch(t){case s.X:this.x=e;break;case s.Y:this.y=e;break;default:throw new p("Invalid ordinate index: "+t)}}},{key:"getZ",value:function(){return q.NULL_ORDINATE}},{key:"getOrdinate",value:function(t){switch(t){case s.X:return this.x;case s.Y:return this.y}throw new p("Invalid ordinate index: "+t)}},{key:"setZ",value:function(t){throw new p("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new s(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}}],[{key:"constructor_",value:function(){if(0==arguments.length)q.constructor_.call(this);else if(1==arguments.length){if(arguments[0]instanceof s){var t=arguments[0];q.constructor_.call(this,t.x,t.y)}else if(arguments[0]instanceof q){var e=arguments[0];q.constructor_.call(this,e.x,e.y)}}else if(2==arguments.length){var n=arguments[0],i=arguments[1];q.constructor_.call(this,n,i,q.NULL_ORDINATE)}}}]),s}(q);tq.X=0,tq.Y=1,tq.Z=-1,tq.M=-1;var tY=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(t,e){switch(t){case s.X:this.x=e;break;case s.Y:this.y=e;break;case s.M:this._m=e;break;default:throw new p("Invalid ordinate index: "+t)}}},{key:"setM",value:function(t){this._m=t}},{key:"getZ",value:function(){return q.NULL_ORDINATE}},{key:"getOrdinate",value:function(t){switch(t){case s.X:return this.x;case s.Y:return this.y;case s.M:return this._m}throw new p("Invalid ordinate index: "+t)}},{key:"setZ",value:function(t){throw new p("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new s(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,0==arguments.length)q.constructor_.call(this),this._m=0;else if(1==arguments.length){if(arguments[0]instanceof s){var t=arguments[0];q.constructor_.call(this,t.x,t.y),this._m=t._m}else if(arguments[0]instanceof q){var e=arguments[0];q.constructor_.call(this,e.x,e.y),this._m=this.getM()}}else if(3==arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];q.constructor_.call(this,n,i,q.NULL_ORDINATE),this._m=r}}}]),s}(q);tY.X=0,tY.Y=1,tY.Z=-1,tY.M=2;var tz=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(t,e){switch(t){case q.X:this.x=e;break;case q.Y:this.y=e;break;case q.Z:this.z=e;break;case q.M:this._m=e;break;default:throw new p("Invalid ordinate index: "+t)}}},{key:"setM",value:function(t){this._m=t}},{key:"getOrdinate",value:function(t){switch(t){case q.X:return this.x;case q.Y:return this.y;case q.Z:return this.getZ();case q.M:return this.getM()}throw new p("Invalid ordinate index: "+t)}},{key:"copy",value:function(){return new s(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,0==arguments.length)q.constructor_.call(this),this._m=0;else if(1==arguments.length){if(arguments[0]instanceof s){var t=arguments[0];q.constructor_.call(this,t),this._m=t._m}else if(arguments[0]instanceof q){var e=arguments[0];q.constructor_.call(this,e),this._m=this.getM()}}else if(4==arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],a=arguments[3];q.constructor_.call(this,n,i,r),this._m=a}}}]),s}(q),tX=function(){function e(){t(this,e)}return n(e,null,[{key:"measures",value:function(t){return t instanceof tq?0:t instanceof tY||t instanceof tz?1:0}},{key:"dimension",value:function(t){return t instanceof tq?2:t instanceof tY?3:t instanceof tz?4:3}},{key:"create",value:function(){if(1==arguments.length){var t=arguments[0];return e.create(t,0)}if(2==arguments.length){var n=arguments[0],i=arguments[1];return 2===n?new tq:3===n&&0===i?new q:3===n&&1===i?new tY:4===n&&1===i?new tz:new q}}}]),e}(),tB=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"getCoordinate",value:function(t){return this.get(t)}},{key:"addAll",value:function(){if(2==arguments.length&&"boolean"==typeof arguments[1]&&te(arguments[0],U)){for(var t=arguments[0],e=arguments[1],n=!1,i=t.iterator();i.hasNext();)this.add(i.next(),e),n=!0;return n}return c(r(a.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var t=c(r(a.prototype),"clone",this).call(this),e=0;e<this.size();e++)t.add(e,this.get(e).clone());return t}},{key:"toCoordinateArray",value:function(){if(0==arguments.length)return this.toArray(a.coordArrayType);if(1==arguments.length){var t=arguments[0];if(t)return this.toArray(a.coordArrayType);for(var e=this.size(),n=Array(e).fill(null),i=0;i<e;i++)n[i]=this.get(e-i-1);return n}}},{key:"add",value:function(){if(1==arguments.length){var t=arguments[0];return c(r(a.prototype),"add",this).call(this,t)}if(2==arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var e=arguments[0],n=arguments[1];return this.add(e,n,!0),!0}if(arguments[0]instanceof q&&"boolean"==typeof arguments[1]){var i=arguments[0],s=arguments[1];if(!s&&this.size()>=1&&this.get(this.size()-1).equals2D(i))return null;c(r(a.prototype),"add",this).call(this,i)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var o=arguments[0],u=arguments[1];return this.add(o,u),!0}}else if(3==arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var l=arguments[0],h=arguments[1],f=arguments[2];if(f)for(var v=0;v<l.length;v++)this.add(l[v],h);else for(var g=l.length-1;g>=0;g--)this.add(l[g],h);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof q){var y=arguments[0],d=arguments[1],_=arguments[2];if(!_){var p=this.size();if(p>0&&(y>0&&this.get(y-1).equals2D(d)||y<p&&this.get(y).equals2D(d)))return null}c(r(a.prototype),"add",this).call(this,y,d)}}else if(4==arguments.length){var m=arguments[0],k=arguments[1],x=arguments[2],I=arguments[3],E=1;x>I&&(E=-1);for(var N=x;N!==I;N+=E)this.add(m[N],k);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var t=this.get(0).copy();this.add(t,!1)}}}],[{key:"constructor_",value:function(){if(0==arguments.length);else if(1==arguments.length){var t=arguments[0];this.ensureCapacity(t.length),this.add(t,!0)}else if(2==arguments.length){var e=arguments[0],n=arguments[1];this.ensureCapacity(e.length),this.add(e,n)}}}]),a}(tf);tB.coordArrayType=[].fill(null);var tU=function(){function e(){t(this,e)}return n(e,null,[{key:"isRing",value:function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])}},{key:"ptNotInList",value:function(t,n){for(var i=0;i<t.length;i++){var r=t[i];if(0>e.indexOf(r,n))return r}return null}},{key:"scroll",value:function(t,n){var i=e.indexOf(n,t);if(i<0)return null;var r=Array(t.length).fill(null);td.arraycopy(t,i,r,0,t.length-i),td.arraycopy(t,0,r,t.length-i,i),td.arraycopy(r,0,t,0,t.length)}},{key:"equals",value:function(){if(2==arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e||t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3==arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2];if(i===r)return!0;if(null===i||null===r||i.length!==r.length)return!1;for(var a=0;a<i.length;a++)if(0!==s.compare(i[a],r[a]))return!1;return!0}}},{key:"intersection",value:function(t,e){for(var n=new tB,i=0;i<t.length;i++)e.intersects(t[i])&&n.add(t[i],!0);return n.toCoordinateArray()}},{key:"measures",value:function(t){if(null===t||0===t.length)return 0;var e,n=0,i=y(t);try{for(i.s();!(e=i.n()).done;){var r=e.value;n=Math.max(n,tX.measures(r))}}catch(t){i.e(t)}finally{i.f()}return n}},{key:"hasRepeatedPoints",value:function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(t){return e.hasRepeatedPoints(t)?new tB(t,!1).toCoordinateArray():t}},{key:"reverse",value:function(t){for(var e=t.length-1,n=Math.trunc(e/2),i=0;i<=n;i++){var r=t[i];t[i]=t[e-i],t[e-i]=r}}},{key:"removeNull",value:function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var i=Array(e).fill(null);if(0===e)return i;for(var r=0,s=0;s<t.length;s++)null!==t[s]&&(i[r++]=t[s]);return i}},{key:"copyDeep",value:function(){if(1==arguments.length){for(var t=arguments[0],e=Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=t[n].copy();return e}if(5==arguments.length)for(var i=arguments[0],r=arguments[1],s=arguments[2],a=arguments[3],o=arguments[4],u=0;u<o;u++)s[a+u]=i[r+u].copy()}},{key:"isEqualReversed",value:function(t,e){for(var n=0;n<t.length;n++){var i=t[n],r=e[t.length-n-1];if(0!==i.compareTo(r))return!1}return!0}},{key:"envelope",value:function(t){for(var e=new z,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e}},{key:"toCoordinateArray",value:function(t){return t.toArray(e.coordArrayType)}},{key:"dimension",value:function(t){if(null===t||0===t.length)return 3;var e,n=0,i=y(t);try{for(i.s();!(e=i.n()).done;){var r=e.value;n=Math.max(n,tX.dimension(r))}}catch(t){i.e(t)}finally{i.f()}return n}},{key:"atLeastNCoordinatesOrNothing",value:function(t,e){return e.length>=t?e:[]}},{key:"indexOf",value:function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return -1}},{key:"increasingDirection",value:function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,i=t[e].compareTo(t[n]);if(0!==i)return i}return 1}},{key:"compare",value:function(t,e){for(var n=0;n<t.length&&n<e.length;){var i=t[n].compareTo(e[n]);if(0!==i)return i;n++}return n<e.length?-1:n<t.length?1:0}},{key:"minCoordinate",value:function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e}},{key:"extract",value:function(t,e,n){e=t_.clamp(e,0,t.length);var i=(n=t_.clamp(n,-1,t.length))-e+1;n<0&&(i=0),e>=t.length&&(i=0),n<e&&(i=0);var r=Array(i).fill(null);if(0===i)return r;for(var s=0,a=e;a<=n;a++)r[s++]=t[a];return r}}]),e}(),tV=function(){function e(){t(this,e)}return n(e,[{key:"compare",value:function(t,e){return tU.compare(t,e)}},{key:"interfaces_",get:function(){return[b]}}]),e}(),tH=function(){function e(){t(this,e)}return n(e,[{key:"compare",value:function(t,e){if(t.length<e.length)return -1;if(t.length>e.length)return 1;if(0===t.length)return 0;var n=tU.compare(t,e);return tU.isEqualReversed(t,e)?0:n}},{key:"OLDcompare",value:function(t,e){if(t.length<e.length)return -1;if(t.length>e.length)return 1;if(0===t.length)return 0;for(var n=tU.increasingDirection(t),i=tU.increasingDirection(e),r=n>0?0:t.length-1,s=i>0?0:t.length-1,a=0;a<t.length;a++){var o=t[r].compareTo(e[s]);if(0!==o)return o;r+=n,s+=i}return 0}},{key:"interfaces_",get:function(){return[b]}}]),e}();tU.ForwardComparator=tV,tU.BidirectionalComparator=tH,tU.coordArrayType=[].fill(null);var tZ=function(){function e(n){t(this,e),this.str=n}return n(e,[{key:"append",value:function(t){this.str+=t}},{key:"setCharAt",value:function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}},{key:"toString",value:function(){return this.str}}]),e}(),tW=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getM",value:function(t){return this.hasM()?this._coordinates[t].getM():w.NaN}},{key:"setOrdinate",value:function(t,e,n){switch(e){case to.X:this._coordinates[t].x=n;break;case to.Y:this._coordinates[t].y=n;break;default:this._coordinates[t].setOrdinate(e,n)}}},{key:"getZ",value:function(t){return this.hasZ()?this._coordinates[t].getZ():w.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(t,e){switch(e){case to.X:return this._coordinates[t].x;case to.Y:return this._coordinates[t].y;default:return this._coordinates[t].getOrdinate(e)}}},{key:"getCoordinate",value:function(){if(1==arguments.length){var t=arguments[0];return this._coordinates[t]}if(2==arguments.length){var e=arguments[0],n=arguments[1];n.setCoordinate(this._coordinates[e])}}},{key:"getCoordinateCopy",value:function(t){var e=this.createCoordinate();return e.setCoordinate(this._coordinates[t]),e}},{key:"createCoordinate",value:function(){return tX.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(t){return this._coordinates[t].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t}},{key:"copy",value:function(){for(var t=Array(this.size()).fill(null),n=0;n<this._coordinates.length;n++){var i=this.createCoordinate();i.setCoordinate(this._coordinates[n]),t[n]=i}return new e(t,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var t=new tZ(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"}},{key:"getY",value:function(t){return this._coordinates[t].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[to,I]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,1==arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];e.constructor_.call(this,t,tU.dimension(t),tU.measures(t))}else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new q}else if(te(arguments[0],to)){var r=arguments[0];if(null===r)return this._coordinates=[].fill(null),null;this._dimension=r.getDimension(),this._measures=r.getMeasures(),this._coordinates=Array(r.size()).fill(null);for(var s=0;s<this._coordinates.length;s++)this._coordinates[s]=r.getCoordinateCopy(s)}}else if(2==arguments.length){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var a=arguments[0],o=arguments[1];e.constructor_.call(this,a,o,tU.measures(a))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],l=arguments[1];this._coordinates=Array(u).fill(null),this._dimension=l;for(var h=0;h<u;h++)this._coordinates[h]=tX.create(l)}}else if(3==arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],f=arguments[1],v=arguments[2];this._dimension=f,this._measures=v,this._coordinates=null===c?[].fill(null):c}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var g=arguments[0],y=arguments[1],d=arguments[2];this._coordinates=Array(g).fill(null),this._dimension=y,this._measures=d;for(var _=0;_<g;_++)this._coordinates[_]=this.createCoordinate()}}}}]),e}(),tj=function(){function e(){t(this,e)}return n(e,[{key:"readResolve",value:function(){return e.instance()}},{key:"create",value:function(){if(1==arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new tW(t)}if(te(arguments[0],to)){var e=arguments[0];return new tW(e)}}else{if(2==arguments.length){var n=arguments[0],i=arguments[1];return i>3&&(i=3),i<2&&(i=2),new tW(n,i)}if(3==arguments.length){var r=arguments[0],s=arguments[1],a=arguments[2],o=s-a;return a>1&&(a=1),o>3&&(o=3),o<2&&(o=2),new tW(r,o+a,a)}}}},{key:"interfaces_",get:function(){return[tm,I]}}],[{key:"instance",value:function(){return e.instanceObject}}]),e}();tj.instanceObject=new tj;var tK=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"copyInternal",value:function(){for(var t=Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new a(t,this._factory)}},{key:"equalsExact",value:function(){if(2==arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof X){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&c(r(a.prototype),"equalsExact",this).call(this,t,e)}return c(r(a.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return X.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new tf,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),i=0;i<n.getNumGeometries();i++)t.add(n.getGeometryN(i));var r=Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(r))}},{key:"getGeometryType",value:function(){return X.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[tb]}}],[{key:"constructor_",value:function(){var t=arguments[0],e=arguments[1];tD.constructor_.call(this,t,e)}}]),a}(tD),tJ=function(){function e(){t(this,e)}return n(e,[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}]),e}(),tQ=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),(e=r.call(this)).map=new Map,e}return n(s,[{key:"get",value:function(t){return this.map.get(t)||null}},{key:"put",value:function(t,e){return this.map.set(t,e),e}},{key:"values",value:function(){for(var t=new tf,e=this.map.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t}},{key:"entrySet",value:function(){var t=new W;return this.map.entries().forEach(function(e){return t.add(e)}),t}},{key:"size",value:function(){return this.map.size()}}]),s}(tJ),t$=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"equals",value:function(t){return t instanceof e&&this._modelType===t._modelType&&this._scale===t._scale}},{key:"compareTo",value:function(t){var e=this.getMaximumSignificantDigits(),n=t.getMaximumSignificantDigits();return ti.compare(e,n)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===e.FLOATING||this._modelType===e.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var t="UNKNOWN";return this._modelType===e.FLOATING?t="Floating":this._modelType===e.FLOATING_SINGLE?t="Floating-Single":this._modelType===e.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}},{key:"makePrecise",value:function(){if("number"==typeof arguments[0]){var t=arguments[0];return w.isNaN(t)||this._modelType===e.FLOATING_SINGLE?t:this._modelType===e.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof q){var n=arguments[0];if(this._modelType===e.FLOATING)return null;n.x=this.makePrecise(n.x),n.y=this.makePrecise(n.y)}}},{key:"getMaximumSignificantDigits",value:function(){var t=16;return this._modelType===e.FLOATING?t=16:this._modelType===e.FLOATING_SINGLE?t=6:this._modelType===e.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t}},{key:"setScale",value:function(t){this._scale=Math.abs(t)}},{key:"interfaces_",get:function(){return[I,k]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,0==arguments.length)this._modelType=e.FLOATING;else if(1==arguments.length){if(arguments[0]instanceof t0){var t=arguments[0];this._modelType=t,t===e.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=e.FIXED,this.setScale(n)}else if(arguments[0]instanceof e){var i=arguments[0];this._modelType=i._modelType,this._scale=i._scale}}}},{key:"mostPrecise",value:function(t,e){return t.compareTo(e)>=0?t:e}}]),e}(),t0=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"readResolve",value:function(){return e.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[I]}}],[{key:"constructor_",value:function(){this._name=null;var t=arguments[0];this._name=t,e.nameToTypeMap.put(t,this)}}]),e}();t0.nameToTypeMap=new tQ,t$.Type=t0,t$.FIXED=new t0("FIXED"),t$.FLOATING=new t0("FLOATING"),t$.FLOATING_SINGLE=new t0("FLOATING SINGLE"),t$.maximumPreciseValue=0x20000000000000;var t1=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"copyInternal",value:function(){for(var t=Array(this._geometries.length).fill(null),e=0;e<t.length;e++)t[e]=this._geometries[e].copy();return new a(t,this._factory)}},{key:"equalsExact",value:function(){if(2==arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof X){var t=arguments[0],e=arguments[1];return!!this.isEquivalentClass(t)&&c(r(a.prototype),"equalsExact",this).call(this,t,e)}return c(r(a.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?tN.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return X.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new H}},{key:"getGeometryType",value:function(){return X.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[tI]}}],[{key:"constructor_",value:function(){var t=arguments[0],e=arguments[1];tD.constructor_.call(this,t,e)}}]),a}(tD),t2=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"createEmpty",value:function(t){switch(t){case -1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new p("Invalid dimension: "+t)}}},{key:"toGeometry",value:function(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new q(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new q(t.getMinX(),t.getMinY()),new q(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new q(t.getMinX(),t.getMinY()),new q(t.getMinX(),t.getMaxY()),new q(t.getMaxX(),t.getMaxY()),new q(t.getMaxX(),t.getMinY()),new q(t.getMinX(),t.getMinY())]),null)}},{key:"createLineString",value: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(te(arguments[0],to)){var e=arguments[0];return new tL(e,this)}}}},{key:"createMultiLineString",value:function(){if(0==arguments.length)return new t1(null,this);if(1==arguments.length){var t=arguments[0];return new t1(t,this)}}},{key:"buildGeometry",value:function(t){for(var n=null,i=!1,r=!1,s=t.iterator();s.hasNext();){var a=s.next(),o=a.getTypeCode();null===n&&(n=o),o!==n&&(i=!0),a instanceof tD&&(r=!0)}if(null===n)return this.createGeometryCollection();if(i||r)return this.createGeometryCollection(e.toGeometryArray(t));var u=t.iterator().next();if(t.size()>1){if(u instanceof tM)return this.createMultiPolygon(e.toPolygonArray(t));if(u instanceof tL)return this.createMultiLineString(e.toLineStringArray(t));if(u instanceof tR)return this.createMultiPoint(e.toPointArray(t));A.shouldNeverReachHere("Unhandled geometry type: "+u.getGeometryType())}return u}},{key:"createMultiPointFromCoords",value:function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}},{key:"createPoint",value:function(){if(0==arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1==arguments.length){if(arguments[0]instanceof q){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(te(arguments[0],to)){var e=arguments[0];return new tR(e,this)}}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(0==arguments.length)return this.createPolygon(null,null);if(1==arguments.length){if(te(arguments[0],to)){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 tG){var n=arguments[0];return this.createPolygon(n,null)}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];return new tM(i,r,this)}}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){if(0==arguments.length)return new tD(null,this);if(1==arguments.length){var t=arguments[0];return new tD(t,this)}}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value: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(te(arguments[0],to)){var e=arguments[0];return new tG(e,this)}}}},{key:"createMultiPolygon",value:function(){if(0==arguments.length)return new tK(null,this);if(1==arguments.length){var t=arguments[0];return new tK(t,this)}}},{key:"createMultiPoint",value:function(){if(0==arguments.length)return new tF(null,this);if(1==arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return new tF(t,this)}if(te(arguments[0],to)){var e=arguments[0];if(null===e)return this.createMultiPoint([].fill(null));for(var n=Array(e.size()).fill(null),i=0;i<e.size();i++){var r=this.getCoordinateSequenceFactory().create(1,e.getDimension(),e.getMeasures());tE.copy(e,i,r,0,1),n[i]=this.createPoint(r)}return this.createMultiPoint(n)}}}},{key:"interfaces_",get:function(){return[I]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,0==arguments.length)e.constructor_.call(this,new t$,0);else if(1==arguments.length){if(te(arguments[0],tm)){var t=arguments[0];e.constructor_.call(this,new t$,0,t)}else if(arguments[0]instanceof t$){var n=arguments[0];e.constructor_.call(this,n,0,e.getDefaultCoordinateSequenceFactory())}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];e.constructor_.call(this,i,r,e.getDefaultCoordinateSequenceFactory())}else if(3==arguments.length){var s=arguments[0],a=arguments[1],o=arguments[2];this._precisionModel=s,this._coordinateSequenceFactory=o,this._SRID=a}}},{key:"toMultiPolygonArray",value:function(t){var e=Array(t.size()).fill(null);return t.toArray(e)}},{key:"toGeometryArray",value:function(t){if(null===t)return null;var e=Array(t.size()).fill(null);return t.toArray(e)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return tj.instance()}},{key:"toMultiLineStringArray",value:function(t){var e=Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLineStringArray",value:function(t){var e=Array(t.size()).fill(null);return t.toArray(e)}},{key:"toMultiPointArray",value:function(t){var e=Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLinearRingArray",value:function(t){var e=Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPointArray",value:function(t){var e=Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPolygonArray",value:function(t){var e=Array(t.size()).fill(null);return t.toArray(e)}},{key:"createPointFromInternalCoord",value:function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)}}]),e}(),t3={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},t4="EMPTY",t5={};for(var t9 in t3)t5[t9]=t3[t9].toUpperCase();var t8=function(){function e(n){t(this,e),this.wkt=n,this.index_=-1}return n(e,[{key:"isAlpha_",value:function(t){return t>="a"&&t<="z"||t>="A"&&t<="Z"}},{key:"isNumeric_",value:function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)}},{key:"isWhiteSpace_",value:function(t){return" "==t||"	"==t||"\r"==t||"\n"==t}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var t,e=this.nextChar_(),n=this.index_,i=e;if("("==e)t=2;else if(","==e)t=5;else if(")"==e)t=3;else if(this.isNumeric_(e)||"-"==e)t=4,i=this.readNumber_();else if(this.isAlpha_(e))t=1,i=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw Error("Unexpected character: "+e);t=6}return{position:n,value:i,type:t}}},{key:"readNumber_",value:function(){var t,e=this.index_,n=!1,i=!1;do"."==t?n=!0:"e"!=t&&"E"!=t||(i=!0),t=this.nextChar_();while(this.isNumeric_(t,n)||!i&&("e"==t||"E"==t)||i&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}},{key:"readText_",value:function(){var t,e=this.index_;do t=this.nextChar_();while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}]),e}(),t6=function(){function e(n,i){t(this,e),this.lexer_=n,this.token_,this.layout_="XY",this.factory=i}return n(e,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(t){return this.token_.type==t}},{key:"match",value:function(t){var e=this.isTokenType(t);return e&&this.consume_(),e}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var t="XY",e=this.token_;if(this.isTokenType(1)){var n=e.value;"Z"===n?t="XYZ":"M"===n?t="XYM":"ZM"===n&&(t="XYZM"),"XY"!==t&&this.consume_()}return t}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(2)){var t=[];do t.push(this.parseGeometry_());while(this.match(5));if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(2)){var t=this.parsePoint_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return null;throw Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(2)){var t=this.parsePointList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(2)){var t=this.parseLineStringTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var t;if(this.match(2)){if(t=2==this.token_.type?this.parsePointTextList_():this.parsePointList_(),this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(2)){var t=this.parseLineStringTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(2)){var t=this.parsePolygonTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var t=[],e=this.layout_.length,n=0;n<e;++n){var i=this.token_;if(!this.match(4))break;t.push(i.value)}if(t.length==e)return t;throw Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var t=[this.parsePoint_()];this.match(5);)t.push(this.parsePoint_());return t}},{key:"parsePointTextList_",value:function(){for(var t=[this.parsePointText_()];this.match(5);)t.push(this.parsePointText_());return t}},{key:"parseLineStringTextList_",value:function(){for(var t=[this.parseLineStringText_()];this.match(5);)t.push(this.parseLineStringText_());return t}},{key:"parsePolygonTextList_",value:function(){for(var t=[this.parsePolygonText_()];this.match(5);)t.push(this.parsePolygonText_());return t}},{key:"isEmptyGeometry_",value:function(){var t=this.isTokenType(1)&&this.token_.value==t4;return t&&this.consume_(),t}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var t=this.factory,e=function(t){return o(q,f(t))},n=function(n){var i=n.map(function(n){return t.createLinearRing(n.map(e))});return i.length>1?t.createPolygon(i[0],i.slice(1)):t.createPolygon(i[0])},i=this.token_;if(this.match(1)){var r=i.value;if(this.layout_=this.parseGeometryLayout_(),"GEOMETRYCOLLECTION"==r){var s=this.parseGeometryCollectionText_();return t.createGeometryCollection(s)}switch(r){case"POINT":var a=this.parsePointText_();return a?t.createPoint(o(q,f(a))):t.createPoint();case"LINESTRING":var u=this.parseLineStringText_().map(e);return t.createLineString(u);case"LINEARRING":var l=this.parseLineStringText_().map(e);return t.createLinearRing(l);case"POLYGON":var h=this.parsePolygonText_();return h&&0!==h.length?n(h):t.createPolygon();case"MULTIPOINT":var c=this.parseMultiPointText_();if(!c||0===c.length)return t.createMultiPoint();var v=c.map(e).map(function(e){return t.createPoint(e)});return t.createMultiPoint(v);case"MULTILINESTRING":var g=this.parseMultiLineStringText_().map(function(n){return t.createLineString(n.map(e))});return t.createMultiLineString(g);case"MULTIPOLYGON":var y=this.parseMultiPolygonText_();if(!y||0===y.length)return t.createMultiPolygon();var d=y.map(n);return t.createMultiPolygon(d);default:throw Error("Invalid geometry type: "+r)}}throw Error(this.formatErrorMessage_())}}]),e}();function t7(t){if(t.isEmpty())return"";var e=t.getCoordinate(),n=[e.x,e.y];return void 0===e.z||Number.isNaN(e.z)||n.push(e.z),void 0===e.m||Number.isNaN(e.m)||n.push(e.m),n.join(" ")}function et(t){for(var e=t.getCoordinates().map(function(t){var e=[t.x,t.y];return void 0===t.z||Number.isNaN(t.z)||e.push(t.z),void 0===t.m||Number.isNaN(t.m)||e.push(t.m),e}),n=[],i=0,r=e.length;i<r;++i)n.push(e[i].join(" "));return n.join(", ")}function ee(t){var e=[];e.push("("+et(t.getExteriorRing())+")");for(var n=0,i=t.getNumInteriorRing();n<i;++n)e.push("("+et(t.getInteriorRingN(n))+")");return e.join(", ")}var en={Point:t7,LineString:et,LinearRing:et,Polygon:ee,MultiPoint:function(t){for(var e=[],n=0,i=t.getNumGeometries();n<i;++n)e.push("("+t7(t.getGeometryN(n))+")");return e.join(", ")},MultiLineString:function(t){for(var e=[],n=0,i=t.getNumGeometries();n<i;++n)e.push("("+et(t.getGeometryN(n))+")");return e.join(", ")},MultiPolygon:function(t){for(var e=[],n=0,i=t.getNumGeometries();n<i;++n)e.push("("+ee(t.getGeometryN(n))+")");return e.join(", ")},GeometryCollection:function(t){for(var e=[],n=0,i=t.getNumGeometries();n<i;++n)e.push(ei(t.getGeometryN(n)));return e.join(", ")}};function ei(t){var e=t.getGeometryType(),n=en[e];e=e.toUpperCase();var i=function(t){var e="";if(t.isEmpty())return e;var n=t.getCoordinate();return void 0===n.z||Number.isNaN(n.z)||(e+="Z"),void 0===n.m||Number.isNaN(n.m)||(e+="M"),e}(t);return i.length>0&&(e+=" "+i),t.isEmpty()?e+" "+t4:e+" ("+n(t)+")"}var er=function(){function e(n){t(this,e),this.geometryFactory=n||new t2,this.precisionModel=this.geometryFactory.getPrecisionModel()}return n(e,[{key:"read",value:function(t){return new t6(new t8(t),this.geometryFactory).parse()}},{key:"write",value:function(t){return ei(t)}}]),e}(),es=function(){function e(n){t(this,e),this.parser=new er(n)}return n(e,[{key:"write",value:function(t){return this.parser.write(t)}}],[{key:"toLineString",value:function(t,e){if(2!=arguments.length)throw Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"}}]),e}(),ea=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getIndexAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}},{key:"getTopologySummary",value:function(){var t=new tZ;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}},{key:"computeIntersection",value:function(t,e,n,i){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=i,this._result=this.computeIntersect(t,e,n,i)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(0==arguments.length)null===this._intLineIndex&&(this._intLineIndex=[,,].fill().map(function(){return[,,]}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1==arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"isInteriorIntersection",value:function(){if(0==arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1==arguments.length){for(var t=arguments[0],e=0;e<this._result;e++)if(!this._intPt[e].equals2D(this._inputLines[t][0])&&!this._intPt[e].equals2D(this._inputLines[t][1]))return!0;return!1}}},{key:"getIntersection",value:function(t){return this._intPt[t]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==e.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(t,n){return e.computeEdgeDistance(this._intPt[n],this._inputLines[t][0],this._inputLines[t][1])}},{key:"isCollinear",value:function(){return this._result===e.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return es.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+es.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(t,e){return this._inputLines[t][e]}},{key:"isIntersection",value:function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=[,,].fill().map(function(){return[,,]}),this._intPt=[,,].fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new q,this._intPt[1]=new q,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(t,e,n){var i=Math.abs(n.x-e.x),r=Math.abs(n.y-e.y),s=-1;if(t.equals(e))s=0;else if(t.equals(n))s=i>r?i:r;else{var a=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);0!==(s=i>r?a:o)||t.equals(e)||(s=Math.max(a,o))}return A.isTrue(!(0===s&&!t.equals(e)),"Bad distance calculation"),s}},{key:"nonRobustComputeEdgeDistance",value:function(t,e,n){var i=t.x-e.x,r=t.y-e.y,s=Math.sqrt(i*i+r*r);return A.isTrue(!(0===s&&!t.equals(e)),"Invalid distance calculation"),s}}]),e}();ea.DONT_INTERSECT=0,ea.DO_INTERSECT=1,ea.COLLINEAR=2,ea.NO_INTERSECTION=0,ea.POINT_INTERSECTION=1,ea.COLLINEAR_INTERSECTION=2;var eo=function(e){i(a,e);var s=h(a);function a(){return t(this,a),s.call(this)}return n(a,[{key:"isInSegmentEnvelopes",value:function(t){var e=new z(this._inputLines[0][0],this._inputLines[0][1]),n=new z(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)}},{key:"computeIntersection",value:function(){if(3!=arguments.length)return c(r(a.prototype),"computeIntersection",this).apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2];if(this._isProper=!1,z.intersects(e,n,t)&&0===tu.index(e,n,t)&&0===tu.index(n,e,t))return this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),this._result=ea.POINT_INTERSECTION,null;this._result=ea.NO_INTERSECTION}},{key:"intersection",value:function(t,e,n,i){var r=this.intersectionSafe(t,e,n,i);return this.isInSegmentEnvelopes(r)||(r=new q(a.nearestEndpoint(t,e,n,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(r),r}},{key:"checkDD",value:function(t,e,n,i,r){var s=ta.intersection(t,e,n,i),a=this.isInSegmentEnvelopes(s);td.out.println("DD in env = "+a+"  --------------------- "+s),r.distance(s)>1e-4&&td.out.println("Distance = "+r.distance(s))}},{key:"intersectionSafe",value:function(t,e,n,i){var r=ty.intersection(t,e,n,i);return null===r&&(r=a.nearestEndpoint(t,e,n,i)),r}},{key:"computeCollinearIntersection",value:function(t,e,n,i){var r=z.intersects(t,e,n),s=z.intersects(t,e,i),a=z.intersects(n,i,t),o=z.intersects(n,i,e);return r&&s?(this._intPt[0]=n,this._intPt[1]=i,ea.COLLINEAR_INTERSECTION):a&&o?(this._intPt[0]=t,this._intPt[1]=e,ea.COLLINEAR_INTERSECTION):r&&a?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||s||o?ea.COLLINEAR_INTERSECTION:ea.POINT_INTERSECTION):r&&o?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||s||a?ea.COLLINEAR_INTERSECTION:ea.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=t,!i.equals(t)||r||o?ea.COLLINEAR_INTERSECTION:ea.POINT_INTERSECTION):s&&o?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||r||a?ea.COLLINEAR_INTERSECTION:ea.POINT_INTERSECTION):ea.NO_INTERSECTION}},{key:"computeIntersect",value:function(t,e,n,i){if(this._isProper=!1,!z.intersects(t,e,n,i))return ea.NO_INTERSECTION;var r=tu.index(t,e,n),s=tu.index(t,e,i);if(r>0&&s>0||r<0&&s<0)return ea.NO_INTERSECTION;var a=tu.index(n,i,t),o=tu.index(n,i,e);return a>0&&o>0||a<0&&o<0?ea.NO_INTERSECTION:0===r&&0===s&&0===a&&0===o?this.computeCollinearIntersection(t,e,n,i):(0===r||0===s||0===a||0===o?(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 q(n):0===s?this._intPt[0]=new q(i):0===a?this._intPt[0]=new q(t):0===o&&(this._intPt[0]=new q(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,n,i)),ea.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(t,e,n,i){var r=t,s=tp.pointToSegment(t,n,i),a=tp.pointToSegment(e,n,i);return a<s&&(s=a,r=e),(a=tp.pointToSegment(n,t,e))<s&&(s=a,r=n),(a=tp.pointToSegment(i,t,e))<s&&(s=a,r=i),r}}]),a}(ea),eu=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"countSegment",value:function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,i=e.x;return n>i&&(n=e.x,i=t.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var r=tu.index(t,e,this._p);if(r===tu.COLLINEAR)return this._isPointOnSegment=!0,null;e.y<t.y&&(r=-r),r===tu.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==B.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?B.BOUNDARY:this._crossingCount%2==1?B.INTERIOR:B.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof q&&te(arguments[1],to)){for(var t=arguments[0],n=arguments[1],i=new e(t),r=new q,s=new q,a=1;a<n.size()&&(n.getCoordinate(a,r),n.getCoordinate(a-1,s),i.countSegment(r,s),!i.isOnSegment());a++);return i.getLocation()}if(arguments[0]instanceof q&&arguments[1]instanceof Array){for(var o=arguments[0],u=arguments[1],l=new e(o),h=1;h<u.length;h++){var c=u[h],f=u[h-1];if(l.countSegment(c,f),l.isOnSegment())break}return l.getLocation()}}}]),e}(),el=function(){function e(){t(this,e)}return n(e,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof q&&te(arguments[1],to)){for(var t=arguments[0],e=arguments[1],n=new eo,i=new q,r=new q,s=e.size(),a=1;a<s;a++)if(e.getCoordinate(a-1,i),e.getCoordinate(a,r),n.computeIntersection(t,i,r),n.hasIntersection())return!0;return!1}if(arguments[0]instanceof q&&arguments[1]instanceof Array){for(var o=arguments[0],u=arguments[1],l=new eo,h=1;h<u.length;h++){var c=u[h-1],f=u[h];if(l.computeIntersection(o,c,f),l.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(t,e){return eu.locatePointInRing(t,e)}},{key:"isInRing",value:function(t,n){return e.locateInRing(t,n)!==B.EXTERIOR}}]),e}(),eh=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"setAllLocations",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t}},{key:"isNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==B.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]===B.NONE&&(this.location[e]=t)}},{key:"isLine",value:function(){return 1===this.location.length}},{key:"merge",value:function(t){if(t.location.length>this.location.length){var e=[,,,].fill(null);e[K.ON]=this.location[K.ON],e[K.LEFT]=B.NONE,e[K.RIGHT]=B.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===B.NONE&&n<t.location.length&&(this.location[n]=t.location[n])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var t=this.location[K.LEFT];this.location[K.LEFT]=this.location[K.RIGHT],this.location[K.RIGHT]=t}},{key:"toString",value:function(){var t=new tn;return this.location.length>1&&t.append(B.toLocationSymbol(this.location[K.LEFT])),t.append(B.toLocationSymbol(this.location[K.ON])),this.location.length>1&&t.append(B.toLocationSymbol(this.location[K.RIGHT])),t.toString()}},{key:"setLocations",value:function(t,e,n){this.location[K.ON]=t,this.location[K.LEFT]=e,this.location[K.RIGHT]=n}},{key:"get",value:function(t){return t<this.location.length?this.location[t]:B.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===B.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(1==arguments.length){var t=arguments[0];this.setLocation(K.ON,t)}else if(2==arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}}},{key:"init",value:function(t){this.location=Array(t).fill(null),this.setAllLocations(B.NONE)}},{key:"isEqualOnSide",value:function(t,e){return this.location[e]===t.location[e]}},{key:"allPositionsEqual",value:function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,1==arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[K.ON]=n}else if(arguments[0]instanceof e){var i=arguments[0];if(this.init(i.location.length),null!==i)for(var r=0;r<this.location.length;r++)this.location[r]=i.location[r]}}else if(3==arguments.length){var s=arguments[0],a=arguments[1],o=arguments[2];this.init(3),this.location[K.ON]=s,this.location[K.LEFT]=a,this.location[K.RIGHT]=o}}}]),e}(),ec=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getGeometryCount",value:function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t}},{key:"setAllLocations",value:function(t,e){this.elt[t].setAllLocations(e)}},{key:"isNull",value:function(t){return this.elt[t].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(1==arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2==arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}}},{key:"isLine",value:function(t){return this.elt[t].isLine()}},{key:"merge",value:function(t){for(var e=0;e<2;e++)null===this.elt[e]&&null!==t.elt[e]?this.elt[e]=new eh(t.elt[e]):this.elt[e].merge(t.elt[e])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(1==arguments.length){var t=arguments[0];return this.elt[t].get(K.ON)}if(2==arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}}},{key:"toString",value:function(){var t=new tn;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()}},{key:"isArea",value:function(){if(0==arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1==arguments.length){var t=arguments[0];return this.elt[t].isArea()}}},{key:"isAnyNull",value:function(t){return this.elt[t].isAnyNull()}},{key:"setLocation",value:function(){if(2==arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(K.ON,e)}else if(3==arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];this.elt[n].setLocation(i,r)}}},{key:"isEqualOnSide",value:function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)}},{key:"allPositionsEqual",value:function(t,e){return this.elt[t].allPositionsEqual(e)}},{key:"toLine",value:function(t){this.elt[t].isArea()&&(this.elt[t]=new eh(this.elt[t].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=[,,].fill(null),1==arguments.length){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new eh(t),this.elt[1]=new eh(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.elt[0]=new eh(n.elt[0]),this.elt[1]=new eh(n.elt[1])}}else if(2==arguments.length){var i=arguments[0],r=arguments[1];this.elt[0]=new eh(B.NONE),this.elt[1]=new eh(B.NONE),this.elt[i].setLocation(r)}else if(3==arguments.length){var s=arguments[0],a=arguments[1],o=arguments[2];this.elt[0]=new eh(s,a,o),this.elt[1]=new eh(s,a,o)}else if(4==arguments.length){var u=arguments[0],l=arguments[1],h=arguments[2],c=arguments[3];this.elt[0]=new eh(B.NONE,B.NONE,B.NONE),this.elt[1]=new eh(B.NONE,B.NONE,B.NONE),this.elt[u].setLocations(l,h,c)}}},{key:"toLineLabel",value:function(t){for(var n=new e(B.NONE),i=0;i<2;i++)n.setLocation(i,t.getLocation(i));return n}}]),e}(),ef=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"computeRing",value:function(){if(null!==this._ring)return null;for(var t=Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=tu.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return 1===this._label.getGeometryCount()}},{key:"computePoints",value:function(t){this._startDe=t;var e=t,n=!0;do{if(null===e)throw new th("Found null DirectedEdge");if(e.getEdgeRing()===this)throw new th("Directed Edge visited twice during ring-building at "+e.getCoordinate());this._edges.add(e);var i=e.getLabel();A.isTrue(i.isArea()),this.mergeLabel(i),this.addPoints(e.getEdge(),e.isForward(),n),n=!1,this.setEdgeRing(e,this),e=this.getNext(e)}while(e!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(t){return this._pts.get(t)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var t=this._startDe;do{var e=t.getNode().getEdges().getOutgoingDegree(this);e>this._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(t,e,n){var i=t.getCoordinates();if(e){var r=1;n&&(r=0);for(var s=r;s<i.length;s++)this._pts.add(i[s])}else{var a=i.length-2;n&&(a=i.length-1);for(var o=a;o>=0;o--)this._pts.add(i[o])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var t=this._startDe;do t.getEdge().setInResult(!0),t=t.getNext();while(t!==this._startDe)}},{key:"containsPoint",value:function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t)||!el.isInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0}},{key:"addHole",value:function(t){this._holes.add(t)}},{key:"isShell",value:function(){return null===this._shell}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(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,K.RIGHT);if(i===B.NONE)return null;if(this._label.getLocation(n)===B.NONE)return this._label.setLocation(n,i),null}}},{key:"setShell",value:function(t){this._shell=t,null!==t&&t.addHole(this)}},{key:"toPolygon",value:function(t){for(var e=Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new tf,this._pts=new tf,this._label=new ec(B.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new tf,this._geometryFactory=null,0==arguments.length);else if(2==arguments.length){var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()}}}]),e}(),ev=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,[{key:"setEdgeRing",value:function(t,e){t.setMinEdgeRing(e)}},{key:"getNext",value:function(t){return t.getNextMin()}}],[{key:"constructor_",value:function(){var t=arguments[0],e=arguments[1];ef.constructor_.call(this,t,e)}}]),s}(ef),eg=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,[{key:"buildMinimalRings",value:function(){var t=new tf,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new ev(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t}},{key:"setEdgeRing",value:function(t,e){t.setEdgeRing(e)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var t=this._startDe;do t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext();while(t!==this._startDe)}},{key:"getNext",value:function(t){return t.getNext()}}],[{key:"constructor_",value:function(){var t=arguments[0],e=arguments[1];ef.constructor_.call(this,t,e)}}]),s}(ef),ey=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"setVisited",value:function(t){this._isVisited=t}},{key:"setInResult",value:function(t){this._isInResult=t}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(t){this._label=t}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(t){this._isCovered=t,this._isCoveredSet=!0}},{key:"updateIM",value:function(t){A.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0==arguments.length);else if(1==arguments.length){var t=arguments[0];this._label=t}}}]),e}(),ed=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"isIncidentEdgeInResult",value:function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return 1===this._label.getGeometryCount()}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(t){t.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(t){}},{key:"computeMergedLocation",value:function(t,e){var n=B.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var i=t.getLocation(e);n!==B.BOUNDARY&&(n=i)}return n}},{key:"setLabel",value:function(){if(2!=arguments.length||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return c(r(a.prototype),"setLabel",this).apply(this,arguments);var t=arguments[0],e=arguments[1];null===this._label?this._label=new ec(t,e):this._label.setLocation(t,e)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof a){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof ec)for(var e=arguments[0],n=0;n<2;n++){var i=this.computeMergedLocation(e,n);this._label.getLocation(n)===B.NONE&&this._label.setLocation(n,i)}}},{key:"add",value:function(t){this._edges.insert(t),t.setNode(this)}},{key:"setLabelBoundary",value:function(t){if(null===this._label)return null;var e=B.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case B.BOUNDARY:n=B.INTERIOR;break;case B.INTERIOR:default:n=B.BOUNDARY}this._label.setLocation(t,n)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var t=arguments[0],e=arguments[1];this._coord=t,this._edges=e,this._label=new ec(0,B.NONE)}}]),a}(ey);function e_(t){return null==t?0:t.color}function ep(t){return null==t?null:t.parent}function em(t,e){null!==t&&(t.color=e)}function ek(t){return null==t?null:t.left}function ex(t){return null==t?null:t.right}var eI=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),(e=r.call(this)).root_=null,e.size_=0,e}return n(s,[{key:"get",value:function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null}},{key:"put",value:function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,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 a={key:t,left:null,right:null,value:e,parent:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return i<0?n.left=a:n.right=a,this.fixAfterInsertion(a),this.size_++,null}},{key:"fixAfterInsertion",value:function(t){var e;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)ep(t)===ek(ep(ep(t)))?1===e_(e=ex(ep(ep(t))))?(em(ep(t),0),em(e,0),em(ep(ep(t)),1),t=ep(ep(t))):(t===ex(ep(t))&&(t=ep(t),this.rotateLeft(t)),em(ep(t),0),em(ep(ep(t)),1),this.rotateRight(ep(ep(t)))):1===e_(e=ek(ep(ep(t))))?(em(ep(t),0),em(e,0),em(ep(ep(t)),1),t=ep(ep(t))):(t===ek(ep(t))&&(t=ep(t),this.rotateRight(t)),em(ep(t),0),em(ep(ep(t)),1),this.rotateLeft(ep(ep(t))));this.root_.color=0}},{key:"values",value:function(){var t=new tf,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=s.successor(e));)t.add(e.value);return t}},{key:"entrySet",value:function(){var t=new W,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=s.successor(e));)t.add(e);return t}},{key:"rotateLeft",value: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}}},{key:"rotateRight",value: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}}},{key:"getFirstEntry",value:function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return!0;e=e.right}}return!1}}],[{key:"successor",value:function(t){var e;if(null===t)return null;if(null!==t.right){for(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}}]),s}(function(e){i(r,e);var n=h(r);function r(){return t(this,r),n.apply(this,arguments)}return r}(tJ)),eE=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"find",value:function(t){return this.nodeMap.get(t)}},{key:"addNode",value:function(){if(arguments[0]instanceof q){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof ed){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return null===i?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}}},{key:"print",value:function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(t){for(var e=new tf,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(t)===B.BOUNDARY&&e.add(i)}return e}},{key:"add",value:function(t){var e=t.getCoordinate();this.addNode(e).add(t)}}],[{key:"constructor_",value:function(){this.nodeMap=new eI,this.nodeFact=null;var t=arguments[0];this.nodeFact=t}}]),e}(),eN=function(){function e(){t(this,e)}return n(e,null,[{key:"isNorthern",value:function(t){return t===e.NE||t===e.NW}},{key:"isOpposite",value:function(t,e){return t!==e&&2==(t-e+4)%4}},{key:"commonHalfPlane",value:function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return -1;var n=t<e?t:e;return 0===n&&3===(t>e?t:e)?3:n}},{key:"isInHalfPlane",value:function(t,n){return n===e.SE?t===e.SE||t===e.SW:t===n||t===n+1}},{key:"quadrant",value:function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],n=arguments[1];if(0===t&&0===n)throw new p("Cannot compute the quadrant for point ( "+t+", "+n+" )");return t>=0?n>=0?e.NE:e.SE:n>=0?e.NW:e.SW}if(arguments[0]instanceof q&&arguments[1]instanceof q){var i=arguments[0],r=arguments[1];if(r.x===i.x&&r.y===i.y)throw new p("Cannot compute the quadrant for two identical points "+i);return r.x>=i.x?r.y>=i.y?e.NE:e.SE:r.y>=i.y?e.NW:e.SW}}}]),e}();eN.NE=0,eN.NW=1,eN.SW=2,eN.SE=3;var eT=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"compareDirection",value:function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:tu.index(t._p0,t._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(t){this._node=t}},{key:"print",value:function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),r=n.substring(i+1);t.print("  "+r+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+"   "+this._label)}},{key:"compareTo",value:function(t){return this.compareDirection(t)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return"  "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+"   "+this._label}},{key:"computeLabel",value:function(t){}},{key:"init",value:function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=eN.quadrant(this._dx,this._dy),A.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1==arguments.length){var t=arguments[0];this._edge=t}else if(3==arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];e.constructor_.call(this,n,i,r,null)}else if(4==arguments.length){var s=arguments[0],a=arguments[1],o=arguments[2],u=arguments[3];e.constructor_.call(this,s),this.init(a,o),this._label=u}}}]),e}(),eS=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(t){return this._depth[t]}},{key:"setVisited",value:function(t){this._isVisited=t}},{key:"computeDirectedLabel",value:function(){this._label=new ec(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new th("assigned depths do not match",this.getCoordinate());this._depth[t]=e}},{key:"isInteriorAreaEdge",value:function(){for(var t=!0,e=0;e<2;e++)this._label.isArea(e)&&this._label.getLocation(e,K.LEFT)===B.INTERIOR&&this._label.getLocation(e,K.RIGHT)===B.INTERIOR||(t=!1);return t}},{key:"setNextMin",value:function(t){this._nextMin=t}},{key:"print",value:function(t){c(r(a.prototype),"print",this).call(this,t),t.print(" "+this._depth[K.LEFT]+"/"+this._depth[K.RIGHT]),t.print(" ("+this.getDepthDelta()+")"),this._isInResult&&t.print(" inResult")}},{key:"setMinEdgeRing",value:function(t){this._minEdgeRing=t}},{key:"isLineEdge",value:function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,B.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,B.EXTERIOR);return t&&e&&n}},{key:"setEdgeRing",value:function(t){this._edgeRing=t}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t}},{key:"setInResult",value:function(t){this._isInResult=t}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)}},{key:"setSym",value:function(t){this._sym=t}},{key:"setVisitedEdge",value:function(t){this.setVisited(t),this._sym.setVisited(t)}},{key:"setEdgeDepths",value:function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var i=1;t===K.LEFT&&(i=-1);var r=K.opposite(t),s=e+n*i;this.setDepth(t,e),this.setDepth(r,s)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(t){this._next=t}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var t=arguments[0],e=arguments[1];if(eT.constructor_.call(this,t),this._isForward=e,e)this.init(t.getCoordinate(0),t.getCoordinate(1));else{var n=t.getNumPoints()-1;this.init(t.getCoordinate(n),t.getCoordinate(n-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(t,e){return t===B.EXTERIOR&&e===B.INTERIOR?1:t===B.INTERIOR&&e===B.EXTERIOR?-1:0}}]),a}(eT),eL=function(){function e(){t(this,e)}return n(e,[{key:"createNode",value:function(t){return new ed(t,null)}}]),e}(),eC=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"printEdges",value:function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}}},{key:"find",value:function(t){return this._nodes.find(t)}},{key:"addNode",value:function(){if(arguments[0]instanceof ed){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof q){var e=arguments[0];return this._nodes.addNode(e)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(t){td.out.println(t)}},{key:"isBoundaryNode",value:function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var i=n.getLabel();return null!==i&&i.getLocation(t)===B.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var t=this._nodes.iterator();t.hasNext();)t.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(t,e,n,i){return!!t.equals(n)&&tu.index(t,e,i)===tu.COLLINEAR&&eN.quadrant(t,e)===eN.quadrant(n,i)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(t){td.out.print(t)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(t,e){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),r=i.getCoordinates();if(this.matchInSameDirection(t,e,r[0],r[1])||this.matchInSameDirection(t,e,r[r.length-1],r[r.length-2]))return i}return null}},{key:"insertEdge",value:function(t){this._edges.add(t)}},{key:"findEdgeEnd",value:function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null}},{key:"addEdges",value:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this._edges.add(n);var i=new eS(n,!0),r=new eS(n,!1);i.setSym(r),r.setSym(i),this.add(i),this.add(r)}}},{key:"add",value:function(t){this._nodes.add(t),this._edgeEndList.add(t)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(t,e){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),r=i.getCoordinates();if(t.equals(r[0])&&e.equals(r[1]))return i}return null}}],[{key:"constructor_",value:function(){if(this._edges=new tf,this._nodes=null,this._edgeEndList=new tf,0==arguments.length)this._nodes=new eE(new eL);else if(1==arguments.length){var t=arguments[0];this._nodes=new eE(t)}}},{key:"linkResultDirectedEdges",value:function(t){for(var e=t.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()}}]),e}(),eR=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"sortShellsAndHoles",value:function(t,e,n){for(var i=t.iterator();i.hasNext();){var r=i.next();r.isHole()?n.add(r):e.add(r)}}},{key:"computePolygons",value:function(t){for(var e=new tf,n=t.iterator();n.hasNext();){var i=n.next().toPolygon(this._geometryFactory);e.add(i)}return e}},{key:"placeFreeHoles",value:function(t,n){for(var i=n.iterator();i.hasNext();){var r=i.next();if(null===r.getShell()){var s=e.findEdgeRingContaining(r,t);if(null===s)throw new th("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(s)}}}},{key:"buildMinimalEdgeRings",value:function(t,e,n){for(var i=new tf,r=t.iterator();r.hasNext();){var s=r.next();if(s.getMaxNodeDegree()>2){s.linkDirectedEdgesForMinimalEdgeRings();var a=s.buildMinimalRings(),o=this.findShell(a);null!==o?(this.placePolygonHoles(o,a),e.add(o)):n.addAll(a)}else i.add(s)}return i}},{key:"buildMaximalEdgeRings",value:function(t){for(var e=new tf,n=t.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&null===i.getEdgeRing()){var r=new eg(i,this._geometryFactory);e.add(r),r.setInResult()}}return e}},{key:"placePolygonHoles",value:function(t,e){for(var n=e.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(t)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(t){for(var e=0,n=null,i=t.iterator();i.hasNext();){var r=i.next();r.isHole()||(n=r,e++)}return A.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n}},{key:"add",value: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];eC.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(e),r=new tf,s=this.buildMinimalEdgeRings(i,this._shellList,r);this.sortShellsAndHoles(s,this._shellList,r),this.placeFreeHoles(this._shellList,r)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new tf;var t=arguments[0];this._geometryFactory=t}},{key:"findEdgeRingContaining",value:function(t,e){for(var n=t.getLinearRing(),i=n.getEnvelopeInternal(),r=n.getCoordinateN(0),s=null,a=null,o=e.iterator();o.hasNext();){var u=o.next(),l=u.getLinearRing(),h=l.getEnvelopeInternal();if(!h.equals(i)&&h.contains(i)){r=tU.ptNotInList(n.getCoordinates(),l.getCoordinates());var c=!1;el.isInRing(r,l.getCoordinates())&&(c=!0),c&&(null===s||a.contains(h))&&(a=(s=u).getLinearRing().getEnvelopeInternal())}}return s}}]),e}(),eO=function(){function e(){t(this,e)}return n(e,[{key:"getBounds",value:function(){}}]),e}(),ew=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[eO,I]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}}]),e}(),eb=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"poll",value: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}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(t){for(var e=null,n=this._items.get(t);2*t<=this._size&&((e=2*t)!==this._size&&0>this._items.get(e+1).compareTo(this._items.get(e))&&e++,0>this._items.get(e).compareTo(n));t=e)this._items.set(t,this._items.get(e));this._items.set(t,n)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return 0===this._size}},{key:"add",value:function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);0>t.compareTo(this._items.get(Math.trunc(e/2)));e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new tf,this._items.add(null)}}]),e}(),eM=function(){function e(){t(this,e)}return n(e,[{key:"insert",value:function(t,e){}},{key:"remove",value:function(t,e){}},{key:"query",value:function(){}}]),e}(),eP=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(t){A.isTrue(null===this._bounds),this._childBoundables.add(t)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[eO,I]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new tf,this._bounds=null,this._level=null,0==arguments.length);else if(1==arguments.length){var t=arguments[0];this._level=t}}}]),e}(),eA={reverseOrder:function(){return{compare:function(t,e){return e.compareTo(t)}}},min:function(t){return eA.sort(t),t.get(0)},sort:function(t,e){var n=t.toArray();e?tw.sort(n,e):tw.sort(n);for(var i=t.iterator(),r=0,s=n.length;r<s;r++)i.next(),i.set(n[r])},singletonList:function(t){var e=new tf;return e.add(t),e}},eD=function(){function e(){t(this,e)}return n(e,null,[{key:"maxDistance",value:function(t,n,i,r,s,a,o,u){var l=e.distance(t,n,s,a);return Math.max(l=Math.max(l=Math.max(l,e.distance(t,n,o,u)),e.distance(i,r,s,a)),e.distance(i,r,o,u))}},{key:"distance",value:function(t,e,n,i){var r=n-t,s=i-e;return Math.sqrt(r*r+s*s)}},{key:"maximumDistance",value:function(t,n){var i=Math.min(t.getMinX(),n.getMinX()),r=Math.min(t.getMinY(),n.getMinY()),s=Math.max(t.getMaxX(),n.getMaxX()),a=Math.max(t.getMaxY(),n.getMaxY());return e.distance(i,r,s,a)}},{key:"minMaxDistance",value:function(t,n){var i=t.getMinX(),r=t.getMinY(),s=t.getMaxX(),a=t.getMaxY(),o=n.getMinX(),u=n.getMinY(),l=n.getMaxX(),h=n.getMaxY(),c=e.maxDistance(i,r,i,a,o,u,o,h);return Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c=Math.min(c,e.maxDistance(i,r,i,a,o,u,l,u)),e.maxDistance(i,r,i,a,l,h,o,h)),e.maxDistance(i,r,i,a,l,h,l,u)),e.maxDistance(i,r,s,r,o,u,o,h)),e.maxDistance(i,r,s,r,o,u,l,u)),e.maxDistance(i,r,s,r,l,h,o,h)),e.maxDistance(i,r,s,r,l,h,l,u)),e.maxDistance(s,a,i,a,o,u,o,h)),e.maxDistance(s,a,i,a,o,u,l,u)),e.maxDistance(s,a,i,a,l,h,o,h)),e.maxDistance(s,a,i,a,l,h,l,u)),e.maxDistance(s,a,s,r,o,u,o,h)),e.maxDistance(s,a,s,r,o,u,l,u)),e.maxDistance(s,a,s,r,l,h,o,h)),e.maxDistance(s,a,s,r,l,h,l,u))}}]),e}(),eF=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"maximumDistance",value:function(){return eD.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(t,n){var i=e.isComposite(this._boundable1),r=e.isComposite(this._boundable2);if(i&&r)return e.area(this._boundable1)>e.area(this._boundable2)?this.expand(this._boundable1,this._boundable2,!1,t,n):this.expand(this._boundable2,this._boundable1,!0,t,n),null;if(i)return this.expand(this._boundable1,this._boundable2,!1,t,n),null;if(r)return this.expand(this._boundable2,this._boundable1,!0,t,n),null;throw new p("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(e.isComposite(this._boundable1)||e.isComposite(this._boundable2))}},{key:"compareTo",value:function(t){return this._distance<t._distance?-1:this._distance>t._distance?1:0}},{key:"expand",value:function(t,n,i,r,s){for(var a=t.getChildBoundables().iterator();a.hasNext();){var o=a.next(),u=null;(u=i?new e(n,o,this._itemDistance):new e(o,n,this._itemDistance)).getDistance()<s&&r.add(u)}}},{key:"getBoundable",value:function(t){return 0===t?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()}},{key:"area",value:function(t){return t.getBounds().getArea()}},{key:"isComposite",value:function(t){return t instanceof eP}}]),e}(),eG=function(){function e(){t(this,e)}return n(e,[{key:"visitItem",value:function(t){}}]),e}(),eq=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"queryInternal",value:function(){if(te(arguments[2],eG)&&arguments[0]instanceof Object&&arguments[1]instanceof eP)for(var t=arguments[0],e=arguments[1],n=arguments[2],i=e.getChildBoundables(),r=0;r<i.size();r++){var s=i.get(r);this.getIntersectsOp().intersects(s.getBounds(),t)&&(s instanceof eP?this.queryInternal(t,s,n):s instanceof ew?n.visitItem(s.getItem()):A.shouldNeverReachHere())}else if(te(arguments[2],$)&&arguments[0]instanceof Object&&arguments[1]instanceof eP)for(var a=arguments[0],o=arguments[1],u=arguments[2],l=o.getChildBoundables(),h=0;h<l.size();h++){var c=l.get(h);this.getIntersectsOp().intersects(c.getBounds(),a)&&(c instanceof eP?this.queryInternal(a,c,u):c instanceof ew?u.add(c.getItem()):A.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(t){return t.get(t.size()-1)}},{key:"size",value:function(){if(0==arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1==arguments.length){for(var t=arguments[0],e=0,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof eP?e+=this.size(i):i instanceof ew&&(e+=1)}return e}}},{key:"removeItem",value:function(t,e){for(var n=null,i=t.getChildBoundables().iterator();i.hasNext();){var r=i.next();r instanceof ew&&r.getItem()===e&&(n=r)}return null!==n&&(t.getChildBoundables().remove(n),!0)}},{key:"itemsTree",value:function(){if(0==arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new tf:t}if(1==arguments.length){for(var e=arguments[0],n=new tf,i=e.getChildBoundables().iterator();i.hasNext();){var r=i.next();if(r instanceof eP){var s=this.itemsTree(r);null!==s&&n.add(s)}else r instanceof ew?n.add(r.getItem()):A.shouldNeverReachHere()}return 0>=n.size()?null:n}}},{key:"insert",value:function(t,e){A.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new ew(t,e))}},{key:"boundablesAtLevel",value:function(){if(1==arguments.length){var t=arguments[0],e=new tf;return this.boundablesAtLevel(t,this._root,e),e}if(3==arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2];if(A.isTrue(n>-2),i.getLevel()===n)return r.add(i),null;for(var s=i.getChildBoundables().iterator();s.hasNext();){var a=s.next();a instanceof eP?this.boundablesAtLevel(n,a,r):(A.isTrue(a instanceof ew),-1===n&&r.add(a))}return null}}},{key:"query",value:function(){if(1==arguments.length){var t=arguments[0];this.build();var e=new tf;return this.isEmpty()||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)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(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 a=null,o=i.getChildBoundables().iterator();o.hasNext();){var u=o.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&u instanceof eP&&(s=this.remove(n,u,r))){a=u;break}}return null!==a&&a.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(a),s}}},{key:"createHigherLevels",value:function(t,e){A.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)}},{key:"depth",value:function(){if(0==arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1==arguments.length){for(var t=arguments[0],e=0,n=t.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof eP){var r=this.depth(i);r>e&&(e=r)}}return e+1}}},{key:"createParentBoundables",value:function(t,e){A.isTrue(!t.isEmpty());var n=new tf;n.add(this.createNode(e));var i=new tf(t);eA.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}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[I]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new tf,this._nodeCapacity=null,0==arguments.length)e.constructor_.call(this,e.DEFAULT_NODE_CAPACITY);else if(1==arguments.length){var t=arguments[0];A.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}},{key:"compareDoubles",value:function(t,e){return t>e?1:t<e?-1:0}}]),e}();eq.IntersectsOp=function(){},eq.DEFAULT_NODE_CAPACITY=10;var eY=function(){function e(){t(this,e)}return n(e,[{key:"distance",value:function(t,e){}}]),e}(),ez=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"createParentBoundablesFromVerticalSlices",value:function(t,e){A.isTrue(t.length>0);for(var n=new tf,i=0;i<t.length;i++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[i],e));return n}},{key:"nearestNeighbourK",value:function(){if(2==arguments.length){var t=arguments[0],e=arguments[1];return this.nearestNeighbourK(t,w.POSITIVE_INFINITY,e)}if(3==arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=i,o=new eb;o.add(n);for(var u=new eb;!o.isEmpty()&&s>=0;){var l=o.poll(),h=l.getDistance();if(h>=s)break;l.isLeaves()?u.size()<r?u.add(l):(u.peek().getDistance()>h&&(u.poll(),u.add(l)),s=u.peek().getDistance()):l.expandToQueue(o,s)}return a.getItems(u)}}},{key:"createNode",value:function(t){return new eX(t)}},{key:"size",value:function(){return 0==arguments.length?c(r(a.prototype),"size",this).call(this):c(r(a.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(2==arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof z))return c(r(a.prototype),"insert",this).apply(this,arguments);var t=arguments[0],e=arguments[1];if(t.isNull())return null;c(r(a.prototype),"insert",this).call(this,t,e)}},{key:"getIntersectsOp",value:function(){return a.intersectsOp}},{key:"verticalSlices",value:function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),i=Array(e).fill(null),r=t.iterator(),s=0;s<e;s++){i[s]=new tf;for(var a=0;r.hasNext()&&a<n;){var o=r.next();i[s].add(o),a++}}return i}},{key:"query",value:function(){if(1==arguments.length){var t=arguments[0];return c(r(a.prototype),"query",this).call(this,t)}if(2==arguments.length){var e=arguments[0],n=arguments[1];c(r(a.prototype),"query",this).call(this,e,n)}}},{key:"getComparator",value:function(){return a.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(t,e){return c(r(a.prototype),"createParentBoundables",this).call(this,t,e)}},{key:"remove",value:function(){if(2==arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof z){var t=arguments[0],e=arguments[1];return c(r(a.prototype),"remove",this).call(this,t,e)}return c(r(a.prototype),"remove",this).apply(this,arguments)}},{key:"depth",value:function(){return 0==arguments.length?c(r(a.prototype),"depth",this).call(this):c(r(a.prototype),"depth",this).apply(this,arguments)}},{key:"createParentBoundables",value:function(t,e){A.isTrue(!t.isEmpty());var n=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new tf(t);eA.sort(i,a.xComparator);var r=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(n))));return this.createParentBoundablesFromVerticalSlices(r,e)}},{key:"nearestNeighbour",value:function(){if(1==arguments.length){if(te(arguments[0],eY)){var t=arguments[0];if(this.isEmpty())return null;var e=new eF(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(e)}if(arguments[0]instanceof eF){var n=arguments[0],i=w.POSITIVE_INFINITY,r=null,s=new eb;for(s.add(n);!s.isEmpty()&&i>0;){var a=s.poll(),o=a.getDistance();if(o>=i)break;a.isLeaves()?(i=o,r=a):a.expandToQueue(s,i)}return null===r?null:[r.getBoundable(0).getItem(),r.getBoundable(1).getItem()]}}else{if(2==arguments.length){var u=arguments[0],l=arguments[1];if(this.isEmpty()||u.isEmpty())return null;var h=new eF(this.getRoot(),u.getRoot(),l);return this.nearestNeighbour(h)}if(3==arguments.length){var c=arguments[0],f=arguments[1],v=arguments[2],g=new ew(c,f),y=new eF(this.getRoot(),g,v);return this.nearestNeighbour(y)[0]}if(4==arguments.length){var d=arguments[0],_=arguments[1],p=arguments[2],m=arguments[3],k=new ew(d,_),x=new eF(this.getRoot(),k,p);return this.nearestNeighbourK(x,m)}}}},{key:"isWithinDistance",value:function(){if(2==arguments.length){var t=arguments[0],e=arguments[1],n=w.POSITIVE_INFINITY,i=new eb;for(i.add(t);!i.isEmpty();){var r=i.poll(),s=r.getDistance();if(s>e)break;if(r.maximumDistance()<=e)return!0;if(r.isLeaves()){if((n=s)<=e)return!0}else r.expandToQueue(i,n)}return!1}if(3==arguments.length){var a=arguments[0],o=arguments[1],u=arguments[2],l=new eF(this.getRoot(),a.getRoot(),o);return this.isWithinDistance(l,u)}}},{key:"interfaces_",get:function(){return[eM,I]}}],[{key:"constructor_",value:function(){if(0==arguments.length)a.constructor_.call(this,a.DEFAULT_NODE_CAPACITY);else if(1==arguments.length){var t=arguments[0];eq.constructor_.call(this,t)}}},{key:"centreX",value:function(t){return a.avg(t.getMinX(),t.getMaxX())}},{key:"avg",value:function(t,e){return(t+e)/2}},{key:"getItems",value:function(t){for(var e=Array(t.size()).fill(null),n=0;!t.isEmpty();){var i=t.poll();e[n]=i.getBoundable(0).getItem(),n++}return e}},{key:"centreY",value:function(t){return a.avg(t.getMinY(),t.getMaxY())}}]),a}(eq),eX=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,[{key:"computeBounds",value:function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new z(n.getBounds()):t.expandToInclude(n.getBounds())}return t}}],[{key:"constructor_",value:function(){var t=arguments[0];eP.constructor_.call(this,t)}}]),s}(eP);ez.STRtreeNode=eX,ez.xComparator=new(function(){function e(){t(this,e)}return n(e,[{key:"interfaces_",get:function(){return[b]}},{key:"compare",value:function(t,e){return eq.compareDoubles(ez.centreX(t.getBounds()),ez.centreX(e.getBounds()))}}]),e}()),ez.yComparator=new(function(){function e(){t(this,e)}return n(e,[{key:"interfaces_",get:function(){return[b]}},{key:"compare",value:function(t,e){return eq.compareDoubles(ez.centreY(t.getBounds()),ez.centreY(e.getBounds()))}}]),e}()),ez.intersectsOp=new(function(){function e(){t(this,e)}return n(e,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(t,e){return t.intersects(e)}}]),e}()),ez.DEFAULT_NODE_CAPACITY=10;var eB=function(){function e(){t(this,e)}return n(e,null,[{key:"relativeSign",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"compare",value:function(t,n,i){if(n.equals2D(i))return 0;var r=e.relativeSign(n.x,i.x),s=e.relativeSign(n.y,i.y);switch(t){case 0:return e.compareValue(r,s);case 1:return e.compareValue(s,r);case 2:return e.compareValue(s,-r);case 3:return e.compareValue(-r,s);case 4:return e.compareValue(-r,-s);case 5:return e.compareValue(-s,-r);case 6:return e.compareValue(-s,r);case 7:return e.compareValue(r,-s)}return A.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}}]),e}(),eU=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(t){return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:this._isInterior?t._isInterior?eB.compare(this._segmentOctant,this.coord,t.coord):1:-1}},{key:"isEndPoint",value:function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._segString=t,this.coord=new q(e),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!e.equals2D(t.getCoordinate(n))}}]),e}(),eV=function(){function e(){t(this,e)}return n(e,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),e}(),eH=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getSplitCoordinates",value:function(){var t=new tB;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()}},{key:"addCollapsedNodes",value:function(){var t=new tf;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)}}},{key:"createSplitEdgePts",value:function(t,e){var n=e.segmentIndex-t.segmentIndex+2;if(2===n)return[new q(t.coord),new q(e.coord)];var i=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(i);r||n--;var s=Array(n).fill(null),a=0;s[a++]=new q(t.coord);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)s[a++]=this._edge.getCoordinate(o);return r&&(s[a]=new q(e.coord)),s}},{key:"print",value:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"findCollapsesFromExistingVertices",value:function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e);this._edge.getCoordinate(e+1);var i=this._edge.getCoordinate(e+2);n.equals2D(i)&&t.add(ti.valueOf(e+1))}}},{key:"addEdgeCoordinates",value:function(t,e,n){var i=this.createSplitEdgePts(t,e);n.add(i,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),r=this.createSplitEdge(n,i);t.add(r),n=i}}},{key:"findCollapseIndex",value:function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var i=e.segmentIndex-t.segmentIndex;return e.isInterior()||i--,1===i&&(n[0]=t.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(t){for(var e=[,].fill(null),n=this.iterator(),i=n.next();n.hasNext();){var r=n.next();this.findCollapseIndex(i,r,e)&&t.add(ti.valueOf(e[0])),i=r}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)}},{key:"createSplitEdge",value:function(t,e){return new eK(this.createSplitEdgePts(t,e),this._edge.getData())}},{key:"add",value:function(t,e){var n=new eU(this._edge,t,e,this._edge.getSegmentOctant(e)),i=this._nodeMap.get(n);return null!==i?(A.isTrue(i.coord.equals2D(t),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)}},{key:"checkSplitEdgesCorrectness",value:function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new M("bad split edge start point at "+n);var i=t.get(t.size()-1).getCoordinates(),r=i[i.length-1];if(!r.equals2D(e[e.length-1]))throw new M("bad split edge end point at "+r)}}],[{key:"constructor_",value:function(){this._nodeMap=new eI,this._edge=null;var t=arguments[0];this._edge=t}}]),e}(),eZ=function(){function e(){t(this,e)}return n(e,null,[{key:"octant",value:function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],n=arguments[1];if(0===t&&0===n)throw new p("Cannot compute the octant for point ( "+t+", "+n+" )");var i=Math.abs(t),r=Math.abs(n);return t>=0?n>=0?i>=r?0:1:i>=r?7:6:n>=0?i>=r?3:2:i>=r?4:5}if(arguments[0]instanceof q&&arguments[1]instanceof q){var s=arguments[0],a=arguments[1],o=a.x-s.x,u=a.y-s.y;if(0===o&&0===u)throw new p("Cannot compute the octant for two identical points "+s);return e.octant(o,u)}}}]),e}(),eW=function(){function e(){t(this,e)}return n(e,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(t){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(t){}},{key:"getData",value:function(){}}]),e}(),ej=function(){function e(){t(this,e)}return n(e,[{key:"addIntersection",value:function(t,e){}},{key:"interfaces_",get:function(){return[eW]}}]),e}(),eK=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(t){return this._pts[t]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}},{key:"setData",value:function(t){this._data=t}},{key:"safeOctant",value:function(t,e){return t.equals2D(e)?0:eZ.octant(t,e)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value: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[3],s=new q(n.getIntersection(r));this.addIntersection(s,i)}}},{key:"toString",value:function(){return es.toLineString(new tW(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(t,e){var n=e,i=n+1;if(i<this._pts.length){var r=this._pts[i];t.equals2D(r)&&(n=i)}return this._nodeList.add(t,n)}},{key:"addIntersections",value:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)}},{key:"interfaces_",get:function(){return[ej]}}],[{key:"constructor_",value:function(){this._nodeList=new eH(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e}},{key:"getNodedSubstrings",value:function(){if(1==arguments.length){var t=arguments[0],n=new tf;return e.getNodedSubstrings(t,n),n}if(2==arguments.length)for(var i=arguments[0],r=arguments[1],s=i.iterator();s.hasNext();)s.next().getNodeList().addSplitEdges(r)}}]),e}(),eJ=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof e){var t=arguments[0],n=tu.index(this.p0,this.p1,t.p0),i=tu.index(this.p0,this.p1,t.p1);return n>=0&&i>=0||n<=0&&i<=0?Math.max(n,i):0}if(arguments[0]instanceof q){var r=arguments[0];return tu.index(this.p0,this.p1,r)}}},{key:"toGeometry",value:function(t){return t.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(t){return t instanceof e&&this.p0.equals(t.p0)&&this.p1.equals(t.p1)}},{key:"intersection",value:function(t){var e=new eo;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof q){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new q(t);var n=this.projectionFactor(t),i=new q;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i}if(arguments[0]instanceof e){var r=arguments[0],s=this.projectionFactor(r.p0),a=this.projectionFactor(r.p1);if(s>=1&&a>=1||s<=0&&a<=0)return null;var o=this.project(r.p0);s<0&&(o=this.p0),s>1&&(o=this.p1);var u=this.project(r.p1);return a<0&&(u=this.p0),a>1&&(u=this.p1),new e(o,u)}}},{key:"normalize",value:function(){0>this.p1.compareTo(this.p0)&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(t){return 0===t?this.p0:this.p1}},{key:"distancePerpendicular",value:function(t){return tp.pointToLinePerpendicular(t,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return e.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value: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?w.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/i}},{key:"closestPoints",value:function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=[,,].fill(null),i=w.MAX_VALUE,r=null,s=this.closestPoint(t.p0);i=s.distance(t.p0),n[0]=s,n[1]=t.p0;var a=this.closestPoint(t.p1);(r=a.distance(t.p1))<i&&(i=r,n[0]=a,n[1]=t.p1);var o=t.closestPoint(this.p0);(r=o.distance(this.p0))<i&&(i=r,n[0]=this.p0,n[1]=o);var u=t.closestPoint(this.p1);return(r=u.distance(this.p1))<i&&(i=r,n[0]=this.p1,n[1]=u),n}},{key:"closestPoint",value:function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(t){var e=this.p0.compareTo(t.p0);return 0!==e?e:this.p1.compareTo(t.p1)}},{key:"reverse",value:function(){var t=this.p0;this.p0=this.p1,this.p1=t}},{key:"equalsTopo",value:function(t){return this.p0.equals(t.p0)&&this.p1.equals(t.p1)||this.p0.equals(t.p1)&&this.p1.equals(t.p0)}},{key:"lineIntersection",value:function(t){return ty.intersection(this.p0,this.p1,t.p0,t.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),i=this.p0.y+t*(this.p1.y-this.p0.y),r=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,a=Math.sqrt(r*r+s*s),o=0,u=0;if(0!==e){if(a<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");o=e*r/a,u=e*s/a}return new q(n-u,i+o)}},{key:"setCoordinates",value:function(){if(1==arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2==arguments.length){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}}},{key:"segmentFraction",value:function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||w.isNaN(e))&&(e=1),e}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(t){var e=this.p1.getY()-this.p0.getY(),n=this.p0.getX()-this.p1.getX(),i=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),r=e*e+n*n,s=e*e-n*n,a=t.getX(),o=t.getY();return new q((-s*a-2*e*n*o-2*e*i)/r,(s*o-2*e*n*a-2*n*i)/r)}},{key:"distance",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return tp.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof q){var n=arguments[0];return tp.pointToSegment(n,this.p0,this.p1)}}},{key:"pointAlong",value:function(t){var e=new q;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}},{key:"hashCode",value:function(){var t=w.doubleToLongBits(this.p0.x),e=Math.trunc(t^=31*w.doubleToLongBits(this.p0.y))^Math.trunc(t>>32),n=w.doubleToLongBits(this.p1.x);return Math.trunc(n^=31*w.doubleToLongBits(this.p1.y))^Math.trunc(n>>32)^e}},{key:"interfaces_",get:function(){return[k,I]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,0==arguments.length)e.constructor_.call(this,new q,new q);else if(1==arguments.length){var t=arguments[0];e.constructor_.call(this,t.p0,t.p1)}else if(2==arguments.length){var n=arguments[0],i=arguments[1];this.p0=n,this.p1=i}else if(4==arguments.length){var r=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3];e.constructor_.call(this,new q(r,s),new q(a,o))}}},{key:"midPoint",value:function(t,e){return new q((t.x+e.x)/2,(t.y+e.y)/2)}}]),e}(),eQ=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"overlap",value:function(){if(2==arguments.length);else if(4==arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];t.getLineSegment(e,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new eJ,this._overlapSeg2=new eJ}}]),e}(),e$=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getLineSegment",value:function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]}},{key:"computeSelect",value: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 a=Math.trunc((e+n)/2);e<a&&this.computeSelect(t,e,a,i),a<n&&this.computeSelect(t,a,n,i)}},{key:"getCoordinates",value:function(){for(var t=Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t}},{key:"computeOverlaps",value:function(){if(2==arguments.length){var t=arguments[0],e=arguments[1];this.computeOverlaps(this._start,this._end,t,t._start,t._end,e)}else if(6==arguments.length){var n=arguments[0],i=arguments[1],r=arguments[2],s=arguments[3],a=arguments[4],o=arguments[5];if(i-n==1&&a-s==1)return o.overlap(this,n,r,s),null;if(!this.overlaps(n,i,r,s,a))return null;var u=Math.trunc((n+i)/2),l=Math.trunc((s+a)/2);n<u&&(s<l&&this.computeOverlaps(n,u,r,s,l,o),l<a&&this.computeOverlaps(n,u,r,l,a,o)),u<i&&(s<l&&this.computeOverlaps(u,i,r,s,l,o),l<a&&this.computeOverlaps(u,i,r,l,a,o))}}},{key:"setId",value:function(t){this._id=t}},{key:"select",value:function(t,e){this.computeSelect(t,this._start,this._end,e)}},{key:"getEnvelope",value:function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new z(t,e)}return this._env}},{key:"overlaps",value:function(t,e,n,i,r){return z.intersects(this._pts[t],this._pts[e],n._pts[i],n._pts[r])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=i}}]),e}(),e0=function(){function e(){t(this,e)}return n(e,null,[{key:"findChainEnd",value:function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var i=eN.quadrant(t[n],t[n+1]),r=e+1;r<t.length&&(t[r-1].equals2D(t[r])||eN.quadrant(t[r-1],t[r])===i);)r++;return r-1}},{key:"getChains",value:function(){if(1==arguments.length){var t=arguments[0];return e.getChains(t,null)}if(2==arguments.length){var n=arguments[0],i=arguments[1],r=new tf,s=0;do{var a=e.findChainEnd(n,s),o=new e$(n,s,a,i);r.add(o),s=a}while(s<n.length-1);return r}}}]),e}(),e1=function(){function e(){t(this,e)}return n(e,[{key:"computeNodes",value:function(t){}},{key:"getNodedSubstrings",value:function(){}}]),e}(),e2=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"setSegmentIntersector",value:function(t){this._segInt=t}},{key:"interfaces_",get:function(){return[e1]}}],[{key:"constructor_",value:function(){if(this._segInt=null,0==arguments.length);else if(1==arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}}}]),e}(),e3=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return eK.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(t){for(var e=e0.getChains(t.getCoordinates(),t).iterator();e.hasNext();){var n=e.next();n.setId(this._idCounter++),this._index.insert(n.getEnvelope(),n),this._monoChains.add(n)}}},{key:"computeNodes",value:function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var t=new e4(this._segInt),e=this._monoChains.iterator();e.hasNext();)for(var n=e.next(),i=this._index.query(n.getEnvelope()).iterator();i.hasNext();){var r=i.next();if(r.getId()>n.getId()&&(n.computeOverlaps(r,t),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new tf,this._index=new ez,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,0==arguments.length);else if(1==arguments.length){var t=arguments[0];e2.constructor_.call(this,t)}}}]),s}(e2),e4=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"overlap",value:function(){if(4!=arguments.length)return c(r(a.prototype),"overlap",this).apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3],s=t.getContext(),o=n.getContext();this._si.processIntersections(s,e,o,i)}}],[{key:"constructor_",value:function(){this._si=null;var t=arguments[0];this._si=t}}]),a}(eQ);e3.SegmentOverlapAction=e4;var e5=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"isDeletable",value:function(t,e,n,i){var r=this._inputLine[t],s=this._inputLine[e],a=this._inputLine[n];return!!this.isConcave(r,s,a)&&!!this.isShallow(r,s,a,i)&&this.isShallowSampled(r,s,t,n,i)}},{key:"deleteShallowConcavities",value:function(){for(var t=1,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n),r=!1;i<this._inputLine.length;){var s=!1;this.isDeletable(t,n,i,this._distanceTol)&&(this._isDeleted[n]=e.DELETE,s=!0,r=!0),t=s?i:n,n=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(n)}return r}},{key:"isShallowConcavity",value:function(t,e,n,i){return tu.index(t,e,n)===this._angleOrientation&&tp.pointToSegment(e,t,n)<i}},{key:"isShallowSampled",value:function(t,n,i,r,s){var a=Math.trunc((r-i)/e.NUM_PTS_TO_CHECK);a<=0&&(a=1);for(var o=i;o<r;o+=a)if(!this.isShallow(t,n,this._inputLine[o],s))return!1;return!0}},{key:"isConcave",value:function(t,e,n){return tu.index(t,e,n)===this._angleOrientation}},{key:"simplify",value:function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=tu.CLOCKWISE),this._isDeleted=Array(this._inputLine.length).fill(null);var e=!1;do e=this.deleteShallowConcavities();while(e);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(t){for(var n=t+1;n<this._inputLine.length&&this._isDeleted[n]===e.DELETE;)n++;return n}},{key:"isShallow",value:function(t,e,n,i){return tp.pointToSegment(e,t,n)<i}},{key:"collapseLine",value:function(){for(var t=new tB,n=0;n<this._inputLine.length;n++)this._isDeleted[n]!==e.DELETE&&t.add(this._inputLine[n]);return t.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=tu.COUNTERCLOCKWISE;var t=arguments[0];this._inputLine=t}},{key:"simplify",value:function(t,n){return new e(t).simplify(n)}}]),e}();e5.INIT=0,e5.DELETE=1,e5.KEEP=1,e5.NUM_PTS_TO_CHECK=10;var e9=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getCoordinates",value:function(){return this._ptList.toArray(e.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"addPt",value:function(t){var e=new q(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var i=t.length-1;i>=0;i--)this.addPt(t[i])}},{key:"isRedundant",value:function(t){if(1>this._ptList.size())return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance}},{key:"toString",value:function(){return new t2().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(1>this._ptList.size())return null;var t=new q(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)}},{key:"setMinimumVertexDistance",value:function(t){this._minimimVertexDistance=t}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new tf}}]),e}();e9.COORDINATE_ARRAY_TYPE=[].fill(null);var e8=function(){function e(){t(this,e)}return n(e,null,[{key:"toDegrees",value:function(t){return 180*t/Math.PI}},{key:"normalize",value:function(t){for(;t>Math.PI;)t-=e.PI_TIMES_2;for(;t<=-Math.PI;)t+=e.PI_TIMES_2;return t}},{key:"angle",value: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;return Math.atan2(n.y-e.y,i)}}},{key:"isAcute",value: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}},{key:"isObtuse",value: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}},{key:"interiorAngle",value:function(t,n,i){var r=e.angle(n,t);return Math.abs(e.angle(n,i)-r)}},{key:"normalizePositive",value:function(t){if(t<0){for(;t<0;)t+=e.PI_TIMES_2;t>=e.PI_TIMES_2&&(t=0)}else{for(;t>=e.PI_TIMES_2;)t-=e.PI_TIMES_2;t<0&&(t=0)}return t}},{key:"angleBetween",value:function(t,n,i){var r=e.angle(n,t),s=e.angle(n,i);return e.diff(r,s)}},{key:"diff",value:function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n}},{key:"toRadians",value:function(t){return t*Math.PI/180}},{key:"getTurn",value:function(t,n){var i=Math.sin(n-t);return i>0?e.COUNTERCLOCKWISE:i<0?e.CLOCKWISE:e.NONE}},{key:"angleBetweenOriented",value:function(t,n,i){var r=e.angle(n,t),s=e.angle(n,i)-r;return s<=-Math.PI?s+e.PI_TIMES_2:s>Math.PI?s-e.PI_TIMES_2:s}}]),e}();e8.PI_TIMES_2=2*Math.PI,e8.PI_OVER_2=Math.PI/2,e8.PI_OVER_4=Math.PI/4,e8.COUNTERCLOCKWISE=tu.COUNTERCLOCKWISE,e8.CLOCKWISE=tu.CLOCKWISE,e8.NONE=tu.COLLINEAR;var e6=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"addNextSegment",value: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=tu.index(this._s0,this._s1,this._s2),i=n===tu.CLOCKWISE&&this._side===K.LEFT||n===tu.COUNTERCLOCKWISE&&this._side===K.RIGHT;0===n?this.addCollinear(e):i?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)}},{key:"addLineEndCap",value:function(t,e){var n=new eJ(t,e),i=new eJ;this.computeOffsetSegment(n,K.LEFT,this._distance,i);var r=new eJ;this.computeOffsetSegment(n,K.RIGHT,this._distance,r);var s=e.x-t.x,a=Math.atan2(e.y-t.y,s);switch(this._bufParams.getEndCapStyle()){case d.CAP_ROUND:this._segList.addPt(i.p1),this.addDirectedFillet(e,a+Math.PI/2,a-Math.PI/2,tu.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case d.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(r.p1);break;case d.CAP_SQUARE:var o=new q;o.x=Math.abs(this._distance)*Math.cos(a),o.y=Math.abs(this._distance)*Math.sin(a);var u=new q(i.p1.x+o.x,i.p1.y+o.y),l=new q(r.p1.x+o.x,r.p1.y+o.y);this._segList.addPt(u),this._segList.addPt(l)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(t,e,n,i){var r=ty.intersection(e.p0,e.p1,n.p0,n.p1);if(null!==r&&(i<=0?1:r.distance(t)/Math.abs(i))<=this._bufParams.getMitreLimit())return this._segList.addPt(r),null;this.addLimitedMitreJoin(e,n,i,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(t,n){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*e.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===d.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===d.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(n&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(t){this._segList.addPt(new q(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new q(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new q(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new q(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(t,e){this._segList.addPts(t,e)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(t,e,n,i,r){var s=e.x-t.x,a=Math.atan2(e.y-t.y,s),o=n.x-t.x,u=Math.atan2(n.y-t.y,o);i===tu.CLOCKWISE?a<=u&&(a+=2*Math.PI):a>=u&&(a-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,a,u,i,r),this._segList.addPt(n)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value: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)}},{key:"addLimitedMitreJoin",value:function(t,e,n,i){var r=this._seg0.p1,s=e8.angle(r,this._seg0.p0),a=e8.angleBetweenOriented(this._seg0.p0,r,this._seg1.p1)/2,o=e8.normalize(s+a),u=e8.normalize(o+Math.PI),l=i*n,h=n-l*Math.abs(Math.sin(a)),c=new q(r.x+l*Math.cos(u),r.y+l*Math.sin(u)),f=new eJ(r,c),v=f.pointAlongOffset(1,h),g=f.pointAlongOffset(1,-h);this._side===K.LEFT?(this._segList.addPt(v),this._segList.addPt(g)):(this._segList.addPt(g),this._segList.addPt(v))}},{key:"addDirectedFillet",value:function(t,e,n,i,r){var s=i===tu.CLOCKWISE?-1:1,a=Math.abs(e-n),o=Math.trunc(a/this._filletAngleQuantum+.5);if(o<1)return null;for(var u=a/o,l=new q,h=0;h<o;h++){var c=e+s*h*u;l.x=t.x+r*Math.cos(c),l.y=t.y+r*Math.sin(c),this._segList.addPt(l)}}},{key:"computeOffsetSegment",value:function(t,e,n,i){var r=e===K.LEFT?1:-1,s=t.p1.x-t.p0.x,a=t.p1.y-t.p0.y,o=Math.sqrt(s*s+a*a),u=r*n*s/o,l=r*n*a/o;i.p0.x=t.p0.x-l,i.p0.y=t.p0.y+u,i.p1.x=t.p1.x-l,i.p1.y=t.p1.y+u}},{key:"addInsideTurn",value:function(t,n){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*e.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var i=new q((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(i);var r=new q((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(t){var e=new q(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}},{key:"init",value:function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new e9,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*e.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===d.JOIN_BEVEL||this._bufParams.getJoinStyle()===d.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,tu.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new eJ,this._seg1=new eJ,this._offset0=new eJ,this._offset1=new eJ,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],i=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new eo,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===d.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)}}]),e}();e6.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,e6.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,e6.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,e6.MAX_CLOSING_SEG_LEN_FACTOR=80;var e7=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getOffsetCurve",value: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&&tU.reverse(s),s}},{key:"computeSingleSidedBufferCurve",value:function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var r=e5.simplify(t,-i),s=r.length-1;n.initSideSegments(r[s],r[s-1],K.LEFT),n.addFirstSegment();for(var a=s-2;a>=0;a--)n.addNextSegment(r[a],!0)}else{n.addSegments(t,!1);var o=e5.simplify(t,i),u=o.length-1;n.initSideSegments(o[0],o[1],K.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(o[l],!0)}n.addLastSegment(),n.closeRing()}},{key:"computeRingBufferCurve",value:function(t,e,n){var i=this.simplifyTolerance(this._distance);e===K.RIGHT&&(i=-i);var r=e5.simplify(t,i),s=r.length-1;n.initSideSegments(r[s-1],r[0],e);for(var a=1;a<=s;a++){var o=1!==a;n.addNextSegment(r[a],o)}n.closeRing()}},{key:"computeLineBufferCurve",value:function(t,e){var n=this.simplifyTolerance(this._distance),i=e5.simplify(t,n),r=i.length-1;e.initSideSegments(i[0],i[1],K.LEFT);for(var s=2;s<=r;s++)e.addNextSegment(i[s],!0);e.addLastSegment(),e.addLineEndCap(i[r-1],i[r]);var a=e5.simplify(t,-n),o=a.length-1;e.initSideSegments(a[o],a[o-1],K.LEFT);for(var u=o-2;u>=0;u--)e.addNextSegment(a[u],!0);e.addLastSegment(),e.addLineEndCap(a[1],a[0]),e.closeRing()}},{key:"computePointCurve",value:function(t,e){switch(this._bufParams.getEndCapStyle()){case d.CAP_ROUND:e.createCircle(t);break;case d.CAP_SQUARE:e.createSquare(t)}}},{key:"getLineCurve",value:function(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;var n=Math.abs(e),i=this.getSegGen(n);return t.length<=1?this.computePointCurve(t[0],i):this._bufParams.isSingleSided()?this.computeSingleSidedBufferCurve(t,e<0,i):this.computeLineBufferCurve(t,i),i.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(t){return t*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(t,n,i){if(this._distance=i,t.length<=2)return this.getLineCurve(t,i);if(0===i)return e.copyCoordinates(t);var r=this.getSegGen(i);return this.computeRingBufferCurve(t,n,r),r.getCoordinates()}},{key:"computeOffsetCurve",value:function(t,e,n){var i=this.simplifyTolerance(this._distance);if(e){var r=e5.simplify(t,-i),s=r.length-1;n.initSideSegments(r[s],r[s-1],K.LEFT),n.addFirstSegment();for(var a=s-2;a>=0;a--)n.addNextSegment(r[a],!0)}else{var o=e5.simplify(t,i),u=o.length-1;n.initSideSegments(o[0],o[1],K.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(o[l],!0)}n.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(t){return 0===t||t<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(t){return new e6(this._precisionModel,this._bufParams,t)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}},{key:"copyCoordinates",value:function(t){for(var e=Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new q(t[n]);return e}}]),e}(),nt=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"findStabbedSegments",value:function(){if(1==arguments.length){for(var t=arguments[0],e=new tf,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),r=i.getEnvelope();t.y<r.getMinY()||t.y>r.getMaxY()||this.findStabbedSegments(t,i.getDirectedEdges(),e)}return e}if(3==arguments.length){if(te(arguments[2],$)&&arguments[0]instanceof q&&arguments[1]instanceof eS){for(var s=arguments[0],a=arguments[1],o=arguments[2],u=a.getEdge().getCoordinates(),l=0;l<u.length-1;l++)if(this._seg.p0=u[l],this._seg.p1=u[l+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<s.x)&&!(this._seg.isHorizontal()||s.y<this._seg.p0.y||s.y>this._seg.p1.y||tu.index(this._seg.p0,this._seg.p1,s)===tu.RIGHT)){var h=a.getDepth(K.LEFT);this._seg.p0.equals(u[l])||(h=a.getDepth(K.RIGHT));var c=new ne(this._seg,h);o.add(c)}}else if(te(arguments[2],$)&&arguments[0]instanceof q&&te(arguments[1],$))for(var f=arguments[0],v=arguments[1],g=arguments[2],y=v.iterator();y.hasNext();){var d=y.next();d.isForward()&&this.findStabbedSegments(f,d,g)}}}},{key:"getDepth",value:function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:eA.min(e)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new eJ;var t=arguments[0];this._subgraphs=t}}]),e}(),ne=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"compareTo",value:function(t){if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return -1;var e=this._upwardSeg.orientationIndex(t._upwardSeg);return 0!==e||0!=(e=-1*t._upwardSeg.orientationIndex(this._upwardSeg))?e:this._upwardSeg.compareTo(t._upwardSeg)}},{key:"compareX",value:function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new eJ(t),this._leftDepth=e}}]),e}();nt.DepthSegment=ne;var nn=function(e){i(s,e);var r=h(s);function s(){var e;return t(this,s),e=r.call(this),s.constructor_.apply(l(e),arguments),e}return n(s,null,[{key:"constructor_",value:function(){_.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),s}(_),ni=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getY",value:function(){var t=this.y/this.w;if(w.isNaN(t)||w.isInfinite(t))throw new nn;return t}},{key:"getX",value:function(){var t=this.x/this.w;if(w.isNaN(t)||w.isInfinite(t))throw new nn;return t}},{key:"getCoordinate",value:function(){var t=new q;return t.x=this.getX(),t.y=this.getY(),t}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,0==arguments.length)this.x=0,this.y=0,this.w=1;else if(1==arguments.length){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(2==arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var n=arguments[0],i=arguments[1];this.x=n,this.y=i,this.w=1}else if(arguments[0]instanceof e&&arguments[1]instanceof e){var r=arguments[0],s=arguments[1];this.x=r.y*s.w-s.y*r.w,this.y=s.x*r.w-r.x*s.w,this.w=r.x*s.y-s.x*r.y}else if(arguments[0]instanceof q&&arguments[1]instanceof q){var a=arguments[0],o=arguments[1];this.x=a.y-o.y,this.y=o.x-a.x,this.w=a.x*o.y-o.x*a.y}}else if(3==arguments.length){var u=arguments[0],l=arguments[1],h=arguments[2];this.x=u,this.y=l,this.w=h}else if(4==arguments.length){var c=arguments[0],f=arguments[1],v=arguments[2],g=arguments[3],y=c.y-f.y,d=f.x-c.x,_=c.x*f.y-f.x*c.y,p=v.y-g.y,m=g.x-v.x,k=v.x*g.y-g.x*v.y;this.x=d*k-m*_,this.y=p*_-y*k,this.w=y*m-p*d}}}]),e}(),nr=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"area",value:function(){return e.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return e.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(t){if(null===t)throw new p("Supplied point is null.");return e.interpolateZ(t,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return e.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return e.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return e.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return e.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return e.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return e.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.p0=t,this.p1=e,this.p2=n}},{key:"area",value:function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)}},{key:"signedArea",value:function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2}},{key:"det",value:function(t,e,n,i){return t*i-e*n}},{key:"interpolateZ",value:function(t,e,n,i){var r=e.x,s=e.y,a=n.x-r,o=i.x-r,u=n.y-s,l=i.y-s,h=a*l-o*u,c=t.x-r,f=t.y-s;return e.getZ()+(l*c-o*f)/h*(n.getZ()-e.getZ())+(-u*c+a*f)/h*(i.getZ()-e.getZ())}},{key:"longestSideLength",value:function(t,e,n){var i=t.distance(e),r=e.distance(n),s=n.distance(t),a=i;return r>a&&(a=r),s>a&&(a=s),a}},{key:"circumcentreDD",value:function(t,e,n){var i=ts.valueOf(t.x).subtract(n.x),r=ts.valueOf(t.y).subtract(n.y),s=ts.valueOf(e.x).subtract(n.x),a=ts.valueOf(e.y).subtract(n.y),o=ts.determinant(i,r,s,a).multiply(2),u=i.sqr().add(r.sqr()),l=s.sqr().add(a.sqr()),h=ts.determinant(r,u,a,l),c=ts.determinant(i,u,s,l);return new q(ts.valueOf(n.x).subtract(h.divide(o)).doubleValue(),ts.valueOf(n.y).add(c.divide(o)).doubleValue())}},{key:"isAcute",value:function(t,e,n){return!!e8.isAcute(t,e,n)&&!!e8.isAcute(e,n,t)&&!!e8.isAcute(n,t,e)}},{key:"circumcentre",value:function(t,n,i){var r=i.x,s=i.y,a=t.x-r,o=t.y-s,u=n.x-r,l=n.y-s,h=2*e.det(a,o,u,l);return new q(r-e.det(o,a*a+o*o,l,u*u+l*l)/h,s+e.det(a,a*a+o*o,u,u*u+l*l)/h)}},{key:"perpendicularBisector",value:function(t,e){var n=e.x-t.x,i=e.y-t.y,r=new ni(t.x+n/2,t.y+i/2,1),s=new ni(t.x-i+n/2,t.y+n+i/2,1);return new ni(r,s)}},{key:"angleBisector",value:function(t,e,n){var i=e.distance(t),r=i/(i+e.distance(n)),s=n.x-t.x,a=n.y-t.y;return new q(t.x+r*s,t.y+r*a)}},{key:"area3D",value:function(t,e,n){var i=e.x-t.x,r=e.y-t.y,s=e.getZ()-t.getZ(),a=n.x-t.x,o=n.y-t.y,u=n.getZ()-t.getZ(),l=r*u-s*o,h=s*a-i*u,c=i*o-r*a;return Math.sqrt(l*l+h*h+c*c)/2}},{key:"centroid",value:function(t,e,n){return new q((t.x+e.x+n.x)/3,(t.y+e.y+n.y)/3)}},{key:"inCentre",value:function(t,e,n){var i=e.distance(n),r=t.distance(n),s=t.distance(e),a=i+r+s;return new q((i*t.x+r*e.x+s*n.x)/a,(i*t.y+r*e.y+s*n.y)/a)}}]),e}(),ns=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"addRingSide",value:function(t,e,n,i,r){if(0===e&&t.length<tG.MINIMUM_VALID_SIZE)return null;var s=i,a=r;t.length>=tG.MINIMUM_VALID_SIZE&&tu.isCCW(t)&&(s=r,a=i,n=K.opposite(n));var o=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(o,s,a)}},{key:"addRingBothSides",value:function(t,e){this.addRingSide(t,e,K.LEFT,B.EXTERIOR,B.INTERIOR),this.addRingSide(t,e,K.RIGHT,B.INTERIOR,B.EXTERIOR)}},{key:"addPoint",value:function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,B.EXTERIOR,B.INTERIOR)}},{key:"addPolygon",value:function(t){var e=this._distance,n=K.LEFT;this._distance<0&&(e=-this._distance,n=K.RIGHT);var i=t.getExteriorRing(),r=tU.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&r.length<3)return null;this.addRingSide(r,e,n,B.EXTERIOR,B.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),o=tU.removeRepeatedPoints(a.getCoordinates());this._distance>0&&this.isErodedCompletely(a,-this._distance)||this.addRingSide(o,e,K.opposite(n),B.INTERIOR,B.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(t,e){var n=new nr(t[0],t[1],t[2]),i=n.inCentre();return tp.pointToSegment(i,n.p0,n.p1)<Math.abs(e)}},{key:"addLineString",value:function(t){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var e=tU.removeRepeatedPoints(t.getCoordinates());if(tU.isRing(e)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(e,this._distance);else{var n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,B.EXTERIOR,B.INTERIOR)}}},{key:"addCurve",value:function(t,e,n){if(null===t||t.length<2)return null;var i=new eK(t,new ec(0,B.BOUNDARY,e,n));this._curveList.add(i)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(t){if(t.isEmpty())return null;if(t instanceof tM)this.addPolygon(t);else if(t instanceof tL)this.addLineString(t);else if(t instanceof tR)this.addPoint(t);else if(t instanceof tF)this.addCollection(t);else if(t instanceof t1)this.addCollection(t);else if(t instanceof tK)this.addCollection(t);else{if(!(t instanceof tD))throw new H(t.getGeometryType());this.addCollection(t)}}},{key:"isErodedCompletely",value: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}},{key:"addCollection",value:function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new tf;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n}}]),e}(),na=function(){function e(){t(this,e)}return n(e,[{key:"locate",value:function(t){}}]),e}(),no=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,e.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new V;var t=this._parent.getGeometryN(this._index++);return t instanceof tD?(this._subcollectionIterator=new e(t),this._subcollectionIterator.next()):t}},{key:"remove",value:function(){throw new H(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[eV]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()}},{key:"isAtomic",value:function(t){return!(t instanceof tD)}}]),e}(),nu=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"locate",value:function(t){return e.locate(t,this._geom)}},{key:"interfaces_",get:function(){return[na]}}],[{key:"constructor_",value:function(){this._geom=null;var t=arguments[0];this._geom=t}},{key:"locatePointInPolygon",value:function(t,n){if(n.isEmpty())return B.EXTERIOR;var i=n.getExteriorRing(),r=e.locatePointInRing(t,i);if(r!==B.INTERIOR)return r;for(var s=0;s<n.getNumInteriorRing();s++){var a=n.getInteriorRingN(s),o=e.locatePointInRing(t,a);if(o===B.BOUNDARY)return B.BOUNDARY;if(o===B.INTERIOR)return B.EXTERIOR}return B.INTERIOR}},{key:"locatePointInRing",value:function(t,e){return e.getEnvelopeInternal().intersects(t)?el.locateInRing(t,e.getCoordinates()):B.EXTERIOR}},{key:"containsPointInPolygon",value:function(t,n){return B.EXTERIOR!==e.locatePointInPolygon(t,n)}},{key:"locateInGeometry",value:function(t,n){if(n instanceof tM)return e.locatePointInPolygon(t,n);if(n instanceof tD)for(var i=new no(n);i.hasNext();){var r=i.next();if(r!==n){var s=e.locateInGeometry(t,r);if(s!==B.EXTERIOR)return s}}return B.EXTERIOR}},{key:"isContained",value:function(t,n){return B.EXTERIOR!==e.locate(t,n)}},{key:"locate",value:function(t,n){return n.isEmpty()?B.EXTERIOR:n.getEnvelopeInternal().intersects(t)?e.locateInGeometry(t,n):B.EXTERIOR}}]),e}(),nl=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var t=null,e=null,n=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var r=this._resultAreaEdgeList.get(i),s=r.getSym();if(r.getLabel().isArea())switch(null===t&&r.isInResult()&&(t=r),n){case this._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;e=s,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!r.isInResult())continue;e.setNext(r),n=this._SCANNING_FOR_INCOMING}}if(n===this._LINKING_TO_OUTGOING){if(null===t)throw new th("no outgoing dirEdge found",this.getCoordinate());A.isTrue(t.isInResult(),"unable to link last incoming dirEdge"),e.setNext(t)}}},{key:"insert",value:function(t){this.insertEdgeEnd(t,t)}},{key:"getRightmostEdge",value:function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var i=t.get(e-1),r=n.getQuadrant(),s=i.getQuadrant();return eN.isNorthern(r)&&eN.isNorthern(s)?n:eN.isNorthern(r)||eN.isNorthern(s)?0!==n.getDy()?n:0!==i.getDy()?i:(A.shouldNeverReachHere("found two horizontal edges incident on node"),null):i}},{key:"print",value:function(t){td.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}}},{key:"getResultAreaEdges",value:function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new tf;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(t){for(var e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=0;n--){var i=this._edgeList.get(n),r=i.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=i}e.setNext(t)}},{key:"computeDepths",value:function(){if(1==arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(K.LEFT),i=t.getDepth(K.RIGHT),r=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,r)!==i)throw new th("depth mismatch at "+t.getCoordinate())}else if(3==arguments.length){for(var s=arguments[0],a=arguments[1],o=arguments[2],u=o,l=s;l<a;l++){var h=this._edgeList.get(l);h.setEdgeDepths(K.RIGHT,u),u=h.getDepth(K.LEFT)}return u}}},{key:"mergeSymLabels",value:function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(t){for(var e=null,n=null,i=this._SCANNING_FOR_INCOMING,r=this._resultAreaEdgeList.size()-1;r>=0;r--){var s=this._resultAreaEdgeList.get(r),a=s.getSym();switch(null===e&&s.getEdgeRing()===t&&(e=s),i){case this._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,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&&(A.isTrue(null!==e,"found null for first outgoing dirEdge"),A.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))}},{key:"getOutgoingDegree",value:function(){if(0==arguments.length){for(var t=0,e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1==arguments.length){for(var n=arguments[0],i=0,r=this.iterator();r.hasNext();)r.next().getEdgeRing()===n&&i++;return i}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var t=B.NONE,e=this.iterator();e.hasNext();){var n=e.next(),i=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=B.INTERIOR;break}if(i.isInResult()){t=B.EXTERIOR;break}}}if(t===B.NONE)return null;for(var r=t,s=this.iterator();s.hasNext();){var a=s.next(),o=a.getSym();a.isLineEdge()?a.getEdge().setCovered(r===B.INTERIOR):(a.isInResult()&&(r=B.EXTERIOR),o.isInResult()&&(r=B.INTERIOR))}}},{key:"computeLabelling",value:function(t){c(r(a.prototype),"computeLabelling",this).call(this,t),this._label=new ec(B.NONE);for(var e=this.iterator();e.hasNext();)for(var n=e.next().getEdge().getLabel(),i=0;i<2;i++){var s=n.getLocation(i);s!==B.INTERIOR&&s!==B.BOUNDARY||this._label.setLocation(i,B.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),a}(function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getNextCW",value:function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)}},{key:"propagateSideLabels",value:function(t){for(var e=B.NONE,n=this.iterator();n.hasNext();){var i=n.next().getLabel();i.isArea(t)&&i.getLocation(t,K.LEFT)!==B.NONE&&(e=i.getLocation(t,K.LEFT))}if(e===B.NONE)return null;for(var r=e,s=this.iterator();s.hasNext();){var a=s.next(),o=a.getLabel();if(o.getLocation(t,K.ON)===B.NONE&&o.setLocation(t,K.ON,r),o.isArea(t)){var u=o.getLocation(t,K.LEFT),l=o.getLocation(t,K.RIGHT);if(l!==B.NONE){if(l!==r)throw new th("side location conflict",a.getCoordinate());u===B.NONE&&A.shouldNeverReachHere("found single null side (at "+a.getCoordinate()+")"),r=u}else A.isTrue(o.getLocation(t,K.LEFT)===B.NONE,"found single null side"),o.setLocation(t,K.RIGHT,r),o.setLocation(t,K.LEFT,r)}}}},{key:"getCoordinate",value:function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null}},{key:"print",value:function(t){td.out.println("EdgeEndStar:   "+this.getCoordinate());for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"isAreaLabelsConsistent",value:function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(t){var e=this.getEdges();if(0>=e.size())return!0;var n=e.size()-1,i=e.get(n).getLabel().getLocation(t,K.LEFT);A.isTrue(i!==B.NONE,"Found unlabelled area edge");for(var r=i,s=this.iterator();s.hasNext();){var a=s.next().getLabel();A.isTrue(a.isArea(t),"Found non-area edge");var o=a.getLocation(t,K.LEFT),u=a.getLocation(t,K.RIGHT);if(o===u||u!==r)return!1;r=o}return!0}},{key:"findIndex",value:function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++)if(this._edgeList.get(e)===t)return e;return -1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return null===this._edgeList&&(this._edgeList=new tf(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(t,e,n){return this._ptInAreaLocation[t]===B.NONE&&(this._ptInAreaLocation[t]=nu.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]}},{key:"toString",value:function(){var t=new tn;t.append("EdgeEndStar:   "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()}},{key:"computeEdgeEndLabels",value:function(t){for(var e=this.iterator();e.hasNext();)e.next().computeLabel(t)}},{key:"computeLabelling",value:function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var i=n.next().getLabel(),r=0;r<2;r++)i.isLine(r)&&i.getLocation(r)===B.BOUNDARY&&(e[r]=!0);for(var s=this.iterator();s.hasNext();)for(var a=s.next(),o=a.getLabel(),u=0;u<2;u++)if(o.isAnyNull(u)){var l=B.NONE;if(e[u])l=B.EXTERIOR;else{var h=a.getCoordinate();l=this.getLocation(u,h,t)}o.setAllLocationsIfNull(u,l)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(t,e){this._edgeMap.put(t,e),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new eI,this._edgeList=null,this._ptInAreaLocation=[B.NONE,B.NONE]}}]),e}()),nh=function(e){i(s,e);var r=h(s);function s(){return t(this,s),r.call(this)}return n(s,[{key:"createNode",value:function(t){return new ed(t,new nl)}}]),s}(eL),nc=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"compareTo",value:function(t){return e.compareOriented(this._pts,this._orientation,t._pts,t._orientation)}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)}},{key:"orientation",value:function(t){return 1===tU.increasingDirection(t)}},{key:"compareOriented",value:function(t,e,n,i){for(var r=e?1:-1,s=i?1:-1,a=e?t.length:-1,o=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)===a,f=(l+=s)===o;if(c&&!f)return -1;if(!c&&f)return 1;if(c&&f)return 0}}}]),e}(),nf=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"print",value:function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var i=n.getCoordinates(),r=0;r<i.length;r++)r>0&&t.print(","),t.print(i[r].x+" "+i[r].y);t.println(")")}t.print(")  ")}},{key:"addAll",value:function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())}},{key:"findEdgeIndex",value:function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return -1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(t){return this._edges.get(t)}},{key:"findEqualEdge",value:function(t){var e=new nc(t.getCoordinates());return this._ocaMap.get(e)}},{key:"add",value:function(t){this._edges.add(t);var e=new nc(t.getCoordinates());this._ocaMap.put(e,t)}}],[{key:"constructor_",value:function(){this._edges=new tf,this._ocaMap=new eI}}]),e}(),nv=function(){function e(){t(this,e)}return n(e,[{key:"processIntersections",value:function(t,e,n,i){}},{key:"isDone",value:function(){}}]),e}(),ng=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"isTrivialIntersection",value:function(t,n,i,r){if(t===i&&1===this._li.getIntersectionNum()){if(e.isAdjacentSegments(n,r))return!0;if(t.isClosed()){var s=t.size()-1;if(0===n&&r===s||0===r&&n===s)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(t,e,n,i){if(t===n&&e===i)return null;this.numTests++;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],a=n.getCoordinates()[i],o=n.getCoordinates()[i+1];this._li.computeIntersection(r,s,a,o),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,i)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[nv]}}],[{key:"constructor_",value:function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t}},{key:"isAdjacentSegments",value:function(t,e){return 1===Math.abs(t-e)}}]),e}(),ny=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)}},{key:"compareTo",value:function(t){return this.compare(t.segmentIndex,t.dist)}},{key:"isEndPoint",value:function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new q(t),this.segmentIndex=e,this.dist=n}}]),e}(),nd=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"print",value:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var i=e.next(),r=this.createSplitEdge(n,i);t.add(r),n=i}}},{key:"addEndpoints",value:function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)}},{key:"createSplitEdge",value:function(t,e){var n=e.segmentIndex-t.segmentIndex+2,i=this.edge.pts[e.segmentIndex],r=e.dist>0||!e.coord.equals2D(i);r||n--;var s=Array(n).fill(null),a=0;s[a++]=new q(t.coord);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)s[a++]=this.edge.pts[o];return r&&(s[a]=e.coord),new nI(s,new ec(this.edge._label))}},{key:"add",value:function(t,e,n){var i=new ny(t,e,n),r=this._nodeMap.get(i);return null!==r?r:(this._nodeMap.put(i,i),i)}},{key:"isIntersection",value:function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new eI,this.edge=null;var t=arguments[0];this.edge=t}}]),e}(),n_=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(e.isTrue(this._matrix[B.INTERIOR][B.INTERIOR])||e.isTrue(this._matrix[B.INTERIOR][B.BOUNDARY])||e.isTrue(this._matrix[B.BOUNDARY][B.INTERIOR])||e.isTrue(this._matrix[B.BOUNDARY][B.BOUNDARY]))&&this._matrix[B.EXTERIOR][B.INTERIOR]===tN.FALSE&&this._matrix[B.EXTERIOR][B.BOUNDARY]===tN.FALSE}},{key:"isCoveredBy",value:function(){return(e.isTrue(this._matrix[B.INTERIOR][B.INTERIOR])||e.isTrue(this._matrix[B.INTERIOR][B.BOUNDARY])||e.isTrue(this._matrix[B.BOUNDARY][B.INTERIOR])||e.isTrue(this._matrix[B.BOUNDARY][B.BOUNDARY]))&&this._matrix[B.INTERIOR][B.EXTERIOR]===tN.FALSE&&this._matrix[B.BOUNDARY][B.EXTERIOR]===tN.FALSE}},{key:"set",value:function(){if(1==arguments.length)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),i=e%3;this._matrix[n][i]=tN.toDimensionValue(t.charAt(e))}else if(3==arguments.length){var r=arguments[0],s=arguments[1],a=arguments[2];this._matrix[r][s]=a}}},{key:"isContains",value:function(){return e.isTrue(this._matrix[B.INTERIOR][B.INTERIOR])&&this._matrix[B.EXTERIOR][B.INTERIOR]===tN.FALSE&&this._matrix[B.EXTERIOR][B.BOUNDARY]===tN.FALSE}},{key:"setAtLeast",value:function(){if(1==arguments.length)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),i=e%3;this.setAtLeast(n,i,tN.toDimensionValue(t.charAt(e)))}else if(3==arguments.length){var r=arguments[0],s=arguments[1],a=arguments[2];this._matrix[r][s]<a&&(this._matrix[r][s]=a)}}},{key:"setAtLeastIfValid",value:function(t,e,n){t>=0&&e>=0&&this.setAtLeast(t,e,n)}},{key:"isWithin",value:function(){return e.isTrue(this._matrix[B.INTERIOR][B.INTERIOR])&&this._matrix[B.INTERIOR][B.EXTERIOR]===tN.FALSE&&this._matrix[B.BOUNDARY][B.EXTERIOR]===tN.FALSE}},{key:"isTouches",value:function(t,n){return t>n?this.isTouches(n,t):(t===tN.A&&n===tN.A||t===tN.L&&n===tN.L||t===tN.L&&n===tN.A||t===tN.P&&n===tN.A||t===tN.P&&n===tN.L)&&this._matrix[B.INTERIOR][B.INTERIOR]===tN.FALSE&&(e.isTrue(this._matrix[B.INTERIOR][B.BOUNDARY])||e.isTrue(this._matrix[B.BOUNDARY][B.INTERIOR])||e.isTrue(this._matrix[B.BOUNDARY][B.BOUNDARY]))}},{key:"isOverlaps",value:function(t,n){return t===tN.P&&n===tN.P||t===tN.A&&n===tN.A?e.isTrue(this._matrix[B.INTERIOR][B.INTERIOR])&&e.isTrue(this._matrix[B.INTERIOR][B.EXTERIOR])&&e.isTrue(this._matrix[B.EXTERIOR][B.INTERIOR]):t===tN.L&&n===tN.L&&1===this._matrix[B.INTERIOR][B.INTERIOR]&&e.isTrue(this._matrix[B.INTERIOR][B.EXTERIOR])&&e.isTrue(this._matrix[B.EXTERIOR][B.INTERIOR])}},{key:"isEquals",value:function(t,n){return t===n&&e.isTrue(this._matrix[B.INTERIOR][B.INTERIOR])&&this._matrix[B.INTERIOR][B.EXTERIOR]===tN.FALSE&&this._matrix[B.BOUNDARY][B.EXTERIOR]===tN.FALSE&&this._matrix[B.EXTERIOR][B.INTERIOR]===tN.FALSE&&this._matrix[B.EXTERIOR][B.BOUNDARY]===tN.FALSE}},{key:"toString",value:function(){for(var t=new tZ("123456789"),e=0;e<3;e++)for(var n=0;n<3;n++)t.setCharAt(3*e+n,tN.toDimensionSymbol(this._matrix[e][n]));return t.toString()}},{key:"setAll",value:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this._matrix[e][n]=t}},{key:"get",value:function(t,e){return this._matrix[t][e]}},{key:"transpose",value: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}},{key:"matches",value:function(t){if(9!==t.length)throw new p("Should be length 9: "+t);for(var n=0;n<3;n++)for(var i=0;i<3;i++)if(!e.matches(this._matrix[n][i],t.charAt(3*n+i)))return!1;return!0}},{key:"add",value:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this.setAtLeast(e,n,t.get(e,n))}},{key:"isDisjoint",value:function(){return this._matrix[B.INTERIOR][B.INTERIOR]===tN.FALSE&&this._matrix[B.INTERIOR][B.BOUNDARY]===tN.FALSE&&this._matrix[B.BOUNDARY][B.INTERIOR]===tN.FALSE&&this._matrix[B.BOUNDARY][B.BOUNDARY]===tN.FALSE}},{key:"isCrosses",value:function(t,n){return t===tN.P&&n===tN.L||t===tN.P&&n===tN.A||t===tN.L&&n===tN.A?e.isTrue(this._matrix[B.INTERIOR][B.INTERIOR])&&e.isTrue(this._matrix[B.INTERIOR][B.EXTERIOR]):t===tN.L&&n===tN.P||t===tN.A&&n===tN.P||t===tN.A&&n===tN.L?e.isTrue(this._matrix[B.INTERIOR][B.INTERIOR])&&e.isTrue(this._matrix[B.EXTERIOR][B.INTERIOR]):t===tN.L&&n===tN.L&&0===this._matrix[B.INTERIOR][B.INTERIOR]}},{key:"interfaces_",get:function(){return[x]}}],[{key:"constructor_",value:function(){if(this._matrix=null,0==arguments.length)this._matrix=[,,,].fill().map(function(){return[,,,]}),this.setAll(tN.FALSE);else if(1==arguments.length){if("string"==typeof arguments[0]){var t=arguments[0];e.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof e){var n=arguments[0];e.constructor_.call(this),this._matrix[B.INTERIOR][B.INTERIOR]=n._matrix[B.INTERIOR][B.INTERIOR],this._matrix[B.INTERIOR][B.BOUNDARY]=n._matrix[B.INTERIOR][B.BOUNDARY],this._matrix[B.INTERIOR][B.EXTERIOR]=n._matrix[B.INTERIOR][B.EXTERIOR],this._matrix[B.BOUNDARY][B.INTERIOR]=n._matrix[B.BOUNDARY][B.INTERIOR],this._matrix[B.BOUNDARY][B.BOUNDARY]=n._matrix[B.BOUNDARY][B.BOUNDARY],this._matrix[B.BOUNDARY][B.EXTERIOR]=n._matrix[B.BOUNDARY][B.EXTERIOR],this._matrix[B.EXTERIOR][B.INTERIOR]=n._matrix[B.EXTERIOR][B.INTERIOR],this._matrix[B.EXTERIOR][B.BOUNDARY]=n._matrix[B.EXTERIOR][B.BOUNDARY],this._matrix[B.EXTERIOR][B.EXTERIOR]=n._matrix[B.EXTERIOR][B.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&"string"==typeof arguments[1]){var t=arguments[0],n=arguments[1];return n===tN.SYM_DONTCARE||n===tN.SYM_TRUE&&(t>=0||t===tN.TRUE)||n===tN.SYM_FALSE&&t===tN.FALSE||n===tN.SYM_P&&t===tN.P||n===tN.SYM_L&&t===tN.L||n===tN.SYM_A&&t===tN.A}if("string"==typeof arguments[0]&&"string"==typeof arguments[1]){var i=arguments[0],r=arguments[1];return new e(i).matches(r)}}},{key:"isTrue",value:function(t){return t>=0||t===tN.TRUE}}]),e}(),np=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(t){return null===t||0===t.length?null:(this.ensureCapacity(this._size+t.length),td.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}},{key:"ensureCapacity",value:function(t){if(t<=this._data.length)return null;var e=Math.max(t,2*this._data.length);this._data=tw.copyOf(this._data,e)}},{key:"toArray",value:function(){var t=Array(this._size).fill(null);return td.arraycopy(this._data,0,t,0,this._size),t}},{key:"add",value:function(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,0==arguments.length)e.constructor_.call(this,10);else if(1==arguments.length){var t=arguments[0];this._data=Array(t).fill(null)}}}]),e}(),nm=function(){function e(){t(this,e)}return n(e,[{key:"getChainStartIndices",value:function(t){var e=0,n=new np(Math.trunc(t.length/2));n.add(e);do{var i=this.findChainEnd(t,e);n.add(i),e=i}while(e<t.length-1);return n.toArray()}},{key:"findChainEnd",value:function(t,e){for(var n=eN.quadrant(t[e],t[e+1]),i=e+1;i<t.length&&eN.quadrant(t[i-1],t[i])===n;)i++;return i-1}},{key:"OLDgetChainStartIndices",value:function(t){var n=0,i=new tf;i.add(n);do{var r=this.findChainEnd(t,n);i.add(r),n=r}while(n<t.length-1);return e.toIntArray(i)}}],[{key:"toIntArray",value:function(t){for(var e=Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e}}]),e}(),nk=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n}},{key:"getMinX",value:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n}},{key:"computeIntersectsForChain",value:function(){if(4==arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],i)}else if(6==arguments.length){var r=arguments[0],s=arguments[1],a=arguments[2],o=arguments[3],u=arguments[4],l=arguments[5];if(s-r==1&&u-o==1)return l.addIntersections(this.e,r,a.e,o),null;if(!this.overlaps(r,s,a,o,u))return null;var h=Math.trunc((r+s)/2),c=Math.trunc((o+u)/2);r<h&&(o<c&&this.computeIntersectsForChain(r,h,a,o,c,l),c<u&&this.computeIntersectsForChain(r,h,a,c,u,l)),h<s&&(o<c&&this.computeIntersectsForChain(h,s,a,o,c,l),c<u&&this.computeIntersectsForChain(h,s,a,c,u,l))}}},{key:"overlaps",value:function(t,e,n,i,r){return z.intersects(this.pts[t],this.pts[e],n.pts[i],n.pts[r])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var i=0;i<t.startIndex.length-1;i++)this.computeIntersectsForChain(n,t,i,e)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new nm;this.startIndex=e.getChainStartIndices(this.pts)}}]),e}(),nx=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"getDepth",value:function(t,e){return this._depth[t][e]}},{key:"setDepth",value:function(t,e,n){this._depth[t][e]=n}},{key:"isNull",value:function(){if(0==arguments.length){for(var t=0;t<2;t++)for(var n=0;n<3;n++)if(this._depth[t][n]!==e.NULL_VALUE)return!1;return!0}if(1==arguments.length){var i=arguments[0];return this._depth[i][1]===e.NULL_VALUE}if(2==arguments.length){var r=arguments[0],s=arguments[1];return this._depth[r][s]===e.NULL_VALUE}}},{key:"normalize",value:function(){for(var t=0;t<2;t++)if(!this.isNull(t)){var e=this._depth[t][1];this._depth[t][2]<e&&(e=this._depth[t][2]),e<0&&(e=0);for(var n=1;n<3;n++){var i=0;this._depth[t][n]>e&&(i=1),this._depth[t][n]=i}}}},{key:"getDelta",value:function(t){return this._depth[t][K.RIGHT]-this._depth[t][K.LEFT]}},{key:"getLocation",value:function(t,e){return this._depth[t][e]<=0?B.EXTERIOR:B.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(1==arguments.length)for(var t=arguments[0],n=0;n<2;n++)for(var i=1;i<3;i++){var r=t.getLocation(n,i);r!==B.EXTERIOR&&r!==B.INTERIOR||(this.isNull(n,i)?this._depth[n][i]=e.depthAtLocation(r):this._depth[n][i]+=e.depthAtLocation(r))}else if(3==arguments.length){var s=arguments[0],a=arguments[1],o=arguments[2];o===B.INTERIOR&&this._depth[s][a]++}}}],[{key:"constructor_",value:function(){this._depth=[,,].fill().map(function(){return[,,,]});for(var t=0;t<2;t++)for(var n=0;n<3;n++)this._depth[t][n]=e.NULL_VALUE}},{key:"depthAtLocation",value:function(t){return t===B.EXTERIOR?0:t===B.INTERIOR?1:e.NULL_VALUE}}]),e}();nx.NULL_VALUE=-1;var nI=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var t=[,,].fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new a(t,ec.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(t){this._isIsolated=t}},{key:"setName",value:function(t){this._name=t}},{key:"equals",value:function(t){if(!(t instanceof a)||this.pts.length!==t.pts.length)return!1;for(var e=!0,n=!0,i=this.pts.length,r=0;r<this.pts.length;r++)if(this.pts[r].equals2D(t.pts[r])||(e=!1),this.pts[r].equals2D(t.pts[--i])||(n=!1),!e&&!n)return!1;return!0}},{key:"getCoordinate",value:function(){if(0==arguments.length)return this.pts.length>0?this.pts[0]:null;if(1==arguments.length){var t=arguments[0];return this.pts[t]}}},{key:"print",value:function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(")  "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(t){a.updateIM(this._label,t)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")}},{key:"getMonotoneChainEdge",value:function(){return null===this._mce&&(this._mce=new nk(this)),this._mce}},{key:"getEnvelope",value:function(){if(null===this._env){this._env=new z;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env}},{key:"addIntersection",value:function(t,e,n,i){var r=new q(t.getIntersection(i)),s=e,a=t.getEdgeDistance(n,i),o=s+1;if(o<this.pts.length){var u=this.pts[o];r.equals2D(u)&&(s=o,a=0)}this.eiList.add(r,s,a)}},{key:"toString",value:function(){var t=new tZ;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(")  "+this._label+" "+this._depthDelta),t.toString()}},{key:"isPointwiseEqual",value:function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0}},{key:"setDepthDelta",value:function(t){this._depthDelta=t}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++)this.addIntersection(t,e,n,i)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new nd(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new nx,this._depthDelta=0,1==arguments.length){var t=arguments[0];a.constructor_.call(this,t,null)}else if(2==arguments.length){var e=arguments[0],n=arguments[1];this.pts=e,this._label=n}}},{key:"updateIM",value:function(){if(!(2==arguments.length&&arguments[1]instanceof n_&&arguments[0]instanceof ec))return c(r(a),"updateIM",this).apply(this,arguments);var t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,K.ON),t.getLocation(1,K.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,K.LEFT),t.getLocation(1,K.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,K.RIGHT),t.getLocation(1,K.RIGHT),2))}}]),a}(ey),nE=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"setWorkingPrecisionModel",value:function(t){this._workingPrecisionModel=t}},{key:"insertUniqueEdge",value:function(t){var n=this._edgeList.findEqualEdge(t);if(null!==n){var i=n.getLabel(),r=t.getLabel();n.isPointwiseEqual(t)||(r=new ec(t.getLabel())).flip(),i.merge(r);var s=e.depthDelta(r),a=n.getDepthDelta()+s;n.setDepthDelta(a)}else this._edgeList.add(t),t.setDepthDelta(e.depthDelta(t.getLabel()))}},{key:"buildSubgraphs",value:function(t,e){for(var n=new tf,i=t.iterator();i.hasNext();){var r=i.next(),s=r.getRightmostCoordinate(),a=new nt(n).getDepth(s);r.computeDepth(a),r.findResultEdges(),n.add(r),e.add(r.getDirectedEdges(),r.getNodes())}}},{key:"createSubgraphs",value:function(t){for(var e=new tf,n=t.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var r=new tg;r.create(i),e.add(r)}}return eA.sort(e,eA.reverseOrder()),e}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new e3,n=new eo;return n.setPrecisionModel(t),e.setSegmentIntersector(new ng(n)),e}},{key:"buffer",value:function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var i=new ns(t,e,new e7(n,this._bufParams)).getCurves();if(0>=i.size())return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new eC(new nh),this._graph.addEdges(this._edgeList.getEdges());var r=this.createSubgraphs(this._graph),s=new eR(this._geomFact);this.buildSubgraphs(r,s);var a=s.getPolygons();return 0>=a.size()?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)}},{key:"computeNodedEdges",value:function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var i=n.getNodedSubstrings().iterator();i.hasNext();){var r=i.next(),s=r.getCoordinates();if(2!==s.length||!s[0].equals2D(s[1])){var a=r.getData(),o=new nI(r.getCoordinates(),new ec(a));this.insertUniqueEdge(o)}}}},{key:"setNoder",value:function(t){this._workingNoder=t}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new nf;var t=arguments[0];this._bufParams=t}},{key:"depthDelta",value:function(t){var e=t.getLocation(0,K.LEFT),n=t.getLocation(0,K.RIGHT);return e===B.INTERIOR&&n===B.EXTERIOR?1:e===B.EXTERIOR&&n===B.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(t){for(var e=new t2,n=new tf;t.hasNext();){var i=t.next(),r=e.createLineString(i.getCoordinates());n.add(r)}return e.buildGeometry(n)}}]),e}(),nN=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"rescale",value:function(){if(te(arguments[0],U))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var i=arguments[0],r=0;r<i.length;r++)i[r].x=i[r].x/this._scaleFactor+this._offsetX,i[r].y=i[r].y/this._scaleFactor+this._offsetY;2===i.length&&i[0].equals2D(i[1])&&td.out.println(i)}}},{key:"scale",value:function(){if(te(arguments[0],U)){for(var t=arguments[0],e=new tf(t.size()),n=t.iterator();n.hasNext();){var i=n.next();e.add(new eK(this.scale(i.getCoordinates()),i.getData()))}return e}if(arguments[0]instanceof Array){for(var r=arguments[0],s=Array(r.length).fill(null),a=0;a<r.length;a++)s[a]=new q(Math.round((r[a].x-this._offsetX)*this._scaleFactor),Math.round((r[a].y-this._offsetY)*this._scaleFactor),r[a].getZ());return tU.removeRepeatedPoints(s)}}},{key:"isIntegerPrecision",value:function(){return 1===this._scaleFactor}},{key:"getNodedSubstrings",value:function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t}},{key:"computeNodes",value:function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)}},{key:"interfaces_",get:function(){return[e1]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2==arguments.length){var t=arguments[0],n=arguments[1];e.constructor_.call(this,t,n,0,0)}else if(4==arguments.length){var i=arguments[0],r=arguments[1];this._noder=i,this._scaleFactor=r,this._isScaled=!this.isIntegerPrecision()}}}]),e}(),nT=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"checkEndPtVertexIntersections",value:function(){if(0==arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next().getCoordinates();this.checkEndPtVertexIntersections(e[0],this._segStrings),this.checkEndPtVertexIntersections(e[e.length-1],this._segStrings)}else if(2==arguments.length){for(var n=arguments[0],i=arguments[1],r=i.iterator();r.hasNext();)for(var s=r.next(),a=s.getCoordinates(),o=1;o<a.length-1;o++)if(a[o].equals(n))throw new M("found endpt/interior pt intersection at index "+o+" :pt "+n)}}},{key:"checkInteriorIntersections",value:function(){if(0==arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkInteriorIntersections(e,i)}else if(2==arguments.length)for(var r=arguments[0],s=arguments[1],a=r.getCoordinates(),o=s.getCoordinates(),u=0;u<a.length-1;u++)for(var l=0;l<o.length-1;l++)this.checkInteriorIntersections(r,u,s,l);else if(4==arguments.length){var h=arguments[0],c=arguments[1],f=arguments[2],v=arguments[3];if(h===f&&c===v)return null;var g=h.getCoordinates()[c],y=h.getCoordinates()[c+1],d=f.getCoordinates()[v],_=f.getCoordinates()[v+1];if(this._li.computeIntersection(g,y,d,_),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,y)||this.hasInteriorIntersection(this._li,d,_)))throw new M("found non-noded intersection at "+g+"-"+y+" and "+d+"-"+_)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(0==arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1==arguments.length)for(var n=arguments[0],i=n.getCoordinates(),r=0;r<i.length-2;r++)this.checkCollapse(i[r],i[r+1],i[r+2])}},{key:"hasInteriorIntersection",value:function(t,e,n){for(var i=0;i<t.getIntersectionNum();i++){var r=t.getIntersection(i);if(!r.equals(e)&&!r.equals(n))return!0}return!1}},{key:"checkCollapse",value:function(t,n,i){if(t.equals(i))throw new M("found non-noded collapse at "+e.fact.createLineString([t,n,i]))}}],[{key:"constructor_",value:function(){this._li=new eo,this._segStrings=null;var t=arguments[0];this._segStrings=t}}]),e}();nT.fact=new t2;var nS=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"intersectsScaled",value:function(t,e){var n=Math.min(t.x,e.x),i=Math.max(t.x,e.x),r=Math.min(t.y,e.y),s=Math.max(t.y,e.y),a=this._maxx<n||this._minx>i||this._maxy<r||this._miny>s;if(a)return!1;var o=this.intersectsToleranceSquare(t,e);return A.isTrue(!(a&&o),"Found bad envelope test"),o}},{key:"initCorners",value: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 q(this._maxx,this._maxy),this._corner[1]=new q(this._minx,this._maxy),this._corner[2]=new q(this._minx,this._miny),this._corner[3]=new q(this._maxx,this._miny)}},{key:"intersects",value: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))}},{key:"scale",value:function(t){return Math.round(t*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}},{key:"getSafeEnvelope",value:function(){if(null===this._safeEnv){var t=e.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new z(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}},{key:"intersectsPixelClosure",value: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())))}},{key:"intersectsToleranceSquare",value: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))))}},{key:"addSnappedNode",value:function(t,e){var n=t.getCoordinate(e),i=t.getCoordinate(e+1);return!!this.intersects(n,i)&&(t.addIntersection(this.getCoordinate(),e),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=[,,,,].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 p("Scale factor must be non-zero");1!==e&&(this._pt=new q(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new q,this._p1Scaled=new q),this.initCorners(this._pt)}}]),e}();nS.SAFE_ENV_EXPANSION_FACTOR=.75;var nL=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"select",value:function(){if(1==arguments.length);else if(2==arguments.length){var t=arguments[0],e=arguments[1];t.getLineSegment(e,this.selectedSegment),this.select(this.selectedSegment)}}}],[{key:"constructor_",value:function(){this.selectedSegment=new eJ}}]),e}(),nC=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"snap",value:function(){if(1==arguments.length){var e=arguments[0];return this.snap(e,null,-1)}if(3==arguments.length){var i=arguments[0],r=arguments[1],s=arguments[2],a=i.getSafeEnvelope(),o=new nR(i,r,s);return this._index.query(a,new(function(){function e(){t(this,e)}return n(e,[{key:"interfaces_",get:function(){return[eG]}},{key:"visitItem",value:function(t){t.select(a,o)}}]),e}())),o.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var t=arguments[0];this._index=t}}]),e}(),nR=function(e){i(a,e);var s=h(a);function a(){var e;return t(this,a),e=s.call(this),a.constructor_.apply(l(e),arguments),e}return n(a,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(2==arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof e$))return c(r(a.prototype),"select",this).apply(this,arguments);var t=arguments[0],e=arguments[1],n=t.getContext();if(this._parentEdge===n&&(e===this._hotPixelVertexIndex||e+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(n,e)}}],[{key:"constructor_",value:function(){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}}]),a}(nL);nC.HotPixelSnapAction=nR;var nO=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"processIntersections",value:function(t,e,n,i){if(t===n&&e===i)return null;var r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],a=n.getCoordinates()[i],o=n.getCoordinates()[i+1];if(this._li.computeIntersection(r,s,a,o),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),n.addIntersections(this._li,i,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[nv]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new tf}}]),e}(),nw=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"checkCorrectness",value:function(t){var e=new nT(eK.getNodedSubstrings(t));try{e.checkValid()}catch(t){if(!(t instanceof _))throw t;t.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return eK.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)}},{key:"findInteriorIntersections",value:function(t,e){var n=new nO(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(te(arguments[0],U))for(var t=arguments[0],e=t.iterator();e.hasNext();){var n=e.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof eK)for(var i=arguments[0],r=i.getCoordinates(),s=0;s<r.length;s++){var a=new nS(r[s],this._scaleFactor,this._li);this._pointSnapper.snap(a,i,s)&&i.addIntersection(r[s],s)}}},{key:"computeNodes",value:function(t){this._nodedSegStrings=t,this._noder=new e3,this._pointSnapper=new nC(this._noder.getIndex()),this.snapRound(t,this._li)}},{key:"computeIntersectionSnaps",value:function(t){for(var e=t.iterator();e.hasNext();){var n=new nS(e.next(),this._scaleFactor,this._li);this._pointSnapper.snap(n)}}},{key:"interfaces_",get:function(){return[e1]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new eo,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()}}]),e}(),nb=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return n(e,[{key:"bufferFixedPrecision",value:function(t){var e=new nN(new nw(new t$(1)),t.getScale()),n=new nE(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(0==arguments.length){for(var t=e.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(t){if(!(t instanceof th))throw t;this._saveException=t}if(null!==this._resultGeometry)return null}throw this._saveException}if(1==arguments.length){var n=arguments[0],i=new t$(e.precisionScaleFactor(this._argGeom,this._distance,n));this.bufferFixedPrecision(i)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===t$.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(t){this._bufParams.setQuadrantSegments(t)}},{key:"bufferOriginalPrecision",value:function(){try{var t=new nE(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof M))throw t;this._saveException=t}}},{key:"getResultGeometry",value:function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(t){this._bufParams.setEndCapStyle(t)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new d,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}}},{key:"bufferOp",value:function(){if(2==arguments.length){var t=arguments[0],n=arguments[1];return new e(t).getResultGeometry(n)}if(3==arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof X&&"number"==typeof arguments[1]){var i=arguments[0],r=arguments[1],s=arguments[2],a=new e(i);return a.setQuadrantSegments(s),a.getResultGeometry(r)}if(arguments[2]instanceof d&&arguments[0]instanceof X&&"number"==typeof arguments[1]){var o=arguments[0],u=arguments[1],l=arguments[2];return new e(o,l).getResultGeometry(u)}}else if(4==arguments.length){var h=arguments[0],c=arguments[1],f=arguments[2],v=arguments[3],g=new e(h);return g.setQuadrantSegments(f),g.setEndCapStyle(v),g.getResultGeometry(c)}}},{key:"precisionScaleFactor",value:function(t,e,n){var i=t.getEnvelopeInternal();return Math.pow(10,n-Math.trunc(Math.log(t_.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(e>0?e:0))/Math.log(10)+1))}}]),e}();nb.CAP_ROUND=d.CAP_ROUND,nb.CAP_BUTT=d.CAP_FLAT,nb.CAP_FLAT=d.CAP_FLAT,nb.CAP_SQUARE=d.CAP_SQUARE,nb.MAX_PRECISION_DIGITS=12;var nM=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],nP=function(){function e(n){t(this,e),this.geometryFactory=n||new t2}return n(e,[{key:"read",value:function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!nA[n])throw Error("Unknown GeoJSON type: "+e.type);return -1!==nM.indexOf(n)?nA[n].call(this,e.coordinates):"GeometryCollection"===n?nA[n].call(this,e.geometries):nA[n].call(this,e)}},{key:"write",value:function(t){var e=t.getGeometryType();if(!nD[e])throw Error("Geometry is not supported");return nD[e].call(this,t)}}]),e}(),nA={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){if(!nA[t.geometry.type])throw Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=nA.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.call(this,t.bbox)),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(o(q,f(i)))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new q(t[0],t[1]),new q(t[2],t[1]),new q(t[2],t[3]),new q(t[0],t[3]),new q(t[0],t[1])])},Point:function(t){var e=o(q,f(t));return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(nA.Point.call(this,t[n]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=nA.coordinates.call(this,t);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(nA.LineString.call(this,t[n]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=nA.coordinates.call(this,t[0]),n=this.geometryFactory.createLinearRing(e),i=[],r=1;r<t.length;++r){var s=t[r],a=nA.coordinates.call(this,s),o=this.geometryFactory.createLinearRing(a);i.push(o)}return this.geometryFactory.createPolygon(n,i)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(nA.Polygon.call(this,i))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var i=t[n];e.push(this.read(i))}return this.geometryFactory.createGeometryCollection(e)}},nD={coordinate:function(t){var e=[t.x,t.y];return t.z&&e.push(t.z),t.m&&e.push(t.m),e},Point:function(t){return{type:"Point",coordinates:nD.coordinate.call(this,t.getCoordinate())}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=nD.Point.call(this,i);e.push(r.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),i=0;i<n.length;++i){var r=n[i];e.push(nD.coordinate.call(this,r))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=nD.LineString.call(this,i);e.push(r.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=nD.LineString.call(this,t._shell);e.push(n.coordinates);for(var i=0;i<t._holes.length;++i){var r=t._holes[i],s=nD.LineString.call(this,r);e.push(s.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=nD.Polygon.call(this,i);e.push(r.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var i=t._geometries[n],r=i.getGeometryType();e.push(nD[r].call(this,i))}return{type:"GeometryCollection",geometries:e}}};return{BufferOp:nb,GeoJSONReader:function(){function e(n){t(this,e),this.parser=new nP(n||new t2)}return n(e,[{key:"read",value:function(t){return this.parser.read(t)}}]),e}(),GeoJSONWriter:function(){function e(){t(this,e),this.parser=new nP(this.geometryFactory)}return n(e,[{key:"write",value:function(t){return this.parser.write(t)}}]),e}()}},t.exports=e()}}]);