diff --git a/dist/vl-mapactions.js b/dist/vl-mapactions.js index b695b24..61087cb 100644 --- a/dist/vl-mapactions.js +++ b/dist/vl-mapactions.js @@ -5,4 +5,4 @@ var VlMapActions=function(t){var e={};function i(n){if(e[n])return e[n].exports; * https://github.com/bjornharrtell/jsts/blob/master/LICENSE_EPLv1.txt * @license */ -!function(t){"use strict";class e{static equalsWithTolerance(t,e,i){return Math.abs(t-e)<=i}}class i extends Error{constructor(t){super(t),this.name=Object.keys({Exception:i})[0]}toString(){return this.message}}class n extends i{constructor(t){super(t),this.name=Object.keys({IllegalArgumentException:n})[0]}}class r{constructor(t,e){this.low=e||0,this.high=t||0}static toBinaryString(t){let e,i="";for(e=2147483648;e>0;e>>>=1)i+=(t.high&e)===e?"1":"0";for(e=2147483648;e>0;e>>>=1)i+=(t.low&e)===e?"1":"0";return i}}function s(){}function o(){}function a(){}function l(){}function h(){}s.NaN=NaN,s.isNaN=t=>Number.isNaN(t),s.isInfinite=t=>!Number.isFinite(t),s.MAX_VALUE=Number.MAX_VALUE,"function"==typeof Float64Array&&"function"==typeof Int32Array?function(){const t=new Float64Array(1),e=new Int32Array(t.buffer);s.doubleToLongBits=function(i){t[0]=i;let n=0|e[0],s=0|e[1];return 2146435072==(2146435072&s)&&0!=(1048575&s)&&0!==n&&(n=0,s=2146959360),new r(s,n)},s.longBitsToDouble=function(i){return e[0]=i.low,e[1]=i.high,t[0]}}():function(){const t=Math.log2,e=Math.floor,i=Math.pow,n=function(){for(let n=53;n>0;n--){const r=i(2,n)-1;if(e(t(r))+1===n)return r}return 0}();s.doubleToLongBits=function(s){let o,a,l,h,c,u,d,g,_;if(s<0||1/s===Number.NEGATIVE_INFINITY?(u=1<<31,s=-s):u=0,0===s)return _=0,g=u,new r(g,_);if(s===1/0)return _=0,g=2146435072|u,new r(g,_);if(s!=s)return _=0,g=2146959360,new r(g,_);if(h=0,_=0,o=e(s),o>1)if(o<=n)h=e(t(o)),h<=20?(_=0,g=o<<20-h&1048575):(l=h-20,a=i(2,l),_=o%a<<32-l,g=o/a&1048575);else for(l=o,_=0;a=l/2,l=e(a),0!==l;)h++,_>>>=1,_|=(1&g)<<31,g>>>=1,a!==l&&(g|=524288);if(d=h+1023,c=0===o,o=s-o,h<52&&0!==o)for(l=0;;){if(a=2*o,a>=1?(o=a-1,c?(d--,c=!1):(l<<=1,l|=1,h++)):(o=a,c?0==--d&&(h++,c=!1):(l<<=1,h++)),20===h)g|=l,l=0;else if(52===h){_|=l;break}if(1===a){h<20?g|=l<<20-h:h<52&&(_|=l<<52-h);break}}return g|=d<<20,g|=u,new r(g,_)},s.longBitsToDouble=function(t){let e,n,r,s;const o=t.high,a=t.low,l=o&1<<31?-1:1;for(r=((2146435072&o)>>20)-1023,s=0,n=1<<19,e=1;e<=20;e++)o&n&&(s+=i(2,-e)),n>>>=1;for(n=1<<31,e=21;e<=52;e++)a&n&&(s+=i(2,-e)),n>>>=1;if(-1023===r){if(0===s)return 0*l;r=-1022}else{if(1024===r)return 0===s?l/0:NaN;s+=1}return l*s*i(2,r)}}();class c extends i{constructor(t){super(t),this.name=Object.keys({RuntimeException:c})[0]}}class u extends c{constructor(){super(),u.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)c.constructor_.call(this);else if(1===arguments.length){const t=arguments[0];c.constructor_.call(this,t)}}}class d{static shouldNeverReachHere(){if(0===arguments.length)d.shouldNeverReachHere(null);else if(1===arguments.length){const t=arguments[0];throw new u("Should never reach here"+(null!==t?": "+t:""))}}static isTrue(){if(1===arguments.length){const t=arguments[0];d.isTrue(t,null)}else if(2===arguments.length){const t=arguments[1];if(!arguments[0])throw null===t?new u:new u(t)}}static equals(){if(2===arguments.length){const t=arguments[0],e=arguments[1];d.equals(t,e,null)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];if(!e.equals(t))throw new u("Expected "+t+" but encountered "+e+(null!==i?": "+i:""))}}}const g=new ArrayBuffer(8),_=new Float64Array(g),p=new Int32Array(g);class f{constructor(){f.constructor_.apply(this,arguments)}static constructor_(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)f.constructor_.call(this,0,0);else if(1===arguments.length){const t=arguments[0];f.constructor_.call(this,t.x,t.y,t.getZ())}else if(2===arguments.length){const t=arguments[0],e=arguments[1];f.constructor_.call(this,t,e,f.NULL_ORDINATE)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this.x=t,this.y=e,this.z=i}}static hashCode(t){return _[0]=t,p[0]^p[1]}getM(){return s.NaN}setOrdinate(t,e){switch(t){case f.X:this.x=e;break;case f.Y:this.y=e;break;case f.Z:this.setZ(e);break;default:throw new n("Invalid ordinate index: "+t)}}equals2D(){if(1===arguments.length){const t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){const t=arguments[0],i=arguments[1];return!!e.equalsWithTolerance(this.x,t.x,i)&&!!e.equalsWithTolerance(this.y,t.y,i)}}setM(t){throw new n("Invalid ordinate index: "+f.M)}getZ(){return this.z}getOrdinate(t){switch(t){case f.X:return this.x;case f.Y:return this.y;case f.Z:return this.getZ()}throw new n("Invalid ordinate index: "+t)}equals3D(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||s.isNaN(this.getZ())&&s.isNaN(t.getZ()))}equals(t){return t instanceof f&&this.equals2D(t)}equalInZ(t,i){return e.equalsWithTolerance(this.getZ(),t.getZ(),i)}setX(t){this.x=t}compareTo(t){const e=t;return this.xe.x?1:this.ye.y?1:0}getX(){return this.x}setZ(t){this.z=t}clone(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return d.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}copy(){return new f(this)}toString(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}distance3D(t){const e=this.x-t.x,i=this.y-t.y,n=this.getZ()-t.getZ();return Math.sqrt(e*e+i*i+n*n)}getY(){return this.y}setY(t){this.y=t}distance(t){const e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)}hashCode(){let t=17;return t=37*t+f.hashCode(this.x),t=37*t+f.hashCode(this.y),t}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}get interfaces_(){return[o,a,h]}}class m{constructor(){m.constructor_.apply(this,arguments)}static constructor_(){if(this._dimensionsToTest=2,0===arguments.length)m.constructor_.call(this,2);else if(1===arguments.length){const t=arguments[0];if(2!==t&&3!==t)throw new n("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}static compare(t,e){return te?1:s.isNaN(t)?s.isNaN(e)?0:-1:s.isNaN(e)?1:0}compare(t,e){const i=m.compare(t.x,e.x);if(0!==i)return i;const n=m.compare(t.y,e.y);return 0!==n?n:this._dimensionsToTest<=2?0:m.compare(t.getZ(),e.getZ())}get interfaces_(){return[l]}}function y(t,e){return t.interfaces_&&t.interfaces_.indexOf(e)>-1}f.DimensionalComparator=m,f.NULL_ORDINATE=s.NaN,f.X=0,f.Y=1,f.Z=2,f.M=3;class v{add(){}addAll(){}isEmpty(){}iterator(){}size(){}toArray(){}remove(){}}class x extends i{constructor(t){super(t),this.name=Object.keys({IndexOutOfBoundsException:x})[0]}}class E extends v{get(){}set(){}isEmpty(){}}class I extends i{constructor(t){super(t),this.name=Object.keys({NoSuchElementException:I})[0]}}class C extends E{constructor(t){super(),this.array=[],t instanceof v&&this.addAll(t)}get interfaces_(){return[E,v]}ensureCapacity(){}add(t){return 1===arguments.length?this.array.push(t):this.array.splice(arguments[0],0,arguments[1]),!0}clear(){this.array=[]}addAll(t){for(const e of t)this.array.push(e)}set(t,e){const i=this.array[t];return this.array[t]=e,i}iterator(){return new w(this)}get(t){if(t<0||t>=this.size())throw new x;return this.array[t]}isEmpty(){return 0===this.array.length}sort(t){t?this.array.sort((e,i)=>t.compare(e,i)):this.array.sort()}size(){return this.array.length}toArray(){return this.array.slice()}remove(t){for(let e=0,i=this.array.length;e=1&&this.get(this.size()-1).equals2D(t))return null;super.add.call(this,t)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return this.add(t,e),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];if(arguments[2])for(let i=0;i=0;i--)this.add(t[i],e);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1];if(!arguments[2]){const i=this.size();if(i>0){if(t>0&&this.get(t-1).equals2D(e))return null;if(tn&&(r=-1);for(let s=i;s!==n;s+=r)this.add(t[s],e);return!0}}closeRing(){if(this.size()>0){const t=this.get(0).copy();this.add(t,!1)}}}S.coordArrayType=new Array(0).fill(null);class T{filter(t,e){}isDone(){}isGeometryChanged(){}}class L{constructor(){L.constructor_.apply(this,arguments)}static constructor_(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof f){const t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof L){const t=arguments[0];this.init(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t.x,e.x,t.y,e.y)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this.init(t,e,i,n)}}static intersects(){if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return i.x>=(t.xe.x?t.x:e.x)&&i.y>=(t.ye.y?t.y:e.y)}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];let r=Math.min(i.x,n.x),s=Math.max(i.x,n.x),o=Math.min(t.x,e.x),a=Math.max(t.x,e.x);return!(o>s||as||at._minx?this._minx:t._minx,i=this._miny>t._miny?this._miny:t._miny,n=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];return!this.isNull()&&t>=this._minx&&t<=this._maxx&&e>=this._miny&&e<=this._maxy}}intersects(){if(1===arguments.length){if(arguments[0]instanceof L){const t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||(t.x>e.x?t.x:e.x)this._maxy||(t.y>e.y?t.y:e.y)this._maxx||tthis._maxy||ethis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.isNull()?(this._minx=t,this._maxx=t,this._miny=e,this._maxy=e):(tthis._maxx&&(this._maxx=t),ethis._maxy&&(this._maxy=e))}}minExtent(){if(this.isNull())return 0;const t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0}translate(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}copy(){return new L(this)}toString(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}setToNull(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}disjoint(t){return!(!this.isNull()&&!t.isNull())||t._minx>this._maxx||t._maxxthis._maxy||t._maxye?t:e}expandBy(){if(1===arguments.length){const t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=e,this._maxy+=e,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}contains(){if(1===arguments.length){if(arguments[0]instanceof L){const t=arguments[0];return this.covers(t)}if(arguments[0]instanceof f){const t=arguments[0];return this.covers(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.covers(t,e)}}centre(){return this.isNull()?null:new f((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}init(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof f){const t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof L){const t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t.x,e.x,t.y,e.y)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];tt._maxx&&(e=this._minx-t._maxx);let i=0;return this._maxyt._maxy&&(i=this._miny-t._maxy),0===e?i:0===i?e:Math.sqrt(e*e+i*i)}hashCode(){let t=17;return t=37*t+f.hashCode(this._minx),t=37*t+f.hashCode(this._maxx),t=37*t+f.hashCode(this._miny),t=37*t+f.hashCode(this._maxy),t}get interfaces_(){return[o,h]}}class N{constructor(t){this.str=t}append(t){this.str+=t}setCharAt(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}toString(){return this.str}}class O{constructor(t){this.value=t}intValue(){return this.value}compareTo(t){return this.valuet?1:0}static compare(t,e){return te?1:0}static isNan(t){return Number.isNaN(t)}static valueOf(t){return new O(t)}}class R{static isWhitespace(t){return t<=32&&t>=0||127===t}static toUpperCase(t){return t.toUpperCase()}}class P{constructor(){P.constructor_.apply(this,arguments)}static constructor_(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){const t=arguments[0];this.init(t)}else if(arguments[0]instanceof P){const t=arguments[0];this.init(t)}else if("string"==typeof arguments[0]){const t=arguments[0];P.constructor_.call(this,P.parse(t))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t,e)}}static determinant(){if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];return P.determinant(P.valueOf(t),P.valueOf(e),P.valueOf(i),P.valueOf(n))}if(arguments[3]instanceof P&&arguments[2]instanceof P&&arguments[0]instanceof P&&arguments[1]instanceof P){const t=arguments[1],e=arguments[2],i=arguments[3];return arguments[0].multiply(i).selfSubtract(t.multiply(e))}}static sqr(t){return P.valueOf(t).selfMultiply(t)}static valueOf(){if("string"==typeof arguments[0]){const t=arguments[0];return P.parse(t)}if("number"==typeof arguments[0])return new P(arguments[0])}static sqrt(t){return P.valueOf(t).sqrt()}static parse(t){let e=0;const i=t.length;for(;R.isWhitespace(t.charAt(e));)e++;let n=!1;if(e=i);){const i=t.charAt(e);if(e++,R.isDigit(i)){const t=i-"0";r.selfMultiply(P.TEN),r.selfAdd(t),s++}else{if("."!==i){if("e"===i||"E"===i){const i=t.substring(e);try{a=O.parseInt(i)}catch(e){throw e instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+i+" in string "+t):e}break}throw new NumberFormatException("Unexpected character '"+i+"' at position "+e+" in string "+t)}o=s,l=!0}}let h=r;l||(o=s);const c=s-o-a;if(0===c)h=r;else if(c>0){const t=P.TEN.pow(c);h=r.divide(t)}else if(c<0){const t=P.TEN.pow(-c);h=r.multiply(t)}return n?h.negate():h}static createNaN(){return new P(s.NaN,s.NaN)}static copy(t){return new P(t)}static magnitude(t){const e=Math.abs(t),i=Math.log(e)/Math.log(10);let n=Math.trunc(Math.floor(i));return 10*Math.pow(10,n)<=e&&(n+=1),n}static stringOfChar(t,e){const i=new N;for(let n=0;n9?(r=!0,l="9"):l="0"+n,o.append(l),i=i.subtract(P.valueOf(n)).multiply(P.TEN),r&&i.selfAdd(P.TEN);let h=!0;const c=P.magnitude(i._hi);if(c<0&&Math.abs(c)>=a-e&&(h=!1),!h)break}return e[0]=n,o.toString()}sqr(){return this.multiply(this)}doubleValue(){return this._hi+this._lo}subtract(){if(arguments[0]instanceof P){const t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){const t=arguments[0];return this.add(-t)}}equals(){if(1===arguments.length&&arguments[0]instanceof P){const t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}isZero(){return 0===this._hi&&0===this._lo}selfSubtract(){if(arguments[0]instanceof P){const t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}}getSpecialNumberString(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}min(t){return this.le(t)?this:t}selfDivide(){if(1===arguments.length){if(arguments[0]instanceof P){const t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.selfDivide(t,0)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let i=null,n=null,r=null,s=null,o=null,a=null,l=null,h=null;return o=this._hi/t,a=P.SPLIT*o,i=a-o,h=P.SPLIT*t,i=a-i,n=o-i,r=h-t,l=o*t,r=h-r,s=t-r,h=i*r-l+i*s+n*r+n*s,a=(this._hi-l-h+this._lo-o*e)/t,h=o+a,this._hi=h,this._lo=o-h+a,this}}dump(){return"DD<"+this._hi+", "+this._lo+">"}divide(){if(arguments[0]instanceof P){const t=arguments[0];let e=null,i=null,n=null,r=null,s=null,o=null,a=null,l=null;return s=this._hi/t._hi,o=P.SPLIT*s,e=o-s,l=P.SPLIT*t._hi,e=o-e,i=s-e,n=l-t._hi,a=s*t._hi,n=l-n,r=t._hi-n,l=e*n-a+e*r+i*n+i*r,o=(this._hi-a-l+this._lo-s*t._lo)/t._hi,l=s+o,new P(l,s-l+o)}if("number"==typeof arguments[0]){const t=arguments[0];return s.isNaN(t)?P.createNaN():P.copy(this).selfDivide(t,0)}}ge(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}pow(t){if(0===t)return P.valueOf(1);let e=new P(this),i=P.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&i.selfMultiply(e),n/=2,n>0&&(e=e.sqr());else i=e;return t<0?i.reciprocal():i}ceil(){if(this.isNaN())return P.NaN;const t=Math.ceil(this._hi);let e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new P(t,e)}compareTo(t){const e=t;return this._hie._hi?1:this._loe._lo?1:0}rint(){return this.isNaN()?this:this.add(.5).floor()}setValue(){if(arguments[0]instanceof P){const t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){const t=arguments[0];return this.init(t),this}}max(t){return this.ge(t)?this:t}sqrt(){if(this.isZero())return P.valueOf(0);if(this.isNegative())return P.NaN;const t=1/Math.sqrt(this._hi),e=this._hi*t,i=P.valueOf(e),n=this.subtract(i.sqr())._hi*(.5*t);return i.add(n)}selfAdd(){if(1===arguments.length){if(arguments[0]instanceof P){const t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];let e=null,i=null,n=null,r=null,s=null,o=null;return n=this._hi+t,s=n-this._hi,r=n-s,r=t-s+(this._hi-r),o=r+this._lo,e=n+o,i=o+(n-e),this._hi=e+i,this._lo=i+(e-this._hi),this}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let i=null,n=null,r=null,s=null,o=null,a=null,l=null,h=null;o=this._hi+t,r=this._lo+e,l=o-this._hi,h=r-this._lo,a=o-l,s=r-h,a=t-l+(this._hi-a),s=e-h+(this._lo-s),l=a+r,i=o+l,n=l+(o-i),l=s+n;const c=i+l,u=l+(i-c);return this._hi=c,this._lo=u,this}}selfMultiply(){if(1===arguments.length){if(arguments[0]instanceof P){const t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.selfMultiply(t,0)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let i=null,n=null,r=null,s=null,o=null,a=null;o=P.SPLIT*this._hi,i=o-this._hi,a=P.SPLIT*t,i=o-i,n=this._hi-i,r=a-t,o=this._hi*t,r=a-r,s=t-r,a=i*r-o+i*s+n*r+n*s+(this._hi*e+this._lo*t);const l=o+a;i=o-l;const h=a+i;return this._hi=l,this._lo=h,this}}selfSqr(){return this.selfMultiply(this)}floor(){if(this.isNaN())return P.NaN;const t=Math.floor(this._hi);let e=0;return t===this._hi&&(e=Math.floor(this._lo)),new P(t,e)}negate(){return this.isNaN()?this:new P(-this._hi,-this._lo)}clone(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}multiply(){if(arguments[0]instanceof P){const t=arguments[0];return t.isNaN()?P.createNaN():P.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){const t=arguments[0];return s.isNaN(t)?P.createNaN():P.copy(this).selfMultiply(t,0)}}isNaN(){return s.isNaN(this._hi)}intValue(){return Math.trunc(this._hi)}toString(){const t=P.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}toStandardNotation(){const t=this.getSpecialNumberString();if(null!==t)return t;const e=new Array(1).fill(null),i=this.extractSignificantDigits(!0,e),n=e[0]+1;let r=i;if("."===i.charAt(0))r="0"+i;else if(n<0)r="0."+P.stringOfChar("0",-n)+i;else if(-1===i.indexOf(".")){const t=n-i.length;r=i+P.stringOfChar("0",t)+".0"}return this.isNegative()?"-"+r:r}reciprocal(){let t=null,e=null,i=null,n=null,r=null,s=null,o=null,a=null;r=1/this._hi,s=P.SPLIT*r,t=s-r,a=P.SPLIT*this._hi,t=s-t,e=r-t,i=a-this._hi,o=r*this._hi,i=a-i,n=this._hi-i,a=t*i-o+t*n+e*i+e*n,s=(1-o-a-r*this._lo)/this._hi;const l=r+s;return new P(l,r-l+s)}toSciNotation(){if(this.isZero())return P.SCI_NOT_ZERO;const t=this.getSpecialNumberString();if(null!==t)return t;const e=new Array(1).fill(null),i=this.extractSignificantDigits(!1,e),n=P.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===i.charAt(0))throw new IllegalStateException("Found leading zero: "+i);let r="";i.length>1&&(r=i.substring(1));const s=i.charAt(0)+"."+r;return this.isNegative()?"-"+s+n:s+n}abs(){return this.isNaN()?P.NaN:this.isNegative()?this.negate():new P(this)}isPositive(){return this._hi>0||0===this._hi&&this._lo>0}lt(t){return this._hit._hi||this._hi===t._hi&&this._lo>t._lo}isNegative(){return this._hi<0||0===this._hi&&this._lo<0}trunc(){return this.isNaN()?P.NaN:this.isPositive()?this.floor():this.ceil()}signum(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}get interfaces_(){return[h,o,a]}}P.PI=new P(3.141592653589793,12246467991473532e-32),P.TWO_PI=new P(6.283185307179586,24492935982947064e-32),P.PI_2=new P(1.5707963267948966,6123233995736766e-32),P.E=new P(2.718281828459045,14456468917292502e-32),P.NaN=new P(s.NaN,s.NaN),P.EPS=123259516440783e-46,P.SPLIT=134217729,P.MAX_PRINT_DIGITS=32,P.TEN=P.valueOf(10),P.ONE=P.valueOf(1),P.SCI_NOT_EXPONENT_CHAR="E",P.SCI_NOT_ZERO="0.0E0";class b{static orientationIndex(t,e,i){const n=b.orientationIndexFilter(t,e,i);if(n<=1)return n;const r=P.valueOf(e.x).selfAdd(-t.x),s=P.valueOf(e.y).selfAdd(-t.y),o=P.valueOf(i.x).selfAdd(-e.x),a=P.valueOf(i.y).selfAdd(-e.y);return r.selfMultiply(a).selfSubtract(s.selfMultiply(o)).signum()}static signOfDet2x2(){if(arguments[3]instanceof P&&arguments[2]instanceof P&&arguments[0]instanceof P&&arguments[1]instanceof P){const t=arguments[1],e=arguments[2],i=arguments[3];return arguments[0].multiply(i).selfSubtract(t.multiply(e)).signum()}if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=P.valueOf(t),s=P.valueOf(e),o=P.valueOf(i),a=P.valueOf(n);return r.multiply(a).selfSubtract(s.multiply(o)).signum()}}static intersection(t,e,i,n){const r=new P(t.y).selfSubtract(e.y),o=new P(e.x).selfSubtract(t.x),a=new P(t.x).selfMultiply(e.y).selfSubtract(new P(e.x).selfMultiply(t.y)),l=new P(i.y).selfSubtract(n.y),h=new P(n.x).selfSubtract(i.x),c=new P(i.x).selfMultiply(n.y).selfSubtract(new P(n.x).selfMultiply(i.y)),u=o.multiply(c).selfSubtract(h.multiply(a)),d=l.multiply(a).selfSubtract(r.multiply(c)),g=r.multiply(h).selfSubtract(l.multiply(o)),_=u.selfDivide(g).doubleValue(),p=d.selfDivide(g).doubleValue();return s.isNaN(_)||s.isInfinite(_)||s.isNaN(p)||s.isInfinite(p)?null:new f(_,p)}static orientationIndexFilter(t,e,i){let n=null;const r=(t.x-i.x)*(e.y-i.y),s=(t.y-i.y)*(e.x-i.x),o=r-s;if(r>0){if(s<=0)return b.signum(o);n=r+s}else{if(!(r<0))return b.signum(o);if(s>=0)return b.signum(o);n=-r-s}const a=b.DP_SAFE_EPSILON*n;return o>=a||-o>=a?b.signum(o):2}static signum(t){return t>0?1:t<0?-1:0}}b.DP_SAFE_EPSILON=1e-15;class M{getM(t){if(this.hasM()){const e=this.getDimension()-this.getMeasures();return this.getOrdinate(t,e)}return s.NaN}setOrdinate(t,e,i){}getZ(t){return this.hasZ()?this.getOrdinate(t,2):s.NaN}size(){}getOrdinate(t,e){}getCoordinate(){}getCoordinateCopy(t){}createCoordinate(){}getDimension(){}hasM(){return this.getMeasures()>0}getX(t){}hasZ(){return this.getDimension()-this.getMeasures()>2}getMeasures(){return 0}expandEnvelope(t){}copy(){}getY(t){}toCoordinateArray(){}get interfaces_(){return[a]}}M.X=0,M.Y=1,M.Z=2,M.M=3;class A{static index(t,e,i){return b.orientationIndex(t,e,i)}static isCCW(){if(arguments[0]instanceof Array){const t=arguments[0],e=t.length-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");let i=t[0],r=0;for(let n=1;n<=e;n++){const e=t[n];e.y>i.y&&(i=e,r=n)}let s=r;do{s-=1,s<0&&(s=e)}while(t[s].equals2D(i)&&s!==r);let o=r;do{o=(o+1)%e}while(t[o].equals2D(i)&&o!==r);const a=t[s],l=t[o];if(a.equals2D(i)||l.equals2D(i)||a.equals2D(l))return!1;const h=A.index(a,i,l);let c=null;return c=0===h?a.x>l.x:h>0,c}if(y(arguments[0],M)){const t=arguments[0],e=t.size()-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");let i=t.getCoordinate(0),r=0;for(let n=1;n<=e;n++){const e=t.getCoordinate(n);e.y>i.y&&(i=e,r=n)}let s=null,o=r;do{o-=1,o<0&&(o=e),s=t.getCoordinate(o)}while(s.equals2D(i)&&o!==r);let a=null,l=r;do{l=(l+1)%e,a=t.getCoordinate(l)}while(a.equals2D(i)&&l!==r);if(s.equals2D(i)||a.equals2D(i)||s.equals2D(a))return!1;const h=A.index(s,i,a);let c=null;return c=0===h?s.x>a.x:h>0,c}}}A.CLOCKWISE=-1,A.RIGHT=A.CLOCKWISE,A.COUNTERCLOCKWISE=1,A.LEFT=A.COUNTERCLOCKWISE,A.COLLINEAR=0,A.STRAIGHT=A.COLLINEAR;class F{static intersection(t,e,i,n){const r=t.xe.x?t.x:e.x,l=t.y>e.y?t.y:e.y,h=i.xn.x?i.x:n.x,d=i.y>n.y?i.y:n.y,g=((r>h?r:h)+(ac?o:c)+(li?i:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],i=arguments[2];return ti?i:t}}static wrap(t,e){return t<0?e- -t%e:t%e}static max(){if(3===arguments.length){const t=arguments[1],e=arguments[2];let i=arguments[0];return t>i&&(i=t),e>i&&(i=e),i}if(4===arguments.length){const t=arguments[1],e=arguments[2],i=arguments[3];let n=arguments[0];return t>n&&(n=t),e>n&&(n=e),i>n&&(n=i),n}}static average(t,e){return(t+e)/2}}G.LOG_10=Math.log(10);class k{static segmentToSegment(t,e,i,n){if(t.equals(e))return k.pointToSegment(t,i,n);if(i.equals(n))return k.pointToSegment(n,t,e);let r=!1;if(L.intersects(t,e,i,n)){const s=(e.x-t.x)*(n.y-i.y)-(e.y-t.y)*(n.x-i.x);if(0===s)r=!0;else{const o=(t.y-i.y)*(n.x-i.x)-(t.x-i.x)*(n.y-i.y),a=((t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y))/s,l=o/s;(l<0||l>1||a<0||a>1)&&(r=!0)}}else r=!0;return r?G.min(k.pointToSegment(t,i,n),k.pointToSegment(e,i,n),k.pointToSegment(i,t,e),k.pointToSegment(n,t,e)):0}static pointToSegment(t,e,i){if(e.x===i.x&&e.y===i.y)return t.distance(e);const n=(i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y),r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;if(r<=0)return t.distance(e);if(r>=1)return t.distance(i);const s=((e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y))/n;return Math.abs(s)*Math.sqrt(n)}static pointToLinePerpendicular(t,e,i){const n=(i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y),r=((e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y))/n;return Math.abs(r)*Math.sqrt(n)}static pointToSegmentString(t,e){if(0===e.length)throw new n("Line array must contain at least one vertex");let i=t.distance(e[0]);for(let n=0;n0)&&(n=e,i=r)}return i}}static extend(t,e,i){const n=t.create(i,e.getDimension()),r=e.size();if(j.copy(e,0,n,0,r),r>0)for(let t=r;t0)&&(e=n)}return e}}class U extends i{constructor(t){super(t),this.name=Object.keys({UnsupportedOperationException:U})[0]}}class W{static toDimensionSymbol(t){switch(t){case W.FALSE:return W.SYM_FALSE;case W.TRUE:return W.SYM_TRUE;case W.DONTCARE:return W.SYM_DONTCARE;case W.P:return W.SYM_P;case W.L:return W.SYM_L;case W.A:return W.SYM_A}throw new n("Unknown dimension value: "+t)}static toDimensionValue(t){switch(R.toUpperCase(t)){case W.SYM_FALSE:return W.FALSE;case W.SYM_TRUE:return W.TRUE;case W.SYM_DONTCARE:return W.DONTCARE;case W.SYM_P:return W.P;case W.SYM_L:return W.L;case W.SYM_A:return W.A}throw new n("Unknown dimension symbol: "+t)}}W.P=0,W.L=1,W.A=2,W.FALSE=-1,W.TRUE=-2,W.DONTCARE=-3,W.SYM_FALSE="F",W.SYM_TRUE="T",W.SYM_DONTCARE="*",W.SYM_P="0",W.SYM_L="1",W.SYM_A="2";class H{filter(t){}}class Z extends Y{constructor(){super(),Z.constructor_.apply(this,arguments)}static constructor_(){if(this._points=null,0===arguments.length);else if(2===arguments.length){const t=arguments[0],e=arguments[1];Y.constructor_.call(this,e),this.init(t)}}computeEnvelopeInternal(){return this.isEmpty()?new L:this._points.expandEnvelope(new L)}isRing(){return this.isClosed()&&this.isSimple()}getCoordinates(){return this._points.toCoordinateArray()}copyInternal(){return new Z(this._points.copy(),this._factory)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof Y){const t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;const i=t;if(this._points.size()!==i._points.size())return!1;for(let t=0;t0){const t=this._points.copy();j.reverse(t),this._points=t}return null}}}getCoordinate(){return this.isEmpty()?null:this._points.getCoordinate(0)}getBoundaryDimension(){return this.isClosed()?W.FALSE:0}isClosed(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}reverseInternal(){const t=this._points.copy();return j.reverse(t),this.getFactory().createLineString(t)}getEndPoint(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}getTypeCode(){return Y.TYPECODE_LINESTRING}getDimension(){return 1}getLength(){return q.ofLine(this._points)}getNumPoints(){return this._points.size()}compareToSameClass(){if(1===arguments.length){const t=arguments[0];let e=0,i=0;for(;e= 2)");this._points=t}isCoordinate(t){for(let e=0;et.compareTo(e));else if(2===arguments.length)t.sort((t,e)=>arguments[1].compare(t,e));else if(3===arguments.length){const e=t.slice(arguments[1],arguments[2]);e.sort();const i=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);for(const e of i)t.push(e)}else if(4===arguments.length){const e=t.slice(arguments[1],arguments[2]);e.sort((t,e)=>arguments[3].compare(t,e));const i=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);for(const e of i)t.push(e)}}static asList(t){const e=new C;for(const i of t)e.add(i);return e}static copyOf(t,e){return t.slice(0,e)}}class tt{}class et extends Y{constructor(){super(),et.constructor_.apply(this,arguments)}static constructor_(){this._shell=null,this._holes=null;let t=arguments[0],e=arguments[1],i=arguments[2];if(Y.constructor_.call(this,i),null===t&&(t=this.getFactory().createLinearRing()),null===e&&(e=[]),Y.hasNullElements(e))throw new n("holes must not contain null elements");if(t.isEmpty()&&Y.hasNonEmptyElements(e))throw new n("shell is empty but holes are not");this._shell=t,this._holes=e}computeEnvelopeInternal(){return this._shell.getEnvelopeInternal()}getCoordinates(){if(this.isEmpty())return[];const t=new Array(this.getNumPoints()).fill(null);let e=-1;const i=this._shell.getCoordinates();for(let n=0;n=1&&this.getCoordinateSequence().size()= 4)")}getGeometryType(){return Y.TYPENAME_LINEARRING}}lt.MINIMUM_VALID_SIZE=4;class ht extends f{constructor(){super(),ht.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)f.constructor_.call(this);else if(1===arguments.length){if(arguments[0]instanceof ht){const t=arguments[0];f.constructor_.call(this,t.x,t.y)}else if(arguments[0]instanceof f){const t=arguments[0];f.constructor_.call(this,t.x,t.y)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];f.constructor_.call(this,t,e,f.NULL_ORDINATE)}}setOrdinate(t,e){switch(t){case ht.X:this.x=e;break;case ht.Y:this.y=e;break;default:throw new n("Invalid ordinate index: "+t)}}getZ(){return f.NULL_ORDINATE}getOrdinate(t){switch(t){case ht.X:return this.x;case ht.Y:return this.y}throw new n("Invalid ordinate index: "+t)}setZ(t){throw new n("CoordinateXY dimension 2 does not support z-ordinate")}copy(){return new ht(this)}toString(){return"("+this.x+", "+this.y+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}}ht.X=0,ht.Y=1,ht.Z=-1,ht.M=-1;class ct extends f{constructor(){super(),ct.constructor_.apply(this,arguments)}static constructor_(){if(this._m=null,0===arguments.length)f.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof ct){const t=arguments[0];f.constructor_.call(this,t.x,t.y),this._m=t._m}else if(arguments[0]instanceof f){const t=arguments[0];f.constructor_.call(this,t.x,t.y),this._m=this.getM()}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];f.constructor_.call(this,t,e,f.NULL_ORDINATE),this._m=i}}getM(){return this._m}setOrdinate(t,e){switch(t){case ct.X:this.x=e;break;case ct.Y:this.y=e;break;case ct.M:this._m=e;break;default:throw new n("Invalid ordinate index: "+t)}}setM(t){this._m=t}getZ(){return f.NULL_ORDINATE}getOrdinate(t){switch(t){case ct.X:return this.x;case ct.Y:return this.y;case ct.M:return this._m}throw new n("Invalid ordinate index: "+t)}setZ(t){throw new n("CoordinateXY dimension 2 does not support z-ordinate")}copy(){return new ct(this)}toString(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}}ct.X=0,ct.Y=1,ct.Z=-1,ct.M=2;class ut extends f{constructor(){super(),ut.constructor_.apply(this,arguments)}static constructor_(){if(this._m=null,0===arguments.length)f.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof ut){const t=arguments[0];f.constructor_.call(this,t),this._m=t._m}else if(arguments[0]instanceof f){const t=arguments[0];f.constructor_.call(this,t),this._m=this.getM()}}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];f.constructor_.call(this,t,e,i),this._m=n}}getM(){return this._m}setOrdinate(t,e){switch(t){case f.X:this.x=e;break;case f.Y:this.y=e;break;case f.Z:this.z=e;break;case f.M:this._m=e;break;default:throw new n("Invalid ordinate index: "+t)}}setM(t){this._m=t}getOrdinate(t){switch(t){case f.X:return this.x;case f.Y:return this.y;case f.Z:return this.getZ();case f.M:return this.getM()}throw new n("Invalid ordinate index: "+t)}copy(){return new ut(this)}toString(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}}class dt{static measures(t){return t instanceof ht?0:t instanceof ct||t instanceof ut?1:0}static dimension(t){return t instanceof ht?2:t instanceof ct?3:t instanceof ut?4:3}static create(){if(1===arguments.length){const t=arguments[0];return dt.create(t,0)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return 2===t?new ht:3===t&&0===e?new f:3===t&&1===e?new ct:4===t&&1===e?new ut:new f}}}class gt{static isRing(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))}static ptNotInList(t,e){for(let i=0;i=t?e:[]}static indexOf(t,e){for(let i=0;i0)&&(e=t[i]);return e}static extract(t,e,i){e=G.clamp(e,0,t.length);let n=(i=G.clamp(i,-1,t.length))-e+1;i<0&&(n=0),e>=t.length&&(n=0),in.length)return 1;if(0===i.length)return 0;const r=gt.compare(i,n);return gt.isEqualReversed(i,n)?0:r}OLDcompare(t,e){const i=t,n=e;if(i.lengthn.length)return 1;if(0===i.length)return 0;const r=gt.increasingDirection(i),s=gt.increasingDirection(n);let o=r>0?0:i.length-1,a=s>0?0:i.length-1;for(let t=0;t0){const t=new _t(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(let e=1;e3&&(t=3),t<2&&(t=2),new pt(arguments[0],t)}if(3===arguments.length){let t=arguments[2],e=arguments[1]-t;return t>1&&(t=1),e>3&&(e=3),e<2&&(e=2),new pt(arguments[0],e+t,t)}}}get interfaces_(){return[V,h]}}ft.instanceObject=new ft;class mt extends ot{constructor(){super(),mt.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];ot.constructor_.call(this,t,e)}copyInternal(){const t=new Array(this._geometries.length).fill(null);for(let e=0;et.add(e)),t}size(){return this.map.size()}}class It{constructor(){It.constructor_.apply(this,arguments)}static constructor_(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=It.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof Ct){const t=arguments[0];this._modelType=t,t===It.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){const t=arguments[0];this._modelType=It.FIXED,this.setScale(t)}else if(arguments[0]instanceof It){const t=arguments[0];this._modelType=t._modelType,this._scale=t._scale}}static mostPrecise(t,e){return t.compareTo(e)>=0?t:e}equals(t){if(!(t instanceof It))return!1;const e=t;return this._modelType===e._modelType&&this._scale===e._scale}compareTo(t){const e=t,i=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return O.compare(i,n)}getScale(){return this._scale}isFloating(){return this._modelType===It.FLOATING||this._modelType===It.FLOATING_SINGLE}getType(){return this._modelType}toString(){let t="UNKNOWN";return this._modelType===It.FLOATING?t="Floating":this._modelType===It.FLOATING_SINGLE?t="Floating-Single":this._modelType===It.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}makePrecise(){if("number"==typeof arguments[0]){const t=arguments[0];return s.isNaN(t)||this._modelType===It.FLOATING_SINGLE?t:this._modelType===It.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof f){const t=arguments[0];if(this._modelType===It.FLOATING)return null;t.x=this.makePrecise(t.x),t.y=this.makePrecise(t.y)}}getMaximumSignificantDigits(){let t=16;return this._modelType===It.FLOATING?t=16:this._modelType===It.FLOATING_SINGLE?t=6:this._modelType===It.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t}setScale(t){this._scale=Math.abs(t)}get interfaces_(){return[h,o]}}class Ct{constructor(){Ct.constructor_.apply(this,arguments)}static constructor_(){this._name=null;const t=arguments[0];this._name=t,Ct.nameToTypeMap.put(t,this)}readResolve(){return Ct.nameToTypeMap.get(this._name)}toString(){return this._name}get interfaces_(){return[h]}}Ct.nameToTypeMap=new Et,It.Type=Ct,It.FIXED=new Ct("FIXED"),It.FLOATING=new Ct("FLOATING"),It.FLOATING_SINGLE=new Ct("FLOATING SINGLE"),It.maximumPreciseValue=9007199254740992;class wt extends ot{constructor(){super(),wt.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];ot.constructor_.call(this,t,e)}copyInternal(){const t=new Array(this._geometries.length).fill(null);for(let e=0;e1){if(r instanceof et)return this.createMultiPolygon(St.toPolygonArray(t));if(r instanceof Z)return this.createMultiLineString(St.toLineStringArray(t));if(r instanceof J)return this.createMultiPoint(St.toPointArray(t));d.shouldNeverReachHere("Unhandled geometry type: "+r.getGeometryType())}return r}createMultiPointFromCoords(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}createPoint(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof f){const t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(y(arguments[0],M))return new J(arguments[0],this)}}getCoordinateSequenceFactory(){return this._coordinateSequenceFactory}createPolygon(){if(0===arguments.length)return this.createPolygon(null,null);if(1===arguments.length){if(y(arguments[0],M)){const t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){const t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof lt){const t=arguments[0];return this.createPolygon(t,null)}}else if(2===arguments.length)return new et(arguments[0],arguments[1],this)}getSRID(){return this._SRID}createGeometryCollection(){return 0===arguments.length?new ot(null,this):1===arguments.length?new ot(arguments[0],this):void 0}getPrecisionModel(){return this._precisionModel}createLinearRing(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(y(arguments[0],M))return new lt(arguments[0],this)}}createMultiPolygon(){return 0===arguments.length?new mt(null,this):1===arguments.length?new mt(arguments[0],this):void 0}createMultiPoint(){if(0===arguments.length)return new at(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new at(arguments[0],this);if(y(arguments[0],M)){const t=arguments[0];if(null===t)return this.createMultiPoint(new Array(0).fill(null));const e=new Array(t.size()).fill(null);for(let i=0;i="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)}isWhiteSpace_(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i,n=t;if("("==t)i=2;else if(","==t)i=5;else if(")"==t)i=3;else if(this.isNumeric_(t)||"-"==t)i=4,n=this.readNumber_();else if(this.isAlpha_(t))i=1,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);i=6}return{position:e,value:n,type:i}}readNumber_(){let t;const e=this.index_;let i=!1,n=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,i)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class Ot{constructor(t,e){this.lexer_=t,this.token_,this.layout_="XY",this.factory=e}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(1)){const i=e.value;"Z"===i?t="XYZ":"M"===i?t="XYM":"ZM"===i&&(t="XYZM"),"XY"!==t&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(2)){const t=[];do{t.push(this.parseGeometry_())}while(this.match(5));if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(2)){const t=this.parsePoint_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(2)){const t=this.parsePointList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(2)){const t=this.parseLineStringTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(2)){let t;if(t=2==this.token_.type?this.parsePointTextList_():this.parsePointList_(),this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(2)){const t=this.parseLineStringTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(2)){const t=this.parsePolygonTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;inew f(...t),i=i=>{const n=i.map(i=>t.createLinearRing(i.map(e)));return n.length>1?t.createPolygon(n[0],n.slice(1)):t.createPolygon(n[0])},n=this.token_;if(this.match(1)){const r=n.value;if(this.layout_=this.parseGeometryLayout_(),"GEOMETRYCOLLECTION"==r){const e=this.parseGeometryCollectionText_();return t.createGeometryCollection(e)}switch(r){case"POINT":{const e=this.parsePointText_();return e?t.createPoint(new f(...e)):t.createPoint()}case"LINESTRING":{const i=this.parseLineStringText_().map(e);return t.createLineString(i)}case"LINEARRING":{const i=this.parseLineStringText_().map(e);return t.createLinearRing(i)}case"POLYGON":{const e=this.parsePolygonText_();return e&&0!==e.length?i(e):t.createPolygon()}case"MULTIPOINT":{const i=this.parseMultiPointText_();if(!i||0===i.length)return t.createMultiPoint();const n=i.map(e).map(e=>t.createPoint(e));return t.createMultiPoint(n)}case"MULTILINESTRING":{const i=this.parseMultiLineStringText_().map(i=>t.createLineString(i.map(e)));return t.createMultiLineString(i)}case"MULTIPOLYGON":{const e=this.parseMultiPolygonText_();if(!e||0===e.length)return t.createMultiPolygon();const n=e.map(i);return t.createMultiPolygon(n)}default:throw new Error("Invalid geometry type: "+r)}}throw new Error(this.formatErrorMessage_())}}function Rt(t){if(t.isEmpty())return"";const e=t.getCoordinate(),i=[e.x,e.y];return e.z&&i.push(e.z),e.m&&i.push(e.m),i.join(" ")}function Pt(t){const e=t.getCoordinates().map(t=>[t.x,t.y]),i=[];for(let t=0,n=e.length;t0&&(e+=" "+n),t.isEmpty()?e+" EMPTY":e+" ("+i(t)+")"}class Ft{constructor(t){this.geometryFactory=t||new St,this.precisionModel=this.geometryFactory.getPrecisionModel()}read(t){const e=new Nt(t);return new Ot(e,this.geometryFactory).parse()}write(t){return At(t)}}class Dt{constructor(t){this.parser=new Ft(t)}write(t){return this.parser.write(t)}static toLineString(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"}}class Gt{constructor(){Gt.constructor_.apply(this,arguments)}static constructor_(){this._result=null,this._inputLines=Array(2).fill().map(()=>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 f,this._intPt[1]=new f,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}static computeEdgeDistance(t,e,i){const n=Math.abs(i.x-e.x),r=Math.abs(i.y-e.y);let s=-1;if(t.equals(e))s=0;else if(t.equals(i))s=n>r?n:r;else{const i=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);s=n>r?i:o,0!==s||t.equals(e)||(s=Math.max(i,o))}return d.isTrue(!(0===s&&!t.equals(e)),"Bad distance calculation"),s}static nonRobustComputeEdgeDistance(t,e,i){const n=t.x-e.x,r=t.y-e.y,s=Math.sqrt(n*n+r*r);return d.isTrue(!(0===s&&!t.equals(e)),"Invalid distance calculation"),s}getIndexAlongSegment(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}getTopologySummary(){const t=new _t;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}computeIntersection(t,e,i,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=i,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,i,n)}getIntersectionNum(){return this._result}computeIntLineIndex(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map(()=>Array(2)),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){const 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)}}isProper(){return this.hasIntersection()&&this._isProper}setPrecisionModel(t){this._precisionModel=t}isInteriorIntersection(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){const t=arguments[0];for(let e=0;e1e-4&&D.out.println("Distance = "+r.distance(s))}intersectionSafe(t,e,i,n){let r=F.intersection(t,e,i,n);return null===r&&(r=kt.nearestEndpoint(t,e,i,n)),r}computeCollinearIntersection(t,e,i,n){const r=L.intersects(t,e,i),s=L.intersects(t,e,n),o=L.intersects(i,n,t),a=L.intersects(i,n,e);return r&&s?(this._intPt[0]=i,this._intPt[1]=n,Gt.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=t,this._intPt[1]=e,Gt.COLLINEAR_INTERSECTION):r&&o?(this._intPt[0]=i,this._intPt[1]=t,!i.equals(t)||s||a?Gt.COLLINEAR_INTERSECTION:Gt.POINT_INTERSECTION):r&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||s||o?Gt.COLLINEAR_INTERSECTION:Gt.POINT_INTERSECTION):s&&o?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||r||a?Gt.COLLINEAR_INTERSECTION:Gt.POINT_INTERSECTION):s&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||r||o?Gt.COLLINEAR_INTERSECTION:Gt.POINT_INTERSECTION):Gt.NO_INTERSECTION}computeIntersect(t,e,i,n){if(this._isProper=!1,!L.intersects(t,e,i,n))return Gt.NO_INTERSECTION;const r=A.index(t,e,i),s=A.index(t,e,n);if(r>0&&s>0||r<0&&s<0)return Gt.NO_INTERSECTION;const o=A.index(i,n,t),a=A.index(i,n,e);return o>0&&a>0||o<0&&a<0?Gt.NO_INTERSECTION:0===r&&0===s&&0===o&&0===a?this.computeCollinearIntersection(t,e,i,n):(0===r||0===s||0===o||0===a?(this._isProper=!1,t.equals2D(i)||t.equals2D(n)?this._intPt[0]=t:e.equals2D(i)||e.equals2D(n)?this._intPt[0]=e:0===r?this._intPt[0]=new f(i):0===s?this._intPt[0]=new f(n):0===o?this._intPt[0]=new f(t):0===a&&(this._intPt[0]=new f(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,i,n)),Gt.POINT_INTERSECTION)}}class Vt{constructor(){Vt.constructor_.apply(this,arguments)}static constructor_(){if(this.p0=null,this.p1=null,0===arguments.length)Vt.constructor_.call(this,new f,new f);else if(1===arguments.length){const t=arguments[0];Vt.constructor_.call(this,t.p0,t.p1)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.p0=t,this.p1=e}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];Vt.constructor_.call(this,new f(t,e),new f(i,n))}}static midPoint(t,e){return new f((t.x+e.x)/2,(t.y+e.y)/2)}minX(){return Math.min(this.p0.x,this.p1.x)}orientationIndex(){if(arguments[0]instanceof Vt){const t=arguments[0],e=A.index(this.p0,this.p1,t.p0),i=A.index(this.p0,this.p1,t.p1);return e>=0&&i>=0||e<=0&&i<=0?Math.max(e,i):0}if(arguments[0]instanceof f){const t=arguments[0];return A.index(this.p0,this.p1,t)}}toGeometry(t){return t.createLineString([this.p0,this.p1])}isVertical(){return this.p0.x===this.p1.x}equals(t){if(!(t instanceof Vt))return!1;const e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)}intersection(t){const e=new kt;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}project(){if(arguments[0]instanceof f){const t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new f(t);const e=this.projectionFactor(t),i=new f;return i.x=this.p0.x+e*(this.p1.x-this.p0.x),i.y=this.p0.y+e*(this.p1.y-this.p0.y),i}if(arguments[0]instanceof Vt){const t=arguments[0],e=this.projectionFactor(t.p0),i=this.projectionFactor(t.p1);if(e>=1&&i>=1)return null;if(e<=0&&i<=0)return null;let n=this.project(t.p0);e<0&&(n=this.p0),e>1&&(n=this.p1);let r=this.project(t.p1);return i<0&&(r=this.p0),i>1&&(r=this.p1),new Vt(n,r)}}normalize(){this.p1.compareTo(this.p0)<0&&this.reverse()}angle(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}getCoordinate(t){return 0===t?this.p0:this.p1}distancePerpendicular(t){return k.pointToLinePerpendicular(t,this.p0,this.p1)}minY(){return Math.min(this.p0.y,this.p1.y)}midPoint(){return Vt.midPoint(this.p0,this.p1)}projectionFactor(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;const e=this.p1.x-this.p0.x,i=this.p1.y-this.p0.y,n=e*e+i*i;return n<=0?s.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*i)/n}closestPoints(t){const e=this.intersection(t);if(null!==e)return[e,e];const i=new Array(2).fill(null);let n=s.MAX_VALUE,r=null;const o=this.closestPoint(t.p0);n=o.distance(t.p0),i[0]=o,i[1]=t.p0;const a=this.closestPoint(t.p1);r=a.distance(t.p1),r0&&e<1?this.project(t):this.p0.distance(t)1||s.isNaN(e))&&(e=1),e}toString(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}isHorizontal(){return this.p0.y===this.p1.y}reflect(t){const e=this.p1.getY()-this.p0.getY(),i=this.p0.getX()-this.p1.getX(),n=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),r=e*e+i*i,s=e*e-i*i,o=t.getX(),a=t.getY();return new f((-s*o-2*e*i*a-2*e*n)/r,(s*a-2*e*i*o-2*i*n)/r)}distance(){if(arguments[0]instanceof Vt){const t=arguments[0];return k.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof f){const t=arguments[0];return k.pointToSegment(t,this.p0,this.p1)}}pointAlong(t){const e=new f;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e}hashCode(){let t=s.doubleToLongBits(this.p0.x);t^=31*s.doubleToLongBits(this.p0.y);const e=Math.trunc(t)^Math.trunc(t>>32);let i=s.doubleToLongBits(this.p1.x);return i^=31*s.doubleToLongBits(this.p1.y),e^Math.trunc(i)^Math.trunc(i>>32)}get interfaces_(){return[o,h]}}class Bt{static toLocationSymbol(t){switch(t){case Bt.EXTERIOR:return"e";case Bt.BOUNDARY:return"b";case Bt.INTERIOR:return"i";case Bt.NONE:return"-"}throw new n("Unknown location value: "+t)}}Bt.INTERIOR=0,Bt.BOUNDARY=1,Bt.EXTERIOR=2,Bt.NONE=-1;class Yt{constructor(){Yt.constructor_.apply(this,arguments)}static constructor_(){if(this._matrix=null,0===arguments.length)this._matrix=Array(3).fill().map(()=>Array(3)),this.setAll(W.FALSE);else if(1===arguments.length)if("string"==typeof arguments[0]){const t=arguments[0];Yt.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof Yt){const t=arguments[0];Yt.constructor_.call(this),this._matrix[Bt.INTERIOR][Bt.INTERIOR]=t._matrix[Bt.INTERIOR][Bt.INTERIOR],this._matrix[Bt.INTERIOR][Bt.BOUNDARY]=t._matrix[Bt.INTERIOR][Bt.BOUNDARY],this._matrix[Bt.INTERIOR][Bt.EXTERIOR]=t._matrix[Bt.INTERIOR][Bt.EXTERIOR],this._matrix[Bt.BOUNDARY][Bt.INTERIOR]=t._matrix[Bt.BOUNDARY][Bt.INTERIOR],this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]=t._matrix[Bt.BOUNDARY][Bt.BOUNDARY],this._matrix[Bt.BOUNDARY][Bt.EXTERIOR]=t._matrix[Bt.BOUNDARY][Bt.EXTERIOR],this._matrix[Bt.EXTERIOR][Bt.INTERIOR]=t._matrix[Bt.EXTERIOR][Bt.INTERIOR],this._matrix[Bt.EXTERIOR][Bt.BOUNDARY]=t._matrix[Bt.EXTERIOR][Bt.BOUNDARY],this._matrix[Bt.EXTERIOR][Bt.EXTERIOR]=t._matrix[Bt.EXTERIOR][Bt.EXTERIOR]}}static matches(){if(Number.isInteger(arguments[0])&&"string"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return e===W.SYM_DONTCARE||e===W.SYM_TRUE&&(t>=0||t===W.TRUE)||e===W.SYM_FALSE&&t===W.FALSE||e===W.SYM_P&&t===W.P||e===W.SYM_L&&t===W.L||e===W.SYM_A&&t===W.A}if("string"==typeof arguments[0]&&"string"==typeof arguments[1]){const t=arguments[1];return new Yt(arguments[0]).matches(t)}}static isTrue(t){return t>=0||t===W.TRUE}isIntersects(){return!this.isDisjoint()}isCovers(){return(Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.BOUNDARY])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]))&&this._matrix[Bt.EXTERIOR][Bt.INTERIOR]===W.FALSE&&this._matrix[Bt.EXTERIOR][Bt.BOUNDARY]===W.FALSE}isCoveredBy(){return(Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.BOUNDARY])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]))&&this._matrix[Bt.INTERIOR][Bt.EXTERIOR]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.EXTERIOR]===W.FALSE}set(){if(1===arguments.length){const t=arguments[0];for(let e=0;e=0&&e>=0&&this.setAtLeast(t,e,i)}isWithin(){return Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&this._matrix[Bt.INTERIOR][Bt.EXTERIOR]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.EXTERIOR]===W.FALSE}isTouches(t,e){return t>e?this.isTouches(e,t):(t===W.A&&e===W.A||t===W.L&&e===W.L||t===W.L&&e===W.A||t===W.P&&e===W.A||t===W.P&&e===W.L)&&this._matrix[Bt.INTERIOR][Bt.INTERIOR]===W.FALSE&&(Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.BOUNDARY])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]))}isOverlaps(t,e){return t===W.P&&e===W.P||t===W.A&&e===W.A?Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.EXTERIOR])&&Yt.isTrue(this._matrix[Bt.EXTERIOR][Bt.INTERIOR]):t===W.L&&e===W.L&&1===this._matrix[Bt.INTERIOR][Bt.INTERIOR]&&Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.EXTERIOR])&&Yt.isTrue(this._matrix[Bt.EXTERIOR][Bt.INTERIOR])}isEquals(t,e){return t===e&&Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&this._matrix[Bt.INTERIOR][Bt.EXTERIOR]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.EXTERIOR]===W.FALSE&&this._matrix[Bt.EXTERIOR][Bt.INTERIOR]===W.FALSE&&this._matrix[Bt.EXTERIOR][Bt.BOUNDARY]===W.FALSE}toString(){const t=new _t("123456789");for(let e=0;e<3;e++)for(let i=0;i<3;i++)t.setCharAt(3*e+i,W.toDimensionSymbol(this._matrix[e][i]));return t.toString()}setAll(t){for(let e=0;e<3;e++)for(let i=0;i<3;i++)this._matrix[e][i]=t}get(t,e){return this._matrix[t][e]}transpose(){let t=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=t,t=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=t,t=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=t,this}matches(t){if(9!==t.length)throw new n("Should be length 9: "+t);for(let e=0;e<3;e++)for(let i=0;i<3;i++)if(!Yt.matches(this._matrix[e][i],t.charAt(3*e+i)))return!1;return!0}add(t){for(let e=0;e<3;e++)for(let i=0;i<3;i++)this.setAtLeast(e,i,t.get(e,i))}isDisjoint(){return this._matrix[Bt.INTERIOR][Bt.INTERIOR]===W.FALSE&&this._matrix[Bt.INTERIOR][Bt.BOUNDARY]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.INTERIOR]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]===W.FALSE}isCrosses(t,e){return t===W.P&&e===W.L||t===W.P&&e===W.A||t===W.L&&e===W.A?Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.EXTERIOR]):t===W.L&&e===W.P||t===W.A&&e===W.P||t===W.A&&e===W.L?Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&Yt.isTrue(this._matrix[Bt.EXTERIOR][Bt.INTERIOR]):t===W.L&&e===W.L&&0===this._matrix[Bt.INTERIOR][Bt.INTERIOR]}get interfaces_(){return[a]}}class zt{static toDegrees(t){return 180*t/Math.PI}static normalize(t){for(;t>Math.PI;)t-=zt.PI_TIMES_2;for(;t<=-Math.PI;)t+=zt.PI_TIMES_2;return t}static angle(){if(1===arguments.length){const t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=e.x-t.x,n=e.y-t.y;return Math.atan2(n,i)}}static isAcute(t,e,i){const n=t.x-e.x,r=t.y-e.y;return n*(i.x-e.x)+r*(i.y-e.y)>0}static isObtuse(t,e,i){const n=t.x-e.x,r=t.y-e.y;return n*(i.x-e.x)+r*(i.y-e.y)<0}static interiorAngle(t,e,i){const n=zt.angle(e,t),r=zt.angle(e,i);return Math.abs(r-n)}static normalizePositive(t){if(t<0){for(;t<0;)t+=zt.PI_TIMES_2;t>=zt.PI_TIMES_2&&(t=0)}else{for(;t>=zt.PI_TIMES_2;)t-=zt.PI_TIMES_2;t<0&&(t=0)}return t}static angleBetween(t,e,i){const n=zt.angle(e,t),r=zt.angle(e,i);return zt.diff(n,r)}static diff(t,e){let i=null;return i=tMath.PI&&(i=2*Math.PI-i),i}static toRadians(t){return t*Math.PI/180}static getTurn(t,e){const i=Math.sin(e-t);return i>0?zt.COUNTERCLOCKWISE:i<0?zt.CLOCKWISE:zt.NONE}static angleBetweenOriented(t,e,i){const n=zt.angle(e,t),r=zt.angle(e,i)-n;return r<=-Math.PI?r+zt.PI_TIMES_2:r>Math.PI?r-zt.PI_TIMES_2:r}}zt.PI_TIMES_2=2*Math.PI,zt.PI_OVER_2=Math.PI/2,zt.PI_OVER_4=Math.PI/4,zt.COUNTERCLOCKWISE=A.COUNTERCLOCKWISE,zt.CLOCKWISE=A.CLOCKWISE,zt.NONE=A.COLLINEAR;class qt extends i{constructor(){super(),qt.constructor_.apply(this,arguments)}static constructor_(){i.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}class Xt{constructor(){Xt.constructor_.apply(this,arguments)}static constructor_(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){const t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];this.x=t,this.y=e,this.w=1}else if(arguments[0]instanceof Xt&&arguments[1]instanceof Xt){const t=arguments[0],e=arguments[1];this.x=t.y*e.w-e.y*t.w,this.y=e.x*t.w-t.x*e.w,this.w=t.x*e.y-e.x*t.y}else if(arguments[0]instanceof f&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1];this.x=t.y-e.y,this.y=e.x-t.x,this.w=t.x*e.y-e.x*t.y}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this.x=t,this.y=e,this.w=i}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=t.y-e.y,s=e.x-t.x,o=t.x*e.y-e.x*t.y,a=i.y-n.y,l=n.x-i.x,h=i.x*n.y-n.x*i.y;this.x=s*h-l*o,this.y=a*o-r*h,this.w=r*l-a*s}}getY(){const t=this.y/this.w;if(s.isNaN(t)||s.isInfinite(t))throw new qt;return t}getX(){const t=this.x/this.w;if(s.isNaN(t)||s.isInfinite(t))throw new qt;return t}getCoordinate(){const t=new f;return t.x=this.getX(),t.y=this.getY(),t}}class jt{constructor(){jt.constructor_.apply(this,arguments)}static constructor_(){this.p0=null,this.p1=null,this.p2=null;const t=arguments[0],e=arguments[1],i=arguments[2];this.p0=t,this.p1=e,this.p2=i}static area(t,e,i){return Math.abs(((i.x-t.x)*(e.y-t.y)-(e.x-t.x)*(i.y-t.y))/2)}static signedArea(t,e,i){return((i.x-t.x)*(e.y-t.y)-(e.x-t.x)*(i.y-t.y))/2}static det(t,e,i,n){return t*n-e*i}static interpolateZ(t,e,i,n){const r=e.x,s=e.y,o=i.x-r,a=n.x-r,l=i.y-s,h=n.y-s,c=o*h-a*l,u=t.x-r,d=t.y-s,g=(h*u-a*d)/c,_=(-l*u+o*d)/c;return e.getZ()+g*(i.getZ()-e.getZ())+_*(n.getZ()-e.getZ())}static longestSideLength(t,e,i){const n=t.distance(e),r=e.distance(i),s=i.distance(t);let o=n;return r>o&&(o=r),s>o&&(o=s),o}static circumcentreDD(t,e,i){const n=P.valueOf(t.x).subtract(i.x),r=P.valueOf(t.y).subtract(i.y),s=P.valueOf(e.x).subtract(i.x),o=P.valueOf(e.y).subtract(i.y),a=P.determinant(n,r,s,o).multiply(2),l=n.sqr().add(r.sqr()),h=s.sqr().add(o.sqr()),c=P.determinant(r,l,o,h),u=P.determinant(n,l,s,h),d=P.valueOf(i.x).subtract(c.divide(a)).doubleValue(),g=P.valueOf(i.y).add(u.divide(a)).doubleValue();return new f(d,g)}static isAcute(t,e,i){return!!zt.isAcute(t,e,i)&&!!zt.isAcute(e,i,t)&&!!zt.isAcute(i,t,e)}static circumcentre(t,e,i){const n=i.x,r=i.y,s=t.x-n,o=t.y-r,a=e.x-n,l=e.y-r,h=2*jt.det(s,o,a,l),c=jt.det(o,s*s+o*o,l,a*a+l*l),u=jt.det(s,s*s+o*o,a,a*a+l*l);return new f(n-c/h,r+u/h)}static perpendicularBisector(t,e){const i=e.x-t.x,n=e.y-t.y,r=new Xt(t.x+i/2,t.y+n/2,1),s=new Xt(t.x-n+i/2,t.y+i+n/2,1);return new Xt(r,s)}static angleBisector(t,e,i){const n=e.distance(t),r=n/(n+e.distance(i)),s=i.x-t.x,o=i.y-t.y;return new f(t.x+r*s,t.y+r*o)}static area3D(t,e,i){const n=e.x-t.x,r=e.y-t.y,s=e.getZ()-t.getZ(),o=i.x-t.x,a=i.y-t.y,l=i.getZ()-t.getZ(),h=r*l-s*a,c=s*o-n*l,u=n*a-r*o,d=h*h+c*c+u*u;return Math.sqrt(d)/2}static centroid(t,e,i){const n=(t.x+e.x+i.x)/3,r=(t.y+e.y+i.y)/3;return new f(n,r)}static inCentre(t,e,i){const n=e.distance(i),r=t.distance(i),s=t.distance(e),o=n+r+s,a=(n*t.x+r*e.x+s*i.x)/o,l=(n*t.y+r*e.y+s*i.y)/o;return new f(a,l)}area(){return jt.area(this.p0,this.p1,this.p2)}signedArea(){return jt.signedArea(this.p0,this.p1,this.p2)}interpolateZ(t){if(null===t)throw new n("Supplied point is null.");return jt.interpolateZ(t,this.p0,this.p1,this.p2)}longestSideLength(){return jt.longestSideLength(this.p0,this.p1,this.p2)}isAcute(){return jt.isAcute(this.p0,this.p1,this.p2)}circumcentre(){return jt.circumcentre(this.p0,this.p1,this.p2)}area3D(){return jt.area3D(this.p0,this.p1,this.p2)}centroid(){return jt.centroid(this.p0,this.p1,this.p2)}inCentre(){return jt.inCentre(this.p0,this.p1,this.p2)}}class Ut extends i{constructor(){super(),Ut.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)i.constructor_.call(this);else if(1===arguments.length){const t=arguments[0];i.constructor_.call(this,t)}}}class Wt{constructor(){Wt.constructor_.apply(this,arguments)}static constructor_(){if(this._m00=null,this._m01=null,this._m02=null,this._m10=null,this._m11=null,this._m12=null,0===arguments.length)this.setToIdentity();else if(1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];this._m00=t[0],this._m01=t[1],this._m02=t[2],this._m10=t[3],this._m11=t[4],this._m12=t[5]}else if(arguments[0]instanceof Wt){const t=arguments[0];this.setTransformation(t)}}else if(6===arguments.length&&"number"==typeof arguments[5]&&"number"==typeof arguments[4]&&"number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[4],s=arguments[5];this.setTransformation(t,e,i,n,r,s)}}static translationInstance(t,e){const i=new Wt;return i.setToTranslation(t,e),i}static shearInstance(t,e){const i=new Wt;return i.setToShear(t,e),i}static reflectionInstance(){if(2===arguments.length){const t=arguments[0],e=arguments[1],i=new Wt;return i.setToReflection(t,e),i}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=new Wt;return r.setToReflection(t,e,i,n),r}}static rotationInstance(){if(1===arguments.length){const t=arguments[0];return Wt.rotationInstance(Math.sin(t),Math.cos(t))}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=new Wt;return i.setToRotation(t,e),i}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return Wt.rotationInstance(Math.sin(t),Math.cos(t),e,i)}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=new Wt;return r.setToRotation(t,e,i,n),r}}static scaleInstance(){if(2===arguments.length){const t=arguments[0],e=arguments[1],i=new Wt;return i.setToScale(t,e),i}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=new Wt;return r.translate(-i,-n),r.scale(t,e),r.translate(i,n),r}}setToReflectionBasic(t,e,i,r){if(t===i&&e===r)throw new n("Reflection line points must be distinct");const s=i-t,o=r-e,a=Math.sqrt(s*s+o*o),l=o/a,h=s/a,c=2*l*h,u=h*h-l*l;return this._m00=u,this._m01=c,this._m02=0,this._m10=c,this._m11=-u,this._m12=0,this}getInverse(){const t=this.getDeterminant();if(0===t)throw new Ut("Transformation is non-invertible");const e=this._m11/t,i=-this._m10/t,n=-this._m01/t,r=this._m00/t,s=(this._m01*this._m12-this._m02*this._m11)/t,o=(-this._m00*this._m12+this._m10*this._m02)/t;return new Wt(e,n,s,i,r,o)}compose(t){const e=t._m00*this._m00+t._m01*this._m10,i=t._m00*this._m01+t._m01*this._m11,n=t._m00*this._m02+t._m01*this._m12+t._m02,r=t._m10*this._m00+t._m11*this._m10,s=t._m10*this._m01+t._m11*this._m11,o=t._m10*this._m02+t._m11*this._m12+t._m12;return this._m00=e,this._m01=i,this._m02=n,this._m10=r,this._m11=s,this._m12=o,this}equals(t){if(null===t)return!1;if(!(t instanceof Wt))return!1;const e=t;return this._m00===e._m00&&this._m01===e._m01&&this._m02===e._m02&&this._m10===e._m10&&this._m11===e._m11&&this._m12===e._m12}setToScale(t,e){return this._m00=t,this._m01=0,this._m02=0,this._m10=0,this._m11=e,this._m12=0,this}isIdentity(){return 1===this._m00&&0===this._m01&&0===this._m02&&0===this._m10&&1===this._m11&&0===this._m12}scale(t,e){return this.compose(Wt.scaleInstance(t,e)),this}setToIdentity(){return this._m00=1,this._m01=0,this._m02=0,this._m10=0,this._m11=1,this._m12=0,this}isGeometryChanged(){return!0}setTransformation(){if(1===arguments.length){const t=arguments[0];return this._m00=t._m00,this._m01=t._m01,this._m02=t._m02,this._m10=t._m10,this._m11=t._m11,this._m12=t._m12,this}if(6===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[4],s=arguments[5];return this._m00=t,this._m01=e,this._m02=i,this._m10=n,this._m11=r,this._m12=s,this}}setToRotation(){if(1===arguments.length){const t=arguments[0];return this.setToRotation(Math.sin(t),Math.cos(t)),this}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._m00=e,this._m01=-t,this._m02=0,this._m10=t,this._m11=e,this._m12=0,this}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return this.setToRotation(Math.sin(t),Math.cos(t),e,i),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];return this._m00=e,this._m01=-t,this._m02=i-i*e+n*t,this._m10=t,this._m11=e,this._m12=n-i*t-n*e,this}}getMatrixEntries(){return[this._m00,this._m01,this._m02,this._m10,this._m11,this._m12]}filter(t,e){this.transform(t,e)}rotate(){if(1===arguments.length){const t=arguments[0];return this.compose(Wt.rotationInstance(t)),this}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.compose(Wt.rotationInstance(t,e)),this}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return this.compose(Wt.rotationInstance(t,e,i)),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];return this.compose(Wt.rotationInstance(t,e,i,n)),this}}getDeterminant(){return this._m00*this._m11-this._m01*this._m10}composeBefore(t){const e=this._m00*t._m00+this._m01*t._m10,i=this._m00*t._m01+this._m01*t._m11,n=this._m00*t._m02+this._m01*t._m12+this._m02,r=this._m10*t._m00+this._m11*t._m10,s=this._m10*t._m01+this._m11*t._m11,o=this._m10*t._m02+this._m11*t._m12+this._m12;return this._m00=e,this._m01=i,this._m02=n,this._m10=r,this._m11=s,this._m12=o,this}setToShear(t,e){return this._m00=1,this._m01=t,this._m02=0,this._m10=e,this._m11=1,this._m12=0,this}isDone(){return!1}clone(){try{return null}catch(t){if(!(t instanceof i))throw t;d.shouldNeverReachHere()}return null}translate(t,e){return this.compose(Wt.translationInstance(t,e)),this}setToReflection(){if(2===arguments.length){const t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Reflection vector must be non-zero");if(t===e)return this._m00=0,this._m01=1,this._m02=0,this._m10=1,this._m11=0,this._m12=0,this;const i=Math.sqrt(t*t+e*e),r=e/i,s=t/i;return this.rotate(-r,s),this.scale(1,-1),this.rotate(r,s),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],r=arguments[3];if(t===i&&e===r)throw new n("Reflection line points must be distinct");this.setToTranslation(-t,-e);const s=i-t,o=r-e,a=Math.sqrt(s*s+o*o),l=o/a,h=s/a;return this.rotate(-l,h),this.scale(1,-1),this.rotate(l,h),this.translate(t,e),this}}toString(){return"AffineTransformation[["+this._m00+", "+this._m01+", "+this._m02+"], ["+this._m10+", "+this._m11+", "+this._m12+"]]"}setToTranslation(t,e){return this._m00=1,this._m01=0,this._m02=t,this._m10=0,this._m11=1,this._m12=e,this}shear(t,e){return this.compose(Wt.shearInstance(t,e)),this}transform(){if(1===arguments.length){const t=arguments[0].copy();return t.apply(this),t}if(2===arguments.length){if(arguments[0]instanceof f&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1],i=this._m00*t.x+this._m01*t.y+this._m02,n=this._m10*t.x+this._m11*t.y+this._m12;return e.x=i,e.y=n,e}if(y(arguments[0],M)&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],i=this._m00*t.getOrdinate(e,0)+this._m01*t.getOrdinate(e,1)+this._m02,n=this._m10*t.getOrdinate(e,0)+this._m11*t.getOrdinate(e,1)+this._m12;t.setOrdinate(e,0,i),t.setOrdinate(e,1,n)}}}reflect(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.compose(Wt.reflectionInstance(t,e)),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];return this.compose(Wt.reflectionInstance(t,e,i,n)),this}}get interfaces_(){return[a,T]}}class Ht{static solve(t,e){const i=e.length;if(t.length!==i||t[0].length!==i)throw new n("Matrix A is incorrectly sized");for(let n=0;nMath.abs(t[r][n])&&(r=e);if(0===t[r][n])return null;Ht.swapRows(t,n,r),Ht.swapRows(e,n,r);for(let r=n+1;r=n;e--)t[r][e]-=t[n][e]*s;e[r]-=e[n]*s}}const r=new Array(i).fill(null);for(let n=i-1;n>=0;n--){let s=0;for(let e=n+1;e3)throw new n("Too many control points");return 1===t.length?Kt.createFromControlVectors(t[0],e[0]):2===t.length?Kt.createFromControlVectors(t[0],t[1],e[0],e[1]):Kt.createFromControlVectors(t[0],t[1],t[2],e[0],e[1],e[2])}}else{if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=new f(n.x-i.x,n.y-i.y),s=zt.angleBetweenOriented(e,t,r),o=e.distance(t),a=n.distance(i);if(0===o)return null;const l=a/o,h=Wt.translationInstance(-t.x,-t.y);return h.rotate(s),h.scale(l,l),h.translate(i.x,i.y),h}if(6===arguments.length)return new Zt(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]).getTransformation()}}}class Jt{constructor(){Jt.constructor_.apply(this,arguments)}static constructor_(){this._coords=null;const t=arguments[0];this._coords=t}static getCoordinates(t){const e=new C;return t.apply(new Jt(e)),e}filter(t){(t instanceof Z||t instanceof J)&&this._coords.add(t.getCoordinate())}get interfaces_(){return[B]}}class $t{constructor(){$t.constructor_.apply(this,arguments)}static constructor_(){this._mapOp=null;const t=arguments[0];this._mapOp=t}static map(t,e){return new $t(e).map(t)}map(t){const e=new C;for(let i=0;i0&&n<4&&!this._preserveType?this._factory.createLineString(i):this._factory.createLinearRing(i)}}class oe{constructor(){oe.constructor_.apply(this,arguments)}static constructor_(){this._comps=null;const t=arguments[0];this._comps=t}static getGeometry(t){return t.getFactory().buildGeometry(oe.getLines(t))}static getLines(){if(1===arguments.length){const t=arguments[0];return oe.getLines(t,new C)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t instanceof Z?e.add(t):t instanceof ot&&t.apply(new oe(e)),e}}filter(t){t instanceof Z&&this._comps.add(t)}get interfaces_(){return[H]}}class ae{constructor(){ae.constructor_.apply(this,arguments)}static constructor_(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){const t=arguments[0];this._lines=t}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._lines=t,this._isForcedToLineString=e}}static getGeometry(){if(1===arguments.length){const t=arguments[0];return t.getFactory().buildGeometry(ae.getLines(t))}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t.getFactory().buildGeometry(ae.getLines(t,e))}}static getLines(){if(1===arguments.length){const t=arguments[0];return ae.getLines(t,!1)}if(2===arguments.length){if(y(arguments[0],v)&&y(arguments[1],v)){const t=arguments[1];for(let e=arguments[0].iterator();e.hasNext();){const i=e.next();ae.getLines(i,t)}return t}if(arguments[0]instanceof Y&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1],i=new C;return t.apply(new ae(i,e)),i}if(arguments[0]instanceof Y&&y(arguments[1],v)){const t=arguments[0],e=arguments[1];return t instanceof Z?e.add(t):t.apply(new ae(e)),e}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&y(arguments[0],v)&&y(arguments[1],v)){const t=arguments[1],e=arguments[2];for(let i=arguments[0].iterator();i.hasNext();){const n=i.next();ae.getLines(n,t,e)}return t}if("boolean"==typeof arguments[2]&&arguments[0]instanceof Y&&y(arguments[1],v)){const t=arguments[1],e=arguments[2];return arguments[0].apply(new ae(t,e)),t}}}filter(t){if(this._isForcedToLineString&&t instanceof lt){const e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Z&&this._lines.add(t)}setForceToLineString(t){this._isForcedToLineString=t}get interfaces_(){return[B]}}const le={reverseOrder:function(){return{compare:(t,e)=>e.compareTo(t)}},min:function(t){return le.sort(t),t.get(0)},sort:function(t,e){const i=t.toArray();e?Q.sort(i,e):Q.sort(i);const n=t.iterator();for(let t=0,e=i.length;t2*Math.PI)&&(a=2*Math.PI);const l=a/(this._nPts-1),h=new Array(this._nPts).fill(null);let c=0;for(let e=0;e2*Math.PI)&&(a=2*Math.PI);const l=a/(this._nPts-1),h=new Array(this._nPts+2).fill(null);let c=0;h[c++]=this.coord(s,o);for(let e=0;e1&&(i=1);const n=i*e,r=(1-i)*e,s=t.getMinX()+e,o=t.getMinY()+e,a=new Array(this._nPts+1).fill(null);let l=0;for(let t=0;tthis._distance&&this.initialize(t,e,i)}}}class ye{static computeDistance(){if(arguments[2]instanceof me&&arguments[0]instanceof Z&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1],i=arguments[2],n=new Vt,r=t.getCoordinates();for(let t=0;t1||t<=0)throw new n("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t}compute(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)}distance(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()}computeOrientedDistance(t,e,i){const n=new xe(e);if(t.apply(n),i.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){const n=new Ee(e,this._densifyFrac);t.apply(n),i.setMaximum(n.getMaxPointDistance())}}orientedDistance(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()}}class xe{constructor(){xe.constructor_.apply(this,arguments)}static constructor_(){this._maxPtDist=new me,this._minPtDist=new me,this._euclideanDist=new ye,this._geom=null;const t=arguments[0];this._geom=t}filter(t){this._minPtDist.initialize(),ye.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}getMaxPointDistance(){return this._maxPtDist}get interfaces_(){return[z]}}class Ee{constructor(){Ee.constructor_.apply(this,arguments)}static constructor_(){this._maxPtDist=new me,this._minPtDist=new me,this._geom=null,this._numSubSegs=0;const t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))}filter(t,e){if(0===e)return null;const i=t.getCoordinate(e-1),n=t.getCoordinate(e),r=(n.x-i.x)/this._numSubSegs,s=(n.y-i.y)/this._numSubSegs;for(let t=0;te||this._maxs?1:0}get interfaces_(){return[l]}};class Te extends Se{constructor(){super(),Te.constructor_.apply(this,arguments)}static constructor_(){this._item=null;const t=arguments[0],e=arguments[1],i=arguments[2];this._min=t,this._max=e,this._item=i}query(t,e,i){if(!this.intersects(t,e))return null;i.visitItem(this._item)}}class Le extends Se{constructor(){super(),Le.constructor_.apply(this,arguments)}static constructor_(){this._node1=null,this._node2=null;const t=arguments[0],e=arguments[1];this._node1=t,this._node2=e,this.buildExtent(this._node1,this._node2)}buildExtent(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)}query(t,e,i){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,i),null!==this._node2&&this._node2.query(t,e,i)}}class Ne{constructor(){Ne.constructor_.apply(this,arguments)}static constructor_(){this._leaves=new C,this._root=null,this._level=0}buildTree(){le.sort(this._leaves,new Se.NodeComparator);let t=this._leaves,e=null,i=new C;for(;;){if(this.buildLevel(t,i),1===i.size())return i.get(0);e=t,t=i,i=e}}insert(t,e,i){if(null!==this._root)throw new IllegalStateException("Index cannot be added to once it has been queried");this._leaves.add(new Te(t,e,i))}query(t,e,i){if(this.init(),null===this._root)return null;this._root.query(t,e,i)}buildRoot(){if(null!==this._root)return null;this._root=this.buildTree()}printNode(t){D.out.println(Dt.toLineString(new f(t._min,this._level),new f(t._max,this._level)))}init(){return null!==this._root||0===this._leaves.size()?null:void this.buildRoot()}buildLevel(t,e){this._level++,e.clear();for(let i=0;in&&(i=e.x,n=t.x),this._p.x>=i&&this._p.x<=n&&(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){let i=A.index(t,e,this._p);if(i===A.COLLINEAR)return this._isPointOnSegment=!0,null;e.y=this._max)throw new I;const t=this._parent.getGeometryN(this._index++);return t instanceof ot?(this._subcollectionIterator=new De(t),this._subcollectionIterator.next()):t}remove(){throw new U(this.getClass().getName())}hasNext(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}get interfaces_(){return[Fe]}}class Ge{constructor(){Ge.constructor_.apply(this,arguments)}static constructor_(){this._geom=null;const t=arguments[0];this._geom=t}static locatePointInPolygon(t,e){if(e.isEmpty())return Bt.EXTERIOR;const i=e.getExteriorRing(),n=Ge.locatePointInRing(t,i);if(n!==Bt.INTERIOR)return n;for(let i=0;i0&&this.addPoint(t[0])}addHole(t){const e=A.isCCW(t);for(let i=0;i0)t.x=this._cg3.x/3/this._areasum2,t.y=this._cg3.y/3/this._areasum2;else if(this._totalLength>0)t.x=this._lineCentSum.x/this._totalLength,t.y=this._lineCentSum.y/this._totalLength;else{if(!(this._ptCount>0))return null;t.x=this._ptCentSum.x/this._ptCount,t.y=this._ptCentSum.y/this._ptCount}return t}addShell(t){t.length>0&&this.setAreaBasePoint(t[0]);const e=!A.isCCW(t);for(let i=0;i=this.size())throw new x;return this.array[t]}push(t){return this.array.push(t),t}pop(){if(0===this.array.length)throw new qe;return this.array.pop()}peek(){if(0===this.array.length)throw new qe;return this.array[this.array.length-1]}empty(){return 0===this.array.length}isEmpty(){return this.empty()}search(t){return this.array.indexOf(t)}size(){return this.array.length}toArray(){return this.array.slice()}}class je{constructor(){je.constructor_.apply(this,arguments)}static constructor_(){this._coordSet=new vt,this._list=new C}static filterCoordinates(t){const e=new je;for(let i=0;i50&&(t=this.reduce(this._inputPts));const e=this.preSort(t),i=this.grahamScan(e),n=this.toCoordinateArray(i);return this.lineOrPolygon(n)}padArray3(t){const e=new Array(3).fill(null);for(let i=0;ie[2].y&&(e[2]=t[i]),t[i].x+t[i].y>e[3].x+e[3].y&&(e[3]=t[i]),t[i].x>e[4].x&&(e[4]=t[i]),t[i].x-t[i].y>e[5].x-e[5].y&&(e[5]=t[i]),t[i].y0;)e=i.pop();i.push(e),i.push(t[n])}return i.push(t[0]),i}}class We{constructor(){We.constructor_.apply(this,arguments)}static constructor_(){this._origin=null;const t=arguments[0];this._origin=t}static polarCompare(t,e,i){const n=e.x-t.x,r=e.y-t.y,s=i.x-t.x,o=i.y-t.y,a=A.index(t,e,i);if(a===A.COUNTERCLOCKWISE)return 1;if(a===A.CLOCKWISE)return-1;const l=n*n+r*r,h=s*s+o*o;return lh?1:0}compare(t,e){const i=t,n=e;return We.polarCompare(this._origin,i,n)}get interfaces_(){return[l]}}Ue.RadialComparator=We;class He{constructor(){He.constructor_.apply(this,arguments)}static constructor_(){this._interiorPoint=null,this._maxWidth=-1;const t=arguments[0];this.process(t)}static getInteriorPoint(t){return new He(t).getInteriorPoint()}static avg(t,e){return(t+e)/2}getInteriorPoint(){return this._interiorPoint}process(t){if(t.isEmpty())return null;if(t instanceof et)this.processPolygon(t);else if(t instanceof ot){const e=t;for(let t=0;tthis._maxWidth&&(this._maxWidth=i,this._interiorPoint=e.getInteriorPoint())}}class Ze{constructor(){Ze.constructor_.apply(this,arguments)}static constructor_(){this._polygon=null,this._interiorPointY=null,this._interiorSectionWidth=0,this._interiorPoint=null;const t=arguments[0];this._polygon=t,this._interiorPointY=Je.getScanLineY(t)}static isEdgeCrossingCounted(t,e,i){const n=t.getY(),r=e.getY();return!(n===r||n===i&&rt.getMaxY())}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return!(t.getY()>i&&e.getY()>i||t.getY()this._interiorSectionWidth){this._interiorSectionWidth=r;const t=He.avg(i,n);this._interiorPoint=new f(t,this._interiorPointY)}}}process(){if(this._polygon.isEmpty())return null;this._interiorPoint=new f(this._polygon.getCoordinate());const t=new C;this.scanRing(this._polygon.getExteriorRing(),t);for(let e=0;ee?1:0}get interfaces_(){return[l]}}Ze.DoubleComparator=Ke;class Je{constructor(){Je.constructor_.apply(this,arguments)}static constructor_(){this._poly=null,this._centreY=null,this._hiY=s.MAX_VALUE,this._loY=-s.MAX_VALUE;const t=arguments[0];this._poly=t,this._hiY=t.getEnvelopeInternal().getMaxY(),this._loY=t.getEnvelopeInternal().getMinY(),this._centreY=He.avg(this._loY,this._hiY)}static getScanLineY(t){return new Je(t).getScanLineY()}updateInterval(t){t<=this._centreY?t>this._loY&&(this._loY=t):t>this._centreY&&t0}get interfaces_(){return[ti]}}class ni{isInBoundary(t){return t>1}get interfaces_(){return[ti]}}class ri{isInBoundary(t){return 1===t}get interfaces_(){return[ti]}}ti.Mod2BoundaryNodeRule=ei,ti.EndPointBoundaryNodeRule=ii,ti.MultiValentEndPointBoundaryNodeRule=ni,ti.MonoValentEndPointBoundaryNodeRule=ri,ti.MOD2_BOUNDARY_RULE=new ei,ti.ENDPOINT_BOUNDARY_RULE=new ii,ti.MULTIVALENT_ENDPOINT_BOUNDARY_RULE=new ni,ti.MONOVALENT_ENDPOINT_BOUNDARY_RULE=new ri,ti.OGC_SFS_BOUNDARY_RULE=ti.MOD2_BOUNDARY_RULE;class si{constructor(){si.constructor_.apply(this,arguments)}static constructor_(){if(this._boundaryRule=ti.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){const t=arguments[0];if(null===t)throw new n("Rule must be non-null");this._boundaryRule=t}}locateInPolygonRing(t,e){return e.getEnvelopeInternal().intersects(t)?Ae.locateInRing(t,e.getCoordinates()):Bt.EXTERIOR}intersects(t,e){return this.locate(t,e)!==Bt.EXTERIOR}updateLocationInfo(t){t===Bt.INTERIOR&&(this._isIn=!0),t===Bt.BOUNDARY&&this._numBoundaries++}computeLocation(t,e){if(e instanceof J&&this.updateLocationInfo(this.locateOnPoint(t,e)),e instanceof Z)this.updateLocationInfo(this.locateOnLineString(t,e));else if(e instanceof et)this.updateLocationInfo(this.locateInPolygon(t,e));else if(e instanceof wt){const i=e;for(let e=0;e0||this._isIn?Bt.INTERIOR:Bt.EXTERIOR)}}class oi{constructor(){oi.constructor_.apply(this,arguments)}static constructor_(){this._input=null,this._extremalPts=null,this._centre=null,this._radius=0;const t=arguments[0];this._input=t}static farthestPoints(t){const e=t[0].distance(t[1]),i=t[1].distance(t[2]),n=t[2].distance(t[0]);return e>=i&&e>=n?[t[0],t[1]]:i>=e&&i>=n?[t[1],t[2]]:[t[2],t[0]]}static pointWitMinAngleWithX(t,e){let i=s.MAX_VALUE,n=null;for(let r=0;r=t.length&&(e=0),e}static computeC(t,e,i){return t*i.y-e*i.x}static getMinimumDiameter(t){return new ai(t).getDiameter()}static getMinimumRectangle(t){return new ai(t).getMinimumRectangle()}static computeSegmentForLine(t,e,i){let n=null,r=null;return Math.abs(e)>Math.abs(t)?(n=new f(0,i/e),r=new f(1,i/e-t/e)):(n=new f(i/t,0),r=new f(i/t-e/t,1)),new Vt(n,r)}getWidthCoordinate(){return this.computeMinimumDiameter(),this._minWidthPt}getSupportingSegment(){return this.computeMinimumDiameter(),this._inputGeom.getFactory().createLineString([this._minBaseSeg.p0,this._minBaseSeg.p1])}getDiameter(){if(this.computeMinimumDiameter(),null===this._minWidthPt)return this._inputGeom.getFactory().createLineString();const t=this._minBaseSeg.project(this._minWidthPt);return this._inputGeom.getFactory().createLineString([t,this._minWidthPt])}computeWidthConvex(t){this._convexHullPts=t instanceof et?t.getExteriorRing().getCoordinates():t.getCoordinates(),0===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=null,this._minBaseSeg=null):1===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=this._convexHullPts[0],this._minBaseSeg.p0=this._convexHullPts[0],this._minBaseSeg.p1=this._convexHullPts[0]):2===this._convexHullPts.length||3===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=this._convexHullPts[0],this._minBaseSeg.p0=this._convexHullPts[0],this._minBaseSeg.p1=this._convexHullPts[1]):this.computeConvexRingMinDiameter(this._convexHullPts)}computeConvexRingMinDiameter(t){this._minWidth=s.MAX_VALUE;let e=1;const i=new Vt;for(let n=0;n=n;)n=r,s=o,o=ai.nextIndex(t,s),r=e.distancePerpendicular(t[o]);return nn&&(n=a),ao&&(o=l),l1){const t=o/a;for(let e=1;ee?t:e)?3:i}static isInHalfPlane(t,e){return e===di.SE?t===di.SE||t===di.SW:t===e||t===e+1}static quadrant(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?di.NE:di.SE:e>=0?di.NW:di.SW}if(arguments[0]instanceof f&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1];if(e.x===t.x&&e.y===t.y)throw new n("Cannot compute the quadrant for two identical points "+t);return e.x>=t.x?e.y>=t.y?di.NE:di.SE:e.y>=t.y?di.NW:di.SW}}}di.NE=0,di.NW=1,di.SW=2,di.SE=3;class gi{constructor(){gi.constructor_.apply(this,arguments)}static constructor_(){this._orig=null,this._sym=null,this._next=null;const t=arguments[0];this._orig=t}static create(t,e){const i=new gi(t),n=new gi(e);return i.link(n),i}find(t){let e=this;do{if(null===e)return null;if(e.dest().equals2D(t))return e;e=e.oNext()}while(e!==this);return null}dest(){return this._sym._orig}isEdgesSorted(){const t=this.findLowest();let e=t;do{const i=e.oNext();if(i===t)break;if(!(i.compareTo(e)>0))return!1;e=i}while(e!==t);return!0}oNext(){return this._sym._next}directionY(){return this.directionPt().getY()-this._orig.getY()}insert(t){if(this.oNext()===this)return this.insertAfter(t),null;this.insertionEdge(t).insertAfter(t)}insertAfter(t){d.equals(this._orig,t.orig());const e=this.oNext();this._sym.setNext(t),t.sym().setNext(e)}degree(){let t=0,e=this;do{t++,e=e.oNext()}while(e!==this);return t}equals(){if(2===arguments.length&&arguments[1]instanceof f&&arguments[0]instanceof f){const t=arguments[0],e=arguments[1];return this._orig.equals2D(t)&&this._sym._orig.equals(e)}}findLowest(){let t=this,e=this.oNext();do{e.compareTo(t)<0&&(t=e),e=e.oNext()}while(e!==this);return t}directionPt(){return this.dest()}sym(){return this._sym}prev(){return this._sym.next()._sym}compareAngularDirection(t){const e=this.directionX(),i=this.directionY(),n=t.directionX(),r=t.directionY();if(e===n&&i===r)return 0;const s=di.quadrant(e,i),o=di.quadrant(n,r);if(s>o)return 1;if(s0&&t.compareTo(e)>=0&&t.compareTo(i)<=0)return e;if(i.compareTo(e)<=0&&(t.compareTo(i)<=0||t.compareTo(e)>=0))return e;e=i}while(e!==this);return d.shouldNeverReachHere(),null}compareTo(t){const e=t;return this.compareAngularDirection(e)}toStringNode(){const t=this.orig(),e=(this.dest(),new _t);e.append("Node( "+Dt.format(t)+" )\n");let i=this;do{e.append(" -> "+i),e.append("\n"),i=i.oNext()}while(i!==this);return e.toString()}link(t){this.setSym(t),t.setSym(this),this.setNext(t),t.setNext(this)}next(){return this._next}setSym(t){this._sym=t}orig(){return this._orig}toString(){return"HE("+this._orig.x+" "+this._orig.y+", "+this._sym._orig.x+" "+this._sym._orig.y+")"}toStringNodeEdge(){return" -> ("+Dt.format(this.dest())}setNext(t){this._next=t}}class _i extends gi{constructor(){super(),_i.constructor_.apply(this,arguments)}static constructor_(){this._isMarked=!1;const t=arguments[0];gi.constructor_.call(this,t)}static setMarkBoth(t,e){t.setMark(e),t.sym().setMark(e)}static isMarked(t){return t.isMarked()}static setMark(t,e){t.setMark(e)}static markBoth(t){t.mark(),t.sym().mark()}static mark(t){t.mark()}mark(){this._isMarked=!0}setMark(t){this._isMarked=t}isMarked(){return this._isMarked}}class pi{constructor(){pi.constructor_.apply(this,arguments)}static constructor_(){this._vertexMap=new Et}static isValidEdge(t,e){return 0!==e.compareTo(t)}insert(t,e,i){const n=this.create(t,e);null!==i?i.insert(n):this._vertexMap.put(t,n);const r=this._vertexMap.get(e);return null!==r?r.insert(n.sym()):this._vertexMap.put(e,n.sym()),n}create(t,e){const i=this.createEdge(t),n=this.createEdge(e);return i.link(n),i}createEdge(t){return new gi(t)}addEdge(t,e){if(!pi.isValidEdge(t,e))return null;const i=this._vertexMap.get(t);let n=null;return null!==i&&(n=i.find(e)),null!==n?n:this.insert(t,e,i)}getVertexEdges(){return this._vertexMap.values()}findEdge(t,e){const i=this._vertexMap.get(t);return null===i?null:i.find(e)}}class fi extends _i{constructor(){super(),fi.constructor_.apply(this,arguments)}static constructor_(){this._isStart=!1;const t=arguments[0];_i.constructor_.call(this,t)}setStart(){this._isStart=!0}isStart(){return this._isStart}}class mi extends pi{constructor(){super()}createEdge(t){return new fi(t)}}class yi{constructor(){yi.constructor_.apply(this,arguments)}static constructor_(){this._result=null,this._factory=null,this._graph=null,this._lines=new C,this._nodeEdgeStack=new Xe,this._ringStartEdge=null,this._graph=new mi}static dissolve(t){const e=new yi;return e.add(t),e.getResult()}addLine(t){this._lines.add(this._factory.createLineString(t.toCoordinateArray()))}updateRingStartEdge(t){return t.isStart()||(t=t.sym()).isStart()?null===this._ringStartEdge?(this._ringStartEdge=t,null):void(t.orig().compareTo(this._ringStartEdge.orig())<0&&(this._ringStartEdge=t)):null}getResult(){return null===this._result&&this.computeResult(),this._result}process(t){let e=t.prevNode();null===e&&(e=t),this.stackEdges(e),this.buildLines()}buildRing(t){const e=new S;let i=t;for(e.add(i.orig().copy(),!1);2===i.sym().degree();){const n=i.next();if(n===t)break;e.add(n.orig().copy(),!1),i=n}e.add(i.dest().copy(),!1),this.addLine(e)}buildLine(t){const e=new S;let i=t;for(this._ringStartEdge=null,_i.markBoth(i),e.add(i.orig().copy(),!1);2===i.sym().degree();){this.updateRingStartEdge(i);const n=i.next();if(n===t)return this.buildRing(this._ringStartEdge),null;e.add(n.orig().copy(),!1),i=n,_i.markBoth(i)}e.add(i.dest().clone(),!1),this.stackEdges(i.sym()),this.addLine(e)}stackEdges(t){let e=t;do{_i.isMarked(e)||this._nodeEdgeStack.add(e),e=e.oNext()}while(e!==t)}computeResult(){for(let t=this._graph.getVertexEdges().iterator();t.hasNext();){const e=t.next();_i.isMarked(e)||this.process(e)}this._result=this._factory.buildGeometry(this._lines)}buildLines(){for(;!this._nodeEdgeStack.empty();){const t=this._nodeEdgeStack.pop();_i.isMarked(t)||this.buildLine(t)}}add(){if(arguments[0]instanceof Y)arguments[0].apply(new class{get interfaces_(){return[B]}filter(t){t instanceof Z&&this.add(t)}});else if(y(arguments[0],v))for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.add(e)}else if(arguments[0]instanceof Z){const t=arguments[0];null===this._factory&&(this._factory=t.getFactory());const e=t.getCoordinateSequence();let i=!1;for(let t=1;te._xValue?1:this._eventTypee._eventType?1:0}getInsertEvent(){return this._insertEvent}isInsert(){return this._eventType===Ii.INSERT}isSameLabel(t){return null!==this._label&&this._label===t._label}getDeleteEventIndex(){return this._deleteEventIndex}get interfaces_(){return[o]}}Ii.INSERT=1,Ii.DELETE=2;class Ci{constructor(){Ci.constructor_.apply(this,arguments)}static constructor_(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;const t=arguments[0],e=arguments[1],i=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=i}static isAdjacentSegments(t,e){return 1===Math.abs(t-e)}isTrivialIntersection(t,e,i,n){if(t===i&&1===this._li.getIntersectionNum()){if(Ci.isAdjacentSegments(e,n))return!0;if(t.isClosed()){const i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1}getProperIntersectionPoint(){return this._properIntersectionPoint}setIsDoneIfProperInt(t){this._isDoneWhenProperInt=t}hasProperInteriorIntersection(){return this._hasProperInterior}isBoundaryPointInternal(t,e){for(let i=e.iterator();i.hasNext();){const e=i.next().getCoordinate();if(t.isIntersection(e))return!0}return!1}hasProperIntersection(){return this._hasProper}hasIntersection(){return this._hasIntersection}isDone(){return this._isDone}isBoundaryPoint(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))}setBoundaryNodes(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e}addIntersections(t,e,i,n){if(t===i&&e===n)return null;this.numTests++;const r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=i.getCoordinates()[n],a=i.getCoordinates()[n+1];this._li.computeIntersection(r,s,o,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),i.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,i,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),i.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))}}class wi extends class{}{constructor(){super(),wi.constructor_.apply(this,arguments)}static constructor_(){this.events=new C,this.nOverlaps=null}prepareEvents(){le.sort(this.events);for(let t=0;tthis.location.length){const t=new Array(3).fill(null);t[xi.ON]=this.location[xi.ON],t[xi.LEFT]=Bt.NONE,t[xi.RIGHT]=Bt.NONE,this.location=t}for(let e=0;e1&&t.append(Bt.toLocationSymbol(this.location[xi.LEFT])),t.append(Bt.toLocationSymbol(this.location[xi.ON])),this.location.length>1&&t.append(Bt.toLocationSymbol(this.location[xi.RIGHT])),t.toString()}setLocations(t,e,i){this.location[xi.ON]=t,this.location[xi.LEFT]=e,this.location[xi.RIGHT]=i}get(t){return t1}isAnyNull(){for(let t=0;t0||!e.coord.equals2D(n);r||i--;const s=new Array(i).fill(null);let o=0;s[o++]=new f(t.coord);for(let i=t.segmentIndex+1;i<=e.segmentIndex;i++)s[o++]=this.edge.pts[i];return r&&(s[o]=e.coord),new Yi(s,new Ti(this.edge._label))}add(t,e,i){const n=new Li(t,e,i),r=this._nodeMap.get(n);return null!==r?r:(this._nodeMap.put(n,n),n)}isIntersection(t){for(let e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1}}class Di{constructor(){Di.constructor_.apply(this,arguments)}static constructor_(){if(this._data=null,this._size=0,0===arguments.length)Di.constructor_.call(this,10);else if(1===arguments.length){const t=arguments[0];this._data=new Array(t).fill(null)}}size(){return this._size}addAll(t){return null===t||0===t.length?null:(this.ensureCapacity(this._size+t.length),D.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}ensureCapacity(t){if(t<=this._data.length)return null;const e=Math.max(t,2*this._data.length);this._data=Q.copyOf(this._data,e)}toArray(){const t=new Array(this._size).fill(null);return D.arraycopy(this._data,0,t,0,this._size),t}add(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}class Gi{static toIntArray(t){const e=new Array(t.size()).fill(null);for(let i=0;ii?e:i}getMinX(t){const e=this.pts[this.startIndex[t]].x,i=this.pts[this.startIndex[t+1]].x;return eArray(3));for(let t=0;t<2;t++)for(let e=0;e<3;e++)this._depth[t][e]=Vi.NULL_VALUE}static depthAtLocation(t){return t===Bt.EXTERIOR?0:t===Bt.INTERIOR?1:Vi.NULL_VALUE}getDepth(t,e){return this._depth[t][e]}setDepth(t,e,i){this._depth[t][e]=i}isNull(){if(0===arguments.length){for(let t=0;t<2;t++)for(let e=0;e<3;e++)if(this._depth[t][e]!==Vi.NULL_VALUE)return!1;return!0}if(1===arguments.length){const t=arguments[0];return this._depth[t][1]===Vi.NULL_VALUE}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._depth[t][e]===Vi.NULL_VALUE}}normalize(){for(let t=0;t<2;t++)if(!this.isNull(t)){let e=this._depth[t][1];this._depth[t][2]e&&(n=1),this._depth[t][i]=n}}}getDelta(t){return this._depth[t][xi.RIGHT]-this._depth[t][xi.LEFT]}getLocation(t,e){return this._depth[t][e]<=0?Bt.EXTERIOR:Bt.INTERIOR}toString(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}add(){if(1===arguments.length){const t=arguments[0];for(let e=0;e<2;e++)for(let i=1;i<3;i++){const n=t.getLocation(e,i);n!==Bt.EXTERIOR&&n!==Bt.INTERIOR||(this.isNull(e,i)?this._depth[e][i]=Vi.depthAtLocation(n):this._depth[e][i]+=Vi.depthAtLocation(n))}}else if(3===arguments.length){const t=arguments[0],e=arguments[1];arguments[2]===Bt.INTERIOR&&this._depth[t][e]++}}}Vi.NULL_VALUE=-1;class Bi{constructor(){Bi.constructor_.apply(this,arguments)}static constructor_(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._label=t}}setVisited(t){this._isVisited=t}setInResult(t){this._isInResult=t}isCovered(){return this._isCovered}isCoveredSet(){return this._isCoveredSet}setLabel(t){this._label=t}getLabel(){return this._label}setCovered(t){this._isCovered=t,this._isCoveredSet=!0}updateIM(t){d.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)}isInResult(){return this._isInResult}isVisited(){return this._isVisited}}class Yi extends Bi{constructor(){super(),Yi.constructor_.apply(this,arguments)}static constructor_(){if(this.pts=null,this._env=null,this.eiList=new Fi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Vi,this._depthDelta=0,1===arguments.length){const t=arguments[0];Yi.constructor_.call(this,t,null)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.pts=t,this._label=e}}static updateIM(){if(!(2===arguments.length&&arguments[1]instanceof Yt&&arguments[0]instanceof Ti))return super.updateIM.apply(this,arguments);{const t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,xi.ON),t.getLocation(1,xi.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,xi.LEFT),t.getLocation(1,xi.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,xi.RIGHT),t.getLocation(1,xi.RIGHT),2))}}getDepth(){return this._depth}getCollapsedEdge(){const t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new Yi(t,Ti.toLineLabel(this._label))}isIsolated(){return this._isIsolated}getCoordinates(){return this.pts}setIsolated(t){this._isIsolated=t}setName(t){this._name=t}equals(t){if(!(t instanceof Yi))return!1;const e=t;if(this.pts.length!==e.pts.length)return!1;let i=!0,n=!0,r=this.pts.length;for(let t=0;t0?this.pts[0]:null;if(1===arguments.length){const t=arguments[0];return this.pts[t]}}print(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(let e=0;e0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)}computeIM(t){Yi.updateIM(this._label,t)}isCollapsed(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])}isClosed(){return this.pts[0].equals(this.pts[this.pts.length-1])}getMaximumSegmentIndex(){return this.pts.length-1}getDepthDelta(){return this._depthDelta}getNumPoints(){return this.pts.length}printReverse(t){t.print("edge "+this._name+": ");for(let e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")}getMonotoneChainEdge(){return null===this._mce&&(this._mce=new ki(this)),this._mce}getEnvelope(){if(null===this._env){this._env=new L;for(let t=0;t0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()}isPointwiseEqual(t){if(this.pts.length!==t.pts.length)return!1;for(let e=0;et._quadrant?1:this._quadrant=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])}getInvalidPoint(){return this._invalidPoint}getBoundaryPoints(){const t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null);let i=0;for(let n=t.iterator();n.hasNext();){const t=n.next();e[i++]=t.getCoordinate().copy()}return e}getBoundaryNodes(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes}addSelfIntersectionNode(t,e,i){if(this.isBoundaryNode(t,e))return null;i===Bt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,i)}addPolygonRing(t,e,i){if(t.isEmpty())return null;const n=gt.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;let r=e,s=i;A.isCCW(n)&&(r=i,s=e);const o=new Yi(n,new Ti(this._argIndex,Bt.BOUNDARY,r,s));this._lineEdgeMap.put(t,o),this.insertEdge(o),this.insertPoint(this._argIndex,n[0],Bt.BOUNDARY)}insertPoint(t,e,i){const n=this._nodes.addNode(e),r=n.getLabel();null===r?n._label=new Ti(t,i):r.setLocation(t,i)}createEdgeSetIntersector(){return new wi}addSelfIntersectionNodes(t){for(let e=this._edges.iterator();e.hasNext();){const i=e.next(),n=i.getLabel().getLocation(t);for(let e=i.eiList.iterator();e.hasNext();){const i=e.next();this.addSelfIntersectionNode(t,i.coord,n)}}}add(){if(!(1===arguments.length&&arguments[0]instanceof Y))return super.add.apply(this,arguments);{const t=arguments[0];if(t.isEmpty())return null;if(t instanceof mt&&(this._useBoundaryDeterminationRule=!1),t instanceof et)this.addPolygon(t);else if(t instanceof Z)this.addLineString(t);else if(t instanceof J)this.addPoint(t);else if(t instanceof at)this.addCollection(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof mt)this.addCollection(t);else{if(!(t instanceof ot))throw new U(t.getGeometryType());this.addCollection(t)}}}addCollection(t){for(let e=0;e50?(null===this._areaPtLocator&&(this._areaPtLocator=new Pe(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)}findEdge(){if(1===arguments.length&&arguments[0]instanceof Z){const t=arguments[0];return this._lineEdgeMap.get(t)}return super.findEdge.apply(this,arguments)}}var Ki=Object.freeze({__proto__:null,GeometryGraph:Zi});class Ji{visit(t){}}class $i{constructor(){$i.constructor_.apply(this,arguments)}static constructor_(){if(this._p=null,this._data=null,this._left=null,this._right=null,this._count=null,2===arguments.length){const t=arguments[0],e=arguments[1];this._p=new f(t),this._left=null,this._right=null,this._count=1,this._data=e}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._p=new f(t,e),this._left=null,this._right=null,this._count=1,this._data=i}}isRepeated(){return this._count>1}getRight(){return this._right}getCoordinate(){return this._p}setLeft(t){this._left=t}getX(){return this._p.x}getData(){return this._data}getCount(){return this._count}getLeft(){return this._left}getY(){return this._p.y}increment(){this._count=this._count+1}setRight(t){this._right=t}}class Qi{constructor(){Qi.constructor_.apply(this,arguments)}static constructor_(){if(this._root=null,this._numberOfNodes=null,this._tolerance=null,0===arguments.length)Qi.constructor_.call(this,0);else if(1===arguments.length){const t=arguments[0];this._tolerance=t}}static toCoordinates(){if(1===arguments.length){const t=arguments[0];return Qi.toCoordinates(t,!1)}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=new S;for(let n=t.iterator();n.hasNext();){const t=n.next(),r=e?t.getCount():1;for(let e=0;e0){const e=this.findBestMatchNode(t);if(null!==e)return e.increment(),e}return this.insertExact(t,e)}}query(){if(1===arguments.length){const t=arguments[0],e=new C;return this.query(t,e),e}if(2===arguments.length)if(arguments[0]instanceof L&&y(arguments[1],E)){const t=arguments[0],e=arguments[1];this.queryNode(this._root,t,!0,new class{get interfaces_(){return[Ji]}visit(t){e.add(t)}})}else if(arguments[0]instanceof L&&y(arguments[1],Ji)){const t=arguments[0],e=arguments[1];this.queryNode(this._root,t,!0,e)}}queryNode(t,e,i,n){if(null===t)return null;let r=null,s=null,o=null;i?(r=e.getMinX(),s=e.getMaxX(),o=t.getX()):(r=e.getMinY(),s=e.getMaxY(),o=t.getY());const a=o<=s;r=e&&(t.getMinY()>=i&&(n=3),t.getMaxY()<=i&&(n=1)),t.getMaxX()<=e&&(t.getMinY()>=i&&(n=2),t.getMaxY()<=i&&(n=0)),n}hasChildren(){for(let t=0;t<4;t++)if(null!==this._subnode[t])return!0;return!1}isPrunable(){return!(this.hasChildren()||this.hasItems())}addAllItems(t){t.addAll(this._items);for(let e=0;e<4;e++)null!==this._subnode[e]&&this._subnode[e].addAllItems(t);return t}getNodeCount(){let t=0;for(let e=0;e<4;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+1}size(){let t=0;for(let e=0;e<4;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+this._items.size()}addAllItemsFromOverlapping(t,e){if(!this.isSearchMatch(t))return null;e.addAll(this._items);for(let i=0;i<4;i++)null!==this._subnode[i]&&this._subnode[i].addAllItemsFromOverlapping(t,e)}visitItems(t,e){for(let t=this._items.iterator();t.hasNext();)e.visitItem(t.next())}hasItems(){return!this._items.isEmpty()}remove(t,e){if(!this.isSearchMatch(t))return!1;let i=!1;for(let n=0;n<4;n++)if(null!==this._subnode[n]&&(i=this._subnode[n].remove(t,e),i)){this._subnode[n].isPrunable()&&(this._subnode[n]=null);break}return i||(i=this._items.remove(e),i)}visit(t,e){if(!this.isSearchMatch(t))return null;this.visitItems(t,e);for(let i=0;i<4;i++)null!==this._subnode[i]&&this._subnode[i].visit(t,e)}getItems(){return this._items}depth(){let t=0;for(let e=0;e<4;e++)if(null!==this._subnode[e]){const i=this._subnode[e].depth();i>t&&(t=i)}return t+1}isEmpty(){let t=!0;if(this._items.isEmpty()){for(let e=0;e<4;e++)if(null!==this._subnode[e]&&!this._subnode[e].isEmpty()){t=!1;break}}else t=!1;return t}add(t){this._items.add(t)}get interfaces_(){return[h]}}function rn(){}rn.exponent=function(t){return function(t,e){let i,n,r,s;if(s||(i=e<0||1/e<0,isFinite(e)||(s={d:32752,c:0,b:0,a:0},i&&(s.d+=32768),n=Math.pow(2,11)-1,r=0)),!s){for(n=1023,r=Math.abs(e);r>=2;)n++,r/=2;for(;r<1&&n>0;)n--,r*=2;n<=0&&(r/=2)}return n}(0,t)-1023},rn.powerOf2=function(t){return Math.pow(2,t)};class sn{constructor(){sn.constructor_.apply(this,arguments)}static constructor_(){this._pt=new f,this._level=0,this._env=null;const t=arguments[0];this.computeKey(t)}static computeQuadLevel(t){const e=t.getWidth(),i=t.getHeight(),n=e>i?e:i;return rn.exponent(n)+1}getLevel(){return this._level}computeKey(){if(1===arguments.length){const t=arguments[0];for(this._level=sn.computeQuadLevel(t),this._env=new L,this.computeKey(this._level,t);!this._env.contains(t);)this._level+=1,this.computeKey(this._level,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1],i=rn.powerOf2(t);this._pt.x=Math.floor(e.getMinX()/i)*i,this._pt.y=Math.floor(e.getMinY()/i)*i,this._env.init(this._pt.x,this._pt.x+i,this._pt.y,this._pt.y+i)}}getEnvelope(){return this._env}getCentre(){return new f((this._env.getMinX()+this._env.getMaxX())/2,(this._env.getMinY()+this._env.getMaxY())/2)}getPoint(){return this._pt}}class on extends nn{constructor(){super(),on.constructor_.apply(this,arguments)}static constructor_(){this._env=null,this._centrex=null,this._centrey=null,this._level=null;const t=arguments[0],e=arguments[1];this._env=t,this._level=e,this._centrex=(t.getMinX()+t.getMaxX())/2,this._centrey=(t.getMinY()+t.getMaxY())/2}static createNode(t){const e=new sn(t);return new on(e.getEnvelope(),e.getLevel())}static createExpanded(t,e){const i=new L(e);null!==t&&i.expandToInclude(t._env);const n=on.createNode(i);return null!==t&&n.insertNode(t),n}find(t){const e=nn.getSubnodeIndex(t,this._centrex,this._centrey);return-1===e?this:null!==this._subnode[e]?this._subnode[e].find(t):this}isSearchMatch(t){return null!==t&&this._env.intersects(t)}getSubnode(t){return null===this._subnode[t]&&(this._subnode[t]=this.createSubnode(t)),this._subnode[t]}getEnvelope(){return this._env}getNode(t){const e=nn.getSubnodeIndex(t,this._centrex,this._centrey);return-1!==e?this.getSubnode(e).getNode(t):this}createSubnode(t){let e=0,i=0,n=0,r=0;switch(t){case 0:e=this._env.getMinX(),i=this._centrex,n=this._env.getMinY(),r=this._centrey;break;case 1:e=this._centrex,i=this._env.getMaxX(),n=this._env.getMinY(),r=this._centrey;break;case 2:e=this._env.getMinX(),i=this._centrex,n=this._centrey,r=this._env.getMaxY();break;case 3:e=this._centrex,i=this._env.getMaxX(),n=this._centrey,r=this._env.getMaxY()}const s=new L(e,i,n,r);return new on(s,this._level-1)}insertNode(t){d.isTrue(null===this._env||this._env.contains(t._env));const e=nn.getSubnodeIndex(t._env,this._centrex,this._centrey);if(t._level===this._level-1)this._subnode[e]=t;else{const i=this.createSubnode(e);i.insertNode(t),this._subnode[e]=i}}}class an{static isZeroWidth(t,e){const i=e-t;if(0===i)return!0;const n=i/Math.max(Math.abs(t),Math.abs(e));return rn.exponent(n)<=an.MIN_BINARY_EXPONENT}}an.MIN_BINARY_EXPONENT=-50;class ln extends nn{constructor(){super()}insert(t,e){const i=nn.getSubnodeIndex(t,ln.origin.x,ln.origin.y);if(-1===i)return this.add(e),null;const n=this._subnode[i];if(null===n||!n.getEnvelope().contains(t)){const e=on.createExpanded(n,t);this._subnode[i]=e}this.insertContained(this._subnode[i],t,e)}isSearchMatch(t){return!0}insertContained(t,e,i){d.isTrue(t.getEnvelope().contains(e));const n=an.isZeroWidth(e.getMinX(),e.getMaxX()),r=an.isZeroWidth(e.getMinY(),e.getMaxY());let s=null;s=n||r?t.find(e):t.getNode(e),s.add(i)}}ln.origin=new f(0,0);class hn{insert(t,e){}remove(t,e){}query(){}}class cn{constructor(){cn.constructor_.apply(this,arguments)}static constructor_(){this._root=null,this._minExtent=1,this._root=new ln}static ensureExtent(t,e){let i=t.getMinX(),n=t.getMaxX(),r=t.getMinY(),s=t.getMaxY();return i!==n&&r!==s?t:(i===n&&(i-=e/2,n+=e/2),r===s&&(r-=e/2,s+=e/2),new L(i,n,r,s))}size(){return null!==this._root?this._root.size():0}insert(t,e){this.collectStats(t);const i=cn.ensureExtent(t,this._minExtent);this._root.insert(i,e)}query(){if(1===arguments.length){const t=arguments[0],e=new Oe;return this.query(t,e),e.getItems()}if(2===arguments.length){const t=arguments[0],e=arguments[1];this._root.visit(t,e)}}queryAll(){const t=new C;return this._root.addAllItems(t),t}remove(t,e){const i=cn.ensureExtent(t,this._minExtent);return this._root.remove(i,e)}collectStats(t){const e=t.getWidth();e0&&(this._minExtent=e);const i=t.getHeight();i0&&(this._minExtent=i)}depth(){return null!==this._root?this._root.depth():0}isEmpty(){return null===this._root||this._root.isEmpty()}get interfaces_(){return[hn,h]}}var un=Object.freeze({__proto__:null,Quadtree:cn});class dn{getBounds(){}}class gn{constructor(){gn.constructor_.apply(this,arguments)}static constructor_(){this._bounds=null,this._item=null;const t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}getItem(){return this._item}getBounds(){return this._bounds}get interfaces_(){return[dn,h]}}class _n{constructor(){_n.constructor_.apply(this,arguments)}static constructor_(){this._size=null,this._items=null,this._size=0,this._items=new C,this._items.add(null)}poll(){if(this.isEmpty())return null;const t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t}size(){return this._size}reorder(t){let e=null;const i=this._items.get(t);for(;2*t<=this._size&&(e=2*t,e!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(i)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,i)}clear(){this._size=0,this._items.clear()}peek(){return this.isEmpty()?null:this._items.get(1)}isEmpty(){return 0===this._size}add(t){this._items.add(null),this._size+=1;let e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)}}class pn{constructor(){pn.constructor_.apply(this,arguments)}static constructor_(){if(this._childBoundables=new C,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._level=t}}getLevel(){return this._level}size(){return this._childBoundables.size()}getChildBoundables(){return this._childBoundables}addChildBoundable(t){d.isTrue(null===this._bounds),this._childBoundables.add(t)}isEmpty(){return this._childBoundables.isEmpty()}getBounds(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds}get interfaces_(){return[dn,h]}}class fn{static maxDistance(t,e,i,n,r,s,o,a){let l=fn.distance(t,e,r,s);return l=Math.max(l,fn.distance(t,e,o,a)),l=Math.max(l,fn.distance(i,n,r,s)),l=Math.max(l,fn.distance(i,n,o,a)),l}static distance(t,e,i,n){const r=i-t,s=n-e;return Math.sqrt(r*r+s*s)}static maximumDistance(t,e){const i=Math.min(t.getMinX(),e.getMinX()),n=Math.min(t.getMinY(),e.getMinY()),r=Math.max(t.getMaxX(),e.getMaxX()),s=Math.max(t.getMaxY(),e.getMaxY());return fn.distance(i,n,r,s)}static minMaxDistance(t,e){const i=t.getMinX(),n=t.getMinY(),r=t.getMaxX(),s=t.getMaxY(),o=e.getMinX(),a=e.getMinY(),l=e.getMaxX(),h=e.getMaxY();let c=fn.maxDistance(i,n,i,s,o,a,o,h);return c=Math.min(c,fn.maxDistance(i,n,i,s,o,a,l,a)),c=Math.min(c,fn.maxDistance(i,n,i,s,l,h,o,h)),c=Math.min(c,fn.maxDistance(i,n,i,s,l,h,l,a)),c=Math.min(c,fn.maxDistance(i,n,r,n,o,a,o,h)),c=Math.min(c,fn.maxDistance(i,n,r,n,o,a,l,a)),c=Math.min(c,fn.maxDistance(i,n,r,n,l,h,o,h)),c=Math.min(c,fn.maxDistance(i,n,r,n,l,h,l,a)),c=Math.min(c,fn.maxDistance(r,s,i,s,o,a,o,h)),c=Math.min(c,fn.maxDistance(r,s,i,s,o,a,l,a)),c=Math.min(c,fn.maxDistance(r,s,i,s,l,h,o,h)),c=Math.min(c,fn.maxDistance(r,s,i,s,l,h,l,a)),c=Math.min(c,fn.maxDistance(r,s,r,n,o,a,o,h)),c=Math.min(c,fn.maxDistance(r,s,r,n,o,a,l,a)),c=Math.min(c,fn.maxDistance(r,s,r,n,l,h,o,h)),c=Math.min(c,fn.maxDistance(r,s,r,n,l,h,l,a)),c}}class mn{constructor(){mn.constructor_.apply(this,arguments)}static constructor_(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;const t=arguments[0],e=arguments[1],i=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=i,this._distance=this.distance()}static area(t){return t.getBounds().getArea()}static isComposite(t){return t instanceof pn}maximumDistance(){return fn.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}expandToQueue(t,e){const i=mn.isComposite(this._boundable1),r=mn.isComposite(this._boundable2);if(i&&r)return mn.area(this._boundable1)>mn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,e),null):(this.expand(this._boundable2,this._boundable1,!0,t,e),null);if(i)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 n("neither boundable is composite")}isLeaves(){return!(mn.isComposite(this._boundable1)||mn.isComposite(this._boundable2))}compareTo(t){const e=t;return this._distancee._distance?1:0}expand(t,e,i,n,r){for(let s=t.getChildBoundables().iterator();s.hasNext();){const t=s.next();let o=null;o=i?new mn(e,t,this._itemDistance):new mn(t,e,this._itemDistance),o.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}static compareDoubles(t,e){return t>e?1:t-2),e.getLevel()===t)return i.add(e),null;for(let n=e.getChildBoundables().iterator();n.hasNext();){const e=n.next();e instanceof pn?this.boundablesAtLevel(t,e,i):(d.isTrue(e instanceof gn),-1===t&&i.add(e))}return null}}query(){if(1===arguments.length){const t=arguments[0];this.build();const e=new C;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e)}}build(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}getRoot(){return this.build(),this._root}remove(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];let n=this.removeItem(e,i);if(n)return!0;let r=null;for(let s=e.getChildBoundables().iterator();s.hasNext();){const e=s.next();if(this.getIntersectsOp().intersects(e.getBounds(),t)&&e instanceof pn&&(n=this.remove(t,e,i),n)){r=e;break}}return null!==r&&r.getChildBoundables().isEmpty()&&e.getChildBoundables().remove(r),n}}createHigherLevels(t,e){d.isTrue(!t.isEmpty());const i=this.createParentBoundables(t,e+1);return 1===i.size()?i.get(0):this.createHigherLevels(i,e+1)}depth(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){let t=0;for(let e=arguments[0].getChildBoundables().iterator();e.hasNext();){const i=e.next();if(i instanceof pn){const e=this.depth(i);e>t&&(t=e)}}return t+1}}createParentBoundables(t,e){d.isTrue(!t.isEmpty());const i=new C;i.add(this.createNode(e));const n=new C(t);le.sort(n,this.getComparator());for(let t=n.iterator();t.hasNext();){const n=t.next();this.lastNode(i).getChildBoundables().size()===this.getNodeCapacity()&&i.add(this.createNode(e)),this.lastNode(i).addChildBoundable(n)}return i}isEmpty(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}get interfaces_(){return[h]}}yn.IntersectsOp=function(){},yn.DEFAULT_NODE_CAPACITY=10;class vn{distance(t,e){}}class xn extends yn{constructor(){super(),xn.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)xn.constructor_.call(this,xn.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){const t=arguments[0];yn.constructor_.call(this,t)}}static centreX(t){return xn.avg(t.getMinX(),t.getMaxX())}static avg(t,e){return(t+e)/2}static getItems(t){const e=new Array(t.size()).fill(null);let i=0;for(;!t.isEmpty();){const n=t.poll();e[i]=n.getBoundable(0).getItem(),i++}return e}static centreY(t){return xn.avg(t.getMinY(),t.getMaxY())}createParentBoundablesFromVerticalSlices(t,e){d.isTrue(t.length>0);const i=new C;for(let n=0;n=0;){const t=n.poll(),s=t.getDistance();if(s>=i)break;t.isLeaves()?r.size()s&&(r.poll(),r.add(t)),i=r.peek().getDistance()):t.expandToQueue(n,i)}return xn.getItems(r)}}createNode(t){return new En(t)}size(){return 0===arguments.length?super.size.call(this):super.size.apply(this,arguments)}insert(){if(!(2===arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof L))return super.insert.apply(this,arguments);{const t=arguments[0],e=arguments[1];if(t.isNull())return null;super.insert.call(this,t,e)}}getIntersectsOp(){return xn.intersectsOp}verticalSlices(t,e){const i=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),r=t.iterator();for(let t=0;t0;){const t=n.poll(),r=t.getDistance();if(r>=e)break;t.isLeaves()?(e=r,i=t):t.expandToQueue(n,e)}return null===i?null:[i.getBoundable(0).getItem(),i.getBoundable(1).getItem()]}}else{if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.isEmpty()||t.isEmpty())return null;const i=new mn(this.getRoot(),t.getRoot(),e);return this.nearestNeighbour(i)}if(3===arguments.length){const t=arguments[2],e=new gn(arguments[0],arguments[1]),i=new mn(this.getRoot(),e,t);return this.nearestNeighbour(i)[0]}if(4===arguments.length){const t=arguments[2],e=arguments[3],i=new gn(arguments[0],arguments[1]),n=new mn(this.getRoot(),i,t);return this.nearestNeighbourK(n,e)}}}isWithinDistance(){if(2===arguments.length){const t=arguments[0],e=arguments[1];let i=s.POSITIVE_INFINITY;const n=new _n;for(n.add(t);!n.isEmpty();){const t=n.poll(),r=t.getDistance();if(r>e)return!1;if(t.maximumDistance()<=e)return!0;if(t.isLeaves()){if(i=r,i<=e)return!0}else t.expandToQueue(n,i)}return!1}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=new mn(this.getRoot(),t.getRoot(),e);return this.isWithinDistance(n,i)}}get interfaces_(){return[hn,h]}}class En extends pn{constructor(){super(),En.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0];pn.constructor_.call(this,t)}computeBounds(){let t=null;for(let e=this.getChildBoundables().iterator();e.hasNext();){const i=e.next();null===t?t=new L(i.getBounds()):t.expandToInclude(i.getBounds())}return t}}xn.STRtreeNode=En,xn.xComparator=new class{get interfaces_(){return[l]}compare(t,e){return yn.compareDoubles(xn.centreX(t.getBounds()),xn.centreX(e.getBounds()))}},xn.yComparator=new class{get interfaces_(){return[l]}compare(t,e){return yn.compareDoubles(xn.centreY(t.getBounds()),xn.centreY(e.getBounds()))}},xn.intersectsOp=new class{get interfaces_(){return[IntersectsOp]}intersects(t,e){return t.intersects(e)}},xn.DEFAULT_NODE_CAPACITY=10;var In=Object.freeze({__proto__:null,STRtree:xn}),Cn=Object.freeze({__proto__:null,kdtree:en,quadtree:un,strtree:In});const wn=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];class Sn{constructor(t){this.geometryFactory=t||new St}read(t){let e;e="string"==typeof t?JSON.parse(t):t;const i=e.type;if(!Tn[i])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==wn.indexOf(i)?Tn[i].call(this,e.coordinates):"GeometryCollection"===i?Tn[i].call(this,e.geometries):Tn[i].call(this,e)}write(t){const e=t.getGeometryType();if(!Ln[e])throw new Error("Geometry is not supported");return Ln[e].call(this,t)}}const Tn={Feature:function(t){const e={};for(const i in t)e[i]=t[i];if(t.geometry){const i=t.geometry.type;if(!Tn[i])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Tn.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){const e={};if(t.features){e.features=[];for(let i=0;ie?1:0}static compare(t,e,i){if(e.equals2D(i))return 0;const n=Rn.relativeSign(e.x,i.x),r=Rn.relativeSign(e.y,i.y);switch(t){case 0:return Rn.compareValue(n,r);case 1:return Rn.compareValue(r,n);case 2:return Rn.compareValue(r,-n);case 3:return Rn.compareValue(-n,r);case 4:return Rn.compareValue(-n,-r);case 5:return Rn.compareValue(-r,-n);case 6:return Rn.compareValue(-r,n);case 7:return Rn.compareValue(n,-r)}return d.shouldNeverReachHere("invalid octant value"),0}static compareValue(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}}class Pn{constructor(){Pn.constructor_.apply(this,arguments)}static constructor_(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this._segString=t,this.coord=new f(e),this.segmentIndex=i,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(i))}getCoordinate(){return this.coord}print(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)}compareTo(t){const e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:this._isInterior?e._isInterior?Rn.compare(this._segmentOctant,this.coord,e.coord):1:-1}isEndPoint(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t}toString(){return this.segmentIndex+":"+this.coord.toString()}isInterior(){return this._isInterior}get interfaces_(){return[o]}}class bn{constructor(){bn.constructor_.apply(this,arguments)}static constructor_(){this._nodeMap=new Ai,this._edge=null;const t=arguments[0];this._edge=t}getSplitCoordinates(){const t=new S;this.addEndpoints();const e=this.iterator();let i=e.next();for(;e.hasNext();){const n=e.next();this.addEdgeCoordinates(i,n,t),i=n}return t.toCoordinateArray()}addCollapsedNodes(){const t=new C;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(let e=t.iterator();e.hasNext();){const t=e.next().intValue();this.add(this._edge.getCoordinate(t),t)}}createSplitEdgePts(t,e){let i=e.segmentIndex-t.segmentIndex+2;if(2===i)return[new f(t.coord),new f(e.coord)];const n=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(n);r||i--;const s=new Array(i).fill(null);let o=0;s[o++]=new f(t.coord);for(let i=t.segmentIndex+1;i<=e.segmentIndex;i++)s[o++]=this._edge.getCoordinate(i);return r&&(s[o]=new f(e.coord)),s}print(t){t.println("Intersections:");for(let e=this.iterator();e.hasNext();)e.next().print(t)}findCollapsesFromExistingVertices(t){for(let e=0;e=0?e>=0?i>=r?0:1:i>=r?7:6:e>=0?i>=r?3:2:i>=r?4:5}if(arguments[0]instanceof f&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1],i=e.x-t.x,r=e.y-t.y;if(0===i&&0===r)throw new n("Cannot compute the octant for two identical points "+t);return Mn.octant(i,r)}}}class An{getCoordinates(){}size(){}getCoordinate(t){}isClosed(){}setData(t){}getData(){}}class Fn{addIntersection(t,e){}get interfaces_(){return[An]}}class Dn{constructor(){Dn.constructor_.apply(this,arguments)}static constructor_(){this._nodeList=new bn(this),this._pts=null,this._data=null;const t=arguments[0],e=arguments[1];this._pts=t,this._data=e}static getNodedSubstrings(){if(1===arguments.length){const t=arguments[0],e=new C;return Dn.getNodedSubstrings(t,e),e}if(2===arguments.length){const t=arguments[1];for(let e=arguments[0].iterator();e.hasNext();)e.next().getNodeList().addSplitEdges(t)}}getCoordinates(){return this._pts}size(){return this._pts.length}getCoordinate(t){return this._pts[t]}isClosed(){return this._pts[0].equals(this._pts[this._pts.length-1])}getSegmentOctant(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}setData(t){this._data=t}safeOctant(t,e){return t.equals2D(e)?0:Mn.octant(t,e)}getData(){return this._data}addIntersection(){if(2===arguments.length){const t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){const t=arguments[1],e=arguments[3],i=new f(arguments[0].getIntersection(e));this.addIntersection(i,t)}}toString(){return Dt.toLineString(new pt(this._pts))}getNodeList(){return this._nodeList}addIntersectionNode(t,e){let i=e;const n=i+1;if(n=t.length-1)return t.length-1;const n=di.quadrant(t[i],t[i+1]);let r=e+1;for(;ri.getId()&&(i.computeOverlaps(n,t),this._nOverlaps++),this._segInt.isDone())return null}}}}class qn extends Gn{constructor(){super(),qn.constructor_.apply(this,arguments)}static constructor_(){this._si=null;const t=arguments[0];this._si=t}overlap(){if(4!==arguments.length)return super.overlap.apply(this,arguments);{const t=arguments[1],e=arguments[2],i=arguments[3],n=arguments[0].getContext(),r=e.getContext();this._si.processIntersections(n,t,r,i)}}}zn.SegmentOverlapAction=qn;class Xn{constructor(){Xn.constructor_.apply(this,arguments)}static constructor_(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){const t=arguments[0],e=arguments[1];Xn.constructor_.call(this,t,e,0,0)}else if(4===arguments.length){const t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._isScaled=!this.isIntegerPrecision()}}rescale(){if(y(arguments[0],v))for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){const t=arguments[0];for(let e=0;e0&&this._minIndexthis._minCoord.y&&i.y>this._minCoord.y&&n===A.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)}getRightmostSideOfSegment(t,e){const i=t.getEdge().getCoordinates();if(e<0||e+1>=i.length)return-1;if(i[e].y===i[e+1].y)return-1;let n=xi.LEFT;return i[e].ythis._minCoord.x)&&(this._minDe=t,this._minIndex=i,this._minCoord=e[i])}findRightmostEdgeAtNode(){const t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}findEdge(t){for(let e=t.iterator();e.hasNext();){const t=e.next();t.isForward()&&this.checkForRightmostCoordinate(t)}d.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===xi.LEFT&&(this._orientedDe=this._minDe.getSym())}}class $n{constructor(){this.array=[]}addLast(t){this.array.push(t)}removeFirst(){return this.array.shift()}isEmpty(){return 0===this.array.length}}class Qn{constructor(){Qn.constructor_.apply(this,arguments)}static constructor_(){this._finder=null,this._dirEdgeList=new C,this._nodes=new C,this._rightMostCoord=null,this._env=null,this._finder=new Jn}clearVisitedEdges(){for(let t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)}getRightmostCoordinate(){return this._rightMostCoord}computeNodeDepth(t){let e=null;for(let i=t.getEdges().iterator();i.hasNext();){const t=i.next();if(t.isVisited()||t.getSym().isVisited()){e=t;break}}if(null===e)throw new ji("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(let e=t.getEdges().iterator();e.hasNext();){const t=e.next();t.setVisited(!0),this.copySymDepths(t)}}computeDepth(t){this.clearVisitedEdges();const e=this._finder.getEdge();e.getNode(),e.getLabel(),e.setEdgeDepths(xi.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)}create(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}findResultEdges(){for(let t=this._dirEdgeList.iterator();t.hasNext();){const e=t.next();e.getDepth(xi.RIGHT)>=1&&e.getDepth(xi.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}}computeDepths(t){const e=new vt,i=new $n,n=t.getNode();for(i.addLast(n),e.add(n),t.setVisited(!0);!i.isEmpty();){const t=i.removeFirst();e.add(t),this.computeNodeDepth(t);for(let n=t.getEdges().iterator();n.hasNext();){const t=n.next().getSym();if(t.isVisited())continue;const r=t.getNode();e.contains(r)||(i.addLast(r),e.add(r))}}}compareTo(t){const e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0}getEnvelope(){if(null===this._env){const t=new L;for(let e=this._dirEdgeList.iterator();e.hasNext();){const i=e.next().getEdge().getCoordinates();for(let e=0;ethis._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2}addPoints(t,e,i){const n=t.getCoordinates();if(e){let t=1;i&&(t=0);for(let e=t;e=0;e--)this._pts.add(n[e])}}isHole(){return this._isHole}setInResult(){let t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)}containsPoint(t){const e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Ae.isInRing(t,e.getCoordinates()))return!1;for(let e=this._holes.iterator();e.hasNext();)if(e.next().containsPoint(t))return!1;return!0}addHole(t){this._holes.add(t)}isShell(){return null===this._shell}getLabel(){return this._label}getEdges(){return this._edges}getMaxNodeDegree(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}getShell(){return this._shell}mergeLabel(){if(1===arguments.length){const t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){const t=arguments[1],e=arguments[0].getLocation(t,xi.RIGHT);if(e===Bt.NONE)return null;if(this._label.getLocation(t)===Bt.NONE)return this._label.setLocation(t,e),null}}setShell(t){this._shell=t,null!==t&&t.addHole(this)}toPolygon(t){const e=new Array(this._holes.size()).fill(null);for(let t=0;t2){t.linkDirectedEdgesForMinimalEdgeRings();const n=t.buildMinimalRings(),r=this.findShell(n);null!==r?(this.placePolygonHoles(r,n),e.add(r)):i.addAll(n)}else n.add(t)}return n}buildMaximalEdgeRings(t){const e=new C;for(let i=t.iterator();i.hasNext();){const t=i.next();if(t.isInResult()&&t.getLabel().isArea()&&null===t.getEdgeRing()){const i=new ir(t,this._geometryFactory);e.add(i),i.setInResult()}}return e}placePolygonHoles(t,e){for(let i=e.iterator();i.hasNext();){const e=i.next();e.isHole()&&e.setShell(t)}}getPolygons(){return this.computePolygons(this._shellList)}findShell(t){let e=0,i=null;for(let n=t.iterator();n.hasNext();){const t=n.next();t.isHole()||(i=t,e++)}return d.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),i}add(){if(1===arguments.length){const t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){const t=arguments[0],e=arguments[1];Hi.linkResultDirectedEdges(e);const i=this.buildMaximalEdgeRings(t),n=new C,r=this.buildMinimalEdgeRings(i,this._shellList,n);this.sortShellsAndHoles(r,this._shellList,n),this.placeFreeHoles(this._shellList,n)}}}class rr{constructor(){rr.constructor_.apply(this,arguments)}static constructor_(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=A.COUNTERCLOCKWISE;const t=arguments[0];this._inputLine=t}static simplify(t,e){return new rr(t).simplify(e)}isDeletable(t,e,i,n){const r=this._inputLine[t],s=this._inputLine[e],o=this._inputLine[i];return!!this.isConcave(r,s,o)&&!!this.isShallow(r,s,o,n)&&this.isShallowSampled(r,s,t,i,n)}deleteShallowConcavities(){let t=1,e=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(e),n=!1;for(;i=0;e--)this.addPt(t[e])}isRedundant(t){if(this._ptList.size()<1)return!1;const e=this._ptList.get(this._ptList.size()-1);return t.distance(e)=8&&e.getJoinStyle()===Kn.JOIN_ROUND&&(this._closingSegLengthFactor=or.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)}addNextSegment(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;const i=A.index(this._s0,this._s1,this._s2),n=i===A.CLOCKWISE&&this._side===xi.LEFT||i===A.COUNTERCLOCKWISE&&this._side===xi.RIGHT;0===i?this.addCollinear(e):n?this.addOutsideTurn(i,e):this.addInsideTurn(i,e)}addLineEndCap(t,e){const i=new Vt(t,e),n=new Vt;this.computeOffsetSegment(i,xi.LEFT,this._distance,n);const r=new Vt;this.computeOffsetSegment(i,xi.RIGHT,this._distance,r);const s=e.x-t.x,o=e.y-t.y,a=Math.atan2(o,s);switch(this._bufParams.getEndCapStyle()){case Kn.CAP_ROUND:this._segList.addPt(n.p1),this.addDirectedFillet(e,a+Math.PI/2,a-Math.PI/2,A.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Kn.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(r.p1);break;case Kn.CAP_SQUARE:const t=new f;t.x=Math.abs(this._distance)*Math.cos(a),t.y=Math.abs(this._distance)*Math.sin(a);const i=new f(n.p1.x+t.x,n.p1.y+t.y),s=new f(r.p1.x+t.x,r.p1.y+t.y);this._segList.addPt(i),this._segList.addPt(s)}}getCoordinates(){return this._segList.getCoordinates()}addMitreJoin(t,e,i,n){const r=F.intersection(e.p0,e.p1,i.p0,i.p1);if(null!==r&&(n<=0?1:r.distance(t)/Math.abs(n))<=this._bufParams.getMitreLimit())return this._segList.addPt(r),null;this.addLimitedMitreJoin(e,i,n,this._bufParams.getMitreLimit())}addOutsideTurn(t,e){if(this._offset0.p1.distance(this._offset1.p0)=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,a,c,n,r),this._segList.addPt(i)}addLastSegment(){this._segList.addPt(this._offset1.p1)}initSideSegments(t,e,i){this._s1=t,this._s2=e,this._side=i,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,i,this._distance,this._offset1)}addLimitedMitreJoin(t,e,i,n){const r=this._seg0.p1,s=zt.angle(r,this._seg0.p0),o=zt.angleBetweenOriented(this._seg0.p0,r,this._seg1.p1)/2,a=zt.normalize(s+o),l=zt.normalize(a+Math.PI),h=n*i,c=i-h*Math.abs(Math.sin(o)),u=r.x+h*Math.cos(l),d=r.y+h*Math.sin(l),g=new f(u,d),_=new Vt(r,g),p=_.pointAlongOffset(1,c),m=_.pointAlongOffset(1,-c);this._side===xi.LEFT?(this._segList.addPt(p),this._segList.addPt(m)):(this._segList.addPt(m),this._segList.addPt(p))}addDirectedFillet(t,e,i,n,r){const s=n===A.CLOCKWISE?-1:1,o=Math.abs(e-i),a=Math.trunc(o/this._filletAngleQuantum+.5);if(a<1)return null;const l=o/a,h=new f;for(let i=0;i0){const t=new f((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(t);const e=new f((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(e)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}createCircle(t){const e=new f(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}addBevelJoin(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}init(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new sr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*or.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}addCollinear(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Kn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Kn.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,A.CLOCKWISE,this._distance))}closeRing(){this._segList.closeRing()}hasNarrowConcaveAngle(){return this._hasNarrowConcaveAngle}}or.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,or.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,or.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,or.MAX_CLOSING_SEG_LEN_FACTOR=80;class ar{constructor(){ar.constructor_.apply(this,arguments)}static constructor_(){this._distance=0,this._precisionModel=null,this._bufParams=null;const t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}static copyCoordinates(t){const e=new Array(t.length).fill(null);for(let i=0;i=0;t--)i.addNextSegment(e[t],!0)}else{i.addSegments(t,!1);const e=rr.simplify(t,n),r=e.length-1;i.initSideSegments(e[0],e[1],xi.LEFT),i.addFirstSegment();for(let t=2;t<=r;t++)i.addNextSegment(e[t],!0)}i.addLastSegment(),i.closeRing()}computeRingBufferCurve(t,e,i){let n=this.simplifyTolerance(this._distance);e===xi.RIGHT&&(n=-n);const r=rr.simplify(t,n),s=r.length-1;i.initSideSegments(r[s-1],r[0],e);for(let t=1;t<=s;t++){const e=1!==t;i.addNextSegment(r[t],e)}i.closeRing()}computeLineBufferCurve(t,e){const i=this.simplifyTolerance(this._distance),n=rr.simplify(t,i),r=n.length-1;e.initSideSegments(n[0],n[1],xi.LEFT);for(let t=2;t<=r;t++)e.addNextSegment(n[t],!0);e.addLastSegment(),e.addLineEndCap(n[r-1],n[r]);const s=rr.simplify(t,-i),o=s.length-1;e.initSideSegments(s[o],s[o-1],xi.LEFT);for(let t=o-2;t>=0;t--)e.addNextSegment(s[t],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()}computePointCurve(t,e){switch(this._bufParams.getEndCapStyle()){case Kn.CAP_ROUND:e.createCircle(t);break;case Kn.CAP_SQUARE:e.createSquare(t)}}getLineCurve(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;const i=Math.abs(e),n=this.getSegGen(i);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){const i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()}getBufferParameters(){return this._bufParams}simplifyTolerance(t){return t*this._bufParams.getSimplifyFactor()}getRingCurve(t,e,i){if(this._distance=i,t.length<=2)return this.getLineCurve(t,i);if(0===i)return ar.copyCoordinates(t);const n=this.getSegGen(i);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()}computeOffsetCurve(t,e,i){const n=this.simplifyTolerance(this._distance);if(e){const e=rr.simplify(t,-n),r=e.length-1;i.initSideSegments(e[r],e[r-1],xi.LEFT),i.addFirstSegment();for(let t=r-2;t>=0;t--)i.addNextSegment(e[t],!0)}else{const e=rr.simplify(t,n),r=e.length-1;i.initSideSegments(e[0],e[1],xi.LEFT),i.addFirstSegment();for(let t=2;t<=r;t++)i.addNextSegment(e[t],!0)}i.addLastSegment()}isLineOffsetEmpty(t){return 0===t||t<0&&!this._bufParams.isSingleSided()}getSegGen(t){return new or(this._precisionModel,this._bufParams,t)}}class lr{constructor(){lr.constructor_.apply(this,arguments)}static constructor_(){this._subgraphs=null,this._seg=new Vt;const t=arguments[0];this._subgraphs=t}findStabbedSegments(){if(1===arguments.length){const t=arguments[0],e=new C;for(let i=this._subgraphs.iterator();i.hasNext();){const n=i.next(),r=n.getEnvelope();t.yr.getMaxY()||this.findStabbedSegments(t,n.getDirectedEdges(),e)}return e}if(3===arguments.length)if(y(arguments[2],E)&&arguments[0]instanceof f&&arguments[1]instanceof Ui){const t=arguments[0],e=arguments[1],i=arguments[2],n=e.getEdge().getCoordinates();for(let r=0;rthis._seg.p1.y&&this._seg.reverse(),Math.max(this._seg.p0.x,this._seg.p1.x)this._seg.p1.y)continue;if(A.index(this._seg.p0,this._seg.p1,t)===A.RIGHT)continue;let s=e.getDepth(xi.LEFT);this._seg.p0.equals(n[r])||(s=e.getDepth(xi.RIGHT));const o=new hr(this._seg,s);i.add(o)}}else if(y(arguments[2],E)&&arguments[0]instanceof f&&y(arguments[1],E)){const t=arguments[0],e=arguments[2];for(let i=arguments[1].iterator();i.hasNext();){const n=i.next();n.isForward()&&this.findStabbedSegments(t,n,e)}}}getDepth(t){const e=this.findStabbedSegments(t);return 0===e.size()?0:le.min(e)._leftDepth}}class hr{constructor(){hr.constructor_.apply(this,arguments)}static constructor_(){this._upwardSeg=null,this._leftDepth=null;const t=arguments[0],e=arguments[1];this._upwardSeg=new Vt(t),this._leftDepth=e}compareTo(t){const e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;let i=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==i?i:(i=-1*e._upwardSeg.orientationIndex(this._upwardSeg),0!==i?i:this._upwardSeg.compareTo(e._upwardSeg))}compareX(t,e){const i=t.p0.compareTo(e.p0);return 0!==i?i:t.p1.compareTo(e.p1)}toString(){return this._upwardSeg.toString()}get interfaces_(){return[o]}}lr.DepthSegment=hr;class cr{constructor(){cr.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new C;const t=arguments[0],e=arguments[1],i=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=i}addRingSide(t,e,i,n,r){if(0===e&&t.length=lt.MINIMUM_VALID_SIZE&&A.isCCW(t)&&(s=r,o=n,i=xi.opposite(i));const a=this._curveBuilder.getRingCurve(t,i,e);this.addCurve(a,s,o)}addRingBothSides(t,e){this.addRingSide(t,e,xi.LEFT,Bt.EXTERIOR,Bt.INTERIOR),this.addRingSide(t,e,xi.RIGHT,Bt.INTERIOR,Bt.EXTERIOR)}addPoint(t){if(this._distance<=0)return null;const e=t.getCoordinates(),i=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(i,Bt.EXTERIOR,Bt.INTERIOR)}addPolygon(t){let e=this._distance,i=xi.LEFT;this._distance<0&&(e=-this._distance,i=xi.RIGHT);const n=t.getExteriorRing(),r=gt.removeRepeatedPoints(n.getCoordinates());if(this._distance<0&&this.isErodedCompletely(n,this._distance))return null;if(this._distance<=0&&r.length<3)return null;this.addRingSide(r,e,i,Bt.EXTERIOR,Bt.INTERIOR);for(let n=0;n0&&this.isErodedCompletely(r,-this._distance)||this.addRingSide(s,e,xi.opposite(i),Bt.INTERIOR,Bt.EXTERIOR)}}isTriangleErodedCompletely(t,e){const i=new jt(t[0],t[1],t[2]),n=i.inCentre();return k.pointToSegment(n,i.p0,i.p1)r}addCollection(t){for(let e=0;e=0;i--){const n=this._edgeList.get(i),r=n.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=n}e.setNext(t)}computeDepths(){if(1===arguments.length){const t=arguments[0],e=this.findIndex(t),i=t.getDepth(xi.LEFT),n=t.getDepth(xi.RIGHT),r=this.computeDepths(e+1,this._edgeList.size(),i);if(this.computeDepths(0,e,r)!==n)throw new ji("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){const t=arguments[1];let e=arguments[2];for(let i=arguments[0];i=0;r--){const s=this._resultAreaEdgeList.get(r),o=s.getSym();switch(null===e&&s.getEdgeRing()===t&&(e=s),n){case this._SCANNING_FOR_INCOMING:if(o.getEdgeRing()!==t)continue;i=o,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;i.setNextMin(s),n=this._SCANNING_FOR_INCOMING}}n===this._LINKING_TO_OUTGOING&&(d.isTrue(null!==e,"found null for first outgoing dirEdge"),d.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),i.setNextMin(e))}getOutgoingDegree(){if(0===arguments.length){let t=0;for(let e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){const t=arguments[0];let e=0;for(let i=this.iterator();i.hasNext();)i.next().getEdgeRing()===t&&e++;return e}}getLabel(){return this._label}findCoveredLineEdges(){let t=Bt.NONE;for(let e=this.iterator();e.hasNext();){const i=e.next(),n=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){t=Bt.INTERIOR;break}if(n.isInResult()){t=Bt.EXTERIOR;break}}}if(t===Bt.NONE)return null;let e=t;for(let t=this.iterator();t.hasNext();){const i=t.next(),n=i.getSym();i.isLineEdge()?i.getEdge().setCovered(e===Bt.INTERIOR):(i.isInResult()&&(e=Bt.EXTERIOR),n.isInResult()&&(e=Bt.INTERIOR))}}computeLabelling(t){super.computeLabelling.call(this,t),this._label=new Ti(Bt.NONE);for(let t=this.iterator();t.hasNext();){const e=t.next().getEdge().getLabel();for(let t=0;t<2;t++){const i=e.getLocation(t);i!==Bt.INTERIOR&&i!==Bt.BOUNDARY||this._label.setLocation(t,Bt.INTERIOR)}}}}class gr extends Wi{constructor(){super()}createNode(t){return new zi(t,new dr)}}class _r{constructor(){_r.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._orientation=null;const t=arguments[0];this._pts=t,this._orientation=_r.orientation(t)}static orientation(t){return 1===gt.increasingDirection(t)}static compareOriented(t,e,i,n){const r=e?1:-1,s=n?1:-1,o=e?t.length:-1,a=n?i.length:-1;let l=e?0:t.length-1,h=n?0:i.length-1;for(;;){const e=t[l].compareTo(i[h]);if(0!==e)return e;l+=r,h+=s;const n=l===o,c=h===a;if(n&&!c)return-1;if(!n&&c)return 1;if(n&&c)return 0}}compareTo(t){const e=t;return _r.compareOriented(this._pts,this._orientation,e._pts,e._orientation)}get interfaces_(){return[o]}}class pr{constructor(){pr.constructor_.apply(this,arguments)}static constructor_(){this._edges=new C,this._ocaMap=new Ai}print(t){t.print("MULTILINESTRING ( ");for(let e=0;e0&&t.print(","),t.print("(");const n=i.getCoordinates();for(let e=0;e0&&t.print(","),t.print(n[e].x+" "+n[e].y);t.println(")")}t.print(") ")}addAll(t){for(let e=t.iterator();e.hasNext();)this.add(e.next())}findEdgeIndex(t){for(let e=0;en||this._maxys;if(o)return!1;const a=this.intersectsToleranceSquare(t,e);return d.isTrue(!(o&&a),"Found bad envelope test"),a}initCorners(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new f(this._maxx,this._maxy),this._corner[1]=new f(this._minx,this._maxy),this._corner[2]=new f(this._minx,this._miny),this._corner[3]=new f(this._maxx,this._miny)}intersects(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}scale(t){return Math.round(t*this._scaleFactor)}getCoordinate(){return this._originalPt}copyScaled(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}getSafeEnvelope(){if(null===this._safeEnv){const t=xr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new L(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}intersectsPixelClosure(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))))}intersectsToleranceSquare(t,e){let i=!1,n=!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()&&(i=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||i&&n||t.equals(this._pt)||e.equals(this._pt)))))}addSnappedNode(t,e){const i=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(i,n)&&(t.addIntersection(this.getCoordinate(),e),!0)}}xr.SAFE_ENV_EXPANSION_FACTOR=.75;class Er{constructor(){Er.constructor_.apply(this,arguments)}static constructor_(){this.selectedSegment=new Vt}select(){if(1===arguments.length);else if(2===arguments.length){const t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}}}class Ir{constructor(){Ir.constructor_.apply(this,arguments)}static constructor_(){this._index=null;const t=arguments[0];this._index=t}snap(){if(1===arguments.length){const t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=t.getSafeEnvelope(),r=new Cr(t,e,i);return this._index.query(n,new class{get interfaces_(){return[Ce]}visitItem(t){t.select(n,r)}}),r.isNodeAdded()}}}class Cr extends Er{constructor(){super(),Cr.constructor_.apply(this,arguments)}static constructor_(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;const t=arguments[0],e=arguments[1],i=arguments[2];this._hotPixel=t,this._parentEdge=e,this._hotPixelVertexIndex=i}isNodeAdded(){return this._isNodeAdded}select(){if(!(2===arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof kn))return super.select.apply(this,arguments);{const t=arguments[1],e=arguments[0].getContext();if(this._parentEdge===e&&(t===this._hotPixelVertexIndex||t+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(e,t)}}}Ir.HotPixelSnapAction=Cr;class wr{constructor(){wr.constructor_.apply(this,arguments)}static constructor_(){this._li=null,this._interiorIntersections=null;const t=arguments[0];this._li=t,this._interiorIntersections=new C}processIntersections(t,e,i,n){if(t===i&&e===n)return null;const r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=i.getCoordinates()[n],a=i.getCoordinates()[n+1];if(this._li.computeIntersection(r,s,o,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(let t=0;t0?e:0),s=i-Math.trunc(Math.log(r)/Math.log(10)+1);return Math.pow(10,s)}bufferFixedPrecision(t){const e=new Xn(new Sr(new It(1)),t.getScale()),i=new yr(this._bufParams);i.setWorkingPrecisionModel(t),i.setNoder(e),this._resultGeometry=i.buffer(this._argGeom,this._distance)}bufferReducedPrecision(){if(0===arguments.length){for(let t=Tr.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(t){if(!(t instanceof ji))throw t;this._saveException=t}if(null!==this._resultGeometry)return null}throw this._saveException}if(1===arguments.length){const t=arguments[0],e=Tr.precisionScaleFactor(this._argGeom,this._distance,t),i=new It(e);this.bufferFixedPrecision(i)}}computeGeometry(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;const t=this._argGeom.getFactory().getPrecisionModel();t.getType()===It.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}setQuadrantSegments(t){this._bufParams.setQuadrantSegments(t)}bufferOriginalPrecision(){try{const t=new yr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof c))throw t;this._saveException=t}}getResultGeometry(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}setEndCapStyle(t){this._bufParams.setEndCapStyle(t)}}Tr.CAP_ROUND=Kn.CAP_ROUND,Tr.CAP_BUTT=Kn.CAP_FLAT,Tr.CAP_FLAT=Kn.CAP_FLAT,Tr.CAP_SQUARE=Kn.CAP_SQUARE,Tr.MAX_PRECISION_DIGITS=12;var Lr=Object.freeze({__proto__:null,BufferOp:Tr,BufferParameters:Kn});class Nr{constructor(){Nr.constructor_.apply(this,arguments)}static constructor_(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){const t=arguments[0],e=arguments[1];Nr.constructor_.call(this,t,Nr.INSIDE_AREA,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._component=t,this._segIndex=e,this._pt=i}}getSegmentIndex(){return this._segIndex}getCoordinate(){return this._pt}isInsideArea(){return this._segIndex===Nr.INSIDE_AREA}toString(){return this._component.getGeometryType()+"["+this._segIndex+"]-"+Dt.toPoint(this._pt)}getGeometryComponent(){return this._component}}Nr.INSIDE_AREA=-1;class Or{constructor(){Or.constructor_.apply(this,arguments)}static constructor_(){this._locations=null;const t=arguments[0];this._locations=t}static getLocations(t){const e=new C;return t.apply(new Or(e)),e}filter(t){if(t.isEmpty())return null;(t instanceof J||t instanceof Z||t instanceof et)&&this._locations.add(new Nr(t,0,t.getCoordinate()))}get interfaces_(){return[H]}}class Rr{constructor(){Rr.constructor_.apply(this,arguments)}static constructor_(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new si,this._minDistanceLocation=null,this._minDistance=s.MAX_VALUE,2===arguments.length){const t=arguments[0],e=arguments[1];Rr.constructor_.call(this,t,e,0)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e,this._terminateDistance=i}}static distance(t,e){return new Rr(t,e).distance()}static isWithinDistance(t,e,i){return!(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>i)&&new Rr(t,e,i).distance()<=i}static nearestPoints(t,e){return new Rr(t,e).nearestPoints()}computeContainmentDistance(){if(0===arguments.length){const t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1],i=this._geom[t];if(i.getDimension()<2)return null;const n=1-t,r=ce.getPolygons(i);if(r.size()>0){const i=Or.getLocations(this._geom[n]);if(this.computeContainmentDistance(i,r,e),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[n]=e[0],this._minDistanceLocation[t]=e[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&y(arguments[0],E)&&y(arguments[1],E)){const t=arguments[0],e=arguments[1],i=arguments[2];for(let n=0;nthis._minDistance)return null;const n=t.getCoordinates(),r=e.getCoordinate();for(let s=0;sthis._minDistance)return null;const n=t.getCoordinates(),r=e.getCoordinates();for(let s=0;sthis._minDistance))for(let a=0;athis._minDistance)continue;const h=k.segmentToSegment(n[s],n[s+1],r[a],r[a+1]);if(ht&>.reverse(this._coordinates)}return this._coordinates}toLineString(){return this._factory.createLineString(this.getCoordinates())}add(t){this._directedEdges.add(t)}}class Mr{constructor(){Mr.constructor_.apply(this,arguments)}static constructor_(){this._isMarked=!1,this._isVisited=!1,this._data=null}static getComponentWithVisitedState(t,e){for(;t.hasNext();){const i=t.next();if(i.isVisited()===e)return i}return null}static setVisited(t,e){for(;t.hasNext();)t.next().setVisited(e)}static setMarked(t,e){for(;t.hasNext();)t.next().setMarked(e)}setVisited(t){this._isVisited=t}isMarked(){return this._isMarked}setData(t){this._data=t}getData(){return this._data}setMarked(t){this._isMarked=t}getContext(){return this._data}isVisited(){return this._isVisited}setContext(t){this._data=t}}class Ar extends Mr{constructor(){super(),Ar.constructor_.apply(this,arguments)}static constructor_(){if(this._parentEdge=null,this._from=null,this._to=null,this._p0=null,this._p1=null,this._sym=null,this._edgeDirection=null,this._quadrant=null,this._angle=null,0===arguments.length);else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this._from=t,this._to=e,this._edgeDirection=n,this._p0=t.getCoordinate(),this._p1=i;const r=this._p1.x-this._p0.x,s=this._p1.y-this._p0.y;this._quadrant=di.quadrant(r,s),this._angle=Math.atan2(s,r)}}static toEdges(t){const e=new C;for(let i=t.iterator();i.hasNext();)e.add(i.next()._parentEdge);return e}isRemoved(){return null===this._parentEdge}compareDirection(t){return this._quadrant>t._quadrant?1:this._quadrant=0&&t.add(r+1,new f(i),!1)}}findSegmentIndexToSnap(t,e){let i=s.MAX_VALUE,n=-1;for(let r=0;re&&(e=t)}return e}if(2===arguments.length){const t=arguments[0],e=arguments[1];return Math.min(Zr.computeOverlaySnapTolerance(t),Zr.computeOverlaySnapTolerance(e))}}static computeSizeBasedSnapTolerance(t){const e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Zr.SNAP_PRECISION_FACTOR}static snapToSelf(t,e,i){return new Zr(t).snapToSelf(e,i)}snapTo(t,e){const i=this.extractTargetCoordinates(t);return new Kr(e,i).transform(this._srcGeom)}snapToSelf(t,e){const i=this.extractTargetCoordinates(this._srcGeom),n=new Kr(t,i,!0).transform(this._srcGeom);let r=n;return e&&y(r,tt)&&(r=n.buffer(0)),r}computeSnapTolerance(t){return this.computeMinimumSegmentLength(t)/10}extractTargetCoordinates(t){const e=new rt,i=t.getCoordinates();for(let t=0;t=t.size()-2}static createAnyIntersectionFinder(t){return new Qr(t)}static createInteriorIntersectionsFinder(t){const e=new Qr(t);return e.setFindAllIntersections(!0),e.setInteriorIntersectionsOnly(!0),e}setCheckEndSegmentsOnly(t){this._isCheckEndSegmentsOnly=t}getIntersectionSegments(){return this._intSegments}count(){return this._intersectionCount}getIntersections(){return this._intersections}setFindAllIntersections(t){this._findAllIntersections=t}setKeepIntersections(t){this._keepIntersections=t}getIntersection(){return this._interiorIntersection}processIntersections(t,e,i,n){if(!this._findAllIntersections&&this.hasIntersection())return null;const r=t===i;if(r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!Qr.isEndSegment(t,e)&&!Qr.isEndSegment(i,n))return null;const s=t.getCoordinate(e),o=t.getCoordinate(e+1),a=i.getCoordinate(n),l=i.getCoordinate(n+1),h=0===e,c=e+2===t.size(),u=0===n,d=n+2===i.size();this._li.computeIntersection(s,o,a,l);const g=this._li.hasIntersection()&&this._li.isInteriorIntersection();let _=!1;this._isInteriorIntersectionsOnly||(_=!(r&&Math.abs(n-e)<=1)&&Qr.isInteriorVertexIntersection(s,o,a,l,h,c,u,d)),(g||_)&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=s,this._intSegments[1]=o,this._intSegments[2]=a,this._intSegments[3]=l,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)}hasIntersection(){return null!==this._interiorIntersection}isDone(){return!this._findAllIntersections&&null!==this._interiorIntersection}setInteriorIntersectionsOnly(t){this._isInteriorIntersectionsOnly=t}get interfaces_(){return[fr]}}class ts{constructor(){ts.constructor_.apply(this,arguments)}static constructor_(){this._li=new kt,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;const t=arguments[0];this._segStrings=t}static computeIntersections(t){const e=new ts(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()}execute(){if(null!==this._segInt)return null;this.checkInteriorIntersections()}getIntersections(){return this._segInt.getIntersections()}isValid(){return this.execute(),this._isValid}setFindAllIntersections(t){this._findAllIntersections=t}checkInteriorIntersections(){this._isValid=!0,this._segInt=new Qr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);const t=new zn;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null}checkValid(){if(this.execute(),!this._isValid)throw new ji(this.getErrorMessage(),this._segInt.getIntersection())}getErrorMessage(){if(this._isValid)return"no intersections found";const t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Dt.toLineString(t[0],t[1])+" and "+Dt.toLineString(t[2],t[3])}}class es{constructor(){es.constructor_.apply(this,arguments)}static constructor_(){this._nv=null;const t=arguments[0];this._nv=new ts(es.toSegmentStrings(t))}static toSegmentStrings(t){const e=new C;for(let i=t.iterator();i.hasNext();){const t=i.next();e.add(new $r(t.getCoordinates(),t))}return e}static checkValid(t){new es(t).checkValid()}checkValid(){this._nv.checkValid()}}class is{constructor(){is.constructor_.apply(this,arguments)}static constructor_(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new C,this._resultLineList=new C;const t=arguments[0],e=arguments[1],i=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=i}collectLines(t){for(let e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){const i=e.next();this.collectLineEdge(i,t,this._lineEdgesList),this.collectBoundaryTouchEdge(i,t,this._lineEdgesList)}}labelIsolatedLine(t,e){const i=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,i)}build(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList}collectLineEdge(t,e,i){const n=t.getLabel(),r=t.getEdge();t.isLineEdge()&&(t.isVisited()||!us.isResultOfOp(n,e)||r.isCovered()||(i.add(r),t.setVisitedEdge(!0)))}findCoveredLineEdges(){for(let t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(let t=this._op.getGraph().getEdgeEnds().iterator();t.hasNext();){const e=t.next(),i=e.getEdge();if(e.isLineEdge()&&!i.isCoveredSet()){const t=this._op.isCoveredByA(e.getCoordinate());i.setCovered(t)}}}labelIsolatedLines(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),i=t.getLabel();t.isIsolated()&&(i.isNull(0)?this.labelIsolatedLine(t,0):this.labelIsolatedLine(t,1))}}buildLines(t){for(let t=this._lineEdgesList.iterator();t.hasNext();){const e=t.next(),i=this._geometryFactory.createLineString(e.getCoordinates());this._resultLineList.add(i),e.setInResult(!0)}}collectBoundaryTouchEdge(t,e,i){const n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(d.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(us.isResultOfOp(n,e)&&e===us.INTERSECTION&&(i.add(t.getEdge()),t.setVisitedEdge(!0))))}}class ns{constructor(){ns.constructor_.apply(this,arguments)}static constructor_(){this._op=null,this._geometryFactory=null,this._resultPointList=new C;const t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e}filterCoveredNodeToPoint(t){const e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){const t=this._geometryFactory.createPoint(e);this._resultPointList.add(t)}}extractNonCoveredResultNodes(t){for(let e=this._op.getGraph().getNodes().iterator();e.hasNext();){const i=e.next();if(!(i.isInResult()||i.isIncidentEdgeInResult()||0!==i.getEdges().getDegree()&&t!==us.INTERSECTION)){const e=i.getLabel();us.isResultOfOp(e,t)&&this.filterCoveredNodeToPoint(i)}}}build(t){return this.extractNonCoveredResultNodes(t),this._resultPointList}}class rs{constructor(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=new r,this._commonSignExp=null}getCommon(){return s.longBitsToDouble(this._commonBits)}add(t){const e=s.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=rs.signExpBits(this._commonBits),this._isFirst=!1,null):rs.signExpBits(e)!==this._commonSignExp?(this._commonBits.high=0,this._commonBits.low=0,null):(this._commonMantissaBitsCount=rs.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=rs.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))}toString(){if(1===arguments.length){const t=arguments[0],e=s.longBitsToDouble(t),i="0000000000000000000000000000000000000000000000000000000000000000"+r.toBinaryString(t),n=i.substring(i.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}}getClass(){return rs}get interfaces_(){return[]}static getBit(t,e){const i=1<>>20}static zeroLowerBits(t,e){let i="low";if(e>32&&(t.low=0,e%=32,i="high"),e>0){const n=e<32?~((1<=0;n--){if(rs.getBit(t,n)!==rs.getBit(e,n))return i;i++}return 52}}class ss{constructor(){ss.constructor_.apply(this,arguments)}static constructor_(){this._commonCoord=null,this._ccFilter=new os}addCommonBits(t){const e=new as(this._commonCoord);t.apply(e),t.geometryChanged()}removeCommonBits(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;const e=new f(this._commonCoord);e.x=-e.x,e.y=-e.y;const i=new as(e);return t.apply(i),t.geometryChanged(),t}getCommonCoordinate(){return this._commonCoord}add(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()}}class os{constructor(){os.constructor_.apply(this,arguments)}static constructor_(){this._commonBitsX=new rs,this._commonBitsY=new rs}filter(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)}getCommonCoordinate(){return new f(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())}get interfaces_(){return[z]}}class as{constructor(){as.constructor_.apply(this,arguments)}static constructor_(){this.trans=null;const t=arguments[0];this.trans=t}filter(t,e){const i=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,i),t.setOrdinate(e,1,n)}isDone(){return!1}isGeometryChanged(){return!0}get interfaces_(){return[T]}}ss.CommonCoordinateFilter=os,ss.Translater=as;class ls{constructor(){ls.constructor_.apply(this,arguments)}static constructor_(){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null;const t=arguments[0],e=arguments[1];this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()}static overlayOp(t,e,i){return new ls(t,e).getResultGeometry(i)}static union(t,e){return ls.overlayOp(t,e,us.UNION)}static intersection(t,e){return ls.overlayOp(t,e,us.INTERSECTION)}static symDifference(t,e){return ls.overlayOp(t,e,us.SYMDIFFERENCE)}static difference(t,e){return ls.overlayOp(t,e,us.DIFFERENCE)}selfSnap(t){return new Zr(t).snapTo(t,this._snapTolerance)}removeCommonBits(t){this._cbr=new ss,this._cbr.add(t[0]),this._cbr.add(t[1]);const e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e}prepareResult(t){return this._cbr.addCommonBits(t),t}getResultGeometry(t){const e=this.snap(this._geom),i=us.overlayOp(e[0],e[1],t);return this.prepareResult(i)}checkValid(t){t.isValid()||D.out.println("Snapped geometry is invalid")}computeSnapTolerance(){this._snapTolerance=Zr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])}snap(t){const e=this.removeCommonBits(t);return Zr.snap(e[0],e[1],this._snapTolerance)}}class hs{constructor(){hs.constructor_.apply(this,arguments)}static constructor_(){this._geom=new Array(2).fill(null);const t=arguments[0],e=arguments[1];this._geom[0]=t,this._geom[1]=e}static overlayOp(t,e,i){return new hs(t,e).getResultGeometry(i)}static union(t,e){return hs.overlayOp(t,e,us.UNION)}static intersection(t,e){return hs.overlayOp(t,e,us.INTERSECTION)}static symDifference(t,e){return hs.overlayOp(t,e,us.SYMDIFFERENCE)}static difference(t,e){return hs.overlayOp(t,e,us.DIFFERENCE)}getResultGeometry(t){let e=null,i=!1,n=null;try{e=us.overlayOp(this._geom[0],this._geom[1],t),i=!0}catch(t){if(!(t instanceof c))throw t;n=t}if(!i)try{e=ls.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof c?n:t}return e}}class cs{constructor(){cs.constructor_.apply(this,arguments)}static constructor_(){if(this._li=new kt,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){const t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Zi(0,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];cs.constructor_.call(this,t,e,ti.OGC_SFS_BOUNDARY_RULE)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];t.getPrecisionModel().compareTo(e.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Zi(0,t,i),this._arg[1]=new Zi(1,e,i)}}getArgGeometry(t){return this._arg[t].getGeometry()}setComputationPrecision(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)}}class us extends cs{constructor(){super(),us.constructor_.apply(this,arguments)}static constructor_(){this._ptLocator=new si,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new pr,this._resultPolyList=new C,this._resultLineList=new C,this._resultPointList=new C;const t=arguments[0],e=arguments[1];cs.constructor_.call(this,t,e),this._graph=new Hi(new gr),this._geomFact=t.getFactory()}static overlayOp(t,e,i){return new us(t,e).getResultGeometry(i)}static union(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return us.createEmptyResult(us.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return hs.overlayOp(t,e,us.UNION)}static intersection(t,e){if(t.isEmpty()||e.isEmpty())return us.createEmptyResult(us.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){const i=e;return $t.map(t,new class{get interfaces_(){return[MapOp]}map(t){return us.intersection(t,i)}})}return hs.overlayOp(t,e,us.INTERSECTION)}static symDifference(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return us.createEmptyResult(us.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return hs.overlayOp(t,e,us.SYMDIFFERENCE)}static resultDimension(t,e,i){const n=e.getDimension(),r=i.getDimension();let s=-1;switch(t){case us.INTERSECTION:s=Math.min(n,r);break;case us.UNION:s=Math.max(n,r);break;case us.DIFFERENCE:s=n;break;case us.SYMDIFFERENCE:s=Math.max(n,r)}return s}static createEmptyResult(t,e,i,n){const r=us.resultDimension(t,e,i);return n.createEmpty(r)}static difference(t,e){if(t.isEmpty())return us.createEmptyResult(us.DIFFERENCE,t,e,t.getFactory());if(e.isEmpty())return t.copy();if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return hs.overlayOp(t,e,us.DIFFERENCE)}static isResultOfOp(){if(2===arguments.length){const t=arguments[0],e=arguments[1],i=t.getLocation(0),n=t.getLocation(1);return us.isResultOfOp(i,n,e)}if(3===arguments.length){let t=arguments[0],e=arguments[1],i=arguments[2];switch(t===Bt.BOUNDARY&&(t=Bt.INTERIOR),e===Bt.BOUNDARY&&(e=Bt.INTERIOR),i){case us.INTERSECTION:return t===Bt.INTERIOR&&e===Bt.INTERIOR;case us.UNION:return t===Bt.INTERIOR||e===Bt.INTERIOR;case us.DIFFERENCE:return t===Bt.INTERIOR&&e!==Bt.INTERIOR;case us.SYMDIFFERENCE:return t===Bt.INTERIOR&&e!==Bt.INTERIOR||t!==Bt.INTERIOR&&e===Bt.INTERIOR}return!1}}insertUniqueEdge(t){const e=this._edgeList.findEqualEdge(t);if(null!==e){const i=e.getLabel();let n=t.getLabel();e.isPointwiseEqual(t)||(n=new Ti(t.getLabel()),n.flip());const r=e.getDepth();r.isNull()&&r.add(i),r.add(n),i.merge(n)}else this._edgeList.add(t)}getGraph(){return this._graph}cancelDuplicateResultEdges(){for(let t=this._graph.getEdgeEnds().iterator();t.hasNext();){const e=t.next(),i=e.getSym();e.isInResult()&&i.isInResult()&&(e.setInResult(!1),i.setInResult(!1))}}isCoveredByLA(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)}computeGeometry(t,e,i,n){const r=new C;return r.addAll(t),r.addAll(e),r.addAll(i),r.isEmpty()?us.createEmptyResult(n,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(r)}mergeSymLabels(){for(let t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()}isCovered(t,e){for(let i=e.iterator();i.hasNext();){const e=i.next();if(this._ptLocator.locate(t,e)!==Bt.EXTERIOR)return!0}return!1}replaceCollapsedEdges(){const t=new C;for(let e=this._edgeList.iterator();e.hasNext();){const i=e.next();i.isCollapsed()&&(e.remove(),t.add(i.getCollapsedEdge()))}this._edgeList.addAll(t)}updateNodeLabelling(){for(let t=this._graph.getNodes().iterator();t.hasNext();){const e=t.next(),i=e.getEdges().getLabel();e.getLabel().merge(i)}}getResultGeometry(t){return this.computeOverlay(t),this._resultGeom}insertUniqueEdges(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.insertUniqueEdge(t)}}computeOverlay(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);const e=new C;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),es.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();const i=new nr(this._geomFact);i.add(this._graph),this._resultPolyList=i.getPolygons();const n=new is(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);const r=new ns(this,this._geomFact,this._ptLocator);this._resultPointList=r.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)}labelIncompleteNode(t,e){const i=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,i)}copyPoints(t){for(let e=this._arg[t].getNodeIterator();e.hasNext();){const i=e.next();this._graph.addNode(i.getCoordinate()).setLabel(t,i.getLabel().getLocation(t))}}findResultAreaEdges(t){for(let e=this._graph.getEdgeEnds().iterator();e.hasNext();){const i=e.next(),n=i.getLabel();n.isArea()&&!i.isInteriorAreaEdge()&&us.isResultOfOp(n.getLocation(0,xi.RIGHT),n.getLocation(1,xi.RIGHT),t)&&i.setInResult(!0)}}computeLabelsFromDepths(){for(let t=this._edgeList.iterator();t.hasNext();){const e=t.next(),i=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(let t=0;t<2;t++)i.isNull(t)||!i.isArea()||n.isNull(t)||(0===n.getDelta(t)?i.toLine(t):(d.isTrue(!n.isNull(t,xi.LEFT),"depth of LEFT side has not been initialized"),i.setLocation(t,xi.LEFT,n.getLocation(t,xi.LEFT)),d.isTrue(!n.isNull(t,xi.RIGHT),"depth of RIGHT side has not been initialized"),i.setLocation(t,xi.RIGHT,n.getLocation(t,xi.RIGHT))))}}}computeLabelling(){for(let t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()}labelIncompleteNodes(){for(let t=this._graph.getNodes().iterator();t.hasNext();){const e=t.next(),i=e.getLabel();e.isIsolated()&&(i.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(i)}}isCoveredByA(t){return!!this.isCovered(t,this._resultPolyList)}}us.INTERSECTION=1,us.UNION=2,us.DIFFERENCE=3,us.SYMDIFFERENCE=4;var ds=Object.freeze({__proto__:null,snap:Jr,OverlayOp:us});class gs extends Ar{constructor(){super(),gs.constructor_.apply(this,arguments)}static constructor_(){this._edgeRing=null,this._next=null,this._label=-1;const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];Ar.constructor_.call(this,t,e,i,n)}getNext(){return this._next}isInRing(){return null!==this._edgeRing}setRing(t){this._edgeRing=t}setLabel(t){this._label=t}getLabel(){return this._label}setNext(t){this._next=t}getRing(){return this._edgeRing}}class _s extends Dr{constructor(){super(),_s.constructor_.apply(this,arguments)}static constructor_(){this._line=null;const t=arguments[0];this._line=t}getLine(){return this._line}}class ps{constructor(){ps.constructor_.apply(this,arguments)}static constructor_(){this._geometryFactory=new St,this._geomGraph=null,this._disconnectedRingcoord=null;const t=arguments[0];this._geomGraph=t}static findDifferentPoint(t,e){for(let i=0;i=t.getNumPoints()&&null===n)return null;let s=t.getCoordinate(r);null!==n&&n.segmentIndex===i.segmentIndex&&(s=n.coord);const o=new Xi(t,i.coord,s,new Ti(t.getLabel()));e.add(o)}createEdgeEndForPrev(t,e,i,n){let r=i.segmentIndex;if(0===i.dist){if(0===r)return null;r--}let s=t.getCoordinate(r);null!==n&&n.segmentIndex>=r&&(s=n.coord);const o=new Ti(t.getLabel());o.flip();const a=new Xi(t,i.coord,s,o);e.add(a)}computeEdgeEnds(){if(1===arguments.length){const t=arguments[0],e=new C;for(let i=t;i.hasNext();){const t=i.next();this.computeEdgeEnds(t,e)}return e}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=t.getEdgeIntersectionList();i.addEndpoints();const n=i.iterator();let r=null,s=null;if(!n.hasNext())return null;let o=n.next();do{r=s,s=o,o=null,n.hasNext()&&(o=n.next()),null!==s&&(this.createEdgeEndForPrev(t,e,s,r),this.createEdgeEndForNext(t,e,s,o))}while(null!==s)}}}class ms extends Xi{constructor(){super(),ms.constructor_.apply(this,arguments)}static constructor_(){if(this._edgeEnds=new C,1===arguments.length){const t=arguments[0];ms.constructor_.call(this,null,t)}else if(2===arguments.length){const t=arguments[1];Xi.constructor_.call(this,t.getEdge(),t.getCoordinate(),t.getDirectedCoordinate(),new Ti(t.getLabel())),this.insert(t)}}insert(t){this._edgeEnds.add(t)}print(t){t.println("EdgeEndBundle--\x3e Label: "+this._label);for(let e=this.iterator();e.hasNext();)e.next().print(t),t.println()}iterator(){return this._edgeEnds.iterator()}getEdgeEnds(){return this._edgeEnds}computeLabelOn(t,e){let i=0,n=!1;for(let e=this.iterator();e.hasNext();){const r=e.next().getLabel().getLocation(t);r===Bt.BOUNDARY&&i++,r===Bt.INTERIOR&&(n=!0)}let r=Bt.NONE;n&&(r=Bt.INTERIOR),i>0&&(r=Zi.determineBoundary(e,i)),this._label.setLocation(t,r)}computeLabelSide(t,e){for(let i=this.iterator();i.hasNext();){const n=i.next();if(n.getLabel().isArea()){const i=n.getLabel().getLocation(t,e);if(i===Bt.INTERIOR)return this._label.setLocation(t,e,Bt.INTERIOR),null;i===Bt.EXTERIOR&&this._label.setLocation(t,e,Bt.EXTERIOR)}}}getLabel(){return this._label}computeLabelSides(t){this.computeLabelSide(t,xi.LEFT),this.computeLabelSide(t,xi.RIGHT)}updateIM(t){Yi.updateIM(this._label,t)}computeLabel(t){let e=!1;for(let t=this.iterator();t.hasNext();)t.next().getLabel().isArea()&&(e=!0);this._label=e?new Ti(Bt.NONE,Bt.NONE,Bt.NONE):new Ti(Bt.NONE);for(let i=0;i<2;i++)this.computeLabelOn(i,t),e&&this.computeLabelSides(i)}}class ys extends ur{constructor(){super()}updateIM(t){for(let e=this.iterator();e.hasNext();)e.next().updateIM(t)}insert(t){let e=this._edgeMap.get(t);null===e?(e=new ms(t),this.insertEdgeEnd(t,e)):e.insert(t)}}class vs extends zi{constructor(){super(),vs.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];zi.constructor_.call(this,t,e)}updateIMFromEdges(t){this._edges.updateIM(t)}computeIM(t){t.setAtLeastIfValid(this._label.getLocation(0),this._label.getLocation(1),0)}}class xs extends Wi{constructor(){super()}createNode(t){return new vs(t,new ys)}}class Es{constructor(){Es.constructor_.apply(this,arguments)}static constructor_(){this._nodes=new qi(new xs)}insertEdgeEnds(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this._nodes.add(t)}}getNodeIterator(){return this._nodes.iterator()}copyNodesAndLabels(t,e){for(let i=t.getNodeIterator();i.hasNext();){const t=i.next();this._nodes.addNode(t.getCoordinate()).setLabel(e,t.getLabel().getLocation(e))}}build(t){this.computeIntersectionNodes(t,0),this.copyNodesAndLabels(t,0);const e=(new fs).computeEdgeEnds(t.getEdgeIterator());this.insertEdgeEnds(e)}computeIntersectionNodes(t,e){for(let i=t.getEdgeIterator();i.hasNext();){const t=i.next(),n=t.getLabel().getLocation(e);for(let i=t.getEdgeIntersectionList().iterator();i.hasNext();){const t=i.next(),r=this._nodes.addNode(t.coord);n===Bt.BOUNDARY?r.setLabelBoundary(e):r.getLabel().isNull(e)&&r.setLabel(e,Bt.INTERIOR)}}}}class Is{constructor(){Is.constructor_.apply(this,arguments)}static constructor_(){this._li=new kt,this._geomGraph=null,this._nodeGraph=new Es,this._invalidPoint=null;const t=arguments[0];this._geomGraph=t}isNodeEdgeAreaLabelsConsistent(){for(let t=this._nodeGraph.getNodeIterator();t.hasNext();){const e=t.next();if(!e.getEdges().isAreaLabelsConsistent(this._geomGraph))return this._invalidPoint=e.getCoordinate().copy(),!1}return!0}getInvalidPoint(){return this._invalidPoint}hasDuplicateRings(){for(let t=this._nodeGraph.getNodeIterator();t.hasNext();)for(let e=t.next().getEdges().iterator();e.hasNext();){const t=e.next();if(t.getEdgeEnds().size()>1)return this._invalidPoint=t.getEdge().getCoordinate(0),!0}return!1}isNodeConsistentArea(){const t=this._geomGraph.computeSelfNodes(this._li,!0,!0);return t.hasProperIntersection()?(this._invalidPoint=t.getProperIntersectionPoint(),!1):(this._nodeGraph.build(this._geomGraph),this.isNodeEdgeAreaLabelsConsistent())}}class Cs{constructor(){Cs.constructor_.apply(this,arguments)}static constructor_(){this._graph=null,this._rings=new C,this._totalEnv=new L,this._index=null,this._nestedPt=null;const t=arguments[0];this._graph=t}buildIndex(){this._index=new xn;for(let t=0;t=1&&(e=t.getCoordinateN(0)),this._validErr=new ws(ws.RING_NOT_CLOSED,e)}}checkShellsNotNested(t,e){for(let i=0;i=0;e--)i.add(t[e],!1)}static findEdgeRingContaining(t,e){const i=t.getRing(),n=i.getEnvelopeInternal();let r=i.getCoordinateN(0),s=null,o=null;for(let t=e.iterator();t.hasNext();){const e=t.next(),a=e.getRing().getEnvelopeInternal();a.equals(n)||a.contains(n)&&(r=gt.ptNotInList(i.getCoordinates(),e.getCoordinates()),e.isInRing(r)&&(null===s||o.contains(a))&&(s=e,o=s.getRing().getEnvelopeInternal()))}return s}isIncluded(){return this._isIncluded}getCoordinates(){if(null===this._ringPts){const t=new S;for(let e=this._deList.iterator();e.hasNext();){const i=e.next(),n=i.getEdge();Ts.addEdge(n.getLine().getCoordinates(),i.getEdgeDirection(),t)}this._ringPts=t.toCoordinateArray()}return this._ringPts}isIncludedSet(){return this._isIncludedSet}isValid(){return this.getCoordinates(),!(this._ringPts.length<=3)&&(this.getRing(),Ss.isValid(this._ring))}build(t){let e=t;do{this.add(e),e.setRing(this),e=e.getNext(),d.isTrue(null!==e,"found null DE in ring"),d.isTrue(e===t||!e.isInRing(),"found DE already in ring")}while(e!==t)}isInRing(t){return Bt.EXTERIOR!==this.getLocator().locate(t)}isOuterHole(){return!!this._isHole&&!this.hasShell()}getPolygon(){let t=null;if(null!==this._holes){t=new Array(this._holes.size()).fill(null);for(let e=0;e=0)continue;e.add(t);const r=Ts.findDirEdgesInRing(t);Ls.label(r,i),i++}return e}static getDegreeNonDeleted(t){let e=0;for(let i=t.getOutEdges().getEdges().iterator();i.hasNext();)i.next().isMarked()||e++;return e}static deleteAllEdges(t){for(let e=t.getOutEdges().getEdges().iterator();e.hasNext();){const t=e.next();t.setMarked(!0);const i=t.getSym();null!==i&&i.setMarked(!0)}}static label(t,e){for(let i=t.iterator();i.hasNext();)i.next().setLabel(e)}static computeNextCWEdges(t){let e=null,i=null;for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();){const t=n.next();t.isMarked()||(null===e&&(e=t),null!==i&&i.getSym().setNext(t),i=t)}null!==i&&i.getSym().setNext(e)}static computeNextCCWEdges(t,e){let i=null,n=null;const r=t.getOutEdges().getEdges();for(let t=r.size()-1;t>=0;t--){const s=r.get(t),o=s.getSym();let a=null;s.getLabel()===e&&(a=s);let l=null;o.getLabel()===e&&(l=o),null===a&&null===l||(null!==l&&(n=l),null!==a&&(null!==n&&(n.setNext(a),n=null),null===i&&(i=a)))}null!==n&&(d.isTrue(null!==i),n.setNext(i))}static getDegree(t,e){let i=0;for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();)n.next().getLabel()===e&&i++;return i}static findIntersectionNodes(t,e){let i=t,n=null;do{const r=i.getFromNode();Ls.getDegree(r,e)>1&&(null===n&&(n=new C),n.add(r)),i=i.getNext(),d.isTrue(null!==i,"found null DE in ring"),d.isTrue(i===t||!i.isInRing(),"found DE already in ring")}while(i!==t);return n}findEdgeRing(t){const e=new Ts(this._factory);return e.build(t),e}computeDepthParity(){if(0===arguments.length)for(;;)return null}computeNextCWEdges(){for(let t=this.nodeIterator();t.hasNext();){const e=t.next();Ls.computeNextCWEdges(e)}}addEdge(t){if(t.isEmpty())return null;const e=gt.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return null;const i=e[0],n=e[e.length-1],r=this.getNode(i),s=this.getNode(n),o=new gs(r,s,e[1],!0),a=new gs(s,r,e[e.length-2],!1),l=new _s(t);l.setDirectedEdges(o,a),this.add(l)}deleteCutEdges(){this.computeNextCWEdges(),Ls.findLabeledEdgeRings(this._dirEdges);const t=new C;for(let e=this._dirEdges.iterator();e.hasNext();){const i=e.next();if(i.isMarked())continue;const n=i.getSym();if(i.getLabel()===n.getLabel()){i.setMarked(!0),n.setMarked(!0);const e=i.getEdge();t.add(e.getLine())}}return t}getEdgeRings(){this.computeNextCWEdges(),Ls.label(this._dirEdges,-1);const t=Ls.findLabeledEdgeRings(this._dirEdges);this.convertMaximalToMinimalEdgeRings(t);const e=new C;for(let t=this._dirEdges.iterator();t.hasNext();){const i=t.next();if(i.isMarked())continue;if(i.isInRing())continue;const n=this.findEdgeRing(i);e.add(n)}return e}getNode(t){let e=this.findNode(t);return null===e&&(e=new kr(t),this.add(e)),e}convertMaximalToMinimalEdgeRings(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),i=t.getLabel(),n=Ls.findIntersectionNodes(t,i);if(null!==n)for(let t=n.iterator();t.hasNext();){const e=t.next();Ls.computeNextCCWEdges(e,i)}}}deleteDangles(){const t=this.findNodesOfDegree(1),e=new vt,i=new Xe;for(let e=t.iterator();e.hasNext();)i.push(e.next());for(;!i.isEmpty();){const t=i.pop();Ls.deleteAllEdges(t);for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();){const t=n.next();t.setMarked(!0);const r=t.getSym();null!==r&&r.setMarked(!0);const s=t.getEdge();e.add(s.getLine());const o=t.getToNode();1===Ls.getDegreeNonDeleted(o)&&i.push(o)}}return e}}class Ns{constructor(){Ns.constructor_.apply(this,arguments)}static constructor_(){this._shells=null,this._shellIndex=null;const t=arguments[0];this._shells=t,this.buildIndex()}static assignHolesToShells(t,e){new Ns(e).assignHolesToShells(t)}assignHolesToShells(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.assignHoleToShell(t)}}buildIndex(){this._shellIndex=new xn;for(const t of this._shells)this._shellIndex.insert(t.getRing().getEnvelopeInternal(),t)}queryOverlappingShells(t){return this._shellIndex.query(t)}findShellContaining(t){const e=t.getRing().getEnvelopeInternal(),i=this.queryOverlappingShells(e);return Ts.findEdgeRingContaining(t,i)}assignHoleToShell(t){const e=this.findShellContaining(t);null!==e&&e.addHole(t)}}class Os{constructor(){Os.constructor_.apply(this,arguments)}static constructor_(){if(this._lineStringAdder=new Rs(this),this._graph=null,this._dangles=new C,this._cutEdges=new C,this._invalidRingLines=new C,this._holeList=null,this._shellList=null,this._polyList=null,this._isCheckingRingsValid=!0,this._extractOnlyPolygonal=null,this._geomFactory=null,0===arguments.length)Os.constructor_.call(this,!1);else if(1===arguments.length){const t=arguments[0];this._extractOnlyPolygonal=t}}static extractPolygons(t,e){const i=new C;for(let n=t.iterator();n.hasNext();){const t=n.next();(e||t.isIncluded())&&i.add(t.getPolygon())}return i}static findOuterShells(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),i=t.getOuterHole();null===i||i.isProcessed()||(t.setIncluded(!0),i.setProcessed(!0))}}static findDisjointShells(t){Os.findOuterShells(t);let e=null;do{e=!1;for(let i=t.iterator();i.hasNext();){const t=i.next();t.isIncludedSet()||(t.updateIncluded(),t.isIncludedSet()||(e=!0))}}while(e)}getGeometry(){return null===this._geomFactory&&(this._geomFactory=new St),this.polygonize(),this._extractOnlyPolygonal?this._geomFactory.buildGeometry(this._polyList):this._geomFactory.createGeometryCollection(St.toGeometryArray(this._polyList))}getInvalidRingLines(){return this.polygonize(),this._invalidRingLines}findValidRings(t,e,i){for(let n=t.iterator();n.hasNext();){const t=n.next();t.isValid()?e.add(t):i.add(t.getLineString())}}polygonize(){if(null!==this._polyList)return null;if(this._polyList=new C,null===this._graph)return null;this._dangles=this._graph.deleteDangles(),this._cutEdges=this._graph.deleteCutEdges();const t=this._graph.getEdgeRings();let e=new C;this._invalidRingLines=new C,this._isCheckingRingsValid?this.findValidRings(t,e,this._invalidRingLines):e=t,this.findShellsAndHoles(e),Ns.assignHolesToShells(this._holeList,this._shellList),le.sort(this._shellList,new Ts.EnvelopeComparator);let i=!0;this._extractOnlyPolygonal&&(Os.findDisjointShells(this._shellList),i=!1),this._polyList=Os.extractPolygons(this._shellList,i)}getDangles(){return this.polygonize(),this._dangles}getCutEdges(){return this.polygonize(),this._cutEdges}getPolygons(){return this.polygonize(),this._polyList}add(){if(y(arguments[0],v))for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.add(e)}else if(arguments[0]instanceof Z){const t=arguments[0];this._geomFactory=t.getFactory(),null===this._graph&&(this._graph=new Ls(this._geomFactory)),this._graph.addEdge(t)}else arguments[0]instanceof Y&&arguments[0].apply(this._lineStringAdder)}setCheckRingsValid(t){this._isCheckingRingsValid=t}findShellsAndHoles(t){this._holeList=new C,this._shellList=new C;for(let e=t.iterator();e.hasNext();){const t=e.next();t.computeHole(),t.isHole()?this._holeList.add(t):this._shellList.add(t)}}}class Rs{constructor(){Rs.constructor_.apply(this,arguments)}static constructor_(){this.p=null;const t=arguments[0];this.p=t}filter(t){t instanceof Z&&this.p.add(t)}get interfaces_(){return[B]}}Os.LineStringAdder=Rs;var Ps=Object.freeze({__proto__:null,Polygonizer:Os});class bs{constructor(){bs.constructor_.apply(this,arguments)}static constructor_(){this._li=new kt,this._ptLocator=new si,this._arg=null,this._nodes=new qi(new xs),this._im=null,this._isolatedEdges=new C,this._invalidPoint=null;const t=arguments[0];this._arg=t}insertEdgeEnds(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this._nodes.add(t)}}computeProperIntersectionIM(t,e){const i=this._arg[0].getGeometry().getDimension(),n=this._arg[1].getGeometry().getDimension(),r=t.hasProperIntersection(),s=t.hasProperInteriorIntersection();2===i&&2===n?r&&e.setAtLeast("212101212"):2===i&&1===n?(r&&e.setAtLeast("FFF0FFFF2"),s&&e.setAtLeast("1FFFFF1FF")):1===i&&2===n?(r&&e.setAtLeast("F0FFFFFF2"),s&&e.setAtLeast("1F1FFFFFF")):1===i&&1===n&&s&&e.setAtLeast("0FFFFFFFF")}labelIsolatedEdges(t,e){for(let i=this._arg[t].getEdgeIterator();i.hasNext();){const t=i.next();t.isIsolated()&&(this.labelIsolatedEdge(t,e,this._arg[e].getGeometry()),this._isolatedEdges.add(t))}}labelIsolatedEdge(t,e,i){if(i.getDimension()>0){const n=this._ptLocator.locate(t.getCoordinate(),i);t.getLabel().setAllLocations(e,n)}else t.getLabel().setAllLocations(e,Bt.EXTERIOR)}computeIM(){const t=new Yt;if(t.set(Bt.EXTERIOR,Bt.EXTERIOR,2),!this._arg[0].getGeometry().getEnvelopeInternal().intersects(this._arg[1].getGeometry().getEnvelopeInternal()))return this.computeDisjointIM(t),t;this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1);const e=this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!1);this.computeIntersectionNodes(0),this.computeIntersectionNodes(1),this.copyNodesAndLabels(0),this.copyNodesAndLabels(1),this.labelIsolatedNodes(),this.computeProperIntersectionIM(e,t);const i=new fs,n=i.computeEdgeEnds(this._arg[0].getEdgeIterator());this.insertEdgeEnds(n);const r=i.computeEdgeEnds(this._arg[1].getEdgeIterator());return this.insertEdgeEnds(r),this.labelNodeEdges(),this.labelIsolatedEdges(0,1),this.labelIsolatedEdges(1,0),this.updateIM(t),t}labelNodeEdges(){for(let t=this._nodes.iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg)}copyNodesAndLabels(t){for(let e=this._arg[t].getNodeIterator();e.hasNext();){const i=e.next();this._nodes.addNode(i.getCoordinate()).setLabel(t,i.getLabel().getLocation(t))}}labelIntersectionNodes(t){for(let e=this._arg[t].getEdgeIterator();e.hasNext();){const i=e.next(),n=i.getLabel().getLocation(t);for(let e=i.getEdgeIntersectionList().iterator();e.hasNext();){const i=e.next(),r=this._nodes.find(i.coord);r.getLabel().isNull(t)&&(n===Bt.BOUNDARY?r.setLabelBoundary(t):r.setLabel(t,Bt.INTERIOR))}}}labelIsolatedNode(t,e){const i=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setAllLocations(e,i)}computeIntersectionNodes(t){for(let e=this._arg[t].getEdgeIterator();e.hasNext();){const i=e.next(),n=i.getLabel().getLocation(t);for(let e=i.getEdgeIntersectionList().iterator();e.hasNext();){const i=e.next(),r=this._nodes.addNode(i.coord);n===Bt.BOUNDARY?r.setLabelBoundary(t):r.getLabel().isNull(t)&&r.setLabel(t,Bt.INTERIOR)}}}labelIsolatedNodes(){for(let t=this._nodes.iterator();t.hasNext();){const e=t.next(),i=e.getLabel();d.isTrue(i.getGeometryCount()>0,"node with empty label found"),e.isIsolated()&&(i.isNull(0)?this.labelIsolatedNode(e,0):this.labelIsolatedNode(e,1))}}updateIM(t){for(let e=this._isolatedEdges.iterator();e.hasNext();)e.next().updateIM(t);for(let e=this._nodes.iterator();e.hasNext();){const i=e.next();i.updateIM(t),i.updateIMFromEdges(t)}}computeDisjointIM(t){const e=this._arg[0].getGeometry();e.isEmpty()||(t.set(Bt.INTERIOR,Bt.EXTERIOR,e.getDimension()),t.set(Bt.BOUNDARY,Bt.EXTERIOR,e.getBoundaryDimension()));const i=this._arg[1].getGeometry();i.isEmpty()||(t.set(Bt.EXTERIOR,Bt.INTERIOR,i.getDimension()),t.set(Bt.EXTERIOR,Bt.BOUNDARY,i.getBoundaryDimension()))}}class Ms{constructor(){Ms.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null;const t=arguments[0];this._rectEnv=t.getEnvelopeInternal()}static contains(t,e){return new Ms(t).contains(e)}isContainedInBoundary(t){if(t instanceof et)return!1;if(t instanceof J)return this.isPointContainedInBoundary(t);if(t instanceof Z)return this.isLineStringContainedInBoundary(t);for(let e=0;e0){const i=t;t=e,e=i}let n=!1;return e.y>t.y&&(n=!0),n?this._li.computeIntersection(t,e,this._diagDown0,this._diagDown1):this._li.computeIntersection(t,e,this._diagUp0,this._diagUp1),!!this._li.hasIntersection()}}class Fs{constructor(){Fs.constructor_.apply(this,arguments)}static constructor_(){this._rectangle=null,this._rectEnv=null;const t=arguments[0];this._rectangle=t,this._rectEnv=t.getEnvelopeInternal()}static intersects(t,e){return new Fs(t).intersects(e)}intersects(t){if(!this._rectEnv.intersects(t.getEnvelopeInternal()))return!1;const e=new Ds(this._rectEnv);if(e.applyTo(t),e.intersects())return!0;const i=new Gs(this._rectangle);if(i.applyTo(t),i.containsPoint())return!0;const n=new ks(this._rectangle);return n.applyTo(t),!!n.intersects()}}class Ds extends ue{constructor(){super(),Ds.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null,this._intersects=!1;const t=arguments[0];this._rectEnv=t}isDone(){return!0===this._intersects}visit(t){const e=t.getEnvelopeInternal();return this._rectEnv.intersects(e)?this._rectEnv.contains(e)||e.getMinX()>=this._rectEnv.getMinX()&&e.getMaxX()<=this._rectEnv.getMaxX()||e.getMinY()>=this._rectEnv.getMinY()&&e.getMaxY()<=this._rectEnv.getMaxY()?(this._intersects=!0,null):void 0:null}intersects(){return this._intersects}}class Gs extends ue{constructor(){super(),Gs.constructor_.apply(this,arguments)}static constructor_(){this._rectSeq=null,this._rectEnv=null,this._containsPoint=!1;const t=arguments[0];this._rectSeq=t.getExteriorRing().getCoordinateSequence(),this._rectEnv=t.getEnvelopeInternal()}isDone(){return!0===this._containsPoint}visit(t){if(!(t instanceof et))return null;const e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;const i=new f;for(let n=0;n<4;n++)if(this._rectSeq.getCoordinate(n,i),e.contains(i)&&Ge.containsPointInPolygon(i,t))return this._containsPoint=!0,null}containsPoint(){return this._containsPoint}}class ks extends ue{constructor(){super(),ks.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null,this._rectIntersector=null,this._hasIntersection=!1,this._p0=new f,this._p1=new f;const t=arguments[0];this._rectEnv=t.getEnvelopeInternal(),this._rectIntersector=new As(this._rectEnv)}intersects(){return this._hasIntersection}isDone(){return!0===this._hasIntersection}visit(t){const e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;const i=ae.getLines(t);this.checkIntersectionWithLineStrings(i)}checkIntersectionWithLineStrings(t){for(let e=t.iterator();e.hasNext();){const t=e.next();if(this.checkIntersectionWithSegments(t),this._hasIntersection)return null}}checkIntersectionWithSegments(t){const e=t.getCoordinateSequence();for(let t=1;t0)&&!!t.getEnvelopeInternal().covers(e.getEnvelopeInternal())&&(!!t.isRectangle()||new Vs(t,e).getIntersectionMatrix().isCovers())}static intersects(t,e){if(!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal()))return!1;if(t.isRectangle())return Fs.intersects(t,e);if(e.isRectangle())return Fs.intersects(e,t);if(t.isGeometryCollection()||e.isGeometryCollection()){for(let i=0;i0)&&!!t.getEnvelopeInternal().contains(e.getEnvelopeInternal())&&(t.isRectangle()?Ms.contains(t,e):new Vs(t,e).getIntersectionMatrix().isContains())}getIntersectionMatrix(){return this._relate.computeIM()}}var Bs=Object.freeze({__proto__:null,RelateOp:Vs});class Ys{constructor(){Ys.constructor_.apply(this,arguments)}static constructor_(){this._pointGeom=null,this._otherGeom=null,this._geomFact=null;const t=arguments[0],e=arguments[1];this._pointGeom=t,this._otherGeom=e,this._geomFact=e.getFactory()}static union(t,e){return new Ys(t,e).union()}union(){const t=new si,e=new rt;for(let i=0;ithis._dimension&&(this._dimension=t)}getDimension(){return this._dimension}filter(t){return this.recordDimension(t.getDimension()),t instanceof ot||t.isEmpty()?null:t instanceof et?(this._polygons.add(t),null):t instanceof Z?(this._lines.add(t),null):t instanceof J?(this._points.add(t),null):void d.shouldNeverReachHere("Unhandled geometry type: "+t.getGeometryType())}getExtract(t){switch(t){case 0:return this._points;case 1:return this._lines;case 2:return this._polygons}return d.shouldNeverReachHere("Invalid dimension: "+t),null}isEmpty(){return this._polygons.isEmpty()&&this._lines.isEmpty()&&this._points.isEmpty()}add(){if(y(arguments[0],v)){const t=arguments[0];for(const e of t)this.add(e)}else if(arguments[0]instanceof Y){const t=arguments[0];null===this._geomFactory&&(this._geomFactory=t.getFactory()),t.apply(this)}}get interfaces_(){return[H]}}class qs{constructor(){qs.constructor_.apply(this,arguments)}static constructor_(){this._geomFactory=null,this._g0=null,this._g1=null,this._isUnionSafe=null;const t=arguments[0],e=arguments[1];this._g0=t,this._g1=e,this._geomFactory=t.getFactory()}static containsProperly(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return!t.isNull()&&e.getX()>t.getMinX()&&e.getX()t.getMinY()&&e.getY()=t.size()?null:t.get(e)}static union(t){return new Xs(t).union()}reduceToGeometries(t){const e=new C;for(let i=t.iterator();i.hasNext();){const t=i.next();let n=null;y(t,E)?n=this.unionTree(t):t instanceof Y&&(n=t),e.add(n)}return e}union(){if(null===this._inputPolys)throw new IllegalStateException("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();const t=new xn(Xs.STRTREE_NODE_CAPACITY);for(let e=this._inputPolys.iterator();e.hasNext();){const i=e.next();t.insert(i.getEnvelopeInternal(),i)}this._inputPolys=null;const e=t.itemsTree();return this.unionTree(e)}binaryUnion(){if(1===arguments.length){const t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];if(i-e<=1){const i=Xs.getGeometry(t,e);return this.unionSafe(i,null)}if(i-e==2)return this.unionSafe(Xs.getGeometry(t,e),Xs.getGeometry(t,e+1));{const n=Math.trunc((i+e)/2),r=this.binaryUnion(t,e,n),s=this.binaryUnion(t,n,i);return this.unionSafe(r,s)}}}repeatedUnion(t){let e=null;for(let i=t.iterator();i.hasNext();){const t=i.next();e=null===e?t.copy():e.union(t)}return e}unionSafe(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionActual(t,e)}unionActual(t,e){const i=qs.union(t,e);return Xs.restrictToPolygons(i)}unionTree(t){const e=this.reduceToGeometries(t);return this.binaryUnion(e)}bufferUnion(){if(1===arguments.length){const t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t.getFactory().createGeometryCollection([t,e]).buffer(0)}}}Xs.STRTREE_NODE_CAPACITY=4;class js{constructor(){js.constructor_.apply(this,arguments)}static constructor_(){if(this._geomFact=null,this._extracter=null,1===arguments.length){if(y(arguments[0],v)){const t=arguments[0];this.extract(t)}else if(arguments[0]instanceof Y){const t=arguments[0];this.extract(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._geomFact=e,this.extract(t)}}static union(){if(1===arguments.length){if(y(arguments[0],v))return new js(arguments[0]).union();if(arguments[0]instanceof Y)return new js(arguments[0]).union()}else if(2===arguments.length)return new js(arguments[0],arguments[1]).union()}unionNoOpt(t){const e=this._geomFact.createPoint();return hs.overlayOp(t,e,us.UNION)}unionWithNull(t,e){return null===t&&null===e?null:null===e?t:null===t?e:t.union(e)}extract(){if(y(arguments[0],v)){const t=arguments[0];this._extracter=zs.extract(t)}else if(arguments[0]instanceof Y){const t=arguments[0];this._extracter=zs.extract(t)}}union(){if(null===this._geomFact&&(this._geomFact=this._extracter.getFactory()),null===this._geomFact)return null;if(this._extracter.isEmpty())return this._geomFact.createEmpty(this._extracter.getDimension());const t=this._extracter.getExtract(0),e=this._extracter.getExtract(1),i=this._extracter.getExtract(2);let n=null;if(t.size()>0){const e=this._geomFact.buildGeometry(t);n=this.unionNoOpt(e)}let r=null;if(e.size()>0){const t=this._geomFact.buildGeometry(e);r=this.unionNoOpt(t)}let s=null;i.size()>0&&(s=Xs.union(i));const o=this.unionWithNull(r,s);let a=null;return a=null===n?o:null===o?n:Ys.union(n,o),null===a?this._geomFact.createGeometryCollection():a}}var Us=Object.freeze({__proto__:null,UnaryUnionOp:js}),Ws=Object.freeze({__proto__:null,IsValidOp:Ss,ConsistentAreaTester:Is}),Hs=Object.freeze({__proto__:null,BoundaryOp:Un,IsSimpleOp:Hn,buffer:Lr,distance:Pr,linemerge:Wr,overlay:ds,polygonize:Ps,relate:Bs,union:Us,valid:Ws});class Zs extends te.CoordinateOperation{constructor(){super(),Zs.constructor_.apply(this,arguments)}static constructor_(){this._targetPM=null,this._removeCollapsed=!0;const t=arguments[0],e=arguments[1];this._targetPM=t,this._removeCollapsed=e}edit(){if(2===arguments.length&&arguments[1]instanceof Y&&arguments[0]instanceof Array){const t=arguments[0],e=arguments[1];if(0===t.length)return null;const i=new Array(t.length).fill(null);for(let e=0;e=2&&(i=!0),e.edit(t,new Zs(this._targetPM,i))}changePM(t,e){return this.createEditor(t.getFactory(),e).edit(t,new te.NoOpGeometryOperation)}setRemoveCollapsedComponents(t){this._removeCollapsed=t}createFactory(t,e){return new St(e,t.getSRID(),t.getCoordinateSequenceFactory())}setChangePrecisionModel(t){this._changePrecisionModel=t}reduce(t){const e=this.reducePointwise(t);return this._isPointwise?e:y(e,tt)?Ss.isValid(e)?e:this.fixPolygonalTopology(e):e}setPointwise(t){this._isPointwise=t}createEditor(t,e){if(t.getPrecisionModel()===e)return new te;const i=this.createFactory(t,e);return new te(i)}}var Js=Object.freeze({__proto__:null,GeometryPrecisionReducer:Ks});class $s{constructor(){$s.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._usePt=null,this._distanceTolerance=null,this._seg=new Vt;const t=arguments[0];this._pts=t}static simplify(t,e){const i=new $s(t);return i.setDistanceTolerance(e),i.simplify()}simplifySection(t,e){if(t+1===e)return null;this._seg.p0=this._pts[t],this._seg.p1=this._pts[e];let i=-1,n=t;for(let r=t+1;ri&&(i=t,n=r)}if(i<=this._distanceTolerance)for(let i=t+1;i=e[0]&&nthis._distanceTolerance&&(r=!1);const a=new Vt;if(a.p0=this._linePts[t],a.p1=this._linePts[e],n[0]=t,n[1]=e,this.hasBadIntersection(this._line,n,a)&&(r=!1),r){const i=this.flatten(t,e);return this._line.addToResult(i),null}this.simplifySection(t,o,i),this.simplifySection(o,e,i)}hasBadOutputIntersection(t){for(let e=this._outputIndex.query(t).iterator();e.hasNext();){const i=e.next();if(this.hasInteriorIntersection(i,t))return!0}return!1}findFurthestPoint(t,e,i,n){const r=new Vt;r.p0=t[e],r.p1=t[i];let s=-1,o=e;for(let n=e+1;ns&&(s=i,o=n)}return n[0]=s,o}simplify(t){this._line=t,this._linePts=t.getParentCoordinates(),this.simplifySection(0,this._linePts.length-1,0)}remove(t,e,i){for(let n=e;nn&&(o=n),r.setMinimumLength(o),r.splitAt(s),r.getSplitPoint()}get interfaces_(){return[mo]}}class vo{static triArea(t,e,i){return(e.x-t.x)*(i.y-t.y)-(e.y-t.y)*(i.x-t.x)}static isInCircleDDNormalized(t,e,i,n){const r=P.valueOf(t.x).selfSubtract(n.x),s=P.valueOf(t.y).selfSubtract(n.y),o=P.valueOf(e.x).selfSubtract(n.x),a=P.valueOf(e.y).selfSubtract(n.y),l=P.valueOf(i.x).selfSubtract(n.x),h=P.valueOf(i.y).selfSubtract(n.y),c=r.multiply(a).selfSubtract(o.multiply(s)),u=o.multiply(h).selfSubtract(l.multiply(a)),d=l.multiply(s).selfSubtract(r.multiply(h)),g=r.multiply(r).selfAdd(s.multiply(s)),_=o.multiply(o).selfAdd(a.multiply(a)),p=l.multiply(l).selfAdd(h.multiply(h));return g.selfMultiply(u).selfAdd(_.selfMultiply(d)).selfAdd(p.selfMultiply(c)).doubleValue()>0}static checkRobustInCircle(t,e,i,n){const r=vo.isInCircleNonRobust(t,e,i,n),s=vo.isInCircleDDSlow(t,e,i,n),o=vo.isInCircleCC(t,e,i,n),a=jt.circumcentre(t,e,i);D.out.println("p radius diff a = "+Math.abs(n.distance(a)-t.distance(a))/t.distance(a)),r===s&&r===o||(D.out.println("inCircle robustness failure (double result = "+r+", DD result = "+s+", CC result = "+o+")"),D.out.println(Dt.toLineString(new pt([t,e,i,n]))),D.out.println("Circumcentre = "+Dt.toPoint(a)+" radius = "+t.distance(a)),D.out.println("p radius diff a = "+Math.abs(n.distance(a)/t.distance(a)-1)),D.out.println("p radius diff b = "+Math.abs(n.distance(a)/e.distance(a)-1)),D.out.println("p radius diff c = "+Math.abs(n.distance(a)/i.distance(a)-1)),D.out.println())}static isInCircleDDFast(t,e,i,n){const r=P.sqr(t.x).selfAdd(P.sqr(t.y)).selfMultiply(vo.triAreaDDFast(e,i,n)),s=P.sqr(e.x).selfAdd(P.sqr(e.y)).selfMultiply(vo.triAreaDDFast(t,i,n)),o=P.sqr(i.x).selfAdd(P.sqr(i.y)).selfMultiply(vo.triAreaDDFast(t,e,n)),a=P.sqr(n.x).selfAdd(P.sqr(n.y)).selfMultiply(vo.triAreaDDFast(t,e,i));return r.selfSubtract(s).selfAdd(o).selfSubtract(a).doubleValue()>0}static isInCircleCC(t,e,i,n){const r=jt.circumcentre(t,e,i),s=t.distance(r);return n.distance(r)-s<=0}static isInCircleNormalized(t,e,i,n){const r=t.x-n.x,s=t.y-n.y,o=e.x-n.x,a=e.y-n.y,l=i.x-n.x,h=i.y-n.y;return(r*r+s*s)*(o*h-l*a)+(o*o+a*a)*(l*s-r*h)+(l*l+h*h)*(r*a-o*s)>0}static isInCircleDDSlow(t,e,i,n){const r=P.valueOf(n.x),s=P.valueOf(n.y),o=P.valueOf(t.x),a=P.valueOf(t.y),l=P.valueOf(e.x),h=P.valueOf(e.y),c=P.valueOf(i.x),u=P.valueOf(i.y),d=o.multiply(o).add(a.multiply(a)).multiply(vo.triAreaDDSlow(l,h,c,u,r,s)),g=l.multiply(l).add(h.multiply(h)).multiply(vo.triAreaDDSlow(o,a,c,u,r,s)),_=c.multiply(c).add(u.multiply(u)).multiply(vo.triAreaDDSlow(o,a,l,h,r,s)),p=r.multiply(r).add(s.multiply(s)).multiply(vo.triAreaDDSlow(o,a,l,h,c,u));return d.subtract(g).add(_).subtract(p).doubleValue()>0}static isInCircleNonRobust(t,e,i,n){return(t.x*t.x+t.y*t.y)*vo.triArea(e,i,n)-(e.x*e.x+e.y*e.y)*vo.triArea(t,i,n)+(i.x*i.x+i.y*i.y)*vo.triArea(t,e,n)-(n.x*n.x+n.y*n.y)*vo.triArea(t,e,i)>0}static isInCircleRobust(t,e,i,n){return vo.isInCircleNormalized(t,e,i,n)}static triAreaDDSlow(t,e,i,n,r,s){return i.subtract(t).multiply(s.subtract(e)).subtract(n.subtract(e).multiply(r.subtract(t)))}static triAreaDDFast(t,e,i){const n=P.valueOf(e.x).selfSubtract(t.x).selfMultiply(P.valueOf(i.y).selfSubtract(t.y)),r=P.valueOf(e.y).selfSubtract(t.y).selfMultiply(P.valueOf(i.x).selfSubtract(t.x));return n.selfSubtract(r)}}class xo{constructor(){xo.constructor_.apply(this,arguments)}static constructor_(){if(this._p=null,1===arguments.length){const t=arguments[0];this._p=new f(t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._p=new f(t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._p=new f(t,e,i)}}static interpolateZ(){if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=e.distance(i),r=t.distance(e),s=i.getZ()-e.getZ();return e.getZ()+s*(r/n)}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=e.x,s=e.y,o=i.x-r,a=n.x-r,l=i.y-s,h=n.y-s,c=o*h-a*l,u=t.x-r,d=t.y-s,g=(h*u-a*d)/c,_=(-l*u+o*d)/c;return e.getZ()+g*(i.getZ()-e.getZ())+_*(n.getZ()-e.getZ())}}circleCenter(t,e){const i=new xo(this.getX(),this.getY()),n=this.bisector(i,t),r=this.bisector(t,e),s=new Xt(n,r);let o=null;try{o=new xo(s.getX(),s.getY())}catch(n){if(!(n instanceof qt))throw n;D.err.println("a: "+i+" b: "+t+" c: "+e),D.err.println(n)}return o}dot(t){return this._p.x*t.getX()+this._p.y*t.getY()}magn(){return Math.sqrt(this._p.x*this._p.x+this._p.y*this._p.y)}getZ(){return this._p.getZ()}bisector(t,e){const i=e.getX()-t.getX(),n=e.getY()-t.getY(),r=new Xt(t.getX()+i/2,t.getY()+n/2,1),s=new Xt(t.getX()-n+i/2,t.getY()+i+n/2,1);return new Xt(r,s)}equals(){if(1===arguments.length){const t=arguments[0];return this._p.x===t.getX()&&this._p.y===t.getY()}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._p.distance(t.getCoordinate())0}getX(){return this._p.x}crossProduct(t){return this._p.x*t.getY()-this._p.y*t.getX()}setZ(t){this._p.setZ(t)}times(t){return new xo(t*this._p.x,t*this._p.y)}cross(){return new xo(this._p.y,-this._p.x)}leftOf(t){return this.isCCW(t.orig(),t.dest())}toString(){return"POINT ("+this._p.x+" "+this._p.y+")"}sub(t){return new xo(this._p.x-t.getX(),this._p.y-t.getY())}getY(){return this._p.y}classify(t,e){const i=e.sub(t),n=this.sub(t),r=i.crossProduct(n);return r>0?xo.LEFT:r<0?xo.RIGHT:i.getX()*n.getX()<0||i.getY()*n.getY()<0?xo.BEHIND:i.magn()0}insertSite(t){let e=this._subdiv.locate(t);if(this._subdiv.isVertexOfEdge(e,t))return e;this._subdiv.isOnEdge(e,t.getCoordinate())&&(e=e.oPrev(),this._subdiv.delete(e.oNext()));let i=this._subdiv.makeEdge(e.orig(),t);Io.splice(i,e);const n=i;do{i=this._subdiv.connect(e,i.sym()),e=i.oPrev()}while(e.lNext()!==n);for(;;){const r=e.oPrev();if(r.dest().rightOf(e)&&t.isInCircle(e.orig(),r.dest(),e.dest()))Io.swap(e),e=e.oPrev();else{if(e.oNext()===n)return i;e=e.oNext().lPrev()}}}insertSites(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.insertSite(t)}}}class wo{locate(t){}}class So{constructor(){So.constructor_.apply(this,arguments)}static constructor_(){this._subdiv=null,this._lastEdge=null;const t=arguments[0];this._subdiv=t,this.init()}init(){this._lastEdge=this.findEdge()}locate(t){this._lastEdge.isLive()||this.init();const e=this._subdiv.locateFromEdge(t,this._lastEdge);return this._lastEdge=e,e}findEdge(){return this._subdiv.getEdges().iterator().next()}get interfaces_(){return[wo]}}class To extends c{constructor(){super(),To.constructor_.apply(this,arguments)}static constructor_(){if(this._seg=null,1===arguments.length){if("string"==typeof arguments[0]){const t=arguments[0];c.constructor_.call(this,t)}else if(arguments[0]instanceof Vt){const t=arguments[0];c.constructor_.call(this,"Locate failed to converge (at edge: "+t+"). Possible causes include invalid Subdivision topology or very close sites"),this._seg=new Vt(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];c.constructor_.call(this,To.msgWithSpatial(t,e)),this._seg=new Vt(e)}}static msgWithSpatial(t,e){return null!==e?t+" [ "+e+" ]":t}getSegment(){return this._seg}}class Lo{visit(t){}}class No{constructor(){No.constructor_.apply(this,arguments)}static constructor_(){this._visitedKey=0,this._quadEdges=new C,this._startingEdge=null,this._tolerance=null,this._edgeCoincidenceTolerance=null,this._frameVertex=new Array(3).fill(null),this._frameEnv=null,this._locator=null,this._seg=new Vt,this._triEdges=new Array(3).fill(null);const t=arguments[0],e=arguments[1];this._tolerance=e,this._edgeCoincidenceTolerance=e/No.EDGE_COINCIDENCE_TOL_FACTOR,this.createFrame(t),this._startingEdge=this.initSubdiv(),this._locator=new So(this)}static getTriangleEdges(t,e){if(e[0]=t,e[1]=e[0].lNext(),e[2]=e[1].lNext(),e[2].lNext()!==e[0])throw new n("Edges do not form a triangle")}getTriangleVertices(t){const e=new Po;return this.visitTriangles(e,t),e.getTriangleVertices()}isFrameVertex(t){return!!t.equals(this._frameVertex[0])||!!t.equals(this._frameVertex[1])||!!t.equals(this._frameVertex[2])}isVertexOfEdge(t,e){return!(!e.equals(t.orig(),this._tolerance)&&!e.equals(t.dest(),this._tolerance))}connect(t,e){const i=Io.connect(t,e);return this._quadEdges.add(i),i}getVoronoiCellPolygon(t,e){const i=new C,n=t;do{const e=t.rot().orig().getCoordinate();i.add(e),t=t.oPrev()}while(t!==n);const r=new S;r.addAll(i,!1),r.closeRing(),r.size()<4&&(D.out.println(r),r.add(r.get(r.size()-1),!0));const s=r.toCoordinateArray(),o=e.createPolygon(e.createLinearRing(s)),a=n.orig();return o.setUserData(a.getCoordinate()),o}setLocator(t){this._locator=t}initSubdiv(){const t=this.makeEdge(this._frameVertex[0],this._frameVertex[1]),e=this.makeEdge(this._frameVertex[1],this._frameVertex[2]);Io.splice(t.sym(),e);const i=this.makeEdge(this._frameVertex[2],this._frameVertex[0]);return Io.splice(e.sym(),i),Io.splice(i.sym(),t),t}isFrameBorderEdge(t){const e=new Array(3).fill(null);No.getTriangleEdges(t,e);const i=new Array(3).fill(null);No.getTriangleEdges(t.sym(),i);const n=t.lNext().dest();if(this.isFrameVertex(n))return!0;const r=t.sym().lNext().dest();return!!this.isFrameVertex(r)}makeEdge(t,e){const i=Io.makeEdge(t,e);return this._quadEdges.add(i),i}visitTriangles(t,e){this._visitedKey++;const i=new Xe;i.push(this._startingEdge);const n=new vt;for(;!i.empty();){const r=i.pop();if(!n.contains(r)){const s=this.fetchTriangleToVisit(r,i,e,n);null!==s&&t.visit(s)}}}isFrameEdge(t){return!(!this.isFrameVertex(t.orig())&&!this.isFrameVertex(t.dest()))}isOnEdge(t,e){return this._seg.setCoordinates(t.orig().getCoordinate(),t.dest().getCoordinate()),this._seg.distance(e)i?10*e:10*i,this._frameVertex[0]=new xo((t.getMaxX()+t.getMinX())/2,t.getMaxY()+n),this._frameVertex[1]=new xo(t.getMinX()-n,t.getMinY()-n),this._frameVertex[2]=new xo(t.getMaxX()+n,t.getMinY()-n),this._frameEnv=new L(this._frameVertex[0].getCoordinate(),this._frameVertex[1].getCoordinate()),this._frameEnv.expandToInclude(this._frameVertex[2].getCoordinate())}getTriangleCoordinates(t){const e=new bo;return this.visitTriangles(e,t),e.getTriangles()}getVertices(t){const e=new vt;for(let i=this._quadEdges.iterator();i.hasNext();){const n=i.next(),r=n.orig();!t&&this.isFrameVertex(r)||e.add(r);const s=n.dest();!t&&this.isFrameVertex(s)||e.add(s)}return e}fetchTriangleToVisit(t,e,i,n){let r=t,s=0,o=!1;do{this._triEdges[s]=r,this.isFrameEdge(r)&&(o=!0);const t=r.sym();n.contains(t)||e.push(t),n.add(r),s++,r=r.lNext()}while(r!==t);return o&&!i?null:this._triEdges}getEdges(){if(0===arguments.length)return this._quadEdges;if(1===arguments.length){const t=arguments[0],e=this.getPrimaryEdges(!1),i=new Array(e.size()).fill(null);let n=0;for(let r=e.iterator();r.hasNext();){const e=r.next();i[n++]=t.createLineString([e.orig().getCoordinate(),e.dest().getCoordinate()])}return t.createMultiLineString(i)}}getVertexUniqueEdges(t){const e=new C,i=new vt;for(let n=this._quadEdges.iterator();n.hasNext();){const r=n.next(),s=r.orig();i.contains(s)||(i.add(s),!t&&this.isFrameVertex(s)||e.add(r));const o=r.sym(),a=o.orig();i.contains(a)||(i.add(a),!t&&this.isFrameVertex(a)||e.add(o))}return e}getTriangleEdges(t){const e=new Ro;return this.visitTriangles(e,t),e.getTriangleEdges()}getPrimaryEdges(t){this._visitedKey++;const e=new C,i=new Xe;i.push(this._startingEdge);const n=new vt;for(;!i.empty();){const r=i.pop();if(!n.contains(r)){const s=r.getPrimary();!t&&this.isFrameEdge(s)||e.add(s),i.push(r.oNext()),i.push(r.sym().oNext()),n.add(r),n.add(r.sym())}}return e}delete(t){Io.splice(t,t.oPrev()),Io.splice(t.sym(),t.sym().oPrev());const e=t.sym(),i=t.rot(),n=t.rot().sym();this._quadEdges.remove(t),this._quadEdges.remove(e),this._quadEdges.remove(i),this._quadEdges.remove(n),t.delete(),e.delete(),i.delete(),n.delete()}locateFromEdge(t,e){let i=0;const n=this._quadEdges.size();let r=e;for(;;){if(i++,i>n)throw new To(r.toLineSegment());if(t.equals(r.orig())||t.equals(r.dest()))break;if(t.rightOf(r))r=r.sym();else if(t.rightOf(r.oNext())){if(t.rightOf(r.dPrev()))break;r=r.dPrev()}else r=r.oNext()}return r}getTolerance(){return this._tolerance}getVoronoiCellPolygons(t){this.visitTriangles(new Oo,!0);const e=new C;for(let i=this.getVertexUniqueEdges(!1).iterator();i.hasNext();){const n=i.next();e.add(this.getVoronoiCellPolygon(n,t))}return e}getVoronoiDiagram(t){const e=this.getVoronoiCellPolygons(t);return t.createGeometryCollection(St.toGeometryArray(e))}getTriangles(t){const e=this.getTriangleCoordinates(!1),i=new Array(e.size()).fill(null);let n=0;for(let r=e.iterator();r.hasNext();){const e=r.next();i[n++]=t.createPolygon(t.createLinearRing(e))}return t.createGeometryCollection(i)}insertSite(t){let e=this.locate(t);if(t.equals(e.orig(),this._tolerance)||t.equals(e.dest(),this._tolerance))return e;let i=this.makeEdge(e.orig(),t);Io.splice(i,e);const n=i;do{i=this.connect(e,i.sym()),e=i.oPrev()}while(e.lNext()!==n);return n}locate(){if(1===arguments.length){if(arguments[0]instanceof xo){const t=arguments[0];return this._locator.locate(t)}if(arguments[0]instanceof f){const t=arguments[0];return this._locator.locate(new xo(t))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1],i=this._locator.locate(new xo(t));if(null===i)return null;let n=i;i.dest().getCoordinate().equals2D(t)&&(n=i.sym());let r=n;do{if(r.dest().getCoordinate().equals2D(e))return r;r=r.oNext()}while(r!==n);return null}}}class Oo{visit(t){const e=t[0].orig().getCoordinate(),i=t[1].orig().getCoordinate(),n=t[2].orig().getCoordinate(),r=jt.circumcentreDD(e,i,n),s=new xo(r);for(let e=0;e<3;e++)t[e].rot().setOrig(s)}get interfaces_(){return[Lo]}}class Ro{constructor(){Ro.constructor_.apply(this,arguments)}static constructor_(){this._triList=new C}getTriangleEdges(){return this._triList}visit(t){this._triList.add(t)}get interfaces_(){return[Lo]}}class Po{constructor(){Po.constructor_.apply(this,arguments)}static constructor_(){this._triList=new C}visit(t){this._triList.add([t[0].orig(),t[1].orig(),t[2].orig()])}getTriangleVertices(){return this._triList}get interfaces_(){return[Lo]}}class bo{constructor(){bo.constructor_.apply(this,arguments)}static constructor_(){this._coordList=new S,this._triCoords=new C}checkTriangleSize(t){let e="";t.length>=2?e=Dt.toLineString(t[0],t[1]):t.length>=1&&(e=Dt.toPoint(t[0]))}visit(t){this._coordList.clear();for(let e=0;e<3;e++){const i=t[e].orig();this._coordList.add(i.getCoordinate())}if(this._coordList.size()>0){this._coordList.closeRing();const t=this._coordList.toCoordinateArray();if(4!==t.length)return null;this._triCoords.add(t)}}getTriangles(){return this._triCoords}get interfaces_(){return[Lo]}}No.TriangleCircumcentreVisitor=Oo,No.TriangleEdgesListVisitor=Ro,No.TriangleVertexListVisitor=Po,No.TriangleCoordinatesVisitor=bo,No.EDGE_COINCIDENCE_TOL_FACTOR=1e3;class Mo{constructor(){Mo.constructor_.apply(this,arguments)}static constructor_(){if(this._ls=null,this._data=null,2===arguments.length){const t=arguments[0],e=arguments[1];this._ls=new Vt(t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._ls=new Vt(t,e),this._data=i}else if(6===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[4],s=arguments[5];Mo.constructor_.call(this,new f(t,e,i),new f(n,r,s))}else if(7===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[4],s=arguments[5],o=arguments[6];Mo.constructor_.call(this,new f(t,e,i),new f(n,r,s),o)}}getLineSegment(){return this._ls}getEndZ(){return this._ls.getCoordinate(1).getZ()}getStartZ(){return this._ls.getCoordinate(0).getZ()}intersection(t){return this._ls.intersection(t.getLineSegment())}getStart(){return this._ls.getCoordinate(0)}getEnd(){return this._ls.getCoordinate(1)}getEndY(){return this._ls.getCoordinate(1).y}getStartX(){return this._ls.getCoordinate(0).x}equalsTopo(t){return this._ls.equalsTopo(t.getLineSegment())}getStartY(){return this._ls.getCoordinate(0).y}setData(t){this._data=t}getData(){return this._data}getEndX(){return this._ls.getCoordinate(1).x}toString(){return this._ls.toString()}}class Ao extends c{constructor(){super(),Ao.constructor_.apply(this,arguments)}static constructor_(){if(this._pt=null,1===arguments.length){const t=arguments[0];c.constructor_.call(this,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];c.constructor_.call(this,Ao.msgWithCoord(t,e)),this._pt=new f(e)}}static msgWithCoord(t,e){return null!==e?t+" [ "+Dt.toPoint(e)+" ]":t}getCoordinate(){return this._pt}}class Fo{constructor(){Fo.constructor_.apply(this,arguments)}static constructor_(){this._initialVertices=null,this._segVertices=null,this._segments=new C,this._subdiv=null,this._incDel=null,this._convexHull=null,this._splitFinder=new yo,this._kdt=null,this._vertexFactory=null,this._computeAreaEnv=null,this._splitPt=null,this._tolerance=null;const t=arguments[0],e=arguments[1];this._initialVertices=new C(t),this._tolerance=e,this._kdt=new Qi(e)}static computeVertexEnvelope(t){const e=new L;for(let i=t.iterator();i.hasNext();){const t=i.next();e.expandToInclude(t.getCoordinate())}return e}getInitialVertices(){return this._initialVertices}getKDT(){return this._kdt}enforceConstraints(){this.addConstraintVertices();let t=0,e=0;do{e=this.enforceGabriel(this._segments),t++}while(e>0&&t0?t.getSegmentIndex()+1:t.getSegmentIndex()}getComponentIndex(){return this._componentIndex}getLine(){return this._currentLine}getVertexIndex(){return this._vertexIndex}getSegmentEnd(){return this._vertexIndex=this._currentLine.getNumPoints()&&(this._componentIndex++,this.loadCurrentLine(),this._vertexIndex=0)}loadCurrentLine(){if(this._componentIndex>=this._numLines)return this._currentLine=null,null;this._currentLine=this._linearGeom.getGeometryN(this._componentIndex)}getSegmentStart(){return this._currentLine.getCoordinateN(this._vertexIndex)}isEndOfLine(){return!(this._componentIndex>=this._numLines||this._vertexIndex=this._numLines||this._componentIndex===this._numLines-1&&this._vertexIndex>=this._currentLine.getNumPoints())}}class zo{constructor(){zo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indexOf(t,e){return new zo(t).indexOf(e)}static indexOfAfter(t,e,i){return new zo(t).indexOfAfter(e,i)}indexOf(t){return this.indexOfFromStart(t,-1)}indexOfFromStart(t,e){let i=s.MAX_VALUE,n=e,r=0;const o=new Vt,a=new Yo(this._linearGeom);for(;a.hasNext();){if(!a.isEndOfLine()){o.p0=a.getSegmentStart(),o.p1=a.getSegmentEnd();const s=o.distance(t),l=this.segmentNearestMeasure(o,t,r);se&&(n=l,i=s),r+=o.getLength()}a.next()}return n}indexOfAfter(t,e){if(e<0)return this.indexOf(t);const i=this._linearGeom.getLength();if(i=e,"computed index is before specified minimum index"),n}segmentNearestMeasure(t,e,i){const n=t.projectionFactor(e);return n<=0?i:n<=1?i+n*t.getLength():i+t.getLength()}}class qo{constructor(){qo.constructor_.apply(this,arguments)}static constructor_(){if(this._componentIndex=0,this._segmentIndex=0,this._segmentFraction=0,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._componentIndex=t._componentIndex,this._segmentIndex=t._segmentIndex,this._segmentFraction=t._segmentFraction}else if(2===arguments.length){const t=arguments[0],e=arguments[1];qo.constructor_.call(this,0,t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._componentIndex=t,this._segmentIndex=e,this._segmentFraction=i,this.normalize()}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this._componentIndex=t,this._segmentIndex=e,this._segmentFraction=i,n&&this.normalize()}}static getEndLocation(t){const e=new qo;return e.setToEnd(t),e}static pointAlongSegmentByFraction(t,e,i){if(i<=0)return t;if(i>=1)return e;const n=(e.x-t.x)*i+t.x,r=(e.y-t.y)*i+t.y,s=(e.getZ()-t.getZ())*i+t.getZ();return new f(n,r,s)}static compareLocationValues(t,e,i,n,r,s){return tn?1:er?1:is?1:0}static numSegments(t){const e=t.getNumPoints();return e<=1?0:e-1}getSegmentIndex(){return this._segmentIndex}getComponentIndex(){return this._componentIndex}isEndpoint(t){const e=t.getGeometryN(this._componentIndex),i=qo.numSegments(e);return this._segmentIndex>=i||this._segmentIndex===i-1&&this._segmentFraction>=1}isValid(t){if(this._componentIndex<0||this._componentIndex>=t.getNumGeometries())return!1;const e=t.getGeometryN(this._componentIndex);return!(this._segmentIndex<0||this._segmentIndex>e.getNumPoints()||this._segmentIndex===e.getNumPoints()&&0!==this._segmentFraction||this._segmentFraction<0||this._segmentFraction>1)}normalize(){this._segmentFraction<0&&(this._segmentFraction=0),this._segmentFraction>1&&(this._segmentFraction=1),this._componentIndex<0&&(this._componentIndex=0,this._segmentIndex=0,this._segmentFraction=0),this._segmentIndex<0&&(this._segmentIndex=0,this._segmentFraction=0),1===this._segmentFraction&&(this._segmentFraction=0,this._segmentIndex+=1)}toLowest(t){const e=t.getGeometryN(this._componentIndex),i=qo.numSegments(e);return this._segmentIndex=qo.numSegments(e))return i;const n=e.getCoordinateN(this._segmentIndex+1);return qo.pointAlongSegmentByFraction(i,n,this._segmentFraction)}getSegmentFraction(){return this._segmentFraction}getSegment(t){const e=t.getGeometryN(this._componentIndex),i=e.getCoordinateN(this._segmentIndex);if(this._segmentIndex>=qo.numSegments(e)){const t=e.getCoordinateN(e.getNumPoints()-2);return new Vt(t,i)}const n=e.getCoordinateN(this._segmentIndex+1);return new Vt(i,n)}clamp(t){if(this._componentIndex>=t.getNumGeometries())return this.setToEnd(t),null;if(this._segmentIndex>=t.getNumPoints()){const e=t.getGeometryN(this._componentIndex);this._segmentIndex=qo.numSegments(e),this._segmentFraction=1}}setToEnd(t){this._componentIndex=t.getNumGeometries()-1;const e=t.getGeometryN(this._componentIndex);this._segmentIndex=qo.numSegments(e),this._segmentFraction=0}compareTo(t){const e=t;return this._componentIndexe._componentIndex?1:this._segmentIndexe._segmentIndex?1:this._segmentFractione._segmentFraction?1:0}copy(){return new qo(this._componentIndex,this._segmentIndex,this._segmentFraction)}toString(){return"LinearLoc["+this._componentIndex+", "+this._segmentIndex+", "+this._segmentFraction+"]"}isOnSameSegment(t){return this._componentIndex===t._componentIndex&&(this._segmentIndex===t._segmentIndex||t._segmentIndex-this._segmentIndex==1&&0===t._segmentFraction||this._segmentIndex-t._segmentIndex==1&&0===this._segmentFraction)}snapToVertex(t,e){if(this._segmentFraction<=0||this._segmentFraction>=1)return null;const i=this.getSegmentLength(t),n=this._segmentFraction*i,r=i-n;n<=r&&nt?1:this._segmentIndexe?1:this._segmentFractioni?1:0}getSegmentLength(t){const e=t.getGeometryN(this._componentIndex);let i=this._segmentIndex;this._segmentIndex>=qo.numSegments(e)&&(i=e.getNumPoints()-2);const n=e.getCoordinateN(i),r=e.getCoordinateN(i+1);return n.distance(r)}isVertex(){return this._segmentFraction<=0||this._segmentFraction>=1}get interfaces_(){return[o]}}class Xo{constructor(){Xo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indexOf(t,e){return new Xo(t).indexOf(e)}static indexOfAfter(t,e,i){return new Xo(t).indexOfAfter(e,i)}indexOf(t){return this.indexOfFromStart(t,null)}indexOfFromStart(t,e){let i=s.MAX_VALUE,n=0,r=0,o=-1;const a=new Vt;for(let s=new Yo(this._linearGeom);s.hasNext();s.next())if(!s.isEndOfLine()){a.p0=s.getSegmentStart(),a.p1=s.getSegmentEnd();const l=a.distance(t),h=a.segmentFraction(t),c=s.getComponentIndex(),u=s.getVertexIndex();l=0,"computed location is before specified minimum location"),n}}class jo{constructor(){jo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indicesOf(t,e){return new jo(t).indicesOf(e)}indicesOf(t){const e=t.getGeometryN(0).getCoordinateN(0),i=t.getGeometryN(t.getNumGeometries()-1),n=i.getCoordinateN(i.getNumPoints()-1),r=new Xo(this._linearGeom),s=new Array(2).fill(null);return s[0]=r.indexOf(e),0===t.getLength()?s[1]=s[0].copy():s[1]=r.indexOfAfter(n,s[0]),s}}class Uo{constructor(){Uo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static getLength(t,e){return new Uo(t).getLength(e)}static getLocation(){if(2===arguments.length){const t=arguments[1];return new Uo(arguments[0]).getLocation(t)}if(3===arguments.length){const t=arguments[1],e=arguments[2];return new Uo(arguments[0]).getLocation(t,e)}}getLength(t){let e=0;const i=new Yo(this._linearGeom);for(;i.hasNext();){if(!i.isEndOfLine()){const n=i.getSegmentStart(),r=i.getSegmentEnd().distance(n);if(t.getComponentIndex()===i.getComponentIndex()&&t.getSegmentIndex()===i.getVertexIndex())return e+r*t.getSegmentFraction();e+=r}i.next()}return e}resolveHigher(t){if(!t.isEndpoint(this._linearGeom))return t;let e=t.getComponentIndex();if(e>=this._linearGeom.getNumGeometries()-1)return t;do{e++}while(et){const n=(t-e)/r,s=i.getComponentIndex(),o=i.getVertexIndex();return new qo(s,o,n)}e+=r}i.next()}return qo.getEndLocation(this._linearGeom)}}class Wo{constructor(){Wo.constructor_.apply(this,arguments)}static constructor_(){this._geomFact=null,this._lines=new C,this._coordList=null,this._ignoreInvalidLines=!1,this._fixInvalidLines=!1,this._lastPt=null;const t=arguments[0];this._geomFact=t}getGeometry(){return this.endLine(),this._geomFact.buildGeometry(this._lines)}getLastCoordinate(){return this._lastPt}endLine(){if(null===this._coordList)return null;if(this._ignoreInvalidLines&&this._coordList.size()<2)return this._coordList=null,null;const t=this._coordList.toCoordinateArray();let e=t;this._fixInvalidLines&&(e=this.validCoordinateSequence(t)),this._coordList=null;let i=null;try{i=this._geomFact.createLineString(e)}catch(t){if(!(t instanceof n))throw t;if(!this._ignoreInvalidLines)throw t}null!==i&&this._lines.add(i)}setFixInvalidLines(t){this._fixInvalidLines=t}add(){if(1===arguments.length){const t=arguments[0];this.add(t,!0)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];null===this._coordList&&(this._coordList=new S),this._coordList.add(t,e),this._lastPt=t}}setIgnoreInvalidLines(t){this._ignoreInvalidLines=t}validCoordinateSequence(t){return t.length>=2?t:[t[0],t[0]]}}class Ho{constructor(){Ho.constructor_.apply(this,arguments)}static constructor_(){this._line=null;const t=arguments[0];this._line=t}static extract(t,e,i){return new Ho(t).extract(e,i)}computeLinear(t,e){const i=new Wo(this._line.getFactory());i.setFixInvalidLines(!0),t.isVertex()||i.add(t.getCoordinate(this._line));for(let n=new Yo(this._line,t);n.hasNext()&&!(e.compareLocationValues(n.getComponentIndex(),n.getVertexIndex(),0)<0);n.next()){const t=n.getSegmentStart();i.add(t),n.isEndOfLine()&&i.endLine()}return e.isVertex()||i.add(e.getCoordinate(this._line)),i.getGeometry()}computeLine(t,e){const i=this._line.getCoordinates(),n=new S;let r=t.getSegmentIndex();t.getSegmentFraction()>0&&(r+=1);let s=e.getSegmentIndex();1===e.getSegmentFraction()&&(s+=1),s>=i.length&&(s=i.length-1),t.isVertex()||n.add(t.getCoordinate(this._line));for(let t=r;t<=s;t++)n.add(i[t]);e.isVertex()||n.add(e.getCoordinate(this._line)),n.size()<=0&&n.add(t.getCoordinate(this._line));let o=n.toCoordinateArray();return o.length<=1&&(o=[o[0],o[0]]),this._line.getFactory().createLineString(o)}extract(t,e){return e.compareTo(t)<0?this.reverse(this.computeLinear(e,t)):this.computeLinear(t,e)}reverse(t){return y(t,X)?t.reverse():(d.shouldNeverReachHere("non-linear geometry encountered"),null)}}class Zo{constructor(){Zo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}clampIndex(t){const e=this.positiveIndex(t),i=this.getStartIndex();if(en?n:e}locationOf(){if(1===arguments.length){const t=arguments[0];return Uo.getLocation(this._linearGeom,t)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return Uo.getLocation(this._linearGeom,t,e)}}project(t){return zo.indexOf(this._linearGeom,t)}positiveIndex(t){return t>=0?t:this._linearGeom.getLength()+t}extractPoint(){if(1===arguments.length){const t=arguments[0];return Uo.getLocation(this._linearGeom,t).getCoordinate(this._linearGeom)}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=Uo.getLocation(this._linearGeom,t).toLowest(this._linearGeom);return i.getSegment(this._linearGeom).pointAlongOffset(i.getSegmentFraction(),e)}}isValidIndex(t){return t>=this.getStartIndex()&&t<=this.getEndIndex()}getEndIndex(){return this._linearGeom.getLength()}getStartIndex(){return 0}indexOfAfter(t,e){return zo.indexOfAfter(this._linearGeom,t,e)}extractLine(t,e){const i=this.clampIndex(t),n=this.clampIndex(e),r=i===n,s=this.locationOf(i,r),o=this.locationOf(n);return Ho.extract(this._linearGeom,s,o)}indexOf(t){return zo.indexOf(this._linearGeom,t)}indicesOf(t){const e=jo.indicesOf(this._linearGeom,t);return[Uo.getLength(this._linearGeom,e[0]),Uo.getLength(this._linearGeom,e[1])]}}class Ko{constructor(){Ko.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t,this.checkGeometryType()}clampIndex(t){const e=t.copy();return e.clamp(this._linearGeom),e}project(t){return Xo.indexOf(this._linearGeom,t)}checkGeometryType(){if(!(this._linearGeom instanceof Z||this._linearGeom instanceof wt))throw new n("Input geometry must be linear")}extractPoint(){if(1===arguments.length)return arguments[0].getCoordinate(this._linearGeom);if(2===arguments.length){const t=arguments[1],e=arguments[0].toLowest(this._linearGeom);return e.getSegment(this._linearGeom).pointAlongOffset(e.getSegmentFraction(),t)}}isValidIndex(t){return t.isValid(this._linearGeom)}getEndIndex(){return qo.getEndLocation(this._linearGeom)}getStartIndex(){return new qo}indexOfAfter(t,e){return Xo.indexOfAfter(this._linearGeom,t,e)}extractLine(t,e){return Ho.extract(this._linearGeom,t,e)}indexOf(t){return Xo.indexOf(this._linearGeom,t)}indicesOf(t){return jo.indicesOf(this._linearGeom,t)}}var Jo=Object.freeze({__proto__:null,LengthIndexedLine:Zo,LengthLocationMap:Uo,LinearGeometryBuilder:Wo,LinearIterator:Yo,LinearLocation:qo,LocationIndexedLine:Ko});class $o{static transform(t,e){const i=new C;for(let n=t.iterator();n.hasNext();)i.add(e.execute(n.next()));return i}static select(t,e){const i=new C;for(let n=t.iterator();n.hasNext();){const t=n.next();Boolean.TRUE.equals(e.execute(t))&&i.add(t)}return i}static apply(t,e){for(let i=t.iterator();i.hasNext();)e.execute(i.next())}}$o.Function=function(){};class Qo{constructor(){Qo.constructor_.apply(this,arguments)}static constructor_(){this.pts=null,this.n=0;const t=arguments[0];this.pts=new Array(t).fill(null)}filter(t){this.pts[this.n++]=t}getCoordinates(){return this.pts}get interfaces_(){return[z]}}class ta{constructor(){ta.constructor_.apply(this,arguments)}static constructor_(){this._n=0}filter(t){this._n++}getCount(){return this._n}get interfaces_(){return[z]}}class ea{constructor(){ea.constructor_.apply(this,arguments)}static constructor_(){this._counts=new Et}count(t){const e=this._counts.get(t);return null===e?0:e.count()}add(t){const e=this._counts.get(t);null===e?this._counts.put(t,new ia(1)):e.increment()}}class ia{constructor(){ia.constructor_.apply(this,arguments)}static constructor_(){if(this.count=0,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this.count=t}}count(){return this.count}increment(){this.count++}}function na(){}function ra(){}function sa(){}ea.Counter=ia;class oa extends i{}function aa(){}class la{static chars(t,e){const i=new Array(e).fill(null);for(let n=0;n=0;){const t=r.substring(0,s);n.add(t),r=r.substring(s+i),s=r.indexOf(e)}r.length>0&&n.add(r);const o=new Array(n.size()).fill(null);for(let t=0;te)&&Rr.isWithinDistance(this,t,e)},Y.prototype.distance=function(t){return Rr.distance(this,t)},t.algorithm=li,t.densify=ui,t.dissolve=vi,t.geom=fe,t.geomgraph=Ki,t.index=Cn,t.io=On,t.linearref=Jo,t.noding=jn,t.operation=Hs,t.precision=Js,t.simplify=po,t.triangulate=Bo,t.util=ha,t.version="2.5.1 (8b99322)",Object.defineProperty(t,"__esModule",{value:!0})}(e)},11:function(t,e,i){"use strict";i.r(e),i.d(e,"VlCustomMap",(function(){return _l})),i.d(e,"VlMapWithActions",(function(){return gl})),i.d(e,"VlSnapInteraction",(function(){return wc})),i.d(e,"VlBoxSelectAction",(function(){return Fl})),i.d(e,"VlDeleteAction",(function(){return Dl})),i.d(e,"VlDrawAction",(function(){return Sc})),i.d(e,"VlDrawLineAction",(function(){return Tc})),i.d(e,"VlDrawRectangleAction",(function(){return Lc})),i.d(e,"VlHighlightAction",(function(){return Nc})),i.d(e,"VlMapAction",(function(){return Ml})),i.d(e,"VlMeasureAction",(function(){return Oc})),i.d(e,"VlModifyAction",(function(){return Bc})),i.d(e,"VlModifyAndTranslateAction",(function(){return Wc})),i.d(e,"VlSelectAction",(function(){return Al})),i.d(e,"VlSelectActions",(function(){return Hc})),i.d(e,"VlShowInfoAction",(function(){return Kc})),i.d(e,"VlShowInfoSelectAction",(function(){return Jc})),i.d(e,"VlSplitAction",(function(){return Qc})),i.d(e,"VlTooltips",(function(){return Zc})),i.d(e,"VlTranslateAction",(function(){return tu})),i.d(e,"OlLayerGroup",(function(){return ko})),i.d(e,"OlVectorLayer",(function(){return Wh})),i.d(e,"OlTileLayer",(function(){return du})),i.d(e,"OlOverlay",(function(){return qr})),i.d(e,"OlVectorSource",(function(){return hc})),i.d(e,"OlClusterSource",(function(){return _u})),i.d(e,"OlWMTSSource",(function(){return od})),i.d(e,"OlWMTSTileGrid",(function(){return rd})),i.d(e,"OlFeature",(function(){return tt})),i.d(e,"OlPoint",(function(){return mn})),i.d(e,"OlGeometryType",(function(){return De})),i.d(e,"OlStyle",(function(){return Ll})),i.d(e,"OlStyleStroke",(function(){return El})),i.d(e,"OlStyleFill",(function(){return xl})),i.d(e,"OlStyleCircle",(function(){return vl})),i.d(e,"OlStyleText",(function(){return ad})),i.d(e,"OlProjection",(function(){return ue})),i.d(e,"OlGeoJSON",(function(){return Yn})),i.d(e,"OlExtent",(function(){return n})),i.d(e,"OlLoadingstrategy",(function(){return r}));var n={};i.r(n),i.d(n,"boundingExtent",(function(){return vt})),i.d(n,"buffer",(function(){return xt})),i.d(n,"clone",(function(){return Et})),i.d(n,"closestSquaredDistanceXY",(function(){return It})),i.d(n,"containsCoordinate",(function(){return Ct})),i.d(n,"containsExtent",(function(){return wt})),i.d(n,"containsXY",(function(){return St})),i.d(n,"coordinateRelationship",(function(){return Tt})),i.d(n,"createEmpty",(function(){return Lt})),i.d(n,"createOrUpdate",(function(){return Nt})),i.d(n,"createOrUpdateEmpty",(function(){return Ot})),i.d(n,"createOrUpdateFromCoordinate",(function(){return Rt})),i.d(n,"createOrUpdateFromCoordinates",(function(){return Pt})),i.d(n,"createOrUpdateFromFlatCoordinates",(function(){return bt})),i.d(n,"createOrUpdateFromRings",(function(){return Mt})),i.d(n,"equals",(function(){return At})),i.d(n,"approximatelyEquals",(function(){return Ft})),i.d(n,"extend",(function(){return Dt})),i.d(n,"extendCoordinate",(function(){return Gt})),i.d(n,"extendCoordinates",(function(){return kt})),i.d(n,"extendFlatCoordinates",(function(){return Vt})),i.d(n,"extendRings",(function(){return Bt})),i.d(n,"extendXY",(function(){return Yt})),i.d(n,"forEachCorner",(function(){return zt})),i.d(n,"getArea",(function(){return qt})),i.d(n,"getBottomLeft",(function(){return Xt})),i.d(n,"getBottomRight",(function(){return jt})),i.d(n,"getCenter",(function(){return Ut})),i.d(n,"getCorner",(function(){return Wt})),i.d(n,"getEnlargedArea",(function(){return Ht})),i.d(n,"getForViewAndSize",(function(){return Zt})),i.d(n,"getHeight",(function(){return Kt})),i.d(n,"getIntersectionArea",(function(){return Jt})),i.d(n,"getIntersection",(function(){return $t})),i.d(n,"getMargin",(function(){return Qt})),i.d(n,"getSize",(function(){return te})),i.d(n,"getTopLeft",(function(){return ee})),i.d(n,"getTopRight",(function(){return ie})),i.d(n,"getWidth",(function(){return ne})),i.d(n,"intersects",(function(){return re})),i.d(n,"isEmpty",(function(){return se})),i.d(n,"returnOrUpdate",(function(){return oe})),i.d(n,"scaleFromCenter",(function(){return ae})),i.d(n,"intersectsSegment",(function(){return le})),i.d(n,"applyTransform",(function(){return he})),i.d(n,"wrapX",(function(){return ce}));var r={};i.r(r),i.d(r,"all",(function(){return ic})),i.d(r,"bbox",(function(){return nc})),i.d(r,"tile",(function(){return rc}));var s=function(){function t(t){this.propagationStopped,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.propagationStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),o="propertychange",a=function(){function t(){this.disposed=!1}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function l(t,e){return t>e?1:t=0}function c(t,e,i){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var r=void 0;if(i>0){for(r=1;r0)},e.prototype.removeEventListener=function(t,e){var i=this.listeners_&&this.listeners_[t];if(i){var n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=f,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}},e}(a),w="change",S="error",T="contextmenu",L="click",N="dblclick",O="keydown",R="keypress",P="load",b="resize",M="touchmove",A="wheel";function F(t,e,i,n,r){if(n&&n!==t&&(i=i.bind(n)),r){var s=i;i=function(){t.removeEventListener(e,i),s.apply(this,arguments)}}var o={target:t,type:e,listener:i};return t.addEventListener(e,i),o}function D(t,e,i,n){return F(t,e,i,n,!0)}function G(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),y(t))}var k=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function V(t){if(Array.isArray(t))for(var e=0,i=t.length;er&&(l|=ft),as&&(l|=pt),l===gt&&(l=_t),l}function Lt(){return[1/0,1/0,-1/0,-1/0]}function Nt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Ot(t){return Nt(1/0,1/0,-1/0,-1/0,t)}function Rt(t,e){var i=t[0],n=t[1];return Nt(i,n,i,n,e)}function Pt(t,e){return kt(Ot(e),t)}function bt(t,e,i,n,r){return Vt(Ot(r),t,e,i,n)}function Mt(t,e){return Bt(Ot(e),t)}function At(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Ft(t,e,i){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function Gt(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function kt(t,e){for(var i=0,n=e.length;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function se(t){return t[2]=o&&p<=l),n||!(s&ft)||r&ft||(n=(f=g-(d-l)*_)>=a&&f<=h),n||!(s&mt)||r&mt||(n=(p=d-(g-a)/_)>=o&&p<=l),n||!(s&yt)||r&yt||(n=(f=g-(d-o)*_)>=a&&f<=h)}return n}function he(t,e,i,n){var r=[];if(n>1)for(var s=t[2]-t[0],o=t[3]-t[1],a=0;a=i[2])){var r=ne(i),s=Math.floor((n[0]-i[0])/r)*r;t[0]-=s,t[2]-=s}return t}var ue=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||it[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}();function de(t,e,i){return Math.min(Math.max(t,e),i)}var ge="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2},_e="log2"in Math?Math.log2:function(t){return Math.log(t)*Math.LOG2E};function pe(t,e,i,n,r,s){var o=r-i,a=s-n;if(0!==o||0!==a){var l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return fe(t,e,i,n)}function fe(t,e,i,n){var r=i-t,s=n-e;return r*r+s*s}function me(t){return t*Math.PI/180}function ye(t,e){var i=t%e;return i*e<0?i+e:i}function ve(t,e,i){return t+i*(e-t)}var xe=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ee=6378137*Math.PI,Ie=[-Ee,-Ee,Ee,Ee],Ce=[-180,-85,180,85],we=function(t){function e(e){return t.call(this,{code:e,units:nt.METERS,extent:Ie,global:!0,worldExtent:Ce,getPointResolution:function(t,e){return t/ge(e[1]/6378137)}})||this}return xe(e,t),e}(ue),Se=[new we("EPSG:3857"),new we("EPSG:102100"),new we("EPSG:102113"),new we("EPSG:900913"),new we("urn:ogc:def:crs:EPSG:6.18:3:3857"),new we("urn:ogc:def:crs:EPSG::3857"),new we("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Te(t,e,i){var n=t.length,r=i>1?i:2,s=e;void 0===s&&(s=r>2?t.slice():new Array(n));for(var o=Ee,a=0;ao?l=o:l<-o&&(l=-o),s[a+1]=l}return s}function Le(t,e,i){var n=t.length,r=i>1?i:2,s=e;void 0===s&&(s=r>2?t.slice():new Array(n));for(var o=0;o=1?(i=c,n=u):(i=l+_*d,n=h+_*g),[i,n]}function Be(t,e){for(var i=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Ye(t,e){var i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function ze(t,e){return t[0]*=e,t[1]*=e,t}function qe(t,e){var i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Xe(t,e){return Math.sqrt(qe(t,e))}function je(t,e){return qe(t,Ve(t,e))}function Ue(t,e){if(e.canWrapX()){var i=ne(e.getExtent()),n=We(t,e,i);n&&(t[0]-=n*i)}return t}function We(t,e,i){var n=e.getExtent(),r=0;if(e.canWrapX()&&(t[0]n[2])){var s=i||ne(n);r=Math.floor((t[0]-n[0])/s)}return r}function He(t,e,i){var n;if(void 0!==e){for(var r=0,s=t.length;r1)a=i;else{if(d>0){for(var g=0;gr&&(r=h),s=a,o=l}return r}function zi(t,e,i,n,r){for(var s=0,o=i.length;s0;){for(var u=h.pop(),d=h.pop(),g=0,_=t[d],p=t[d+1],f=t[u],m=t[u+1],y=d+n;yg&&(c=y,g=v)}g>r&&(l[(c-e)/n]=1,d+n0&&p>g)&&(_<0&&f<_||_==f||_>0&&f>_)?(a=u,l=d):(s[o++]=a,s[o++]=l,h=a,c=l,a=u,l=d)}}return s[o++]=a,s[o++]=l,o}function $i(t,e,i,n,r,s,o,a){for(var l=0,h=i.length;l>1)],e))<0?o=n+1:(a=n,h=!r);return h?o:~o}(_,y);v<0?(h=(y-_[-v-2])/(_[-v-1]-_[-v-2]),a=e+(-v-2)*n):a=e+v*n}var x=o>1?o:2,E=s||new Array(x);for(p=0;p>1;rs&&(h-a)*(s-l)-(r-a)*(c-l)>0&&o++:c<=s&&(h-a)*(s-l)-(r-a)*(c-l)<0&&o--,a=h,l=c}return 0!==o}function ln(t,e,i,n,r,s){if(0===i.length)return!1;if(!an(t,e,i[0],n,r,s))return!1;for(var o=1,a=i.length;o=r[0]&&s[2]<=r[2]||(s[1]>=r[1]&&s[3]<=r[3]||Qi(t,e,i,n,(function(t,e){return le(r,t,e)})))))}function cn(t,e,i,n,r){if(!function(t,e,i,n,r){return!!hn(t,e,i,n,r)||(!!an(t,e,i,n,r[0],r[1])||(!!an(t,e,i,n,r[0],r[3])||(!!an(t,e,i,n,r[2],r[1])||!!an(t,e,i,n,r[2],r[3]))))}(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(var s=1,o=i.length;sE&&ln(t,e,i,n,c=(u+d)/2,p)&&(x=c,E=I),u=d}return isNaN(x)&&(x=r[s]),o?(o.push(x,p,E),o):[x,p,E]}function Sn(t,e,i,n){for(;es||(h==s&&l>=o||(r=a,s=h,o=l))}return r}(t,e,i,n),a=o-n;a=i&&(l=e);var h=t[a],c=t[a+1],u=t[o],d=t[o+1],g=t[l],_=t[l+1];return u*_+h*d+c*g-(c*u+d*g+h*_)<0}function Ln(t,e,i,n,r){for(var s=void 0!==r&&r,o=0,a=i.length;oc&&(c=h=(c+h)/2),u>d&&(d=u=(d+u)/2);var g=de(n[0],h,c),_=de(n[1],u,d),p=30*r;return o&&i&&(g+=-p*Math.log(1+Math.max(0,h-n[0])/p)+p*Math.log(1+Math.max(0,n[0]-c)/p),_+=-p*Math.log(1+Math.max(0,u-n[1])/p)+p*Math.log(1+Math.max(0,n[1]-d)/p)),[g,_]}}}function Hn(t){return t}function Zn(t,e,i,n){var r=ne(e)/i[0],s=Kt(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function Kn(t,e,i){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),de(n,i/2,2*e)}function Jn(t,e,i,n,r){return function(s,o,a,l){if(void 0!==s){var h=n?Zn(t,n,a,r):t;return(void 0===i||i)&&l?Kn(s,h,e):de(s,e,h)}}}function $n(t){return void 0!==t?0:void 0}function Qn(t){return void 0!==t?t:void 0}function tr(t){return Math.pow(t,3)}function er(t){return 1-tr(1-t)}function ir(t){return 3*t*t-2*t*t*t}function nr(t){return t}var rr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function sr(t,e){setTimeout((function(){t(e)}),0)}function or(t){return!(t.sourceCenter&&t.targetCenter&&!Be(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}var ar=function(t){function e(e){var i=t.call(this)||this,n=m({},e);return i.hints_=[0,0],i.animations_=[],i.updateAnimationKey_,i.projection_=ti(n.projection,"EPSG:3857"),i.viewportSize_=[100,100],i.targetCenter_=null,i.targetResolution_,i.targetRotation_,i.cancelAnchor_=void 0,n.center&&(n.center=di(n.center,i.projection_)),n.extent&&(n.extent=_i(n.extent,i.projection_)),i.applyOptions_(n),i}return rr(e,t),e.prototype.applyOptions_=function(t){var e=function(t){var e,i,n,r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28,o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,u=ti(t.projection,"EPSG:3857"),d=u.getExtent(),g=t.constrainOnlyCenter,_=t.extent;a||_||!u.isGlobal()||(g=!1,_=d);if(void 0!==t.resolutions){var p=t.resolutions;i=p[r],n=void 0!==p[s]?p[s]:p[p.length-1],e=t.constrainResolution?function(t,e,i,n){return function(r,s,o,a){if(void 0!==r){var l=t[0],h=t[t.length-1],u=i?Zn(l,i,o,n):l;if(a)return void 0===e||e?Kn(r,u,h):de(r,h,u);var d=Math.min(u,r),g=Math.floor(c(t,d,s));return t[g]>u&&g1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i),!this.isDef()){var n=arguments[i-1];return n.center&&this.setCenterInternal(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&sr(e,!0))}for(var r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_,l=[],h=0;h0},e.prototype.getInteracting=function(){return this.hints_[qn]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(zn,-this.hints_[zn]);for(var e=0,i=this.animations_.length;e=0;--i){for(var n=this.animations_[i],r=!0,s=0,o=n.length;s0?l/a.duration:1;h>=1?(a.complete=!0,h=1):r=!1;var c=a.easing(h);if(a.sourceCenter){var u=a.sourceCenter[0],d=a.sourceCenter[1],g=u+c*(a.targetCenter[0]-u),_=d+c*(a.targetCenter[1]-d);this.targetCenter_=[g,_]}if(a.sourceResolution&&a.targetResolution){var p=1===c?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){var f=this.getViewportSize_(this.getRotation()),m=this.constraints_.resolution(p,0,f,!0);this.targetCenter_=this.calculateCenterZoom(m,a.anchor)}this.targetResolution_=p,this.applyTargetState_(!0)}if(void 0!==a.sourceRotation&&void 0!==a.targetRotation){var y=1===c?ye(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){var v=this.constraints_.rotation(y,!0);this.targetCenter_=this.calculateCenterRotate(v,a.anchor)}this.targetRotation_=y}if(this.applyTargetState_(!0),e=!0,!a.complete)break}}if(r){this.animations_[i]=null,this.setHint(zn,-1);var x=n[0].callback;x&&sr(x,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var i,n=this.getCenterInternal();return void 0!==n&&(Ye(i=[n[0]-e[0],n[1]-e[1]],t-this.getRotation()),ke(i,e)),i},e.prototype.calculateCenterZoom=function(t,e){var i,n=this.getCenterInternal(),r=this.getResolution();void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]);return i},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?ui(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(Xn)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.options_.constrainResolution},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return gi(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSize_(),i=this.getCenterInternal();$(i,1);var n=this.getResolution();$(void 0!==n,2);var r=this.getRotation();return $(void 0!==r,3),Zt(i,n,r,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(jn)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(_i(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var i=e||this.getViewportSize_(),n=ne(t)/i[0],r=Kt(t)/i[1];return Math.max(n,r)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/Math.log(e);return function(t){return i/Math.pow(e,t*r)}},e.prototype.getRotation=function(){return this.get(Un)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}},e.prototype.getState=function(){var t=this.getCenterInternal(),e=this.getProjection(),i=this.getResolution(),n=this.getRotation();return{center:t.slice(0),projection:void 0!==e?e:null,resolution:i,rotation:n,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,i,n=this.minZoom_||0;if(this.resolutions_){var r=c(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=de(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,de(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var i,n=m({size:this.getViewportSize_()},e||{});if($(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))$(!se(t),25),i=Mn(r=_i(t,this.getProjection()));else if(t.getType()===De.CIRCLE){var r;(i=Mn(r=_i(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),Ut(r))}else{var s=ci();i=s?t.clone().transform(s,this.getProjection()):t}this.fitInternal(i,n)},e.prototype.fitInternal=function(t,e){var i=e||{},n=i.size;n||(n=this.getViewportSize_());var r,s=void 0!==i.padding?i.padding:[0,0,0,0],o=void 0!==i.nearest&&i.nearest;r=void 0!==i.minResolution?i.minResolution:void 0!==i.maxZoom?this.getResolutionForZoom(i.maxZoom):0;for(var a=t.getFlatCoordinates(),l=this.getRotation(),h=Math.cos(-l),c=Math.sin(-l),u=1/0,d=1/0,g=-1/0,_=-1/0,p=t.getStride(),m=0,y=a.length;m0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:er})):e.setZoom(n)}}},e}(jr),Hr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Zr=function(t){function e(e){var i=this,n=e||{};i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this;var r=void 0!==n.className?n.className:"ol-rotate",s=void 0!==n.label?n.label:"⇧";i.label_=null,"string"==typeof s?(i.label_=document.createElement("span"),i.label_.className="ol-compass",i.label_.textContent=s):(i.label_=s,i.label_.classList.add("ol-compass"));var o=n.tipLabel?n.tipLabel:"Reset rotation",a=document.createElement("button");a.className=r+"-reset",a.setAttribute("type","button"),a.title=o,a.appendChild(i.label_),a.addEventListener(L,i.handleClick_.bind(i),!1);var l=r+" ol-unselectable ol-control",h=i.element;return h.className=l,h.appendChild(a),i.callResetNorth_=n.resetNorth?n.resetNorth:void 0,i.duration_=void 0!==n.duration?n.duration:250,i.autoHide_=void 0===n.autoHide||n.autoHide,i.rotation_=void 0,i.autoHide_&&i.element.classList.add("ol-hidden"),i}return Hr(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()},e.prototype.resetNorth_=function(){var t=this.getMap().getView();if(t){var e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:er}):t.setRotation(0))}},e.prototype.render=function(t){var e=t.frameState;if(e){var i=e.viewState.rotation;if(i!=this.rotation_){var n="rotate("+i+"rad)";if(this.autoHide_){var r=this.element.classList.contains("ol-hidden");r||0!==i?r&&0!==i&&this.element.classList.remove("ol-hidden"):this.element.classList.add("ol-hidden")}this.label_.style.transform=n}this.rotation_=i}},e}(jr),Kr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Jr="degrees",$r="imperial",Qr="nautical",ts="metric",es="us",is=[1,2,5],ns=function(t){function e(e){var i=this,n=e||{},r=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).innerElement_=document.createElement("div"),i.innerElement_.className=r+"-inner",i.element.className=r+" ol-unselectable",i.element.appendChild(i.innerElement_),i.viewState_=null,i.minWidth_=void 0!==n.minWidth?n.minWidth:64,i.renderedVisible_=!1,i.renderedWidth_=void 0,i.renderedHTML_="",i.addEventListener(H("units"),i.handleUnitsChanged_),i.setUnits(n.units||ts),i.scaleBar_=n.bar||!1,i.scaleBarSteps_=n.steps||4,i.scaleBarText_=n.text||!1,i.dpi_=n.dpi||void 0,i}return Kr(e,t),e.prototype.getUnits=function(){return this.get("units")},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set("units",t)},e.prototype.setDpi=function(t){this.dpi_=t},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,i=t.projection,n=this.getUnits(),r=n==Jr?nt.DEGREES:nt.METERS,s=$e(i,t.resolution,e,r),o=this.minWidth_*(this.dpi_||25.4/.28)/(25.4/.28),a=o*s,l="";if(n==Jr){var h=it[nt.DEGREES];(a*=h)=o)break;++_}g=this.scaleBar_?this.createScaleBar(u,c,l):c.toFixed(d<0?-d:0)+" "+l,this.renderedHTML_!=g&&(this.innerElement_.innerHTML=g,this.renderedHTML_=g),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,i){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),r=[],s=t/this.scaleBarSteps_,o="#ffffff",a=0;a
'+this.createMarker("relative",a)+(a%2==0||2===this.scaleBarSteps_?this.createStepText(a,t,!1,e,i):"")+""),a===this.scaleBarSteps_-1&&r.push(this.createStepText(a+1,t,!0,e,i)),o="#ffffff"===o?"#000000":"#ffffff";return'
'+(this.scaleBarText_?'
'+n+"
":"")+r.join("")+"
"},e.prototype.createMarker=function(t,e){return'
'},e.prototype.createStepText=function(t,e,i,n,r){var s=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return'
'+s+"
"},e.prototype.getScaleForResolution=function(){var t=$e(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||25.4/.28,i=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*i*39.37*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}(jr),rs=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,ss=/^([a-z]*)$|^hsla?\(.*\)$/i;function os(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var i=getComputedStyle(e).color;return document.body.removeChild(e),i}return""}var as,ls,hs=(as={},ls=0,function(t){var e;if(as.hasOwnProperty(t))e=as[t];else{if(ls>=1024){var i=0;for(var n in as)0==(3&i++)&&(delete as[n],--ls)}e=function(t){var e,i,n,r,s;if(ss.exec(t)&&(t=os(t)),rs.exec(t)){var o=t.length-1,a=void 0;a=o<=4?1:2;var l=4===o||8===o;e=parseInt(t.substr(1+0*a,a),16),i=parseInt(t.substr(1+1*a,a),16),n=parseInt(t.substr(1+2*a,a),16),r=l?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,l&&(r=(r<<4)+r)),s=[e,i,n,r/255]}else 0==t.indexOf("rgba(")?us(s=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((s=t.slice(4,-1).split(",").map(Number)).push(1),us(s)):$(!1,14);return s}(t),as[t]=e,++ls}return e});function cs(t){return Array.isArray(t)?t:hs(t)}function us(t){return t[0]=de(t[0]+.5|0,0,255),t[1]=de(t[1]+.5|0,0,255),t[2]=de(t[2]+.5|0,0,255),t[3]=de(t[3],0,1),t}function ds(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var i=t[1];i!=(0|i)&&(i=i+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:t[3])+")"}var gs=function(){function t(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return t.prototype.clear=function(){this.cache_={},this.cacheSize_=0},t.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,i){var n=_s(t,e,i);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,i,n){var r=_s(t,e,i);this.cache_[r]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}();function _s(t,e,i){return e+":"+t+":"+(i?function(t){return"string"==typeof t?t:ds(t)}(i):"null")}var ps=new gs,fs="opacity",ms="visible",ys="extent",vs="zIndex",xs="maxResolution",Es="minResolution",Is="maxZoom",Cs="minZoom",ws="source",Ss=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ts=function(t){function e(e){var i=t.call(this)||this,n=m({},e);return n[fs]=void 0!==e.opacity?e.opacity:1,$("number"==typeof n[fs],64),n[ms]=void 0===e.visible||e.visible,n[vs]=e.zIndex,n[xs]=void 0!==e.maxResolution?e.maxResolution:1/0,n[Es]=void 0!==e.minResolution?e.minResolution:0,n[Cs]=void 0!==e.minZoom?e.minZoom:-1/0,n[Is]=void 0!==e.maxZoom?e.maxZoom:1/0,i.className_=void 0!==n.className?e.className:"ol-layer",delete n.className,i.setProperties(n),i.state_=null,i}return Ss(e,t),e.prototype.getClassName=function(){return this.className_},e.prototype.getLayerState=function(t){var e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=de(Math.round(100*this.getOpacity())/100,0,1),e.sourceState=this.getSourceState(),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i?i:!1===e.managed?1/0:0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e},e.prototype.getLayersArray=function(t){return Y()},e.prototype.getLayerStatesArray=function(t){return Y()},e.prototype.getExtent=function(){return this.get(ys)},e.prototype.getMaxResolution=function(){return this.get(xs)},e.prototype.getMinResolution=function(){return this.get(Es)},e.prototype.getMinZoom=function(){return this.get(Cs)},e.prototype.getMaxZoom=function(){return this.get(Is)},e.prototype.getOpacity=function(){return this.get(fs)},e.prototype.getSourceState=function(){return Y()},e.prototype.getVisible=function(){return this.get(ms)},e.prototype.getZIndex=function(){return this.get(vs)},e.prototype.setExtent=function(t){this.set(ys,t)},e.prototype.setMaxResolution=function(t){this.set(xs,t)},e.prototype.setMinResolution=function(t){this.set(Es,t)},e.prototype.setMaxZoom=function(t){this.set(Is,t)},e.prototype.setMinZoom=function(t){this.set(Cs,t)},e.prototype.setOpacity=function(t){$("number"==typeof t,64),this.set(fs,t)},e.prototype.setVisible=function(t){this.set(ms,t)},e.prototype.setZIndex=function(t){this.set(vs,t)},e.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),t.prototype.disposeInternal.call(this)},e}(Z),Ls="prerender",Ns="postrender",Os="precompose",Rs="postcompose",Ps="rendercomplete",bs="undefined",Ms="ready",As=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function Fs(t,e){if(!t.visible)return!1;var i=e.resolution;if(i=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Ds=function(t){function e(e){var i=this,n=m({},e);delete n.source,(i=t.call(this,n)||this).mapPrecomposeKey_=null,i.mapRenderKey_=null,i.sourceChangeKey_=null,i.renderer_=null,e.render&&(i.render=e.render),e.map&&i.setMap(e.map),i.addEventListener(H(ws),i.handleSourcePropertyChange_);var r=e.source?e.source:null;return i.setSource(r),i}return As(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(ws)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():bs},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(G(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=F(t,w,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_.getFeatures(t)},e.prototype.render=function(t,e){var i=this.getRenderer();if(i.prepareFrame(t))return i.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(G(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(G(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=F(t,Os,(function(t){var e=t.frameState.layerStatesArray,i=this.getLayerState(!1);$(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=F(this,w,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(ws,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.setSource(null),t.prototype.disposeInternal.call(this)},e}(Ts),Gs=function(){function t(){}return t.prototype.drawCustom=function(t,e,i){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}();function ks(t){return Array.isArray(t)?ds(t):t}var Vs=[],Bs=[0,0,0,0],Ys=new Z;(new C).setSize=function(){console.warn("labelCache is deprecated.")};var zs,qs,Xs,js=null,Us={},Ws=function(){var t,e,i=["monospace","serif"],n=i.length,r="wmytzilWMYTZIL@#/&?$%10";function s(t,s,o){for(var a=!0,l=0;l=0;--x){var E=f[x],I=E.layer;if(I.hasRenderer()&&Fs(E,h)&&o.call(a,I)){var C=I.getRenderer(),w=I.getSource();if(C&&w){var S=w.getWrapX()?d:t,T=c.bind(null,E.managed);y[0]=S[0]+g[v][0],y[1]=S[1]+g[v][1],l=C.forEachFeatureAtCoordinate(y,e,i,T,p)}if(l)return l}}},e.prototype.forEachLayerAtPixel=function(t,e,i,n,r){return Y()},e.prototype.hasFeatureAtCoordinate=function(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,_,this,r,s)},e.prototype.getMap=function(){return this.map_},e.prototype.renderFrame=function(t){this.declutterTree_=function(t,e){e&&e.clear();for(var i=t.declutterItems,n=i.length-1;n>=0;--n)for(var r=i[n],s=r.items,o=0,a=s.length;o=0;--a){var l=o[a],h=l.layer;if(h.hasRenderer()&&Fs(l,s)&&r(h)){var c=h.getRenderer().getDataAtPixel(t,e,i);if(c){var u=n(h,c);if(u)return u}}}},e}(Eo),To="layergroup",Lo="size",No="target",Oo="view",Ro="add",Po="remove",bo=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Mo="length",Ao=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.element=i,r.index=n,r}return bo(e,t),e}(s),Fo=function(t){function e(e,i){var n=t.call(this)||this,r=i||{};if(n.unique_=!!r.unique,n.array_=e||[],n.unique_)for(var s=0,o=n.array_.length;s0;)this.pop()},e.prototype.extend=function(t){for(var e=0,i=t.length;ethis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(G(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(M,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(G(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(G),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(C),Ho=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,y(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(i);return delete this.queuedElements_[n],i},t.prototype.enqueue=function(t){$(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;t>1;){var a=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),h=lt;){var o=this.getParentIndex_(e);if(!(n[o]>s))break;i[e]=i[o],n[e]=n[o],e=o}i[e]=r,n[e]=s},t.prototype.reprioritize=function(){var t,e,i,n=this.priorityFunction_,r=this.elements_,s=this.priorities_,o=0,a=r.length;for(e=0;e0;)n=(i=this.dequeue()[0]).getKey(),i.getState()!==Zo||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++r,i.load())},e}(Ho);function ia(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var na=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var ra=function(t){function e(e){var i=t.call(this)||this,n=function(t){var e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);var i,n,r,s={},o=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new ko({layers:t.layers});s[To]=o,s[No]=t.target,s[Oo]=void 0!==t.view?t.view:new ar,void 0!==t.controls&&(Array.isArray(t.controls)?i=new Fo(t.controls.slice()):($("function"==typeof t.controls.getArray,47),i=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?n=new Fo(t.interactions.slice()):($("function"==typeof t.interactions.getArray,48),n=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?r=new Fo(t.overlays.slice()):($("function"==typeof t.overlays.getArray,49),r=t.overlays):r=new Fo;return{controls:i,interactions:n,keyboardEventTarget:e,overlays:r,values:s}}(e);return i.boundHandleBrowserEvent_=i.handleBrowserEvent.bind(i),i.maxTilesLoading_=void 0!==e.maxTilesLoading?e.maxTilesLoading:16,i.pixelRatio_=void 0!==e.pixelRatio?e.pixelRatio:Lr,i.postRenderTimeoutHandle_,i.animationDelayKey_,i.animationDelay_=function(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}.bind(i),i.coordinateToPixelTransform_=[1,0,0,1,0,0],i.pixelToCoordinateTransform_=[1,0,0,1,0,0],i.frameIndex_=0,i.frameState_=null,i.previousExtent_=null,i.viewPropertyListenerKey_=null,i.viewChangeListenerKey_=null,i.layerGroupPropertyListenerKeys_=null,i.viewport_=document.createElement("div"),i.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),i.viewport_.style.position="relative",i.viewport_.style.overflow="hidden",i.viewport_.style.width="100%",i.viewport_.style.height="100%",i.overlayContainer_=document.createElement("div"),i.overlayContainer_.style.position="absolute",i.overlayContainer_.style.zIndex="0",i.overlayContainer_.style.width="100%",i.overlayContainer_.style.height="100%",i.overlayContainer_.style.pointerEvents="none",i.overlayContainer_.className="ol-overlaycontainer",i.viewport_.appendChild(i.overlayContainer_),i.overlayContainerStopEvent_=document.createElement("div"),i.overlayContainerStopEvent_.style.position="absolute",i.overlayContainerStopEvent_.style.zIndex="0",i.overlayContainerStopEvent_.style.width="100%",i.overlayContainerStopEvent_.style.height="100%",i.overlayContainerStopEvent_.style.pointerEvents="none",i.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",i.viewport_.appendChild(i.overlayContainerStopEvent_),i.mapBrowserEventHandler_=null,i.moveTolerance_=e.moveTolerance,i.keyboardEventTarget_=n.keyboardEventTarget,i.keyHandlerKeys_=null,i.controls=n.controls||new Fo,i.interactions=n.interactions||new Fo,i.overlays_=n.overlays,i.overlayIdIndex_={},i.renderer_=null,i.handleResize_,i.postRenderFunctions_=[],i.tileQueue_=new ea(i.getTilePriority.bind(i),i.handleTileChange_.bind(i)),i.addEventListener(H(To),i.handleLayerGroupChanged_),i.addEventListener(H(Oo),i.handleViewChanged_),i.addEventListener(H(Lo),i.handleSizeChanged_),i.addEventListener(H(No),i.handleTargetChanged_),i.setProperties(n.values),i.controls.forEach(function(t){t.setMap(this)}.bind(i)),i.controls.addEventListener(Ro,function(t){t.element.setMap(this)}.bind(i)),i.controls.addEventListener(Po,function(t){t.element.setMap(null)}.bind(i)),i.interactions.forEach(function(t){t.setMap(this)}.bind(i)),i.interactions.addEventListener(Ro,function(t){t.element.setMap(this)}.bind(i)),i.interactions.addEventListener(Po,function(t){t.element.setMap(null)}.bind(i)),i.overlays_.forEach(i.addOverlayInternal_.bind(i)),i.overlays_.addEventListener(Ro,function(t){this.addOverlayInternal_(t.element)}.bind(i)),i.overlays_.addEventListener(Po,function(t){var e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}.bind(i)),i}return na(e,t),e.prototype.createRenderer=function(){throw new Error("Use a map type that has a createRenderer method")},e.prototype.addControl=function(t){this.getControls().push(t)},e.prototype.addInteraction=function(t){this.getInteractions().push(t)},e.prototype.addLayer=function(t){this.getLayerGroup().getLayers().push(t)},e.prototype.addOverlay=function(t){this.getOverlays().push(t)},e.prototype.addOverlayInternal_=function(t){var e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)},e.prototype.disposeInternal=function(){this.setTarget(null),t.prototype.disposeInternal.call(this)},e.prototype.forEachFeatureAtPixel=function(t,e,i){if(this.frameState_){var n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance*this.frameState_.pixelRatio:0,s=void 0!==i.layerFilter?i.layerFilter:_,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}},e.prototype.getFeaturesAtPixel=function(t,e){var i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i},e.prototype.forEachLayerAtPixel=function(t,e,i){if(this.frameState_){var n=i||{},r=void 0!==n.hitTolerance?n.hitTolerance*this.frameState_.pixelRatio:0,s=n.layerFilter||_;return this.renderer_.forEachLayerAtPixel(t,this.frameState_,r,e,s)}},e.prototype.hasFeatureAtPixel=function(t,e){if(!this.frameState_)return!1;var i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:_,r=void 0!==e.hitTolerance?e.hitTolerance*this.frameState_.pixelRatio:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)},e.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))},e.prototype.getEventCoordinateInternal=function(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))},e.prototype.getEventPixel=function(t){var e=this.viewport_.getBoundingClientRect(),i="changedTouches"in t?t.changedTouches[0]:t;return[i.clientX-e.left,i.clientY-e.top]},e.prototype.getTarget=function(){return this.get(No)},e.prototype.getTargetElement=function(){var t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null},e.prototype.getCoordinateFromPixel=function(t){return ui(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())},e.prototype.getCoordinateFromPixelInternal=function(t){var e=this.frameState_;return e?st(e.pixelToCoordinateTransform,t.slice()):null},e.prototype.getControls=function(){return this.controls},e.prototype.getOverlays=function(){return this.overlays_},e.prototype.getOverlayById=function(t){var e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null},e.prototype.getInteractions=function(){return this.interactions},e.prototype.getLayerGroup=function(){return this.get(To)},e.prototype.getLayers=function(){return this.getLayerGroup().getLayers()},e.prototype.getLoading=function(){for(var t=this.getLayerGroup().getLayerStatesArray(),e=0,i=t.length;e=0;o--){var a=s[o];if(a.getActive())if(!a.handleEvent(t))break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var i=this.maxTilesLoading_,n=i;if(t){var r=t.viewHints;if(r[zn]||r[qn]){var s=!Or&&Date.now()-t.time>8;i=s?0:8,n=s?0:2}}e.getTilesLoading()0&&t[1]>0}(e)&&i&&i.isDef()){var s=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),o=i.getState();r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterItems:n?n.declutterItems:[],extent:Zt(o.center,o.resolution,o.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:o,viewHints:s,wantedTiles:{}}}if(this.frameState_=r,this.renderer_.renderFrame(r),r){if(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n)(!this.previousExtent_||!se(this.previousExtent_)&&!At(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Bo(hr,this,n)),this.previousExtent_=Ot(this.previousExtent_));this.previousExtent_&&!r.viewHints[zn]&&!r.viewHints[qn]&&!At(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Bo(cr,this,r)),Et(r.extent,this.previousExtent_))}this.dispatchEvent(new Bo(lr,this,r)),this.postRenderTimeoutHandle_=setTimeout(this.handlePostRender.bind(this),0)},e.prototype.setLayerGroup=function(t){this.set(To,t)},e.prototype.setSize=function(t){this.set(Lo,t)},e.prototype.setTarget=function(t){this.set(No,t)},e.prototype.setView=function(t){this.set(Oo,t)},e.prototype.updateSize=function(){var t=this.getTargetElement();if(t){var e=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)])}else this.setSize(void 0);this.updateViewportSize_()},e.prototype.updateViewportSize_=function(){var t=this.getView();if(t){var e=void 0,i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}},e}(Z),sa=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),oa=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return sa(e,t),e.prototype.createRenderer=function(){return new So(this)},e}(ra),aa=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).boundHandleRotationChanged_=i.handleRotationChanged_.bind(i),i.collapsed_=void 0===n.collapsed||n.collapsed,i.collapsible_=void 0===n.collapsible||n.collapsible,i.collapsible_||(i.collapsed_=!1),i.rotateWithView_=void 0!==n.rotateWithView&&n.rotateWithView,i.viewExtent_=void 0;var r=void 0!==n.className?n.className:"ol-overviewmap",s=void 0!==n.tipLabel?n.tipLabel:"Overview map",o=void 0!==n.collapseLabel?n.collapseLabel:"«";"string"==typeof o?(i.collapseLabel_=document.createElement("span"),i.collapseLabel_.textContent=o):i.collapseLabel_=o;var a=void 0!==n.label?n.label:"»";"string"==typeof a?(i.label_=document.createElement("span"),i.label_.textContent=a):i.label_=a;var l=i.collapsible_&&!i.collapsed_?i.collapseLabel_:i.label_,h=document.createElement("button");h.setAttribute("type","button"),h.title=s,h.appendChild(l),h.addEventListener(L,i.handleClick_.bind(i),!1),i.ovmapDiv_=document.createElement("div"),i.ovmapDiv_.className="ol-overviewmap-map",i.view_=n.view,i.ovmap_=new oa({view:n.view});var c=i.ovmap_;n.layers&&n.layers.forEach((function(t){c.addLayer(t)}));var u=document.createElement("div");u.className="ol-overviewmap-box",u.style.boxSizing="border-box",i.boxOverlay_=new qr({position:[0,0],positioning:pr,element:u}),i.ovmap_.addOverlay(i.boxOverlay_);var d=r+" ol-unselectable ol-control"+(i.collapsed_&&i.collapsible_?" ol-collapsed":"")+(i.collapsible_?"":" ol-uncollapsible"),g=i.element;g.className=d,g.appendChild(i.ovmapDiv_),g.appendChild(h);var _=i,p=i.boxOverlay_,f=i.boxOverlay_.getElement(),m=function(t){var e,i={clientX:(e=t).clientX,clientY:e.clientY},n=c.getEventCoordinateInternal(i);p.setPosition(n)},y=function(t){var e=c.getEventCoordinateInternal(t);_.getMap().getView().setCenterInternal(e),window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",y)};return f.addEventListener("mousedown",(function(){window.addEventListener("mousemove",m),window.addEventListener("mouseup",y)})),i}return sa(e,t),e.prototype.setMap=function(e){var i=this.getMap();if(e!==i){if(i){var n=i.getView();n&&this.unbindView_(n),this.ovmap_.setTarget(null)}if(t.prototype.setMap.call(this,e),e){this.ovmap_.setTarget(this.ovmapDiv_),this.listenerKeys.push(F(e,o,this.handleMapPropertyChange_,this));var r=e.getView();r&&(this.bindView_(r),r.isDef()&&(this.ovmap_.updateSize(),this.resetExtent_()))}}},e.prototype.handleMapPropertyChange_=function(t){if(t.key===Oo){var e=t.oldValue;e&&this.unbindView_(e);var i=this.getMap().getView();this.bindView_(i)}},e.prototype.bindView_=function(t){if(!this.view_){var e=new ar({projection:t.getProjection()});this.ovmap_.setView(e)}t.addEventListener(H(Un),this.boundHandleRotationChanged_),this.handleRotationChanged_()},e.prototype.unbindView_=function(t){t.removeEventListener(H(Un),this.boundHandleRotationChanged_)},e.prototype.handleRotationChanged_=function(){this.rotateWithView_&&this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())},e.prototype.validateExtent_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var i=t.getSize(),n=t.getView().calculateExtentInternal(i);if(!this.viewExtent_||!At(n,this.viewExtent_)){this.viewExtent_=n;var r=e.getSize(),s=e.getView().calculateExtentInternal(r),o=e.getPixelFromCoordinateInternal(ee(n)),a=e.getPixelFromCoordinateInternal(jt(n)),l=Math.abs(o[0]-a[0]),h=Math.abs(o[1]-a[1]),c=r[0],u=r[1];l<.1*c||h<.1*u||l>.75*c||h>.75*u?this.resetExtent_():wt(s,n)||this.recenter_()}}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,i=t.getSize(),n=t.getView().calculateExtentInternal(i),r=e.getView(),s=Math.log(7.5)/Math.LN2;ae(n,1/(.1*Math.pow(2,s/2))),r.fitInternal(Mn(n))},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var i=t.getSize(),n=t.getView(),r=e.getView(),s=this.rotateWithView_?0:-n.getRotation(),o=this.boxOverlay_,a=this.boxOverlay_.getElement(),l=n.getCenterInternal(),h=n.getResolution(),c=r.getResolution(),u=i[0]*h/c,d=i[1]*h/c;if(o.setPosition(l),a){a.style.width=u+"px",a.style.height=d+"px";var g="rotate("+s+"rad)";a.style.transform=g}}},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?Ar(this.collapseLabel_,this.label_):Ar(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),D(t,lr,(function(t){this.updateBox_()}),this)}},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getRotateWithView=function(){return this.rotateWithView_},e.prototype.setRotateWithView=function(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))},e.prototype.getOverviewMap=function(){return this.ovmap_},e.prototype.render=function(t){this.validateExtent_(),this.updateBox_()},e}(jr),la="active",ha=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function ca(t,e,i,n){var r=t.getZoom();if(void 0!==r){var s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:er})}}var ua=function(t){function e(e){var i=t.call(this)||this;return e&&e.handleEvent&&(i.handleEvent=e.handleEvent),i.map_=null,i.setActive(!0),i}return ha(e,t),e.prototype.getActive=function(){return this.get(la)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(la,t)},e.prototype.setMap=function(t){this.map_=t},e}(Z),da=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ga=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.delta_=n.delta?n.delta:1,i.duration_=void 0!==n.duration?n.duration:250,i}return da(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==qo.DBLCLICK){var i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;ca(n.getView(),s,r,this.duration_),t.preventDefault(),e=!0}return!e},e}(ua),_a=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function pa(t){for(var e=t.length,i=0,n=0,r=0;r0}}else if(t.type==qo.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==qo.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===qo.POINTERDOWN||e===qo.POINTERDRAG||e===qo.POINTERUP}(t)){var e=t.originalEvent,i=e.pointerId.toString();t.type==qo.POINTERUP?delete this.trackedPointers_[i]:(t.type==qo.POINTERDOWN||i in this.trackedPointers_)&&(this.trackedPointers_[i]=e),this.targetPointers=v(this.trackedPointers_)}},e}(ua);function ma(t){var e=arguments;return function(t){for(var i=!0,n=0,r=e.length;n0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(fa),Ma=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Aa=function(t){function e(e){var i=this,n=e||{};return(i=t.call(this,{stopDown:p})||this).condition_=n.condition?n.condition:ya,i.lastAngle_=void 0,i.duration_=void 0!==n.duration?n.duration:250,i}return Ma(e,t),e.prototype.handleDragEvent=function(t){if(Oa(t)){var e=t.map,i=e.getView();if(i.getConstraints().rotation!==$n){var n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){var o=s-this.lastAngle_;i.adjustRotationInternal(-o)}this.lastAngle_=s}}},e.prototype.handleUpEvent=function(t){return!Oa(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!Oa(t)&&(!(!Ia(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(fa),Fa=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Da=function(t){function e(e){var i=t.call(this)||this;return i.geometry_=null,i.element_=document.createElement("div"),i.element_.style.position="absolute",i.element_.style.pointerEvents="auto",i.element_.className="ol-box "+e,i.map_=null,i.startPixel_=null,i.endPixel_=null,i}return Fa(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,i=this.element_.style;i.left=Math.min(t[0],e[0])+"px",i.top=Math.min(t[1],e[1])+"px",i.width=Math.abs(e[0]-t[0])+"px",i.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new bn([i])},e.prototype.getGeometry=function(){return this.geometry_},e}(a),Ga=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ka="boxstart",Va="boxdrag",Ba="boxend",Ya=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.coordinate=i,r.mapBrowserEvent=n,r}return Ga(e,t),e}(s),za=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.box_=new Da(n.className||"ol-dragbox"),i.minArea_=void 0!==n.minArea?n.minArea:64,n.onBoxEnd&&(i.onBoxEnd=n.onBoxEnd),i.startPixel_=null,i.condition_=n.condition?n.condition:Ia,i.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:i.defaultBoxEndCondition,i}return Ga(e,t),e.prototype.defaultBoxEndCondition=function(t,e,i){var n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Ya(Va,t.coordinate,t))},e.prototype.handleUpEvent=function(t){return this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd(t),this.dispatchEvent(new Ya(Ba,t.coordinate,t))),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ya(ka,t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}(fa),qa=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Xa=function(t){function e(e){var i=this,n=e||{},r=n.condition?n.condition:La;return(i=t.call(this,{condition:r,className:n.className||"ol-dragzoom",minArea:n.minArea})||this).duration_=void 0!==n.duration?n.duration:200,i.out_=void 0!==n.out&&n.out,i}return qa(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap(),i=e.getView(),n=e.getSize(),r=this.getGeometry().getExtent();if(this.out_){var s=i.calculateExtentInternal(n),o=Pt([e.getPixelFromCoordinateInternal(Xt(r)),e.getPixelFromCoordinateInternal(ie(r))]);ae(s,1/i.getResolutionForExtentInternal(o,n)),r=s}var a=i.getConstrainedResolution(i.getResolutionForExtentInternal(r,n)),l=i.getConstrainedCenter(Ut(r),a);i.animateInternal({resolution:a,center:l,duration:this.duration_,easing:er})},e}(za),ja=37,Ua=38,Wa=39,Ha=40,Za=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ka=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.defaultCondition_=function(t){return Ta(t)&&Na(t)},i.condition_=void 0!==n.condition?n.condition:i.defaultCondition_,i.duration_=void 0!==n.duration?n.duration:100,i.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,i}return Za(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==O){var i=t.originalEvent.keyCode;if(this.condition_(t)&&(i==Ha||i==ja||i==Wa||i==Ua)){var n=t.map.getView(),r=n.getResolution()*this.pixelDelta_,s=0,o=0;i==Ha?o=-r:i==ja?s=-r:i==Wa?s=r:o=r;var a=[s,o];Ye(a,n.getRotation()),function(t,e,i){var n=t.getCenterInternal();if(n){var r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:nr,center:t.getConstrainedCenter(r)})}}(n,a,this.duration_),t.preventDefault(),e=!0}}return!e},e}(ua),Ja=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),$a=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.condition_=n.condition?n.condition:Na,i.delta_=n.delta?n.delta:1,i.duration_=void 0!==n.duration?n.duration:100,i}return Ja(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==O||t.type==R){var i=t.originalEvent.charCode;if(this.condition_(t)&&(i=="+".charCodeAt(0)||i=="-".charCodeAt(0))){var n=t.map,r=i=="+".charCodeAt(0)?this.delta_:-this.delta_;ca(n.getView(),r,void 0,this.duration_),t.preventDefault(),e=!0}}return!e},e}(ua),Qa=function(){function t(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}return t.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},t.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},t.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;var n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;var r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),tl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),el="trackpad",il="wheel",nl=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,n)||this).totalDelta_=0,i.lastDelta_=0,i.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,i.duration_=void 0!==n.duration?n.duration:250,i.timeout_=void 0!==n.timeout?n.timeout:80,i.useAnchor_=void 0===n.useAnchor||n.useAnchor,i.constrainResolution_=void 0!==n.constrainResolution&&n.constrainResolution;var r=n.condition?n.condition:xa;return i.condition_=n.onFocusOnly?ma(va,r):r,i.lastAnchor_=null,i.startTime_=void 0,i.timeoutId_,i.mode_=void 0,i.trackpadEventGap_=400,i.trackpadTimeoutId_,i.deltaPerZoom_=300,i}return tl(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==A)return!0;t.preventDefault();var e,i=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==A&&(e=n.deltaY,wr&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Lr),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?el:il);var s=i.getView();if(this.mode_===el&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=e;var o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),o),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var i=-de(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),ca(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(ua),rl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),sl=function(t){function e(e){var i=this,n=e||{},r=n;return r.stopDown||(r.stopDown=p),(i=t.call(this,r)||this).anchor_=null,i.lastAngle_=void 0,i.rotating_=!1,i.rotationDelta_=0,i.threshold_=void 0!==n.threshold?n.threshold:.3,i.duration_=void 0!==n.duration?n.duration:250,i}return rl(e,t),e.prototype.handleDragEvent=function(t){var e=0,i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){var s=r-this.lastAngle_;this.rotationDelta_+=s,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=s}this.lastAngle_=r;var o=t.map,a=o.getView();if(a.getConstraints().rotation!==$n){var l=o.getViewport().getBoundingClientRect(),h=pa(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=o.getCoordinateFromPixelInternal(h),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(fa),ol=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),al=function(t){function e(e){var i=this,n=e||{},r=n;return r.stopDown||(r.stopDown=p),(i=t.call(this,r)||this).anchor_=null,i.duration_=void 0!==n.duration?n.duration:400,i.lastDistance_=void 0,i.lastScaleDelta_=1,i}return ol(e,t),e.prototype.handleDragEvent=function(t){var e=1,i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;var a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e);var h=a.getViewport().getBoundingClientRect(),c=pa(this.targetPointers);c[0]-=h.left,c[1]-=h.top,this.anchor_=a.getCoordinateFromPixelInternal(c),a.render(),l.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(fa);function ll(t){var e=t||{},i=new Fo,n=new Qa(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&i.push(new Aa),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&i.push(new ga({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&i.push(new ba({onFocusOnly:e.onFocusOnly,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&i.push(new sl),(void 0===e.pinchZoom||e.pinchZoom)&&i.push(new al({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(i.push(new Ka),i.push(new $a({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&i.push(new nl({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&i.push(new Xa({duration:e.zoomDuration})),i}var hl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),cl=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).ulElement_=document.createElement("ul"),i.collapsed_=void 0===n.collapsed||n.collapsed,i.overrideCollapsible_=void 0!==n.collapsible,i.collapsible_=void 0===n.collapsible||n.collapsible,i.collapsible_||(i.collapsed_=!1);var r=void 0!==n.className?n.className:"ol-attribution",s=void 0!==n.tipLabel?n.tipLabel:"Attributions",o=void 0!==n.collapseLabel?n.collapseLabel:"»";"string"==typeof o?(i.collapseLabel_=document.createElement("span"),i.collapseLabel_.textContent=o):i.collapseLabel_=o;var a=void 0!==n.label?n.label:"i";"string"==typeof a?(i.label_=document.createElement("span"),i.label_.textContent=a):i.label_=a;var l=i.collapsible_&&!i.collapsed_?i.collapseLabel_:i.label_,h=document.createElement("button");h.setAttribute("type","button"),h.title=s,h.appendChild(l),h.addEventListener(L,i.handleClick_.bind(i),!1);var c=r+" ol-unselectable ol-control"+(i.collapsed_&&i.collapsible_?" ol-collapsed":"")+(i.collapsible_?"":" ol-uncollapsible"),u=i.element;return u.className=c,u.appendChild(i.ulElement_),u.appendChild(h),i.renderedAttributions_=[],i.renderedVisible_=!0,i}return hl(e,t),e.prototype.collectSourceAttributions_=function(t){for(var e={},i=[],n=t.layerStatesArray,r=0,s=n.length;r0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!g(e,this.renderedAttributions_)){Dr(this.ulElement_);for(var n=0,r=e.length;ni.push(t)),t.interactions=i,super(t),this.actions=[],t.actions.forEach(t=>{this.addAction(t)}),setTimeout(()=>{this.activateDefaultAction()}),!t.disableEscapeKey){const t=t=>{t&&t.keyCode&&27==t.keyCode&&this.activateDefaultAction()};document.body.removeEventListener("keydown",t),document.body.addEventListener("keydown",t)}}activateAction(t){if(this.currentAction){if(this.currentAction==t)return!1;this.currentAction.deactivate(),clearTimeout(this.timeout)}this.currentAction=t,this.timeout=setTimeout(()=>{t.activate()},gl.CLICK_COUNT_TIMEOUT)}addAction(t){this.actions.push(t),t.map=this,t.interactions.forEach(e=>{this.addInteraction(e),e.map=t.map})}removeAction(t){this.currentAction==t&&this.activateDefaultAction(),t.interactions.forEach(t=>{this.removeInteraction(t)}),this.actions.splice(this.actions.indexOf(t),1)}activateDefaultAction(){this.actions.length>0&&this.actions[0]&&(this.currentAction==this.actions[0]&&(this.currentAction.deactivate(),this.currentAction=void 0),this.activateAction(this.actions[0]))}}class _l extends gl{constructor(t){t.layers=[t.customLayers.baseLayerGroup,t.customLayers.overlayGroup],t.controls=t.controls||[new Wr,new Zr,new ns({minWidth:128})],super(t),this.projection=t.projection,this.geoJSONFormat=new Yn({dataProjection:t.projection}),this.custom=t.custom||{},t.customLayers.overviewMapLayers&&t.customLayers.overviewMapLayers.length>0&&this.createOverviewMapControl(t),this.baseLayers=t.customLayers.baseLayerGroup.getLayers().getArray(),this.maxZoomViewToExtent=t.maxZoomViewToExtent||16}createOverviewMapControl(t){const e=this,i=t=>{const i=t=>{let i=0;return e.baseLayers.forEach((t,e)=>{t.getVisible()&&(i=e)}),t[i+1>=t.length?0:i+1]};t||(t=i(e.baseLayers)),e.baseLayers.forEach(e=>e.setVisible(e==t));const n=e.overviewMapControl.getOverviewMap().getLayers().getArray(),r=i(n);n.forEach(t=>t.setVisible(t==r)),e.render(),e.overviewMapControl.getOverviewMap().render()};this.overviewMapLayers=t.customLayers.overviewMapLayers,this.overviewMapControl=new aa({layers:this.overviewMapLayers,collapsed:!1,view:new ar({projection:this.projection})}),this.overviewMapControl.element.addEventListener("click",()=>i(),!1),t.view&&t.controls.push(this.overviewMapControl),this.custom.toggleBaseLayer=i}addBaseLayerAndOverlayMapLayer(t,e){t.setVisible(0===this.baseLayers.length),this.baseLayers.push(t),this.overviewMapControl?this.overviewMapControl.getOverviewMap().getLayers().getArray().push(e):this.createOverviewMapControl({customLayers:{overviewMapLayers:[e]}}),e.setVisible(2===this.overviewMapControl.getOverviewMap().getLayers().getArray().length)}getBaseLayers(){return this.getLayerGroup().getLayers().getArray()[0].getLayers().getArray()}getOverlayLayers(){return this.getLayerGroup().getLayers().getArray()[1].getLayers().getArray()}initializeView(t,e){if(!this.getView().getZoom()){const i=new ar({extent:this.projection.getExtent(),projection:this.projection,maxZoom:16,minZoom:2,center:[140860.69299028325,190532.7165957574],zoom:2});this.zoomViewToExtent(i,t,e),this.setView(i),this.overviewMapControl&&this.addControl(this.overviewMapControl)}}zoomToExtent(t,e){this.zoomViewToExtent(this.getView(),t,e)}zoomViewToExtent(t,e,i){e&&t.fit(e,{size:this.getSize()}),(i||this.maxZoomViewToExtent)&&t.getZoom()>(i||this.maxZoomViewToExtent)&&t.setZoom(i||this.maxZoomViewToExtent)}zoomToGeometry(t,e){const i={type:"FeatureCollection",features:[{type:"Feature",geometry:t}]};this.zoomToExtent(this.geoJSONFormat.readFeatures(i)[0].getGeometry().getExtent(),e)}showInfo(t,e){const i=document.createElement("div");i.setAttribute("class","close"),i.onclick=()=>event.currentTarget.parentNode.remove();const n=document.createElement("div");n.innerHTML=""+t+"
",n.setAttribute("class","info-tooltip"),n.appendChild(i);const r=new qr({offset:[0,-5],positioning:"bottom-center",element:n});this.addOverlay(r),r.setPosition(e),n.parentNode.style.position="fixed"}}var pl=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ia(t.scale),this.displacement_=t.displacement}return t.prototype.clone=function(){var e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return Y()},t.prototype.getImage=function(t){return Y()},t.prototype.getHitDetectionImage=function(){return Y()},t.prototype.getPixelRatio=function(t){return 1},t.prototype.getImageState=function(){return Y()},t.prototype.getImageSize=function(){return Y()},t.prototype.getHitDetectionImageSize=function(){return Y()},t.prototype.getOrigin=function(){return Y()},t.prototype.getSize=function(){return Y()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=ia(t)},t.prototype.listenImageChange=function(t){Y()},t.prototype.load=function(){Y()},t.prototype.unlistenImageChange=function(t){Y()},t}(),fl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ml=function(t){function e(e){var i=this,n=void 0!==e.rotateWithView&&e.rotateWithView;return(i=t.call(this,{opacity:1,rotateWithView:n,rotation:void 0!==e.rotation?e.rotation:0,scale:1,displacement:void 0!==e.displacement?e.displacement:[0,0]})||this).canvas_={},i.hitDetectionCanvas_=null,i.fill_=void 0!==e.fill?e.fill:null,i.origin_=[0,0],i.points_=e.points,i.radius_=void 0!==e.radius?e.radius:e.radius1,i.radius2_=e.radius2,i.angle_=void 0!==e.angle?e.angle:0,i.stroke_=void 0!==e.stroke?e.stroke:null,i.anchor_=null,i.size_=null,i.imageSize_=null,i.hitDetectionImageSize_=null,i.render(),i}return fl(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionCanvas_){var t=this.createRenderOptions();this.createHitDetectionCanvas_(t)}return this.hitDetectionCanvas_},e.prototype.getImage=function(t){if(!this.canvas_[t||1]){var e=this.createRenderOptions(),i=Pr(e.size*t||1,e.size*t||1);this.draw_(e,i,0,0,t||1),this.canvas_[t||1]=i.canvas}return this.canvas_[t||1]},e.prototype.getPixelRatio=function(t){return t},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return uo},e.prototype.getOrigin=function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t){},e.prototype.createRenderOptions=function(){var t,e="round",i="round",n=0,r=null,s=0,o=0;return this.stroke_&&(null===(t=this.stroke_.getColor())&&(t="#000"),t=ks(t),void 0===(o=this.stroke_.getWidth())&&(o=1),r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),void 0===(i=this.stroke_.getLineJoin())&&(i="round"),void 0===(e=this.stroke_.getLineCap())&&(e="round"),void 0===(n=this.stroke_.getMiterLimit())&&(n=10)),{strokeStyle:t,strokeWidth:o,size:2*(this.radius_+o)+1,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}},e.prototype.render=function(){var t=this.createRenderOptions(),e=Pr(t.size,t.size);this.draw_(t,e,0,0,1),this.canvas_[1]=e.canvas;var i=e.canvas.width,n=i,r=this.getDisplacement();this.hitDetectionImageSize_=[t.size,t.size],this.createHitDetectionCanvas_(t),this.anchor_=[i/2-r[0],i/2+r[1]],this.size_=[i,i],this.imageSize_=[n,n]},e.prototype.draw_=function(t,e,i,n,r){var s,o,a;e.setTransform(r,0,0,r,0,0),e.translate(i,n),e.beginPath();var l=this.points_;if(l===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var h=void 0!==this.radius2_?this.radius2_:this.radius_;for(h!==this.radius_&&(l*=2),s=0;s<=l;s++)o=2*s*Math.PI/l-Math.PI/2+this.angle_,a=s%2==0?this.radius_:h,e.lineTo(t.size/2+a*Math.cos(o),t.size/2+a*Math.sin(o))}if(this.fill_){var c=this.fill_.getColor();null===c&&(c="#000"),e.fillStyle=ks(c),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,e.setLineDash&&t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke()),e.closePath()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionCanvas_=this.getImage(1),this.fill_){var e=this.fill_.getColor(),i=0;if("string"==typeof e&&(e=cs(e)),null===e?i=1:Array.isArray(e)&&(i=4===e.length?e[3]:1),0===i){var n=Pr(t.size,t.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(t,n,0,0)}}},e.prototype.drawHitDetectionCanvas_=function(t,e,i,n){e.translate(i,n),e.beginPath();var r=this.points_;if(r===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var s=void 0!==this.radius2_?this.radius2_:this.radius_;s!==this.radius_&&(r*=2);var o=void 0,a=void 0,l=void 0;for(o=0;o<=r;o++)l=2*o*Math.PI/r-Math.PI/2+this.angle_,a=o%2==0?this.radius_:s,e.lineTo(t.size/2+a*Math.cos(l),t.size/2+a*Math.sin(l))}e.fillStyle="#000",e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e}(pl),yl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),vl=function(t){function e(e){var i=e||{};return t.call(this,{points:1/0,fill:i.fill,radius:i.radius,stroke:i.stroke,displacement:void 0!==i.displacement?i.displacement:[0,0]})||this}return yl(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),displacement:this.getDisplacement().slice()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.setRadius=function(t){this.radius_=t,this.render()},e}(ml),xl=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0})},t.prototype.getColor=function(){return this.color_},t.prototype.setColor=function(t){this.color_=t},t}(),El=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},t.prototype.getColor=function(){return this.color_},t.prototype.getLineCap=function(){return this.lineCap_},t.prototype.getLineDash=function(){return this.lineDash_},t.prototype.getLineDashOffset=function(){return this.lineDashOffset_},t.prototype.getLineJoin=function(){return this.lineJoin_},t.prototype.getMiterLimit=function(){return this.miterLimit_},t.prototype.getWidth=function(){return this.width_},t.prototype.setColor=function(t){this.color_=t},t.prototype.setLineCap=function(t){this.lineCap_=t},t.prototype.setLineDash=function(t){this.lineDash_=t},t.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t},t.prototype.setLineJoin=function(t){this.lineJoin_=t},t.prototype.setMiterLimit=function(t){this.miterLimit_=t},t.prototype.setWidth=function(t){this.width_=t},t}(),Il=function(){function t(t){var e=t||{};this.geometry_=null,this.geometryFunction_=Tl,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}return t.prototype.clone=function(){var e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},t.prototype.getRenderer=function(){return this.renderer_},t.prototype.setRenderer=function(t){this.renderer_=t},t.prototype.getGeometry=function(){return this.geometry_},t.prototype.getGeometryFunction=function(){return this.geometryFunction_},t.prototype.getFill=function(){return this.fill_},t.prototype.setFill=function(t){this.fill_=t},t.prototype.getImage=function(){return this.image_},t.prototype.setImage=function(t){this.image_=t},t.prototype.getStroke=function(){return this.stroke_},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.getText=function(){return this.text_},t.prototype.setText=function(t){this.text_=t},t.prototype.getZIndex=function(){return this.zIndex_},t.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Tl,this.geometry_=t},t.prototype.setZIndex=function(t){this.zIndex_=t},t}();var Cl=null;function wl(t,e){if(!Cl){var i=new xl({color:"rgba(255,255,255,0.4)"}),n=new El({color:"#3399CC",width:1.25});Cl=[new Il({image:new vl({fill:i,stroke:n,radius:5}),fill:i,stroke:n})]}return Cl}function Sl(){var t={},e=[255,255,255,1],i=[0,153,255,1];return t[De.POLYGON]=[new Il({fill:new xl({color:[255,255,255,.5]})})],t[De.MULTI_POLYGON]=t[De.POLYGON],t[De.LINE_STRING]=[new Il({stroke:new El({color:e,width:5})}),new Il({stroke:new El({color:i,width:3})})],t[De.MULTI_LINE_STRING]=t[De.LINE_STRING],t[De.CIRCLE]=t[De.POLYGON].concat(t[De.LINE_STRING]),t[De.POINT]=[new Il({image:new vl({radius:6,fill:new xl({color:i}),stroke:new El({color:e,width:1.5})}),zIndex:1/0})],t[De.MULTI_POINT]=t[De.POINT],t[De.GEOMETRY_COLLECTION]=t[De.POLYGON].concat(t[De.LINE_STRING],t[De.POINT]),t}function Tl(t){return t.getGeometry()}var Ll=Il,Nl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ol="select",Rl=function(t){function e(e,i,n,r){var s=t.call(this,e)||this;return s.selected=i,s.deselected=n,s.mapBrowserEvent=r,s}return Nl(e,t),e}(s),Pl={};var bl=function(t){function e(e){var i,n,r=t.call(this)||this,s=e||{};if(r.boundAddFeature_=r.addFeature_.bind(r),r.boundRemoveFeature_=r.removeFeature_.bind(r),r.condition_=s.condition?s.condition:Sa,r.addCondition_=s.addCondition?s.addCondition:Ca,r.removeCondition_=s.removeCondition?s.removeCondition:Ca,r.toggleCondition_=s.toggleCondition?s.toggleCondition:La,r.multi_=!!s.multi&&s.multi,r.filter_=s.filter?s.filter:_,r.hitTolerance_=s.hitTolerance?s.hitTolerance:0,r.style_=void 0!==s.style?s.style:(d((i=Sl())[De.POLYGON],i[De.LINE_STRING]),d(i[De.GEOMETRY_COLLECTION],i[De.LINE_STRING]),function(t){return t.getGeometry()?i[t.getGeometry().getType()]:null}),r.features_=s.features||new Fo,s.layers)if("function"==typeof s.layers)n=s.layers;else{var o=s.layers;n=function(t){return h(o,t)}}else n=_;return r.layerFilter_=n,r.featureLayerAssociation_={},r}return Nl(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[q(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[q(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),t.prototype.setMap.call(this,e),e?(this.features_.addEventListener(Ro,this.boundAddFeature_),this.features_.addEventListener(Po,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(Ro,this.boundAddFeature_),this.features_.removeEventListener(Po,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.applySelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.restorePreviousStyle_(e)},e.prototype.getStyle=function(){return this.style_},e.prototype.applySelectedStyle_=function(t){var e=q(t);e in Pl||(Pl[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){var i=q(t),n=this.getMap().getInteractions().getArray().filter((function(i){return i instanceof e&&i.getStyle()&&-1!==i.getFeatures().getArray().indexOf(t)}));n.length>0?t.setStyle(n[n.length-1].getStyle()):(t.setStyle(Pl[i]),delete Pl[i])},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[q(t)]},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,s=t.map,o=this.getFeatures(),a=[],l=[];if(r){y(this.featureLayerAssociation_),s.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return l.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var c=o.getLength()-1;c>=0;--c){var u=o.item(c),d=l.indexOf(u);d>-1?l.splice(d,1):(o.remove(u),a.push(u))}0!==l.length&&o.extend(l)}else{s.forEachFeatureAtPixel(t.pixel,function(t,r){if(this.filter_(t,r))return!e&&!n||h(o.getArray(),t)?(i||n)&&h(o.getArray(),t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(l.push(t),this.addFeatureLayerAssociation_(t,r)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var g=a.length-1;g>=0;--g)o.remove(a[g]);o.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new Rl(Ol,l,a,t)),!0},e}(ua);class Ml{constructor(t){Array.isArray(t)||(t=[t]),this.interactions=[],t.forEach(t=>{this.addInteraction(t)})}addInteraction(t){t.setActive(!1),this.interactions.push(t)}activate(){this.interactions.forEach(t=>{t.setActive(!0)})}deactivate(){this.interactions.forEach(t=>{t.setActive(!1)})}}class Al extends Ml{constructor(t,e,i){const n=i&&i.cluster,r=i&&i.filter?i.filter:()=>!0,s=i?i.style:null,o=i&&i.hoverStyle||s,a=(t,e)=>(this.selectInteraction.getFeatures().clear(),this.filter(t,e)),l=(t,e)=>{const i=-1!==this.selectInteraction.getFeatures().getArray().indexOf(t);return this.filter(t,e)&&!i},h=new bl({filter:l,condition:wa,style:o,layers:[t]}),c=new bl({style:s,layers:[t]}),u=new bl({filter:a,condition:Ea,style:s,layers:[t]});super([c,u,h]),this.cluster=n,this.filter=r,this.layer=t,this.style=s,this.hoverStyle=o,this.hoverInteraction=h,this.markInteraction=c,this.selectInteraction=u,this.hoverInteraction.on("select",()=>{const t=this.map.getTargetElement();this.hoverInteraction.getFeatures().getLength()>0?t.style.cursor="pointer":t.style.cursor="",this.map.render()}),this.selectedFeature=null,this.getLayer=()=>t;const d=t=>{let e=t.getArray().indexOf(this.selectedFeature)+1;return e>t.getLength()-1&&(e=0),t.getArray()[e]};this.selectInteraction.on("select",t=>{this.markInteraction.getFeatures().clear(),this.selectInteraction.getFeatures().getLength()>0?(1===this.selectInteraction.getFeatures().getLength()?this.selectedFeature=this.selectInteraction.getFeatures().getArray()[0]:this.selectedFeature=d(this.selectInteraction.getFeatures()),e&&e(this.selectedFeature,t,this.getLayer())):(this.selectedFeature=null,e&&e()),this.map.render()}),this.selectInteractionFilter=a,this.hoverInteractionFilter=l}_fixClusterBehavior(){if(this.selectedFeature){const t=this.selectedFeature.get("features")||[this.selectedFeature];this.selectInteraction.getFeatures().clear(),this.markInteraction.getFeatures().clear(),t&&t.forEach(t=>{t.getId()&&this.markFeatureWithId(t.getId())})}}getClusterWithFeatureId(t,e){for(let i=0;ithis._fixClusterBehavior(),this.map.on("moveend",this._fixClusterBehaviorListener),this.selectInteraction.on("select",this._fixClusterBehaviorListener)),super.activate()}deactivate(){this._fixClusterBehaviorListener&&(this.map.un("moveend",this._fixClusterBehaviorListener),this.selectInteraction.un("select",this._fixClusterBehaviorListener)),this.clearFeatures(),super.deactivate()}selectFeature(t){this.selectInteraction.getFeatures().push(t),this.selectInteraction.dispatchEvent({type:"select",feature:t})}getSelectedFeatures(){return this.selectInteraction.getFeatures()}deselect(){this.selectedFeature=null}markFeatureWithId(t,e){const i=(e=e||this.layer).getSource().getFeatureById(t)||this.getClusterWithFeatureId(e.getSource().getFeatures(),t);i&&-1===this.markInteraction.getFeatures().getArray().indexOf(i)&&this.markInteraction.getFeatures().push(i)}isMarked(t){let e=!1;return this.markInteraction.getFeatures().forEach(i=>{i===t&&(e=!0)}),e}demarkAllFeatures(){this.markInteraction.getFeatures().clear()}}class Fl extends Al{constructor(t,e,i){super(t,t=>{t&&e([t])},i),this.dragBoxInteraction=new za({style:new Ll({stroke:new El({color:[0,0,255,1]})})}),this.addInteraction(this.dragBoxInteraction),this.dragBoxInteraction.on("boxdrag",()=>{const e=this.dragBoxInteraction.getGeometry().getExtent();this.hoverInteraction.getFeatures().clear(),t.getSource().forEachFeatureIntersectingExtent(e,t=>{this.hoverInteraction.getFeatures().push(t)})}),this.dragBoxInteraction.on("boxend",()=>{this.hoverInteraction.getFeatures().getLength()>0&&e(this.hoverInteraction.getFeatures().getArray().slice(0))})}}class Dl extends Fl{constructor(t,e,i){const n=new Ll({fill:new xl({color:"rgba(217, 83, 79, 0.6)"}),stroke:new El({color:"#d9534f",width:5}),image:new vl({radius:4,stroke:new El({color:"#d9534f",width:5}),fill:new xl({color:"rgba(217, 83, 79, 0.6)"})})}),r=i&&i.style||n,s=e=>{e&&t.getSource().getFeatureById(e.getId())===e&&t.getSource().removeFeature(e)};super(t,t=>{e&&null!=e?e(t,t=>{s(t),this.clearFeatures()},()=>{this.clearFeatures()}):(t.forEach(t=>{s(t)}),this.clearFeatures())},{style:r})}}var Gl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),kl=function(t){function e(e,i,n){var r=t.call(this)||this;if(void 0!==n&&void 0===i)r.setFlatCoordinates(n,e);else{var s=i||0;r.setCenterAndRadius(e,s,n)}return r}return Gl(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,i,n){var r=this.flatCoordinates,s=t-r[0],o=e-r[1],a=s*s+o*o;if(a=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||zt(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(var r=1;rthis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,i=[Hl.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[Hl.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)},e.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!g(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[Hl.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Et(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;xt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(Gs),Jl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),$l=function(t){function e(e,i,n,r){var s=t.call(this,e,i,n,r)||this;return s.declutterGroups_=null,s.hitDetectionImage_=null,s.image_=null,s.imagePixelRatio_=void 0,s.anchorX_=void 0,s.anchorY_=void 0,s.height_=void 0,s.opacity_=void 0,s.originX_=void 0,s.originY_=void 0,s.rotateWithView_=void 0,s.rotation_=void 0,s.scale_=void 0,s.width_=void 0,s}return Jl(e,t),e.prototype.drawCoordinates_=function(t,e,i,n){return this.appendFlatCoordinates(t,e,i,n,!1,!1)},e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,s=this.drawCoordinates_(i,0,i.length,n);this.instructions.push([Hl.DRAW_IMAGE,r,s,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,this.declutterGroups_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_)]),this.hitDetectionInstructions.push([Hl.DRAW_IMAGE,r,s,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,s=this.drawCoordinates_(i,0,i.length,n);this.instructions.push([Hl.DRAW_IMAGE,r,s,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,this.declutterGroups_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_)]),this.hitDetectionInstructions.push([Hl.DRAW_IMAGE,r,s,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var i=t.getAnchor(),n=t.getSize(),r=t.getHitDetectionImage(),s=t.getImage(this.pixelRatio),o=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.declutterGroups_=e,this.hitDetectionImage_=r,this.image_=s,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=o[0],this.originY_=o[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0]},e}(Kl),Ql=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),th=function(t){function e(e,i,n,r){return t.call(this,e,i,n,r)||this}return Ql(e,t),e.prototype.drawFlatCoordinates_=function(t,e,i,n){var r=this.coordinates.length,s=this.appendFlatCoordinates(t,e,i,n,!1,!1),o=[Hl.MOVE_TO_LINE_TO,r,s];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i},e.prototype.drawLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Hl.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Ul);var s=t.getFlatCoordinates(),o=t.getStride();this.drawFlatCoordinates_(s,0,s.length,o),this.hitDetectionInstructions.push(jl),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Hl.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Ul);for(var s=t.getEnds(),o=t.getFlatCoordinates(),a=t.getStride(),l=0,h=0,c=s.length;ht&&(m>f&&(f=m,_=y,p=s),m=0,y=s-r)),o=a,c=d,u=g),l=v,h=x}return(m+=a)>f?[y,s]:[_,p]}var oh=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ah={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},lh={Circle:ih,Default:Kl,Image:$l,LineString:th,Polygon:ih,Text:function(t){function e(e,i,n,r){var s=t.call(this,e,i,n,r)||this;return s.declutterGroups_,s.labels_=null,s.text_="",s.textOffsetX_=0,s.textOffsetY_=0,s.textRotateWithView_=void 0,s.textRotation_=0,s.textFillState_=null,s.fillStates={},s.textStrokeState_=null,s.strokeStates={},s.textState_={},s.textStates={},s.textKey_="",s.fillKey_="",s.strokeKey_="",s}return oh(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(""!==this.text_&&r&&(i||n)){var s,o,a=this.coordinates.length,l=t.getType(),h=null,c=2,u=t.getStride();if(r.placement===rh){if(!re(this.getBufferedMaxExtent(),t.getExtent()))return;var d=void 0;if(h=t.getFlatCoordinates(),l==De.LINE_STRING)d=[h.length];else if(l==De.MULTI_LINE_STRING)d=t.getEnds();else if(l==De.POLYGON)d=t.getEnds().slice(0,1);else if(l==De.MULTI_POLYGON){var g=t.getEndss();for(d=[],s=0,o=g.length;s_[_.length-n]}else d=t[e]>t[i-n];for(var p,f,m=r.length,y=t[e],v=t[e+1],x=t[e+=n],E=t[e+1],I=0,C=Math.sqrt(Math.pow(x-y,2)+Math.pow(E-v,2)),w=!1,S=0;S0?-Math.PI:Math.PI),void 0!==f){var P=R-f;if(w=w||0!==P,P+=P>Math.PI?-2*Math.PI:P<-Math.PI?2*Math.PI:0,Math.abs(P)>o)return null}f=R;var b=O/C,M=ve(y,x,b),A=ve(v,E,b);g[p]=[M,A,L/2,R,T],s+=L}return w?g:[[g[0][0],g[0][1],g[0][2],g[0][3],r]]}var mh=[1/0,1/0,-1/0,-1/0],yh=[1,0,0,1,0,0],vh=[],xh=[],Eh=[],Ih=[],Ch=function(){function t(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.declutterItems=[],this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderBuffer_=r,this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}return t.prototype.createLabel=function(t,e,i,n){var r=t+e+i+n;if(this.labels_[r])return this.labels_[r];var s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=ah[a.textAlign||"center"],u=n&&s.lineWidth?s.lineWidth:0,d=t.split("\n"),g=d.length,_=[],p=function(t,e,i){for(var n=e.length,r=0,s=0;sr.width?r.width-c:p,E=l+u>r.height?r.height-u:l,I=f[3]+x*g[0]+f[1],C=f[0]+E*g[1]+f[2],w=i-f[3],S=n-f[0];(v||0!==d)&&(vh[0]=w,Ih[0]=w,vh[1]=S,xh[1]=S,xh[0]=w+I,Eh[0]=xh[0],Eh[1]=S+C,Ih[1]=Eh[1]);var T=null;if(0!==d){var L=i+s,N=n+o;T=ot(yh,L,N,1,1,d,-L,-N),st(yh,vh),st(yh,xh),st(yh,Eh),st(yh,Ih),Nt(Math.min(vh[0],xh[0],Eh[0],Ih[0]),Math.min(vh[1],xh[1],Eh[1],Ih[1]),Math.max(vh[0],xh[0],Eh[0],Ih[0]),Math.max(vh[1],xh[1],Eh[1],Ih[1]),mh)}else Nt(w,S,w+I,S+C,mh);var O=0,R=0;if(a){var P=this.renderBuffer_;P[0]=Math.max(P[0],ne(mh)),O=P[0],P[1]=Math.max(P[1],Kt(mh)),R=P[1]}var b=t.canvas,M=y?y[2]*g[0]/2:0,A=mh[0]-M<=(b.width+O)/e&&mh[2]+M>=-O/e&&mh[1]-M<=(b.height+R)/e&&mh[3]+M>=-R/e;if(_&&(i=Math.round(i),n=Math.round(n)),a){if(!A&&1==a[0])return!1;var F=A?[t,T?T.slice(0):null,h,r,c,u,x,E,i,n,g,mh.slice()]:null;F&&(v&&F.push(m,y,vh.slice(0),xh.slice(0),Eh.slice(0),Ih.slice(0)),a.push(F))}else A&&(v&&this.replayTextBackground_(t,vh,xh,Eh,Ih,m,y,!1),Qs(t,T,h,r,c,u,x,E,i,n,g));return!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=st(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.renderDeclutter=function(t,e,i,n){for(var r=[],s=1,o=t.length;s12&&this.replayTextBackground_(u[0],u[14],u[15],u[16],u[17],u[12],u[13],!0),Qs.apply(void 0,u),g!==i&&(d.globalAlpha=g)}}return t.length=1,n},t.prototype.drawLabelWithPointPlacement_=function(t,e,i,n){var r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=ah[r.textAlign||"center"],h=ah[r.textBaseline||"middle"],c=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*c,anchorY:h*s.height/a+2*(.5-h)*c}},t.prototype.execute_=function(t,e,i,n,r,s,o){var a,l,h;this.declutterItems.length=0,this.pixelCoordinates_&&g(i,this.renderedTransform_)?a=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),a=pi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),l=this.renderedTransform_,h=i,l[0]=h[0],l[1]=h[1],l[2]=h[2],l[3]=h[3],l[4]=h[4],l[5]=h[5]);for(var c,u,d,_,p,f,m,y,v,x,E,I,C,w,S,T,L,N=0,O=n.length,R=0,P=0,b=0,M=null,A=null,F=this.coordinateCache_,D=this.viewRotation_,G=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,k={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:D},V=this.instructions!=n||this.overlaps?0:200;NV&&(this.fill_(t),P=0),b>V&&(t.stroke(),b=0),P||b||(t.beginPath(),_=NaN,p=NaN),++N;break;case Hl.CIRCLE:var Y=a[R=B[1]],z=a[R+1],q=a[R+2]-Y,X=a[R+3]-z,j=Math.sqrt(q*q+X*X);t.moveTo(Y+j,z),t.arc(Y,z,j,0,2*Math.PI,!0),++N;break;case Hl.CLOSE_PATH:t.closePath(),++N;break;case Hl.CUSTOM:R=B[1],c=B[2];var U=B[3],W=B[4],H=6==B.length?B[5]:void 0;k.geometry=U,k.feature=S,N in F||(F[N]=[]);var Z=F[N];H?H(a,R,c,2,Z):(Z[0]=a[R],Z[1]=a[R+1],Z.length=2),W(Z,k),++N;break;case Hl.DRAW_IMAGE:R=B[1],c=B[2],x=B[3],u=B[4],d=B[5],v=s?null:B[6];var K=B[7],J=B[8],$=B[9],Q=B[10],tt=B[11],et=B[12],it=B[13],nt=B[14];if(!x&&B.length>=19){E=B[18],I=B[19],C=B[20],w=B[21];var rt=this.drawLabelWithPointPlacement_(E,I,C,w);x=rt.label,B[3]=x;var st=B[22];u=(rt.anchorX-st)*this.pixelRatio,B[4]=u;var ot=B[23];d=(rt.anchorY-ot)*this.pixelRatio,B[5]=d,K=x.height,B[7]=K,nt=x.width,B[14]=nt}var at=void 0;B.length>24&&(at=B[24]);var lt=void 0,ht=void 0,ct=void 0;B.length>16?(lt=B[15],ht=B[16],ct=B[17]):(lt=Bs,ht=!1,ct=!1),tt&&G?et+=D:tt||G||(et-=D);for(var ut=0,dt=0;R=s;)Lh(i,t+r,t+s),Lh(i,t+s,t+r),Lh(i,t-s,t+r),Lh(i,t-r,t+s),Lh(i,t-r,t-s),Lh(i,t-s,t-r),Lh(i,t+s,t-r),Lh(i,t+r,t-s),s++,2*((o+=1+2*s)-r)+1>0&&(o+=1-2*(r-=1));return Th[t]=i,i}(n);function g(t){for(var e=c.getImageData(0,0,o,o).data,i=0;i0){var a=void 0;return(!s||u!=so&&u!=lo||-1!==s.indexOf(t))&&(a=r(t)),a||void c.clearRect(0,0,o,o)}}var _,p,f,m,y,v=Object.keys(this.executorsByZIndex_).map(Number);for(v.sort(l),_=v.length-1;_>=0;--_){var x=v[_].toString();for(f=this.executorsByZIndex_[x],p=wh.length-1;p>=0;--p)if(void 0!==(m=f[u=wh[p]])&&(y=m.executeHitDetection(c,a,i,g,h)))return y}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return pi(o,0,8,2,t,o),o},t.prototype.isEmpty=function(){return x(this.executorsByZIndex_)},t.prototype.execute=function(t,e,i,n,r,s,o){var a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(l),this.maxExtent_&&(t.save(),this.clip(t,i));var h,c,u,d,g,_,p=s||wh;for(h=0,c=a.length;h=r)for(n=r;n0,6);var u=void 0!==n.src?ho:uo;return i.color_=void 0!==n.color?cs(n.color):null,i.iconImage_=function(t,e,i,n,r,s){var o=ps.get(e,n,s);return o||(o=new Yh(t,e,i,n,r,s),ps.set(e,n,s,o)),o}(l,c,h,i.crossOrigin_,u,i.color_),i.offset_=void 0!==n.offset?n.offset:[0,0],i.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:Mh,i.origin_=null,i.size_=void 0!==n.size?n.size:null,i}return zh(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==Oh||this.anchorYUnits_==Oh){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==Oh&&(t[0]*=e[0]),this.anchorYUnits_==Oh&&(t[1]*=e[1])}if(this.anchorOrigin_!=Mh){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=Ah&&this.anchorOrigin_!=bh||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Ph&&this.anchorOrigin_!=bh||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_,e=this.getDisplacement();if(this.offsetOrigin_!=Mh){var i=this.getSize(),n=this.iconImage_.getSize();if(!i||!n)return null;t=t.slice(),this.offsetOrigin_!=Ah&&this.offsetOrigin_!=bh||(t[0]=n[0]-i[0]-t[0]),this.offsetOrigin_!=Ph&&this.offsetOrigin_!=bh||(t[1]=n[1]-i[1]-t[1])}return t[0]+=e[0],t[1]+=e[1],this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(w,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(w,t)},e}(pl);var Xh=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),jh=function(t){function e(e){var i=t.call(this,e)||this;return i.boundHandleStyleImageChange_=i.handleStyleImageChange_.bind(i),i.animatingOrInteracting_,i.dirty_=!1,i.hitDetectionImageData_=null,i.renderedFeatures_=null,i.renderedRevision_=-1,i.renderedResolution_=NaN,i.renderedExtent_=[1/0,1/0,-1/0,-1/0],i.renderedRotation_,i.renderedCenter_=null,i.renderedProjection_=null,i.renderedRenderOrder_=null,i.replayGroup_=null,i.replayGroupChanged=!0,i.clipping=!0,i}return Xh(e,t),e.prototype.useContainer=function(e,i,n){n<1&&(e=null),t.prototype.useContainer.call(this,e,i,n)},e.prototype.renderFrame=function(t,e){var i=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];!function(t,e,i){rt(t,e,0,0,i,0,0)}(this.pixelTransform,1/i,1/i),at(this.inversePixelTransform,this.pixelTransform);var r=lt(this.pixelTransform);this.useContainer(e,r,n.opacity);var s=this.context,o=s.canvas,a=this.replayGroup_;if(!a||a.isEmpty())return!this.containerReused&&o.width>0&&(o.width=0),this.container;var h=Math.round(t.size[0]*i),c=Math.round(t.size[1]*i);o.width!=h||o.height!=c?(o.width=h,o.height=c,o.style.transform!==r&&(o.style.transform=r)):this.containerReused||s.clearRect(0,0,h,c),this.preRender(s,t);var u=t.extent,d=t.viewState,g=d.center,_=d.resolution,p=d.projection,f=d.rotation,m=p.getExtent(),y=this.getLayer().getSource(),v=!1;if(n.extent&&this.clipping){var x=_i(n.extent,p);(v=!wt(x,t.extent)&&re(x,t.extent))&&this.clipUnrotated(s,t,x)}var E=t.viewHints,I=!(E[zn]||E[qn]),C=this.getRenderTransform(g,_,f,i,h,c,0),w=this.getLayer().getDeclutter()?{}:null;if(a.execute(s,1,C,f,I,void 0,w),y.getWrapX()&&p.canWrapX()&&!wt(m,u)){for(var S=u[0],T=ne(m),L=0,N=void 0;Sm[2];){N=T*++L;var R=this.getRenderTransform(g,_,f,i,h,c,N);a.execute(s,1,R,f,I,void 0,w),S-=T}}if(w){var P=t.viewHints;!function(t,e,i,n,r,s){for(var o=Object.keys(t).map(Number).sort(l),a=0,h=o.length;a0&&(u=_,s.push({items:_.declutterItems,opacity:n}))}}(w,s,f,1,!(P[zn]||P[qn]),t.declutterItems)}v&&s.restore(),this.postRender(s,t);var b=n.opacity,M=this.container;return b!==parseFloat(M.style.opacity)&&(M.style.opacity=1===b?"":String(b)),this.renderedRotation_!==d.rotation&&(this.renderedRotation_=d.rotation,this.hitDetectionImageData_=null),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e,i){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var n=[this.context.canvas.width,this.context.canvas.height];st(this.pixelTransform,n);var r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,h=this.renderedExtent_,c=this.getLayer(),u=[],d=n[0]/2,g=n[1]/2;u.push(this.getRenderTransform(r,s,o,.5,d,g,0).slice());var _=c.getSource(),p=a.getExtent();if(_.getWrapX()&&a.canWrapX()&&!wt(p,h)){for(var f=h[0],m=ne(p),y=0,v=void 0;fp[2];)v=m*++y,u.push(this.getRenderTransform(r,s,o,.5,d,g,v).slice()),f-=m}this.hitDetectionImageData_=function(t,e,i,n,r,s,o){var a=Pr(t[0]/2,t[1]/2);a.imageSmoothingEnabled=!1;for(var h=a.canvas,c=new io(a,.5,r,null,o),u=i.length,d=Math.floor(16777215/u),g={},_=1;_<=u;++_){var p=i[_-1],f=p.getStyleFunction()||n;if(n){var m=f(p,s);if(m){Array.isArray(m)||(m=[m]);for(var y="#"+("000000"+(_*d).toString(16)).slice(-6),v=0,x=m.length;vy[0]&&E[2]>y[2]&&m.push([E[0]-v,E[1],E[2]-v,E[3]])}if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&wt(this.renderedExtent_,f))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var I,C=new hh(mo(c,u),f,c,u,e.getDeclutter()),w=ci();if(w){for(var S=0,T=m.length;S=200&&a.status<300){var s=e.getType(),l=void 0;s==Li||s==Ni?l=a.responseText:s==Oi?(l=a.responseXML)||(l=(new DOMParser).parseFromString(a.responseText,"application/xml")):s==Ti&&(l=a.response),l?i.call(this,e.readFeatures(l,{extent:r,featureProjection:o}),e.readProjection(l)):n.call(this)}else n.call(this)}.bind(this),a.onerror=function(){n.call(this)}.bind(this),a.send()}}(t,e,(function(t,e){"function"==typeof this.addFeatures&&this.addFeatures(t)}),f)}var ac=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),lc=function(t){function e(e,i){var n=t.call(this,e)||this;return n.feature=i,n}return ac(e,t),e}(s),hc=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{attributions:n.attributions,projection:void 0,state:Ms,wrapX:void 0===n.wrapX||n.wrapX})||this).loader_=f,i.format_=n.format,i.overlaps_=void 0===n.overlaps||n.overlaps,i.url_=n.url,void 0!==n.loader?i.loader_=n.loader:void 0!==i.url_&&($(i.format_,7),i.loader_=oc(i.url_,i.format_)),i.strategy_=void 0!==n.strategy?n.strategy:ic;var r,s,o=void 0===n.useSpatialIndex||n.useSpatialIndex;return i.featuresRtree_=o?new Hh:null,i.loadedExtentsRtree_=new Hh,i.nullGeometryFeatures_={},i.idIndex_={},i.uidIndex_={},i.featureChangeKeys_={},i.featuresCollection_=null,Array.isArray(n.features)?s=n.features:n.features&&(s=(r=n.features).getArray()),o||void 0!==r||(r=new Fo(s)),void 0!==s&&i.addFeaturesInternal(s),void 0!==r&&i.bindFeaturesCollection_(r),i}return ac(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=q(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var i=t.getGeometry();if(i){var n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new lc($h,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[F(e,w,this.handleFeatureChange_,this),F(e,o,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var i=!0,n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&($(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],i=[],n=[],r=0,s=t.length;r=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,i=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===qo.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===qo.POINTERDOWN?n=!1:i?(n=e.type===qo.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.preventDefault()):("mouse"==e.originalEvent.pointerType||e.type===qo.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===qo.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new zo(qo.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var i=this.mode_===_c;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||i?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate):(this.startDrawing_(t),this.mode_===uc&&this.finishDrawing()),e=!1):this.freehand_&&this.abortDrawing(),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,i=t.pixel,n=e[0]-i[0],r=e[1]-i[1],s=n*n+r*r;if(this.shouldHandle_=this.freehand_?s>this.squaredClickTolerance_:s<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t)},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var i=!1,n=[this.finishCoordinate_];if(this.mode_===dc)i=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===gc){var r=this.sketchCoords_;i=r[0].length>this.minPoints_,n=[r[0][0],r[0][r[0].length-2]]}if(i)for(var s=t.map,o=0,a=n.length;o=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(t.slice()),this.geometryFunction_(i,n,r)):this.mode_===gc&&((i=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(t.slice()),e&&(this.finishCoordinate_=i[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();this.mode_===dc?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e,i),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===gc&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)),0===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,i=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===dc?(e.pop(),this.geometryFunction_(e,i,n)):this.mode_===gc&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),this.type_===De.MULTI_POINT?t.setGeometry(new vn([e])):this.type_===De.MULTI_LINE_STRING?t.setGeometry(new pn([e])):this.type_===De.MULTI_POLYGON&&t.setGeometry(new Gn([e])),this.dispatchEvent(new yc(fc,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new yc(mc,t))},e.prototype.appendCoordinates=function(t){var e=this.mode_,i=[];e===dc?i=this.sketchCoords_:e===gc&&(i=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]);for(var n=i.pop(),r=0;r=0;--a)s.remove(o[a])}i&&(G(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])},e.prototype.setMap=function(e){var i=this.getMap(),n=this.featuresListenerKeys_,r=this.getFeatures_();i&&(n.forEach(G),n.length=0,r.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(F(this.features_,Ro,this.handleFeatureAdd_,this),F(this.features_,Po,this.handleFeatureRemove_,this)):this.source_&&n.push(F(this.source_,$h,this.handleFeatureAdd_,this),F(this.source_,ec,this.handleFeatureRemove_,this)),r.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,i){var n=vt([i.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),i.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),r=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(r=r.filter((function(t){return t.feature.getGeometry().getType()!==De.CIRCLE})));var s=!1,o=null,a=null;if(0===r.length)return{snapped:s,vertex:o,vertexPixel:a};for(var l,h=i.getView().getProjection(),c=di(e,h),u=1/0,d=0;dv?p[1]:p[0],a=i.getPixelFromCoordinate(o))}else if(this.edge_){var x=l.feature.getGeometry().getType()===De.CIRCLE;if(x){var E=l.feature.getGeometry(),I=ci();I&&(E=E.clone().transform(I,h)),o=ui(function(t,e){var i=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1],o=t[0]-r,a=t[1]-s;0===o&&0===a&&(o=1);var l=Math.sqrt(o*o+a*a);return[r+i*o/l,s+i*a/l]}(c,E),h)}else Ic[0]=di(p[0],h),Ic[1]=di(p[1],h),o=ui(Ve(c,Ic),h);if(Xe(t,a=i.getPixelFromCoordinate(o))<=this.pixelTolerance_&&(s=!0,this.vertex_&&!x)){f=i.getPixelFromCoordinate(p[0]),m=i.getPixelFromCoordinate(p[1]),y=qe(a,f),v=qe(a,m);Math.sqrt(Math.min(y,v))<=this.pixelTolerance_&&(o=y>v?p[1]:p[0],a=i.getPixelFromCoordinate(o))}}return s&&(a=[Math.round(a[0]),Math.round(a[1])]),{snapped:s,vertex:o,vertexPixel:a}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){var i=this.getMap().getView().getProjection(),n=e,r=ci();r&&(n=n.clone().transform(r,i));var s=An(n);r&&s.transform(i,r);for(var o=s.getCoordinates()[0],a=0,l=o.length-1;a{if(s.measure){const e=t.feature;s.measure="object"==typeof s.measure?s.measure:{},s.measure.tooltip=s.measure.tooltip||{};const i=document.createElement("div");i.setAttribute("class","measure-tooltip"),this.tooltip=new qr({offset:s.measure.tooltip.offset||[-15,10],positioning:"bottom-center"}),this.map.addOverlay(this.tooltip),this.measurePointermoveHandler=this.map.on("pointermove",()=>{this._showMeasureTooltip(e,this.tooltip,i)})}}),o.on("drawend",e=>{const n=e.feature;i(n,()=>{try{t.getSource().removeFeature(n)}catch(e){const i=t.getSource().on("addfeature",e=>{t.getSource().removeFeature(e.feature),V(i)})}}),this._cleanUp()}),super(r),this.drawOptions=s,this.drawInteraction=o}deactivate(){this._cleanUp(),super.deactivate()}_cleanUp(){this.drawOptions.measure&&(V(this.measurePointermoveHandler),this._removeTooltip())}_removeTooltip(){this.tooltip&&(this.map.removeOverlay(this.tooltip),this.tooltip=void 0)}_showMeasureTooltip(t,e){if(this.tooltip){const i=this._getLengthOfLastSegment(t.getGeometry());0!==i&&(e.textContent=i+" m",this.tooltip.setElement(e),this.tooltip.setPosition(t.getGeometry().getLastCoordinate()))}}_getLengthOfLastSegment(t){return t&&t instanceof gn?new gn(this._getCoordinatesOfLastSegment(t)).getLength().toFixed(2):t&&t instanceof bn?new gn(this._getCoordinatesOfLastSegment(t.getLinearRing(0))).getLength().toFixed(2):0}_getCoordinatesOfLastSegment(t){const e=t.getCoordinates().length;return t.getCoordinates().slice(e-2)}}class Tc extends Sc{constructor(t,e,i){i=i||{},super(t,De.LINE_STRING,e,i),this.drawLineOptions=i}}class Lc extends Sc{constructor(t,e,i){const n=i||{};n.maxPoints=2,n.geometryFunction=(t,e)=>{e||(e=new bn([]));const i=t[0],n=t[1];return e.setCoordinates([[i,[i[0],n[1]],n,[n[0],i[1]],i]]),e},super(t,De.LINE_STRING,e,n),this.drawRectangleOptions=n}}class Nc extends Ml{constructor(t,e){const i=new bl({layers:[t],condition:wa,style:e?e.style:null});super([i]),this.layer=t,this.highlightInteraction=i}deactivate(){this.dehighlightAllFeatures(),super.deactivate()}highlightFeatureWithId(t){if(t){const e=this.layer.getSource().getFeatureById(t)||this._getClusterByFeatureId(this.layer.getSource().getFeatures(),t);e&&-1===this.highlightInteraction.getFeatures().getArray().indexOf(e)&&this.highlightInteraction.getFeatures().push(e)}}_getClusterByFeatureId(t,e){for(let i=0;i{i===t&&(e=!0)}),e}dehighlightAllFeatures(){this.highlightInteraction.getFeatures().clear()}}class Oc extends Sc{constructor(t,e){super(t,"LineString",()=>{V(this.measurePointermoveHandler)},e);let i=0;this.layer=t,this.measureTooltips=[],this.measurePointermoveHandler=void 0;this.drawInteraction.on("drawstart",t=>{const e=i++,n=t.feature;n.setId(e);const r=document.createElement("div");r.setAttribute("class","measure-tooltip");const s=new qr({offset:[-15,10],positioning:"bottom-center"});this.map.addOverlay(s),this.measureTooltips[e]=s,this.measurePointermoveHandler=this.map.on("pointermove",()=>((t,e,i)=>{const n=t.getGeometry().getLength().toFixed(2);i.textContent=n+" m",e.setElement(i),e.setPosition(t.getGeometry().getLastCoordinate())})(n,s,r))});const n=t=>{this.map.removeOverlay(this.measureTooltips[t]),this.measureTooltips[t]=null};this.layer.getSource().on("removefeature",t=>{n(t.feature.getId())}),this.cleanUp=()=>{V(this.measurePointermoveHandler);const t=[];this.measureTooltips.forEach((e,i)=>{null==this.layer.getSource().getFeatureById(i)&&t.push(i)}),t.forEach(t=>{n(t)})},this.getTooltipFor=t=>this.measureTooltips[t],this.measureOptions=e}deactivate(){this.cleanUp(),super.deactivate(this)}}var Rc=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Pc=[0,0,0,0],bc=[],Mc="modifystart",Ac="modifyend",Fc=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.features=i,r.mapBrowserEvent=n,r}return Rc(e,t),e}(s);function Dc(t,e){return t.index-e.index}function Gc(t,e,i){var n=e.geometry;if(n.getType()===De.CIRCLE){var r=n;if(1===e.index){var s=ci();s&&(r=r.clone().transform(s,i));var o=qe(r.getCenter(),di(t,i)),a=Math.sqrt(o)-r.getRadius();return a*a}}var l=di(t,i);return bc[0]=di(e.segment[0],i),bc[1]=di(e.segment[1],i),je(l,bc)}function kc(t,e,i){var n=e.geometry;if(n.getType()===De.CIRCLE&&1===e.index){var r=n,s=ci();return s&&(r=r.clone().transform(s,i)),ui(r.getClosestPoint(di(t,i)),i)}var o=di(t,i);return bc[0]=di(e.segment[0],i),bc[1]=di(e.segment[1],i),ui(Ve(o,bc),i)}var Vc=function(t){function e(e){var i,n,r=t.call(this,e)||this;if(r.boundHandleFeatureChange_=r.handleFeatureChange_.bind(r),r.condition_=e.condition?e.condition:Ra,r.defaultDeleteCondition_=function(t){return function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&Sa(t)},r.deleteCondition_=e.deleteCondition?e.deleteCondition:r.defaultDeleteCondition_,r.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:xa,r.vertexFeature_=null,r.vertexSegments_=null,r.lastPixel_=[0,0],r.ignoreNextSingleClick_=!1,r.modified_=!1,r.rBush_=new Hh,r.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,r.snappedToVertex_=!1,r.changingFeature_=!1,r.dragSegments_=[],r.overlay_=new Wh({source:new hc({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:(i=Sl(),function(t,e){return i[De.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r)},r.source_=null,e.source?(r.source_=e.source,n=new Fo(r.source_.getFeatures()),r.source_.addEventListener($h,r.handleSourceAdd_.bind(r)),r.source_.addEventListener(ec,r.handleSourceRemove_.bind(r))):n=e.features,!n)throw new Error("The modify interaction requires features or a source");return r.features_=n,r.features_.forEach(r.addFeature_.bind(r)),r.features_.addEventListener(Ro,r.handleFeatureAdd_.bind(r)),r.features_.addEventListener(Po,r.handleFeatureRemove_.bind(r)),r.lastPointerEvent_=null,r}return Rc(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var i=this.SEGMENT_WRITERS_[e.getType()];i&&i(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(w,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new Fc(Mc,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(w,this.boundHandleFeatureChange_)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,i=[];e.forEach((function(e){t===e.feature&&i.push(e)}));for(var n=i.length-1;n>=0;--n){for(var r=i[n],s=this.dragSegments_.length-1;s>=0;--s)this.dragSegments_[s][0]===r&&this.dragSegments_.splice(s,1);e.remove(r)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var i=e.getCoordinates(),n=0,r=i.length;n=0;--p)this.insertVertex_.apply(this,r[p])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var i=this.dragSegments_[e][0],n=i.geometry;if(n.getType()===De.CIRCLE){var r=n.getCenter(),s=i.featureSegments[0],o=i.featureSegments[1];s.segment[0]=r,s.segment[1]=r,o.segment[0]=r,o.segment[1]=r,this.rBush_.update(Rt(r),s);var a=n,l=ci();if(l){var h=t.map.getView().getProjection();a=An(a=a.clone().transform(l,h)).transform(h,l)}this.rBush_.update(a.getExtent(),o)}else this.rBush_.update(vt(i.segment),i)}return this.modified_&&(this.dispatchEvent(new Fc(Ac,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,i){var n=i||e.getCoordinateFromPixel(t),r=e.getView().getProjection(),s=gi(xt(_i(Rt(n,Pc),r),e.getView().getResolution()*this.pixelTolerance_,Pc),r),o=this.rBush_.getInExtent(s);if(o.length>0){o.sort((function(t,e){return Gc(n,t,r)-Gc(n,e,r)}));var a=o[0],l=a.segment,h=kc(n,a,r),c=e.getPixelFromCoordinate(h),u=Xe(t,c);if(u<=this.pixelTolerance_){var d={};if(a.geometry.getType()===De.CIRCLE&&1===a.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h);else{var g=e.getPixelFromCoordinate(l[0]),_=e.getPixelFromCoordinate(l[1]),p=qe(c,g),f=qe(c,_);u=Math.sqrt(Math.min(p,f)),this.snappedToVertex_=u<=this.pixelTolerance_,this.snappedToVertex_&&(h=p>f?l[1]:l[0]),this.createOrUpdateVertexFeature_(h);for(var m=1,y=o.length;m=0;--r)c=q((h=(i=u[r])[0]).feature),h.depth&&(c+="-"+h.depth.join("-")),c in d||(d[c]={}),0===i[1]?(d[c].right=h,d[c].index=h.index):1==i[1]&&(d[c].left=h,d[c].index=h.index+1);for(c in d){switch(l=d[c].right,o=d[c].left,(a=(s=d[c].index)-1)<0&&(a=0),t=e=(n=(h=void 0!==o?o:l).geometry).getCoordinates(),g=!1,n.getType()){case De.MULTI_LINE_STRING:e[h.depth[0]].length>2&&(e[h.depth[0]].splice(s,1),g=!0);break;case De.LINE_STRING:e.length>2&&(e.splice(s,1),g=!0);break;case De.MULTI_POLYGON:t=t[h.depth[1]];case De.POLYGON:(t=t[h.depth[0]]).length>4&&(s==t.length-1&&(s=0),t.splice(s,1),g=!0,0===s&&(t.pop(),t.push(t[0]),a=t.length-1))}if(g){this.setGeometryCoordinates_(n,e);var _=[];if(void 0!==o&&(this.rBush_.remove(o),_.push(o.segment[0])),void 0!==l&&(this.rBush_.remove(l),_.push(l.segment[1])),void 0!==o&&void 0!==l){var p={depth:h.depth,feature:h.feature,geometry:h.geometry,index:a,segment:_};this.rBush_.insert(vt(p.segment),p)}this.updateSegmentIndices_(n,s,h.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),u.length=0}}return g},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===i||void 0===r.depth||g(r.depth,i))&&r.index>e&&(r.index+=n)}))},e}(fa);class Bc extends Al{constructor(t,e,i){super(t,null,{filter:i?i.filter:null}),this.modifyInteraction=new Vc({features:this.selectInteraction.getFeatures()}),this.addInteraction(this.modifyInteraction),i&&i.snapping&&this.addInteraction(new wc(i.snapping.layer||t)),this.modifyInteraction.on("modifystart",t=>{this.currentGeometryBeingModified=t.features.getArray()[0].getGeometry().clone()}),this.modifyInteraction.on("modifyend",t=>{t.features.forEach(t=>{e(t,t=>{t.setGeometry(this.currentGeometryBeingModified)})})})}}var Yc=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),zc="translatestart",qc="translating",Xc="translateend",jc=function(t){function e(e,i,n,r,s){var o=t.call(this,e)||this;return o.features=i,o.coordinate=n,o.startCoordinate=r,o.mapBrowserEvent=s,o}return Yc(e,t),e}(s),Uc=function(t){function e(e){var i,n=this,r=e||{};if((n=t.call(this,r)||this).lastCoordinate_=null,n.startCoordinate_=null,n.features_=void 0!==r.features?r.features:null,r.layers)if("function"==typeof r.layers)i=r.layers;else{var s=r.layers;i=function(t){return h(s,t)}}else i=_;return n.layerFilter_=i,n.filter_=r.filter?r.filter:_,n.hitTolerance_=r.hitTolerance?r.hitTolerance:0,n.lastFeature_=null,n.addEventListener(H(la),n.handleActiveChanged_),n}return Yc(e,t),e.prototype.handleDownEvent=function(t){if(this.lastFeature_=this.featuresAtPixel_(t.pixel,t.map),!this.lastCoordinate_&&this.lastFeature_){this.startCoordinate_=t.coordinate,this.lastCoordinate_=t.coordinate,this.handleMoveEvent(t);var e=this.features_||new Fo([this.lastFeature_]);return this.dispatchEvent(new jc(zc,e,t.coordinate,this.startCoordinate_,t)),!0}return!1},e.prototype.handleUpEvent=function(t){if(this.lastCoordinate_){this.lastCoordinate_=null,this.handleMoveEvent(t);var e=this.features_||new Fo([this.lastFeature_]);return this.dispatchEvent(new jc(Xc,e,t.coordinate,this.startCoordinate_,t)),this.startCoordinate_=null,!0}return!1},e.prototype.handleDragEvent=function(t){if(this.lastCoordinate_){var e=t.coordinate,i=e[0]-this.lastCoordinate_[0],n=e[1]-this.lastCoordinate_[1],r=this.features_||new Fo([this.lastFeature_]);r.forEach((function(t){var e=t.getGeometry();e.translate(i,n),t.setGeometry(e)})),this.lastCoordinate_=e,this.dispatchEvent(new jc(qc,r,e,this.startCoordinate_,t))}},e.prototype.handleMoveEvent=function(t){var e=t.map.getViewport();this.featuresAtPixel_(t.pixel,t.map)?(e.classList.remove(this.lastCoordinate_?"ol-grab":"ol-grabbing"),e.classList.add(this.lastCoordinate_?"ol-grabbing":"ol-grab")):e.classList.remove("ol-grab","ol-grabbing")},e.prototype.featuresAtPixel_=function(t,e){return e.forEachFeatureAtPixel(t,function(t,e){if(this.filter_(t,e)&&(!this.features_||h(this.features_.getArray(),t)))return t}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){var i=this.getMap();t.prototype.setMap.call(this,e),this.updateState_(i)},e.prototype.handleActiveChanged_=function(){this.updateState_(null)},e.prototype.updateState_=function(t){var e=this.getMap(),i=this.getActive();e&&i||(e=e||t)&&e.getViewport().classList.remove("ol-grab","ol-grabbing")},e}(fa);class Wc extends Bc{constructor(t,e,i){super(t,e,i),this.translateInteraction=new Uc({features:this.selectInteraction.getFeatures()}),this.addInteraction(this.translateInteraction),this.translateInteraction.on("translateend",t=>{t.features.forEach(t=>{e(t,t=>{t.getGeometry().setCoordinates(t.get("entity").geometry.coordinates)}),this.selectInteraction.getFeatures().clear()})})}}class Hc extends Al{constructor(t,e,i){const n=t.map(t=>t.layer),r=t=>{const e=this._getLayer(t),i=this._getLayerStyle(e);return i&&"function"==typeof i?i(t):i},s=t=>{const e=this._getLayer(t),i=this._getLayerHoverStyle(e);return i&&"function"==typeof i?i(t):i},o=(t,e)=>{let n=!1;return this.layers.forEach(t=>{t==e&&(n=!0)}),i&&i.filter?n&&i.filter(t):n};super(n,e,{filter:o,style:r,hoverStyle:s}),this.layerConfiguraties=t,this.layers=n,this.style=r,this.hoverStyle=s,this.filter=o}_getLayer(t){return this.layers.find(e=>-1!==e.getSource().getFeatures().indexOf(t))}_getLayerStyle(t,e){const i=this.layerConfiguraties.find(e=>e.layer===t);return i?i[e||"style"]:null}_getLayerHoverStyle(t){return this._getLayerStyle(t,"hoverStyle")||this._getLayerStyle(t)}markFeatureWithId(t,e){e?super.markFeatureWithId(t,e):this.layers.forEach(e=>{super.markFeatureWithId(t,e)})}}class Zc{constructor(t,e,i,n){this.layer=t,t.tooltips=[],this.showTooltip=(r,s,o,a)=>{a=a||{};const l=document.createElement("div");l.innerHTML="
",l.setAttribute("class","info-tooltip");const h=new qr({offset:a.offset||[0,-10],positioning:"bottom-center",insertFirst:!1});h.setElement(l),r.addOverlay(h),t.tooltips.push(h);const c=t=>{l.childNodes[0].innerHTML=t,h.setPosition(o),h.setElement(l),l.parentNode.style.position="fixed"};let u=0;const d=setTimeout(()=>{u=500,c(" "+(i||"Info berekenen ..."))},100);e(s,o).then(t=>{setTimeout(()=>{clearTimeout(d),c(t),r.render(),n&&n(s,o)},u)})},this.clear=t=>{this.layer.tooltips.forEach(e=>t.removeOverlay(e))}}}class Kc extends Sc{constructor(t,e,i,n){const r=new Zc(t,e,i);super(t,"Point",t=>{this.Vltooltips.showTooltip(this.map,t,t.getGeometry().getCoordinates(),n)}),this.layer=t,this.Vltooltips=r}clear(){this.Vltooltips.clear(this.map),this.layer.getSource().clear()}deactivate(){this.clear(),super.deactivate()}}class Jc extends Al{constructor(t,e,i,n,r){super(t,(t,e)=>{if(t){const i=t.getGeometry().getClosestPoint(e.mapBrowserEvent.coordinate);this.tooltips.showTooltip(this.map,t,i,r)}}),this.tooltips=new Zc(t,e,i,n),this.layer=t}clear(){this.tooltips.clear(this.map)}deactivate(){this.clear(),this.layer.setVisible(this.visible),super.deactivate()}activate(){this.visible=this.layer.getVisible(),this.layer.setVisible(!0),super.activate()}}var $c=i(1);class Qc extends Ml{constructor(t,e,i){const n=new $c.io.OL3Parser;n.inject(mn,gn,Cn,bn,vn,pn,Gn);const r=[],s=new Al(t,t=>{t&&(this.selectAction.deactivate(),this.drawAction.activate())},i),o=new Sc(t,"LineString",t=>{const i=this.selectAction.selectedFeature,r=n.read(i.getGeometry().getPolygons()[0]),s=n.read(t.getGeometry()),o=r.getExteriorRing().union(s),a=new $c.operation.polygonize.Polygonizer;a.add(o);const l=[];for(let t=a.getPolygons().iterator();t.hasNext();){const e=new Gn([]);e.appendPolygon(n.write(t.next())),l.push(new tt({geometry:e}))}e&&e(i,l),this.selectAction.clearFeatures(),setTimeout(()=>{this.drawAction.deactivate(),this.selectAction.activate()})},i);super(r),this.interactions=r,this.selectAction=s,this.drawAction=o}activate(){this.map.addAction(this.selectAction),this.map.addAction(this.drawAction),this.selectAction.activate()}deactivate(){this.selectAction.deactivate(),this.drawAction.deactivate()}}class tu extends Ml{constructor(t,e){const i=new bl({layers:[t],style:t.selectionStyle}),n={features:i.getFeatures(),layers:[t]},r=new Uc(n);super([i,r]),this.selectInteraction=i,this.translateInteraction=r,this.translateInteraction.on("translateend",t=>{t.features.forEach(t=>{e(t,t=>{t.getGeometry().setCoordinates(t.get("entity").geometry.coordinates)}),this.selectInteraction.getFeatures().clear()})}),this.translateOptions=n}deactivate(){this.selectInteraction.getFeatures().clear(),super.deactivate()}}var eu="preload",iu="useInterimTilesOnError",nu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ru=function(t){function e(e){var i=this,n=e||{},r=m({},n);return delete r.preload,delete r.useInterimTilesOnError,(i=t.call(this,r)||this).setPreload(void 0!==n.preload?n.preload:0),i.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),i}return nu(e,t),e.prototype.getPreload=function(){return this.get(eu)},e.prototype.setPreload=function(t){this.set(eu,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(iu)},e.prototype.setUseInterimTilesOnError=function(t){this.set(iu,t)},e}(Ds),su=function(){function t(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}return t.prototype.contains=function(t){return this.containsXY(t[1],t[2])},t.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},t.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},t.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},t.prototype.extend=function(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function ou(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new su(t,e,i,n)}var au=su,lu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),hu=function(t){function e(e){var i=t.call(this,e)||this;return i.extentChanged=!0,i.renderedExtent_=null,i.renderedPixelRatio,i.renderedProjection=null,i.renderedRevision,i.renderedTiles=[],i.newTiles_=!1,i.tmpExtent=[1/0,1/0,-1/0,-1/0],i.tmpTileRange_=new au(0,0,0,0),i}return lu(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==Jo||i==Qo||i==$o&&!n},e.prototype.getTile=function(t,e,i,n){var r=n.pixelRatio,s=n.viewState.projection,o=this.getLayer(),a=o.getSource().getTile(t,e,i,r,s);return a.getState()==$o&&(o.getUseInterimTilesOnError()?o.getPreload()>0&&(this.newTiles_=!0):a.setState(Jo)),this.isDrawableTile(a)||(a=a.getInterimTile()),a},e.prototype.loadedTileCallback=function(e,i,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,i,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=n.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(r),_=g.getZForResolution(s,u.zDirection),p=g.getResolution(_),f=t.extent,y=i.extent&&_i(i.extent,r);y&&(f=$t(f,_i(i.extent,r)));var v=u.getTilePixelRatio(h),x=Math.round(t.size[0]*v),E=Math.round(t.size[1]*v);if(a){var I=Math.round(Math.sqrt(x*x+E*E));x=I,E=I}var C=p*x/2/v,w=p*E/2/v,S=[o[0]-C,o[1]-w,o[0]+C,o[1]+w],T=g.getTileRangeForExtentAndZ(f,_),L={};L[_]={};var N=this.createLoadedTileFinder(u,r,L),O=this.tmpExtent,R=this.tmpTileRange_;this.newTiles_=!1;for(var P=T.minX;P<=T.maxX;++P)for(var b=T.minY;b<=T.maxY;++b){var M=this.getTile(_,P,b,t);if(this.isDrawableTile(M)){var A=q(this);if(M.getState()==Jo){L[_][M.tileCoord.toString()]=M;var F=M.inTransition(A);this.newTiles_||!F&&-1!==this.renderedTiles.indexOf(M)||(this.newTiles_=!0)}if(1===M.getAlpha(A,t.time))continue}var D=g.getTileCoordChildTileRange(M.tileCoord,R,O),G=!1;D&&(G=N(_+1,D)),G||g.forEachTileCoordParentTileRange(M.tileCoord,N,R,O)}var k=p/s;ot(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/v,1/v,a,-x/2,-E/2);var V,B=(V=this.pixelTransform,Nr?lt(V):(to||(to=Pr(1,1).canvas),to.style.transform=lt(V),to.style.transform));this.useContainer(e,B,i.opacity);var Y=this.context,z=Y.canvas;at(this.inversePixelTransform,this.pixelTransform),ot(this.tempTransform,x/2,E/2,k,k,0,-x/2,-E/2),z.width!=x||z.height!=E?(z.width=x,z.height=E):this.containerReused||Y.clearRect(0,0,x,E),y&&this.clipUnrotated(Y,t,y),m(Y,u.getContextOptions()),this.preRender(Y,t),this.renderedTiles.length=0;var X,j,U,W=Object.keys(L).map(Number);W.sort(l),1!==i.opacity||this.containerReused&&!u.getOpaque(t.viewState.projection)?(X=[],j=[]):W=W.reverse();for(var H=W.length-1;H>=0;--H){var Z=W[H],K=u.getTilePixelSize(Z,h,r),J=g.getResolution(Z)/p,$=K[0]*J*k,Q=K[1]*J*k,tt=g.getTileCoordForCoordAndZ(ee(S),Z),et=g.getTileCoordExtent(tt),it=st(this.tempTransform,[v*(et[0]-S[0])/p,v*(S[3]-et[3])/p]),nt=v*u.getGutterForProjection(r),rt=L[Z];for(var ht in rt){var ct=(M=rt[ht]).tileCoord,ut=it[0]-(tt[1]-ct[1])*$,dt=Math.round(ut+$),gt=it[1]-(tt[2]-ct[2])*Q,_t=Math.round(gt+Q),pt=dt-(P=Math.round(ut)),ft=_t-(b=Math.round(gt)),mt=_===Z;if(!(F=mt&&1!==M.getAlpha(q(this),t.time)))if(X){Y.save(),U=[P,b,P+pt,b,P+pt,b+ft,P,b+ft];for(var yt=0,vt=X.length;yt=0;--i){var n=this.geometryFunction(t[i]);n?ke(e,n.getCoordinates()):t.splice(i,1)}ze(e,1/t.length);var r=new tt(new mn(e));return r.set("features",t),r},e}(hc),pu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),fu=function(t){function e(e,i,n){var r=t.call(this)||this,s=n||{};return r.tileCoord=e,r.state=i,r.interimTile=null,r.hifi=!0,r.key="",r.transition_=void 0===s.transition?250:s.transition,r.transitionStarts_={},r}return pu(e,t),e.prototype.changed=function(){this.dispatchEvent(w)},e.prototype.release=function(){},e.prototype.getKey=function(){return this.key+"/"+this.tileCoord},e.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(t.getState()==Jo)return this.transition_=0,t;t=t.interimTile}while(t);return this},e.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,e=this;do{if(t.getState()==Jo){t.interimTile=null;break}t.getState()==Ko?e=t:t.getState()==Zo?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}},e.prototype.getTileCoord=function(){return this.tileCoord},e.prototype.getState=function(){return this.state},e.prototype.setState=function(t){if(this.state!==$o&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){Y()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;var n=e-i+1e3/60;return n>=this.transition_?1:tr(n/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(C),mu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var yu,vu=function(t){function e(e,i,n,r,s,o){var a=t.call(this,e,i,o)||this;return a.crossOrigin_=r,a.src_=n,a.image_=new Image,null!==r&&(a.image_.crossOrigin=r),a.unlisten_=null,a.tileLoadFunction_=s,a}return mu(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.getKey=function(){return this.src_},e.prototype.handleImageError_=function(){var t;this.state=$o,this.unlistenImage_(),this.image_=((t=Pr(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=Jo:this.state=Qo,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==$o&&(this.state=Zo,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Zo&&(this.state=Ko,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=kh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(fu),xu=function(){function t(t,e,i,n,r,s){this.sourceProj_=t,this.targetProj_=e;var o={},a=ni(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return o[e]||(o[e]=a(t)),o[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&ne(n)==ne(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ne(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ne(this.targetProj_.getExtent()):null;var l=ee(i),h=ie(i),c=jt(i),u=Xt(i),d=this.transformInv_(l),g=this.transformInv_(h),_=this.transformInv_(c),p=this.transformInv_(u),f=10+(s?Math.max(0,Math.ceil(_e(qt(i)/(s*s*256*256)))):0);if(this.addQuad_(l,h,c,u,d,g,_,p,f),this.wrapsXInSource_){var m=1/0;this.triangles_.forEach((function(t,e,i){m=Math.min(m,t.source[0][0],t.source[1][0],t.source[2][0])})),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-m>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-m>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-m>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-m>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-i.5&&c<1,g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)g=ne(vt([t,e,i,n]))/this.targetWorldWidth_>.25||g;!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)}if(!(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3]))||re(h,this.maxSourceExtent_)){var _=0;if(!(g||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(1!=(_=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1))&&2!=_&&4!=_&&8!=_)return;if(l>0){if(!g){var p=[(t[0]+i[0])/2,(t[1]+i[1])/2],f=this.transformInv_(p),m=void 0;if(d)m=(ye(r[0],u)+ye(o[0],u))/2-ye(f[0],u);else m=(r[0]+o[0])/2-f[0];var y=(r[1]+o[1])/2-f[1];g=m*m+y*y>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var v=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(v),E=[(n[0]+t[0])/2,(n[1]+t[1])/2],I=this.transformInv_(E);this.addQuad_(t,e,v,E,r,s,x,I,l-1),this.addQuad_(E,v,i,n,I,x,o,a,l-1)}else{var C=[(t[0]+e[0])/2,(t[1]+e[1])/2],w=this.transformInv_(C),S=[(i[0]+n[0])/2,(i[1]+n[1])/2],T=this.transformInv_(S);this.addQuad_(t,C,S,n,r,w,T,a,l-1),this.addQuad_(C,e,i,S,w,s,o,T,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&_)&&this.addTriangle_(t,i,n,r,o,a),0==(14&_)&&this.addTriangle_(t,i,e,r,o,s),_&&(0==(13&_)&&this.addTriangle_(e,n,t,s,a,r),0==(7&_)&&this.addTriangle_(e,n,i,s,a,o))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){var r=e.source;Gt(t,r[0]),Gt(t,r[1]),Gt(t,r[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),Eu={imageSmoothingEnabled:!1,msImageSmoothingEnabled:!1};function Iu(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function Cu(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function wu(t,e,i,n){var r=ri(i,e,t),s=$e(e,n,i),o=e.getMetersPerUnit();void 0!==o&&(s*=o);var a=t.getMetersPerUnit();void 0!==a&&(s/=a);var l=t.getExtent();if(!l||Ct(l,r)){var h=$e(t,s,r)/s;isFinite(h)&&h>0&&(s/=h)}return s}function Su(t,e,i,n,r,s,o,a,l,h,c,u){var d=Pr(Math.round(i*t),Math.round(i*e));if(m(d,u),0===l.length)return d.canvas;function g(t){return Math.round(t*i)/i}d.scale(i,i),d.globalCompositeOperation="lighter";var _=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,i){Dt(_,t.extent)}));var p=ne(_),f=Kt(_),y=Pr(Math.round(i*p/n),Math.round(i*f/n));m(y,u);var v=i/n;l.forEach((function(t,e,i){var n=t.extent[0]-_[0],r=-(t.extent[3]-_[3]),s=ne(t.extent),o=Kt(t.extent);t.image.width>0&&t.image.height>0&&y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,n*v,r*v,s*v,o*v)}));var x=ee(o);return a.getTriangles().forEach((function(t,e,r){var o=t.source,a=t.target,l=o[0][0],h=o[0][1],c=o[1][0],p=o[1][1],f=o[2][0],m=o[2][1],v=g((a[0][0]-x[0])/s),E=g(-(a[0][1]-x[1])/s),I=g((a[1][0]-x[0])/s),C=g(-(a[1][1]-x[1])/s),w=g((a[2][0]-x[0])/s),S=g(-(a[2][1]-x[1])/s),T=l,L=h;l=0,h=0;var N=function(t){for(var e=t.length,i=0;ir&&(r=o,n=s)}if(0===r)return null;var a=t[n];t[n]=t[i],t[i]=a;for(var l=i+1;l=0;d--){u[d]=t[d][e]/t[d][d];for(var g=d-1;g>=0;g--)t[g][e]-=t[g][d]*u[d]}return u}([[c-=T,p-=L,0,0,I-v],[f-=T,m-=L,0,0,w-v],[0,0,c,p,C-E],[0,0,f,m,S-E]]);if(N){if(d.save(),d.beginPath(),function(){if(void 0===yu){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Iu(t,4,5,4,0),Iu(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;yu=Cu(e,0)||Cu(e,4)||Cu(e,8)}return yu}()||u===Eu){d.moveTo(I,C);for(var O=v-I,R=E-C,P=0;P<4;P++)d.lineTo(I+g((P+1)*O/4),C+g(P*R/3)),3!=P&&d.lineTo(I+g((P+1)*O/4),C+g((P+1)*R/3));d.lineTo(w,S)}else d.moveTo(I,C),d.lineTo(v,E),d.lineTo(w,S);d.clip(),d.transform(N[0],N[2],N[1],N[3],v,E),d.translate(_[0]-T,_[3]-L),d.scale(n/i,-n/i),d.drawImage(y.canvas,0,0),d.restore()}})),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach((function(t,e,i){var n=t.target,r=(n[0][0]-x[0])/s,o=-(n[0][1]-x[1])/s,a=(n[1][0]-x[0])/s,l=-(n[1][1]-x[1])/s,h=(n[2][0]-x[0])/s,c=-(n[2][1]-x[1])/s;d.beginPath(),d.moveTo(a,l),d.lineTo(r,o),d.lineTo(h,c),d.closePath(),d.stroke()})),d.restore()),d.canvas}var Tu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Lu=function(t){function e(e,i,n,r,s,o,a,l,h,c,u,d){var g=t.call(this,s,Zo)||this;g.renderEdges_=void 0!==u&&u,g.contextOptions_=d,g.pixelRatio_=a,g.gutter_=l,g.canvas_=null,g.sourceTileGrid_=i,g.targetTileGrid_=r,g.wrappedTileCoord_=o||s,g.sourceTiles_=[],g.sourcesListenerKeys_=null,g.sourceZ_=0;var _=r.getTileCoordExtent(g.wrappedTileCoord_),p=g.targetTileGrid_.getExtent(),f=g.sourceTileGrid_.getExtent(),m=p?$t(_,p):_;if(0===qt(m))return g.state=Qo,g;var y=e.getExtent();y&&(f=f?$t(f,y):y);var v=r.getResolution(g.wrappedTileCoord_[0]),x=function(t,e,i,n){var r=Ut(i),s=wu(t,e,r,n);return(!isFinite(s)||s<=0)&&zt(i,(function(i){return s=wu(t,e,i,n),isFinite(s)&&s>0})),s}(e,n,m,v);if(!isFinite(x)||x<=0)return g.state=Qo,g;var E=void 0!==c?c:.5;if(g.triangulation_=new xu(e,n,m,f,x*E,v),0===g.triangulation_.getTriangles().length)return g.state=Qo,g;g.sourceZ_=i.getZForResolution(x);var I=g.triangulation_.calculateSourceExtent();if(f&&(e.canWrapX()?(I[1]=de(I[1],f[1],f[3]),I[3]=de(I[3],f[1],f[3])):I=$t(I,f)),qt(I)){for(var C=i.getTileRangeForExtentAndZ(I,g.sourceZ_),w=C.minX;w<=C.maxX;w++)for(var S=C.minY;S<=C.maxY;S++){var T=h(g.sourceZ_,w,S,a);T&&g.sourceTiles_.push(T)}0===g.sourceTiles_.length&&(g.state=Qo)}else g.state=Qo;return g}return Tu(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,i,n){e&&e.getState()==Jo&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=$o;else{var e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Su(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=Jo}this.changed()},e.prototype.load=function(){if(this.state==Zo){this.state=Ko,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,n){var r=e.getState();if(r==Zo||r==Ko){t++;var s=F(e,w,(function(i){var n=e.getState();n!=Jo&&n!=$o&&n!=Qo||(G(s),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(s)}}.bind(this)),this.sourceTiles_.forEach((function(t,e,i){t.getState()==Zo&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(G),this.sourcesListenerKeys_=null},e}(fu),Nu=function(){function t(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t.prototype.canExpireCache=function(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var i=this.entries_[t];return $(void 0!==i,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_},t.prototype.remove=function(t){var e=this.entries_[t];return $(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){$(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function Ou(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Ru(t,e,i){return t+"/"+e+"/"+i}function Pu(t){return Ru(t[0],t[1],t[2])}var bu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Mu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return bu(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=function(t){return t.split("/").map(Number)}(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(Pu(e.tileCoord)),e.release())}.bind(this))}},e}(Nu),Au="tileloadstart",Fu="tileloadend",Du="tileloaderror",Gu=[0,0,0],ku=function(){function t(t){var e,i,n,r;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,$((e=this.resolutions_,i=!0,n=function(t,e){return e-t}||l,e.every((function(t,r){if(0===r)return!0;var s=n(e[r-1],t);return!(s>0||i&&0===s)}))),17),!t.origins)for(var s=0,o=this.resolutions_.length-1;s=this.minZoom;){if(e(a,2===this.zoomFactor_?ou(r=Math.floor(r/2),r,s=Math.floor(s/2),s,i):this.getTileRangeForExtentAndZ(o,a,i)))return!0;--a}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]0?n:Math.max(o/a[0],s/a[1]),h=r+1,c=new Array(h),u=0;ui||i>e.getMaxZoom())return!1;var s,o=e.getExtent();return!(s=o?e.getTileRangeForExtentAndZ(o,i):e.getFullTileRange(i))||s.containsXY(n,r)}(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.updateCacheSize=function(t,e){var i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)},e.prototype.useTile=function(t,e,i,n){},e}(Jh),Xu=function(t){function e(e,i){var n=t.call(this,e)||this;return n.tile=i,n}return zu(e,t),e}(s),ju=qu;function Uu(t,e){var i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){return o?t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(r,o[2].toString()).replace(s,(function(){var t=o[0],i=e.getFullTileRange(t);return $(i,55),(i.getHeight()-o[2]-1).toString()})):void 0}}function Wu(t){return 1===t.length?t[0]:function(e,i,n){if(e){var r=ye(function(t){return(t[1]<0&&(i.tileUrlFunction=Wu(s.map(i.createFromWMTSTemplate.bind(i)))),i}return sd(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(Wu(t.map(this.createFromWMTSTemplate.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var i in this.dimensions_)e[t++]=i+"-"+this.dimensions_[i];return e.join("/")},e.prototype.updateDimensions=function(t){m(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e.prototype.createFromWMTSTemplate=function(t){var e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==td&&m(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==td?ed(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));var n=this.tileGrid,r=this.dimensions_;return function(i,s,o){if(i){var a={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};m(a,r);var l=t;return l=e==td?ed(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return a[e]}))}}},e}(Qu);var ad=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=ia(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new xl({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:nh,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){var e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=ia(void 0!==t?t:1)},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}()}});void 0===VlMapActions&&console.error("esm-webpack-plugin: nothing exported!");const _VlMapActions$VlCustomMap=VlMapActions.VlCustomMap,_VlMapActions$VlMapWithActions=VlMapActions.VlMapWithActions,_VlMapActions$VlSnapInteraction=VlMapActions.VlSnapInteraction,_VlMapActions$VlBoxSelectAction=VlMapActions.VlBoxSelectAction,_VlMapActions$VlDeleteAction=VlMapActions.VlDeleteAction,_VlMapActions$VlDrawAction=VlMapActions.VlDrawAction,_VlMapActions$VlDrawLineAction=VlMapActions.VlDrawLineAction,_VlMapActions$VlDrawRectangleAction=VlMapActions.VlDrawRectangleAction,_VlMapActions$VlHighlightAction=VlMapActions.VlHighlightAction,_VlMapActions$VlMapAction=VlMapActions.VlMapAction,_VlMapActions$VlMeasureAction=VlMapActions.VlMeasureAction,_VlMapActions$VlModifyAction=VlMapActions.VlModifyAction,_VlMapActions$VlModifyAndTranslateAction=VlMapActions.VlModifyAndTranslateAction,_VlMapActions$VlSelectAction=VlMapActions.VlSelectAction,_VlMapActions$VlSelectActions=VlMapActions.VlSelectActions,_VlMapActions$VlShowInfoAction=VlMapActions.VlShowInfoAction,_VlMapActions$VlShowInfoSelectAction=VlMapActions.VlShowInfoSelectAction,_VlMapActions$VlSplitAction=VlMapActions.VlSplitAction,_VlMapActions$VlTooltips=VlMapActions.VlTooltips,_VlMapActions$VlTranslateAction=VlMapActions.VlTranslateAction,_VlMapActions$OlLayerGroup=VlMapActions.OlLayerGroup,_VlMapActions$OlVectorLayer=VlMapActions.OlVectorLayer,_VlMapActions$OlTileLayer=VlMapActions.OlTileLayer,_VlMapActions$OlOverlay=VlMapActions.OlOverlay,_VlMapActions$OlVectorSource=VlMapActions.OlVectorSource,_VlMapActions$OlClusterSource=VlMapActions.OlClusterSource,_VlMapActions$OlWMTSSource=VlMapActions.OlWMTSSource,_VlMapActions$OlWMTSTileGrid=VlMapActions.OlWMTSTileGrid,_VlMapActions$OlFeature=VlMapActions.OlFeature,_VlMapActions$OlPoint=VlMapActions.OlPoint,_VlMapActions$OlGeometryType=VlMapActions.OlGeometryType,_VlMapActions$OlStyle=VlMapActions.OlStyle,_VlMapActions$OlStyleStroke=VlMapActions.OlStyleStroke,_VlMapActions$OlStyleFill=VlMapActions.OlStyleFill,_VlMapActions$OlStyleCircle=VlMapActions.OlStyleCircle,_VlMapActions$OlStyleText=VlMapActions.OlStyleText,_VlMapActions$OlProjection=VlMapActions.OlProjection,_VlMapActions$OlGeoJSON=VlMapActions.OlGeoJSON,_VlMapActions$OlExtent=VlMapActions.OlExtent,_VlMapActions$OlLoadingstrategy=VlMapActions.OlLoadingstrategy;export{_VlMapActions$VlCustomMap as VlCustomMap,_VlMapActions$VlMapWithActions as VlMapWithActions,_VlMapActions$VlSnapInteraction as VlSnapInteraction,_VlMapActions$VlBoxSelectAction as VlBoxSelectAction,_VlMapActions$VlDeleteAction as VlDeleteAction,_VlMapActions$VlDrawAction as VlDrawAction,_VlMapActions$VlDrawLineAction as VlDrawLineAction,_VlMapActions$VlDrawRectangleAction as VlDrawRectangleAction,_VlMapActions$VlHighlightAction as VlHighlightAction,_VlMapActions$VlMapAction as VlMapAction,_VlMapActions$VlMeasureAction as VlMeasureAction,_VlMapActions$VlModifyAction as VlModifyAction,_VlMapActions$VlModifyAndTranslateAction as VlModifyAndTranslateAction,_VlMapActions$VlSelectAction as VlSelectAction,_VlMapActions$VlSelectActions as VlSelectActions,_VlMapActions$VlShowInfoAction as VlShowInfoAction,_VlMapActions$VlShowInfoSelectAction as VlShowInfoSelectAction,_VlMapActions$VlSplitAction as VlSplitAction,_VlMapActions$VlTooltips as VlTooltips,_VlMapActions$VlTranslateAction as VlTranslateAction,_VlMapActions$OlLayerGroup as OlLayerGroup,_VlMapActions$OlVectorLayer as OlVectorLayer,_VlMapActions$OlTileLayer as OlTileLayer,_VlMapActions$OlOverlay as OlOverlay,_VlMapActions$OlVectorSource as OlVectorSource,_VlMapActions$OlClusterSource as OlClusterSource,_VlMapActions$OlWMTSSource as OlWMTSSource,_VlMapActions$OlWMTSTileGrid as OlWMTSTileGrid,_VlMapActions$OlFeature as OlFeature,_VlMapActions$OlPoint as OlPoint,_VlMapActions$OlGeometryType as OlGeometryType,_VlMapActions$OlStyle as OlStyle,_VlMapActions$OlStyleStroke as OlStyleStroke,_VlMapActions$OlStyleFill as OlStyleFill,_VlMapActions$OlStyleCircle as OlStyleCircle,_VlMapActions$OlStyleText as OlStyleText,_VlMapActions$OlProjection as OlProjection,_VlMapActions$OlGeoJSON as OlGeoJSON,_VlMapActions$OlExtent as OlExtent,_VlMapActions$OlLoadingstrategy as OlLoadingstrategy}; \ No newline at end of file +!function(t){"use strict";class e{static equalsWithTolerance(t,e,i){return Math.abs(t-e)<=i}}class i extends Error{constructor(t){super(t),this.name=Object.keys({Exception:i})[0]}toString(){return this.message}}class n extends i{constructor(t){super(t),this.name=Object.keys({IllegalArgumentException:n})[0]}}class r{constructor(t,e){this.low=e||0,this.high=t||0}static toBinaryString(t){let e,i="";for(e=2147483648;e>0;e>>>=1)i+=(t.high&e)===e?"1":"0";for(e=2147483648;e>0;e>>>=1)i+=(t.low&e)===e?"1":"0";return i}}function s(){}function o(){}function a(){}function l(){}function h(){}s.NaN=NaN,s.isNaN=t=>Number.isNaN(t),s.isInfinite=t=>!Number.isFinite(t),s.MAX_VALUE=Number.MAX_VALUE,"function"==typeof Float64Array&&"function"==typeof Int32Array?function(){const t=new Float64Array(1),e=new Int32Array(t.buffer);s.doubleToLongBits=function(i){t[0]=i;let n=0|e[0],s=0|e[1];return 2146435072==(2146435072&s)&&0!=(1048575&s)&&0!==n&&(n=0,s=2146959360),new r(s,n)},s.longBitsToDouble=function(i){return e[0]=i.low,e[1]=i.high,t[0]}}():function(){const t=Math.log2,e=Math.floor,i=Math.pow,n=function(){for(let n=53;n>0;n--){const r=i(2,n)-1;if(e(t(r))+1===n)return r}return 0}();s.doubleToLongBits=function(s){let o,a,l,h,c,u,d,g,_;if(s<0||1/s===Number.NEGATIVE_INFINITY?(u=1<<31,s=-s):u=0,0===s)return _=0,g=u,new r(g,_);if(s===1/0)return _=0,g=2146435072|u,new r(g,_);if(s!=s)return _=0,g=2146959360,new r(g,_);if(h=0,_=0,o=e(s),o>1)if(o<=n)h=e(t(o)),h<=20?(_=0,g=o<<20-h&1048575):(l=h-20,a=i(2,l),_=o%a<<32-l,g=o/a&1048575);else for(l=o,_=0;a=l/2,l=e(a),0!==l;)h++,_>>>=1,_|=(1&g)<<31,g>>>=1,a!==l&&(g|=524288);if(d=h+1023,c=0===o,o=s-o,h<52&&0!==o)for(l=0;;){if(a=2*o,a>=1?(o=a-1,c?(d--,c=!1):(l<<=1,l|=1,h++)):(o=a,c?0==--d&&(h++,c=!1):(l<<=1,h++)),20===h)g|=l,l=0;else if(52===h){_|=l;break}if(1===a){h<20?g|=l<<20-h:h<52&&(_|=l<<52-h);break}}return g|=d<<20,g|=u,new r(g,_)},s.longBitsToDouble=function(t){let e,n,r,s;const o=t.high,a=t.low,l=o&1<<31?-1:1;for(r=((2146435072&o)>>20)-1023,s=0,n=1<<19,e=1;e<=20;e++)o&n&&(s+=i(2,-e)),n>>>=1;for(n=1<<31,e=21;e<=52;e++)a&n&&(s+=i(2,-e)),n>>>=1;if(-1023===r){if(0===s)return 0*l;r=-1022}else{if(1024===r)return 0===s?l/0:NaN;s+=1}return l*s*i(2,r)}}();class c extends i{constructor(t){super(t),this.name=Object.keys({RuntimeException:c})[0]}}class u extends c{constructor(){super(),u.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)c.constructor_.call(this);else if(1===arguments.length){const t=arguments[0];c.constructor_.call(this,t)}}}class d{static shouldNeverReachHere(){if(0===arguments.length)d.shouldNeverReachHere(null);else if(1===arguments.length){const t=arguments[0];throw new u("Should never reach here"+(null!==t?": "+t:""))}}static isTrue(){if(1===arguments.length){const t=arguments[0];d.isTrue(t,null)}else if(2===arguments.length){const t=arguments[1];if(!arguments[0])throw null===t?new u:new u(t)}}static equals(){if(2===arguments.length){const t=arguments[0],e=arguments[1];d.equals(t,e,null)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];if(!e.equals(t))throw new u("Expected "+t+" but encountered "+e+(null!==i?": "+i:""))}}}const g=new ArrayBuffer(8),_=new Float64Array(g),p=new Int32Array(g);class f{constructor(){f.constructor_.apply(this,arguments)}static constructor_(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)f.constructor_.call(this,0,0);else if(1===arguments.length){const t=arguments[0];f.constructor_.call(this,t.x,t.y,t.getZ())}else if(2===arguments.length){const t=arguments[0],e=arguments[1];f.constructor_.call(this,t,e,f.NULL_ORDINATE)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this.x=t,this.y=e,this.z=i}}static hashCode(t){return _[0]=t,p[0]^p[1]}getM(){return s.NaN}setOrdinate(t,e){switch(t){case f.X:this.x=e;break;case f.Y:this.y=e;break;case f.Z:this.setZ(e);break;default:throw new n("Invalid ordinate index: "+t)}}equals2D(){if(1===arguments.length){const t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){const t=arguments[0],i=arguments[1];return!!e.equalsWithTolerance(this.x,t.x,i)&&!!e.equalsWithTolerance(this.y,t.y,i)}}setM(t){throw new n("Invalid ordinate index: "+f.M)}getZ(){return this.z}getOrdinate(t){switch(t){case f.X:return this.x;case f.Y:return this.y;case f.Z:return this.getZ()}throw new n("Invalid ordinate index: "+t)}equals3D(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||s.isNaN(this.getZ())&&s.isNaN(t.getZ()))}equals(t){return t instanceof f&&this.equals2D(t)}equalInZ(t,i){return e.equalsWithTolerance(this.getZ(),t.getZ(),i)}setX(t){this.x=t}compareTo(t){const e=t;return this.xe.x?1:this.ye.y?1:0}getX(){return this.x}setZ(t){this.z=t}clone(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return d.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}copy(){return new f(this)}toString(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}distance3D(t){const e=this.x-t.x,i=this.y-t.y,n=this.getZ()-t.getZ();return Math.sqrt(e*e+i*i+n*n)}getY(){return this.y}setY(t){this.y=t}distance(t){const e=this.x-t.x,i=this.y-t.y;return Math.sqrt(e*e+i*i)}hashCode(){let t=17;return t=37*t+f.hashCode(this.x),t=37*t+f.hashCode(this.y),t}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}get interfaces_(){return[o,a,h]}}class m{constructor(){m.constructor_.apply(this,arguments)}static constructor_(){if(this._dimensionsToTest=2,0===arguments.length)m.constructor_.call(this,2);else if(1===arguments.length){const t=arguments[0];if(2!==t&&3!==t)throw new n("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}static compare(t,e){return te?1:s.isNaN(t)?s.isNaN(e)?0:-1:s.isNaN(e)?1:0}compare(t,e){const i=m.compare(t.x,e.x);if(0!==i)return i;const n=m.compare(t.y,e.y);return 0!==n?n:this._dimensionsToTest<=2?0:m.compare(t.getZ(),e.getZ())}get interfaces_(){return[l]}}function y(t,e){return t.interfaces_&&t.interfaces_.indexOf(e)>-1}f.DimensionalComparator=m,f.NULL_ORDINATE=s.NaN,f.X=0,f.Y=1,f.Z=2,f.M=3;class v{add(){}addAll(){}isEmpty(){}iterator(){}size(){}toArray(){}remove(){}}class x extends i{constructor(t){super(t),this.name=Object.keys({IndexOutOfBoundsException:x})[0]}}class E extends v{get(){}set(){}isEmpty(){}}class I extends i{constructor(t){super(t),this.name=Object.keys({NoSuchElementException:I})[0]}}class C extends E{constructor(t){super(),this.array=[],t instanceof v&&this.addAll(t)}get interfaces_(){return[E,v]}ensureCapacity(){}add(t){return 1===arguments.length?this.array.push(t):this.array.splice(arguments[0],0,arguments[1]),!0}clear(){this.array=[]}addAll(t){for(const e of t)this.array.push(e)}set(t,e){const i=this.array[t];return this.array[t]=e,i}iterator(){return new w(this)}get(t){if(t<0||t>=this.size())throw new x;return this.array[t]}isEmpty(){return 0===this.array.length}sort(t){t?this.array.sort((e,i)=>t.compare(e,i)):this.array.sort()}size(){return this.array.length}toArray(){return this.array.slice()}remove(t){for(let e=0,i=this.array.length;e=1&&this.get(this.size()-1).equals2D(t))return null;super.add.call(this,t)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return this.add(t,e),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1];if(arguments[2])for(let i=0;i=0;i--)this.add(t[i],e);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1];if(!arguments[2]){const i=this.size();if(i>0){if(t>0&&this.get(t-1).equals2D(e))return null;if(tn&&(r=-1);for(let s=i;s!==n;s+=r)this.add(t[s],e);return!0}}closeRing(){if(this.size()>0){const t=this.get(0).copy();this.add(t,!1)}}}S.coordArrayType=new Array(0).fill(null);class T{filter(t,e){}isDone(){}isGeometryChanged(){}}class L{constructor(){L.constructor_.apply(this,arguments)}static constructor_(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof f){const t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof L){const t=arguments[0];this.init(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t.x,e.x,t.y,e.y)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this.init(t,e,i,n)}}static intersects(){if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return i.x>=(t.xe.x?t.x:e.x)&&i.y>=(t.ye.y?t.y:e.y)}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];let r=Math.min(i.x,n.x),s=Math.max(i.x,n.x),o=Math.min(t.x,e.x),a=Math.max(t.x,e.x);return!(o>s||as||at._minx?this._minx:t._minx,i=this._miny>t._miny?this._miny:t._miny,n=this._maxx=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];return!this.isNull()&&t>=this._minx&&t<=this._maxx&&e>=this._miny&&e<=this._maxy}}intersects(){if(1===arguments.length){if(arguments[0]instanceof L){const t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||(t.x>e.x?t.x:e.x)this._maxy||(t.y>e.y?t.y:e.y)this._maxx||tthis._maxy||ethis._maxx&&(this._maxx=t._maxx),t._minythis._maxy&&(this._maxy=t._maxy))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.isNull()?(this._minx=t,this._maxx=t,this._miny=e,this._maxy=e):(tthis._maxx&&(this._maxx=t),ethis._maxy&&(this._maxy=e))}}minExtent(){if(this.isNull())return 0;const t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0}translate(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}copy(){return new L(this)}toString(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}setToNull(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}disjoint(t){return!(!this.isNull()&&!t.isNull())||t._minx>this._maxx||t._maxxthis._maxy||t._maxye?t:e}expandBy(){if(1===arguments.length){const t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=e,this._maxy+=e,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}contains(){if(1===arguments.length){if(arguments[0]instanceof L){const t=arguments[0];return this.covers(t)}if(arguments[0]instanceof f){const t=arguments[0];return this.covers(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.covers(t,e)}}centre(){return this.isNull()?null:new f((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}init(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof f){const t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof L){const t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t.x,e.x,t.y,e.y)}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];tt._maxx&&(e=this._minx-t._maxx);let i=0;return this._maxyt._maxy&&(i=this._miny-t._maxy),0===e?i:0===i?e:Math.sqrt(e*e+i*i)}hashCode(){let t=17;return t=37*t+f.hashCode(this._minx),t=37*t+f.hashCode(this._maxx),t=37*t+f.hashCode(this._miny),t=37*t+f.hashCode(this._maxy),t}get interfaces_(){return[o,h]}}class N{constructor(t){this.str=t}append(t){this.str+=t}setCharAt(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}toString(){return this.str}}class O{constructor(t){this.value=t}intValue(){return this.value}compareTo(t){return this.valuet?1:0}static compare(t,e){return te?1:0}static isNan(t){return Number.isNaN(t)}static valueOf(t){return new O(t)}}class R{static isWhitespace(t){return t<=32&&t>=0||127===t}static toUpperCase(t){return t.toUpperCase()}}class P{constructor(){P.constructor_.apply(this,arguments)}static constructor_(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){const t=arguments[0];this.init(t)}else if(arguments[0]instanceof P){const t=arguments[0];this.init(t)}else if("string"==typeof arguments[0]){const t=arguments[0];P.constructor_.call(this,P.parse(t))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.init(t,e)}}static determinant(){if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];return P.determinant(P.valueOf(t),P.valueOf(e),P.valueOf(i),P.valueOf(n))}if(arguments[3]instanceof P&&arguments[2]instanceof P&&arguments[0]instanceof P&&arguments[1]instanceof P){const t=arguments[1],e=arguments[2],i=arguments[3];return arguments[0].multiply(i).selfSubtract(t.multiply(e))}}static sqr(t){return P.valueOf(t).selfMultiply(t)}static valueOf(){if("string"==typeof arguments[0]){const t=arguments[0];return P.parse(t)}if("number"==typeof arguments[0])return new P(arguments[0])}static sqrt(t){return P.valueOf(t).sqrt()}static parse(t){let e=0;const i=t.length;for(;R.isWhitespace(t.charAt(e));)e++;let n=!1;if(e=i);){const i=t.charAt(e);if(e++,R.isDigit(i)){const t=i-"0";r.selfMultiply(P.TEN),r.selfAdd(t),s++}else{if("."!==i){if("e"===i||"E"===i){const i=t.substring(e);try{a=O.parseInt(i)}catch(e){throw e instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+i+" in string "+t):e}break}throw new NumberFormatException("Unexpected character '"+i+"' at position "+e+" in string "+t)}o=s,l=!0}}let h=r;l||(o=s);const c=s-o-a;if(0===c)h=r;else if(c>0){const t=P.TEN.pow(c);h=r.divide(t)}else if(c<0){const t=P.TEN.pow(-c);h=r.multiply(t)}return n?h.negate():h}static createNaN(){return new P(s.NaN,s.NaN)}static copy(t){return new P(t)}static magnitude(t){const e=Math.abs(t),i=Math.log(e)/Math.log(10);let n=Math.trunc(Math.floor(i));return 10*Math.pow(10,n)<=e&&(n+=1),n}static stringOfChar(t,e){const i=new N;for(let n=0;n9?(r=!0,l="9"):l="0"+n,o.append(l),i=i.subtract(P.valueOf(n)).multiply(P.TEN),r&&i.selfAdd(P.TEN);let h=!0;const c=P.magnitude(i._hi);if(c<0&&Math.abs(c)>=a-e&&(h=!1),!h)break}return e[0]=n,o.toString()}sqr(){return this.multiply(this)}doubleValue(){return this._hi+this._lo}subtract(){if(arguments[0]instanceof P){const t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){const t=arguments[0];return this.add(-t)}}equals(){if(1===arguments.length&&arguments[0]instanceof P){const t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}isZero(){return 0===this._hi&&0===this._lo}selfSubtract(){if(arguments[0]instanceof P){const t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}}getSpecialNumberString(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}min(t){return this.le(t)?this:t}selfDivide(){if(1===arguments.length){if(arguments[0]instanceof P){const t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.selfDivide(t,0)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let i=null,n=null,r=null,s=null,o=null,a=null,l=null,h=null;return o=this._hi/t,a=P.SPLIT*o,i=a-o,h=P.SPLIT*t,i=a-i,n=o-i,r=h-t,l=o*t,r=h-r,s=t-r,h=i*r-l+i*s+n*r+n*s,a=(this._hi-l-h+this._lo-o*e)/t,h=o+a,this._hi=h,this._lo=o-h+a,this}}dump(){return"DD<"+this._hi+", "+this._lo+">"}divide(){if(arguments[0]instanceof P){const t=arguments[0];let e=null,i=null,n=null,r=null,s=null,o=null,a=null,l=null;return s=this._hi/t._hi,o=P.SPLIT*s,e=o-s,l=P.SPLIT*t._hi,e=o-e,i=s-e,n=l-t._hi,a=s*t._hi,n=l-n,r=t._hi-n,l=e*n-a+e*r+i*n+i*r,o=(this._hi-a-l+this._lo-s*t._lo)/t._hi,l=s+o,new P(l,s-l+o)}if("number"==typeof arguments[0]){const t=arguments[0];return s.isNaN(t)?P.createNaN():P.copy(this).selfDivide(t,0)}}ge(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}pow(t){if(0===t)return P.valueOf(1);let e=new P(this),i=P.valueOf(1),n=Math.abs(t);if(n>1)for(;n>0;)n%2==1&&i.selfMultiply(e),n/=2,n>0&&(e=e.sqr());else i=e;return t<0?i.reciprocal():i}ceil(){if(this.isNaN())return P.NaN;const t=Math.ceil(this._hi);let e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new P(t,e)}compareTo(t){const e=t;return this._hie._hi?1:this._loe._lo?1:0}rint(){return this.isNaN()?this:this.add(.5).floor()}setValue(){if(arguments[0]instanceof P){const t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){const t=arguments[0];return this.init(t),this}}max(t){return this.ge(t)?this:t}sqrt(){if(this.isZero())return P.valueOf(0);if(this.isNegative())return P.NaN;const t=1/Math.sqrt(this._hi),e=this._hi*t,i=P.valueOf(e),n=this.subtract(i.sqr())._hi*(.5*t);return i.add(n)}selfAdd(){if(1===arguments.length){if(arguments[0]instanceof P){const t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];let e=null,i=null,n=null,r=null,s=null,o=null;return n=this._hi+t,s=n-this._hi,r=n-s,r=t-s+(this._hi-r),o=r+this._lo,e=n+o,i=o+(n-e),this._hi=e+i,this._lo=i+(e-this._hi),this}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let i=null,n=null,r=null,s=null,o=null,a=null,l=null,h=null;o=this._hi+t,r=this._lo+e,l=o-this._hi,h=r-this._lo,a=o-l,s=r-h,a=t-l+(this._hi-a),s=e-h+(this._lo-s),l=a+r,i=o+l,n=l+(o-i),l=s+n;const c=i+l,u=l+(i-c);return this._hi=c,this._lo=u,this}}selfMultiply(){if(1===arguments.length){if(arguments[0]instanceof P){const t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){const t=arguments[0];return this.selfMultiply(t,0)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];let i=null,n=null,r=null,s=null,o=null,a=null;o=P.SPLIT*this._hi,i=o-this._hi,a=P.SPLIT*t,i=o-i,n=this._hi-i,r=a-t,o=this._hi*t,r=a-r,s=t-r,a=i*r-o+i*s+n*r+n*s+(this._hi*e+this._lo*t);const l=o+a;i=o-l;const h=a+i;return this._hi=l,this._lo=h,this}}selfSqr(){return this.selfMultiply(this)}floor(){if(this.isNaN())return P.NaN;const t=Math.floor(this._hi);let e=0;return t===this._hi&&(e=Math.floor(this._lo)),new P(t,e)}negate(){return this.isNaN()?this:new P(-this._hi,-this._lo)}clone(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}multiply(){if(arguments[0]instanceof P){const t=arguments[0];return t.isNaN()?P.createNaN():P.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){const t=arguments[0];return s.isNaN(t)?P.createNaN():P.copy(this).selfMultiply(t,0)}}isNaN(){return s.isNaN(this._hi)}intValue(){return Math.trunc(this._hi)}toString(){const t=P.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}toStandardNotation(){const t=this.getSpecialNumberString();if(null!==t)return t;const e=new Array(1).fill(null),i=this.extractSignificantDigits(!0,e),n=e[0]+1;let r=i;if("."===i.charAt(0))r="0"+i;else if(n<0)r="0."+P.stringOfChar("0",-n)+i;else if(-1===i.indexOf(".")){const t=n-i.length;r=i+P.stringOfChar("0",t)+".0"}return this.isNegative()?"-"+r:r}reciprocal(){let t=null,e=null,i=null,n=null,r=null,s=null,o=null,a=null;r=1/this._hi,s=P.SPLIT*r,t=s-r,a=P.SPLIT*this._hi,t=s-t,e=r-t,i=a-this._hi,o=r*this._hi,i=a-i,n=this._hi-i,a=t*i-o+t*n+e*i+e*n,s=(1-o-a-r*this._lo)/this._hi;const l=r+s;return new P(l,r-l+s)}toSciNotation(){if(this.isZero())return P.SCI_NOT_ZERO;const t=this.getSpecialNumberString();if(null!==t)return t;const e=new Array(1).fill(null),i=this.extractSignificantDigits(!1,e),n=P.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===i.charAt(0))throw new IllegalStateException("Found leading zero: "+i);let r="";i.length>1&&(r=i.substring(1));const s=i.charAt(0)+"."+r;return this.isNegative()?"-"+s+n:s+n}abs(){return this.isNaN()?P.NaN:this.isNegative()?this.negate():new P(this)}isPositive(){return this._hi>0||0===this._hi&&this._lo>0}lt(t){return this._hit._hi||this._hi===t._hi&&this._lo>t._lo}isNegative(){return this._hi<0||0===this._hi&&this._lo<0}trunc(){return this.isNaN()?P.NaN:this.isPositive()?this.floor():this.ceil()}signum(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}get interfaces_(){return[h,o,a]}}P.PI=new P(3.141592653589793,12246467991473532e-32),P.TWO_PI=new P(6.283185307179586,24492935982947064e-32),P.PI_2=new P(1.5707963267948966,6123233995736766e-32),P.E=new P(2.718281828459045,14456468917292502e-32),P.NaN=new P(s.NaN,s.NaN),P.EPS=123259516440783e-46,P.SPLIT=134217729,P.MAX_PRINT_DIGITS=32,P.TEN=P.valueOf(10),P.ONE=P.valueOf(1),P.SCI_NOT_EXPONENT_CHAR="E",P.SCI_NOT_ZERO="0.0E0";class b{static orientationIndex(t,e,i){const n=b.orientationIndexFilter(t,e,i);if(n<=1)return n;const r=P.valueOf(e.x).selfAdd(-t.x),s=P.valueOf(e.y).selfAdd(-t.y),o=P.valueOf(i.x).selfAdd(-e.x),a=P.valueOf(i.y).selfAdd(-e.y);return r.selfMultiply(a).selfSubtract(s.selfMultiply(o)).signum()}static signOfDet2x2(){if(arguments[3]instanceof P&&arguments[2]instanceof P&&arguments[0]instanceof P&&arguments[1]instanceof P){const t=arguments[1],e=arguments[2],i=arguments[3];return arguments[0].multiply(i).selfSubtract(t.multiply(e)).signum()}if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=P.valueOf(t),s=P.valueOf(e),o=P.valueOf(i),a=P.valueOf(n);return r.multiply(a).selfSubtract(s.multiply(o)).signum()}}static intersection(t,e,i,n){const r=new P(t.y).selfSubtract(e.y),o=new P(e.x).selfSubtract(t.x),a=new P(t.x).selfMultiply(e.y).selfSubtract(new P(e.x).selfMultiply(t.y)),l=new P(i.y).selfSubtract(n.y),h=new P(n.x).selfSubtract(i.x),c=new P(i.x).selfMultiply(n.y).selfSubtract(new P(n.x).selfMultiply(i.y)),u=o.multiply(c).selfSubtract(h.multiply(a)),d=l.multiply(a).selfSubtract(r.multiply(c)),g=r.multiply(h).selfSubtract(l.multiply(o)),_=u.selfDivide(g).doubleValue(),p=d.selfDivide(g).doubleValue();return s.isNaN(_)||s.isInfinite(_)||s.isNaN(p)||s.isInfinite(p)?null:new f(_,p)}static orientationIndexFilter(t,e,i){let n=null;const r=(t.x-i.x)*(e.y-i.y),s=(t.y-i.y)*(e.x-i.x),o=r-s;if(r>0){if(s<=0)return b.signum(o);n=r+s}else{if(!(r<0))return b.signum(o);if(s>=0)return b.signum(o);n=-r-s}const a=b.DP_SAFE_EPSILON*n;return o>=a||-o>=a?b.signum(o):2}static signum(t){return t>0?1:t<0?-1:0}}b.DP_SAFE_EPSILON=1e-15;class M{getM(t){if(this.hasM()){const e=this.getDimension()-this.getMeasures();return this.getOrdinate(t,e)}return s.NaN}setOrdinate(t,e,i){}getZ(t){return this.hasZ()?this.getOrdinate(t,2):s.NaN}size(){}getOrdinate(t,e){}getCoordinate(){}getCoordinateCopy(t){}createCoordinate(){}getDimension(){}hasM(){return this.getMeasures()>0}getX(t){}hasZ(){return this.getDimension()-this.getMeasures()>2}getMeasures(){return 0}expandEnvelope(t){}copy(){}getY(t){}toCoordinateArray(){}get interfaces_(){return[a]}}M.X=0,M.Y=1,M.Z=2,M.M=3;class A{static index(t,e,i){return b.orientationIndex(t,e,i)}static isCCW(){if(arguments[0]instanceof Array){const t=arguments[0],e=t.length-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");let i=t[0],r=0;for(let n=1;n<=e;n++){const e=t[n];e.y>i.y&&(i=e,r=n)}let s=r;do{s-=1,s<0&&(s=e)}while(t[s].equals2D(i)&&s!==r);let o=r;do{o=(o+1)%e}while(t[o].equals2D(i)&&o!==r);const a=t[s],l=t[o];if(a.equals2D(i)||l.equals2D(i)||a.equals2D(l))return!1;const h=A.index(a,i,l);let c=null;return c=0===h?a.x>l.x:h>0,c}if(y(arguments[0],M)){const t=arguments[0],e=t.size()-1;if(e<3)throw new n("Ring has fewer than 4 points, so orientation cannot be determined");let i=t.getCoordinate(0),r=0;for(let n=1;n<=e;n++){const e=t.getCoordinate(n);e.y>i.y&&(i=e,r=n)}let s=null,o=r;do{o-=1,o<0&&(o=e),s=t.getCoordinate(o)}while(s.equals2D(i)&&o!==r);let a=null,l=r;do{l=(l+1)%e,a=t.getCoordinate(l)}while(a.equals2D(i)&&l!==r);if(s.equals2D(i)||a.equals2D(i)||s.equals2D(a))return!1;const h=A.index(s,i,a);let c=null;return c=0===h?s.x>a.x:h>0,c}}}A.CLOCKWISE=-1,A.RIGHT=A.CLOCKWISE,A.COUNTERCLOCKWISE=1,A.LEFT=A.COUNTERCLOCKWISE,A.COLLINEAR=0,A.STRAIGHT=A.COLLINEAR;class F{static intersection(t,e,i,n){const r=t.xe.x?t.x:e.x,l=t.y>e.y?t.y:e.y,h=i.xn.x?i.x:n.x,d=i.y>n.y?i.y:n.y,g=((r>h?r:h)+(ac?o:c)+(li?i:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],i=arguments[2];return ti?i:t}}static wrap(t,e){return t<0?e- -t%e:t%e}static max(){if(3===arguments.length){const t=arguments[1],e=arguments[2];let i=arguments[0];return t>i&&(i=t),e>i&&(i=e),i}if(4===arguments.length){const t=arguments[1],e=arguments[2],i=arguments[3];let n=arguments[0];return t>n&&(n=t),e>n&&(n=e),i>n&&(n=i),n}}static average(t,e){return(t+e)/2}}G.LOG_10=Math.log(10);class k{static segmentToSegment(t,e,i,n){if(t.equals(e))return k.pointToSegment(t,i,n);if(i.equals(n))return k.pointToSegment(n,t,e);let r=!1;if(L.intersects(t,e,i,n)){const s=(e.x-t.x)*(n.y-i.y)-(e.y-t.y)*(n.x-i.x);if(0===s)r=!0;else{const o=(t.y-i.y)*(n.x-i.x)-(t.x-i.x)*(n.y-i.y),a=((t.y-i.y)*(e.x-t.x)-(t.x-i.x)*(e.y-t.y))/s,l=o/s;(l<0||l>1||a<0||a>1)&&(r=!0)}}else r=!0;return r?G.min(k.pointToSegment(t,i,n),k.pointToSegment(e,i,n),k.pointToSegment(i,t,e),k.pointToSegment(n,t,e)):0}static pointToSegment(t,e,i){if(e.x===i.x&&e.y===i.y)return t.distance(e);const n=(i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y),r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;if(r<=0)return t.distance(e);if(r>=1)return t.distance(i);const s=((e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y))/n;return Math.abs(s)*Math.sqrt(n)}static pointToLinePerpendicular(t,e,i){const n=(i.x-e.x)*(i.x-e.x)+(i.y-e.y)*(i.y-e.y),r=((e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y))/n;return Math.abs(r)*Math.sqrt(n)}static pointToSegmentString(t,e){if(0===e.length)throw new n("Line array must contain at least one vertex");let i=t.distance(e[0]);for(let n=0;n0)&&(n=e,i=r)}return i}}static extend(t,e,i){const n=t.create(i,e.getDimension()),r=e.size();if(j.copy(e,0,n,0,r),r>0)for(let t=r;t0)&&(e=n)}return e}}class U extends i{constructor(t){super(t),this.name=Object.keys({UnsupportedOperationException:U})[0]}}class W{static toDimensionSymbol(t){switch(t){case W.FALSE:return W.SYM_FALSE;case W.TRUE:return W.SYM_TRUE;case W.DONTCARE:return W.SYM_DONTCARE;case W.P:return W.SYM_P;case W.L:return W.SYM_L;case W.A:return W.SYM_A}throw new n("Unknown dimension value: "+t)}static toDimensionValue(t){switch(R.toUpperCase(t)){case W.SYM_FALSE:return W.FALSE;case W.SYM_TRUE:return W.TRUE;case W.SYM_DONTCARE:return W.DONTCARE;case W.SYM_P:return W.P;case W.SYM_L:return W.L;case W.SYM_A:return W.A}throw new n("Unknown dimension symbol: "+t)}}W.P=0,W.L=1,W.A=2,W.FALSE=-1,W.TRUE=-2,W.DONTCARE=-3,W.SYM_FALSE="F",W.SYM_TRUE="T",W.SYM_DONTCARE="*",W.SYM_P="0",W.SYM_L="1",W.SYM_A="2";class H{filter(t){}}class Z extends Y{constructor(){super(),Z.constructor_.apply(this,arguments)}static constructor_(){if(this._points=null,0===arguments.length);else if(2===arguments.length){const t=arguments[0],e=arguments[1];Y.constructor_.call(this,e),this.init(t)}}computeEnvelopeInternal(){return this.isEmpty()?new L:this._points.expandEnvelope(new L)}isRing(){return this.isClosed()&&this.isSimple()}getCoordinates(){return this._points.toCoordinateArray()}copyInternal(){return new Z(this._points.copy(),this._factory)}equalsExact(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof Y){const t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;const i=t;if(this._points.size()!==i._points.size())return!1;for(let t=0;t0){const t=this._points.copy();j.reverse(t),this._points=t}return null}}}getCoordinate(){return this.isEmpty()?null:this._points.getCoordinate(0)}getBoundaryDimension(){return this.isClosed()?W.FALSE:0}isClosed(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}reverseInternal(){const t=this._points.copy();return j.reverse(t),this.getFactory().createLineString(t)}getEndPoint(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}getTypeCode(){return Y.TYPECODE_LINESTRING}getDimension(){return 1}getLength(){return q.ofLine(this._points)}getNumPoints(){return this._points.size()}compareToSameClass(){if(1===arguments.length){const t=arguments[0];let e=0,i=0;for(;e= 2)");this._points=t}isCoordinate(t){for(let e=0;et.compareTo(e));else if(2===arguments.length)t.sort((t,e)=>arguments[1].compare(t,e));else if(3===arguments.length){const e=t.slice(arguments[1],arguments[2]);e.sort();const i=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);for(const e of i)t.push(e)}else if(4===arguments.length){const e=t.slice(arguments[1],arguments[2]);e.sort((t,e)=>arguments[3].compare(t,e));const i=t.slice(0,arguments[1]).concat(e,t.slice(arguments[2],t.length));t.splice(0,t.length);for(const e of i)t.push(e)}}static asList(t){const e=new C;for(const i of t)e.add(i);return e}static copyOf(t,e){return t.slice(0,e)}}class tt{}class et extends Y{constructor(){super(),et.constructor_.apply(this,arguments)}static constructor_(){this._shell=null,this._holes=null;let t=arguments[0],e=arguments[1],i=arguments[2];if(Y.constructor_.call(this,i),null===t&&(t=this.getFactory().createLinearRing()),null===e&&(e=[]),Y.hasNullElements(e))throw new n("holes must not contain null elements");if(t.isEmpty()&&Y.hasNonEmptyElements(e))throw new n("shell is empty but holes are not");this._shell=t,this._holes=e}computeEnvelopeInternal(){return this._shell.getEnvelopeInternal()}getCoordinates(){if(this.isEmpty())return[];const t=new Array(this.getNumPoints()).fill(null);let e=-1;const i=this._shell.getCoordinates();for(let n=0;n=1&&this.getCoordinateSequence().size()= 4)")}getGeometryType(){return Y.TYPENAME_LINEARRING}}lt.MINIMUM_VALID_SIZE=4;class ht extends f{constructor(){super(),ht.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)f.constructor_.call(this);else if(1===arguments.length){if(arguments[0]instanceof ht){const t=arguments[0];f.constructor_.call(this,t.x,t.y)}else if(arguments[0]instanceof f){const t=arguments[0];f.constructor_.call(this,t.x,t.y)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];f.constructor_.call(this,t,e,f.NULL_ORDINATE)}}setOrdinate(t,e){switch(t){case ht.X:this.x=e;break;case ht.Y:this.y=e;break;default:throw new n("Invalid ordinate index: "+t)}}getZ(){return f.NULL_ORDINATE}getOrdinate(t){switch(t){case ht.X:return this.x;case ht.Y:return this.y}throw new n("Invalid ordinate index: "+t)}setZ(t){throw new n("CoordinateXY dimension 2 does not support z-ordinate")}copy(){return new ht(this)}toString(){return"("+this.x+", "+this.y+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}}ht.X=0,ht.Y=1,ht.Z=-1,ht.M=-1;class ct extends f{constructor(){super(),ct.constructor_.apply(this,arguments)}static constructor_(){if(this._m=null,0===arguments.length)f.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof ct){const t=arguments[0];f.constructor_.call(this,t.x,t.y),this._m=t._m}else if(arguments[0]instanceof f){const t=arguments[0];f.constructor_.call(this,t.x,t.y),this._m=this.getM()}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];f.constructor_.call(this,t,e,f.NULL_ORDINATE),this._m=i}}getM(){return this._m}setOrdinate(t,e){switch(t){case ct.X:this.x=e;break;case ct.Y:this.y=e;break;case ct.M:this._m=e;break;default:throw new n("Invalid ordinate index: "+t)}}setM(t){this._m=t}getZ(){return f.NULL_ORDINATE}getOrdinate(t){switch(t){case ct.X:return this.x;case ct.Y:return this.y;case ct.M:return this._m}throw new n("Invalid ordinate index: "+t)}setZ(t){throw new n("CoordinateXY dimension 2 does not support z-ordinate")}copy(){return new ct(this)}toString(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}}ct.X=0,ct.Y=1,ct.Z=-1,ct.M=2;class ut extends f{constructor(){super(),ut.constructor_.apply(this,arguments)}static constructor_(){if(this._m=null,0===arguments.length)f.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof ut){const t=arguments[0];f.constructor_.call(this,t),this._m=t._m}else if(arguments[0]instanceof f){const t=arguments[0];f.constructor_.call(this,t),this._m=this.getM()}}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];f.constructor_.call(this,t,e,i),this._m=n}}getM(){return this._m}setOrdinate(t,e){switch(t){case f.X:this.x=e;break;case f.Y:this.y=e;break;case f.Z:this.z=e;break;case f.M:this._m=e;break;default:throw new n("Invalid ordinate index: "+t)}}setM(t){this._m=t}getOrdinate(t){switch(t){case f.X:return this.x;case f.Y:return this.y;case f.Z:return this.getZ();case f.M:return this.getM()}throw new n("Invalid ordinate index: "+t)}copy(){return new ut(this)}toString(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}setCoordinate(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}}class dt{static measures(t){return t instanceof ht?0:t instanceof ct||t instanceof ut?1:0}static dimension(t){return t instanceof ht?2:t instanceof ct?3:t instanceof ut?4:3}static create(){if(1===arguments.length){const t=arguments[0];return dt.create(t,0)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return 2===t?new ht:3===t&&0===e?new f:3===t&&1===e?new ct:4===t&&1===e?new ut:new f}}}class gt{static isRing(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))}static ptNotInList(t,e){for(let i=0;i=t?e:[]}static indexOf(t,e){for(let i=0;i0)&&(e=t[i]);return e}static extract(t,e,i){e=G.clamp(e,0,t.length);let n=(i=G.clamp(i,-1,t.length))-e+1;i<0&&(n=0),e>=t.length&&(n=0),in.length)return 1;if(0===i.length)return 0;const r=gt.compare(i,n);return gt.isEqualReversed(i,n)?0:r}OLDcompare(t,e){const i=t,n=e;if(i.lengthn.length)return 1;if(0===i.length)return 0;const r=gt.increasingDirection(i),s=gt.increasingDirection(n);let o=r>0?0:i.length-1,a=s>0?0:i.length-1;for(let t=0;t0){const t=new _t(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(let e=1;e3&&(t=3),t<2&&(t=2),new pt(arguments[0],t)}if(3===arguments.length){let t=arguments[2],e=arguments[1]-t;return t>1&&(t=1),e>3&&(e=3),e<2&&(e=2),new pt(arguments[0],e+t,t)}}}get interfaces_(){return[V,h]}}ft.instanceObject=new ft;class mt extends ot{constructor(){super(),mt.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];ot.constructor_.call(this,t,e)}copyInternal(){const t=new Array(this._geometries.length).fill(null);for(let e=0;et.add(e)),t}size(){return this.map.size()}}class It{constructor(){It.constructor_.apply(this,arguments)}static constructor_(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=It.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof Ct){const t=arguments[0];this._modelType=t,t===It.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){const t=arguments[0];this._modelType=It.FIXED,this.setScale(t)}else if(arguments[0]instanceof It){const t=arguments[0];this._modelType=t._modelType,this._scale=t._scale}}static mostPrecise(t,e){return t.compareTo(e)>=0?t:e}equals(t){if(!(t instanceof It))return!1;const e=t;return this._modelType===e._modelType&&this._scale===e._scale}compareTo(t){const e=t,i=this.getMaximumSignificantDigits(),n=e.getMaximumSignificantDigits();return O.compare(i,n)}getScale(){return this._scale}isFloating(){return this._modelType===It.FLOATING||this._modelType===It.FLOATING_SINGLE}getType(){return this._modelType}toString(){let t="UNKNOWN";return this._modelType===It.FLOATING?t="Floating":this._modelType===It.FLOATING_SINGLE?t="Floating-Single":this._modelType===It.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t}makePrecise(){if("number"==typeof arguments[0]){const t=arguments[0];return s.isNaN(t)||this._modelType===It.FLOATING_SINGLE?t:this._modelType===It.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof f){const t=arguments[0];if(this._modelType===It.FLOATING)return null;t.x=this.makePrecise(t.x),t.y=this.makePrecise(t.y)}}getMaximumSignificantDigits(){let t=16;return this._modelType===It.FLOATING?t=16:this._modelType===It.FLOATING_SINGLE?t=6:this._modelType===It.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t}setScale(t){this._scale=Math.abs(t)}get interfaces_(){return[h,o]}}class Ct{constructor(){Ct.constructor_.apply(this,arguments)}static constructor_(){this._name=null;const t=arguments[0];this._name=t,Ct.nameToTypeMap.put(t,this)}readResolve(){return Ct.nameToTypeMap.get(this._name)}toString(){return this._name}get interfaces_(){return[h]}}Ct.nameToTypeMap=new Et,It.Type=Ct,It.FIXED=new Ct("FIXED"),It.FLOATING=new Ct("FLOATING"),It.FLOATING_SINGLE=new Ct("FLOATING SINGLE"),It.maximumPreciseValue=9007199254740992;class wt extends ot{constructor(){super(),wt.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];ot.constructor_.call(this,t,e)}copyInternal(){const t=new Array(this._geometries.length).fill(null);for(let e=0;e1){if(r instanceof et)return this.createMultiPolygon(St.toPolygonArray(t));if(r instanceof Z)return this.createMultiLineString(St.toLineStringArray(t));if(r instanceof J)return this.createMultiPoint(St.toPointArray(t));d.shouldNeverReachHere("Unhandled geometry type: "+r.getGeometryType())}return r}createMultiPointFromCoords(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}createPoint(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof f){const t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(y(arguments[0],M))return new J(arguments[0],this)}}getCoordinateSequenceFactory(){return this._coordinateSequenceFactory}createPolygon(){if(0===arguments.length)return this.createPolygon(null,null);if(1===arguments.length){if(y(arguments[0],M)){const t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){const t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof lt){const t=arguments[0];return this.createPolygon(t,null)}}else if(2===arguments.length)return new et(arguments[0],arguments[1],this)}getSRID(){return this._SRID}createGeometryCollection(){return 0===arguments.length?new ot(null,this):1===arguments.length?new ot(arguments[0],this):void 0}getPrecisionModel(){return this._precisionModel}createLinearRing(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(y(arguments[0],M))return new lt(arguments[0],this)}}createMultiPolygon(){return 0===arguments.length?new mt(null,this):1===arguments.length?new mt(arguments[0],this):void 0}createMultiPoint(){if(0===arguments.length)return new at(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new at(arguments[0],this);if(y(arguments[0],M)){const t=arguments[0];if(null===t)return this.createMultiPoint(new Array(0).fill(null));const e=new Array(t.size()).fill(null);for(let i=0;i="a"&&t<="z"||t>="A"&&t<="Z"}isNumeric_(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)}isWhiteSpace_(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}nextChar_(){return this.wkt.charAt(++this.index_)}nextToken(){const t=this.nextChar_(),e=this.index_;let i,n=t;if("("==t)i=2;else if(","==t)i=5;else if(")"==t)i=3;else if(this.isNumeric_(t)||"-"==t)i=4,n=this.readNumber_();else if(this.isAlpha_(t))i=1,n=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(""!==t)throw new Error("Unexpected character: "+t);i=6}return{position:e,value:n,type:i}}readNumber_(){let t;const e=this.index_;let i=!1,n=!1;do{"."==t?i=!0:"e"!=t&&"E"!=t||(n=!0),t=this.nextChar_()}while(this.isNumeric_(t,i)||!n&&("e"==t||"E"==t)||n&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}readText_(){let t;const e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}class Ot{constructor(t,e){this.lexer_=t,this.token_,this.layout_="XY",this.factory=e}consume_(){this.token_=this.lexer_.nextToken()}isTokenType(t){return this.token_.type==t}match(t){const e=this.isTokenType(t);return e&&this.consume_(),e}parse(){return this.consume_(),this.parseGeometry_()}parseGeometryLayout_(){let t="XY";const e=this.token_;if(this.isTokenType(1)){const i=e.value;"Z"===i?t="XYZ":"M"===i?t="XYM":"ZM"===i&&(t="XYZM"),"XY"!==t&&this.consume_()}return t}parseGeometryCollectionText_(){if(this.match(2)){const t=[];do{t.push(this.parseGeometry_())}while(this.match(5));if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePointText_(){if(this.match(2)){const t=this.parsePoint_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}parseLineStringText_(){if(this.match(2)){const t=this.parsePointList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePolygonText_(){if(this.match(2)){const t=this.parseLineStringTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiPointText_(){if(this.match(2)){let t;if(t=2==this.token_.type?this.parsePointTextList_():this.parsePointList_(),this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiLineStringText_(){if(this.match(2)){const t=this.parseLineStringTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parseMultiPolygonText_(){if(this.match(2)){const t=this.parsePolygonTextList_();if(this.match(3))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}parsePoint_(){const t=[],e=this.layout_.length;for(let i=0;inew f(...t),i=i=>{const n=i.map(i=>t.createLinearRing(i.map(e)));return n.length>1?t.createPolygon(n[0],n.slice(1)):t.createPolygon(n[0])},n=this.token_;if(this.match(1)){const r=n.value;if(this.layout_=this.parseGeometryLayout_(),"GEOMETRYCOLLECTION"==r){const e=this.parseGeometryCollectionText_();return t.createGeometryCollection(e)}switch(r){case"POINT":{const e=this.parsePointText_();return e?t.createPoint(new f(...e)):t.createPoint()}case"LINESTRING":{const i=this.parseLineStringText_().map(e);return t.createLineString(i)}case"LINEARRING":{const i=this.parseLineStringText_().map(e);return t.createLinearRing(i)}case"POLYGON":{const e=this.parsePolygonText_();return e&&0!==e.length?i(e):t.createPolygon()}case"MULTIPOINT":{const i=this.parseMultiPointText_();if(!i||0===i.length)return t.createMultiPoint();const n=i.map(e).map(e=>t.createPoint(e));return t.createMultiPoint(n)}case"MULTILINESTRING":{const i=this.parseMultiLineStringText_().map(i=>t.createLineString(i.map(e)));return t.createMultiLineString(i)}case"MULTIPOLYGON":{const e=this.parseMultiPolygonText_();if(!e||0===e.length)return t.createMultiPolygon();const n=e.map(i);return t.createMultiPolygon(n)}default:throw new Error("Invalid geometry type: "+r)}}throw new Error(this.formatErrorMessage_())}}function Rt(t){if(t.isEmpty())return"";const e=t.getCoordinate(),i=[e.x,e.y];return e.z&&i.push(e.z),e.m&&i.push(e.m),i.join(" ")}function Pt(t){const e=t.getCoordinates().map(t=>[t.x,t.y]),i=[];for(let t=0,n=e.length;t0&&(e+=" "+n),t.isEmpty()?e+" EMPTY":e+" ("+i(t)+")"}class Ft{constructor(t){this.geometryFactory=t||new St,this.precisionModel=this.geometryFactory.getPrecisionModel()}read(t){const e=new Nt(t);return new Ot(e,this.geometryFactory).parse()}write(t){return At(t)}}class Dt{constructor(t){this.parser=new Ft(t)}write(t){return this.parser.write(t)}static toLineString(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"}}class Gt{constructor(){Gt.constructor_.apply(this,arguments)}static constructor_(){this._result=null,this._inputLines=Array(2).fill().map(()=>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 f,this._intPt[1]=new f,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}static computeEdgeDistance(t,e,i){const n=Math.abs(i.x-e.x),r=Math.abs(i.y-e.y);let s=-1;if(t.equals(e))s=0;else if(t.equals(i))s=n>r?n:r;else{const i=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);s=n>r?i:o,0!==s||t.equals(e)||(s=Math.max(i,o))}return d.isTrue(!(0===s&&!t.equals(e)),"Bad distance calculation"),s}static nonRobustComputeEdgeDistance(t,e,i){const n=t.x-e.x,r=t.y-e.y,s=Math.sqrt(n*n+r*r);return d.isTrue(!(0===s&&!t.equals(e)),"Invalid distance calculation"),s}getIndexAlongSegment(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}getTopologySummary(){const t=new _t;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}computeIntersection(t,e,i,n){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=i,this._inputLines[1][1]=n,this._result=this.computeIntersect(t,e,i,n)}getIntersectionNum(){return this._result}computeIntLineIndex(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map(()=>Array(2)),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){const 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)}}isProper(){return this.hasIntersection()&&this._isProper}setPrecisionModel(t){this._precisionModel=t}isInteriorIntersection(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){const t=arguments[0];for(let e=0;e1e-4&&D.out.println("Distance = "+r.distance(s))}intersectionSafe(t,e,i,n){let r=F.intersection(t,e,i,n);return null===r&&(r=kt.nearestEndpoint(t,e,i,n)),r}computeCollinearIntersection(t,e,i,n){const r=L.intersects(t,e,i),s=L.intersects(t,e,n),o=L.intersects(i,n,t),a=L.intersects(i,n,e);return r&&s?(this._intPt[0]=i,this._intPt[1]=n,Gt.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=t,this._intPt[1]=e,Gt.COLLINEAR_INTERSECTION):r&&o?(this._intPt[0]=i,this._intPt[1]=t,!i.equals(t)||s||a?Gt.COLLINEAR_INTERSECTION:Gt.POINT_INTERSECTION):r&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||s||o?Gt.COLLINEAR_INTERSECTION:Gt.POINT_INTERSECTION):s&&o?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||r||a?Gt.COLLINEAR_INTERSECTION:Gt.POINT_INTERSECTION):s&&a?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||r||o?Gt.COLLINEAR_INTERSECTION:Gt.POINT_INTERSECTION):Gt.NO_INTERSECTION}computeIntersect(t,e,i,n){if(this._isProper=!1,!L.intersects(t,e,i,n))return Gt.NO_INTERSECTION;const r=A.index(t,e,i),s=A.index(t,e,n);if(r>0&&s>0||r<0&&s<0)return Gt.NO_INTERSECTION;const o=A.index(i,n,t),a=A.index(i,n,e);return o>0&&a>0||o<0&&a<0?Gt.NO_INTERSECTION:0===r&&0===s&&0===o&&0===a?this.computeCollinearIntersection(t,e,i,n):(0===r||0===s||0===o||0===a?(this._isProper=!1,t.equals2D(i)||t.equals2D(n)?this._intPt[0]=t:e.equals2D(i)||e.equals2D(n)?this._intPt[0]=e:0===r?this._intPt[0]=new f(i):0===s?this._intPt[0]=new f(n):0===o?this._intPt[0]=new f(t):0===a&&(this._intPt[0]=new f(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,i,n)),Gt.POINT_INTERSECTION)}}class Vt{constructor(){Vt.constructor_.apply(this,arguments)}static constructor_(){if(this.p0=null,this.p1=null,0===arguments.length)Vt.constructor_.call(this,new f,new f);else if(1===arguments.length){const t=arguments[0];Vt.constructor_.call(this,t.p0,t.p1)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.p0=t,this.p1=e}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];Vt.constructor_.call(this,new f(t,e),new f(i,n))}}static midPoint(t,e){return new f((t.x+e.x)/2,(t.y+e.y)/2)}minX(){return Math.min(this.p0.x,this.p1.x)}orientationIndex(){if(arguments[0]instanceof Vt){const t=arguments[0],e=A.index(this.p0,this.p1,t.p0),i=A.index(this.p0,this.p1,t.p1);return e>=0&&i>=0||e<=0&&i<=0?Math.max(e,i):0}if(arguments[0]instanceof f){const t=arguments[0];return A.index(this.p0,this.p1,t)}}toGeometry(t){return t.createLineString([this.p0,this.p1])}isVertical(){return this.p0.x===this.p1.x}equals(t){if(!(t instanceof Vt))return!1;const e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)}intersection(t){const e=new kt;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}project(){if(arguments[0]instanceof f){const t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new f(t);const e=this.projectionFactor(t),i=new f;return i.x=this.p0.x+e*(this.p1.x-this.p0.x),i.y=this.p0.y+e*(this.p1.y-this.p0.y),i}if(arguments[0]instanceof Vt){const t=arguments[0],e=this.projectionFactor(t.p0),i=this.projectionFactor(t.p1);if(e>=1&&i>=1)return null;if(e<=0&&i<=0)return null;let n=this.project(t.p0);e<0&&(n=this.p0),e>1&&(n=this.p1);let r=this.project(t.p1);return i<0&&(r=this.p0),i>1&&(r=this.p1),new Vt(n,r)}}normalize(){this.p1.compareTo(this.p0)<0&&this.reverse()}angle(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}getCoordinate(t){return 0===t?this.p0:this.p1}distancePerpendicular(t){return k.pointToLinePerpendicular(t,this.p0,this.p1)}minY(){return Math.min(this.p0.y,this.p1.y)}midPoint(){return Vt.midPoint(this.p0,this.p1)}projectionFactor(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;const e=this.p1.x-this.p0.x,i=this.p1.y-this.p0.y,n=e*e+i*i;return n<=0?s.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*i)/n}closestPoints(t){const e=this.intersection(t);if(null!==e)return[e,e];const i=new Array(2).fill(null);let n=s.MAX_VALUE,r=null;const o=this.closestPoint(t.p0);n=o.distance(t.p0),i[0]=o,i[1]=t.p0;const a=this.closestPoint(t.p1);r=a.distance(t.p1),r0&&e<1?this.project(t):this.p0.distance(t)1||s.isNaN(e))&&(e=1),e}toString(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}isHorizontal(){return this.p0.y===this.p1.y}reflect(t){const e=this.p1.getY()-this.p0.getY(),i=this.p0.getX()-this.p1.getX(),n=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),r=e*e+i*i,s=e*e-i*i,o=t.getX(),a=t.getY();return new f((-s*o-2*e*i*a-2*e*n)/r,(s*a-2*e*i*o-2*i*n)/r)}distance(){if(arguments[0]instanceof Vt){const t=arguments[0];return k.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof f){const t=arguments[0];return k.pointToSegment(t,this.p0,this.p1)}}pointAlong(t){const e=new f;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e}hashCode(){let t=s.doubleToLongBits(this.p0.x);t^=31*s.doubleToLongBits(this.p0.y);const e=Math.trunc(t)^Math.trunc(t>>32);let i=s.doubleToLongBits(this.p1.x);return i^=31*s.doubleToLongBits(this.p1.y),e^Math.trunc(i)^Math.trunc(i>>32)}get interfaces_(){return[o,h]}}class Bt{static toLocationSymbol(t){switch(t){case Bt.EXTERIOR:return"e";case Bt.BOUNDARY:return"b";case Bt.INTERIOR:return"i";case Bt.NONE:return"-"}throw new n("Unknown location value: "+t)}}Bt.INTERIOR=0,Bt.BOUNDARY=1,Bt.EXTERIOR=2,Bt.NONE=-1;class Yt{constructor(){Yt.constructor_.apply(this,arguments)}static constructor_(){if(this._matrix=null,0===arguments.length)this._matrix=Array(3).fill().map(()=>Array(3)),this.setAll(W.FALSE);else if(1===arguments.length)if("string"==typeof arguments[0]){const t=arguments[0];Yt.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof Yt){const t=arguments[0];Yt.constructor_.call(this),this._matrix[Bt.INTERIOR][Bt.INTERIOR]=t._matrix[Bt.INTERIOR][Bt.INTERIOR],this._matrix[Bt.INTERIOR][Bt.BOUNDARY]=t._matrix[Bt.INTERIOR][Bt.BOUNDARY],this._matrix[Bt.INTERIOR][Bt.EXTERIOR]=t._matrix[Bt.INTERIOR][Bt.EXTERIOR],this._matrix[Bt.BOUNDARY][Bt.INTERIOR]=t._matrix[Bt.BOUNDARY][Bt.INTERIOR],this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]=t._matrix[Bt.BOUNDARY][Bt.BOUNDARY],this._matrix[Bt.BOUNDARY][Bt.EXTERIOR]=t._matrix[Bt.BOUNDARY][Bt.EXTERIOR],this._matrix[Bt.EXTERIOR][Bt.INTERIOR]=t._matrix[Bt.EXTERIOR][Bt.INTERIOR],this._matrix[Bt.EXTERIOR][Bt.BOUNDARY]=t._matrix[Bt.EXTERIOR][Bt.BOUNDARY],this._matrix[Bt.EXTERIOR][Bt.EXTERIOR]=t._matrix[Bt.EXTERIOR][Bt.EXTERIOR]}}static matches(){if(Number.isInteger(arguments[0])&&"string"==typeof arguments[1]){const t=arguments[0],e=arguments[1];return e===W.SYM_DONTCARE||e===W.SYM_TRUE&&(t>=0||t===W.TRUE)||e===W.SYM_FALSE&&t===W.FALSE||e===W.SYM_P&&t===W.P||e===W.SYM_L&&t===W.L||e===W.SYM_A&&t===W.A}if("string"==typeof arguments[0]&&"string"==typeof arguments[1]){const t=arguments[1];return new Yt(arguments[0]).matches(t)}}static isTrue(t){return t>=0||t===W.TRUE}isIntersects(){return!this.isDisjoint()}isCovers(){return(Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.BOUNDARY])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]))&&this._matrix[Bt.EXTERIOR][Bt.INTERIOR]===W.FALSE&&this._matrix[Bt.EXTERIOR][Bt.BOUNDARY]===W.FALSE}isCoveredBy(){return(Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.BOUNDARY])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]))&&this._matrix[Bt.INTERIOR][Bt.EXTERIOR]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.EXTERIOR]===W.FALSE}set(){if(1===arguments.length){const t=arguments[0];for(let e=0;e=0&&e>=0&&this.setAtLeast(t,e,i)}isWithin(){return Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&this._matrix[Bt.INTERIOR][Bt.EXTERIOR]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.EXTERIOR]===W.FALSE}isTouches(t,e){return t>e?this.isTouches(e,t):(t===W.A&&e===W.A||t===W.L&&e===W.L||t===W.L&&e===W.A||t===W.P&&e===W.A||t===W.P&&e===W.L)&&this._matrix[Bt.INTERIOR][Bt.INTERIOR]===W.FALSE&&(Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.BOUNDARY])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.INTERIOR])||Yt.isTrue(this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]))}isOverlaps(t,e){return t===W.P&&e===W.P||t===W.A&&e===W.A?Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.EXTERIOR])&&Yt.isTrue(this._matrix[Bt.EXTERIOR][Bt.INTERIOR]):t===W.L&&e===W.L&&1===this._matrix[Bt.INTERIOR][Bt.INTERIOR]&&Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.EXTERIOR])&&Yt.isTrue(this._matrix[Bt.EXTERIOR][Bt.INTERIOR])}isEquals(t,e){return t===e&&Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&this._matrix[Bt.INTERIOR][Bt.EXTERIOR]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.EXTERIOR]===W.FALSE&&this._matrix[Bt.EXTERIOR][Bt.INTERIOR]===W.FALSE&&this._matrix[Bt.EXTERIOR][Bt.BOUNDARY]===W.FALSE}toString(){const t=new _t("123456789");for(let e=0;e<3;e++)for(let i=0;i<3;i++)t.setCharAt(3*e+i,W.toDimensionSymbol(this._matrix[e][i]));return t.toString()}setAll(t){for(let e=0;e<3;e++)for(let i=0;i<3;i++)this._matrix[e][i]=t}get(t,e){return this._matrix[t][e]}transpose(){let t=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=t,t=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=t,t=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=t,this}matches(t){if(9!==t.length)throw new n("Should be length 9: "+t);for(let e=0;e<3;e++)for(let i=0;i<3;i++)if(!Yt.matches(this._matrix[e][i],t.charAt(3*e+i)))return!1;return!0}add(t){for(let e=0;e<3;e++)for(let i=0;i<3;i++)this.setAtLeast(e,i,t.get(e,i))}isDisjoint(){return this._matrix[Bt.INTERIOR][Bt.INTERIOR]===W.FALSE&&this._matrix[Bt.INTERIOR][Bt.BOUNDARY]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.INTERIOR]===W.FALSE&&this._matrix[Bt.BOUNDARY][Bt.BOUNDARY]===W.FALSE}isCrosses(t,e){return t===W.P&&e===W.L||t===W.P&&e===W.A||t===W.L&&e===W.A?Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.EXTERIOR]):t===W.L&&e===W.P||t===W.A&&e===W.P||t===W.A&&e===W.L?Yt.isTrue(this._matrix[Bt.INTERIOR][Bt.INTERIOR])&&Yt.isTrue(this._matrix[Bt.EXTERIOR][Bt.INTERIOR]):t===W.L&&e===W.L&&0===this._matrix[Bt.INTERIOR][Bt.INTERIOR]}get interfaces_(){return[a]}}class zt{static toDegrees(t){return 180*t/Math.PI}static normalize(t){for(;t>Math.PI;)t-=zt.PI_TIMES_2;for(;t<=-Math.PI;)t+=zt.PI_TIMES_2;return t}static angle(){if(1===arguments.length){const t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=e.x-t.x,n=e.y-t.y;return Math.atan2(n,i)}}static isAcute(t,e,i){const n=t.x-e.x,r=t.y-e.y;return n*(i.x-e.x)+r*(i.y-e.y)>0}static isObtuse(t,e,i){const n=t.x-e.x,r=t.y-e.y;return n*(i.x-e.x)+r*(i.y-e.y)<0}static interiorAngle(t,e,i){const n=zt.angle(e,t),r=zt.angle(e,i);return Math.abs(r-n)}static normalizePositive(t){if(t<0){for(;t<0;)t+=zt.PI_TIMES_2;t>=zt.PI_TIMES_2&&(t=0)}else{for(;t>=zt.PI_TIMES_2;)t-=zt.PI_TIMES_2;t<0&&(t=0)}return t}static angleBetween(t,e,i){const n=zt.angle(e,t),r=zt.angle(e,i);return zt.diff(n,r)}static diff(t,e){let i=null;return i=tMath.PI&&(i=2*Math.PI-i),i}static toRadians(t){return t*Math.PI/180}static getTurn(t,e){const i=Math.sin(e-t);return i>0?zt.COUNTERCLOCKWISE:i<0?zt.CLOCKWISE:zt.NONE}static angleBetweenOriented(t,e,i){const n=zt.angle(e,t),r=zt.angle(e,i)-n;return r<=-Math.PI?r+zt.PI_TIMES_2:r>Math.PI?r-zt.PI_TIMES_2:r}}zt.PI_TIMES_2=2*Math.PI,zt.PI_OVER_2=Math.PI/2,zt.PI_OVER_4=Math.PI/4,zt.COUNTERCLOCKWISE=A.COUNTERCLOCKWISE,zt.CLOCKWISE=A.CLOCKWISE,zt.NONE=A.COLLINEAR;class qt extends i{constructor(){super(),qt.constructor_.apply(this,arguments)}static constructor_(){i.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}class Xt{constructor(){Xt.constructor_.apply(this,arguments)}static constructor_(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){const t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];this.x=t,this.y=e,this.w=1}else if(arguments[0]instanceof Xt&&arguments[1]instanceof Xt){const t=arguments[0],e=arguments[1];this.x=t.y*e.w-e.y*t.w,this.y=e.x*t.w-t.x*e.w,this.w=t.x*e.y-e.x*t.y}else if(arguments[0]instanceof f&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1];this.x=t.y-e.y,this.y=e.x-t.x,this.w=t.x*e.y-e.x*t.y}}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this.x=t,this.y=e,this.w=i}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=t.y-e.y,s=e.x-t.x,o=t.x*e.y-e.x*t.y,a=i.y-n.y,l=n.x-i.x,h=i.x*n.y-n.x*i.y;this.x=s*h-l*o,this.y=a*o-r*h,this.w=r*l-a*s}}getY(){const t=this.y/this.w;if(s.isNaN(t)||s.isInfinite(t))throw new qt;return t}getX(){const t=this.x/this.w;if(s.isNaN(t)||s.isInfinite(t))throw new qt;return t}getCoordinate(){const t=new f;return t.x=this.getX(),t.y=this.getY(),t}}class jt{constructor(){jt.constructor_.apply(this,arguments)}static constructor_(){this.p0=null,this.p1=null,this.p2=null;const t=arguments[0],e=arguments[1],i=arguments[2];this.p0=t,this.p1=e,this.p2=i}static area(t,e,i){return Math.abs(((i.x-t.x)*(e.y-t.y)-(e.x-t.x)*(i.y-t.y))/2)}static signedArea(t,e,i){return((i.x-t.x)*(e.y-t.y)-(e.x-t.x)*(i.y-t.y))/2}static det(t,e,i,n){return t*n-e*i}static interpolateZ(t,e,i,n){const r=e.x,s=e.y,o=i.x-r,a=n.x-r,l=i.y-s,h=n.y-s,c=o*h-a*l,u=t.x-r,d=t.y-s,g=(h*u-a*d)/c,_=(-l*u+o*d)/c;return e.getZ()+g*(i.getZ()-e.getZ())+_*(n.getZ()-e.getZ())}static longestSideLength(t,e,i){const n=t.distance(e),r=e.distance(i),s=i.distance(t);let o=n;return r>o&&(o=r),s>o&&(o=s),o}static circumcentreDD(t,e,i){const n=P.valueOf(t.x).subtract(i.x),r=P.valueOf(t.y).subtract(i.y),s=P.valueOf(e.x).subtract(i.x),o=P.valueOf(e.y).subtract(i.y),a=P.determinant(n,r,s,o).multiply(2),l=n.sqr().add(r.sqr()),h=s.sqr().add(o.sqr()),c=P.determinant(r,l,o,h),u=P.determinant(n,l,s,h),d=P.valueOf(i.x).subtract(c.divide(a)).doubleValue(),g=P.valueOf(i.y).add(u.divide(a)).doubleValue();return new f(d,g)}static isAcute(t,e,i){return!!zt.isAcute(t,e,i)&&!!zt.isAcute(e,i,t)&&!!zt.isAcute(i,t,e)}static circumcentre(t,e,i){const n=i.x,r=i.y,s=t.x-n,o=t.y-r,a=e.x-n,l=e.y-r,h=2*jt.det(s,o,a,l),c=jt.det(o,s*s+o*o,l,a*a+l*l),u=jt.det(s,s*s+o*o,a,a*a+l*l);return new f(n-c/h,r+u/h)}static perpendicularBisector(t,e){const i=e.x-t.x,n=e.y-t.y,r=new Xt(t.x+i/2,t.y+n/2,1),s=new Xt(t.x-n+i/2,t.y+i+n/2,1);return new Xt(r,s)}static angleBisector(t,e,i){const n=e.distance(t),r=n/(n+e.distance(i)),s=i.x-t.x,o=i.y-t.y;return new f(t.x+r*s,t.y+r*o)}static area3D(t,e,i){const n=e.x-t.x,r=e.y-t.y,s=e.getZ()-t.getZ(),o=i.x-t.x,a=i.y-t.y,l=i.getZ()-t.getZ(),h=r*l-s*a,c=s*o-n*l,u=n*a-r*o,d=h*h+c*c+u*u;return Math.sqrt(d)/2}static centroid(t,e,i){const n=(t.x+e.x+i.x)/3,r=(t.y+e.y+i.y)/3;return new f(n,r)}static inCentre(t,e,i){const n=e.distance(i),r=t.distance(i),s=t.distance(e),o=n+r+s,a=(n*t.x+r*e.x+s*i.x)/o,l=(n*t.y+r*e.y+s*i.y)/o;return new f(a,l)}area(){return jt.area(this.p0,this.p1,this.p2)}signedArea(){return jt.signedArea(this.p0,this.p1,this.p2)}interpolateZ(t){if(null===t)throw new n("Supplied point is null.");return jt.interpolateZ(t,this.p0,this.p1,this.p2)}longestSideLength(){return jt.longestSideLength(this.p0,this.p1,this.p2)}isAcute(){return jt.isAcute(this.p0,this.p1,this.p2)}circumcentre(){return jt.circumcentre(this.p0,this.p1,this.p2)}area3D(){return jt.area3D(this.p0,this.p1,this.p2)}centroid(){return jt.centroid(this.p0,this.p1,this.p2)}inCentre(){return jt.inCentre(this.p0,this.p1,this.p2)}}class Ut extends i{constructor(){super(),Ut.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)i.constructor_.call(this);else if(1===arguments.length){const t=arguments[0];i.constructor_.call(this,t)}}}class Wt{constructor(){Wt.constructor_.apply(this,arguments)}static constructor_(){if(this._m00=null,this._m01=null,this._m02=null,this._m10=null,this._m11=null,this._m12=null,0===arguments.length)this.setToIdentity();else if(1===arguments.length){if(arguments[0]instanceof Array){const t=arguments[0];this._m00=t[0],this._m01=t[1],this._m02=t[2],this._m10=t[3],this._m11=t[4],this._m12=t[5]}else if(arguments[0]instanceof Wt){const t=arguments[0];this.setTransformation(t)}}else if(6===arguments.length&&"number"==typeof arguments[5]&&"number"==typeof arguments[4]&&"number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[4],s=arguments[5];this.setTransformation(t,e,i,n,r,s)}}static translationInstance(t,e){const i=new Wt;return i.setToTranslation(t,e),i}static shearInstance(t,e){const i=new Wt;return i.setToShear(t,e),i}static reflectionInstance(){if(2===arguments.length){const t=arguments[0],e=arguments[1],i=new Wt;return i.setToReflection(t,e),i}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=new Wt;return r.setToReflection(t,e,i,n),r}}static rotationInstance(){if(1===arguments.length){const t=arguments[0];return Wt.rotationInstance(Math.sin(t),Math.cos(t))}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=new Wt;return i.setToRotation(t,e),i}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return Wt.rotationInstance(Math.sin(t),Math.cos(t),e,i)}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=new Wt;return r.setToRotation(t,e,i,n),r}}static scaleInstance(){if(2===arguments.length){const t=arguments[0],e=arguments[1],i=new Wt;return i.setToScale(t,e),i}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=new Wt;return r.translate(-i,-n),r.scale(t,e),r.translate(i,n),r}}setToReflectionBasic(t,e,i,r){if(t===i&&e===r)throw new n("Reflection line points must be distinct");const s=i-t,o=r-e,a=Math.sqrt(s*s+o*o),l=o/a,h=s/a,c=2*l*h,u=h*h-l*l;return this._m00=u,this._m01=c,this._m02=0,this._m10=c,this._m11=-u,this._m12=0,this}getInverse(){const t=this.getDeterminant();if(0===t)throw new Ut("Transformation is non-invertible");const e=this._m11/t,i=-this._m10/t,n=-this._m01/t,r=this._m00/t,s=(this._m01*this._m12-this._m02*this._m11)/t,o=(-this._m00*this._m12+this._m10*this._m02)/t;return new Wt(e,n,s,i,r,o)}compose(t){const e=t._m00*this._m00+t._m01*this._m10,i=t._m00*this._m01+t._m01*this._m11,n=t._m00*this._m02+t._m01*this._m12+t._m02,r=t._m10*this._m00+t._m11*this._m10,s=t._m10*this._m01+t._m11*this._m11,o=t._m10*this._m02+t._m11*this._m12+t._m12;return this._m00=e,this._m01=i,this._m02=n,this._m10=r,this._m11=s,this._m12=o,this}equals(t){if(null===t)return!1;if(!(t instanceof Wt))return!1;const e=t;return this._m00===e._m00&&this._m01===e._m01&&this._m02===e._m02&&this._m10===e._m10&&this._m11===e._m11&&this._m12===e._m12}setToScale(t,e){return this._m00=t,this._m01=0,this._m02=0,this._m10=0,this._m11=e,this._m12=0,this}isIdentity(){return 1===this._m00&&0===this._m01&&0===this._m02&&0===this._m10&&1===this._m11&&0===this._m12}scale(t,e){return this.compose(Wt.scaleInstance(t,e)),this}setToIdentity(){return this._m00=1,this._m01=0,this._m02=0,this._m10=0,this._m11=1,this._m12=0,this}isGeometryChanged(){return!0}setTransformation(){if(1===arguments.length){const t=arguments[0];return this._m00=t._m00,this._m01=t._m01,this._m02=t._m02,this._m10=t._m10,this._m11=t._m11,this._m12=t._m12,this}if(6===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[4],s=arguments[5];return this._m00=t,this._m01=e,this._m02=i,this._m10=n,this._m11=r,this._m12=s,this}}setToRotation(){if(1===arguments.length){const t=arguments[0];return this.setToRotation(Math.sin(t),Math.cos(t)),this}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._m00=e,this._m01=-t,this._m02=0,this._m10=t,this._m11=e,this._m12=0,this}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return this.setToRotation(Math.sin(t),Math.cos(t),e,i),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];return this._m00=e,this._m01=-t,this._m02=i-i*e+n*t,this._m10=t,this._m11=e,this._m12=n-i*t-n*e,this}}getMatrixEntries(){return[this._m00,this._m01,this._m02,this._m10,this._m11,this._m12]}filter(t,e){this.transform(t,e)}rotate(){if(1===arguments.length){const t=arguments[0];return this.compose(Wt.rotationInstance(t)),this}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.compose(Wt.rotationInstance(t,e)),this}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return this.compose(Wt.rotationInstance(t,e,i)),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];return this.compose(Wt.rotationInstance(t,e,i,n)),this}}getDeterminant(){return this._m00*this._m11-this._m01*this._m10}composeBefore(t){const e=this._m00*t._m00+this._m01*t._m10,i=this._m00*t._m01+this._m01*t._m11,n=this._m00*t._m02+this._m01*t._m12+this._m02,r=this._m10*t._m00+this._m11*t._m10,s=this._m10*t._m01+this._m11*t._m11,o=this._m10*t._m02+this._m11*t._m12+this._m12;return this._m00=e,this._m01=i,this._m02=n,this._m10=r,this._m11=s,this._m12=o,this}setToShear(t,e){return this._m00=1,this._m01=t,this._m02=0,this._m10=e,this._m11=1,this._m12=0,this}isDone(){return!1}clone(){try{return null}catch(t){if(!(t instanceof i))throw t;d.shouldNeverReachHere()}return null}translate(t,e){return this.compose(Wt.translationInstance(t,e)),this}setToReflection(){if(2===arguments.length){const t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Reflection vector must be non-zero");if(t===e)return this._m00=0,this._m01=1,this._m02=0,this._m10=1,this._m11=0,this._m12=0,this;const i=Math.sqrt(t*t+e*e),r=e/i,s=t/i;return this.rotate(-r,s),this.scale(1,-1),this.rotate(r,s),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],r=arguments[3];if(t===i&&e===r)throw new n("Reflection line points must be distinct");this.setToTranslation(-t,-e);const s=i-t,o=r-e,a=Math.sqrt(s*s+o*o),l=o/a,h=s/a;return this.rotate(-l,h),this.scale(1,-1),this.rotate(l,h),this.translate(t,e),this}}toString(){return"AffineTransformation[["+this._m00+", "+this._m01+", "+this._m02+"], ["+this._m10+", "+this._m11+", "+this._m12+"]]"}setToTranslation(t,e){return this._m00=1,this._m01=0,this._m02=t,this._m10=0,this._m11=1,this._m12=e,this}shear(t,e){return this.compose(Wt.shearInstance(t,e)),this}transform(){if(1===arguments.length){const t=arguments[0].copy();return t.apply(this),t}if(2===arguments.length){if(arguments[0]instanceof f&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1],i=this._m00*t.x+this._m01*t.y+this._m02,n=this._m10*t.x+this._m11*t.y+this._m12;return e.x=i,e.y=n,e}if(y(arguments[0],M)&&Number.isInteger(arguments[1])){const t=arguments[0],e=arguments[1],i=this._m00*t.getOrdinate(e,0)+this._m01*t.getOrdinate(e,1)+this._m02,n=this._m10*t.getOrdinate(e,0)+this._m11*t.getOrdinate(e,1)+this._m12;t.setOrdinate(e,0,i),t.setOrdinate(e,1,n)}}}reflect(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.compose(Wt.reflectionInstance(t,e)),this}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];return this.compose(Wt.reflectionInstance(t,e,i,n)),this}}get interfaces_(){return[a,T]}}class Ht{static solve(t,e){const i=e.length;if(t.length!==i||t[0].length!==i)throw new n("Matrix A is incorrectly sized");for(let n=0;nMath.abs(t[r][n])&&(r=e);if(0===t[r][n])return null;Ht.swapRows(t,n,r),Ht.swapRows(e,n,r);for(let r=n+1;r=n;e--)t[r][e]-=t[n][e]*s;e[r]-=e[n]*s}}const r=new Array(i).fill(null);for(let n=i-1;n>=0;n--){let s=0;for(let e=n+1;e3)throw new n("Too many control points");return 1===t.length?Kt.createFromControlVectors(t[0],e[0]):2===t.length?Kt.createFromControlVectors(t[0],t[1],e[0],e[1]):Kt.createFromControlVectors(t[0],t[1],t[2],e[0],e[1],e[2])}}else{if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=new f(n.x-i.x,n.y-i.y),s=zt.angleBetweenOriented(e,t,r),o=e.distance(t),a=n.distance(i);if(0===o)return null;const l=a/o,h=Wt.translationInstance(-t.x,-t.y);return h.rotate(s),h.scale(l,l),h.translate(i.x,i.y),h}if(6===arguments.length)return new Zt(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]).getTransformation()}}}class Jt{constructor(){Jt.constructor_.apply(this,arguments)}static constructor_(){this._coords=null;const t=arguments[0];this._coords=t}static getCoordinates(t){const e=new C;return t.apply(new Jt(e)),e}filter(t){(t instanceof Z||t instanceof J)&&this._coords.add(t.getCoordinate())}get interfaces_(){return[B]}}class $t{constructor(){$t.constructor_.apply(this,arguments)}static constructor_(){this._mapOp=null;const t=arguments[0];this._mapOp=t}static map(t,e){return new $t(e).map(t)}map(t){const e=new C;for(let i=0;i0&&n<4&&!this._preserveType?this._factory.createLineString(i):this._factory.createLinearRing(i)}}class oe{constructor(){oe.constructor_.apply(this,arguments)}static constructor_(){this._comps=null;const t=arguments[0];this._comps=t}static getGeometry(t){return t.getFactory().buildGeometry(oe.getLines(t))}static getLines(){if(1===arguments.length){const t=arguments[0];return oe.getLines(t,new C)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t instanceof Z?e.add(t):t instanceof ot&&t.apply(new oe(e)),e}}filter(t){t instanceof Z&&this._comps.add(t)}get interfaces_(){return[H]}}class ae{constructor(){ae.constructor_.apply(this,arguments)}static constructor_(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){const t=arguments[0];this._lines=t}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._lines=t,this._isForcedToLineString=e}}static getGeometry(){if(1===arguments.length){const t=arguments[0];return t.getFactory().buildGeometry(ae.getLines(t))}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t.getFactory().buildGeometry(ae.getLines(t,e))}}static getLines(){if(1===arguments.length){const t=arguments[0];return ae.getLines(t,!1)}if(2===arguments.length){if(y(arguments[0],v)&&y(arguments[1],v)){const t=arguments[1];for(let e=arguments[0].iterator();e.hasNext();){const i=e.next();ae.getLines(i,t)}return t}if(arguments[0]instanceof Y&&"boolean"==typeof arguments[1]){const t=arguments[0],e=arguments[1],i=new C;return t.apply(new ae(i,e)),i}if(arguments[0]instanceof Y&&y(arguments[1],v)){const t=arguments[0],e=arguments[1];return t instanceof Z?e.add(t):t.apply(new ae(e)),e}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&y(arguments[0],v)&&y(arguments[1],v)){const t=arguments[1],e=arguments[2];for(let i=arguments[0].iterator();i.hasNext();){const n=i.next();ae.getLines(n,t,e)}return t}if("boolean"==typeof arguments[2]&&arguments[0]instanceof Y&&y(arguments[1],v)){const t=arguments[1],e=arguments[2];return arguments[0].apply(new ae(t,e)),t}}}filter(t){if(this._isForcedToLineString&&t instanceof lt){const e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof Z&&this._lines.add(t)}setForceToLineString(t){this._isForcedToLineString=t}get interfaces_(){return[B]}}const le={reverseOrder:function(){return{compare:(t,e)=>e.compareTo(t)}},min:function(t){return le.sort(t),t.get(0)},sort:function(t,e){const i=t.toArray();e?Q.sort(i,e):Q.sort(i);const n=t.iterator();for(let t=0,e=i.length;t2*Math.PI)&&(a=2*Math.PI);const l=a/(this._nPts-1),h=new Array(this._nPts).fill(null);let c=0;for(let e=0;e2*Math.PI)&&(a=2*Math.PI);const l=a/(this._nPts-1),h=new Array(this._nPts+2).fill(null);let c=0;h[c++]=this.coord(s,o);for(let e=0;e1&&(i=1);const n=i*e,r=(1-i)*e,s=t.getMinX()+e,o=t.getMinY()+e,a=new Array(this._nPts+1).fill(null);let l=0;for(let t=0;tthis._distance&&this.initialize(t,e,i)}}}class ye{static computeDistance(){if(arguments[2]instanceof me&&arguments[0]instanceof Z&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1],i=arguments[2],n=new Vt,r=t.getCoordinates();for(let t=0;t1||t<=0)throw new n("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t}compute(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)}distance(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()}computeOrientedDistance(t,e,i){const n=new xe(e);if(t.apply(n),i.setMaximum(n.getMaxPointDistance()),this._densifyFrac>0){const n=new Ee(e,this._densifyFrac);t.apply(n),i.setMaximum(n.getMaxPointDistance())}}orientedDistance(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()}}class xe{constructor(){xe.constructor_.apply(this,arguments)}static constructor_(){this._maxPtDist=new me,this._minPtDist=new me,this._euclideanDist=new ye,this._geom=null;const t=arguments[0];this._geom=t}filter(t){this._minPtDist.initialize(),ye.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}getMaxPointDistance(){return this._maxPtDist}get interfaces_(){return[z]}}class Ee{constructor(){Ee.constructor_.apply(this,arguments)}static constructor_(){this._maxPtDist=new me,this._minPtDist=new me,this._geom=null,this._numSubSegs=0;const t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))}filter(t,e){if(0===e)return null;const i=t.getCoordinate(e-1),n=t.getCoordinate(e),r=(n.x-i.x)/this._numSubSegs,s=(n.y-i.y)/this._numSubSegs;for(let t=0;te||this._maxs?1:0}get interfaces_(){return[l]}};class Te extends Se{constructor(){super(),Te.constructor_.apply(this,arguments)}static constructor_(){this._item=null;const t=arguments[0],e=arguments[1],i=arguments[2];this._min=t,this._max=e,this._item=i}query(t,e,i){if(!this.intersects(t,e))return null;i.visitItem(this._item)}}class Le extends Se{constructor(){super(),Le.constructor_.apply(this,arguments)}static constructor_(){this._node1=null,this._node2=null;const t=arguments[0],e=arguments[1];this._node1=t,this._node2=e,this.buildExtent(this._node1,this._node2)}buildExtent(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)}query(t,e,i){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,i),null!==this._node2&&this._node2.query(t,e,i)}}class Ne{constructor(){Ne.constructor_.apply(this,arguments)}static constructor_(){this._leaves=new C,this._root=null,this._level=0}buildTree(){le.sort(this._leaves,new Se.NodeComparator);let t=this._leaves,e=null,i=new C;for(;;){if(this.buildLevel(t,i),1===i.size())return i.get(0);e=t,t=i,i=e}}insert(t,e,i){if(null!==this._root)throw new IllegalStateException("Index cannot be added to once it has been queried");this._leaves.add(new Te(t,e,i))}query(t,e,i){if(this.init(),null===this._root)return null;this._root.query(t,e,i)}buildRoot(){if(null!==this._root)return null;this._root=this.buildTree()}printNode(t){D.out.println(Dt.toLineString(new f(t._min,this._level),new f(t._max,this._level)))}init(){return null!==this._root||0===this._leaves.size()?null:void this.buildRoot()}buildLevel(t,e){this._level++,e.clear();for(let i=0;in&&(i=e.x,n=t.x),this._p.x>=i&&this._p.x<=n&&(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){let i=A.index(t,e,this._p);if(i===A.COLLINEAR)return this._isPointOnSegment=!0,null;e.y=this._max)throw new I;const t=this._parent.getGeometryN(this._index++);return t instanceof ot?(this._subcollectionIterator=new De(t),this._subcollectionIterator.next()):t}remove(){throw new U(this.getClass().getName())}hasNext(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}get interfaces_(){return[Fe]}}class Ge{constructor(){Ge.constructor_.apply(this,arguments)}static constructor_(){this._geom=null;const t=arguments[0];this._geom=t}static locatePointInPolygon(t,e){if(e.isEmpty())return Bt.EXTERIOR;const i=e.getExteriorRing(),n=Ge.locatePointInRing(t,i);if(n!==Bt.INTERIOR)return n;for(let i=0;i0&&this.addPoint(t[0])}addHole(t){const e=A.isCCW(t);for(let i=0;i0)t.x=this._cg3.x/3/this._areasum2,t.y=this._cg3.y/3/this._areasum2;else if(this._totalLength>0)t.x=this._lineCentSum.x/this._totalLength,t.y=this._lineCentSum.y/this._totalLength;else{if(!(this._ptCount>0))return null;t.x=this._ptCentSum.x/this._ptCount,t.y=this._ptCentSum.y/this._ptCount}return t}addShell(t){t.length>0&&this.setAreaBasePoint(t[0]);const e=!A.isCCW(t);for(let i=0;i=this.size())throw new x;return this.array[t]}push(t){return this.array.push(t),t}pop(){if(0===this.array.length)throw new qe;return this.array.pop()}peek(){if(0===this.array.length)throw new qe;return this.array[this.array.length-1]}empty(){return 0===this.array.length}isEmpty(){return this.empty()}search(t){return this.array.indexOf(t)}size(){return this.array.length}toArray(){return this.array.slice()}}class je{constructor(){je.constructor_.apply(this,arguments)}static constructor_(){this._coordSet=new vt,this._list=new C}static filterCoordinates(t){const e=new je;for(let i=0;i50&&(t=this.reduce(this._inputPts));const e=this.preSort(t),i=this.grahamScan(e),n=this.toCoordinateArray(i);return this.lineOrPolygon(n)}padArray3(t){const e=new Array(3).fill(null);for(let i=0;ie[2].y&&(e[2]=t[i]),t[i].x+t[i].y>e[3].x+e[3].y&&(e[3]=t[i]),t[i].x>e[4].x&&(e[4]=t[i]),t[i].x-t[i].y>e[5].x-e[5].y&&(e[5]=t[i]),t[i].y0;)e=i.pop();i.push(e),i.push(t[n])}return i.push(t[0]),i}}class We{constructor(){We.constructor_.apply(this,arguments)}static constructor_(){this._origin=null;const t=arguments[0];this._origin=t}static polarCompare(t,e,i){const n=e.x-t.x,r=e.y-t.y,s=i.x-t.x,o=i.y-t.y,a=A.index(t,e,i);if(a===A.COUNTERCLOCKWISE)return 1;if(a===A.CLOCKWISE)return-1;const l=n*n+r*r,h=s*s+o*o;return lh?1:0}compare(t,e){const i=t,n=e;return We.polarCompare(this._origin,i,n)}get interfaces_(){return[l]}}Ue.RadialComparator=We;class He{constructor(){He.constructor_.apply(this,arguments)}static constructor_(){this._interiorPoint=null,this._maxWidth=-1;const t=arguments[0];this.process(t)}static getInteriorPoint(t){return new He(t).getInteriorPoint()}static avg(t,e){return(t+e)/2}getInteriorPoint(){return this._interiorPoint}process(t){if(t.isEmpty())return null;if(t instanceof et)this.processPolygon(t);else if(t instanceof ot){const e=t;for(let t=0;tthis._maxWidth&&(this._maxWidth=i,this._interiorPoint=e.getInteriorPoint())}}class Ze{constructor(){Ze.constructor_.apply(this,arguments)}static constructor_(){this._polygon=null,this._interiorPointY=null,this._interiorSectionWidth=0,this._interiorPoint=null;const t=arguments[0];this._polygon=t,this._interiorPointY=Je.getScanLineY(t)}static isEdgeCrossingCounted(t,e,i){const n=t.getY(),r=e.getY();return!(n===r||n===i&&rt.getMaxY())}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];return!(t.getY()>i&&e.getY()>i||t.getY()this._interiorSectionWidth){this._interiorSectionWidth=r;const t=He.avg(i,n);this._interiorPoint=new f(t,this._interiorPointY)}}}process(){if(this._polygon.isEmpty())return null;this._interiorPoint=new f(this._polygon.getCoordinate());const t=new C;this.scanRing(this._polygon.getExteriorRing(),t);for(let e=0;ee?1:0}get interfaces_(){return[l]}}Ze.DoubleComparator=Ke;class Je{constructor(){Je.constructor_.apply(this,arguments)}static constructor_(){this._poly=null,this._centreY=null,this._hiY=s.MAX_VALUE,this._loY=-s.MAX_VALUE;const t=arguments[0];this._poly=t,this._hiY=t.getEnvelopeInternal().getMaxY(),this._loY=t.getEnvelopeInternal().getMinY(),this._centreY=He.avg(this._loY,this._hiY)}static getScanLineY(t){return new Je(t).getScanLineY()}updateInterval(t){t<=this._centreY?t>this._loY&&(this._loY=t):t>this._centreY&&t0}get interfaces_(){return[ti]}}class ni{isInBoundary(t){return t>1}get interfaces_(){return[ti]}}class ri{isInBoundary(t){return 1===t}get interfaces_(){return[ti]}}ti.Mod2BoundaryNodeRule=ei,ti.EndPointBoundaryNodeRule=ii,ti.MultiValentEndPointBoundaryNodeRule=ni,ti.MonoValentEndPointBoundaryNodeRule=ri,ti.MOD2_BOUNDARY_RULE=new ei,ti.ENDPOINT_BOUNDARY_RULE=new ii,ti.MULTIVALENT_ENDPOINT_BOUNDARY_RULE=new ni,ti.MONOVALENT_ENDPOINT_BOUNDARY_RULE=new ri,ti.OGC_SFS_BOUNDARY_RULE=ti.MOD2_BOUNDARY_RULE;class si{constructor(){si.constructor_.apply(this,arguments)}static constructor_(){if(this._boundaryRule=ti.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){const t=arguments[0];if(null===t)throw new n("Rule must be non-null");this._boundaryRule=t}}locateInPolygonRing(t,e){return e.getEnvelopeInternal().intersects(t)?Ae.locateInRing(t,e.getCoordinates()):Bt.EXTERIOR}intersects(t,e){return this.locate(t,e)!==Bt.EXTERIOR}updateLocationInfo(t){t===Bt.INTERIOR&&(this._isIn=!0),t===Bt.BOUNDARY&&this._numBoundaries++}computeLocation(t,e){if(e instanceof J&&this.updateLocationInfo(this.locateOnPoint(t,e)),e instanceof Z)this.updateLocationInfo(this.locateOnLineString(t,e));else if(e instanceof et)this.updateLocationInfo(this.locateInPolygon(t,e));else if(e instanceof wt){const i=e;for(let e=0;e0||this._isIn?Bt.INTERIOR:Bt.EXTERIOR)}}class oi{constructor(){oi.constructor_.apply(this,arguments)}static constructor_(){this._input=null,this._extremalPts=null,this._centre=null,this._radius=0;const t=arguments[0];this._input=t}static farthestPoints(t){const e=t[0].distance(t[1]),i=t[1].distance(t[2]),n=t[2].distance(t[0]);return e>=i&&e>=n?[t[0],t[1]]:i>=e&&i>=n?[t[1],t[2]]:[t[2],t[0]]}static pointWitMinAngleWithX(t,e){let i=s.MAX_VALUE,n=null;for(let r=0;r=t.length&&(e=0),e}static computeC(t,e,i){return t*i.y-e*i.x}static getMinimumDiameter(t){return new ai(t).getDiameter()}static getMinimumRectangle(t){return new ai(t).getMinimumRectangle()}static computeSegmentForLine(t,e,i){let n=null,r=null;return Math.abs(e)>Math.abs(t)?(n=new f(0,i/e),r=new f(1,i/e-t/e)):(n=new f(i/t,0),r=new f(i/t-e/t,1)),new Vt(n,r)}getWidthCoordinate(){return this.computeMinimumDiameter(),this._minWidthPt}getSupportingSegment(){return this.computeMinimumDiameter(),this._inputGeom.getFactory().createLineString([this._minBaseSeg.p0,this._minBaseSeg.p1])}getDiameter(){if(this.computeMinimumDiameter(),null===this._minWidthPt)return this._inputGeom.getFactory().createLineString();const t=this._minBaseSeg.project(this._minWidthPt);return this._inputGeom.getFactory().createLineString([t,this._minWidthPt])}computeWidthConvex(t){this._convexHullPts=t instanceof et?t.getExteriorRing().getCoordinates():t.getCoordinates(),0===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=null,this._minBaseSeg=null):1===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=this._convexHullPts[0],this._minBaseSeg.p0=this._convexHullPts[0],this._minBaseSeg.p1=this._convexHullPts[0]):2===this._convexHullPts.length||3===this._convexHullPts.length?(this._minWidth=0,this._minWidthPt=this._convexHullPts[0],this._minBaseSeg.p0=this._convexHullPts[0],this._minBaseSeg.p1=this._convexHullPts[1]):this.computeConvexRingMinDiameter(this._convexHullPts)}computeConvexRingMinDiameter(t){this._minWidth=s.MAX_VALUE;let e=1;const i=new Vt;for(let n=0;n=n;)n=r,s=o,o=ai.nextIndex(t,s),r=e.distancePerpendicular(t[o]);return nn&&(n=a),ao&&(o=l),l1){const t=o/a;for(let e=1;ee?t:e)?3:i}static isInHalfPlane(t,e){return e===di.SE?t===di.SE||t===di.SW:t===e||t===e+1}static quadrant(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){const t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new n("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?di.NE:di.SE:e>=0?di.NW:di.SW}if(arguments[0]instanceof f&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1];if(e.x===t.x&&e.y===t.y)throw new n("Cannot compute the quadrant for two identical points "+t);return e.x>=t.x?e.y>=t.y?di.NE:di.SE:e.y>=t.y?di.NW:di.SW}}}di.NE=0,di.NW=1,di.SW=2,di.SE=3;class gi{constructor(){gi.constructor_.apply(this,arguments)}static constructor_(){this._orig=null,this._sym=null,this._next=null;const t=arguments[0];this._orig=t}static create(t,e){const i=new gi(t),n=new gi(e);return i.link(n),i}find(t){let e=this;do{if(null===e)return null;if(e.dest().equals2D(t))return e;e=e.oNext()}while(e!==this);return null}dest(){return this._sym._orig}isEdgesSorted(){const t=this.findLowest();let e=t;do{const i=e.oNext();if(i===t)break;if(!(i.compareTo(e)>0))return!1;e=i}while(e!==t);return!0}oNext(){return this._sym._next}directionY(){return this.directionPt().getY()-this._orig.getY()}insert(t){if(this.oNext()===this)return this.insertAfter(t),null;this.insertionEdge(t).insertAfter(t)}insertAfter(t){d.equals(this._orig,t.orig());const e=this.oNext();this._sym.setNext(t),t.sym().setNext(e)}degree(){let t=0,e=this;do{t++,e=e.oNext()}while(e!==this);return t}equals(){if(2===arguments.length&&arguments[1]instanceof f&&arguments[0]instanceof f){const t=arguments[0],e=arguments[1];return this._orig.equals2D(t)&&this._sym._orig.equals(e)}}findLowest(){let t=this,e=this.oNext();do{e.compareTo(t)<0&&(t=e),e=e.oNext()}while(e!==this);return t}directionPt(){return this.dest()}sym(){return this._sym}prev(){return this._sym.next()._sym}compareAngularDirection(t){const e=this.directionX(),i=this.directionY(),n=t.directionX(),r=t.directionY();if(e===n&&i===r)return 0;const s=di.quadrant(e,i),o=di.quadrant(n,r);if(s>o)return 1;if(s0&&t.compareTo(e)>=0&&t.compareTo(i)<=0)return e;if(i.compareTo(e)<=0&&(t.compareTo(i)<=0||t.compareTo(e)>=0))return e;e=i}while(e!==this);return d.shouldNeverReachHere(),null}compareTo(t){const e=t;return this.compareAngularDirection(e)}toStringNode(){const t=this.orig(),e=(this.dest(),new _t);e.append("Node( "+Dt.format(t)+" )\n");let i=this;do{e.append(" -> "+i),e.append("\n"),i=i.oNext()}while(i!==this);return e.toString()}link(t){this.setSym(t),t.setSym(this),this.setNext(t),t.setNext(this)}next(){return this._next}setSym(t){this._sym=t}orig(){return this._orig}toString(){return"HE("+this._orig.x+" "+this._orig.y+", "+this._sym._orig.x+" "+this._sym._orig.y+")"}toStringNodeEdge(){return" -> ("+Dt.format(this.dest())}setNext(t){this._next=t}}class _i extends gi{constructor(){super(),_i.constructor_.apply(this,arguments)}static constructor_(){this._isMarked=!1;const t=arguments[0];gi.constructor_.call(this,t)}static setMarkBoth(t,e){t.setMark(e),t.sym().setMark(e)}static isMarked(t){return t.isMarked()}static setMark(t,e){t.setMark(e)}static markBoth(t){t.mark(),t.sym().mark()}static mark(t){t.mark()}mark(){this._isMarked=!0}setMark(t){this._isMarked=t}isMarked(){return this._isMarked}}class pi{constructor(){pi.constructor_.apply(this,arguments)}static constructor_(){this._vertexMap=new Et}static isValidEdge(t,e){return 0!==e.compareTo(t)}insert(t,e,i){const n=this.create(t,e);null!==i?i.insert(n):this._vertexMap.put(t,n);const r=this._vertexMap.get(e);return null!==r?r.insert(n.sym()):this._vertexMap.put(e,n.sym()),n}create(t,e){const i=this.createEdge(t),n=this.createEdge(e);return i.link(n),i}createEdge(t){return new gi(t)}addEdge(t,e){if(!pi.isValidEdge(t,e))return null;const i=this._vertexMap.get(t);let n=null;return null!==i&&(n=i.find(e)),null!==n?n:this.insert(t,e,i)}getVertexEdges(){return this._vertexMap.values()}findEdge(t,e){const i=this._vertexMap.get(t);return null===i?null:i.find(e)}}class fi extends _i{constructor(){super(),fi.constructor_.apply(this,arguments)}static constructor_(){this._isStart=!1;const t=arguments[0];_i.constructor_.call(this,t)}setStart(){this._isStart=!0}isStart(){return this._isStart}}class mi extends pi{constructor(){super()}createEdge(t){return new fi(t)}}class yi{constructor(){yi.constructor_.apply(this,arguments)}static constructor_(){this._result=null,this._factory=null,this._graph=null,this._lines=new C,this._nodeEdgeStack=new Xe,this._ringStartEdge=null,this._graph=new mi}static dissolve(t){const e=new yi;return e.add(t),e.getResult()}addLine(t){this._lines.add(this._factory.createLineString(t.toCoordinateArray()))}updateRingStartEdge(t){return t.isStart()||(t=t.sym()).isStart()?null===this._ringStartEdge?(this._ringStartEdge=t,null):void(t.orig().compareTo(this._ringStartEdge.orig())<0&&(this._ringStartEdge=t)):null}getResult(){return null===this._result&&this.computeResult(),this._result}process(t){let e=t.prevNode();null===e&&(e=t),this.stackEdges(e),this.buildLines()}buildRing(t){const e=new S;let i=t;for(e.add(i.orig().copy(),!1);2===i.sym().degree();){const n=i.next();if(n===t)break;e.add(n.orig().copy(),!1),i=n}e.add(i.dest().copy(),!1),this.addLine(e)}buildLine(t){const e=new S;let i=t;for(this._ringStartEdge=null,_i.markBoth(i),e.add(i.orig().copy(),!1);2===i.sym().degree();){this.updateRingStartEdge(i);const n=i.next();if(n===t)return this.buildRing(this._ringStartEdge),null;e.add(n.orig().copy(),!1),i=n,_i.markBoth(i)}e.add(i.dest().clone(),!1),this.stackEdges(i.sym()),this.addLine(e)}stackEdges(t){let e=t;do{_i.isMarked(e)||this._nodeEdgeStack.add(e),e=e.oNext()}while(e!==t)}computeResult(){for(let t=this._graph.getVertexEdges().iterator();t.hasNext();){const e=t.next();_i.isMarked(e)||this.process(e)}this._result=this._factory.buildGeometry(this._lines)}buildLines(){for(;!this._nodeEdgeStack.empty();){const t=this._nodeEdgeStack.pop();_i.isMarked(t)||this.buildLine(t)}}add(){if(arguments[0]instanceof Y)arguments[0].apply(new class{get interfaces_(){return[B]}filter(t){t instanceof Z&&this.add(t)}});else if(y(arguments[0],v))for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.add(e)}else if(arguments[0]instanceof Z){const t=arguments[0];null===this._factory&&(this._factory=t.getFactory());const e=t.getCoordinateSequence();let i=!1;for(let t=1;te._xValue?1:this._eventTypee._eventType?1:0}getInsertEvent(){return this._insertEvent}isInsert(){return this._eventType===Ii.INSERT}isSameLabel(t){return null!==this._label&&this._label===t._label}getDeleteEventIndex(){return this._deleteEventIndex}get interfaces_(){return[o]}}Ii.INSERT=1,Ii.DELETE=2;class Ci{constructor(){Ci.constructor_.apply(this,arguments)}static constructor_(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;const t=arguments[0],e=arguments[1],i=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=i}static isAdjacentSegments(t,e){return 1===Math.abs(t-e)}isTrivialIntersection(t,e,i,n){if(t===i&&1===this._li.getIntersectionNum()){if(Ci.isAdjacentSegments(e,n))return!0;if(t.isClosed()){const i=t.getNumPoints()-1;if(0===e&&n===i||0===n&&e===i)return!0}}return!1}getProperIntersectionPoint(){return this._properIntersectionPoint}setIsDoneIfProperInt(t){this._isDoneWhenProperInt=t}hasProperInteriorIntersection(){return this._hasProperInterior}isBoundaryPointInternal(t,e){for(let i=e.iterator();i.hasNext();){const e=i.next().getCoordinate();if(t.isIntersection(e))return!0}return!1}hasProperIntersection(){return this._hasProper}hasIntersection(){return this._hasIntersection}isDone(){return this._isDone}isBoundaryPoint(t,e){return!(null===e||!this.isBoundaryPointInternal(t,e[0])&&!this.isBoundaryPointInternal(t,e[1]))}setBoundaryNodes(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e}addIntersections(t,e,i,n){if(t===i&&e===n)return null;this.numTests++;const r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=i.getCoordinates()[n],a=i.getCoordinates()[n+1];this._li.computeIntersection(r,s,o,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),i.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,i,n)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),i.addIntersections(this._li,n,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))}}class wi extends class{}{constructor(){super(),wi.constructor_.apply(this,arguments)}static constructor_(){this.events=new C,this.nOverlaps=null}prepareEvents(){le.sort(this.events);for(let t=0;tthis.location.length){const t=new Array(3).fill(null);t[xi.ON]=this.location[xi.ON],t[xi.LEFT]=Bt.NONE,t[xi.RIGHT]=Bt.NONE,this.location=t}for(let e=0;e1&&t.append(Bt.toLocationSymbol(this.location[xi.LEFT])),t.append(Bt.toLocationSymbol(this.location[xi.ON])),this.location.length>1&&t.append(Bt.toLocationSymbol(this.location[xi.RIGHT])),t.toString()}setLocations(t,e,i){this.location[xi.ON]=t,this.location[xi.LEFT]=e,this.location[xi.RIGHT]=i}get(t){return t1}isAnyNull(){for(let t=0;t0||!e.coord.equals2D(n);r||i--;const s=new Array(i).fill(null);let o=0;s[o++]=new f(t.coord);for(let i=t.segmentIndex+1;i<=e.segmentIndex;i++)s[o++]=this.edge.pts[i];return r&&(s[o]=e.coord),new Yi(s,new Ti(this.edge._label))}add(t,e,i){const n=new Li(t,e,i),r=this._nodeMap.get(n);return null!==r?r:(this._nodeMap.put(n,n),n)}isIntersection(t){for(let e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1}}class Di{constructor(){Di.constructor_.apply(this,arguments)}static constructor_(){if(this._data=null,this._size=0,0===arguments.length)Di.constructor_.call(this,10);else if(1===arguments.length){const t=arguments[0];this._data=new Array(t).fill(null)}}size(){return this._size}addAll(t){return null===t||0===t.length?null:(this.ensureCapacity(this._size+t.length),D.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}ensureCapacity(t){if(t<=this._data.length)return null;const e=Math.max(t,2*this._data.length);this._data=Q.copyOf(this._data,e)}toArray(){const t=new Array(this._size).fill(null);return D.arraycopy(this._data,0,t,0,this._size),t}add(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}class Gi{static toIntArray(t){const e=new Array(t.size()).fill(null);for(let i=0;ii?e:i}getMinX(t){const e=this.pts[this.startIndex[t]].x,i=this.pts[this.startIndex[t+1]].x;return eArray(3));for(let t=0;t<2;t++)for(let e=0;e<3;e++)this._depth[t][e]=Vi.NULL_VALUE}static depthAtLocation(t){return t===Bt.EXTERIOR?0:t===Bt.INTERIOR?1:Vi.NULL_VALUE}getDepth(t,e){return this._depth[t][e]}setDepth(t,e,i){this._depth[t][e]=i}isNull(){if(0===arguments.length){for(let t=0;t<2;t++)for(let e=0;e<3;e++)if(this._depth[t][e]!==Vi.NULL_VALUE)return!1;return!0}if(1===arguments.length){const t=arguments[0];return this._depth[t][1]===Vi.NULL_VALUE}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._depth[t][e]===Vi.NULL_VALUE}}normalize(){for(let t=0;t<2;t++)if(!this.isNull(t)){let e=this._depth[t][1];this._depth[t][2]e&&(n=1),this._depth[t][i]=n}}}getDelta(t){return this._depth[t][xi.RIGHT]-this._depth[t][xi.LEFT]}getLocation(t,e){return this._depth[t][e]<=0?Bt.EXTERIOR:Bt.INTERIOR}toString(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}add(){if(1===arguments.length){const t=arguments[0];for(let e=0;e<2;e++)for(let i=1;i<3;i++){const n=t.getLocation(e,i);n!==Bt.EXTERIOR&&n!==Bt.INTERIOR||(this.isNull(e,i)?this._depth[e][i]=Vi.depthAtLocation(n):this._depth[e][i]+=Vi.depthAtLocation(n))}}else if(3===arguments.length){const t=arguments[0],e=arguments[1];arguments[2]===Bt.INTERIOR&&this._depth[t][e]++}}}Vi.NULL_VALUE=-1;class Bi{constructor(){Bi.constructor_.apply(this,arguments)}static constructor_(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._label=t}}setVisited(t){this._isVisited=t}setInResult(t){this._isInResult=t}isCovered(){return this._isCovered}isCoveredSet(){return this._isCoveredSet}setLabel(t){this._label=t}getLabel(){return this._label}setCovered(t){this._isCovered=t,this._isCoveredSet=!0}updateIM(t){d.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)}isInResult(){return this._isInResult}isVisited(){return this._isVisited}}class Yi extends Bi{constructor(){super(),Yi.constructor_.apply(this,arguments)}static constructor_(){if(this.pts=null,this._env=null,this.eiList=new Fi(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Vi,this._depthDelta=0,1===arguments.length){const t=arguments[0];Yi.constructor_.call(this,t,null)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this.pts=t,this._label=e}}static updateIM(){if(!(2===arguments.length&&arguments[1]instanceof Yt&&arguments[0]instanceof Ti))return super.updateIM.apply(this,arguments);{const t=arguments[0],e=arguments[1];e.setAtLeastIfValid(t.getLocation(0,xi.ON),t.getLocation(1,xi.ON),1),t.isArea()&&(e.setAtLeastIfValid(t.getLocation(0,xi.LEFT),t.getLocation(1,xi.LEFT),2),e.setAtLeastIfValid(t.getLocation(0,xi.RIGHT),t.getLocation(1,xi.RIGHT),2))}}getDepth(){return this._depth}getCollapsedEdge(){const t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new Yi(t,Ti.toLineLabel(this._label))}isIsolated(){return this._isIsolated}getCoordinates(){return this.pts}setIsolated(t){this._isIsolated=t}setName(t){this._name=t}equals(t){if(!(t instanceof Yi))return!1;const e=t;if(this.pts.length!==e.pts.length)return!1;let i=!0,n=!0,r=this.pts.length;for(let t=0;t0?this.pts[0]:null;if(1===arguments.length){const t=arguments[0];return this.pts[t]}}print(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(let e=0;e0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)}computeIM(t){Yi.updateIM(this._label,t)}isCollapsed(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])}isClosed(){return this.pts[0].equals(this.pts[this.pts.length-1])}getMaximumSegmentIndex(){return this.pts.length-1}getDepthDelta(){return this._depthDelta}getNumPoints(){return this.pts.length}printReverse(t){t.print("edge "+this._name+": ");for(let e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")}getMonotoneChainEdge(){return null===this._mce&&(this._mce=new ki(this)),this._mce}getEnvelope(){if(null===this._env){this._env=new L;for(let t=0;t0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()}isPointwiseEqual(t){if(this.pts.length!==t.pts.length)return!1;for(let e=0;et._quadrant?1:this._quadrant=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])}getInvalidPoint(){return this._invalidPoint}getBoundaryPoints(){const t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null);let i=0;for(let n=t.iterator();n.hasNext();){const t=n.next();e[i++]=t.getCoordinate().copy()}return e}getBoundaryNodes(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes}addSelfIntersectionNode(t,e,i){if(this.isBoundaryNode(t,e))return null;i===Bt.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,i)}addPolygonRing(t,e,i){if(t.isEmpty())return null;const n=gt.removeRepeatedPoints(t.getCoordinates());if(n.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=n[0],null;let r=e,s=i;A.isCCW(n)&&(r=i,s=e);const o=new Yi(n,new Ti(this._argIndex,Bt.BOUNDARY,r,s));this._lineEdgeMap.put(t,o),this.insertEdge(o),this.insertPoint(this._argIndex,n[0],Bt.BOUNDARY)}insertPoint(t,e,i){const n=this._nodes.addNode(e),r=n.getLabel();null===r?n._label=new Ti(t,i):r.setLocation(t,i)}createEdgeSetIntersector(){return new wi}addSelfIntersectionNodes(t){for(let e=this._edges.iterator();e.hasNext();){const i=e.next(),n=i.getLabel().getLocation(t);for(let e=i.eiList.iterator();e.hasNext();){const i=e.next();this.addSelfIntersectionNode(t,i.coord,n)}}}add(){if(!(1===arguments.length&&arguments[0]instanceof Y))return super.add.apply(this,arguments);{const t=arguments[0];if(t.isEmpty())return null;if(t instanceof mt&&(this._useBoundaryDeterminationRule=!1),t instanceof et)this.addPolygon(t);else if(t instanceof Z)this.addLineString(t);else if(t instanceof J)this.addPoint(t);else if(t instanceof at)this.addCollection(t);else if(t instanceof wt)this.addCollection(t);else if(t instanceof mt)this.addCollection(t);else{if(!(t instanceof ot))throw new U(t.getGeometryType());this.addCollection(t)}}}addCollection(t){for(let e=0;e50?(null===this._areaPtLocator&&(this._areaPtLocator=new Pe(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)}findEdge(){if(1===arguments.length&&arguments[0]instanceof Z){const t=arguments[0];return this._lineEdgeMap.get(t)}return super.findEdge.apply(this,arguments)}}var Ki=Object.freeze({__proto__:null,GeometryGraph:Zi});class Ji{visit(t){}}class $i{constructor(){$i.constructor_.apply(this,arguments)}static constructor_(){if(this._p=null,this._data=null,this._left=null,this._right=null,this._count=null,2===arguments.length){const t=arguments[0],e=arguments[1];this._p=new f(t),this._left=null,this._right=null,this._count=1,this._data=e}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._p=new f(t,e),this._left=null,this._right=null,this._count=1,this._data=i}}isRepeated(){return this._count>1}getRight(){return this._right}getCoordinate(){return this._p}setLeft(t){this._left=t}getX(){return this._p.x}getData(){return this._data}getCount(){return this._count}getLeft(){return this._left}getY(){return this._p.y}increment(){this._count=this._count+1}setRight(t){this._right=t}}class Qi{constructor(){Qi.constructor_.apply(this,arguments)}static constructor_(){if(this._root=null,this._numberOfNodes=null,this._tolerance=null,0===arguments.length)Qi.constructor_.call(this,0);else if(1===arguments.length){const t=arguments[0];this._tolerance=t}}static toCoordinates(){if(1===arguments.length){const t=arguments[0];return Qi.toCoordinates(t,!1)}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=new S;for(let n=t.iterator();n.hasNext();){const t=n.next(),r=e?t.getCount():1;for(let e=0;e0){const e=this.findBestMatchNode(t);if(null!==e)return e.increment(),e}return this.insertExact(t,e)}}query(){if(1===arguments.length){const t=arguments[0],e=new C;return this.query(t,e),e}if(2===arguments.length)if(arguments[0]instanceof L&&y(arguments[1],E)){const t=arguments[0],e=arguments[1];this.queryNode(this._root,t,!0,new class{get interfaces_(){return[Ji]}visit(t){e.add(t)}})}else if(arguments[0]instanceof L&&y(arguments[1],Ji)){const t=arguments[0],e=arguments[1];this.queryNode(this._root,t,!0,e)}}queryNode(t,e,i,n){if(null===t)return null;let r=null,s=null,o=null;i?(r=e.getMinX(),s=e.getMaxX(),o=t.getX()):(r=e.getMinY(),s=e.getMaxY(),o=t.getY());const a=o<=s;r=e&&(t.getMinY()>=i&&(n=3),t.getMaxY()<=i&&(n=1)),t.getMaxX()<=e&&(t.getMinY()>=i&&(n=2),t.getMaxY()<=i&&(n=0)),n}hasChildren(){for(let t=0;t<4;t++)if(null!==this._subnode[t])return!0;return!1}isPrunable(){return!(this.hasChildren()||this.hasItems())}addAllItems(t){t.addAll(this._items);for(let e=0;e<4;e++)null!==this._subnode[e]&&this._subnode[e].addAllItems(t);return t}getNodeCount(){let t=0;for(let e=0;e<4;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+1}size(){let t=0;for(let e=0;e<4;e++)null!==this._subnode[e]&&(t+=this._subnode[e].size());return t+this._items.size()}addAllItemsFromOverlapping(t,e){if(!this.isSearchMatch(t))return null;e.addAll(this._items);for(let i=0;i<4;i++)null!==this._subnode[i]&&this._subnode[i].addAllItemsFromOverlapping(t,e)}visitItems(t,e){for(let t=this._items.iterator();t.hasNext();)e.visitItem(t.next())}hasItems(){return!this._items.isEmpty()}remove(t,e){if(!this.isSearchMatch(t))return!1;let i=!1;for(let n=0;n<4;n++)if(null!==this._subnode[n]&&(i=this._subnode[n].remove(t,e),i)){this._subnode[n].isPrunable()&&(this._subnode[n]=null);break}return i||(i=this._items.remove(e),i)}visit(t,e){if(!this.isSearchMatch(t))return null;this.visitItems(t,e);for(let i=0;i<4;i++)null!==this._subnode[i]&&this._subnode[i].visit(t,e)}getItems(){return this._items}depth(){let t=0;for(let e=0;e<4;e++)if(null!==this._subnode[e]){const i=this._subnode[e].depth();i>t&&(t=i)}return t+1}isEmpty(){let t=!0;if(this._items.isEmpty()){for(let e=0;e<4;e++)if(null!==this._subnode[e]&&!this._subnode[e].isEmpty()){t=!1;break}}else t=!1;return t}add(t){this._items.add(t)}get interfaces_(){return[h]}}function rn(){}rn.exponent=function(t){return function(t,e){let i,n,r,s;if(s||(i=e<0||1/e<0,isFinite(e)||(s={d:32752,c:0,b:0,a:0},i&&(s.d+=32768),n=Math.pow(2,11)-1,r=0)),!s){for(n=1023,r=Math.abs(e);r>=2;)n++,r/=2;for(;r<1&&n>0;)n--,r*=2;n<=0&&(r/=2)}return n}(0,t)-1023},rn.powerOf2=function(t){return Math.pow(2,t)};class sn{constructor(){sn.constructor_.apply(this,arguments)}static constructor_(){this._pt=new f,this._level=0,this._env=null;const t=arguments[0];this.computeKey(t)}static computeQuadLevel(t){const e=t.getWidth(),i=t.getHeight(),n=e>i?e:i;return rn.exponent(n)+1}getLevel(){return this._level}computeKey(){if(1===arguments.length){const t=arguments[0];for(this._level=sn.computeQuadLevel(t),this._env=new L,this.computeKey(this._level,t);!this._env.contains(t);)this._level+=1,this.computeKey(this._level,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1],i=rn.powerOf2(t);this._pt.x=Math.floor(e.getMinX()/i)*i,this._pt.y=Math.floor(e.getMinY()/i)*i,this._env.init(this._pt.x,this._pt.x+i,this._pt.y,this._pt.y+i)}}getEnvelope(){return this._env}getCentre(){return new f((this._env.getMinX()+this._env.getMaxX())/2,(this._env.getMinY()+this._env.getMaxY())/2)}getPoint(){return this._pt}}class on extends nn{constructor(){super(),on.constructor_.apply(this,arguments)}static constructor_(){this._env=null,this._centrex=null,this._centrey=null,this._level=null;const t=arguments[0],e=arguments[1];this._env=t,this._level=e,this._centrex=(t.getMinX()+t.getMaxX())/2,this._centrey=(t.getMinY()+t.getMaxY())/2}static createNode(t){const e=new sn(t);return new on(e.getEnvelope(),e.getLevel())}static createExpanded(t,e){const i=new L(e);null!==t&&i.expandToInclude(t._env);const n=on.createNode(i);return null!==t&&n.insertNode(t),n}find(t){const e=nn.getSubnodeIndex(t,this._centrex,this._centrey);return-1===e?this:null!==this._subnode[e]?this._subnode[e].find(t):this}isSearchMatch(t){return null!==t&&this._env.intersects(t)}getSubnode(t){return null===this._subnode[t]&&(this._subnode[t]=this.createSubnode(t)),this._subnode[t]}getEnvelope(){return this._env}getNode(t){const e=nn.getSubnodeIndex(t,this._centrex,this._centrey);return-1!==e?this.getSubnode(e).getNode(t):this}createSubnode(t){let e=0,i=0,n=0,r=0;switch(t){case 0:e=this._env.getMinX(),i=this._centrex,n=this._env.getMinY(),r=this._centrey;break;case 1:e=this._centrex,i=this._env.getMaxX(),n=this._env.getMinY(),r=this._centrey;break;case 2:e=this._env.getMinX(),i=this._centrex,n=this._centrey,r=this._env.getMaxY();break;case 3:e=this._centrex,i=this._env.getMaxX(),n=this._centrey,r=this._env.getMaxY()}const s=new L(e,i,n,r);return new on(s,this._level-1)}insertNode(t){d.isTrue(null===this._env||this._env.contains(t._env));const e=nn.getSubnodeIndex(t._env,this._centrex,this._centrey);if(t._level===this._level-1)this._subnode[e]=t;else{const i=this.createSubnode(e);i.insertNode(t),this._subnode[e]=i}}}class an{static isZeroWidth(t,e){const i=e-t;if(0===i)return!0;const n=i/Math.max(Math.abs(t),Math.abs(e));return rn.exponent(n)<=an.MIN_BINARY_EXPONENT}}an.MIN_BINARY_EXPONENT=-50;class ln extends nn{constructor(){super()}insert(t,e){const i=nn.getSubnodeIndex(t,ln.origin.x,ln.origin.y);if(-1===i)return this.add(e),null;const n=this._subnode[i];if(null===n||!n.getEnvelope().contains(t)){const e=on.createExpanded(n,t);this._subnode[i]=e}this.insertContained(this._subnode[i],t,e)}isSearchMatch(t){return!0}insertContained(t,e,i){d.isTrue(t.getEnvelope().contains(e));const n=an.isZeroWidth(e.getMinX(),e.getMaxX()),r=an.isZeroWidth(e.getMinY(),e.getMaxY());let s=null;s=n||r?t.find(e):t.getNode(e),s.add(i)}}ln.origin=new f(0,0);class hn{insert(t,e){}remove(t,e){}query(){}}class cn{constructor(){cn.constructor_.apply(this,arguments)}static constructor_(){this._root=null,this._minExtent=1,this._root=new ln}static ensureExtent(t,e){let i=t.getMinX(),n=t.getMaxX(),r=t.getMinY(),s=t.getMaxY();return i!==n&&r!==s?t:(i===n&&(i-=e/2,n+=e/2),r===s&&(r-=e/2,s+=e/2),new L(i,n,r,s))}size(){return null!==this._root?this._root.size():0}insert(t,e){this.collectStats(t);const i=cn.ensureExtent(t,this._minExtent);this._root.insert(i,e)}query(){if(1===arguments.length){const t=arguments[0],e=new Oe;return this.query(t,e),e.getItems()}if(2===arguments.length){const t=arguments[0],e=arguments[1];this._root.visit(t,e)}}queryAll(){const t=new C;return this._root.addAllItems(t),t}remove(t,e){const i=cn.ensureExtent(t,this._minExtent);return this._root.remove(i,e)}collectStats(t){const e=t.getWidth();e0&&(this._minExtent=e);const i=t.getHeight();i0&&(this._minExtent=i)}depth(){return null!==this._root?this._root.depth():0}isEmpty(){return null===this._root||this._root.isEmpty()}get interfaces_(){return[hn,h]}}var un=Object.freeze({__proto__:null,Quadtree:cn});class dn{getBounds(){}}class gn{constructor(){gn.constructor_.apply(this,arguments)}static constructor_(){this._bounds=null,this._item=null;const t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}getItem(){return this._item}getBounds(){return this._bounds}get interfaces_(){return[dn,h]}}class _n{constructor(){_n.constructor_.apply(this,arguments)}static constructor_(){this._size=null,this._items=null,this._size=0,this._items=new C,this._items.add(null)}poll(){if(this.isEmpty())return null;const t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t}size(){return this._size}reorder(t){let e=null;const i=this._items.get(t);for(;2*t<=this._size&&(e=2*t,e!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(i)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,i)}clear(){this._size=0,this._items.clear()}peek(){return this.isEmpty()?null:this._items.get(1)}isEmpty(){return 0===this._size}add(t){this._items.add(null),this._size+=1;let e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)}}class pn{constructor(){pn.constructor_.apply(this,arguments)}static constructor_(){if(this._childBoundables=new C,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._level=t}}getLevel(){return this._level}size(){return this._childBoundables.size()}getChildBoundables(){return this._childBoundables}addChildBoundable(t){d.isTrue(null===this._bounds),this._childBoundables.add(t)}isEmpty(){return this._childBoundables.isEmpty()}getBounds(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds}get interfaces_(){return[dn,h]}}class fn{static maxDistance(t,e,i,n,r,s,o,a){let l=fn.distance(t,e,r,s);return l=Math.max(l,fn.distance(t,e,o,a)),l=Math.max(l,fn.distance(i,n,r,s)),l=Math.max(l,fn.distance(i,n,o,a)),l}static distance(t,e,i,n){const r=i-t,s=n-e;return Math.sqrt(r*r+s*s)}static maximumDistance(t,e){const i=Math.min(t.getMinX(),e.getMinX()),n=Math.min(t.getMinY(),e.getMinY()),r=Math.max(t.getMaxX(),e.getMaxX()),s=Math.max(t.getMaxY(),e.getMaxY());return fn.distance(i,n,r,s)}static minMaxDistance(t,e){const i=t.getMinX(),n=t.getMinY(),r=t.getMaxX(),s=t.getMaxY(),o=e.getMinX(),a=e.getMinY(),l=e.getMaxX(),h=e.getMaxY();let c=fn.maxDistance(i,n,i,s,o,a,o,h);return c=Math.min(c,fn.maxDistance(i,n,i,s,o,a,l,a)),c=Math.min(c,fn.maxDistance(i,n,i,s,l,h,o,h)),c=Math.min(c,fn.maxDistance(i,n,i,s,l,h,l,a)),c=Math.min(c,fn.maxDistance(i,n,r,n,o,a,o,h)),c=Math.min(c,fn.maxDistance(i,n,r,n,o,a,l,a)),c=Math.min(c,fn.maxDistance(i,n,r,n,l,h,o,h)),c=Math.min(c,fn.maxDistance(i,n,r,n,l,h,l,a)),c=Math.min(c,fn.maxDistance(r,s,i,s,o,a,o,h)),c=Math.min(c,fn.maxDistance(r,s,i,s,o,a,l,a)),c=Math.min(c,fn.maxDistance(r,s,i,s,l,h,o,h)),c=Math.min(c,fn.maxDistance(r,s,i,s,l,h,l,a)),c=Math.min(c,fn.maxDistance(r,s,r,n,o,a,o,h)),c=Math.min(c,fn.maxDistance(r,s,r,n,o,a,l,a)),c=Math.min(c,fn.maxDistance(r,s,r,n,l,h,o,h)),c=Math.min(c,fn.maxDistance(r,s,r,n,l,h,l,a)),c}}class mn{constructor(){mn.constructor_.apply(this,arguments)}static constructor_(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;const t=arguments[0],e=arguments[1],i=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=i,this._distance=this.distance()}static area(t){return t.getBounds().getArea()}static isComposite(t){return t instanceof pn}maximumDistance(){return fn.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}expandToQueue(t,e){const i=mn.isComposite(this._boundable1),r=mn.isComposite(this._boundable2);if(i&&r)return mn.area(this._boundable1)>mn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,e),null):(this.expand(this._boundable2,this._boundable1,!0,t,e),null);if(i)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 n("neither boundable is composite")}isLeaves(){return!(mn.isComposite(this._boundable1)||mn.isComposite(this._boundable2))}compareTo(t){const e=t;return this._distancee._distance?1:0}expand(t,e,i,n,r){for(let s=t.getChildBoundables().iterator();s.hasNext();){const t=s.next();let o=null;o=i?new mn(e,t,this._itemDistance):new mn(t,e,this._itemDistance),o.getDistance()1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}static compareDoubles(t,e){return t>e?1:t-2),e.getLevel()===t)return i.add(e),null;for(let n=e.getChildBoundables().iterator();n.hasNext();){const e=n.next();e instanceof pn?this.boundablesAtLevel(t,e,i):(d.isTrue(e instanceof gn),-1===t&&i.add(e))}return null}}query(){if(1===arguments.length){const t=arguments[0];this.build();const e=new C;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e)}}build(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}getRoot(){return this.build(),this._root}remove(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];let n=this.removeItem(e,i);if(n)return!0;let r=null;for(let s=e.getChildBoundables().iterator();s.hasNext();){const e=s.next();if(this.getIntersectsOp().intersects(e.getBounds(),t)&&e instanceof pn&&(n=this.remove(t,e,i),n)){r=e;break}}return null!==r&&r.getChildBoundables().isEmpty()&&e.getChildBoundables().remove(r),n}}createHigherLevels(t,e){d.isTrue(!t.isEmpty());const i=this.createParentBoundables(t,e+1);return 1===i.size()?i.get(0):this.createHigherLevels(i,e+1)}depth(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){let t=0;for(let e=arguments[0].getChildBoundables().iterator();e.hasNext();){const i=e.next();if(i instanceof pn){const e=this.depth(i);e>t&&(t=e)}}return t+1}}createParentBoundables(t,e){d.isTrue(!t.isEmpty());const i=new C;i.add(this.createNode(e));const n=new C(t);le.sort(n,this.getComparator());for(let t=n.iterator();t.hasNext();){const n=t.next();this.lastNode(i).getChildBoundables().size()===this.getNodeCapacity()&&i.add(this.createNode(e)),this.lastNode(i).addChildBoundable(n)}return i}isEmpty(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}get interfaces_(){return[h]}}yn.IntersectsOp=function(){},yn.DEFAULT_NODE_CAPACITY=10;class vn{distance(t,e){}}class xn extends yn{constructor(){super(),xn.constructor_.apply(this,arguments)}static constructor_(){if(0===arguments.length)xn.constructor_.call(this,xn.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){const t=arguments[0];yn.constructor_.call(this,t)}}static centreX(t){return xn.avg(t.getMinX(),t.getMaxX())}static avg(t,e){return(t+e)/2}static getItems(t){const e=new Array(t.size()).fill(null);let i=0;for(;!t.isEmpty();){const n=t.poll();e[i]=n.getBoundable(0).getItem(),i++}return e}static centreY(t){return xn.avg(t.getMinY(),t.getMaxY())}createParentBoundablesFromVerticalSlices(t,e){d.isTrue(t.length>0);const i=new C;for(let n=0;n=0;){const t=n.poll(),s=t.getDistance();if(s>=i)break;t.isLeaves()?r.size()s&&(r.poll(),r.add(t)),i=r.peek().getDistance()):t.expandToQueue(n,i)}return xn.getItems(r)}}createNode(t){return new En(t)}size(){return 0===arguments.length?super.size.call(this):super.size.apply(this,arguments)}insert(){if(!(2===arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof L))return super.insert.apply(this,arguments);{const t=arguments[0],e=arguments[1];if(t.isNull())return null;super.insert.call(this,t,e)}}getIntersectsOp(){return xn.intersectsOp}verticalSlices(t,e){const i=Math.trunc(Math.ceil(t.size()/e)),n=new Array(e).fill(null),r=t.iterator();for(let t=0;t0;){const t=n.poll(),r=t.getDistance();if(r>=e)break;t.isLeaves()?(e=r,i=t):t.expandToQueue(n,e)}return null===i?null:[i.getBoundable(0).getItem(),i.getBoundable(1).getItem()]}}else{if(2===arguments.length){const t=arguments[0],e=arguments[1];if(this.isEmpty()||t.isEmpty())return null;const i=new mn(this.getRoot(),t.getRoot(),e);return this.nearestNeighbour(i)}if(3===arguments.length){const t=arguments[2],e=new gn(arguments[0],arguments[1]),i=new mn(this.getRoot(),e,t);return this.nearestNeighbour(i)[0]}if(4===arguments.length){const t=arguments[2],e=arguments[3],i=new gn(arguments[0],arguments[1]),n=new mn(this.getRoot(),i,t);return this.nearestNeighbourK(n,e)}}}isWithinDistance(){if(2===arguments.length){const t=arguments[0],e=arguments[1];let i=s.POSITIVE_INFINITY;const n=new _n;for(n.add(t);!n.isEmpty();){const t=n.poll(),r=t.getDistance();if(r>e)return!1;if(t.maximumDistance()<=e)return!0;if(t.isLeaves()){if(i=r,i<=e)return!0}else t.expandToQueue(n,i)}return!1}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=new mn(this.getRoot(),t.getRoot(),e);return this.isWithinDistance(n,i)}}get interfaces_(){return[hn,h]}}class En extends pn{constructor(){super(),En.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0];pn.constructor_.call(this,t)}computeBounds(){let t=null;for(let e=this.getChildBoundables().iterator();e.hasNext();){const i=e.next();null===t?t=new L(i.getBounds()):t.expandToInclude(i.getBounds())}return t}}xn.STRtreeNode=En,xn.xComparator=new class{get interfaces_(){return[l]}compare(t,e){return yn.compareDoubles(xn.centreX(t.getBounds()),xn.centreX(e.getBounds()))}},xn.yComparator=new class{get interfaces_(){return[l]}compare(t,e){return yn.compareDoubles(xn.centreY(t.getBounds()),xn.centreY(e.getBounds()))}},xn.intersectsOp=new class{get interfaces_(){return[IntersectsOp]}intersects(t,e){return t.intersects(e)}},xn.DEFAULT_NODE_CAPACITY=10;var In=Object.freeze({__proto__:null,STRtree:xn}),Cn=Object.freeze({__proto__:null,kdtree:en,quadtree:un,strtree:In});const wn=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"];class Sn{constructor(t){this.geometryFactory=t||new St}read(t){let e;e="string"==typeof t?JSON.parse(t):t;const i=e.type;if(!Tn[i])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==wn.indexOf(i)?Tn[i].call(this,e.coordinates):"GeometryCollection"===i?Tn[i].call(this,e.geometries):Tn[i].call(this,e)}write(t){const e=t.getGeometryType();if(!Ln[e])throw new Error("Geometry is not supported");return Ln[e].call(this,t)}}const Tn={Feature:function(t){const e={};for(const i in t)e[i]=t[i];if(t.geometry){const i=t.geometry.type;if(!Tn[i])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=Tn.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){const e={};if(t.features){e.features=[];for(let i=0;ie?1:0}static compare(t,e,i){if(e.equals2D(i))return 0;const n=Rn.relativeSign(e.x,i.x),r=Rn.relativeSign(e.y,i.y);switch(t){case 0:return Rn.compareValue(n,r);case 1:return Rn.compareValue(r,n);case 2:return Rn.compareValue(r,-n);case 3:return Rn.compareValue(-n,r);case 4:return Rn.compareValue(-n,-r);case 5:return Rn.compareValue(-r,-n);case 6:return Rn.compareValue(-r,n);case 7:return Rn.compareValue(n,-r)}return d.shouldNeverReachHere("invalid octant value"),0}static compareValue(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}}class Pn{constructor(){Pn.constructor_.apply(this,arguments)}static constructor_(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this._segString=t,this.coord=new f(e),this.segmentIndex=i,this._segmentOctant=n,this._isInterior=!e.equals2D(t.getCoordinate(i))}getCoordinate(){return this.coord}print(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)}compareTo(t){const e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:this._isInterior?e._isInterior?Rn.compare(this._segmentOctant,this.coord,e.coord):1:-1}isEndPoint(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t}toString(){return this.segmentIndex+":"+this.coord.toString()}isInterior(){return this._isInterior}get interfaces_(){return[o]}}class bn{constructor(){bn.constructor_.apply(this,arguments)}static constructor_(){this._nodeMap=new Ai,this._edge=null;const t=arguments[0];this._edge=t}getSplitCoordinates(){const t=new S;this.addEndpoints();const e=this.iterator();let i=e.next();for(;e.hasNext();){const n=e.next();this.addEdgeCoordinates(i,n,t),i=n}return t.toCoordinateArray()}addCollapsedNodes(){const t=new C;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(let e=t.iterator();e.hasNext();){const t=e.next().intValue();this.add(this._edge.getCoordinate(t),t)}}createSplitEdgePts(t,e){let i=e.segmentIndex-t.segmentIndex+2;if(2===i)return[new f(t.coord),new f(e.coord)];const n=this._edge.getCoordinate(e.segmentIndex),r=e.isInterior()||!e.coord.equals2D(n);r||i--;const s=new Array(i).fill(null);let o=0;s[o++]=new f(t.coord);for(let i=t.segmentIndex+1;i<=e.segmentIndex;i++)s[o++]=this._edge.getCoordinate(i);return r&&(s[o]=new f(e.coord)),s}print(t){t.println("Intersections:");for(let e=this.iterator();e.hasNext();)e.next().print(t)}findCollapsesFromExistingVertices(t){for(let e=0;e=0?e>=0?i>=r?0:1:i>=r?7:6:e>=0?i>=r?3:2:i>=r?4:5}if(arguments[0]instanceof f&&arguments[1]instanceof f){const t=arguments[0],e=arguments[1],i=e.x-t.x,r=e.y-t.y;if(0===i&&0===r)throw new n("Cannot compute the octant for two identical points "+t);return Mn.octant(i,r)}}}class An{getCoordinates(){}size(){}getCoordinate(t){}isClosed(){}setData(t){}getData(){}}class Fn{addIntersection(t,e){}get interfaces_(){return[An]}}class Dn{constructor(){Dn.constructor_.apply(this,arguments)}static constructor_(){this._nodeList=new bn(this),this._pts=null,this._data=null;const t=arguments[0],e=arguments[1];this._pts=t,this._data=e}static getNodedSubstrings(){if(1===arguments.length){const t=arguments[0],e=new C;return Dn.getNodedSubstrings(t,e),e}if(2===arguments.length){const t=arguments[1];for(let e=arguments[0].iterator();e.hasNext();)e.next().getNodeList().addSplitEdges(t)}}getCoordinates(){return this._pts}size(){return this._pts.length}getCoordinate(t){return this._pts[t]}isClosed(){return this._pts[0].equals(this._pts[this._pts.length-1])}getSegmentOctant(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}setData(t){this._data=t}safeOctant(t,e){return t.equals2D(e)?0:Mn.octant(t,e)}getData(){return this._data}addIntersection(){if(2===arguments.length){const t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){const t=arguments[1],e=arguments[3],i=new f(arguments[0].getIntersection(e));this.addIntersection(i,t)}}toString(){return Dt.toLineString(new pt(this._pts))}getNodeList(){return this._nodeList}addIntersectionNode(t,e){let i=e;const n=i+1;if(n=t.length-1)return t.length-1;const n=di.quadrant(t[i],t[i+1]);let r=e+1;for(;ri.getId()&&(i.computeOverlaps(n,t),this._nOverlaps++),this._segInt.isDone())return null}}}}class qn extends Gn{constructor(){super(),qn.constructor_.apply(this,arguments)}static constructor_(){this._si=null;const t=arguments[0];this._si=t}overlap(){if(4!==arguments.length)return super.overlap.apply(this,arguments);{const t=arguments[1],e=arguments[2],i=arguments[3],n=arguments[0].getContext(),r=e.getContext();this._si.processIntersections(n,t,r,i)}}}zn.SegmentOverlapAction=qn;class Xn{constructor(){Xn.constructor_.apply(this,arguments)}static constructor_(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){const t=arguments[0],e=arguments[1];Xn.constructor_.call(this,t,e,0,0)}else if(4===arguments.length){const t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._isScaled=!this.isIntegerPrecision()}}rescale(){if(y(arguments[0],v))for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.rescale(e.getCoordinates())}else if(arguments[0]instanceof Array){const t=arguments[0];for(let e=0;e0&&this._minIndexthis._minCoord.y&&i.y>this._minCoord.y&&n===A.CLOCKWISE)&&(r=!0),r&&(this._minIndex=this._minIndex-1)}getRightmostSideOfSegment(t,e){const i=t.getEdge().getCoordinates();if(e<0||e+1>=i.length)return-1;if(i[e].y===i[e+1].y)return-1;let n=xi.LEFT;return i[e].ythis._minCoord.x)&&(this._minDe=t,this._minIndex=i,this._minCoord=e[i])}findRightmostEdgeAtNode(){const t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}findEdge(t){for(let e=t.iterator();e.hasNext();){const t=e.next();t.isForward()&&this.checkForRightmostCoordinate(t)}d.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===xi.LEFT&&(this._orientedDe=this._minDe.getSym())}}class $n{constructor(){this.array=[]}addLast(t){this.array.push(t)}removeFirst(){return this.array.shift()}isEmpty(){return 0===this.array.length}}class Qn{constructor(){Qn.constructor_.apply(this,arguments)}static constructor_(){this._finder=null,this._dirEdgeList=new C,this._nodes=new C,this._rightMostCoord=null,this._env=null,this._finder=new Jn}clearVisitedEdges(){for(let t=this._dirEdgeList.iterator();t.hasNext();)t.next().setVisited(!1)}getRightmostCoordinate(){return this._rightMostCoord}computeNodeDepth(t){let e=null;for(let i=t.getEdges().iterator();i.hasNext();){const t=i.next();if(t.isVisited()||t.getSym().isVisited()){e=t;break}}if(null===e)throw new ji("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(let e=t.getEdges().iterator();e.hasNext();){const t=e.next();t.setVisited(!0),this.copySymDepths(t)}}computeDepth(t){this.clearVisitedEdges();const e=this._finder.getEdge();e.getNode(),e.getLabel(),e.setEdgeDepths(xi.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)}create(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}findResultEdges(){for(let t=this._dirEdgeList.iterator();t.hasNext();){const e=t.next();e.getDepth(xi.RIGHT)>=1&&e.getDepth(xi.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}}computeDepths(t){const e=new vt,i=new $n,n=t.getNode();for(i.addLast(n),e.add(n),t.setVisited(!0);!i.isEmpty();){const t=i.removeFirst();e.add(t),this.computeNodeDepth(t);for(let n=t.getEdges().iterator();n.hasNext();){const t=n.next().getSym();if(t.isVisited())continue;const r=t.getNode();e.contains(r)||(i.addLast(r),e.add(r))}}}compareTo(t){const e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0}getEnvelope(){if(null===this._env){const t=new L;for(let e=this._dirEdgeList.iterator();e.hasNext();){const i=e.next().getEdge().getCoordinates();for(let e=0;ethis._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2}addPoints(t,e,i){const n=t.getCoordinates();if(e){let t=1;i&&(t=0);for(let e=t;e=0;e--)this._pts.add(n[e])}}isHole(){return this._isHole}setInResult(){let t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)}containsPoint(t){const e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Ae.isInRing(t,e.getCoordinates()))return!1;for(let e=this._holes.iterator();e.hasNext();)if(e.next().containsPoint(t))return!1;return!0}addHole(t){this._holes.add(t)}isShell(){return null===this._shell}getLabel(){return this._label}getEdges(){return this._edges}getMaxNodeDegree(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}getShell(){return this._shell}mergeLabel(){if(1===arguments.length){const t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){const t=arguments[1],e=arguments[0].getLocation(t,xi.RIGHT);if(e===Bt.NONE)return null;if(this._label.getLocation(t)===Bt.NONE)return this._label.setLocation(t,e),null}}setShell(t){this._shell=t,null!==t&&t.addHole(this)}toPolygon(t){const e=new Array(this._holes.size()).fill(null);for(let t=0;t2){t.linkDirectedEdgesForMinimalEdgeRings();const n=t.buildMinimalRings(),r=this.findShell(n);null!==r?(this.placePolygonHoles(r,n),e.add(r)):i.addAll(n)}else n.add(t)}return n}buildMaximalEdgeRings(t){const e=new C;for(let i=t.iterator();i.hasNext();){const t=i.next();if(t.isInResult()&&t.getLabel().isArea()&&null===t.getEdgeRing()){const i=new ir(t,this._geometryFactory);e.add(i),i.setInResult()}}return e}placePolygonHoles(t,e){for(let i=e.iterator();i.hasNext();){const e=i.next();e.isHole()&&e.setShell(t)}}getPolygons(){return this.computePolygons(this._shellList)}findShell(t){let e=0,i=null;for(let n=t.iterator();n.hasNext();){const t=n.next();t.isHole()||(i=t,e++)}return d.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),i}add(){if(1===arguments.length){const t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){const t=arguments[0],e=arguments[1];Hi.linkResultDirectedEdges(e);const i=this.buildMaximalEdgeRings(t),n=new C,r=this.buildMinimalEdgeRings(i,this._shellList,n);this.sortShellsAndHoles(r,this._shellList,n),this.placeFreeHoles(this._shellList,n)}}}class rr{constructor(){rr.constructor_.apply(this,arguments)}static constructor_(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=A.COUNTERCLOCKWISE;const t=arguments[0];this._inputLine=t}static simplify(t,e){return new rr(t).simplify(e)}isDeletable(t,e,i,n){const r=this._inputLine[t],s=this._inputLine[e],o=this._inputLine[i];return!!this.isConcave(r,s,o)&&!!this.isShallow(r,s,o,n)&&this.isShallowSampled(r,s,t,i,n)}deleteShallowConcavities(){let t=1,e=this.findNextNonDeletedIndex(t),i=this.findNextNonDeletedIndex(e),n=!1;for(;i=0;e--)this.addPt(t[e])}isRedundant(t){if(this._ptList.size()<1)return!1;const e=this._ptList.get(this._ptList.size()-1);return t.distance(e)=8&&e.getJoinStyle()===Kn.JOIN_ROUND&&(this._closingSegLengthFactor=or.MAX_CLOSING_SEG_LEN_FACTOR),this.init(i)}addNextSegment(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;const i=A.index(this._s0,this._s1,this._s2),n=i===A.CLOCKWISE&&this._side===xi.LEFT||i===A.COUNTERCLOCKWISE&&this._side===xi.RIGHT;0===i?this.addCollinear(e):n?this.addOutsideTurn(i,e):this.addInsideTurn(i,e)}addLineEndCap(t,e){const i=new Vt(t,e),n=new Vt;this.computeOffsetSegment(i,xi.LEFT,this._distance,n);const r=new Vt;this.computeOffsetSegment(i,xi.RIGHT,this._distance,r);const s=e.x-t.x,o=e.y-t.y,a=Math.atan2(o,s);switch(this._bufParams.getEndCapStyle()){case Kn.CAP_ROUND:this._segList.addPt(n.p1),this.addDirectedFillet(e,a+Math.PI/2,a-Math.PI/2,A.CLOCKWISE,this._distance),this._segList.addPt(r.p1);break;case Kn.CAP_FLAT:this._segList.addPt(n.p1),this._segList.addPt(r.p1);break;case Kn.CAP_SQUARE:const t=new f;t.x=Math.abs(this._distance)*Math.cos(a),t.y=Math.abs(this._distance)*Math.sin(a);const i=new f(n.p1.x+t.x,n.p1.y+t.y),s=new f(r.p1.x+t.x,r.p1.y+t.y);this._segList.addPt(i),this._segList.addPt(s)}}getCoordinates(){return this._segList.getCoordinates()}addMitreJoin(t,e,i,n){const r=F.intersection(e.p0,e.p1,i.p0,i.p1);if(null!==r&&(n<=0?1:r.distance(t)/Math.abs(n))<=this._bufParams.getMitreLimit())return this._segList.addPt(r),null;this.addLimitedMitreJoin(e,i,n,this._bufParams.getMitreLimit())}addOutsideTurn(t,e){if(this._offset0.p1.distance(this._offset1.p0)=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,a,c,n,r),this._segList.addPt(i)}addLastSegment(){this._segList.addPt(this._offset1.p1)}initSideSegments(t,e,i){this._s1=t,this._s2=e,this._side=i,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,i,this._distance,this._offset1)}addLimitedMitreJoin(t,e,i,n){const r=this._seg0.p1,s=zt.angle(r,this._seg0.p0),o=zt.angleBetweenOriented(this._seg0.p0,r,this._seg1.p1)/2,a=zt.normalize(s+o),l=zt.normalize(a+Math.PI),h=n*i,c=i-h*Math.abs(Math.sin(o)),u=r.x+h*Math.cos(l),d=r.y+h*Math.sin(l),g=new f(u,d),_=new Vt(r,g),p=_.pointAlongOffset(1,c),m=_.pointAlongOffset(1,-c);this._side===xi.LEFT?(this._segList.addPt(p),this._segList.addPt(m)):(this._segList.addPt(m),this._segList.addPt(p))}addDirectedFillet(t,e,i,n,r){const s=n===A.CLOCKWISE?-1:1,o=Math.abs(e-i),a=Math.trunc(o/this._filletAngleQuantum+.5);if(a<1)return null;const l=o/a,h=new f;for(let i=0;i0){const t=new f((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(t);const e=new f((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(e)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}createCircle(t){const e=new f(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}addBevelJoin(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}init(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new sr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*or.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}addCollinear(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Kn.JOIN_BEVEL||this._bufParams.getJoinStyle()===Kn.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,A.CLOCKWISE,this._distance))}closeRing(){this._segList.closeRing()}hasNarrowConcaveAngle(){return this._hasNarrowConcaveAngle}}or.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,or.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,or.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,or.MAX_CLOSING_SEG_LEN_FACTOR=80;class ar{constructor(){ar.constructor_.apply(this,arguments)}static constructor_(){this._distance=0,this._precisionModel=null,this._bufParams=null;const t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}static copyCoordinates(t){const e=new Array(t.length).fill(null);for(let i=0;i=0;t--)i.addNextSegment(e[t],!0)}else{i.addSegments(t,!1);const e=rr.simplify(t,n),r=e.length-1;i.initSideSegments(e[0],e[1],xi.LEFT),i.addFirstSegment();for(let t=2;t<=r;t++)i.addNextSegment(e[t],!0)}i.addLastSegment(),i.closeRing()}computeRingBufferCurve(t,e,i){let n=this.simplifyTolerance(this._distance);e===xi.RIGHT&&(n=-n);const r=rr.simplify(t,n),s=r.length-1;i.initSideSegments(r[s-1],r[0],e);for(let t=1;t<=s;t++){const e=1!==t;i.addNextSegment(r[t],e)}i.closeRing()}computeLineBufferCurve(t,e){const i=this.simplifyTolerance(this._distance),n=rr.simplify(t,i),r=n.length-1;e.initSideSegments(n[0],n[1],xi.LEFT);for(let t=2;t<=r;t++)e.addNextSegment(n[t],!0);e.addLastSegment(),e.addLineEndCap(n[r-1],n[r]);const s=rr.simplify(t,-i),o=s.length-1;e.initSideSegments(s[o],s[o-1],xi.LEFT);for(let t=o-2;t>=0;t--)e.addNextSegment(s[t],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()}computePointCurve(t,e){switch(this._bufParams.getEndCapStyle()){case Kn.CAP_ROUND:e.createCircle(t);break;case Kn.CAP_SQUARE:e.createSquare(t)}}getLineCurve(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;const i=Math.abs(e),n=this.getSegGen(i);if(t.length<=1)this.computePointCurve(t[0],n);else if(this._bufParams.isSingleSided()){const i=e<0;this.computeSingleSidedBufferCurve(t,i,n)}else this.computeLineBufferCurve(t,n);return n.getCoordinates()}getBufferParameters(){return this._bufParams}simplifyTolerance(t){return t*this._bufParams.getSimplifyFactor()}getRingCurve(t,e,i){if(this._distance=i,t.length<=2)return this.getLineCurve(t,i);if(0===i)return ar.copyCoordinates(t);const n=this.getSegGen(i);return this.computeRingBufferCurve(t,e,n),n.getCoordinates()}computeOffsetCurve(t,e,i){const n=this.simplifyTolerance(this._distance);if(e){const e=rr.simplify(t,-n),r=e.length-1;i.initSideSegments(e[r],e[r-1],xi.LEFT),i.addFirstSegment();for(let t=r-2;t>=0;t--)i.addNextSegment(e[t],!0)}else{const e=rr.simplify(t,n),r=e.length-1;i.initSideSegments(e[0],e[1],xi.LEFT),i.addFirstSegment();for(let t=2;t<=r;t++)i.addNextSegment(e[t],!0)}i.addLastSegment()}isLineOffsetEmpty(t){return 0===t||t<0&&!this._bufParams.isSingleSided()}getSegGen(t){return new or(this._precisionModel,this._bufParams,t)}}class lr{constructor(){lr.constructor_.apply(this,arguments)}static constructor_(){this._subgraphs=null,this._seg=new Vt;const t=arguments[0];this._subgraphs=t}findStabbedSegments(){if(1===arguments.length){const t=arguments[0],e=new C;for(let i=this._subgraphs.iterator();i.hasNext();){const n=i.next(),r=n.getEnvelope();t.yr.getMaxY()||this.findStabbedSegments(t,n.getDirectedEdges(),e)}return e}if(3===arguments.length)if(y(arguments[2],E)&&arguments[0]instanceof f&&arguments[1]instanceof Ui){const t=arguments[0],e=arguments[1],i=arguments[2],n=e.getEdge().getCoordinates();for(let r=0;rthis._seg.p1.y&&this._seg.reverse(),Math.max(this._seg.p0.x,this._seg.p1.x)this._seg.p1.y)continue;if(A.index(this._seg.p0,this._seg.p1,t)===A.RIGHT)continue;let s=e.getDepth(xi.LEFT);this._seg.p0.equals(n[r])||(s=e.getDepth(xi.RIGHT));const o=new hr(this._seg,s);i.add(o)}}else if(y(arguments[2],E)&&arguments[0]instanceof f&&y(arguments[1],E)){const t=arguments[0],e=arguments[2];for(let i=arguments[1].iterator();i.hasNext();){const n=i.next();n.isForward()&&this.findStabbedSegments(t,n,e)}}}getDepth(t){const e=this.findStabbedSegments(t);return 0===e.size()?0:le.min(e)._leftDepth}}class hr{constructor(){hr.constructor_.apply(this,arguments)}static constructor_(){this._upwardSeg=null,this._leftDepth=null;const t=arguments[0],e=arguments[1];this._upwardSeg=new Vt(t),this._leftDepth=e}compareTo(t){const e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;let i=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==i?i:(i=-1*e._upwardSeg.orientationIndex(this._upwardSeg),0!==i?i:this._upwardSeg.compareTo(e._upwardSeg))}compareX(t,e){const i=t.p0.compareTo(e.p0);return 0!==i?i:t.p1.compareTo(e.p1)}toString(){return this._upwardSeg.toString()}get interfaces_(){return[o]}}lr.DepthSegment=hr;class cr{constructor(){cr.constructor_.apply(this,arguments)}static constructor_(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new C;const t=arguments[0],e=arguments[1],i=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=i}addRingSide(t,e,i,n,r){if(0===e&&t.length=lt.MINIMUM_VALID_SIZE&&A.isCCW(t)&&(s=r,o=n,i=xi.opposite(i));const a=this._curveBuilder.getRingCurve(t,i,e);this.addCurve(a,s,o)}addRingBothSides(t,e){this.addRingSide(t,e,xi.LEFT,Bt.EXTERIOR,Bt.INTERIOR),this.addRingSide(t,e,xi.RIGHT,Bt.INTERIOR,Bt.EXTERIOR)}addPoint(t){if(this._distance<=0)return null;const e=t.getCoordinates(),i=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(i,Bt.EXTERIOR,Bt.INTERIOR)}addPolygon(t){let e=this._distance,i=xi.LEFT;this._distance<0&&(e=-this._distance,i=xi.RIGHT);const n=t.getExteriorRing(),r=gt.removeRepeatedPoints(n.getCoordinates());if(this._distance<0&&this.isErodedCompletely(n,this._distance))return null;if(this._distance<=0&&r.length<3)return null;this.addRingSide(r,e,i,Bt.EXTERIOR,Bt.INTERIOR);for(let n=0;n0&&this.isErodedCompletely(r,-this._distance)||this.addRingSide(s,e,xi.opposite(i),Bt.INTERIOR,Bt.EXTERIOR)}}isTriangleErodedCompletely(t,e){const i=new jt(t[0],t[1],t[2]),n=i.inCentre();return k.pointToSegment(n,i.p0,i.p1)r}addCollection(t){for(let e=0;e=0;i--){const n=this._edgeList.get(i),r=n.getSym();null===e&&(e=r),null!==t&&r.setNext(t),t=n}e.setNext(t)}computeDepths(){if(1===arguments.length){const t=arguments[0],e=this.findIndex(t),i=t.getDepth(xi.LEFT),n=t.getDepth(xi.RIGHT),r=this.computeDepths(e+1,this._edgeList.size(),i);if(this.computeDepths(0,e,r)!==n)throw new ji("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){const t=arguments[1];let e=arguments[2];for(let i=arguments[0];i=0;r--){const s=this._resultAreaEdgeList.get(r),o=s.getSym();switch(null===e&&s.getEdgeRing()===t&&(e=s),n){case this._SCANNING_FOR_INCOMING:if(o.getEdgeRing()!==t)continue;i=o,n=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;i.setNextMin(s),n=this._SCANNING_FOR_INCOMING}}n===this._LINKING_TO_OUTGOING&&(d.isTrue(null!==e,"found null for first outgoing dirEdge"),d.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),i.setNextMin(e))}getOutgoingDegree(){if(0===arguments.length){let t=0;for(let e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){const t=arguments[0];let e=0;for(let i=this.iterator();i.hasNext();)i.next().getEdgeRing()===t&&e++;return e}}getLabel(){return this._label}findCoveredLineEdges(){let t=Bt.NONE;for(let e=this.iterator();e.hasNext();){const i=e.next(),n=i.getSym();if(!i.isLineEdge()){if(i.isInResult()){t=Bt.INTERIOR;break}if(n.isInResult()){t=Bt.EXTERIOR;break}}}if(t===Bt.NONE)return null;let e=t;for(let t=this.iterator();t.hasNext();){const i=t.next(),n=i.getSym();i.isLineEdge()?i.getEdge().setCovered(e===Bt.INTERIOR):(i.isInResult()&&(e=Bt.EXTERIOR),n.isInResult()&&(e=Bt.INTERIOR))}}computeLabelling(t){super.computeLabelling.call(this,t),this._label=new Ti(Bt.NONE);for(let t=this.iterator();t.hasNext();){const e=t.next().getEdge().getLabel();for(let t=0;t<2;t++){const i=e.getLocation(t);i!==Bt.INTERIOR&&i!==Bt.BOUNDARY||this._label.setLocation(t,Bt.INTERIOR)}}}}class gr extends Wi{constructor(){super()}createNode(t){return new zi(t,new dr)}}class _r{constructor(){_r.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._orientation=null;const t=arguments[0];this._pts=t,this._orientation=_r.orientation(t)}static orientation(t){return 1===gt.increasingDirection(t)}static compareOriented(t,e,i,n){const r=e?1:-1,s=n?1:-1,o=e?t.length:-1,a=n?i.length:-1;let l=e?0:t.length-1,h=n?0:i.length-1;for(;;){const e=t[l].compareTo(i[h]);if(0!==e)return e;l+=r,h+=s;const n=l===o,c=h===a;if(n&&!c)return-1;if(!n&&c)return 1;if(n&&c)return 0}}compareTo(t){const e=t;return _r.compareOriented(this._pts,this._orientation,e._pts,e._orientation)}get interfaces_(){return[o]}}class pr{constructor(){pr.constructor_.apply(this,arguments)}static constructor_(){this._edges=new C,this._ocaMap=new Ai}print(t){t.print("MULTILINESTRING ( ");for(let e=0;e0&&t.print(","),t.print("(");const n=i.getCoordinates();for(let e=0;e0&&t.print(","),t.print(n[e].x+" "+n[e].y);t.println(")")}t.print(") ")}addAll(t){for(let e=t.iterator();e.hasNext();)this.add(e.next())}findEdgeIndex(t){for(let e=0;en||this._maxys;if(o)return!1;const a=this.intersectsToleranceSquare(t,e);return d.isTrue(!(o&&a),"Found bad envelope test"),a}initCorners(t){this._minx=t.x-.5,this._maxx=t.x+.5,this._miny=t.y-.5,this._maxy=t.y+.5,this._corner[0]=new f(this._maxx,this._maxy),this._corner[1]=new f(this._minx,this._maxy),this._corner[2]=new f(this._minx,this._miny),this._corner[3]=new f(this._maxx,this._miny)}intersects(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}scale(t){return Math.round(t*this._scaleFactor)}getCoordinate(){return this._originalPt}copyScaled(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}getSafeEnvelope(){if(null===this._safeEnv){const t=xr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new L(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}intersectsPixelClosure(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))))}intersectsToleranceSquare(t,e){let i=!1,n=!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()&&(i=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||i&&n||t.equals(this._pt)||e.equals(this._pt)))))}addSnappedNode(t,e){const i=t.getCoordinate(e),n=t.getCoordinate(e+1);return!!this.intersects(i,n)&&(t.addIntersection(this.getCoordinate(),e),!0)}}xr.SAFE_ENV_EXPANSION_FACTOR=.75;class Er{constructor(){Er.constructor_.apply(this,arguments)}static constructor_(){this.selectedSegment=new Vt}select(){if(1===arguments.length);else if(2===arguments.length){const t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}}}class Ir{constructor(){Ir.constructor_.apply(this,arguments)}static constructor_(){this._index=null;const t=arguments[0];this._index=t}snap(){if(1===arguments.length){const t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=t.getSafeEnvelope(),r=new Cr(t,e,i);return this._index.query(n,new class{get interfaces_(){return[Ce]}visitItem(t){t.select(n,r)}}),r.isNodeAdded()}}}class Cr extends Er{constructor(){super(),Cr.constructor_.apply(this,arguments)}static constructor_(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;const t=arguments[0],e=arguments[1],i=arguments[2];this._hotPixel=t,this._parentEdge=e,this._hotPixelVertexIndex=i}isNodeAdded(){return this._isNodeAdded}select(){if(!(2===arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof kn))return super.select.apply(this,arguments);{const t=arguments[1],e=arguments[0].getContext();if(this._parentEdge===e&&(t===this._hotPixelVertexIndex||t+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(e,t)}}}Ir.HotPixelSnapAction=Cr;class wr{constructor(){wr.constructor_.apply(this,arguments)}static constructor_(){this._li=null,this._interiorIntersections=null;const t=arguments[0];this._li=t,this._interiorIntersections=new C}processIntersections(t,e,i,n){if(t===i&&e===n)return null;const r=t.getCoordinates()[e],s=t.getCoordinates()[e+1],o=i.getCoordinates()[n],a=i.getCoordinates()[n+1];if(this._li.computeIntersection(r,s,o,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(let t=0;t0?e:0),s=i-Math.trunc(Math.log(r)/Math.log(10)+1);return Math.pow(10,s)}bufferFixedPrecision(t){const e=new Xn(new Sr(new It(1)),t.getScale()),i=new yr(this._bufParams);i.setWorkingPrecisionModel(t),i.setNoder(e),this._resultGeometry=i.buffer(this._argGeom,this._distance)}bufferReducedPrecision(){if(0===arguments.length){for(let t=Tr.MAX_PRECISION_DIGITS;t>=0;t--){try{this.bufferReducedPrecision(t)}catch(t){if(!(t instanceof ji))throw t;this._saveException=t}if(null!==this._resultGeometry)return null}throw this._saveException}if(1===arguments.length){const t=arguments[0],e=Tr.precisionScaleFactor(this._argGeom,this._distance,t),i=new It(e);this.bufferFixedPrecision(i)}}computeGeometry(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;const t=this._argGeom.getFactory().getPrecisionModel();t.getType()===It.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}setQuadrantSegments(t){this._bufParams.setQuadrantSegments(t)}bufferOriginalPrecision(){try{const t=new yr(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof c))throw t;this._saveException=t}}getResultGeometry(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}setEndCapStyle(t){this._bufParams.setEndCapStyle(t)}}Tr.CAP_ROUND=Kn.CAP_ROUND,Tr.CAP_BUTT=Kn.CAP_FLAT,Tr.CAP_FLAT=Kn.CAP_FLAT,Tr.CAP_SQUARE=Kn.CAP_SQUARE,Tr.MAX_PRECISION_DIGITS=12;var Lr=Object.freeze({__proto__:null,BufferOp:Tr,BufferParameters:Kn});class Nr{constructor(){Nr.constructor_.apply(this,arguments)}static constructor_(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length){const t=arguments[0],e=arguments[1];Nr.constructor_.call(this,t,Nr.INSIDE_AREA,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._component=t,this._segIndex=e,this._pt=i}}getSegmentIndex(){return this._segIndex}getCoordinate(){return this._pt}isInsideArea(){return this._segIndex===Nr.INSIDE_AREA}toString(){return this._component.getGeometryType()+"["+this._segIndex+"]-"+Dt.toPoint(this._pt)}getGeometryComponent(){return this._component}}Nr.INSIDE_AREA=-1;class Or{constructor(){Or.constructor_.apply(this,arguments)}static constructor_(){this._locations=null;const t=arguments[0];this._locations=t}static getLocations(t){const e=new C;return t.apply(new Or(e)),e}filter(t){if(t.isEmpty())return null;(t instanceof J||t instanceof Z||t instanceof et)&&this._locations.add(new Nr(t,0,t.getCoordinate()))}get interfaces_(){return[H]}}class Rr{constructor(){Rr.constructor_.apply(this,arguments)}static constructor_(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new si,this._minDistanceLocation=null,this._minDistance=s.MAX_VALUE,2===arguments.length){const t=arguments[0],e=arguments[1];Rr.constructor_.call(this,t,e,0)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e,this._terminateDistance=i}}static distance(t,e){return new Rr(t,e).distance()}static isWithinDistance(t,e,i){return!(t.getEnvelopeInternal().distance(e.getEnvelopeInternal())>i)&&new Rr(t,e,i).distance()<=i}static nearestPoints(t,e){return new Rr(t,e).nearestPoints()}computeContainmentDistance(){if(0===arguments.length){const t=new Array(2).fill(null);if(this.computeContainmentDistance(0,t),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1],i=this._geom[t];if(i.getDimension()<2)return null;const n=1-t,r=ce.getPolygons(i);if(r.size()>0){const i=Or.getLocations(this._geom[n]);if(this.computeContainmentDistance(i,r,e),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[n]=e[0],this._minDistanceLocation[t]=e[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&y(arguments[0],E)&&y(arguments[1],E)){const t=arguments[0],e=arguments[1],i=arguments[2];for(let n=0;nthis._minDistance)return null;const n=t.getCoordinates(),r=e.getCoordinate();for(let s=0;sthis._minDistance)return null;const n=t.getCoordinates(),r=e.getCoordinates();for(let s=0;sthis._minDistance))for(let a=0;athis._minDistance)continue;const h=k.segmentToSegment(n[s],n[s+1],r[a],r[a+1]);if(ht&>.reverse(this._coordinates)}return this._coordinates}toLineString(){return this._factory.createLineString(this.getCoordinates())}add(t){this._directedEdges.add(t)}}class Mr{constructor(){Mr.constructor_.apply(this,arguments)}static constructor_(){this._isMarked=!1,this._isVisited=!1,this._data=null}static getComponentWithVisitedState(t,e){for(;t.hasNext();){const i=t.next();if(i.isVisited()===e)return i}return null}static setVisited(t,e){for(;t.hasNext();)t.next().setVisited(e)}static setMarked(t,e){for(;t.hasNext();)t.next().setMarked(e)}setVisited(t){this._isVisited=t}isMarked(){return this._isMarked}setData(t){this._data=t}getData(){return this._data}setMarked(t){this._isMarked=t}getContext(){return this._data}isVisited(){return this._isVisited}setContext(t){this._data=t}}class Ar extends Mr{constructor(){super(),Ar.constructor_.apply(this,arguments)}static constructor_(){if(this._parentEdge=null,this._from=null,this._to=null,this._p0=null,this._p1=null,this._sym=null,this._edgeDirection=null,this._quadrant=null,this._angle=null,0===arguments.length);else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this._from=t,this._to=e,this._edgeDirection=n,this._p0=t.getCoordinate(),this._p1=i;const r=this._p1.x-this._p0.x,s=this._p1.y-this._p0.y;this._quadrant=di.quadrant(r,s),this._angle=Math.atan2(s,r)}}static toEdges(t){const e=new C;for(let i=t.iterator();i.hasNext();)e.add(i.next()._parentEdge);return e}isRemoved(){return null===this._parentEdge}compareDirection(t){return this._quadrant>t._quadrant?1:this._quadrant=0&&t.add(r+1,new f(i),!1)}}findSegmentIndexToSnap(t,e){let i=s.MAX_VALUE,n=-1;for(let r=0;re&&(e=t)}return e}if(2===arguments.length){const t=arguments[0],e=arguments[1];return Math.min(Zr.computeOverlaySnapTolerance(t),Zr.computeOverlaySnapTolerance(e))}}static computeSizeBasedSnapTolerance(t){const e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Zr.SNAP_PRECISION_FACTOR}static snapToSelf(t,e,i){return new Zr(t).snapToSelf(e,i)}snapTo(t,e){const i=this.extractTargetCoordinates(t);return new Kr(e,i).transform(this._srcGeom)}snapToSelf(t,e){const i=this.extractTargetCoordinates(this._srcGeom),n=new Kr(t,i,!0).transform(this._srcGeom);let r=n;return e&&y(r,tt)&&(r=n.buffer(0)),r}computeSnapTolerance(t){return this.computeMinimumSegmentLength(t)/10}extractTargetCoordinates(t){const e=new rt,i=t.getCoordinates();for(let t=0;t=t.size()-2}static createAnyIntersectionFinder(t){return new Qr(t)}static createInteriorIntersectionsFinder(t){const e=new Qr(t);return e.setFindAllIntersections(!0),e.setInteriorIntersectionsOnly(!0),e}setCheckEndSegmentsOnly(t){this._isCheckEndSegmentsOnly=t}getIntersectionSegments(){return this._intSegments}count(){return this._intersectionCount}getIntersections(){return this._intersections}setFindAllIntersections(t){this._findAllIntersections=t}setKeepIntersections(t){this._keepIntersections=t}getIntersection(){return this._interiorIntersection}processIntersections(t,e,i,n){if(!this._findAllIntersections&&this.hasIntersection())return null;const r=t===i;if(r&&e===n)return null;if(this._isCheckEndSegmentsOnly&&!Qr.isEndSegment(t,e)&&!Qr.isEndSegment(i,n))return null;const s=t.getCoordinate(e),o=t.getCoordinate(e+1),a=i.getCoordinate(n),l=i.getCoordinate(n+1),h=0===e,c=e+2===t.size(),u=0===n,d=n+2===i.size();this._li.computeIntersection(s,o,a,l);const g=this._li.hasIntersection()&&this._li.isInteriorIntersection();let _=!1;this._isInteriorIntersectionsOnly||(_=!(r&&Math.abs(n-e)<=1)&&Qr.isInteriorVertexIntersection(s,o,a,l,h,c,u,d)),(g||_)&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=s,this._intSegments[1]=o,this._intSegments[2]=a,this._intSegments[3]=l,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)}hasIntersection(){return null!==this._interiorIntersection}isDone(){return!this._findAllIntersections&&null!==this._interiorIntersection}setInteriorIntersectionsOnly(t){this._isInteriorIntersectionsOnly=t}get interfaces_(){return[fr]}}class ts{constructor(){ts.constructor_.apply(this,arguments)}static constructor_(){this._li=new kt,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;const t=arguments[0];this._segStrings=t}static computeIntersections(t){const e=new ts(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()}execute(){if(null!==this._segInt)return null;this.checkInteriorIntersections()}getIntersections(){return this._segInt.getIntersections()}isValid(){return this.execute(),this._isValid}setFindAllIntersections(t){this._findAllIntersections=t}checkInteriorIntersections(){this._isValid=!0,this._segInt=new Qr(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);const t=new zn;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null}checkValid(){if(this.execute(),!this._isValid)throw new ji(this.getErrorMessage(),this._segInt.getIntersection())}getErrorMessage(){if(this._isValid)return"no intersections found";const t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Dt.toLineString(t[0],t[1])+" and "+Dt.toLineString(t[2],t[3])}}class es{constructor(){es.constructor_.apply(this,arguments)}static constructor_(){this._nv=null;const t=arguments[0];this._nv=new ts(es.toSegmentStrings(t))}static toSegmentStrings(t){const e=new C;for(let i=t.iterator();i.hasNext();){const t=i.next();e.add(new $r(t.getCoordinates(),t))}return e}static checkValid(t){new es(t).checkValid()}checkValid(){this._nv.checkValid()}}class is{constructor(){is.constructor_.apply(this,arguments)}static constructor_(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new C,this._resultLineList=new C;const t=arguments[0],e=arguments[1],i=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=i}collectLines(t){for(let e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){const i=e.next();this.collectLineEdge(i,t,this._lineEdgesList),this.collectBoundaryTouchEdge(i,t,this._lineEdgesList)}}labelIsolatedLine(t,e){const i=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,i)}build(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList}collectLineEdge(t,e,i){const n=t.getLabel(),r=t.getEdge();t.isLineEdge()&&(t.isVisited()||!us.isResultOfOp(n,e)||r.isCovered()||(i.add(r),t.setVisitedEdge(!0)))}findCoveredLineEdges(){for(let t=this._op.getGraph().getNodes().iterator();t.hasNext();)t.next().getEdges().findCoveredLineEdges();for(let t=this._op.getGraph().getEdgeEnds().iterator();t.hasNext();){const e=t.next(),i=e.getEdge();if(e.isLineEdge()&&!i.isCoveredSet()){const t=this._op.isCoveredByA(e.getCoordinate());i.setCovered(t)}}}labelIsolatedLines(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),i=t.getLabel();t.isIsolated()&&(i.isNull(0)?this.labelIsolatedLine(t,0):this.labelIsolatedLine(t,1))}}buildLines(t){for(let t=this._lineEdgesList.iterator();t.hasNext();){const e=t.next(),i=this._geometryFactory.createLineString(e.getCoordinates());this._resultLineList.add(i),e.setInResult(!0)}}collectBoundaryTouchEdge(t,e,i){const n=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(d.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(us.isResultOfOp(n,e)&&e===us.INTERSECTION&&(i.add(t.getEdge()),t.setVisitedEdge(!0))))}}class ns{constructor(){ns.constructor_.apply(this,arguments)}static constructor_(){this._op=null,this._geometryFactory=null,this._resultPointList=new C;const t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e}filterCoveredNodeToPoint(t){const e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){const t=this._geometryFactory.createPoint(e);this._resultPointList.add(t)}}extractNonCoveredResultNodes(t){for(let e=this._op.getGraph().getNodes().iterator();e.hasNext();){const i=e.next();if(!(i.isInResult()||i.isIncidentEdgeInResult()||0!==i.getEdges().getDegree()&&t!==us.INTERSECTION)){const e=i.getLabel();us.isResultOfOp(e,t)&&this.filterCoveredNodeToPoint(i)}}}build(t){return this.extractNonCoveredResultNodes(t),this._resultPointList}}class rs{constructor(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=new r,this._commonSignExp=null}getCommon(){return s.longBitsToDouble(this._commonBits)}add(t){const e=s.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=rs.signExpBits(this._commonBits),this._isFirst=!1,null):rs.signExpBits(e)!==this._commonSignExp?(this._commonBits.high=0,this._commonBits.low=0,null):(this._commonMantissaBitsCount=rs.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=rs.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))}toString(){if(1===arguments.length){const t=arguments[0],e=s.longBitsToDouble(t),i="0000000000000000000000000000000000000000000000000000000000000000"+r.toBinaryString(t),n=i.substring(i.length-64);return n.substring(0,1)+" "+n.substring(1,12)+"(exp) "+n.substring(12)+" [ "+e+" ]"}}getClass(){return rs}get interfaces_(){return[]}static getBit(t,e){const i=1<>>20}static zeroLowerBits(t,e){let i="low";if(e>32&&(t.low=0,e%=32,i="high"),e>0){const n=e<32?~((1<=0;n--){if(rs.getBit(t,n)!==rs.getBit(e,n))return i;i++}return 52}}class ss{constructor(){ss.constructor_.apply(this,arguments)}static constructor_(){this._commonCoord=null,this._ccFilter=new os}addCommonBits(t){const e=new as(this._commonCoord);t.apply(e),t.geometryChanged()}removeCommonBits(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;const e=new f(this._commonCoord);e.x=-e.x,e.y=-e.y;const i=new as(e);return t.apply(i),t.geometryChanged(),t}getCommonCoordinate(){return this._commonCoord}add(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()}}class os{constructor(){os.constructor_.apply(this,arguments)}static constructor_(){this._commonBitsX=new rs,this._commonBitsY=new rs}filter(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)}getCommonCoordinate(){return new f(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())}get interfaces_(){return[z]}}class as{constructor(){as.constructor_.apply(this,arguments)}static constructor_(){this.trans=null;const t=arguments[0];this.trans=t}filter(t,e){const i=t.getOrdinate(e,0)+this.trans.x,n=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,i),t.setOrdinate(e,1,n)}isDone(){return!1}isGeometryChanged(){return!0}get interfaces_(){return[T]}}ss.CommonCoordinateFilter=os,ss.Translater=as;class ls{constructor(){ls.constructor_.apply(this,arguments)}static constructor_(){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null;const t=arguments[0],e=arguments[1];this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()}static overlayOp(t,e,i){return new ls(t,e).getResultGeometry(i)}static union(t,e){return ls.overlayOp(t,e,us.UNION)}static intersection(t,e){return ls.overlayOp(t,e,us.INTERSECTION)}static symDifference(t,e){return ls.overlayOp(t,e,us.SYMDIFFERENCE)}static difference(t,e){return ls.overlayOp(t,e,us.DIFFERENCE)}selfSnap(t){return new Zr(t).snapTo(t,this._snapTolerance)}removeCommonBits(t){this._cbr=new ss,this._cbr.add(t[0]),this._cbr.add(t[1]);const e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e}prepareResult(t){return this._cbr.addCommonBits(t),t}getResultGeometry(t){const e=this.snap(this._geom),i=us.overlayOp(e[0],e[1],t);return this.prepareResult(i)}checkValid(t){t.isValid()||D.out.println("Snapped geometry is invalid")}computeSnapTolerance(){this._snapTolerance=Zr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])}snap(t){const e=this.removeCommonBits(t);return Zr.snap(e[0],e[1],this._snapTolerance)}}class hs{constructor(){hs.constructor_.apply(this,arguments)}static constructor_(){this._geom=new Array(2).fill(null);const t=arguments[0],e=arguments[1];this._geom[0]=t,this._geom[1]=e}static overlayOp(t,e,i){return new hs(t,e).getResultGeometry(i)}static union(t,e){return hs.overlayOp(t,e,us.UNION)}static intersection(t,e){return hs.overlayOp(t,e,us.INTERSECTION)}static symDifference(t,e){return hs.overlayOp(t,e,us.SYMDIFFERENCE)}static difference(t,e){return hs.overlayOp(t,e,us.DIFFERENCE)}getResultGeometry(t){let e=null,i=!1,n=null;try{e=us.overlayOp(this._geom[0],this._geom[1],t),i=!0}catch(t){if(!(t instanceof c))throw t;n=t}if(!i)try{e=ls.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof c?n:t}return e}}class cs{constructor(){cs.constructor_.apply(this,arguments)}static constructor_(){if(this._li=new kt,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){const t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new Zi(0,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];cs.constructor_.call(this,t,e,ti.OGC_SFS_BOUNDARY_RULE)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];t.getPrecisionModel().compareTo(e.getPrecisionModel())>=0?this.setComputationPrecision(t.getPrecisionModel()):this.setComputationPrecision(e.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new Zi(0,t,i),this._arg[1]=new Zi(1,e,i)}}getArgGeometry(t){return this._arg[t].getGeometry()}setComputationPrecision(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)}}class us extends cs{constructor(){super(),us.constructor_.apply(this,arguments)}static constructor_(){this._ptLocator=new si,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new pr,this._resultPolyList=new C,this._resultLineList=new C,this._resultPointList=new C;const t=arguments[0],e=arguments[1];cs.constructor_.call(this,t,e),this._graph=new Hi(new gr),this._geomFact=t.getFactory()}static overlayOp(t,e,i){return new us(t,e).getResultGeometry(i)}static union(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return us.createEmptyResult(us.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return hs.overlayOp(t,e,us.UNION)}static intersection(t,e){if(t.isEmpty()||e.isEmpty())return us.createEmptyResult(us.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){const i=e;return $t.map(t,new class{get interfaces_(){return[MapOp]}map(t){return us.intersection(t,i)}})}return hs.overlayOp(t,e,us.INTERSECTION)}static symDifference(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return us.createEmptyResult(us.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return hs.overlayOp(t,e,us.SYMDIFFERENCE)}static resultDimension(t,e,i){const n=e.getDimension(),r=i.getDimension();let s=-1;switch(t){case us.INTERSECTION:s=Math.min(n,r);break;case us.UNION:s=Math.max(n,r);break;case us.DIFFERENCE:s=n;break;case us.SYMDIFFERENCE:s=Math.max(n,r)}return s}static createEmptyResult(t,e,i,n){const r=us.resultDimension(t,e,i);return n.createEmpty(r)}static difference(t,e){if(t.isEmpty())return us.createEmptyResult(us.DIFFERENCE,t,e,t.getFactory());if(e.isEmpty())return t.copy();if(t.isGeometryCollection()||e.isGeometryCollection())throw new n("This method does not support GeometryCollection arguments");return hs.overlayOp(t,e,us.DIFFERENCE)}static isResultOfOp(){if(2===arguments.length){const t=arguments[0],e=arguments[1],i=t.getLocation(0),n=t.getLocation(1);return us.isResultOfOp(i,n,e)}if(3===arguments.length){let t=arguments[0],e=arguments[1],i=arguments[2];switch(t===Bt.BOUNDARY&&(t=Bt.INTERIOR),e===Bt.BOUNDARY&&(e=Bt.INTERIOR),i){case us.INTERSECTION:return t===Bt.INTERIOR&&e===Bt.INTERIOR;case us.UNION:return t===Bt.INTERIOR||e===Bt.INTERIOR;case us.DIFFERENCE:return t===Bt.INTERIOR&&e!==Bt.INTERIOR;case us.SYMDIFFERENCE:return t===Bt.INTERIOR&&e!==Bt.INTERIOR||t!==Bt.INTERIOR&&e===Bt.INTERIOR}return!1}}insertUniqueEdge(t){const e=this._edgeList.findEqualEdge(t);if(null!==e){const i=e.getLabel();let n=t.getLabel();e.isPointwiseEqual(t)||(n=new Ti(t.getLabel()),n.flip());const r=e.getDepth();r.isNull()&&r.add(i),r.add(n),i.merge(n)}else this._edgeList.add(t)}getGraph(){return this._graph}cancelDuplicateResultEdges(){for(let t=this._graph.getEdgeEnds().iterator();t.hasNext();){const e=t.next(),i=e.getSym();e.isInResult()&&i.isInResult()&&(e.setInResult(!1),i.setInResult(!1))}}isCoveredByLA(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)}computeGeometry(t,e,i,n){const r=new C;return r.addAll(t),r.addAll(e),r.addAll(i),r.isEmpty()?us.createEmptyResult(n,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(r)}mergeSymLabels(){for(let t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().mergeSymLabels()}isCovered(t,e){for(let i=e.iterator();i.hasNext();){const e=i.next();if(this._ptLocator.locate(t,e)!==Bt.EXTERIOR)return!0}return!1}replaceCollapsedEdges(){const t=new C;for(let e=this._edgeList.iterator();e.hasNext();){const i=e.next();i.isCollapsed()&&(e.remove(),t.add(i.getCollapsedEdge()))}this._edgeList.addAll(t)}updateNodeLabelling(){for(let t=this._graph.getNodes().iterator();t.hasNext();){const e=t.next(),i=e.getEdges().getLabel();e.getLabel().merge(i)}}getResultGeometry(t){return this.computeOverlay(t),this._resultGeom}insertUniqueEdges(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.insertUniqueEdge(t)}}computeOverlay(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);const e=new C;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),es.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();const i=new nr(this._geomFact);i.add(this._graph),this._resultPolyList=i.getPolygons();const n=new is(this,this._geomFact,this._ptLocator);this._resultLineList=n.build(t);const r=new ns(this,this._geomFact,this._ptLocator);this._resultPointList=r.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)}labelIncompleteNode(t,e){const i=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,i)}copyPoints(t){for(let e=this._arg[t].getNodeIterator();e.hasNext();){const i=e.next();this._graph.addNode(i.getCoordinate()).setLabel(t,i.getLabel().getLocation(t))}}findResultAreaEdges(t){for(let e=this._graph.getEdgeEnds().iterator();e.hasNext();){const i=e.next(),n=i.getLabel();n.isArea()&&!i.isInteriorAreaEdge()&&us.isResultOfOp(n.getLocation(0,xi.RIGHT),n.getLocation(1,xi.RIGHT),t)&&i.setInResult(!0)}}computeLabelsFromDepths(){for(let t=this._edgeList.iterator();t.hasNext();){const e=t.next(),i=e.getLabel(),n=e.getDepth();if(!n.isNull()){n.normalize();for(let t=0;t<2;t++)i.isNull(t)||!i.isArea()||n.isNull(t)||(0===n.getDelta(t)?i.toLine(t):(d.isTrue(!n.isNull(t,xi.LEFT),"depth of LEFT side has not been initialized"),i.setLocation(t,xi.LEFT,n.getLocation(t,xi.LEFT)),d.isTrue(!n.isNull(t,xi.RIGHT),"depth of RIGHT side has not been initialized"),i.setLocation(t,xi.RIGHT,n.getLocation(t,xi.RIGHT))))}}}computeLabelling(){for(let t=this._graph.getNodes().iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()}labelIncompleteNodes(){for(let t=this._graph.getNodes().iterator();t.hasNext();){const e=t.next(),i=e.getLabel();e.isIsolated()&&(i.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(i)}}isCoveredByA(t){return!!this.isCovered(t,this._resultPolyList)}}us.INTERSECTION=1,us.UNION=2,us.DIFFERENCE=3,us.SYMDIFFERENCE=4;var ds=Object.freeze({__proto__:null,snap:Jr,OverlayOp:us});class gs extends Ar{constructor(){super(),gs.constructor_.apply(this,arguments)}static constructor_(){this._edgeRing=null,this._next=null,this._label=-1;const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];Ar.constructor_.call(this,t,e,i,n)}getNext(){return this._next}isInRing(){return null!==this._edgeRing}setRing(t){this._edgeRing=t}setLabel(t){this._label=t}getLabel(){return this._label}setNext(t){this._next=t}getRing(){return this._edgeRing}}class _s extends Dr{constructor(){super(),_s.constructor_.apply(this,arguments)}static constructor_(){this._line=null;const t=arguments[0];this._line=t}getLine(){return this._line}}class ps{constructor(){ps.constructor_.apply(this,arguments)}static constructor_(){this._geometryFactory=new St,this._geomGraph=null,this._disconnectedRingcoord=null;const t=arguments[0];this._geomGraph=t}static findDifferentPoint(t,e){for(let i=0;i=t.getNumPoints()&&null===n)return null;let s=t.getCoordinate(r);null!==n&&n.segmentIndex===i.segmentIndex&&(s=n.coord);const o=new Xi(t,i.coord,s,new Ti(t.getLabel()));e.add(o)}createEdgeEndForPrev(t,e,i,n){let r=i.segmentIndex;if(0===i.dist){if(0===r)return null;r--}let s=t.getCoordinate(r);null!==n&&n.segmentIndex>=r&&(s=n.coord);const o=new Ti(t.getLabel());o.flip();const a=new Xi(t,i.coord,s,o);e.add(a)}computeEdgeEnds(){if(1===arguments.length){const t=arguments[0],e=new C;for(let i=t;i.hasNext();){const t=i.next();this.computeEdgeEnds(t,e)}return e}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=t.getEdgeIntersectionList();i.addEndpoints();const n=i.iterator();let r=null,s=null;if(!n.hasNext())return null;let o=n.next();do{r=s,s=o,o=null,n.hasNext()&&(o=n.next()),null!==s&&(this.createEdgeEndForPrev(t,e,s,r),this.createEdgeEndForNext(t,e,s,o))}while(null!==s)}}}class ms extends Xi{constructor(){super(),ms.constructor_.apply(this,arguments)}static constructor_(){if(this._edgeEnds=new C,1===arguments.length){const t=arguments[0];ms.constructor_.call(this,null,t)}else if(2===arguments.length){const t=arguments[1];Xi.constructor_.call(this,t.getEdge(),t.getCoordinate(),t.getDirectedCoordinate(),new Ti(t.getLabel())),this.insert(t)}}insert(t){this._edgeEnds.add(t)}print(t){t.println("EdgeEndBundle--\x3e Label: "+this._label);for(let e=this.iterator();e.hasNext();)e.next().print(t),t.println()}iterator(){return this._edgeEnds.iterator()}getEdgeEnds(){return this._edgeEnds}computeLabelOn(t,e){let i=0,n=!1;for(let e=this.iterator();e.hasNext();){const r=e.next().getLabel().getLocation(t);r===Bt.BOUNDARY&&i++,r===Bt.INTERIOR&&(n=!0)}let r=Bt.NONE;n&&(r=Bt.INTERIOR),i>0&&(r=Zi.determineBoundary(e,i)),this._label.setLocation(t,r)}computeLabelSide(t,e){for(let i=this.iterator();i.hasNext();){const n=i.next();if(n.getLabel().isArea()){const i=n.getLabel().getLocation(t,e);if(i===Bt.INTERIOR)return this._label.setLocation(t,e,Bt.INTERIOR),null;i===Bt.EXTERIOR&&this._label.setLocation(t,e,Bt.EXTERIOR)}}}getLabel(){return this._label}computeLabelSides(t){this.computeLabelSide(t,xi.LEFT),this.computeLabelSide(t,xi.RIGHT)}updateIM(t){Yi.updateIM(this._label,t)}computeLabel(t){let e=!1;for(let t=this.iterator();t.hasNext();)t.next().getLabel().isArea()&&(e=!0);this._label=e?new Ti(Bt.NONE,Bt.NONE,Bt.NONE):new Ti(Bt.NONE);for(let i=0;i<2;i++)this.computeLabelOn(i,t),e&&this.computeLabelSides(i)}}class ys extends ur{constructor(){super()}updateIM(t){for(let e=this.iterator();e.hasNext();)e.next().updateIM(t)}insert(t){let e=this._edgeMap.get(t);null===e?(e=new ms(t),this.insertEdgeEnd(t,e)):e.insert(t)}}class vs extends zi{constructor(){super(),vs.constructor_.apply(this,arguments)}static constructor_(){const t=arguments[0],e=arguments[1];zi.constructor_.call(this,t,e)}updateIMFromEdges(t){this._edges.updateIM(t)}computeIM(t){t.setAtLeastIfValid(this._label.getLocation(0),this._label.getLocation(1),0)}}class xs extends Wi{constructor(){super()}createNode(t){return new vs(t,new ys)}}class Es{constructor(){Es.constructor_.apply(this,arguments)}static constructor_(){this._nodes=new qi(new xs)}insertEdgeEnds(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this._nodes.add(t)}}getNodeIterator(){return this._nodes.iterator()}copyNodesAndLabels(t,e){for(let i=t.getNodeIterator();i.hasNext();){const t=i.next();this._nodes.addNode(t.getCoordinate()).setLabel(e,t.getLabel().getLocation(e))}}build(t){this.computeIntersectionNodes(t,0),this.copyNodesAndLabels(t,0);const e=(new fs).computeEdgeEnds(t.getEdgeIterator());this.insertEdgeEnds(e)}computeIntersectionNodes(t,e){for(let i=t.getEdgeIterator();i.hasNext();){const t=i.next(),n=t.getLabel().getLocation(e);for(let i=t.getEdgeIntersectionList().iterator();i.hasNext();){const t=i.next(),r=this._nodes.addNode(t.coord);n===Bt.BOUNDARY?r.setLabelBoundary(e):r.getLabel().isNull(e)&&r.setLabel(e,Bt.INTERIOR)}}}}class Is{constructor(){Is.constructor_.apply(this,arguments)}static constructor_(){this._li=new kt,this._geomGraph=null,this._nodeGraph=new Es,this._invalidPoint=null;const t=arguments[0];this._geomGraph=t}isNodeEdgeAreaLabelsConsistent(){for(let t=this._nodeGraph.getNodeIterator();t.hasNext();){const e=t.next();if(!e.getEdges().isAreaLabelsConsistent(this._geomGraph))return this._invalidPoint=e.getCoordinate().copy(),!1}return!0}getInvalidPoint(){return this._invalidPoint}hasDuplicateRings(){for(let t=this._nodeGraph.getNodeIterator();t.hasNext();)for(let e=t.next().getEdges().iterator();e.hasNext();){const t=e.next();if(t.getEdgeEnds().size()>1)return this._invalidPoint=t.getEdge().getCoordinate(0),!0}return!1}isNodeConsistentArea(){const t=this._geomGraph.computeSelfNodes(this._li,!0,!0);return t.hasProperIntersection()?(this._invalidPoint=t.getProperIntersectionPoint(),!1):(this._nodeGraph.build(this._geomGraph),this.isNodeEdgeAreaLabelsConsistent())}}class Cs{constructor(){Cs.constructor_.apply(this,arguments)}static constructor_(){this._graph=null,this._rings=new C,this._totalEnv=new L,this._index=null,this._nestedPt=null;const t=arguments[0];this._graph=t}buildIndex(){this._index=new xn;for(let t=0;t=1&&(e=t.getCoordinateN(0)),this._validErr=new ws(ws.RING_NOT_CLOSED,e)}}checkShellsNotNested(t,e){for(let i=0;i=0;e--)i.add(t[e],!1)}static findEdgeRingContaining(t,e){const i=t.getRing(),n=i.getEnvelopeInternal();let r=i.getCoordinateN(0),s=null,o=null;for(let t=e.iterator();t.hasNext();){const e=t.next(),a=e.getRing().getEnvelopeInternal();a.equals(n)||a.contains(n)&&(r=gt.ptNotInList(i.getCoordinates(),e.getCoordinates()),e.isInRing(r)&&(null===s||o.contains(a))&&(s=e,o=s.getRing().getEnvelopeInternal()))}return s}isIncluded(){return this._isIncluded}getCoordinates(){if(null===this._ringPts){const t=new S;for(let e=this._deList.iterator();e.hasNext();){const i=e.next(),n=i.getEdge();Ts.addEdge(n.getLine().getCoordinates(),i.getEdgeDirection(),t)}this._ringPts=t.toCoordinateArray()}return this._ringPts}isIncludedSet(){return this._isIncludedSet}isValid(){return this.getCoordinates(),!(this._ringPts.length<=3)&&(this.getRing(),Ss.isValid(this._ring))}build(t){let e=t;do{this.add(e),e.setRing(this),e=e.getNext(),d.isTrue(null!==e,"found null DE in ring"),d.isTrue(e===t||!e.isInRing(),"found DE already in ring")}while(e!==t)}isInRing(t){return Bt.EXTERIOR!==this.getLocator().locate(t)}isOuterHole(){return!!this._isHole&&!this.hasShell()}getPolygon(){let t=null;if(null!==this._holes){t=new Array(this._holes.size()).fill(null);for(let e=0;e=0)continue;e.add(t);const r=Ts.findDirEdgesInRing(t);Ls.label(r,i),i++}return e}static getDegreeNonDeleted(t){let e=0;for(let i=t.getOutEdges().getEdges().iterator();i.hasNext();)i.next().isMarked()||e++;return e}static deleteAllEdges(t){for(let e=t.getOutEdges().getEdges().iterator();e.hasNext();){const t=e.next();t.setMarked(!0);const i=t.getSym();null!==i&&i.setMarked(!0)}}static label(t,e){for(let i=t.iterator();i.hasNext();)i.next().setLabel(e)}static computeNextCWEdges(t){let e=null,i=null;for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();){const t=n.next();t.isMarked()||(null===e&&(e=t),null!==i&&i.getSym().setNext(t),i=t)}null!==i&&i.getSym().setNext(e)}static computeNextCCWEdges(t,e){let i=null,n=null;const r=t.getOutEdges().getEdges();for(let t=r.size()-1;t>=0;t--){const s=r.get(t),o=s.getSym();let a=null;s.getLabel()===e&&(a=s);let l=null;o.getLabel()===e&&(l=o),null===a&&null===l||(null!==l&&(n=l),null!==a&&(null!==n&&(n.setNext(a),n=null),null===i&&(i=a)))}null!==n&&(d.isTrue(null!==i),n.setNext(i))}static getDegree(t,e){let i=0;for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();)n.next().getLabel()===e&&i++;return i}static findIntersectionNodes(t,e){let i=t,n=null;do{const r=i.getFromNode();Ls.getDegree(r,e)>1&&(null===n&&(n=new C),n.add(r)),i=i.getNext(),d.isTrue(null!==i,"found null DE in ring"),d.isTrue(i===t||!i.isInRing(),"found DE already in ring")}while(i!==t);return n}findEdgeRing(t){const e=new Ts(this._factory);return e.build(t),e}computeDepthParity(){if(0===arguments.length)for(;;)return null}computeNextCWEdges(){for(let t=this.nodeIterator();t.hasNext();){const e=t.next();Ls.computeNextCWEdges(e)}}addEdge(t){if(t.isEmpty())return null;const e=gt.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return null;const i=e[0],n=e[e.length-1],r=this.getNode(i),s=this.getNode(n),o=new gs(r,s,e[1],!0),a=new gs(s,r,e[e.length-2],!1),l=new _s(t);l.setDirectedEdges(o,a),this.add(l)}deleteCutEdges(){this.computeNextCWEdges(),Ls.findLabeledEdgeRings(this._dirEdges);const t=new C;for(let e=this._dirEdges.iterator();e.hasNext();){const i=e.next();if(i.isMarked())continue;const n=i.getSym();if(i.getLabel()===n.getLabel()){i.setMarked(!0),n.setMarked(!0);const e=i.getEdge();t.add(e.getLine())}}return t}getEdgeRings(){this.computeNextCWEdges(),Ls.label(this._dirEdges,-1);const t=Ls.findLabeledEdgeRings(this._dirEdges);this.convertMaximalToMinimalEdgeRings(t);const e=new C;for(let t=this._dirEdges.iterator();t.hasNext();){const i=t.next();if(i.isMarked())continue;if(i.isInRing())continue;const n=this.findEdgeRing(i);e.add(n)}return e}getNode(t){let e=this.findNode(t);return null===e&&(e=new kr(t),this.add(e)),e}convertMaximalToMinimalEdgeRings(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),i=t.getLabel(),n=Ls.findIntersectionNodes(t,i);if(null!==n)for(let t=n.iterator();t.hasNext();){const e=t.next();Ls.computeNextCCWEdges(e,i)}}}deleteDangles(){const t=this.findNodesOfDegree(1),e=new vt,i=new Xe;for(let e=t.iterator();e.hasNext();)i.push(e.next());for(;!i.isEmpty();){const t=i.pop();Ls.deleteAllEdges(t);for(let n=t.getOutEdges().getEdges().iterator();n.hasNext();){const t=n.next();t.setMarked(!0);const r=t.getSym();null!==r&&r.setMarked(!0);const s=t.getEdge();e.add(s.getLine());const o=t.getToNode();1===Ls.getDegreeNonDeleted(o)&&i.push(o)}}return e}}class Ns{constructor(){Ns.constructor_.apply(this,arguments)}static constructor_(){this._shells=null,this._shellIndex=null;const t=arguments[0];this._shells=t,this.buildIndex()}static assignHolesToShells(t,e){new Ns(e).assignHolesToShells(t)}assignHolesToShells(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.assignHoleToShell(t)}}buildIndex(){this._shellIndex=new xn;for(const t of this._shells)this._shellIndex.insert(t.getRing().getEnvelopeInternal(),t)}queryOverlappingShells(t){return this._shellIndex.query(t)}findShellContaining(t){const e=t.getRing().getEnvelopeInternal(),i=this.queryOverlappingShells(e);return Ts.findEdgeRingContaining(t,i)}assignHoleToShell(t){const e=this.findShellContaining(t);null!==e&&e.addHole(t)}}class Os{constructor(){Os.constructor_.apply(this,arguments)}static constructor_(){if(this._lineStringAdder=new Rs(this),this._graph=null,this._dangles=new C,this._cutEdges=new C,this._invalidRingLines=new C,this._holeList=null,this._shellList=null,this._polyList=null,this._isCheckingRingsValid=!0,this._extractOnlyPolygonal=null,this._geomFactory=null,0===arguments.length)Os.constructor_.call(this,!1);else if(1===arguments.length){const t=arguments[0];this._extractOnlyPolygonal=t}}static extractPolygons(t,e){const i=new C;for(let n=t.iterator();n.hasNext();){const t=n.next();(e||t.isIncluded())&&i.add(t.getPolygon())}return i}static findOuterShells(t){for(let e=t.iterator();e.hasNext();){const t=e.next(),i=t.getOuterHole();null===i||i.isProcessed()||(t.setIncluded(!0),i.setProcessed(!0))}}static findDisjointShells(t){Os.findOuterShells(t);let e=null;do{e=!1;for(let i=t.iterator();i.hasNext();){const t=i.next();t.isIncludedSet()||(t.updateIncluded(),t.isIncludedSet()||(e=!0))}}while(e)}getGeometry(){return null===this._geomFactory&&(this._geomFactory=new St),this.polygonize(),this._extractOnlyPolygonal?this._geomFactory.buildGeometry(this._polyList):this._geomFactory.createGeometryCollection(St.toGeometryArray(this._polyList))}getInvalidRingLines(){return this.polygonize(),this._invalidRingLines}findValidRings(t,e,i){for(let n=t.iterator();n.hasNext();){const t=n.next();t.isValid()?e.add(t):i.add(t.getLineString())}}polygonize(){if(null!==this._polyList)return null;if(this._polyList=new C,null===this._graph)return null;this._dangles=this._graph.deleteDangles(),this._cutEdges=this._graph.deleteCutEdges();const t=this._graph.getEdgeRings();let e=new C;this._invalidRingLines=new C,this._isCheckingRingsValid?this.findValidRings(t,e,this._invalidRingLines):e=t,this.findShellsAndHoles(e),Ns.assignHolesToShells(this._holeList,this._shellList),le.sort(this._shellList,new Ts.EnvelopeComparator);let i=!0;this._extractOnlyPolygonal&&(Os.findDisjointShells(this._shellList),i=!1),this._polyList=Os.extractPolygons(this._shellList,i)}getDangles(){return this.polygonize(),this._dangles}getCutEdges(){return this.polygonize(),this._cutEdges}getPolygons(){return this.polygonize(),this._polyList}add(){if(y(arguments[0],v))for(let t=arguments[0].iterator();t.hasNext();){const e=t.next();this.add(e)}else if(arguments[0]instanceof Z){const t=arguments[0];this._geomFactory=t.getFactory(),null===this._graph&&(this._graph=new Ls(this._geomFactory)),this._graph.addEdge(t)}else arguments[0]instanceof Y&&arguments[0].apply(this._lineStringAdder)}setCheckRingsValid(t){this._isCheckingRingsValid=t}findShellsAndHoles(t){this._holeList=new C,this._shellList=new C;for(let e=t.iterator();e.hasNext();){const t=e.next();t.computeHole(),t.isHole()?this._holeList.add(t):this._shellList.add(t)}}}class Rs{constructor(){Rs.constructor_.apply(this,arguments)}static constructor_(){this.p=null;const t=arguments[0];this.p=t}filter(t){t instanceof Z&&this.p.add(t)}get interfaces_(){return[B]}}Os.LineStringAdder=Rs;var Ps=Object.freeze({__proto__:null,Polygonizer:Os});class bs{constructor(){bs.constructor_.apply(this,arguments)}static constructor_(){this._li=new kt,this._ptLocator=new si,this._arg=null,this._nodes=new qi(new xs),this._im=null,this._isolatedEdges=new C,this._invalidPoint=null;const t=arguments[0];this._arg=t}insertEdgeEnds(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this._nodes.add(t)}}computeProperIntersectionIM(t,e){const i=this._arg[0].getGeometry().getDimension(),n=this._arg[1].getGeometry().getDimension(),r=t.hasProperIntersection(),s=t.hasProperInteriorIntersection();2===i&&2===n?r&&e.setAtLeast("212101212"):2===i&&1===n?(r&&e.setAtLeast("FFF0FFFF2"),s&&e.setAtLeast("1FFFFF1FF")):1===i&&2===n?(r&&e.setAtLeast("F0FFFFFF2"),s&&e.setAtLeast("1F1FFFFFF")):1===i&&1===n&&s&&e.setAtLeast("0FFFFFFFF")}labelIsolatedEdges(t,e){for(let i=this._arg[t].getEdgeIterator();i.hasNext();){const t=i.next();t.isIsolated()&&(this.labelIsolatedEdge(t,e,this._arg[e].getGeometry()),this._isolatedEdges.add(t))}}labelIsolatedEdge(t,e,i){if(i.getDimension()>0){const n=this._ptLocator.locate(t.getCoordinate(),i);t.getLabel().setAllLocations(e,n)}else t.getLabel().setAllLocations(e,Bt.EXTERIOR)}computeIM(){const t=new Yt;if(t.set(Bt.EXTERIOR,Bt.EXTERIOR,2),!this._arg[0].getGeometry().getEnvelopeInternal().intersects(this._arg[1].getGeometry().getEnvelopeInternal()))return this.computeDisjointIM(t),t;this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1);const e=this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!1);this.computeIntersectionNodes(0),this.computeIntersectionNodes(1),this.copyNodesAndLabels(0),this.copyNodesAndLabels(1),this.labelIsolatedNodes(),this.computeProperIntersectionIM(e,t);const i=new fs,n=i.computeEdgeEnds(this._arg[0].getEdgeIterator());this.insertEdgeEnds(n);const r=i.computeEdgeEnds(this._arg[1].getEdgeIterator());return this.insertEdgeEnds(r),this.labelNodeEdges(),this.labelIsolatedEdges(0,1),this.labelIsolatedEdges(1,0),this.updateIM(t),t}labelNodeEdges(){for(let t=this._nodes.iterator();t.hasNext();)t.next().getEdges().computeLabelling(this._arg)}copyNodesAndLabels(t){for(let e=this._arg[t].getNodeIterator();e.hasNext();){const i=e.next();this._nodes.addNode(i.getCoordinate()).setLabel(t,i.getLabel().getLocation(t))}}labelIntersectionNodes(t){for(let e=this._arg[t].getEdgeIterator();e.hasNext();){const i=e.next(),n=i.getLabel().getLocation(t);for(let e=i.getEdgeIntersectionList().iterator();e.hasNext();){const i=e.next(),r=this._nodes.find(i.coord);r.getLabel().isNull(t)&&(n===Bt.BOUNDARY?r.setLabelBoundary(t):r.setLabel(t,Bt.INTERIOR))}}}labelIsolatedNode(t,e){const i=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setAllLocations(e,i)}computeIntersectionNodes(t){for(let e=this._arg[t].getEdgeIterator();e.hasNext();){const i=e.next(),n=i.getLabel().getLocation(t);for(let e=i.getEdgeIntersectionList().iterator();e.hasNext();){const i=e.next(),r=this._nodes.addNode(i.coord);n===Bt.BOUNDARY?r.setLabelBoundary(t):r.getLabel().isNull(t)&&r.setLabel(t,Bt.INTERIOR)}}}labelIsolatedNodes(){for(let t=this._nodes.iterator();t.hasNext();){const e=t.next(),i=e.getLabel();d.isTrue(i.getGeometryCount()>0,"node with empty label found"),e.isIsolated()&&(i.isNull(0)?this.labelIsolatedNode(e,0):this.labelIsolatedNode(e,1))}}updateIM(t){for(let e=this._isolatedEdges.iterator();e.hasNext();)e.next().updateIM(t);for(let e=this._nodes.iterator();e.hasNext();){const i=e.next();i.updateIM(t),i.updateIMFromEdges(t)}}computeDisjointIM(t){const e=this._arg[0].getGeometry();e.isEmpty()||(t.set(Bt.INTERIOR,Bt.EXTERIOR,e.getDimension()),t.set(Bt.BOUNDARY,Bt.EXTERIOR,e.getBoundaryDimension()));const i=this._arg[1].getGeometry();i.isEmpty()||(t.set(Bt.EXTERIOR,Bt.INTERIOR,i.getDimension()),t.set(Bt.EXTERIOR,Bt.BOUNDARY,i.getBoundaryDimension()))}}class Ms{constructor(){Ms.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null;const t=arguments[0];this._rectEnv=t.getEnvelopeInternal()}static contains(t,e){return new Ms(t).contains(e)}isContainedInBoundary(t){if(t instanceof et)return!1;if(t instanceof J)return this.isPointContainedInBoundary(t);if(t instanceof Z)return this.isLineStringContainedInBoundary(t);for(let e=0;e0){const i=t;t=e,e=i}let n=!1;return e.y>t.y&&(n=!0),n?this._li.computeIntersection(t,e,this._diagDown0,this._diagDown1):this._li.computeIntersection(t,e,this._diagUp0,this._diagUp1),!!this._li.hasIntersection()}}class Fs{constructor(){Fs.constructor_.apply(this,arguments)}static constructor_(){this._rectangle=null,this._rectEnv=null;const t=arguments[0];this._rectangle=t,this._rectEnv=t.getEnvelopeInternal()}static intersects(t,e){return new Fs(t).intersects(e)}intersects(t){if(!this._rectEnv.intersects(t.getEnvelopeInternal()))return!1;const e=new Ds(this._rectEnv);if(e.applyTo(t),e.intersects())return!0;const i=new Gs(this._rectangle);if(i.applyTo(t),i.containsPoint())return!0;const n=new ks(this._rectangle);return n.applyTo(t),!!n.intersects()}}class Ds extends ue{constructor(){super(),Ds.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null,this._intersects=!1;const t=arguments[0];this._rectEnv=t}isDone(){return!0===this._intersects}visit(t){const e=t.getEnvelopeInternal();return this._rectEnv.intersects(e)?this._rectEnv.contains(e)||e.getMinX()>=this._rectEnv.getMinX()&&e.getMaxX()<=this._rectEnv.getMaxX()||e.getMinY()>=this._rectEnv.getMinY()&&e.getMaxY()<=this._rectEnv.getMaxY()?(this._intersects=!0,null):void 0:null}intersects(){return this._intersects}}class Gs extends ue{constructor(){super(),Gs.constructor_.apply(this,arguments)}static constructor_(){this._rectSeq=null,this._rectEnv=null,this._containsPoint=!1;const t=arguments[0];this._rectSeq=t.getExteriorRing().getCoordinateSequence(),this._rectEnv=t.getEnvelopeInternal()}isDone(){return!0===this._containsPoint}visit(t){if(!(t instanceof et))return null;const e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;const i=new f;for(let n=0;n<4;n++)if(this._rectSeq.getCoordinate(n,i),e.contains(i)&&Ge.containsPointInPolygon(i,t))return this._containsPoint=!0,null}containsPoint(){return this._containsPoint}}class ks extends ue{constructor(){super(),ks.constructor_.apply(this,arguments)}static constructor_(){this._rectEnv=null,this._rectIntersector=null,this._hasIntersection=!1,this._p0=new f,this._p1=new f;const t=arguments[0];this._rectEnv=t.getEnvelopeInternal(),this._rectIntersector=new As(this._rectEnv)}intersects(){return this._hasIntersection}isDone(){return!0===this._hasIntersection}visit(t){const e=t.getEnvelopeInternal();if(!this._rectEnv.intersects(e))return null;const i=ae.getLines(t);this.checkIntersectionWithLineStrings(i)}checkIntersectionWithLineStrings(t){for(let e=t.iterator();e.hasNext();){const t=e.next();if(this.checkIntersectionWithSegments(t),this._hasIntersection)return null}}checkIntersectionWithSegments(t){const e=t.getCoordinateSequence();for(let t=1;t0)&&!!t.getEnvelopeInternal().covers(e.getEnvelopeInternal())&&(!!t.isRectangle()||new Vs(t,e).getIntersectionMatrix().isCovers())}static intersects(t,e){if(!t.getEnvelopeInternal().intersects(e.getEnvelopeInternal()))return!1;if(t.isRectangle())return Fs.intersects(t,e);if(e.isRectangle())return Fs.intersects(e,t);if(t.isGeometryCollection()||e.isGeometryCollection()){for(let i=0;i0)&&!!t.getEnvelopeInternal().contains(e.getEnvelopeInternal())&&(t.isRectangle()?Ms.contains(t,e):new Vs(t,e).getIntersectionMatrix().isContains())}getIntersectionMatrix(){return this._relate.computeIM()}}var Bs=Object.freeze({__proto__:null,RelateOp:Vs});class Ys{constructor(){Ys.constructor_.apply(this,arguments)}static constructor_(){this._pointGeom=null,this._otherGeom=null,this._geomFact=null;const t=arguments[0],e=arguments[1];this._pointGeom=t,this._otherGeom=e,this._geomFact=e.getFactory()}static union(t,e){return new Ys(t,e).union()}union(){const t=new si,e=new rt;for(let i=0;ithis._dimension&&(this._dimension=t)}getDimension(){return this._dimension}filter(t){return this.recordDimension(t.getDimension()),t instanceof ot||t.isEmpty()?null:t instanceof et?(this._polygons.add(t),null):t instanceof Z?(this._lines.add(t),null):t instanceof J?(this._points.add(t),null):void d.shouldNeverReachHere("Unhandled geometry type: "+t.getGeometryType())}getExtract(t){switch(t){case 0:return this._points;case 1:return this._lines;case 2:return this._polygons}return d.shouldNeverReachHere("Invalid dimension: "+t),null}isEmpty(){return this._polygons.isEmpty()&&this._lines.isEmpty()&&this._points.isEmpty()}add(){if(y(arguments[0],v)){const t=arguments[0];for(const e of t)this.add(e)}else if(arguments[0]instanceof Y){const t=arguments[0];null===this._geomFactory&&(this._geomFactory=t.getFactory()),t.apply(this)}}get interfaces_(){return[H]}}class qs{constructor(){qs.constructor_.apply(this,arguments)}static constructor_(){this._geomFactory=null,this._g0=null,this._g1=null,this._isUnionSafe=null;const t=arguments[0],e=arguments[1];this._g0=t,this._g1=e,this._geomFactory=t.getFactory()}static containsProperly(){if(2===arguments.length){const t=arguments[0],e=arguments[1];return!t.isNull()&&e.getX()>t.getMinX()&&e.getX()t.getMinY()&&e.getY()=t.size()?null:t.get(e)}static union(t){return new Xs(t).union()}reduceToGeometries(t){const e=new C;for(let i=t.iterator();i.hasNext();){const t=i.next();let n=null;y(t,E)?n=this.unionTree(t):t instanceof Y&&(n=t),e.add(n)}return e}union(){if(null===this._inputPolys)throw new IllegalStateException("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();const t=new xn(Xs.STRTREE_NODE_CAPACITY);for(let e=this._inputPolys.iterator();e.hasNext();){const i=e.next();t.insert(i.getEnvelopeInternal(),i)}this._inputPolys=null;const e=t.itemsTree();return this.unionTree(e)}binaryUnion(){if(1===arguments.length){const t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];if(i-e<=1){const i=Xs.getGeometry(t,e);return this.unionSafe(i,null)}if(i-e==2)return this.unionSafe(Xs.getGeometry(t,e),Xs.getGeometry(t,e+1));{const n=Math.trunc((i+e)/2),r=this.binaryUnion(t,e,n),s=this.binaryUnion(t,n,i);return this.unionSafe(r,s)}}}repeatedUnion(t){let e=null;for(let i=t.iterator();i.hasNext();){const t=i.next();e=null===e?t.copy():e.union(t)}return e}unionSafe(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionActual(t,e)}unionActual(t,e){const i=qs.union(t,e);return Xs.restrictToPolygons(i)}unionTree(t){const e=this.reduceToGeometries(t);return this.binaryUnion(e)}bufferUnion(){if(1===arguments.length){const t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return t.getFactory().createGeometryCollection([t,e]).buffer(0)}}}Xs.STRTREE_NODE_CAPACITY=4;class js{constructor(){js.constructor_.apply(this,arguments)}static constructor_(){if(this._geomFact=null,this._extracter=null,1===arguments.length){if(y(arguments[0],v)){const t=arguments[0];this.extract(t)}else if(arguments[0]instanceof Y){const t=arguments[0];this.extract(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._geomFact=e,this.extract(t)}}static union(){if(1===arguments.length){if(y(arguments[0],v))return new js(arguments[0]).union();if(arguments[0]instanceof Y)return new js(arguments[0]).union()}else if(2===arguments.length)return new js(arguments[0],arguments[1]).union()}unionNoOpt(t){const e=this._geomFact.createPoint();return hs.overlayOp(t,e,us.UNION)}unionWithNull(t,e){return null===t&&null===e?null:null===e?t:null===t?e:t.union(e)}extract(){if(y(arguments[0],v)){const t=arguments[0];this._extracter=zs.extract(t)}else if(arguments[0]instanceof Y){const t=arguments[0];this._extracter=zs.extract(t)}}union(){if(null===this._geomFact&&(this._geomFact=this._extracter.getFactory()),null===this._geomFact)return null;if(this._extracter.isEmpty())return this._geomFact.createEmpty(this._extracter.getDimension());const t=this._extracter.getExtract(0),e=this._extracter.getExtract(1),i=this._extracter.getExtract(2);let n=null;if(t.size()>0){const e=this._geomFact.buildGeometry(t);n=this.unionNoOpt(e)}let r=null;if(e.size()>0){const t=this._geomFact.buildGeometry(e);r=this.unionNoOpt(t)}let s=null;i.size()>0&&(s=Xs.union(i));const o=this.unionWithNull(r,s);let a=null;return a=null===n?o:null===o?n:Ys.union(n,o),null===a?this._geomFact.createGeometryCollection():a}}var Us=Object.freeze({__proto__:null,UnaryUnionOp:js}),Ws=Object.freeze({__proto__:null,IsValidOp:Ss,ConsistentAreaTester:Is}),Hs=Object.freeze({__proto__:null,BoundaryOp:Un,IsSimpleOp:Hn,buffer:Lr,distance:Pr,linemerge:Wr,overlay:ds,polygonize:Ps,relate:Bs,union:Us,valid:Ws});class Zs extends te.CoordinateOperation{constructor(){super(),Zs.constructor_.apply(this,arguments)}static constructor_(){this._targetPM=null,this._removeCollapsed=!0;const t=arguments[0],e=arguments[1];this._targetPM=t,this._removeCollapsed=e}edit(){if(2===arguments.length&&arguments[1]instanceof Y&&arguments[0]instanceof Array){const t=arguments[0],e=arguments[1];if(0===t.length)return null;const i=new Array(t.length).fill(null);for(let e=0;e=2&&(i=!0),e.edit(t,new Zs(this._targetPM,i))}changePM(t,e){return this.createEditor(t.getFactory(),e).edit(t,new te.NoOpGeometryOperation)}setRemoveCollapsedComponents(t){this._removeCollapsed=t}createFactory(t,e){return new St(e,t.getSRID(),t.getCoordinateSequenceFactory())}setChangePrecisionModel(t){this._changePrecisionModel=t}reduce(t){const e=this.reducePointwise(t);return this._isPointwise?e:y(e,tt)?Ss.isValid(e)?e:this.fixPolygonalTopology(e):e}setPointwise(t){this._isPointwise=t}createEditor(t,e){if(t.getPrecisionModel()===e)return new te;const i=this.createFactory(t,e);return new te(i)}}var Js=Object.freeze({__proto__:null,GeometryPrecisionReducer:Ks});class $s{constructor(){$s.constructor_.apply(this,arguments)}static constructor_(){this._pts=null,this._usePt=null,this._distanceTolerance=null,this._seg=new Vt;const t=arguments[0];this._pts=t}static simplify(t,e){const i=new $s(t);return i.setDistanceTolerance(e),i.simplify()}simplifySection(t,e){if(t+1===e)return null;this._seg.p0=this._pts[t],this._seg.p1=this._pts[e];let i=-1,n=t;for(let r=t+1;ri&&(i=t,n=r)}if(i<=this._distanceTolerance)for(let i=t+1;i=e[0]&&nthis._distanceTolerance&&(r=!1);const a=new Vt;if(a.p0=this._linePts[t],a.p1=this._linePts[e],n[0]=t,n[1]=e,this.hasBadIntersection(this._line,n,a)&&(r=!1),r){const i=this.flatten(t,e);return this._line.addToResult(i),null}this.simplifySection(t,o,i),this.simplifySection(o,e,i)}hasBadOutputIntersection(t){for(let e=this._outputIndex.query(t).iterator();e.hasNext();){const i=e.next();if(this.hasInteriorIntersection(i,t))return!0}return!1}findFurthestPoint(t,e,i,n){const r=new Vt;r.p0=t[e],r.p1=t[i];let s=-1,o=e;for(let n=e+1;ns&&(s=i,o=n)}return n[0]=s,o}simplify(t){this._line=t,this._linePts=t.getParentCoordinates(),this.simplifySection(0,this._linePts.length-1,0)}remove(t,e,i){for(let n=e;nn&&(o=n),r.setMinimumLength(o),r.splitAt(s),r.getSplitPoint()}get interfaces_(){return[mo]}}class vo{static triArea(t,e,i){return(e.x-t.x)*(i.y-t.y)-(e.y-t.y)*(i.x-t.x)}static isInCircleDDNormalized(t,e,i,n){const r=P.valueOf(t.x).selfSubtract(n.x),s=P.valueOf(t.y).selfSubtract(n.y),o=P.valueOf(e.x).selfSubtract(n.x),a=P.valueOf(e.y).selfSubtract(n.y),l=P.valueOf(i.x).selfSubtract(n.x),h=P.valueOf(i.y).selfSubtract(n.y),c=r.multiply(a).selfSubtract(o.multiply(s)),u=o.multiply(h).selfSubtract(l.multiply(a)),d=l.multiply(s).selfSubtract(r.multiply(h)),g=r.multiply(r).selfAdd(s.multiply(s)),_=o.multiply(o).selfAdd(a.multiply(a)),p=l.multiply(l).selfAdd(h.multiply(h));return g.selfMultiply(u).selfAdd(_.selfMultiply(d)).selfAdd(p.selfMultiply(c)).doubleValue()>0}static checkRobustInCircle(t,e,i,n){const r=vo.isInCircleNonRobust(t,e,i,n),s=vo.isInCircleDDSlow(t,e,i,n),o=vo.isInCircleCC(t,e,i,n),a=jt.circumcentre(t,e,i);D.out.println("p radius diff a = "+Math.abs(n.distance(a)-t.distance(a))/t.distance(a)),r===s&&r===o||(D.out.println("inCircle robustness failure (double result = "+r+", DD result = "+s+", CC result = "+o+")"),D.out.println(Dt.toLineString(new pt([t,e,i,n]))),D.out.println("Circumcentre = "+Dt.toPoint(a)+" radius = "+t.distance(a)),D.out.println("p radius diff a = "+Math.abs(n.distance(a)/t.distance(a)-1)),D.out.println("p radius diff b = "+Math.abs(n.distance(a)/e.distance(a)-1)),D.out.println("p radius diff c = "+Math.abs(n.distance(a)/i.distance(a)-1)),D.out.println())}static isInCircleDDFast(t,e,i,n){const r=P.sqr(t.x).selfAdd(P.sqr(t.y)).selfMultiply(vo.triAreaDDFast(e,i,n)),s=P.sqr(e.x).selfAdd(P.sqr(e.y)).selfMultiply(vo.triAreaDDFast(t,i,n)),o=P.sqr(i.x).selfAdd(P.sqr(i.y)).selfMultiply(vo.triAreaDDFast(t,e,n)),a=P.sqr(n.x).selfAdd(P.sqr(n.y)).selfMultiply(vo.triAreaDDFast(t,e,i));return r.selfSubtract(s).selfAdd(o).selfSubtract(a).doubleValue()>0}static isInCircleCC(t,e,i,n){const r=jt.circumcentre(t,e,i),s=t.distance(r);return n.distance(r)-s<=0}static isInCircleNormalized(t,e,i,n){const r=t.x-n.x,s=t.y-n.y,o=e.x-n.x,a=e.y-n.y,l=i.x-n.x,h=i.y-n.y;return(r*r+s*s)*(o*h-l*a)+(o*o+a*a)*(l*s-r*h)+(l*l+h*h)*(r*a-o*s)>0}static isInCircleDDSlow(t,e,i,n){const r=P.valueOf(n.x),s=P.valueOf(n.y),o=P.valueOf(t.x),a=P.valueOf(t.y),l=P.valueOf(e.x),h=P.valueOf(e.y),c=P.valueOf(i.x),u=P.valueOf(i.y),d=o.multiply(o).add(a.multiply(a)).multiply(vo.triAreaDDSlow(l,h,c,u,r,s)),g=l.multiply(l).add(h.multiply(h)).multiply(vo.triAreaDDSlow(o,a,c,u,r,s)),_=c.multiply(c).add(u.multiply(u)).multiply(vo.triAreaDDSlow(o,a,l,h,r,s)),p=r.multiply(r).add(s.multiply(s)).multiply(vo.triAreaDDSlow(o,a,l,h,c,u));return d.subtract(g).add(_).subtract(p).doubleValue()>0}static isInCircleNonRobust(t,e,i,n){return(t.x*t.x+t.y*t.y)*vo.triArea(e,i,n)-(e.x*e.x+e.y*e.y)*vo.triArea(t,i,n)+(i.x*i.x+i.y*i.y)*vo.triArea(t,e,n)-(n.x*n.x+n.y*n.y)*vo.triArea(t,e,i)>0}static isInCircleRobust(t,e,i,n){return vo.isInCircleNormalized(t,e,i,n)}static triAreaDDSlow(t,e,i,n,r,s){return i.subtract(t).multiply(s.subtract(e)).subtract(n.subtract(e).multiply(r.subtract(t)))}static triAreaDDFast(t,e,i){const n=P.valueOf(e.x).selfSubtract(t.x).selfMultiply(P.valueOf(i.y).selfSubtract(t.y)),r=P.valueOf(e.y).selfSubtract(t.y).selfMultiply(P.valueOf(i.x).selfSubtract(t.x));return n.selfSubtract(r)}}class xo{constructor(){xo.constructor_.apply(this,arguments)}static constructor_(){if(this._p=null,1===arguments.length){const t=arguments[0];this._p=new f(t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];this._p=new f(t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._p=new f(t,e,i)}}static interpolateZ(){if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=e.distance(i),r=t.distance(e),s=i.getZ()-e.getZ();return e.getZ()+s*(r/n)}if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=e.x,s=e.y,o=i.x-r,a=n.x-r,l=i.y-s,h=n.y-s,c=o*h-a*l,u=t.x-r,d=t.y-s,g=(h*u-a*d)/c,_=(-l*u+o*d)/c;return e.getZ()+g*(i.getZ()-e.getZ())+_*(n.getZ()-e.getZ())}}circleCenter(t,e){const i=new xo(this.getX(),this.getY()),n=this.bisector(i,t),r=this.bisector(t,e),s=new Xt(n,r);let o=null;try{o=new xo(s.getX(),s.getY())}catch(n){if(!(n instanceof qt))throw n;D.err.println("a: "+i+" b: "+t+" c: "+e),D.err.println(n)}return o}dot(t){return this._p.x*t.getX()+this._p.y*t.getY()}magn(){return Math.sqrt(this._p.x*this._p.x+this._p.y*this._p.y)}getZ(){return this._p.getZ()}bisector(t,e){const i=e.getX()-t.getX(),n=e.getY()-t.getY(),r=new Xt(t.getX()+i/2,t.getY()+n/2,1),s=new Xt(t.getX()-n+i/2,t.getY()+i+n/2,1);return new Xt(r,s)}equals(){if(1===arguments.length){const t=arguments[0];return this._p.x===t.getX()&&this._p.y===t.getY()}if(2===arguments.length){const t=arguments[0],e=arguments[1];return this._p.distance(t.getCoordinate())0}getX(){return this._p.x}crossProduct(t){return this._p.x*t.getY()-this._p.y*t.getX()}setZ(t){this._p.setZ(t)}times(t){return new xo(t*this._p.x,t*this._p.y)}cross(){return new xo(this._p.y,-this._p.x)}leftOf(t){return this.isCCW(t.orig(),t.dest())}toString(){return"POINT ("+this._p.x+" "+this._p.y+")"}sub(t){return new xo(this._p.x-t.getX(),this._p.y-t.getY())}getY(){return this._p.y}classify(t,e){const i=e.sub(t),n=this.sub(t),r=i.crossProduct(n);return r>0?xo.LEFT:r<0?xo.RIGHT:i.getX()*n.getX()<0||i.getY()*n.getY()<0?xo.BEHIND:i.magn()0}insertSite(t){let e=this._subdiv.locate(t);if(this._subdiv.isVertexOfEdge(e,t))return e;this._subdiv.isOnEdge(e,t.getCoordinate())&&(e=e.oPrev(),this._subdiv.delete(e.oNext()));let i=this._subdiv.makeEdge(e.orig(),t);Io.splice(i,e);const n=i;do{i=this._subdiv.connect(e,i.sym()),e=i.oPrev()}while(e.lNext()!==n);for(;;){const r=e.oPrev();if(r.dest().rightOf(e)&&t.isInCircle(e.orig(),r.dest(),e.dest()))Io.swap(e),e=e.oPrev();else{if(e.oNext()===n)return i;e=e.oNext().lPrev()}}}insertSites(t){for(let e=t.iterator();e.hasNext();){const t=e.next();this.insertSite(t)}}}class wo{locate(t){}}class So{constructor(){So.constructor_.apply(this,arguments)}static constructor_(){this._subdiv=null,this._lastEdge=null;const t=arguments[0];this._subdiv=t,this.init()}init(){this._lastEdge=this.findEdge()}locate(t){this._lastEdge.isLive()||this.init();const e=this._subdiv.locateFromEdge(t,this._lastEdge);return this._lastEdge=e,e}findEdge(){return this._subdiv.getEdges().iterator().next()}get interfaces_(){return[wo]}}class To extends c{constructor(){super(),To.constructor_.apply(this,arguments)}static constructor_(){if(this._seg=null,1===arguments.length){if("string"==typeof arguments[0]){const t=arguments[0];c.constructor_.call(this,t)}else if(arguments[0]instanceof Vt){const t=arguments[0];c.constructor_.call(this,"Locate failed to converge (at edge: "+t+"). Possible causes include invalid Subdivision topology or very close sites"),this._seg=new Vt(t)}}else if(2===arguments.length){const t=arguments[0],e=arguments[1];c.constructor_.call(this,To.msgWithSpatial(t,e)),this._seg=new Vt(e)}}static msgWithSpatial(t,e){return null!==e?t+" [ "+e+" ]":t}getSegment(){return this._seg}}class Lo{visit(t){}}class No{constructor(){No.constructor_.apply(this,arguments)}static constructor_(){this._visitedKey=0,this._quadEdges=new C,this._startingEdge=null,this._tolerance=null,this._edgeCoincidenceTolerance=null,this._frameVertex=new Array(3).fill(null),this._frameEnv=null,this._locator=null,this._seg=new Vt,this._triEdges=new Array(3).fill(null);const t=arguments[0],e=arguments[1];this._tolerance=e,this._edgeCoincidenceTolerance=e/No.EDGE_COINCIDENCE_TOL_FACTOR,this.createFrame(t),this._startingEdge=this.initSubdiv(),this._locator=new So(this)}static getTriangleEdges(t,e){if(e[0]=t,e[1]=e[0].lNext(),e[2]=e[1].lNext(),e[2].lNext()!==e[0])throw new n("Edges do not form a triangle")}getTriangleVertices(t){const e=new Po;return this.visitTriangles(e,t),e.getTriangleVertices()}isFrameVertex(t){return!!t.equals(this._frameVertex[0])||!!t.equals(this._frameVertex[1])||!!t.equals(this._frameVertex[2])}isVertexOfEdge(t,e){return!(!e.equals(t.orig(),this._tolerance)&&!e.equals(t.dest(),this._tolerance))}connect(t,e){const i=Io.connect(t,e);return this._quadEdges.add(i),i}getVoronoiCellPolygon(t,e){const i=new C,n=t;do{const e=t.rot().orig().getCoordinate();i.add(e),t=t.oPrev()}while(t!==n);const r=new S;r.addAll(i,!1),r.closeRing(),r.size()<4&&(D.out.println(r),r.add(r.get(r.size()-1),!0));const s=r.toCoordinateArray(),o=e.createPolygon(e.createLinearRing(s)),a=n.orig();return o.setUserData(a.getCoordinate()),o}setLocator(t){this._locator=t}initSubdiv(){const t=this.makeEdge(this._frameVertex[0],this._frameVertex[1]),e=this.makeEdge(this._frameVertex[1],this._frameVertex[2]);Io.splice(t.sym(),e);const i=this.makeEdge(this._frameVertex[2],this._frameVertex[0]);return Io.splice(e.sym(),i),Io.splice(i.sym(),t),t}isFrameBorderEdge(t){const e=new Array(3).fill(null);No.getTriangleEdges(t,e);const i=new Array(3).fill(null);No.getTriangleEdges(t.sym(),i);const n=t.lNext().dest();if(this.isFrameVertex(n))return!0;const r=t.sym().lNext().dest();return!!this.isFrameVertex(r)}makeEdge(t,e){const i=Io.makeEdge(t,e);return this._quadEdges.add(i),i}visitTriangles(t,e){this._visitedKey++;const i=new Xe;i.push(this._startingEdge);const n=new vt;for(;!i.empty();){const r=i.pop();if(!n.contains(r)){const s=this.fetchTriangleToVisit(r,i,e,n);null!==s&&t.visit(s)}}}isFrameEdge(t){return!(!this.isFrameVertex(t.orig())&&!this.isFrameVertex(t.dest()))}isOnEdge(t,e){return this._seg.setCoordinates(t.orig().getCoordinate(),t.dest().getCoordinate()),this._seg.distance(e)i?10*e:10*i,this._frameVertex[0]=new xo((t.getMaxX()+t.getMinX())/2,t.getMaxY()+n),this._frameVertex[1]=new xo(t.getMinX()-n,t.getMinY()-n),this._frameVertex[2]=new xo(t.getMaxX()+n,t.getMinY()-n),this._frameEnv=new L(this._frameVertex[0].getCoordinate(),this._frameVertex[1].getCoordinate()),this._frameEnv.expandToInclude(this._frameVertex[2].getCoordinate())}getTriangleCoordinates(t){const e=new bo;return this.visitTriangles(e,t),e.getTriangles()}getVertices(t){const e=new vt;for(let i=this._quadEdges.iterator();i.hasNext();){const n=i.next(),r=n.orig();!t&&this.isFrameVertex(r)||e.add(r);const s=n.dest();!t&&this.isFrameVertex(s)||e.add(s)}return e}fetchTriangleToVisit(t,e,i,n){let r=t,s=0,o=!1;do{this._triEdges[s]=r,this.isFrameEdge(r)&&(o=!0);const t=r.sym();n.contains(t)||e.push(t),n.add(r),s++,r=r.lNext()}while(r!==t);return o&&!i?null:this._triEdges}getEdges(){if(0===arguments.length)return this._quadEdges;if(1===arguments.length){const t=arguments[0],e=this.getPrimaryEdges(!1),i=new Array(e.size()).fill(null);let n=0;for(let r=e.iterator();r.hasNext();){const e=r.next();i[n++]=t.createLineString([e.orig().getCoordinate(),e.dest().getCoordinate()])}return t.createMultiLineString(i)}}getVertexUniqueEdges(t){const e=new C,i=new vt;for(let n=this._quadEdges.iterator();n.hasNext();){const r=n.next(),s=r.orig();i.contains(s)||(i.add(s),!t&&this.isFrameVertex(s)||e.add(r));const o=r.sym(),a=o.orig();i.contains(a)||(i.add(a),!t&&this.isFrameVertex(a)||e.add(o))}return e}getTriangleEdges(t){const e=new Ro;return this.visitTriangles(e,t),e.getTriangleEdges()}getPrimaryEdges(t){this._visitedKey++;const e=new C,i=new Xe;i.push(this._startingEdge);const n=new vt;for(;!i.empty();){const r=i.pop();if(!n.contains(r)){const s=r.getPrimary();!t&&this.isFrameEdge(s)||e.add(s),i.push(r.oNext()),i.push(r.sym().oNext()),n.add(r),n.add(r.sym())}}return e}delete(t){Io.splice(t,t.oPrev()),Io.splice(t.sym(),t.sym().oPrev());const e=t.sym(),i=t.rot(),n=t.rot().sym();this._quadEdges.remove(t),this._quadEdges.remove(e),this._quadEdges.remove(i),this._quadEdges.remove(n),t.delete(),e.delete(),i.delete(),n.delete()}locateFromEdge(t,e){let i=0;const n=this._quadEdges.size();let r=e;for(;;){if(i++,i>n)throw new To(r.toLineSegment());if(t.equals(r.orig())||t.equals(r.dest()))break;if(t.rightOf(r))r=r.sym();else if(t.rightOf(r.oNext())){if(t.rightOf(r.dPrev()))break;r=r.dPrev()}else r=r.oNext()}return r}getTolerance(){return this._tolerance}getVoronoiCellPolygons(t){this.visitTriangles(new Oo,!0);const e=new C;for(let i=this.getVertexUniqueEdges(!1).iterator();i.hasNext();){const n=i.next();e.add(this.getVoronoiCellPolygon(n,t))}return e}getVoronoiDiagram(t){const e=this.getVoronoiCellPolygons(t);return t.createGeometryCollection(St.toGeometryArray(e))}getTriangles(t){const e=this.getTriangleCoordinates(!1),i=new Array(e.size()).fill(null);let n=0;for(let r=e.iterator();r.hasNext();){const e=r.next();i[n++]=t.createPolygon(t.createLinearRing(e))}return t.createGeometryCollection(i)}insertSite(t){let e=this.locate(t);if(t.equals(e.orig(),this._tolerance)||t.equals(e.dest(),this._tolerance))return e;let i=this.makeEdge(e.orig(),t);Io.splice(i,e);const n=i;do{i=this.connect(e,i.sym()),e=i.oPrev()}while(e.lNext()!==n);return n}locate(){if(1===arguments.length){if(arguments[0]instanceof xo){const t=arguments[0];return this._locator.locate(t)}if(arguments[0]instanceof f){const t=arguments[0];return this._locator.locate(new xo(t))}}else if(2===arguments.length){const t=arguments[0],e=arguments[1],i=this._locator.locate(new xo(t));if(null===i)return null;let n=i;i.dest().getCoordinate().equals2D(t)&&(n=i.sym());let r=n;do{if(r.dest().getCoordinate().equals2D(e))return r;r=r.oNext()}while(r!==n);return null}}}class Oo{visit(t){const e=t[0].orig().getCoordinate(),i=t[1].orig().getCoordinate(),n=t[2].orig().getCoordinate(),r=jt.circumcentreDD(e,i,n),s=new xo(r);for(let e=0;e<3;e++)t[e].rot().setOrig(s)}get interfaces_(){return[Lo]}}class Ro{constructor(){Ro.constructor_.apply(this,arguments)}static constructor_(){this._triList=new C}getTriangleEdges(){return this._triList}visit(t){this._triList.add(t)}get interfaces_(){return[Lo]}}class Po{constructor(){Po.constructor_.apply(this,arguments)}static constructor_(){this._triList=new C}visit(t){this._triList.add([t[0].orig(),t[1].orig(),t[2].orig()])}getTriangleVertices(){return this._triList}get interfaces_(){return[Lo]}}class bo{constructor(){bo.constructor_.apply(this,arguments)}static constructor_(){this._coordList=new S,this._triCoords=new C}checkTriangleSize(t){let e="";t.length>=2?e=Dt.toLineString(t[0],t[1]):t.length>=1&&(e=Dt.toPoint(t[0]))}visit(t){this._coordList.clear();for(let e=0;e<3;e++){const i=t[e].orig();this._coordList.add(i.getCoordinate())}if(this._coordList.size()>0){this._coordList.closeRing();const t=this._coordList.toCoordinateArray();if(4!==t.length)return null;this._triCoords.add(t)}}getTriangles(){return this._triCoords}get interfaces_(){return[Lo]}}No.TriangleCircumcentreVisitor=Oo,No.TriangleEdgesListVisitor=Ro,No.TriangleVertexListVisitor=Po,No.TriangleCoordinatesVisitor=bo,No.EDGE_COINCIDENCE_TOL_FACTOR=1e3;class Mo{constructor(){Mo.constructor_.apply(this,arguments)}static constructor_(){if(this._ls=null,this._data=null,2===arguments.length){const t=arguments[0],e=arguments[1];this._ls=new Vt(t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._ls=new Vt(t,e),this._data=i}else if(6===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[4],s=arguments[5];Mo.constructor_.call(this,new f(t,e,i),new f(n,r,s))}else if(7===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3],r=arguments[4],s=arguments[5],o=arguments[6];Mo.constructor_.call(this,new f(t,e,i),new f(n,r,s),o)}}getLineSegment(){return this._ls}getEndZ(){return this._ls.getCoordinate(1).getZ()}getStartZ(){return this._ls.getCoordinate(0).getZ()}intersection(t){return this._ls.intersection(t.getLineSegment())}getStart(){return this._ls.getCoordinate(0)}getEnd(){return this._ls.getCoordinate(1)}getEndY(){return this._ls.getCoordinate(1).y}getStartX(){return this._ls.getCoordinate(0).x}equalsTopo(t){return this._ls.equalsTopo(t.getLineSegment())}getStartY(){return this._ls.getCoordinate(0).y}setData(t){this._data=t}getData(){return this._data}getEndX(){return this._ls.getCoordinate(1).x}toString(){return this._ls.toString()}}class Ao extends c{constructor(){super(),Ao.constructor_.apply(this,arguments)}static constructor_(){if(this._pt=null,1===arguments.length){const t=arguments[0];c.constructor_.call(this,t)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];c.constructor_.call(this,Ao.msgWithCoord(t,e)),this._pt=new f(e)}}static msgWithCoord(t,e){return null!==e?t+" [ "+Dt.toPoint(e)+" ]":t}getCoordinate(){return this._pt}}class Fo{constructor(){Fo.constructor_.apply(this,arguments)}static constructor_(){this._initialVertices=null,this._segVertices=null,this._segments=new C,this._subdiv=null,this._incDel=null,this._convexHull=null,this._splitFinder=new yo,this._kdt=null,this._vertexFactory=null,this._computeAreaEnv=null,this._splitPt=null,this._tolerance=null;const t=arguments[0],e=arguments[1];this._initialVertices=new C(t),this._tolerance=e,this._kdt=new Qi(e)}static computeVertexEnvelope(t){const e=new L;for(let i=t.iterator();i.hasNext();){const t=i.next();e.expandToInclude(t.getCoordinate())}return e}getInitialVertices(){return this._initialVertices}getKDT(){return this._kdt}enforceConstraints(){this.addConstraintVertices();let t=0,e=0;do{e=this.enforceGabriel(this._segments),t++}while(e>0&&t0?t.getSegmentIndex()+1:t.getSegmentIndex()}getComponentIndex(){return this._componentIndex}getLine(){return this._currentLine}getVertexIndex(){return this._vertexIndex}getSegmentEnd(){return this._vertexIndex=this._currentLine.getNumPoints()&&(this._componentIndex++,this.loadCurrentLine(),this._vertexIndex=0)}loadCurrentLine(){if(this._componentIndex>=this._numLines)return this._currentLine=null,null;this._currentLine=this._linearGeom.getGeometryN(this._componentIndex)}getSegmentStart(){return this._currentLine.getCoordinateN(this._vertexIndex)}isEndOfLine(){return!(this._componentIndex>=this._numLines||this._vertexIndex=this._numLines||this._componentIndex===this._numLines-1&&this._vertexIndex>=this._currentLine.getNumPoints())}}class zo{constructor(){zo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indexOf(t,e){return new zo(t).indexOf(e)}static indexOfAfter(t,e,i){return new zo(t).indexOfAfter(e,i)}indexOf(t){return this.indexOfFromStart(t,-1)}indexOfFromStart(t,e){let i=s.MAX_VALUE,n=e,r=0;const o=new Vt,a=new Yo(this._linearGeom);for(;a.hasNext();){if(!a.isEndOfLine()){o.p0=a.getSegmentStart(),o.p1=a.getSegmentEnd();const s=o.distance(t),l=this.segmentNearestMeasure(o,t,r);se&&(n=l,i=s),r+=o.getLength()}a.next()}return n}indexOfAfter(t,e){if(e<0)return this.indexOf(t);const i=this._linearGeom.getLength();if(i=e,"computed index is before specified minimum index"),n}segmentNearestMeasure(t,e,i){const n=t.projectionFactor(e);return n<=0?i:n<=1?i+n*t.getLength():i+t.getLength()}}class qo{constructor(){qo.constructor_.apply(this,arguments)}static constructor_(){if(this._componentIndex=0,this._segmentIndex=0,this._segmentFraction=0,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this._componentIndex=t._componentIndex,this._segmentIndex=t._segmentIndex,this._segmentFraction=t._segmentFraction}else if(2===arguments.length){const t=arguments[0],e=arguments[1];qo.constructor_.call(this,0,t,e)}else if(3===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2];this._componentIndex=t,this._segmentIndex=e,this._segmentFraction=i,this.normalize()}else if(4===arguments.length){const t=arguments[0],e=arguments[1],i=arguments[2],n=arguments[3];this._componentIndex=t,this._segmentIndex=e,this._segmentFraction=i,n&&this.normalize()}}static getEndLocation(t){const e=new qo;return e.setToEnd(t),e}static pointAlongSegmentByFraction(t,e,i){if(i<=0)return t;if(i>=1)return e;const n=(e.x-t.x)*i+t.x,r=(e.y-t.y)*i+t.y,s=(e.getZ()-t.getZ())*i+t.getZ();return new f(n,r,s)}static compareLocationValues(t,e,i,n,r,s){return tn?1:er?1:is?1:0}static numSegments(t){const e=t.getNumPoints();return e<=1?0:e-1}getSegmentIndex(){return this._segmentIndex}getComponentIndex(){return this._componentIndex}isEndpoint(t){const e=t.getGeometryN(this._componentIndex),i=qo.numSegments(e);return this._segmentIndex>=i||this._segmentIndex===i-1&&this._segmentFraction>=1}isValid(t){if(this._componentIndex<0||this._componentIndex>=t.getNumGeometries())return!1;const e=t.getGeometryN(this._componentIndex);return!(this._segmentIndex<0||this._segmentIndex>e.getNumPoints()||this._segmentIndex===e.getNumPoints()&&0!==this._segmentFraction||this._segmentFraction<0||this._segmentFraction>1)}normalize(){this._segmentFraction<0&&(this._segmentFraction=0),this._segmentFraction>1&&(this._segmentFraction=1),this._componentIndex<0&&(this._componentIndex=0,this._segmentIndex=0,this._segmentFraction=0),this._segmentIndex<0&&(this._segmentIndex=0,this._segmentFraction=0),1===this._segmentFraction&&(this._segmentFraction=0,this._segmentIndex+=1)}toLowest(t){const e=t.getGeometryN(this._componentIndex),i=qo.numSegments(e);return this._segmentIndex=qo.numSegments(e))return i;const n=e.getCoordinateN(this._segmentIndex+1);return qo.pointAlongSegmentByFraction(i,n,this._segmentFraction)}getSegmentFraction(){return this._segmentFraction}getSegment(t){const e=t.getGeometryN(this._componentIndex),i=e.getCoordinateN(this._segmentIndex);if(this._segmentIndex>=qo.numSegments(e)){const t=e.getCoordinateN(e.getNumPoints()-2);return new Vt(t,i)}const n=e.getCoordinateN(this._segmentIndex+1);return new Vt(i,n)}clamp(t){if(this._componentIndex>=t.getNumGeometries())return this.setToEnd(t),null;if(this._segmentIndex>=t.getNumPoints()){const e=t.getGeometryN(this._componentIndex);this._segmentIndex=qo.numSegments(e),this._segmentFraction=1}}setToEnd(t){this._componentIndex=t.getNumGeometries()-1;const e=t.getGeometryN(this._componentIndex);this._segmentIndex=qo.numSegments(e),this._segmentFraction=0}compareTo(t){const e=t;return this._componentIndexe._componentIndex?1:this._segmentIndexe._segmentIndex?1:this._segmentFractione._segmentFraction?1:0}copy(){return new qo(this._componentIndex,this._segmentIndex,this._segmentFraction)}toString(){return"LinearLoc["+this._componentIndex+", "+this._segmentIndex+", "+this._segmentFraction+"]"}isOnSameSegment(t){return this._componentIndex===t._componentIndex&&(this._segmentIndex===t._segmentIndex||t._segmentIndex-this._segmentIndex==1&&0===t._segmentFraction||this._segmentIndex-t._segmentIndex==1&&0===this._segmentFraction)}snapToVertex(t,e){if(this._segmentFraction<=0||this._segmentFraction>=1)return null;const i=this.getSegmentLength(t),n=this._segmentFraction*i,r=i-n;n<=r&&nt?1:this._segmentIndexe?1:this._segmentFractioni?1:0}getSegmentLength(t){const e=t.getGeometryN(this._componentIndex);let i=this._segmentIndex;this._segmentIndex>=qo.numSegments(e)&&(i=e.getNumPoints()-2);const n=e.getCoordinateN(i),r=e.getCoordinateN(i+1);return n.distance(r)}isVertex(){return this._segmentFraction<=0||this._segmentFraction>=1}get interfaces_(){return[o]}}class Xo{constructor(){Xo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indexOf(t,e){return new Xo(t).indexOf(e)}static indexOfAfter(t,e,i){return new Xo(t).indexOfAfter(e,i)}indexOf(t){return this.indexOfFromStart(t,null)}indexOfFromStart(t,e){let i=s.MAX_VALUE,n=0,r=0,o=-1;const a=new Vt;for(let s=new Yo(this._linearGeom);s.hasNext();s.next())if(!s.isEndOfLine()){a.p0=s.getSegmentStart(),a.p1=s.getSegmentEnd();const l=a.distance(t),h=a.segmentFraction(t),c=s.getComponentIndex(),u=s.getVertexIndex();l=0,"computed location is before specified minimum location"),n}}class jo{constructor(){jo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static indicesOf(t,e){return new jo(t).indicesOf(e)}indicesOf(t){const e=t.getGeometryN(0).getCoordinateN(0),i=t.getGeometryN(t.getNumGeometries()-1),n=i.getCoordinateN(i.getNumPoints()-1),r=new Xo(this._linearGeom),s=new Array(2).fill(null);return s[0]=r.indexOf(e),0===t.getLength()?s[1]=s[0].copy():s[1]=r.indexOfAfter(n,s[0]),s}}class Uo{constructor(){Uo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}static getLength(t,e){return new Uo(t).getLength(e)}static getLocation(){if(2===arguments.length){const t=arguments[1];return new Uo(arguments[0]).getLocation(t)}if(3===arguments.length){const t=arguments[1],e=arguments[2];return new Uo(arguments[0]).getLocation(t,e)}}getLength(t){let e=0;const i=new Yo(this._linearGeom);for(;i.hasNext();){if(!i.isEndOfLine()){const n=i.getSegmentStart(),r=i.getSegmentEnd().distance(n);if(t.getComponentIndex()===i.getComponentIndex()&&t.getSegmentIndex()===i.getVertexIndex())return e+r*t.getSegmentFraction();e+=r}i.next()}return e}resolveHigher(t){if(!t.isEndpoint(this._linearGeom))return t;let e=t.getComponentIndex();if(e>=this._linearGeom.getNumGeometries()-1)return t;do{e++}while(et){const n=(t-e)/r,s=i.getComponentIndex(),o=i.getVertexIndex();return new qo(s,o,n)}e+=r}i.next()}return qo.getEndLocation(this._linearGeom)}}class Wo{constructor(){Wo.constructor_.apply(this,arguments)}static constructor_(){this._geomFact=null,this._lines=new C,this._coordList=null,this._ignoreInvalidLines=!1,this._fixInvalidLines=!1,this._lastPt=null;const t=arguments[0];this._geomFact=t}getGeometry(){return this.endLine(),this._geomFact.buildGeometry(this._lines)}getLastCoordinate(){return this._lastPt}endLine(){if(null===this._coordList)return null;if(this._ignoreInvalidLines&&this._coordList.size()<2)return this._coordList=null,null;const t=this._coordList.toCoordinateArray();let e=t;this._fixInvalidLines&&(e=this.validCoordinateSequence(t)),this._coordList=null;let i=null;try{i=this._geomFact.createLineString(e)}catch(t){if(!(t instanceof n))throw t;if(!this._ignoreInvalidLines)throw t}null!==i&&this._lines.add(i)}setFixInvalidLines(t){this._fixInvalidLines=t}add(){if(1===arguments.length){const t=arguments[0];this.add(t,!0)}else if(2===arguments.length){const t=arguments[0],e=arguments[1];null===this._coordList&&(this._coordList=new S),this._coordList.add(t,e),this._lastPt=t}}setIgnoreInvalidLines(t){this._ignoreInvalidLines=t}validCoordinateSequence(t){return t.length>=2?t:[t[0],t[0]]}}class Ho{constructor(){Ho.constructor_.apply(this,arguments)}static constructor_(){this._line=null;const t=arguments[0];this._line=t}static extract(t,e,i){return new Ho(t).extract(e,i)}computeLinear(t,e){const i=new Wo(this._line.getFactory());i.setFixInvalidLines(!0),t.isVertex()||i.add(t.getCoordinate(this._line));for(let n=new Yo(this._line,t);n.hasNext()&&!(e.compareLocationValues(n.getComponentIndex(),n.getVertexIndex(),0)<0);n.next()){const t=n.getSegmentStart();i.add(t),n.isEndOfLine()&&i.endLine()}return e.isVertex()||i.add(e.getCoordinate(this._line)),i.getGeometry()}computeLine(t,e){const i=this._line.getCoordinates(),n=new S;let r=t.getSegmentIndex();t.getSegmentFraction()>0&&(r+=1);let s=e.getSegmentIndex();1===e.getSegmentFraction()&&(s+=1),s>=i.length&&(s=i.length-1),t.isVertex()||n.add(t.getCoordinate(this._line));for(let t=r;t<=s;t++)n.add(i[t]);e.isVertex()||n.add(e.getCoordinate(this._line)),n.size()<=0&&n.add(t.getCoordinate(this._line));let o=n.toCoordinateArray();return o.length<=1&&(o=[o[0],o[0]]),this._line.getFactory().createLineString(o)}extract(t,e){return e.compareTo(t)<0?this.reverse(this.computeLinear(e,t)):this.computeLinear(t,e)}reverse(t){return y(t,X)?t.reverse():(d.shouldNeverReachHere("non-linear geometry encountered"),null)}}class Zo{constructor(){Zo.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t}clampIndex(t){const e=this.positiveIndex(t),i=this.getStartIndex();if(en?n:e}locationOf(){if(1===arguments.length){const t=arguments[0];return Uo.getLocation(this._linearGeom,t)}if(2===arguments.length){const t=arguments[0],e=arguments[1];return Uo.getLocation(this._linearGeom,t,e)}}project(t){return zo.indexOf(this._linearGeom,t)}positiveIndex(t){return t>=0?t:this._linearGeom.getLength()+t}extractPoint(){if(1===arguments.length){const t=arguments[0];return Uo.getLocation(this._linearGeom,t).getCoordinate(this._linearGeom)}if(2===arguments.length){const t=arguments[0],e=arguments[1],i=Uo.getLocation(this._linearGeom,t).toLowest(this._linearGeom);return i.getSegment(this._linearGeom).pointAlongOffset(i.getSegmentFraction(),e)}}isValidIndex(t){return t>=this.getStartIndex()&&t<=this.getEndIndex()}getEndIndex(){return this._linearGeom.getLength()}getStartIndex(){return 0}indexOfAfter(t,e){return zo.indexOfAfter(this._linearGeom,t,e)}extractLine(t,e){const i=this.clampIndex(t),n=this.clampIndex(e),r=i===n,s=this.locationOf(i,r),o=this.locationOf(n);return Ho.extract(this._linearGeom,s,o)}indexOf(t){return zo.indexOf(this._linearGeom,t)}indicesOf(t){const e=jo.indicesOf(this._linearGeom,t);return[Uo.getLength(this._linearGeom,e[0]),Uo.getLength(this._linearGeom,e[1])]}}class Ko{constructor(){Ko.constructor_.apply(this,arguments)}static constructor_(){this._linearGeom=null;const t=arguments[0];this._linearGeom=t,this.checkGeometryType()}clampIndex(t){const e=t.copy();return e.clamp(this._linearGeom),e}project(t){return Xo.indexOf(this._linearGeom,t)}checkGeometryType(){if(!(this._linearGeom instanceof Z||this._linearGeom instanceof wt))throw new n("Input geometry must be linear")}extractPoint(){if(1===arguments.length)return arguments[0].getCoordinate(this._linearGeom);if(2===arguments.length){const t=arguments[1],e=arguments[0].toLowest(this._linearGeom);return e.getSegment(this._linearGeom).pointAlongOffset(e.getSegmentFraction(),t)}}isValidIndex(t){return t.isValid(this._linearGeom)}getEndIndex(){return qo.getEndLocation(this._linearGeom)}getStartIndex(){return new qo}indexOfAfter(t,e){return Xo.indexOfAfter(this._linearGeom,t,e)}extractLine(t,e){return Ho.extract(this._linearGeom,t,e)}indexOf(t){return Xo.indexOf(this._linearGeom,t)}indicesOf(t){return jo.indicesOf(this._linearGeom,t)}}var Jo=Object.freeze({__proto__:null,LengthIndexedLine:Zo,LengthLocationMap:Uo,LinearGeometryBuilder:Wo,LinearIterator:Yo,LinearLocation:qo,LocationIndexedLine:Ko});class $o{static transform(t,e){const i=new C;for(let n=t.iterator();n.hasNext();)i.add(e.execute(n.next()));return i}static select(t,e){const i=new C;for(let n=t.iterator();n.hasNext();){const t=n.next();Boolean.TRUE.equals(e.execute(t))&&i.add(t)}return i}static apply(t,e){for(let i=t.iterator();i.hasNext();)e.execute(i.next())}}$o.Function=function(){};class Qo{constructor(){Qo.constructor_.apply(this,arguments)}static constructor_(){this.pts=null,this.n=0;const t=arguments[0];this.pts=new Array(t).fill(null)}filter(t){this.pts[this.n++]=t}getCoordinates(){return this.pts}get interfaces_(){return[z]}}class ta{constructor(){ta.constructor_.apply(this,arguments)}static constructor_(){this._n=0}filter(t){this._n++}getCount(){return this._n}get interfaces_(){return[z]}}class ea{constructor(){ea.constructor_.apply(this,arguments)}static constructor_(){this._counts=new Et}count(t){const e=this._counts.get(t);return null===e?0:e.count()}add(t){const e=this._counts.get(t);null===e?this._counts.put(t,new ia(1)):e.increment()}}class ia{constructor(){ia.constructor_.apply(this,arguments)}static constructor_(){if(this.count=0,0===arguments.length);else if(1===arguments.length){const t=arguments[0];this.count=t}}count(){return this.count}increment(){this.count++}}function na(){}function ra(){}function sa(){}ea.Counter=ia;class oa extends i{}function aa(){}class la{static chars(t,e){const i=new Array(e).fill(null);for(let n=0;n=0;){const t=r.substring(0,s);n.add(t),r=r.substring(s+i),s=r.indexOf(e)}r.length>0&&n.add(r);const o=new Array(n.size()).fill(null);for(let t=0;te)&&Rr.isWithinDistance(this,t,e)},Y.prototype.distance=function(t){return Rr.distance(this,t)},t.algorithm=li,t.densify=ui,t.dissolve=vi,t.geom=fe,t.geomgraph=Ki,t.index=Cn,t.io=On,t.linearref=Jo,t.noding=jn,t.operation=Hs,t.precision=Js,t.simplify=po,t.triangulate=Bo,t.util=ha,t.version="2.5.1 (8b99322)",Object.defineProperty(t,"__esModule",{value:!0})}(e)},11:function(t,e,i){"use strict";i.r(e),i.d(e,"VlCustomMap",(function(){return _l})),i.d(e,"VlMapWithActions",(function(){return gl})),i.d(e,"VlSnapInteraction",(function(){return wc})),i.d(e,"VlBoxSelectAction",(function(){return Fl})),i.d(e,"VlDeleteAction",(function(){return Dl})),i.d(e,"VlDrawAction",(function(){return Sc})),i.d(e,"VlDrawLineAction",(function(){return Tc})),i.d(e,"VlDrawPolygonAction",(function(){return Lc})),i.d(e,"VlDrawRectangleAction",(function(){return Nc})),i.d(e,"VlHighlightAction",(function(){return Oc})),i.d(e,"VlMapAction",(function(){return Ml})),i.d(e,"VlMeasureAction",(function(){return Rc})),i.d(e,"VlModifyAction",(function(){return Yc})),i.d(e,"VlModifyAndTranslateAction",(function(){return Hc})),i.d(e,"VlSelectAction",(function(){return Al})),i.d(e,"VlSelectActions",(function(){return Zc})),i.d(e,"VlShowInfoAction",(function(){return Jc})),i.d(e,"VlShowInfoSelectAction",(function(){return $c})),i.d(e,"VlSplitAction",(function(){return tu})),i.d(e,"VlTooltips",(function(){return Kc})),i.d(e,"VlTranslateAction",(function(){return eu})),i.d(e,"OlLayerGroup",(function(){return ko})),i.d(e,"OlVectorLayer",(function(){return Wh})),i.d(e,"OlTileLayer",(function(){return gu})),i.d(e,"OlOverlay",(function(){return qr})),i.d(e,"OlVectorSource",(function(){return hc})),i.d(e,"OlClusterSource",(function(){return pu})),i.d(e,"OlWMTSSource",(function(){return ad})),i.d(e,"OlWMTSTileGrid",(function(){return sd})),i.d(e,"OlFeature",(function(){return tt})),i.d(e,"OlPoint",(function(){return mn})),i.d(e,"OlGeometryType",(function(){return De})),i.d(e,"OlStyle",(function(){return Ll})),i.d(e,"OlStyleStroke",(function(){return El})),i.d(e,"OlStyleFill",(function(){return xl})),i.d(e,"OlStyleCircle",(function(){return vl})),i.d(e,"OlStyleText",(function(){return ld})),i.d(e,"OlProjection",(function(){return ue})),i.d(e,"OlGeoJSON",(function(){return Yn})),i.d(e,"OlExtent",(function(){return n})),i.d(e,"OlLoadingstrategy",(function(){return r}));var n={};i.r(n),i.d(n,"boundingExtent",(function(){return vt})),i.d(n,"buffer",(function(){return xt})),i.d(n,"clone",(function(){return Et})),i.d(n,"closestSquaredDistanceXY",(function(){return It})),i.d(n,"containsCoordinate",(function(){return Ct})),i.d(n,"containsExtent",(function(){return wt})),i.d(n,"containsXY",(function(){return St})),i.d(n,"coordinateRelationship",(function(){return Tt})),i.d(n,"createEmpty",(function(){return Lt})),i.d(n,"createOrUpdate",(function(){return Nt})),i.d(n,"createOrUpdateEmpty",(function(){return Ot})),i.d(n,"createOrUpdateFromCoordinate",(function(){return Rt})),i.d(n,"createOrUpdateFromCoordinates",(function(){return Pt})),i.d(n,"createOrUpdateFromFlatCoordinates",(function(){return bt})),i.d(n,"createOrUpdateFromRings",(function(){return Mt})),i.d(n,"equals",(function(){return At})),i.d(n,"approximatelyEquals",(function(){return Ft})),i.d(n,"extend",(function(){return Dt})),i.d(n,"extendCoordinate",(function(){return Gt})),i.d(n,"extendCoordinates",(function(){return kt})),i.d(n,"extendFlatCoordinates",(function(){return Vt})),i.d(n,"extendRings",(function(){return Bt})),i.d(n,"extendXY",(function(){return Yt})),i.d(n,"forEachCorner",(function(){return zt})),i.d(n,"getArea",(function(){return qt})),i.d(n,"getBottomLeft",(function(){return Xt})),i.d(n,"getBottomRight",(function(){return jt})),i.d(n,"getCenter",(function(){return Ut})),i.d(n,"getCorner",(function(){return Wt})),i.d(n,"getEnlargedArea",(function(){return Ht})),i.d(n,"getForViewAndSize",(function(){return Zt})),i.d(n,"getHeight",(function(){return Kt})),i.d(n,"getIntersectionArea",(function(){return Jt})),i.d(n,"getIntersection",(function(){return $t})),i.d(n,"getMargin",(function(){return Qt})),i.d(n,"getSize",(function(){return te})),i.d(n,"getTopLeft",(function(){return ee})),i.d(n,"getTopRight",(function(){return ie})),i.d(n,"getWidth",(function(){return ne})),i.d(n,"intersects",(function(){return re})),i.d(n,"isEmpty",(function(){return se})),i.d(n,"returnOrUpdate",(function(){return oe})),i.d(n,"scaleFromCenter",(function(){return ae})),i.d(n,"intersectsSegment",(function(){return le})),i.d(n,"applyTransform",(function(){return he})),i.d(n,"wrapX",(function(){return ce}));var r={};i.r(r),i.d(r,"all",(function(){return ic})),i.d(r,"bbox",(function(){return nc})),i.d(r,"tile",(function(){return rc}));var s=function(){function t(t){this.propagationStopped,this.type=t,this.target=null}return t.prototype.preventDefault=function(){this.propagationStopped=!0},t.prototype.stopPropagation=function(){this.propagationStopped=!0},t}(),o="propertychange",a=function(){function t(){this.disposed=!1}return t.prototype.dispose=function(){this.disposed||(this.disposed=!0,this.disposeInternal())},t.prototype.disposeInternal=function(){},t}();function l(t,e){return t>e?1:t=0}function c(t,e,i){var n=t.length;if(t[0]<=e)return 0;if(e<=t[n-1])return n-1;var r=void 0;if(i>0){for(r=1;r0)},e.prototype.removeEventListener=function(t,e){var i=this.listeners_&&this.listeners_[t];if(i){var n=i.indexOf(e);-1!==n&&(this.pendingRemovals_&&t in this.pendingRemovals_?(i[n]=f,++this.pendingRemovals_[t]):(i.splice(n,1),0===i.length&&delete this.listeners_[t]))}},e}(a),w="change",S="error",T="contextmenu",L="click",N="dblclick",O="keydown",R="keypress",P="load",b="resize",M="touchmove",A="wheel";function F(t,e,i,n,r){if(n&&n!==t&&(i=i.bind(n)),r){var s=i;i=function(){t.removeEventListener(e,i),s.apply(this,arguments)}}var o={target:t,type:e,listener:i};return t.addEventListener(e,i),o}function D(t,e,i,n){return F(t,e,i,n,!0)}function G(t){t&&t.target&&(t.target.removeEventListener(t.type,t.listener),y(t))}var k=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function V(t){if(Array.isArray(t))for(var e=0,i=t.length;er&&(l|=ft),as&&(l|=pt),l===gt&&(l=_t),l}function Lt(){return[1/0,1/0,-1/0,-1/0]}function Nt(t,e,i,n,r){return r?(r[0]=t,r[1]=e,r[2]=i,r[3]=n,r):[t,e,i,n]}function Ot(t){return Nt(1/0,1/0,-1/0,-1/0,t)}function Rt(t,e){var i=t[0],n=t[1];return Nt(i,n,i,n,e)}function Pt(t,e){return kt(Ot(e),t)}function bt(t,e,i,n,r){return Vt(Ot(r),t,e,i,n)}function Mt(t,e){return Bt(Ot(e),t)}function At(t,e){return t[0]==e[0]&&t[2]==e[2]&&t[1]==e[1]&&t[3]==e[3]}function Ft(t,e,i){return Math.abs(t[0]-e[0])t[2]&&(t[2]=e[2]),e[1]t[3]&&(t[3]=e[3]),t}function Gt(t,e){e[0]t[2]&&(t[2]=e[0]),e[1]t[3]&&(t[3]=e[1])}function kt(t,e){for(var i=0,n=e.length;ie[0]?n[0]=t[0]:n[0]=e[0],t[1]>e[1]?n[1]=t[1]:n[1]=e[1],t[2]=e[0]&&t[1]<=e[3]&&t[3]>=e[1]}function se(t){return t[2]=o&&p<=l),n||!(s&ft)||r&ft||(n=(f=g-(d-l)*_)>=a&&f<=h),n||!(s&mt)||r&mt||(n=(p=d-(g-a)/_)>=o&&p<=l),n||!(s&yt)||r&yt||(n=(f=g-(d-o)*_)>=a&&f<=h)}return n}function he(t,e,i,n){var r=[];if(n>1)for(var s=t[2]-t[0],o=t[3]-t[1],a=0;a=i[2])){var r=ne(i),s=Math.floor((n[0]-i[0])/r)*r;t[0]-=s,t[2]-=s}return t}var ue=function(){function t(t){this.code_=t.code,this.units_=t.units,this.extent_=void 0!==t.extent?t.extent:null,this.worldExtent_=void 0!==t.worldExtent?t.worldExtent:null,this.axisOrientation_=void 0!==t.axisOrientation?t.axisOrientation:"enu",this.global_=void 0!==t.global&&t.global,this.canWrapX_=!(!this.global_||!this.extent_),this.getPointResolutionFunc_=t.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=t.metersPerUnit}return t.prototype.canWrapX=function(){return this.canWrapX_},t.prototype.getCode=function(){return this.code_},t.prototype.getExtent=function(){return this.extent_},t.prototype.getUnits=function(){return this.units_},t.prototype.getMetersPerUnit=function(){return this.metersPerUnit_||it[this.units_]},t.prototype.getWorldExtent=function(){return this.worldExtent_},t.prototype.getAxisOrientation=function(){return this.axisOrientation_},t.prototype.isGlobal=function(){return this.global_},t.prototype.setGlobal=function(t){this.global_=t,this.canWrapX_=!(!t||!this.extent_)},t.prototype.getDefaultTileGrid=function(){return this.defaultTileGrid_},t.prototype.setDefaultTileGrid=function(t){this.defaultTileGrid_=t},t.prototype.setExtent=function(t){this.extent_=t,this.canWrapX_=!(!this.global_||!t)},t.prototype.setWorldExtent=function(t){this.worldExtent_=t},t.prototype.setGetPointResolution=function(t){this.getPointResolutionFunc_=t},t.prototype.getPointResolutionFunc=function(){return this.getPointResolutionFunc_},t}();function de(t,e,i){return Math.min(Math.max(t,e),i)}var ge="cosh"in Math?Math.cosh:function(t){var e=Math.exp(t);return(e+1/e)/2},_e="log2"in Math?Math.log2:function(t){return Math.log(t)*Math.LOG2E};function pe(t,e,i,n,r,s){var o=r-i,a=s-n;if(0!==o||0!==a){var l=((t-i)*o+(e-n)*a)/(o*o+a*a);l>1?(i=r,n=s):l>0&&(i+=o*l,n+=a*l)}return fe(t,e,i,n)}function fe(t,e,i,n){var r=i-t,s=n-e;return r*r+s*s}function me(t){return t*Math.PI/180}function ye(t,e){var i=t%e;return i*e<0?i+e:i}function ve(t,e,i){return t+i*(e-t)}var xe=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ee=6378137*Math.PI,Ie=[-Ee,-Ee,Ee,Ee],Ce=[-180,-85,180,85],we=function(t){function e(e){return t.call(this,{code:e,units:nt.METERS,extent:Ie,global:!0,worldExtent:Ce,getPointResolution:function(t,e){return t/ge(e[1]/6378137)}})||this}return xe(e,t),e}(ue),Se=[new we("EPSG:3857"),new we("EPSG:102100"),new we("EPSG:102113"),new we("EPSG:900913"),new we("urn:ogc:def:crs:EPSG:6.18:3:3857"),new we("urn:ogc:def:crs:EPSG::3857"),new we("http://www.opengis.net/gml/srs/epsg.xml#3857")];function Te(t,e,i){var n=t.length,r=i>1?i:2,s=e;void 0===s&&(s=r>2?t.slice():new Array(n));for(var o=Ee,a=0;ao?l=o:l<-o&&(l=-o),s[a+1]=l}return s}function Le(t,e,i){var n=t.length,r=i>1?i:2,s=e;void 0===s&&(s=r>2?t.slice():new Array(n));for(var o=0;o=1?(i=c,n=u):(i=l+_*d,n=h+_*g),[i,n]}function Be(t,e){for(var i=!0,n=t.length-1;n>=0;--n)if(t[n]!=e[n]){i=!1;break}return i}function Ye(t,e){var i=Math.cos(e),n=Math.sin(e),r=t[0]*i-t[1]*n,s=t[1]*i+t[0]*n;return t[0]=r,t[1]=s,t}function ze(t,e){return t[0]*=e,t[1]*=e,t}function qe(t,e){var i=t[0]-e[0],n=t[1]-e[1];return i*i+n*n}function Xe(t,e){return Math.sqrt(qe(t,e))}function je(t,e){return qe(t,Ve(t,e))}function Ue(t,e){if(e.canWrapX()){var i=ne(e.getExtent()),n=We(t,e,i);n&&(t[0]-=n*i)}return t}function We(t,e,i){var n=e.getExtent(),r=0;if(e.canWrapX()&&(t[0]n[2])){var s=i||ne(n);r=Math.floor((t[0]-n[0])/s)}return r}function He(t,e,i){var n;if(void 0!==e){for(var r=0,s=t.length;r1)a=i;else{if(d>0){for(var g=0;gr&&(r=h),s=a,o=l}return r}function zi(t,e,i,n,r){for(var s=0,o=i.length;s0;){for(var u=h.pop(),d=h.pop(),g=0,_=t[d],p=t[d+1],f=t[u],m=t[u+1],y=d+n;yg&&(c=y,g=v)}g>r&&(l[(c-e)/n]=1,d+n0&&p>g)&&(_<0&&f<_||_==f||_>0&&f>_)?(a=u,l=d):(s[o++]=a,s[o++]=l,h=a,c=l,a=u,l=d)}}return s[o++]=a,s[o++]=l,o}function $i(t,e,i,n,r,s,o,a){for(var l=0,h=i.length;l>1)],e))<0?o=n+1:(a=n,h=!r);return h?o:~o}(_,y);v<0?(h=(y-_[-v-2])/(_[-v-1]-_[-v-2]),a=e+(-v-2)*n):a=e+v*n}var x=o>1?o:2,E=s||new Array(x);for(p=0;p>1;rs&&(h-a)*(s-l)-(r-a)*(c-l)>0&&o++:c<=s&&(h-a)*(s-l)-(r-a)*(c-l)<0&&o--,a=h,l=c}return 0!==o}function ln(t,e,i,n,r,s){if(0===i.length)return!1;if(!an(t,e,i[0],n,r,s))return!1;for(var o=1,a=i.length;o=r[0]&&s[2]<=r[2]||(s[1]>=r[1]&&s[3]<=r[3]||Qi(t,e,i,n,(function(t,e){return le(r,t,e)})))))}function cn(t,e,i,n,r){if(!function(t,e,i,n,r){return!!hn(t,e,i,n,r)||(!!an(t,e,i,n,r[0],r[1])||(!!an(t,e,i,n,r[0],r[3])||(!!an(t,e,i,n,r[2],r[1])||!!an(t,e,i,n,r[2],r[3]))))}(t,e,i[0],n,r))return!1;if(1===i.length)return!0;for(var s=1,o=i.length;sE&&ln(t,e,i,n,c=(u+d)/2,p)&&(x=c,E=I),u=d}return isNaN(x)&&(x=r[s]),o?(o.push(x,p,E),o):[x,p,E]}function Sn(t,e,i,n){for(;es||(h==s&&l>=o||(r=a,s=h,o=l))}return r}(t,e,i,n),a=o-n;a=i&&(l=e);var h=t[a],c=t[a+1],u=t[o],d=t[o+1],g=t[l],_=t[l+1];return u*_+h*d+c*g-(c*u+d*g+h*_)<0}function Ln(t,e,i,n,r){for(var s=void 0!==r&&r,o=0,a=i.length;oc&&(c=h=(c+h)/2),u>d&&(d=u=(d+u)/2);var g=de(n[0],h,c),_=de(n[1],u,d),p=30*r;return o&&i&&(g+=-p*Math.log(1+Math.max(0,h-n[0])/p)+p*Math.log(1+Math.max(0,n[0]-c)/p),_+=-p*Math.log(1+Math.max(0,u-n[1])/p)+p*Math.log(1+Math.max(0,n[1]-d)/p)),[g,_]}}}function Hn(t){return t}function Zn(t,e,i,n){var r=ne(e)/i[0],s=Kt(e)/i[1];return n?Math.min(t,Math.max(r,s)):Math.min(t,Math.min(r,s))}function Kn(t,e,i){var n=Math.min(t,e);return n*=Math.log(1+50*Math.max(0,t/e-1))/50+1,i&&(n=Math.max(n,i),n/=Math.log(1+50*Math.max(0,i/t-1))/50+1),de(n,i/2,2*e)}function Jn(t,e,i,n,r){return function(s,o,a,l){if(void 0!==s){var h=n?Zn(t,n,a,r):t;return(void 0===i||i)&&l?Kn(s,h,e):de(s,e,h)}}}function $n(t){return void 0!==t?0:void 0}function Qn(t){return void 0!==t?t:void 0}function tr(t){return Math.pow(t,3)}function er(t){return 1-tr(1-t)}function ir(t){return 3*t*t-2*t*t*t}function nr(t){return t}var rr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function sr(t,e){setTimeout((function(){t(e)}),0)}function or(t){return!(t.sourceCenter&&t.targetCenter&&!Be(t.sourceCenter,t.targetCenter))&&(t.sourceResolution===t.targetResolution&&t.sourceRotation===t.targetRotation)}var ar=function(t){function e(e){var i=t.call(this)||this,n=m({},e);return i.hints_=[0,0],i.animations_=[],i.updateAnimationKey_,i.projection_=ti(n.projection,"EPSG:3857"),i.viewportSize_=[100,100],i.targetCenter_=null,i.targetResolution_,i.targetRotation_,i.cancelAnchor_=void 0,n.center&&(n.center=di(n.center,i.projection_)),n.extent&&(n.extent=_i(n.extent,i.projection_)),i.applyOptions_(n),i}return rr(e,t),e.prototype.applyOptions_=function(t){var e=function(t){var e,i,n,r=void 0!==t.minZoom?t.minZoom:0,s=void 0!==t.maxZoom?t.maxZoom:28,o=void 0!==t.zoomFactor?t.zoomFactor:2,a=void 0!==t.multiWorld&&t.multiWorld,l=void 0===t.smoothResolutionConstraint||t.smoothResolutionConstraint,h=void 0!==t.showFullExtent&&t.showFullExtent,u=ti(t.projection,"EPSG:3857"),d=u.getExtent(),g=t.constrainOnlyCenter,_=t.extent;a||_||!u.isGlobal()||(g=!1,_=d);if(void 0!==t.resolutions){var p=t.resolutions;i=p[r],n=void 0!==p[s]?p[s]:p[p.length-1],e=t.constrainResolution?function(t,e,i,n){return function(r,s,o,a){if(void 0!==r){var l=t[0],h=t[t.length-1],u=i?Zn(l,i,o,n):l;if(a)return void 0===e||e?Kn(r,u,h):de(r,h,u);var d=Math.min(u,r),g=Math.floor(c(t,d,s));return t[g]>u&&g1&&"function"==typeof arguments[i-1]&&(e=arguments[i-1],--i),!this.isDef()){var n=arguments[i-1];return n.center&&this.setCenterInternal(n.center),void 0!==n.zoom&&this.setZoom(n.zoom),void 0!==n.rotation&&this.setRotation(n.rotation),void(e&&sr(e,!0))}for(var r=Date.now(),s=this.targetCenter_.slice(),o=this.targetResolution_,a=this.targetRotation_,l=[],h=0;h0},e.prototype.getInteracting=function(){return this.hints_[qn]>0},e.prototype.cancelAnimations=function(){var t;this.setHint(zn,-this.hints_[zn]);for(var e=0,i=this.animations_.length;e=0;--i){for(var n=this.animations_[i],r=!0,s=0,o=n.length;s0?l/a.duration:1;h>=1?(a.complete=!0,h=1):r=!1;var c=a.easing(h);if(a.sourceCenter){var u=a.sourceCenter[0],d=a.sourceCenter[1],g=u+c*(a.targetCenter[0]-u),_=d+c*(a.targetCenter[1]-d);this.targetCenter_=[g,_]}if(a.sourceResolution&&a.targetResolution){var p=1===c?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){var f=this.getViewportSize_(this.getRotation()),m=this.constraints_.resolution(p,0,f,!0);this.targetCenter_=this.calculateCenterZoom(m,a.anchor)}this.targetResolution_=p,this.applyTargetState_(!0)}if(void 0!==a.sourceRotation&&void 0!==a.targetRotation){var y=1===c?ye(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){var v=this.constraints_.rotation(y,!0);this.targetCenter_=this.calculateCenterRotate(v,a.anchor)}this.targetRotation_=y}if(this.applyTargetState_(!0),e=!0,!a.complete)break}}if(r){this.animations_[i]=null,this.setHint(zn,-1);var x=n[0].callback;x&&sr(x,!0)}}this.animations_=this.animations_.filter(Boolean),e&&void 0===this.updateAnimationKey_&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}},e.prototype.calculateCenterRotate=function(t,e){var i,n=this.getCenterInternal();return void 0!==n&&(Ye(i=[n[0]-e[0],n[1]-e[1]],t-this.getRotation()),ke(i,e)),i},e.prototype.calculateCenterZoom=function(t,e){var i,n=this.getCenterInternal(),r=this.getResolution();void 0!==n&&void 0!==r&&(i=[e[0]-t*(e[0]-n[0])/r,e[1]-t*(e[1]-n[1])/r]);return i},e.prototype.getViewportSize_=function(t){var e=this.viewportSize_;if(t){var i=e[0],n=e[1];return[Math.abs(i*Math.cos(t))+Math.abs(n*Math.sin(t)),Math.abs(i*Math.sin(t))+Math.abs(n*Math.cos(t))]}return e},e.prototype.setViewportSize=function(t){this.viewportSize_=Array.isArray(t)?t.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)},e.prototype.getCenter=function(){var t=this.getCenterInternal();return t?ui(t,this.getProjection()):t},e.prototype.getCenterInternal=function(){return this.get(Xn)},e.prototype.getConstraints=function(){return this.constraints_},e.prototype.getConstrainResolution=function(){return this.options_.constrainResolution},e.prototype.getHints=function(t){return void 0!==t?(t[0]=this.hints_[0],t[1]=this.hints_[1],t):this.hints_.slice()},e.prototype.calculateExtent=function(t){return gi(this.calculateExtentInternal(t),this.getProjection())},e.prototype.calculateExtentInternal=function(t){var e=t||this.getViewportSize_(),i=this.getCenterInternal();$(i,1);var n=this.getResolution();$(void 0!==n,2);var r=this.getRotation();return $(void 0!==r,3),Zt(i,n,r,e)},e.prototype.getMaxResolution=function(){return this.maxResolution_},e.prototype.getMinResolution=function(){return this.minResolution_},e.prototype.getMaxZoom=function(){return this.getZoomForResolution(this.minResolution_)},e.prototype.setMaxZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({maxZoom:t}))},e.prototype.getMinZoom=function(){return this.getZoomForResolution(this.maxResolution_)},e.prototype.setMinZoom=function(t){this.applyOptions_(this.getUpdatedOptions_({minZoom:t}))},e.prototype.setConstrainResolution=function(t){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:t}))},e.prototype.getProjection=function(){return this.projection_},e.prototype.getResolution=function(){return this.get(jn)},e.prototype.getResolutions=function(){return this.resolutions_},e.prototype.getResolutionForExtent=function(t,e){return this.getResolutionForExtentInternal(_i(t,this.getProjection()),e)},e.prototype.getResolutionForExtentInternal=function(t,e){var i=e||this.getViewportSize_(),n=ne(t)/i[0],r=Kt(t)/i[1];return Math.max(n,r)},e.prototype.getResolutionForValueFunction=function(t){var e=t||2,i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/Math.log(e);return function(t){return i/Math.pow(e,t*r)}},e.prototype.getRotation=function(){return this.get(Un)},e.prototype.getValueForResolutionFunction=function(t){var e=Math.log(t||2),i=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(i/n)/e;return function(t){return Math.log(i/t)/e/r}},e.prototype.getState=function(){var t=this.getCenterInternal(),e=this.getProjection(),i=this.getResolution(),n=this.getRotation();return{center:t.slice(0),projection:void 0!==e?e:null,resolution:i,rotation:n,zoom:this.getZoom()}},e.prototype.getZoom=function(){var t,e=this.getResolution();return void 0!==e&&(t=this.getZoomForResolution(e)),t},e.prototype.getZoomForResolution=function(t){var e,i,n=this.minZoom_||0;if(this.resolutions_){var r=c(this.resolutions_,t,1);n=r,e=this.resolutions_[r],i=r==this.resolutions_.length-1?2:e/this.resolutions_[r+1]}else e=this.maxResolution_,i=this.zoomFactor_;return n+Math.log(e/t)/Math.log(i)},e.prototype.getResolutionForZoom=function(t){if(this.resolutions_){if(this.resolutions_.length<=1)return 0;var e=de(Math.floor(t),0,this.resolutions_.length-2),i=this.resolutions_[e]/this.resolutions_[e+1];return this.resolutions_[e]/Math.pow(i,de(t-e,0,1))}return this.maxResolution_/Math.pow(this.zoomFactor_,t-this.minZoom_)},e.prototype.fit=function(t,e){var i,n=m({size:this.getViewportSize_()},e||{});if($(Array.isArray(t)||"function"==typeof t.getSimplifiedGeometry,24),Array.isArray(t))$(!se(t),25),i=Mn(r=_i(t,this.getProjection()));else if(t.getType()===De.CIRCLE){var r;(i=Mn(r=_i(t.getExtent(),this.getProjection()))).rotate(this.getRotation(),Ut(r))}else{var s=ci();i=s?t.clone().transform(s,this.getProjection()):t}this.fitInternal(i,n)},e.prototype.fitInternal=function(t,e){var i=e||{},n=i.size;n||(n=this.getViewportSize_());var r,s=void 0!==i.padding?i.padding:[0,0,0,0],o=void 0!==i.nearest&&i.nearest;r=void 0!==i.minResolution?i.minResolution:void 0!==i.maxZoom?this.getResolutionForZoom(i.maxZoom):0;for(var a=t.getFlatCoordinates(),l=this.getRotation(),h=Math.cos(-l),c=Math.sin(-l),u=1/0,d=1/0,g=-1/0,_=-1/0,p=t.getStride(),m=0,y=a.length;m0?(e.getAnimating()&&e.cancelAnimations(),e.animate({zoom:n,duration:this.duration_,easing:er})):e.setZoom(n)}}},e}(jr),Hr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Zr=function(t){function e(e){var i=this,n=e||{};i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this;var r=void 0!==n.className?n.className:"ol-rotate",s=void 0!==n.label?n.label:"⇧";i.label_=null,"string"==typeof s?(i.label_=document.createElement("span"),i.label_.className="ol-compass",i.label_.textContent=s):(i.label_=s,i.label_.classList.add("ol-compass"));var o=n.tipLabel?n.tipLabel:"Reset rotation",a=document.createElement("button");a.className=r+"-reset",a.setAttribute("type","button"),a.title=o,a.appendChild(i.label_),a.addEventListener(L,i.handleClick_.bind(i),!1);var l=r+" ol-unselectable ol-control",h=i.element;return h.className=l,h.appendChild(a),i.callResetNorth_=n.resetNorth?n.resetNorth:void 0,i.duration_=void 0!==n.duration?n.duration:250,i.autoHide_=void 0===n.autoHide||n.autoHide,i.rotation_=void 0,i.autoHide_&&i.element.classList.add("ol-hidden"),i}return Hr(e,t),e.prototype.handleClick_=function(t){t.preventDefault(),void 0!==this.callResetNorth_?this.callResetNorth_():this.resetNorth_()},e.prototype.resetNorth_=function(){var t=this.getMap().getView();if(t){var e=t.getRotation();void 0!==e&&(this.duration_>0&&e%(2*Math.PI)!=0?t.animate({rotation:0,duration:this.duration_,easing:er}):t.setRotation(0))}},e.prototype.render=function(t){var e=t.frameState;if(e){var i=e.viewState.rotation;if(i!=this.rotation_){var n="rotate("+i+"rad)";if(this.autoHide_){var r=this.element.classList.contains("ol-hidden");r||0!==i?r&&0!==i&&this.element.classList.remove("ol-hidden"):this.element.classList.add("ol-hidden")}this.label_.style.transform=n}this.rotation_=i}},e}(jr),Kr=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Jr="degrees",$r="imperial",Qr="nautical",ts="metric",es="us",is=[1,2,5],ns=function(t){function e(e){var i=this,n=e||{},r=void 0!==n.className?n.className:n.bar?"ol-scale-bar":"ol-scale-line";return(i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).innerElement_=document.createElement("div"),i.innerElement_.className=r+"-inner",i.element.className=r+" ol-unselectable",i.element.appendChild(i.innerElement_),i.viewState_=null,i.minWidth_=void 0!==n.minWidth?n.minWidth:64,i.renderedVisible_=!1,i.renderedWidth_=void 0,i.renderedHTML_="",i.addEventListener(H("units"),i.handleUnitsChanged_),i.setUnits(n.units||ts),i.scaleBar_=n.bar||!1,i.scaleBarSteps_=n.steps||4,i.scaleBarText_=n.text||!1,i.dpi_=n.dpi||void 0,i}return Kr(e,t),e.prototype.getUnits=function(){return this.get("units")},e.prototype.handleUnitsChanged_=function(){this.updateElement_()},e.prototype.setUnits=function(t){this.set("units",t)},e.prototype.setDpi=function(t){this.dpi_=t},e.prototype.updateElement_=function(){var t=this.viewState_;if(t){var e=t.center,i=t.projection,n=this.getUnits(),r=n==Jr?nt.DEGREES:nt.METERS,s=$e(i,t.resolution,e,r),o=this.minWidth_*(this.dpi_||25.4/.28)/(25.4/.28),a=o*s,l="";if(n==Jr){var h=it[nt.DEGREES];(a*=h)=o)break;++_}g=this.scaleBar_?this.createScaleBar(u,c,l):c.toFixed(d<0?-d:0)+" "+l,this.renderedHTML_!=g&&(this.innerElement_.innerHTML=g,this.renderedHTML_=g),this.renderedWidth_!=u&&(this.innerElement_.style.width=u+"px",this.renderedWidth_=u),this.renderedVisible_||(this.element.style.display="",this.renderedVisible_=!0)}else this.renderedVisible_&&(this.element.style.display="none",this.renderedVisible_=!1)},e.prototype.createScaleBar=function(t,e,i){for(var n="1 : "+Math.round(this.getScaleForResolution()).toLocaleString(),r=[],s=t/this.scaleBarSteps_,o="#ffffff",a=0;a
'+this.createMarker("relative",a)+(a%2==0||2===this.scaleBarSteps_?this.createStepText(a,t,!1,e,i):"")+""),a===this.scaleBarSteps_-1&&r.push(this.createStepText(a+1,t,!0,e,i)),o="#ffffff"===o?"#000000":"#ffffff";return'
'+(this.scaleBarText_?'
'+n+"
":"")+r.join("")+"
"},e.prototype.createMarker=function(t,e){return'
'},e.prototype.createStepText=function(t,e,i,n,r){var s=(0===t?0:Math.round(n/this.scaleBarSteps_*t*100)/100)+(0===t?"":" "+r);return'
'+s+"
"},e.prototype.getScaleForResolution=function(){var t=$e(this.viewState_.projection,this.viewState_.resolution,this.viewState_.center),e=this.dpi_||25.4/.28,i=this.viewState_.projection.getMetersPerUnit();return parseFloat(t.toString())*i*39.37*e},e.prototype.render=function(t){var e=t.frameState;this.viewState_=e?e.viewState:null,this.updateElement_()},e}(jr),rs=/^#([a-f0-9]{3}|[a-f0-9]{4}(?:[a-f0-9]{2}){0,2})$/i,ss=/^([a-z]*)$|^hsla?\(.*\)$/i;function os(t){var e=document.createElement("div");if(e.style.color=t,""!==e.style.color){document.body.appendChild(e);var i=getComputedStyle(e).color;return document.body.removeChild(e),i}return""}var as,ls,hs=(as={},ls=0,function(t){var e;if(as.hasOwnProperty(t))e=as[t];else{if(ls>=1024){var i=0;for(var n in as)0==(3&i++)&&(delete as[n],--ls)}e=function(t){var e,i,n,r,s;if(ss.exec(t)&&(t=os(t)),rs.exec(t)){var o=t.length-1,a=void 0;a=o<=4?1:2;var l=4===o||8===o;e=parseInt(t.substr(1+0*a,a),16),i=parseInt(t.substr(1+1*a,a),16),n=parseInt(t.substr(1+2*a,a),16),r=l?parseInt(t.substr(1+3*a,a),16):255,1==a&&(e=(e<<4)+e,i=(i<<4)+i,n=(n<<4)+n,l&&(r=(r<<4)+r)),s=[e,i,n,r/255]}else 0==t.indexOf("rgba(")?us(s=t.slice(5,-1).split(",").map(Number)):0==t.indexOf("rgb(")?((s=t.slice(4,-1).split(",").map(Number)).push(1),us(s)):$(!1,14);return s}(t),as[t]=e,++ls}return e});function cs(t){return Array.isArray(t)?t:hs(t)}function us(t){return t[0]=de(t[0]+.5|0,0,255),t[1]=de(t[1]+.5|0,0,255),t[2]=de(t[2]+.5|0,0,255),t[3]=de(t[3],0,1),t}function ds(t){var e=t[0];e!=(0|e)&&(e=e+.5|0);var i=t[1];i!=(0|i)&&(i=i+.5|0);var n=t[2];return n!=(0|n)&&(n=n+.5|0),"rgba("+e+","+i+","+n+","+(void 0===t[3]?1:t[3])+")"}var gs=function(){function t(){this.cache_={},this.cacheSize_=0,this.maxCacheSize_=32}return t.prototype.clear=function(){this.cache_={},this.cacheSize_=0},t.prototype.canExpireCache=function(){return this.cacheSize_>this.maxCacheSize_},t.prototype.expire=function(){if(this.canExpireCache()){var t=0;for(var e in this.cache_){var i=this.cache_[e];0!=(3&t++)||i.hasListener()||(delete this.cache_[e],--this.cacheSize_)}}},t.prototype.get=function(t,e,i){var n=_s(t,e,i);return n in this.cache_?this.cache_[n]:null},t.prototype.set=function(t,e,i,n){var r=_s(t,e,i);this.cache_[r]=n,++this.cacheSize_},t.prototype.setSize=function(t){this.maxCacheSize_=t,this.expire()},t}();function _s(t,e,i){return e+":"+t+":"+(i?function(t){return"string"==typeof t?t:ds(t)}(i):"null")}var ps=new gs,fs="opacity",ms="visible",ys="extent",vs="zIndex",xs="maxResolution",Es="minResolution",Is="maxZoom",Cs="minZoom",ws="source",Ss=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ts=function(t){function e(e){var i=t.call(this)||this,n=m({},e);return n[fs]=void 0!==e.opacity?e.opacity:1,$("number"==typeof n[fs],64),n[ms]=void 0===e.visible||e.visible,n[vs]=e.zIndex,n[xs]=void 0!==e.maxResolution?e.maxResolution:1/0,n[Es]=void 0!==e.minResolution?e.minResolution:0,n[Cs]=void 0!==e.minZoom?e.minZoom:-1/0,n[Is]=void 0!==e.maxZoom?e.maxZoom:1/0,i.className_=void 0!==n.className?e.className:"ol-layer",delete n.className,i.setProperties(n),i.state_=null,i}return Ss(e,t),e.prototype.getClassName=function(){return this.className_},e.prototype.getLayerState=function(t){var e=this.state_||{layer:this,managed:void 0===t||t},i=this.getZIndex();return e.opacity=de(Math.round(100*this.getOpacity())/100,0,1),e.sourceState=this.getSourceState(),e.visible=this.getVisible(),e.extent=this.getExtent(),e.zIndex=void 0!==i?i:!1===e.managed?1/0:0,e.maxResolution=this.getMaxResolution(),e.minResolution=Math.max(this.getMinResolution(),0),e.minZoom=this.getMinZoom(),e.maxZoom=this.getMaxZoom(),this.state_=e,e},e.prototype.getLayersArray=function(t){return Y()},e.prototype.getLayerStatesArray=function(t){return Y()},e.prototype.getExtent=function(){return this.get(ys)},e.prototype.getMaxResolution=function(){return this.get(xs)},e.prototype.getMinResolution=function(){return this.get(Es)},e.prototype.getMinZoom=function(){return this.get(Cs)},e.prototype.getMaxZoom=function(){return this.get(Is)},e.prototype.getOpacity=function(){return this.get(fs)},e.prototype.getSourceState=function(){return Y()},e.prototype.getVisible=function(){return this.get(ms)},e.prototype.getZIndex=function(){return this.get(vs)},e.prototype.setExtent=function(t){this.set(ys,t)},e.prototype.setMaxResolution=function(t){this.set(xs,t)},e.prototype.setMinResolution=function(t){this.set(Es,t)},e.prototype.setMaxZoom=function(t){this.set(Is,t)},e.prototype.setMinZoom=function(t){this.set(Cs,t)},e.prototype.setOpacity=function(t){$("number"==typeof t,64),this.set(fs,t)},e.prototype.setVisible=function(t){this.set(ms,t)},e.prototype.setZIndex=function(t){this.set(vs,t)},e.prototype.disposeInternal=function(){this.state_&&(this.state_.layer=null,this.state_=null),t.prototype.disposeInternal.call(this)},e}(Z),Ls="prerender",Ns="postrender",Os="precompose",Rs="postcompose",Ps="rendercomplete",bs="undefined",Ms="ready",As=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function Fs(t,e){if(!t.visible)return!1;var i=e.resolution;if(i=t.maxResolution)return!1;var n=e.zoom;return n>t.minZoom&&n<=t.maxZoom}var Ds=function(t){function e(e){var i=this,n=m({},e);delete n.source,(i=t.call(this,n)||this).mapPrecomposeKey_=null,i.mapRenderKey_=null,i.sourceChangeKey_=null,i.renderer_=null,e.render&&(i.render=e.render),e.map&&i.setMap(e.map),i.addEventListener(H(ws),i.handleSourcePropertyChange_);var r=e.source?e.source:null;return i.setSource(r),i}return As(e,t),e.prototype.getLayersArray=function(t){var e=t||[];return e.push(this),e},e.prototype.getLayerStatesArray=function(t){var e=t||[];return e.push(this.getLayerState()),e},e.prototype.getSource=function(){return this.get(ws)||null},e.prototype.getSourceState=function(){var t=this.getSource();return t?t.getState():bs},e.prototype.handleSourceChange_=function(){this.changed()},e.prototype.handleSourcePropertyChange_=function(){this.sourceChangeKey_&&(G(this.sourceChangeKey_),this.sourceChangeKey_=null);var t=this.getSource();t&&(this.sourceChangeKey_=F(t,w,this.handleSourceChange_,this)),this.changed()},e.prototype.getFeatures=function(t){return this.renderer_.getFeatures(t)},e.prototype.render=function(t,e){var i=this.getRenderer();if(i.prepareFrame(t))return i.renderFrame(t,e)},e.prototype.setMap=function(t){this.mapPrecomposeKey_&&(G(this.mapPrecomposeKey_),this.mapPrecomposeKey_=null),t||this.changed(),this.mapRenderKey_&&(G(this.mapRenderKey_),this.mapRenderKey_=null),t&&(this.mapPrecomposeKey_=F(t,Os,(function(t){var e=t.frameState.layerStatesArray,i=this.getLayerState(!1);$(!e.some((function(t){return t.layer===i.layer})),67),e.push(i)}),this),this.mapRenderKey_=F(this,w,t.render,t),this.changed())},e.prototype.setSource=function(t){this.set(ws,t)},e.prototype.getRenderer=function(){return this.renderer_||(this.renderer_=this.createRenderer()),this.renderer_},e.prototype.hasRenderer=function(){return!!this.renderer_},e.prototype.createRenderer=function(){return null},e.prototype.disposeInternal=function(){this.setSource(null),t.prototype.disposeInternal.call(this)},e}(Ts),Gs=function(){function t(){}return t.prototype.drawCustom=function(t,e,i){},t.prototype.drawGeometry=function(t){},t.prototype.setStyle=function(t){},t.prototype.drawCircle=function(t,e){},t.prototype.drawFeature=function(t,e){},t.prototype.drawGeometryCollection=function(t,e){},t.prototype.drawLineString=function(t,e){},t.prototype.drawMultiLineString=function(t,e){},t.prototype.drawMultiPoint=function(t,e){},t.prototype.drawMultiPolygon=function(t,e){},t.prototype.drawPoint=function(t,e){},t.prototype.drawPolygon=function(t,e){},t.prototype.drawText=function(t,e){},t.prototype.setFillStrokeStyle=function(t,e){},t.prototype.setImageStyle=function(t,e){},t.prototype.setTextStyle=function(t,e){},t}();function ks(t){return Array.isArray(t)?ds(t):t}var Vs=[],Bs=[0,0,0,0],Ys=new Z;(new C).setSize=function(){console.warn("labelCache is deprecated.")};var zs,qs,Xs,js=null,Us={},Ws=function(){var t,e,i=["monospace","serif"],n=i.length,r="wmytzilWMYTZIL@#/&?$%10";function s(t,s,o){for(var a=!0,l=0;l=0;--x){var E=f[x],I=E.layer;if(I.hasRenderer()&&Fs(E,h)&&o.call(a,I)){var C=I.getRenderer(),w=I.getSource();if(C&&w){var S=w.getWrapX()?d:t,T=c.bind(null,E.managed);y[0]=S[0]+g[v][0],y[1]=S[1]+g[v][1],l=C.forEachFeatureAtCoordinate(y,e,i,T,p)}if(l)return l}}},e.prototype.forEachLayerAtPixel=function(t,e,i,n,r){return Y()},e.prototype.hasFeatureAtCoordinate=function(t,e,i,n,r,s){return void 0!==this.forEachFeatureAtCoordinate(t,e,i,n,_,this,r,s)},e.prototype.getMap=function(){return this.map_},e.prototype.renderFrame=function(t){this.declutterTree_=function(t,e){e&&e.clear();for(var i=t.declutterItems,n=i.length-1;n>=0;--n)for(var r=i[n],s=r.items,o=0,a=s.length;o=0;--a){var l=o[a],h=l.layer;if(h.hasRenderer()&&Fs(l,s)&&r(h)){var c=h.getRenderer().getDataAtPixel(t,e,i);if(c){var u=n(h,c);if(u)return u}}}},e}(Eo),To="layergroup",Lo="size",No="target",Oo="view",Ro="add",Po="remove",bo=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Mo="length",Ao=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.element=i,r.index=n,r}return bo(e,t),e}(s),Fo=function(t){function e(e,i){var n=t.call(this)||this,r=i||{};if(n.unique_=!!r.unique,n.array_=e||[],n.unique_)for(var s=0,o=n.array_.length;s0;)this.pop()},e.prototype.extend=function(t){for(var e=0,i=t.length;ethis.moveTolerance_||Math.abs(t.clientY-this.down_.clientY)>this.moveTolerance_},e.prototype.disposeInternal=function(){this.relayedListenerKey_&&(G(this.relayedListenerKey_),this.relayedListenerKey_=null),this.element_.removeEventListener(M,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&(G(this.pointerdownListenerKey_),this.pointerdownListenerKey_=null),this.dragListenerKeys_.forEach(G),this.dragListenerKeys_.length=0,this.element_=null,t.prototype.disposeInternal.call(this)},e}(C),Ho=function(){function t(t,e){this.priorityFunction_=t,this.keyFunction_=e,this.elements_=[],this.priorities_=[],this.queuedElements_={}}return t.prototype.clear=function(){this.elements_.length=0,this.priorities_.length=0,y(this.queuedElements_)},t.prototype.dequeue=function(){var t=this.elements_,e=this.priorities_,i=t[0];1==t.length?(t.length=0,e.length=0):(t[0]=t.pop(),e[0]=e.pop(),this.siftUp_(0));var n=this.keyFunction_(i);return delete this.queuedElements_[n],i},t.prototype.enqueue=function(t){$(!(this.keyFunction_(t)in this.queuedElements_),31);var e=this.priorityFunction_(t);return e!=1/0&&(this.elements_.push(t),this.priorities_.push(e),this.queuedElements_[this.keyFunction_(t)]=!0,this.siftDown_(0,this.elements_.length-1),!0)},t.prototype.getCount=function(){return this.elements_.length},t.prototype.getLeftChildIndex_=function(t){return 2*t+1},t.prototype.getRightChildIndex_=function(t){return 2*t+2},t.prototype.getParentIndex_=function(t){return t-1>>1},t.prototype.heapify_=function(){var t;for(t=(this.elements_.length>>1)-1;t>=0;t--)this.siftUp_(t)},t.prototype.isEmpty=function(){return 0===this.elements_.length},t.prototype.isKeyQueued=function(t){return t in this.queuedElements_},t.prototype.isQueued=function(t){return this.isKeyQueued(this.keyFunction_(t))},t.prototype.siftUp_=function(t){for(var e=this.elements_,i=this.priorities_,n=e.length,r=e[t],s=i[t],o=t;t>1;){var a=this.getLeftChildIndex_(t),l=this.getRightChildIndex_(t),h=lt;){var o=this.getParentIndex_(e);if(!(n[o]>s))break;i[e]=i[o],n[e]=n[o],e=o}i[e]=r,n[e]=s},t.prototype.reprioritize=function(){var t,e,i,n=this.priorityFunction_,r=this.elements_,s=this.priorities_,o=0,a=r.length;for(e=0;e0;)n=(i=this.dequeue()[0]).getKey(),i.getState()!==Zo||n in this.tilesLoadingKeys_||(this.tilesLoadingKeys_[n]=!0,++this.tilesLoading_,++r,i.load())},e}(Ho);function ia(t,e){return Array.isArray(t)?t:(void 0===e?e=[t,t]:(e[0]=t,e[1]=t),e)}var na=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var ra=function(t){function e(e){var i=t.call(this)||this,n=function(t){var e=null;void 0!==t.keyboardEventTarget&&(e="string"==typeof t.keyboardEventTarget?document.getElementById(t.keyboardEventTarget):t.keyboardEventTarget);var i,n,r,s={},o=t.layers&&"function"==typeof t.layers.getLayers?t.layers:new ko({layers:t.layers});s[To]=o,s[No]=t.target,s[Oo]=void 0!==t.view?t.view:new ar,void 0!==t.controls&&(Array.isArray(t.controls)?i=new Fo(t.controls.slice()):($("function"==typeof t.controls.getArray,47),i=t.controls));void 0!==t.interactions&&(Array.isArray(t.interactions)?n=new Fo(t.interactions.slice()):($("function"==typeof t.interactions.getArray,48),n=t.interactions));void 0!==t.overlays?Array.isArray(t.overlays)?r=new Fo(t.overlays.slice()):($("function"==typeof t.overlays.getArray,49),r=t.overlays):r=new Fo;return{controls:i,interactions:n,keyboardEventTarget:e,overlays:r,values:s}}(e);return i.boundHandleBrowserEvent_=i.handleBrowserEvent.bind(i),i.maxTilesLoading_=void 0!==e.maxTilesLoading?e.maxTilesLoading:16,i.pixelRatio_=void 0!==e.pixelRatio?e.pixelRatio:Lr,i.postRenderTimeoutHandle_,i.animationDelayKey_,i.animationDelay_=function(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}.bind(i),i.coordinateToPixelTransform_=[1,0,0,1,0,0],i.pixelToCoordinateTransform_=[1,0,0,1,0,0],i.frameIndex_=0,i.frameState_=null,i.previousExtent_=null,i.viewPropertyListenerKey_=null,i.viewChangeListenerKey_=null,i.layerGroupPropertyListenerKeys_=null,i.viewport_=document.createElement("div"),i.viewport_.className="ol-viewport"+("ontouchstart"in window?" ol-touch":""),i.viewport_.style.position="relative",i.viewport_.style.overflow="hidden",i.viewport_.style.width="100%",i.viewport_.style.height="100%",i.overlayContainer_=document.createElement("div"),i.overlayContainer_.style.position="absolute",i.overlayContainer_.style.zIndex="0",i.overlayContainer_.style.width="100%",i.overlayContainer_.style.height="100%",i.overlayContainer_.style.pointerEvents="none",i.overlayContainer_.className="ol-overlaycontainer",i.viewport_.appendChild(i.overlayContainer_),i.overlayContainerStopEvent_=document.createElement("div"),i.overlayContainerStopEvent_.style.position="absolute",i.overlayContainerStopEvent_.style.zIndex="0",i.overlayContainerStopEvent_.style.width="100%",i.overlayContainerStopEvent_.style.height="100%",i.overlayContainerStopEvent_.style.pointerEvents="none",i.overlayContainerStopEvent_.className="ol-overlaycontainer-stopevent",i.viewport_.appendChild(i.overlayContainerStopEvent_),i.mapBrowserEventHandler_=null,i.moveTolerance_=e.moveTolerance,i.keyboardEventTarget_=n.keyboardEventTarget,i.keyHandlerKeys_=null,i.controls=n.controls||new Fo,i.interactions=n.interactions||new Fo,i.overlays_=n.overlays,i.overlayIdIndex_={},i.renderer_=null,i.handleResize_,i.postRenderFunctions_=[],i.tileQueue_=new ea(i.getTilePriority.bind(i),i.handleTileChange_.bind(i)),i.addEventListener(H(To),i.handleLayerGroupChanged_),i.addEventListener(H(Oo),i.handleViewChanged_),i.addEventListener(H(Lo),i.handleSizeChanged_),i.addEventListener(H(No),i.handleTargetChanged_),i.setProperties(n.values),i.controls.forEach(function(t){t.setMap(this)}.bind(i)),i.controls.addEventListener(Ro,function(t){t.element.setMap(this)}.bind(i)),i.controls.addEventListener(Po,function(t){t.element.setMap(null)}.bind(i)),i.interactions.forEach(function(t){t.setMap(this)}.bind(i)),i.interactions.addEventListener(Ro,function(t){t.element.setMap(this)}.bind(i)),i.interactions.addEventListener(Po,function(t){t.element.setMap(null)}.bind(i)),i.overlays_.forEach(i.addOverlayInternal_.bind(i)),i.overlays_.addEventListener(Ro,function(t){this.addOverlayInternal_(t.element)}.bind(i)),i.overlays_.addEventListener(Po,function(t){var e=t.element.getId();void 0!==e&&delete this.overlayIdIndex_[e.toString()],t.element.setMap(null)}.bind(i)),i}return na(e,t),e.prototype.createRenderer=function(){throw new Error("Use a map type that has a createRenderer method")},e.prototype.addControl=function(t){this.getControls().push(t)},e.prototype.addInteraction=function(t){this.getInteractions().push(t)},e.prototype.addLayer=function(t){this.getLayerGroup().getLayers().push(t)},e.prototype.addOverlay=function(t){this.getOverlays().push(t)},e.prototype.addOverlayInternal_=function(t){var e=t.getId();void 0!==e&&(this.overlayIdIndex_[e.toString()]=t),t.setMap(this)},e.prototype.disposeInternal=function(){this.setTarget(null),t.prototype.disposeInternal.call(this)},e.prototype.forEachFeatureAtPixel=function(t,e,i){if(this.frameState_){var n=this.getCoordinateFromPixelInternal(t),r=void 0!==(i=void 0!==i?i:{}).hitTolerance?i.hitTolerance*this.frameState_.pixelRatio:0,s=void 0!==i.layerFilter?i.layerFilter:_,o=!1!==i.checkWrapped;return this.renderer_.forEachFeatureAtCoordinate(n,this.frameState_,r,o,e,null,s,null)}},e.prototype.getFeaturesAtPixel=function(t,e){var i=[];return this.forEachFeatureAtPixel(t,(function(t){i.push(t)}),e),i},e.prototype.forEachLayerAtPixel=function(t,e,i){if(this.frameState_){var n=i||{},r=void 0!==n.hitTolerance?n.hitTolerance*this.frameState_.pixelRatio:0,s=n.layerFilter||_;return this.renderer_.forEachLayerAtPixel(t,this.frameState_,r,e,s)}},e.prototype.hasFeatureAtPixel=function(t,e){if(!this.frameState_)return!1;var i=this.getCoordinateFromPixelInternal(t),n=void 0!==(e=void 0!==e?e:{}).layerFilter?e.layerFilter:_,r=void 0!==e.hitTolerance?e.hitTolerance*this.frameState_.pixelRatio:0,s=!1!==e.checkWrapped;return this.renderer_.hasFeatureAtCoordinate(i,this.frameState_,r,s,n,null)},e.prototype.getEventCoordinate=function(t){return this.getCoordinateFromPixel(this.getEventPixel(t))},e.prototype.getEventCoordinateInternal=function(t){return this.getCoordinateFromPixelInternal(this.getEventPixel(t))},e.prototype.getEventPixel=function(t){var e=this.viewport_.getBoundingClientRect(),i="changedTouches"in t?t.changedTouches[0]:t;return[i.clientX-e.left,i.clientY-e.top]},e.prototype.getTarget=function(){return this.get(No)},e.prototype.getTargetElement=function(){var t=this.getTarget();return void 0!==t?"string"==typeof t?document.getElementById(t):t:null},e.prototype.getCoordinateFromPixel=function(t){return ui(this.getCoordinateFromPixelInternal(t),this.getView().getProjection())},e.prototype.getCoordinateFromPixelInternal=function(t){var e=this.frameState_;return e?st(e.pixelToCoordinateTransform,t.slice()):null},e.prototype.getControls=function(){return this.controls},e.prototype.getOverlays=function(){return this.overlays_},e.prototype.getOverlayById=function(t){var e=this.overlayIdIndex_[t.toString()];return void 0!==e?e:null},e.prototype.getInteractions=function(){return this.interactions},e.prototype.getLayerGroup=function(){return this.get(To)},e.prototype.getLayers=function(){return this.getLayerGroup().getLayers()},e.prototype.getLoading=function(){for(var t=this.getLayerGroup().getLayerStatesArray(),e=0,i=t.length;e=0;o--){var a=s[o];if(a.getActive())if(!a.handleEvent(t))break}}},e.prototype.handlePostRender=function(){var t=this.frameState_,e=this.tileQueue_;if(!e.isEmpty()){var i=this.maxTilesLoading_,n=i;if(t){var r=t.viewHints;if(r[zn]||r[qn]){var s=!Or&&Date.now()-t.time>8;i=s?0:8,n=s?0:2}}e.getTilesLoading()0&&t[1]>0}(e)&&i&&i.isDef()){var s=i.getHints(this.frameState_?this.frameState_.viewHints:void 0),o=i.getState();r={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutterItems:n?n.declutterItems:[],extent:Zt(o.center,o.resolution,o.rotation,e),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:e,tileQueue:this.tileQueue_,time:t,usedTiles:{},viewState:o,viewHints:s,wantedTiles:{}}}if(this.frameState_=r,this.renderer_.renderFrame(r),r){if(r.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,r.postRenderFunctions),n)(!this.previousExtent_||!se(this.previousExtent_)&&!At(r.extent,this.previousExtent_))&&(this.dispatchEvent(new Bo(hr,this,n)),this.previousExtent_=Ot(this.previousExtent_));this.previousExtent_&&!r.viewHints[zn]&&!r.viewHints[qn]&&!At(r.extent,this.previousExtent_)&&(this.dispatchEvent(new Bo(cr,this,r)),Et(r.extent,this.previousExtent_))}this.dispatchEvent(new Bo(lr,this,r)),this.postRenderTimeoutHandle_=setTimeout(this.handlePostRender.bind(this),0)},e.prototype.setLayerGroup=function(t){this.set(To,t)},e.prototype.setSize=function(t){this.set(Lo,t)},e.prototype.setTarget=function(t){this.set(No,t)},e.prototype.setView=function(t){this.set(Oo,t)},e.prototype.updateSize=function(){var t=this.getTargetElement();if(t){var e=getComputedStyle(t);this.setSize([t.offsetWidth-parseFloat(e.borderLeftWidth)-parseFloat(e.paddingLeft)-parseFloat(e.paddingRight)-parseFloat(e.borderRightWidth),t.offsetHeight-parseFloat(e.borderTopWidth)-parseFloat(e.paddingTop)-parseFloat(e.paddingBottom)-parseFloat(e.borderBottomWidth)])}else this.setSize(void 0);this.updateViewportSize_()},e.prototype.updateViewportSize_=function(){var t=this.getView();if(t){var e=void 0,i=getComputedStyle(this.viewport_);i.width&&i.height&&(e=[parseInt(i.width,10),parseInt(i.height,10)]),t.setViewportSize(e)}},e}(Z),sa=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),oa=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return sa(e,t),e.prototype.createRenderer=function(){return new So(this)},e}(ra),aa=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).boundHandleRotationChanged_=i.handleRotationChanged_.bind(i),i.collapsed_=void 0===n.collapsed||n.collapsed,i.collapsible_=void 0===n.collapsible||n.collapsible,i.collapsible_||(i.collapsed_=!1),i.rotateWithView_=void 0!==n.rotateWithView&&n.rotateWithView,i.viewExtent_=void 0;var r=void 0!==n.className?n.className:"ol-overviewmap",s=void 0!==n.tipLabel?n.tipLabel:"Overview map",o=void 0!==n.collapseLabel?n.collapseLabel:"«";"string"==typeof o?(i.collapseLabel_=document.createElement("span"),i.collapseLabel_.textContent=o):i.collapseLabel_=o;var a=void 0!==n.label?n.label:"»";"string"==typeof a?(i.label_=document.createElement("span"),i.label_.textContent=a):i.label_=a;var l=i.collapsible_&&!i.collapsed_?i.collapseLabel_:i.label_,h=document.createElement("button");h.setAttribute("type","button"),h.title=s,h.appendChild(l),h.addEventListener(L,i.handleClick_.bind(i),!1),i.ovmapDiv_=document.createElement("div"),i.ovmapDiv_.className="ol-overviewmap-map",i.view_=n.view,i.ovmap_=new oa({view:n.view});var c=i.ovmap_;n.layers&&n.layers.forEach((function(t){c.addLayer(t)}));var u=document.createElement("div");u.className="ol-overviewmap-box",u.style.boxSizing="border-box",i.boxOverlay_=new qr({position:[0,0],positioning:pr,element:u}),i.ovmap_.addOverlay(i.boxOverlay_);var d=r+" ol-unselectable ol-control"+(i.collapsed_&&i.collapsible_?" ol-collapsed":"")+(i.collapsible_?"":" ol-uncollapsible"),g=i.element;g.className=d,g.appendChild(i.ovmapDiv_),g.appendChild(h);var _=i,p=i.boxOverlay_,f=i.boxOverlay_.getElement(),m=function(t){var e,i={clientX:(e=t).clientX,clientY:e.clientY},n=c.getEventCoordinateInternal(i);p.setPosition(n)},y=function(t){var e=c.getEventCoordinateInternal(t);_.getMap().getView().setCenterInternal(e),window.removeEventListener("mousemove",m),window.removeEventListener("mouseup",y)};return f.addEventListener("mousedown",(function(){window.addEventListener("mousemove",m),window.addEventListener("mouseup",y)})),i}return sa(e,t),e.prototype.setMap=function(e){var i=this.getMap();if(e!==i){if(i){var n=i.getView();n&&this.unbindView_(n),this.ovmap_.setTarget(null)}if(t.prototype.setMap.call(this,e),e){this.ovmap_.setTarget(this.ovmapDiv_),this.listenerKeys.push(F(e,o,this.handleMapPropertyChange_,this));var r=e.getView();r&&(this.bindView_(r),r.isDef()&&(this.ovmap_.updateSize(),this.resetExtent_()))}}},e.prototype.handleMapPropertyChange_=function(t){if(t.key===Oo){var e=t.oldValue;e&&this.unbindView_(e);var i=this.getMap().getView();this.bindView_(i)}},e.prototype.bindView_=function(t){if(!this.view_){var e=new ar({projection:t.getProjection()});this.ovmap_.setView(e)}t.addEventListener(H(Un),this.boundHandleRotationChanged_),this.handleRotationChanged_()},e.prototype.unbindView_=function(t){t.removeEventListener(H(Un),this.boundHandleRotationChanged_)},e.prototype.handleRotationChanged_=function(){this.rotateWithView_&&this.ovmap_.getView().setRotation(this.getMap().getView().getRotation())},e.prototype.validateExtent_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var i=t.getSize(),n=t.getView().calculateExtentInternal(i);if(!this.viewExtent_||!At(n,this.viewExtent_)){this.viewExtent_=n;var r=e.getSize(),s=e.getView().calculateExtentInternal(r),o=e.getPixelFromCoordinateInternal(ee(n)),a=e.getPixelFromCoordinateInternal(jt(n)),l=Math.abs(o[0]-a[0]),h=Math.abs(o[1]-a[1]),c=r[0],u=r[1];l<.1*c||h<.1*u||l>.75*c||h>.75*u?this.resetExtent_():wt(s,n)||this.recenter_()}}},e.prototype.resetExtent_=function(){var t=this.getMap(),e=this.ovmap_,i=t.getSize(),n=t.getView().calculateExtentInternal(i),r=e.getView(),s=Math.log(7.5)/Math.LN2;ae(n,1/(.1*Math.pow(2,s/2))),r.fitInternal(Mn(n))},e.prototype.recenter_=function(){var t=this.getMap(),e=this.ovmap_,i=t.getView();e.getView().setCenterInternal(i.getCenterInternal())},e.prototype.updateBox_=function(){var t=this.getMap(),e=this.ovmap_;if(t.isRendered()&&e.isRendered()){var i=t.getSize(),n=t.getView(),r=e.getView(),s=this.rotateWithView_?0:-n.getRotation(),o=this.boxOverlay_,a=this.boxOverlay_.getElement(),l=n.getCenterInternal(),h=n.getResolution(),c=r.getResolution(),u=i[0]*h/c,d=i[1]*h/c;if(o.setPosition(l),a){a.style.width=u+"px",a.style.height=d+"px";var g="rotate("+s+"rad)";a.style.transform=g}}},e.prototype.handleClick_=function(t){t.preventDefault(),this.handleToggle_()},e.prototype.handleToggle_=function(){this.element.classList.toggle("ol-collapsed"),this.collapsed_?Ar(this.collapseLabel_,this.label_):Ar(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_;var t=this.ovmap_;if(!this.collapsed_){if(t.isRendered())return this.viewExtent_=void 0,void t.render();t.updateSize(),this.resetExtent_(),D(t,lr,(function(t){this.updateBox_()}),this)}},e.prototype.getCollapsible=function(){return this.collapsible_},e.prototype.setCollapsible=function(t){this.collapsible_!==t&&(this.collapsible_=t,this.element.classList.toggle("ol-uncollapsible"),!t&&this.collapsed_&&this.handleToggle_())},e.prototype.setCollapsed=function(t){this.collapsible_&&this.collapsed_!==t&&this.handleToggle_()},e.prototype.getCollapsed=function(){return this.collapsed_},e.prototype.getRotateWithView=function(){return this.rotateWithView_},e.prototype.setRotateWithView=function(t){this.rotateWithView_!==t&&(this.rotateWithView_=t,0!==this.getMap().getView().getRotation()&&(this.rotateWithView_?this.handleRotationChanged_():this.ovmap_.getView().setRotation(0),this.viewExtent_=void 0,this.validateExtent_(),this.updateBox_()))},e.prototype.getOverviewMap=function(){return this.ovmap_},e.prototype.render=function(t){this.validateExtent_(),this.updateBox_()},e}(jr),la="active",ha=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function ca(t,e,i,n){var r=t.getZoom();if(void 0!==r){var s=t.getConstrainedZoom(r+e),o=t.getResolutionForZoom(s);t.getAnimating()&&t.cancelAnimations(),t.animate({resolution:o,anchor:i,duration:void 0!==n?n:250,easing:er})}}var ua=function(t){function e(e){var i=t.call(this)||this;return e&&e.handleEvent&&(i.handleEvent=e.handleEvent),i.map_=null,i.setActive(!0),i}return ha(e,t),e.prototype.getActive=function(){return this.get(la)},e.prototype.getMap=function(){return this.map_},e.prototype.handleEvent=function(t){return!0},e.prototype.setActive=function(t){this.set(la,t)},e.prototype.setMap=function(t){this.map_=t},e}(Z),da=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ga=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.delta_=n.delta?n.delta:1,i.duration_=void 0!==n.duration?n.duration:250,i}return da(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==qo.DBLCLICK){var i=t.originalEvent,n=t.map,r=t.coordinate,s=i.shiftKey?-this.delta_:this.delta_;ca(n.getView(),s,r,this.duration_),t.preventDefault(),e=!0}return!e},e}(ua),_a=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();function pa(t){for(var e=t.length,i=0,n=0,r=0;r0}}else if(t.type==qo.POINTERDOWN){var n=this.handleDownEvent(t);this.handlingDownUpSequence=n,e=this.stopDown(n)}else t.type==qo.POINTERMOVE&&this.handleMoveEvent(t);return!e},e.prototype.handleMoveEvent=function(t){},e.prototype.handleUpEvent=function(t){return!1},e.prototype.stopDown=function(t){return t},e.prototype.updateTrackedPointers_=function(t){if(function(t){var e=t.type;return e===qo.POINTERDOWN||e===qo.POINTERDRAG||e===qo.POINTERUP}(t)){var e=t.originalEvent,i=e.pointerId.toString();t.type==qo.POINTERUP?delete this.trackedPointers_[i]:(t.type==qo.POINTERDOWN||i in this.trackedPointers_)&&(this.trackedPointers_[i]=e),this.targetPointers=v(this.trackedPointers_)}},e}(ua);function ma(t){var e=arguments;return function(t){for(var i=!0,n=0,r=e.length;n0&&this.condition_(t)){var e=t.map.getView();return this.lastCentroid=null,e.getAnimating()&&e.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1},e}(fa),Ma=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Aa=function(t){function e(e){var i=this,n=e||{};return(i=t.call(this,{stopDown:p})||this).condition_=n.condition?n.condition:ya,i.lastAngle_=void 0,i.duration_=void 0!==n.duration?n.duration:250,i}return Ma(e,t),e.prototype.handleDragEvent=function(t){if(Oa(t)){var e=t.map,i=e.getView();if(i.getConstraints().rotation!==$n){var n=e.getSize(),r=t.pixel,s=Math.atan2(n[1]/2-r[1],r[0]-n[0]/2);if(void 0!==this.lastAngle_){var o=s-this.lastAngle_;i.adjustRotationInternal(-o)}this.lastAngle_=s}}},e.prototype.handleUpEvent=function(t){return!Oa(t)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){return!!Oa(t)&&(!(!Ia(t)||!this.condition_(t))&&(t.map.getView().beginInteraction(),this.lastAngle_=void 0,!0))},e}(fa),Fa=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Da=function(t){function e(e){var i=t.call(this)||this;return i.geometry_=null,i.element_=document.createElement("div"),i.element_.style.position="absolute",i.element_.style.pointerEvents="auto",i.element_.className="ol-box "+e,i.map_=null,i.startPixel_=null,i.endPixel_=null,i}return Fa(e,t),e.prototype.disposeInternal=function(){this.setMap(null)},e.prototype.render_=function(){var t=this.startPixel_,e=this.endPixel_,i=this.element_.style;i.left=Math.min(t[0],e[0])+"px",i.top=Math.min(t[1],e[1])+"px",i.width=Math.abs(e[0]-t[0])+"px",i.height=Math.abs(e[1]-t[1])+"px"},e.prototype.setMap=function(t){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);var e=this.element_.style;e.left="inherit",e.top="inherit",e.width="inherit",e.height="inherit"}this.map_=t,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)},e.prototype.setPixels=function(t,e){this.startPixel_=t,this.endPixel_=e,this.createOrUpdateGeometry(),this.render_()},e.prototype.createOrUpdateGeometry=function(){var t=this.startPixel_,e=this.endPixel_,i=[t,[t[0],e[1]],e,[e[0],t[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);i[4]=i[0].slice(),this.geometry_?this.geometry_.setCoordinates([i]):this.geometry_=new bn([i])},e.prototype.getGeometry=function(){return this.geometry_},e}(a),Ga=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ka="boxstart",Va="boxdrag",Ba="boxend",Ya=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.coordinate=i,r.mapBrowserEvent=n,r}return Ga(e,t),e}(s),za=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.box_=new Da(n.className||"ol-dragbox"),i.minArea_=void 0!==n.minArea?n.minArea:64,n.onBoxEnd&&(i.onBoxEnd=n.onBoxEnd),i.startPixel_=null,i.condition_=n.condition?n.condition:Ia,i.boxEndCondition_=n.boxEndCondition?n.boxEndCondition:i.defaultBoxEndCondition,i}return Ga(e,t),e.prototype.defaultBoxEndCondition=function(t,e,i){var n=i[0]-e[0],r=i[1]-e[1];return n*n+r*r>=this.minArea_},e.prototype.getGeometry=function(){return this.box_.getGeometry()},e.prototype.handleDragEvent=function(t){this.box_.setPixels(this.startPixel_,t.pixel),this.dispatchEvent(new Ya(Va,t.coordinate,t))},e.prototype.handleUpEvent=function(t){return this.box_.setMap(null),this.boxEndCondition_(t,this.startPixel_,t.pixel)&&(this.onBoxEnd(t),this.dispatchEvent(new Ya(Ba,t.coordinate,t))),!1},e.prototype.handleDownEvent=function(t){return!!this.condition_(t)&&(this.startPixel_=t.pixel,this.box_.setMap(t.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ya(ka,t.coordinate,t)),!0)},e.prototype.onBoxEnd=function(t){},e}(fa),qa=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Xa=function(t){function e(e){var i=this,n=e||{},r=n.condition?n.condition:La;return(i=t.call(this,{condition:r,className:n.className||"ol-dragzoom",minArea:n.minArea})||this).duration_=void 0!==n.duration?n.duration:200,i.out_=void 0!==n.out&&n.out,i}return qa(e,t),e.prototype.onBoxEnd=function(t){var e=this.getMap(),i=e.getView(),n=e.getSize(),r=this.getGeometry().getExtent();if(this.out_){var s=i.calculateExtentInternal(n),o=Pt([e.getPixelFromCoordinateInternal(Xt(r)),e.getPixelFromCoordinateInternal(ie(r))]);ae(s,1/i.getResolutionForExtentInternal(o,n)),r=s}var a=i.getConstrainedResolution(i.getResolutionForExtentInternal(r,n)),l=i.getConstrainedCenter(Ut(r),a);i.animateInternal({resolution:a,center:l,duration:this.duration_,easing:er})},e}(za),ja=37,Ua=38,Wa=39,Ha=40,Za=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ka=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.defaultCondition_=function(t){return Ta(t)&&Na(t)},i.condition_=void 0!==n.condition?n.condition:i.defaultCondition_,i.duration_=void 0!==n.duration?n.duration:100,i.pixelDelta_=void 0!==n.pixelDelta?n.pixelDelta:128,i}return Za(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==O){var i=t.originalEvent.keyCode;if(this.condition_(t)&&(i==Ha||i==ja||i==Wa||i==Ua)){var n=t.map.getView(),r=n.getResolution()*this.pixelDelta_,s=0,o=0;i==Ha?o=-r:i==ja?s=-r:i==Wa?s=r:o=r;var a=[s,o];Ye(a,n.getRotation()),function(t,e,i){var n=t.getCenterInternal();if(n){var r=[n[0]+e[0],n[1]+e[1]];t.animateInternal({duration:void 0!==i?i:250,easing:nr,center:t.getConstrainedCenter(r)})}}(n,a,this.duration_),t.preventDefault(),e=!0}}return!e},e}(ua),Ja=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),$a=function(t){function e(e){var i=t.call(this)||this,n=e||{};return i.condition_=n.condition?n.condition:Na,i.delta_=n.delta?n.delta:1,i.duration_=void 0!==n.duration?n.duration:100,i}return Ja(e,t),e.prototype.handleEvent=function(t){var e=!1;if(t.type==O||t.type==R){var i=t.originalEvent.charCode;if(this.condition_(t)&&(i=="+".charCodeAt(0)||i=="-".charCodeAt(0))){var n=t.map,r=i=="+".charCodeAt(0)?this.delta_:-this.delta_;ca(n.getView(),r,void 0,this.duration_),t.preventDefault(),e=!0}}return!e},e}(ua),Qa=function(){function t(t,e,i){this.decay_=t,this.minVelocity_=e,this.delay_=i,this.points_=[],this.angle_=0,this.initialVelocity_=0}return t.prototype.begin=function(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0},t.prototype.update=function(t,e){this.points_.push(t,e,Date.now())},t.prototype.end=function(){if(this.points_.length<6)return!1;var t=Date.now()-this.delay_,e=this.points_.length-3;if(this.points_[e+2]0&&this.points_[i+2]>t;)i-=3;var n=this.points_[e+2]-this.points_[i+2];if(n<1e3/60)return!1;var r=this.points_[e]-this.points_[i],s=this.points_[e+1]-this.points_[i+1];return this.angle_=Math.atan2(s,r),this.initialVelocity_=Math.sqrt(r*r+s*s)/n,this.initialVelocity_>this.minVelocity_},t.prototype.getDistance=function(){return(this.minVelocity_-this.initialVelocity_)/this.decay_},t.prototype.getAngle=function(){return this.angle_},t}(),tl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),el="trackpad",il="wheel",nl=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,n)||this).totalDelta_=0,i.lastDelta_=0,i.maxDelta_=void 0!==n.maxDelta?n.maxDelta:1,i.duration_=void 0!==n.duration?n.duration:250,i.timeout_=void 0!==n.timeout?n.timeout:80,i.useAnchor_=void 0===n.useAnchor||n.useAnchor,i.constrainResolution_=void 0!==n.constrainResolution&&n.constrainResolution;var r=n.condition?n.condition:xa;return i.condition_=n.onFocusOnly?ma(va,r):r,i.lastAnchor_=null,i.startTime_=void 0,i.timeoutId_,i.mode_=void 0,i.trackpadEventGap_=400,i.trackpadTimeoutId_,i.deltaPerZoom_=300,i}return tl(e,t),e.prototype.endInteraction_=function(){this.trackpadTimeoutId_=void 0,this.getMap().getView().endInteraction(void 0,this.lastDelta_?this.lastDelta_>0?1:-1:0,this.lastAnchor_)},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;if(t.type!==A)return!0;t.preventDefault();var e,i=t.map,n=t.originalEvent;if(this.useAnchor_&&(this.lastAnchor_=t.coordinate),t.type==A&&(e=n.deltaY,wr&&n.deltaMode===WheelEvent.DOM_DELTA_PIXEL&&(e/=Lr),n.deltaMode===WheelEvent.DOM_DELTA_LINE&&(e*=40)),0===e)return!1;this.lastDelta_=e;var r=Date.now();void 0===this.startTime_&&(this.startTime_=r),(!this.mode_||r-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(e)<4?el:il);var s=i.getView();if(this.mode_===el&&!s.getConstrainResolution()&&!this.constrainResolution_)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(s.getAnimating()&&s.cancelAnimations(),s.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),s.adjustZoom(-e/this.deltaPerZoom_,this.lastAnchor_),this.startTime_=r,!1;this.totalDelta_+=e;var o=Math.max(this.timeout_-(r-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,i),o),!1},e.prototype.handleWheelZoom_=function(t){var e=t.getView();e.getAnimating()&&e.cancelAnimations();var i=-de(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(e.getConstrainResolution()||this.constrainResolution_)&&(i=i?i>0?1:-1:0),ca(e,i,this.lastAnchor_,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0},e.prototype.setMouseAnchor=function(t){this.useAnchor_=t,t||(this.lastAnchor_=null)},e}(ua),rl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),sl=function(t){function e(e){var i=this,n=e||{},r=n;return r.stopDown||(r.stopDown=p),(i=t.call(this,r)||this).anchor_=null,i.lastAngle_=void 0,i.rotating_=!1,i.rotationDelta_=0,i.threshold_=void 0!==n.threshold?n.threshold:.3,i.duration_=void 0!==n.duration?n.duration:250,i}return rl(e,t),e.prototype.handleDragEvent=function(t){var e=0,i=this.targetPointers[0],n=this.targetPointers[1],r=Math.atan2(n.clientY-i.clientY,n.clientX-i.clientX);if(void 0!==this.lastAngle_){var s=r-this.lastAngle_;this.rotationDelta_+=s,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),e=s}this.lastAngle_=r;var o=t.map,a=o.getView();if(a.getConstraints().rotation!==$n){var l=o.getViewport().getBoundingClientRect(),h=pa(this.targetPointers);h[0]-=l.left,h[1]-=l.top,this.anchor_=o.getCoordinateFromPixelInternal(h),this.rotating_&&(o.render(),a.adjustRotationInternal(e,this.anchor_))}},e.prototype.handleUpEvent=function(t){return!(this.targetPointers.length<2)||(t.map.getView().endInteraction(this.duration_),!1)},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(fa),ol=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),al=function(t){function e(e){var i=this,n=e||{},r=n;return r.stopDown||(r.stopDown=p),(i=t.call(this,r)||this).anchor_=null,i.duration_=void 0!==n.duration?n.duration:400,i.lastDistance_=void 0,i.lastScaleDelta_=1,i}return ol(e,t),e.prototype.handleDragEvent=function(t){var e=1,i=this.targetPointers[0],n=this.targetPointers[1],r=i.clientX-n.clientX,s=i.clientY-n.clientY,o=Math.sqrt(r*r+s*s);void 0!==this.lastDistance_&&(e=this.lastDistance_/o),this.lastDistance_=o;var a=t.map,l=a.getView();1!=e&&(this.lastScaleDelta_=e);var h=a.getViewport().getBoundingClientRect(),c=pa(this.targetPointers);c[0]-=h.left,c[1]-=h.top,this.anchor_=a.getCoordinateFromPixelInternal(c),a.render(),l.adjustResolutionInternal(e,this.anchor_)},e.prototype.handleUpEvent=function(t){if(this.targetPointers.length<2){var e=t.map.getView(),i=this.lastScaleDelta_>1?1:-1;return e.endInteraction(this.duration_,i),!1}return!0},e.prototype.handleDownEvent=function(t){if(this.targetPointers.length>=2){var e=t.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||e.getView().beginInteraction(),!0}return!1},e}(fa);function ll(t){var e=t||{},i=new Fo,n=new Qa(-.005,.05,100);return(void 0===e.altShiftDragRotate||e.altShiftDragRotate)&&i.push(new Aa),(void 0===e.doubleClickZoom||e.doubleClickZoom)&&i.push(new ga({delta:e.zoomDelta,duration:e.zoomDuration})),(void 0===e.dragPan||e.dragPan)&&i.push(new ba({onFocusOnly:e.onFocusOnly,kinetic:n})),(void 0===e.pinchRotate||e.pinchRotate)&&i.push(new sl),(void 0===e.pinchZoom||e.pinchZoom)&&i.push(new al({duration:e.zoomDuration})),(void 0===e.keyboard||e.keyboard)&&(i.push(new Ka),i.push(new $a({delta:e.zoomDelta,duration:e.zoomDuration}))),(void 0===e.mouseWheelZoom||e.mouseWheelZoom)&&i.push(new nl({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(void 0===e.shiftDragZoom||e.shiftDragZoom)&&i.push(new Xa({duration:e.zoomDuration})),i}var hl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),cl=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{element:document.createElement("div"),render:n.render,target:n.target})||this).ulElement_=document.createElement("ul"),i.collapsed_=void 0===n.collapsed||n.collapsed,i.overrideCollapsible_=void 0!==n.collapsible,i.collapsible_=void 0===n.collapsible||n.collapsible,i.collapsible_||(i.collapsed_=!1);var r=void 0!==n.className?n.className:"ol-attribution",s=void 0!==n.tipLabel?n.tipLabel:"Attributions",o=void 0!==n.collapseLabel?n.collapseLabel:"»";"string"==typeof o?(i.collapseLabel_=document.createElement("span"),i.collapseLabel_.textContent=o):i.collapseLabel_=o;var a=void 0!==n.label?n.label:"i";"string"==typeof a?(i.label_=document.createElement("span"),i.label_.textContent=a):i.label_=a;var l=i.collapsible_&&!i.collapsed_?i.collapseLabel_:i.label_,h=document.createElement("button");h.setAttribute("type","button"),h.title=s,h.appendChild(l),h.addEventListener(L,i.handleClick_.bind(i),!1);var c=r+" ol-unselectable ol-control"+(i.collapsed_&&i.collapsible_?" ol-collapsed":"")+(i.collapsible_?"":" ol-uncollapsible"),u=i.element;return u.className=c,u.appendChild(i.ulElement_),u.appendChild(h),i.renderedAttributions_=[],i.renderedVisible_=!0,i}return hl(e,t),e.prototype.collectSourceAttributions_=function(t){for(var e={},i=[],n=t.layerStatesArray,r=0,s=n.length;r0;if(this.renderedVisible_!=i&&(this.element.style.display=i?"":"none",this.renderedVisible_=i),!g(e,this.renderedAttributions_)){Dr(this.ulElement_);for(var n=0,r=e.length;ni.push(t)),t.interactions=i,super(t),this.actions=[],t.actions.forEach(t=>{this.addAction(t)}),setTimeout(()=>{this.activateDefaultAction()}),!t.disableEscapeKey){const t=t=>{t&&t.keyCode&&27==t.keyCode&&this.activateDefaultAction()};document.body.removeEventListener("keydown",t),document.body.addEventListener("keydown",t)}}activateAction(t){if(this.currentAction){if(this.currentAction==t)return!1;this.currentAction.deactivate(),clearTimeout(this.timeout)}this.currentAction=t,this.timeout=setTimeout(()=>{t.activate()},gl.CLICK_COUNT_TIMEOUT)}addAction(t){this.actions.push(t),t.map=this,t.interactions.forEach(e=>{this.addInteraction(e),e.map=t.map})}removeAction(t){this.currentAction==t&&this.activateDefaultAction(),t.interactions.forEach(t=>{this.removeInteraction(t)}),this.actions.splice(this.actions.indexOf(t),1)}activateDefaultAction(){this.actions.length>0&&this.actions[0]&&(this.currentAction==this.actions[0]&&(this.currentAction.deactivate(),this.currentAction=void 0),this.activateAction(this.actions[0]))}}class _l extends gl{constructor(t){t.layers=[t.customLayers.baseLayerGroup,t.customLayers.overlayGroup],t.controls=t.controls||[new Wr,new Zr,new ns({minWidth:128})],super(t),this.projection=t.projection,this.geoJSONFormat=new Yn({dataProjection:t.projection}),this.custom=t.custom||{},t.customLayers.overviewMapLayers&&t.customLayers.overviewMapLayers.length>0&&this.createOverviewMapControl(t),this.baseLayers=t.customLayers.baseLayerGroup.getLayers().getArray(),this.maxZoomViewToExtent=t.maxZoomViewToExtent||16}createOverviewMapControl(t){const e=this,i=t=>{const i=t=>{let i=0;return e.baseLayers.forEach((t,e)=>{t.getVisible()&&(i=e)}),t[i+1>=t.length?0:i+1]};t||(t=i(e.baseLayers)),e.baseLayers.forEach(e=>e.setVisible(e==t));const n=e.overviewMapControl.getOverviewMap().getLayers().getArray(),r=i(n);n.forEach(t=>t.setVisible(t==r)),e.render(),e.overviewMapControl.getOverviewMap().render()};this.overviewMapLayers=t.customLayers.overviewMapLayers,this.overviewMapControl=new aa({layers:this.overviewMapLayers,collapsed:!1,view:new ar({projection:this.projection})}),this.overviewMapControl.element.addEventListener("click",()=>i(),!1),t.view&&t.controls.push(this.overviewMapControl),this.custom.toggleBaseLayer=i}addBaseLayerAndOverlayMapLayer(t,e){t.setVisible(0===this.baseLayers.length),this.baseLayers.push(t),this.overviewMapControl?this.overviewMapControl.getOverviewMap().getLayers().getArray().push(e):this.createOverviewMapControl({customLayers:{overviewMapLayers:[e]}}),e.setVisible(2===this.overviewMapControl.getOverviewMap().getLayers().getArray().length)}getBaseLayers(){return this.getLayerGroup().getLayers().getArray()[0].getLayers().getArray()}getOverlayLayers(){return this.getLayerGroup().getLayers().getArray()[1].getLayers().getArray()}initializeView(t,e){if(!this.getView().getZoom()){const i=new ar({extent:this.projection.getExtent(),projection:this.projection,maxZoom:16,minZoom:2,center:[140860.69299028325,190532.7165957574],zoom:2});this.zoomViewToExtent(i,t,e),this.setView(i),this.overviewMapControl&&this.addControl(this.overviewMapControl)}}zoomToExtent(t,e){this.zoomViewToExtent(this.getView(),t,e)}zoomViewToExtent(t,e,i){e&&t.fit(e,{size:this.getSize()}),(i||this.maxZoomViewToExtent)&&t.getZoom()>(i||this.maxZoomViewToExtent)&&t.setZoom(i||this.maxZoomViewToExtent)}zoomToGeometry(t,e){const i={type:"FeatureCollection",features:[{type:"Feature",geometry:t}]};this.zoomToExtent(this.geoJSONFormat.readFeatures(i)[0].getGeometry().getExtent(),e)}showInfo(t,e){const i=document.createElement("div");i.setAttribute("class","close"),i.onclick=()=>event.currentTarget.parentNode.remove();const n=document.createElement("div");n.innerHTML=""+t+"
",n.setAttribute("class","info-tooltip"),n.appendChild(i);const r=new qr({offset:[0,-5],positioning:"bottom-center",element:n});this.addOverlay(r),r.setPosition(e),n.parentNode.style.position="fixed"}}var pl=function(){function t(t){this.opacity_=t.opacity,this.rotateWithView_=t.rotateWithView,this.rotation_=t.rotation,this.scale_=t.scale,this.scaleArray_=ia(t.scale),this.displacement_=t.displacement}return t.prototype.clone=function(){var e=this.getScale();return new t({opacity:this.getOpacity(),scale:Array.isArray(e)?e.slice():e,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()})},t.prototype.getOpacity=function(){return this.opacity_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getDisplacement=function(){return this.displacement_},t.prototype.getAnchor=function(){return Y()},t.prototype.getImage=function(t){return Y()},t.prototype.getHitDetectionImage=function(){return Y()},t.prototype.getPixelRatio=function(t){return 1},t.prototype.getImageState=function(){return Y()},t.prototype.getImageSize=function(){return Y()},t.prototype.getHitDetectionImageSize=function(){return Y()},t.prototype.getOrigin=function(){return Y()},t.prototype.getSize=function(){return Y()},t.prototype.setOpacity=function(t){this.opacity_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=ia(t)},t.prototype.listenImageChange=function(t){Y()},t.prototype.load=function(){Y()},t.prototype.unlistenImageChange=function(t){Y()},t}(),fl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ml=function(t){function e(e){var i=this,n=void 0!==e.rotateWithView&&e.rotateWithView;return(i=t.call(this,{opacity:1,rotateWithView:n,rotation:void 0!==e.rotation?e.rotation:0,scale:1,displacement:void 0!==e.displacement?e.displacement:[0,0]})||this).canvas_={},i.hitDetectionCanvas_=null,i.fill_=void 0!==e.fill?e.fill:null,i.origin_=[0,0],i.points_=e.points,i.radius_=void 0!==e.radius?e.radius:e.radius1,i.radius2_=e.radius2,i.angle_=void 0!==e.angle?e.angle:0,i.stroke_=void 0!==e.stroke?e.stroke:null,i.anchor_=null,i.size_=null,i.imageSize_=null,i.hitDetectionImageSize_=null,i.render(),i}return fl(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.getAnchor=function(){return this.anchor_},e.prototype.getAngle=function(){return this.angle_},e.prototype.getFill=function(){return this.fill_},e.prototype.getHitDetectionImage=function(){if(!this.hitDetectionCanvas_){var t=this.createRenderOptions();this.createHitDetectionCanvas_(t)}return this.hitDetectionCanvas_},e.prototype.getImage=function(t){if(!this.canvas_[t||1]){var e=this.createRenderOptions(),i=Pr(e.size*t||1,e.size*t||1);this.draw_(e,i,0,0,t||1),this.canvas_[t||1]=i.canvas}return this.canvas_[t||1]},e.prototype.getPixelRatio=function(t){return t},e.prototype.getImageSize=function(){return this.imageSize_},e.prototype.getHitDetectionImageSize=function(){return this.hitDetectionImageSize_},e.prototype.getImageState=function(){return uo},e.prototype.getOrigin=function(){return this.origin_},e.prototype.getPoints=function(){return this.points_},e.prototype.getRadius=function(){return this.radius_},e.prototype.getRadius2=function(){return this.radius2_},e.prototype.getSize=function(){return this.size_},e.prototype.getStroke=function(){return this.stroke_},e.prototype.listenImageChange=function(t){},e.prototype.load=function(){},e.prototype.unlistenImageChange=function(t){},e.prototype.createRenderOptions=function(){var t,e="round",i="round",n=0,r=null,s=0,o=0;return this.stroke_&&(null===(t=this.stroke_.getColor())&&(t="#000"),t=ks(t),void 0===(o=this.stroke_.getWidth())&&(o=1),r=this.stroke_.getLineDash(),s=this.stroke_.getLineDashOffset(),void 0===(i=this.stroke_.getLineJoin())&&(i="round"),void 0===(e=this.stroke_.getLineCap())&&(e="round"),void 0===(n=this.stroke_.getMiterLimit())&&(n=10)),{strokeStyle:t,strokeWidth:o,size:2*(this.radius_+o)+1,lineCap:e,lineDash:r,lineDashOffset:s,lineJoin:i,miterLimit:n}},e.prototype.render=function(){var t=this.createRenderOptions(),e=Pr(t.size,t.size);this.draw_(t,e,0,0,1),this.canvas_[1]=e.canvas;var i=e.canvas.width,n=i,r=this.getDisplacement();this.hitDetectionImageSize_=[t.size,t.size],this.createHitDetectionCanvas_(t),this.anchor_=[i/2-r[0],i/2+r[1]],this.size_=[i,i],this.imageSize_=[n,n]},e.prototype.draw_=function(t,e,i,n,r){var s,o,a;e.setTransform(r,0,0,r,0,0),e.translate(i,n),e.beginPath();var l=this.points_;if(l===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var h=void 0!==this.radius2_?this.radius2_:this.radius_;for(h!==this.radius_&&(l*=2),s=0;s<=l;s++)o=2*s*Math.PI/l-Math.PI/2+this.angle_,a=s%2==0?this.radius_:h,e.lineTo(t.size/2+a*Math.cos(o),t.size/2+a*Math.sin(o))}if(this.fill_){var c=this.fill_.getColor();null===c&&(c="#000"),e.fillStyle=ks(c),e.fill()}this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,e.setLineDash&&t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.lineCap=t.lineCap,e.lineJoin=t.lineJoin,e.miterLimit=t.miterLimit,e.stroke()),e.closePath()},e.prototype.createHitDetectionCanvas_=function(t){if(this.hitDetectionCanvas_=this.getImage(1),this.fill_){var e=this.fill_.getColor(),i=0;if("string"==typeof e&&(e=cs(e)),null===e?i=1:Array.isArray(e)&&(i=4===e.length?e[3]:1),0===i){var n=Pr(t.size,t.size);this.hitDetectionCanvas_=n.canvas,this.drawHitDetectionCanvas_(t,n,0,0)}}},e.prototype.drawHitDetectionCanvas_=function(t,e,i,n){e.translate(i,n),e.beginPath();var r=this.points_;if(r===1/0)e.arc(t.size/2,t.size/2,this.radius_,0,2*Math.PI,!0);else{var s=void 0!==this.radius2_?this.radius2_:this.radius_;s!==this.radius_&&(r*=2);var o=void 0,a=void 0,l=void 0;for(o=0;o<=r;o++)l=2*o*Math.PI/r-Math.PI/2+this.angle_,a=o%2==0?this.radius_:s,e.lineTo(t.size/2+a*Math.cos(l),t.size/2+a*Math.sin(l))}e.fillStyle="#000",e.fill(),this.stroke_&&(e.strokeStyle=t.strokeStyle,e.lineWidth=t.strokeWidth,t.lineDash&&(e.setLineDash(t.lineDash),e.lineDashOffset=t.lineDashOffset),e.stroke()),e.closePath()},e}(pl),yl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),vl=function(t){function e(e){var i=e||{};return t.call(this,{points:1/0,fill:i.fill,radius:i.radius,stroke:i.stroke,displacement:void 0!==i.displacement?i.displacement:[0,0]})||this}return yl(e,t),e.prototype.clone=function(){var t=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),displacement:this.getDisplacement().slice()});return t.setOpacity(this.getOpacity()),t.setScale(this.getScale()),t},e.prototype.setRadius=function(t){this.radius_=t,this.render()},e}(ml),xl=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0})},t.prototype.getColor=function(){return this.color_},t.prototype.setColor=function(t){this.color_=t},t}(),El=function(){function t(t){var e=t||{};this.color_=void 0!==e.color?e.color:null,this.lineCap_=e.lineCap,this.lineDash_=void 0!==e.lineDash?e.lineDash:null,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.width_=e.width}return t.prototype.clone=function(){var e=this.getColor();return new t({color:Array.isArray(e)?e.slice():e||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),width:this.getWidth()})},t.prototype.getColor=function(){return this.color_},t.prototype.getLineCap=function(){return this.lineCap_},t.prototype.getLineDash=function(){return this.lineDash_},t.prototype.getLineDashOffset=function(){return this.lineDashOffset_},t.prototype.getLineJoin=function(){return this.lineJoin_},t.prototype.getMiterLimit=function(){return this.miterLimit_},t.prototype.getWidth=function(){return this.width_},t.prototype.setColor=function(t){this.color_=t},t.prototype.setLineCap=function(t){this.lineCap_=t},t.prototype.setLineDash=function(t){this.lineDash_=t},t.prototype.setLineDashOffset=function(t){this.lineDashOffset_=t},t.prototype.setLineJoin=function(t){this.lineJoin_=t},t.prototype.setMiterLimit=function(t){this.miterLimit_=t},t.prototype.setWidth=function(t){this.width_=t},t}(),Il=function(){function t(t){var e=t||{};this.geometry_=null,this.geometryFunction_=Tl,void 0!==e.geometry&&this.setGeometry(e.geometry),this.fill_=void 0!==e.fill?e.fill:null,this.image_=void 0!==e.image?e.image:null,this.renderer_=void 0!==e.renderer?e.renderer:null,this.stroke_=void 0!==e.stroke?e.stroke:null,this.text_=void 0!==e.text?e.text:null,this.zIndex_=e.zIndex}return t.prototype.clone=function(){var e=this.getGeometry();return e&&"object"==typeof e&&(e=e.clone()),new t({geometry:e,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})},t.prototype.getRenderer=function(){return this.renderer_},t.prototype.setRenderer=function(t){this.renderer_=t},t.prototype.getGeometry=function(){return this.geometry_},t.prototype.getGeometryFunction=function(){return this.geometryFunction_},t.prototype.getFill=function(){return this.fill_},t.prototype.setFill=function(t){this.fill_=t},t.prototype.getImage=function(){return this.image_},t.prototype.setImage=function(t){this.image_=t},t.prototype.getStroke=function(){return this.stroke_},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.getText=function(){return this.text_},t.prototype.setText=function(t){this.text_=t},t.prototype.getZIndex=function(){return this.zIndex_},t.prototype.setGeometry=function(t){"function"==typeof t?this.geometryFunction_=t:"string"==typeof t?this.geometryFunction_=function(e){return e.get(t)}:t?void 0!==t&&(this.geometryFunction_=function(){return t}):this.geometryFunction_=Tl,this.geometry_=t},t.prototype.setZIndex=function(t){this.zIndex_=t},t}();var Cl=null;function wl(t,e){if(!Cl){var i=new xl({color:"rgba(255,255,255,0.4)"}),n=new El({color:"#3399CC",width:1.25});Cl=[new Il({image:new vl({fill:i,stroke:n,radius:5}),fill:i,stroke:n})]}return Cl}function Sl(){var t={},e=[255,255,255,1],i=[0,153,255,1];return t[De.POLYGON]=[new Il({fill:new xl({color:[255,255,255,.5]})})],t[De.MULTI_POLYGON]=t[De.POLYGON],t[De.LINE_STRING]=[new Il({stroke:new El({color:e,width:5})}),new Il({stroke:new El({color:i,width:3})})],t[De.MULTI_LINE_STRING]=t[De.LINE_STRING],t[De.CIRCLE]=t[De.POLYGON].concat(t[De.LINE_STRING]),t[De.POINT]=[new Il({image:new vl({radius:6,fill:new xl({color:i}),stroke:new El({color:e,width:1.5})}),zIndex:1/0})],t[De.MULTI_POINT]=t[De.POINT],t[De.GEOMETRY_COLLECTION]=t[De.POLYGON].concat(t[De.LINE_STRING],t[De.POINT]),t}function Tl(t){return t.getGeometry()}var Ll=Il,Nl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Ol="select",Rl=function(t){function e(e,i,n,r){var s=t.call(this,e)||this;return s.selected=i,s.deselected=n,s.mapBrowserEvent=r,s}return Nl(e,t),e}(s),Pl={};var bl=function(t){function e(e){var i,n,r=t.call(this)||this,s=e||{};if(r.boundAddFeature_=r.addFeature_.bind(r),r.boundRemoveFeature_=r.removeFeature_.bind(r),r.condition_=s.condition?s.condition:Sa,r.addCondition_=s.addCondition?s.addCondition:Ca,r.removeCondition_=s.removeCondition?s.removeCondition:Ca,r.toggleCondition_=s.toggleCondition?s.toggleCondition:La,r.multi_=!!s.multi&&s.multi,r.filter_=s.filter?s.filter:_,r.hitTolerance_=s.hitTolerance?s.hitTolerance:0,r.style_=void 0!==s.style?s.style:(d((i=Sl())[De.POLYGON],i[De.LINE_STRING]),d(i[De.GEOMETRY_COLLECTION],i[De.LINE_STRING]),function(t){return t.getGeometry()?i[t.getGeometry().getType()]:null}),r.features_=s.features||new Fo,s.layers)if("function"==typeof s.layers)n=s.layers;else{var o=s.layers;n=function(t){return h(o,t)}}else n=_;return r.layerFilter_=n,r.featureLayerAssociation_={},r}return Nl(e,t),e.prototype.addFeatureLayerAssociation_=function(t,e){this.featureLayerAssociation_[q(t)]=e},e.prototype.getFeatures=function(){return this.features_},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.getLayer=function(t){return this.featureLayerAssociation_[q(t)]},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){this.getMap()&&this.style_&&this.features_.forEach(this.restorePreviousStyle_.bind(this)),t.prototype.setMap.call(this,e),e?(this.features_.addEventListener(Ro,this.boundAddFeature_),this.features_.addEventListener(Po,this.boundRemoveFeature_),this.style_&&this.features_.forEach(this.applySelectedStyle_.bind(this))):(this.features_.removeEventListener(Ro,this.boundAddFeature_),this.features_.removeEventListener(Po,this.boundRemoveFeature_))},e.prototype.addFeature_=function(t){var e=t.element;this.style_&&this.applySelectedStyle_(e)},e.prototype.removeFeature_=function(t){var e=t.element;this.style_&&this.restorePreviousStyle_(e)},e.prototype.getStyle=function(){return this.style_},e.prototype.applySelectedStyle_=function(t){var e=q(t);e in Pl||(Pl[e]=t.getStyle()),t.setStyle(this.style_)},e.prototype.restorePreviousStyle_=function(t){var i=q(t),n=this.getMap().getInteractions().getArray().filter((function(i){return i instanceof e&&i.getStyle()&&-1!==i.getFeatures().getArray().indexOf(t)}));n.length>0?t.setStyle(n[n.length-1].getStyle()):(t.setStyle(Pl[i]),delete Pl[i])},e.prototype.removeFeatureLayerAssociation_=function(t){delete this.featureLayerAssociation_[q(t)]},e.prototype.handleEvent=function(t){if(!this.condition_(t))return!0;var e=this.addCondition_(t),i=this.removeCondition_(t),n=this.toggleCondition_(t),r=!e&&!i&&!n,s=t.map,o=this.getFeatures(),a=[],l=[];if(r){y(this.featureLayerAssociation_),s.forEachFeatureAtPixel(t.pixel,function(t,e){if(this.filter_(t,e))return l.push(t),this.addFeatureLayerAssociation_(t,e),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var c=o.getLength()-1;c>=0;--c){var u=o.item(c),d=l.indexOf(u);d>-1?l.splice(d,1):(o.remove(u),a.push(u))}0!==l.length&&o.extend(l)}else{s.forEachFeatureAtPixel(t.pixel,function(t,r){if(this.filter_(t,r))return!e&&!n||h(o.getArray(),t)?(i||n)&&h(o.getArray(),t)&&(a.push(t),this.removeFeatureLayerAssociation_(t)):(l.push(t),this.addFeatureLayerAssociation_(t,r)),!this.multi_}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_});for(var g=a.length-1;g>=0;--g)o.remove(a[g]);o.extend(l)}return(l.length>0||a.length>0)&&this.dispatchEvent(new Rl(Ol,l,a,t)),!0},e}(ua);class Ml{constructor(t){Array.isArray(t)||(t=[t]),this.interactions=[],t.forEach(t=>{this.addInteraction(t)})}addInteraction(t){t.setActive(!1),this.interactions.push(t)}activate(){this.interactions.forEach(t=>{t.setActive(!0)})}deactivate(){this.interactions.forEach(t=>{t.setActive(!1)})}}class Al extends Ml{constructor(t,e,i){const n=i&&i.cluster,r=i&&i.filter?i.filter:()=>!0,s=i?i.style:null,o=i&&i.hoverStyle||s,a=(t,e)=>(this.selectInteraction.getFeatures().clear(),this.filter(t,e)),l=(t,e)=>{const i=-1!==this.selectInteraction.getFeatures().getArray().indexOf(t);return this.filter(t,e)&&!i},h=new bl({filter:l,condition:wa,style:o,layers:[t]}),c=new bl({style:s,layers:[t]}),u=new bl({filter:a,condition:Ea,style:s,layers:[t]});super([c,u,h]),this.cluster=n,this.filter=r,this.layer=t,this.style=s,this.hoverStyle=o,this.hoverInteraction=h,this.markInteraction=c,this.selectInteraction=u,this.hoverInteraction.on("select",()=>{const t=this.map.getTargetElement();this.hoverInteraction.getFeatures().getLength()>0?t.style.cursor="pointer":t.style.cursor="",this.map.render()}),this.selectedFeature=null,this.getLayer=()=>t;const d=t=>{let e=t.getArray().indexOf(this.selectedFeature)+1;return e>t.getLength()-1&&(e=0),t.getArray()[e]};this.selectInteraction.on("select",t=>{this.markInteraction.getFeatures().clear(),this.selectInteraction.getFeatures().getLength()>0?(1===this.selectInteraction.getFeatures().getLength()?this.selectedFeature=this.selectInteraction.getFeatures().getArray()[0]:this.selectedFeature=d(this.selectInteraction.getFeatures()),e&&e(this.selectedFeature,t,this.getLayer())):(this.selectedFeature=null,e&&e()),this.map.render()}),this.selectInteractionFilter=a,this.hoverInteractionFilter=l}_fixClusterBehavior(){if(this.selectedFeature){const t=this.selectedFeature.get("features")||[this.selectedFeature];this.selectInteraction.getFeatures().clear(),this.markInteraction.getFeatures().clear(),t&&t.forEach(t=>{t.getId()&&this.markFeatureWithId(t.getId())})}}getClusterWithFeatureId(t,e){for(let i=0;ithis._fixClusterBehavior(),this.map.on("moveend",this._fixClusterBehaviorListener),this.selectInteraction.on("select",this._fixClusterBehaviorListener)),super.activate()}deactivate(){this._fixClusterBehaviorListener&&(this.map.un("moveend",this._fixClusterBehaviorListener),this.selectInteraction.un("select",this._fixClusterBehaviorListener)),this.clearFeatures(),super.deactivate()}selectFeature(t){this.selectInteraction.getFeatures().push(t),this.selectInteraction.dispatchEvent({type:"select",feature:t})}getSelectedFeatures(){return this.selectInteraction.getFeatures()}deselect(){this.selectedFeature=null}markFeatureWithId(t,e){const i=(e=e||this.layer).getSource().getFeatureById(t)||this.getClusterWithFeatureId(e.getSource().getFeatures(),t);i&&-1===this.markInteraction.getFeatures().getArray().indexOf(i)&&this.markInteraction.getFeatures().push(i)}isMarked(t){let e=!1;return this.markInteraction.getFeatures().forEach(i=>{i===t&&(e=!0)}),e}demarkAllFeatures(){this.markInteraction.getFeatures().clear()}}class Fl extends Al{constructor(t,e,i){super(t,t=>{t&&e([t])},i),this.dragBoxInteraction=new za({style:new Ll({stroke:new El({color:[0,0,255,1]})})}),this.addInteraction(this.dragBoxInteraction),this.dragBoxInteraction.on("boxdrag",()=>{const e=this.dragBoxInteraction.getGeometry().getExtent();this.hoverInteraction.getFeatures().clear(),t.getSource().forEachFeatureIntersectingExtent(e,t=>{this.hoverInteraction.getFeatures().push(t)})}),this.dragBoxInteraction.on("boxend",()=>{this.hoverInteraction.getFeatures().getLength()>0&&e(this.hoverInteraction.getFeatures().getArray().slice(0))})}}class Dl extends Fl{constructor(t,e,i){const n=new Ll({fill:new xl({color:"rgba(217, 83, 79, 0.6)"}),stroke:new El({color:"#d9534f",width:5}),image:new vl({radius:4,stroke:new El({color:"#d9534f",width:5}),fill:new xl({color:"rgba(217, 83, 79, 0.6)"})})}),r=i&&i.style||n,s=e=>{e&&t.getSource().getFeatureById(e.getId())===e&&t.getSource().removeFeature(e)};super(t,t=>{e&&null!=e?e(t,t=>{s(t),this.clearFeatures()},()=>{this.clearFeatures()}):(t.forEach(t=>{s(t)}),this.clearFeatures())},{style:r})}}var Gl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),kl=function(t){function e(e,i,n){var r=t.call(this)||this;if(void 0!==n&&void 0===i)r.setFlatCoordinates(n,e);else{var s=i||0;r.setCenterAndRadius(e,s,n)}return r}return Gl(e,t),e.prototype.clone=function(){return new e(this.flatCoordinates.slice(),void 0,this.layout)},e.prototype.closestPointXY=function(t,e,i,n){var r=this.flatCoordinates,s=t-r[0],o=e-r[1],a=s*s+o*o;if(a=e[0]||(t[1]<=e[1]&&t[3]>=e[1]||zt(t,this.intersectsCoordinate.bind(this)))}return!1},e.prototype.setCenter=function(t){var e=this.stride,i=this.flatCoordinates[e]-this.flatCoordinates[0],n=t.slice();n[e]=n[0]+i;for(var r=1;rthis.maxLineWidth&&(this.maxLineWidth=i.lineWidth,this.bufferedMaxExtent_=null)}else i.strokeStyle=void 0,i.lineCap=void 0,i.lineDash=null,i.lineDashOffset=void 0,i.lineJoin=void 0,i.lineWidth=void 0,i.miterLimit=void 0},e.prototype.createFill=function(t){var e=t.fillStyle,i=[Hl.SET_FILL_STYLE,e];return"string"!=typeof e&&i.push(!0),i},e.prototype.applyStroke=function(t){this.instructions.push(this.createStroke(t))},e.prototype.createStroke=function(t){return[Hl.SET_STROKE_STYLE,t.strokeStyle,t.lineWidth*this.pixelRatio,t.lineCap,t.lineJoin,t.miterLimit,this.applyPixelRatio(t.lineDash),t.lineDashOffset*this.pixelRatio]},e.prototype.updateFillStyle=function(t,e){var i=t.fillStyle;"string"==typeof i&&t.currentFillStyle==i||(void 0!==i&&this.instructions.push(e.call(this,t)),t.currentFillStyle=i)},e.prototype.updateStrokeStyle=function(t,e){var i=t.strokeStyle,n=t.lineCap,r=t.lineDash,s=t.lineDashOffset,o=t.lineJoin,a=t.lineWidth,l=t.miterLimit;(t.currentStrokeStyle!=i||t.currentLineCap!=n||r!=t.currentLineDash&&!g(t.currentLineDash,r)||t.currentLineDashOffset!=s||t.currentLineJoin!=o||t.currentLineWidth!=a||t.currentMiterLimit!=l)&&(void 0!==i&&e.call(this,t),t.currentStrokeStyle=i,t.currentLineCap=n,t.currentLineDash=r,t.currentLineDashOffset=s,t.currentLineJoin=o,t.currentLineWidth=a,t.currentMiterLimit=l)},e.prototype.endGeometry=function(t){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;var e=[Hl.END_GEOMETRY,t];this.instructions.push(e),this.hitDetectionInstructions.push(e)},e.prototype.getBufferedMaxExtent=function(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=Et(this.maxExtent),this.maxLineWidth>0)){var t=this.resolution*(this.maxLineWidth+1)/2;xt(this.bufferedMaxExtent_,t,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_},e}(Gs),Jl=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),$l=function(t){function e(e,i,n,r){var s=t.call(this,e,i,n,r)||this;return s.declutterGroups_=null,s.hitDetectionImage_=null,s.image_=null,s.imagePixelRatio_=void 0,s.anchorX_=void 0,s.anchorY_=void 0,s.height_=void 0,s.opacity_=void 0,s.originX_=void 0,s.originY_=void 0,s.rotateWithView_=void 0,s.rotation_=void 0,s.scale_=void 0,s.width_=void 0,s}return Jl(e,t),e.prototype.drawCoordinates_=function(t,e,i,n){return this.appendFlatCoordinates(t,e,i,n,!1,!1)},e.prototype.drawPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,s=this.drawCoordinates_(i,0,i.length,n);this.instructions.push([Hl.DRAW_IMAGE,r,s,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,this.declutterGroups_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_)]),this.hitDetectionInstructions.push([Hl.DRAW_IMAGE,r,s,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.drawMultiPoint=function(t,e){if(this.image_){this.beginGeometry(t,e);var i=t.getFlatCoordinates(),n=t.getStride(),r=this.coordinates.length,s=this.drawCoordinates_(i,0,i.length,n);this.instructions.push([Hl.DRAW_IMAGE,r,s,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,this.declutterGroups_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_)]),this.hitDetectionInstructions.push([Hl.DRAW_IMAGE,r,s,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.declutterGroups_,this.height_,this.opacity_,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_]),this.endGeometry(e)}},e.prototype.finish=function(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,t.prototype.finish.call(this)},e.prototype.setImageStyle=function(t,e){var i=t.getAnchor(),n=t.getSize(),r=t.getHitDetectionImage(),s=t.getImage(this.pixelRatio),o=t.getOrigin();this.imagePixelRatio_=t.getPixelRatio(this.pixelRatio),this.anchorX_=i[0],this.anchorY_=i[1],this.declutterGroups_=e,this.hitDetectionImage_=r,this.image_=s,this.height_=n[1],this.opacity_=t.getOpacity(),this.originX_=o[0],this.originY_=o[1],this.rotateWithView_=t.getRotateWithView(),this.rotation_=t.getRotation(),this.scale_=t.getScaleArray(),this.width_=n[0]},e}(Kl),Ql=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),th=function(t){function e(e,i,n,r){return t.call(this,e,i,n,r)||this}return Ql(e,t),e.prototype.drawFlatCoordinates_=function(t,e,i,n){var r=this.coordinates.length,s=this.appendFlatCoordinates(t,e,i,n,!1,!1),o=[Hl.MOVE_TO_LINE_TO,r,s];return this.instructions.push(o),this.hitDetectionInstructions.push(o),i},e.prototype.drawLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Hl.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Ul);var s=t.getFlatCoordinates(),o=t.getStride();this.drawFlatCoordinates_(s,0,s.length,o),this.hitDetectionInstructions.push(jl),this.endGeometry(e)}},e.prototype.drawMultiLineString=function(t,e){var i=this.state,n=i.strokeStyle,r=i.lineWidth;if(void 0!==n&&void 0!==r){this.updateStrokeStyle(i,this.applyStroke),this.beginGeometry(t,e),this.hitDetectionInstructions.push([Hl.SET_STROKE_STYLE,i.strokeStyle,i.lineWidth,i.lineCap,i.lineJoin,i.miterLimit,i.lineDash,i.lineDashOffset],Ul);for(var s=t.getEnds(),o=t.getFlatCoordinates(),a=t.getStride(),l=0,h=0,c=s.length;ht&&(m>f&&(f=m,_=y,p=s),m=0,y=s-r)),o=a,c=d,u=g),l=v,h=x}return(m+=a)>f?[y,s]:[_,p]}var oh=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ah={left:0,end:0,center:.5,right:1,start:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},lh={Circle:ih,Default:Kl,Image:$l,LineString:th,Polygon:ih,Text:function(t){function e(e,i,n,r){var s=t.call(this,e,i,n,r)||this;return s.declutterGroups_,s.labels_=null,s.text_="",s.textOffsetX_=0,s.textOffsetY_=0,s.textRotateWithView_=void 0,s.textRotation_=0,s.textFillState_=null,s.fillStates={},s.textStrokeState_=null,s.strokeStates={},s.textState_={},s.textStates={},s.textKey_="",s.fillKey_="",s.strokeKey_="",s}return oh(e,t),e.prototype.finish=function(){var e=t.prototype.finish.call(this);return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e},e.prototype.drawText=function(t,e){var i=this.textFillState_,n=this.textStrokeState_,r=this.textState_;if(""!==this.text_&&r&&(i||n)){var s,o,a=this.coordinates.length,l=t.getType(),h=null,c=2,u=t.getStride();if(r.placement===rh){if(!re(this.getBufferedMaxExtent(),t.getExtent()))return;var d=void 0;if(h=t.getFlatCoordinates(),l==De.LINE_STRING)d=[h.length];else if(l==De.MULTI_LINE_STRING)d=t.getEnds();else if(l==De.POLYGON)d=t.getEnds().slice(0,1);else if(l==De.MULTI_POLYGON){var g=t.getEndss();for(d=[],s=0,o=g.length;s_[_.length-n]}else d=t[e]>t[i-n];for(var p,f,m=r.length,y=t[e],v=t[e+1],x=t[e+=n],E=t[e+1],I=0,C=Math.sqrt(Math.pow(x-y,2)+Math.pow(E-v,2)),w=!1,S=0;S0?-Math.PI:Math.PI),void 0!==f){var P=R-f;if(w=w||0!==P,P+=P>Math.PI?-2*Math.PI:P<-Math.PI?2*Math.PI:0,Math.abs(P)>o)return null}f=R;var b=O/C,M=ve(y,x,b),A=ve(v,E,b);g[p]=[M,A,L/2,R,T],s+=L}return w?g:[[g[0][0],g[0][1],g[0][2],g[0][3],r]]}var mh=[1/0,1/0,-1/0,-1/0],yh=[1,0,0,1,0,0],vh=[],xh=[],Eh=[],Ih=[],Ch=function(){function t(t,e,i,n,r){this.overlaps=i,this.pixelRatio=e,this.resolution=t,this.alignFill_,this.declutterItems=[],this.instructions=n.instructions,this.coordinates=n.coordinates,this.coordinateCache_={},this.renderBuffer_=r,this.renderedTransform_=[1,0,0,1,0,0],this.hitDetectionInstructions=n.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=n.fillStates||{},this.strokeStates=n.strokeStates||{},this.textStates=n.textStates||{},this.widths_={},this.labels_={}}return t.prototype.createLabel=function(t,e,i,n){var r=t+e+i+n;if(this.labels_[r])return this.labels_[r];var s=n?this.strokeStates[n]:null,o=i?this.fillStates[i]:null,a=this.textStates[e],l=this.pixelRatio,h=[a.scale[0]*l,a.scale[1]*l],c=ah[a.textAlign||"center"],u=n&&s.lineWidth?s.lineWidth:0,d=t.split("\n"),g=d.length,_=[],p=function(t,e,i){for(var n=e.length,r=0,s=0;sr.width?r.width-c:p,E=l+u>r.height?r.height-u:l,I=f[3]+x*g[0]+f[1],C=f[0]+E*g[1]+f[2],w=i-f[3],S=n-f[0];(v||0!==d)&&(vh[0]=w,Ih[0]=w,vh[1]=S,xh[1]=S,xh[0]=w+I,Eh[0]=xh[0],Eh[1]=S+C,Ih[1]=Eh[1]);var T=null;if(0!==d){var L=i+s,N=n+o;T=ot(yh,L,N,1,1,d,-L,-N),st(yh,vh),st(yh,xh),st(yh,Eh),st(yh,Ih),Nt(Math.min(vh[0],xh[0],Eh[0],Ih[0]),Math.min(vh[1],xh[1],Eh[1],Ih[1]),Math.max(vh[0],xh[0],Eh[0],Ih[0]),Math.max(vh[1],xh[1],Eh[1],Ih[1]),mh)}else Nt(w,S,w+I,S+C,mh);var O=0,R=0;if(a){var P=this.renderBuffer_;P[0]=Math.max(P[0],ne(mh)),O=P[0],P[1]=Math.max(P[1],Kt(mh)),R=P[1]}var b=t.canvas,M=y?y[2]*g[0]/2:0,A=mh[0]-M<=(b.width+O)/e&&mh[2]+M>=-O/e&&mh[1]-M<=(b.height+R)/e&&mh[3]+M>=-R/e;if(_&&(i=Math.round(i),n=Math.round(n)),a){if(!A&&1==a[0])return!1;var F=A?[t,T?T.slice(0):null,h,r,c,u,x,E,i,n,g,mh.slice()]:null;F&&(v&&F.push(m,y,vh.slice(0),xh.slice(0),Eh.slice(0),Ih.slice(0)),a.push(F))}else A&&(v&&this.replayTextBackground_(t,vh,xh,Eh,Ih,m,y,!1),Qs(t,T,h,r,c,u,x,E,i,n,g));return!0},t.prototype.fill_=function(t){if(this.alignFill_){var e=st(this.renderedTransform_,[0,0]),i=512*this.pixelRatio;t.save(),t.translate(e[0]%i,e[1]%i),t.rotate(this.viewRotation_)}t.fill(),this.alignFill_&&t.restore()},t.prototype.setStrokeStyle_=function(t,e){t.strokeStyle=e[1],t.lineWidth=e[2],t.lineCap=e[3],t.lineJoin=e[4],t.miterLimit=e[5],t.setLineDash&&(t.lineDashOffset=e[7],t.setLineDash(e[6]))},t.prototype.renderDeclutter=function(t,e,i,n){for(var r=[],s=1,o=t.length;s12&&this.replayTextBackground_(u[0],u[14],u[15],u[16],u[17],u[12],u[13],!0),Qs.apply(void 0,u),g!==i&&(d.globalAlpha=g)}}return t.length=1,n},t.prototype.drawLabelWithPointPlacement_=function(t,e,i,n){var r=this.textStates[e],s=this.createLabel(t,e,n,i),o=this.strokeStates[i],a=this.pixelRatio,l=ah[r.textAlign||"center"],h=ah[r.textBaseline||"middle"],c=o&&o.lineWidth?o.lineWidth:0;return{label:s,anchorX:l*(s.width/a-2*r.scale[0])+2*(.5-l)*c,anchorY:h*s.height/a+2*(.5-h)*c}},t.prototype.execute_=function(t,e,i,n,r,s,o){var a,l,h;this.declutterItems.length=0,this.pixelCoordinates_&&g(i,this.renderedTransform_)?a=this.pixelCoordinates_:(this.pixelCoordinates_||(this.pixelCoordinates_=[]),a=pi(this.coordinates,0,this.coordinates.length,2,i,this.pixelCoordinates_),l=this.renderedTransform_,h=i,l[0]=h[0],l[1]=h[1],l[2]=h[2],l[3]=h[3],l[4]=h[4],l[5]=h[5]);for(var c,u,d,_,p,f,m,y,v,x,E,I,C,w,S,T,L,N=0,O=n.length,R=0,P=0,b=0,M=null,A=null,F=this.coordinateCache_,D=this.viewRotation_,G=Math.round(1e12*Math.atan2(-i[1],i[0]))/1e12,k={context:t,pixelRatio:this.pixelRatio,resolution:this.resolution,rotation:D},V=this.instructions!=n||this.overlaps?0:200;NV&&(this.fill_(t),P=0),b>V&&(t.stroke(),b=0),P||b||(t.beginPath(),_=NaN,p=NaN),++N;break;case Hl.CIRCLE:var Y=a[R=B[1]],z=a[R+1],q=a[R+2]-Y,X=a[R+3]-z,j=Math.sqrt(q*q+X*X);t.moveTo(Y+j,z),t.arc(Y,z,j,0,2*Math.PI,!0),++N;break;case Hl.CLOSE_PATH:t.closePath(),++N;break;case Hl.CUSTOM:R=B[1],c=B[2];var U=B[3],W=B[4],H=6==B.length?B[5]:void 0;k.geometry=U,k.feature=S,N in F||(F[N]=[]);var Z=F[N];H?H(a,R,c,2,Z):(Z[0]=a[R],Z[1]=a[R+1],Z.length=2),W(Z,k),++N;break;case Hl.DRAW_IMAGE:R=B[1],c=B[2],x=B[3],u=B[4],d=B[5],v=s?null:B[6];var K=B[7],J=B[8],$=B[9],Q=B[10],tt=B[11],et=B[12],it=B[13],nt=B[14];if(!x&&B.length>=19){E=B[18],I=B[19],C=B[20],w=B[21];var rt=this.drawLabelWithPointPlacement_(E,I,C,w);x=rt.label,B[3]=x;var st=B[22];u=(rt.anchorX-st)*this.pixelRatio,B[4]=u;var ot=B[23];d=(rt.anchorY-ot)*this.pixelRatio,B[5]=d,K=x.height,B[7]=K,nt=x.width,B[14]=nt}var at=void 0;B.length>24&&(at=B[24]);var lt=void 0,ht=void 0,ct=void 0;B.length>16?(lt=B[15],ht=B[16],ct=B[17]):(lt=Bs,ht=!1,ct=!1),tt&&G?et+=D:tt||G||(et-=D);for(var ut=0,dt=0;R=s;)Lh(i,t+r,t+s),Lh(i,t+s,t+r),Lh(i,t-s,t+r),Lh(i,t-r,t+s),Lh(i,t-r,t-s),Lh(i,t-s,t-r),Lh(i,t+s,t-r),Lh(i,t+r,t-s),s++,2*((o+=1+2*s)-r)+1>0&&(o+=1-2*(r-=1));return Th[t]=i,i}(n);function g(t){for(var e=c.getImageData(0,0,o,o).data,i=0;i0){var a=void 0;return(!s||u!=so&&u!=lo||-1!==s.indexOf(t))&&(a=r(t)),a||void c.clearRect(0,0,o,o)}}var _,p,f,m,y,v=Object.keys(this.executorsByZIndex_).map(Number);for(v.sort(l),_=v.length-1;_>=0;--_){var x=v[_].toString();for(f=this.executorsByZIndex_[x],p=wh.length-1;p>=0;--p)if(void 0!==(m=f[u=wh[p]])&&(y=m.executeHitDetection(c,a,i,g,h)))return y}},t.prototype.getClipCoords=function(t){var e=this.maxExtent_;if(!e)return null;var i=e[0],n=e[1],r=e[2],s=e[3],o=[i,n,i,s,r,s,r,n];return pi(o,0,8,2,t,o),o},t.prototype.isEmpty=function(){return x(this.executorsByZIndex_)},t.prototype.execute=function(t,e,i,n,r,s,o){var a=Object.keys(this.executorsByZIndex_).map(Number);a.sort(l),this.maxExtent_&&(t.save(),this.clip(t,i));var h,c,u,d,g,_,p=s||wh;for(h=0,c=a.length;h=r)for(n=r;n0,6);var u=void 0!==n.src?ho:uo;return i.color_=void 0!==n.color?cs(n.color):null,i.iconImage_=function(t,e,i,n,r,s){var o=ps.get(e,n,s);return o||(o=new Yh(t,e,i,n,r,s),ps.set(e,n,s,o)),o}(l,c,h,i.crossOrigin_,u,i.color_),i.offset_=void 0!==n.offset?n.offset:[0,0],i.offsetOrigin_=void 0!==n.offsetOrigin?n.offsetOrigin:Mh,i.origin_=null,i.size_=void 0!==n.size?n.size:null,i}return zh(e,t),e.prototype.clone=function(){var t=this.getScale();return new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,crossOrigin:this.crossOrigin_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,src:this.getSrc(),offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,size:null!==this.size_?this.size_.slice():void 0,opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView()})},e.prototype.getAnchor=function(){if(this.normalizedAnchor_)return this.normalizedAnchor_;var t=this.anchor_,e=this.getSize();if(this.anchorXUnits_==Oh||this.anchorYUnits_==Oh){if(!e)return null;t=this.anchor_.slice(),this.anchorXUnits_==Oh&&(t[0]*=e[0]),this.anchorYUnits_==Oh&&(t[1]*=e[1])}if(this.anchorOrigin_!=Mh){if(!e)return null;t===this.anchor_&&(t=this.anchor_.slice()),this.anchorOrigin_!=Ah&&this.anchorOrigin_!=bh||(t[0]=-t[0]+e[0]),this.anchorOrigin_!=Ph&&this.anchorOrigin_!=bh||(t[1]=-t[1]+e[1])}return this.normalizedAnchor_=t,this.normalizedAnchor_},e.prototype.setAnchor=function(t){this.anchor_=t,this.normalizedAnchor_=null},e.prototype.getColor=function(){return this.color_},e.prototype.getImage=function(t){return this.iconImage_.getImage(t)},e.prototype.getPixelRatio=function(t){return this.iconImage_.getPixelRatio(t)},e.prototype.getImageSize=function(){return this.iconImage_.getSize()},e.prototype.getHitDetectionImageSize=function(){return this.getImageSize()},e.prototype.getImageState=function(){return this.iconImage_.getImageState()},e.prototype.getHitDetectionImage=function(){return this.iconImage_.getHitDetectionImage()},e.prototype.getOrigin=function(){if(this.origin_)return this.origin_;var t=this.offset_,e=this.getDisplacement();if(this.offsetOrigin_!=Mh){var i=this.getSize(),n=this.iconImage_.getSize();if(!i||!n)return null;t=t.slice(),this.offsetOrigin_!=Ah&&this.offsetOrigin_!=bh||(t[0]=n[0]-i[0]-t[0]),this.offsetOrigin_!=Ph&&this.offsetOrigin_!=bh||(t[1]=n[1]-i[1]-t[1])}return t[0]+=e[0],t[1]+=e[1],this.origin_=t,this.origin_},e.prototype.getSrc=function(){return this.iconImage_.getSrc()},e.prototype.getSize=function(){return this.size_?this.size_:this.iconImage_.getSize()},e.prototype.listenImageChange=function(t){this.iconImage_.addEventListener(w,t)},e.prototype.load=function(){this.iconImage_.load()},e.prototype.unlistenImageChange=function(t){this.iconImage_.removeEventListener(w,t)},e}(pl);var Xh=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),jh=function(t){function e(e){var i=t.call(this,e)||this;return i.boundHandleStyleImageChange_=i.handleStyleImageChange_.bind(i),i.animatingOrInteracting_,i.dirty_=!1,i.hitDetectionImageData_=null,i.renderedFeatures_=null,i.renderedRevision_=-1,i.renderedResolution_=NaN,i.renderedExtent_=[1/0,1/0,-1/0,-1/0],i.renderedRotation_,i.renderedCenter_=null,i.renderedProjection_=null,i.renderedRenderOrder_=null,i.replayGroup_=null,i.replayGroupChanged=!0,i.clipping=!0,i}return Xh(e,t),e.prototype.useContainer=function(e,i,n){n<1&&(e=null),t.prototype.useContainer.call(this,e,i,n)},e.prototype.renderFrame=function(t,e){var i=t.pixelRatio,n=t.layerStatesArray[t.layerIndex];!function(t,e,i){rt(t,e,0,0,i,0,0)}(this.pixelTransform,1/i,1/i),at(this.inversePixelTransform,this.pixelTransform);var r=lt(this.pixelTransform);this.useContainer(e,r,n.opacity);var s=this.context,o=s.canvas,a=this.replayGroup_;if(!a||a.isEmpty())return!this.containerReused&&o.width>0&&(o.width=0),this.container;var h=Math.round(t.size[0]*i),c=Math.round(t.size[1]*i);o.width!=h||o.height!=c?(o.width=h,o.height=c,o.style.transform!==r&&(o.style.transform=r)):this.containerReused||s.clearRect(0,0,h,c),this.preRender(s,t);var u=t.extent,d=t.viewState,g=d.center,_=d.resolution,p=d.projection,f=d.rotation,m=p.getExtent(),y=this.getLayer().getSource(),v=!1;if(n.extent&&this.clipping){var x=_i(n.extent,p);(v=!wt(x,t.extent)&&re(x,t.extent))&&this.clipUnrotated(s,t,x)}var E=t.viewHints,I=!(E[zn]||E[qn]),C=this.getRenderTransform(g,_,f,i,h,c,0),w=this.getLayer().getDeclutter()?{}:null;if(a.execute(s,1,C,f,I,void 0,w),y.getWrapX()&&p.canWrapX()&&!wt(m,u)){for(var S=u[0],T=ne(m),L=0,N=void 0;Sm[2];){N=T*++L;var R=this.getRenderTransform(g,_,f,i,h,c,N);a.execute(s,1,R,f,I,void 0,w),S-=T}}if(w){var P=t.viewHints;!function(t,e,i,n,r,s){for(var o=Object.keys(t).map(Number).sort(l),a=0,h=o.length;a0&&(u=_,s.push({items:_.declutterItems,opacity:n}))}}(w,s,f,1,!(P[zn]||P[qn]),t.declutterItems)}v&&s.restore(),this.postRender(s,t);var b=n.opacity,M=this.container;return b!==parseFloat(M.style.opacity)&&(M.style.opacity=1===b?"":String(b)),this.renderedRotation_!==d.rotation&&(this.renderedRotation_=d.rotation,this.hitDetectionImageData_=null),this.container},e.prototype.getFeatures=function(t){return new Promise(function(e,i){if(!this.hitDetectionImageData_&&!this.animatingOrInteracting_){var n=[this.context.canvas.width,this.context.canvas.height];st(this.pixelTransform,n);var r=this.renderedCenter_,s=this.renderedResolution_,o=this.renderedRotation_,a=this.renderedProjection_,h=this.renderedExtent_,c=this.getLayer(),u=[],d=n[0]/2,g=n[1]/2;u.push(this.getRenderTransform(r,s,o,.5,d,g,0).slice());var _=c.getSource(),p=a.getExtent();if(_.getWrapX()&&a.canWrapX()&&!wt(p,h)){for(var f=h[0],m=ne(p),y=0,v=void 0;fp[2];)v=m*++y,u.push(this.getRenderTransform(r,s,o,.5,d,g,v).slice()),f-=m}this.hitDetectionImageData_=function(t,e,i,n,r,s,o){var a=Pr(t[0]/2,t[1]/2);a.imageSmoothingEnabled=!1;for(var h=a.canvas,c=new io(a,.5,r,null,o),u=i.length,d=Math.floor(16777215/u),g={},_=1;_<=u;++_){var p=i[_-1],f=p.getStyleFunction()||n;if(n){var m=f(p,s);if(m){Array.isArray(m)||(m=[m]);for(var y="#"+("000000"+(_*d).toString(16)).slice(-6),v=0,x=m.length;vy[0]&&E[2]>y[2]&&m.push([E[0]-v,E[1],E[2]-v,E[3]])}if(!this.dirty_&&this.renderedResolution_==c&&this.renderedRevision_==d&&this.renderedRenderOrder_==_&&wt(this.renderedExtent_,f))return this.replayGroupChanged=!1,!0;this.replayGroup_=null,this.dirty_=!1;var I,C=new hh(mo(c,u),f,c,u,e.getDeclutter()),w=ci();if(w){for(var S=0,T=m.length;S=200&&a.status<300){var s=e.getType(),l=void 0;s==Li||s==Ni?l=a.responseText:s==Oi?(l=a.responseXML)||(l=(new DOMParser).parseFromString(a.responseText,"application/xml")):s==Ti&&(l=a.response),l?i.call(this,e.readFeatures(l,{extent:r,featureProjection:o}),e.readProjection(l)):n.call(this)}else n.call(this)}.bind(this),a.onerror=function(){n.call(this)}.bind(this),a.send()}}(t,e,(function(t,e){"function"==typeof this.addFeatures&&this.addFeatures(t)}),f)}var ac=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),lc=function(t){function e(e,i){var n=t.call(this,e)||this;return n.feature=i,n}return ac(e,t),e}(s),hc=function(t){function e(e){var i=this,n=e||{};(i=t.call(this,{attributions:n.attributions,projection:void 0,state:Ms,wrapX:void 0===n.wrapX||n.wrapX})||this).loader_=f,i.format_=n.format,i.overlaps_=void 0===n.overlaps||n.overlaps,i.url_=n.url,void 0!==n.loader?i.loader_=n.loader:void 0!==i.url_&&($(i.format_,7),i.loader_=oc(i.url_,i.format_)),i.strategy_=void 0!==n.strategy?n.strategy:ic;var r,s,o=void 0===n.useSpatialIndex||n.useSpatialIndex;return i.featuresRtree_=o?new Hh:null,i.loadedExtentsRtree_=new Hh,i.nullGeometryFeatures_={},i.idIndex_={},i.uidIndex_={},i.featureChangeKeys_={},i.featuresCollection_=null,Array.isArray(n.features)?s=n.features:n.features&&(s=(r=n.features).getArray()),o||void 0!==r||(r=new Fo(s)),void 0!==s&&i.addFeaturesInternal(s),void 0!==r&&i.bindFeaturesCollection_(r),i}return ac(e,t),e.prototype.addFeature=function(t){this.addFeatureInternal(t),this.changed()},e.prototype.addFeatureInternal=function(t){var e=q(t);if(this.addToIndex_(e,t)){this.setupChangeEvents_(e,t);var i=t.getGeometry();if(i){var n=i.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(n,t)}else this.nullGeometryFeatures_[e]=t;this.dispatchEvent(new lc($h,t))}else this.featuresCollection_&&this.featuresCollection_.remove(t)},e.prototype.setupChangeEvents_=function(t,e){this.featureChangeKeys_[t]=[F(e,w,this.handleFeatureChange_,this),F(e,o,this.handleFeatureChange_,this)]},e.prototype.addToIndex_=function(t,e){var i=!0,n=e.getId();return void 0!==n&&(n.toString()in this.idIndex_?i=!1:this.idIndex_[n.toString()]=e),i&&($(!(t in this.uidIndex_),30),this.uidIndex_[t]=e),i},e.prototype.addFeatures=function(t){this.addFeaturesInternal(t),this.changed()},e.prototype.addFeaturesInternal=function(t){for(var e=[],i=[],n=[],r=0,s=t.length;r=this.dragVertexDelay_?(this.downPx_=e.pixel,this.shouldHandle_=!this.freehand_,i=!0):this.lastDragTime_=void 0,this.shouldHandle_&&void 0!==this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0));return this.freehand_&&e.type===qo.POINTERDRAG&&null!==this.sketchFeature_?(this.addToDrawing_(e.coordinate),n=!1):this.freehand_&&e.type===qo.POINTERDOWN?n=!1:i?(n=e.type===qo.POINTERMOVE)&&this.freehand_?(this.handlePointerMove_(e),this.shouldHandle_&&e.preventDefault()):("mouse"==e.originalEvent.pointerType||e.type===qo.POINTERDRAG&&void 0===this.downTimeout_)&&this.handlePointerMove_(e):e.type===qo.DBLCLICK&&(n=!1),t.prototype.handleEvent.call(this,e)&&n},e.prototype.handleDownEvent=function(t){return this.shouldHandle_=!this.freehand_,this.freehand_?(this.downPx_=t.pixel,this.finishCoordinate_||this.startDrawing_(t),!0):this.condition_(t)?(this.lastDragTime_=Date.now(),this.downTimeout_=setTimeout(function(){this.handlePointerMove_(new zo(qo.POINTERMOVE,t.map,t.originalEvent,!1,t.frameState))}.bind(this),this.dragVertexDelay_),this.downPx_=t.pixel,!0):(this.lastDragTime_=void 0,!1)},e.prototype.handleUpEvent=function(t){var e=!0;this.downTimeout_&&(clearTimeout(this.downTimeout_),this.downTimeout_=void 0),this.handlePointerMove_(t);var i=this.mode_===_c;return this.shouldHandle_?(this.finishCoordinate_?this.freehand_||i?this.finishDrawing():this.atFinish_(t)?this.finishCondition_(t)&&this.finishDrawing():this.addToDrawing_(t.coordinate):(this.startDrawing_(t),this.mode_===uc&&this.finishDrawing()),e=!1):this.freehand_&&this.abortDrawing(),!e&&this.stopClick_&&t.stopPropagation(),e},e.prototype.handlePointerMove_=function(t){if(this.downPx_&&(!this.freehand_&&this.shouldHandle_||this.freehand_&&!this.shouldHandle_)){var e=this.downPx_,i=t.pixel,n=e[0]-i[0],r=e[1]-i[1],s=n*n+r*r;if(this.shouldHandle_=this.freehand_?s>this.squaredClickTolerance_:s<=this.squaredClickTolerance_,!this.shouldHandle_)return}this.finishCoordinate_?this.modifyDrawing_(t):this.createOrUpdateSketchPoint_(t)},e.prototype.atFinish_=function(t){var e=!1;if(this.sketchFeature_){var i=!1,n=[this.finishCoordinate_];if(this.mode_===dc)i=this.sketchCoords_.length>this.minPoints_;else if(this.mode_===gc){var r=this.sketchCoords_;i=r[0].length>this.minPoints_,n=[r[0][0],r[0][r[0].length-2]]}if(i)for(var s=t.map,o=0,a=n.length;o=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(t.slice()),this.geometryFunction_(i,n,r)):this.mode_===gc&&((i=this.sketchCoords_[0]).length>=this.maxPoints_&&(this.freehand_?i.pop():e=!0),i.push(t.slice()),e&&(this.finishCoordinate_=i[0]),this.geometryFunction_(this.sketchCoords_,n,r)),this.updateSketchFeatures_(),e&&this.finishDrawing()},e.prototype.removeLastPoint=function(){if(this.sketchFeature_){var t,e=this.sketchFeature_.getGeometry(),i=this.getMap().getView().getProjection();this.mode_===dc?((t=this.sketchCoords_).splice(-2,1),this.geometryFunction_(t,e,i),t.length>=2&&(this.finishCoordinate_=t[t.length-2].slice())):this.mode_===gc&&((t=this.sketchCoords_[0]).splice(-2,1),this.sketchLine_.getGeometry().setCoordinates(t),this.geometryFunction_(this.sketchCoords_,e,i)),0===t.length&&this.abortDrawing(),this.updateSketchFeatures_()}},e.prototype.finishDrawing=function(){var t=this.abortDrawing_();if(t){var e=this.sketchCoords_,i=t.getGeometry(),n=this.getMap().getView().getProjection();this.mode_===dc?(e.pop(),this.geometryFunction_(e,i,n)):this.mode_===gc&&(e[0].pop(),this.geometryFunction_(e,i,n),e=i.getCoordinates()),this.type_===De.MULTI_POINT?t.setGeometry(new vn([e])):this.type_===De.MULTI_LINE_STRING?t.setGeometry(new pn([e])):this.type_===De.MULTI_POLYGON&&t.setGeometry(new Gn([e])),this.dispatchEvent(new yc(fc,t)),this.features_&&this.features_.push(t),this.source_&&this.source_.addFeature(t)}},e.prototype.abortDrawing_=function(){this.finishCoordinate_=null;var t=this.sketchFeature_;return this.sketchFeature_=null,this.sketchPoint_=null,this.sketchLine_=null,this.overlay_.getSource().clear(!0),t},e.prototype.abortDrawing=function(){var t=this.abortDrawing_();t&&this.dispatchEvent(new yc(mc,t))},e.prototype.appendCoordinates=function(t){var e=this.mode_,i=[];e===dc?i=this.sketchCoords_:e===gc&&(i=this.sketchCoords_&&this.sketchCoords_.length?this.sketchCoords_[0]:[]);for(var n=i.pop(),r=0;r=0;--a)s.remove(o[a])}i&&(G(this.featureChangeListenerKeys_[n]),delete this.featureChangeListenerKeys_[n])},e.prototype.setMap=function(e){var i=this.getMap(),n=this.featuresListenerKeys_,r=this.getFeatures_();i&&(n.forEach(G),n.length=0,r.forEach(this.forEachFeatureRemove_.bind(this))),t.prototype.setMap.call(this,e),e&&(this.features_?n.push(F(this.features_,Ro,this.handleFeatureAdd_,this),F(this.features_,Po,this.handleFeatureRemove_,this)):this.source_&&n.push(F(this.source_,$h,this.handleFeatureAdd_,this),F(this.source_,ec,this.handleFeatureRemove_,this)),r.forEach(this.forEachFeatureAdd_.bind(this)))},e.prototype.snapTo=function(t,e,i){var n=vt([i.getCoordinateFromPixel([t[0]-this.pixelTolerance_,t[1]+this.pixelTolerance_]),i.getCoordinateFromPixel([t[0]+this.pixelTolerance_,t[1]-this.pixelTolerance_])]),r=this.rBush_.getInExtent(n);this.vertex_&&!this.edge_&&(r=r.filter((function(t){return t.feature.getGeometry().getType()!==De.CIRCLE})));var s=!1,o=null,a=null;if(0===r.length)return{snapped:s,vertex:o,vertexPixel:a};for(var l,h=i.getView().getProjection(),c=di(e,h),u=1/0,d=0;dv?p[1]:p[0],a=i.getPixelFromCoordinate(o))}else if(this.edge_){var x=l.feature.getGeometry().getType()===De.CIRCLE;if(x){var E=l.feature.getGeometry(),I=ci();I&&(E=E.clone().transform(I,h)),o=ui(function(t,e){var i=e.getRadius(),n=e.getCenter(),r=n[0],s=n[1],o=t[0]-r,a=t[1]-s;0===o&&0===a&&(o=1);var l=Math.sqrt(o*o+a*a);return[r+i*o/l,s+i*a/l]}(c,E),h)}else Ic[0]=di(p[0],h),Ic[1]=di(p[1],h),o=ui(Ve(c,Ic),h);if(Xe(t,a=i.getPixelFromCoordinate(o))<=this.pixelTolerance_&&(s=!0,this.vertex_&&!x)){f=i.getPixelFromCoordinate(p[0]),m=i.getPixelFromCoordinate(p[1]),y=qe(a,f),v=qe(a,m);Math.sqrt(Math.min(y,v))<=this.pixelTolerance_&&(o=y>v?p[1]:p[0],a=i.getPixelFromCoordinate(o))}}return s&&(a=[Math.round(a[0]),Math.round(a[1])]),{snapped:s,vertex:o,vertexPixel:a}},e.prototype.updateFeature_=function(t){this.removeFeature(t,!1),this.addFeature(t,!1)},e.prototype.writeCircleGeometry_=function(t,e){var i=this.getMap().getView().getProjection(),n=e,r=ci();r&&(n=n.clone().transform(r,i));var s=An(n);r&&s.transform(i,r);for(var o=s.getCoordinates()[0],a=0,l=o.length-1;a{if(n.measure){const e=t.feature;n.measure="object"==typeof n.measure?n.measure:{},n.measure.tooltip=n.measure.tooltip||{};const i=document.createElement("div");i.setAttribute("class","measure-tooltip"),this.tooltip=new qr({offset:n.measure.tooltip.offset||[-15,10],positioning:"bottom-center"}),this.map.addOverlay(this.tooltip),this.measurePointermoveHandler=this.map.on("pointermove",()=>{this._showMeasureTooltip(e,this.tooltip,i)})}}),s.on("drawend",e=>{const n=e.feature;i(n,()=>{try{t.getSource().removeFeature(n)}catch(e){const i=t.getSource().on("addfeature",e=>{t.getSource().removeFeature(e.feature),V(i)})}}),this._cleanUp()}),super(r),this.options=n,this.drawInteraction=s}deactivate(){this._cleanUp(),super.deactivate()}_cleanUp(){this.options.measure&&(V(this.measurePointermoveHandler),this._removeTooltip())}_removeTooltip(){this.tooltip&&(this.map.removeOverlay(this.tooltip),this.tooltip=void 0)}_showMeasureTooltip(t,e){if(this.tooltip){const i=this._getLengthOfLastSegment(t.getGeometry());0!==i&&(e.textContent=i+" m",this.tooltip.setElement(e),this.tooltip.setPosition(t.getGeometry().getLastCoordinate()))}}_getLengthOfLastSegment(t){return t&&t instanceof gn?new gn(this._getCoordinatesOfLastSegment(t)).getLength().toFixed(2):t&&t instanceof bn?new gn(this._getCoordinatesOfLastSegment(t.getLinearRing(0))).getLength().toFixed(2):0}_getCoordinatesOfLastSegment(t){const e=t.getCoordinates().length;return t.getCoordinates().slice(e-2)}}class Tc extends Sc{constructor(t,e,i={}){super(t,De.LINE_STRING,e,i)}}class Lc extends Sc{constructor(t,e,i={}){super(t,De.POLYGON,e,i)}}class Nc extends Sc{constructor(t,e,i={}){i.maxPoints=2,i.geometryFunction=(t,e)=>{e||(e=new bn([]));const i=t[0],n=t[1];return e.setCoordinates([[i,[i[0],n[1]],n,[n[0],i[1]],i]]),e},super(t,De.LINE_STRING,e,i)}}class Oc extends Ml{constructor(t,e){const i=new bl({layers:[t],condition:wa,style:e?e.style:null});super([i]),this.layer=t,this.highlightInteraction=i}deactivate(){this.dehighlightAllFeatures(),super.deactivate()}highlightFeatureWithId(t){if(t){const e=this.layer.getSource().getFeatureById(t)||this._getClusterByFeatureId(this.layer.getSource().getFeatures(),t);e&&-1===this.highlightInteraction.getFeatures().getArray().indexOf(e)&&this.highlightInteraction.getFeatures().push(e)}}_getClusterByFeatureId(t,e){for(let i=0;i{i===t&&(e=!0)}),e}dehighlightAllFeatures(){this.highlightInteraction.getFeatures().clear()}}class Rc extends Sc{constructor(t,e){super(t,"LineString",()=>{V(this.measurePointermoveHandler)},e);let i=0;this.layer=t,this.measureTooltips=[],this.measurePointermoveHandler=void 0;this.drawInteraction.on("drawstart",t=>{const e=i++,n=t.feature;n.setId(e);const r=document.createElement("div");r.setAttribute("class","measure-tooltip");const s=new qr({offset:[-15,10],positioning:"bottom-center"});this.map.addOverlay(s),this.measureTooltips[e]=s,this.measurePointermoveHandler=this.map.on("pointermove",()=>((t,e,i)=>{const n=t.getGeometry().getLength().toFixed(2);i.textContent=n+" m",e.setElement(i),e.setPosition(t.getGeometry().getLastCoordinate())})(n,s,r))});const n=t=>{this.map.removeOverlay(this.measureTooltips[t]),this.measureTooltips[t]=null};this.layer.getSource().on("removefeature",t=>{n(t.feature.getId())}),this.cleanUp=()=>{V(this.measurePointermoveHandler);const t=[];this.measureTooltips.forEach((e,i)=>{null==this.layer.getSource().getFeatureById(i)&&t.push(i)}),t.forEach(t=>{n(t)})},this.getTooltipFor=t=>this.measureTooltips[t],this.measureOptions=e}deactivate(){this.cleanUp(),super.deactivate(this)}}var Pc=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),bc=[0,0,0,0],Mc=[],Ac="modifystart",Fc="modifyend",Dc=function(t){function e(e,i,n){var r=t.call(this,e)||this;return r.features=i,r.mapBrowserEvent=n,r}return Pc(e,t),e}(s);function Gc(t,e){return t.index-e.index}function kc(t,e,i){var n=e.geometry;if(n.getType()===De.CIRCLE){var r=n;if(1===e.index){var s=ci();s&&(r=r.clone().transform(s,i));var o=qe(r.getCenter(),di(t,i)),a=Math.sqrt(o)-r.getRadius();return a*a}}var l=di(t,i);return Mc[0]=di(e.segment[0],i),Mc[1]=di(e.segment[1],i),je(l,Mc)}function Vc(t,e,i){var n=e.geometry;if(n.getType()===De.CIRCLE&&1===e.index){var r=n,s=ci();return s&&(r=r.clone().transform(s,i)),ui(r.getClosestPoint(di(t,i)),i)}var o=di(t,i);return Mc[0]=di(e.segment[0],i),Mc[1]=di(e.segment[1],i),ui(Ve(o,Mc),i)}var Bc=function(t){function e(e){var i,n,r=t.call(this,e)||this;if(r.boundHandleFeatureChange_=r.handleFeatureChange_.bind(r),r.condition_=e.condition?e.condition:Ra,r.defaultDeleteCondition_=function(t){return function(t){var e=t.originalEvent;return e.altKey&&!(e.metaKey||e.ctrlKey)&&!e.shiftKey}(t)&&Sa(t)},r.deleteCondition_=e.deleteCondition?e.deleteCondition:r.defaultDeleteCondition_,r.insertVertexCondition_=e.insertVertexCondition?e.insertVertexCondition:xa,r.vertexFeature_=null,r.vertexSegments_=null,r.lastPixel_=[0,0],r.ignoreNextSingleClick_=!1,r.modified_=!1,r.rBush_=new Hh,r.pixelTolerance_=void 0!==e.pixelTolerance?e.pixelTolerance:10,r.snappedToVertex_=!1,r.changingFeature_=!1,r.dragSegments_=[],r.overlay_=new Wh({source:new hc({useSpatialIndex:!1,wrapX:!!e.wrapX}),style:e.style?e.style:(i=Sl(),function(t,e){return i[De.POINT]}),updateWhileAnimating:!0,updateWhileInteracting:!0}),r.SEGMENT_WRITERS_={Point:r.writePointGeometry_.bind(r),LineString:r.writeLineStringGeometry_.bind(r),LinearRing:r.writeLineStringGeometry_.bind(r),Polygon:r.writePolygonGeometry_.bind(r),MultiPoint:r.writeMultiPointGeometry_.bind(r),MultiLineString:r.writeMultiLineStringGeometry_.bind(r),MultiPolygon:r.writeMultiPolygonGeometry_.bind(r),Circle:r.writeCircleGeometry_.bind(r),GeometryCollection:r.writeGeometryCollectionGeometry_.bind(r)},r.source_=null,e.source?(r.source_=e.source,n=new Fo(r.source_.getFeatures()),r.source_.addEventListener($h,r.handleSourceAdd_.bind(r)),r.source_.addEventListener(ec,r.handleSourceRemove_.bind(r))):n=e.features,!n)throw new Error("The modify interaction requires features or a source");return r.features_=n,r.features_.forEach(r.addFeature_.bind(r)),r.features_.addEventListener(Ro,r.handleFeatureAdd_.bind(r)),r.features_.addEventListener(Po,r.handleFeatureRemove_.bind(r)),r.lastPointerEvent_=null,r}return Pc(e,t),e.prototype.addFeature_=function(t){var e=t.getGeometry();if(e){var i=this.SEGMENT_WRITERS_[e.getType()];i&&i(t,e)}var n=this.getMap();n&&n.isRendered()&&this.getActive()&&this.handlePointerAtPixel_(this.lastPixel_,n),t.addEventListener(w,this.boundHandleFeatureChange_)},e.prototype.willModifyFeatures_=function(t){this.modified_||(this.modified_=!0,this.dispatchEvent(new Dc(Ac,this.features_,t)))},e.prototype.removeFeature_=function(t){this.removeFeatureSegmentData_(t),this.vertexFeature_&&0===this.features_.getLength()&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.removeEventListener(w,this.boundHandleFeatureChange_)},e.prototype.removeFeatureSegmentData_=function(t){var e=this.rBush_,i=[];e.forEach((function(e){t===e.feature&&i.push(e)}));for(var n=i.length-1;n>=0;--n){for(var r=i[n],s=this.dragSegments_.length-1;s>=0;--s)this.dragSegments_[s][0]===r&&this.dragSegments_.splice(s,1);e.remove(r)}},e.prototype.setActive=function(e){this.vertexFeature_&&!e&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),t.prototype.setActive.call(this,e)},e.prototype.setMap=function(e){this.overlay_.setMap(e),t.prototype.setMap.call(this,e)},e.prototype.getOverlay=function(){return this.overlay_},e.prototype.handleSourceAdd_=function(t){t.feature&&this.features_.push(t.feature)},e.prototype.handleSourceRemove_=function(t){t.feature&&this.features_.remove(t.feature)},e.prototype.handleFeatureAdd_=function(t){this.addFeature_(t.element)},e.prototype.handleFeatureChange_=function(t){if(!this.changingFeature_){var e=t.target;this.removeFeature_(e),this.addFeature_(e)}},e.prototype.handleFeatureRemove_=function(t){var e=t.element;this.removeFeature_(e)},e.prototype.writePointGeometry_=function(t,e){var i=e.getCoordinates(),n={feature:t,geometry:e,segment:[i,i]};this.rBush_.insert(e.getExtent(),n)},e.prototype.writeMultiPointGeometry_=function(t,e){for(var i=e.getCoordinates(),n=0,r=i.length;n=0;--p)this.insertVertex_.apply(this,r[p])}return!!this.vertexFeature_},e.prototype.handleUpEvent=function(t){for(var e=this.dragSegments_.length-1;e>=0;--e){var i=this.dragSegments_[e][0],n=i.geometry;if(n.getType()===De.CIRCLE){var r=n.getCenter(),s=i.featureSegments[0],o=i.featureSegments[1];s.segment[0]=r,s.segment[1]=r,o.segment[0]=r,o.segment[1]=r,this.rBush_.update(Rt(r),s);var a=n,l=ci();if(l){var h=t.map.getView().getProjection();a=An(a=a.clone().transform(l,h)).transform(h,l)}this.rBush_.update(a.getExtent(),o)}else this.rBush_.update(vt(i.segment),i)}return this.modified_&&(this.dispatchEvent(new Dc(Fc,this.features_,t)),this.modified_=!1),!1},e.prototype.handlePointerMove_=function(t){this.lastPixel_=t.pixel,this.handlePointerAtPixel_(t.pixel,t.map,t.coordinate)},e.prototype.handlePointerAtPixel_=function(t,e,i){var n=i||e.getCoordinateFromPixel(t),r=e.getView().getProjection(),s=gi(xt(_i(Rt(n,bc),r),e.getView().getResolution()*this.pixelTolerance_,bc),r),o=this.rBush_.getInExtent(s);if(o.length>0){o.sort((function(t,e){return kc(n,t,r)-kc(n,e,r)}));var a=o[0],l=a.segment,h=Vc(n,a,r),c=e.getPixelFromCoordinate(h),u=Xe(t,c);if(u<=this.pixelTolerance_){var d={};if(a.geometry.getType()===De.CIRCLE&&1===a.index)this.snappedToVertex_=!0,this.createOrUpdateVertexFeature_(h);else{var g=e.getPixelFromCoordinate(l[0]),_=e.getPixelFromCoordinate(l[1]),p=qe(c,g),f=qe(c,_);u=Math.sqrt(Math.min(p,f)),this.snappedToVertex_=u<=this.pixelTolerance_,this.snappedToVertex_&&(h=p>f?l[1]:l[0]),this.createOrUpdateVertexFeature_(h);for(var m=1,y=o.length;m=0;--r)c=q((h=(i=u[r])[0]).feature),h.depth&&(c+="-"+h.depth.join("-")),c in d||(d[c]={}),0===i[1]?(d[c].right=h,d[c].index=h.index):1==i[1]&&(d[c].left=h,d[c].index=h.index+1);for(c in d){switch(l=d[c].right,o=d[c].left,(a=(s=d[c].index)-1)<0&&(a=0),t=e=(n=(h=void 0!==o?o:l).geometry).getCoordinates(),g=!1,n.getType()){case De.MULTI_LINE_STRING:e[h.depth[0]].length>2&&(e[h.depth[0]].splice(s,1),g=!0);break;case De.LINE_STRING:e.length>2&&(e.splice(s,1),g=!0);break;case De.MULTI_POLYGON:t=t[h.depth[1]];case De.POLYGON:(t=t[h.depth[0]]).length>4&&(s==t.length-1&&(s=0),t.splice(s,1),g=!0,0===s&&(t.pop(),t.push(t[0]),a=t.length-1))}if(g){this.setGeometryCoordinates_(n,e);var _=[];if(void 0!==o&&(this.rBush_.remove(o),_.push(o.segment[0])),void 0!==l&&(this.rBush_.remove(l),_.push(l.segment[1])),void 0!==o&&void 0!==l){var p={depth:h.depth,feature:h.feature,geometry:h.geometry,index:a,segment:_};this.rBush_.insert(vt(p.segment),p)}this.updateSegmentIndices_(n,s,h.depth,-1),this.vertexFeature_&&(this.overlay_.getSource().removeFeature(this.vertexFeature_),this.vertexFeature_=null),u.length=0}}return g},e.prototype.setGeometryCoordinates_=function(t,e){this.changingFeature_=!0,t.setCoordinates(e),this.changingFeature_=!1},e.prototype.updateSegmentIndices_=function(t,e,i,n){this.rBush_.forEachInExtent(t.getExtent(),(function(r){r.geometry===t&&(void 0===i||void 0===r.depth||g(r.depth,i))&&r.index>e&&(r.index+=n)}))},e}(fa);class Yc extends Al{constructor(t,e,i){super(t,null,{filter:i?i.filter:null}),this.modifyInteraction=new Bc({features:this.selectInteraction.getFeatures()}),this.addInteraction(this.modifyInteraction),i&&i.snapping&&this.addInteraction(new wc(i.snapping.layer||t)),this.modifyInteraction.on("modifystart",t=>{this.currentGeometryBeingModified=t.features.getArray()[0].getGeometry().clone()}),this.modifyInteraction.on("modifyend",t=>{t.features.forEach(t=>{e(t,t=>{t.setGeometry(this.currentGeometryBeingModified)})})})}}var zc=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),qc="translatestart",Xc="translating",jc="translateend",Uc=function(t){function e(e,i,n,r,s){var o=t.call(this,e)||this;return o.features=i,o.coordinate=n,o.startCoordinate=r,o.mapBrowserEvent=s,o}return zc(e,t),e}(s),Wc=function(t){function e(e){var i,n=this,r=e||{};if((n=t.call(this,r)||this).lastCoordinate_=null,n.startCoordinate_=null,n.features_=void 0!==r.features?r.features:null,r.layers)if("function"==typeof r.layers)i=r.layers;else{var s=r.layers;i=function(t){return h(s,t)}}else i=_;return n.layerFilter_=i,n.filter_=r.filter?r.filter:_,n.hitTolerance_=r.hitTolerance?r.hitTolerance:0,n.lastFeature_=null,n.addEventListener(H(la),n.handleActiveChanged_),n}return zc(e,t),e.prototype.handleDownEvent=function(t){if(this.lastFeature_=this.featuresAtPixel_(t.pixel,t.map),!this.lastCoordinate_&&this.lastFeature_){this.startCoordinate_=t.coordinate,this.lastCoordinate_=t.coordinate,this.handleMoveEvent(t);var e=this.features_||new Fo([this.lastFeature_]);return this.dispatchEvent(new Uc(qc,e,t.coordinate,this.startCoordinate_,t)),!0}return!1},e.prototype.handleUpEvent=function(t){if(this.lastCoordinate_){this.lastCoordinate_=null,this.handleMoveEvent(t);var e=this.features_||new Fo([this.lastFeature_]);return this.dispatchEvent(new Uc(jc,e,t.coordinate,this.startCoordinate_,t)),this.startCoordinate_=null,!0}return!1},e.prototype.handleDragEvent=function(t){if(this.lastCoordinate_){var e=t.coordinate,i=e[0]-this.lastCoordinate_[0],n=e[1]-this.lastCoordinate_[1],r=this.features_||new Fo([this.lastFeature_]);r.forEach((function(t){var e=t.getGeometry();e.translate(i,n),t.setGeometry(e)})),this.lastCoordinate_=e,this.dispatchEvent(new Uc(Xc,r,e,this.startCoordinate_,t))}},e.prototype.handleMoveEvent=function(t){var e=t.map.getViewport();this.featuresAtPixel_(t.pixel,t.map)?(e.classList.remove(this.lastCoordinate_?"ol-grab":"ol-grabbing"),e.classList.add(this.lastCoordinate_?"ol-grabbing":"ol-grab")):e.classList.remove("ol-grab","ol-grabbing")},e.prototype.featuresAtPixel_=function(t,e){return e.forEachFeatureAtPixel(t,function(t,e){if(this.filter_(t,e)&&(!this.features_||h(this.features_.getArray(),t)))return t}.bind(this),{layerFilter:this.layerFilter_,hitTolerance:this.hitTolerance_})},e.prototype.getHitTolerance=function(){return this.hitTolerance_},e.prototype.setHitTolerance=function(t){this.hitTolerance_=t},e.prototype.setMap=function(e){var i=this.getMap();t.prototype.setMap.call(this,e),this.updateState_(i)},e.prototype.handleActiveChanged_=function(){this.updateState_(null)},e.prototype.updateState_=function(t){var e=this.getMap(),i=this.getActive();e&&i||(e=e||t)&&e.getViewport().classList.remove("ol-grab","ol-grabbing")},e}(fa);class Hc extends Yc{constructor(t,e,i){super(t,e,i),this.translateInteraction=new Wc({features:this.selectInteraction.getFeatures()}),this.addInteraction(this.translateInteraction),this.translateInteraction.on("translateend",t=>{t.features.forEach(t=>{e(t,t=>{t.getGeometry().setCoordinates(t.get("entity").geometry.coordinates)}),this.selectInteraction.getFeatures().clear()})})}}class Zc extends Al{constructor(t,e,i){const n=t.map(t=>t.layer),r=t=>{const e=this._getLayer(t),i=this._getLayerStyle(e);return i&&"function"==typeof i?i(t):i},s=t=>{const e=this._getLayer(t),i=this._getLayerHoverStyle(e);return i&&"function"==typeof i?i(t):i},o=(t,e)=>{let n=!1;return this.layers.forEach(t=>{t==e&&(n=!0)}),i&&i.filter?n&&i.filter(t):n};super(n,e,{filter:o,style:r,hoverStyle:s}),this.layerConfiguraties=t,this.layers=n,this.style=r,this.hoverStyle=s,this.filter=o}_getLayer(t){return this.layers.find(e=>-1!==e.getSource().getFeatures().indexOf(t))}_getLayerStyle(t,e){const i=this.layerConfiguraties.find(e=>e.layer===t);return i?i[e||"style"]:null}_getLayerHoverStyle(t){return this._getLayerStyle(t,"hoverStyle")||this._getLayerStyle(t)}markFeatureWithId(t,e){e?super.markFeatureWithId(t,e):this.layers.forEach(e=>{super.markFeatureWithId(t,e)})}}class Kc{constructor(t,e,i,n){this.layer=t,t.tooltips=[],this.showTooltip=(r,s,o,a)=>{a=a||{};const l=document.createElement("div");l.innerHTML="
",l.setAttribute("class","info-tooltip");const h=new qr({offset:a.offset||[0,-10],positioning:"bottom-center",insertFirst:!1});h.setElement(l),r.addOverlay(h),t.tooltips.push(h);const c=t=>{l.childNodes[0].innerHTML=t,h.setPosition(o),h.setElement(l),l.parentNode.style.position="fixed"};let u=0;const d=setTimeout(()=>{u=500,c(" "+(i||"Info berekenen ..."))},100);e(s,o).then(t=>{setTimeout(()=>{clearTimeout(d),c(t),r.render(),n&&n(s,o)},u)})},this.clear=t=>{this.layer.tooltips.forEach(e=>t.removeOverlay(e))}}}class Jc extends Sc{constructor(t,e,i,n){const r=new Kc(t,e,i);super(t,"Point",t=>{this.Vltooltips.showTooltip(this.map,t,t.getGeometry().getCoordinates(),n)}),this.layer=t,this.Vltooltips=r}clear(){this.Vltooltips.clear(this.map),this.layer.getSource().clear()}deactivate(){this.clear(),super.deactivate()}}class $c extends Al{constructor(t,e,i,n,r){super(t,(t,e)=>{if(t){const i=t.getGeometry().getClosestPoint(e.mapBrowserEvent.coordinate);this.tooltips.showTooltip(this.map,t,i,r)}}),this.tooltips=new Kc(t,e,i,n),this.layer=t}clear(){this.tooltips.clear(this.map)}deactivate(){this.clear(),this.layer.setVisible(this.visible),super.deactivate()}activate(){this.visible=this.layer.getVisible(),this.layer.setVisible(!0),super.activate()}}var Qc=i(1);class tu extends Ml{constructor(t,e,i){const n=new Qc.io.OL3Parser;n.inject(mn,gn,Cn,bn,vn,pn,Gn);const r=[],s=new Al(t,t=>{t&&(this.selectAction.deactivate(),this.drawAction.activate())},i),o=new Sc(t,"LineString",t=>{const i=this.selectAction.selectedFeature,r=n.read(i.getGeometry().getPolygons()[0]),s=n.read(t.getGeometry()),o=r.getExteriorRing().union(s),a=new Qc.operation.polygonize.Polygonizer;a.add(o);const l=[];for(let t=a.getPolygons().iterator();t.hasNext();){const e=new Gn([]);e.appendPolygon(n.write(t.next())),l.push(new tt({geometry:e}))}e&&e(i,l),this.selectAction.clearFeatures(),setTimeout(()=>{this.drawAction.deactivate(),this.selectAction.activate()})},i);super(r),this.interactions=r,this.selectAction=s,this.drawAction=o}activate(){this.map.addAction(this.selectAction),this.map.addAction(this.drawAction),this.selectAction.activate()}deactivate(){this.selectAction.deactivate(),this.drawAction.deactivate()}}class eu extends Ml{constructor(t,e){const i=new bl({layers:[t],style:t.selectionStyle}),n={features:i.getFeatures(),layers:[t]},r=new Wc(n);super([i,r]),this.selectInteraction=i,this.translateInteraction=r,this.translateInteraction.on("translateend",t=>{t.features.forEach(t=>{e(t,t=>{t.getGeometry().setCoordinates(t.get("entity").geometry.coordinates)}),this.selectInteraction.getFeatures().clear()})}),this.translateOptions=n}deactivate(){this.selectInteraction.getFeatures().clear(),super.deactivate()}}var iu="preload",nu="useInterimTilesOnError",ru=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),su=function(t){function e(e){var i=this,n=e||{},r=m({},n);return delete r.preload,delete r.useInterimTilesOnError,(i=t.call(this,r)||this).setPreload(void 0!==n.preload?n.preload:0),i.setUseInterimTilesOnError(void 0===n.useInterimTilesOnError||n.useInterimTilesOnError),i}return ru(e,t),e.prototype.getPreload=function(){return this.get(iu)},e.prototype.setPreload=function(t){this.set(iu,t)},e.prototype.getUseInterimTilesOnError=function(){return this.get(nu)},e.prototype.setUseInterimTilesOnError=function(t){this.set(nu,t)},e}(Ds),ou=function(){function t(t,e,i,n){this.minX=t,this.maxX=e,this.minY=i,this.maxY=n}return t.prototype.contains=function(t){return this.containsXY(t[1],t[2])},t.prototype.containsTileRange=function(t){return this.minX<=t.minX&&t.maxX<=this.maxX&&this.minY<=t.minY&&t.maxY<=this.maxY},t.prototype.containsXY=function(t,e){return this.minX<=t&&t<=this.maxX&&this.minY<=e&&e<=this.maxY},t.prototype.equals=function(t){return this.minX==t.minX&&this.minY==t.minY&&this.maxX==t.maxX&&this.maxY==t.maxY},t.prototype.extend=function(t){t.minXthis.maxX&&(this.maxX=t.maxX),t.minYthis.maxY&&(this.maxY=t.maxY)},t.prototype.getHeight=function(){return this.maxY-this.minY+1},t.prototype.getSize=function(){return[this.getWidth(),this.getHeight()]},t.prototype.getWidth=function(){return this.maxX-this.minX+1},t.prototype.intersects=function(t){return this.minX<=t.maxX&&this.maxX>=t.minX&&this.minY<=t.maxY&&this.maxY>=t.minY},t}();function au(t,e,i,n,r){return void 0!==r?(r.minX=t,r.maxX=e,r.minY=i,r.maxY=n,r):new ou(t,e,i,n)}var lu=ou,hu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),cu=function(t){function e(e){var i=t.call(this,e)||this;return i.extentChanged=!0,i.renderedExtent_=null,i.renderedPixelRatio,i.renderedProjection=null,i.renderedRevision,i.renderedTiles=[],i.newTiles_=!1,i.tmpExtent=[1/0,1/0,-1/0,-1/0],i.tmpTileRange_=new lu(0,0,0,0),i}return hu(e,t),e.prototype.isDrawableTile=function(t){var e=this.getLayer(),i=t.getState(),n=e.getUseInterimTilesOnError();return i==Jo||i==Qo||i==$o&&!n},e.prototype.getTile=function(t,e,i,n){var r=n.pixelRatio,s=n.viewState.projection,o=this.getLayer(),a=o.getSource().getTile(t,e,i,r,s);return a.getState()==$o&&(o.getUseInterimTilesOnError()?o.getPreload()>0&&(this.newTiles_=!0):a.setState(Jo)),this.isDrawableTile(a)||(a=a.getInterimTile()),a},e.prototype.loadedTileCallback=function(e,i,n){return!!this.isDrawableTile(n)&&t.prototype.loadedTileCallback.call(this,e,i,n)},e.prototype.prepareFrame=function(t){return!!this.getLayer().getSource()},e.prototype.renderFrame=function(t,e){var i=t.layerStatesArray[t.layerIndex],n=t.viewState,r=n.projection,s=n.resolution,o=n.center,a=n.rotation,h=t.pixelRatio,c=this.getLayer(),u=c.getSource(),d=u.getRevision(),g=u.getTileGridForProjection(r),_=g.getZForResolution(s,u.zDirection),p=g.getResolution(_),f=t.extent,y=i.extent&&_i(i.extent,r);y&&(f=$t(f,_i(i.extent,r)));var v=u.getTilePixelRatio(h),x=Math.round(t.size[0]*v),E=Math.round(t.size[1]*v);if(a){var I=Math.round(Math.sqrt(x*x+E*E));x=I,E=I}var C=p*x/2/v,w=p*E/2/v,S=[o[0]-C,o[1]-w,o[0]+C,o[1]+w],T=g.getTileRangeForExtentAndZ(f,_),L={};L[_]={};var N=this.createLoadedTileFinder(u,r,L),O=this.tmpExtent,R=this.tmpTileRange_;this.newTiles_=!1;for(var P=T.minX;P<=T.maxX;++P)for(var b=T.minY;b<=T.maxY;++b){var M=this.getTile(_,P,b,t);if(this.isDrawableTile(M)){var A=q(this);if(M.getState()==Jo){L[_][M.tileCoord.toString()]=M;var F=M.inTransition(A);this.newTiles_||!F&&-1!==this.renderedTiles.indexOf(M)||(this.newTiles_=!0)}if(1===M.getAlpha(A,t.time))continue}var D=g.getTileCoordChildTileRange(M.tileCoord,R,O),G=!1;D&&(G=N(_+1,D)),G||g.forEachTileCoordParentTileRange(M.tileCoord,N,R,O)}var k=p/s;ot(this.pixelTransform,t.size[0]/2,t.size[1]/2,1/v,1/v,a,-x/2,-E/2);var V,B=(V=this.pixelTransform,Nr?lt(V):(to||(to=Pr(1,1).canvas),to.style.transform=lt(V),to.style.transform));this.useContainer(e,B,i.opacity);var Y=this.context,z=Y.canvas;at(this.inversePixelTransform,this.pixelTransform),ot(this.tempTransform,x/2,E/2,k,k,0,-x/2,-E/2),z.width!=x||z.height!=E?(z.width=x,z.height=E):this.containerReused||Y.clearRect(0,0,x,E),y&&this.clipUnrotated(Y,t,y),m(Y,u.getContextOptions()),this.preRender(Y,t),this.renderedTiles.length=0;var X,j,U,W=Object.keys(L).map(Number);W.sort(l),1!==i.opacity||this.containerReused&&!u.getOpaque(t.viewState.projection)?(X=[],j=[]):W=W.reverse();for(var H=W.length-1;H>=0;--H){var Z=W[H],K=u.getTilePixelSize(Z,h,r),J=g.getResolution(Z)/p,$=K[0]*J*k,Q=K[1]*J*k,tt=g.getTileCoordForCoordAndZ(ee(S),Z),et=g.getTileCoordExtent(tt),it=st(this.tempTransform,[v*(et[0]-S[0])/p,v*(S[3]-et[3])/p]),nt=v*u.getGutterForProjection(r),rt=L[Z];for(var ht in rt){var ct=(M=rt[ht]).tileCoord,ut=it[0]-(tt[1]-ct[1])*$,dt=Math.round(ut+$),gt=it[1]-(tt[2]-ct[2])*Q,_t=Math.round(gt+Q),pt=dt-(P=Math.round(ut)),ft=_t-(b=Math.round(gt)),mt=_===Z;if(!(F=mt&&1!==M.getAlpha(q(this),t.time)))if(X){Y.save(),U=[P,b,P+pt,b,P+pt,b+ft,P,b+ft];for(var yt=0,vt=X.length;yt=0;--i){var n=this.geometryFunction(t[i]);n?ke(e,n.getCoordinates()):t.splice(i,1)}ze(e,1/t.length);var r=new tt(new mn(e));return r.set("features",t),r},e}(hc),fu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),mu=function(t){function e(e,i,n){var r=t.call(this)||this,s=n||{};return r.tileCoord=e,r.state=i,r.interimTile=null,r.hifi=!0,r.key="",r.transition_=void 0===s.transition?250:s.transition,r.transitionStarts_={},r}return fu(e,t),e.prototype.changed=function(){this.dispatchEvent(w)},e.prototype.release=function(){},e.prototype.getKey=function(){return this.key+"/"+this.tileCoord},e.prototype.getInterimTile=function(){if(!this.interimTile)return this;var t=this.interimTile;do{if(t.getState()==Jo)return this.transition_=0,t;t=t.interimTile}while(t);return this},e.prototype.refreshInterimChain=function(){if(this.interimTile){var t=this.interimTile,e=this;do{if(t.getState()==Jo){t.interimTile=null;break}t.getState()==Ko?e=t:t.getState()==Zo?e.interimTile=t.interimTile:e=t,t=e.interimTile}while(t)}},e.prototype.getTileCoord=function(){return this.tileCoord},e.prototype.getState=function(){return this.state},e.prototype.setState=function(t){if(this.state!==$o&&this.state>t)throw new Error("Tile load sequence violation");this.state=t,this.changed()},e.prototype.load=function(){Y()},e.prototype.getAlpha=function(t,e){if(!this.transition_)return 1;var i=this.transitionStarts_[t];if(i){if(-1===i)return 1}else i=e,this.transitionStarts_[t]=i;var n=e-i+1e3/60;return n>=this.transition_?1:tr(n/this.transition_)},e.prototype.inTransition=function(t){return!!this.transition_&&-1!==this.transitionStarts_[t]},e.prototype.endTransition=function(t){this.transition_&&(this.transitionStarts_[t]=-1)},e}(C),yu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}();var vu,xu=function(t){function e(e,i,n,r,s,o){var a=t.call(this,e,i,o)||this;return a.crossOrigin_=r,a.src_=n,a.image_=new Image,null!==r&&(a.image_.crossOrigin=r),a.unlisten_=null,a.tileLoadFunction_=s,a}return yu(e,t),e.prototype.getImage=function(){return this.image_},e.prototype.getKey=function(){return this.src_},e.prototype.handleImageError_=function(){var t;this.state=$o,this.unlistenImage_(),this.image_=((t=Pr(1,1)).fillStyle="rgba(0,0,0,0)",t.fillRect(0,0,1,1),t.canvas),this.changed()},e.prototype.handleImageLoad_=function(){var t=this.image_;t.naturalWidth&&t.naturalHeight?this.state=Jo:this.state=Qo,this.unlistenImage_(),this.changed()},e.prototype.load=function(){this.state==$o&&(this.state=Zo,this.image_=new Image,null!==this.crossOrigin_&&(this.image_.crossOrigin=this.crossOrigin_)),this.state==Zo&&(this.state=Ko,this.changed(),this.tileLoadFunction_(this,this.src_),this.unlisten_=kh(this.image_,this.handleImageLoad_.bind(this),this.handleImageError_.bind(this)))},e.prototype.unlistenImage_=function(){this.unlisten_&&(this.unlisten_(),this.unlisten_=null)},e}(mu),Eu=function(){function t(t,e,i,n,r,s){this.sourceProj_=t,this.targetProj_=e;var o={},a=ni(this.targetProj_,this.sourceProj_);this.transformInv_=function(t){var e=t[0]+"/"+t[1];return o[e]||(o[e]=a(t)),o[e]},this.maxSourceExtent_=n,this.errorThresholdSquared_=r*r,this.triangles_=[],this.wrapsXInSource_=!1,this.canWrapXInSource_=this.sourceProj_.canWrapX()&&!!n&&!!this.sourceProj_.getExtent()&&ne(n)==ne(this.sourceProj_.getExtent()),this.sourceWorldWidth_=this.sourceProj_.getExtent()?ne(this.sourceProj_.getExtent()):null,this.targetWorldWidth_=this.targetProj_.getExtent()?ne(this.targetProj_.getExtent()):null;var l=ee(i),h=ie(i),c=jt(i),u=Xt(i),d=this.transformInv_(l),g=this.transformInv_(h),_=this.transformInv_(c),p=this.transformInv_(u),f=10+(s?Math.max(0,Math.ceil(_e(qt(i)/(s*s*256*256)))):0);if(this.addQuad_(l,h,c,u,d,g,_,p,f),this.wrapsXInSource_){var m=1/0;this.triangles_.forEach((function(t,e,i){m=Math.min(m,t.source[0][0],t.source[1][0],t.source[2][0])})),this.triangles_.forEach(function(t){if(Math.max(t.source[0][0],t.source[1][0],t.source[2][0])-m>this.sourceWorldWidth_/2){var e=[[t.source[0][0],t.source[0][1]],[t.source[1][0],t.source[1][1]],[t.source[2][0],t.source[2][1]]];e[0][0]-m>this.sourceWorldWidth_/2&&(e[0][0]-=this.sourceWorldWidth_),e[1][0]-m>this.sourceWorldWidth_/2&&(e[1][0]-=this.sourceWorldWidth_),e[2][0]-m>this.sourceWorldWidth_/2&&(e[2][0]-=this.sourceWorldWidth_);var i=Math.min(e[0][0],e[1][0],e[2][0]);Math.max(e[0][0],e[1][0],e[2][0])-i.5&&c<1,g=!1;if(l>0){if(this.targetProj_.isGlobal()&&this.targetWorldWidth_)g=ne(vt([t,e,i,n]))/this.targetWorldWidth_>.25||g;!d&&this.sourceProj_.isGlobal()&&c&&(g=c>.25||g)}if(!(!g&&this.maxSourceExtent_&&isFinite(h[0])&&isFinite(h[1])&&isFinite(h[2])&&isFinite(h[3]))||re(h,this.maxSourceExtent_)){var _=0;if(!(g||isFinite(r[0])&&isFinite(r[1])&&isFinite(s[0])&&isFinite(s[1])&&isFinite(o[0])&&isFinite(o[1])&&isFinite(a[0])&&isFinite(a[1])))if(l>0)g=!0;else if(1!=(_=(isFinite(r[0])&&isFinite(r[1])?0:8)+(isFinite(s[0])&&isFinite(s[1])?0:4)+(isFinite(o[0])&&isFinite(o[1])?0:2)+(isFinite(a[0])&&isFinite(a[1])?0:1))&&2!=_&&4!=_&&8!=_)return;if(l>0){if(!g){var p=[(t[0]+i[0])/2,(t[1]+i[1])/2],f=this.transformInv_(p),m=void 0;if(d)m=(ye(r[0],u)+ye(o[0],u))/2-ye(f[0],u);else m=(r[0]+o[0])/2-f[0];var y=(r[1]+o[1])/2-f[1];g=m*m+y*y>this.errorThresholdSquared_}if(g){if(Math.abs(t[0]-i[0])<=Math.abs(t[1]-i[1])){var v=[(e[0]+i[0])/2,(e[1]+i[1])/2],x=this.transformInv_(v),E=[(n[0]+t[0])/2,(n[1]+t[1])/2],I=this.transformInv_(E);this.addQuad_(t,e,v,E,r,s,x,I,l-1),this.addQuad_(E,v,i,n,I,x,o,a,l-1)}else{var C=[(t[0]+e[0])/2,(t[1]+e[1])/2],w=this.transformInv_(C),S=[(i[0]+n[0])/2,(i[1]+n[1])/2],T=this.transformInv_(S);this.addQuad_(t,C,S,n,r,w,T,a,l-1),this.addQuad_(C,e,i,S,w,s,o,T,l-1)}return}}if(d){if(!this.canWrapXInSource_)return;this.wrapsXInSource_=!0}0==(11&_)&&this.addTriangle_(t,i,n,r,o,a),0==(14&_)&&this.addTriangle_(t,i,e,r,o,s),_&&(0==(13&_)&&this.addTriangle_(e,n,t,s,a,r),0==(7&_)&&this.addTriangle_(e,n,i,s,a,o))}},t.prototype.calculateSourceExtent=function(){var t=[1/0,1/0,-1/0,-1/0];return this.triangles_.forEach((function(e,i,n){var r=e.source;Gt(t,r[0]),Gt(t,r[1]),Gt(t,r[2])})),t},t.prototype.getTriangles=function(){return this.triangles_},t}(),Iu={imageSmoothingEnabled:!1,msImageSmoothingEnabled:!1};function Cu(t,e,i,n,r){t.beginPath(),t.moveTo(0,0),t.lineTo(e,i),t.lineTo(n,r),t.closePath(),t.save(),t.clip(),t.fillRect(0,0,Math.max(e,n)+1,Math.max(i,r)),t.restore()}function wu(t,e){return Math.abs(t[4*e]-210)>2||Math.abs(t[4*e+3]-191.25)>2}function Su(t,e,i,n){var r=ri(i,e,t),s=$e(e,n,i),o=e.getMetersPerUnit();void 0!==o&&(s*=o);var a=t.getMetersPerUnit();void 0!==a&&(s/=a);var l=t.getExtent();if(!l||Ct(l,r)){var h=$e(t,s,r)/s;isFinite(h)&&h>0&&(s/=h)}return s}function Tu(t,e,i,n,r,s,o,a,l,h,c,u){var d=Pr(Math.round(i*t),Math.round(i*e));if(m(d,u),0===l.length)return d.canvas;function g(t){return Math.round(t*i)/i}d.scale(i,i),d.globalCompositeOperation="lighter";var _=[1/0,1/0,-1/0,-1/0];l.forEach((function(t,e,i){Dt(_,t.extent)}));var p=ne(_),f=Kt(_),y=Pr(Math.round(i*p/n),Math.round(i*f/n));m(y,u);var v=i/n;l.forEach((function(t,e,i){var n=t.extent[0]-_[0],r=-(t.extent[3]-_[3]),s=ne(t.extent),o=Kt(t.extent);t.image.width>0&&t.image.height>0&&y.drawImage(t.image,h,h,t.image.width-2*h,t.image.height-2*h,n*v,r*v,s*v,o*v)}));var x=ee(o);return a.getTriangles().forEach((function(t,e,r){var o=t.source,a=t.target,l=o[0][0],h=o[0][1],c=o[1][0],p=o[1][1],f=o[2][0],m=o[2][1],v=g((a[0][0]-x[0])/s),E=g(-(a[0][1]-x[1])/s),I=g((a[1][0]-x[0])/s),C=g(-(a[1][1]-x[1])/s),w=g((a[2][0]-x[0])/s),S=g(-(a[2][1]-x[1])/s),T=l,L=h;l=0,h=0;var N=function(t){for(var e=t.length,i=0;ir&&(r=o,n=s)}if(0===r)return null;var a=t[n];t[n]=t[i],t[i]=a;for(var l=i+1;l=0;d--){u[d]=t[d][e]/t[d][d];for(var g=d-1;g>=0;g--)t[g][e]-=t[g][d]*u[d]}return u}([[c-=T,p-=L,0,0,I-v],[f-=T,m-=L,0,0,w-v],[0,0,c,p,C-E],[0,0,f,m,S-E]]);if(N){if(d.save(),d.beginPath(),function(){if(void 0===vu){var t=document.createElement("canvas").getContext("2d");t.globalCompositeOperation="lighter",t.fillStyle="rgba(210, 0, 0, 0.75)",Cu(t,4,5,4,0),Cu(t,4,5,0,5);var e=t.getImageData(0,0,3,3).data;vu=wu(e,0)||wu(e,4)||wu(e,8)}return vu}()||u===Iu){d.moveTo(I,C);for(var O=v-I,R=E-C,P=0;P<4;P++)d.lineTo(I+g((P+1)*O/4),C+g(P*R/3)),3!=P&&d.lineTo(I+g((P+1)*O/4),C+g((P+1)*R/3));d.lineTo(w,S)}else d.moveTo(I,C),d.lineTo(v,E),d.lineTo(w,S);d.clip(),d.transform(N[0],N[2],N[1],N[3],v,E),d.translate(_[0]-T,_[3]-L),d.scale(n/i,-n/i),d.drawImage(y.canvas,0,0),d.restore()}})),c&&(d.save(),d.globalCompositeOperation="source-over",d.strokeStyle="black",d.lineWidth=1,a.getTriangles().forEach((function(t,e,i){var n=t.target,r=(n[0][0]-x[0])/s,o=-(n[0][1]-x[1])/s,a=(n[1][0]-x[0])/s,l=-(n[1][1]-x[1])/s,h=(n[2][0]-x[0])/s,c=-(n[2][1]-x[1])/s;d.beginPath(),d.moveTo(a,l),d.lineTo(r,o),d.lineTo(h,c),d.closePath(),d.stroke()})),d.restore()),d.canvas}var Lu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Nu=function(t){function e(e,i,n,r,s,o,a,l,h,c,u,d){var g=t.call(this,s,Zo)||this;g.renderEdges_=void 0!==u&&u,g.contextOptions_=d,g.pixelRatio_=a,g.gutter_=l,g.canvas_=null,g.sourceTileGrid_=i,g.targetTileGrid_=r,g.wrappedTileCoord_=o||s,g.sourceTiles_=[],g.sourcesListenerKeys_=null,g.sourceZ_=0;var _=r.getTileCoordExtent(g.wrappedTileCoord_),p=g.targetTileGrid_.getExtent(),f=g.sourceTileGrid_.getExtent(),m=p?$t(_,p):_;if(0===qt(m))return g.state=Qo,g;var y=e.getExtent();y&&(f=f?$t(f,y):y);var v=r.getResolution(g.wrappedTileCoord_[0]),x=function(t,e,i,n){var r=Ut(i),s=Su(t,e,r,n);return(!isFinite(s)||s<=0)&&zt(i,(function(i){return s=Su(t,e,i,n),isFinite(s)&&s>0})),s}(e,n,m,v);if(!isFinite(x)||x<=0)return g.state=Qo,g;var E=void 0!==c?c:.5;if(g.triangulation_=new Eu(e,n,m,f,x*E,v),0===g.triangulation_.getTriangles().length)return g.state=Qo,g;g.sourceZ_=i.getZForResolution(x);var I=g.triangulation_.calculateSourceExtent();if(f&&(e.canWrapX()?(I[1]=de(I[1],f[1],f[3]),I[3]=de(I[3],f[1],f[3])):I=$t(I,f)),qt(I)){for(var C=i.getTileRangeForExtentAndZ(I,g.sourceZ_),w=C.minX;w<=C.maxX;w++)for(var S=C.minY;S<=C.maxY;S++){var T=h(g.sourceZ_,w,S,a);T&&g.sourceTiles_.push(T)}0===g.sourceTiles_.length&&(g.state=Qo)}else g.state=Qo;return g}return Lu(e,t),e.prototype.getImage=function(){return this.canvas_},e.prototype.reproject_=function(){var t=[];if(this.sourceTiles_.forEach(function(e,i,n){e&&e.getState()==Jo&&t.push({extent:this.sourceTileGrid_.getTileCoordExtent(e.tileCoord),image:e.getImage()})}.bind(this)),this.sourceTiles_.length=0,0===t.length)this.state=$o;else{var e=this.wrappedTileCoord_[0],i=this.targetTileGrid_.getTileSize(e),n="number"==typeof i?i:i[0],r="number"==typeof i?i:i[1],s=this.targetTileGrid_.getResolution(e),o=this.sourceTileGrid_.getResolution(this.sourceZ_),a=this.targetTileGrid_.getTileCoordExtent(this.wrappedTileCoord_);this.canvas_=Tu(n,r,this.pixelRatio_,o,this.sourceTileGrid_.getExtent(),s,a,this.triangulation_,t,this.gutter_,this.renderEdges_,this.contextOptions_),this.state=Jo}this.changed()},e.prototype.load=function(){if(this.state==Zo){this.state=Ko,this.changed();var t=0;this.sourcesListenerKeys_=[],this.sourceTiles_.forEach(function(e,i,n){var r=e.getState();if(r==Zo||r==Ko){t++;var s=F(e,w,(function(i){var n=e.getState();n!=Jo&&n!=$o&&n!=Qo||(G(s),0===--t&&(this.unlistenSources_(),this.reproject_()))}),this);this.sourcesListenerKeys_.push(s)}}.bind(this)),this.sourceTiles_.forEach((function(t,e,i){t.getState()==Zo&&t.load()})),0===t&&setTimeout(this.reproject_.bind(this),0)}},e.prototype.unlistenSources_=function(){this.sourcesListenerKeys_.forEach(G),this.sourcesListenerKeys_=null},e}(mu),Ou=function(){function t(t){this.highWaterMark=void 0!==t?t:2048,this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null}return t.prototype.canExpireCache=function(){return this.highWaterMark>0&&this.getCount()>this.highWaterMark},t.prototype.clear=function(){this.count_=0,this.entries_={},this.oldest_=null,this.newest_=null},t.prototype.containsKey=function(t){return this.entries_.hasOwnProperty(t)},t.prototype.forEach=function(t){for(var e=this.oldest_;e;)t(e.value_,e.key_,this),e=e.newer},t.prototype.get=function(t,e){var i=this.entries_[t];return $(void 0!==i,15),i===this.newest_||(i===this.oldest_?(this.oldest_=this.oldest_.newer,this.oldest_.older=null):(i.newer.older=i.older,i.older.newer=i.newer),i.newer=null,i.older=this.newest_,this.newest_.newer=i,this.newest_=i),i.value_},t.prototype.remove=function(t){var e=this.entries_[t];return $(void 0!==e,15),e===this.newest_?(this.newest_=e.older,this.newest_&&(this.newest_.newer=null)):e===this.oldest_?(this.oldest_=e.newer,this.oldest_&&(this.oldest_.older=null)):(e.newer.older=e.older,e.older.newer=e.newer),delete this.entries_[t],--this.count_,e.value_},t.prototype.getCount=function(){return this.count_},t.prototype.getKeys=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.key_;return e},t.prototype.getValues=function(){var t,e=new Array(this.count_),i=0;for(t=this.newest_;t;t=t.older)e[i++]=t.value_;return e},t.prototype.peekLast=function(){return this.oldest_.value_},t.prototype.peekLastKey=function(){return this.oldest_.key_},t.prototype.peekFirstKey=function(){return this.newest_.key_},t.prototype.pop=function(){var t=this.oldest_;return delete this.entries_[t.key_],t.newer&&(t.newer.older=null),this.oldest_=t.newer,this.oldest_||(this.newest_=null),--this.count_,t.value_},t.prototype.replace=function(t,e){this.get(t),this.entries_[t].value_=e},t.prototype.set=function(t,e){$(!(t in this.entries_),16);var i={key_:t,newer:null,older:this.newest_,value_:e};this.newest_?this.newest_.newer=i:this.oldest_=i,this.newest_=i,this.entries_[t]=i,++this.count_},t.prototype.setSize=function(t){this.highWaterMark=t},t}();function Ru(t,e,i,n){return void 0!==n?(n[0]=t,n[1]=e,n[2]=i,n):[t,e,i]}function Pu(t,e,i){return t+"/"+e+"/"+i}function bu(t){return Pu(t[0],t[1],t[2])}var Mu=function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function n(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Au=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Mu(e,t),e.prototype.expireCache=function(t){for(;this.canExpireCache();){if(this.peekLast().getKey()in t)break;this.pop().release()}},e.prototype.pruneExceptNewestZ=function(){if(0!==this.getCount()){var t=function(t){return t.split("/").map(Number)}(this.peekFirstKey())[0];this.forEach(function(e){e.tileCoord[0]!==t&&(this.remove(bu(e.tileCoord)),e.release())}.bind(this))}},e}(Ou),Fu="tileloadstart",Du="tileloadend",Gu="tileloaderror",ku=[0,0,0],Vu=function(){function t(t){var e,i,n,r;if(this.minZoom=void 0!==t.minZoom?t.minZoom:0,this.resolutions_=t.resolutions,$((e=this.resolutions_,i=!0,n=function(t,e){return e-t}||l,e.every((function(t,r){if(0===r)return!0;var s=n(e[r-1],t);return!(s>0||i&&0===s)}))),17),!t.origins)for(var s=0,o=this.resolutions_.length-1;s=this.minZoom;){if(e(a,2===this.zoomFactor_?au(r=Math.floor(r/2),r,s=Math.floor(s/2),s,i):this.getTileRangeForExtentAndZ(o,a,i)))return!0;--a}return!1},t.prototype.getExtent=function(){return this.extent_},t.prototype.getMaxZoom=function(){return this.maxZoom},t.prototype.getMinZoom=function(){return this.minZoom},t.prototype.getOrigin=function(t){return this.origin_?this.origin_:this.origins_[t]},t.prototype.getResolution=function(t){return this.resolutions_[t]},t.prototype.getResolutions=function(){return this.resolutions_},t.prototype.getTileCoordChildTileRange=function(t,e,i){if(t[0]0?n:Math.max(o/a[0],s/a[1]),h=r+1,c=new Array(h),u=0;ui||i>e.getMaxZoom())return!1;var s,o=e.getExtent();return!(s=o?e.getTileRangeForExtentAndZ(o,i):e.getFullTileRange(i))||s.containsXY(n,r)}(t,n)?t:null},e.prototype.clear=function(){this.tileCache.clear()},e.prototype.refresh=function(){this.clear(),t.prototype.refresh.call(this)},e.prototype.updateCacheSize=function(t,e){var i=this.getTileCacheForProjection(e);t>i.highWaterMark&&(i.highWaterMark=t)},e.prototype.useTile=function(t,e,i,n){},e}(Jh),ju=function(t){function e(e,i){var n=t.call(this,e)||this;return n.tile=i,n}return qu(e,t),e}(s),Uu=Xu;function Wu(t,e){var i=/\{z\}/g,n=/\{x\}/g,r=/\{y\}/g,s=/\{-y\}/g;return function(o,a,l){return o?t.replace(i,o[0].toString()).replace(n,o[1].toString()).replace(r,o[2].toString()).replace(s,(function(){var t=o[0],i=e.getFullTileRange(t);return $(i,55),(i.getHeight()-o[2]-1).toString()})):void 0}}function Hu(t){return 1===t.length?t[0]:function(e,i,n){if(e){var r=ye(function(t){return(t[1]<0&&(i.tileUrlFunction=Hu(s.map(i.createFromWMTSTemplate.bind(i)))),i}return od(e,t),e.prototype.setUrls=function(t){this.urls=t;var e=t.join("\n");this.setTileUrlFunction(Hu(t.map(this.createFromWMTSTemplate.bind(this))),e)},e.prototype.getDimensions=function(){return this.dimensions_},e.prototype.getFormat=function(){return this.format_},e.prototype.getLayer=function(){return this.layer_},e.prototype.getMatrixSet=function(){return this.matrixSet_},e.prototype.getRequestEncoding=function(){return this.requestEncoding_},e.prototype.getStyle=function(){return this.style_},e.prototype.getVersion=function(){return this.version_},e.prototype.getKeyForDimensions_=function(){var t=0,e=[];for(var i in this.dimensions_)e[t++]=i+"-"+this.dimensions_[i];return e.join("/")},e.prototype.updateDimensions=function(t){m(this.dimensions_,t),this.setKey(this.getKeyForDimensions_())},e.prototype.createFromWMTSTemplate=function(t){var e=this.requestEncoding_,i={layer:this.layer_,style:this.style_,tilematrixset:this.matrixSet_};e==ed&&m(i,{Service:"WMTS",Request:"GetTile",Version:this.version_,Format:this.format_}),t=e==ed?id(t,i):t.replace(/\{(\w+?)\}/g,(function(t,e){return e.toLowerCase()in i?i[e.toLowerCase()]:t}));var n=this.tileGrid,r=this.dimensions_;return function(i,s,o){if(i){var a={TileMatrix:n.getMatrixId(i[0]),TileCol:i[1],TileRow:i[2]};m(a,r);var l=t;return l=e==ed?id(l,a):l.replace(/\{(\w+?)\}/g,(function(t,e){return a[e]}))}}},e}(td);var ld=function(){function t(t){var e=t||{};this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.scale_=e.scale,this.scaleArray_=ia(void 0!==e.scale?e.scale:1),this.text_=e.text,this.textAlign_=e.textAlign,this.textBaseline_=e.textBaseline,this.fill_=void 0!==e.fill?e.fill:new xl({color:"#333"}),this.maxAngle_=void 0!==e.maxAngle?e.maxAngle:Math.PI/4,this.placement_=void 0!==e.placement?e.placement:nh,this.overflow_=!!e.overflow,this.stroke_=void 0!==e.stroke?e.stroke:null,this.offsetX_=void 0!==e.offsetX?e.offsetX:0,this.offsetY_=void 0!==e.offsetY?e.offsetY:0,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=void 0===e.padding?null:e.padding}return t.prototype.clone=function(){var e=this.getScale();return new t({font:this.getFont(),placement:this.getPlacement(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(e)?e.slice():e,text:this.getText(),textAlign:this.getTextAlign(),textBaseline:this.getTextBaseline(),fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()})},t.prototype.getOverflow=function(){return this.overflow_},t.prototype.getFont=function(){return this.font_},t.prototype.getMaxAngle=function(){return this.maxAngle_},t.prototype.getPlacement=function(){return this.placement_},t.prototype.getOffsetX=function(){return this.offsetX_},t.prototype.getOffsetY=function(){return this.offsetY_},t.prototype.getFill=function(){return this.fill_},t.prototype.getRotateWithView=function(){return this.rotateWithView_},t.prototype.getRotation=function(){return this.rotation_},t.prototype.getScale=function(){return this.scale_},t.prototype.getScaleArray=function(){return this.scaleArray_},t.prototype.getStroke=function(){return this.stroke_},t.prototype.getText=function(){return this.text_},t.prototype.getTextAlign=function(){return this.textAlign_},t.prototype.getTextBaseline=function(){return this.textBaseline_},t.prototype.getBackgroundFill=function(){return this.backgroundFill_},t.prototype.getBackgroundStroke=function(){return this.backgroundStroke_},t.prototype.getPadding=function(){return this.padding_},t.prototype.setOverflow=function(t){this.overflow_=t},t.prototype.setFont=function(t){this.font_=t},t.prototype.setMaxAngle=function(t){this.maxAngle_=t},t.prototype.setOffsetX=function(t){this.offsetX_=t},t.prototype.setOffsetY=function(t){this.offsetY_=t},t.prototype.setPlacement=function(t){this.placement_=t},t.prototype.setRotateWithView=function(t){this.rotateWithView_=t},t.prototype.setFill=function(t){this.fill_=t},t.prototype.setRotation=function(t){this.rotation_=t},t.prototype.setScale=function(t){this.scale_=t,this.scaleArray_=ia(void 0!==t?t:1)},t.prototype.setStroke=function(t){this.stroke_=t},t.prototype.setText=function(t){this.text_=t},t.prototype.setTextAlign=function(t){this.textAlign_=t},t.prototype.setTextBaseline=function(t){this.textBaseline_=t},t.prototype.setBackgroundFill=function(t){this.backgroundFill_=t},t.prototype.setBackgroundStroke=function(t){this.backgroundStroke_=t},t.prototype.setPadding=function(t){this.padding_=t},t}()}});void 0===VlMapActions&&console.error("esm-webpack-plugin: nothing exported!");const _VlMapActions$VlCustomMap=VlMapActions.VlCustomMap,_VlMapActions$VlMapWithActions=VlMapActions.VlMapWithActions,_VlMapActions$VlSnapInteraction=VlMapActions.VlSnapInteraction,_VlMapActions$VlBoxSelectAction=VlMapActions.VlBoxSelectAction,_VlMapActions$VlDeleteAction=VlMapActions.VlDeleteAction,_VlMapActions$VlDrawAction=VlMapActions.VlDrawAction,_VlMapActions$VlDrawLineAction=VlMapActions.VlDrawLineAction,_VlMapActions$VlDrawPolygonAction=VlMapActions.VlDrawPolygonAction,_VlMapActions$VlDrawRectangleAction=VlMapActions.VlDrawRectangleAction,_VlMapActions$VlHighlightAction=VlMapActions.VlHighlightAction,_VlMapActions$VlMapAction=VlMapActions.VlMapAction,_VlMapActions$VlMeasureAction=VlMapActions.VlMeasureAction,_VlMapActions$VlModifyAction=VlMapActions.VlModifyAction,_VlMapActions$VlModifyAndTranslateAction=VlMapActions.VlModifyAndTranslateAction,_VlMapActions$VlSelectAction=VlMapActions.VlSelectAction,_VlMapActions$VlSelectActions=VlMapActions.VlSelectActions,_VlMapActions$VlShowInfoAction=VlMapActions.VlShowInfoAction,_VlMapActions$VlShowInfoSelectAction=VlMapActions.VlShowInfoSelectAction,_VlMapActions$VlSplitAction=VlMapActions.VlSplitAction,_VlMapActions$VlTooltips=VlMapActions.VlTooltips,_VlMapActions$VlTranslateAction=VlMapActions.VlTranslateAction,_VlMapActions$OlLayerGroup=VlMapActions.OlLayerGroup,_VlMapActions$OlVectorLayer=VlMapActions.OlVectorLayer,_VlMapActions$OlTileLayer=VlMapActions.OlTileLayer,_VlMapActions$OlOverlay=VlMapActions.OlOverlay,_VlMapActions$OlVectorSource=VlMapActions.OlVectorSource,_VlMapActions$OlClusterSource=VlMapActions.OlClusterSource,_VlMapActions$OlWMTSSource=VlMapActions.OlWMTSSource,_VlMapActions$OlWMTSTileGrid=VlMapActions.OlWMTSTileGrid,_VlMapActions$OlFeature=VlMapActions.OlFeature,_VlMapActions$OlPoint=VlMapActions.OlPoint,_VlMapActions$OlGeometryType=VlMapActions.OlGeometryType,_VlMapActions$OlStyle=VlMapActions.OlStyle,_VlMapActions$OlStyleStroke=VlMapActions.OlStyleStroke,_VlMapActions$OlStyleFill=VlMapActions.OlStyleFill,_VlMapActions$OlStyleCircle=VlMapActions.OlStyleCircle,_VlMapActions$OlStyleText=VlMapActions.OlStyleText,_VlMapActions$OlProjection=VlMapActions.OlProjection,_VlMapActions$OlGeoJSON=VlMapActions.OlGeoJSON,_VlMapActions$OlExtent=VlMapActions.OlExtent,_VlMapActions$OlLoadingstrategy=VlMapActions.OlLoadingstrategy;export{_VlMapActions$VlCustomMap as VlCustomMap,_VlMapActions$VlMapWithActions as VlMapWithActions,_VlMapActions$VlSnapInteraction as VlSnapInteraction,_VlMapActions$VlBoxSelectAction as VlBoxSelectAction,_VlMapActions$VlDeleteAction as VlDeleteAction,_VlMapActions$VlDrawAction as VlDrawAction,_VlMapActions$VlDrawLineAction as VlDrawLineAction,_VlMapActions$VlDrawPolygonAction as VlDrawPolygonAction,_VlMapActions$VlDrawRectangleAction as VlDrawRectangleAction,_VlMapActions$VlHighlightAction as VlHighlightAction,_VlMapActions$VlMapAction as VlMapAction,_VlMapActions$VlMeasureAction as VlMeasureAction,_VlMapActions$VlModifyAction as VlModifyAction,_VlMapActions$VlModifyAndTranslateAction as VlModifyAndTranslateAction,_VlMapActions$VlSelectAction as VlSelectAction,_VlMapActions$VlSelectActions as VlSelectActions,_VlMapActions$VlShowInfoAction as VlShowInfoAction,_VlMapActions$VlShowInfoSelectAction as VlShowInfoSelectAction,_VlMapActions$VlSplitAction as VlSplitAction,_VlMapActions$VlTooltips as VlTooltips,_VlMapActions$VlTranslateAction as VlTranslateAction,_VlMapActions$OlLayerGroup as OlLayerGroup,_VlMapActions$OlVectorLayer as OlVectorLayer,_VlMapActions$OlTileLayer as OlTileLayer,_VlMapActions$OlOverlay as OlOverlay,_VlMapActions$OlVectorSource as OlVectorSource,_VlMapActions$OlClusterSource as OlClusterSource,_VlMapActions$OlWMTSSource as OlWMTSSource,_VlMapActions$OlWMTSTileGrid as OlWMTSTileGrid,_VlMapActions$OlFeature as OlFeature,_VlMapActions$OlPoint as OlPoint,_VlMapActions$OlGeometryType as OlGeometryType,_VlMapActions$OlStyle as OlStyle,_VlMapActions$OlStyleStroke as OlStyleStroke,_VlMapActions$OlStyleFill as OlStyleFill,_VlMapActions$OlStyleCircle as OlStyleCircle,_VlMapActions$OlStyleText as OlStyleText,_VlMapActions$OlProjection as OlProjection,_VlMapActions$OlGeoJSON as OlGeoJSON,_VlMapActions$OlExtent as OlExtent,_VlMapActions$OlLoadingstrategy as OlLoadingstrategy}; \ No newline at end of file diff --git a/src/index.js b/src/index.js index 81bf2ea..208ab0b 100644 --- a/src/index.js +++ b/src/index.js @@ -6,6 +6,7 @@ module.exports = { VlDeleteAction: require('../dist/vl-mapactions.js').DeleteAction, VlDrawAction: require('../dist/vl-mapactions.js').DrawAction, VlDrawLineAction: require('../dist/vl-mapactions.js').DrawLineAction, + VlDrawPolygonAction: require('../dist/vl-mapactions.js').DrawPolygonAction, VlDrawRectangleAction: require('../dist/vl-mapactions.js').DrawRectangleAction, VlHighlightAction: require('../dist/vl-mapactions.js').HighlightAction, VlMapAction: require('../dist/vl-mapactions.js').MapAction, diff --git a/src/vl-mapactions-all.js b/src/vl-mapactions-all.js index 2c630bf..639b5bf 100644 --- a/src/vl-mapactions-all.js +++ b/src/vl-mapactions-all.js @@ -4,6 +4,7 @@ import {VlBoxSelectAction} from './vl-mapactions-box-select-action'; import {VlDeleteAction} from './vl-mapactions-delete-action'; import {VlDrawAction} from './vl-mapactions-draw-action'; import {VlDrawLineAction} from './vl-mapactions-draw-line-action'; +import {VlDrawPolygonAction} from './vl-mapactions-draw-polygon-action'; import {VlDrawRectangleAction} from './vl-mapactions-draw-rectangle-action'; import {VlHighlightAction} from './vl-mapactions-highlight-action'; import {VlMapAction} from './vl-mapactions-mapaction'; @@ -47,6 +48,7 @@ export { VlDeleteAction, VlDrawAction, VlDrawLineAction, + VlDrawPolygonAction, VlDrawRectangleAction, VlHighlightAction, VlMapAction, diff --git a/src/vl-mapactions-draw-action.js b/src/vl-mapactions-draw-action.js index 3c03707..3fc8902 100644 --- a/src/vl-mapactions-draw-action.js +++ b/src/vl-mapactions-draw-action.js @@ -6,29 +6,28 @@ import {VlMapAction} from './vl-mapactions-mapaction'; import {VlSnapInteraction} from './vl-mapactions-snap-interaction'; export class VlDrawAction extends VlMapAction { - constructor(layer, type, onDraw, options) { + constructor(layer, type, onDraw, options = {}) { const interactions = []; - const drawOptions = options || {}; - drawOptions.source = layer.getSource(); - drawOptions.type = type; - const drawInteraction = new Draw(drawOptions); + options.source = layer.getSource(); + options.type = type; + const drawInteraction = new Draw(options); interactions.push(drawInteraction); - if (drawOptions.snapping) { - interactions.push(new VlSnapInteraction(drawOptions.snapping.layer || layer)); + if (options.snapping) { + interactions.push(new VlSnapInteraction(options.snapping.layer || layer)); } drawInteraction.on('drawstart', (event) => { - if (drawOptions.measure) { + if (options.measure) { const feature = event.feature; - drawOptions.measure = typeof drawOptions.measure === 'object' ? drawOptions.measure : {}; - drawOptions.measure.tooltip = drawOptions.measure.tooltip || {}; + options.measure = typeof options.measure === 'object' ? options.measure : {}; + options.measure.tooltip = options.measure.tooltip || {}; const tooltipElement = document.createElement('div'); tooltipElement.setAttribute('class', 'measure-tooltip'); this.tooltip = new Overlay({ - offset: drawOptions.measure.tooltip.offset || [-15, 10], + offset: options.measure.tooltip.offset || [-15, 10], positioning: 'bottom-center', }); @@ -57,7 +56,7 @@ export class VlDrawAction extends VlMapAction { super(interactions); - this.drawOptions = drawOptions; + this.options = options; this.drawInteraction = drawInteraction; } @@ -67,7 +66,7 @@ export class VlDrawAction extends VlMapAction { } _cleanUp() { - if (this.drawOptions.measure) { + if (this.options.measure) { unByKey(this.measurePointermoveHandler); this._removeTooltip(); } diff --git a/src/vl-mapactions-draw-line-action.js b/src/vl-mapactions-draw-line-action.js index 21a01ba..9e37cc7 100644 --- a/src/vl-mapactions-draw-line-action.js +++ b/src/vl-mapactions-draw-line-action.js @@ -2,9 +2,7 @@ import {VlDrawAction} from './vl-mapactions-draw-action'; import GeometryType from 'ol/geom/GeometryType'; export class VlDrawLineAction extends VlDrawAction { - constructor(layer, onDraw, options) { - options = options || {}; + constructor(layer, onDraw, options = {}) { super(layer, GeometryType.LINE_STRING, onDraw, options); - this.drawLineOptions = options; } } diff --git a/src/vl-mapactions-draw-polygon-action.js b/src/vl-mapactions-draw-polygon-action.js new file mode 100644 index 0000000..e19a5ce --- /dev/null +++ b/src/vl-mapactions-draw-polygon-action.js @@ -0,0 +1,8 @@ +import {VlDrawAction} from './vl-mapactions-draw-action'; +import GeometryType from 'ol/geom/GeometryType'; + +export class VlDrawPolygonAction extends VlDrawAction { + constructor(layer, onDraw, options = {}) { + super(layer, GeometryType.POLYGON, onDraw, options); + } +} diff --git a/src/vl-mapactions-draw-rectangle-action.js b/src/vl-mapactions-draw-rectangle-action.js index 64cf42d..0b0d5fa 100644 --- a/src/vl-mapactions-draw-rectangle-action.js +++ b/src/vl-mapactions-draw-rectangle-action.js @@ -3,10 +3,9 @@ import {VlDrawAction} from './vl-mapactions-draw-action'; import GeometryType from 'ol/geom/GeometryType'; export class VlDrawRectangleAction extends VlDrawAction { - constructor(layer, onDraw, options) { - const drawRectangleOptions = options || {}; - drawRectangleOptions.maxPoints = 2; - drawRectangleOptions.geometryFunction = (coordinates, geometry) => { + constructor(layer, onDraw, options = {}) { + options.maxPoints = 2; + options.geometryFunction = (coordinates, geometry) => { if (!geometry) { geometry = new Polygon([]); } @@ -17,9 +16,6 @@ export class VlDrawRectangleAction extends VlDrawAction { ]); return geometry; }; - - super(layer, GeometryType.LINE_STRING, onDraw, drawRectangleOptions); - - this.drawRectangleOptions = drawRectangleOptions; + super(layer, GeometryType.LINE_STRING, onDraw, options); } } diff --git a/test/unit/vl-mapactions-draw-action.test.js b/test/unit/vl-mapactions-draw-action.test.js index 6e63661..3b34e37 100644 --- a/test/unit/vl-mapactions-draw-action.test.js +++ b/test/unit/vl-mapactions-draw-action.test.js @@ -26,7 +26,7 @@ describe('draw action', () => { it('kan opties meegeven aan draw action', () => { const drawAction = new VlDrawAction(layer, 'LineString', callback, {maxPoints: 2}); - const options = drawAction.drawOptions; + const options = drawAction.options; expect(options.maxPoints).to.equal(2); expect(options.source).to.equal(source); expect(options.type).to.equal('LineString'); diff --git a/test/unit/vl-mapactions-draw-line-action.test.js b/test/unit/vl-mapactions-draw-line-action.test.js index c4991ba..0236d04 100644 --- a/test/unit/vl-mapactions-draw-line-action.test.js +++ b/test/unit/vl-mapactions-draw-line-action.test.js @@ -26,13 +26,13 @@ describe('draw line action', () => { }; const action = new VlDrawLineAction(layer, callback, options); - expect(action.drawLineOptions.maxPoints).to.be.undefined; - expect(action.drawLineOptions.snapping).to.deep.equal(snappingOptions); - expect(action.drawLineOptions.measure).to.be.true; + expect(action.options.maxPoints).to.be.undefined; + expect(action.options.snapping).to.deep.equal(snappingOptions); + expect(action.options.measure).to.be.true; }); it('geeft de juiste configuratie mee aan de draw interaction', () => { const action = new VlDrawLineAction(layer, callback); - expect(action.drawOptions).to.deep.equal(action.drawLineOptions); + expect(action.options).to.deep.equal(action.options); }); }); diff --git a/test/unit/vl-mapactions-draw-polygon-action.test.js b/test/unit/vl-mapactions-draw-polygon-action.test.js new file mode 100644 index 0000000..8d56ad6 --- /dev/null +++ b/test/unit/vl-mapactions-draw-polygon-action.test.js @@ -0,0 +1,30 @@ +import sinon from 'sinon/pkg/sinon-esm'; +import {expect} from 'chai'; +import {Vector as SourceVector} from 'ol/source'; +import {VlDrawPolygonAction} from '../../src/vl-mapactions-draw-polygon-action'; + +describe('draw polygon action', () => { + const source = new SourceVector({}); + + const layer = { + getSource: () => { + return source; + }, + }; + + const callback = sinon.spy(); + + it('geeft de snapping configuratie door aan de draw action', () => { + const snappingLayer = sinon.spy(); + const snapping = { + layer: snappingLayer, + }; + const action = new VlDrawPolygonAction(layer, callback, snapping); + expect(action.options.layer).to.deep.equal(snappingLayer); + }); + + it('geeft de juiste configuratie mee aan de draw interaction', () => { + const action = new VlDrawPolygonAction(layer, callback); + expect(action.options).to.deep.equal(action.options); + }); +}); diff --git a/test/unit/vl-mapactions-draw-rectangle-action.test.js b/test/unit/vl-mapactions-draw-rectangle-action.test.js index f29e838..050c3b3 100644 --- a/test/unit/vl-mapactions-draw-rectangle-action.test.js +++ b/test/unit/vl-mapactions-draw-rectangle-action.test.js @@ -20,13 +20,13 @@ describe('draw rectangle action', () => { layer: snappingLayer, }; const action = new VlDrawRectangleAction(layer, callback, snapping); - expect(action.drawRectangleOptions.layer).to.deep.equal(snappingLayer); + expect(action.options.layer).to.deep.equal(snappingLayer); }); it('geeft de juiste configuratie mee aan de draw interaction', () => { const action = new VlDrawRectangleAction(layer, callback); - expect(action.drawRectangleOptions.maxPoints).to.equal(2); - const geometryFunction = action.drawRectangleOptions.geometryFunction; + expect(action.options.maxPoints).to.equal(2); + const geometryFunction = action.options.geometryFunction; const geometry = geometryFunction([[0, 0], [1, 2]], null); expect(geometry.getCoordinates()[0][0]).to.deep.equal([0, 0]); expect(geometry.getCoordinates()[0][1]).to.deep.equal([0, 2]);