@swissgeo/coordinates 1.0.0-rc.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.ts +1 -12
- package/dist/index.js +8012 -18103
- package/dist/ol.cjs +1 -0
- package/dist/ol.d.ts +11 -0
- package/dist/ol.js +4467 -0
- package/dist/registerProj4-BuUOcPpF.cjs +23 -0
- package/dist/registerProj4-CwR_kPOz.js +10172 -0
- package/eslint.config.mts +12 -0
- package/index.html +14 -0
- package/package.json +30 -23
- package/setup-vitest.ts +8 -0
- package/src/DevApp.vue +66 -0
- package/src/__test__/coordinatesUtils.spec.ts +178 -0
- package/src/__test__/extentUtils.spec.ts +92 -0
- package/src/coordinatesUtils.ts +188 -0
- package/src/dev.ts +6 -0
- package/src/extentUtils.ts +196 -0
- package/src/index.ts +29 -0
- package/src/ol.ts +53 -0
- package/src/proj/CoordinateSystem.ts +315 -0
- package/src/proj/CoordinateSystemBounds.ts +170 -0
- package/src/proj/CustomCoordinateSystem.ts +58 -0
- package/src/proj/LV03CoordinateSystem.ts +23 -0
- package/src/proj/LV95CoordinateSystem.ts +35 -0
- package/src/proj/StandardCoordinateSystem.ts +22 -0
- package/src/proj/SwissCoordinateSystem.ts +233 -0
- package/src/proj/WGS84CoordinateSystem.ts +97 -0
- package/src/proj/WebMercatorCoordinateSystem.ts +89 -0
- package/src/proj/__test__/CoordinateSystem.spec.ts +63 -0
- package/src/proj/__test__/CoordinateSystemBounds.spec.ts +252 -0
- package/src/proj/__test__/SwissCoordinateSystem.spec.ts +136 -0
- package/src/proj/index.ts +65 -0
- package/src/proj/types.ts +22 -0
- package/src/registerProj4.ts +38 -0
- package/tsconfig.json +4 -0
- package/vite.config.ts +46 -0
- package/dist/index.umd.cjs +0 -29
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Y=require("./registerProj4-BuUOcPpF.cjs");function Rs(o,c,m){var v=o.length,l=de(o[0],c),k=[],N,g,A;let R,E;for(m||(m=[]),N=1;N<v;N++){for(R=o[N-1],E=o[N],g=A=de(E,c);;)if(l|g){if(l&g)break;l?(R=On(R,E,l,c),l=de(R,c)):(E=On(R,E,g,c),g=de(E,c))}else{k.push(R),g!==A?(k.push(E),N<v-1&&(m.push(k),k=[])):N===v-1&&k.push(E);break}l=A}return k.length&&m.push(k),m}function Os(o,c){var m,v,l,k,N,g,A;for(v=1;v<=8;v*=2){for(m=[],l=o[o.length-1],k=!(de(l,c)&v),N=0;N<o.length;N++)g=o[N],A=!(de(g,c)&v),A!==k&&m.push(On(l,g,v,c)),A&&m.push(g),l=g,k=A;if(o=m,!o.length)break}return m}function On(o,c,m,v){return m&8?[o[0]+(c[0]-o[0])*(v[3]-o[1])/(c[1]-o[1]),v[3]]:m&4?[o[0]+(c[0]-o[0])*(v[1]-o[1])/(c[1]-o[1]),v[1]]:m&2?[v[2],o[1]+(c[1]-o[1])*(v[2]-o[0])/(c[0]-o[0])]:m&1?[v[0],o[1]+(c[1]-o[1])*(v[0]-o[0])/(c[0]-o[0])]:null}function de(o,c){var m=0;return o[0]<c[0]?m|=1:o[0]>c[2]&&(m|=2),o[1]<c[1]?m|=4:o[1]>c[3]&&(m|=8),m}function Ms(o,c){const m=Y.getGeom(o),v=m.type,l=o.type==="Feature"?o.properties:{};let k=m.coordinates;switch(v){case"LineString":case"MultiLineString":{const N=[];return v==="LineString"&&(k=[k]),k.forEach(g=>{Rs(g,c,N)}),N.length===1?Y.lineString(N[0],l):Y.multiLineString(N,l)}case"Polygon":return Y.polygon(Pi(k,c),l);case"MultiPolygon":return Y.multiPolygon(k.map(N=>Pi(N,c)),l);default:throw new Error("geometry "+v+" not supported")}}function Pi(o,c){const m=[];for(const v of o){const l=Os(v,c);l.length>0&&((l[0][0]!==l[l.length-1][0]||l[0][1]!==l[l.length-1][1])&&l.push(l[0]),l.length>=4&&m.push(l))}return m}function As(o,c={}){const m=Y.bbox(o),v=(m[0]+m[2])/2,l=(m[1]+m[3])/2;return Y.point([v,l],c.properties,c)}var $e={exports:{}},Ps=$e.exports,bi;function bs(){return bi||(bi=1,function(o,c){(function(m,v){o.exports=v()})(Ps,function(){function m(i,t){(t==null||t>i.length)&&(t=i.length);for(var e=0,n=Array(t);e<t;e++)n[e]=i[e];return n}function v(i,t,e){return t=E(t),function(n,r){if(r&&(typeof r=="object"||typeof r=="function"))return r;if(r!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return function(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}(n)}(i,T()?Reflect.construct(t,e||[],E(i).constructor):t.apply(i,e))}function l(i,t){if(!(i instanceof t))throw new TypeError("Cannot call a class as a function")}function k(i,t,e){if(T())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,t);var r=new(i.bind.apply(i,n));return e&&w(r,e.prototype),r}function N(i,t){for(var e=0;e<t.length;e++){var n=t[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(i,V(n.key),n)}}function g(i,t,e){return t&&N(i.prototype,t),e&&N(i,e),Object.defineProperty(i,"prototype",{writable:!1}),i}function A(i,t){var e=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!e){if(Array.isArray(i)||(e=et(i))||t){e&&(i=e);var n=0,r=function(){};return{s:r,n:function(){return n>=i.length?{done:!0}:{done:!1,value:i[n++]}},e:function(h){throw h},f:r}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s,a=!0,u=!1;return{s:function(){e=e.call(i)},n:function(){var h=e.next();return a=h.done,h},e:function(h){u=!0,s=h},f:function(){try{a||e.return==null||e.return()}finally{if(u)throw s}}}}function R(){return R=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(i,t,e){var n=function(s,a){for(;!{}.hasOwnProperty.call(s,a)&&(s=E(s))!==null;);return s}(i,t);if(n){var r=Object.getOwnPropertyDescriptor(n,t);return r.get?r.get.call(arguments.length<3?i:e):r.value}},R.apply(null,arguments)}function E(i){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},E(i)}function x(i,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(t&&t.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),Object.defineProperty(i,"prototype",{writable:!1}),t&&w(i,t)}function T(){try{var i=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(T=function(){return!!i})()}function w(i,t){return w=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},w(i,t)}function I(i,t,e,n){var r=R(E(1&n?i.prototype:i),t,e);return 2&n&&typeof r=="function"?function(s){return r.apply(e,s)}:r}function Q(i){return function(t){if(Array.isArray(t))return m(t)}(i)||function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}(i)||et(i)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function V(i){var t=function(e,n){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var s=r.call(e,n);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(i,"string");return typeof t=="symbol"?t:t+""}function et(i,t){if(i){if(typeof i=="string")return m(i,t);var e={}.toString.call(i).slice(8,-1);return e==="Object"&&i.constructor&&(e=i.constructor.name),e==="Map"||e==="Set"?Array.from(i):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?m(i,t):void 0}}function U(i){var t=typeof Map=="function"?new Map:void 0;return U=function(e){if(e===null||!function(r){try{return Function.toString.call(r).indexOf("[native code]")!==-1}catch{return typeof r=="function"}}(e))return e;if(typeof e!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return k(e,arguments,E(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),w(n,e)},U(i)}var P=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(t){this._quadrantSegments=t,this._quadrantSegments===0&&(this._joinStyle=i.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=i.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==i.JOIN_ROUND&&(this._quadrantSegments=i.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=i.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=i.CAP_ROUND,this._joinStyle=i.JOIN_ROUND,this._mitreLimit=i.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=i.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var t=arguments[0];this.setQuadrantSegments(t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.setQuadrantSegments(e),this.setEndCapStyle(n)}else if(arguments.length===4){var r=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.setQuadrantSegments(r),this.setEndCapStyle(s),this.setJoinStyle(a),this.setMitreLimit(u)}}}},{key:"bufferDistanceError",value:function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)}}])}();P.CAP_ROUND=1,P.CAP_FLAT=2,P.CAP_SQUARE=3,P.JOIN_ROUND=1,P.JOIN_MITRE=2,P.JOIN_BEVEL=3,P.DEFAULT_QUADRANT_SEGMENTS=8,P.DEFAULT_MITRE_LIMIT=5,P.DEFAULT_SIMPLIFY_FACTOR=.01;var W=function(i){function t(e){var n;return l(this,t),(n=v(this,t,[e])).name=Object.keys({Exception:t})[0],n}return x(t,i),g(t,[{key:"toString",value:function(){return this.message}}])}(U(Error)),F=function(i){function t(e){var n;return l(this,t),(n=v(this,t,[e])).name=Object.keys({IllegalArgumentException:t})[0],n}return x(t,i),g(t)}(W),G=function(){return g(function i(){l(this,i)},[{key:"filter",value:function(i){}}])}();function z(){}function K(){}function q(){}var ft,ot,lt,_t,M,tt,ut,vt,kt=function(){return g(function i(){l(this,i)},null,[{key:"equalsWithTolerance",value:function(i,t,e){return Math.abs(i-t)<=e}}])}(),Et=function(){return g(function i(t,e){l(this,i),this.low=e||0,this.high=t||0},null,[{key:"toBinaryString",value:function(i){var t,e="";for(t=2147483648;t>0;t>>>=1)e+=(i.high&t)===t?"1":"0";for(t=2147483648;t>0;t>>>=1)e+=(i.low&t)===t?"1":"0";return e}}])}();function D(){}function Tt(){}D.NaN=NaN,D.isNaN=function(i){return Number.isNaN(i)},D.isInfinite=function(i){return!Number.isFinite(i)},D.MAX_VALUE=Number.MAX_VALUE,D.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,D.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(tt=2146435072,ut=new Float64Array(1),vt=new Int32Array(ut.buffer),D.doubleToLongBits=function(i){ut[0]=i;var t=0|vt[0],e=0|vt[1];return(e&tt)===tt&&1048575&e&&t!==0&&(t=0,e=2146959360),new Et(e,t)},D.longBitsToDouble=function(i){return vt[0]=i.low,vt[1]=i.high,ut[0]}):(ft=1023,ot=Math.log2,lt=Math.floor,_t=Math.pow,M=function(){for(var i=53;i>0;i--){var t=_t(2,i)-1;if(lt(ot(t))+1===i)return t}return 0}(),D.doubleToLongBits=function(i){var t,e,n,r,s,a,u,h,f;if(i<0||1/i===Number.NEGATIVE_INFINITY?(a=1<<31,i=-i):a=0,i===0)return new Et(h=a,f=0);if(i===1/0)return new Et(h=2146435072|a,f=0);if(i!=i)return new Et(h=2146959360,f=0);if(r=0,f=0,(t=lt(i))>1)if(t<=M)(r=lt(ot(t)))<=20?(f=0,h=t<<20-r&1048575):(f=t%(e=_t(2,n=r-20))<<32-n,h=t/e&1048575);else for(n=t,f=0;(n=lt(e=n/2))!==0;)r++,f>>>=1,f|=(1&h)<<31,h>>>=1,e!==n&&(h|=524288);if(u=r+ft,s=t===0,t=i-t,r<52&&t!==0)for(n=0;;){if((e=2*t)>=1?(t=e-1,s?(u--,s=!1):(n<<=1,n|=1,r++)):(t=e,s?--u==0&&(r++,s=!1):(n<<=1,r++)),r===20)h|=n,n=0;else if(r===52){f|=n;break}if(e===1){r<20?h|=n<<20-r:r<52&&(f|=n<<52-r);break}}return h|=u<<20,new Et(h|=a,f)},D.longBitsToDouble=function(i){var t,e,n,r,s=i.high,a=i.low,u=s&1<<31?-1:1;for(n=((2146435072&s)>>20)-ft,r=0,e=1<<19,t=1;t<=20;t++)s&e&&(r+=_t(2,-t)),e>>>=1;for(e=1<<31,t=21;t<=52;t++)a&e&&(r+=_t(2,-t)),e>>>=1;if(n===-1023){if(r===0)return 0*u;n=-1022}else{if(n===1024)return r===0?u/0:NaN;r+=1}return u*r*_t(2,n)});var xt=function(i){function t(e){var n;return l(this,t),(n=v(this,t,[e])).name=Object.keys({RuntimeException:t})[0],n}return x(t,i),g(t)}(W),wt=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,null,[{key:"constructor_",value:function(){if(arguments.length===0)xt.constructor_.call(this);else if(arguments.length===1){var e=arguments[0];xt.constructor_.call(this,e)}}}])}(xt),$=function(){function i(){l(this,i)}return g(i,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)i.shouldNeverReachHere(null);else if(arguments.length===1){var t=arguments[0];throw new wt("Should never reach here"+(t!==null?": "+t:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var t=arguments[0];i.isTrue(t,null)}else if(arguments.length===2){var e=arguments[1];if(!arguments[0])throw e===null?new wt:new wt(e)}}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];i.equals(t,e,null)}else if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2];if(!r.equals(n))throw new wt("Expected "+n+" but encountered "+r+(s!==null?": "+s:""))}}}])}(),Zt=new ArrayBuffer(8),xr=new Float64Array(Zt),qn=new Int32Array(Zt),p=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getM",value:function(){return D.NaN}},{key:"setOrdinate",value:function(t,e){switch(t){case i.X:this.x=e;break;case i.Y:this.y=e;break;case i.Z:this.setZ(e);break;default:throw new F("Invalid ordinate index: "+t)}}},{key:"equals2D",value:function(){if(arguments.length===1){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(arguments.length===2){var e=arguments[0],n=arguments[1];return!!kt.equalsWithTolerance(this.x,e.x,n)&&!!kt.equalsWithTolerance(this.y,e.y,n)}}},{key:"setM",value:function(t){throw new F("Invalid ordinate index: "+i.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(t){switch(t){case i.X:return this.x;case i.Y:return this.y;case i.Z:return this.getZ()}throw new F("Invalid ordinate index: "+t)}},{key:"equals3D",value:function(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||D.isNaN(this.getZ())&&D.isNaN(t.getZ()))}},{key:"equals",value:function(t){return t instanceof i&&this.equals2D(t)}},{key:"equalInZ",value:function(t,e){return kt.equalsWithTolerance(this.getZ(),t.getZ(),e)}},{key:"setX",value:function(t){this.x=t}},{key:"compareTo",value:function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0}},{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 $.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}},{key:"copy",value:function(){return new i(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,r=this.getZ()-t.getZ();return Math.sqrt(e*e+n*n+r*r)}},{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(){var t=17;return t=37*(t=37*t+i.hashCode(this.x))+i.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[z,K,q]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)i.constructor_.call(this,0,0);else if(arguments.length===1){var t=arguments[0];i.constructor_.call(this,t.x,t.y,t.getZ())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];i.constructor_.call(this,e,n,i.NULL_ORDINATE)}else if(arguments.length===3){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 xr[0]=t,qn[0]^qn[1]}}])}(),Ir=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"compare",value:function(t,e){var n=i.compare(t.x,e.x);if(n!==0)return n;var r=i.compare(t.y,e.y);return r!==0?r:this._dimensionsToTest<=2?0:i.compare(t.getZ(),e.getZ())}},{key:"interfaces_",get:function(){return[Tt]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)i.constructor_.call(this,2);else if(arguments.length===1){var t=arguments[0];if(t!==2&&t!==3)throw new F("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}},{key:"compare",value:function(t,e){return t<e?-1:t>e?1:D.isNaN(t)?D.isNaN(e)?0:-1:D.isNaN(e)?1:0}}])}();p.DimensionalComparator=Ir,p.NULL_ORDINATE=D.NaN,p.X=0,p.Y=1,p.Z=2,p.M=3;var gt=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(t){if(!(t instanceof i))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()}},{key:"intersection",value:function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new i;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny;return new i(e,this._maxx<t._maxx?this._maxx:t._maxx,n,this._maxy<t._maxy?this._maxy:t._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof p){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof i){var e=arguments[0];return!this.isNull()&&!e.isNull()&&e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof p){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(arguments.length===2){if(arguments[0]instanceof p&&arguments[1]instanceof p){var n=arguments[0],r=arguments[1];return!this.isNull()&&!((n.x<r.x?n.x:r.x)>this._maxx)&&!((n.x>r.x?n.x:r.x)<this._minx)&&!((n.y<r.y?n.y:r.y)>this._maxy)&&!((n.y>r.y?n.y:r.y)<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){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(arguments.length===1){if(arguments[0]instanceof p){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof i){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),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){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0}},{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 i(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(arguments.length===1){var t=arguments[0];this.expandBy(t,t)}else if(arguments.length===2){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(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof p){var e=arguments[0];return this.covers(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.covers(n,r)}}},{key:"centre",value:function(){return this.isNull()?null:new p((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof p){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof i){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var s=arguments[0],a=arguments[1],u=arguments[2],h=arguments[3];s<a?(this._minx=s,this._maxx=a):(this._minx=a,this._maxx=s),u<h?(this._miny=u,this._maxy=h):(this._miny=h,this._maxy=u)}}},{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),e===0?n:n===0?e:Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+p.hashCode(this._minx))+p.hashCode(this._maxx))+p.hashCode(this._miny))+p.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[z,q]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof p){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof i){var e=arguments[0];this.init(e)}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(arguments.length===4){var s=arguments[0],a=arguments[1],u=arguments[2],h=arguments[3];this.init(s,a,u,h)}}},{key:"intersects",value:function(){if(arguments.length===3){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(arguments.length===4){var r=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3],h=Math.min(a.x,u.x),f=Math.max(a.x,u.x),d=Math.min(r.x,s.x),_=Math.max(r.x,s.x);return!(d>f)&&!(_<h)&&(h=Math.min(a.y,u.y),f=Math.max(a.y,u.y),d=Math.min(r.y,s.y),_=Math.max(r.y,s.y),!(d>f)&&!(_<h))}}}])}(),B=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===i.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(i.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(t){return t!==null&&this.norm().equalsExact(t.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var t;if(arguments.length===1){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(arguments.length===2){var n=arguments[0],r=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,r)}}},{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()===i.TYPECODE_GEOMETRYCOLLECTION)throw new F("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(t,e,n){return n===0?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 this.envelope!=null&&(t.envelope=this.envelope.copy()),t.setSRID(this.getSRID()),t}},{key:"copy",value:function(){var t=this.copyInternal();return t.envelope=this._envelope==null?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 this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new gt(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(),r=e.iterator();n.hasNext()&&r.hasNext();){var s=n.next(),a=r.next(),u=s.compareTo(a);if(u!==0)return u}return n.hasNext()?1:r.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()===i.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===i.TYPECODE_MULTIPOINT||this.getTypeCode()===i.TYPECODE_MULTILINESTRING||this.getTypeCode()===i.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[K,z,q]}},{key:"getClass",value:function(){return i}}],[{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(t[e]===null)return!0;return!1}}])}();B.constructor_=function(i){i&&(this._envelope=null,this._userData=null,this._factory=i,this._SRID=i.getSRID())},B.TYPECODE_POINT=0,B.TYPECODE_MULTIPOINT=1,B.TYPECODE_LINESTRING=2,B.TYPECODE_LINEARRING=3,B.TYPECODE_MULTILINESTRING=4,B.TYPECODE_POLYGON=5,B.TYPECODE_MULTIPOLYGON=6,B.TYPECODE_GEOMETRYCOLLECTION=7,B.TYPENAME_POINT="Point",B.TYPENAME_MULTIPOINT="MultiPoint",B.TYPENAME_LINESTRING="LineString",B.TYPENAME_LINEARRING="LinearRing",B.TYPENAME_MULTILINESTRING="MultiLineString",B.TYPENAME_POLYGON="Polygon",B.TYPENAME_MULTIPOLYGON="MultiPolygon",B.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",B.geometryChangedFilter={get interfaces_(){return[G]},filter:function(i){i.geometryChangedAction()}};var y=function(){function i(){l(this,i)}return g(i,null,[{key:"toLocationSymbol",value:function(t){switch(t){case i.EXTERIOR:return"e";case i.BOUNDARY:return"b";case i.INTERIOR:return"i";case i.NONE:return"-"}throw new F("Unknown location value: "+t)}}])}();y.INTERIOR=0,y.BOUNDARY=1,y.EXTERIOR=2,y.NONE=-1;var Yt=function(){return g(function i(){l(this,i)},[{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(){}}])}(),De=function(i){function t(e){var n;return l(this,t),(n=v(this,t,[e])).name=Object.keys({NoSuchElementException:t})[0],n}return x(t,i),g(t)}(W),Jt=function(i){function t(e){var n;return l(this,t),(n=v(this,t,[e])).name=Object.keys({UnsupportedOperationException:t})[0],n}return x(t,i),g(t)}(W),Yn=function(i){function t(){return l(this,t),v(this,t,arguments)}return x(t,i),g(t,[{key:"contains",value:function(){}}])}(Yt),on=function(i){function t(e){var n;return l(this,t),(n=v(this,t)).map=new Map,e instanceof Yt&&n.addAll(e),n}return x(t,i),g(t,[{key:"contains",value:function(e){var n=e.hashCode?e.hashCode():e;return!!this.map.has(n)}},{key:"add",value:function(e){var n=e.hashCode?e.hashCode():e;return!this.map.has(n)&&!!this.map.set(n,e)}},{key:"addAll",value:function(e){var n,r=A(e);try{for(r.s();!(n=r.n()).done;){var s=n.value;this.add(s)}}catch(a){r.e(a)}finally{r.f()}return!0}},{key:"remove",value:function(){throw new Jt}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new Nr(this.map)}},{key:Symbol.iterator,value:function(){return this.map}}])}(Yn),Nr=function(){return g(function i(t){l(this,i),this.iterator=t.values();var e=this.iterator.next(),n=e.done,r=e.value;this.done=n,this.value=r},[{key:"next",value:function(){if(this.done)throw new De;var i=this.value,t=this.iterator.next(),e=t.done,n=t.value;return this.done=e,this.value=n,i}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new Jt}}])}(),C=function(){function i(){l(this,i)}return g(i,null,[{key:"opposite",value:function(t){return t===i.LEFT?i.RIGHT:t===i.RIGHT?i.LEFT:t}}])}();C.ON=0,C.LEFT=1,C.RIGHT=2;var zn=function(i){function t(e){var n;return l(this,t),(n=v(this,t,[e])).name=Object.keys({EmptyStackException:t})[0],n}return x(t,i),g(t)}(W),Bn=function(i){function t(e){var n;return l(this,t),(n=v(this,t,[e])).name=Object.keys({IndexOutOfBoundsException:t})[0],n}return x(t,i),g(t)}(W),ee=function(i){function t(){return l(this,t),v(this,t,arguments)}return x(t,i),g(t,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}])}(Yt),Sr=function(i){function t(){var e;return l(this,t),(e=v(this,t)).array=[],e}return x(t,i),g(t,[{key:"add",value:function(e){return this.array.push(e),!0}},{key:"get",value:function(e){if(e<0||e>=this.size())throw new Bn;return this.array[e]}},{key:"push",value:function(e){return this.array.push(e),e}},{key:"pop",value:function(){if(this.array.length===0)throw new zn;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new zn;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(e){return this.array.indexOf(e)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])}(ee);function J(i,t){return i.interfaces_&&i.interfaces_.indexOf(t)>-1}var xe=function(){return g(function i(t){l(this,i),this.str=t},[{key:"append",value:function(i){this.str+=i}},{key:"setCharAt",value:function(i,t){this.str=this.str.substr(0,i)+t+this.str.substr(i+1)}},{key:"toString",value:function(){return this.str}}])}(),Fe=function(){function i(t){l(this,i),this.value=t}return g(i,[{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 i(t)}}])}(),ln=function(){return g(function i(){l(this,i)},null,[{key:"isWhitespace",value:function(i){return i<=32&&i>=0||i===127}},{key:"toUpperCase",value:function(i){return i.toUpperCase()}}])}(),Z=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"le",value:function(t){return this._hi<t._hi||this._hi===t._hi&&this._lo<=t._lo}},{key:"extractSignificantDigits",value:function(t,e){var n=this.abs(),r=i.magnitude(n._hi),s=i.TEN.pow(r);(n=n.divide(s)).gt(i.TEN)?(n=n.divide(i.TEN),r+=1):n.lt(i.ONE)&&(n=n.multiply(i.TEN),r-=1);for(var a=r+1,u=new xe,h=i.MAX_PRINT_DIGITS-1,f=0;f<=h;f++){t&&f===a&&u.append(".");var d=Math.trunc(n._hi);if(d<0)break;var _=!1,S=0;d>9?(_=!0,S="9"):S="0"+d,u.append(S),n=n.subtract(i.valueOf(d)).multiply(i.TEN),_&&n.selfAdd(i.TEN);var O=!0,b=i.magnitude(n._hi);if(b<0&&Math.abs(b)>=h-f&&(O=!1),!O)break}return e[0]=r,u.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 i){var t=arguments[0];return this.add(t.negate())}if(typeof arguments[0]=="number"){var e=arguments[0];return this.add(-e)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof i){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,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(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfDivide(e,0)}}else if(arguments.length===2){var n,r,s,a,u=arguments[0],h=arguments[1],f=null,d=null,_=null,S=null;return s=this._hi/u,S=(f=(_=i.SPLIT*s)-(f=_-s))*(d=(S=i.SPLIT*u)-(d=S-u))-(a=s*u)+f*(r=u-d)+(n=s-f)*d+n*r,S=s+(_=(this._hi-a-S+this._lo-s*h)/u),this._hi=S,this._lo=s-S+_,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof i){var t,e,n,r,s=arguments[0],a=null,u=null,h=null,f=null;return t=(n=this._hi/s._hi)-(a=(h=i.SPLIT*n)-(a=h-n)),f=a*(u=(f=i.SPLIT*s._hi)-(u=f-s._hi))-(r=n*s._hi)+a*(e=s._hi-u)+t*u+t*e,new i(f=n+(h=(this._hi-r-f+this._lo-n*s._lo)/s._hi),n-f+h)}if(typeof arguments[0]=="number"){var d=arguments[0];return D.isNaN(d)?i.createNaN():i.copy(this).selfDivide(d,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(t===0)return i.valueOf(1);var e=new i(this),n=i.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n}},{key:"ceil",value:function(){if(this.isNaN())return i.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new i(t,e)}},{key:"compareTo",value:function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return this.init(t),this}if(typeof arguments[0]=="number"){var e=arguments[0];return this.init(e),this}}},{key:"max",value:function(t){return this.ge(t)?this:t}},{key:"sqrt",value:function(){if(this.isZero())return i.valueOf(0);if(this.isNegative())return i.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=i.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e,n,r,s,a,u=arguments[0],h=null;return h=(r=this._hi+u)-(s=r-this._hi),n=(a=(h=u-s+(this._hi-h))+this._lo)+(r-(e=r+a)),this._hi=e+n,this._lo=n+(e-this._hi),this}}else if(arguments.length===2){var f,d,_,S,O=arguments[0],b=arguments[1],X=null,rt=null,nt=null;_=this._hi+O,d=this._lo+b,rt=_-(nt=_-this._hi),X=d-(S=d-this._lo);var ht=(f=_+(nt=(rt=O-nt+(this._hi-rt))+d))+(nt=(X=b-S+(this._lo-X))+(nt+(_-f))),Nt=nt+(f-ht);return this._hi=ht,this._lo=Nt,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof i){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if(typeof arguments[0]=="number"){var e=arguments[0];return this.selfMultiply(e,0)}}else if(arguments.length===2){var n,r,s=arguments[0],a=arguments[1],u=null,h=null,f=null,d=null;u=(f=i.SPLIT*this._hi)-this._hi,d=i.SPLIT*s,u=f-u,n=this._hi-u,h=d-s;var _=(f=this._hi*s)+(d=u*(h=d-h)-f+u*(r=s-h)+n*h+n*r+(this._hi*a+this._lo*s)),S=d+(u=f-_);return this._hi=_,this._lo=S,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return i.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new i(t,e)}},{key:"negate",value:function(){return this.isNaN()?this:new i(-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 i){var t=arguments[0];return t.isNaN()?i.createNaN():i.copy(this).selfMultiply(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return D.isNaN(e)?i.createNaN():i.copy(this).selfMultiply(e,0)}}},{key:"isNaN",value:function(){return D.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var t=i.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,s=n;if(n.charAt(0)===".")s="0"+n;else if(r<0)s="0."+i.stringOfChar("0",-r)+n;else if(n.indexOf(".")===-1){var a=r-n.length;s=n+i.stringOfChar("0",a)+".0"}return this.isNegative()?"-"+s:s}},{key:"reciprocal",value:function(){var t,e,n,r,s=null,a=null,u=null,h=null;t=(n=1/this._hi)-(s=(u=i.SPLIT*n)-(s=u-n)),a=(h=i.SPLIT*this._hi)-this._hi;var f=n+(u=(1-(r=n*this._hi)-(h=s*(a=h-a)-r+s*(e=this._hi-a)+t*a+t*e)-n*this._lo)/this._hi);return new i(f,n-f+u)}},{key:"toSciNotation",value:function(){if(this.isZero())return i.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(t!==null)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=i.SCI_NOT_EXPONENT_CHAR+e[0];if(n.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+n);var s="";n.length>1&&(s=n.substring(1));var a=n.charAt(0)+"."+s;return this.isNegative()?"-"+a+r:a+r}},{key:"abs",value:function(){return this.isNaN()?i.NaN:this.isNegative()?this.negate():new i(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&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 i){var t=arguments[0];return i.copy(this).selfAdd(t)}if(typeof arguments[0]=="number"){var e=arguments[0];return i.copy(this).selfAdd(e)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof i){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this._hi=n,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||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?i.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[q,z,K]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof i){var e=arguments[0];this.init(e)}else if(typeof arguments[0]=="string"){var n=arguments[0];i.constructor_.call(this,i.parse(n))}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];this.init(r,s)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];return i.determinant(i.valueOf(t),i.valueOf(e),i.valueOf(n),i.valueOf(r))}if(arguments[3]instanceof i&&arguments[2]instanceof i&&arguments[0]instanceof i&&arguments[1]instanceof i){var s=arguments[1],a=arguments[2],u=arguments[3];return arguments[0].multiply(u).selfSubtract(s.multiply(a))}}},{key:"sqr",value:function(t){return i.valueOf(t).selfMultiply(t)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var t=arguments[0];return i.parse(t)}if(typeof arguments[0]=="number")return new i(arguments[0])}},{key:"sqrt",value:function(t){return i.valueOf(t).sqrt()}},{key:"parse",value:function(t){for(var e=0,n=t.length;ln.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var s=t.charAt(e);s!=="-"&&s!=="+"||(e++,s==="-"&&(r=!0))}for(var a=new i,u=0,h=0,f=0,d=!1;!(e>=n);){var _=t.charAt(e);if(e++,ln.isDigit(_)){var S=_-"0";a.selfMultiply(i.TEN),a.selfAdd(S),u++}else{if(_!=="."){if(_==="e"||_==="E"){var O=t.substring(e);try{f=Fe.parseInt(O)}catch(ht){throw ht instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+O+" in string "+t):ht}break}throw new NumberFormatException("Unexpected character '"+_+"' at position "+e+" in string "+t)}h=u,d=!0}}var b=a;d||(h=u);var X=u-h-f;if(X===0)b=a;else if(X>0){var rt=i.TEN.pow(X);b=a.divide(rt)}else if(X<0){var nt=i.TEN.pow(-X);b=a.multiply(nt)}return r?b.negate():b}},{key:"createNaN",value:function(){return new i(D.NaN,D.NaN)}},{key:"copy",value:function(t){return new i(t)}},{key:"magnitude",value:function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r}},{key:"stringOfChar",value:function(t,e){for(var n=new xe,r=0;r<e;r++)n.append(t);return n.toString()}}])}();Z.PI=new Z(3.141592653589793,12246467991473532e-32),Z.TWO_PI=new Z(6.283185307179586,24492935982947064e-32),Z.PI_2=new Z(1.5707963267948966,6123233995736766e-32),Z.E=new Z(2.718281828459045,14456468917292502e-32),Z.NaN=new Z(D.NaN,D.NaN),Z.EPS=123259516440783e-46,Z.SPLIT=134217729,Z.MAX_PRINT_DIGITS=32,Z.TEN=Z.valueOf(10),Z.ONE=Z.valueOf(1),Z.SCI_NOT_EXPONENT_CHAR="E",Z.SCI_NOT_ZERO="0.0E0";var hn=function(){function i(){l(this,i)}return g(i,null,[{key:"orientationIndex",value:function(t,e,n){var r=i.orientationIndexFilter(t,e,n);if(r<=1)return r;var s=Z.valueOf(e.x).selfAdd(-t.x),a=Z.valueOf(e.y).selfAdd(-t.y),u=Z.valueOf(n.x).selfAdd(-e.x),h=Z.valueOf(n.y).selfAdd(-e.y);return s.selfMultiply(h).selfSubtract(a.selfMultiply(u)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof Z&&arguments[2]instanceof Z&&arguments[0]instanceof Z&&arguments[1]instanceof Z){var t=arguments[1],e=arguments[2],n=arguments[3];return arguments[0].multiply(n).selfSubtract(t.multiply(e)).signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3],h=Z.valueOf(r),f=Z.valueOf(s),d=Z.valueOf(a),_=Z.valueOf(u);return h.multiply(_).selfSubtract(f.multiply(d)).signum()}}},{key:"intersection",value:function(t,e,n,r){var s=new Z(t.y).selfSubtract(e.y),a=new Z(e.x).selfSubtract(t.x),u=new Z(t.x).selfMultiply(e.y).selfSubtract(new Z(e.x).selfMultiply(t.y)),h=new Z(n.y).selfSubtract(r.y),f=new Z(r.x).selfSubtract(n.x),d=new Z(n.x).selfMultiply(r.y).selfSubtract(new Z(r.x).selfMultiply(n.y)),_=a.multiply(d).selfSubtract(f.multiply(u)),S=h.multiply(u).selfSubtract(s.multiply(d)),O=s.multiply(f).selfSubtract(h.multiply(a)),b=_.selfDivide(O).doubleValue(),X=S.selfDivide(O).doubleValue();return D.isNaN(b)||D.isInfinite(b)||D.isNaN(X)||D.isInfinite(X)?null:new p(b,X)}},{key:"orientationIndexFilter",value:function(t,e,n){var r=null,s=(t.x-n.x)*(e.y-n.y),a=(t.y-n.y)*(e.x-n.x),u=s-a;if(s>0){if(a<=0)return i.signum(u);r=s+a}else{if(!(s<0)||a>=0)return i.signum(u);r=-s-a}var h=i.DP_SAFE_EPSILON*r;return u>=h||-u>=h?i.signum(u):2}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}}])}();hn.DP_SAFE_EPSILON=1e-15;var it=function(){return g(function i(){l(this,i)},[{key:"getM",value:function(i){if(this.hasM()){var t=this.getDimension()-this.getMeasures();return this.getOrdinate(i,t)}return D.NaN}},{key:"setOrdinate",value:function(i,t,e){}},{key:"getZ",value:function(i){return this.hasZ()?this.getOrdinate(i,2):D.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(i,t){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(i){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(i){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(i){}},{key:"copy",value:function(){}},{key:"getY",value:function(i){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[K]}}])}();it.X=0,it.Y=1,it.Z=2,it.M=3;var j=function(){function i(){l(this,i)}return g(i,null,[{key:"index",value:function(t,e,n){return hn.orientationIndex(t,e,n)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var t=arguments[0],e=t.length-1;if(e<3)throw new F("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,s=1;s<=e;s++){var a=t[s];a.y>n.y&&(n=a,r=s)}var u=r;do(u-=1)<0&&(u=e);while(t[u].equals2D(n)&&u!==r);var h=r;do h=(h+1)%e;while(t[h].equals2D(n)&&h!==r);var f=t[u],d=t[h];if(f.equals2D(n)||d.equals2D(n)||f.equals2D(d))return!1;var _=i.index(f,n,d);return _===0?f.x>d.x:_>0}if(J(arguments[0],it)){var S=arguments[0],O=S.size()-1;if(O<3)throw new F("Ring has fewer than 4 points, so orientation cannot be determined");for(var b=S.getCoordinate(0),X=0,rt=1;rt<=O;rt++){var nt=S.getCoordinate(rt);nt.y>b.y&&(b=nt,X=rt)}var ht=null,Nt=X;do(Nt-=1)<0&&(Nt=O),ht=S.getCoordinate(Nt);while(ht.equals2D(b)&&Nt!==X);var St=null,oe=X;do oe=(oe+1)%O,St=S.getCoordinate(oe);while(St.equals2D(b)&&oe!==X);if(ht.equals2D(b)||St.equals2D(b)||ht.equals2D(St))return!1;var Oe=i.index(ht,b,St);return Oe===0?ht.x>St.x:Oe>0}}}])}();j.CLOCKWISE=-1,j.RIGHT=j.CLOCKWISE,j.COUNTERCLOCKWISE=1,j.LEFT=j.COUNTERCLOCKWISE,j.COLLINEAR=0,j.STRAIGHT=j.COLLINEAR;var Tr=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(i,t){var e=this.getRightmostSideOfSegment(i,t);return e<0&&(e=this.getRightmostSideOfSegment(i,t-1)),e<0&&(this._minCoord=null,this.checkForRightmostCoordinate(i)),e}},{key:"findRightmostEdgeAtVertex",value:function(){var i=this._minDe.getEdge().getCoordinates();$.isTrue(this._minIndex>0&&this._minIndex<i.length,"rightmost point expected to be interior vertex of edge");var t=i[this._minIndex-1],e=i[this._minIndex+1],n=j.index(this._minCoord,e,t),r=!1;(t.y<this._minCoord.y&&e.y<this._minCoord.y&&n===j.COUNTERCLOCKWISE||t.y>this._minCoord.y&&e.y>this._minCoord.y&&n===j.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(i,t){var e=i.getEdge().getCoordinates();if(t<0||t+1>=e.length||e[t].y===e[t+1].y)return-1;var n=C.LEFT;return e[t].y<e[t+1].y&&(n=C.RIGHT),n}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(i){for(var t=i.getEdge().getCoordinates(),e=0;e<t.length-1;e++)(this._minCoord===null||t[e].x>this._minCoord.x)&&(this._minDe=i,this._minIndex=e,this._minCoord=t[e])}},{key:"findRightmostEdgeAtNode",value:function(){var i=this._minDe.getNode().getEdges();this._minDe=i.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(i){for(var t=i.iterator();t.hasNext();){var e=t.next();e.isForward()&&this.checkForRightmostCoordinate(e)}$.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===C.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])}(),Wt=function(i){function t(e,n){var r;return l(this,t),(r=v(this,t,[n?e+" [ "+n+" ]":e])).pt=n?new p(n):void 0,r.name=Object.keys({TopologyException:t})[0],r}return x(t,i),g(t,[{key:"getCoordinate",value:function(){return this.pt}}])}(xt),Cr=function(){return g(function i(){l(this,i),this.array=[]},[{key:"addLast",value:function(i){this.array.push(i)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])}(),H=function(i){function t(e){var n;return l(this,t),(n=v(this,t)).array=[],e instanceof Yt&&n.addAll(e),n}return x(t,i),g(t,[{key:"interfaces_",get:function(){return[ee,Yt]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(e){return arguments.length===1?this.array.push(e):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(e){var n,r=A(e);try{for(r.s();!(n=r.n()).done;){var s=n.value;this.array.push(s)}}catch(a){r.e(a)}finally{r.f()}}},{key:"set",value:function(e,n){var r=this.array[e];return this.array[e]=n,r}},{key:"iterator",value:function(){return new wr(this)}},{key:"get",value:function(e){if(e<0||e>=this.size())throw new Bn;return this.array[e]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(e){e?this.array.sort(function(n,r){return e.compare(n,r)}):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(e){for(var n=0,r=this.array.length;n<r;n++)if(this.array[n]===e)return!!this.array.splice(n,1);return!1}},{key:Symbol.iterator,value:function(){return this.array.values()}}])}(ee),wr=function(){return g(function i(t){l(this,i),this.arrayList=t,this.position=0},[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new De;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(i){return this.arrayList.set(this.position-1,i)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}])}(),Lr=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"clearVisitedEdges",value:function(){for(var i=this._dirEdgeList.iterator();i.hasNext();)i.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(i){for(var t=null,e=i.getEdges().iterator();e.hasNext();){var n=e.next();if(n.isVisited()||n.getSym().isVisited()){t=n;break}}if(t===null)throw new Wt("unable to find edge to compute depths at "+i.getCoordinate());i.getEdges().computeDepths(t);for(var r=i.getEdges().iterator();r.hasNext();){var s=r.next();s.setVisited(!0),this.copySymDepths(s)}}},{key:"computeDepth",value:function(i){this.clearVisitedEdges();var t=this._finder.getEdge();t.getNode(),t.getLabel(),t.setEdgeDepths(C.RIGHT,i),this.copySymDepths(t),this.computeDepths(t)}},{key:"create",value:function(i){this.addReachable(i),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var i=this._dirEdgeList.iterator();i.hasNext();){var t=i.next();t.getDepth(C.RIGHT)>=1&&t.getDepth(C.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}}},{key:"computeDepths",value:function(i){var t=new on,e=new Cr,n=i.getNode();for(e.addLast(n),t.add(n),i.setVisited(!0);!e.isEmpty();){var r=e.removeFirst();t.add(r),this.computeNodeDepth(r);for(var s=r.getEdges().iterator();s.hasNext();){var a=s.next().getSym();if(!a.isVisited()){var u=a.getNode();t.contains(u)||(e.addLast(u),t.add(u))}}}}},{key:"compareTo",value:function(i){var t=i;return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var i=new gt,t=this._dirEdgeList.iterator();t.hasNext();)for(var e=t.next().getEdge().getCoordinates(),n=0;n<e.length-1;n++)i.expandToInclude(e[n]);this._env=i}return this._env}},{key:"addReachable",value:function(i){var t=new Sr;for(t.add(i);!t.empty();){var e=t.pop();this.add(e,t)}}},{key:"copySymDepths",value:function(i){var t=i.getSym();t.setDepth(C.LEFT,i.getDepth(C.RIGHT)),t.setDepth(C.RIGHT,i.getDepth(C.LEFT))}},{key:"add",value:function(i,t){i.setVisited(!0),this._nodes.add(i);for(var e=i.getEdges().iterator();e.hasNext();){var n=e.next();this._dirEdgeList.add(n);var r=n.getSym().getNode();r.isVisited()||t.push(r)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[z]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new H,this._nodes=new H,this._rightMostCoord=null,this._env=null,this._finder=new Tr}}])}(),cn=function(){return g(function i(){l(this,i)},null,[{key:"intersection",value:function(i,t,e,n){var r=i.x<t.x?i.x:t.x,s=i.y<t.y?i.y:t.y,a=i.x>t.x?i.x:t.x,u=i.y>t.y?i.y:t.y,h=e.x<n.x?e.x:n.x,f=e.y<n.y?e.y:n.y,d=e.x>n.x?e.x:n.x,_=e.y>n.y?e.y:n.y,S=((r>h?r:h)+(a<d?a:d))/2,O=((s>f?s:f)+(u<_?u:_))/2,b=i.x-S,X=i.y-O,rt=t.x-S,nt=t.y-O,ht=e.x-S,Nt=e.y-O,St=n.x-S,oe=n.y-O,Oe=X-nt,wi=rt-b,Li=b*nt-rt*X,Ri=Nt-oe,Oi=St-ht,Mi=ht*oe-St*Nt,Ai=Oe*Oi-Ri*wi,Cn=(wi*Mi-Oi*Li)/Ai,wn=(Ri*Li-Oe*Mi)/Ai;return D.isNaN(Cn)||D.isInfinite(Cn)||D.isNaN(wn)||D.isInfinite(wn)?null:new p(Cn+S,wn+O)}}])}(),Mt=function(){return g(function i(){l(this,i)},null,[{key:"arraycopy",value:function(i,t,e,n,r){for(var s=0,a=t;a<t+r;a++)e[n+s]=i[a],s++}},{key:"getProperty",value:function(i){return{"line.separator":`
|
|
4
|
+
`}[i]}}])}(),Ie=function(){function i(){l(this,i)}return g(i,null,[{key:"log10",value:function(t){var e=Math.log(t);return D.isInfinite(e)||D.isNaN(e)?e:e/i.LOG_10}},{key:"min",value:function(t,e,n,r){var s=t;return e<s&&(s=e),n<s&&(s=n),r<s&&(s=r),s}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){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 r=arguments[0],s=arguments[1],a=arguments[2];return r<s?s:r>a?a:r}}},{key:"wrap",value:function(t,e){return t<0?e- -t%e:t%e}},{key:"max",value:function(){if(arguments.length===3){var t=arguments[1],e=arguments[2],n=arguments[0];return t>n&&(n=t),e>n&&(n=e),n}if(arguments.length===4){var r=arguments[1],s=arguments[2],a=arguments[3],u=arguments[0];return r>u&&(u=r),s>u&&(u=s),a>u&&(u=a),u}}},{key:"average",value:function(t,e){return(t+e)/2}}])}();Ie.LOG_10=Math.log(10);var zt=function(){function i(){l(this,i)}return g(i,null,[{key:"segmentToSegment",value:function(t,e,n,r){if(t.equals(e))return i.pointToSegment(t,n,r);if(n.equals(r))return i.pointToSegment(r,t,e);var s=!1;if(gt.intersects(t,e,n,r)){var a=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(a===0)s=!0;else{var u=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),h=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/a,f=u/a;(f<0||f>1||h<0||h>1)&&(s=!0)}}else s=!0;return s?Ie.min(i.pointToSegment(t,n,r),i.pointToSegment(e,n,r),i.pointToSegment(n,t,e),i.pointToSegment(r,t,e)):0}},{key:"pointToSegment",value:function(t,e,n){if(e.x===n.x&&e.y===n.y)return t.distance(e);var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),s=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;if(s<=0)return t.distance(e);if(s>=1)return t.distance(n);var a=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(a)*Math.sqrt(r)}},{key:"pointToLinePerpendicular",value:function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),s=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(s)*Math.sqrt(r)}},{key:"pointToSegmentString",value:function(t,e){if(e.length===0)throw new F("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var s=i.pointToSegment(t,e[r],e[r+1]);s<n&&(n=s)}return n}}])}(),Xn=function(){return g(function i(){l(this,i)},[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||J(arguments[0],it);else if(arguments.length!==2){if(arguments.length===3){var i=arguments[0],t=arguments[1];return this.create(i,t)}}}}])}(),Ge=function(){return g(function i(){l(this,i)},[{key:"filter",value:function(i){}}])}(),Rr=function(){return g(function i(){l(this,i)},null,[{key:"ofLine",value:function(i){var t=i.size();if(t<=1)return 0;var e=0,n=new p;i.getCoordinate(0,n);for(var r=n.x,s=n.y,a=1;a<t;a++){i.getCoordinate(a,n);var u=n.x,h=n.y,f=u-r,d=h-s;e+=Math.sqrt(f*f+d*d),r=u,s=h}return e}}])}(),Un=g(function i(){l(this,i)}),ne=function(){function i(){l(this,i)}return g(i,null,[{key:"copyCoord",value:function(t,e,n,r){for(var s=Math.min(t.getDimension(),n.getDimension()),a=0;a<s;a++)n.setOrdinate(r,a,t.getOrdinate(e,a))}},{key:"isRing",value:function(t){var e=t.size();return e===0||!(e<=3)&&t.getOrdinate(0,it.X)===t.getOrdinate(e-1,it.X)&&t.getOrdinate(0,it.Y)===t.getOrdinate(e-1,it.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(J(arguments[0],it)&&Number.isInteger(arguments[1])){var t=arguments[0],e=arguments[1];i.scroll(t,e,i.isRing(t))}else if(J(arguments[0],it)&&arguments[1]instanceof p){var n=arguments[0],r=arguments[1],s=i.indexOf(r,n);if(s<=0)return null;i.scroll(n,s)}}else if(arguments.length===3){var a=arguments[0],u=arguments[1],h=arguments[2];if(u<=0)return null;for(var f=a.copy(),d=h?a.size()-1:a.size(),_=0;_<d;_++)for(var S=0;S<a.getDimension();S++)a.setOrdinate(_,S,f.getOrdinate((u+_)%d,S));if(h)for(var O=0;O<a.getDimension();O++)a.setOrdinate(d,O,a.getOrdinate(0,O))}}},{key:"isEqual",value:function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),s=0;s<n;s++)for(var a=0;a<r;a++){var u=t.getOrdinate(s,a),h=e.getOrdinate(s,a);if(t.getOrdinate(s,a)!==e.getOrdinate(s,a)&&(!D.isNaN(u)||!D.isNaN(h)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var t=arguments[0];return i.minCoordinateIndex(t,0,t.size()-1)}if(arguments.length===3){for(var e=arguments[0],n=arguments[2],r=-1,s=null,a=arguments[1];a<=n;a++){var u=e.getCoordinate(a);(s===null||s.compareTo(u)>0)&&(s=u,r=a)}return r}}},{key:"extend",value:function(t,e,n){var r=t.create(n,e.getDimension()),s=e.size();if(i.copy(e,0,r,0,s),s>0)for(var a=s;a<n;a++)i.copy(e,s-1,r,a,1);return r}},{key:"reverse",value:function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)i.swap(t,r,e-r)}},{key:"swap",value:function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var s=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,s)}}},{key:"copy",value:function(t,e,n,r,s){for(var a=0;a<s;a++)i.copyCoord(t,e+a,n,r+a)}},{key:"ensureValidRing",value:function(t,e){var n=e.size();return n===0?e:n<=3?i.createClosedRing(t,e,4):e.getOrdinate(0,it.X)===e.getOrdinate(n-1,it.X)&&e.getOrdinate(0,it.Y)===e.getOrdinate(n-1,it.Y)?e:i.createClosedRing(t,e,n+1)}},{key:"indexOf",value:function(t,e){for(var n=0;n<e.size();n++)if(t.x===e.getOrdinate(n,it.X)&&t.y===e.getOrdinate(n,it.Y))return n;return-1}},{key:"createClosedRing",value:function(t,e,n){var r=t.create(n,e.getDimension()),s=e.size();i.copy(e,0,r,0,s);for(var a=s;a<n;a++)i.copy(e,0,r,a,1);return r}},{key:"minCoordinate",value:function(t){for(var e=null,n=0;n<t.size();n++){var r=t.getCoordinate(n);(e===null||e.compareTo(r)>0)&&(e=r)}return e}}])}(),L=function(){function i(){l(this,i)}return g(i,null,[{key:"toDimensionSymbol",value:function(t){switch(t){case i.FALSE:return i.SYM_FALSE;case i.TRUE:return i.SYM_TRUE;case i.DONTCARE:return i.SYM_DONTCARE;case i.P:return i.SYM_P;case i.L:return i.SYM_L;case i.A:return i.SYM_A}throw new F("Unknown dimension value: "+t)}},{key:"toDimensionValue",value:function(t){switch(ln.toUpperCase(t)){case i.SYM_FALSE:return i.FALSE;case i.SYM_TRUE:return i.TRUE;case i.SYM_DONTCARE:return i.DONTCARE;case i.SYM_P:return i.P;case i.SYM_L:return i.L;case i.SYM_A:return i.A}throw new F("Unknown dimension symbol: "+t)}}])}();L.P=0,L.L=1,L.A=2,L.FALSE=-1,L.TRUE=-2,L.DONTCARE=-3,L.SYM_FALSE="F",L.SYM_TRUE="T",L.SYM_DONTCARE="*",L.SYM_P="0",L.SYM_L="1",L.SYM_A="2";var qe=function(){return g(function i(){l(this,i)},[{key:"filter",value:function(i){}}])}(),Ye=function(){return g(function i(){l(this,i)},[{key:"filter",value:function(i,t){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])}(),Ne=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new gt:this._points.expandEnvelope(new gt)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof B){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._points.size()!==r._points.size())return!1;for(var s=0;s<this._points.size();s++)if(!this.equal(this._points.getCoordinate(s),r._points.getCoordinate(s),n))return!1;return!0}return I(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var e=0;e<Math.trunc(this._points.size()/2);e++){var n=this._points.size()-1-e;if(!this._points.getCoordinate(e).equals(this._points.getCoordinate(n))){if(this._points.getCoordinate(e).compareTo(this._points.getCoordinate(n))>0){var r=this._points.copy();ne.reverse(r),this._points=r}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?L.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var e=this._points.copy();return ne.reverse(e),this.getFactory().createLineString(e)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return B.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return Rr.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var e=arguments[0],n=0,r=0;n<this._points.size()&&r<e._points.size();){var s=this._points.getCoordinate(n).compareTo(e._points.getCoordinate(r));if(s!==0)return s;n++,r++}return n<this._points.size()?1:r<e._points.size()?-1:0}if(arguments.length===2){var a=arguments[0];return arguments[1].compare(this._points,a._points)}}},{key:"apply",value:function(){if(J(arguments[0],Ge))for(var e=arguments[0],n=0;n<this._points.size();n++)e.filter(this._points.getCoordinate(n));else if(J(arguments[0],Ye)){var r=arguments[0];if(this._points.size()===0)return null;for(var s=0;s<this._points.size()&&(r.filter(this._points,s),!r.isDone());s++);r.isGeometryChanged()&&this.geometryChanged()}else J(arguments[0],qe)?arguments[0].filter(this):J(arguments[0],G)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){throw new Jt}},{key:"isEquivalentClass",value:function(e){return e instanceof t}},{key:"getCoordinateN",value:function(e){return this._points.getCoordinate(e)}},{key:"getGeometryType",value:function(){return B.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(e){if(e===null&&(e=this.getFactory().getCoordinateSequenceFactory().create([])),e.size()===1)throw new F("Invalid number of points in LineString (found "+e.size()+" - must be 0 or >= 2)");this._points=e}},{key:"isCoordinate",value:function(e){for(var n=0;n<this._points.size();n++)if(this._points.getCoordinate(n).equals(e))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(e){return this.getFactory().createPoint(this._points.getCoordinate(e))}},{key:"interfaces_",get:function(){return[Un]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],n=arguments[1];B.constructor_.call(this,n),this.init(e)}}}}])}(B),Vn=g(function i(){l(this,i)}),fn=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new gt;var e=new gt;return e.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),e}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new t(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof B){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}return I(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return L.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return B.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0];return this.getCoordinate().compareTo(e.getCoordinate())}if(arguments.length===2){var n=arguments[0];return arguments[1].compare(this._coordinates,n._coordinates)}}},{key:"apply",value:function(){if(J(arguments[0],Ge)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this.getCoordinate())}else if(J(arguments[0],Ye)){var n=arguments[0];if(this.isEmpty())return null;n.filter(this._coordinates,0),n.isGeometryChanged()&&this.geometryChanged()}else J(arguments[0],qe)?arguments[0].filter(this):J(arguments[0],G)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return B.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(e){e===null&&(e=this.getFactory().getCoordinateSequenceFactory().create([])),$.isTrue(e.size()<=1),this._coordinates=e}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Vn]}}],[{key:"constructor_",value:function(){this._coordinates=null;var e=arguments[0],n=arguments[1];B.constructor_.call(this,n),this.init(e)}}])}(B),Hn=function(){function i(){l(this,i)}return g(i,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var t=arguments[0];return Math.abs(i.ofRingSigned(t))}if(J(arguments[0],it)){var e=arguments[0];return Math.abs(i.ofRingSigned(e))}}},{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,r=1;r<t.length-1;r++){var s=t[r].x-n,a=t[r+1].y;e+=s*(t[r-1].y-a)}return e/2}if(J(arguments[0],it)){var u=arguments[0],h=u.size();if(h<3)return 0;var f=new p,d=new p,_=new p;u.getCoordinate(0,d),u.getCoordinate(1,_);var S=d.x;_.x-=S;for(var O=0,b=1;b<h-1;b++)f.y=d.y,d.x=_.x,d.y=_.y,u.getCoordinate(b+1,_),_.x-=S,O+=d.x*(f.y-_.y);return O/2}}}])}(),ie=function(){return g(function i(){l(this,i)},null,[{key:"sort",value:function(){var i=arguments,t=arguments[0];if(arguments.length===1)t.sort(function(S,O){return S.compareTo(O)});else if(arguments.length===2)t.sort(function(S,O){return i[1].compare(S,O)});else if(arguments.length===3){var e=t.slice(arguments[1],arguments[2]);e.sort();var n=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);var r,s=A(n);try{for(s.s();!(r=s.n()).done;){var a=r.value;t.push(a)}}catch(S){s.e(S)}finally{s.f()}}else if(arguments.length===4){var u=t.slice(arguments[1],arguments[2]);u.sort(function(S,O){return i[3].compare(S,O)});var h=t.slice(0,arguments[1]).concat(u,t.slice(arguments[2],t.length));t.splice(0,t.length);var f,d=A(h);try{for(d.s();!(f=d.n()).done;){var _=f.value;t.push(_)}}catch(S){d.e(S)}finally{d.f()}}}},{key:"asList",value:function(i){var t,e=new H,n=A(i);try{for(n.s();!(t=n.n()).done;){var r=t.value;e.add(r)}}catch(s){n.e(s)}finally{n.f()}return e}},{key:"copyOf",value:function(i,t){return i.slice(0,t)}}])}(),Zn=g(function i(){l(this,i)}),ze=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var e=new Array(this.getNumPoints()).fill(null),n=-1,r=this._shell.getCoordinates(),s=0;s<r.length;s++)e[++n]=r[s];for(var a=0;a<this._holes.length;a++)for(var u=this._holes[a].getCoordinates(),h=0;h<u.length;h++)e[++n]=u[h];return e}},{key:"getArea",value:function(){var e=0;e+=Hn.ofRing(this._shell.getCoordinateSequence());for(var n=0;n<this._holes.length;n++)e-=Hn.ofRing(this._holes[n].getCoordinateSequence());return e}},{key:"copyInternal",value:function(){for(var e=this._shell.copy(),n=new Array(this._holes.length).fill(null),r=0;r<this._holes.length;r++)n[r]=this._holes[r].copy();return new t(e,n,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var e=this._shell.getCoordinateSequence(),n=this.getEnvelopeInternal(),r=0;r<5;r++){var s=e.getX(r);if(s!==n.getMinX()&&s!==n.getMaxX())return!1;var a=e.getY(r);if(a!==n.getMinY()&&a!==n.getMaxY())return!1}for(var u=e.getX(0),h=e.getY(0),f=1;f<=4;f++){var d=e.getX(f),_=e.getY(f);if(d!==u==(_!==h))return!1;u=d,h=_}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof B){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e,s=this._shell,a=r._shell;if(!s.equalsExact(a,n)||this._holes.length!==r._holes.length)return!1;for(var u=0;u<this._holes.length;u++)if(!this._holes[u].equalsExact(r._holes[u],n))return!1;return!0}return I(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var e=0;e<this._holes.length;e++)this._holes[e]=this.normalized(this._holes[e],!1);ie.sort(this._holes)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];if(n.isEmpty())return null;var s=n.getCoordinateSequence(),a=ne.minCoordinateIndex(s,0,s.size()-2);ne.scroll(s,a,!0),j.isCCW(s)===r&&ne.reverse(s)}}},{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 e=this.getExteriorRing().reverse(),n=new Array(this.getNumInteriorRing()).fill(null),r=0;r<n.length;r++)n[r]=this.getInteriorRingN(r).reverse();return this.getFactory().createPolygon(e,n)}},{key:"getTypeCode",value:function(){return B.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var e=0;e+=this._shell.getLength();for(var n=0;n<this._holes.length;n++)e+=this._holes[n].getLength();return e}},{key:"getNumPoints",value:function(){for(var e=this._shell.getNumPoints(),n=0;n<this._holes.length;n++)e+=this._holes[n].getNumPoints();return e}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(e,n){var r=e.copy();return this.normalize(r,n),r}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0],n=this._shell,r=e._shell;return n.compareToSameClass(r)}if(arguments.length===2){var s=arguments[1],a=arguments[0],u=this._shell,h=a._shell,f=u.compareToSameClass(h,s);if(f!==0)return f;for(var d=this.getNumInteriorRing(),_=a.getNumInteriorRing(),S=0;S<d&&S<_;){var O=this.getInteriorRingN(S),b=a.getInteriorRingN(S),X=O.compareToSameClass(b,s);if(X!==0)return X;S++}return S<d?1:S<_?-1:0}}},{key:"apply",value:function(){if(J(arguments[0],Ge)){var e=arguments[0];this._shell.apply(e);for(var n=0;n<this._holes.length;n++)this._holes[n].apply(e)}else if(J(arguments[0],Ye)){var r=arguments[0];if(this._shell.apply(r),!r.isDone())for(var s=0;s<this._holes.length&&(this._holes[s].apply(r),!r.isDone());s++);r.isGeometryChanged()&&this.geometryChanged()}else if(J(arguments[0],qe))arguments[0].filter(this);else if(J(arguments[0],G)){var a=arguments[0];a.filter(this),this._shell.apply(a);for(var u=0;u<this._holes.length;u++)this._holes[u].apply(a)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var e=new Array(this._holes.length+1).fill(null);e[0]=this._shell;for(var n=0;n<this._holes.length;n++)e[n+1]=this._holes[n];return e.length<=1?this.getFactory().createLinearRing(e[0].getCoordinateSequence()):this.getFactory().createMultiLineString(e)}},{key:"getGeometryType",value:function(){return B.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(e){return this._holes[e]}},{key:"interfaces_",get:function(){return[Zn]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var e=arguments[0],n=arguments[1],r=arguments[2];if(B.constructor_.call(this,r),e===null&&(e=this.getFactory().createLinearRing()),n===null&&(n=[]),B.hasNullElements(n))throw new F("holes must not contain null elements");if(e.isEmpty()&&B.hasNonEmptyElements(n))throw new F("shell is empty but holes are not");this._shell=e,this._holes=n}}])}(B),Or=function(i){function t(){return l(this,t),v(this,t,arguments)}return x(t,i),g(t)}(Yn),Wn=function(i){function t(e){var n;return l(this,t),(n=v(this,t)).array=[],e instanceof Yt&&n.addAll(e),n}return x(t,i),g(t,[{key:"contains",value:function(e){var n,r=A(this.array);try{for(r.s();!(n=r.n()).done;)if(n.value.compareTo(e)===0)return!0}catch(s){r.e(s)}finally{r.f()}return!1}},{key:"add",value:function(e){if(this.contains(e))return!1;for(var n=0,r=this.array.length;n<r;n++)if(this.array[n].compareTo(e)===1)return!!this.array.splice(n,0,e);return this.array.push(e),!0}},{key:"addAll",value:function(e){var n,r=A(e);try{for(r.s();!(n=r.n()).done;){var s=n.value;this.add(s)}}catch(a){r.e(a)}finally{r.f()}return!0}},{key:"remove",value:function(){throw new Jt}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new Mr(this.array)}}])}(Or),Mr=function(){return g(function i(t){l(this,i),this.array=t,this.position=0},[{key:"next",value:function(){if(this.position===this.array.length)throw new De;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new Jt}}])}(),Lt=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"computeEnvelopeInternal",value:function(){for(var e=new gt,n=0;n<this._geometries.length;n++)e.expandToInclude(this._geometries[n].getEnvelopeInternal());return e}},{key:"getGeometryN",value:function(e){return this._geometries[e]}},{key:"getCoordinates",value:function(){for(var e=new Array(this.getNumPoints()).fill(null),n=-1,r=0;r<this._geometries.length;r++)for(var s=this._geometries[r].getCoordinates(),a=0;a<s.length;a++)e[++n]=s[a];return e}},{key:"getArea",value:function(){for(var e=0,n=0;n<this._geometries.length;n++)e+=this._geometries[n].getArea();return e}},{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),n=0;n<e.length;n++)e[n]=this._geometries[n].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof B){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._geometries.length!==r._geometries.length)return!1;for(var s=0;s<this._geometries.length;s++)if(!this._geometries[s].equalsExact(r._geometries[s],n))return!1;return!0}return I(t,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var e=0;e<this._geometries.length;e++)this._geometries[e].normalize();ie.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var e=L.FALSE,n=0;n<this._geometries.length;n++)e=Math.max(e,this._geometries[n].getBoundaryDimension());return e}},{key:"reverseInternal",value:function(){for(var e=this._geometries.length,n=new H(e),r=0;r<e;r++)n.add(this._geometries[r].reverse());return this.getFactory().buildGeometry(n)}},{key:"getTypeCode",value:function(){return B.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var e=L.FALSE,n=0;n<this._geometries.length;n++)e=Math.max(e,this._geometries[n].getDimension());return e}},{key:"getLength",value:function(){for(var e=0,n=0;n<this._geometries.length;n++)e+=this._geometries[n].getLength();return e}},{key:"getNumPoints",value:function(){for(var e=0,n=0;n<this._geometries.length;n++)e+=this._geometries[n].getNumPoints();return e}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var e=arguments[0],n=new Wn(ie.asList(this._geometries)),r=new Wn(ie.asList(e._geometries));return this.compare(n,r)}if(arguments.length===2){for(var s=arguments[1],a=arguments[0],u=this.getNumGeometries(),h=a.getNumGeometries(),f=0;f<u&&f<h;){var d=this.getGeometryN(f),_=a.getGeometryN(f),S=d.compareToSameClass(_,s);if(S!==0)return S;f++}return f<u?1:f<h?-1:0}}},{key:"apply",value:function(){if(J(arguments[0],Ge))for(var e=arguments[0],n=0;n<this._geometries.length;n++)this._geometries[n].apply(e);else if(J(arguments[0],Ye)){var r=arguments[0];if(this._geometries.length===0)return null;for(var s=0;s<this._geometries.length&&(this._geometries[s].apply(r),!r.isDone());s++);r.isGeometryChanged()&&this.geometryChanged()}else if(J(arguments[0],qe)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)this._geometries[u].apply(a)}else if(J(arguments[0],G)){var h=arguments[0];h.filter(this);for(var f=0;f<this._geometries.length;f++)this._geometries[f].apply(h)}}},{key:"getBoundary",value:function(){return B.checkNotGeometryCollection(this),$.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return B.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],n=arguments[1];if(B.constructor_.call(this,n),e===null&&(e=[]),B.hasNullElements(e))throw new F("geometries must not contain null elements");this._geometries=e}}}}])}(B),gn=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),n=0;n<e.length;n++)e[n]=this._geometries[n].copy();return new t(e,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof B){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&I(t,"equalsExact",this,1).call(this,e,n)}return I(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var e=arguments[0];return this._geometries[e].getCoordinate()}return I(t,"getCoordinate",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return L.FALSE}},{key:"getTypeCode",value:function(){return B.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return B.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Vn]}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Lt.constructor_.call(this,e,n)}}])}(Lt),Se=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return L.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||I(t,"isClosed",this,1).call(this)}},{key:"reverseInternal",value:function(){var e=this._points.copy();return ne.reverse(e),this.getFactory().createLinearRing(e)}},{key:"getTypeCode",value:function(){return B.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!I(t,"isClosed",this,1).call(this))throw new F("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new F("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return B.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Ne.constructor_.call(this,e,n),this.validateConstruction()}}])}(Ne);Se.MINIMUM_VALID_SIZE=4;var re=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"setOrdinate",value:function(e,n){switch(e){case t.X:this.x=n;break;case t.Y:this.y=n;break;default:throw new F("Invalid ordinate index: "+e)}}},{key:"getZ",value:function(){return p.NULL_ORDINATE}},{key:"getOrdinate",value:function(e){switch(e){case t.X:return this.x;case t.Y:return this.y}throw new F("Invalid ordinate index: "+e)}},{key:"setZ",value:function(e){throw new F("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)p.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];p.constructor_.call(this,e.x,e.y)}else if(arguments[0]instanceof p){var n=arguments[0];p.constructor_.call(this,n.x,n.y)}}else if(arguments.length===2){var r=arguments[0],s=arguments[1];p.constructor_.call(this,r,s,p.NULL_ORDINATE)}}}])}(p);re.X=0,re.Y=1,re.Z=-1,re.M=-1;var se=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(e,n){switch(e){case t.X:this.x=n;break;case t.Y:this.y=n;break;case t.M:this._m=n;break;default:throw new F("Invalid ordinate index: "+e)}}},{key:"setM",value:function(e){this._m=e}},{key:"getZ",value:function(){return p.NULL_ORDINATE}},{key:"getOrdinate",value:function(e){switch(e){case t.X:return this.x;case t.Y:return this.y;case t.M:return this._m}throw new F("Invalid ordinate index: "+e)}},{key:"setZ",value:function(e){throw new F("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ(),this._m=e.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)p.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];p.constructor_.call(this,e.x,e.y),this._m=e._m}else if(arguments[0]instanceof p){var n=arguments[0];p.constructor_.call(this,n.x,n.y),this._m=this.getM()}}else if(arguments.length===3){var r=arguments[0],s=arguments[1],a=arguments[2];p.constructor_.call(this,r,s,p.NULL_ORDINATE),this._m=a}}}])}(p);se.X=0,se.Y=1,se.Z=-1,se.M=2;var vn=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(e,n){switch(e){case p.X:this.x=n;break;case p.Y:this.y=n;break;case p.Z:this.z=n;break;case p.M:this._m=n;break;default:throw new F("Invalid ordinate index: "+e)}}},{key:"setM",value:function(e){this._m=e}},{key:"getOrdinate",value:function(e){switch(e){case p.X:return this.x;case p.Y:return this.y;case p.Z:return this.getZ();case p.M:return this.getM()}throw new F("Invalid ordinate index: "+e)}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ(),this._m=e.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)p.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var e=arguments[0];p.constructor_.call(this,e),this._m=e._m}else if(arguments[0]instanceof p){var n=arguments[0];p.constructor_.call(this,n),this._m=this.getM()}}else if(arguments.length===4){var r=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];p.constructor_.call(this,r,s,a),this._m=u}}}])}(p),Be=function(){function i(){l(this,i)}return g(i,null,[{key:"measures",value:function(t){return t instanceof re?0:t instanceof se||t instanceof vn?1:0}},{key:"dimension",value:function(t){return t instanceof re?2:t instanceof se?3:t instanceof vn?4:3}},{key:"create",value:function(){if(arguments.length===1){var t=arguments[0];return i.create(t,0)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return e===2?new re:e===3&&n===0?new p:e===3&&n===1?new se:e===4&&n===1?new vn:new p}}}])}(),Te=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"getCoordinate",value:function(e){return this.get(e)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&J(arguments[0],Yt)){for(var e=arguments[1],n=!1,r=arguments[0].iterator();r.hasNext();)this.add(r.next(),e),n=!0;return n}return I(t,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var e=I(t,"clone",this,1).call(this),n=0;n<this.size();n++)e.add(n,this.get(n).clone());return e}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(t.coordArrayType);if(arguments.length===1){if(arguments[0])return this.toArray(t.coordArrayType);for(var e=this.size(),n=new Array(e).fill(null),r=0;r<e;r++)n[r]=this.get(e-r-1);return n}}},{key:"add",value:function(){if(arguments.length===1){var e=arguments[0];return I(t,"add",this,1).call(this,e)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var n=arguments[0],r=arguments[1];return this.add(n,r,!0),!0}if(arguments[0]instanceof p&&typeof arguments[1]=="boolean"){var s=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(s))return null;I(t,"add",this,1).call(this,s)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var a=arguments[0],u=arguments[1];return this.add(a,u),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var h=arguments[0],f=arguments[1];if(arguments[2])for(var d=0;d<h.length;d++)this.add(h[d],f);else for(var _=h.length-1;_>=0;_--)this.add(h[_],f);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof p){var S=arguments[0],O=arguments[1];if(!arguments[2]){var b=this.size();if(b>0&&(S>0&&this.get(S-1).equals2D(O)||S<b&&this.get(S).equals2D(O)))return null}I(t,"add",this,1).call(this,S,O)}}else if(arguments.length===4){var X=arguments[0],rt=arguments[1],nt=arguments[2],ht=arguments[3],Nt=1;nt>ht&&(Nt=-1);for(var St=nt;St!==ht;St+=Nt)this.add(X[St],rt);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var e=this.get(0).copy();this.add(e,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.ensureCapacity(n.length),this.add(n,r)}}}}])}(H);Te.coordArrayType=new Array(0).fill(null);var pt=function(){function i(){l(this,i)}return g(i,null,[{key:"isRing",value:function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])}},{key:"ptNotInList",value:function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(i.indexOf(r,e)<0)return r}return null}},{key:"scroll",value:function(t,e){var n=i.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);Mt.arraycopy(t,n,r,0,t.length-n),Mt.arraycopy(t,0,r,t.length-n,n),Mt.arraycopy(r,0,t,0,t.length)}},{key:"equals",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(t===null||e===null||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(arguments.length===3){var r=arguments[0],s=arguments[1],a=arguments[2];if(r===s)return!0;if(r===null||s===null||r.length!==s.length)return!1;for(var u=0;u<r.length;u++)if(a.compare(r[u],s[u])!==0)return!1;return!0}}},{key:"intersection",value:function(t,e){for(var n=new Te,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()}},{key:"measures",value:function(t){if(t===null||t.length===0)return 0;var e,n=0,r=A(t);try{for(r.s();!(e=r.n()).done;){var s=e.value;n=Math.max(n,Be.measures(s))}}catch(a){r.e(a)}finally{r.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 i.hasRepeatedPoints(t)?new Te(t,!1).toCoordinateArray():t}},{key:"reverse",value:function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var s=t[r];t[r]=t[e-r],t[e-r]=s}}},{key:"removeNull",value:function(t){for(var e=0,n=0;n<t.length;n++)t[n]!==null&&e++;var r=new Array(e).fill(null);if(e===0)return r;for(var s=0,a=0;a<t.length;a++)t[a]!==null&&(r[s++]=t[a]);return r}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=t[n].copy();return e}if(arguments.length===5)for(var r=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3],h=arguments[4],f=0;f<h;f++)a[u+f]=r[s+f].copy()}},{key:"isEqualReversed",value:function(t,e){for(var n=0;n<t.length;n++){var r=t[n],s=e[t.length-n-1];if(r.compareTo(s)!==0)return!1}return!0}},{key:"envelope",value:function(t){for(var e=new gt,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e}},{key:"toCoordinateArray",value:function(t){return t.toArray(i.coordArrayType)}},{key:"dimension",value:function(t){if(t===null||t.length===0)return 3;var e,n=0,r=A(t);try{for(r.s();!(e=r.n()).done;){var s=e.value;n=Math.max(n,Be.dimension(s))}}catch(a){r.e(a)}finally{r.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,r=t[e].compareTo(t[n]);if(r!==0)return r}return 1}},{key:"compare",value:function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(r!==0)return r;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++)(e===null||e.compareTo(t[n])>0)&&(e=t[n]);return e}},{key:"extract",value:function(t,e,n){e=Ie.clamp(e,0,t.length);var r=(n=Ie.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var s=new Array(r).fill(null);if(r===0)return s;for(var a=0,u=e;u<=n;u++)s[a++]=t[u];return s}}])}(),Ar=function(){return g(function i(){l(this,i)},[{key:"compare",value:function(i,t){var e=i,n=t;return pt.compare(e,n)}},{key:"interfaces_",get:function(){return[Tt]}}])}(),Pr=function(){return g(function i(){l(this,i)},[{key:"compare",value:function(i,t){var e=i,n=t;if(e.length<n.length)return-1;if(e.length>n.length)return 1;if(e.length===0)return 0;var r=pt.compare(e,n);return pt.isEqualReversed(e,n)?0:r}},{key:"OLDcompare",value:function(i,t){var e=i,n=t;if(e.length<n.length)return-1;if(e.length>n.length)return 1;if(e.length===0)return 0;for(var r=pt.increasingDirection(e),s=pt.increasingDirection(n),a=r>0?0:e.length-1,u=s>0?0:e.length-1,h=0;h<e.length;h++){var f=e[a].compareTo(n[u]);if(f!==0)return f;a+=r,u+=s}return 0}},{key:"interfaces_",get:function(){return[Tt]}}])}();pt.ForwardComparator=Ar,pt.BidirectionalComparator=Pr,pt.coordArrayType=new Array(0).fill(null);var Xe=function(){return g(function i(t){l(this,i),this.str=t},[{key:"append",value:function(i){this.str+=i}},{key:"setCharAt",value:function(i,t){this.str=this.str.substr(0,i)+t+this.str.substr(i+1)}},{key:"toString",value:function(){return this.str}}])}(),Ce=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getM",value:function(t){return this.hasM()?this._coordinates[t].getM():D.NaN}},{key:"setOrdinate",value:function(t,e,n){switch(e){case it.X:this._coordinates[t].x=n;break;case it.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():D.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(t,e){switch(e){case it.X:return this._coordinates[t].x;case it.Y:return this._coordinates[t].y;default:return this._coordinates[t].getOrdinate(e)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var t=arguments[0];return this._coordinates[t]}if(arguments.length===2){var e=arguments[0];arguments[1].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 Be.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=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++){var n=this.createCoordinate();n.setCoordinate(this._coordinates[e]),t[e]=n}return new i(t,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var t=new Xe(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[it,q]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];i.constructor_.call(this,t,pt.dimension(t),pt.measures(t))}else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)this._coordinates[n]=new p}else if(J(arguments[0],it)){var r=arguments[0];if(r===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=r.getDimension(),this._measures=r.getMeasures(),this._coordinates=new Array(r.size()).fill(null);for(var s=0;s<this._coordinates.length;s++)this._coordinates[s]=r.getCoordinateCopy(s)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];i.constructor_.call(this,a,u,pt.measures(a))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var h=arguments[0],f=arguments[1];this._coordinates=new Array(h).fill(null),this._dimension=f;for(var d=0;d<h;d++)this._coordinates[d]=Be.create(f)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var _=arguments[0],S=arguments[1],O=arguments[2];this._dimension=S,this._measures=O,this._coordinates=_===null?new Array(0).fill(null):_}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var b=arguments[0],X=arguments[1],rt=arguments[2];this._coordinates=new Array(b).fill(null),this._dimension=X,this._measures=rt;for(var nt=0;nt<b;nt++)this._coordinates[nt]=this.createCoordinate()}}}}])}(),mn=function(){function i(){l(this,i)}return g(i,[{key:"readResolve",value:function(){return i.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array)return new Ce(arguments[0]);if(J(arguments[0],it))return new Ce(arguments[0])}else{if(arguments.length===2){var t=arguments[1];return t>3&&(t=3),t<2&&(t=2),new Ce(arguments[0],t)}if(arguments.length===3){var e=arguments[2],n=arguments[1]-e;return e>1&&(e=1),n>3&&(n=3),n<2&&(n=2),new Ce(arguments[0],n+e,e)}}}},{key:"interfaces_",get:function(){return[Xn,q]}}],[{key:"instance",value:function(){return i.instanceObject}}])}();mn.instanceObject=new mn;var yn=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),n=0;n<e.length;n++)e[n]=this._geometries[n].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof B){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&I(t,"equalsExact",this,1).call(this,e,n)}return I(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return B.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var e=new H,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getBoundary(),s=0;s<r.getNumGeometries();s++)e.add(r.getGeometryN(s));var a=new Array(e.size()).fill(null);return this.getFactory().createMultiLineString(e.toArray(a))}},{key:"getGeometryType",value:function(){return B.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[Zn]}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Lt.constructor_.call(this,e,n)}}])}(Lt),jn=function(){return g(function i(){l(this,i)},[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}])}(),br=function(i){function t(){var e;return l(this,t),(e=v(this,t)).map=new Map,e}return x(t,i),g(t,[{key:"get",value:function(e){return this.map.get(e)||null}},{key:"put",value:function(e,n){return this.map.set(e,n),n}},{key:"values",value:function(){for(var e=new H,n=this.map.values(),r=n.next();!r.done;)e.add(r.value),r=n.next();return e}},{key:"entrySet",value:function(){var e=new on;return this.map.entries().forEach(function(n){return e.add(n)}),e}},{key:"size",value:function(){return this.map.size()}}])}(jn),Gt=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"equals",value:function(t){if(!(t instanceof i))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale}},{key:"compareTo",value:function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return Fe.compare(n,r)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===i.FLOATING||this._modelType===i.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var t="UNKNOWN";return this._modelType===i.FLOATING?t="Floating":this._modelType===i.FLOATING_SINGLE?t="Floating-Single":this._modelType===i.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var t=arguments[0];return D.isNaN(t)||this._modelType===i.FLOATING_SINGLE?t:this._modelType===i.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof p){var e=arguments[0];if(this._modelType===i.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}}},{key:"getMaximumSignificantDigits",value:function(){var t=16;return this._modelType===i.FLOATING?t=16:this._modelType===i.FLOATING_SINGLE?t=6:this._modelType===i.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[q,z]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=i.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof he){var t=arguments[0];this._modelType=t,t===i.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var e=arguments[0];this._modelType=i.FIXED,this.setScale(e)}else if(arguments[0]instanceof i){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}}},{key:"mostPrecise",value:function(t,e){return t.compareTo(e)>=0?t:e}}])}(),he=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"readResolve",value:function(){return i.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){this._name=null;var t=arguments[0];this._name=t,i.nameToTypeMap.put(t,this)}}])}();he.nameToTypeMap=new br,Gt.Type=he,Gt.FIXED=new he("FIXED"),Gt.FLOATING=new he("FLOATING"),Gt.FLOATING_SINGLE=new he("FLOATING SINGLE"),Gt.maximumPreciseValue=9007199254740992;var dn=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"copyInternal",value:function(){for(var e=new Array(this._geometries.length).fill(null),n=0;n<e.length;n++)e[n]=this._geometries[n].copy();return new t(e,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof B){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&I(t,"equalsExact",this,1).call(this,e,n)}return I(t,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?L.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var e=0;e<this._geometries.length;e++)if(!this._geometries[e].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return B.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new Jt}},{key:"getGeometryType",value:function(){return B.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[Un]}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Lt.constructor_.call(this,e,n)}}])}(Lt),ce=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{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 F("Invalid dimension: "+t)}}},{key:"toGeometry",value:function(t){return t.isNull()?this.createPoint():t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new p(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new p(t.getMinX(),t.getMinY()),new p(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new p(t.getMinX(),t.getMinY()),new p(t.getMinX(),t.getMaxY()),new p(t.getMaxX(),t.getMaxY()),new p(t.getMaxX(),t.getMinY()),new p(t.getMinX(),t.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLineString(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(J(arguments[0],it))return new Ne(arguments[0],this)}}},{key:"createMultiLineString",value:function(){return arguments.length===0?new dn(null,this):arguments.length===1?new dn(arguments[0],this):void 0}},{key:"buildGeometry",value:function(t){for(var e=null,n=!1,r=!1,s=t.iterator();s.hasNext();){var a=s.next(),u=a.getTypeCode();e===null&&(e=u),u!==e&&(n=!0),a instanceof Lt&&(r=!0)}if(e===null)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(i.toGeometryArray(t));var h=t.iterator().next();if(t.size()>1){if(h instanceof ze)return this.createMultiPolygon(i.toPolygonArray(t));if(h instanceof Ne)return this.createMultiLineString(i.toLineStringArray(t));if(h instanceof fn)return this.createMultiPoint(i.toPointArray(t));$.shouldNeverReachHere("Unhandled geometry type: "+h.getGeometryType())}return h}},{key:"createMultiPointFromCoords",value:function(t){return this.createMultiPoint(t!==null?this.getCoordinateSequenceFactory().create(t):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof p){var t=arguments[0];return this.createPoint(t!==null?this.getCoordinateSequenceFactory().create([t]):null)}if(J(arguments[0],it))return new fn(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(J(arguments[0],it)){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 Se){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2)return new ze(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new Lt(null,this):arguments.length===1?new Lt(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(t!==null?this.getCoordinateSequenceFactory().create(t):null)}if(J(arguments[0],it))return new Se(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new yn(null,this):arguments.length===1?new yn(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new gn(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new gn(arguments[0],this);if(J(arguments[0],it)){var t=arguments[0];if(t===null)return this.createMultiPoint(new Array(0).fill(null));for(var e=new Array(t.size()).fill(null),n=0;n<t.size();n++){var r=this.getCoordinateSequenceFactory().create(1,t.getDimension(),t.getMeasures());ne.copy(t,n,r,0,1),e[n]=this.createPoint(r)}return this.createMultiPoint(e)}}}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)i.constructor_.call(this,new Gt,0);else if(arguments.length===1){if(J(arguments[0],Xn)){var t=arguments[0];i.constructor_.call(this,new Gt,0,t)}else if(arguments[0]instanceof Gt){var e=arguments[0];i.constructor_.call(this,e,0,i.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];i.constructor_.call(this,n,r,i.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];this._precisionModel=s,this._coordinateSequenceFactory=u,this._SRID=a}}},{key:"toMultiPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toGeometryArray",value:function(t){if(t===null)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return mn.instance()}},{key:"toMultiLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLineStringArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toMultiPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toLinearRingArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPointArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"toPolygonArray",value:function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)}},{key:"createPointFromInternalCoord",value:function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)}}])}(),_n="XY",Dr="XYZ",Fr="XYM",Gr="XYZM",Kn={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"},Jn="EMPTY",Ue=1,jt=2,Qt=3,Qn=4,fe=5,qr=6;for(var Yr in Kn)Kn[Yr].toUpperCase();var zr=function(){return g(function i(t){l(this,i),this.wkt=t,this.index_=-1},[{key:"isAlpha_",value:function(i){return i>="a"&&i<="z"||i>="A"&&i<="Z"}},{key:"isNumeric_",value:function(i,t){return i>="0"&&i<="9"||i=="."&&!(t!==void 0&&t)}},{key:"isWhiteSpace_",value:function(i){return i==" "||i==" "||i=="\r"||i==`
|
|
5
|
+
`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var i,t=this.nextChar_(),e=this.index_,n=t;if(t=="(")i=jt;else if(t==",")i=fe;else if(t==")")i=Qt;else if(this.isNumeric_(t)||t=="-")i=Qn,n=this.readNumber_();else if(this.isAlpha_(t))i=Ue,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t!=="")throw new Error("Unexpected character: "+t);i=qr}return{position:e,value:n,type:i}}},{key:"readNumber_",value:function(){var i,t=this.index_,e=!1,n=!1;do i=="."?e=!0:i!="e"&&i!="E"||(n=!0),i=this.nextChar_();while(this.isNumeric_(i,e)||!n&&(i=="e"||i=="E")||n&&(i=="-"||i=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}},{key:"readText_",value:function(){var i,t=this.index_;do i=this.nextChar_();while(this.isAlpha_(i));return this.wkt.substring(t,this.index_--).toUpperCase()}}])}(),Br=function(){return g(function i(t,e){l(this,i),this.lexer_=t,this.token_,this.layout_=_n,this.factory=e},[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(i){return this.token_.type==i}},{key:"match",value:function(i){var t=this.isTokenType(i);return t&&this.consume_(),t}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var i=_n,t=this.token_;if(this.isTokenType(Ue)){var e=t.value;e==="Z"?i=Dr:e==="M"?i=Fr:e==="ZM"&&(i=Gr),i!==_n&&this.consume_()}return i}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(jt)){var i=[];do i.push(this.parseGeometry_());while(this.match(fe));if(this.match(Qt))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(jt)){var i=this.parsePoint_();if(this.match(Qt))return i}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(jt)){var i=this.parsePointList_();if(this.match(Qt))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(jt)){var i=this.parseLineStringTextList_();if(this.match(Qt))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var i;if(this.match(jt)){if(i=this.token_.type==jt?this.parsePointTextList_():this.parsePointList_(),this.match(Qt))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(jt)){var i=this.parseLineStringTextList_();if(this.match(Qt))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(jt)){var i=this.parsePolygonTextList_();if(this.match(Qt))return i}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var i=[],t=this.layout_.length,e=0;e<t;++e){var n=this.token_;if(!this.match(Qn))break;i.push(n.value)}if(i.length==t)return i;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var i=[this.parsePoint_()];this.match(fe);)i.push(this.parsePoint_());return i}},{key:"parsePointTextList_",value:function(){for(var i=[this.parsePointText_()];this.match(fe);)i.push(this.parsePointText_());return i}},{key:"parseLineStringTextList_",value:function(){for(var i=[this.parseLineStringText_()];this.match(fe);)i.push(this.parseLineStringText_());return i}},{key:"parsePolygonTextList_",value:function(){for(var i=[this.parsePolygonText_()];this.match(fe);)i.push(this.parsePolygonText_());return i}},{key:"isEmptyGeometry_",value:function(){var i=this.isTokenType(Ue)&&this.token_.value==Jn;return i&&this.consume_(),i}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var i=this.factory,t=function(X){return k(p,Q(X))},e=function(X){var rt=X.map(function(nt){return i.createLinearRing(nt.map(t))});return rt.length>1?i.createPolygon(rt[0],rt.slice(1)):i.createPolygon(rt[0])},n=this.token_;if(this.match(Ue)){var r=n.value;if(this.layout_=this.parseGeometryLayout_(),r=="GEOMETRYCOLLECTION"){var s=this.parseGeometryCollectionText_();return i.createGeometryCollection(s)}switch(r){case"POINT":var a=this.parsePointText_();return a?i.createPoint(k(p,Q(a))):i.createPoint();case"LINESTRING":var u=this.parseLineStringText_().map(t);return i.createLineString(u);case"LINEARRING":var h=this.parseLineStringText_().map(t);return i.createLinearRing(h);case"POLYGON":var f=this.parsePolygonText_();return f&&f.length!==0?e(f):i.createPolygon();case"MULTIPOINT":var d=this.parseMultiPointText_();if(!d||d.length===0)return i.createMultiPoint();var _=d.map(t).map(function(X){return i.createPoint(X)});return i.createMultiPoint(_);case"MULTILINESTRING":var S=this.parseMultiLineStringText_().map(function(X){return i.createLineString(X.map(t))});return i.createMultiLineString(S);case"MULTIPOLYGON":var O=this.parseMultiPolygonText_();if(!O||O.length===0)return i.createMultiPolygon();var b=O.map(e);return i.createMultiPolygon(b);default:throw new Error("Invalid geometry type: "+r)}}throw new Error(this.formatErrorMessage_())}}])}();function $n(i){if(i.isEmpty())return"";var t=i.getCoordinate(),e=[t.x,t.y];return t.z===void 0||Number.isNaN(t.z)||e.push(t.z),t.m===void 0||Number.isNaN(t.m)||e.push(t.m),e.join(" ")}function we(i){for(var t=i.getCoordinates().map(function(s){var a=[s.x,s.y];return s.z===void 0||Number.isNaN(s.z)||a.push(s.z),s.m===void 0||Number.isNaN(s.m)||a.push(s.m),a}),e=[],n=0,r=t.length;n<r;++n)e.push(t[n].join(" "));return e.join(", ")}function ti(i){var t=[];t.push("("+we(i.getExteriorRing())+")");for(var e=0,n=i.getNumInteriorRing();e<n;++e)t.push("("+we(i.getInteriorRingN(e))+")");return t.join(", ")}var Xr={Point:$n,LineString:we,LinearRing:we,Polygon:ti,MultiPoint:function(i){for(var t=[],e=0,n=i.getNumGeometries();e<n;++e)t.push("("+$n(i.getGeometryN(e))+")");return t.join(", ")},MultiLineString:function(i){for(var t=[],e=0,n=i.getNumGeometries();e<n;++e)t.push("("+we(i.getGeometryN(e))+")");return t.join(", ")},MultiPolygon:function(i){for(var t=[],e=0,n=i.getNumGeometries();e<n;++e)t.push("("+ti(i.getGeometryN(e))+")");return t.join(", ")},GeometryCollection:function(i){for(var t=[],e=0,n=i.getNumGeometries();e<n;++e)t.push(ei(i.getGeometryN(e)));return t.join(", ")}};function ei(i){var t=i.getGeometryType(),e=Xr[t];t=t.toUpperCase();var n=function(r){var s="";if(r.isEmpty())return s;var a=r.getCoordinate();return a.z===void 0||Number.isNaN(a.z)||(s+="Z"),a.m===void 0||Number.isNaN(a.m)||(s+="M"),s}(i);return n.length>0&&(t+=" "+n),i.isEmpty()?t+" "+Jn:t+" ("+e(i)+")"}var Ur=function(){return g(function i(t){l(this,i),this.geometryFactory=t||new ce,this.precisionModel=this.geometryFactory.getPrecisionModel()},[{key:"read",value:function(i){var t=new zr(i);return new Br(t,this.geometryFactory).parse()}},{key:"write",value:function(i){return ei(i)}}])}(),pn=function(){return g(function i(t){l(this,i),this.parser=new Ur(t)},[{key:"write",value:function(i){return this.parser.write(i)}}],[{key:"toLineString",value:function(i,t){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+i.x+" "+i.y+", "+t.x+" "+t.y+" )"}}])}(),mt=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getIndexAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}},{key:"getTopologySummary",value:function(){var t=new Xe;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,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){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(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){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!==i.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(t,e){return i.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])}},{key:"isCollinear",value:function(){return this._result===i.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return pn.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+pn.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=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new p,this._intPt[1]=new p,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(t,e,n){var r=Math.abs(n.x-e.x),s=Math.abs(n.y-e.y),a=-1;if(t.equals(e))a=0;else if(t.equals(n))a=r>s?r:s;else{var u=Math.abs(t.x-e.x),h=Math.abs(t.y-e.y);(a=r>s?u:h)!==0||t.equals(e)||(a=Math.max(u,h))}return $.isTrue(!(a===0&&!t.equals(e)),"Bad distance calculation"),a}},{key:"nonRobustComputeEdgeDistance",value:function(t,e,n){var r=t.x-e.x,s=t.y-e.y,a=Math.sqrt(r*r+s*s);return $.isTrue(!(a===0&&!t.equals(e)),"Invalid distance calculation"),a}}])}();mt.DONT_INTERSECT=0,mt.DO_INTERSECT=1,mt.COLLINEAR=2,mt.NO_INTERSECTION=0,mt.POINT_INTERSECTION=1,mt.COLLINEAR_INTERSECTION=2;var ae=function(i){function t(){return l(this,t),v(this,t)}return x(t,i),g(t,[{key:"isInSegmentEnvelopes",value:function(e){var n=new gt(this._inputLines[0][0],this._inputLines[0][1]),r=new gt(this._inputLines[1][0],this._inputLines[1][1]);return n.contains(e)&&r.contains(e)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return I(t,"computeIntersection",this,1).apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2];if(this._isProper=!1,gt.intersects(n,r,e)&&j.index(n,r,e)===0&&j.index(r,n,e)===0)return this._isProper=!0,(e.equals(n)||e.equals(r))&&(this._isProper=!1),this._result=mt.POINT_INTERSECTION,null;this._result=mt.NO_INTERSECTION}},{key:"intersection",value:function(e,n,r,s){var a=this.intersectionSafe(e,n,r,s);return this.isInSegmentEnvelopes(a)||(a=new p(t.nearestEndpoint(e,n,r,s))),this._precisionModel!==null&&this._precisionModel.makePrecise(a),a}},{key:"checkDD",value:function(e,n,r,s,a){var u=hn.intersection(e,n,r,s),h=this.isInSegmentEnvelopes(u);Mt.out.println("DD in env = "+h+" --------------------- "+u),a.distance(u)>1e-4&&Mt.out.println("Distance = "+a.distance(u))}},{key:"intersectionSafe",value:function(e,n,r,s){var a=cn.intersection(e,n,r,s);return a===null&&(a=t.nearestEndpoint(e,n,r,s)),a}},{key:"computeCollinearIntersection",value:function(e,n,r,s){var a=gt.intersects(e,n,r),u=gt.intersects(e,n,s),h=gt.intersects(r,s,e),f=gt.intersects(r,s,n);return a&&u?(this._intPt[0]=r,this._intPt[1]=s,mt.COLLINEAR_INTERSECTION):h&&f?(this._intPt[0]=e,this._intPt[1]=n,mt.COLLINEAR_INTERSECTION):a&&h?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||u||f?mt.COLLINEAR_INTERSECTION:mt.POINT_INTERSECTION):a&&f?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||u||h?mt.COLLINEAR_INTERSECTION:mt.POINT_INTERSECTION):u&&h?(this._intPt[0]=s,this._intPt[1]=e,!s.equals(e)||a||f?mt.COLLINEAR_INTERSECTION:mt.POINT_INTERSECTION):u&&f?(this._intPt[0]=s,this._intPt[1]=n,!s.equals(n)||a||h?mt.COLLINEAR_INTERSECTION:mt.POINT_INTERSECTION):mt.NO_INTERSECTION}},{key:"computeIntersect",value:function(e,n,r,s){if(this._isProper=!1,!gt.intersects(e,n,r,s))return mt.NO_INTERSECTION;var a=j.index(e,n,r),u=j.index(e,n,s);if(a>0&&u>0||a<0&&u<0)return mt.NO_INTERSECTION;var h=j.index(r,s,e),f=j.index(r,s,n);return h>0&&f>0||h<0&&f<0?mt.NO_INTERSECTION:a===0&&u===0&&h===0&&f===0?this.computeCollinearIntersection(e,n,r,s):(a===0||u===0||h===0||f===0?(this._isProper=!1,e.equals2D(r)||e.equals2D(s)?this._intPt[0]=e:n.equals2D(r)||n.equals2D(s)?this._intPt[0]=n:a===0?this._intPt[0]=new p(r):u===0?this._intPt[0]=new p(s):h===0?this._intPt[0]=new p(e):f===0&&(this._intPt[0]=new p(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,r,s)),mt.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(e,n,r,s){var a=e,u=zt.pointToSegment(e,r,s),h=zt.pointToSegment(n,r,s);return h<u&&(u=h,a=n),(h=zt.pointToSegment(r,e,n))<u&&(u=h,a=r),(h=zt.pointToSegment(s,e,n))<u&&(u=h,a=s),a}}])}(mt),Vr=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{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,r=e.x;return n>r&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(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 s=j.index(t,e,this._p);if(s===j.COLLINEAR)return this._isPointOnSegment=!0,null;e.y<t.y&&(s=-s),s===j.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==y.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?y.BOUNDARY:this._crossingCount%2==1?y.INTERIOR:y.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 p&&J(arguments[1],it)){for(var t=arguments[1],e=new i(arguments[0]),n=new p,r=new p,s=1;s<t.size();s++)if(t.getCoordinate(s,n),t.getCoordinate(s-1,r),e.countSegment(n,r),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof p&&arguments[1]instanceof Array){for(var a=arguments[1],u=new i(arguments[0]),h=1;h<a.length;h++){var f=a[h],d=a[h-1];if(u.countSegment(f,d),u.isOnSegment())return u.getLocation()}return u.getLocation()}}}])}(),kn=function(){function i(){l(this,i)}return g(i,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof p&&J(arguments[1],it)){for(var t=arguments[0],e=arguments[1],n=new ae,r=new p,s=new p,a=e.size(),u=1;u<a;u++)if(e.getCoordinate(u-1,r),e.getCoordinate(u,s),n.computeIntersection(t,r,s),n.hasIntersection())return!0;return!1}if(arguments[0]instanceof p&&arguments[1]instanceof Array){for(var h=arguments[0],f=arguments[1],d=new ae,_=1;_<f.length;_++){var S=f[_-1],O=f[_];if(d.computeIntersection(h,S,O),d.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(t,e){return Vr.locatePointInRing(t,e)}},{key:"isInRing",value:function(t,e){return i.locateInRing(t,e)!==y.EXTERIOR}}])}(),At=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{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]!==y.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(t){for(var e=0;e<this.location.length;e++)this.location[e]===y.NONE&&(this.location[e]=t)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[C.ON]=this.location[C.ON],e[C.LEFT]=y.NONE,e[C.RIGHT]=y.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===y.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[C.LEFT];this.location[C.LEFT]=this.location[C.RIGHT],this.location[C.RIGHT]=t}},{key:"toString",value:function(){var t=new xe;return this.location.length>1&&t.append(y.toLocationSymbol(this.location[C.LEFT])),t.append(y.toLocationSymbol(this.location[C.ON])),this.location.length>1&&t.append(y.toLocationSymbol(this.location[C.RIGHT])),t.toString()}},{key:"setLocations",value:function(t,e,n){this.location[C.ON]=t,this.location[C.LEFT]=e,this.location[C.RIGHT]=n}},{key:"get",value:function(t){return t<this.location.length?this.location[t]:y.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]===y.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var t=arguments[0];this.setLocation(C.ON,t)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.location[e]=n}}},{key:"init",value:function(t){this.location=new Array(t).fill(null),this.setAllLocations(y.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,arguments.length===1){if(arguments[0]instanceof Array){var t=arguments[0];this.init(t.length)}else if(Number.isInteger(arguments[0])){var e=arguments[0];this.init(1),this.location[C.ON]=e}else if(arguments[0]instanceof i){var n=arguments[0];if(this.init(n.location.length),n!==null)for(var r=0;r<this.location.length;r++)this.location[r]=n.location[r]}}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];this.init(3),this.location[C.ON]=s,this.location[C.LEFT]=a,this.location[C.RIGHT]=u}}}])}(),Pt=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{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(arguments.length===1){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(arguments.length===2){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++)this.elt[e]===null&&t.elt[e]!==null?this.elt[e]=new At(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(arguments.length===1){var t=arguments[0];return this.elt[t].get(C.ON)}if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}}},{key:"toString",value:function(){var t=new xe;return this.elt[0]!==null&&(t.append("A:"),t.append(this.elt[0].toString())),this.elt[1]!==null&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var t=arguments[0];return this.elt[t].isArea()}}},{key:"isAnyNull",value:function(t){return this.elt[t].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(C.ON,e)}else if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2];this.elt[n].setLocation(r,s)}}},{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 At(this.elt[t].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var t=arguments[0];this.elt[0]=new At(t),this.elt[1]=new At(t)}else if(arguments[0]instanceof i){var e=arguments[0];this.elt[0]=new At(e.elt[0]),this.elt[1]=new At(e.elt[1])}}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.elt[0]=new At(y.NONE),this.elt[1]=new At(y.NONE),this.elt[n].setLocation(r)}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];this.elt[0]=new At(s,a,u),this.elt[1]=new At(s,a,u)}else if(arguments.length===4){var h=arguments[0],f=arguments[1],d=arguments[2],_=arguments[3];this.elt[0]=new At(y.NONE,y.NONE,y.NONE),this.elt[1]=new At(y.NONE,y.NONE,y.NONE),this.elt[h].setLocations(f,d,_)}}},{key:"toLineLabel",value:function(t){for(var e=new i(y.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e}}])}(),Ve=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var i=new Array(this._pts.size()).fill(null),t=0;t<this._pts.size();t++)i[t]=this._pts.get(t);this._ring=this._geometryFactory.createLinearRing(i),this._isHole=j.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(i){this._startDe=i;var t=i,e=!0;do{if(t===null)throw new Wt("Found null DirectedEdge");if(t.getEdgeRing()===this)throw new Wt("Directed Edge visited twice during ring-building at "+t.getCoordinate());this._edges.add(t);var n=t.getLabel();$.isTrue(n.isArea()),this.mergeLabel(n),this.addPoints(t.getEdge(),t.isForward(),e),e=!1,this.setEdgeRing(t,this),t=this.getNext(t)}while(t!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(i){return this._pts.get(i)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var i=this._startDe;do{var t=i.getNode().getEdges().getOutgoingDegree(this);t>this._maxNodeDegree&&(this._maxNodeDegree=t),i=this.getNext(i)}while(i!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(i,t,e){var n=i.getCoordinates();if(t){var r=1;e&&(r=0);for(var s=r;s<n.length;s++)this._pts.add(n[s])}else{var a=n.length-2;e&&(a=n.length-1);for(var u=a;u>=0;u--)this._pts.add(n[u])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var i=this._startDe;do i.getEdge().setInResult(!0),i=i.getNext();while(i!==this._startDe)}},{key:"containsPoint",value:function(i){var t=this.getLinearRing();if(!t.getEnvelopeInternal().contains(i)||!kn.isInRing(i,t.getCoordinates()))return!1;for(var e=this._holes.iterator();e.hasNext();)if(e.next().containsPoint(i))return!1;return!0}},{key:"addHole",value:function(i){this._holes.add(i)}},{key:"isShell",value:function(){return this._shell===null}},{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(arguments.length===1){var i=arguments[0];this.mergeLabel(i,0),this.mergeLabel(i,1)}else if(arguments.length===2){var t=arguments[1],e=arguments[0].getLocation(t,C.RIGHT);if(e===y.NONE)return null;if(this._label.getLocation(t)===y.NONE)return this._label.setLocation(t,e),null}}},{key:"setShell",value:function(i){this._shell=i,i!==null&&i.addHole(this)}},{key:"toPolygon",value:function(i){for(var t=new Array(this._holes.size()).fill(null),e=0;e<this._holes.size();e++)t[e]=this._holes.get(e).getLinearRing();return i.createPolygon(this.getLinearRing(),t)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new H,this._pts=new H,this._label=new Pt(y.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new H,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var i=arguments[0],t=arguments[1];this._geometryFactory=t,this.computePoints(i),this.computeRing()}}}}])}(),Hr=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"setEdgeRing",value:function(e,n){e.setMinEdgeRing(n)}},{key:"getNext",value:function(e){return e.getNextMin()}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Ve.constructor_.call(this,e,n)}}])}(Ve),Zr=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"buildMinimalRings",value:function(){var e=new H,n=this._startDe;do{if(n.getMinEdgeRing()===null){var r=new Hr(n,this._geometryFactory);e.add(r)}n=n.getNext()}while(n!==this._startDe);return e}},{key:"setEdgeRing",value:function(e,n){e.setEdgeRing(n)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var e=this._startDe;do e.getNode().getEdges().linkMinimalDirectedEdges(this),e=e.getNext();while(e!==this._startDe)}},{key:"getNext",value:function(e){return e.getNext()}}],[{key:"constructor_",value:function(){var e=arguments[0],n=arguments[1];Ve.constructor_.call(this,e,n)}}])}(Ve),ni=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"setVisited",value:function(i){this._isVisited=i}},{key:"setInResult",value:function(i){this._isInResult=i}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(i){this._label=i}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(i){this._isCovered=i,this._isCoveredSet=!0}},{key:"updateIM",value:function(i){$.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(i)}},{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,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this._label=i}}}}])}(),He=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"isIncidentEdgeInResult",value:function(){for(var e=this.getEdges().getEdges().iterator();e.hasNext();)if(e.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(e){e.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(e){}},{key:"computeMergedLocation",value:function(e,n){var r=y.NONE;if(r=this._label.getLocation(n),!e.isNull(n)){var s=e.getLocation(n);r!==y.BOUNDARY&&(r=s)}return r}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return I(t,"setLabel",this,1).apply(this,arguments);var e=arguments[0],n=arguments[1];this._label===null?this._label=new Pt(e,n):this._label.setLocation(e,n)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof t){var e=arguments[0];this.mergeLabel(e._label)}else if(arguments[0]instanceof Pt)for(var n=arguments[0],r=0;r<2;r++){var s=this.computeMergedLocation(n,r);this._label.getLocation(r)===y.NONE&&this._label.setLocation(r,s)}}},{key:"add",value:function(e){this._edges.insert(e),e.setNode(this)}},{key:"setLabelBoundary",value:function(e){if(this._label===null)return null;var n=y.NONE;this._label!==null&&(n=this._label.getLocation(e));var r=null;switch(n){case y.BOUNDARY:r=y.INTERIOR;break;case y.INTERIOR:default:r=y.BOUNDARY}this._label.setLocation(e,r)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new Pt(0,y.NONE)}}])}(ni),Wr=function(i){function t(){return l(this,t),v(this,t,arguments)}return x(t,i),g(t)}(jn);function ii(i){return i==null?0:i.color}function at(i){return i==null?null:i.parent}function Bt(i,t){i!==null&&(i.color=t)}function En(i){return i==null?null:i.left}function ri(i){return i==null?null:i.right}var Le=function(i){function t(){var e;return l(this,t),(e=v(this,t)).root_=null,e.size_=0,e}return x(t,i),g(t,[{key:"get",value:function(e){for(var n=this.root_;n!==null;){var r=e.compareTo(n.key);if(r<0)n=n.left;else{if(!(r>0))return n.value;n=n.right}}return null}},{key:"put",value:function(e,n){if(this.root_===null)return this.root_={key:e,value:n,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var r,s,a=this.root_;do if(r=a,(s=e.compareTo(a.key))<0)a=a.left;else{if(!(s>0)){var u=a.value;return a.value=n,u}a=a.right}while(a!==null);var h={key:e,left:null,right:null,value:n,parent:r,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return s<0?r.left=h:r.right=h,this.fixAfterInsertion(h),this.size_++,null}},{key:"fixAfterInsertion",value:function(e){var n;for(e.color=1;e!=null&&e!==this.root_&&e.parent.color===1;)at(e)===En(at(at(e)))?ii(n=ri(at(at(e))))===1?(Bt(at(e),0),Bt(n,0),Bt(at(at(e)),1),e=at(at(e))):(e===ri(at(e))&&(e=at(e),this.rotateLeft(e)),Bt(at(e),0),Bt(at(at(e)),1),this.rotateRight(at(at(e)))):ii(n=En(at(at(e))))===1?(Bt(at(e),0),Bt(n,0),Bt(at(at(e)),1),e=at(at(e))):(e===En(at(e))&&(e=at(e),this.rotateRight(e)),Bt(at(e),0),Bt(at(at(e)),1),this.rotateLeft(at(at(e))));this.root_.color=0}},{key:"values",value:function(){var e=new H,n=this.getFirstEntry();if(n!==null)for(e.add(n.value);(n=t.successor(n))!==null;)e.add(n.value);return e}},{key:"entrySet",value:function(){var e=new on,n=this.getFirstEntry();if(n!==null)for(e.add(n);(n=t.successor(n))!==null;)e.add(n);return e}},{key:"rotateLeft",value:function(e){if(e!=null){var n=e.right;e.right=n.left,n.left!=null&&(n.left.parent=e),n.parent=e.parent,e.parent==null?this.root_=n:e.parent.left===e?e.parent.left=n:e.parent.right=n,n.left=e,e.parent=n}}},{key:"rotateRight",value:function(e){if(e!=null){var n=e.left;e.left=n.right,n.right!=null&&(n.right.parent=e),n.parent=e.parent,e.parent==null?this.root_=n:e.parent.right===e?e.parent.right=n:e.parent.left=n,n.right=e,e.parent=n}}},{key:"getFirstEntry",value:function(){var e=this.root_;if(e!=null)for(;e.left!=null;)e=e.left;return e}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(e){for(var n=this.root_;n!==null;){var r=e.compareTo(n.key);if(r<0)n=n.left;else{if(!(r>0))return!0;n=n.right}}return!1}}],[{key:"successor",value:function(e){var n;if(e===null)return null;if(e.right!==null){for(n=e.right;n.left!==null;)n=n.left;return n}n=e.parent;for(var r=e;n!==null&&r===n.right;)r=n,n=n.parent;return n}}])}(Wr),si=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"find",value:function(i){return this.nodeMap.get(i)}},{key:"addNode",value:function(){if(arguments[0]instanceof p){var i=arguments[0],t=this.nodeMap.get(i);return t===null&&(t=this.nodeFact.createNode(i),this.nodeMap.put(i,t)),t}if(arguments[0]instanceof He){var e=arguments[0],n=this.nodeMap.get(e.getCoordinate());return n===null?(this.nodeMap.put(e.getCoordinate(),e),e):(n.mergeLabel(e),n)}}},{key:"print",value:function(i){for(var t=this.iterator();t.hasNext();)t.next().print(i)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(i){for(var t=new H,e=this.iterator();e.hasNext();){var n=e.next();n.getLabel().getLocation(i)===y.BOUNDARY&&t.add(n)}return t}},{key:"add",value:function(i){var t=i.getCoordinate();this.addNode(t).add(i)}}],[{key:"constructor_",value:function(){this.nodeMap=new Le,this.nodeFact=null;var i=arguments[0];this.nodeFact=i}}])}(),Ct=function(){function i(){l(this,i)}return g(i,null,[{key:"isNorthern",value:function(t){return t===i.NE||t===i.NW}},{key:"isOpposite",value:function(t,e){return t!==e&&(t-e+4)%4===2}},{key:"commonHalfPlane",value:function(t,e){if(t===e)return t;if((t-e+4)%4===2)return-1;var n=t<e?t:e;return n===0&&(t>e?t:e)===3?3:n}},{key:"isInHalfPlane",value:function(t,e){return e===i.SE?t===i.SE||t===i.SW:t===e||t===e+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new F("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?i.NE:i.SE:e>=0?i.NW:i.SW}if(arguments[0]instanceof p&&arguments[1]instanceof p){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new F("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?i.NE:i.SE:r.y>=n.y?i.NW:i.SW}}}])}();Ct.NE=0,Ct.NW=1,Ct.SW=2,Ct.SE=3;var ai=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{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:j.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(),r=n.lastIndexOf("."),s=n.substring(r+1);t.print(" "+s+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)}},{key:"compareTo",value:function(t){var e=t;return this.compareDirection(e)}},{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=Ct.quadrant(this._dx,this._dy),$.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[z]}}],[{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,arguments.length===1){var t=arguments[0];this._edge=t}else if(arguments.length===3){var e=arguments[0],n=arguments[1],r=arguments[2];i.constructor_.call(this,e,n,r,null)}else if(arguments.length===4){var s=arguments[0],a=arguments[1],u=arguments[2],h=arguments[3];i.constructor_.call(this,s),this.init(a,u),this._label=h}}}])}(),xn=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(e){return this._depth[e]}},{key:"setVisited",value:function(e){this._isVisited=e}},{key:"computeDirectedLabel",value:function(){this._label=new Pt(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(e,n){if(this._depth[e]!==-999&&this._depth[e]!==n)throw new Wt("assigned depths do not match",this.getCoordinate());this._depth[e]=n}},{key:"isInteriorAreaEdge",value:function(){for(var e=!0,n=0;n<2;n++)this._label.isArea(n)&&this._label.getLocation(n,C.LEFT)===y.INTERIOR&&this._label.getLocation(n,C.RIGHT)===y.INTERIOR||(e=!1);return e}},{key:"setNextMin",value:function(e){this._nextMin=e}},{key:"print",value:function(e){I(t,"print",this,1).call(this,e),e.print(" "+this._depth[C.LEFT]+"/"+this._depth[C.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")}},{key:"setMinEdgeRing",value:function(e){this._minEdgeRing=e}},{key:"isLineEdge",value:function(){var e=this._label.isLine(0)||this._label.isLine(1),n=!this._label.isArea(0)||this._label.allPositionsEqual(0,y.EXTERIOR),r=!this._label.isArea(1)||this._label.allPositionsEqual(1,y.EXTERIOR);return e&&n&&r}},{key:"setEdgeRing",value:function(e){this._edgeRing=e}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var e=this._edge.getDepthDelta();return this._isForward||(e=-e),e}},{key:"setInResult",value:function(e){this._isInResult=e}},{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(e){this.print(e),e.print(" "),this._isForward?this._edge.print(e):this._edge.printReverse(e)}},{key:"setSym",value:function(e){this._sym=e}},{key:"setVisitedEdge",value:function(e){this.setVisited(e),this._sym.setVisited(e)}},{key:"setEdgeDepths",value:function(e,n){var r=this.getEdge().getDepthDelta();this._isForward||(r=-r);var s=1;e===C.LEFT&&(s=-1);var a=C.opposite(e),u=n+r*s;this.setDepth(e,n),this.setDepth(a,u)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(e){this._next=e}},{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 e=arguments[0],n=arguments[1];if(ai.constructor_.call(this,e),this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var r=e.getNumPoints()-1;this.init(e.getCoordinate(r),e.getCoordinate(r-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(e,n){return e===y.EXTERIOR&&n===y.INTERIOR?1:e===y.INTERIOR&&n===y.EXTERIOR?-1:0}}])}(ai),ui=function(){return g(function i(){l(this,i)},[{key:"createNode",value:function(i){return new He(i,null)}}])}(),oi=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"printEdges",value:function(i){i.println("Edges:");for(var t=0;t<this._edges.size();t++){i.println("edge "+t+":");var e=this._edges.get(t);e.print(i),e.eiList.print(i)}}},{key:"find",value:function(i){return this._nodes.find(i)}},{key:"addNode",value:function(){if(arguments[0]instanceof He){var i=arguments[0];return this._nodes.addNode(i)}if(arguments[0]instanceof p){var t=arguments[0];return this._nodes.addNode(t)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var i=this._nodes.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(i){Mt.out.println(i)}},{key:"isBoundaryNode",value:function(i,t){var e=this._nodes.find(t);if(e===null)return!1;var n=e.getLabel();return n!==null&&n.getLocation(i)===y.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var i=this._nodes.iterator();i.hasNext();)i.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(i,t,e,n){return!!i.equals(e)&&j.index(i,t,n)===j.COLLINEAR&&Ct.quadrant(i,t)===Ct.quadrant(e,n)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(i){Mt.out.print(i)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(i,t){for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e),r=n.getCoordinates();if(this.matchInSameDirection(i,t,r[0],r[1])||this.matchInSameDirection(i,t,r[r.length-1],r[r.length-2]))return n}return null}},{key:"insertEdge",value:function(i){this._edges.add(i)}},{key:"findEdgeEnd",value:function(i){for(var t=this.getEdgeEnds().iterator();t.hasNext();){var e=t.next();if(e.getEdge()===i)return e}return null}},{key:"addEdges",value:function(i){for(var t=i.iterator();t.hasNext();){var e=t.next();this._edges.add(e);var n=new xn(e,!0),r=new xn(e,!1);n.setSym(r),r.setSym(n),this.add(n),this.add(r)}}},{key:"add",value:function(i){this._nodes.add(i),this._edgeEndList.add(i)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(i,t){for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e),r=n.getCoordinates();if(i.equals(r[0])&&t.equals(r[1]))return n}return null}}],[{key:"constructor_",value:function(){if(this._edges=new H,this._nodes=null,this._edgeEndList=new H,arguments.length===0)this._nodes=new si(new ui);else if(arguments.length===1){var i=arguments[0];this._nodes=new si(i)}}},{key:"linkResultDirectedEdges",value:function(i){for(var t=i.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}}])}(),jr=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"sortShellsAndHoles",value:function(t,e,n){for(var r=t.iterator();r.hasNext();){var s=r.next();s.isHole()?n.add(s):e.add(s)}}},{key:"computePolygons",value:function(t){for(var e=new H,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e}},{key:"placeFreeHoles",value:function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(r.getShell()===null){var s=i.findEdgeRingContaining(r,t);if(s===null)throw new Wt("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(s)}}}},{key:"buildMinimalEdgeRings",value:function(t,e,n){for(var r=new H,s=t.iterator();s.hasNext();){var a=s.next();if(a.getMaxNodeDegree()>2){a.linkDirectedEdgesForMinimalEdgeRings();var u=a.buildMinimalRings(),h=this.findShell(u);h!==null?(this.placePolygonHoles(h,u),e.add(h)):n.addAll(u)}else r.add(a)}return r}},{key:"buildMaximalEdgeRings",value:function(t){for(var e=new H,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&r.getEdgeRing()===null){var s=new Zr(r,this._geometryFactory);e.add(s),s.setInResult()}}return e}},{key:"placePolygonHoles",value:function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var s=r.next();s.isHole()||(n=s,e++)}return $.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n}},{key:"add",value:function(){if(arguments.length===1){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(arguments.length===2){var e=arguments[0],n=arguments[1];oi.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),s=new H,a=this.buildMinimalEdgeRings(r,this._shellList,s);this.sortShellsAndHoles(a,this._shellList,s),this.placeFreeHoles(this._shellList,s)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new H;var t=arguments[0];this._geometryFactory=t}},{key:"findEdgeRingContaining",value:function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),s=n.getCoordinateN(0),a=null,u=null,h=e.iterator();h.hasNext();){var f=h.next(),d=f.getLinearRing(),_=d.getEnvelopeInternal();if(!_.equals(r)&&_.contains(r)){s=pt.ptNotInList(n.getCoordinates(),d.getCoordinates());var S=!1;kn.isInRing(s,d.getCoordinates())&&(S=!0),S&&(a===null||u.contains(_))&&(u=(a=f).getLinearRing().getEnvelopeInternal())}}return a}}])}(),li=function(){return g(function i(){l(this,i)},[{key:"getBounds",value:function(){}}])}(),Kt=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[li,q]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var i=arguments[0],t=arguments[1];this._bounds=i,this._item=t}}])}(),Ze=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"poll",value:function(){if(this.isEmpty())return null;var i=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),i}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(i){for(var t=null,e=this._items.get(i);2*i<=this._size&&((t=2*i)!==this._size&&this._items.get(t+1).compareTo(this._items.get(t))<0&&t++,this._items.get(t).compareTo(e)<0);i=t)this._items.set(i,this._items.get(t));this._items.set(i,e)}},{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 this._size===0}},{key:"add",value:function(i){this._items.add(null),this._size+=1;var t=this._size;for(this._items.set(0,i);i.compareTo(this._items.get(Math.trunc(t/2)))<0;t/=2)this._items.set(t,this._items.get(Math.trunc(t/2)));this._items.set(t,i)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new H,this._items.add(null)}}])}(),Kr=function(){return g(function i(){l(this,i)},[{key:"insert",value:function(i,t){}},{key:"remove",value:function(i,t){}},{key:"query",value:function(){}}])}(),bt=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{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(i){$.isTrue(this._bounds===null),this._childBoundables.add(i)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[li,q]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new H,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this._level=i}}}}])}(),ge={reverseOrder:function(){return{compare:function(i,t){return t.compareTo(i)}}},min:function(i){return ge.sort(i),i.get(0)},sort:function(i,t){var e=i.toArray();t?ie.sort(e,t):ie.sort(e);for(var n=i.iterator(),r=0,s=e.length;r<s;r++)n.next(),n.set(e[r])},singletonList:function(i){var t=new H;return t.add(i),t}},Jr=function(){function i(){l(this,i)}return g(i,null,[{key:"maxDistance",value:function(t,e,n,r,s,a,u,h){var f=i.distance(t,e,s,a);return f=Math.max(f,i.distance(t,e,u,h)),f=Math.max(f,i.distance(n,r,s,a)),f=Math.max(f,i.distance(n,r,u,h))}},{key:"distance",value:function(t,e,n,r){var s=n-t,a=r-e;return Math.sqrt(s*s+a*a)}},{key:"maximumDistance",value:function(t,e){var n=Math.min(t.getMinX(),e.getMinX()),r=Math.min(t.getMinY(),e.getMinY()),s=Math.max(t.getMaxX(),e.getMaxX()),a=Math.max(t.getMaxY(),e.getMaxY());return i.distance(n,r,s,a)}},{key:"minMaxDistance",value:function(t,e){var n=t.getMinX(),r=t.getMinY(),s=t.getMaxX(),a=t.getMaxY(),u=e.getMinX(),h=e.getMinY(),f=e.getMaxX(),d=e.getMaxY(),_=i.maxDistance(n,r,n,a,u,h,u,d);return _=Math.min(_,i.maxDistance(n,r,n,a,u,h,f,h)),_=Math.min(_,i.maxDistance(n,r,n,a,f,d,u,d)),_=Math.min(_,i.maxDistance(n,r,n,a,f,d,f,h)),_=Math.min(_,i.maxDistance(n,r,s,r,u,h,u,d)),_=Math.min(_,i.maxDistance(n,r,s,r,u,h,f,h)),_=Math.min(_,i.maxDistance(n,r,s,r,f,d,u,d)),_=Math.min(_,i.maxDistance(n,r,s,r,f,d,f,h)),_=Math.min(_,i.maxDistance(s,a,n,a,u,h,u,d)),_=Math.min(_,i.maxDistance(s,a,n,a,u,h,f,h)),_=Math.min(_,i.maxDistance(s,a,n,a,f,d,u,d)),_=Math.min(_,i.maxDistance(s,a,n,a,f,d,f,h)),_=Math.min(_,i.maxDistance(s,a,s,r,u,h,u,d)),_=Math.min(_,i.maxDistance(s,a,s,r,u,h,f,h)),_=Math.min(_,i.maxDistance(s,a,s,r,f,d,u,d)),_=Math.min(_,i.maxDistance(s,a,s,r,f,d,f,h))}}])}(),ve=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"maximumDistance",value:function(){return Jr.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(t,e){var n=i.isComposite(this._boundable1),r=i.isComposite(this._boundable2);if(n&&r)return i.area(this._boundable1)>i.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,e),null):(this.expand(this._boundable2,this._boundable1,!0,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,!1,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,!0,t,e),null;throw new F("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(i.isComposite(this._boundable1)||i.isComposite(this._boundable2))}},{key:"compareTo",value:function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0}},{key:"expand",value:function(t,e,n,r,s){for(var a=t.getChildBoundables().iterator();a.hasNext();){var u=a.next(),h=null;(h=n?new i(e,u,this._itemDistance):new i(u,e,this._itemDistance)).getDistance()<s&&r.add(h)}}},{key:"getBoundable",value:function(t){return t===0?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[z]}}],[{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 bt}}])}(),hi=function(){return g(function i(){l(this,i)},[{key:"visitItem",value:function(i){}}])}(),me=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"queryInternal",value:function(){if(J(arguments[2],hi)&&arguments[0]instanceof Object&&arguments[1]instanceof bt)for(var t=arguments[0],e=arguments[2],n=arguments[1].getChildBoundables(),r=0;r<n.size();r++){var s=n.get(r);this.getIntersectsOp().intersects(s.getBounds(),t)&&(s instanceof bt?this.queryInternal(t,s,e):s instanceof Kt?e.visitItem(s.getItem()):$.shouldNeverReachHere())}else if(J(arguments[2],ee)&&arguments[0]instanceof Object&&arguments[1]instanceof bt)for(var a=arguments[0],u=arguments[2],h=arguments[1].getChildBoundables(),f=0;f<h.size();f++){var d=h.get(f);this.getIntersectsOp().intersects(d.getBounds(),a)&&(d instanceof bt?this.queryInternal(a,d,u):d instanceof Kt?u.add(d.getItem()):$.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(t){return t.get(t.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof bt?t+=this.size(n):n instanceof Kt&&(t+=1)}return t}}},{key:"removeItem",value:function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var s=r.next();s instanceof Kt&&s.getItem()===e&&(n=s)}return n!==null&&(t.getChildBoundables().remove(n),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var t=this.itemsTree(this._root);return t===null?new H:t}if(arguments.length===1){for(var e=arguments[0],n=new H,r=e.getChildBoundables().iterator();r.hasNext();){var s=r.next();if(s instanceof bt){var a=this.itemsTree(s);a!==null&&n.add(a)}else s instanceof Kt?n.add(s.getItem()):$.shouldNeverReachHere()}return n.size()<=0?null:n}}},{key:"insert",value:function(t,e){$.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Kt(t,e))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var t=arguments[0],e=new H;return this.boundablesAtLevel(t,this._root,e),e}if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2];if($.isTrue(n>-2),r.getLevel()===n)return s.add(r),null;for(var a=r.getChildBoundables().iterator();a.hasNext();){var u=a.next();u instanceof bt?this.boundablesAtLevel(n,u,s):($.isTrue(u instanceof Kt),n===-1&&s.add(u))}return null}}},{key:"query",value:function(){if(arguments.length===1){var t=arguments[0];this.build();var e=new H;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(arguments.length===2){var n=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,r)}}},{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(arguments.length===2){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(arguments.length===3){var n=arguments[0],r=arguments[1],s=arguments[2],a=this.removeItem(r,s);if(a)return!0;for(var u=null,h=r.getChildBoundables().iterator();h.hasNext();){var f=h.next();if(this.getIntersectsOp().intersects(f.getBounds(),n)&&f instanceof bt&&(a=this.remove(n,f,s))){u=f;break}}return u!==null&&u.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(u),a}}},{key:"createHigherLevels",value:function(t,e){$.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return n.size()===1?n.get(0):this.createHigherLevels(n,e+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof bt){var r=this.depth(n);r>t&&(t=r)}}return t+1}}},{key:"createParentBoundables",value:function(t,e){$.isTrue(!t.isEmpty());var n=new H;n.add(this.createNode(e));var r=new H(t);ge.sort(r,this.getComparator());for(var s=r.iterator();s.hasNext();){var a=s.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(a)}return n}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[q]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new H,this._nodeCapacity=null,arguments.length===0)i.constructor_.call(this,i.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var t=arguments[0];$.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}}])}();me.IntersectsOp=function(){},me.DEFAULT_NODE_CAPACITY=10;var Qr=function(){return g(function i(){l(this,i)},[{key:"distance",value:function(i,t){}}])}(),Xt=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"createParentBoundablesFromVerticalSlices",value:function(e,n){$.isTrue(e.length>0);for(var r=new H,s=0;s<e.length;s++)r.addAll(this.createParentBoundablesFromVerticalSlice(e[s],n));return r}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var e=arguments[0],n=arguments[1];return this.nearestNeighbourK(e,D.POSITIVE_INFINITY,n)}if(arguments.length===3){var r=arguments[0],s=arguments[2],a=arguments[1],u=new Ze;u.add(r);for(var h=new Ze;!u.isEmpty()&&a>=0;){var f=u.poll(),d=f.getDistance();if(d>=a)break;f.isLeaves()?h.size()<s?h.add(f):(h.peek().getDistance()>d&&(h.poll(),h.add(f)),a=h.peek().getDistance()):f.expandToQueue(u,a)}return t.getItems(h)}}},{key:"createNode",value:function(e){return new ci(e)}},{key:"size",value:function(){return arguments.length===0?I(t,"size",this,1).call(this):I(t,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof gt))return I(t,"insert",this,1).apply(this,arguments);var e=arguments[0],n=arguments[1];if(e.isNull())return null;I(t,"insert",this,1).call(this,e,n)}},{key:"getIntersectsOp",value:function(){return t.intersectsOp}},{key:"verticalSlices",value:function(e,n){for(var r=Math.trunc(Math.ceil(e.size()/n)),s=new Array(n).fill(null),a=e.iterator(),u=0;u<n;u++){s[u]=new H;for(var h=0;a.hasNext()&&h<r;){var f=a.next();s[u].add(f),h++}}return s}},{key:"query",value:function(){if(arguments.length===1){var e=arguments[0];return I(t,"query",this,1).call(this,e)}if(arguments.length===2){var n=arguments[0],r=arguments[1];I(t,"query",this,1).call(this,n,r)}}},{key:"getComparator",value:function(){return t.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(e,n){return I(t,"createParentBoundables",this,1).call(this,e,n)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof gt){var e=arguments[0],n=arguments[1];return I(t,"remove",this,1).call(this,e,n)}return I(t,"remove",this,1).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?I(t,"depth",this,1).call(this):I(t,"depth",this,1).apply(this,arguments)}},{key:"createParentBoundables",value:function(e,n){$.isTrue(!e.isEmpty());var r=Math.trunc(Math.ceil(e.size()/this.getNodeCapacity())),s=new H(e);ge.sort(s,t.xComparator);var a=this.verticalSlices(s,Math.trunc(Math.ceil(Math.sqrt(r))));return this.createParentBoundablesFromVerticalSlices(a,n)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(J(arguments[0],Qr)){var e=arguments[0];if(this.isEmpty())return null;var n=new ve(this.getRoot(),this.getRoot(),e);return this.nearestNeighbour(n)}if(arguments[0]instanceof ve){var r=arguments[0],s=D.POSITIVE_INFINITY,a=null,u=new Ze;for(u.add(r);!u.isEmpty()&&s>0;){var h=u.poll(),f=h.getDistance();if(f>=s)break;h.isLeaves()?(s=f,a=h):h.expandToQueue(u,s)}return a===null?null:[a.getBoundable(0).getItem(),a.getBoundable(1).getItem()]}}else{if(arguments.length===2){var d=arguments[0],_=arguments[1];if(this.isEmpty()||d.isEmpty())return null;var S=new ve(this.getRoot(),d.getRoot(),_);return this.nearestNeighbour(S)}if(arguments.length===3){var O=arguments[2],b=new Kt(arguments[0],arguments[1]),X=new ve(this.getRoot(),b,O);return this.nearestNeighbour(X)[0]}if(arguments.length===4){var rt=arguments[2],nt=arguments[3],ht=new Kt(arguments[0],arguments[1]),Nt=new ve(this.getRoot(),ht,rt);return this.nearestNeighbourK(Nt,nt)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var e=arguments[0],n=arguments[1],r=D.POSITIVE_INFINITY,s=new Ze;for(s.add(e);!s.isEmpty();){var a=s.poll(),u=a.getDistance();if(u>n)return!1;if(a.maximumDistance()<=n)return!0;if(a.isLeaves()){if((r=u)<=n)return!0}else a.expandToQueue(s,r)}return!1}if(arguments.length===3){var h=arguments[0],f=arguments[1],d=arguments[2],_=new ve(this.getRoot(),h.getRoot(),f);return this.isWithinDistance(_,d)}}},{key:"interfaces_",get:function(){return[Kr,q]}}],[{key:"constructor_",value:function(){if(arguments.length===0)t.constructor_.call(this,t.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var e=arguments[0];me.constructor_.call(this,e)}}},{key:"centreX",value:function(e){return t.avg(e.getMinX(),e.getMaxX())}},{key:"avg",value:function(e,n){return(e+n)/2}},{key:"getItems",value:function(e){for(var n=new Array(e.size()).fill(null),r=0;!e.isEmpty();){var s=e.poll();n[r]=s.getBoundable(0).getItem(),r++}return n}},{key:"centreY",value:function(e){return t.avg(e.getMinY(),e.getMaxY())}}])}(me),ci=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"computeBounds",value:function(){for(var e=null,n=this.getChildBoundables().iterator();n.hasNext();){var r=n.next();e===null?e=new gt(r.getBounds()):e.expandToInclude(r.getBounds())}return e}}],[{key:"constructor_",value:function(){var e=arguments[0];bt.constructor_.call(this,e)}}])}(bt);Xt.STRtreeNode=ci,Xt.xComparator=new(function(){return g(function i(){l(this,i)},[{key:"interfaces_",get:function(){return[Tt]}},{key:"compare",value:function(i,t){return me.compareDoubles(Xt.centreX(i.getBounds()),Xt.centreX(t.getBounds()))}}])}()),Xt.yComparator=new(function(){return g(function i(){l(this,i)},[{key:"interfaces_",get:function(){return[Tt]}},{key:"compare",value:function(i,t){return me.compareDoubles(Xt.centreY(i.getBounds()),Xt.centreY(t.getBounds()))}}])}()),Xt.intersectsOp=new(function(){return g(function i(){l(this,i)},[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(i,t){return i.intersects(t)}}])}()),Xt.DEFAULT_NODE_CAPACITY=10;var $r=function(){function i(){l(this,i)}return g(i,null,[{key:"relativeSign",value:function(t,e){return t<e?-1:t>e?1:0}},{key:"compare",value:function(t,e,n){if(e.equals2D(n))return 0;var r=i.relativeSign(e.x,n.x),s=i.relativeSign(e.y,n.y);switch(t){case 0:return i.compareValue(r,s);case 1:return i.compareValue(s,r);case 2:return i.compareValue(s,-r);case 3:return i.compareValue(-r,s);case 4:return i.compareValue(-r,-s);case 5:return i.compareValue(-s,-r);case 6:return i.compareValue(-s,r);case 7:return i.compareValue(r,-s)}return $.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}}])}(),ts=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(i){i.print(this.coord),i.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(i){var t=i;return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:this._isInterior?t._isInterior?$r.compare(this._segmentOctant,this.coord,t.coord):1:-1}},{key:"isEndPoint",value:function(i){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===i}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[z]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var i=arguments[0],t=arguments[1],e=arguments[2],n=arguments[3];this._segString=i,this.coord=new p(t),this.segmentIndex=e,this._segmentOctant=n,this._isInterior=!t.equals2D(i.getCoordinate(e))}}])}(),es=function(){return g(function i(){l(this,i)},[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])}(),ns=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"getSplitCoordinates",value:function(){var i=new Te;this.addEndpoints();for(var t=this.iterator(),e=t.next();t.hasNext();){var n=t.next();this.addEdgeCoordinates(e,n,i),e=n}return i.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var i=new H;this.findCollapsesFromInsertedNodes(i),this.findCollapsesFromExistingVertices(i);for(var t=i.iterator();t.hasNext();){var e=t.next().intValue();this.add(this._edge.getCoordinate(e),e)}}},{key:"createSplitEdgePts",value:function(i,t){var e=t.segmentIndex-i.segmentIndex+2;if(e===2)return[new p(i.coord),new p(t.coord)];var n=this._edge.getCoordinate(t.segmentIndex),r=t.isInterior()||!t.coord.equals2D(n);r||e--;var s=new Array(e).fill(null),a=0;s[a++]=new p(i.coord);for(var u=i.segmentIndex+1;u<=t.segmentIndex;u++)s[a++]=this._edge.getCoordinate(u);return r&&(s[a]=new p(t.coord)),s}},{key:"print",value:function(i){i.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(i)}},{key:"findCollapsesFromExistingVertices",value:function(i){for(var t=0;t<this._edge.size()-2;t++){var e=this._edge.getCoordinate(t);this._edge.getCoordinate(t+1);var n=this._edge.getCoordinate(t+2);e.equals2D(n)&&i.add(Fe.valueOf(t+1))}}},{key:"addEdgeCoordinates",value:function(i,t,e){var n=this.createSplitEdgePts(i,t);e.add(n,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(i){this.addEndpoints(),this.addCollapsedNodes();for(var t=this.iterator(),e=t.next();t.hasNext();){var n=t.next(),r=this.createSplitEdge(e,n);i.add(r),e=n}}},{key:"findCollapseIndex",value:function(i,t,e){if(!i.coord.equals2D(t.coord))return!1;var n=t.segmentIndex-i.segmentIndex;return t.isInterior()||n--,n===1&&(e[0]=i.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(i){for(var t=new Array(1).fill(null),e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.findCollapseIndex(n,r,t)&&i.add(Fe.valueOf(t[0])),n=r}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var i=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(i),i)}},{key:"createSplitEdge",value:function(i,t){var e=this.createSplitEdgePts(i,t);return new ue(e,this._edge.getData())}},{key:"add",value:function(i,t){var e=new ts(this._edge,i,t,this._edge.getSegmentOctant(t)),n=this._nodeMap.get(e);return n!==null?($.isTrue(n.coord.equals2D(i),"Found equal nodes with different coordinates"),n):(this._nodeMap.put(e,e),e)}},{key:"checkSplitEdgesCorrectness",value:function(i){var t=this._edge.getCoordinates(),e=i.get(0).getCoordinate(0);if(!e.equals2D(t[0]))throw new xt("bad split edge start point at "+e);var n=i.get(i.size()-1).getCoordinates(),r=n[n.length-1];if(!r.equals2D(t[t.length-1]))throw new xt("bad split edge end point at "+r)}}],[{key:"constructor_",value:function(){this._nodeMap=new Le,this._edge=null;var i=arguments[0];this._edge=i}}])}(),is=function(){function i(){l(this,i)}return g(i,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],e=arguments[1];if(t===0&&e===0)throw new F("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof p&&arguments[1]instanceof p){var s=arguments[0],a=arguments[1],u=a.x-s.x,h=a.y-s.y;if(u===0&&h===0)throw new F("Cannot compute the octant for two identical points "+s);return i.octant(u,h)}}}])}(),rs=function(){return g(function i(){l(this,i)},[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(i){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(i){}},{key:"getData",value:function(){}}])}(),ss=function(){return g(function i(){l(this,i)},[{key:"addIntersection",value:function(i,t){}},{key:"interfaces_",get:function(){return[rs]}}])}(),ue=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{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:is.octant(t,e)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(arguments.length===4){var n=arguments[1],r=arguments[3],s=new p(arguments[0].getIntersection(r));this.addIntersection(s,n)}}},{key:"toString",value:function(){return pn.toLineString(new Ce(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(t,e){var n=e,r=n+1;if(r<this._pts.length){var s=this._pts[r];t.equals2D(s)&&(n=r)}return this._nodeList.add(t,n)}},{key:"addIntersections",value:function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)}},{key:"interfaces_",get:function(){return[ss]}}],[{key:"constructor_",value:function(){this._nodeList=new ns(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(arguments.length===1){var t=arguments[0],e=new H;return i.getNodedSubstrings(t,e),e}if(arguments.length===2)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();)r.next().getNodeList().addSplitEdges(n)}}])}(),Rt=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof i){var t=arguments[0],e=j.index(this.p0,this.p1,t.p0),n=j.index(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof p){var r=arguments[0];return j.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){if(!(t instanceof i))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)}},{key:"intersection",value:function(t){var e=new ae;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 p){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new p(t);var e=this.projectionFactor(t),n=new p;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof i){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 u=this.project(r.p0);s<0&&(u=this.p0),s>1&&(u=this.p1);var h=this.project(r.p1);return a<0&&(h=this.p0),a>1&&(h=this.p1),new i(u,h)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&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 t===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(t){return zt.pointToLinePerpendicular(t,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return i.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,r=e*e+n*n;return r<=0?D.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r}},{key:"closestPoints",value:function(t){var e=this.intersection(t);if(e!==null)return[e,e];var n=new Array(2).fill(null),r=D.MAX_VALUE,s=null,a=this.closestPoint(t.p0);r=a.distance(t.p0),n[0]=a,n[1]=t.p0;var u=this.closestPoint(t.p1);(s=u.distance(t.p1))<r&&(r=s,n[0]=u,n[1]=t.p1);var h=t.closestPoint(this.p0);(s=h.distance(this.p0))<r&&(r=s,n[0]=this.p0,n[1]=h);var f=t.closestPoint(this.p1);return(s=f.distance(this.p1))<r&&(r=s,n[0]=this.p1,n[1]=f),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=t,n=this.p0.compareTo(e.p0);return n!==0?n:this.p1.compareTo(e.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 cn.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),r=this.p0.y+t*(this.p1.y-this.p0.y),s=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,u=Math.sqrt(s*s+a*a),h=0,f=0;if(e!==0){if(u<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");h=e*s/u,f=e*a/u}return new p(n-f,r+h)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(arguments.length===2){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||D.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(),r=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),s=e*e+n*n,a=e*e-n*n,u=t.getX(),h=t.getY();return new p((-a*u-2*e*n*h-2*e*r)/s,(a*h-2*e*n*u-2*n*r)/s)}},{key:"distance",value:function(){if(arguments[0]instanceof i){var t=arguments[0];return zt.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof p){var e=arguments[0];return zt.pointToSegment(e,this.p0,this.p1)}}},{key:"pointAlong",value:function(t){var e=new p;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=D.doubleToLongBits(this.p0.x);t^=31*D.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=D.doubleToLongBits(this.p1.x);return n^=31*D.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))}},{key:"interfaces_",get:function(){return[z,q]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)i.constructor_.call(this,new p,new p);else if(arguments.length===1){var t=arguments[0];i.constructor_.call(this,t.p0,t.p1)}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this.p0=e,this.p1=n}else if(arguments.length===4){var r=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];i.constructor_.call(this,new p(r,s),new p(a,u))}}},{key:"midPoint",value:function(t,e){return new p((t.x+e.x)/2,(t.y+e.y)/2)}}])}(),as=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var i=arguments[1],t=arguments[2],e=arguments[3];arguments[0].getLineSegment(i,this._overlapSeg1),t.getLineSegment(e,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Rt,this._overlapSeg2=new Rt}}])}(),fi=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"getLineSegment",value:function(i,t){t.p0=this._pts[i],t.p1=this._pts[i+1]}},{key:"computeSelect",value:function(i,t,e,n){var r=this._pts[t],s=this._pts[e];if(e-t==1)return n.select(this,t),null;if(!i.intersects(r,s))return null;var a=Math.trunc((t+e)/2);t<a&&this.computeSelect(i,t,a,n),a<e&&this.computeSelect(i,a,e,n)}},{key:"getCoordinates",value:function(){for(var i=new Array(this._end-this._start+1).fill(null),t=0,e=this._start;e<=this._end;e++)i[t++]=this._pts[e];return i}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var i=arguments[0],t=arguments[1];this.computeOverlaps(this._start,this._end,i,i._start,i._end,t)}else if(arguments.length===6){var e=arguments[0],n=arguments[1],r=arguments[2],s=arguments[3],a=arguments[4],u=arguments[5];if(n-e==1&&a-s==1)return u.overlap(this,e,r,s),null;if(!this.overlaps(e,n,r,s,a))return null;var h=Math.trunc((e+n)/2),f=Math.trunc((s+a)/2);e<h&&(s<f&&this.computeOverlaps(e,h,r,s,f,u),f<a&&this.computeOverlaps(e,h,r,f,a,u)),h<n&&(s<f&&this.computeOverlaps(h,n,r,s,f,u),f<a&&this.computeOverlaps(h,n,r,f,a,u))}}},{key:"setId",value:function(i){this._id=i}},{key:"select",value:function(i,t){this.computeSelect(i,this._start,this._end,t)}},{key:"getEnvelope",value:function(){if(this._env===null){var i=this._pts[this._start],t=this._pts[this._end];this._env=new gt(i,t)}return this._env}},{key:"overlaps",value:function(i,t,e,n,r){return gt.intersects(this._pts[i],this._pts[t],e._pts[n],e._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 i=arguments[0],t=arguments[1],e=arguments[2],n=arguments[3];this._pts=i,this._start=t,this._end=e,this._context=n}}])}(),us=function(){function i(){l(this,i)}return g(i,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 r=Ct.quadrant(t[n],t[n+1]),s=e+1;s<t.length&&!(!t[s-1].equals2D(t[s])&&Ct.quadrant(t[s-1],t[s])!==r);)s++;return s-1}},{key:"getChains",value:function(){if(arguments.length===1){var t=arguments[0];return i.getChains(t,null)}if(arguments.length===2){var e=arguments[0],n=arguments[1],r=new H,s=0;do{var a=i.findChainEnd(e,s),u=new fi(e,s,a,n);r.add(u),s=a}while(s<e.length-1);return r}}}])}(),In=function(){return g(function i(){l(this,i)},[{key:"computeNodes",value:function(i){}},{key:"getNodedSubstrings",value:function(){}}])}(),gi=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"setSegmentIntersector",value:function(i){this._segInt=i}},{key:"interfaces_",get:function(){return[In]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setSegmentIntersector(i)}}}}])}(),Nn=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return ue.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(e){for(var n=us.getChains(e.getCoordinates(),e).iterator();n.hasNext();){var r=n.next();r.setId(this._idCounter++),this._index.insert(r.getEnvelope(),r),this._monoChains.add(r)}}},{key:"computeNodes",value:function(e){this._nodedSegStrings=e;for(var n=e.iterator();n.hasNext();)this.add(n.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var e=new vi(this._segInt),n=this._monoChains.iterator();n.hasNext();)for(var r=n.next(),s=this._index.query(r.getEnvelope()).iterator();s.hasNext();){var a=s.next();if(a.getId()>r.getId()&&(r.computeOverlaps(a,e),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new H,this._index=new Xt,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var e=arguments[0];gi.constructor_.call(this,e)}}}}])}(gi),vi=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"overlap",value:function(){if(arguments.length!==4)return I(t,"overlap",this,1).apply(this,arguments);var e=arguments[1],n=arguments[2],r=arguments[3],s=arguments[0].getContext(),a=n.getContext();this._si.processIntersections(s,e,a,r)}}],[{key:"constructor_",value:function(){this._si=null;var e=arguments[0];this._si=e}}])}(as);Nn.SegmentOverlapAction=vi;var qt=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"isDeletable",value:function(t,e,n,r){var s=this._inputLine[t],a=this._inputLine[e],u=this._inputLine[n];return!!this.isConcave(s,a,u)&&!!this.isShallow(s,a,u,r)&&this.isShallowSampled(s,a,t,n,r)}},{key:"deleteShallowConcavities",value:function(){for(var t=1,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e),r=!1;n<this._inputLine.length;){var s=!1;this.isDeletable(t,e,n,this._distanceTol)&&(this._isDeleted[e]=i.DELETE,s=!0,r=!0),t=s?n:e,e=this.findNextNonDeletedIndex(t),n=this.findNextNonDeletedIndex(e)}return r}},{key:"isShallowConcavity",value:function(t,e,n,r){return j.index(t,e,n)===this._angleOrientation&&zt.pointToSegment(e,t,n)<r}},{key:"isShallowSampled",value:function(t,e,n,r,s){var a=Math.trunc((r-n)/i.NUM_PTS_TO_CHECK);a<=0&&(a=1);for(var u=n;u<r;u+=a)if(!this.isShallow(t,e,this._inputLine[u],s))return!1;return!0}},{key:"isConcave",value:function(t,e,n){var r=j.index(t,e,n)===this._angleOrientation;return r}},{key:"simplify",value:function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=j.CLOCKWISE),this._isDeleted=new 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 e=t+1;e<this._inputLine.length&&this._isDeleted[e]===i.DELETE;)e++;return e}},{key:"isShallow",value:function(t,e,n,r){return zt.pointToSegment(e,t,n)<r}},{key:"collapseLine",value:function(){for(var t=new Te,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==i.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=j.COUNTERCLOCKWISE;var t=arguments[0];this._inputLine=t}},{key:"simplify",value:function(t,e){return new i(t).simplify(e)}}])}();qt.INIT=0,qt.DELETE=1,qt.KEEP=1,qt.NUM_PTS_TO_CHECK=10;var mi=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getCoordinates",value:function(){return this._ptList.toArray(i.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"addPt",value:function(t){var e=new p(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 r=t.length-1;r>=0;r--)this.addPt(t[r])}},{key:"isRedundant",value:function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance}},{key:"toString",value:function(){return new ce().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var t=new p(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 H}}])}();mi.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var Ot=function(){function i(){l(this,i)}return g(i,null,[{key:"toDegrees",value:function(t){return 180*t/Math.PI}},{key:"normalize",value:function(t){for(;t>Math.PI;)t-=i.PI_TIMES_2;for(;t<=-Math.PI;)t+=i.PI_TIMES_2;return t}},{key:"angle",value:function(){if(arguments.length===1){var t=arguments[0];return Math.atan2(t.y,t.x)}if(arguments.length===2){var e=arguments[0],n=arguments[1],r=n.x-e.x,s=n.y-e.y;return Math.atan2(s,r)}}},{key:"isAcute",value:function(t,e,n){var r=t.x-e.x,s=t.y-e.y;return r*(n.x-e.x)+s*(n.y-e.y)>0}},{key:"isObtuse",value:function(t,e,n){var r=t.x-e.x,s=t.y-e.y;return r*(n.x-e.x)+s*(n.y-e.y)<0}},{key:"interiorAngle",value:function(t,e,n){var r=i.angle(e,t),s=i.angle(e,n);return Math.abs(s-r)}},{key:"normalizePositive",value:function(t){if(t<0){for(;t<0;)t+=i.PI_TIMES_2;t>=i.PI_TIMES_2&&(t=0)}else{for(;t>=i.PI_TIMES_2;)t-=i.PI_TIMES_2;t<0&&(t=0)}return t}},{key:"angleBetween",value:function(t,e,n){var r=i.angle(e,t),s=i.angle(e,n);return i.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,e){var n=Math.sin(e-t);return n>0?i.COUNTERCLOCKWISE:n<0?i.CLOCKWISE:i.NONE}},{key:"angleBetweenOriented",value:function(t,e,n){var r=i.angle(e,t),s=i.angle(e,n)-r;return s<=-Math.PI?s+i.PI_TIMES_2:s>Math.PI?s-i.PI_TIMES_2:s}}])}();Ot.PI_TIMES_2=2*Math.PI,Ot.PI_OVER_2=Math.PI/2,Ot.PI_OVER_4=Math.PI/4,Ot.COUNTERCLOCKWISE=j.COUNTERCLOCKWISE,Ot.CLOCKWISE=j.CLOCKWISE,Ot.NONE=j.COLLINEAR;var Re=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{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=j.index(this._s0,this._s1,this._s2),r=n===j.CLOCKWISE&&this._side===C.LEFT||n===j.COUNTERCLOCKWISE&&this._side===C.RIGHT;n===0?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)}},{key:"addLineEndCap",value:function(t,e){var n=new Rt(t,e),r=new Rt;this.computeOffsetSegment(n,C.LEFT,this._distance,r);var s=new Rt;this.computeOffsetSegment(n,C.RIGHT,this._distance,s);var a=e.x-t.x,u=e.y-t.y,h=Math.atan2(u,a);switch(this._bufParams.getEndCapStyle()){case P.CAP_ROUND:this._segList.addPt(r.p1),this.addDirectedFillet(e,h+Math.PI/2,h-Math.PI/2,j.CLOCKWISE,this._distance),this._segList.addPt(s.p1);break;case P.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(s.p1);break;case P.CAP_SQUARE:var f=new p;f.x=Math.abs(this._distance)*Math.cos(h),f.y=Math.abs(this._distance)*Math.sin(h);var d=new p(r.p1.x+f.x,r.p1.y+f.y),_=new p(s.p1.x+f.x,s.p1.y+f.y);this._segList.addPt(d),this._segList.addPt(_)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(t,e,n,r){var s=cn.intersection(e.p0,e.p1,n.p0,n.p1);if(s!==null&&(r<=0?1:s.distance(t)/Math.abs(r))<=this._bufParams.getMitreLimit())return this._segList.addPt(s),null;this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*i.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===P.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===P.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&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 p(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new p(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new p(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new p(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,r,s){var a=e.x-t.x,u=e.y-t.y,h=Math.atan2(u,a),f=n.x-t.x,d=n.y-t.y,_=Math.atan2(d,f);r===j.CLOCKWISE?h<=_&&(h+=2*Math.PI):h>=_&&(h-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,h,_,r,s),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,r){var s=this._seg0.p1,a=Ot.angle(s,this._seg0.p0),u=Ot.angleBetweenOriented(this._seg0.p0,s,this._seg1.p1)/2,h=Ot.normalize(a+u),f=Ot.normalize(h+Math.PI),d=r*n,_=n-d*Math.abs(Math.sin(u)),S=s.x+d*Math.cos(f),O=s.y+d*Math.sin(f),b=new p(S,O),X=new Rt(s,b),rt=X.pointAlongOffset(1,_),nt=X.pointAlongOffset(1,-_);this._side===C.LEFT?(this._segList.addPt(rt),this._segList.addPt(nt)):(this._segList.addPt(nt),this._segList.addPt(rt))}},{key:"addDirectedFillet",value:function(t,e,n,r,s){var a=r===j.CLOCKWISE?-1:1,u=Math.abs(e-n),h=Math.trunc(u/this._filletAngleQuantum+.5);if(h<1)return null;for(var f=u/h,d=new p,_=0;_<h;_++){var S=e+a*_*f;d.x=t.x+s*Math.cos(S),d.y=t.y+s*Math.sin(S),this._segList.addPt(d)}}},{key:"computeOffsetSegment",value:function(t,e,n,r){var s=e===C.LEFT?1:-1,a=t.p1.x-t.p0.x,u=t.p1.y-t.p0.y,h=Math.sqrt(a*a+u*u),f=s*n*a/h,d=s*n*u/h;r.p0.x=t.p0.x-d,r.p0.y=t.p0.y+f,r.p1.x=t.p1.x-d,r.p1.y=t.p1.y+f}},{key:"addInsideTurn",value:function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*i.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new p((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new p((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 p(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 mi,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*i.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()===P.JOIN_BEVEL||this._bufParams.getJoinStyle()===P.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,j.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 Rt,this._seg1=new Rt,this._offset0=new Rt,this._offset1=new Rt,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._precisionModel=t,this._bufParams=e,this._li=new ae,this._filletAngleQuantum=Math.PI/2/e.getQuadrantSegments(),e.getQuadrantSegments()>=8&&e.getJoinStyle()===P.JOIN_ROUND&&(this._closingSegLengthFactor=i.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}}])}();Re.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Re.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Re.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Re.MAX_CLOSING_SEG_LEN_FACTOR=80;var os=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getOffsetCurve",value:function(t,e){if(this._distance=e,e===0)return null;var n=e<0,r=Math.abs(e),s=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],s):this.computeOffsetCurve(t,n,s);var a=s.getCoordinates();return n&&pt.reverse(a),a}},{key:"computeSingleSidedBufferCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var s=qt.simplify(t,-r),a=s.length-1;n.initSideSegments(s[a],s[a-1],C.LEFT),n.addFirstSegment();for(var u=a-2;u>=0;u--)n.addNextSegment(s[u],!0)}else{n.addSegments(t,!1);var h=qt.simplify(t,r),f=h.length-1;n.initSideSegments(h[0],h[1],C.LEFT),n.addFirstSegment();for(var d=2;d<=f;d++)n.addNextSegment(h[d],!0)}n.addLastSegment(),n.closeRing()}},{key:"computeRingBufferCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);e===C.RIGHT&&(r=-r);var s=qt.simplify(t,r),a=s.length-1;n.initSideSegments(s[a-1],s[0],e);for(var u=1;u<=a;u++){var h=u!==1;n.addNextSegment(s[u],h)}n.closeRing()}},{key:"computeLineBufferCurve",value:function(t,e){var n=this.simplifyTolerance(this._distance),r=qt.simplify(t,n),s=r.length-1;e.initSideSegments(r[0],r[1],C.LEFT);for(var a=2;a<=s;a++)e.addNextSegment(r[a],!0);e.addLastSegment(),e.addLineEndCap(r[s-1],r[s]);var u=qt.simplify(t,-n),h=u.length-1;e.initSideSegments(u[h],u[h-1],C.LEFT);for(var f=h-2;f>=0;f--)e.addNextSegment(u[f],!0);e.addLastSegment(),e.addLineEndCap(u[1],u[0]),e.closeRing()}},{key:"computePointCurve",value:function(t,e){switch(this._bufParams.getEndCapStyle()){case P.CAP_ROUND:e.createCircle(t);break;case P.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),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var s=e<0;this.computeSingleSidedBufferCurve(t,s,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(t){return t*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(n===0)return i.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()}},{key:"computeOffsetCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var s=qt.simplify(t,-r),a=s.length-1;n.initSideSegments(s[a],s[a-1],C.LEFT),n.addFirstSegment();for(var u=a-2;u>=0;u--)n.addNextSegment(s[u],!0)}else{var h=qt.simplify(t,r),f=h.length-1;n.initSideSegments(h[0],h[1],C.LEFT),n.addFirstSegment();for(var d=2;d<=f;d++)n.addNextSegment(h[d],!0)}n.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(t){return t===0||t<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(t){return new Re(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=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new p(t[n]);return e}}])}(),yi=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var i=arguments[0],t=new H,e=this._subgraphs.iterator();e.hasNext();){var n=e.next(),r=n.getEnvelope();i.y<r.getMinY()||i.y>r.getMaxY()||this.findStabbedSegments(i,n.getDirectedEdges(),t)}return t}if(arguments.length===3){if(J(arguments[2],ee)&&arguments[0]instanceof p&&arguments[1]instanceof xn){for(var s=arguments[0],a=arguments[1],u=arguments[2],h=a.getEdge().getCoordinates(),f=0;f<h.length-1;f++)if(this._seg.p0=h[f],this._seg.p1=h[f+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||j.index(this._seg.p0,this._seg.p1,s)===j.RIGHT)){var d=a.getDepth(C.LEFT);this._seg.p0.equals(h[f])||(d=a.getDepth(C.RIGHT));var _=new di(this._seg,d);u.add(_)}}else if(J(arguments[2],ee)&&arguments[0]instanceof p&&J(arguments[1],ee))for(var S=arguments[0],O=arguments[2],b=arguments[1].iterator();b.hasNext();){var X=b.next();X.isForward()&&this.findStabbedSegments(S,X,O)}}}},{key:"getDepth",value:function(i){var t=this.findStabbedSegments(i);return t.size()===0?0:ge.min(t)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Rt;var i=arguments[0];this._subgraphs=i}}])}(),di=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"compareTo",value:function(i){var t=i;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 e!==0||(e=-1*t._upwardSeg.orientationIndex(this._upwardSeg))!==0?e:this._upwardSeg.compareTo(t._upwardSeg)}},{key:"compareX",value:function(i,t){var e=i.p0.compareTo(t.p0);return e!==0?e:i.p1.compareTo(t.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[z]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var i=arguments[0],t=arguments[1];this._upwardSeg=new Rt(i),this._leftDepth=t}}])}();yi.DepthSegment=di;var _i=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,null,[{key:"constructor_",value:function(){W.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}])}(W),Sn=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"getY",value:function(){var t=this.y/this.w;if(D.isNaN(t)||D.isInfinite(t))throw new _i;return t}},{key:"getX",value:function(){var t=this.x/this.w;if(D.isNaN(t)||D.isInfinite(t))throw new _i;return t}},{key:"getCoordinate",value:function(){var t=new p;return t.x=this.getX(),t.y=this.getY(),t}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],n=arguments[1];this.x=e,this.y=n,this.w=1}else if(arguments[0]instanceof i&&arguments[1]instanceof i){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 p&&arguments[1]instanceof p){var a=arguments[0],u=arguments[1];this.x=a.y-u.y,this.y=u.x-a.x,this.w=a.x*u.y-u.x*a.y}}else if(arguments.length===3){var h=arguments[0],f=arguments[1],d=arguments[2];this.x=h,this.y=f,this.w=d}else if(arguments.length===4){var _=arguments[0],S=arguments[1],O=arguments[2],b=arguments[3],X=_.y-S.y,rt=S.x-_.x,nt=_.x*S.y-S.x*_.y,ht=O.y-b.y,Nt=b.x-O.x,St=O.x*b.y-b.x*O.y;this.x=rt*St-Nt*nt,this.y=ht*nt-X*St,this.w=X*Nt-ht*rt}}}])}(),ls=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"area",value:function(){return i.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return i.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(t){if(t===null)throw new F("Supplied point is null.");return i.interpolateZ(t,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return i.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return i.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return i.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return i.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return i.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return i.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,r){return t*r-e*n}},{key:"interpolateZ",value:function(t,e,n,r){var s=e.x,a=e.y,u=n.x-s,h=r.x-s,f=n.y-a,d=r.y-a,_=u*d-h*f,S=t.x-s,O=t.y-a,b=(d*S-h*O)/_,X=(-f*S+u*O)/_;return e.getZ()+b*(n.getZ()-e.getZ())+X*(r.getZ()-e.getZ())}},{key:"longestSideLength",value:function(t,e,n){var r=t.distance(e),s=e.distance(n),a=n.distance(t),u=r;return s>u&&(u=s),a>u&&(u=a),u}},{key:"circumcentreDD",value:function(t,e,n){var r=Z.valueOf(t.x).subtract(n.x),s=Z.valueOf(t.y).subtract(n.y),a=Z.valueOf(e.x).subtract(n.x),u=Z.valueOf(e.y).subtract(n.y),h=Z.determinant(r,s,a,u).multiply(2),f=r.sqr().add(s.sqr()),d=a.sqr().add(u.sqr()),_=Z.determinant(s,f,u,d),S=Z.determinant(r,f,a,d),O=Z.valueOf(n.x).subtract(_.divide(h)).doubleValue(),b=Z.valueOf(n.y).add(S.divide(h)).doubleValue();return new p(O,b)}},{key:"isAcute",value:function(t,e,n){return!!Ot.isAcute(t,e,n)&&!!Ot.isAcute(e,n,t)&&!!Ot.isAcute(n,t,e)}},{key:"circumcentre",value:function(t,e,n){var r=n.x,s=n.y,a=t.x-r,u=t.y-s,h=e.x-r,f=e.y-s,d=2*i.det(a,u,h,f),_=i.det(u,a*a+u*u,f,h*h+f*f),S=i.det(a,a*a+u*u,h,h*h+f*f);return new p(r-_/d,s+S/d)}},{key:"perpendicularBisector",value:function(t,e){var n=e.x-t.x,r=e.y-t.y,s=new Sn(t.x+n/2,t.y+r/2,1),a=new Sn(t.x-r+n/2,t.y+n+r/2,1);return new Sn(s,a)}},{key:"angleBisector",value:function(t,e,n){var r=e.distance(t),s=r/(r+e.distance(n)),a=n.x-t.x,u=n.y-t.y;return new p(t.x+s*a,t.y+s*u)}},{key:"area3D",value:function(t,e,n){var r=e.x-t.x,s=e.y-t.y,a=e.getZ()-t.getZ(),u=n.x-t.x,h=n.y-t.y,f=n.getZ()-t.getZ(),d=s*f-a*h,_=a*u-r*f,S=r*h-s*u,O=d*d+_*_+S*S,b=Math.sqrt(O)/2;return b}},{key:"centroid",value:function(t,e,n){var r=(t.x+e.x+n.x)/3,s=(t.y+e.y+n.y)/3;return new p(r,s)}},{key:"inCentre",value:function(t,e,n){var r=e.distance(n),s=t.distance(n),a=t.distance(e),u=r+s+a,h=(r*t.x+s*e.x+a*n.x)/u,f=(r*t.y+s*e.y+a*n.y)/u;return new p(h,f)}}])}(),hs=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"addRingSide",value:function(i,t,e,n,r){if(t===0&&i.length<Se.MINIMUM_VALID_SIZE)return null;var s=n,a=r;i.length>=Se.MINIMUM_VALID_SIZE&&j.isCCW(i)&&(s=r,a=n,e=C.opposite(e));var u=this._curveBuilder.getRingCurve(i,e,t);this.addCurve(u,s,a)}},{key:"addRingBothSides",value:function(i,t){this.addRingSide(i,t,C.LEFT,y.EXTERIOR,y.INTERIOR),this.addRingSide(i,t,C.RIGHT,y.INTERIOR,y.EXTERIOR)}},{key:"addPoint",value:function(i){if(this._distance<=0)return null;var t=i.getCoordinates(),e=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(e,y.EXTERIOR,y.INTERIOR)}},{key:"addPolygon",value:function(i){var t=this._distance,e=C.LEFT;this._distance<0&&(t=-this._distance,e=C.RIGHT);var n=i.getExteriorRing(),r=pt.removeRepeatedPoints(n.getCoordinates());if(this._distance<0&&this.isErodedCompletely(n,this._distance)||this._distance<=0&&r.length<3)return null;this.addRingSide(r,t,e,y.EXTERIOR,y.INTERIOR);for(var s=0;s<i.getNumInteriorRing();s++){var a=i.getInteriorRingN(s),u=pt.removeRepeatedPoints(a.getCoordinates());this._distance>0&&this.isErodedCompletely(a,-this._distance)||this.addRingSide(u,t,C.opposite(e),y.INTERIOR,y.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(i,t){var e=new ls(i[0],i[1],i[2]),n=e.inCentre();return zt.pointToSegment(n,e.p0,e.p1)<Math.abs(t)}},{key:"addLineString",value:function(i){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var t=pt.removeRepeatedPoints(i.getCoordinates());if(pt.isRing(t)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(t,this._distance);else{var e=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(e,y.EXTERIOR,y.INTERIOR)}}},{key:"addCurve",value:function(i,t,e){if(i===null||i.length<2)return null;var n=new ue(i,new Pt(0,y.BOUNDARY,t,e));this._curveList.add(n)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(i){if(i.isEmpty())return null;if(i instanceof ze)this.addPolygon(i);else if(i instanceof Ne)this.addLineString(i);else if(i instanceof fn)this.addPoint(i);else if(i instanceof gn)this.addCollection(i);else if(i instanceof dn)this.addCollection(i);else if(i instanceof yn)this.addCollection(i);else{if(!(i instanceof Lt))throw new Jt(i.getGeometryType());this.addCollection(i)}}},{key:"isErodedCompletely",value:function(i,t){var e=i.getCoordinates();if(e.length<4)return t<0;if(e.length===4)return this.isTriangleErodedCompletely(e,t);var n=i.getEnvelopeInternal(),r=Math.min(n.getHeight(),n.getWidth());return t<0&&2*Math.abs(t)>r}},{key:"addCollection",value:function(i){for(var t=0;t<i.getNumGeometries();t++){var e=i.getGeometryN(t);this.add(e)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new H;var i=arguments[0],t=arguments[1],e=arguments[2];this._inputGeom=i,this._distance=t,this._curveBuilder=e}}])}(),cs=function(){return g(function i(){l(this,i)},[{key:"locate",value:function(i){}}])}(),fs=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,i.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new De;var t=this._parent.getGeometryN(this._index++);return t instanceof Lt?(this._subcollectionIterator=new i(t),this._subcollectionIterator.next()):t}},{key:"remove",value:function(){throw new Jt(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[es]}}],[{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 Lt)}}])}(),gs=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"locate",value:function(t){return i.locate(t,this._geom)}},{key:"interfaces_",get:function(){return[cs]}}],[{key:"constructor_",value:function(){this._geom=null;var t=arguments[0];this._geom=t}},{key:"locatePointInPolygon",value:function(t,e){if(e.isEmpty())return y.EXTERIOR;var n=e.getExteriorRing(),r=i.locatePointInRing(t,n);if(r!==y.INTERIOR)return r;for(var s=0;s<e.getNumInteriorRing();s++){var a=e.getInteriorRingN(s),u=i.locatePointInRing(t,a);if(u===y.BOUNDARY)return y.BOUNDARY;if(u===y.INTERIOR)return y.EXTERIOR}return y.INTERIOR}},{key:"locatePointInRing",value:function(t,e){return e.getEnvelopeInternal().intersects(t)?kn.locateInRing(t,e.getCoordinates()):y.EXTERIOR}},{key:"containsPointInPolygon",value:function(t,e){return y.EXTERIOR!==i.locatePointInPolygon(t,e)}},{key:"locateInGeometry",value:function(t,e){if(e instanceof ze)return i.locatePointInPolygon(t,e);if(e instanceof Lt)for(var n=new fs(e);n.hasNext();){var r=n.next();if(r!==e){var s=i.locateInGeometry(t,r);if(s!==y.EXTERIOR)return s}}return y.EXTERIOR}},{key:"isContained",value:function(t,e){return y.EXTERIOR!==i.locate(t,e)}},{key:"locate",value:function(t,e){return e.isEmpty()?y.EXTERIOR:e.getEnvelopeInternal().intersects(t)?i.locateInGeometry(t,e):y.EXTERIOR}}])}(),vs=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"getNextCW",value:function(i){this.getEdges();var t=this._edgeList.indexOf(i),e=t-1;return t===0&&(e=this._edgeList.size()-1),this._edgeList.get(e)}},{key:"propagateSideLabels",value:function(i){for(var t=y.NONE,e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.isArea(i)&&n.getLocation(i,C.LEFT)!==y.NONE&&(t=n.getLocation(i,C.LEFT))}if(t===y.NONE)return null;for(var r=t,s=this.iterator();s.hasNext();){var a=s.next(),u=a.getLabel();if(u.getLocation(i,C.ON)===y.NONE&&u.setLocation(i,C.ON,r),u.isArea(i)){var h=u.getLocation(i,C.LEFT),f=u.getLocation(i,C.RIGHT);if(f!==y.NONE){if(f!==r)throw new Wt("side location conflict",a.getCoordinate());h===y.NONE&&$.shouldNeverReachHere("found single null side (at "+a.getCoordinate()+")"),r=h}else $.isTrue(u.getLocation(i,C.LEFT)===y.NONE,"found single null side"),u.setLocation(i,C.RIGHT,r),u.setLocation(i,C.LEFT,r)}}}},{key:"getCoordinate",value:function(){var i=this.iterator();return i.hasNext()?i.next().getCoordinate():null}},{key:"print",value:function(i){Mt.out.println("EdgeEndStar: "+this.getCoordinate());for(var t=this.iterator();t.hasNext();)t.next().print(i)}},{key:"isAreaLabelsConsistent",value:function(i){return this.computeEdgeEndLabels(i.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(i){var t=this.getEdges();if(t.size()<=0)return!0;var e=t.size()-1,n=t.get(e).getLabel().getLocation(i,C.LEFT);$.isTrue(n!==y.NONE,"Found unlabelled area edge");for(var r=n,s=this.iterator();s.hasNext();){var a=s.next().getLabel();$.isTrue(a.isArea(i),"Found non-area edge");var u=a.getLocation(i,C.LEFT),h=a.getLocation(i,C.RIGHT);if(u===h||h!==r)return!1;r=u}return!0}},{key:"findIndex",value:function(i){this.iterator();for(var t=0;t<this._edgeList.size();t++)if(this._edgeList.get(t)===i)return t;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new H(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(i,t,e){return this._ptInAreaLocation[i]===y.NONE&&(this._ptInAreaLocation[i]=gs.locate(t,e[i].getGeometry())),this._ptInAreaLocation[i]}},{key:"toString",value:function(){var i=new xe;i.append("EdgeEndStar: "+this.getCoordinate()),i.append(`
|
|
6
|
+
`);for(var t=this.iterator();t.hasNext();){var e=t.next();i.append(e),i.append(`
|
|
7
|
+
`)}return i.toString()}},{key:"computeEdgeEndLabels",value:function(i){for(var t=this.iterator();t.hasNext();)t.next().computeLabel(i)}},{key:"computeLabelling",value:function(i){this.computeEdgeEndLabels(i[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var t=[!1,!1],e=this.iterator();e.hasNext();)for(var n=e.next().getLabel(),r=0;r<2;r++)n.isLine(r)&&n.getLocation(r)===y.BOUNDARY&&(t[r]=!0);for(var s=this.iterator();s.hasNext();)for(var a=s.next(),u=a.getLabel(),h=0;h<2;h++)if(u.isAnyNull(h)){var f=y.NONE;if(t[h])f=y.EXTERIOR;else{var d=a.getCoordinate();f=this.getLocation(h,d,i)}u.setAllLocationsIfNull(h,f)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(i,t){this._edgeMap.put(i,t),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new Le,this._edgeList=null,this._ptInAreaLocation=[y.NONE,y.NONE]}}])}(),ms=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,s=0;s<this._resultAreaEdgeList.size();s++){var a=this._resultAreaEdgeList.get(s),u=a.getSym();if(a.getLabel().isArea())switch(e===null&&a.isInResult()&&(e=a),r){case this._SCANNING_FOR_INCOMING:if(!u.isInResult())continue;n=u,r=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!a.isInResult())continue;n.setNext(a),r=this._SCANNING_FOR_INCOMING}}if(r===this._LINKING_TO_OUTGOING){if(e===null)throw new Wt("no outgoing dirEdge found",this.getCoordinate());$.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),n.setNext(e)}}},{key:"insert",value:function(e){var n=e;this.insertEdgeEnd(n,n)}},{key:"getRightmostEdge",value:function(){var e=this.getEdges(),n=e.size();if(n<1)return null;var r=e.get(0);if(n===1)return r;var s=e.get(n-1),a=r.getQuadrant(),u=s.getQuadrant();return Ct.isNorthern(a)&&Ct.isNorthern(u)?r:Ct.isNorthern(a)||Ct.isNorthern(u)?r.getDy()!==0?r:s.getDy()!==0?s:($.shouldNeverReachHere("found two horizontal edges incident on node"),null):s}},{key:"print",value:function(e){Mt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();){var r=n.next();e.print("out "),r.print(e),e.println(),e.print("in "),r.getSym().print(e),e.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new H;for(var e=this.iterator();e.hasNext();){var n=e.next();(n.isInResult()||n.getSym().isInResult())&&this._resultAreaEdgeList.add(n)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(e){for(var n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.setAllLocationsIfNull(0,e.getLocation(0)),r.setAllLocationsIfNull(1,e.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var e=null,n=null,r=this._edgeList.size()-1;r>=0;r--){var s=this._edgeList.get(r),a=s.getSym();n===null&&(n=a),e!==null&&a.setNext(e),e=s}n.setNext(e)}},{key:"computeDepths",value:function(){if(arguments.length===1){var e=arguments[0],n=this.findIndex(e),r=e.getDepth(C.LEFT),s=e.getDepth(C.RIGHT),a=this.computeDepths(n+1,this._edgeList.size(),r);if(this.computeDepths(0,n,a)!==s)throw new Wt("depth mismatch at "+e.getCoordinate())}else if(arguments.length===3){for(var u=arguments[1],h=arguments[2],f=arguments[0];f<u;f++){var d=this._edgeList.get(f);d.setEdgeDepths(C.RIGHT,h),h=d.getDepth(C.LEFT)}return h}}},{key:"mergeSymLabels",value:function(){for(var e=this.iterator();e.hasNext();){var n=e.next();n.getLabel().merge(n.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(e){for(var n=null,r=null,s=this._SCANNING_FOR_INCOMING,a=this._resultAreaEdgeList.size()-1;a>=0;a--){var u=this._resultAreaEdgeList.get(a),h=u.getSym();switch(n===null&&u.getEdgeRing()===e&&(n=u),s){case this._SCANNING_FOR_INCOMING:if(h.getEdgeRing()!==e)continue;r=h,s=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(u.getEdgeRing()!==e)continue;r.setNextMin(u),s=this._SCANNING_FOR_INCOMING}}s===this._LINKING_TO_OUTGOING&&($.isTrue(n!==null,"found null for first outgoing dirEdge"),$.isTrue(n.getEdgeRing()===e,"unable to link last incoming dirEdge"),r.setNextMin(n))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var e=0,n=this.iterator();n.hasNext();)n.next().isInResult()&&e++;return e}if(arguments.length===1){for(var r=arguments[0],s=0,a=this.iterator();a.hasNext();)a.next().getEdgeRing()===r&&s++;return s}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var e=y.NONE,n=this.iterator();n.hasNext();){var r=n.next(),s=r.getSym();if(!r.isLineEdge()){if(r.isInResult()){e=y.INTERIOR;break}if(s.isInResult()){e=y.EXTERIOR;break}}}if(e===y.NONE)return null;for(var a=e,u=this.iterator();u.hasNext();){var h=u.next(),f=h.getSym();h.isLineEdge()?h.getEdge().setCovered(a===y.INTERIOR):(h.isInResult()&&(a=y.EXTERIOR),f.isInResult()&&(a=y.INTERIOR))}}},{key:"computeLabelling",value:function(e){I(t,"computeLabelling",this,1).call(this,e),this._label=new Pt(y.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),s=0;s<2;s++){var a=r.getLocation(s);a!==y.INTERIOR&&a!==y.BOUNDARY||this._label.setLocation(s,y.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}])}(vs),ys=function(i){function t(){return l(this,t),v(this,t)}return x(t,i),g(t,[{key:"createNode",value:function(e){return new He(e,new ms)}}])}(ui),pi=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"compareTo",value:function(t){var e=t;return i.compareOriented(this._pts,this._orientation,e._pts,e._orientation)}},{key:"interfaces_",get:function(){return[z]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=i.orientation(t)}},{key:"orientation",value:function(t){return pt.increasingDirection(t)===1}},{key:"compareOriented",value:function(t,e,n,r){for(var s=e?1:-1,a=r?1:-1,u=e?t.length:-1,h=r?n.length:-1,f=e?0:t.length-1,d=r?0:n.length-1;;){var _=t[f].compareTo(n[d]);if(_!==0)return _;var S=(f+=s)===u,O=(d+=a)===h;if(S&&!O)return-1;if(!S&&O)return 1;if(S&&O)return 0}}}])}(),ds=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"print",value:function(i){i.print("MULTILINESTRING ( ");for(var t=0;t<this._edges.size();t++){var e=this._edges.get(t);t>0&&i.print(","),i.print("(");for(var n=e.getCoordinates(),r=0;r<n.length;r++)r>0&&i.print(","),i.print(n[r].x+" "+n[r].y);i.println(")")}i.print(") ")}},{key:"addAll",value:function(i){for(var t=i.iterator();t.hasNext();)this.add(t.next())}},{key:"findEdgeIndex",value:function(i){for(var t=0;t<this._edges.size();t++)if(this._edges.get(t).equals(i))return t;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(i){return this._edges.get(i)}},{key:"findEqualEdge",value:function(i){var t=new pi(i.getCoordinates());return this._ocaMap.get(t)}},{key:"add",value:function(i){this._edges.add(i);var t=new pi(i.getCoordinates());this._ocaMap.put(t,i)}}],[{key:"constructor_",value:function(){this._edges=new H,this._ocaMap=new Le}}])}(),ki=function(){return g(function i(){l(this,i)},[{key:"processIntersections",value:function(i,t,e,n){}},{key:"isDone",value:function(){}}])}(),_s=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"isTrivialIntersection",value:function(t,e,n,r){if(t===n&&this._li.getIntersectionNum()===1){if(i.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var s=t.size()-1;if(e===0&&r===s||r===0&&e===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,r){if(t===n&&e===r)return null;this.numTests++;var s=t.getCoordinates()[e],a=t.getCoordinates()[e+1],u=n.getCoordinates()[r],h=n.getCoordinates()[r+1];this._li.computeIntersection(s,a,u,h),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,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[ki]}}],[{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 Math.abs(t-e)===1}}])}(),ps=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(i){i.print(this.coord),i.print(" seg # = "+this.segmentIndex),i.println(" dist = "+this.dist)}},{key:"compareTo",value:function(i){var t=i;return this.compare(t.segmentIndex,t.dist)}},{key:"isEndPoint",value:function(i){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===i}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(i,t){return this.segmentIndex<i?-1:this.segmentIndex>i?1:this.dist<t?-1:this.dist>t?1:0}},{key:"interfaces_",get:function(){return[z]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var i=arguments[0],t=arguments[1],e=arguments[2];this.coord=new p(i),this.segmentIndex=t,this.dist=e}}])}(),ks=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"print",value:function(i){i.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(i)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(i){this.addEndpoints();for(var t=this.iterator(),e=t.next();t.hasNext();){var n=t.next(),r=this.createSplitEdge(e,n);i.add(r),e=n}}},{key:"addEndpoints",value:function(){var i=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[i],i,0)}},{key:"createSplitEdge",value:function(i,t){var e=t.segmentIndex-i.segmentIndex+2,n=this.edge.pts[t.segmentIndex],r=t.dist>0||!t.coord.equals2D(n);r||e--;var s=new Array(e).fill(null),a=0;s[a++]=new p(i.coord);for(var u=i.segmentIndex+1;u<=t.segmentIndex;u++)s[a++]=this.edge.pts[u];return r&&(s[a]=t.coord),new xi(s,new Pt(this.edge._label))}},{key:"add",value:function(i,t,e){var n=new ps(i,t,e),r=this._nodeMap.get(n);return r!==null?r:(this._nodeMap.put(n,n),n)}},{key:"isIntersection",value:function(i){for(var t=this.iterator();t.hasNext();)if(t.next().coord.equals(i))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new Le,this.edge=null;var i=arguments[0];this.edge=i}}])}(),Es=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(i.isTrue(this._matrix[y.INTERIOR][y.INTERIOR])||i.isTrue(this._matrix[y.INTERIOR][y.BOUNDARY])||i.isTrue(this._matrix[y.BOUNDARY][y.INTERIOR])||i.isTrue(this._matrix[y.BOUNDARY][y.BOUNDARY]))&&this._matrix[y.EXTERIOR][y.INTERIOR]===L.FALSE&&this._matrix[y.EXTERIOR][y.BOUNDARY]===L.FALSE}},{key:"isCoveredBy",value:function(){return(i.isTrue(this._matrix[y.INTERIOR][y.INTERIOR])||i.isTrue(this._matrix[y.INTERIOR][y.BOUNDARY])||i.isTrue(this._matrix[y.BOUNDARY][y.INTERIOR])||i.isTrue(this._matrix[y.BOUNDARY][y.BOUNDARY]))&&this._matrix[y.INTERIOR][y.EXTERIOR]===L.FALSE&&this._matrix[y.BOUNDARY][y.EXTERIOR]===L.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),r=e%3;this._matrix[n][r]=L.toDimensionValue(t.charAt(e))}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];this._matrix[s][a]=u}}},{key:"isContains",value:function(){return i.isTrue(this._matrix[y.INTERIOR][y.INTERIOR])&&this._matrix[y.EXTERIOR][y.INTERIOR]===L.FALSE&&this._matrix[y.EXTERIOR][y.BOUNDARY]===L.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var t=arguments[0],e=0;e<t.length;e++){var n=Math.trunc(e/3),r=e%3;this.setAtLeast(n,r,L.toDimensionValue(t.charAt(e)))}else if(arguments.length===3){var s=arguments[0],a=arguments[1],u=arguments[2];this._matrix[s][a]<u&&(this._matrix[s][a]=u)}}},{key:"setAtLeastIfValid",value:function(t,e,n){t>=0&&e>=0&&this.setAtLeast(t,e,n)}},{key:"isWithin",value:function(){return i.isTrue(this._matrix[y.INTERIOR][y.INTERIOR])&&this._matrix[y.INTERIOR][y.EXTERIOR]===L.FALSE&&this._matrix[y.BOUNDARY][y.EXTERIOR]===L.FALSE}},{key:"isTouches",value:function(t,e){return t>e?this.isTouches(e,t):(t===L.A&&e===L.A||t===L.L&&e===L.L||t===L.L&&e===L.A||t===L.P&&e===L.A||t===L.P&&e===L.L)&&this._matrix[y.INTERIOR][y.INTERIOR]===L.FALSE&&(i.isTrue(this._matrix[y.INTERIOR][y.BOUNDARY])||i.isTrue(this._matrix[y.BOUNDARY][y.INTERIOR])||i.isTrue(this._matrix[y.BOUNDARY][y.BOUNDARY]))}},{key:"isOverlaps",value:function(t,e){return t===L.P&&e===L.P||t===L.A&&e===L.A?i.isTrue(this._matrix[y.INTERIOR][y.INTERIOR])&&i.isTrue(this._matrix[y.INTERIOR][y.EXTERIOR])&&i.isTrue(this._matrix[y.EXTERIOR][y.INTERIOR]):t===L.L&&e===L.L&&this._matrix[y.INTERIOR][y.INTERIOR]===1&&i.isTrue(this._matrix[y.INTERIOR][y.EXTERIOR])&&i.isTrue(this._matrix[y.EXTERIOR][y.INTERIOR])}},{key:"isEquals",value:function(t,e){return t===e&&i.isTrue(this._matrix[y.INTERIOR][y.INTERIOR])&&this._matrix[y.INTERIOR][y.EXTERIOR]===L.FALSE&&this._matrix[y.BOUNDARY][y.EXTERIOR]===L.FALSE&&this._matrix[y.EXTERIOR][y.INTERIOR]===L.FALSE&&this._matrix[y.EXTERIOR][y.BOUNDARY]===L.FALSE}},{key:"toString",value:function(){for(var t=new Xe("123456789"),e=0;e<3;e++)for(var n=0;n<3;n++)t.setCharAt(3*e+n,L.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(t.length!==9)throw new F("Should be length 9: "+t);for(var e=0;e<3;e++)for(var n=0;n<3;n++)if(!i.matches(this._matrix[e][n],t.charAt(3*e+n)))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[y.INTERIOR][y.INTERIOR]===L.FALSE&&this._matrix[y.INTERIOR][y.BOUNDARY]===L.FALSE&&this._matrix[y.BOUNDARY][y.INTERIOR]===L.FALSE&&this._matrix[y.BOUNDARY][y.BOUNDARY]===L.FALSE}},{key:"isCrosses",value:function(t,e){return t===L.P&&e===L.L||t===L.P&&e===L.A||t===L.L&&e===L.A?i.isTrue(this._matrix[y.INTERIOR][y.INTERIOR])&&i.isTrue(this._matrix[y.INTERIOR][y.EXTERIOR]):t===L.L&&e===L.P||t===L.A&&e===L.P||t===L.A&&e===L.L?i.isTrue(this._matrix[y.INTERIOR][y.INTERIOR])&&i.isTrue(this._matrix[y.EXTERIOR][y.INTERIOR]):t===L.L&&e===L.L&&this._matrix[y.INTERIOR][y.INTERIOR]===0}},{key:"interfaces_",get:function(){return[K]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(L.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var t=arguments[0];i.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof i){var e=arguments[0];i.constructor_.call(this),this._matrix[y.INTERIOR][y.INTERIOR]=e._matrix[y.INTERIOR][y.INTERIOR],this._matrix[y.INTERIOR][y.BOUNDARY]=e._matrix[y.INTERIOR][y.BOUNDARY],this._matrix[y.INTERIOR][y.EXTERIOR]=e._matrix[y.INTERIOR][y.EXTERIOR],this._matrix[y.BOUNDARY][y.INTERIOR]=e._matrix[y.BOUNDARY][y.INTERIOR],this._matrix[y.BOUNDARY][y.BOUNDARY]=e._matrix[y.BOUNDARY][y.BOUNDARY],this._matrix[y.BOUNDARY][y.EXTERIOR]=e._matrix[y.BOUNDARY][y.EXTERIOR],this._matrix[y.EXTERIOR][y.INTERIOR]=e._matrix[y.EXTERIOR][y.INTERIOR],this._matrix[y.EXTERIOR][y.BOUNDARY]=e._matrix[y.EXTERIOR][y.BOUNDARY],this._matrix[y.EXTERIOR][y.EXTERIOR]=e._matrix[y.EXTERIOR][y.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var t=arguments[0],e=arguments[1];return e===L.SYM_DONTCARE||e===L.SYM_TRUE&&(t>=0||t===L.TRUE)||e===L.SYM_FALSE&&t===L.FALSE||e===L.SYM_P&&t===L.P||e===L.SYM_L&&t===L.L||e===L.SYM_A&&t===L.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var n=arguments[1];return new i(arguments[0]).matches(n)}}},{key:"isTrue",value:function(t){return t>=0||t===L.TRUE}}])}(),xs=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(t){return t===null||t.length===0?null:(this.ensureCapacity(this._size+t.length),Mt.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=ie.copyOf(this._data,e)}},{key:"toArray",value:function(){var t=new Array(this._size).fill(null);return Mt.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,arguments.length===0)i.constructor_.call(this,10);else if(arguments.length===1){var t=arguments[0];this._data=new Array(t).fill(null)}}}])}(),Is=function(){function i(){l(this,i)}return g(i,[{key:"getChainStartIndices",value:function(t){var e=0,n=new xs(Math.trunc(t.length/2));n.add(e);do{var r=this.findChainEnd(t,e);n.add(r),e=r}while(e<t.length-1);return n.toArray()}},{key:"findChainEnd",value:function(t,e){for(var n=Ct.quadrant(t[e],t[e+1]),r=e+1;r<t.length&&Ct.quadrant(t[r-1],t[r])===n;)r++;return r-1}},{key:"OLDgetChainStartIndices",value:function(t){var e=0,n=new H;n.add(e);do{var r=this.findChainEnd(t,e);n.add(r),e=r}while(e<t.length-1);return i.toIntArray(n)}}],[{key:"toIntArray",value:function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e}}])}(),Ns=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(i){var t=this.pts[this.startIndex[i]].x,e=this.pts[this.startIndex[i+1]].x;return t>e?t:e}},{key:"getMinX",value:function(i){var t=this.pts[this.startIndex[i]].x,e=this.pts[this.startIndex[i+1]].x;return t<e?t:e}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var i=arguments[0],t=arguments[1],e=arguments[2],n=arguments[3];this.computeIntersectsForChain(this.startIndex[i],this.startIndex[i+1],t,t.startIndex[e],t.startIndex[e+1],n)}else if(arguments.length===6){var r=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3],h=arguments[4],f=arguments[5];if(s-r==1&&h-u==1)return f.addIntersections(this.e,r,a.e,u),null;if(!this.overlaps(r,s,a,u,h))return null;var d=Math.trunc((r+s)/2),_=Math.trunc((u+h)/2);r<d&&(u<_&&this.computeIntersectsForChain(r,d,a,u,_,f),_<h&&this.computeIntersectsForChain(r,d,a,_,h,f)),d<s&&(u<_&&this.computeIntersectsForChain(d,s,a,u,_,f),_<h&&this.computeIntersectsForChain(d,s,a,_,h,f))}}},{key:"overlaps",value:function(i,t,e,n,r){return gt.intersects(this.pts[i],this.pts[t],e.pts[n],e.pts[r])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(i,t){for(var e=0;e<this.startIndex.length-1;e++)for(var n=0;n<i.startIndex.length-1;n++)this.computeIntersectsForChain(e,i,n,t)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var i=arguments[0];this.e=i,this.pts=i.getCoordinates();var t=new Is;this.startIndex=t.getChainStartIndices(this.pts)}}])}(),Ei=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{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(arguments.length===0){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==i.NULL_VALUE)return!1;return!0}if(arguments.length===1){var n=arguments[0];return this._depth[n][1]===i.NULL_VALUE}if(arguments.length===2){var r=arguments[0],s=arguments[1];return this._depth[r][s]===i.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 r=0;this._depth[t][n]>e&&(r=1),this._depth[t][n]=r}}}},{key:"getDelta",value:function(t){return this._depth[t][C.RIGHT]-this._depth[t][C.LEFT]}},{key:"getLocation",value:function(t,e){return this._depth[t][e]<=0?y.EXTERIOR:y.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(arguments.length===1)for(var t=arguments[0],e=0;e<2;e++)for(var n=1;n<3;n++){var r=t.getLocation(e,n);r!==y.EXTERIOR&&r!==y.INTERIOR||(this.isNull(e,n)?this._depth[e][n]=i.depthAtLocation(r):this._depth[e][n]+=i.depthAtLocation(r))}else if(arguments.length===3){var s=arguments[0],a=arguments[1];arguments[2]===y.INTERIOR&&this._depth[s][a]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var t=0;t<2;t++)for(var e=0;e<3;e++)this._depth[t][e]=i.NULL_VALUE}},{key:"depthAtLocation",value:function(t){return t===y.EXTERIOR?0:t===y.INTERIOR?1:i.NULL_VALUE}}])}();Ei.NULL_VALUE=-1;var xi=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var e=new Array(2).fill(null);return e[0]=this.pts[0],e[1]=this.pts[1],new t(e,Pt.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(e){this._isIsolated=e}},{key:"setName",value:function(e){this._name=e}},{key:"equals",value:function(e){if(!(e instanceof t))return!1;var n=e;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,s=!0,a=this.pts.length,u=0;u<this.pts.length;u++)if(this.pts[u].equals2D(n.pts[u])||(r=!1),this.pts[u].equals2D(n.pts[--a])||(s=!1),!r&&!s)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var e=arguments[0];return this.pts[e]}}},{key:"print",value:function(e){e.print("edge "+this._name+": "),e.print("LINESTRING (");for(var n=0;n<this.pts.length;n++)n>0&&e.print(","),e.print(this.pts[n].x+" "+this.pts[n].y);e.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(e){t.updateIM(this._label,e)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!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(e){e.print("edge "+this._name+": ");for(var n=this.pts.length-1;n>=0;n--)e.print(this.pts[n]+" ");e.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new Ns(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new gt;for(var e=0;e<this.pts.length;e++)this._env.expandToInclude(this.pts[e])}return this._env}},{key:"addIntersection",value:function(e,n,r,s){var a=new p(e.getIntersection(s)),u=n,h=e.getEdgeDistance(r,s),f=u+1;if(f<this.pts.length){var d=this.pts[f];a.equals2D(d)&&(u=f,h=0)}this.eiList.add(a,u,h)}},{key:"toString",value:function(){var e=new Xe;e.append("edge "+this._name+": "),e.append("LINESTRING (");for(var n=0;n<this.pts.length;n++)n>0&&e.append(","),e.append(this.pts[n].x+" "+this.pts[n].y);return e.append(") "+this._label+" "+this._depthDelta),e.toString()}},{key:"isPointwiseEqual",value:function(e){if(this.pts.length!==e.pts.length)return!1;for(var n=0;n<this.pts.length;n++)if(!this.pts[n].equals2D(e.pts[n]))return!1;return!0}},{key:"setDepthDelta",value:function(e){this._depthDelta=e}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(e,n,r){for(var s=0;s<e.getIntersectionNum();s++)this.addIntersection(e,n,r,s)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new ks(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ei,this._depthDelta=0,arguments.length===1){var e=arguments[0];t.constructor_.call(this,e,null)}else if(arguments.length===2){var n=arguments[0],r=arguments[1];this.pts=n,this._label=r}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Es&&arguments[0]instanceof Pt))return I(t,"updateIM",this).apply(this,arguments);var e=arguments[0],n=arguments[1];n.setAtLeastIfValid(e.getLocation(0,C.ON),e.getLocation(1,C.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,C.LEFT),e.getLocation(1,C.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,C.RIGHT),e.getLocation(1,C.RIGHT),2))}}])}(ni),Ii=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"setWorkingPrecisionModel",value:function(t){this._workingPrecisionModel=t}},{key:"insertUniqueEdge",value:function(t){var e=this._edgeList.findEqualEdge(t);if(e!==null){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new Pt(t.getLabel())).flip(),n.merge(r);var s=i.depthDelta(r),a=e.getDepthDelta()+s;e.setDepthDelta(a)}else this._edgeList.add(t),t.setDepthDelta(i.depthDelta(t.getLabel()))}},{key:"buildSubgraphs",value:function(t,e){for(var n=new H,r=t.iterator();r.hasNext();){var s=r.next(),a=s.getRightmostCoordinate(),u=new yi(n).getDepth(a);s.computeDepth(u),s.findResultEdges(),n.add(s),e.add(s.getDirectedEdges(),s.getNodes())}}},{key:"createSubgraphs",value:function(t){for(var e=new H,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var s=new Lr;s.create(r),e.add(s)}}return ge.sort(e,ge.reverseOrder()),e}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(t){if(this._workingNoder!==null)return this._workingNoder;var e=new Nn,n=new ae;return n.setPrecisionModel(t),e.setSegmentIntersector(new _s(n)),e}},{key:"buffer",value:function(t,e){var n=this._workingPrecisionModel;n===null&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new os(n,this._bufParams),s=new hs(t,e,r).getCurves();if(s.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(s,n),this._graph=new oi(new ys),this._graph.addEdges(this._edgeList.getEdges());var a=this.createSubgraphs(this._graph),u=new jr(this._geomFact);this.buildSubgraphs(a,u);var h=u.getPolygons();return h.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(h)}},{key:"computeNodedEdges",value:function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var s=r.next(),a=s.getCoordinates();if(a.length!==2||!a[0].equals2D(a[1])){var u=s.getData(),h=new xi(s.getCoordinates(),new Pt(u));this.insertUniqueEdge(h)}}}},{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 ds;var t=arguments[0];this._bufParams=t}},{key:"depthDelta",value:function(t){var e=t.getLocation(0,C.LEFT),n=t.getLocation(0,C.RIGHT);return e===y.INTERIOR&&n===y.EXTERIOR?1:e===y.EXTERIOR&&n===y.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(t){for(var e=new ce,n=new H;t.hasNext();){var r=t.next(),s=e.createLineString(r.getCoordinates());n.add(s)}return e.buildGeometry(n)}}])}(),Ss=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"rescale",value:function(){if(J(arguments[0],Yt))for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){for(var n=arguments[0],r=0;r<n.length;r++)n[r].x=n[r].x/this._scaleFactor+this._offsetX,n[r].y=n[r].y/this._scaleFactor+this._offsetY;n.length===2&&n[0].equals2D(n[1])&&Mt.out.println(n)}}},{key:"scale",value:function(){if(J(arguments[0],Yt)){for(var t=arguments[0],e=new H(t.size()),n=t.iterator();n.hasNext();){var r=n.next();e.add(new ue(this.scale(r.getCoordinates()),r.getData()))}return e}if(arguments[0]instanceof Array){for(var s=arguments[0],a=new Array(s.length).fill(null),u=0;u<s.length;u++)a[u]=new p(Math.round((s[u].x-this._offsetX)*this._scaleFactor),Math.round((s[u].y-this._offsetY)*this._scaleFactor),s[u].getZ());return pt.removeRepeatedPoints(a)}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{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[In]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var t=arguments[0],e=arguments[1];i.constructor_.call(this,t,e,0,0)}else if(arguments.length===4){var n=arguments[0],r=arguments[1];this._noder=n,this._scaleFactor=r,this._isScaled=!this.isIntegerPrecision()}}}])}(),Ni=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)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(arguments.length===2){for(var n=arguments[0],r=arguments[1].iterator();r.hasNext();)for(var s=r.next().getCoordinates(),a=1;a<s.length-1;a++)if(s[a].equals(n))throw new xt("found endpt/interior pt intersection at index "+a+" :pt "+n)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkInteriorIntersections(e,r)}else if(arguments.length===2)for(var s=arguments[0],a=arguments[1],u=s.getCoordinates(),h=a.getCoordinates(),f=0;f<u.length-1;f++)for(var d=0;d<h.length-1;d++)this.checkInteriorIntersections(s,f,a,d);else if(arguments.length===4){var _=arguments[0],S=arguments[1],O=arguments[2],b=arguments[3];if(_===O&&S===b)return null;var X=_.getCoordinates()[S],rt=_.getCoordinates()[S+1],nt=O.getCoordinates()[b],ht=O.getCoordinates()[b+1];if(this._li.computeIntersection(X,rt,nt,ht),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,X,rt)||this.hasInteriorIntersection(this._li,nt,ht)))throw new xt("found non-noded intersection at "+X+"-"+rt+" and "+nt+"-"+ht)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(arguments.length===1)for(var n=arguments[0].getCoordinates(),r=0;r<n.length-2;r++)this.checkCollapse(n[r],n[r+1],n[r+2])}},{key:"hasInteriorIntersection",value:function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var s=t.getIntersection(r);if(!s.equals(e)&&!s.equals(n))return!0}return!1}},{key:"checkCollapse",value:function(t,e,n){if(t.equals(n))throw new xt("found non-noded collapse at "+i.fact.createLineString([t,e,n]))}}],[{key:"constructor_",value:function(){this._li=new ae,this._segStrings=null;var t=arguments[0];this._segStrings=t}}])}();Ni.fact=new ce;var Tn=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"intersectsScaled",value:function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),s=Math.min(t.y,e.y),a=Math.max(t.y,e.y),u=this._maxx<n||this._minx>r||this._maxy<s||this._miny>a;if(u)return!1;var h=this.intersectsToleranceSquare(t,e);return $.isTrue(!(u&&h),"Found bad envelope test"),h}},{key:"initCorners",value:function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new p(this._maxx,this._maxy),this._corner[1]=new p(this._minx,this._maxy),this._corner[2]=new p(this._minx,this._miny),this._corner[3]=new p(this._maxx,this._miny)}},{key:"intersects",value:function(t,e){return this._scaleFactor===1?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(this._safeEnv===null){var t=i.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new gt(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,r=!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()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!n||!r)||!!t.equals(this._pt)||!!e.equals(this._pt))))}},{key:"addSnappedNode",value:function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(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=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new F("Scale factor must be non-zero");e!==1&&(this._pt=new p(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new p,this._p1Scaled=new p),this.initCorners(this._pt)}}])}();Tn.SAFE_ENV_EXPANSION_FACTOR=.75;var Ts=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var i=arguments[1];arguments[0].getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Rt}}])}(),Si=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"snap",value:function(){if(arguments.length===1){var i=arguments[0];return this.snap(i,null,-1)}if(arguments.length===3){var t=arguments[0],e=arguments[1],n=arguments[2],r=t.getSafeEnvelope(),s=new Ti(t,e,n);return this._index.query(r,new(function(){return g(function a(){l(this,a)},[{key:"interfaces_",get:function(){return[hi]}},{key:"visitItem",value:function(a){a.select(r,s)}}])}())),s.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var i=arguments[0];this._index=i}}])}(),Ti=function(i){function t(){var e;return l(this,t),e=v(this,t),t.constructor_.apply(e,arguments),e}return x(t,i),g(t,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof fi))return I(t,"select",this,1).apply(this,arguments);var e=arguments[1],n=arguments[0].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 e=arguments[0],n=arguments[1],r=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}}])}(Ts);Si.HotPixelSnapAction=Ti;var Cs=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"processIntersections",value:function(i,t,e,n){if(i===e&&t===n)return null;var r=i.getCoordinates()[t],s=i.getCoordinates()[t+1],a=e.getCoordinates()[n],u=e.getCoordinates()[n+1];if(this._li.computeIntersection(r,s,a,u),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var h=0;h<this._li.getIntersectionNum();h++)this._interiorIntersections.add(this._li.getIntersection(h));i.addIntersections(this._li,t,0),e.addIntersections(this._li,n,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[ki]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var i=arguments[0];this._li=i,this._interiorIntersections=new H}}])}(),ws=function(){return g(function i(){l(this,i),i.constructor_.apply(this,arguments)},[{key:"checkCorrectness",value:function(i){var t=ue.getNodedSubstrings(i),e=new Ni(t);try{e.checkValid()}catch(n){if(!(n instanceof W))throw n;n.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return ue.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(i,t){var e=this.findInteriorIntersections(i,t);this.computeIntersectionSnaps(e),this.computeVertexSnaps(i)}},{key:"findInteriorIntersections",value:function(i,t){var e=new Cs(t);return this._noder.setSegmentIntersector(e),this._noder.computeNodes(i),e.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(J(arguments[0],Yt))for(var i=arguments[0].iterator();i.hasNext();){var t=i.next();this.computeVertexSnaps(t)}else if(arguments[0]instanceof ue)for(var e=arguments[0],n=e.getCoordinates(),r=0;r<n.length;r++){var s=new Tn(n[r],this._scaleFactor,this._li);this._pointSnapper.snap(s,e,r)&&e.addIntersection(n[r],r)}}},{key:"computeNodes",value:function(i){this._nodedSegStrings=i,this._noder=new Nn,this._pointSnapper=new Si(this._noder.getIndex()),this.snapRound(i,this._li)}},{key:"computeIntersectionSnaps",value:function(i){for(var t=i.iterator();t.hasNext();){var e=t.next(),n=new Tn(e,this._scaleFactor,this._li);this._pointSnapper.snap(n)}}},{key:"interfaces_",get:function(){return[In]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var i=arguments[0];this._pm=i,this._li=new ae,this._li.setPrecisionModel(i),this._scaleFactor=i.getScale()}}])}(),ye=function(){function i(){l(this,i),i.constructor_.apply(this,arguments)}return g(i,[{key:"bufferFixedPrecision",value:function(t){var e=new Ss(new ws(new Gt(1)),t.getScale()),n=new Ii(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var t=i.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(s){if(!(s instanceof Wt))throw s;this._saveException=s}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var e=arguments[0],n=i.precisionScaleFactor(this._argGeom,this._distance,e),r=new Gt(n);this.bufferFixedPrecision(r)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===Gt.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(t){this._bufParams.setQuadrantSegments(t)}},{key:"bufferOriginalPrecision",value:function(){try{var t=new Ii(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(e){if(!(e instanceof xt))throw e;this._saveException=e}}},{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 P,this._resultGeometry=null,this._saveException=null,arguments.length===1){var t=arguments[0];this._argGeom=t}else if(arguments.length===2){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}}},{key:"bufferOp",value:function(){if(arguments.length===2){var t=arguments[1];return new i(arguments[0]).getResultGeometry(t)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof B&&typeof arguments[1]=="number"){var e=arguments[1],n=arguments[2],r=new i(arguments[0]);return r.setQuadrantSegments(n),r.getResultGeometry(e)}if(arguments[2]instanceof P&&arguments[0]instanceof B&&typeof arguments[1]=="number"){var s=arguments[1];return new i(arguments[0],arguments[2]).getResultGeometry(s)}}else if(arguments.length===4){var a=arguments[1],u=arguments[2],h=arguments[3],f=new i(arguments[0]);return f.setQuadrantSegments(u),f.setEndCapStyle(h),f.getResultGeometry(a)}}},{key:"precisionScaleFactor",value:function(t,e,n){var r=t.getEnvelopeInternal(),s=Ie.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),a=n-Math.trunc(Math.log(s)/Math.log(10)+1);return Math.pow(10,a)}}])}();ye.CAP_ROUND=P.CAP_ROUND,ye.CAP_BUTT=P.CAP_FLAT,ye.CAP_FLAT=P.CAP_FLAT,ye.CAP_SQUARE=P.CAP_SQUARE,ye.MAX_PRECISION_DIGITS=12;var Ls=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Ci=function(){return g(function i(t){l(this,i),this.geometryFactory=t||new ce},[{key:"read",value:function(i){var t,e=(t=typeof i=="string"?JSON.parse(i):i).type;if(!Dt[e])throw new Error("Unknown GeoJSON type: "+t.type);return Ls.indexOf(e)!==-1?Dt[e].call(this,t.coordinates):e==="GeometryCollection"?Dt[e].call(this,t.geometries):Dt[e].call(this,t)}},{key:"write",value:function(i){var t=i.getGeometryType();if(!Ut[t])throw new Error("Geometry is not supported");return Ut[t].call(this,i)}}])}(),Dt={Feature:function(i){var t={};for(var e in i)t[e]=i[e];if(i.geometry){var n=i.geometry.type;if(!Dt[n])throw new Error("Unknown GeoJSON type: "+i.type);t.geometry=this.read(i.geometry)}return i.bbox&&(t.bbox=Dt.bbox.call(this,i.bbox)),t},FeatureCollection:function(i){var t={};if(i.features){t.features=[];for(var e=0;e<i.features.length;++e)t.features.push(this.read(i.features[e]))}return i.bbox&&(t.bbox=this.parse.bbox.call(this,i.bbox)),t},coordinates:function(i){for(var t=[],e=0;e<i.length;++e){var n=i[e];t.push(k(p,Q(n)))}return t},bbox:function(i){return this.geometryFactory.createLinearRing([new p(i[0],i[1]),new p(i[2],i[1]),new p(i[2],i[3]),new p(i[0],i[3]),new p(i[0],i[1])])},Point:function(i){var t=k(p,Q(i));return this.geometryFactory.createPoint(t)},MultiPoint:function(i){for(var t=[],e=0;e<i.length;++e)t.push(Dt.Point.call(this,i[e]));return this.geometryFactory.createMultiPoint(t)},LineString:function(i){var t=Dt.coordinates.call(this,i);return this.geometryFactory.createLineString(t)},MultiLineString:function(i){for(var t=[],e=0;e<i.length;++e)t.push(Dt.LineString.call(this,i[e]));return this.geometryFactory.createMultiLineString(t)},Polygon:function(i){for(var t=Dt.coordinates.call(this,i[0]),e=this.geometryFactory.createLinearRing(t),n=[],r=1;r<i.length;++r){var s=i[r],a=Dt.coordinates.call(this,s),u=this.geometryFactory.createLinearRing(a);n.push(u)}return this.geometryFactory.createPolygon(e,n)},MultiPolygon:function(i){for(var t=[],e=0;e<i.length;++e){var n=i[e];t.push(Dt.Polygon.call(this,n))}return this.geometryFactory.createMultiPolygon(t)},GeometryCollection:function(i){for(var t=[],e=0;e<i.length;++e){var n=i[e];t.push(this.read(n))}return this.geometryFactory.createGeometryCollection(t)}},Ut={coordinate:function(i){var t=[i.x,i.y];return i.z&&t.push(i.z),i.m&&t.push(i.m),t},Point:function(i){return{type:"Point",coordinates:Ut.coordinate.call(this,i.getCoordinate())}},MultiPoint:function(i){for(var t=[],e=0;e<i._geometries.length;++e){var n=i._geometries[e],r=Ut.Point.call(this,n);t.push(r.coordinates)}return{type:"MultiPoint",coordinates:t}},LineString:function(i){for(var t=[],e=i.getCoordinates(),n=0;n<e.length;++n){var r=e[n];t.push(Ut.coordinate.call(this,r))}return{type:"LineString",coordinates:t}},MultiLineString:function(i){for(var t=[],e=0;e<i._geometries.length;++e){var n=i._geometries[e],r=Ut.LineString.call(this,n);t.push(r.coordinates)}return{type:"MultiLineString",coordinates:t}},Polygon:function(i){var t=[],e=Ut.LineString.call(this,i._shell);t.push(e.coordinates);for(var n=0;n<i._holes.length;++n){var r=i._holes[n],s=Ut.LineString.call(this,r);t.push(s.coordinates)}return{type:"Polygon",coordinates:t}},MultiPolygon:function(i){for(var t=[],e=0;e<i._geometries.length;++e){var n=i._geometries[e],r=Ut.Polygon.call(this,n);t.push(r.coordinates)}return{type:"MultiPolygon",coordinates:t}},GeometryCollection:function(i){for(var t=[],e=0;e<i._geometries.length;++e){var n=i._geometries[e],r=n.getGeometryType();t.push(Ut[r].call(this,n))}return{type:"GeometryCollection",geometries:t}}};return{BufferOp:ye,GeoJSONReader:function(){return g(function i(t){l(this,i),this.parser=new Ci(t||new ce)},[{key:"read",value:function(i){return this.parser.read(i)}}])}(),GeoJSONWriter:function(){return g(function i(){l(this,i),this.parser=new Ci(this.geometryFactory)},[{key:"write",value:function(i){return this.parser.write(i)}}])}()}})}($e)),$e.exports}var Ds=bs();const Fs=Y.getDefaultExportFromCjs(Ds);function te(){return new nn}function nn(){this.reset()}nn.prototype={constructor:nn,reset:function(){this.s=this.t=0},add:function(o){Di(We,o,this.t),Di(this,We.s,this.s),this.s?this.t+=We.t:this.s=We.t},valueOf:function(){return this.s}};var We=new nn;function Di(o,c,m){var v=o.s=c+m,l=v-c,k=v-l;o.t=c-k+(m-l)}var ct=1e-6,st=Math.PI,Vt=st/2,Fi=st/4,Ht=st*2,$t=180/st,Ft=st/180,It=Math.abs,Gs=Math.atan,_e=Math.atan2,yt=Math.cos,dt=Math.sin,Ee=Math.sqrt;function Qi(o){return o>1?0:o<-1?st:Math.acos(o)}function le(o){return o>1?Vt:o<-1?-Vt:Math.asin(o)}function Me(){}function rn(o,c){o&&qi.hasOwnProperty(o.type)&&qi[o.type](o,c)}var Gi={Feature:function(o,c){rn(o.geometry,c)},FeatureCollection:function(o,c){for(var m=o.features,v=-1,l=m.length;++v<l;)rn(m[v].geometry,c)}},qi={Sphere:function(o,c){c.sphere()},Point:function(o,c){o=o.coordinates,c.point(o[0],o[1],o[2])},MultiPoint:function(o,c){for(var m=o.coordinates,v=-1,l=m.length;++v<l;)o=m[v],c.point(o[0],o[1],o[2])},LineString:function(o,c){Mn(o.coordinates,c,0)},MultiLineString:function(o,c){for(var m=o.coordinates,v=-1,l=m.length;++v<l;)Mn(m[v],c,0)},Polygon:function(o,c){Yi(o.coordinates,c)},MultiPolygon:function(o,c){for(var m=o.coordinates,v=-1,l=m.length;++v<l;)Yi(m[v],c)},GeometryCollection:function(o,c){for(var m=o.geometries,v=-1,l=m.length;++v<l;)rn(m[v],c)}};function Mn(o,c,m){var v=-1,l=o.length-m,k;for(c.lineStart();++v<l;)k=o[v],c.point(k[0],k[1],k[2]);c.lineEnd()}function Yi(o,c){var m=-1,v=o.length;for(c.polygonStart();++m<v;)Mn(o[m],c,1);c.polygonEnd()}function qs(o,c){o&&Gi.hasOwnProperty(o.type)?Gi[o.type](o,c):rn(o,c)}te();te();function An(o){return[_e(o[1],o[0]),le(o[2])]}function pe(o){var c=o[0],m=o[1],v=yt(m);return[v*yt(c),v*dt(c),dt(m)]}function je(o,c){return o[0]*c[0]+o[1]*c[1]+o[2]*c[2]}function sn(o,c){return[o[1]*c[2]-o[2]*c[1],o[2]*c[0]-o[0]*c[2],o[0]*c[1]-o[1]*c[0]]}function Ln(o,c){o[0]+=c[0],o[1]+=c[1],o[2]+=c[2]}function Ke(o,c){return[o[0]*c,o[1]*c,o[2]*c]}function Pn(o){var c=Ee(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=c,o[1]/=c,o[2]/=c}te();function $i(o,c){function m(v,l){return v=o(v,l),c(v[0],v[1])}return o.invert&&c.invert&&(m.invert=function(v,l){return v=c.invert(v,l),v&&o.invert(v[0],v[1])}),m}function bn(o,c){return[o>st?o-Ht:o<-st?o+Ht:o,c]}bn.invert=bn;function Ys(o,c,m){return(o%=Ht)?c||m?$i(Bi(o),Xi(c,m)):Bi(o):c||m?Xi(c,m):bn}function zi(o){return function(c,m){return c+=o,[c>st?c-Ht:c<-st?c+Ht:c,m]}}function Bi(o){var c=zi(o);return c.invert=zi(-o),c}function Xi(o,c){var m=yt(o),v=dt(o),l=yt(c),k=dt(c);function N(g,A){var R=yt(A),E=yt(g)*R,x=dt(g)*R,T=dt(A),w=T*m+E*v;return[_e(x*l-w*k,E*m-T*v),le(w*l+x*k)]}return N.invert=function(g,A){var R=yt(A),E=yt(g)*R,x=dt(g)*R,T=dt(A),w=T*l-x*k;return[_e(x*l+T*k,E*m+w*v),le(w*m-E*v)]},N}function zs(o,c,m,v,l,k){if(m){var N=yt(c),g=dt(c),A=v*m;l==null?(l=c+v*Ht,k=c-A/2):(l=Ui(N,l),k=Ui(N,k),(v>0?l<k:l>k)&&(l+=v*Ht));for(var R,E=l;v>0?E>k:E<k;E-=A)R=An([N,-g*yt(E),-g*dt(E)]),o.point(R[0],R[1])}}function Ui(o,c){c=pe(c),c[0]-=o,Pn(c);var m=Qi(-c[1]);return((-c[2]<0?-m:m)+Ht-ct)%Ht}function tr(){var o=[],c;return{point:function(m,v){c.push([m,v])},lineStart:function(){o.push(c=[])},lineEnd:Me,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var m=o;return o=[],c=null,m}}}function Bs(o,c,m,v,l,k){var N=o[0],g=o[1],A=c[0],R=c[1],E=0,x=1,T=A-N,w=R-g,I;if(I=m-N,!(!T&&I>0)){if(I/=T,T<0){if(I<E)return;I<x&&(x=I)}else if(T>0){if(I>x)return;I>E&&(E=I)}if(I=l-N,!(!T&&I<0)){if(I/=T,T<0){if(I>x)return;I>E&&(E=I)}else if(T>0){if(I<E)return;I<x&&(x=I)}if(I=v-g,!(!w&&I>0)){if(I/=w,w<0){if(I<E)return;I<x&&(x=I)}else if(w>0){if(I>x)return;I>E&&(E=I)}if(I=k-g,!(!w&&I<0)){if(I/=w,w<0){if(I>x)return;I>E&&(E=I)}else if(w>0){if(I<E)return;I<x&&(x=I)}return E>0&&(o[0]=N+E*T,o[1]=g+E*w),x<1&&(c[0]=N+x*T,c[1]=g+x*w),!0}}}}}function tn(o,c){return It(o[0]-c[0])<ct&&It(o[1]-c[1])<ct}function Je(o,c,m,v){this.x=o,this.z=c,this.o=m,this.e=v,this.v=!1,this.n=this.p=null}function er(o,c,m,v,l){var k=[],N=[],g,A;if(o.forEach(function(I){if(!((Q=I.length-1)<=0)){var Q,V=I[0],et=I[Q],U;if(tn(V,et)){for(l.lineStart(),g=0;g<Q;++g)l.point((V=I[g])[0],V[1]);l.lineEnd();return}k.push(U=new Je(V,I,null,!0)),N.push(U.o=new Je(V,null,U,!1)),k.push(U=new Je(et,I,null,!1)),N.push(U.o=new Je(et,null,U,!0))}}),!!k.length){for(N.sort(c),Vi(k),Vi(N),g=0,A=N.length;g<A;++g)N[g].e=m=!m;for(var R=k[0],E,x;;){for(var T=R,w=!0;T.v;)if((T=T.n)===R)return;E=T.z,l.lineStart();do{if(T.v=T.o.v=!0,T.e){if(w)for(g=0,A=E.length;g<A;++g)l.point((x=E[g])[0],x[1]);else v(T.x,T.n.x,1,l);T=T.n}else{if(w)for(E=T.p.z,g=E.length-1;g>=0;--g)l.point((x=E[g])[0],x[1]);else v(T.x,T.p.x,-1,l);T=T.p}T=T.o,E=T.z,w=!w}while(!T.v);l.lineEnd()}}}function Vi(o){if(c=o.length){for(var c,m=0,v=o[0],l;++m<c;)v.n=l=o[m],l.p=v,v=l;v.n=l=o[0],l.p=v}}function nr(o,c){return o<c?-1:o>c?1:o>=c?0:NaN}function Xs(o){return o.length===1&&(o=Us(o)),{left:function(c,m,v,l){for(v==null&&(v=0),l==null&&(l=c.length);v<l;){var k=v+l>>>1;o(c[k],m)<0?v=k+1:l=k}return v},right:function(c,m,v,l){for(v==null&&(v=0),l==null&&(l=c.length);v<l;){var k=v+l>>>1;o(c[k],m)>0?l=k:v=k+1}return v}}}function Us(o){return function(c,m){return nr(o(c),m)}}Xs(nr);function ir(o){for(var c=o.length,m,v=-1,l=0,k,N;++v<c;)l+=o[v].length;for(k=new Array(l);--c>=0;)for(N=o[c],m=N.length;--m>=0;)k[--l]=N[m];return k}var Ae=1e9,Qe=-Ae;function Vs(o,c,m,v){function l(R,E){return o<=R&&R<=m&&c<=E&&E<=v}function k(R,E,x,T){var w=0,I=0;if(R==null||(w=N(R,x))!==(I=N(E,x))||A(R,E)<0^x>0)do T.point(w===0||w===3?o:m,w>1?v:c);while((w=(w+x+4)%4)!==I);else T.point(E[0],E[1])}function N(R,E){return It(R[0]-o)<ct?E>0?0:3:It(R[0]-m)<ct?E>0?2:1:It(R[1]-c)<ct?E>0?1:0:E>0?3:2}function g(R,E){return A(R.x,E.x)}function A(R,E){var x=N(R,1),T=N(E,1);return x!==T?x-T:x===0?E[1]-R[1]:x===1?R[0]-E[0]:x===2?R[1]-E[1]:E[0]-R[0]}return function(R){var E=R,x=tr(),T,w,I,Q,V,et,U,P,W,F,G,z={point:K,lineStart:lt,lineEnd:_t,polygonStart:ft,polygonEnd:ot};function K(tt,ut){l(tt,ut)&&E.point(tt,ut)}function q(){for(var tt=0,ut=0,vt=w.length;ut<vt;++ut)for(var kt=w[ut],Et=1,D=kt.length,Tt=kt[0],xt,wt,$=Tt[0],Zt=Tt[1];Et<D;++Et)xt=$,wt=Zt,Tt=kt[Et],$=Tt[0],Zt=Tt[1],wt<=v?Zt>v&&($-xt)*(v-wt)>(Zt-wt)*(o-xt)&&++tt:Zt<=v&&($-xt)*(v-wt)<(Zt-wt)*(o-xt)&&--tt;return tt}function ft(){E=x,T=[],w=[],G=!0}function ot(){var tt=q(),ut=G&&tt,vt=(T=ir(T)).length;(ut||vt)&&(R.polygonStart(),ut&&(R.lineStart(),k(null,null,1,R),R.lineEnd()),vt&&er(T,g,tt,k,R),R.polygonEnd()),E=R,T=w=I=null}function lt(){z.point=M,w&&w.push(I=[]),F=!0,W=!1,U=P=NaN}function _t(){T&&(M(Q,V),et&&W&&x.rejoin(),T.push(x.result())),z.point=K,W&&E.lineEnd()}function M(tt,ut){var vt=l(tt,ut);if(w&&I.push([tt,ut]),F)Q=tt,V=ut,et=vt,F=!1,vt&&(E.lineStart(),E.point(tt,ut));else if(vt&&W)E.point(tt,ut);else{var kt=[U=Math.max(Qe,Math.min(Ae,U)),P=Math.max(Qe,Math.min(Ae,P))],Et=[tt=Math.max(Qe,Math.min(Ae,tt)),ut=Math.max(Qe,Math.min(Ae,ut))];Bs(kt,Et,o,c,m,v)?(W||(E.lineStart(),E.point(kt[0],kt[1])),E.point(Et[0],Et[1]),vt||E.lineEnd(),G=!1):vt&&(E.lineStart(),E.point(tt,ut),G=!1)}U=tt,P=ut,W=vt}return z}}var Rn=te();function Hs(o,c){var m=c[0],v=c[1],l=[dt(m),-yt(m),0],k=0,N=0;Rn.reset();for(var g=0,A=o.length;g<A;++g)if(E=(R=o[g]).length)for(var R,E,x=R[E-1],T=x[0],w=x[1]/2+Fi,I=dt(w),Q=yt(w),V=0;V<E;++V,T=U,I=W,Q=F,x=et){var et=R[V],U=et[0],P=et[1]/2+Fi,W=dt(P),F=yt(P),G=U-T,z=G>=0?1:-1,K=z*G,q=K>st,ft=I*W;if(Rn.add(_e(ft*z*dt(K),Q*F+ft*yt(K))),k+=q?G+z*Ht:G,q^T>=m^U>=m){var ot=sn(pe(x),pe(et));Pn(ot);var lt=sn(l,ot);Pn(lt);var _t=(q^G>=0?-1:1)*le(lt[2]);(v>_t||v===_t&&(ot[0]||ot[1]))&&(N+=q^G>=0?1:-1)}}return(k<-ct||k<ct&&Rn<-ct)^N&1}te();function Hi(o){return o}te();te();var ke=1/0,an=ke,Pe=-ke,un=Pe,Zi={point:Zs,lineStart:Me,lineEnd:Me,polygonStart:Me,polygonEnd:Me,result:function(){var o=[[ke,an],[Pe,un]];return Pe=un=-(an=ke=1/0),o}};function Zs(o,c){o<ke&&(ke=o),o>Pe&&(Pe=o),c<an&&(an=c),c>un&&(un=c)}te();function rr(o,c,m,v){return function(l,k){var N=c(k),g=l.invert(v[0],v[1]),A=tr(),R=c(A),E=!1,x,T,w,I={point:Q,lineStart:et,lineEnd:U,polygonStart:function(){I.point=P,I.lineStart=W,I.lineEnd=F,T=[],x=[]},polygonEnd:function(){I.point=Q,I.lineStart=et,I.lineEnd=U,T=ir(T);var G=Hs(x,g);T.length?(E||(k.polygonStart(),E=!0),er(T,js,G,m,k)):G&&(E||(k.polygonStart(),E=!0),k.lineStart(),m(null,null,1,k),k.lineEnd()),E&&(k.polygonEnd(),E=!1),T=x=null},sphere:function(){k.polygonStart(),k.lineStart(),m(null,null,1,k),k.lineEnd(),k.polygonEnd()}};function Q(G,z){var K=l(G,z);o(G=K[0],z=K[1])&&k.point(G,z)}function V(G,z){var K=l(G,z);N.point(K[0],K[1])}function et(){I.point=V,N.lineStart()}function U(){I.point=Q,N.lineEnd()}function P(G,z){w.push([G,z]);var K=l(G,z);R.point(K[0],K[1])}function W(){R.lineStart(),w=[]}function F(){P(w[0][0],w[0][1]),R.lineEnd();var G=R.clean(),z=A.result(),K,q=z.length,ft,ot,lt;if(w.pop(),x.push(w),w=null,!!q){if(G&1){if(ot=z[0],(ft=ot.length-1)>0){for(E||(k.polygonStart(),E=!0),k.lineStart(),K=0;K<ft;++K)k.point((lt=ot[K])[0],lt[1]);k.lineEnd()}return}q>1&&G&2&&z.push(z.pop().concat(z.shift())),T.push(z.filter(Ws))}}return I}}function Ws(o){return o.length>1}function js(o,c){return((o=o.x)[0]<0?o[1]-Vt-ct:Vt-o[1])-((c=c.x)[0]<0?c[1]-Vt-ct:Vt-c[1])}const Wi=rr(function(){return!0},Ks,Qs,[-st,-Vt]);function Ks(o){var c=NaN,m=NaN,v=NaN,l;return{lineStart:function(){o.lineStart(),l=1},point:function(k,N){var g=k>0?st:-st,A=It(k-c);It(A-st)<ct?(o.point(c,m=(m+N)/2>0?Vt:-Vt),o.point(v,m),o.lineEnd(),o.lineStart(),o.point(g,m),o.point(k,m),l=0):v!==g&&A>=st&&(It(c-v)<ct&&(c-=v*ct),It(k-g)<ct&&(k-=g*ct),m=Js(c,m,k,N),o.point(v,m),o.lineEnd(),o.lineStart(),o.point(g,m),l=0),o.point(c=k,m=N),v=g},lineEnd:function(){o.lineEnd(),c=m=NaN},clean:function(){return 2-l}}}function Js(o,c,m,v){var l,k,N=dt(o-m);return It(N)>ct?Gs((dt(c)*(k=yt(v))*dt(m)-dt(v)*(l=yt(c))*dt(o))/(l*k*N)):(c+v)/2}function Qs(o,c,m,v){var l;if(o==null)l=m*Vt,v.point(-st,l),v.point(0,l),v.point(st,l),v.point(st,0),v.point(st,-l),v.point(0,-l),v.point(-st,-l),v.point(-st,0),v.point(-st,l);else if(It(o[0]-c[0])>ct){var k=o[0]<c[0]?st:-st;l=m*k/2,v.point(-k,l),v.point(0,l),v.point(k,l)}else v.point(c[0],c[1])}function $s(o,c){var m=yt(o),v=m>0,l=It(m)>ct;function k(E,x,T,w){zs(w,o,c,T,E,x)}function N(E,x){return yt(E)*yt(x)>m}function g(E){var x,T,w,I,Q;return{lineStart:function(){I=w=!1,Q=1},point:function(V,et){var U=[V,et],P,W=N(V,et),F=v?W?0:R(V,et):W?R(V+(V<0?st:-st),et):0;if(!x&&(I=w=W)&&E.lineStart(),W!==w&&(P=A(x,U),(!P||tn(x,P)||tn(U,P))&&(U[0]+=ct,U[1]+=ct,W=N(U[0],U[1]))),W!==w)Q=0,W?(E.lineStart(),P=A(U,x),E.point(P[0],P[1])):(P=A(x,U),E.point(P[0],P[1]),E.lineEnd()),x=P;else if(l&&x&&v^W){var G;!(F&T)&&(G=A(U,x,!0))&&(Q=0,v?(E.lineStart(),E.point(G[0][0],G[0][1]),E.point(G[1][0],G[1][1]),E.lineEnd()):(E.point(G[1][0],G[1][1]),E.lineEnd(),E.lineStart(),E.point(G[0][0],G[0][1])))}W&&(!x||!tn(x,U))&&E.point(U[0],U[1]),x=U,w=W,T=F},lineEnd:function(){w&&E.lineEnd(),x=null},clean:function(){return Q|(I&&w)<<1}}}function A(E,x,T){var w=pe(E),I=pe(x),Q=[1,0,0],V=sn(w,I),et=je(V,V),U=V[0],P=et-U*U;if(!P)return!T&&E;var W=m*et/P,F=-m*U/P,G=sn(Q,V),z=Ke(Q,W),K=Ke(V,F);Ln(z,K);var q=G,ft=je(z,q),ot=je(q,q),lt=ft*ft-ot*(je(z,z)-1);if(!(lt<0)){var _t=Ee(lt),M=Ke(q,(-ft-_t)/ot);if(Ln(M,z),M=An(M),!T)return M;var tt=E[0],ut=x[0],vt=E[1],kt=x[1],Et;ut<tt&&(Et=tt,tt=ut,ut=Et);var D=ut-tt,Tt=It(D-st)<ct,xt=Tt||D<ct;if(!Tt&&kt<vt&&(Et=vt,vt=kt,kt=Et),xt?Tt?vt+kt>0^M[1]<(It(M[0]-tt)<ct?vt:kt):vt<=M[1]&&M[1]<=kt:D>st^(tt<=M[0]&&M[0]<=ut)){var wt=Ke(q,(-ft+_t)/ot);return Ln(wt,z),[M,An(wt)]}}}function R(E,x){var T=v?o:st-o,w=0;return E<-T?w|=1:E>T&&(w|=2),x<-T?w|=4:x>T&&(w|=8),w}return rr(N,g,k,v?[0,-o]:[-st,o-st])}function sr(o){return function(c){var m=new Dn;for(var v in o)m[v]=o[v];return m.stream=c,m}}function Dn(){}Dn.prototype={constructor:Dn,point:function(o,c){this.stream.point(o,c)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function ar(o,c,m){var v=c[1][0]-c[0][0],l=c[1][1]-c[0][1],k=o.clipExtent&&o.clipExtent();o.scale(150).translate([0,0]),k!=null&&o.clipExtent(null),qs(m,o.stream(Zi));var N=Zi.result(),g=Math.min(v/(N[1][0]-N[0][0]),l/(N[1][1]-N[0][1])),A=+c[0][0]+(v-g*(N[1][0]+N[0][0]))/2,R=+c[0][1]+(l-g*(N[1][1]+N[0][1]))/2;return k!=null&&o.clipExtent(k),o.scale(g*150).translate([A,R])}function ta(o,c,m){return ar(o,[[0,0],c],m)}var ji=16,ea=yt(30*Ft);function Ki(o,c){return+c?ia(o,c):na(o)}function na(o){return sr({point:function(c,m){c=o(c,m),this.stream.point(c[0],c[1])}})}function ia(o,c){function m(v,l,k,N,g,A,R,E,x,T,w,I,Q,V){var et=R-v,U=E-l,P=et*et+U*U;if(P>4*c&&Q--){var W=N+T,F=g+w,G=A+I,z=Ee(W*W+F*F+G*G),K=le(G/=z),q=It(It(G)-1)<ct||It(k-x)<ct?(k+x)/2:_e(F,W),ft=o(q,K),ot=ft[0],lt=ft[1],_t=ot-v,M=lt-l,tt=U*_t-et*M;(tt*tt/P>c||It((et*_t+U*M)/P-.5)>.3||N*T+g*w+A*I<ea)&&(m(v,l,k,N,g,A,ot,lt,q,W/=z,F/=z,G,Q,V),V.point(ot,lt),m(ot,lt,q,W,F,G,R,E,x,T,w,I,Q,V))}}return function(v){var l,k,N,g,A,R,E,x,T,w,I,Q,V={point:et,lineStart:U,lineEnd:W,polygonStart:function(){v.polygonStart(),V.lineStart=F},polygonEnd:function(){v.polygonEnd(),V.lineStart=U}};function et(K,q){K=o(K,q),v.point(K[0],K[1])}function U(){x=NaN,V.point=P,v.lineStart()}function P(K,q){var ft=pe([K,q]),ot=o(K,q);m(x,T,E,w,I,Q,x=ot[0],T=ot[1],E=K,w=ft[0],I=ft[1],Q=ft[2],ji,v),v.point(x,T)}function W(){V.point=et,v.lineEnd()}function F(){U(),V.point=G,V.lineEnd=z}function G(K,q){P(l=K,q),k=x,N=T,g=w,A=I,R=Q,V.point=P}function z(){m(x,T,E,w,I,Q,k,N,l,g,A,R,ji,v),V.lineEnd=W,W()}return V}}var ra=sr({point:function(o,c){this.stream.point(o*Ft,c*Ft)}});function sa(o){return aa(function(){return o})()}function aa(o){var c,m=150,v=480,l=250,k,N,g=0,A=0,R=0,E=0,x=0,T,w,I=null,Q=Wi,V=null,et,U,P,W=Hi,F=.5,G=Ki(ot,F),z,K;function q(M){return M=w(M[0]*Ft,M[1]*Ft),[M[0]*m+k,N-M[1]*m]}function ft(M){return M=w.invert((M[0]-k)/m,(N-M[1])/m),M&&[M[0]*$t,M[1]*$t]}function ot(M,tt){return M=c(M,tt),[M[0]*m+k,N-M[1]*m]}q.stream=function(M){return z&&K===M?z:z=ra(Q(T,G(W(K=M))))},q.clipAngle=function(M){return arguments.length?(Q=+M?$s(I=M*Ft,6*Ft):(I=null,Wi),_t()):I*$t},q.clipExtent=function(M){return arguments.length?(W=M==null?(V=et=U=P=null,Hi):Vs(V=+M[0][0],et=+M[0][1],U=+M[1][0],P=+M[1][1]),_t()):V==null?null:[[V,et],[U,P]]},q.scale=function(M){return arguments.length?(m=+M,lt()):m},q.translate=function(M){return arguments.length?(v=+M[0],l=+M[1],lt()):[v,l]},q.center=function(M){return arguments.length?(g=M[0]%360*Ft,A=M[1]%360*Ft,lt()):[g*$t,A*$t]},q.rotate=function(M){return arguments.length?(R=M[0]%360*Ft,E=M[1]%360*Ft,x=M.length>2?M[2]%360*Ft:0,lt()):[R*$t,E*$t,x*$t]},q.precision=function(M){return arguments.length?(G=Ki(ot,F=M*M),_t()):Ee(F)},q.fitExtent=function(M,tt){return ar(q,M,tt)},q.fitSize=function(M,tt){return ta(q,M,tt)};function lt(){w=$i(T=Ys(R,E,x),c);var M=c(g,A);return k=v-M[0]*m,N=l+M[1]*m,_t()}function _t(){return z=K=null,q}return function(){return c=o.apply(this,arguments),q.invert=c.invert&&ft,lt()}}function ur(o){return function(c,m){var v=yt(c),l=yt(m),k=o(v*l);return[k*l*dt(c),k*dt(m)]}}function or(o){return function(c,m){var v=Ee(c*c+m*m),l=o(v),k=dt(l),N=yt(l);return[_e(c*k,v*N),le(v&&m*k/v)]}}var ua=ur(function(o){return Ee(2/(1+o))});ua.invert=or(function(o){return 2*le(o/2)});var lr=ur(function(o){return(o=Qi(o))&&o/dt(o)});lr.invert=or(function(o){return o});function oa(){return sa(lr).scale(79.4188).clipAngle(180-.001)}function Ji(o,c){return[o,c]}Ji.invert=Ji;var{BufferOp:la,GeoJSONReader:ha,GeoJSONWriter:ca}=Fs;function fa(o,c,m){m=m||{};var v=m.units||"kilometers",l=m.steps||8;if(!o)throw new Error("geojson is required");if(typeof m!="object")throw new Error("options must be an object");if(typeof l!="number")throw new Error("steps must be an number");if(c===void 0)throw new Error("radius is required");if(l<=0)throw new Error("steps must be greater than 0");var k=[];switch(o.type){case"GeometryCollection":return Y.geomEach(o,function(N){var g=en(N,c,v,l);g&&k.push(g)}),Y.featureCollection(k);case"FeatureCollection":return Y.featureEach(o,function(N){var g=en(N,c,v,l);g&&Y.featureEach(g,function(A){A&&k.push(A)})}),Y.featureCollection(k)}return en(o,c,v,l)}function en(o,c,m,v){var l=o.properties||{},k=o.type==="Feature"?o.geometry:o;if(k.type==="GeometryCollection"){var N=[];return Y.geomEach(o,function(Q){var V=en(Q,c,m,v);V&&N.push(V)}),Y.featureCollection(N)}var g=ga(k),A={type:k.type,coordinates:cr(k.coordinates,g)},R=new ha,E=R.read(A),x=Y.radiansToLength(Y.lengthToRadians(c,m),"meters"),T=la.bufferOp(E,x,v),w=new ca;if(T=w.write(T),!hr(T.coordinates)){var I={type:T.type,coordinates:fr(T.coordinates,g)};return Y.feature(I,l)}}function hr(o){return Array.isArray(o[0])?hr(o[0]):isNaN(o[0])}function cr(o,c){return typeof o[0]!="object"?c(o):o.map(function(m){return cr(m,c)})}function fr(o,c){return typeof o[0]!="object"?c.invert(o):o.map(function(m){return fr(m,c)})}function ga(o){var c=As(o).geometry.coordinates,m=[-c[0],-c[1]];return oa().rotate(m).scale(Y.earthRadius)}function gr(o){return!Array.isArray(o)||o.length===0?!1:typeof o[0]=="number"&&typeof o[1]=="number"}function va(o,c,m=!0,v=!1){if(!(!Array.isArray(o)||o.length!==2||!o.every(Y.i)||o.some(l=>l===Number.POSITIVE_INFINITY||l===Number.NEGATIVE_INFINITY)))return o.map(l=>{const k=Y.s(l,c);let N;return v?N=k.toFixed(c):N=k.toString(),m?Y.d(N):N}).join(", ")}function vr(o,c){if(c.usesMercatorPyramid&&c.bounds&&Array.isArray(o)){if(o.length===2&&o.every(Y.i)){const[m,v]=o;if(m>=c.bounds.lowerX&&m<=c.bounds.upperX)return o;const l=c.bounds.upperX-c.bounds.lowerX,N=Math.floor((m-c.bounds.lowerX)/l)*l;return[m-N,v]}else if(o.every(Array.isArray))return o.map(m=>vr(m,c))}return o}function mr(o){return o?o.every(c=>gr(c))?o:mr(o[0]):[]}function ma(o){if(Array.isArray(o)){if(o.every(c=>c.length===2))return o;if(o.some(c=>c.length>2))return o.map(c=>[c[0],c[1]])}throw new Error("Invalid coordinates received, cannot remove Z values")}function yr(o,c,m){if(!o||!c)throw new Error("Invalid arguments, must receive two CRS");if(!gr(m))throw new Error("Invalid coordinates received, must be an array of number or an array of coordinates");const v=m[0];return Array.isArray(v)?m.map(l=>yr(o,c,l)):Y.proj4(o.epsg,c.epsg,m).map(l=>c.roundCoordinateValue(l))}function ya(o){const c=o?.split(":").pop();if(c)return c==="WGS84"?Y.WGS84:Y.allCoordinateSystems.find(m=>m.epsg===`EPSG:${c}`)}const dr={toRoundedString:va,wrapXCoordinates:vr,unwrapGeometryCoordinates:mr,removeZValues:ma,reprojectAndRound:yr,parseCRS:ya};function be(o,c,m){if(m.length===4){const v=Y.proj4(o.epsg,c.epsg,[m[0],m[1]]),l=Y.proj4(o.epsg,c.epsg,[m[2],m[3]]);return[...v,...l].map(k=>c.roundCoordinateValue(k))}else if(m.length===2){const v=Y.proj4(o.epsg,c.epsg,m[0]).map(k=>c.roundCoordinateValue(k)),l=Y.proj4(o.epsg,c.epsg,m[1]).map(k=>c.roundCoordinateValue(k));return[v,l]}return m}function Fn(o){let c=o;return o?.length===4&&(c=[[o[0],o[1]],[o[2],o[3]]]),c}function Gn(o){let c=o;return o?.length===2&&(c=[...o[0],...o[1]]),c}function _r(o,c,m){if(o?.length!==4&&o?.length!==2||!c||!m||!m.bounds)return;let v=m.bounds.flatten;c.epsg!==m.epsg&&(v=be(m,c,v));let l=Y.bbox(Ms(Y.bboxPolygon(v),Gn(o)));if(!(!l||l.length!==4||l.every(k=>Math.abs(k)===1/0)))return c.epsg!==m.epsg&&(l=be(c,m,l)),l}function pr(o){const[c,m]=Fn(o);return[(c[0]+m[0])/2,(c[1]+m[1])/2]}function kr(o){const{size:c,coordinate:m,projection:v,resolution:l,rounded:k=!1}=o;if(!c||!m||!v||!l)return;let N=m;v.epsg!==Y.WGS84.epsg&&(N=Y.proj4(v.epsg,Y.WGS84.epsg,m));const g=fa(Y.point(N),c*l,{units:"meters"});if(!g)return;const A=be(Y.WGS84,v,Y.bbox(g));return k?A.map(R=>Y.s(R)):A}const Er={projExtent:be,normalizeExtent:Fn,flattenExtent:Gn,getExtentIntersectionWithCurrentProjection:_r,createPixelExtentAround:kr,getExtentCenter:pr};Y.registerProj4(Y.proj4);const da={...Y.crs,coordinatesUtils:dr,extentUtils:Er,registerProj4:Y.registerProj4};exports.CoordinateSystem=Y.CoordinateSystem;exports.CoordinateSystemBounds=Y.CoordinateSystemBounds;exports.CustomCoordinateSystem=Y.CustomCoordinateSystem;exports.LV03=Y.LV03;exports.LV95=Y.LV95;exports.StandardCoordinateSystem=Y.StandardCoordinateSystem;exports.SwissCoordinateSystem=Y.SwissCoordinateSystem;exports.WEBMERCATOR=Y.WEBMERCATOR;exports.WGS84=Y.WGS84;exports.allCoordinateSystems=Y.allCoordinateSystems;exports.constants=Y.constants;exports.crs=Y.crs;exports.registerProj4=Y.registerProj4;exports.coordinatesUtils=dr;exports.createPixelExtentAround=kr;exports.default=da;exports.extentUtils=Er;exports.flattenExtent=Gn;exports.getExtentCenter=pr;exports.getExtentIntersectionWithCurrentProjection=_r;exports.normalizeExtent=Fn;exports.projExtent=be;
|