jsts
Version:
A JavaScript library of spatial predicates and functions for processing geometry
7 lines • 500 kB
JavaScript
/**
* JSTS. See https://github.com/bjornharrtell/jsts
* https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EDLv1.txt
* https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EPLv1.txt
* @license
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jsts={})}(this,(function(t){"use strict";class e{static equalsWithTolerance(t,e,s){return Math.abs(t-e)<=s}}class s extends Error{constructor(t){super(t),this.name=Object.keys({Exception:s})[0]}toString(){return this.message}}class n extends s{constructor(t){super(t),this.name=Object.keys({IllegalArgumentException:n})[0]}}class i{constructor(t,e){this.low=e||0,this.high=t||0}static toBinaryString(t){let e,s="";for(e=2147483648;e>0;e>>>=1)s+=(t.high&e)===e?"1":"0";for(e=2147483648;e>0;e>>>=1)s+=(t.low&e)===e?"1":"0";return s}}function r(){}function o(){}function l(){}r.NaN=NaN,r.isNaN=t=>Number.isNaN(t),r.isInfinite=t=>!Number.isFinite(t),r.MAX_VALUE=Number.MAX_VALUE,r.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,r.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,"function"==typeof Float64Array&&"function"==typeof Int32Array?function(){const t=2146435072,e=new Float64Array(1),s=new Int32Array(e.buffer);r.doubleToLongBits=function(n){e[0]=n;let r=0|s[0],o=0|s[1];return(o&t)===t&&1048575&o&&0!==r&&(r=0,o=2146959360),new i(o,r)},r.longBitsToDouble=function(t){return s[0]=t.low,s[1]=t.high,e[0]}}():function(){const t=1023,e=Math.log2,s=Math.floor,n=Math.pow,o=function(){for(let t=53;t>0;t--){const i=n(2,t)-1;if(s(e(i))+1===t)return i}return 0}();r.doubleToLongBits=function(r){let l,a,c,h,u,g,d,_,p;if(r<0||1/r===Number.NEGATIVE_INFINITY?(g=1<<31,r=-r):g=0,0===r)return p=0,_=g,new i(_,p);if(r===1/0)return p=0,_=2146435072|g,new i(_,p);if(r!=r)return p=0,_=2146959360,new i(_,p);if(h=0,p=0,l=s(r),l>1)if(l<=o)h=s(e(l)),h<=20?(p=0,_=l<<20-h&1048575):(c=h-20,a=n(2,c),p=l%a<<32-c,_=l/a&1048575);else for(c=l,p=0;a=c/2,c=s(a),0!==c;)h++,p>>>=1,p|=(1&_)<<31,_>>>=1,a!==c&&(_|=524288);if(d=h+t,u=0===l,l=r-l,h<52&&0!==l)for(c=0;;){if(a=2*l,a>=1?(l=a-1,u?(d--,u=!1):(c<<=1,c|=1,h++)):(l=a,u?0==--d&&(h++,u=!1):(c<<=1,h++)),20===h)_|=c,c=0;else if(52===h){p|=c;break}if(1===a){h<20?_|=c<<20-h:h<52&&(p|=c<<52-h);break}}return _|=d<<20,_|=g,new i(_,p)},r.longBitsToDouble=function(e){let s,i,r,o;const l=e.high,a=e.low,c=l&1<<31?-1:1;for(r=((2146435072&l)>>20)-t,o=0,i=1<<19,s=1;s<=20;s++)l&i&&(o+=n(2,-s)),i>>>=1;for(i=1<<31,s=21;s<=52;s++)a&i&&(o+=n(2,-s)),i>>>=1;if(-1023===r){if(0===o)return 0*c;r=-1022}else{if(1024===r)return 0===o?c/0:NaN;o+=1}return c*o*n(2,r)}}();class a extends s{constructor(t){super(t),this.name=Object.keys({RuntimeException:a})[0]}}class c extends a{constructor(){super(),c.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)a.constructor_.call(this);else if(1===arguments.length){const t=arguments[0];a.constructor_.call(this,t)}}}class h{static isTrue(){if(1===arguments.length){const t=arguments[0];h.isTrue(t,null)}else if(2===arguments.length){const t=arguments[1];if(!arguments[0])throw null===t?new c:new c(t)}}static shouldNeverReachHere(){if(0===arguments.length)h.shouldNeverReachHere(null);else if(1===arguments.length){const t=arguments[0];throw new c("Should never reach here"+(null!==t?": "+t:""))}}static equals(){if(2===arguments.length){const t=arguments[0],e=arguments[1];h.equals(t,e,null)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(!e.equals(t))throw new c("Expected "+t+" but encountered "+e+(null!==s?": "+s:""))}}}function u(){}function g(){}const d=new ArrayBuffer(8),_=new Float64Array(d),p=new Int32Array(d);class m{constructor(){m.constructor_.apply(this,arguments)}static constructor_(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)m.constructor_.call(this,0,0);else if(1===arguments.length){const t=arguments[0];m.constructor_.call(this,t.x,t.y,t.getZ())}else if(2===arguments.length){const t=arguments[0],e=arguments[1];m.constructor_.call(this,t,e,m.NULL_ORDINATE)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];this.x=t,this.y=e,this.z=s}}static hashCode(t){return _[0]=t,p[0]^p[1]}equals2D(){if(1===arguments.length){const t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){const t=arguments[0],s=arguments[1];return!!e.equalsWithTolerance(this.x,t.x,s)&&!!e.equalsWithTolerance(this.y,t.y,s)}}setM(t){throw new n("Invalid ordinate index: "+m.M)}equals3D(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||r.isNaN(this.getZ())&&r.isNaN(t.getZ()))}setX(t){this.x=t}compareTo(t){const e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0}getX(){return this.x}copy(){return new m(this)}toString(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}distance3D(t){const e=this.x-t.x,s=this.y-t.y,n=this.getZ()-t.getZ();return Math.sqrt(e*e+s*s+n*n)}getY(){return this.y}getM(){return r.NaN}setOrdinate(t,e){switch(t){case m.X:this.x=e;break;case m.Y:this.y=e;break;case m.Z:this.setZ(e);break;default:throw new n("Invalid ordinate index: "+t)}}getZ(){return this.z}getOrdinate(t){switch(t){case m.X:return this.x;case m.Y:return this.y;case m.Z:return this.getZ()}throw new n("Invalid ordinate index: "+t)}equals(t){return t instanceof m&&this.equals2D(t)}equalInZ(t,s){return e.equalsWithTolerance(this.getZ(),t.getZ(),s)}setZ(t){this.z=t}clone(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return h.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}setY(t){this.y=t}distance(t){const e=this.x-t.x,s=this.y-t.y;return Math.sqrt(e*e+s*s)}hashCode(){let t=17;return t=37*t+m.hashCode(this.x),t=37*t+m.hashCode(this.y),t}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}get interfaces_(){return[o,u,l]}}class f{constructor(){f.constructor_.apply(this,arguments)}static constructor_(){if(this._dimensionsToTest=2,0===arguments.length)f.constructor_.call(this,2);else if(1===arguments.length){const t=arguments[0];if(2!==t&&3!==t)throw new n("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}static compare(t,e){return t<e?-1:t>e?1:r.isNaN(t)?r.isNaN(e)?0:-1:r.isNaN(e)?1:0}compare(t,e){const s=f.compare(t.x,e.x);if(0!==s)return s;const n=f.compare(t.y,e.y);if(0!==n)return n;if(this._dimensionsToTest<=2)return 0;return f.compare(t.getZ(),e.getZ())}get interfaces_(){return[g]}}m.DimensionalComparator=f,m.NULL_ORDINATE=r.NaN,m.X=0,m.Y=1,m.Z=2,m.M=3;class y extends m{constructor(){super(),y.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)m.constructor_.call(this);else if(1===arguments.length){if(arguments[0]instanceof y){const t=arguments[0];m.constructor_.call(this,t.x,t.y)}else if(arguments[0]instanceof m){const t=arguments[0];m.constructor_.call(this,t.x,t.y)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];m.constructor_.call(this,t,e,m.NULL_ORDINATE)}}setOrdinate(t,e){switch(t){case y.X:this.x=e;break;case y.Y:this.y=e;break;default:throw new n("Invalid ordinate index: "+t)}}setZ(t){throw new n("CoordinateXY dimension 2 does not support z-ordinate")}copy(){return new y(this)}toString(){return"("+this.x+", "+this.y+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}getZ(){return m.NULL_ORDINATE}getOrdinate(t){switch(t){case y.X:return this.x;case y.Y:return this.y}throw new n("Invalid ordinate index: "+t)}}y.X=0,y.Y=1,y.Z=-1,y.M=-1;class x extends m{constructor(){super(),x.constructor_.apply(this,arguments)}static constructor_(){if(this._m=null,0===arguments.length)m.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof x){const t=arguments[0];m.constructor_.call(this,t.x,t.y),this._m=t._m}else if(arguments[0]instanceof m){const t=arguments[0];m.constructor_.call(this,t.x,t.y),this._m=this.getM()}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];m.constructor_.call(this,t,e,m.NULL_ORDINATE),this._m=s}}setM(t){this._m=t}setZ(t){throw new n("CoordinateXY dimension 2 does not support z-ordinate")}copy(){return new x(this)}toString(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}getM(){return this._m}setOrdinate(t,e){switch(t){case x.X:this.x=e;break;case x.Y:this.y=e;break;case x.M:this._m=e;break;default:throw new n("Invalid ordinate index: "+t)}}getZ(){return m.NULL_ORDINATE}getOrdinate(t){switch(t){case x.X:return this.x;case x.Y:return this.y;case x.M:return this._m}throw new n("Invalid ordinate index: "+t)}}x.X=0,x.Y=1,x.Z=-1,x.M=2;class E extends m{constructor(){super(),E.constructor_.apply(this,arguments)}static constructor_(){if(this._m=null,0===arguments.length)m.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof E){const t=arguments[0];m.constructor_.call(this,t),this._m=t._m}else if(arguments[0]instanceof m){const t=arguments[0];m.constructor_.call(this,t),this._m=this.getM()}}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];m.constructor_.call(this,t,e,s),this._m=n}}setM(t){this._m=t}getOrdinate(t){switch(t){case m.X:return this.x;case m.Y:return this.y;case m.Z:return this.getZ();case m.M:return this.getM()}throw new n("Invalid ordinate index: "+t)}copy(){return new E(this)}toString(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}getM(){return this._m}setOrdinate(t,e){switch(t){case m.X:this.x=e;break;case m.Y:this.y=e;break;case m.Z:this.z=e;break;case m.M:this._m=e;break;default:throw new n("Invalid ordinate index: "+t)}}}function I(t,e){return t.interfaces_&&t.interfaces_.indexOf(e)>-1}class N{add(){}addAll(){}isEmpty(){}iterator(){}size(){}toArray(){}remove(){}}class w extends s{constructor(t){super(t),this.name=Object.keys({IndexOutOfBoundsException:w})[0]}}class C extends N{get(){}set(){}isEmpty(){}}class S extends s{constructor(t){super(t),this.name=Object.keys({NoSuchElementException:S})[0]}}class L extends C{constructor(t){super(),this.array=[],t instanceof N&&this.addAll(t)}get interfaces_(){return[C,N]}ensureCapacity(){}add(t){return 1===arguments.length?this.array.push(t):this.array.splice(arguments[0],0,arguments[1]),!0}clear(){this.array=[]}addAll(t){for(const e of t)this.array.push(e)}set(t,e){const s=this.array[t];return this.array[t]=e,s}iterator(){return new T(this)}get(t){if(t<0||t>=this.size())throw new w;return this.array[t]}isEmpty(){return 0===this.array.length}sort(t){t?this.array.sort(((e,s)=>t.compare(e,s))):this.array.sort()}size(){return this.array.length}toArray(){return this.array.slice()}remove(t){for(let e=0,s=this.array.length;e<s;e++)if(this.array[e]===t)return!!this.array.splice(e,1);return!1}[Symbol.iterator](){return this.array.values()}}let T=class{constructor(t){this.arrayList=t,this.position=0}next(){if(this.position===this.arrayList.size())throw new S;return this.arrayList.get(this.position++)}hasNext(){return this.position<this.arrayList.size()}set(t){return this.arrayList.set(this.position-1,t)}remove(){this.arrayList.remove(this.arrayList.get(this.position))}};class R extends L{constructor(){super(),R.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length);else if(1===arguments.length){const t=arguments[0];this.ensureCapacity(t.length),this.add(t,!0)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.ensureCapacity(t.length),this.add(t,e)}}getCoordinate(t){return this.get(t)}addAll(){if(2===arguments.length&&"boolean"==typeof arguments[1]&&I(arguments[0],N)){const t=arguments[1];let e=!1;for(let s=arguments[0].iterator();s.hasNext();)this.add(s.next(),t),e=!0;return e}return super.addAll.apply(this,arguments)}clone(){const t=super.clone.call(this);for(let e=0;e<this.size();e++)t.add(e,this.get(e).clone());return t}closeRing(){if(this.size()>0){const t=this.get(0).copy();this.add(t,!1)}}toCoordinateArray(){if(0===arguments.length)return this.toArray(R.coordArrayType);if(1===arguments.length){if(arguments[0])return this.toArray(R.coordArrayType);const t=this.size(),e=new Array(t).fill(null);for(let s=0;s<t;s++)e[s]=this.get(t-s-1);return e}}add(){if(1===arguments.length){const t=arguments[0];return super.add.call(this,t)}if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return this.add(t,e,!0),!0}if(arguments[0]instanceof m&&"boolean"==typeof arguments[1]){const t=arguments[0];if(!arguments[1]&&this.size()>=1){if(this.get(this.size()-1).equals2D(t))return null}super.add.call(this,t)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return this.add(t,e),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];if(arguments[2])for(let s=0;s<t.length;s++)this.add(t[s],e);else for(let s=t.length-1;s>=0;s--)this.add(t[s],e);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1];if(!arguments[2]){const s=this.size();if(s>0){if(t>0){if(this.get(t-1).equals2D(e))return null}if(t<s){if(this.get(t).equals2D(e))return null}}}super.add.call(this,t,e)}}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];let i=1;s>n&&(i=-1);for(let r=s;r!==n;r+=i)this.add(t[r],e);return!0}}}R.coordArrayType=new Array(0).fill(null);class P{filter(t,e){}isGeometryChanged(){}isDone(){}}class O{constructor(){O.constructor_.apply(this,arguments)}static constructor_(){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 m){const t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof O){const t=arguments[0];this.init(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t.x,e.x,t.y,e.y)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];this.init(t,e,s,n)}}static intersects(){if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];return s.x>=(t.x<e.x?t.x:e.x)&&s.x<=(t.x>e.x?t.x:e.x)&&s.y>=(t.y<e.y?t.y:e.y)&&s.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];let i=Math.min(s.x,n.x),r=Math.max(s.x,n.x),o=Math.min(t.x,e.x),l=Math.max(t.x,e.x);return!(o>r)&&(!(l<i)&&(i=Math.min(s.y,n.y),r=Math.max(s.y,n.y),o=Math.min(t.y,e.y),l=Math.max(t.y,e.y),!(o>r)&&!(l<i)))}}getArea(){return this.getWidth()*this.getHeight()}getMinX(){return this._minx}expandToInclude(){if(1===arguments.length){if(arguments[0]instanceof m){const t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof O){const t=arguments[0];if(t.isNull())return null;this.isNull()?(this._minx=t.getMinX(),this._maxx=t.getMaxX(),this._miny=t.getMinY(),this._maxy=t.getMaxY()):(t._minx<this._minx&&(this._minx=t._minx),t._maxx>this._maxx&&(this._maxx=t._maxx),t._miny<this._miny&&(this._miny=t._miny),t._maxy>this._maxy&&(this._maxy=t._maxy))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.isNull()?(this._minx=t,this._maxx=t,this._miny=e,this._maxy=e):(t<this._minx&&(this._minx=t),t>this._maxx&&(this._maxx=t),e<this._miny&&(this._miny=e),e>this._maxy&&(this._maxy=e))}}compareTo(t){const e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0}translate(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}copy(){return new O(this)}expandBy(){if(1===arguments.length){const t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=e,this._maxy+=e,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}contains(){if(1===arguments.length){if(arguments[0]instanceof O){const t=arguments[0];return this.covers(t)}if(arguments[0]instanceof m){const t=arguments[0];return this.covers(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.covers(t,e)}}hashCode(){let t=17;return t=37*t+m.hashCode(this._minx),t=37*t+m.hashCode(this._maxx),t=37*t+m.hashCode(this._miny),t=37*t+m.hashCode(this._maxy),t}equals(t){if(!(t instanceof O))return!1;const e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()}intersection(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new O;const e=this._minx>t._minx?this._minx:t._minx,s=this._miny>t._miny?this._miny:t._miny,n=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new O(e,n,s,i)}isNull(){return this._maxx<this._minx}getMaxX(){return this._maxx}covers(){if(1===arguments.length){if(arguments[0]instanceof m){const t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof O){const t=arguments[0];return!this.isNull()&&!t.isNull()&&(t.getMinX()>=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];return!this.isNull()&&(t>=this._minx&&t<=this._maxx&&e>=this._miny&&e<=this._maxy)}}intersects(){if(1===arguments.length){if(arguments[0]instanceof O){const 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 m){const t=arguments[0];return this.intersects(t.x,t.y)}}else if(2===arguments.length){if(arguments[0]instanceof m&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1];if(this.isNull())return!1;if((t.x<e.x?t.x:e.x)>this._maxx)return!1;if((t.x>e.x?t.x:e.x)<this._minx)return!1;if((t.y<e.y?t.y:e.y)>this._maxy)return!1;return!((t.y>e.y?t.y:e.y)<this._miny)}if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return!this.isNull()&&!(t>this._maxx||t<this._minx||e>this._maxy||e<this._miny)}}}getMinY(){return this._miny}getDiameter(){if(this.isNull())return 0;const t=this.getWidth(),e=this.getHeight();return Math.sqrt(t*t+e*e)}minExtent(){if(this.isNull())return 0;const t=this.getWidth(),e=this.getHeight();return t<e?t:e}getWidth(){return this.isNull()?0:this._maxx-this._minx}toString(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}setToNull(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}disjoint(t){return!(!this.isNull()&&!t.isNull())||(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}getHeight(){return this.isNull()?0:this._maxy-this._miny}maxExtent(){if(this.isNull())return 0;const t=this.getWidth(),e=this.getHeight();return t>e?t:e}centre(){return this.isNull()?null:new m((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}init(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof m){const t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof O){const t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t.x,e.x,t.y,e.y)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];t<e?(this._minx=t,this._maxx=e):(this._minx=e,this._maxx=t),s<n?(this._miny=s,this._maxy=n):(this._miny=n,this._maxy=s)}}getMaxY(){return this._maxy}distance(t){if(this.intersects(t))return 0;let e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);let s=0;return this._maxy<t._miny?s=t._miny-this._maxy:this._miny>t._maxy&&(s=this._miny-t._maxy),0===e?s:0===s?e:Math.sqrt(e*e+s*s)}get interfaces_(){return[o,l]}}class v{constructor(t){this.str=t}append(t){this.str+=t}setCharAt(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}toString(){return this.str}}class M{constructor(t){this.value=t}intValue(){return this.value}compareTo(t){return this.value<t?-1:this.value>t?1:0}static compare(t,e){return t<e?-1:t>e?1:0}static isNan(t){return Number.isNaN(t)}static valueOf(t){return new M(t)}}class b{static isWhitespace(t){return t<=32&&t>=0||127===t}static toUpperCase(t){return t.toUpperCase()}}class D extends s{constructor(t){super(t),this.name=Object.keys({IllegalStateException:D})[0]}}class A{constructor(){A.constructor_.apply(this,arguments)}static constructor_(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){const t=arguments[0];this.init(t)}else if(arguments[0]instanceof A){const t=arguments[0];this.init(t)}else if("string"==typeof arguments[0]){const t=arguments[0];A.constructor_.call(this,A.parse(t))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t,e)}}static determinant(){if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3];return A.determinant(A.valueOf(t),A.valueOf(e),A.valueOf(s),A.valueOf(n))}if(arguments[3]instanceof A&&arguments[2]instanceof A&&arguments[0]instanceof A&&arguments[1]instanceof A){const t=arguments[1],e=arguments[2],s=arguments[3];return arguments[0].multiply(s).selfSubtract(t.multiply(e))}}static sqr(t){return A.valueOf(t).selfMultiply(t)}static valueOf(){if("string"==typeof arguments[0]){const t=arguments[0];return A.parse(t)}if("number"==typeof arguments[0]){return new A(arguments[0])}}static sqrt(t){return A.valueOf(t).sqrt()}static parse(t){let e=0;const s=t.length;for(;b.isWhitespace(t.charAt(e));)e++;let n=!1;if(e<s){const s=t.charAt(e);"-"!==s&&"+"!==s||(e++,"-"===s&&(n=!0))}const i=new A;let r=0,o=0,l=0,a=!1;for(;!(e>=s);){const s=t.charAt(e);if(e++,b.isDigit(s)){const t=s-"0";i.selfMultiply(A.TEN),i.selfAdd(t),r++}else{if("."!==s){if("e"===s||"E"===s){const s=t.substring(e);try{l=M.parseInt(s)}catch(e){throw e instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+s+" in string "+t):e}break}throw new NumberFormatException("Unexpected character '"+s+"' at position "+e+" in string "+t)}o=r,a=!0}}let c=i;a||(o=r);const h=r-o-l;if(0===h)c=i;else if(h>0){const t=A.TEN.pow(h);c=i.divide(t)}else if(h<0){const t=A.TEN.pow(-h);c=i.multiply(t)}return n?c.negate():c}static createNaN(){return new A(r.NaN,r.NaN)}static copy(t){return new A(t)}static magnitude(t){const e=Math.abs(t),s=Math.log(e)/Math.log(10);let n=Math.trunc(Math.floor(s));return 10*Math.pow(10,n)<=e&&(n+=1),n}static stringOfChar(t,e){const s=new v;for(let n=0;n<e;n++)s.append(t);return s.toString()}le(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo}extractSignificantDigits(t,e){let s=this.abs(),n=A.magnitude(s._hi);const i=A.TEN.pow(n);s=s.divide(i),s.gt(A.TEN)?(s=s.divide(A.TEN),n+=1):s.lt(A.ONE)&&(s=s.multiply(A.TEN),n-=1);const r=n+1,o=new v,l=A.MAX_PRINT_DIGITS-1;for(let e=0;e<=l;e++){t&&e===r&&o.append(".");const n=Math.trunc(s._hi);if(n<0)break;let i=!1,a=0;n>9?(i=!0,a="9"):a="0"+n,o.append(a),s=s.subtract(A.valueOf(n)).multiply(A.TEN),i&&s.selfAdd(A.TEN);let c=!0;const h=A.magnitude(s._hi);if(h<0&&Math.abs(h)>=l-e&&(c=!1),!c)break}return e[0]=n,o.toString()}sqr(){return this.multiply(this)}getSpecialNumberString(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}setValue(){if(arguments[0]instanceof A){const t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){const t=arguments[0];return this.init(t),this}}multiply(){if(arguments[0]instanceof A){const t=arguments[0];return t.isNaN()?A.createNaN():A.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){const t=arguments[0];return r.isNaN(t)?A.createNaN():A.copy(this).selfMultiply(t,0)}}isNaN(){return r.isNaN(this._hi)}reciprocal(){let t=null,e=null,s=null,n=null,i=null,r=null,o=null,l=null;i=1/this._hi,r=A.SPLIT*i,t=r-i,l=A.SPLIT*this._hi,t=r-t,e=i-t,s=l-this._hi,o=i*this._hi,s=l-s,n=this._hi-s,l=t*s-o+t*n+e*s+e*n,r=(1-o-l-i*this._lo)/this._hi;const a=i+r;return new A(a,i-a+r)}doubleValue(){return this._hi+this._lo}subtract(){if(arguments[0]instanceof A){const t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){const t=arguments[0];return this.add(-t)}}equals(){if(1===arguments.length&&arguments[0]instanceof A){const t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}isZero(){return 0===this._hi&&0===this._lo}selfSubtract(){if(arguments[0]instanceof A){const t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}}min(t){return this.le(t)?this:t}selfDivide(){if(1===arguments.length){if(arguments[0]instanceof A){const t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.selfDivide(t,0)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=null,n=null,i=null,r=null,o=null,l=null,a=null,c=null;return o=this._hi/t,l=A.SPLIT*o,s=l-o,c=A.SPLIT*t,s=l-s,n=o-s,i=c-t,a=o*t,i=c-i,r=t-i,c=s*i-a+s*r+n*i+n*r,l=(this._hi-a-c+this._lo-o*e)/t,c=o+l,this._hi=c,this._lo=o-c+l,this}}dump(){return"DD<"+this._hi+", "+this._lo+">"}divide(){if(arguments[0]instanceof A){const t=arguments[0];let e=null,s=null,n=null,i=null,r=null,o=null,l=null,a=null;r=this._hi/t._hi,o=A.SPLIT*r,e=o-r,a=A.SPLIT*t._hi,e=o-e,s=r-e,n=a-t._hi,l=r*t._hi,n=a-n,i=t._hi-n,a=e*n-l+e*i+s*n+s*i,o=(this._hi-l-a+this._lo-r*t._lo)/t._hi,a=r+o;return new A(a,r-a+o)}if("number"==typeof arguments[0]){const t=arguments[0];return r.isNaN(t)?A.createNaN():A.copy(this).selfDivide(t,0)}}ge(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}pow(t){if(0===t)return A.valueOf(1);let e=new A(this),s=A.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&s.selfMultiply(e),n/=2,n>0&&(e=e.sqr());else s=e;return t<0?s.reciprocal():s}ceil(){if(this.isNaN())return A.NaN;const t=Math.ceil(this._hi);let e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new A(t,e)}compareTo(t){const e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0}rint(){if(this.isNaN())return this;return this.add(.5).floor()}max(t){return this.ge(t)?this:t}sqrt(){if(this.isZero())return A.valueOf(0);if(this.isNegative())return A.NaN;const t=1/Math.sqrt(this._hi),e=this._hi*t,s=A.valueOf(e),n=this.subtract(s.sqr())._hi*(.5*t);return s.add(n)}selfAdd(){if(1===arguments.length){if(arguments[0]instanceof A){const t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];let e=null,s=null,n=null,i=null,r=null,o=null;return n=this._hi+t,r=n-this._hi,i=n-r,i=t-r+(this._hi-i),o=i+this._lo,e=n+o,s=o+(n-e),this._hi=e+s,this._lo=s+(e-this._hi),this}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=null,n=null,i=null,r=null,o=null,l=null,a=null,c=null;o=this._hi+t,i=this._lo+e,a=o-this._hi,c=i-this._lo,l=o-a,r=i-c,l=t-a+(this._hi-l),r=e-c+(this._lo-r),a=l+i,s=o+a,n=a+(o-s),a=r+n;const h=s+a,u=a+(s-h);return this._hi=h,this._lo=u,this}}selfMultiply(){if(1===arguments.length){if(arguments[0]instanceof A){const t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.selfMultiply(t,0)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let s=null,n=null,i=null,r=null,o=null,l=null;o=A.SPLIT*this._hi,s=o-this._hi,l=A.SPLIT*t,s=o-s,n=this._hi-s,i=l-t,o=this._hi*t,i=l-i,r=t-i,l=s*i-o+s*r+n*i+n*r+(this._hi*e+this._lo*t);const a=o+l;s=o-a;const c=l+s;return this._hi=a,this._lo=c,this}}selfSqr(){return this.selfMultiply(this)}floor(){if(this.isNaN())return A.NaN;const t=Math.floor(this._hi);let e=0;return t===this._hi&&(e=Math.floor(this._lo)),new A(t,e)}negate(){return this.isNaN()?this:new A(-this._hi,-this._lo)}clone(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}intValue(){return Math.trunc(this._hi)}toString(){const t=A.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}toStandardNotation(){const t=this.getSpecialNumberString();if(null!==t)return t;const e=new Array(1).fill(null),s=this.extractSignificantDigits(!0,e),n=e[0]+1;let i=s;if("."===s.charAt(0))i="0"+s;else if(n<0)i="0."+A.stringOfChar("0",-n)+s;else if(-1===s.indexOf(".")){const t=n-s.length;i=s+A.stringOfChar("0",t)+".0"}return this.isNegative()?"-"+i:i}toSciNotation(){if(this.isZero())return A.SCI_NOT_ZERO;const t=this.getSpecialNumberString();if(null!==t)return t;const e=new Array(1).fill(null),s=this.extractSignificantDigits(!1,e),n=A.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===s.charAt(0))throw new D("Found leading zero: "+s);let i="";s.length>1&&(i=s.substring(1));const r=s.charAt(0)+"."+i;return this.isNegative()?"-"+r+n:r+n}abs(){return this.isNaN()?A.NaN:this.isNegative()?this.negate():new A(this)}isPositive(){return this._hi>0||0===this._hi&&this._lo>0}lt(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<t._lo}add(){if(arguments[0]instanceof A){const t=arguments[0];return A.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){const t=arguments[0];return A.copy(this).selfAdd(t)}}init(){if(1===arguments.length){if("number"==typeof arguments[0]){const t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof A){const t=arguments[0];this._hi=t._hi,this._lo=t._lo}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._hi=t,this._lo=e}}gt(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>t._lo}isNegative(){return this._hi<0||0===this._hi&&this._lo<0}trunc(){return this.isNaN()?A.NaN:this.isPositive()?this.floor():this.ceil()}signum(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}get interfaces_(){return[l,o,u]}}A.PI=new A(3.141592653589793,12246467991473532e-32),A.TWO_PI=new A(6.283185307179586,24492935982947064e-32),A.PI_2=new A(1.5707963267948966,6123233995736766e-32),A.E=new A(2.718281828459045,14456468917292502e-32),A.NaN=new A(r.NaN,r.NaN),A.EPS=123259516440783e-46,A.SPLIT=134217729,A.MAX_PRINT_DIGITS=32,A.TEN=A.valueOf(10),A.ONE=A.valueOf(1),A.SCI_NOT_EXPONENT_CHAR="E",A.SCI_NOT_ZERO="0.0E0";class F{static orientationIndex(t,e,s){const n=F.orientationIndexFilter(t,e,s);if(n<=1)return n;const i=A.valueOf(e.x).selfAdd(-t.x),r=A.valueOf(e.y).selfAdd(-t.y),o=A.valueOf(s.x).selfAdd(-e.x),l=A.valueOf(s.y).selfAdd(-e.y);return i.selfMultiply(l).selfSubtract(r.selfMultiply(o)).signum()}static signOfDet2x2(){if(arguments[3]instanceof A&&arguments[2]instanceof A&&arguments[0]instanceof A&&arguments[1]instanceof A){const t=arguments[1],e=arguments[2],s=arguments[3];return arguments[0].multiply(s).selfSubtract(t.multiply(e)).signum()}if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=A.valueOf(t),r=A.valueOf(e),o=A.valueOf(s),l=A.valueOf(n);return i.multiply(l).selfSubtract(r.multiply(o)).signum()}}static intersection(t,e,s,n){const i=new A(t.y).selfSubtract(e.y),o=new A(e.x).selfSubtract(t.x),l=new A(t.x).selfMultiply(e.y).selfSubtract(new A(e.x).selfMultiply(t.y)),a=new A(s.y).selfSubtract(n.y),c=new A(n.x).selfSubtract(s.x),h=new A(s.x).selfMultiply(n.y).selfSubtract(new A(n.x).selfMultiply(s.y)),u=o.multiply(h).selfSubtract(c.multiply(l)),g=a.multiply(l).selfSubtract(i.multiply(h)),d=i.multiply(c).selfSubtract(a.multiply(o)),_=u.selfDivide(d).doubleValue(),p=g.selfDivide(d).doubleValue();return r.isNaN(_)||r.isInfinite(_)||r.isNaN(p)||r.isInfinite(p)?null:new m(_,p)}static orientationIndexFilter(t,e,s){let n=null;const i=(t.x-s.x)*(e.y-s.y),r=(t.y-s.y)*(e.x-s.x),o=i-r;if(i>0){if(r<=0)return F.signum(o);n=i+r}else{if(!(i<0))return F.signum(o);if(r>=0)return F.signum(o);n=-i-r}const l=F.DP_SAFE_EPSILON*n;return o>=l||-o>=l?F.signum(o):2}static signum(t){return t>0?1:t<0?-1:0}}F.DP_SAFE_EPSILON=1e-15;class G{getCoordinate(){}getCoordinateCopy(t){}createCoordinate(){}getDimension(){}hasM(){return this.getMeasures()>0}getX(t){}hasZ(){return this.getDimension()-this.getMeasures()>2}getMeasures(){return 0}expandEnvelope(t){}copy(){}getY(t){}toCoordinateArray(){}getM(t){if(this.hasM()){const e=this.getDimension()-this.getMeasures();return this.getOrdinate(t,e)}return r.NaN}setOrdinate(t,e,s){}getZ(t){return this.hasZ()?this.getOrdinate(t,2):r.NaN}size(){}getOrdinate(t,e){}get interfaces_(){return[u]}}G.X=0,G.Y=1,G.Z=2,G.M=3;class q{static isCCW(){if(arguments[0]instanceof Array){const t=arguments[0],e=t.length-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");let s=t[0],i=0;for(let n=1;n<=e;n++){const e=t[n];e.y>s.y&&(s=e,i=n)}let r=i;do{r-=1,r<0&&(r=e)}while(t[r].equals2D(s)&&r!==i);let o=i;do{o=(o+1)%e}while(t[o].equals2D(s)&&o!==i);const l=t[r],a=t[o];if(l.equals2D(s)||a.equals2D(s)||l.equals2D(a))return!1;const c=q.index(l,s,a);let h=null;return h=0===c?l.x>a.x:c>0,h}if(I(arguments[0],G)){const t=arguments[0],e=t.size()-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");let s=t.getCoordinate(0),i=0;for(let n=1;n<=e;n++){const e=t.getCoordinate(n);e.y>s.y&&(s=e,i=n)}let r=null,o=i;do{o-=1,o<0&&(o=e),r=t.getCoordinate(o)}while(r.equals2D(s)&&o!==i);let l=null,a=i;do{a=(a+1)%e,l=t.getCoordinate(a)}while(l.equals2D(s)&&a!==i);if(r.equals2D(s)||l.equals2D(s)||r.equals2D(l))return!1;const c=q.index(r,s,l);let h=null;return h=0===c?r.x>l.x:c>0,h}}static index(t,e,s){return F.orientationIndex(t,e,s)}}q.CLOCKWISE=-1,q.RIGHT=q.CLOCKWISE,q.COUNTERCLOCKWISE=1,q.LEFT=q.COUNTERCLOCKWISE,q.COLLINEAR=0,q.STRAIGHT=q.COLLINEAR;class B{static intersection(t,e,s,n){const i=t.x<e.x?t.x:e.x,o=t.y<e.y?t.y:e.y,l=t.x>e.x?t.x:e.x,a=t.y>e.y?t.y:e.y,c=s.x<n.x?s.x:n.x,h=s.y<n.y?s.y:n.y,u=s.x>n.x?s.x:n.x,g=s.y>n.y?s.y:n.y,d=((i>c?i:c)+(l<u?l:u))/2,_=((o>h?o:h)+(a<g?a:g))/2,p=t.x-d,f=t.y-_,y=e.x-d,x=e.y-_,E=s.x-d,I=s.y-_,N=n.x-d,w=n.y-_,C=f-x,S=y-p,L=p*x-y*f,T=I-w,R=N-E,P=E*w-N*I,O=C*R-T*S,v=(S*P-R*L)/O,M=(T*L-C*P)/O;return r.isNaN(v)||r.isInfinite(v)||r.isNaN(M)||r.isInfinite(M)?null:new m(v+d,M+_)}}class Y{static arraycopy(t,e,s,n,i){let r=0;for(let o=e;o<e+i;o++)s[n+r]=t[o],r++}static getProperty(t){return{"line.separator":"\n"}[t]}}class z{static log10(t){const e=Math.log(t);return r.isInfinite(e)||r.isNaN(e)?e:e/z.LOG_10}static min(t,e,s,n){let i=t;return e<i&&(i=e),s<i&&(i=s),n<i&&(i=n),i}static clamp(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],s=arguments[2];return t<e?e:t>s?s:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],s=arguments[2];return t<e?e:t>s?s:t}}static average(t,e){return(t+e)/2}static wrap(t,e){return t<0?e- -t%e:t%e}static max(){if(3===arguments.length){const t=arguments[1],e=arguments[2];let s=arguments[0];return t>s&&(s=t),e>s&&(s=e),s}if(4===arguments.length){const t=arguments[1],e=arguments[2],s=arguments[3];let n=arguments[0];return t>n&&(n=t),e>n&&(n=e),s>n&&(n=s),n}}}z.LOG_10=Math.log(10);class V{static pointToSegmentString(t,e){if(0===e.length)throw new n("Line array must contain at least one vertex");let s=t.distance(e[0]);for(let n=0;n<e.length-1;n++){const i=V.pointToSegment(t,e[n],e[n+1]);i<s&&(s=i)}return s}static segmentToSegment(t,e,s,n){if(t.equals(e))return V.pointToSegment(t,s,n);if(s.equals(n))return V.pointToSegment(n,t,e);let i=!1;if(O.intersects(t,e,s,n)){const r=(e.x-t.x)*(n.y-s.y)-(e.y-t.y)*(n.x-s.x);if(0===r)i=!0;else{const o=(t.y-s.y)*(n.x-s.x)-(t.x-s.x)*(n.y-s.y),l=((t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y))/r,a=o/r;(a<0||a>1||l<0||l>1)&&(i=!0)}}else i=!0;return i?z.min(V.pointToSegment(t,s,n),V.pointToSegment(e,s,n),V.pointToSegment(s,t,e),V.pointToSegment(n,t,e)):0}static pointToLinePerpendicular(t,e,s){const n=(s.x-e.x)*(s.x-e.x)+(s.y-e.y)*(s.y-e.y),i=((e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y))/n;return Math.abs(i)*Math.sqrt(n)}static pointToSegment(t,e,s){if(e.x===s.x&&e.y===s.y)return t.distance(e);const n=(s.x-e.x)*(s.x-e.x)+(s.y-e.y)*(s.y-e.y),i=((t.x-e.x)*(s.x-e.x)+(t.y-e.y)*(s.y-e.y))/n;if(i<=0)return t.distance(e);if(i>=1)return t.distance(s);const r=((e.y-t.y)*(s.x-e.x)-(e.x-t.x)*(s.y-e.y))/n;return Math.abs(r)*Math.sqrt(n)}}class k{static ofLine(t){const e=t.size();if(e<=1)return 0;let s=0;const n=new m;t.getCoordinate(0,n);let i=n.x,r=n.y;for(let o=1;o<e;o++){t.getCoordinate(o,n);const e=n.x,l=n.y,a=e-i,c=l-r;s+=Math.sqrt(a*a+c*c),i=e,r=l}return s}}class X{filter(t){}}class U extends s{constructor(t){super(t),this.name=Object.keys({UnsupportedOperationException:U})[0]}}class H{static measures(t){return t instanceof y?0:t instanceof x||t instanceof E?1:0}static create(){if(1===arguments.length){const t=arguments[0];return H.create(t,0)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return 2===t?new y:3===t&&0===e?new m:3===t&&1===e?new x:4===t&&1===e?new E:new m}}static dimension(t){return t instanceof y?2:t instanceof x?3:t instanceof E?4:3}}class W{static scroll(t,e){const s=W.indexOf(e,t);if(s<0)return null;const n=new Array(t.length).fill(null);Y.arraycopy(t,s,n,0,t.length-s),Y.arraycopy(t,0,n,t.length-s,s),Y.arraycopy(n,0,t,0,t.length)}static removeRepeatedPoints(t){if(!W.hasRepeatedPoints(t))return t;return new R(t,!1).toCoordinateArray()}static reverse(t){const e=t.length-1,s=Math.trunc(e/2);for(let n=0;n<=s;n++){const s=t[n];t[n]=t[e-n],t[e-n]=s}}static removeNull(t){let e=0;for(let s=0;s<t.length;s++)null!==t[s]&&e++;const s=new Array(e).fill(null);if(0===e)return s;let n=0;for(let e=0;e<t.length;e++)null!==t[e]&&(s[n++]=t[e]);return s}static copyDeep(){if(1===arguments.length){const t=arguments[0],e=new Array(t.length).fill(null);for(let s=0;s<t.length;s++)e[s]=t[s].copy();return e}if(5===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2],n=arguments[3],i=arguments[4];for(let r=0;r<i;r++)s[n+r]=t[e+r].copy()}}static isEqualReversed(t,e){for(let s=0;s<t.length;s++){const n=t[s],i=e[t.length-s-1];if(0!==n.compareTo(i))return!1}return!0}static envelope(t){const e=new O;for(let s=0;s<t.length;s++)e.expandToInclude(t[s]);return e}static extract(t,e,s){e=z.clamp(e,0,t.length);let n=(s=z.clamp(s,-1,t.length))-e+1;s<0&&(n=0),e>=t.length&&(n=0),s<e&&(n=0);const i=new Array(n).fill(null);if(0===n)return i;let r=0;for(let n=e;n<=s;n++)i[r++]=t[n];return i}static isRing(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])}static ptNotInList(t,e){for(let s=0;s<t.length;s++){const n=t[s];if(W.indexOf(n,e)<0)return n}return null}static equals(){if(2===arguments.length){const t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(let s=0;s<t.length;s++)if(!t[s].equals(e[s]))return!1;return!0}if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(0!==s.compare(t[n],e[n]))return!1;return!0}}static intersection(t,e){const s=new R;for(let n=0;n<t.length;n++)e.intersects(t[n])&&s.add(t[n],!0);return s.toCoordinateArray()}static measures(t){if(null===t||0===t.length)return 0;let e=0;for(const s of t)e=Math.max(e,H.measures(s));return e}static hasRepeatedPoints(t){for(let e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1}static toCoordinateArray(t){return t.toArray(W.coordArrayType)}static dimension(t){if(null===t||0===t.length)return 3;let e=0;for(const s of t)e=Math.max(e,H.dimension(s));return e}static atLeastNCoordinatesOrNothing(t,e){return e.length>=t?e:[]}static indexOf(t,e){for(let s=0;s<e.length;s++)if(t.equals(e[s]))return s;return-1}static increasingDirection(t){for(let e=0;e<Math.trunc(t.length/2);e++){const s=t.length-1-e,n=t[e].compareTo(t[s]);if(0!==n)return n}return 1}static compare(t,e){let s=0;for(;s<t.length&&s<e.length;){const n=t[s].compareTo(e[s]);if(0!==n)return n;s++}return s<e.length?-1:s<t.length?1:0}static minCoordinate(t){let e=null;for(let s=0;s<t.length;s++)(null===e||e.compareTo(t[s])>0)&&(e=t[s]);return e}}W.ForwardComparator=class{compare(t,e){const s=t,n=e;return W.compare(s,n)}get interfaces_(){return[g]}},W.BidirectionalComparator=class{compare(t,e){const s=t,n=e;if(s.length<n.length)return-1;if(s.length>n.length)return 1;if(0===s.length)return 0;const i=W.compare(s,n);return W.isEqualReversed(s,n)?0:i}OLDcompare(t,e){const s=t,n=e;if(s.length<n.length)return-1;if(s.length>n.length)return 1;if(0===s.length)return 0;const i=W.increasingDirection(s),r=W.increasingDirection(n);let o=i>0?0:s.length-1,l=r>0?0:s.length-1;for(let t=0;t<s.length;t++){const t=s[o].compareTo(n[l]);if(0!==t)return t;o+=i,l+=r}return 0}get interfaces_(){return[g]}},W.coordArrayType=new Array(0).fill(null);class Z{static toDimensionSymbol(t){switch(t){case Z.FALSE:return Z.SYM_FALSE;case Z.TRUE:return Z.SYM_TRUE;case Z.DONTCARE:return Z.SYM_DONTCARE;case Z.P:return Z.SYM_P;case Z.L:return Z.SYM_L;case Z.A:return Z.SYM_A}throw new n("Unknown dimension value: "+t)}static toDimensionValue(t){switch(b.toUpperCase(t)){case Z.SYM_FALSE:return Z.FALSE;case Z.SYM_TRUE:return Z.TRUE;case Z.SYM_DONTCARE:return Z.DONTCARE;case Z.SYM_P:return Z.P;case Z.SYM_L:return Z.L;case Z.SYM_A:return Z.A}throw new n("Unknown dimension symbol: "+t)}}Z.P=0,Z.L=1,Z.A=2,Z.FALSE=-1,Z.TRUE=-2,Z.DONTCARE=-3,Z.SYM_FALSE="F",Z.SYM_TRUE="T",Z.SYM_DONTCARE="*",Z.SYM_P="0",Z.SYM_L="1",Z.SYM_A="2";class j{constructor(){j.constructor_.apply(this,arguments)}isGeometryCollection(){return this.getTypeCode()===j.TYPECODE_GEOMETRYCOLLECTION}getFactory(){return this._factory}getGeometryN(t){return this}getArea(){return 0}isRectangle(){return!1}equalsExact(t){return this===t||this.equalsExact(t,0)}geometryChanged(){this.apply(j.geometryChangedFilter)}geometryChangedAction(){this._envelope=null}equalsNorm(t){return null!==t&&this.norm().equalsExact(t.norm())}getLength(){return 0}getNumGeometries(){return 1}compareTo(){let t;if(1===arguments.length){const 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){const e=arguments[0],s=arguments[1];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,s)}}getUserData(){return this._userData}getSRID(){return this._SRID}getEnvelope(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}static checkNotGeometryCollection(t){if(t.getTypeCode()===j.TYPECODE_GEOMETRYCOLLECTION)throw new n("This method does not support GeometryCollection arguments")}equal(t,e,s){return 0===s?t.equals(e):t.distance(e)<=s}norm(){const t=this.copy();return t.normalize(),t}reverse(){const t=this.reverseInternal();return null!=this.envelope&&(t.envelope=this.envelope.copy()),t.setSRID(this.getSRID()),t}copy(){const t=this.copyInternal();return t.envelope=null==this._envelope?null:this._envelope.copy(),t._SRID=this._SRID,t._userData=this._userData,t}getPrecisionModel(){return this._factory.getPrecisionModel()}getEnvelopeInternal(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new O(this._envelope)}setSRID(t){this._SRID=t}setUserData(t){this._userData=t}compare(t,e){const s=t.iterator(),n=e.iterator();for(;s.hasNext()&&n.hasNext();){const t=s.next(),e=n.next(),i=t.compareTo(e);if(0!==i)return i}return s.hasNext()?1:n.hasNext()?-1:0}hashCode(){return this.getEnvelopeInternal().hashCode()}isEquivalentClass(t){return this.getTypeCode()==t.getTypeCode()}get interfaces_(){return[u,o,l]}getClass(){return j}static hasNonEmptyElements(t){for(let e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1}static hasNullElements(t){for(let e=0;e<t.length;e++)if(null===t[e])return!0;return!1}}j.constructor_=function(t){t&&(this._envelope=null,this._userData=null,this._factory=t,this._SRID=t.getSRID())},j.TYPECODE_POINT=0,j.TYPECODE_MULTIPOINT=1,j.TYPECODE_LINESTRING=2,j.TYPECODE_LINEARRING=3,j.TYPECODE_MULTILINESTRING=4,j.TYPECODE_POLYGON=5,j.TYPECODE_MULTIPOLYGON=6,j.TYPECODE_GEOMETRYCOLLECTION=7,j.TYPENAME_POINT="Point",j.TYPENAME_MULTIPOINT="MultiPoint",j.TYPENAME_LINESTRING="LineString",j.TYPENAME_LINEARRING="LinearRing",j.TYPENAME_MULTILINESTRING="MultiLineString",j.TYPENAME_POLYGON="Polygon",j.TYPENAME_MULTIPOLYGON="MultiPolygon",j.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",j.geometryChangedFilter={get interfaces_(){return[X]},filter(t){t.geometryChangedAction()}};class K{filter(t){}}class Q{}class J{static scroll(){if(2===arguments.length){if(I(arguments[0],G)&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1];J.scroll(t,e,J.isRing(t))}else if(I(arguments[0],G)&&arguments[1]instanceof m){const t=arguments[0],e=arguments[1],s=J.indexOf(e,t);if(s<=0)return null;J.scroll(t,s)}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],s=arguments[2];if(e<=0)return null;const n=t.copy(),i=s?t.size()-1:t.size();for(let s=0;s<i;s++)for(let r=0;r<t.getDimension();r++)t.setOrdinate(s,r,n.getOrdinate((e+s)%i,r));if(s)for(let e=0;e<t.getDimension();e++)t.setOrdinate(i,e,t.getOrdinate(0,e))}}static isEqual(t,e){const s=t.size();if(s!==e.size())return!1;const n=Math.min(t.getDimension(),e.getDimension());for(let i=0;i<s;i++)for(let s=0;s<n;s++){const n=t.getOrdinate(i,s),o=e.getOrdinate(i,s);if(t.getOrdinate(i,s)!==e.getOrdinate(i,s)&&(!r.isNaN(n)||!r.isNaN(o)))return!1}return!0}static minCoordinateIndex(){if(1===arguments.length){const t=arguments[0];return J.minCoordinateIndex(t,0,t.size()-1)}if(3===arguments.length){const t=arguments[0],e=arguments[2];let s=-1,n=null;for(let i=arguments[1];i<=e;i++){const e=t.getCoordinate(i);(null===n||n.compareTo(e)>0)&&(n=e,s=i)}return s}}static extend(t,e,s){const n=t.create(s,e.getDimension()),i=e.size();if(J.copy(e,0,n,0,i),i>0)for(let t=i;t<s;t++)J.copy(e,i-1,n,t,1);return n}static reverse(t){const e=t.size()-1,s=Math.trunc(e/2);for(let n=0;n<=s;n++)J.swap(t,n,e-n)}static ensureValidRing(t,e){const s=e.size();if(0===s)return e;if(s<=3)return J.createClosedRing(t,e,4);return e.getOrdinate(0,G.X)===e.getOrdinate(s-1,G.X)&&e.getOrdinate(0,G.Y)===e.getOrdinate(s-1,G.Y)?e:J.createClosedRing(t,e,s+1)}static minCoordinate(t){let e=null;for(let s=0;s<t.size();s++){const n=t.getCoordinate(s);(null===e||e.compareTo(n)>0)&&(e=n)}return e}static copyCoord(t,e,s,n){const i=Math.min(t.getDimension(),s.getDimension());for(let r=0;r<i;r++)s.setOrdinate(n,r,t.getOrdinate(e,r))}static isRing(t){const e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,G.X)===t.getOrdinate(e-1,G.X)&&t.getOrdinate(0,G.Y)===t.getOrdinate(e-1,G.Y))}static swap(t,e,s){if(e===s)return null;for(let n=0;n<t.getDimension();n++){const i=t.getOrdinate(e,n);t.setOrdinate(e,n,t.getOrdinate(s,n)),t.setOrdinate(s,n,i)}}static copy(t,e,s,n,i){for(let r=0;r<i;r++)J.copyCoord(t,e+r,s,n+r)}static indexOf(t,e){for(let s=0;s<e.size();s++)if(t.x===e.getOrdinate(s,G.X)&&t.y===e.getOrdinate(s,G.Y))return s;return-1}static createClosedRing(t,e,s){const n=t.create(s,e.getDimension()),i=e.size();J.copy(e,0,n,0,i);for(let t=i;t<s;t++)J.copy(e,0,n,t,1);return n}}class ${filter(t){}}class tt extends j{constructor(){super(),tt.constructor_.apply(this,arguments)}static constructor_(){if(this._points=null,0===arguments.length);else if(2===arguments.length){const t=arguments[0],e=arguments[1];j.constructor_.call(this,e),this.init(t)}}computeEnvelopeInternal(){return this.isEmpty()?new O:this._points.expandEnvelope(new O)}isRing(){return this.isClosed()&&W.isRing(this.getCoordinates())}getCoordinates(){return this._points.toCoordinateArray()}copyInternal(){return new tt(this._points.copy(),this._factory)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof j){const t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;const s=t;if(this._points.size()!==s._points.size())return!1;for(let t=0;t<this._points.size();t++)if(!this.equal(this._points.getCoordinate(t),s._points.getCoordinate(t),e))return!1;return!0}return super.equalsExact.apply(this,arguments)}isClosed(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}reverseInternal(){const t=this._points.copy();return J.reverse(t),this.getFactory().createLineString(t)}getEndPoint(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}getTypeCode(){return j.TYPECODE_LINESTRING}getDimension(){return 1}getBoundary(){throw new U}isEquivalentClass(t){return t instanceof tt}getCoordinateSequence(){return this._points}getPointN(t){return this.getFactory().createPoint(this._points.getCoordinate(t))}normalize(){for(let t=0;t<Math.trunc(this._points.size()/2);t++){const 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){const t=this._points.copy();J.reverse(t),this._points=t}return null}}}getCoordinate(){return this.isEmpty()?null:this._points.getCoordinate(0)}getBoundaryDimension(){return this.isClosed()?Z.FALSE:0}getLength(){return k.ofLine(this._points)}getNumPoints(){return this._points.size()}compareToSameClass(){if(1===arguments.length){const t=arguments[0];let e=0,s=0;for(;e<this._points.size()&&s<t._points.size();){const n=this._points.getCoordinate(e).compareTo(t._points.getCoor