!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).turf={})}(this,(function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function h(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function g(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var n=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})})),n}var y,v,d=Object.prototype.toString,m=function(t){var n=d.call(t),r="[object Arguments]"===n;return r||(r="[object Array]"!==n&&null!==t&&"object"===e(t)&&"number"==typeof t.length&&t.length>=0&&"[object Function]"===d.call(t.callee)),r};var _=Array.prototype.slice,b=m,x=Object.keys,E=x?function(t){return x(t)}:function(){if(v)return y;var t;if(v=1,!Object.keys){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=m,o=Object.prototype.propertyIsEnumerable,a=!o.call({toString:null},"toString"),s=o.call((function(){}),"prototype"),u=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(t){var e=t.constructor;return e&&e.prototype===t},c={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},h=function(){if("undefined"==typeof window)return!1;for(var t in window)try{if(!c["$"+t]&&n.call(window,t)&&null!==window[t]&&"object"===e(window[t]))try{l(window[t])}catch(t){return!0}}catch(t){return!0}return!1}();t=function(t){var o=null!==t&&"object"===e(t),c="[object Function]"===r.call(t),f=i(t),p=o&&"[object String]"===r.call(t),g=[];if(!o&&!c&&!f)throw new TypeError("Object.keys called on a non-object");var y=s&&c;if(p&&t.length>0&&!n.call(t,0))for(var v=0;v0)for(var d=0;d1&&"boolean"!=typeof e)throw new G('"allowMissing" argument must be a boolean');if(null===ut(/^%?[^%]*%?$/,t))throw new q("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=function(t){var e=st(t,0,1),n=st(t,-1);if("%"===e&&"%"!==n)throw new q("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==e)throw new q("invalid intrinsic syntax, expected opening `%`");var r=[];return at(t,lt,(function(t,e,n,i){r[r.length]=n?at(i,ct,"$1"):e||t})),r}(t),r=n.length>0?n[0]:"",i=ht("%"+r+"%",e),o=i.name,a=i.value,s=!1,u=i.alias;u&&(r=u[0],ot(n,it([0,1],u)));for(var l=1,c=!0;l=n.length){var g=z(a,h);a=(c=!!g)&&"get"in g&&!("originalValue"in g.get)?g.get:a[h]}else c=rt(a,h),a=a[h];c&&!s&&(Q[o]=a)}}return a},pt=ft("%Object.defineProperty%",!0),gt=function(){if(pt)try{return pt({},"a",{value:1}),!0}catch(t){return!1}return!1};gt.hasArrayLengthDefineBug=function(){if(!gt())return null;try{return 1!==pt([],"length",{value:1}).length}catch(t){return!0}};var yt=gt,vt=ft("%Object.getOwnPropertyDescriptor%",!0);if(vt)try{vt([],"length")}catch(t){vt=null}var dt=vt,mt=yt(),_t=ft,bt=mt&&_t("%Object.defineProperty%",!0);if(bt)try{bt({},"a",{value:1})}catch(t){bt=!1}var xt=_t("%SyntaxError%"),Et=_t("%TypeError%"),wt=dt,kt=function(t,n,r){if(!t||"object"!==e(t)&&"function"!=typeof t)throw new Et("`obj` must be an object or a function`");if("string"!=typeof n&&"symbol"!==e(n))throw new Et("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new Et("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new Et("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new Et("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new Et("`loose`, if provided, must be a boolean");var i=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,s=arguments.length>6&&arguments[6],u=!!wt&&wt(t,n);if(bt)bt(t,n,{configurable:null===a&&u?u.configurable:!a,enumerable:null===i&&u?u.enumerable:!i,value:r,writable:null===o&&u?u.writable:!o});else{if(!s&&(i||o||a))throw new xt("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");t[n]=r}},St=S,It="function"==typeof Symbol&&"symbol"===e(Symbol("foo")),Pt=Object.prototype.toString,Nt=Array.prototype.concat,Mt=kt,Ot=yt(),Lt=function(t,e,n,r){if(e in t)if(!0===r){if(t[e]===n)return}else if("function"!=typeof(i=r)||"[object Function]"!==Pt.call(i)||!r())return;var i;Ot?Mt(t,e,n,!0):Mt(t,e,n)},Rt=function(t,e){var n=arguments.length>2?arguments[2]:{},r=St(e);It&&(r=Nt.call(r,Object.getOwnPropertySymbols(e)));for(var i=0;i4294967295||qt(e)!==e)throw new Bt("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],r=!0,i=!0;if("length"in t&&Ft){var o=Ft(t,"length");o&&!o.configurable&&(r=!1),o&&!o.writable&&(i=!1)}return(r||i||!n)&&(jt?Dt(t,"length",e,!0,!0):Dt(t,"length",e)),t};!function(t){var e=D,n=ft,r=Vt,i=n("%TypeError%"),o=n("%Function.prototype.apply%"),a=n("%Function.prototype.call%"),s=n("%Reflect.apply%",!0)||e.call(a,o),u=n("%Object.defineProperty%",!0),l=n("%Math.max%");if(u)try{u({},"a",{value:1})}catch(t){u=null}t.exports=function(t){if("function"!=typeof t)throw new i("a function is required");var n=s(e,a,arguments);return r(n,1+l(0,t.length-(arguments.length-1)),!0)};var c=function(){return s(e,o,arguments)};u?u(t.exports,"apply",{value:c}):t.exports.apply=c}(Tt);var Gt=Tt.exports,Yt=ft,zt=Gt,Ut=zt(Yt("String.prototype.indexOf")),Xt=function(t,e){var n=Yt(t,!!e);return"function"==typeof n&&Ut(t,".prototype.")>-1?zt(n):n},Wt=S,Ht=I(),Zt=Xt,Jt=Object,$t=Zt("Array.prototype.push"),Qt=Zt("Object.prototype.propertyIsEnumerable"),Kt=Ht?Object.getOwnPropertySymbols:null,te=function(t,e){if(null==t)throw new TypeError("target must be an object");var n=Jt(t);if(1===arguments.length)return n;for(var r=1;r2&&!!arguments[2]&&!me||(de?ve(t,"name",e,!0,!0):ve(t,"name",e)),t},xe=Object,Ee=TypeError,we=be((function(){if(null!=this&&this!==xe(this))throw new Ee("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t}),"get flags",!0),ke=we,Se=Ct.supportsDescriptors,Ie=Object.getOwnPropertyDescriptor,Pe=function(){if(Se&&"gim"===/a/gim.flags){var t=Ie(RegExp.prototype,"flags");if(t&&"function"==typeof t.get&&"boolean"==typeof RegExp.prototype.dotAll&&"boolean"==typeof RegExp.prototype.hasIndices){var e="",n={};if(Object.defineProperty(n,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(n,"sticky",{get:function(){e+="y"}}),"dy"===e)return t.get}}return ke},Ne=Ct.supportsDescriptors,Me=Pe,Oe=Object.getOwnPropertyDescriptor,Le=Object.defineProperty,Re=TypeError,Ce=Object.getPrototypeOf,Te=/a/,Ae=Ct,De=we,je=Pe,Fe=function(){if(!Ne||!Ce)throw new Re("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=Me(),e=Ce(Te),n=Oe(e,"flags");return n&&n.get===t||Le(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},Be=Gt(je());Ae(Be,{getPolyfill:je,implementation:De,shim:Fe});var qe=Be,Ve=Symbol.iterator,Ge="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Ye=[],ze=[],Ue="undefined"!=typeof Uint8Array?Uint8Array:Array,Xe=!1;function We(){Xe=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e=0;e<64;++e)Ye[e]=t[e],ze[t.charCodeAt(e)]=e;ze["-".charCodeAt(0)]=62,ze["_".charCodeAt(0)]=63}function He(t,e,n){for(var r,i,o=[],a=e;a>18&63]+Ye[i>>12&63]+Ye[i>>6&63]+Ye[63&i]);return o.join("")}function Ze(t){var e;Xe||We();for(var n=t.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;su?u:s+a));return 1===r?(e=t[n-1],i+=Ye[e>>2],i+=Ye[e<<4&63],i+="=="):2===r&&(e=(t[n-2]<<8)+t[n-1],i+=Ye[e>>10],i+=Ye[e>>4&63],i+=Ye[e<<2&63],i+="="),o.push(i),o.join("")}function Je(t,e,n,r,i){var o,a,s=8*i-r-1,u=(1<>1,c=-7,h=n?i-1:0,f=n?-1:1,p=t[e+h];for(h+=f,o=p&(1<<-c)-1,p>>=-c,c+=s;c>0;o=256*o+t[e+h],h+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=r;c>0;a=256*a+t[e+h],h+=f,c-=8);if(0===o)o=1-l;else{if(o===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=l}return(p?-1:1)*a*Math.pow(2,o-r)}function $e(t,e,n,r,i,o){var a,s,u,l=8*o-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,g=r?1:-1,y=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(e*u-1)*Math.pow(2,i),a+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[n+p]=255&s,p+=g,s/=256,i-=8);for(a=a<0;t[n+p]=255&a,p+=g,a/=256,l-=8);t[n+p-g]|=128*y}var Qe={}.toString,Ke=Array.isArray||function(t){return"[object Array]"==Qe.call(t)};function tn(){return nn.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function en(t,e){if(tn()=tn())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+tn().toString(16)+" bytes");return 0|t}function ln(t){return!(null==t||!t._isBuffer)}function cn(t,e){if(ln(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return jn(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Fn(t).length;default:if(r)return jn(t).length;e=(""+e).toLowerCase(),r=!0}}function hn(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return In(this,e,n);case"utf8":case"utf-8":return En(this,e,n);case"ascii":return kn(this,e,n);case"latin1":case"binary":return Sn(this,e,n);case"base64":return xn(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pn(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function fn(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function pn(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=nn.from(e,r)),ln(e))return 0===e.length?-1:gn(t,e,n,r,i);if("number"==typeof e)return e&=255,nn.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):gn(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function gn(t,e,n,r,i){var o,a=1,s=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,s/=2,u/=2,n/=2}function l(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(o=n;os&&(n=s-u),o=n;o>=0;o--){for(var h=!0,f=0;fi&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function xn(t,e,n){return 0===e&&n===t.length?Ze(t):Ze(t.slice(e,n))}function En(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(c=l);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&l)<<6|63&o)>127&&(c=u);break;case 3:o=t[i+1],a=t[i+2],128==(192&o)&&128==(192&a)&&(u=(15&l)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:o=t[i+1],a=t[i+2],s=t[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&l)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(c=u)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(t){var e=t.length;if(e<=wn)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),""},nn.prototype.compare=function(t,e,n,r,i){if(!ln(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),u=this.slice(r,i),l=t.slice(e,n),c=0;ci)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return yn(this,t,e,n);case"utf8":case"utf-8":return vn(this,t,e,n);case"ascii":return dn(this,t,e,n);case"latin1":case"binary":return mn(this,t,e,n);case"base64":return _n(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bn(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},nn.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var wn=4096;function kn(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function Mn(t,e,n,r,i,o){if(!ln(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function On(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function Ln(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function Rn(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Cn(t,e,n,r,i){return i||Rn(t,0,n,4),$e(t,e,n,r,23,4),n+4}function Tn(t,e,n,r,i){return i||Rn(t,0,n,8),$e(t,e,n,r,52,8),n+8}nn.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)r+=this[t+--e]*i;return r},nn.prototype.readUInt8=function(t,e){return e||Nn(t,1,this.length),this[t]},nn.prototype.readUInt16LE=function(t,e){return e||Nn(t,2,this.length),this[t]|this[t+1]<<8},nn.prototype.readUInt16BE=function(t,e){return e||Nn(t,2,this.length),this[t]<<8|this[t+1]},nn.prototype.readUInt32LE=function(t,e){return e||Nn(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},nn.prototype.readUInt32BE=function(t,e){return e||Nn(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},nn.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||Nn(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},nn.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||Nn(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},nn.prototype.readInt8=function(t,e){return e||Nn(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},nn.prototype.readInt16LE=function(t,e){e||Nn(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},nn.prototype.readInt16BE=function(t,e){e||Nn(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},nn.prototype.readInt32LE=function(t,e){return e||Nn(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},nn.prototype.readInt32BE=function(t,e){return e||Nn(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},nn.prototype.readFloatLE=function(t,e){return e||Nn(t,4,this.length),Je(this,t,!0,23,4)},nn.prototype.readFloatBE=function(t,e){return e||Nn(t,4,this.length),Je(this,t,!1,23,4)},nn.prototype.readDoubleLE=function(t,e){return e||Nn(t,8,this.length),Je(this,t,!0,52,8)},nn.prototype.readDoubleBE=function(t,e){return e||Nn(t,8,this.length),Je(this,t,!1,52,8)},nn.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||Mn(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+n},nn.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,1,255,0),nn.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},nn.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,2,65535,0),nn.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):On(this,t,e,!0),e+2},nn.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,2,65535,0),nn.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):On(this,t,e,!1),e+2},nn.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,4,4294967295,0),nn.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):Ln(this,t,e,!0),e+4},nn.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,4,4294967295,0),nn.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Ln(this,t,e,!1),e+4},nn.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Mn(this,t,e,n,i-1,-i)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},nn.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);Mn(this,t,e,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},nn.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,1,127,-128),nn.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},nn.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,2,32767,-32768),nn.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):On(this,t,e,!0),e+2},nn.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,2,32767,-32768),nn.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):On(this,t,e,!1),e+2},nn.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,4,2147483647,-2147483648),nn.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):Ln(this,t,e,!0),e+4},nn.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||Mn(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),nn.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):Ln(this,t,e,!1),e+4},nn.prototype.writeFloatLE=function(t,e,n){return Cn(this,t,e,!0,n)},nn.prototype.writeFloatBE=function(t,e,n){return Cn(this,t,e,!1,n)},nn.prototype.writeDoubleLE=function(t,e,n){return Tn(this,t,e,!0,n)},nn.prototype.writeDoubleBE=function(t,e,n){return Tn(this,t,e,!1,n)},nn.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--i)t[i+e]=this[i+n];else if(o<1e3||!nn.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Fn(t){return function(t){var e,n,r,i,o,a;Xe||We();var s=t.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===t[s-2]?2:"="===t[s-1]?1:0,a=new Ue(3*s/4-o),r=o>0?s-4:s;var u=0;for(e=0,n=0;e>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=ze[t.charCodeAt(e)]<<2|ze[t.charCodeAt(e+1)]>>4,a[u++]=255&i):1===o&&(i=ze[t.charCodeAt(e)]<<10|ze[t.charCodeAt(e+1)]<<4|ze[t.charCodeAt(e+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(An,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function Bn(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function qn(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function Vn(){throw new Error("setTimeout has not been defined")}function Gn(){throw new Error("clearTimeout has not been defined")}var Yn=Vn,zn=Gn;function Un(t){if(Yn===setTimeout)return setTimeout(t,0);if((Yn===Vn||!Yn)&&setTimeout)return Yn=setTimeout,setTimeout(t,0);try{return Yn(t,0)}catch(e){try{return Yn.call(null,t,0)}catch(e){return Yn.call(this,t,0)}}}"function"==typeof Ge.setTimeout&&(Yn=setTimeout),"function"==typeof Ge.clearTimeout&&(zn=clearTimeout);var Xn,Wn=[],Hn=!1,Zn=-1;function Jn(){Hn&&Xn&&(Hn=!1,Xn.length?Wn=Xn.concat(Wn):Zn=-1,Wn.length&&$n())}function $n(){if(!Hn){var t=Un(Jn);Hn=!0;for(var e=Wn.length;e;){for(Xn=Wn,Wn=[];++Zn1)for(var n=1;n=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}})),a=r[n];n=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),Ir(e)?n.showHidden=e:e&&zr(n,e),Rr(n.showHidden)&&(n.showHidden=!1),Rr(n.depth)&&(n.depth=2),Rr(n.colors)&&(n.colors=!1),Rr(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=br),Er(n,t,n.depth)}function br(t,e){var n=_r.styles[e];return n?"["+_r.colors[n][0]+"m"+t+"["+_r.colors[n][1]+"m":t}function xr(t,e){return t}function Er(t,e,n){if(t.customInspect&&e&&jr(e.inspect)&&e.inspect!==_r&&(!e.constructor||e.constructor.prototype!==e)){var r=e.inspect(n,t);return Or(r)||(r=Er(t,r,n)),r}var i=function(t,e){if(Rr(e))return t.stylize("undefined","undefined");if(Or(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}if(Mr(e))return t.stylize(""+e,"number");if(Ir(e))return t.stylize(""+e,"boolean");if(Pr(e))return t.stylize("null","null")}(t,e);if(i)return i;var o=Object.keys(e),a=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),Dr(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return wr(e);if(0===o.length){if(jr(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(Cr(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(Ar(e))return t.stylize(Date.prototype.toString.call(e),"date");if(Dr(e))return wr(e)}var u,l="",c=!1,h=["{","}"];(Sr(e)&&(c=!0,h=["[","]"]),jr(e))&&(l=" [Function"+(e.name?": "+e.name:"")+"]");return Cr(e)&&(l=" "+RegExp.prototype.toString.call(e)),Ar(e)&&(l=" "+Date.prototype.toUTCString.call(e)),Dr(e)&&(l=" "+wr(e)),0!==o.length||c&&0!=e.length?n<0?Cr(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),u=c?function(t,e,n,r,i){for(var o=[],a=0,s=e.length;a60)return n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1];return n[0]+e+" "+t.join(", ")+" "+n[1]}(u,l,h)):h[0]+l+h[1]}function wr(t){return"["+Error.prototype.toString.call(t)+"]"}function kr(t,e,n,r,i,o){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),Ur(r,i)||(a="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=Pr(n)?Er(t,u.value,null):Er(t,u.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),Rr(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function Sr(t){return Array.isArray(t)}function Ir(t){return"boolean"==typeof t}function Pr(t){return null===t}function Nr(t){return null==t}function Mr(t){return"number"==typeof t}function Or(t){return"string"==typeof t}function Lr(t){return"symbol"==typeof t}function Rr(t){return void 0===t}function Cr(t){return Tr(t)&&"[object RegExp]"===qr(t)}function Tr(t){return"object"==typeof t&&null!==t}function Ar(t){return Tr(t)&&"[object Date]"===qr(t)}function Dr(t){return Tr(t)&&("[object Error]"===qr(t)||t instanceof Error)}function jr(t){return"function"==typeof t}function Fr(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function Br(t){return nn.isBuffer(t)}function qr(t){return Object.prototype.toString.call(t)}function Vr(t){return t<10?"0"+t.toString(10):t.toString(10)}_r.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},_r.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};var Gr=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Yr(){var t,e;console.log("%s - %s",(t=new Date,e=[Vr(t.getHours()),Vr(t.getMinutes()),Vr(t.getSeconds())].join(":"),[t.getDate(),Gr[t.getMonth()],e].join(" ")),gr.apply(null,arguments))}function zr(t,e){if(!e||!Tr(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}function Ur(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Xr="undefined"!=typeof Symbol?Symbol("util.promisify.custom"):void 0;function Wr(t){if("function"!=typeof t)throw new TypeError('The "original" argument must be of type Function');if(Xr&&t[Xr]){var e;if("function"!=typeof(e=t[Xr]))throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(e,Xr,{value:e,enumerable:!1,writable:!1,configurable:!0}),e}function e(){for(var e,n,r=new Promise((function(t,r){e=t,n=r})),i=[],o=0;o-1e3&&t<1e3||di.call(/e/,e))return e;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof t){var r=t<0?-xi(-t):xi(t);if(r!==t){var i=String(r),o=pi.call(e,i.length+1);return gi.call(i,n,"$&_")+"."+gi.call(gi.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return gi.call(e,n,"$&_")}var Oi=$r,Li=Oi.custom,Ri=ji(Li)?Li:null;function Ci(t,e,n){var r="double"===(n.quoteStyle||e)?'"':"'";return r+t+r}function Ti(t){return gi.call(String(t),/"/g,""")}function Ai(t){return!("[object Array]"!==qi(t)||Ii&&"object"===e(t)&&Ii in t)}function Di(t){return!("[object RegExp]"!==qi(t)||Ii&&"object"===e(t)&&Ii in t)}function ji(t){if(Si)return t&&"object"===e(t)&&t instanceof Symbol;if("symbol"===e(t))return!0;if(!t||"object"!==e(t)||!ki)return!1;try{return ki.call(t),!0}catch(t){}return!1}var Fi=Object.prototype.hasOwnProperty||function(t){return t in this};function Bi(t,e){return Fi.call(t,e)}function qi(t){return ci.call(t)}function Vi(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,r=t.length;ne.maxStringLength){var n=t.length-e.maxStringLength,r="... "+n+" more character"+(n>1?"s":"");return Gi(pi.call(t,0,e.maxStringLength),e)+r}return Ci(gi.call(gi.call(t,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Yi),"single",e)}function Yi(t){var e=t.charCodeAt(0),n={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return n?"\\"+n:"\\x"+(e<16?"0":"")+yi.call(e.toString(16))}function zi(t){return"Object("+t+")"}function Ui(t){return t+" { ? }"}function Xi(t,e,n,r){return t+" ("+e+") {"+(r?Wi(n,r):_i.call(n,", "))+"}"}function Wi(t,e){if(0===t.length)return"";var n="\n"+e.prev+e.base;return n+_i.call(t,","+n)+"\n"+e.prev}function Hi(t,e){var n=Ai(t),r=[];if(n){r.length=t.length;for(var i=0;i0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Bi(a,"numericSeparator")&&"boolean"!=typeof a.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=a.numericSeparator;if(void 0===n)return"undefined";if(null===n)return"null";if("boolean"==typeof n)return n?"true":"false";if("string"==typeof n)return Gi(n,a);if("number"==typeof n){if(0===n)return 1/0/n>0?"0":"-0";var l=String(n);return u?Mi(n,l):l}if("bigint"==typeof n){var c=String(n)+"n";return u?Mi(n,c):c}var h=void 0===a.depth?5:a.depth;if(void 0===i&&(i=0),i>=h&&h>0&&"object"===e(n))return Ai(n)?"[Array]":"[Object]";var p=function(t,e){var n;if("\t"===t.indent)n="\t";else{if(!("number"==typeof t.indent&&t.indent>0))return null;n=_i.call(Array(t.indent+1)," ")}return{base:n,prev:_i.call(Array(e+1),n)}}(a,i);if(void 0===o)o=[];else if(Vi(o,n)>=0)return"[Circular]";function g(e,n,r){if(n&&(o=bi.call(o)).push(n),r){var s={depth:a.depth};return Bi(a,"quoteStyle")&&(s.quoteStyle=a.quoteStyle),t(e,s,i+1,o)}return t(e,a,i+1,o)}if("function"==typeof n&&!Di(n)){var y=function(t){if(t.name)return t.name;var e=fi.call(hi.call(t),/^function\s*([\w$]+)/);if(e)return e[1];return null}(n),v=Hi(n,g);return"[Function"+(y?": "+y:" (anonymous)")+"]"+(v.length>0?" { "+_i.call(v,", ")+" }":"")}if(ji(n)){var d=Si?gi.call(String(n),/^(Symbol\(.*\))_[^)]*$/,"$1"):ki.call(n);return"object"!==e(n)||Si?d:zi(d)}if(function(t){if(!t||"object"!==e(t))return!1;if("undefined"!=typeof HTMLElement&&t instanceof HTMLElement)return!0;return"string"==typeof t.nodeName&&"function"==typeof t.getAttribute}(n)){for(var m="<"+vi.call(String(n.nodeName)),_=n.attributes||[],b=0;b<_.length;b++)m+=" "+_[b].name+"="+Ci(Ti(_[b].value),"double",a);return m+=">",n.childNodes&&n.childNodes.length&&(m+="..."),m+=""}if(Ai(n)){if(0===n.length)return"[]";var x=Hi(n,g);return p&&!function(t){for(var e=0;e=0)return!1;return!0}(x)?"["+Wi(x,p)+"]":"[ "+_i.call(x,", ")+" ]"}if(function(t){return!("[object Error]"!==qi(t)||Ii&&"object"===e(t)&&Ii in t)}(n)){var E=Hi(n,g);return"cause"in Error.prototype||!("cause"in n)||Pi.call(n,"cause")?0===E.length?"["+String(n)+"]":"{ ["+String(n)+"] "+_i.call(E,", ")+" }":"{ ["+String(n)+"] "+_i.call(mi.call("[cause]: "+g(n.cause),E),", ")+" }"}if("object"===e(n)&&s){if(Ri&&"function"==typeof n[Ri]&&Oi)return Oi(n,{depth:h-i});if("symbol"!==s&&"function"==typeof n.inspect)return n.inspect()}if(function(t){if(!ti||!t||"object"!==e(t))return!1;try{ti.call(t);try{ii.call(t)}catch(t){return!0}return t instanceof Map}catch(t){}return!1}(n)){var w=[];return ei&&ei.call(n,(function(t,e){w.push(g(e,n,!0)+" => "+g(t,n))})),Xi("Map",ti.call(n),w,p)}if(function(t){if(!ii||!t||"object"!==e(t))return!1;try{ii.call(t);try{ti.call(t)}catch(t){return!0}return t instanceof Set}catch(t){}return!1}(n)){var k=[];return oi&&oi.call(n,(function(t){k.push(g(t,n))})),Xi("Set",ii.call(n),k,p)}if(function(t){if(!ai||!t||"object"!==e(t))return!1;try{ai.call(t,ai);try{si.call(t,si)}catch(t){return!0}return t instanceof WeakMap}catch(t){}return!1}(n))return Ui("WeakMap");if(function(t){if(!si||!t||"object"!==e(t))return!1;try{si.call(t,si);try{ai.call(t,ai)}catch(t){return!0}return t instanceof WeakSet}catch(t){}return!1}(n))return Ui("WeakSet");if(function(t){if(!ui||!t||"object"!==e(t))return!1;try{return ui.call(t),!0}catch(t){}return!1}(n))return Ui("WeakRef");if(function(t){return!("[object Number]"!==qi(t)||Ii&&"object"===e(t)&&Ii in t)}(n))return zi(g(Number(n)));if(function(t){if(!t||"object"!==e(t)||!Ei)return!1;try{return Ei.call(t),!0}catch(t){}return!1}(n))return zi(g(Ei.call(n)));if(function(t){return!("[object Boolean]"!==qi(t)||Ii&&"object"===e(t)&&Ii in t)}(n))return zi(li.call(n));if(function(t){return!("[object String]"!==qi(t)||Ii&&"object"===e(t)&&Ii in t)}(n))return zi(g(String(n)));if("undefined"!=typeof window&&n===window)return"{ [object Window] }";if(n===f)return"{ [object globalThis] }";if(!function(t){return!("[object Date]"!==qi(t)||Ii&&"object"===e(t)&&Ii in t)}(n)&&!Di(n)){var S=Hi(n,g),I=Ni?Ni(n)===Object.prototype:n instanceof Object||n.constructor===Object,P=n instanceof Object?"":"null prototype",N=!I&&Ii&&Object(n)===n&&Ii in n?pi.call(qi(n),8,-1):P?"Object":"",M=(I||"function"!=typeof n.constructor?"":n.constructor.name?n.constructor.name+" ":"")+(N||P?"["+_i.call(mi.call([],N||[],P||[]),": ")+"] ":"");return 0===S.length?M+"{}":p?M+"{"+Wi(S,p)+"}":M+"{ "+_i.call(S,", ")+" }"}return String(n)},Qi=Zi("%TypeError%"),Ki=Zi("%WeakMap%",!0),to=Zi("%Map%",!0),eo=Ji("WeakMap.prototype.get",!0),no=Ji("WeakMap.prototype.set",!0),ro=Ji("WeakMap.prototype.has",!0),io=Ji("Map.prototype.get",!0),oo=Ji("Map.prototype.set",!0),ao=Ji("Map.prototype.has",!0),so=function(t,e){for(var n,r=t;null!==(n=r.next);r=n)if(n.key===e)return r.next=n.next,n.next=t.next,t.next=n,n},uo=function(t){return t!=t},lo=function(t,e){return 0===t&&0===e?1/t==1/e:t===e||!(!uo(t)||!uo(e))},co=lo,ho=function(){return"function"==typeof Object.is?Object.is:co},fo=ho,po=Ct,go=Ct,yo=lo,vo=ho,mo=function(){var t=fo();return po(Object,{is:t},{is:function(){return Object.is!==t}}),t},_o=Gt(vo(),Object);go(_o,{getPolyfill:vo,implementation:yo,shim:mo});var bo=_o,xo=I,Eo=function(){return xo()&&!!Symbol.toStringTag},wo=Eo(),ko=Xt("Object.prototype.toString"),So=function(t){return!(wo&&t&&"object"===e(t)&&Symbol.toStringTag in t)&&"[object Arguments]"===ko(t)},Io=function(t){return!!So(t)||null!==t&&"object"===e(t)&&"number"==typeof t.length&&t.length>=0&&"[object Array]"!==ko(t)&&"[object Function]"===ko(t.callee)},Po=function(){return So(arguments)}();So.isLegacyArguments=Io;var No,Mo,Oo=Po?So:Io,Lo={}.toString,Ro=Array.isArray||function(t){return"[object Array]"==Lo.call(t)},Co=Function.prototype.toString,To="object"===("undefined"==typeof Reflect?"undefined":e(Reflect))&&null!==Reflect&&Reflect.apply;if("function"==typeof To&&"function"==typeof Object.defineProperty)try{No=Object.defineProperty({},"length",{get:function(){throw Mo}}),Mo={},To((function(){throw 42}),null,No)}catch(t){t!==Mo&&(To=null)}else To=null;var Ao=/^\s*class\b/,Do=function(t){try{var e=Co.call(t);return Ao.test(e)}catch(t){return!1}},jo=function(t){try{return!Do(t)&&(Co.call(t),!0)}catch(t){return!1}},Fo=Object.prototype.toString,Bo="function"==typeof Symbol&&!!Symbol.toStringTag,qo=!(0 in[,]),Vo=function(){return!1};if("object"===("undefined"==typeof document?"undefined":e(document))){var Go=document.all;Fo.call(Go)===Fo.call(document.all)&&(Vo=function(t){if((qo||!t)&&(void 0===t||"object"===e(t)))try{var n=Fo.call(t);return("[object HTMLAllCollection]"===n||"[object HTML document.all class]"===n||"[object HTMLCollection]"===n||"[object Object]"===n)&&null==t("")}catch(t){}return!1})}var Yo=To?function(t){if(Vo(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!==e(t))return!1;try{To(t,null,No)}catch(t){if(t!==Mo)return!1}return!Do(t)&&jo(t)}:function(t){if(Vo(t))return!0;if(!t)return!1;if("function"!=typeof t&&"object"!==e(t))return!1;if(Bo)return jo(t);if(Do(t))return!1;var n=Fo.call(t);return!("[object Function]"!==n&&"[object GeneratorFunction]"!==n&&!/^\[object HTML/.test(n))&&jo(t)},zo=Yo,Uo=Object.prototype.toString,Xo=Object.prototype.hasOwnProperty,Wo=function(t,e,n){if(!zo(e))throw new TypeError("iterator must be a function");var r;arguments.length>=3&&(r=n),"[object Array]"===Uo.call(t)?function(t,e,n){for(var r=0,i=t.length;r-1?n:"Object"===n&&function(t){var e=!1;return Jo(ua,(function(n,r){if(!e)try{n(t),e=oa(r,1)}catch(t){}})),e}(t)}return ta?function(t){var e=!1;return Jo(ua,(function(n,r){if(!e)try{"$"+n(t)===r&&(e=oa(r,1))}catch(t){}})),e}(t):null},ga=pa,ya=Gt,va=Xt,da=ft,ma=function(t){return!!ga(t)},_a=da("ArrayBuffer",!0),ba=da("Float32Array",!0),xa=va("ArrayBuffer.prototype.byteLength",!0),Ea=_a&&!xa&&(new _a).slice,wa=Ea&&ya(Ea),ka=xa||wa?function(t){if(!t||"object"!==e(t))return!1;try{return xa?xa(t):wa(t,0),!0}catch(t){return!1}}:ba?function(t){try{return new ba(t).buffer===t&&!ma(t)}catch(n){return"object"===e(t)&&"RangeError"===n.name}}:function(t){return!1},Sa=Date.prototype.getDay,Ia=Object.prototype.toString,Pa=Eo(),Na=Xt,Ma=Eo();if(Ma){la=Na("Object.prototype.hasOwnProperty"),ca=Na("RegExp.prototype.exec"),ha={};var Oa=function(){throw ha};fa={toString:Oa,valueOf:Oa},"symbol"===e(Symbol.toPrimitive)&&(fa[Symbol.toPrimitive]=Oa)}var La=Na("Object.prototype.toString"),Ra=Object.getOwnPropertyDescriptor,Ca=Ma?function(t){if(!t||"object"!==e(t))return!1;var n=Ra(t,"lastIndex");if(!(n&&la(n,"value")))return!1;try{ca(t,fa)}catch(t){return t===ha}}:function(t){return!(!t||"object"!==e(t)&&"function"!=typeof t)&&"[object RegExp]"===La(t)},Ta=Xt("SharedArrayBuffer.prototype.byteLength",!0),Aa=Ta?function(t){if(!t||"object"!==e(t))return!1;try{return Ta(t),!0}catch(t){return!1}}:function(t){return!1},Da=String.prototype.valueOf,ja=Object.prototype.toString,Fa=Eo(),Ba=Number.prototype.toString,qa=Object.prototype.toString,Va=Eo(),Ga=Xt,Ya=Ga("Boolean.prototype.toString"),za=Ga("Object.prototype.toString"),Ua=Eo(),Xa={exports:{}},Wa=Object.prototype.toString;if(M()){var Ha=Symbol.prototype.toString,Za=/^Symbol\(.*\)$/;Xa.exports=function(t){if("symbol"===e(t))return!0;if("[object Symbol]"!==Wa.call(t))return!1;try{return function(t){return"symbol"===e(t.valueOf())&&Za.test(Ha.call(t))}(t)}catch(t){return!1}}}else Xa.exports=function(t){return!1};var Ja=Xa.exports,$a={exports:{}},Qa="undefined"!=typeof BigInt&&BigInt;if("function"==typeof Qa&&"function"==typeof BigInt&&"bigint"==typeof Qa(42)&&"bigint"==typeof BigInt(42)){var Ka=BigInt.prototype.valueOf;$a.exports=function(t){return null!=t&&"boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t&&"symbol"!==e(t)&&"function"!=typeof t&&("bigint"==typeof t||function(t){try{return Ka.call(t),!0}catch(t){}return!1}(t))}}else $a.exports=function(t){return!1};var ts,es=$a.exports,ns=function(t){return"string"==typeof t||"object"===e(t)&&(Fa?function(t){try{return Da.call(t),!0}catch(t){return!1}}(t):"[object String]"===ja.call(t))},rs=function(t){return"number"==typeof t||"object"===e(t)&&(Va?function(t){try{return Ba.call(t),!0}catch(t){return!1}}(t):"[object Number]"===qa.call(t))},is=function(t){return"boolean"==typeof t||null!==t&&"object"===e(t)&&(Ua&&Symbol.toStringTag in t?function(t){try{return Ya(t),!0}catch(t){return!1}}(t):"[object Boolean]"===za(t))},os=Ja,as=es,ss="function"==typeof Map&&Map.prototype?Map:null,us="function"==typeof Set&&Set.prototype?Set:null;ss||(ts=function(t){return!1});var ls=ss?Map.prototype.has:null,cs=us?Set.prototype.has:null;ts||ls||(ts=function(t){return!1});var hs,fs=ts||function(t){if(!t||"object"!==e(t))return!1;try{if(ls.call(t),cs)try{cs.call(t)}catch(t){return!0}return t instanceof ss}catch(t){}return!1},ps="function"==typeof Map&&Map.prototype?Map:null,gs="function"==typeof Set&&Set.prototype?Set:null;gs||(hs=function(t){return!1});var ys=ps?Map.prototype.has:null,vs=gs?Set.prototype.has:null;hs||vs||(hs=function(t){return!1});var ds,ms=hs||function(t){if(!t||"object"!==e(t))return!1;try{if(vs.call(t),ys)try{ys.call(t)}catch(t){return!0}return t instanceof gs}catch(t){}return!1},_s="function"==typeof WeakMap&&WeakMap.prototype?WeakMap:null,bs="function"==typeof WeakSet&&WeakSet.prototype?WeakSet:null;_s||(ds=function(t){return!1});var xs=_s?_s.prototype.has:null,Es=bs?bs.prototype.has:null;ds||xs||(ds=function(t){return!1});var ws=ds||function(t){if(!t||"object"!==e(t))return!1;try{if(xs.call(t,xs),Es)try{Es.call(t,Es)}catch(t){return!0}return t instanceof _s}catch(t){}return!1},ks={exports:{}},Ss=Xt,Is=ft("%WeakSet%",!0),Ps=Ss("WeakSet.prototype.has",!0);if(Ps){var Ns=Ss("WeakMap.prototype.has",!0);ks.exports=function(t){if(!t||"object"!==e(t))return!1;try{if(Ps(t,Ps),Ns)try{Ns(t,Ns)}catch(t){return!0}return t instanceof Is}catch(t){}return!1}}else ks.exports=function(t){return!1};var Ms=ks.exports,Os=fs,Ls=ms,Rs=ws,Cs=Ms,Ts=Xt("ArrayBuffer.prototype.byteLength",!0),As=ka,Ds=he,js=Xt,Fs=qe,Bs=ft,qs=function(t){if(null!=t&&void 0!==t[Ve])return t[Ve]()},Vs=function(){var t,n,r,i={assert:function(t){if(!i.has(t))throw new Qi("Side channel does not contain "+$i(t))},get:function(i){if(Ki&&i&&("object"===e(i)||"function"==typeof i)){if(t)return eo(t,i)}else if(to){if(n)return io(n,i)}else if(r)return function(t,e){var n=so(t,e);return n&&n.value}(r,i)},has:function(i){if(Ki&&i&&("object"===e(i)||"function"==typeof i)){if(t)return ro(t,i)}else if(to){if(n)return ao(n,i)}else if(r)return function(t,e){return!!so(t,e)}(r,i);return!1},set:function(i,o){Ki&&i&&("object"===e(i)||"function"==typeof i)?(t||(t=new Ki),no(t,i,o)):to?(n||(n=new to),oo(n,i,o)):(r||(r={key:{},next:null}),function(t,e,n){var r=so(t,e);r?r.value=n:t.next={key:e,next:t.next,value:n}}(r,i,o))}};return i},Gs=bo,Ys=Oo,zs=Ro,Us=ka,Xs=function(t){return"object"===e(t)&&null!==t&&(Pa?function(t){try{return Sa.call(t),!0}catch(t){return!1}}(t):"[object Date]"===Ia.call(t))},Ws=Ca,Hs=Aa,Zs=S,Js=function(t){return null==t||"object"!==e(t)&&"function"!=typeof t?null:ns(t)?"String":rs(t)?"Number":is(t)?"Boolean":os(t)?"Symbol":as(t)?"BigInt":void 0},$s=function(t){if(t&&"object"===e(t)){if(Os(t))return"Map";if(Ls(t))return"Set";if(Rs(t))return"WeakMap";if(Cs(t))return"WeakSet"}return!1},Qs=pa,Ks=function(t){return As(t)?Ts?Ts(t):t.byteLength:NaN},tu=js("SharedArrayBuffer.prototype.byteLength",!0),eu=js("Date.prototype.getTime"),nu=Object.getPrototypeOf,ru=js("Object.prototype.toString"),iu=Bs("%Set%",!0),ou=js("Map.prototype.has",!0),au=js("Map.prototype.get",!0),su=js("Map.prototype.size",!0),uu=js("Set.prototype.add",!0),lu=js("Set.prototype.delete",!0),cu=js("Set.prototype.has",!0),hu=js("Set.prototype.size",!0);function fu(t,e,n,r){for(var i,o=qs(t);(i=o.next())&&!i.done;)if(du(e,i.value,n,r))return lu(t,i.value),!0;return!1}function pu(t){return void 0===t?null:"object"!==e(t)?"symbol"!==e(t)&&("string"!=typeof t&&"number"!=typeof t||+t==+t):void 0}function gu(t,e,n,r,i,o){var a=pu(n);if(null!=a)return a;var s=au(e,a),u=Ds({},i,{strict:!1});return!(void 0===s&&!ou(e,a)||!du(r,s,u,o))&&(!ou(t,a)&&du(r,s,u,o))}function yu(t,e,n){var r=pu(n);return null!=r?r:cu(e,r)&&!cu(t,r)}function vu(t,e,n,r,i,o){for(var a,s,u=qs(t);(a=u.next())&&!a.done;)if(du(n,s=a.value,i,o)&&du(r,au(e,s),i,o))return lu(t,s),!0;return!1}function du(t,n,r,i){var o=r||{};if(o.strict?Gs(t,n):t===n)return!0;if(Js(t)!==Js(n))return!1;if(!t||!n||"object"!==e(t)&&"object"!==e(n))return o.strict?Gs(t,n):t==n;var a,s=i.has(t),u=i.has(n);if(s&&u){if(i.get(t)===i.get(n))return!0}else a={};return s||i.set(t,a),u||i.set(n,a),function(t,n,r,i){var o,a;if(e(t)!==e(n))return!1;if(null==t||null==n)return!1;if(ru(t)!==ru(n))return!1;if(Ys(t)!==Ys(n))return!1;var s=zs(t),u=zs(n);if(s!==u)return!1;var l=t instanceof Error,c=n instanceof Error;if(l!==c)return!1;if((l||c)&&(t.name!==n.name||t.message!==n.message))return!1;var h=Ws(t),f=Ws(n);if(h!==f)return!1;if((h||f)&&(t.source!==n.source||Fs(t)!==Fs(n)))return!1;var p=Xs(t),g=Xs(n);if(p!==g)return!1;if((p||g)&&eu(t)!==eu(n))return!1;if(r.strict&&nu&&nu(t)!==nu(n))return!1;var y=Qs(t),v=Qs(n);if(y!==v)return!1;if(y||v){if(t.length!==n.length)return!1;for(o=0;o=0;o--)if(w[o]!=k[o])return!1;for(o=w.length-1;o>=0;o--)if(!du(t[a=w[o]],n[a],r,i))return!1;var S=$s(t),I=$s(n);if(S!==I)return!1;if("Set"===S||"Set"===I)return function(t,n,r,i){if(hu(t)!==hu(n))return!1;var o,a,s,u=qs(t),l=qs(n);for(;(o=u.next())&&!o.done;)if(o.value&&"object"===e(o.value))s||(s=new iu),uu(s,o.value);else if(!cu(n,o.value)){if(r.strict)return!1;if(!yu(t,n,o.value))return!1;s||(s=new iu),uu(s,o.value)}if(s){for(;(a=l.next())&&!a.done;)if(a.value&&"object"===e(a.value)){if(!fu(s,a.value,r.strict,i))return!1}else if(!r.strict&&!cu(t,a.value)&&!fu(s,a.value,r.strict,i))return!1;return 0===hu(s)}return!0}(t,n,r,i);if("Map"===S)return function(t,n,r,i){if(su(t)!==su(n))return!1;var o,a,s,u,l,c,h=qs(t),f=qs(n);for(;(o=h.next())&&!o.done;)if(u=o.value[0],l=o.value[1],u&&"object"===e(u))s||(s=new iu),uu(s,u);else if(void 0===(c=au(n,u))&&!ou(n,u)||!du(l,c,r,i)){if(r.strict)return!1;if(!gu(t,n,u,l,r,i))return!1;s||(s=new iu),uu(s,u)}if(s){for(;(a=f.next())&&!a.done;)if(u=a.value[0],c=a.value[1],u&&"object"===e(u)){if(!vu(s,t,u,c,r,i))return!1}else if(!(r.strict||t.has(u)&&du(au(t,u),c,r,i)||vu(s,t,u,c,Ds({},r,{strict:!1}),i)))return!1;return 0===hu(s)}return!0}(t,n,r,i);return!0}(t,n,o,i)}function mu(t){return!(!t||"object"!==e(t)||"number"!=typeof t.length)&&("function"==typeof t.copy&&"function"==typeof t.slice&&(!(t.length>0&&"number"!=typeof t[0])&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))))}var _u=p((function(t,e,n){return du(t,e,n,Vs())})),bu=Object.defineProperty,xu=function(t,e){return bu(t,"name",{value:e,configurable:!0})},Eu=function(){function t(e){var r,i,o;n(this,t),this.direction=!1,this.compareProperties=!0,this.precision=Math.pow(10,-(null!=(r=null==e?void 0:e.precision)?r:17)),this.direction=null!=(i=null==e?void 0:e.direction)&&i,this.compareProperties=null==(o=null==e?void 0:e.compareProperties)||o}return i(t,[{key:"compare",value:function(t,e){var n=this;if(t.type!==e.type)return!1;if(!ku(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates);case"Polygon":return this.comparePolygon(t,e);case"GeometryCollection":return this.compareGeometryCollection(t,e);case"Feature":return this.compareFeature(t,e);case"FeatureCollection":return this.compareFeatureCollection(t,e);default:if(t.type.startsWith("Multi")){var r=Su(t),i=Su(e);return r.every((function(t){return i.some((function(e){return n.compare(t,e)}))}))}}return!1}},{key:"compareCoord",value:function(t,e){var n=this;return t.length===e.length&&t.every((function(t,r){return Math.abs(t-e[r])2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!ku(t,e))return!1;var i=t,o=e;if(r&&!this.compareCoord(i[0],o[0])){var a=this.fixStartIndex(o,i);if(!a)return!1;o=a}var s=this.compareCoord(i[n],o[n]);return this.direction||s?this.comparePath(i,o):!!this.compareCoord(i[n],o[o.length-(1+n)])&&this.comparePath(i.slice().reverse(),o)}},{key:"fixStartIndex",value:function(t,e){for(var n,r=-1,i=0;i=0&&(n=[].concat(t.slice(r,t.length),t.slice(1,r+1))),n}},{key:"comparePath",value:function(t,e){var n=this;return t.every((function(t,r){return n.compareCoord(t,e[r])}))}},{key:"comparePolygon",value:function(t,e){var n=this;if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){var r=t.coordinates.slice(1,t.coordinates.length),i=e.coordinates.slice(1,e.coordinates.length);return r.every((function(t){return i.some((function(e){return n.compareLine(t,e,1,!0)}))}))}return!1}},{key:"compareGeometryCollection",value:function(t,e){var n=this;return ku(t.geometries,e.geometries)&&this.compareBBox(t,e)&&t.geometries.every((function(t,r){return n.compare(t,e.geometries[r])}))}},{key:"compareFeature",value:function(t,e){return t.id===e.id&&(!this.compareProperties||_u(t.properties,e.properties))&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}},{key:"compareFeatureCollection",value:function(t,e){var n=this;return ku(t.features,e.features)&&this.compareBBox(t,e)&&t.features.every((function(t,r){return n.compare(t,e.features[r])}))}},{key:"compareBBox",value:function(t,e){return Boolean(!t.bbox&&!e.bbox)||!(!t.bbox||!e.bbox)&&this.compareCoord(t.bbox,e.bbox)}}]),t}();xu(Eu,"GeojsonEquality");var wu=Eu;function ku(t,e){return t.coordinates?t.coordinates.length===e.coordinates.length:t.length===e.length}function Su(t){return t.coordinates.map((function(e){return{type:t.type.replace("Multi",""),coordinates:e}}))}xu(ku,"sameLength"),xu(Su,"explode");var Iu=6371008.8,Pu={centimeters:100*Iu,centimetres:100*Iu,degrees:360/(2*Math.PI),feet:3.28084*Iu,inches:39.37*Iu,kilometers:Iu/1e3,kilometres:Iu/1e3,meters:Iu,metres:Iu,miles:Iu/1609.344,millimeters:1e3*Iu,millimetres:1e3*Iu,nauticalmiles:Iu/1852,radians:1,yards:1.0936*Iu},Nu={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:2.9155334959812285e-7,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Mu(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function Ou(t,e){switch(t){case"Point":return Lu(e).geometry;case"LineString":return Au(e).geometry;case"Polygon":return Cu(e).geometry;case"MultiPoint":return Bu(e).geometry;case"MultiLineString":return Fu(e).geometry;case"MultiPolygon":return qu(e).geometry;default:throw new Error(t+" is invalid")}}function Lu(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!$u(t[0])||!$u(t[1]))throw new Error("coordinates must contain numbers");return Mu({type:"Point",coordinates:t},e,n)}function Ru(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ju(t.map((function(t){return Lu(t,e)})),n)}function Cu(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=c(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(var a=0;a2&&void 0!==arguments[2]?arguments[2]:{};return ju(t.map((function(t){return Cu(t,e)})),n)}function Au(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t.length<2)throw new Error("coordinates must be an array of two or more positions");return Mu({type:"LineString",coordinates:t},e,n)}function Du(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return ju(t.map((function(t){return Au(t,e)})),n)}function ju(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function Fu(t,e){return Mu({type:"MultiLineString",coordinates:t},e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}function Bu(t,e){return Mu({type:"MultiPoint",coordinates:t},e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}function qu(t,e){return Mu({type:"MultiPolygon",coordinates:t},e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}function Vu(t,e){return Mu({type:"GeometryCollection",geometries:t},e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})}function Gu(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function Yu(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=Pu[e];if(!n)throw new Error(e+" units is invalid");return t*n}function zu(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=Pu[e];if(!n)throw new Error(e+" units is invalid");return t/n}function Uu(t,e){return Wu(zu(t,e))}function Xu(t){var e=t%360;return e<0&&(e+=360),e}function Wu(t){return 180*(t%(2*Math.PI))/Math.PI}function Hu(t){return t%360*Math.PI/180}function Zu(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"kilometers";if(!(t>=0))throw new Error("length must be a positive number");return Yu(zu(t,e),n)}function Ju(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"meters",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"kilometers";if(!(t>=0))throw new Error("area must be a positive number");var r=Nu[e];if(!r)throw new Error("invalid original units");var i=Nu[n];if(!i)throw new Error("invalid final units");return t/r*i}function $u(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function Qu(t){return null!==t&&"object"===e(t)&&!Array.isArray(t)}function Ku(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!$u(t))throw new Error("bbox must only contain numbers")}))}function tl(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(e(t)))throw new Error("id must be a number or a string")}xu(Mu,"feature"),xu(Ou,"geometry"),xu(Lu,"point"),xu(Ru,"points"),xu(Cu,"polygon"),xu(Tu,"polygons"),xu(Au,"lineString"),xu(Du,"lineStrings"),xu(ju,"featureCollection"),xu(Fu,"multiLineString"),xu(Bu,"multiPoint"),xu(qu,"multiPolygon"),xu(Vu,"geometryCollection"),xu(Gu,"round"),xu(Yu,"radiansToLength"),xu(zu,"lengthToRadians"),xu(Uu,"lengthToDegrees"),xu(Xu,"bearingToAzimuth"),xu(Wu,"radiansToDegrees"),xu(Hu,"degreesToRadians"),xu(Zu,"convertLength"),xu(Ju,"convertArea"),xu($u,"isNumber"),xu(Qu,"isObject"),xu(Ku,"validateBBox"),xu(tl,"validateId");var el=Object.freeze({__proto__:null,GeojsonEquality:wu,areaFactors:Nu,bearingToAzimuth:Xu,convertArea:Ju,convertLength:Zu,degreesToRadians:Hu,earthRadius:Iu,factors:Pu,feature:Mu,featureCollection:ju,geometry:Ou,geometryCollection:Vu,isNumber:$u,isObject:Qu,lengthToDegrees:Uu,lengthToRadians:zu,lineString:Au,lineStrings:Du,multiLineString:Fu,multiPoint:Bu,multiPolygon:qu,point:Lu,points:Ru,polygon:Cu,polygons:Tu,radiansToDegrees:Wu,radiansToLength:Yu,round:Gu,validateBBox:Ku,validateId:tl}),nl=Object.defineProperty,rl=function(t,e){return nl(t,"name",{value:e,configurable:!0})};function il(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return s(t.geometry.coordinates);if("Point"===t.type)return s(t.coordinates)}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return s(t);throw new Error("coord must be GeoJSON Point or an Array of numbers")}function ol(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function al(t){if(t.length>1&&$u(t[0])&&$u(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return al(t[0]);throw new Error("coordinates must only contain numbers")}function sl(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function ul(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function ll(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");var r,i=c(t.features);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}catch(t){i.e(t)}finally{i.f()}}function cl(t){return"Feature"===t.type?t.geometry:t}function hl(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}rl(il,"getCoord"),rl(ol,"getCoords"),rl(al,"containsNumber"),rl(sl,"geojsonType"),rl(ul,"featureOf"),rl(ll,"collectionOf"),rl(cl,"getGeom"),rl(hl,"getType");var fl=Object.freeze({__proto__:null,collectionOf:ll,containsNumber:al,featureOf:ul,geojsonType:sl,getCoord:il,getCoords:ol,getGeom:cl,getType:hl}),pl=Object.defineProperty,gl=function(t,e){return pl(t,"name",{value:e,configurable:!0})};function yl(t,e){if(!0===(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).final)return vl(t,e);var n=il(t),r=il(e),i=Hu(n[0]),o=Hu(r[0]),a=Hu(n[1]),s=Hu(r[1]),u=Math.sin(o-i)*Math.cos(s),l=Math.cos(a)*Math.sin(s)-Math.sin(a)*Math.cos(s)*Math.cos(o-i);return Wu(Math.atan2(u,l))}function vl(t,e){var n=yl(e,t);return n=(n+180)%360}gl(yl,"bearing"),gl(vl,"calculateFinalBearing");function dl(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=il(t),o=Hu(i[0]),a=Hu(i[1]),s=Hu(n),u=zu(e,r.units),l=Math.asin(Math.sin(a)*Math.cos(u)+Math.cos(a)*Math.sin(u)*Math.cos(s));return Lu([Wu(o+Math.atan2(Math.sin(s)*Math.sin(u)*Math.cos(a),Math.cos(u)-Math.sin(a)*Math.sin(l))),Wu(l)],r.properties)}(0,Object.defineProperty)(dl,"name",{value:"destination",configurable:!0});var ml=Object.defineProperty;function _l(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=il(t),i=il(e),o=Hu(i[1]-r[1]),a=Hu(i[0]-r[0]),s=Hu(r[1]),u=Hu(i[1]),l=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(u);return Yu(2*Math.atan2(Math.sqrt(l),Math.sqrt(1-l)),n.units)}!function(t,e){ml(t,"name",{value:e,configurable:!0})}(_l,"distance");var bl=Object.defineProperty;function xl(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=cl(t).coordinates,i=0,o=0;o=i&&o===r.length-1);o++){if(i>=e){var a=e-i;if(a){var s=yl(r[o],r[o-1])-180;return dl(r[o],a,s,n)}return Lu(r[o])}i+=_l(r[o],r[o+1],n)}return Lu(r[r.length-1])}!function(t,e){bl(t,"name",{value:e,configurable:!0})}(xl,"along");var El=Object.defineProperty,wl=function(t,e){return El(t,"name",{value:e,configurable:!0})};function kl(t,e){var n;return(n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).final?Sl(il(e),il(t)):Sl(il(t),il(e)))>180?-(360-n):n}function Sl(t,e){var n=Hu(t[1]),r=Hu(e[1]),i=Hu(e[0]-t[0]);i>Math.PI&&(i-=2*Math.PI),i<-Math.PI&&(i+=2*Math.PI);var o=Math.log(Math.tan(r/2+Math.PI/4)/Math.tan(n/2+Math.PI/4));return(Wu(Math.atan2(i,o))+360)%360}wl(kl,"rhumbBearing"),wl(Sl,"calculateRhumbBearing");var Il=Object.defineProperty;function Pl(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!Qu(r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!n)throw new Error("endPoint is required");var i=t,o=e,a=n,s=Xu(!0!==r.mercator?yl(i,o):kl(i,o)),u=Xu(!0!==r.mercator?yl(a,o):kl(a,o)),l=Math.abs(s-u);return!0===r.explementary?360-l:l}!function(t,e){Il(t,"name",{value:e,configurable:!0})}(Pl,"angle");var Nl=Object.defineProperty,Ml=function(t,e){return Nl(t,"name",{value:e,configurable:!0})};function Ol(t,e,n){if(null!==t)for(var r,i,o,a,s,u,l,c,h=0,f=0,p=t.type,g="FeatureCollection"===p,y="Feature"===p,v=g?t.features.length:1,d=0;ds||f>u||p>l)return a=o,s=n,u=f,l=p,void(i=0);var g=Au([a,o],t.properties);if(!1===e(g,n,r,p,i))return!1;i++,a=o}))&&void 0}}}))}function Gl(t,e,n){var r=n,i=!1;return Vl(t,(function(t,o,a,s,u){r=!1===i&&void 0===n?t:e(r,t,o,a,s,u),i=!0})),r}function Yl(t,e){if(!t)throw new Error("geojson is required");Bl(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var a=0;a0){e+=Math.abs(ec(t[0]));for(var n=1;n=e?(r+2)%e:r+2],s=i[0]*tc,u=o[1]*tc;n+=(a[0]*tc-s)*Math.sin(u),r++}return n*Kl}Zl(ec,"ringArea");var nc=Object.defineProperty;function rc(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=t.bbox&&!0!==e.recompute)return t.bbox;var n=[1/0,1/0,-1/0,-1/0];return Ol(t,(function(t){n[0]>t[0]&&(n[0]=t[0]),n[1]>t[1]&&(n[1]=t[1]),n[2]e[2]&&(n|=2),t[1]e[3]&&(n|=8),n}function cc(t,e){var n=cl(t),r=n.type,i="Feature"===t.type?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":var a=[];return"LineString"===r&&(o=[o]),o.forEach((function(t){ac(t,e,a)})),1===a.length?Au(a[0],i):Fu(a,i);case"Polygon":return Cu(hc(o,e),i);case"MultiPolygon":return qu(o.map((function(t){return hc(t,e)})),i);default:throw new Error("geometry "+r+" not supported")}}function hc(t,e){var n,r=[],i=c(t);try{for(i.s();!(n=i.n()).done;){var o=sc(n.value,e);o.length>0&&(o[0][0]===o[o.length-1][0]&&o[0][1]===o[o.length-1][1]||o.push(o[0]),o.length>=4&&r.push(o))}}catch(t){i.e(t)}finally{i.f()}return r}oc(ac,"lineclip"),oc(sc,"polygonclip"),oc(uc,"intersect"),oc(lc,"bitCode"),oc(cc,"bboxClip"),oc(hc,"clipPolygon");var fc=Object.defineProperty;function pc(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var a=[n,r];return Cu([[a,[i,r],[i,o],[n,o],a]],e.properties,{bbox:t,id:e.id})}!function(t,e){fc(t,"name",{value:e,configurable:!0})}(pc,"bboxPolygon");var gc=Object.defineProperty,yc=function(t,e){return gc(t,"name",{value:e,configurable:!0})},vc=function(){function t(e){n(this,t),this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var r=0;rt&&(e.push(r),n=i)}return e}},{key:"vector",value:function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}}},{key:"pos",value:function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var n=e/this.duration;if(n>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*n);return mc((this.length-1)*n-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])}}]),t}();yc(vc,"Spline");var dc=vc;function mc(t,e,n,r,i){var o=_c(t);return{x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]}}function _c(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}function bc(t){for(var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.resolution||1e4,r=e.sharpness||.85,i=[],o=cl(t).coordinates.map((function(t){return{x:t[0],y:t[1]}})),a=new dc({duration:n,points:o,sharpness:r}),s=yc((function(t){var e=a.pos(t);Math.floor(t/100)%2==0&&i.push([e.x,e.y])}),"pushCoord"),u=0;u0}!function(t,e){xc(t,"name",{value:e,configurable:!0})}(Ec,"booleanClockwise");var wc=Object.defineProperty;function kc(t){var e=cl(t).coordinates;if(e[0].length<=4)return!1;for(var n=!1,r=e[0].length-1,i=0;i0;else if(n!==u>0)return!0}return!1}function Sc(t,e){for(var n=0,r=0,i=0,o=0,a=0,s=0,u=0,l=0,c=null,h=null,f=t[0],p=t[1],g=e.length;n0&&l>0)s=l,a=(c=h)[0]-f;else{if(u=h[0]-t[0],l>0&&s<=0){if((o=a*l-u*s)>0)i+=1;else if(0===o)return 0}else if(s>0&&l<=0){if((o=a*l-u*s)<0)i+=1;else if(0===o)return 0}else if(0===l&&s<0){if(0===(o=a*l-u*s))return 0}else if(0===s&&l<0){if(0===(o=a*l-u*s))return 0}else if(0===s&&0===l){if(u<=0&&a>=0)return 0;if(a<=0&&u>=0)return 0}c=h,s=l,a=u}}return i%2!=0}!function(t,e){wc(t,"name",{value:e,configurable:!0})}(kc,"booleanConcave");var Ic=Object.defineProperty,Pc=function(t,e){return Ic(t,"name",{value:e,configurable:!0})};function Nc(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=il(t),i=cl(e),o=i.type,a=e.bbox,s=i.coordinates;if(a&&!1===Mc(r,a))return!1;"Polygon"===o&&(s=[s]);for(var u=!1,l=0;l=t[0]&&e[3]>=t[1]}Pc(Nc,"booleanPointInPolygon"),Pc(Mc,"inBBox");var Oc=Object.defineProperty,Lc=function(t,e){return Oc(t,"name",{value:e,configurable:!0})};function Rc(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=il(t),i=ol(e),o=0;oi)return!1}else if(0!==p)return!1;return r?"start"===r?Math.abs(h)>=Math.abs(f)?h>0?s0?u=Math.abs(f)?h>0?s<=o&&o0?u<=a&&a=Math.abs(f)?h>0?s0?u=Math.abs(f)?h>0?s<=o&&o<=l:l<=o&&o<=s:f>0?u<=a&&a<=c:c<=a&&a<=u}Lc(Rc,"booleanPointOnLine"),Lc(Cc,"isPointOnLineSegment");var Tc=Object.defineProperty,Ac=function(t,e){return Tc(t,"name",{value:e,configurable:!0})};function Dc(t,e){var n=cl(t),r=cl(e),i=n.type,o=r.type,a=n.coordinates,s=r.coordinates;switch(i){case"Point":if("Point"===o)return Xc(a,s);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return Fc(n,r);case"MultiPoint":return Bc(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return Rc(r,n,{ignoreEndVertices:!0});case"LineString":return Gc(n,r);case"MultiPoint":return qc(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Nc(r,n,{ignoreBoundary:!0});case"LineString":return Yc(n,r);case"Polygon":return zc(n,r);case"MultiPoint":return Vc(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPolygon":if("Polygon"===o)return jc(n,r);throw new Error("feature2 "+o+" geometry not supported");default:throw new Error("feature1 "+i+" geometry not supported")}}function jc(t,e){return t.coordinates.some((function(t){return zc({type:"Polygon",coordinates:t},e)}))}function Fc(t,e){var n,r=!1;for(n=0;ne[0])&&(!(t[2]e[1])&&!(t[3]0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zc;if(n(this,t),this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}return i(t,[{key:"push",value:function(t){this.data.push(t),this.length++,this._up(this.length-1)}},{key:"pop",value:function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}},{key:"_down",value:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t=0)break;e[t]=a,t=o}e[t]=i}}]),t}();function Zc(t,e){return te?1:0}function Jc(t,e){return t.p.x>e.p.x?1:t.p.xe.p.y?1:-1:1}function $c(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x0?(c.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,c.isLeftEndpoint=!1),e.push(l),e.push(c),a=s,eh+=1}}Kc+=1}var rh=i((function t(e){n(this,t),this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}));function ih(t,e){if(null===t||null===e)return!1;if(t.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.rightSweepEvent)||t.leftSweepEvent.isSamePoint(e.leftSweepEvent)||t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;var n=t.leftSweepEvent.p.x,r=t.leftSweepEvent.p.y,i=t.rightSweepEvent.p.x,o=t.rightSweepEvent.p.y,a=e.leftSweepEvent.p.x,s=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,l=e.rightSweepEvent.p.y,c=(l-s)*(i-n)-(u-a)*(o-r),h=(u-a)*(r-s)-(l-s)*(n-a),f=(i-n)*(r-s)-(o-r)*(n-a);if(0===c)return!1;var p=h/c,g=f/c;return p>=0&&p<=1&&g>=0&&g<=1&&[n+p*(i-n),r+p*(o-r)]}function oh(t,e){var n=new Hc([],Jc);return function(t,e){if("FeatureCollection"===t.type)for(var n=t.features,r=0;r2&&void 0!==arguments[2]?arguments[2]:{},r=n.removeDuplicates,i=void 0===r||r,o=n.ignoreSelfIntersections,a=void 0!==o&&o,s=[];"FeatureCollection"===t.type?s=s.concat(t.features):"Feature"===t.type?s.push(t):"LineString"!==t.type&&"Polygon"!==t.type&&"MultiLineString"!==t.type&&"MultiPolygon"!==t.type||s.push(Mu(t)),"FeatureCollection"===e.type?s=s.concat(e.features):"Feature"===e.type?s.push(e):"LineString"!==e.type&&"Polygon"!==e.type&&"MultiLineString"!==e.type&&"MultiPolygon"!==e.type||s.push(Mu(e));var u=sh(ju(s),a),l=[];if(i){var c={};u.forEach((function(t){var e=t.join(",");c[e]||(c[e]=!0,l.push(t))}))}else l=u;return ju(l.map((function(t){return Lu(t)})))}!function(t,e){ah(t,"name",{value:e,configurable:!0})}(uh,"lineIntersect");var lh=Object.defineProperty,ch=function(t,e){return lh(t,"name",{value:e,configurable:!0})};function hh(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=cl(t);switch(e.properties||"Feature"!==t.type||(e.properties=t.properties),n.type){case"Polygon":return fh(n,e);case"MultiPolygon":return ph(n,e);default:throw new Error("invalid poly")}}function fh(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return gh(cl(t).coordinates,e.properties?e.properties:"Feature"===t.type?t.properties:{})}function ph(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=cl(t).coordinates,r=e.properties?e.properties:"Feature"===t.type?t.properties:{},i=[];return n.forEach((function(t){i.push(gh(t,r))})),ju(i)}function gh(t,e){return t.length>1?Fu(t,e):Au(t[0],e)}ch(hh,"polygonToLine"),ch(fh,"singlePolygonToLine"),ch(ph,"multiPolygonToLine"),ch(gh,"coordsToLine");var yh=Object.defineProperty,vh=function(t,e){return yh(t,"name",{value:e,configurable:!0})};function dh(t,e){var n=cl(t),r=cl(e),i=n.type,o=r.type;switch(i){case"MultiPoint":switch(o){case"LineString":return mh(n,r);case"Polygon":return xh(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return mh(r,n);case"LineString":return _h(n,r);case"Polygon":return bh(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return xh(r,n);case"LineString":return bh(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function mh(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o0)for(var n=0;n0}function xh(t,e){for(var n=!1,r=!1,i=t.coordinates.length,o=0;o=Math.abs(s)?a>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:s>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1]:Math.abs(a)>=Math.abs(s)?a>0?t[0]0?t[1]0}function Mh(t,e){var n,r=c(e.coordinates);try{for(r.s();!(n=r.n()).done;){if(Nc(n.value,t))return!0}}catch(t){r.e(t)}finally{r.f()}return uh(e,hh(t)).features.length>0}function Oh(t,e){var n,r=c(t.coordinates[0]);try{for(r.s();!(n=r.n()).done;){if(Nc(n.value,e))return!0}}catch(t){r.e(t)}finally{r.f()}var i,o=c(e.coordinates[0]);try{for(o.s();!(i=o.n()).done;){if(Nc(i.value,t))return!0}}catch(t){o.e(t)}finally{o.f()}return uh(hh(t),hh(e)).features.length>0}function Lh(t,e,n){var r=n[0]-t[0],i=n[1]-t[1],o=e[0]-t[0],a=e[1]-t[1];return 0==r*a-i*o&&(Math.abs(o)>=Math.abs(a)?o>0?t[0]<=n[0]&&n[0]<=e[0]:e[0]<=n[0]&&n[0]<=t[0]:a>0?t[1]<=n[1]&&n[1]<=e[1]:e[1]<=n[1]&&n[1]<=t[1])}function Rh(t,e){return t[0]===e[0]&&t[1]===e[1]}kh(Sh,"booleanDisjoint"),kh(Ih,"disjoint"),kh(Ph,"isPointOnLine"),kh(Nh,"isLineOnLine"),kh(Mh,"isLineInPoly"),kh(Oh,"isPolyInPoly"),kh(Lh,"isPointOnLineSegment"),kh(Rh,"compareCoords");var Ch=Object.defineProperty,Th=function(t,e){return Ch(t,"name",{value:e,configurable:!0})};function Ah(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="object"===e(n)?n.mutate:n;if(!t)throw new Error("geojson is required");var i=hl(t),o=[];switch(i){case"LineString":o=Dh(t,i);break;case"MultiLineString":case"Polygon":ol(t).forEach((function(t){o.push(Dh(t,i))}));break;case"MultiPolygon":ol(t).forEach((function(t){var e=[];t.forEach((function(t){e.push(Dh(t,i))})),o.push(e)}));break;case"Point":return t;case"MultiPoint":var a={};ol(t).forEach((function(t){var e=t.join("-");Object.prototype.hasOwnProperty.call(a,e)||(o.push(t),a[e]=!0)}));break;default:throw new Error(i+" geometry not supported")}return t.coordinates?!0===r?(t.coordinates=o,t):{type:i,coordinates:o}:!0===r?(t.geometry.coordinates=o,t):Mu({type:i,coordinates:o},t.properties,{bbox:t.bbox,id:t.id})}function Dh(t,e){var n=ol(t);if(2===n.length&&!jh(n[0],n[1]))return n;var r=[],i=n.length-1,o=r.length;r.push(n[0]);for(var a=1;a2&&Fh(r[o-3],r[o-1],r[o-2])&&r.splice(r.length-2,1))}if(r.push(n[n.length-1]),o=r.length,("Polygon"===e||"MultiPolygon"===e)&&jh(n[0],n[n.length-1])&&o<4)throw new Error("invalid polygon");return"LineString"===e&&o<3||Fh(r[o-3],r[o-1],r[o-2])&&r.splice(r.length-2,1),r}function jh(t,e){return t[0]===e[0]&&t[1]===e[1]}function Fh(t,e,n){var r=n[0],i=n[1],o=t[0],a=t[1],s=e[0],u=e[1],l=s-o,c=u-a;return 0===(r-o)*c-(i-a)*l&&(Math.abs(l)>=Math.abs(c)?l>0?o<=r&&r<=s:s<=r&&r<=o:c>0?a<=i&&i<=u:u<=i&&i<=a)}Th(Ah,"cleanCoords"),Th(Dh,"cleanLine"),Th(jh,"equals"),Th(Fh,"isPointOnLineSegment");var Bh=Object.defineProperty;function qh(t,e){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).precision;if("number"!=typeof(n=null==n||isNaN(n)?6:n)||!(n>=0))throw new Error("precision must be a positive number");return cl(t).type===cl(e).type&&new wu({precision:n}).compare(Ah(t),Ah(e))}!function(t,e){Bh(t,"name",{value:e,configurable:!0})}(qh,"booleanEqual");var Vh=Object.defineProperty;function Gh(t,e){var n=!1;return Bl(t,(function(t){Bl(e,(function(e){if(!0===n)return!0;n=!Sh(t.geometry,e.geometry)}))})),n}function Yh(t,e,n,r,i){zh(t,e,n||0,r||t.length-1,i||Xh)}function zh(t,e,n,r,i){for(;r>n;){if(r-n>600){var o=r-n+1,a=e-n+1,s=Math.log(o),u=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*u*(o-u)/o)*(a-o/2<0?-1:1);zh(t,e,Math.max(n,Math.floor(e-a*u/o+l)),Math.min(r,Math.floor(e+(o-a)*u/o+l)),i)}var c=t[e],h=n,f=r;for(Uh(t,n,e),i(t[r],c)>0&&Uh(t,n,r);h0;)f--}0===i(t[n],c)?Uh(t,n,f):Uh(t,++f,r),f<=e&&(n=f+1),e<=f&&(r=f-1)}}function Uh(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function Xh(t,e){return te?1:0}!function(t,e){Vh(t,"name",{value:e,configurable:!0})}(Gh,"booleanIntersects");var Wh=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:9;n(this,t),this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()}return i(t,[{key:"all",value:function(){return this._all(this.data,[])}},{key:"search",value:function(t){var e=this.data,n=[];if(!rf(t,e))return n;for(var r=this.toBBox,i=[];e;){for(var o=0;o=0&&i[e].children.length>this._maxEntries;)this._split(i,e),e--;this._adjustParentBBoxes(r,i,e)}},{key:"_split",value:function(t,e){var n=t[e],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);var o=this._chooseSplitIndex(n,i,r),a=of(n.children.splice(o,n.children.length-o));a.height=n.height,a.leaf=n.leaf,Zh(n,this.toBBox),Zh(a,this.toBBox),e?t[e-1].children.push(a):this._splitRoot(n,a)}},{key:"_splitRoot",value:function(t,e){this.data=of([t,e]),this.data.height=t.height+1,this.data.leaf=!1,Zh(this.data,this.toBBox)}},{key:"_chooseSplitIndex",value:function(t,e,n){for(var r,i,o,a,s,u,l,c=1/0,h=1/0,f=e;f<=n-e;f++){var p=Jh(t,0,f,this.toBBox),g=Jh(t,f,n,this.toBBox),y=(i=p,o=g,a=void 0,s=void 0,u=void 0,l=void 0,a=Math.max(i.minX,o.minX),s=Math.max(i.minY,o.minY),u=Math.min(i.maxX,o.maxX),l=Math.min(i.maxY,o.maxY),Math.max(0,u-a)*Math.max(0,l-s)),v=tf(p)+tf(g);y=e;c--){var h=t.children[c];$h(a,t.leaf?i(h):h),s+=ef(a)}return s}},{key:"_adjustParentBBoxes",value:function(t,e,n){for(var r=n;r>=0;r--)$h(e[r],t)}},{key:"_condense",value:function(t){for(var e,n=t.length-1;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():Zh(t[n],this.toBBox)}}]),t}();function Hh(t,e,n){if(!n)return e.indexOf(t);for(var r=0;r=t.minX&&e.maxY>=t.minY}function of(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function af(t,e,n,r,i){for(var o=[e,n];o.length;)if(!((n=o.pop())-(e=o.pop())<=r)){var a=e+Math.ceil((n-e)/r/2)*r;Yh(t,a,e,n,i),o.push(e,a,a,n)}}var sf=Object.freeze({__proto__:null,default:Wh}),uf=Object.defineProperty;function lf(t){var e=new Wh(t);return e.insert=function(t){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:rc(t),Wh.prototype.insert.call(this,t)},e.load=function(t){var e=[];return Array.isArray(t)?t.forEach((function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:rc(t),e.push(t)})):Tl(t,(function(t){if("Feature"!==t.type)throw new Error("invalid features");t.bbox=t.bbox?t.bbox:rc(t),e.push(t)})),Wh.prototype.load.call(this,e)},e.remove=function(t,e){if("Feature"!==t.type)throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:rc(t),Wh.prototype.remove.call(this,t,e)},e.clear=function(){return Wh.prototype.clear.call(this)},e.search=function(t){return ju(Wh.prototype.search.call(this,this.toBBox(t)))},e.collides=function(t){return Wh.prototype.collides.call(this,this.toBBox(t))},e.all=function(){return ju(Wh.prototype.all.call(this))},e.toJSON=function(){return Wh.prototype.toJSON.call(this)},e.fromJSON=function(t){return Wh.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var e;if(t.bbox)e=t.bbox;else if(Array.isArray(t)&&4===t.length)e=t;else if(Array.isArray(t)&&6===t.length)e=[t[0],t[1],t[3],t[4]];else if("Feature"===t.type)e=rc(t);else{if("FeatureCollection"!==t.type)throw new Error("invalid geojson");e=rc(t)}return{minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}},e}!function(t,e){uf(t,"name",{value:e,configurable:!0})}(lf,"geojsonRbush");var cf=Object.defineProperty,hf=function(t,e){return cf(t,"name",{value:e,configurable:!0})};function ff(t){if(!t)throw new Error("geojson is required");var e=[];return Bl(t,(function(t){pf(t,e)})),ju(e)}function pf(t,e){var n=[],r=t.geometry;if(null!==r){switch(r.type){case"Polygon":n=ol(r);break;case"LineString":n=[ol(r)]}n.forEach((function(n){gf(n,t.properties).forEach((function(t){t.id=e.length,e.push(t)}))}))}}function gf(t,e){var n=[];return t.reduce((function(t,r){var i=Au([t,r],e);return i.bbox=yf(t,r),n.push(i),r})),n}function yf(t,e){var n=t[0],r=t[1],i=e[0],o=e[1];return[ni?n:i,r>o?r:o]}hf(ff,"lineSegment"),hf(pf,"lineSegmentFeature"),hf(gf,"createSegments"),hf(yf,"bbox");var vf=Object.defineProperty,df=Object.defineProperties,mf=Object.getOwnPropertyDescriptors,_f=Object.getOwnPropertySymbols,bf=Object.prototype.hasOwnProperty,xf=Object.prototype.propertyIsEnumerable,Ef=function(t,e,n){return e in t?vf(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},wf=function(t,e){for(var n in e||(e={}))bf.call(e,n)&&Ef(t,n,e[n]);if(_f){var r,i=c(_f(e));try{for(i.s();!(r=i.n()).done;){n=r.value;xf.call(e,n)&&Ef(t,n,e[n])}}catch(t){i.e(t)}finally{i.f()}}return t},kf=function(t,e){return df(t,mf(e))};function Sf(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t||!e)throw new Error("lines and pt are required arguments");var r=Lu([1/0,1/0],{dist:1/0,index:-1,location:-1}),i=0;return Bl(t,(function(t){for(var o=ol(t),a=0;a0&&g.features[0]&&(y=kf(wf({},g.features[0]),{properties:{dist:_l(e,g.features[0],n),location:i+_l(s,g.features[0],n)}})),s.properties.dist2&&void 0!==arguments[2]?arguments[2]:{};if(!Qu(n=n||{}))throw new Error("options is invalid");var r,i=n.tolerance||0,o=[],a=lf(),s=ff(t);a.load(s);var u=[];return Vl(e,(function(t){var e=!1;t&&(Tl(a.search(t),(function(n){if(!1===e){var o=ol(t).sort(),a=ol(n).sort();if(_u(o,a))e=!0,r=r?Mf(r,t)||r:t;else if(0===i?Rc(o[0],n)&&Rc(o[1],n):Sf(n,o[0]).properties.dist<=i&&Sf(n,o[1]).properties.dist<=i)e=!0,r=r?Mf(r,t)||r:t;else if(0===i?Rc(a[0],t)&&Rc(a[1],t):Sf(t,a[0]).properties.dist<=i&&Sf(t,a[1]).properties.dist<=i)if(r){var s=Mf(r,n);s?r=s:u.push(n)}else r=n}})),!1===e&&r&&(o.push(r),u.length&&(o=o.concat(u),u=[]),r=void 0))})),r&&o.push(r),ju(o)}function Mf(t,e){var n=ol(e),r=ol(t),i=r[0],o=r[r.length-1],a=t.geometry.coordinates;if(_u(n[0],i))a.unshift(n[1]);else if(_u(n[0],o))a.push(n[1]);else if(_u(n[1],i))a.unshift(n[0]);else{if(!_u(n[1],o))return;a.push(n[0])}return t}Pf(Nf,"lineOverlap"),Pf(Mf,"concatSegment");var Of=Object.defineProperty;function Lf(t,e){var n=cl(t),r=cl(e),i=n.type,o=r.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new wu({precision:6}).compare(t,e))return!1;var a=0;switch(i){case"MultiPoint":for(var s=0;s0}!function(t,e){Of(t,"name",{value:e,configurable:!0})}(Lf,"booleanOverlap");var Rf=Object.defineProperty,Cf=function(t,e){return Rf(t,"name",{value:e,configurable:!0})};function Tf(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Df(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Df(e,"line2"))throw new Error("line2 must be a LineString");for(var n=ff(Ah(t)).features,r=ff(Ah(e)).features,i=0;i1;case"MultiPoint":for(var i=0;i0&&uh(Cu([r[0]]),Cu([r[i]])).features.length>1)return!1}return!0;case"MultiPolygon":for(i=0;i0&&uh(Cu([o[0]]),Cu([o[a]])).features.length>1)return!1}return!0;default:return!1}}function Uf(t){return t[0][0]===t[t.length-1][0]||t[0][1]===t[t.length-1][1]}function Xf(t){for(var e=0;ee[0])&&(!(t[2]e[1])&&!(t[3]1&&void 0!==arguments[1]?arguments[1]:{},n=rc(t);return Lu([(n[0]+n[2])/2,(n[1]+n[3])/2],e.properties,e)}!function(t,e){sp(t,"name",{value:e,configurable:!0})}(up,"center");var lp={exports:{}};!function(t,n){t.exports=function(){function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}var m=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=e.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=e.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==e.JOIN_ROUND&&(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(t){this._joinStyle=t}},{key:"setSimplifyFactor",value:function(t){this._simplifyFactor=t<0?0:t}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(t){this._endCapStyle=t}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(t){this._mitreLimit=t}},{key:"setSingleSided",value:function(t){this._isSingleSided=t}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=e.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=e.CAP_ROUND,this._joinStyle=e.JOIN_ROUND,this._mitreLimit=e.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=e.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setQuadrantSegments(t)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(a),this.setMitreLimit(s)}}},{key:"bufferDistanceError",value:function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)}}]),e}();m.CAP_ROUND=1,m.CAP_FLAT=2,m.CAP_SQUARE=3,m.JOIN_ROUND=1,m.JOIN_MITRE=2,m.JOIN_BEVEL=3,m.DEFAULT_QUADRANT_SEGMENTS=8,m.DEFAULT_MITRE_LIMIT=5,m.DEFAULT_SIMPLIFY_FACTOR=.01;var _=function(e){i(o,e);var n=f(o);function o(e){var r;return t(this,o),(r=n.call(this,e)).name=Object.keys({Exception:o})[0],r}return r(o,[{key:"toString",value:function(){return this.message}}]),o}(l(Error)),b=function(e){i(r,e);var n=f(r);function r(e){var i;return t(this,r),(i=n.call(this,e)).name=Object.keys({IllegalArgumentException:r})[0],i}return r}(_),x=function(){function e(){t(this,e)}return r(e,[{key:"filter",value:function(t){}}]),e}();function E(){}function w(){}function k(){}var S,I,P,N,M,O,L,R,C=function(){function e(){t(this,e)}return r(e,null,[{key:"equalsWithTolerance",value:function(t,e,n){return Math.abs(t-e)<=n}}]),e}(),T=function(){function e(n,r){t(this,e),this.low=r||0,this.high=n||0}return r(e,null,[{key:"toBinaryString",value:function(t){var e,n="";for(e=2147483648;e>0;e>>>=1)n+=(t.high&e)===e?"1":"0";for(e=2147483648;e>0;e>>>=1)n+=(t.low&e)===e?"1":"0";return n}}]),e}();function A(){}function D(){}A.NaN=NaN,A.isNaN=function(t){return Number.isNaN(t)},A.isInfinite=function(t){return!Number.isFinite(t)},A.MAX_VALUE=Number.MAX_VALUE,A.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,A.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,"function"==typeof Float64Array&&"function"==typeof Int32Array?(O=2146435072,L=new Float64Array(1),R=new Int32Array(L.buffer),A.doubleToLongBits=function(t){L[0]=t;var e=0|R[0],n=0|R[1];return(n&O)===O&&0!=(1048575&n)&&0!==e&&(e=0,n=2146959360),new T(n,e)},A.longBitsToDouble=function(t){return R[0]=t.low,R[1]=t.high,L[0]}):(S=1023,I=Math.log2,P=Math.floor,N=Math.pow,M=function(){for(var t=53;t>0;t--){var e=N(2,t)-1;if(P(I(e))+1===t)return e}return 0}(),A.doubleToLongBits=function(t){var e,n,r,i,o,a,s,u,l;if(t<0||1/t===Number.NEGATIVE_INFINITY?(a=1<<31,t=-t):a=0,0===t)return new T(u=a,l=0);if(t===1/0)return new T(u=2146435072|a,l=0);if(t!=t)return new T(u=2146959360,l=0);if(i=0,l=0,(e=P(t))>1)if(e<=M)(i=P(I(e)))<=20?(l=0,u=e<<20-i&1048575):(l=e%(n=N(2,r=i-20))<<32-r,u=e/n&1048575);else for(r=e,l=0;0!==(r=P(n=r/2));)i++,l>>>=1,l|=(1&u)<<31,u>>>=1,n!==r&&(u|=524288);if(s=i+S,o=0===e,e=t-e,i<52&&0!==e)for(r=0;;){if((n=2*e)>=1?(e=n-1,o?(s--,o=!1):(r<<=1,r|=1,i++)):(e=n,o?0==--s&&(i++,o=!1):(r<<=1,i++)),20===i)u|=r,r=0;else if(52===i){l|=r;break}if(1===n){i<20?u|=r<<20-i:i<52&&(l|=r<<52-i);break}}return u|=s<<20,new T(u|=a,l)},A.longBitsToDouble=function(t){var e,n,r,i,o=t.high,a=t.low,s=o&1<<31?-1:1;for(r=((2146435072&o)>>20)-S,i=0,n=1<<19,e=1;e<=20;e++)o&n&&(i+=N(2,-e)),n>>>=1;for(n=1<<31,e=21;e<=52;e++)a&n&&(i+=N(2,-e)),n>>>=1;if(-1023===r){if(0===i)return 0*s;r=-1022}else{if(1024===r)return 0===i?s/0:NaN;i+=1}return s*i*N(2,r)});var j=function(e){i(r,e);var n=f(r);function r(e){var i;return t(this,r),(i=n.call(this,e)).name=Object.keys({RuntimeException:r})[0],i}return r}(_),F=function(e){i(o,e);var n=f(o);function o(){var e;return t(this,o),e=n.call(this),o.constructor_.apply(c(e),arguments),e}return r(o,null,[{key:"constructor_",value:function(){if(0===arguments.length)j.constructor_.call(this);else if(1===arguments.length){var t=arguments[0];j.constructor_.call(this,t)}}}]),o}(j),B=function(){function e(){t(this,e)}return r(e,null,[{key:"shouldNeverReachHere",value:function(){if(0===arguments.length)e.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new F("Should never reach here"+(null!==t?": "+t:""))}}},{key:"isTrue",value:function(){if(1===arguments.length){var t=arguments[0];e.isTrue(t,null)}else if(2===arguments.length){var n=arguments[1];if(!arguments[0])throw null===n?new F:new F(n)}}},{key:"equals",value:function(){if(2===arguments.length){var t=arguments[0],n=arguments[1];e.equals(t,n,null)}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(!i.equals(r))throw new F("Expected "+r+" but encountered "+i+(null!==o?": "+o:""))}}}]),e}(),q=new ArrayBuffer(8),V=new Float64Array(q),G=new Int32Array(q),Y=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getM",value:function(){return A.NaN}},{key:"setOrdinate",value:function(t,n){switch(t){case e.X:this.x=n;break;case e.Y:this.y=n;break;case e.Z:this.setZ(n);break;default:throw new b("Invalid ordinate index: "+t)}}},{key:"equals2D",value:function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!C.equalsWithTolerance(this.x,e.x,n)&&!!C.equalsWithTolerance(this.y,e.y,n)}}},{key:"setM",value:function(t){throw new b("Invalid ordinate index: "+e.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(t){switch(t){case e.X:return this.x;case e.Y:return this.y;case e.Z:return this.getZ()}throw new b("Invalid ordinate index: "+t)}},{key:"equals3D",value:function(t){return this.x===t.x&&this.y===t.y&&(this.getZ()===t.getZ()||A.isNaN(this.getZ())&&A.isNaN(t.getZ()))}},{key:"equals",value:function(t){return t instanceof e&&this.equals2D(t)}},{key:"equalInZ",value:function(t,e){return C.equalsWithTolerance(this.getZ(),t.getZ(),e)}},{key:"setX",value:function(t){this.x=t}},{key:"compareTo",value:function(t){var e=t;return this.xe.x?1:this.ye.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(t){this.z=t}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return B.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw t}}},{key:"copy",value:function(){return new e(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(t){var e=this.x-t.x,n=this.y-t.y,r=this.getZ()-t.getZ();return Math.sqrt(e*e+n*n+r*r)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(t){this.y=t}},{key:"distance",value:function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){var t=17;return 37*(t=37*t+e.hashCode(this.x))+e.hashCode(this.y)}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}},{key:"interfaces_",get:function(){return[E,w,k]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)e.constructor_.call(this,0,0);else if(1===arguments.length){var t=arguments[0];e.constructor_.call(this,t.x,t.y,t.getZ())}else if(2===arguments.length){var n=arguments[0],r=arguments[1];e.constructor_.call(this,n,r,e.NULL_ORDINATE)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2];this.x=i,this.y=o,this.z=a}}},{key:"hashCode",value:function(t){return V[0]=t,G[0]^G[1]}}]),e}(),z=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"compare",value:function(t,n){var r=e.compare(t.x,n.x);if(0!==r)return r;var i=e.compare(t.y,n.y);return 0!==i?i:this._dimensionsToTest<=2?0:e.compare(t.getZ(),n.getZ())}},{key:"interfaces_",get:function(){return[D]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,0===arguments.length)e.constructor_.call(this,2);else if(1===arguments.length){var t=arguments[0];if(2!==t&&3!==t)throw new b("only 2 or 3 dimensions may be specified");this._dimensionsToTest=t}}},{key:"compare",value:function(t,e){return te?1:A.isNaN(t)?A.isNaN(e)?0:-1:A.isNaN(e)?1:0}}]),e}();Y.DimensionalComparator=z,Y.NULL_ORDINATE=A.NaN,Y.X=0,Y.Y=1,Y.Z=2,Y.M=3;var U=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(t){if(!(t instanceof e))return!1;var n=t;return this.isNull()?n.isNull():this._maxx===n.getMaxX()&&this._maxy===n.getMaxY()&&this._minx===n.getMinX()&&this._miny===n.getMinY()}},{key:"intersection",value:function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new e;var n=this._minx>t._minx?this._minx:t._minx,r=this._miny>t._miny?this._miny:t._miny;return new e(n,this._maxx=this._minx&&n.getMaxX()<=this._maxx&&n.getMinY()>=this._miny&&n.getMaxY()<=this._maxy}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];return!this.isNull()&&r>=this._minx&&r<=this._maxx&&i>=this._miny&&i<=this._maxy}}},{key:"intersects",value:function(){if(1===arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxxthis._maxy||t._maxythis._maxx||(r.x>i.x?r.x:i.x)this._maxy||(r.y>i.y?r.y:i.y)this._maxx||othis._maxy||athis._maxx&&(this._maxx=n._maxx),n._minythis._maxy&&(this._maxy=n._maxy))}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.isNull()?(this._minx=r,this._maxx=r,this._miny=i,this._maxy=i):(rthis._maxx&&(this._maxx=r),ithis._maxy&&(this._maxy=i))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return te._minx?1:this._minye._miny?1:this._maxxe._maxx?1:this._maxye._maxy?1:0}},{key:"translate",value:function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)}},{key:"copy",value:function(){return new e(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(t){return!(!this.isNull()&&!t.isNull())||t._minx>this._maxx||t._maxxthis._maxy||t._maxye?t:e}},{key:"expandBy",value:function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(1===arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof Y){var n=arguments[0];return this.covers(n)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];return this.covers(r,i)}}},{key:"centre",value:function(){return this.isNull()?null:new Y((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof Y){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof e){var n=arguments[0];this._minx=n._minx,this._maxx=n._maxx,this._miny=n._miny,this._maxy=n._maxy}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(4===arguments.length){var o=arguments[0],a=arguments[1],s=arguments[2],u=arguments[3];ot._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxyt._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)}},{key:"hashCode",value:function(){var t=17;return 37*(t=37*(t=37*(t=37*t+Y.hashCode(this._minx))+Y.hashCode(this._maxx))+Y.hashCode(this._miny))+Y.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[E,k]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof Y){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(4===arguments.length){var o=arguments[0],a=arguments[1],s=arguments[2],u=arguments[3];this.init(o,a,s,u)}}},{key:"intersects",value:function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.xe.x?t.x:e.x)&&n.y>=(t.ye.y?t.y:e.y)}if(4===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],a=arguments[3],s=Math.min(o.x,a.x),u=Math.max(o.x,a.x),l=Math.min(r.x,i.x),c=Math.max(r.x,i.x);return!(l>u||cu||c=this.size())throw new nt;return this.array[t]}},{key:"push",value:function(t){return this.array.push(t),t}},{key:"pop",value:function(){if(0===this.array.length)throw new et;return this.array.pop()}},{key:"peek",value:function(){if(0===this.array.length)throw new et;return this.array[this.array.length-1]}},{key:"empty",value:function(){return 0===this.array.length}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(t){return this.array.indexOf(t)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}]),o}(rt);function ot(t,e){return t.interfaces_&&t.interfaces_.indexOf(e)>-1}var at=function(){function e(n){t(this,e),this.str=n}return r(e,[{key:"append",value:function(t){this.str+=t}},{key:"setCharAt",value:function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)}},{key:"toString",value:function(){return this.str}}]),e}(),st=function(){function e(n){t(this,e),this.value=n}return r(e,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(t){return this.valuet?1:0}}],[{key:"compare",value:function(t,e){return te?1:0}},{key:"isNan",value:function(t){return Number.isNaN(t)}},{key:"valueOf",value:function(t){return new e(t)}}]),e}(),ut=function(){function e(){t(this,e)}return r(e,null,[{key:"isWhitespace",value:function(t){return t<=32&&t>=0||127===t}},{key:"toUpperCase",value:function(t){return t.toUpperCase()}}]),e}(),lt=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"le",value:function(t){return this._hi9?(h=!0,f="9"):f="0"+c,s.append(f),r=r.subtract(e.valueOf(c)).multiply(e.TEN),h&&r.selfAdd(e.TEN);var p=!0,g=e.magnitude(r._hi);if(g<0&&Math.abs(g)>=u-l&&(p=!1),!p)break}return n[0]=i,s.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var n=arguments[0];return this.add(-n)}}},{key:"equals",value:function(){if(1===arguments.length&&arguments[0]instanceof e){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}}},{key:"isZero",value:function(){return 0===this._hi&&0===this._lo}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(t){return this.le(t)?this:t}},{key:"selfDivide",value:function(){if(1===arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var n=arguments[0];return this.selfDivide(n,0)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1],o=null,a=null,s=null,u=null,l=null,c=null,h=null,f=null;return l=this._hi/r,f=(o=(c=e.SPLIT*l)-(o=c-l))*(s=(f=e.SPLIT*r)-(s=f-r))-(h=l*r)+o*(u=r-s)+(a=l-o)*s+a*u,f=l+(c=(this._hi-h-f+this._lo-l*i)/r),this._hi=f,this._lo=l-f+c,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof e){var t=arguments[0],n=null,r=null,i=null,o=null,a=null,s=null,u=null,l=null;return r=(a=this._hi/t._hi)-(n=(s=e.SPLIT*a)-(n=s-a)),l=n*(i=(l=e.SPLIT*t._hi)-(i=l-t._hi))-(u=a*t._hi)+n*(o=t._hi-i)+r*i+r*o,new e(l=a+(s=(this._hi-u-l+this._lo-a*t._lo)/t._hi),a-l+s)}if("number"==typeof arguments[0]){var c=arguments[0];return A.isNaN(c)?e.createNaN():e.copy(this).selfDivide(c,0)}}},{key:"ge",value:function(t){return this._hi>t._hi||this._hi===t._hi&&this._lo>=t._lo}},{key:"pow",value:function(t){if(0===t)return e.valueOf(1);var n=new e(this),r=e.valueOf(1),i=Math.abs(t);if(i>1)for(;i>0;)i%2==1&&r.selfMultiply(n),(i/=2)>0&&(n=n.sqr());else r=n;return t<0?r.reciprocal():r}},{key:"ceil",value:function(){if(this.isNaN())return e.NaN;var t=Math.ceil(this._hi),n=0;return t===this._hi&&(n=Math.ceil(this._lo)),new e(t,n)}},{key:"compareTo",value:function(t){var e=t;return this._hie._hi?1:this._loe._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var n=arguments[0];return this.init(n),this}}},{key:"max",value:function(t){return this.ge(t)?this:t}},{key:"sqrt",value:function(){if(this.isZero())return e.valueOf(0);if(this.isNegative())return e.NaN;var t=1/Math.sqrt(this._hi),n=this._hi*t,r=e.valueOf(n),i=this.subtract(r.sqr())._hi*(.5*t);return r.add(i)}},{key:"selfAdd",value:function(){if(1===arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var n=arguments[0],r=null,i=null,o=null,a=null,s=null,u=null;return a=(o=this._hi+n)-(s=o-this._hi),i=(u=(a=n-s+(this._hi-a))+this._lo)+(o-(r=o+u)),this._hi=r+i,this._lo=i+(r-this._hi),this}}else if(2===arguments.length){var l=arguments[0],c=arguments[1],h=null,f=null,p=null,g=null,y=null,v=null,d=null;g=this._hi+l,f=this._lo+c,y=g-(v=g-this._hi),p=f-(d=f-this._lo);var m=(h=g+(v=(y=l-v+(this._hi-y))+f))+(v=(p=c-d+(this._lo-p))+(v+(g-h))),_=v+(h-m);return this._hi=m,this._lo=_,this}}},{key:"selfMultiply",value:function(){if(1===arguments.length){if(arguments[0]instanceof e){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var n=arguments[0];return this.selfMultiply(n,0)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1],o=null,a=null,s=null,u=null,l=null,c=null;o=(l=e.SPLIT*this._hi)-this._hi,c=e.SPLIT*r,o=l-o,a=this._hi-o,s=c-r;var h=(l=this._hi*r)+(c=o*(s=c-s)-l+o*(u=r-s)+a*s+a*u+(this._hi*i+this._lo*r)),f=c+(o=l-h);return this._hi=h,this._lo=f,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return e.NaN;var t=Math.floor(this._hi),n=0;return t===this._hi&&(n=Math.floor(this._lo)),new e(t,n)}},{key:"negate",value:function(){return this.isNaN()?this:new e(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(t){if(t instanceof CloneNotSupportedException)return null;throw t}}},{key:"multiply",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return t.isNaN()?e.createNaN():e.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var n=arguments[0];return A.isNaN(n)?e.createNaN():e.copy(this).selfMultiply(n,0)}}},{key:"isNaN",value:function(){return A.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var t=e.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var t=this.getSpecialNumberString();if(null!==t)return t;var n=new Array(1).fill(null),r=this.extractSignificantDigits(!0,n),i=n[0]+1,o=r;if("."===r.charAt(0))o="0"+r;else if(i<0)o="0."+e.stringOfChar("0",-i)+r;else if(-1===r.indexOf(".")){var a=i-r.length;o=r+e.stringOfChar("0",a)+".0"}return this.isNegative()?"-"+o:o}},{key:"reciprocal",value:function(){var t,n,r,i,o=null,a=null,s=null,u=null;t=(r=1/this._hi)-(o=(s=e.SPLIT*r)-(o=s-r)),a=(u=e.SPLIT*this._hi)-this._hi;var l=r+(s=(1-(i=r*this._hi)-(u=o*(a=u-a)-i+o*(n=this._hi-a)+t*a+t*n)-r*this._lo)/this._hi);return new e(l,r-l+s)}},{key:"toSciNotation",value:function(){if(this.isZero())return e.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var n=new Array(1).fill(null),r=this.extractSignificantDigits(!1,n),i=e.SCI_NOT_EXPONENT_CHAR+n[0];if("0"===r.charAt(0))throw new IllegalStateException("Found leading zero: "+r);var o="";r.length>1&&(o=r.substring(1));var a=r.charAt(0)+"."+o;return this.isNegative()?"-"+a+i:a+i}},{key:"abs",value:function(){return this.isNaN()?e.NaN:this.isNegative()?this.negate():new e(this)}},{key:"isPositive",value:function(){return this._hi>0||0===this._hi&&this._lo>0}},{key:"lt",value:function(t){return this._hit._hi||this._hi===t._hi&&this._lo>t._lo}},{key:"isNegative",value:function(){return this._hi<0||0===this._hi&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?e.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[k,E,w]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this.init(t)}else if(arguments[0]instanceof e){var n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){var r=arguments[0];e.constructor_.call(this,e.parse(r))}}else if(2===arguments.length){var i=arguments[0],o=arguments[1];this.init(i,o)}}},{key:"determinant",value:function(){if("number"==typeof arguments[3]&&"number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];return e.determinant(e.valueOf(t),e.valueOf(n),e.valueOf(r),e.valueOf(i))}if(arguments[3]instanceof e&&arguments[2]instanceof e&&arguments[0]instanceof e&&arguments[1]instanceof e){var o=arguments[1],a=arguments[2],s=arguments[3];return arguments[0].multiply(s).selfSubtract(o.multiply(a))}}},{key:"sqr",value:function(t){return e.valueOf(t).selfMultiply(t)}},{key:"valueOf",value:function(){if("string"==typeof arguments[0]){var t=arguments[0];return e.parse(t)}if("number"==typeof arguments[0])return new e(arguments[0])}},{key:"sqrt",value:function(t){return e.valueOf(t).sqrt()}},{key:"parse",value:function(t){for(var n=0,r=t.length;ut.isWhitespace(t.charAt(n));)n++;var i=!1;if(n=r);){var h=t.charAt(n);if(n++,ut.isDigit(h)){var f=h-"0";a.selfMultiply(e.TEN),a.selfAdd(f),s++}else{if("."!==h){if("e"===h||"E"===h){var p=t.substring(n);try{l=st.parseInt(p)}catch(e){throw e instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+p+" in string "+t):e}break}throw new NumberFormatException("Unexpected character '"+h+"' at position "+n+" in string "+t)}u=s,c=!0}}var g=a;c||(u=s);var y=s-u-l;if(0===y)g=a;else if(y>0){var v=e.TEN.pow(y);g=a.divide(v)}else if(y<0){var d=e.TEN.pow(-y);g=a.multiply(d)}return i?g.negate():g}},{key:"createNaN",value:function(){return new e(A.NaN,A.NaN)}},{key:"copy",value:function(t){return new e(t)}},{key:"magnitude",value:function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r}},{key:"stringOfChar",value:function(t,e){for(var n=new at,r=0;r0){if(a<=0)return e.signum(s);i=o+a}else{if(!(o<0))return e.signum(s);if(a>=0)return e.signum(s);i=-o-a}var u=e.DP_SAFE_EPSILON*i;return s>=u||-s>=u?e.signum(s):2}},{key:"signum",value:function(t){return t>0?1:t<0?-1:0}}]),e}();ct.DP_SAFE_EPSILON=1e-15;var ht=function(){function e(){t(this,e)}return r(e,[{key:"getM",value:function(t){if(this.hasM()){var e=this.getDimension()-this.getMeasures();return this.getOrdinate(t,e)}return A.NaN}},{key:"setOrdinate",value:function(t,e,n){}},{key:"getZ",value:function(t){return this.hasZ()?this.getOrdinate(t,2):A.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(t,e){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(t){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(t){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(t){}},{key:"copy",value:function(){}},{key:"getY",value:function(t){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[w]}}]),e}();ht.X=0,ht.Y=1,ht.Z=2,ht.M=3;var ft=function(){function e(){t(this,e)}return r(e,null,[{key:"index",value:function(t,e,n){return ct.orientationIndex(t,e,n)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var t=arguments[0],n=t.length-1;if(n<3)throw new b("Ring has fewer than 4 points, so orientation cannot be determined");for(var r=t[0],i=0,o=1;o<=n;o++){var a=t[o];a.y>r.y&&(r=a,i=o)}var s=i;do{(s-=1)<0&&(s=n)}while(t[s].equals2D(r)&&s!==i);var u=i;do{u=(u+1)%n}while(t[u].equals2D(r)&&u!==i);var l=t[s],c=t[u];if(l.equals2D(r)||c.equals2D(r)||l.equals2D(c))return!1;var h=e.index(l,r,c);return 0===h?l.x>c.x:h>0}if(ot(arguments[0],ht)){var f=arguments[0],p=f.size()-1;if(p<3)throw new b("Ring has fewer than 4 points, so orientation cannot be determined");for(var g=f.getCoordinate(0),y=0,v=1;v<=p;v++){var d=f.getCoordinate(v);d.y>g.y&&(g=d,y=v)}var m=null,_=y;do{(_-=1)<0&&(_=p),m=f.getCoordinate(_)}while(m.equals2D(g)&&_!==y);var x=null,E=y;do{E=(E+1)%p,x=f.getCoordinate(E)}while(x.equals2D(g)&&E!==y);if(m.equals2D(g)||x.equals2D(g)||m.equals2D(x))return!1;var w=e.index(m,g,x);return 0===w?m.x>x.x:w>0}}}]),e}();ft.CLOCKWISE=-1,ft.RIGHT=ft.CLOCKWISE,ft.COUNTERCLOCKWISE=1,ft.LEFT=ft.COUNTERCLOCKWISE,ft.COLLINEAR=0,ft.STRAIGHT=ft.COLLINEAR;var pt=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n}},{key:"findRightmostEdgeAtVertex",value:function(){var t=this._minDe.getEdge().getCoordinates();B.isTrue(this._minIndex>0&&this._minIndexthis._minCoord.y&&n.y>this._minCoord.y&&r===ft.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var r=tt.LEFT;return n[e].ythis._minCoord.x)&&(this._minDe=t,this._minIndex=n,this._minCoord=e[n])}},{key:"findRightmostEdgeAtNode",value:function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}B.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)===tt.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}]),e}(),gt=function(e){i(o,e);var n=f(o);function o(e,r){var i;return t(this,o),(i=n.call(this,r?e+" [ "+r+" ]":e)).pt=r?new Y(r):void 0,i.name=Object.keys({TopologyException:o})[0],i}return r(o,[{key:"getCoordinate",value:function(){return this.pt}}]),o}(j),yt=function(){function e(){t(this,e),this.array=[]}return r(e,[{key:"addLast",value:function(t){this.array.push(t)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return 0===this.array.length}}]),e}(),vt=function(e,n){i(a,e);var o=f(a);function a(e){var n;return t(this,a),(n=o.call(this)).array=[],e instanceof H&&n.addAll(e),n}return r(a,[{key:"interfaces_",get:function(){return[rt,H]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(t){return 1===arguments.length?this.array.push(t):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(t){var e,n=d(t);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.array.push(r)}}catch(t){n.e(t)}finally{n.f()}}},{key:"set",value:function(t,e){var n=this.array[t];return this.array[t]=e,n}},{key:"iterator",value:function(){return new dt(this)}},{key:"get",value:function(t){if(t<0||t>=this.size())throw new nt;return this.array[t]}},{key:"isEmpty",value:function(){return 0===this.array.length}},{key:"sort",value:function(t){t?this.array.sort((function(e,n){return t.compare(e,n)})):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(t){for(var e=0,n=this.array.length;e=1&&e.getDepth(tt.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}}},{key:"computeDepths",value:function(t){var e=new Q,n=new yt,r=t.getNode();for(n.addLast(r),e.add(r),t.setVisited(!0);!n.isEmpty();){var i=n.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var a=o.next().getSym();if(!a.isVisited()){var s=a.getNode();e.contains(s)||(n.addLast(s),e.add(s))}}}}},{key:"compareTo",value:function(t){var e=t;return this._rightMostCoord.xe._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(null===this._env){for(var t=new U,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;re.x?t.x:e.x,s=t.y>e.y?t.y:e.y,u=n.xr.x?n.x:r.x,h=n.y>r.y?n.y:r.y,f=((i>u?i:u)+(al?o:l)+(sn?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return ro?o:r}}},{key:"wrap",value:function(t,e){return t<0?e- -t%e:t%e}},{key:"max",value:function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[0];return t>n&&(n=t),e>n&&(n=e),n}if(4===arguments.length){var r=arguments[1],i=arguments[2],o=arguments[3],a=arguments[0];return r>a&&(a=r),i>a&&(a=i),o>a&&(a=o),a}}},{key:"average",value:function(t,e){return(t+e)/2}}]),e}();xt.LOG_10=Math.log(10);var Et=function(){function e(){t(this,e)}return r(e,null,[{key:"segmentToSegment",value:function(t,n,r,i){if(t.equals(n))return e.pointToSegment(t,r,i);if(r.equals(i))return e.pointToSegment(i,t,n);var o=!1;if(U.intersects(t,n,r,i)){var a=(n.x-t.x)*(i.y-r.y)-(n.y-t.y)*(i.x-r.x);if(0===a)o=!0;else{var s=(t.y-r.y)*(i.x-r.x)-(t.x-r.x)*(i.y-r.y),u=((t.y-r.y)*(n.x-t.x)-(t.x-r.x)*(n.y-t.y))/a,l=s/a;(l<0||l>1||u<0||u>1)&&(o=!0)}}else o=!0;return o?xt.min(e.pointToSegment(t,r,i),e.pointToSegment(n,r,i),e.pointToSegment(r,t,n),e.pointToSegment(i,t,n)):0}},{key:"pointToSegment",value:function(t,e,n){if(e.x===n.x&&e.y===n.y)return t.distance(e);var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((t.x-e.x)*(n.x-e.x)+(t.y-e.y)*(n.y-e.y))/r;if(i<=0)return t.distance(e);if(i>=1)return t.distance(n);var o=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(o)*Math.sqrt(r)}},{key:"pointToLinePerpendicular",value:function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)}},{key:"pointToSegmentString",value:function(t,n){if(0===n.length)throw new b("Line array must contain at least one vertex");for(var r=t.distance(n[0]),i=0;i0)&&(o=s,i=a)}return i}}},{key:"extend",value:function(t,n,r){var i=t.create(r,n.getDimension()),o=n.size();if(e.copy(n,0,i,0,o),o>0)for(var a=o;a0)&&(e=r)}return e}}]),e}(),Nt=function(){function e(){t(this,e)}return r(e,null,[{key:"toDimensionSymbol",value:function(t){switch(t){case e.FALSE:return e.SYM_FALSE;case e.TRUE:return e.SYM_TRUE;case e.DONTCARE:return e.SYM_DONTCARE;case e.P:return e.SYM_P;case e.L:return e.SYM_L;case e.A:return e.SYM_A}throw new b("Unknown dimension value: "+t)}},{key:"toDimensionValue",value:function(t){switch(ut.toUpperCase(t)){case e.SYM_FALSE:return e.FALSE;case e.SYM_TRUE:return e.TRUE;case e.SYM_DONTCARE:return e.DONTCARE;case e.SYM_P:return e.P;case e.SYM_L:return e.L;case e.SYM_A:return e.A}throw new b("Unknown dimension symbol: "+t)}}]),e}();Nt.P=0,Nt.L=1,Nt.A=2,Nt.FALSE=-1,Nt.TRUE=-2,Nt.DONTCARE=-3,Nt.SYM_FALSE="F",Nt.SYM_TRUE="T",Nt.SYM_DONTCARE="*",Nt.SYM_P="0",Nt.SYM_L="1",Nt.SYM_A="2";var Mt=function(){function e(){t(this,e)}return r(e,[{key:"filter",value:function(t){}}]),e}(),Ot=function(){function e(){t(this,e)}return r(e,[{key:"filter",value:function(t,e){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),e}(),Lt=function(e){i(a,e);var n=f(a);function a(){var e;return t(this,a),e=n.call(this),a.constructor_.apply(c(e),arguments),e}return r(a,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new U:this._points.expandEnvelope(new U)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new a(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(2===arguments.length&&"number"==typeof arguments[1]&&arguments[0]instanceof X){var t=arguments[0],e=arguments[1];if(!this.isEquivalentClass(t))return!1;var n=t;if(this._points.size()!==n._points.size())return!1;for(var r=0;r0){var n=this._points.copy();Pt.reverse(n),this._points=n}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?Nt.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var t=this._points.copy();return Pt.reverse(t),this.getFactory().createLineString(t)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return X.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return St.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e= 2)");this._points=t}},{key:"isCoordinate",value:function(t){for(var e=0;e=1&&this.getCoordinateSequence().size()= 4)")}},{key:"getGeometryType",value:function(){return X.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var t=arguments[0],e=arguments[1];Lt.constructor_.call(this,t,e),this.validateConstruction()}}]),a}(Lt);Yt.MINIMUM_VALID_SIZE=4;var zt=function(e){i(o,e);var n=f(o);function o(){var e;return t(this,o),e=n.call(this),o.constructor_.apply(c(e),arguments),e}return r(o,[{key:"setOrdinate",value:function(t,e){switch(t){case o.X:this.x=e;break;case o.Y:this.y=e;break;default:throw new b("Invalid ordinate index: "+t)}}},{key:"getZ",value:function(){return Y.NULL_ORDINATE}},{key:"getOrdinate",value:function(t){switch(t){case o.X:return this.x;case o.Y:return this.y}throw new b("Invalid ordinate index: "+t)}},{key:"setZ",value:function(t){throw new b("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new o(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ()}}],[{key:"constructor_",value:function(){if(0===arguments.length)Y.constructor_.call(this);else if(1===arguments.length){if(arguments[0]instanceof o){var t=arguments[0];Y.constructor_.call(this,t.x,t.y)}else if(arguments[0]instanceof Y){var e=arguments[0];Y.constructor_.call(this,e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];Y.constructor_.call(this,n,r,Y.NULL_ORDINATE)}}}]),o}(Y);zt.X=0,zt.Y=1,zt.Z=-1,zt.M=-1;var Ut=function(e){i(o,e);var n=f(o);function o(){var e;return t(this,o),e=n.call(this),o.constructor_.apply(c(e),arguments),e}return r(o,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(t,e){switch(t){case o.X:this.x=e;break;case o.Y:this.y=e;break;case o.M:this._m=e;break;default:throw new b("Invalid ordinate index: "+t)}}},{key:"setM",value:function(t){this._m=t}},{key:"getZ",value:function(){return Y.NULL_ORDINATE}},{key:"getOrdinate",value:function(t){switch(t){case o.X:return this.x;case o.Y:return this.y;case o.M:return this._m}throw new b("Invalid ordinate index: "+t)}},{key:"setZ",value:function(t){throw new b("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new o(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,0===arguments.length)Y.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof o){var t=arguments[0];Y.constructor_.call(this,t.x,t.y),this._m=t._m}else if(arguments[0]instanceof Y){var e=arguments[0];Y.constructor_.call(this,e.x,e.y),this._m=this.getM()}}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];Y.constructor_.call(this,n,r,Y.NULL_ORDINATE),this._m=i}}}]),o}(Y);Ut.X=0,Ut.Y=1,Ut.Z=-1,Ut.M=2;var Xt=function(e){i(o,e);var n=f(o);function o(){var e;return t(this,o),e=n.call(this),o.constructor_.apply(c(e),arguments),e}return r(o,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(t,e){switch(t){case Y.X:this.x=e;break;case Y.Y:this.y=e;break;case Y.Z:this.z=e;break;case Y.M:this._m=e;break;default:throw new b("Invalid ordinate index: "+t)}}},{key:"setM",value:function(t){this._m=t}},{key:"getOrdinate",value:function(t){switch(t){case Y.X:return this.x;case Y.Y:return this.y;case Y.Z:return this.getZ();case Y.M:return this.getM()}throw new b("Invalid ordinate index: "+t)}},{key:"copy",value:function(){return new o(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(t){this.x=t.x,this.y=t.y,this.z=t.getZ(),this._m=t.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,0===arguments.length)Y.constructor_.call(this),this._m=0;else if(1===arguments.length){if(arguments[0]instanceof o){var t=arguments[0];Y.constructor_.call(this,t),this._m=t._m}else if(arguments[0]instanceof Y){var e=arguments[0];Y.constructor_.call(this,e),this._m=this.getM()}}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],a=arguments[3];Y.constructor_.call(this,n,r,i),this._m=a}}}]),o}(Y),Wt=function(){function e(){t(this,e)}return r(e,null,[{key:"measures",value:function(t){return t instanceof zt?0:t instanceof Ut||t instanceof Xt?1:0}},{key:"dimension",value:function(t){return t instanceof zt?2:t instanceof Ut?3:t instanceof Xt?4:3}},{key:"create",value:function(){if(1===arguments.length){var t=arguments[0];return e.create(t,0)}if(2===arguments.length){var n=arguments[0],r=arguments[1];return 2===n?new zt:3===n&&0===r?new Y:3===n&&1===r?new Ut:4===n&&1===r?new Xt:new Y}}}]),e}(),Ht=function(e){i(a,e);var n=f(a);function a(){var e;return t(this,a),e=n.call(this),a.constructor_.apply(c(e),arguments),e}return r(a,[{key:"getCoordinate",value:function(t){return this.get(t)}},{key:"addAll",value:function(){if(2===arguments.length&&"boolean"==typeof arguments[1]&&ot(arguments[0],H)){for(var t=arguments[1],e=!1,n=arguments[0].iterator();n.hasNext();)this.add(n.next(),t),e=!0;return e}return p(o(a.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var t=p(o(a.prototype),"clone",this).call(this),e=0;e=1&&this.get(this.size()-1).equals2D(r))return null;p(o(a.prototype),"add",this).call(this,r)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var i=arguments[0],s=arguments[1];return this.add(i,s),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];if(arguments[2])for(var c=0;c=0;h--)this.add(u[h],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof Y){var f=arguments[0],g=arguments[1];if(!arguments[2]){var y=this.size();if(y>0){if(f>0&&this.get(f-1).equals2D(g))return null;if(f_&&(b=-1);for(var x=m;x!==_;x+=b)this.add(v[x],d);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var t=this.get(0).copy();this.add(t,!1)}}}],[{key:"constructor_",value:function(){if(0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.ensureCapacity(t.length),this.add(t,!0)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.ensureCapacity(e.length),this.add(e,n)}}}]),a}(vt);Ht.coordArrayType=new Array(0).fill(null);var Zt=function(){function e(){t(this,e)}return r(e,null,[{key:"isRing",value:function(t){return!(t.length<4||!t[0].equals2D(t[t.length-1]))}},{key:"ptNotInList",value:function(t,n){for(var r=0;r=t?e:[]}},{key:"indexOf",value:function(t,e){for(var n=0;n0)&&(e=t[n]);return e}},{key:"extract",value:function(t,e,n){e=xt.clamp(e,0,t.length);var r=(n=xt.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),nr.length)return 1;if(0===n.length)return 0;var i=Zt.compare(n,r);return Zt.isEqualReversed(n,r)?0:i}},{key:"OLDcompare",value:function(t,e){var n=t,r=e;if(n.lengthr.length)return 1;if(0===n.length)return 0;for(var i=Zt.increasingDirection(n),o=Zt.increasingDirection(r),a=i>0?0:n.length-1,s=o>0?0:n.length-1,u=0;u0){var t=new Qt(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e3&&(t=3),t<2&&(t=2),new Kt(arguments[0],t)}if(3===arguments.length){var e=arguments[2],n=arguments[1]-e;return e>1&&(e=1),n>3&&(n=3),n<2&&(n=2),new Kt(arguments[0],n+e,e)}}}},{key:"interfaces_",get:function(){return[wt,k]}}],[{key:"instance",value:function(){return e.instanceObject}}]),e}();te.instanceObject=new te;var ee=function(e){i(a,e);var n=f(a);function a(){var e;return t(this,a),e=n.call(this),a.constructor_.apply(c(e),arguments),e}return r(a,[{key:"copyInternal",value:function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e=0?t:e}}]),e}(),oe=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"readResolve",value:function(){return e.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){this._name=null;var t=arguments[0];this._name=t,e.nameToTypeMap.put(t,this)}}]),e}();oe.nameToTypeMap=new re,ie.Type=oe,ie.FIXED=new oe("FIXED"),ie.FLOATING=new oe("FLOATING"),ie.FLOATING_SINGLE=new oe("FLOATING SINGLE"),ie.maximumPreciseValue=9007199254740992;var ae=function(e){i(a,e);var n=f(a);function a(){var e;return t(this,a),e=n.call(this),a.constructor_.apply(c(e),arguments),e}return r(a,[{key:"copyInternal",value:function(){for(var t=new Array(this._geometries.length).fill(null),e=0;e1){if(u instanceof jt)return this.createMultiPolygon(e.toPolygonArray(t));if(u instanceof Lt)return this.createMultiLineString(e.toLineStringArray(t));if(u instanceof Ct)return this.createMultiPoint(e.toPointArray(t));B.shouldNeverReachHere("Unhandled geometry type: "+u.getGeometryType())}return u}},{key:"createMultiPointFromCoords",value:function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}},{key:"createPoint",value:function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Y){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(ot(arguments[0],ht))return new Ct(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(0===arguments.length)return this.createPolygon(null,null);if(1===arguments.length){if(ot(arguments[0],ht)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Yt){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length)return new jt(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return 0===arguments.length?new Vt(null,this):1===arguments.length?new Vt(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(ot(arguments[0],ht))return new Yt(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return 0===arguments.length?new ee(null,this):1===arguments.length?new ee(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(0===arguments.length)return new Gt(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new Gt(arguments[0],this);if(ot(arguments[0],ht)){var t=arguments[0];if(null===t)return this.createMultiPoint(new Array(0).fill(null));for(var e=new Array(t.size()).fill(null),n=0;n="a"&&t<="z"||t>="A"&&t<="Z"}},{key:"isNumeric_",value:function(t,e){return t>="0"&&t<="9"||"."==t&&!(void 0!==e&&e)}},{key:"isWhiteSpace_",value:function(t){return" "==t||"\t"==t||"\r"==t||"\n"==t}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var t,e=this.nextChar_(),n=this.index_,r=e;if("("==e)t=ye;else if(","==e)t=me;else if(")"==e)t=ve;else if(this.isNumeric_(e)||"-"==e)t=de,r=this.readNumber_();else if(this.isAlpha_(e))t=ge,r=this.readText_();else{if(this.isWhiteSpace_(e))return this.nextToken();if(""!==e)throw new Error("Unexpected character: "+e);t=_e}return{position:n,value:r,type:t}}},{key:"readNumber_",value:function(){var t,e=this.index_,n=!1,r=!1;do{"."==t?n=!0:"e"!=t&&"E"!=t||(r=!0),t=this.nextChar_()}while(this.isNumeric_(t,n)||!r&&("e"==t||"E"==t)||r&&("-"==t||"+"==t));return parseFloat(this.wkt.substring(e,this.index_--))}},{key:"readText_",value:function(){var t,e=this.index_;do{t=this.nextChar_()}while(this.isAlpha_(t));return this.wkt.substring(e,this.index_--).toUpperCase()}}]),e}(),Ee=function(){function e(n,r){t(this,e),this.lexer_=n,this.token_,this.layout_=ue,this.factory=r}return r(e,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(t){return this.token_.type==t}},{key:"match",value:function(t){var e=this.isTokenType(t);return e&&this.consume_(),e}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var t=ue,e=this.token_;if(this.isTokenType(ge)){var n=e.value;"Z"===n?t=le:"M"===n?t=ce:"ZM"===n&&(t=he),t!==ue&&this.consume_()}return t}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(ye)){var t=[];do{t.push(this.parseGeometry_())}while(this.match(me));if(this.match(ve))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(ye)){var t=this.parsePoint_();if(this.match(ve))return t}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(ye)){var t=this.parsePointList_();if(this.match(ve))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(ye)){var t=this.parseLineStringTextList_();if(this.match(ve))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var t;if(this.match(ye)){if(t=this.token_.type==ye?this.parsePointTextList_():this.parsePointList_(),this.match(ve))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(ye)){var t=this.parseLineStringTextList_();if(this.match(ve))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(ye)){var t=this.parsePolygonTextList_();if(this.match(ve))return t}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var t=[],e=this.layout_.length,n=0;n1?t.createPolygon(r[0],r.slice(1)):t.createPolygon(r[0])},r=this.token_;if(this.match(ge)){var i=r.value;if(this.layout_=this.parseGeometryLayout_(),"GEOMETRYCOLLECTION"==i){var o=this.parseGeometryCollectionText_();return t.createGeometryCollection(o)}switch(i){case"POINT":var a=this.parsePointText_();return a?t.createPoint(u(Y,g(a))):t.createPoint();case"LINESTRING":var s=this.parseLineStringText_().map(e);return t.createLineString(s);case"LINEARRING":var l=this.parseLineStringText_().map(e);return t.createLinearRing(l);case"POLYGON":var c=this.parsePolygonText_();return c&&0!==c.length?n(c):t.createPolygon();case"MULTIPOINT":var h=this.parseMultiPointText_();if(!h||0===h.length)return t.createMultiPoint();var f=h.map(e).map((function(e){return t.createPoint(e)}));return t.createMultiPoint(f);case"MULTILINESTRING":var p=this.parseMultiLineStringText_().map((function(n){return t.createLineString(n.map(e))}));return t.createMultiLineString(p);case"MULTIPOLYGON":var y=this.parseMultiPolygonText_();if(!y||0===y.length)return t.createMultiPolygon();var v=y.map(n);return t.createMultiPolygon(v);default:throw new Error("Invalid geometry type: "+i)}}throw new Error(this.formatErrorMessage_())}}]),e}();function we(t){if(t.isEmpty())return"";var e=t.getCoordinate(),n=[e.x,e.y];return void 0===e.z||Number.isNaN(e.z)||n.push(e.z),void 0===e.m||Number.isNaN(e.m)||n.push(e.m),n.join(" ")}function ke(t){for(var e=t.getCoordinates().map((function(t){var e=[t.x,t.y];return void 0===t.z||Number.isNaN(t.z)||e.push(t.z),void 0===t.m||Number.isNaN(t.m)||e.push(t.m),e})),n=[],r=0,i=e.length;r0&&(e+=" "+r),t.isEmpty()?e+" "+pe:e+" ("+n(t)+")"}var Ne=function(){function e(n){t(this,e),this.geometryFactory=n||new se,this.precisionModel=this.geometryFactory.getPrecisionModel()}return r(e,[{key:"read",value:function(t){var e=new xe(t);return new Ee(e,this.geometryFactory).parse()}},{key:"write",value:function(t){return Pe(t)}}]),e}(),Me=function(){function e(n){t(this,e),this.parser=new Ne(n)}return r(e,[{key:"write",value:function(t){return this.parser.write(t)}}],[{key:"toLineString",value:function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"}}]),e}(),Oe=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getIndexAlongSegment",value:function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]}},{key:"getTopologySummary",value:function(){var t=new Qt;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()}},{key:"computeIntersection",value:function(t,e,n,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(t){this._precisionModel=t}},{key:"isInteriorIntersection",value:function(){if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var t=arguments[0],e=0;ei?r:i;else{var a=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);0!==(o=r>i?a:s)||t.equals(e)||(o=Math.max(a,s))}return B.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o}},{key:"nonRobustComputeEdgeDistance",value:function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return B.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o}}]),e}();Oe.DONT_INTERSECT=0,Oe.DO_INTERSECT=1,Oe.COLLINEAR=2,Oe.NO_INTERSECTION=0,Oe.POINT_INTERSECTION=1,Oe.COLLINEAR_INTERSECTION=2;var Le=function(e){i(a,e);var n=f(a);function a(){return t(this,a),n.call(this)}return r(a,[{key:"isInSegmentEnvelopes",value:function(t){var e=new U(this._inputLines[0][0],this._inputLines[0][1]),n=new U(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)}},{key:"computeIntersection",value:function(){if(3!==arguments.length)return p(o(a.prototype),"computeIntersection",this).apply(this,arguments);var t=arguments[0],e=arguments[1],n=arguments[2];if(this._isProper=!1,U.intersects(e,n,t)&&0===ft.index(e,n,t)&&0===ft.index(n,e,t))return this._isProper=!0,(t.equals(e)||t.equals(n))&&(this._isProper=!1),this._result=Oe.POINT_INTERSECTION,null;this._result=Oe.NO_INTERSECTION}},{key:"intersection",value:function(t,e,n,r){var i=this.intersectionSafe(t,e,n,r);return this.isInSegmentEnvelopes(i)||(i=new Y(a.nearestEndpoint(t,e,n,r))),null!==this._precisionModel&&this._precisionModel.makePrecise(i),i}},{key:"checkDD",value:function(t,e,n,r,i){var o=ct.intersection(t,e,n,r),a=this.isInSegmentEnvelopes(o);bt.out.println("DD in env = "+a+" --------------------- "+o),i.distance(o)>1e-4&&bt.out.println("Distance = "+i.distance(o))}},{key:"intersectionSafe",value:function(t,e,n,r){var i=_t.intersection(t,e,n,r);return null===i&&(i=a.nearestEndpoint(t,e,n,r)),i}},{key:"computeCollinearIntersection",value:function(t,e,n,r){var i=U.intersects(t,e,n),o=U.intersects(t,e,r),a=U.intersects(n,r,t),s=U.intersects(n,r,e);return i&&o?(this._intPt[0]=n,this._intPt[1]=r,Oe.COLLINEAR_INTERSECTION):a&&s?(this._intPt[0]=t,this._intPt[1]=e,Oe.COLLINEAR_INTERSECTION):i&&a?(this._intPt[0]=n,this._intPt[1]=t,!n.equals(t)||o||s?Oe.COLLINEAR_INTERSECTION:Oe.POINT_INTERSECTION):i&&s?(this._intPt[0]=n,this._intPt[1]=e,!n.equals(e)||o||a?Oe.COLLINEAR_INTERSECTION:Oe.POINT_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=t,!r.equals(t)||i||s?Oe.COLLINEAR_INTERSECTION:Oe.POINT_INTERSECTION):o&&s?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||i||a?Oe.COLLINEAR_INTERSECTION:Oe.POINT_INTERSECTION):Oe.NO_INTERSECTION}},{key:"computeIntersect",value:function(t,e,n,r){if(this._isProper=!1,!U.intersects(t,e,n,r))return Oe.NO_INTERSECTION;var i=ft.index(t,e,n),o=ft.index(t,e,r);if(i>0&&o>0||i<0&&o<0)return Oe.NO_INTERSECTION;var a=ft.index(n,r,t),s=ft.index(n,r,e);return a>0&&s>0||a<0&&s<0?Oe.NO_INTERSECTION:0===i&&0===o&&0===a&&0===s?this.computeCollinearIntersection(t,e,n,r):(0===i||0===o||0===a||0===s?(this._isProper=!1,t.equals2D(n)||t.equals2D(r)?this._intPt[0]=t:e.equals2D(n)||e.equals2D(r)?this._intPt[0]=e:0===i?this._intPt[0]=new Y(n):0===o?this._intPt[0]=new Y(r):0===a?this._intPt[0]=new Y(t):0===s&&(this._intPt[0]=new Y(e))):(this._isProper=!0,this._intPt[0]=this.intersection(t,e,n,r)),Oe.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(t,e,n,r){var i=t,o=Et.pointToSegment(t,n,r),a=Et.pointToSegment(e,n,r);return ar&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=ft.index(t,e,this._p);if(i===ft.COLLINEAR)return this._isPointOnSegment=!0,null;e.ythis.location.length){var e=new Array(3).fill(null);e[tt.ON]=this.location[tt.ON],e[tt.LEFT]=W.NONE,e[tt.RIGHT]=W.NONE,this.location=e}for(var n=0;n1&&t.append(W.toLocationSymbol(this.location[tt.LEFT])),t.append(W.toLocationSymbol(this.location[tt.ON])),this.location.length>1&&t.append(W.toLocationSymbol(this.location[tt.RIGHT])),t.toString()}},{key:"setLocations",value:function(t,e,n){this.location[tt.ON]=t,this.location[tt.LEFT]=e,this.location[tt.RIGHT]=n}},{key:"get",value:function(t){return t1}},{key:"isAnyNull",value:function(){for(var t=0;tthis._maxNodeDegree&&(this._maxNodeDegree=e),t=this.getNext(t)}while(t!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o=0;s--)this._pts.add(r[s])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)}},{key:"containsPoint",value:function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!Ce.isInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(t))return!1;return!0}},{key:"addHole",value:function(t){this._holes.add(t)}},{key:"isShell",value:function(){return null===this._shell}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],n=arguments[0].getLocation(e,tt.RIGHT);if(n===W.NONE)return null;if(this._label.getLocation(e)===W.NONE)return this._label.setLocation(e,n),null}}},{key:"setShell",value:function(t){this._shell=t,null!==t&&t.addHole(this)}},{key:"toPolygon",value:function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n=2,"found partial label"),this.computeIM(t)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}}}]),e}(),qe=function(e){i(a,e);var n=f(a);function a(){var e;return t(this,a),e=n.call(this),a.constructor_.apply(c(e),arguments),e}return r(a,[{key:"isIncidentEdgeInResult",value:function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();)if(t.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return 1===this._label.getGeometryCount()}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(t){t.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(t){}},{key:"computeMergedLocation",value:function(t,e){var n=W.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==W.BOUNDARY&&(n=r)}return n}},{key:"setLabel",value:function(){if(2!==arguments.length||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return p(o(a.prototype),"setLabel",this).apply(this,arguments);var t=arguments[0],e=arguments[1];null===this._label?this._label=new Ae(t,e):this._label.setLocation(t,e)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof a){var t=arguments[0];this.mergeLabel(t._label)}else if(arguments[0]instanceof Ae)for(var e=arguments[0],n=0;n<2;n++){var r=this.computeMergedLocation(e,n);this._label.getLocation(n)===W.NONE&&this._label.setLocation(n,r)}}},{key:"add",value:function(t){this._edges.insert(t),t.setNode(this)}},{key:"setLabelBoundary",value:function(t){if(null===this._label)return null;var e=W.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;switch(e){case W.BOUNDARY:n=W.INTERIOR;break;case W.INTERIOR:default:n=W.BOUNDARY}this._label.setLocation(t,n)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var t=arguments[0],e=arguments[1];this._coord=t,this._edges=e,this._label=new Ae(0,W.NONE)}}]),a}(Be),Ve=function(e){i(r,e);var n=f(r);function r(){return t(this,r),n.apply(this,arguments)}return r}(ne);function Ge(t){return null==t?0:t.color}function Ye(t){return null==t?null:t.parent}function ze(t,e){null!==t&&(t.color=e)}function Ue(t){return null==t?null:t.left}function Xe(t){return null==t?null:t.right}var We=function(e){i(o,e);var n=f(o);function o(){var e;return t(this,o),(e=n.call(this)).root_=null,e.size_=0,e}return r(o,[{key:"get",value:function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null}},{key:"put",value:function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(r>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var a={key:t,left:null,right:null,value:e,parent:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=a:n.right=a,this.fixAfterInsertion(a),this.size_++,null}},{key:"fixAfterInsertion",value:function(t){var e;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)Ye(t)===Ue(Ye(Ye(t)))?1===Ge(e=Xe(Ye(Ye(t))))?(ze(Ye(t),0),ze(e,0),ze(Ye(Ye(t)),1),t=Ye(Ye(t))):(t===Xe(Ye(t))&&(t=Ye(t),this.rotateLeft(t)),ze(Ye(t),0),ze(Ye(Ye(t)),1),this.rotateRight(Ye(Ye(t)))):1===Ge(e=Ue(Ye(Ye(t))))?(ze(Ye(t),0),ze(e,0),ze(Ye(Ye(t)),1),t=Ye(Ye(t))):(t===Ue(Ye(t))&&(t=Ye(t),this.rotateRight(t)),ze(Ye(t),0),ze(Ye(Ye(t)),1),this.rotateLeft(Ye(Ye(t))));this.root_.color=0}},{key:"values",value:function(){var t=new vt,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=o.successor(e));)t.add(e.value);return t}},{key:"entrySet",value:function(){var t=new Q,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=o.successor(e));)t.add(e);return t}},{key:"rotateLeft",value:function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null==t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}}},{key:"rotateRight",value:function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null==t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}}},{key:"getFirstEntry",value:function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return!0;e=e.right}}return!1}}],[{key:"successor",value:function(t){var e;if(null===t)return null;if(null!==t.right){for(e=t.right;null!==e.left;)e=e.left;return e}e=t.parent;for(var n=t;null!==e&&n===e.right;)n=e,e=e.parent;return e}}]),o}(Ve),He=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"find",value:function(t){return this.nodeMap.get(t)}},{key:"addNode",value:function(){if(arguments[0]instanceof Y){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof qe){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}}},{key:"print",value:function(t){for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(t){for(var e=new vt,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===W.BOUNDARY&&e.add(r)}return e}},{key:"add",value:function(t){var e=t.getCoordinate();this.addNode(e).add(t)}}],[{key:"constructor_",value:function(){this.nodeMap=new We,this.nodeFact=null;var t=arguments[0];this.nodeFact=t}}]),e}(),Ze=function(){function e(){t(this,e)}return r(e,null,[{key:"isNorthern",value:function(t){return t===e.NE||t===e.NW}},{key:"isOpposite",value:function(t,e){return t!==e&&2==(t-e+4)%4}},{key:"commonHalfPlane",value:function(t,e){if(t===e)return t;if(2==(t-e+4)%4)return-1;var n=te?t:e)?3:n}},{key:"isInHalfPlane",value:function(t,n){return n===e.SE?t===e.SE||t===e.SW:t===n||t===n+1}},{key:"quadrant",value:function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],n=arguments[1];if(0===t&&0===n)throw new b("Cannot compute the quadrant for point ( "+t+", "+n+" )");return t>=0?n>=0?e.NE:e.SE:n>=0?e.NW:e.SW}if(arguments[0]instanceof Y&&arguments[1]instanceof Y){var r=arguments[0],i=arguments[1];if(i.x===r.x&&i.y===r.y)throw new b("Cannot compute the quadrant for two identical points "+r);return i.x>=r.x?i.y>=r.y?e.NE:e.SE:i.y>=r.y?e.NW:e.SW}}}]),e}();Ze.NE=0,Ze.NW=1,Ze.SW=2,Ze.SE=3;var Je=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"compareDirection",value:function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant2){o.linkDirectedEdgesForMinimalEdgeRings();var a=o.buildMinimalRings(),s=this.findShell(a);null!==s?(this.placePolygonHoles(s,a),e.add(s)):n.addAll(a)}else r.add(o)}return r}},{key:"buildMaximalEdgeRings",value:function(t){for(var e=new vt,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new Fe(r,this._geometryFactory);e.add(i),i.setInResult()}}return e}},{key:"placePolygonHoles",value:function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return B.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n}},{key:"add",value:function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0],n=arguments[1];Ke.linkResultDirectedEdges(n);var r=this.buildMaximalEdgeRings(e),i=new vt,o=this.buildMinimalEdgeRings(r,this._shellList,i);this.sortShellsAndHoles(o,this._shellList,i),this.placeFreeHoles(this._shellList,i)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new vt;var t=arguments[0];this._geometryFactory=t}},{key:"findEdgeRingContaining",value:function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,a=null,s=e.iterator();s.hasNext();){var u=s.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();if(!c.equals(r)&&c.contains(r)){i=Zt.ptNotInList(n.getCoordinates(),l.getCoordinates());var h=!1;Ce.isInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||a.contains(c))&&(a=(o=u).getLinearRing().getEnvelopeInternal())}}return o}}]),e}(),en=function(){function e(){t(this,e)}return r(e,[{key:"getBounds",value:function(){}}]),e}(),nn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[en,k]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e}}]),e}(),rn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"poll",value:function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(t){for(var e=null,n=this._items.get(t);2*t<=this._size&&((e=2*t)!==this._size&&this._items.get(e+1).compareTo(this._items.get(e))<0&&e++,this._items.get(e).compareTo(n)<0);t=e)this._items.set(t,this._items.get(e));this._items.set(t,n)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return 0===this._size}},{key:"add",value:function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);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)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new vt,this._items.add(null)}}]),e}(),on=function(){function e(){t(this,e)}return r(e,[{key:"insert",value:function(t,e){}},{key:"remove",value:function(t,e){}},{key:"query",value:function(){}}]),e}(),an=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(t){B.isTrue(null===this._bounds),this._childBoundables.add(t)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[en,k]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new vt,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}}}]),e}(),sn={reverseOrder:function(){return{compare:function(t,e){return e.compareTo(t)}}},min:function(t){return sn.sort(t),t.get(0)},sort:function(t,e){var n=t.toArray();e?At.sort(n,e):At.sort(n);for(var r=t.iterator(),i=0,o=n.length;ie.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,t,n),null):(this.expand(this._boundable2,this._boundable1,!0,t,n),null);if(r)return this.expand(this._boundable1,this._boundable2,!1,t,n),null;if(i)return this.expand(this._boundable2,this._boundable1,!0,t,n),null;throw new b("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(e.isComposite(this._boundable1)||e.isComposite(this._boundable2))}},{key:"compareTo",value:function(t){var e=t;return this._distancee._distance?1:0}},{key:"expand",value:function(t,n,r,i,o){for(var a=t.getChildBoundables().iterator();a.hasNext();){var s=a.next(),u=null;(u=r?new e(n,s,this._itemDistance):new e(s,n,this._itemDistance)).getDistance()-2),r.getLevel()===n)return i.add(r),null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var a=o.next();a instanceof an?this.boundablesAtLevel(n,a,i):(B.isTrue(a instanceof nn),-1===n&&i.add(a))}return null}}},{key:"query",value:function(){if(1===arguments.length){var t=arguments[0];this.build();var e=new vt;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.queryInternal(t,this._root,e),e}if(2===arguments.length){var n=arguments[0],r=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,r)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=this.removeItem(r,i);if(o)return!0;for(var a=null,s=r.getChildBoundables().iterator();s.hasNext();){var u=s.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&u instanceof an&&(o=this.remove(n,u,i))){a=u;break}}return null!==a&&a.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(a),o}}},{key:"createHigherLevels",value:function(t,e){B.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)}},{key:"depth",value:function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof an){var r=this.depth(n);r>t&&(t=r)}}return t+1}}},{key:"createParentBoundables",value:function(t,e){B.isTrue(!t.isEmpty());var n=new vt;n.add(this.createNode(e));var r=new vt(t);sn.sort(r,this.getComparator());for(var i=r.iterator();i.hasNext();){var o=i.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(e)),this.lastNode(n).addChildBoundable(o)}return n}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[k]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new vt,this._nodeCapacity=null,0===arguments.length)e.constructor_.call(this,e.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){var t=arguments[0];B.isTrue(t>1,"Node capacity must be greater than 1"),this._nodeCapacity=t}}},{key:"compareDoubles",value:function(t,e){return t>e?1:t0);for(var n=new vt,r=0;r=0;){var u=o.poll(),l=u.getDistance();if(l>=i)break;u.isLeaves()?s.size()l&&(s.poll(),s.add(u)),i=s.peek().getDistance()):u.expandToQueue(o,i)}return a.getItems(s)}}},{key:"createNode",value:function(t){return new gn(t)}},{key:"size",value:function(){return 0===arguments.length?p(o(a.prototype),"size",this).call(this):p(o(a.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(2===arguments.length&&arguments[1]instanceof Object&&arguments[0]instanceof U))return p(o(a.prototype),"insert",this).apply(this,arguments);var t=arguments[0],e=arguments[1];if(t.isNull())return null;p(o(a.prototype),"insert",this).call(this,t,e)}},{key:"getIntersectsOp",value:function(){return a.intersectsOp}},{key:"verticalSlices",value:function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),r=new Array(e).fill(null),i=t.iterator(),o=0;o0;){var a=o.poll(),s=a.getDistance();if(s>=r)break;a.isLeaves()?(r=s,i=a):a.expandToQueue(o,r)}return null===i?null:[i.getBoundable(0).getItem(),i.getBoundable(1).getItem()]}}else{if(2===arguments.length){var u=arguments[0],l=arguments[1];if(this.isEmpty()||u.isEmpty())return null;var c=new ln(this.getRoot(),u.getRoot(),l);return this.nearestNeighbour(c)}if(3===arguments.length){var h=arguments[2],f=new nn(arguments[0],arguments[1]),p=new ln(this.getRoot(),f,h);return this.nearestNeighbour(p)[0]}if(4===arguments.length){var g=arguments[2],y=arguments[3],v=new nn(arguments[0],arguments[1]),d=new ln(this.getRoot(),v,g);return this.nearestNeighbourK(d,y)}}}},{key:"isWithinDistance",value:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=A.POSITIVE_INFINITY,r=new rn;for(r.add(t);!r.isEmpty();){var i=r.poll(),o=i.getDistance();if(o>e)return!1;if(i.maximumDistance()<=e)return!0;if(i.isLeaves()){if((n=o)<=e)return!0}else i.expandToQueue(r,n)}return!1}if(3===arguments.length){var a=arguments[0],s=arguments[1],u=arguments[2],l=new ln(this.getRoot(),a.getRoot(),s);return this.isWithinDistance(l,u)}}},{key:"interfaces_",get:function(){return[on,k]}}],[{key:"constructor_",value:function(){if(0===arguments.length)a.constructor_.call(this,a.DEFAULT_NODE_CAPACITY);else if(1===arguments.length){var t=arguments[0];hn.constructor_.call(this,t)}}},{key:"centreX",value:function(t){return a.avg(t.getMinX(),t.getMaxX())}},{key:"avg",value:function(t,e){return(t+e)/2}},{key:"getItems",value:function(t){for(var e=new Array(t.size()).fill(null),n=0;!t.isEmpty();){var r=t.poll();e[n]=r.getBoundable(0).getItem(),n++}return e}},{key:"centreY",value:function(t){return a.avg(t.getMinY(),t.getMaxY())}}]),a}(hn),gn=function(e){i(o,e);var n=f(o);function o(){var e;return t(this,o),e=n.call(this),o.constructor_.apply(c(e),arguments),e}return r(o,[{key:"computeBounds",value:function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new U(n.getBounds()):t.expandToInclude(n.getBounds())}return t}}],[{key:"constructor_",value:function(){var t=arguments[0];an.constructor_.call(this,t)}}]),o}(an);pn.STRtreeNode=gn,pn.xComparator=new(function(){function e(){t(this,e)}return r(e,[{key:"interfaces_",get:function(){return[D]}},{key:"compare",value:function(t,e){return hn.compareDoubles(pn.centreX(t.getBounds()),pn.centreX(e.getBounds()))}}]),e}()),pn.yComparator=new(function(){function e(){t(this,e)}return r(e,[{key:"interfaces_",get:function(){return[D]}},{key:"compare",value:function(t,e){return hn.compareDoubles(pn.centreY(t.getBounds()),pn.centreY(e.getBounds()))}}]),e}()),pn.intersectsOp=new(function(){function e(){t(this,e)}return r(e,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(t,e){return t.intersects(e)}}]),e}()),pn.DEFAULT_NODE_CAPACITY=10;var yn=function(){function e(){t(this,e)}return r(e,null,[{key:"relativeSign",value:function(t,e){return te?1:0}},{key:"compare",value:function(t,n,r){if(n.equals2D(r))return 0;var i=e.relativeSign(n.x,r.x),o=e.relativeSign(n.y,r.y);switch(t){case 0:return e.compareValue(i,o);case 1:return e.compareValue(o,i);case 2:return e.compareValue(o,-i);case 3:return e.compareValue(-i,o);case 4:return e.compareValue(-i,-o);case 5:return e.compareValue(-o,-i);case 6:return e.compareValue(-o,i);case 7:return e.compareValue(i,-o)}return B.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0}}]),e}(),vn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(t){var e=t;return this.segmentIndexe.segmentIndex?1:this.coord.equals2D(e.coord)?0:this._isInterior?e._isInterior?yn.compare(this._segmentOctant,this.coord,e.coord):1:-1}},{key:"isEndPoint",value:function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[E]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new Y(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))}}]),e}(),dn=function(){function e(){t(this,e)}return r(e,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),e}(),mn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getSplitCoordinates",value:function(){var t=new Ht;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.addEdgeCoordinates(n,r,t),n=r}return t.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var t=new vt;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}}},{key:"createSplitEdgePts",value:function(t,e){var n=e.segmentIndex-t.segmentIndex+2;if(2===n)return[new Y(t.coord),new Y(e.coord)];var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),a=0;o[a++]=new Y(t.coord);for(var s=t.segmentIndex+1;s<=e.segmentIndex;s++)o[a++]=this._edge.getCoordinate(s);return i&&(o[a]=new Y(e.coord)),o}},{key:"print",value:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"findCollapsesFromExistingVertices",value:function(t){for(var e=0;e=0?n>=0?r>=i?0:1:r>=i?7:6:n>=0?r>=i?3:2:r>=i?4:5}if(arguments[0]instanceof Y&&arguments[1]instanceof Y){var o=arguments[0],a=arguments[1],s=a.x-o.x,u=a.y-o.y;if(0===s&&0===u)throw new b("Cannot compute the octant for two identical points "+o);return e.octant(s,u)}}}]),e}(),bn=function(){function e(){t(this,e)}return r(e,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(t){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(t){}},{key:"getData",value:function(){}}]),e}(),xn=function(){function e(){t(this,e)}return r(e,[{key:"addIntersection",value:function(t,e){}},{key:"interfaces_",get:function(){return[bn]}}]),e}(),En=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(t){return this._pts[t]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))}},{key:"setData",value:function(t){this._data=t}},{key:"safeOctant",value:function(t,e){return t.equals2D(e)?0:_n.octant(t,e)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[1],r=arguments[3],i=new Y(arguments[0].getIntersection(r));this.addIntersection(i,n)}}},{key:"toString",value:function(){return Me.toLineString(new Kt(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(t,e){var n=e,r=n+1;if(r=0&&r>=0||n<=0&&r<=0?Math.max(n,r):0}if(arguments[0]instanceof Y){var i=arguments[0];return ft.index(this.p0,this.p1,i)}}},{key:"toGeometry",value:function(t){return t.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(t){if(!(t instanceof e))return!1;var n=t;return this.p0.equals(n.p0)&&this.p1.equals(n.p1)}},{key:"intersection",value:function(t){var e=new Le;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof Y){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new Y(t);var n=this.projectionFactor(t),r=new Y;return r.x=this.p0.x+n*(this.p1.x-this.p0.x),r.y=this.p0.y+n*(this.p1.y-this.p0.y),r}if(arguments[0]instanceof e){var i=arguments[0],o=this.projectionFactor(i.p0),a=this.projectionFactor(i.p1);if(o>=1&&a>=1)return null;if(o<=0&&a<=0)return null;var s=this.project(i.p0);o<0&&(s=this.p0),o>1&&(s=this.p1);var u=this.project(i.p1);return a<0&&(u=this.p0),a>1&&(u=this.p1),new e(s,u)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(t){return 0===t?this.p0:this.p1}},{key:"distancePerpendicular",value:function(t){return Et.pointToLinePerpendicular(t,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return e.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?A.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r}},{key:"closestPoints",value:function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=A.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var a=this.closestPoint(t.p1);(i=a.distance(t.p1))0&&e<1?this.project(t):this.p0.distance(t)1||A.isNaN(e))&&(e=1),e}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(t){var e=this.p1.getY()-this.p0.getY(),n=this.p0.getX()-this.p1.getX(),r=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),i=e*e+n*n,o=e*e-n*n,a=t.getX(),s=t.getY();return new Y((-o*a-2*e*n*s-2*e*r)/i,(o*s-2*e*n*a-2*n*r)/i)}},{key:"distance",value:function(){if(arguments[0]instanceof e){var t=arguments[0];return Et.segmentToSegment(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof Y){var n=arguments[0];return Et.pointToSegment(n,this.p0,this.p1)}}},{key:"pointAlong",value:function(t){var e=new Y;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e}},{key:"hashCode",value:function(){var t=A.doubleToLongBits(this.p0.x);t^=31*A.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=A.doubleToLongBits(this.p1.x);return n^=31*A.doubleToLongBits(this.p1.y),e^Math.trunc(n)^Math.trunc(n>>32)}},{key:"interfaces_",get:function(){return[E,k]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,0===arguments.length)e.constructor_.call(this,new Y,new Y);else if(1===arguments.length){var t=arguments[0];e.constructor_.call(this,t.p0,t.p1)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.p0=n,this.p1=r}else if(4===arguments.length){var i=arguments[0],o=arguments[1],a=arguments[2],s=arguments[3];e.constructor_.call(this,new Y(i,o),new Y(a,s))}}},{key:"midPoint",value:function(t,e){return new Y((t.x+e.x)/2,(t.y+e.y)/2)}}]),e}(),kn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"overlap",value:function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(n,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new wn,this._overlapSeg2=new wn}}]),e}(),Sn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getLineSegment",value:function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]}},{key:"computeSelect",value:function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(n-e==1)return r.select(this,e),null;if(!t.intersects(i,o))return null;var a=Math.trunc((e+n)/2);e=t.length-1)return t.length-1;for(var r=Ze.quadrant(t[n],t[n+1]),i=e+1;in.getId()&&(n.computeOverlaps(i,t),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new vt,this._index=new pn,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,0===arguments.length);else if(1===arguments.length){var t=arguments[0];Nn.constructor_.call(this,t)}}}]),o}(Nn),On=function(e){i(a,e);var n=f(a);function a(){var e;return t(this,a),e=n.call(this),a.constructor_.apply(c(e),arguments),e}return r(a,[{key:"overlap",value:function(){if(4!==arguments.length)return p(o(a.prototype),"overlap",this).apply(this,arguments);var t=arguments[1],e=arguments[2],n=arguments[3],r=arguments[0].getContext(),i=e.getContext();this._si.processIntersections(r,t,i,n)}}],[{key:"constructor_",value:function(){this._si=null;var t=arguments[0];this._si=t}}]),a}(kn);Mn.SegmentOverlapAction=On;var Ln=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"isDeletable",value:function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],a=this._inputLine[n];return!!this.isConcave(i,o,a)&&!!this.isShallow(i,o,a,r)&&this.isShallowSampled(i,o,t,n,r)}},{key:"deleteShallowConcavities",value:function(){for(var t=1,n=this.findNextNonDeletedIndex(t),r=this.findNextNonDeletedIndex(n),i=!1;r=0;r--)this.addPt(t[r])}},{key:"isRedundant",value:function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)Math.PI;)t-=e.PI_TIMES_2;for(;t<=-Math.PI;)t+=e.PI_TIMES_2;return t}},{key:"angle",value:function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}}},{key:"isAcute",value:function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)>0}},{key:"isObtuse",value:function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0}},{key:"interiorAngle",value:function(t,n,r){var i=e.angle(n,t),o=e.angle(n,r);return Math.abs(o-i)}},{key:"normalizePositive",value:function(t){if(t<0){for(;t<0;)t+=e.PI_TIMES_2;t>=e.PI_TIMES_2&&(t=0)}else{for(;t>=e.PI_TIMES_2;)t-=e.PI_TIMES_2;t<0&&(t=0)}return t}},{key:"angleBetween",value:function(t,n,r){var i=e.angle(n,t),o=e.angle(n,r);return e.diff(i,o)}},{key:"diff",value:function(t,e){var n=null;return(n=tMath.PI&&(n=2*Math.PI-n),n}},{key:"toRadians",value:function(t){return t*Math.PI/180}},{key:"getTurn",value:function(t,n){var r=Math.sin(n-t);return r>0?e.COUNTERCLOCKWISE:r<0?e.CLOCKWISE:e.NONE}},{key:"angleBetweenOriented",value:function(t,n,r){var i=e.angle(n,t),o=e.angle(n,r)-i;return o<=-Math.PI?o+e.PI_TIMES_2:o>Math.PI?o-e.PI_TIMES_2:o}}]),e}();Cn.PI_TIMES_2=2*Math.PI,Cn.PI_OVER_2=Math.PI/2,Cn.PI_OVER_4=Math.PI/4,Cn.COUNTERCLOCKWISE=ft.COUNTERCLOCKWISE,Cn.CLOCKWISE=ft.CLOCKWISE,Cn.NONE=ft.COLLINEAR;var Tn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"addNextSegment",value:function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=ft.index(this._s0,this._s1,this._s2),r=n===ft.CLOCKWISE&&this._side===tt.LEFT||n===ft.COUNTERCLOCKWISE&&this._side===tt.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)}},{key:"addLineEndCap",value:function(t,e){var n=new wn(t,e),r=new wn;this.computeOffsetSegment(n,tt.LEFT,this._distance,r);var i=new wn;this.computeOffsetSegment(n,tt.RIGHT,this._distance,i);var o=e.x-t.x,a=e.y-t.y,s=Math.atan2(a,o);switch(this._bufParams.getEndCapStyle()){case m.CAP_ROUND:this._segList.addPt(r.p1),this.addDirectedFillet(e,s+Math.PI/2,s-Math.PI/2,ft.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case m.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case m.CAP_SQUARE:var u=new Y;u.x=Math.abs(this._distance)*Math.cos(s),u.y=Math.abs(this._distance)*Math.sin(s);var l=new Y(r.p1.x+u.x,r.p1.y+u.y),c=new Y(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(t,e,n,r){var i=_t.intersection(e.p0,e.p1,n.p0,n.p1);if(null!==i&&(r<=0?1:i.distance(t)/Math.abs(r))<=this._bufParams.getMitreLimit())return this._segList.addPt(i),null;this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(t,n){if(this._offset0.p1.distance(this._offset1.p0)=c&&(s-=2*Math.PI),this._segList.addPt(e),this.addDirectedFillet(t,s,c,r,i),this._segList.addPt(n)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(t,e,n,r){var i=this._seg0.p1,o=Cn.angle(i,this._seg0.p0),a=Cn.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,s=Cn.normalize(o+a),u=Cn.normalize(s+Math.PI),l=r*n,c=n-l*Math.abs(Math.sin(a)),h=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new Y(h,f),g=new wn(i,p),y=g.pointAlongOffset(1,c),v=g.pointAlongOffset(1,-c);this._side===tt.LEFT?(this._segList.addPt(y),this._segList.addPt(v)):(this._segList.addPt(v),this._segList.addPt(y))}},{key:"addDirectedFillet",value:function(t,e,n,r,i){var o=r===ft.CLOCKWISE?-1:1,a=Math.abs(e-n),s=Math.trunc(a/this._filletAngleQuantum+.5);if(s<1)return null;for(var u=a/s,l=new Y,c=0;c0){var r=new Y((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(r);var i=new Y((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(t){var e=new Y(t.x+this._distance,t.y);this._segList.addPt(e),this.addDirectedFillet(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)}},{key:"init",value:function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Rn,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*e.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===m.JOIN_BEVEL||this._bufParams.getJoinStyle()===m.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,ft.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new wn,this._seg1=new wn,this._offset0=new wn,this._offset1=new wn,this._side=0,this._hasNarrowConcaveAngle=!1;var t=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=t,this._bufParams=n,this._li=new Le,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===m.JOIN_ROUND&&(this._closingSegLengthFactor=e.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)}}]),e}();Tn.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Tn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Tn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Tn.MAX_CLOSING_SEG_LEN_FACTOR=80;var An=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getOffsetCurve",value:function(t,e){if(this._distance=e,0===e)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&Zt.reverse(o),o}},{key:"computeSingleSidedBufferCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Ln.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],tt.LEFT),n.addFirstSegment();for(var a=o-2;a>=0;a--)n.addNextSegment(i[a],!0)}else{n.addSegments(t,!1);var s=Ln.simplify(t,r),u=s.length-1;n.initSideSegments(s[0],s[1],tt.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(s[l],!0)}n.addLastSegment(),n.closeRing()}},{key:"computeRingBufferCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);e===tt.RIGHT&&(r=-r);var i=Ln.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var a=1;a<=o;a++){var s=1!==a;n.addNextSegment(i[a],s)}n.closeRing()}},{key:"computeLineBufferCurve",value:function(t,e){var n=this.simplifyTolerance(this._distance),r=Ln.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],tt.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var a=Ln.simplify(t,-n),s=a.length-1;e.initSideSegments(a[s],a[s-1],tt.LEFT);for(var u=s-2;u>=0;u--)e.addNextSegment(a[u],!0);e.addLastSegment(),e.addLineEndCap(a[1],a[0]),e.closeRing()}},{key:"computePointCurve",value:function(t,e){switch(this._bufParams.getEndCapStyle()){case m.CAP_ROUND:e.createCircle(t);break;case m.CAP_SQUARE:e.createSquare(t)}}},{key:"getLineCurve",value:function(t,e){if(this._distance=e,this.isLineOffsetEmpty(e))return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(t){return t*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(t,n,r){if(this._distance=r,t.length<=2)return this.getLineCurve(t,r);if(0===r)return e.copyCoordinates(t);var i=this.getSegGen(r);return this.computeRingBufferCurve(t,n,i),i.getCoordinates()}},{key:"computeOffsetCurve",value:function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Ln.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],tt.LEFT),n.addFirstSegment();for(var a=o-2;a>=0;a--)n.addNextSegment(i[a],!0)}else{var s=Ln.simplify(t,r),u=s.length-1;n.initSideSegments(s[0],s[1],tt.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(s[l],!0)}n.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(t){return 0===t||t<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(t){return new Tn(this._precisionModel,this._bufParams,t)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e}},{key:"copyCoordinates",value:function(t){for(var e=new Array(t.length).fill(null),n=0;ni.getMaxY()||this.findStabbedSegments(t,r.getDirectedEdges(),e)}return e}if(3===arguments.length)if(ot(arguments[2],rt)&&arguments[0]instanceof Y&&arguments[1]instanceof $e){for(var o=arguments[0],a=arguments[1],s=arguments[2],u=a.getEdge().getCoordinates(),l=0;lthis._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)this._seg.p1.y||ft.index(this._seg.p0,this._seg.p1,o)===ft.RIGHT)){var c=a.getDepth(tt.LEFT);this._seg.p0.equals(u[l])||(c=a.getDepth(tt.RIGHT));var h=new jn(this._seg,c);s.add(h)}}else if(ot(arguments[2],rt)&&arguments[0]instanceof Y&&ot(arguments[1],rt))for(var f=arguments[0],p=arguments[2],g=arguments[1].iterator();g.hasNext();){var y=g.next();y.isForward()&&this.findStabbedSegments(f,y,p)}}},{key:"getDepth",value:function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:sn.min(e)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new wn;var t=arguments[0];this._subgraphs=t}}]),e}(),jn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"compareTo",value:function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n||0!=(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)}},{key:"compareX",value:function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[E]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new wn(t),this._leftDepth=e}}]),e}();Dn.DepthSegment=jn;var Fn=function(e){i(o,e);var n=f(o);function o(){var e;return t(this,o),e=n.call(this),o.constructor_.apply(c(e),arguments),e}return r(o,null,[{key:"constructor_",value:function(){_.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),o}(_),Bn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"getY",value:function(){var t=this.y/this.w;if(A.isNaN(t)||A.isInfinite(t))throw new Fn;return t}},{key:"getX",value:function(){var t=this.x/this.w;if(A.isNaN(t)||A.isInfinite(t))throw new Fn;return t}},{key:"getCoordinate",value:function(){var t=new Y;return t.x=this.getX(),t.y=this.getY(),t}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var t=arguments[0];this.x=t.x,this.y=t.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1];this.x=n,this.y=r,this.w=1}else if(arguments[0]instanceof e&&arguments[1]instanceof e){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof Y&&arguments[1]instanceof Y){var a=arguments[0],s=arguments[1];this.x=a.y-s.y,this.y=s.x-a.x,this.w=a.x*s.y-s.x*a.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(4===arguments.length){var h=arguments[0],f=arguments[1],p=arguments[2],g=arguments[3],y=h.y-f.y,v=f.x-h.x,d=h.x*f.y-f.x*h.y,m=p.y-g.y,_=g.x-p.x,b=p.x*g.y-g.x*p.y;this.x=v*b-_*d,this.y=m*d-y*b,this.w=y*_-m*v}}}]),e}(),qn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"area",value:function(){return e.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return e.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(t){if(null===t)throw new b("Supplied point is null.");return e.interpolateZ(t,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return e.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return e.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return e.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return e.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return e.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return e.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.p0=t,this.p1=e,this.p2=n}},{key:"area",value:function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)}},{key:"signedArea",value:function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2}},{key:"det",value:function(t,e,n,r){return t*r-e*n}},{key:"interpolateZ",value:function(t,e,n,r){var i=e.x,o=e.y,a=n.x-i,s=r.x-i,u=n.y-o,l=r.y-o,c=a*l-s*u,h=t.x-i,f=t.y-o,p=(l*h-s*f)/c,g=(-u*h+a*f)/c;return e.getZ()+p*(n.getZ()-e.getZ())+g*(r.getZ()-e.getZ())}},{key:"longestSideLength",value:function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),a=r;return i>a&&(a=i),o>a&&(a=o),a}},{key:"circumcentreDD",value:function(t,e,n){var r=lt.valueOf(t.x).subtract(n.x),i=lt.valueOf(t.y).subtract(n.y),o=lt.valueOf(e.x).subtract(n.x),a=lt.valueOf(e.y).subtract(n.y),s=lt.determinant(r,i,o,a).multiply(2),u=r.sqr().add(i.sqr()),l=o.sqr().add(a.sqr()),c=lt.determinant(i,u,a,l),h=lt.determinant(r,u,o,l),f=lt.valueOf(n.x).subtract(c.divide(s)).doubleValue(),p=lt.valueOf(n.y).add(h.divide(s)).doubleValue();return new Y(f,p)}},{key:"isAcute",value:function(t,e,n){return!!Cn.isAcute(t,e,n)&&!!Cn.isAcute(e,n,t)&&!!Cn.isAcute(n,t,e)}},{key:"circumcentre",value:function(t,n,r){var i=r.x,o=r.y,a=t.x-i,s=t.y-o,u=n.x-i,l=n.y-o,c=2*e.det(a,s,u,l),h=e.det(s,a*a+s*s,l,u*u+l*l),f=e.det(a,a*a+s*s,u,u*u+l*l);return new Y(i-h/c,o+f/c)}},{key:"perpendicularBisector",value:function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new Bn(t.x+n/2,t.y+r/2,1),o=new Bn(t.x-r+n/2,t.y+n+r/2,1);return new Bn(i,o)}},{key:"angleBisector",value:function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,a=n.y-t.y;return new Y(t.x+i*o,t.y+i*a)}},{key:"area3D",value:function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.getZ()-t.getZ(),a=n.x-t.x,s=n.y-t.y,u=n.getZ()-t.getZ(),l=i*u-o*s,c=o*a-r*u,h=r*s-i*a,f=l*l+c*c+h*h;return Math.sqrt(f)/2}},{key:"centroid",value:function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new Y(r,i)}},{key:"inCentre",value:function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),a=r+i+o,s=(r*t.x+i*e.x+o*n.x)/a,u=(r*t.y+i*e.y+o*n.y)/a;return new Y(s,u)}}]),e}(),Vn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"addRingSide",value:function(t,e,n,r,i){if(0===e&&t.length=Yt.MINIMUM_VALID_SIZE&&ft.isCCW(t)&&(o=i,a=r,n=tt.opposite(n));var s=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(s,o,a)}},{key:"addRingBothSides",value:function(t,e){this.addRingSide(t,e,tt.LEFT,W.EXTERIOR,W.INTERIOR),this.addRingSide(t,e,tt.RIGHT,W.INTERIOR,W.EXTERIOR)}},{key:"addPoint",value:function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,W.EXTERIOR,W.INTERIOR)}},{key:"addPolygon",value:function(t){var e=this._distance,n=tt.LEFT;this._distance<0&&(e=-this._distance,n=tt.RIGHT);var r=t.getExteriorRing(),i=Zt.removeRepeatedPoints(r.getCoordinates());if(this._distance<0&&this.isErodedCompletely(r,this._distance))return null;if(this._distance<=0&&i.length<3)return null;this.addRingSide(i,e,n,W.EXTERIOR,W.INTERIOR);for(var o=0;o0&&this.isErodedCompletely(a,-this._distance)||this.addRingSide(s,e,tt.opposite(n),W.INTERIOR,W.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(t,e){var n=new qn(t[0],t[1],t[2]),r=n.inCentre();return Et.pointToSegment(r,n.p0,n.p1)i}},{key:"addCollection",value:function(t){for(var e=0;e=this._max)throw new Z;var t=this._parent.getGeometryN(this._index++);return t instanceof Vt?(this._subcollectionIterator=new e(t),this._subcollectionIterator.next()):t}},{key:"remove",value:function(){throw new J(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[dn]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()}},{key:"isAtomic",value:function(t){return!(t instanceof Vt)}}]),e}(),zn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"locate",value:function(t){return e.locate(t,this._geom)}},{key:"interfaces_",get:function(){return[Gn]}}],[{key:"constructor_",value:function(){this._geom=null;var t=arguments[0];this._geom=t}},{key:"locatePointInPolygon",value:function(t,n){if(n.isEmpty())return W.EXTERIOR;var r=n.getExteriorRing(),i=e.locatePointInRing(t,r);if(i!==W.INTERIOR)return i;for(var o=0;o=0;n--){var r=this._edgeList.get(n),i=r.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=r}e.setNext(t)}},{key:"computeDepths",value:function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(tt.LEFT),r=t.getDepth(tt.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new gt("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],a=arguments[2],s=arguments[0];s=0;i--){var o=this._resultAreaEdgeList.get(i),a=o.getSym();switch(null===e&&o.getEdgeRing()===t&&(e=o),r){case this._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;n=a,r=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(o.getEdgeRing()!==t)continue;n.setNextMin(o),r=this._SCANNING_FOR_INCOMING}}r===this._LINKING_TO_OUTGOING&&(B.isTrue(null!==e,"found null for first outgoing dirEdge"),B.isTrue(e.getEdgeRing()===t,"unable to link last incoming dirEdge"),n.setNextMin(e))}},{key:"getOutgoingDegree",value:function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();)e.next().isInResult()&&t++;return t}if(1===arguments.length){for(var n=arguments[0],r=0,i=this.iterator();i.hasNext();)i.next().getEdgeRing()===n&&r++;return r}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var t=W.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=W.INTERIOR;break}if(r.isInResult()){t=W.EXTERIOR;break}}}if(t===W.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var a=o.next(),s=a.getSym();a.isLineEdge()?a.getEdge().setCovered(i===W.INTERIOR):(a.isInResult()&&(i=W.EXTERIOR),s.isInResult()&&(i=W.INTERIOR))}}},{key:"computeLabelling",value:function(t){p(o(a.prototype),"computeLabelling",this).call(this,t),this._label=new Ae(W.NONE);for(var e=this.iterator();e.hasNext();)for(var n=e.next().getEdge().getLabel(),r=0;r<2;r++){var i=n.getLocation(r);i!==W.INTERIOR&&i!==W.BOUNDARY||this._label.setLocation(r,W.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),a}(Un),Wn=function(e){i(o,e);var n=f(o);function o(){return t(this,o),n.call(this)}return r(o,[{key:"createNode",value:function(t){return new qe(t,new Xn)}}]),o}(Qe),Hn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"compareTo",value:function(t){var n=t;return e.compareOriented(this._pts,this._orientation,n._pts,n._orientation)}},{key:"interfaces_",get:function(){return[E]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var t=arguments[0];this._pts=t,this._orientation=e.orientation(t)}},{key:"orientation",value:function(t){return 1===Zt.increasingDirection(t)}},{key:"compareOriented",value:function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,a=e?t.length:-1,s=r?n.length:-1,u=e?0:t.length-1,l=r?0:n.length-1;;){var c=t[u].compareTo(n[l]);if(0!==c)return c;var h=(u+=i)===a,f=(l+=o)===s;if(h&&!f)return-1;if(!h&&f)return 1;if(h&&f)return 0}}}]),e}(),Zn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"print",value:function(t){t.print("MULTILINESTRING ( ");for(var e=0;e0&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i0&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")}},{key:"addAll",value:function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())}},{key:"findEdgeIndex",value:function(t){for(var e=0;et?1:this.diste?1:0}},{key:"interfaces_",get:function(){return[E]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new Y(t),this.segmentIndex=e,this.dist=n}}]),e}(),Kn=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"print",value:function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();)e.next().print(t)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}}},{key:"addEndpoints",value:function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)}},{key:"createSplitEdge",value:function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),a=0;o[a++]=new Y(t.coord);for(var s=t.segmentIndex+1;s<=e.segmentIndex;s++)o[a++]=this.edge.pts[s];return i&&(o[a]=e.coord),new or(o,new Ae(this.edge._label))}},{key:"add",value:function(t,e,n){var r=new Qn(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)}},{key:"isIntersection",value:function(t){for(var e=this.iterator();e.hasNext();)if(e.next().coord.equals(t))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new We,this.edge=null;var t=arguments[0];this.edge=t}}]),e}(),tr=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(e.isTrue(this._matrix[W.INTERIOR][W.INTERIOR])||e.isTrue(this._matrix[W.INTERIOR][W.BOUNDARY])||e.isTrue(this._matrix[W.BOUNDARY][W.INTERIOR])||e.isTrue(this._matrix[W.BOUNDARY][W.BOUNDARY]))&&this._matrix[W.EXTERIOR][W.INTERIOR]===Nt.FALSE&&this._matrix[W.EXTERIOR][W.BOUNDARY]===Nt.FALSE}},{key:"isCoveredBy",value:function(){return(e.isTrue(this._matrix[W.INTERIOR][W.INTERIOR])||e.isTrue(this._matrix[W.INTERIOR][W.BOUNDARY])||e.isTrue(this._matrix[W.BOUNDARY][W.INTERIOR])||e.isTrue(this._matrix[W.BOUNDARY][W.BOUNDARY]))&&this._matrix[W.INTERIOR][W.EXTERIOR]===Nt.FALSE&&this._matrix[W.BOUNDARY][W.EXTERIOR]===Nt.FALSE}},{key:"set",value:function(){if(1===arguments.length)for(var t=arguments[0],e=0;e=0&&e>=0&&this.setAtLeast(t,e,n)}},{key:"isWithin",value:function(){return e.isTrue(this._matrix[W.INTERIOR][W.INTERIOR])&&this._matrix[W.INTERIOR][W.EXTERIOR]===Nt.FALSE&&this._matrix[W.BOUNDARY][W.EXTERIOR]===Nt.FALSE}},{key:"isTouches",value:function(t,n){return t>n?this.isTouches(n,t):(t===Nt.A&&n===Nt.A||t===Nt.L&&n===Nt.L||t===Nt.L&&n===Nt.A||t===Nt.P&&n===Nt.A||t===Nt.P&&n===Nt.L)&&this._matrix[W.INTERIOR][W.INTERIOR]===Nt.FALSE&&(e.isTrue(this._matrix[W.INTERIOR][W.BOUNDARY])||e.isTrue(this._matrix[W.BOUNDARY][W.INTERIOR])||e.isTrue(this._matrix[W.BOUNDARY][W.BOUNDARY]))}},{key:"isOverlaps",value:function(t,n){return t===Nt.P&&n===Nt.P||t===Nt.A&&n===Nt.A?e.isTrue(this._matrix[W.INTERIOR][W.INTERIOR])&&e.isTrue(this._matrix[W.INTERIOR][W.EXTERIOR])&&e.isTrue(this._matrix[W.EXTERIOR][W.INTERIOR]):t===Nt.L&&n===Nt.L&&1===this._matrix[W.INTERIOR][W.INTERIOR]&&e.isTrue(this._matrix[W.INTERIOR][W.EXTERIOR])&&e.isTrue(this._matrix[W.EXTERIOR][W.INTERIOR])}},{key:"isEquals",value:function(t,n){return t===n&&e.isTrue(this._matrix[W.INTERIOR][W.INTERIOR])&&this._matrix[W.INTERIOR][W.EXTERIOR]===Nt.FALSE&&this._matrix[W.BOUNDARY][W.EXTERIOR]===Nt.FALSE&&this._matrix[W.EXTERIOR][W.INTERIOR]===Nt.FALSE&&this._matrix[W.EXTERIOR][W.BOUNDARY]===Nt.FALSE}},{key:"toString",value:function(){for(var t=new Qt("123456789"),e=0;e<3;e++)for(var n=0;n<3;n++)t.setCharAt(3*e+n,Nt.toDimensionSymbol(this._matrix[e][n]));return t.toString()}},{key:"setAll",value:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this._matrix[e][n]=t}},{key:"get",value:function(t,e){return this._matrix[t][e]}},{key:"transpose",value:function(){var t=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=t,t=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=t,t=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=t,this}},{key:"matches",value:function(t){if(9!==t.length)throw new b("Should be length 9: "+t);for(var n=0;n<3;n++)for(var r=0;r<3;r++)if(!e.matches(this._matrix[n][r],t.charAt(3*n+r)))return!1;return!0}},{key:"add",value:function(t){for(var e=0;e<3;e++)for(var n=0;n<3;n++)this.setAtLeast(e,n,t.get(e,n))}},{key:"isDisjoint",value:function(){return this._matrix[W.INTERIOR][W.INTERIOR]===Nt.FALSE&&this._matrix[W.INTERIOR][W.BOUNDARY]===Nt.FALSE&&this._matrix[W.BOUNDARY][W.INTERIOR]===Nt.FALSE&&this._matrix[W.BOUNDARY][W.BOUNDARY]===Nt.FALSE}},{key:"isCrosses",value:function(t,n){return t===Nt.P&&n===Nt.L||t===Nt.P&&n===Nt.A||t===Nt.L&&n===Nt.A?e.isTrue(this._matrix[W.INTERIOR][W.INTERIOR])&&e.isTrue(this._matrix[W.INTERIOR][W.EXTERIOR]):t===Nt.L&&n===Nt.P||t===Nt.A&&n===Nt.P||t===Nt.A&&n===Nt.L?e.isTrue(this._matrix[W.INTERIOR][W.INTERIOR])&&e.isTrue(this._matrix[W.EXTERIOR][W.INTERIOR]):t===Nt.L&&n===Nt.L&&0===this._matrix[W.INTERIOR][W.INTERIOR]}},{key:"interfaces_",get:function(){return[w]}}],[{key:"constructor_",value:function(){if(this._matrix=null,0===arguments.length)this._matrix=Array(3).fill().map((function(){return Array(3)})),this.setAll(Nt.FALSE);else if(1===arguments.length)if("string"==typeof arguments[0]){var t=arguments[0];e.constructor_.call(this),this.set(t)}else if(arguments[0]instanceof e){var n=arguments[0];e.constructor_.call(this),this._matrix[W.INTERIOR][W.INTERIOR]=n._matrix[W.INTERIOR][W.INTERIOR],this._matrix[W.INTERIOR][W.BOUNDARY]=n._matrix[W.INTERIOR][W.BOUNDARY],this._matrix[W.INTERIOR][W.EXTERIOR]=n._matrix[W.INTERIOR][W.EXTERIOR],this._matrix[W.BOUNDARY][W.INTERIOR]=n._matrix[W.BOUNDARY][W.INTERIOR],this._matrix[W.BOUNDARY][W.BOUNDARY]=n._matrix[W.BOUNDARY][W.BOUNDARY],this._matrix[W.BOUNDARY][W.EXTERIOR]=n._matrix[W.BOUNDARY][W.EXTERIOR],this._matrix[W.EXTERIOR][W.INTERIOR]=n._matrix[W.EXTERIOR][W.INTERIOR],this._matrix[W.EXTERIOR][W.BOUNDARY]=n._matrix[W.EXTERIOR][W.BOUNDARY],this._matrix[W.EXTERIOR][W.EXTERIOR]=n._matrix[W.EXTERIOR][W.EXTERIOR]}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&"string"==typeof arguments[1]){var t=arguments[0],n=arguments[1];return n===Nt.SYM_DONTCARE||n===Nt.SYM_TRUE&&(t>=0||t===Nt.TRUE)||n===Nt.SYM_FALSE&&t===Nt.FALSE||n===Nt.SYM_P&&t===Nt.P||n===Nt.SYM_L&&t===Nt.L||n===Nt.SYM_A&&t===Nt.A}if("string"==typeof arguments[0]&&"string"==typeof arguments[1]){var r=arguments[1];return new e(arguments[0]).matches(r)}}},{key:"isTrue",value:function(t){return t>=0||t===Nt.TRUE}}]),e}(),er=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(t){return null===t||0===t.length?null:(this.ensureCapacity(this._size+t.length),bt.arraycopy(t,0,this._data,this._size,t.length),void(this._size+=t.length))}},{key:"ensureCapacity",value:function(t){if(t<=this._data.length)return null;var e=Math.max(t,2*this._data.length);this._data=At.copyOf(this._data,e)}},{key:"toArray",value:function(){var t=new Array(this._size).fill(null);return bt.arraycopy(this._data,0,t,0,this._size),t}},{key:"add",value:function(t){this.ensureCapacity(this._size+1),this._data[this._size]=t,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,0===arguments.length)e.constructor_.call(this,10);else if(1===arguments.length){var t=arguments[0];this._data=new Array(t).fill(null)}}}]),e}(),nr=function(){function e(){t(this,e)}return r(e,[{key:"getChainStartIndices",value:function(t){var e=0,n=new er(Math.trunc(t.length/2));n.add(e);do{var r=this.findChainEnd(t,e);n.add(r),e=r}while(en?e:n}},{key:"getMinX",value:function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return ee&&(r=1),this._depth[t][n]=r}}}},{key:"getDelta",value:function(t){return this._depth[t][tt.RIGHT]-this._depth[t][tt.LEFT]}},{key:"getLocation",value:function(t,e){return this._depth[t][e]<=0?W.EXTERIOR:W.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(1===arguments.length)for(var t=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=t.getLocation(n,r);i!==W.EXTERIOR&&i!==W.INTERIOR||(this.isNull(n,r)?this._depth[n][r]=e.depthAtLocation(i):this._depth[n][r]+=e.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],a=arguments[1];arguments[2]===W.INTERIOR&&this._depth[o][a]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var t=0;t<2;t++)for(var n=0;n<3;n++)this._depth[t][n]=e.NULL_VALUE}},{key:"depthAtLocation",value:function(t){return t===W.EXTERIOR?0:t===W.INTERIOR?1:e.NULL_VALUE}}]),e}();ir.NULL_VALUE=-1;var or=function(e){i(a,e);var n=f(a);function a(){var e;return t(this,a),e=n.call(this),a.constructor_.apply(c(e),arguments),e}return r(a,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new a(t,Ae.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(t){this._isIsolated=t}},{key:"setName",value:function(t){this._name=t}},{key:"equals",value:function(t){if(!(t instanceof a))return!1;var e=t;if(this.pts.length!==e.pts.length)return!1;for(var n=!0,r=!0,i=this.pts.length,o=0;o0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}}},{key:"print",value:function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(t){a.updateIM(this._label,t)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&3===this.pts.length&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")}},{key:"getMonotoneChainEdge",value:function(){return null===this._mce&&(this._mce=new rr(this)),this._mce}},{key:"getEnvelope",value:function(){if(null===this._env){this._env=new U;for(var t=0;t0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()}},{key:"isPointwiseEqual",value:function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;er||this._maxyo;if(a)return!1;var s=this.intersectsToleranceSquare(t,e);return B.isTrue(!(a&&s),"Found bad envelope test"),s}},{key:"initCorners",value:function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new Y(this._maxx,this._maxy),this._corner[1]=new Y(this._minx,this._maxy),this._corner[2]=new Y(this._minx,this._miny),this._corner[3]=new Y(this._maxx,this._miny)}},{key:"intersects",value:function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(t){return Math.round(t*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)}},{key:"getSafeEnvelope",value:function(){if(null===this._safeEnv){var t=e.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new U(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.hasIntersection()))))}},{key:"intersectsToleranceSquare",value:function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!(this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),this._li.isProper()||n&&r||t.equals(this._pt)||e.equals(this._pt)))))}},{key:"addSnappedNode",value:function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new b("Scale factor must be non-zero");1!==e&&(this._pt=new Y(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new Y,this._p1Scaled=new Y),this.initCorners(this._pt)}}]),e}();lr.SAFE_ENV_EXPANSION_FACTOR=.75;var cr=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"select",value:function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}}}],[{key:"constructor_",value:function(){this.selectedSegment=new wn}}]),e}(),hr=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"snap",value:function(){if(1===arguments.length){var e=arguments[0];return this.snap(e,null,-1)}if(3===arguments.length){var n=arguments[0],i=arguments[1],o=arguments[2],a=n.getSafeEnvelope(),s=new fr(n,i,o);return this._index.query(a,new(function(){function e(){t(this,e)}return r(e,[{key:"interfaces_",get:function(){return[cn]}},{key:"visitItem",value:function(t){t.select(a,s)}}]),e}())),s.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var t=arguments[0];this._index=t}}]),e}(),fr=function(e){i(a,e);var n=f(a);function a(){var e;return t(this,a),e=n.call(this),a.constructor_.apply(c(e),arguments),e}return r(a,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(2===arguments.length&&Number.isInteger(arguments[1])&&arguments[0]instanceof Sn))return p(o(a.prototype),"select",this).apply(this,arguments);var 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)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._hotPixel=t,this._parentEdge=e,this._hotPixelVertexIndex=n}}]),a}(cr);hr.HotPixelSnapAction=fr;var pr=function(){function e(){t(this,e),e.constructor_.apply(this,arguments)}return r(e,[{key:"processIntersections",value:function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],a=n.getCoordinates()[r],s=n.getCoordinates()[r+1];if(this._li.computeIntersection(i,o,a,s),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u=0;t--){try{this.bufferReducedPrecision(t)}catch(t){if(!(t instanceof gt))throw t;this._saveException=t}if(null!==this._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=e.precisionScaleFactor(this._argGeom,this._distance,n),i=new ie(r);this.bufferFixedPrecision(i)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===ie.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(t){this._bufParams.setQuadrantSegments(t)}},{key:"bufferOriginalPrecision",value:function(){try{var t=new ar(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof j))throw t;this._saveException=t}}},{key:"getResultGeometry",value:function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(t){this._bufParams.setEndCapStyle(t)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new m,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}}},{key:"bufferOp",value:function(){if(2===arguments.length){var t=arguments[1];return new e(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof X&&"number"==typeof arguments[1]){var n=arguments[1],r=arguments[2],i=new e(arguments[0]);return i.setQuadrantSegments(r),i.getResultGeometry(n)}if(arguments[2]instanceof m&&arguments[0]instanceof X&&"number"==typeof arguments[1]){var o=arguments[1];return new e(arguments[0],arguments[2]).getResultGeometry(o)}}else if(4===arguments.length){var a=arguments[1],s=arguments[2],u=arguments[3],l=new e(arguments[0]);return l.setQuadrantSegments(s),l.setEndCapStyle(u),l.getResultGeometry(a)}}},{key:"precisionScaleFactor",value:function(t,e,n){var r=t.getEnvelopeInternal(),i=xt.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)}}]),e}();yr.CAP_ROUND=m.CAP_ROUND,yr.CAP_BUTT=m.CAP_FLAT,yr.CAP_FLAT=m.CAP_FLAT,yr.CAP_SQUARE=m.CAP_SQUARE,yr.MAX_PRECISION_DIGITS=12;var vr=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],dr=function(){function e(n){t(this,e),this.geometryFactory=n||new se}return r(e,[{key:"read",value:function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!mr[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==vr.indexOf(n)?mr[n].call(this,e.coordinates):"GeometryCollection"===n?mr[n].call(this,e.geometries):mr[n].call(this,e)}},{key:"write",value:function(t){var e=t.getGeometryType();if(!_r[e])throw new Error("Geometry is not supported");return _r[e].call(this,t)}}]),e}(),mr={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!mr[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=mr.bbox.call(this,t.bbox)),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n1?0:t<-1?vp:Math.acos(t)}function Mp(t){return t>1?dp:t<-1?-dp:Math.asin(t)}function Op(){}function Lp(t,e){t&&Ap.hasOwnProperty(t.type)&&Ap[t.type](t,e)}var Rp,Cp,Tp={Feature:function(t,e){Lp(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++rvp?t-_p:t<-vp?t+_p:t,e]}function Wp(t){return function(e,n){return[(e+=t)>vp?e-_p:e<-vp?e+_p:e,n]}}function Hp(t){var e=Wp(t);return e.invert=Wp(-t),e}function Zp(t,e){var n=Sp(t),r=Ip(t),i=Sp(e),o=Ip(e);function a(t,e){var a=Sp(e),s=Sp(t)*a,u=Ip(t)*a,l=Ip(e),c=l*n+s*r;return[kp(u*i-c*o,s*n-l*r),Mp(c*i+u*o)]}return a.invert=function(t,e){var a=Sp(e),s=Sp(t)*a,u=Ip(t)*a,l=Ip(e),c=l*i-u*o;return[kp(u*i+l*o,s*n+c*r),Mp(c*n-s*r)]},a}function Jp(t,e){(e=Bp(e))[0]-=t,zp(e);var n=Np(-e[1]);return((-e[2]<0?-n:n)+_p-yp)%_p}function $p(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:Op,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Qp(t,e){return Ep(t[0]-e[0])=0;--o)i.point((c=l[o])[0],c[1]);else r(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function eg(t){if(e=t.length){for(var e,n,r=0,i=t[0];++re?1:t>=e?0:NaN}function rg(t){for(var e,n,r,i=t.length,o=-1,a=0;++o=0;)for(e=(r=t[i]).length;--e>=0;)n[--a]=r[e];return n}hp(),hp(),hp(),Xp.invert=Xp,1===(Rp=ng).length&&(Cp=Rp,Rp=function(t,e){return ng(Cp(t),e)});var ig=1e9,og=-ig;function ag(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,s,l){var c=0,h=0;if(null==i||(c=a(i,s))!==(h=a(o,s))||u(i,o)<0^s>0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+s+4)%4)!==h);else l.point(o[0],o[1])}function a(r,i){return Ep(r[0]-t)0?0:3:Ep(r[0]-n)0?2:1:Ep(r[1]-e)0?1:0:i>0?3:2}function s(t,e){return u(t.x,e.x)}function u(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var u,l,c,h,f,p,g,y,v,d,m,_=a,b=$p(),x={point:E,lineStart:function(){x.point=w,l&&l.push(c=[]);d=!0,v=!1,g=y=NaN},lineEnd:function(){u&&(w(h,f),p&&v&&b.rejoin(),u.push(b.result()));x.point=E,v&&_.lineEnd()},polygonStart:function(){_=b,u=[],l=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;nr&&(f-o)*(r-a)>(p-a)*(t-o)&&++e:p<=r&&(f-o)*(r-a)<(p-a)*(t-o)&&--e;return e}(),n=m&&e,i=(u=rg(u)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&tg(u,s,e,o,a),a.polygonEnd());_=a,u=l=c=null}};function E(t,e){i(t,e)&&_.point(t,e)}function w(o,a){var s=i(o,a);if(l&&c.push([o,a]),d)h=o,f=a,p=s,d=!1,s&&(_.lineStart(),_.point(o,a));else if(s&&v)_.point(o,a);else{var u=[g=Math.max(og,Math.min(ig,g)),y=Math.max(og,Math.min(ig,y))],b=[o=Math.max(og,Math.min(ig,o)),a=Math.max(og,Math.min(ig,a))];!function(t,e,n,r,i,o){var a,s=t[0],u=t[1],l=0,c=1,h=e[0]-s,f=e[1]-u;if(a=n-s,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=i-s,h||!(a<0)){if(a/=h,h<0){if(a>c)return;a>l&&(l=a)}else if(h>0){if(a0)){if(a/=f,f<0){if(a0){if(a>c)return;a>l&&(l=a)}if(a=o-u,f||!(a<0)){if(a/=f,f<0){if(a>c)return;a>l&&(l=a)}else if(f>0){if(a0&&(t[0]=s+l*h,t[1]=u+l*f),c<1&&(e[0]=s+c*h,e[1]=u+c*f),!0}}}}}(u,b,t,e,n,r)?s&&(_.lineStart(),_.point(o,a),m=!1):(v||(_.lineStart(),_.point(u[0],u[1])),_.point(b[0],b[1]),s||_.lineEnd(),m=!1)}g=o,y=a,v=s}return x}}var sg=hp();function ug(t){return t}hp(),hp(),hp();var lg=1/0,cg=lg,hg=-lg,fg=hg,pg={point:function(t,e){thg&&(hg=t);efg&&(fg=e)},lineStart:Op,lineEnd:Op,polygonStart:Op,polygonEnd:Op,result:function(){var t=[[lg,cg],[hg,fg]];return hg=fg=-(cg=lg=1/0),t}};function gg(t,e,n,r){return function(i,o){var a,s,u,l=e(o),c=i.invert(r[0],r[1]),h=$p(),f=e(h),p=!1,g={point:y,lineStart:d,lineEnd:m,polygonStart:function(){g.point=_,g.lineStart=b,g.lineEnd=x,s=[],a=[]},polygonEnd:function(){g.point=y,g.lineStart=d,g.lineEnd=m,s=rg(s);var t=function(t,e){var n=e[0],r=e[1],i=[Ip(n),-Sp(n),0],o=0,a=0;sg.reset();for(var s=0,u=t.length;s=0?1:-1,k=w*E,S=k>vp,I=g*b;if(sg.add(kp(I*w*Ip(k),y*x+I*Sp(k))),o+=S?E+w*_p:E,S^f>=n^m>=n){var P=Vp(Bp(h),Bp(d));zp(P);var N=Vp(i,P);zp(N);var M=(S^E>=0?-1:1)*Mp(N[2]);(r>M||r===M&&(P[0]||P[1]))&&(a+=S^E>=0?1:-1)}}return(o<-yp||o0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t1&&2&i&&l.push(l.pop().concat(l.shift())),s.push(l.filter(yg))}return g}}function yg(t){return t.length>1}function vg(t,e){return((t=t.x)[0]<0?t[1]-dp-yp:dp-t[1])-((e=e.x)[0]<0?e[1]-dp-yp:dp-e[1])}hp();var dg=gg((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?vp:-vp,u=Ep(o-n);Ep(u-vp)0?dp:-dp),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&u>=vp&&(Ep(n-i)yp?wp((Ip(e)*(o=Sp(r))*Ip(n)-Ip(r)*(i=Sp(e))*Ip(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*dp,r.point(-vp,i),r.point(0,i),r.point(vp,i),r.point(vp,0),r.point(vp,-i),r.point(0,-i),r.point(-vp,-i),r.point(-vp,0),r.point(-vp,i);else if(Ep(t[0]-e[0])>yp){var o=t[0]0,i=Ep(n)>yp;function o(t,e){return Sp(t)*Sp(e)>n}function a(t,e,r){var i=[1,0,0],o=Vp(Bp(t),Bp(e)),a=qp(o,o),s=o[0],u=a-s*s;if(!u)return!r&&t;var l=n*a/u,c=-n*s/u,h=Vp(i,o),f=Yp(i,l);Gp(f,Yp(o,c));var p=h,g=qp(f,p),y=qp(p,p),v=g*g-y*(qp(f,f)-1);if(!(v<0)){var d=Pp(v),m=Yp(p,(-g-d)/y);if(Gp(m,f),m=Fp(m),!r)return m;var _,b=t[0],x=e[0],E=t[1],w=e[1];x0^m[1]<(Ep(m[0]-b)vp^(b<=m[0]&&m[0]<=x)){var I=Yp(p,(-g+d)/y);return Gp(I,f),[m,Fp(I)]}}}function s(e,n){var i=r?t:vp-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return gg(o,(function(t){var e,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,f){var p,g=[h,f],y=o(h,f),v=r?y?0:s(h,f):y?s(h+(h<0?vp:-vp),f):0;if(!e&&(l=u=y)&&t.lineStart(),y!==u&&(!(p=a(e,g))||Qp(e,p)||Qp(g,p))&&(g[0]+=yp,g[1]+=yp,y=o(g[0],g[1])),y!==u)c=0,y?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(i&&e&&r^y){var d;v&n||!(d=a(g,e,!0))||(c=0,r?(t.lineStart(),t.point(d[0][0],d[0][1]),t.point(d[1][0],d[1][1]),t.lineEnd()):(t.point(d[1][0],d[1][1]),t.lineEnd(),t.lineStart(),t.point(d[0][0],d[0][1])))}!y||e&&Qp(e,g)||t.point(g[0],g[1]),e=g,u=y,n=v},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var a=Sp(e),s=Ip(e),u=r*n;null==i?(i=e+r*_p,o=e-u/2):(i=Jp(a,i),o=Jp(a,o),(r>0?io)&&(i+=r*_p));for(var l,c=i;r>0?c>o:c4*e&&y--){var b=a+f,x=s+p,E=u+g,w=Pp(b*b+x*x+E*E),k=Mp(E/=w),S=Ep(Ep(E)-1)e||Ep((d*M+m*O)/_-.5)>.3||a*f+s*p+u*g2?t[2]%360*xp:0,N()):[v*bp,d*bp,m*bp]},S.precision=function(t){return arguments.length?(k=kg(P,w=t*t),M()):Pp(w)},S.fitExtent=function(t,e){return xg(S,t,e)},S.fitSize=function(t,e){return function(t,e,n){return xg(t,[[0,0],e],n)}(S,t,e)},function(){return e=t.apply(this,arguments),S.invert=e.invert&&I,N()}}((function(){return t}))()}function Pg(t){return function(e,n){var r=Sp(e),i=Sp(n),o=t(r*i);return[o*i*Ip(e),o*Ip(n)]}}function Ng(t){return function(e,n){var r=Pp(e*e+n*n),i=t(r),o=Ip(i),a=Sp(i);return[kp(e*o,r*a),Mp(r&&n*o/r)]}}Pg((function(t){return Pp(2/(1+t))})).invert=Ng((function(t){return 2*Mp(t/2)}));var Mg=Pg((function(t){return(t=Np(t))&&t/Ip(t)}));function Og(t,e){return[t,e]}Mg.invert=Ng((function(t){return t})),Og.invert=Og;var Lg=Object.defineProperty,Rg=function(t,e){return Lg(t,"name",{value:e,configurable:!0})},Cg=cp.BufferOp,Tg=cp.GeoJSONReader,Ag=cp.GeoJSONWriter;function Dg(t,n,r){var i=(r=r||{}).units||"kilometers",o=r.steps||8;if(!t)throw new Error("geojson is required");if("object"!==e(r))throw new Error("options must be an object");if("number"!=typeof o)throw new Error("steps must be an number");if(void 0===n)throw new Error("radius is required");if(o<=0)throw new Error("steps must be greater than 0");var a=[];switch(t.type){case"GeometryCollection":return jl(t,(function(t){var e=jg(t,n,i,o);e&&a.push(e)})),ju(a);case"FeatureCollection":return Tl(t,(function(t){var e=jg(t,n,i,o);e&&Tl(e,(function(t){t&&a.push(t)}))})),ju(a)}return jg(t,n,i,o)}function jg(t,e,n,r){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var a=[];return jl(t,(function(t){var i=jg(t,e,n,r);i&&a.push(i)})),ju(a)}var s=Vg(o),u={type:o.type,coordinates:Bg(o.coordinates,s)},l=(new Tg).read(u),c=Yu(zu(e,n),"meters"),h=Cg.bufferOp(l,c,r);if(!Fg((h=(new Ag).write(h)).coordinates))return Mu({type:h.type,coordinates:qg(h.coordinates,s)},i)}function Fg(t){return Array.isArray(t[0])?Fg(t[0]):isNaN(t[0])}function Bg(t,n){return"object"!==e(t[0])?n(t):t.map((function(t){return Bg(t,n)}))}function qg(t,n){return"object"!==e(t[0])?n.invert(t):t.map((function(t){return qg(t,n)}))}function Vg(t){var e=up(t).geometry.coordinates,n=[-e[0],-e[1]];return Ig(Mg).scale(79.4188).clipAngle(179.999).rotate(n).scale(Iu)}Rg(Dg,"buffer"),Rg(jg,"bufferFeature"),Rg(Fg,"coordsIsNaN"),Rg(Bg,"projectCoords"),Rg(qg,"unprojectCoords"),Rg(Vg,"defineProjection");var Gg=Object.defineProperty;function Yg(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,r=0,i=0;return jl(t,(function(t,o,a){var s=e.weight?null==a?void 0:a[e.weight]:void 0;if(!$u(s=null==s?1:s))throw new Error("weight value must be a number for feature index "+o);(s=Number(s))>0&&Ol(t,(function(t){n+=t[0]*s,r+=t[1]*s,i+=s}))})),Lu([n/i,r/i],e.properties,e)}!function(t,e){Gg(t,"name",{value:e,configurable:!0})}(Yg,"centerMean");var zg=Object.defineProperty;function Ug(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,r=0,i=0;return Ol(t,(function(t){n+=t[0],r+=t[1],i++}),!0),Lu([n/i,r/i],e.properties)}!function(t,e){zg(t,"name",{value:e,configurable:!0})}(Ug,"centroid");var Xg=Object.defineProperty,Wg=function(t,e){return Xg(t,"name",{value:e,configurable:!0})};function Hg(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Qu(e=e||{}))throw new Error("options is invalid");var n=e.counter||10;if(!$u(n))throw new Error("counter must be a number");var r=e.weight,i=Yg(t,{weight:e.weight}),o=ju([]);Tl(t,(function(t){var e;o.features.push(Ug(t,{properties:{weight:null==(e=t.properties)?void 0:e[r]}}))}));var a={tolerance:e.tolerance,medianCandidates:[]};return Zg(i.geometry.coordinates,[0,0],o,a,n)}function Zg(t,e,n,r,i){var o=r.tolerance||.001,a=0,s=0,u=0,l=0;if(Tl(n,(function(e){var n,r=null==(n=e.properties)?void 0:n.weight,i=null==r?1:r;if(!$u(i=Number(i)))throw new Error("weight value must be a number");if(i>0){l+=1;var o=i*_l(e,t);0===o&&(o=1);var c=i/o;a+=e.geometry.coordinates[0]*c,s+=e.geometry.coordinates[1]*c,u+=c}})),l<1)throw new Error("no features to measure");var c=a/u,h=s/u;return 1===l||0===i||Math.abs(c-e[0])0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Kg;if(n(this,t),this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}return i(t,[{key:"push",value:function(t){this.data.push(t),this.length++,this._up(this.length-1)}},{key:"pop",value:function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}},{key:"_down",value:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t=0)break;e[t]=a,t=o}e[t]=i}}]),t}();function Kg(t,e){return te?1:0}var ty=g(Object.freeze({__proto__:null,default:Qg})),ey={exports:{}},ny=function(t,e,n,r){var i=t[0],o=t[1],a=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var s=(r-n)/2,u=0,l=s-1;uo!=p>o&&i<(f-c)*(o-h)/(p-h)+c&&(a=!a)}return a},ry=function(t,e,n,r){var i=t[0],o=t[1],a=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);for(var s=r-n,u=0,l=s-1;uo!=p>o&&i<(f-c)*(o-h)/(p-h)+c&&(a=!a)}return a};ey.exports=function(t,e,n,r){return e.length>0&&Array.isArray(e[0])?ry(t,e,n,r):ny(t,e,n,r)},ey.exports.nested=ry,ey.exports.flat=ny;var iy=ey.exports,oy={exports:{}};!function(t,e){!function(t){var e=134217729,n=33306690738754706e-32;function r(t,e,n,r,i){var o,a,s,u,l=e[0],c=r[0],h=0,f=0;c>l==c>-l?(o=l,l=e[++h]):(o=c,c=r[++f]);var p=0;if(hl==c>-l?(s=o-((a=l+o)-l),l=e[++h]):(s=o-((a=c+o)-c),c=r[++f]),o=a,0!==s&&(i[p++]=s);hl==c>-l?(s=o-((a=o+l)-(u=a-o))+(l-u),l=e[++h]):(s=o-((a=o+c)-(u=a-o))+(c-u),c=r[++f]),o=a,0!==s&&(i[p++]=s);for(;h0!=m>0)return _;var b=Math.abs(d+m);return Math.abs(_)>=o*b?_:-function(t,i,o,p,g,y,v){var d,m,_,b,x,E,w,k,S,I,P,N,M,O,L,R,C,T,A=t-g,D=o-g,j=i-y,F=p-y;x=(L=(k=A-(w=(E=e*A)-(E-A)))*(I=F-(S=(E=e*F)-(E-F)))-((O=A*F)-w*S-k*S-w*I))-(P=L-(C=(k=j-(w=(E=e*j)-(E-j)))*(I=D-(S=(E=e*D)-(E-D)))-((R=j*D)-w*S-k*S-w*I))),u[0]=L-(P+x)+(x-C),x=(M=O-((N=O+P)-(x=N-O))+(P-x))-(P=M-R),u[1]=M-(P+x)+(x-R),x=(T=N+P)-N,u[2]=N-(T-x)+(P-x),u[3]=T;var B=function(t,e){for(var n=e[0],r=1;r=q||-B>=q)return B;if(d=t-(A+(x=t-A))+(x-g),_=o-(D+(x=o-D))+(x-g),m=i-(j+(x=i-j))+(x-y),b=p-(F+(x=p-F))+(x-y),0===d&&0===m&&0===_&&0===b)return B;if(q=s*v+n*Math.abs(B),(B+=A*b+F*d-(j*_+D*m))>=q||-B>=q)return B;x=(L=(k=d-(w=(E=e*d)-(E-d)))*(I=F-(S=(E=e*F)-(E-F)))-((O=d*F)-w*S-k*S-w*I))-(P=L-(C=(k=m-(w=(E=e*m)-(E-m)))*(I=D-(S=(E=e*D)-(E-D)))-((R=m*D)-w*S-k*S-w*I))),f[0]=L-(P+x)+(x-C),x=(M=O-((N=O+P)-(x=N-O))+(P-x))-(P=M-R),f[1]=M-(P+x)+(x-R),x=(T=N+P)-N,f[2]=N-(T-x)+(P-x),f[3]=T;var V=r(4,u,4,f,l);x=(L=(k=A-(w=(E=e*A)-(E-A)))*(I=b-(S=(E=e*b)-(E-b)))-((O=A*b)-w*S-k*S-w*I))-(P=L-(C=(k=j-(w=(E=e*j)-(E-j)))*(I=_-(S=(E=e*_)-(E-_)))-((R=j*_)-w*S-k*S-w*I))),f[0]=L-(P+x)+(x-C),x=(M=O-((N=O+P)-(x=N-O))+(P-x))-(P=M-R),f[1]=M-(P+x)+(x-R),x=(T=N+P)-N,f[2]=N-(T-x)+(P-x),f[3]=T;var G=r(V,l,4,f,c);x=(L=(k=d-(w=(E=e*d)-(E-d)))*(I=b-(S=(E=e*b)-(E-b)))-((O=d*b)-w*S-k*S-w*I))-(P=L-(C=(k=m-(w=(E=e*m)-(E-m)))*(I=_-(S=(E=e*_)-(E-_)))-((R=m*_)-w*S-k*S-w*I))),f[0]=L-(P+x)+(x-C),x=(M=O-((N=O+P)-(x=N-O))+(P-x))-(P=M-R),f[1]=M-(P+x)+(x-R),x=(T=N+P)-N,f[2]=N-(T-x)+(P-x),f[3]=T;var Y=r(G,c,4,f,h);return h[Y-1]}(t,i,p,g,y,v,b)},t.orient2dfast=function(t,e,n,r,i,o){return(e-o)*(n-i)-(t-i)*(r-o)},Object.defineProperty(t,"__esModule",{value:!0})}(e)}(0,oy.exports);var ay=$g,sy=ty,uy=iy,ly=oy.exports.orient2d;function cy(t,e,n){e=Math.max(0,void 0===e?2:e),n=n||0;var r=function(t){for(var e=t[0],n=t[0],r=t[0],i=t[0],o=0;or[0]&&(r=a),a[1]i[1]&&(i=a)}var s=[e,n,r,i],u=s.slice();for(o=0;o=2&&vy(e[e.length-2],e[e.length-1],t[n])<=0;)e.pop();e.push(t[n])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&vy(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),e.pop(),e.concat(r)}(u)}(t),i=new ay(16);i.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},i.compareMinX=function(t,e){return t[0]-e[0]},i.compareMinY=function(t,e){return t[1]-e[1]},i.load(t);for(var o,a=[],s=0;so||s.push({node:c,dist:h})}for(;s.length&&!s.peek().node.children;){var f=s.pop(),p=f.node,g=by(p,e,n),y=by(p,r,i);if(f.dist=e.minX&&t[0]<=e.maxX&&t[1]>=e.minY&&t[1]<=e.maxY}function yy(t,e,n){for(var r,i,o,a,s=Math.min(t[0],e[0]),u=Math.min(t[1],e[1]),l=Math.max(t[0],e[0]),c=Math.max(t[1],e[1]),h=n.search({minX:s,minY:u,maxX:l,maxY:c}),f=0;f0!=vy(r,i,a)>0&&vy(o,a,r)>0!=vy(o,a,i)>0)return!1;return!0}function vy(t,e,n){return ly(t[0],t[1],e[0],e[1],n[0],n[1])}function dy(t){var e=t.p,n=t.next.p;return t.minX=Math.min(e[0],n[0]),t.minY=Math.min(e[1],n[1]),t.maxX=Math.max(e[0],n[0]),t.maxY=Math.max(e[1],n[1]),t}function my(t,e){var n={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return e?(n.next=e.next,n.prev=e,e.next.prev=n,e.next=n):(n.prev=n,n.next=n),n}function _y(t,e){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r}function by(t,e,n){var r=e[0],i=e[1],o=n[0]-r,a=n[1]-i;if(0!==o||0!==a){var s=((t[0]-r)*o+(t[1]-i)*a)/(o*o+a*a);s>1?(r=n[0],i=n[1]):s>0&&(r+=o*s,i+=a*s)}return(o=t[0]-r)*o+(a=t[1]-i)*a}function xy(t,e,n,r,i,o,a,s){var u,l,c,h,f=n-t,p=r-e,g=a-i,y=s-o,v=t-i,d=e-o,m=f*f+p*p,_=f*g+p*y,b=g*g+y*y,x=f*v+p*d,E=g*v+y*d,w=m*b-_*_,k=w,S=w;0===w?(l=0,k=1,h=E,S=b):(h=m*E-_*x,(l=_*E-b*x)<0?(l=0,h=E,S=b):l>k&&(l=k,h=E+_,S=b)),h<0?(h=0,-x<0?l=0:-x>m?l=k:(l=-x,k=m)):h>S&&(h=S,-x+_<0?l=0:-x+_>m?l=k:(l=-x+_,k=m));var I=(1-(c=0===h?0:h/S))*i+c*a-((1-(u=0===l?0:l/k))*t+u*n),P=(1-c)*o+c*s-((1-u)*e+u*r);return I*I+P*P}function Ey(t,e){return t[0]===e[0]?t[1]-e[1]:t[0]-e[0]}sy.default&&(sy=sy.default),Jg.exports=cy,Jg.exports.default=cy;var wy=p(Jg.exports),ky=Object.defineProperty;function Sy(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.concavity=e.concavity||1/0;var n=[];if(Ol(t,(function(t){n.push([t[0],t[1]])})),!n.length)return null;var r=wy(n,e.concavity);return r.length>3?Cu([r]):null}!function(t,e){ky(t,"name",{value:e,configurable:!0})}(Sy,"convex");var Iy=Object.defineProperty;function Py(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(hl(t)){case"Point":return Lu(il(t),e.properties);case"Polygon":var n=[];Ol(t,(function(t){n.push(t)}));var r,i,o,a,s,u,l,c,h=Ug(t,{properties:e.properties}),f=h.geometry.coordinates,p=0,g=0,y=0,v=n.map((function(t){return[t[0]-f[0],t[1]-f[1]]}));for(r=0;r2&&void 0!==arguments[2]?arguments[2]:{},r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],a=0;a2&&void 0!==arguments[2]?arguments[2]:{};!0!==n.mutate&&(t=Ry(t));var r=n.minPoints||3,i=Uu(e,n.units),o=new Jy(t.features.length),u=t.features.map((function(t){return!1})),l=t.features.map((function(t){return!1})),c=t.features.map((function(t){return!1})),h=t.features.map((function(t){return-1}));o.load(t.features.map((function(t,e){var n=a(t.geometry.coordinates,2),r=n[0],i=n[1];return{minX:r,minY:i,maxX:r,maxY:i,index:e}})));var f=Zy((function(n){var r=t.features[n],s=a(r.geometry.coordinates,2),u=s[0],l=s[1],c=Math.max(l-i,-90),h=Math.min(l+i,90),f=c<0&&h>0?i:Math.abs(c)=r&&e.push.apply(e,s(o))}l[i]||(l[i]=!0,h[i]=t)}}),"expandCluster"),g=0;return t.features.forEach((function(t,e){if(!u[e]){var n=f(e);if(n.length>=r){var i=g;g++,u[e]=!0,p(i,n)}else c[e]=!0}})),t.features.forEach((function(e,n){var r=t.features[n];r.properties||(r.properties={}),h[n]>=0?(r.properties.dbscan=c[n]?"edge":"core",r.properties.cluster=h[n]):r.properties.dbscan="noise"})),t}Zy($y,"clustersDbscan");var Qy={eudist:function(t,e,n){for(var r=t.length,i=0,o=0;o0;r.length0;){var s=t[Math.floor(Math.random()*o)],u=a?s.join("_"):""+s;n[u]||(n[u]=!0,r.push(s))}if(r.length0,a=t[Math.floor(Math.random()*i)];for(o&&a.join("_"),r.push(a);r.length0,p=[];if(n)i="kmrand"==n?iv(t,e):"kmpp"==n?ov(t,e):n;else for(var g={};i.length1&&void 0!==arguments[1]?arguments[1]:{},n=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(n/2)),e.numberOfClusters>n&&(e.numberOfClusters=n),!0!==e.mutate&&(t=Ry(t));var r=Dl(t),i=r.slice(0,e.numberOfClusters),o=uv(r,e.numberOfClusters,i),a={};return o.centroids.forEach((function(t,e){a[e]=t})),Tl(t,(function(t,e){var n=o.idxs[e];t.properties.cluster=n,t.properties.centroid=a[n]})),t}!function(t,e){lv(t,"name",{value:e,configurable:!0})}(cv,"clustersKmeans");var hv=Object.defineProperty,fv=Wh;function pv(t,e,n,r){var i=new fv(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null==(e=t.properties)?void 0:e[n]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=rc(t),n=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];n.forEach((function(e){Nc([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[r]=o})),t}!function(t,e){hv(t,"name",{value:e,configurable:!0})}(pv,"collect");var gv=Object.defineProperty;function yv(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Tl(t,(function(t){var n,r,i,o;switch(null==(o=t.geometry)?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(n=e.MultiPoint.coordinates).push.apply(n,s(t.geometry.coordinates)),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(r=e.MultiLineString.coordinates).push.apply(r,s(t.geometry.coordinates)),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,s(t.geometry.coordinates)),e.MultiPolygon.properties.push(t.properties)}})),ju(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return Mu({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))}!function(t,e){gv(t,"name",{value:e,configurable:!0})}(yv,"combine");var vv=Object.defineProperty,dv=function(t,e){return vv(t,"name",{value:e,configurable:!0})};function mv(t,e){var n=!1;return ju(wv(t.features.map((function(t){var r={x:t.geometry.coordinates[0],y:t.geometry.coordinates[1]};return e?r.z=t.properties[e]:3===t.geometry.coordinates.length&&(n=!0,r.z=t.geometry.coordinates[2]),r}))).map((function(t){var e=[t.a.x,t.a.y],r=[t.b.x,t.b.y],i=[t.c.x,t.c.y],o={};return n?(e.push(t.a.z),r.push(t.b.z),i.push(t.c.z)):o={a:t.a.z,b:t.b.z,c:t.c.z},Cu([[e,r,i,e]],o)})))}dv(mv,"tin");var _v=i((function t(e,r,i){n(this,t),this.a=e,this.b=r,this.c=i;var o,a,s=r.x-e.x,u=r.y-e.y,l=i.x-e.x,c=i.y-e.y,h=s*(e.x+r.x)+u*(e.y+r.y),f=l*(e.x+i.x)+c*(e.y+i.y),p=2*(s*(i.y-r.y)-u*(i.x-r.x));this.x=(c*h-u*f)/p,this.y=(s*f-l*h)/p,o=this.x-e.x,a=this.y-e.y,this.r=o*o+a*a}));dv(_v,"Triangle");var bv=_v;function xv(t,e){return e.x-t.x}function Ev(t){var e,n,r,i,o,a=t.length;t:for(;a;)for(n=t[--a],e=t[--a],r=a;r;)if(o=t[--r],e===(i=t[--r])&&n===o||e===o&&n===i){t.splice(a,2),t.splice(r,2),a-=2;continue t}}function wv(t){if(t.length<3)return[];t.sort(xv);for(var e,n,r,i,o,a,s=t.length-1,u=t[s].x,l=t[0].x,c=t[s].y,h=c;s--;)t[s].yh&&(h=t[s].y);var f,p=l-u,g=h-c,y=p>g?p:g,v=.5*(l+u),d=.5*(h+c),m=[new bv({__sentinel:!0,x:v-20*y,y:d-y},{__sentinel:!0,x:v,y:d+20*y},{__sentinel:!0,x:v+20*y,y:d-y})],_=[],b=[];for(s=t.length;s--;){for(b.length=0,f=m.length;f--;)(p=t[s].x-m[f].x)>0&&p*p>m[f].r?(_.push(m[f]),m.splice(f,1)):p*p+(g=t[s].y-m[f].y)*g>m[f].r||(b.push(m[f].a,m[f].b,m[f].b,m[f].c,m[f].c,m[f].a),m.splice(f,1));for(Ev(b),f=b.length;f;)n=b[--f],e=b[--f],r=t[s],i=n.x-e.x,o=n.y-e.y,a=2*(i*(r.y-n.y)-o*(r.x-n.x)),Math.abs(a)>1e-12&&m.push(new bv(e,n,r))}for(Array.prototype.push.apply(_,m),s=_.length;s--;)(_[s].a.__sentinel||_[s].b.__sentinel||_[s].c.__sentinel)&&_.splice(s,1);return _}function kv(t){return t}function Sv(t,e){var n=function(t){if(null==t)return kv;var e,n,r=t.scale[0],i=t.scale[1],o=t.translate[0],a=t.translate[1];return function(t,s){s||(e=n=0);var u=2,l=t.length,c=new Array(l);for(c[0]=(e+=t[0])*r+o,c[1]=(n+=t[1])*i+a;u1)for(var o,s,u=1,l=a(i[0]);ul&&(s=i[0],i[0]=i[u],i[u]=s,l=o);return i})).filter((function(t){return t.length>0}))}}dv(xv,"byX"),dv(Ev,"dedup"),dv(wv,"triangulate");var Mv=Object.prototype.hasOwnProperty;function Ov(t,e,n,r,i,o){3===arguments.length&&(r=o=Array,i=null);for(var a=new r(t=1<=t)throw new Error("full hashmap");c=a[l=l+1&u]}return a[l]=r,s[l]=o,o},maybeSet:function(r,o){for(var l=e(r)&u,c=a[l],h=0;c!=i;){if(n(c,r))return s[l];if(++h>=t)throw new Error("full hashmap");c=a[l=l+1&u]}return a[l]=r,s[l]=o,o},get:function(r,o){for(var l=e(r)&u,c=a[l],h=0;c!=i;){if(n(c,r))return s[l];if(++h>=t)break;c=a[l=l+1&u]}return o},keys:function(){for(var t=[],e=0,n=a.length;e>7^Tv[2]^Tv[3])}function Dv(t){var e,n,r,i,o=t.coordinates,a=t.lines,s=t.rings,u=function(){for(var t=Ov(1.4*o.length,x,E,Int32Array,-1,Int32Array),e=new Int32Array(o.length),n=0,r=o.length;n=0){var o=h[n];i===e&&o===r||i===r&&o===e||(++p,f[n]=1)}else c[n]=e,h[n]=r}}function x(t){return Av(o[t])}function E(t,e){return Lv(o[t],o[e])}l=c=h=null;var w,k=function(t,e,n,r,i){3===arguments.length&&(r=Array,i=null);for(var o=new r(t=1<=t)throw new Error("full hashset");u=o[s=s+1&a]}return o[s]=r,!0},has:function(r){for(var s=e(r)&a,u=o[s],l=0;u!=i;){if(n(u,r))return!0;if(++l>=t)break;u=o[s=s+1&a]}return!1},values:function(){for(var t=[],e=0,n=o.length;e>1);er&&(r=o),ai&&(i=a)}function u(t){t.forEach(s)}function l(t){t.forEach(u)}for(var c in t)o(t[c]);return r>=e&&i>=n?[e,n,r,i]:void 0}(t=Bv(t)),r=e>0&&n&&function(t,e,n){var r=e[0],i=e[1],o=e[2],a=e[3],s=o-r?(n-1)/(o-r):1,u=a-i?(n-1)/(a-i):1;function l(t){return[Math.round((t[0]-r)*s),Math.round((t[1]-i)*u)]}function c(t,e){for(var n,o,a,l,c,h=-1,f=0,p=t.length,g=new Array(p);++h1&&void 0!==arguments[1]?arguments[1]:{};if(!Qu(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==hl(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==n&&void 0!==n||(t=Ry(t));var r=[],i=zl(t,(function(t,e){var n=Jv(t,e);return n||(r.push(t),e)}));return i&&r.push(i),r.length?1===r.length?r[0]:Fu(r.map((function(t){return t.coordinates}))):null}function Zv(t){return t[0].toString()+","+t[1].toString()}function Jv(t,e){var n,r=t.geometry.coordinates,i=e.geometry.coordinates,o=Zv(r[0]),a=Zv(r[r.length-1]),s=Zv(i[0]),u=Zv(i[i.length-1]);if(o===u)n=i.concat(r.slice(1));else if(s===a)n=r.concat(i.slice(1));else if(o===s)n=r.slice(1).reverse().concat(i);else{if(a!==u)return null;n=r.concat(i.reverse().slice(1))}return Au(n)}function $v(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("FeatureCollection"!==hl(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==e.mutate&&void 0!==e.mutate||(t=Ry(t));var n=[];Bl(t,(function(t){n.push(t.geometry)}));var r=Yv({geoms:Vu(n).geometry});return Pv(r,r.objects.geoms.geometries)}function Qv(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Qu(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if("FeatureCollection"!==hl(t))throw new Error("geojson must be a FeatureCollection");if(!t.features.length)throw new Error("geojson is empty");!1!==n&&void 0!==n||(t=Ry(t));var r=Kv(t);if(!r)throw new Error("geojson must be homogenous");var i=t;switch(r){case"LineString":return Hv(i,e);case"Polygon":return $v(i,e);default:throw new Error(r+" is not supported")}}function Kv(t){var e={};Bl(t,(function(t){e[t.geometry.type]=!0}));var n=Object.keys(e);return 1===n.length?n[0]:null}function td(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.maxEdge||1/0,r=mv(ed(t));if(r.features=r.features.filter((function(t){var r=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],a=_l(r,i,e),s=_l(i,o,e),u=_l(r,o,e);return a<=n&&s<=n&&u<=n})),r.features.length<1)return null;var i=Qv(r);return 1===i.coordinates.length&&(i.coordinates=i.coordinates[0],i.type="Polygon"),Mu(i)}function ed(t){var e=[],n={};return Tl(t,(function(t){if(t.geometry){var r=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(n,r)||(e.push(t),n[r]=!0)}})),ju(e)} /** * splaytree v3.1.2 * Fast Splay tree for Node and browser * * @author Alexander Milevski * @license MIT * @preserve */ /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ function nd(t,e){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]e?1:t0))break;if(null===e.right)break;if(n(t,e.right.key)>0){s=e.right;if(e.right=s.left,s.left=e,null===(e=s).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function ad(t,e,n,r){var i=new rd(t,e);if(null===n)return i.left=i.right=null,i;var o=r(t,(n=od(t,n,r)).key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function sd(t,e,n){var r=null,i=null;if(e){var o=n((e=od(t,e,n)).key,t);0===o?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function ud(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&ud(t.left,o,!1,r,i),t.right&&ud(t.right,o,!0,r,i)}}var ld=function(){function t(t){void 0===t&&(t=id),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=ad(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var n=new rd(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,i=od(t,this._root,r),o=r(t,i.key);return 0===o?this._root=i:(o<0?(n.left=i.left,n.right=i,i.left=null):o>0&&(n.right=i.right,n.left=i,i.right=null),this._size++,this._root=n),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,n){var r;return null===e?null:0===n(t,(e=od(t,e,n)).key)?(null===e.left?r=e.right:(r=od(t,e.left,n)).right=e.right,this._size--,r):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=od(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=od(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},t.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,a=this._root;0!==i.length||a;)if(a)i.push(a),a=a.left;else{if(o((a=i.pop()).key,e)>0)break;if(o(a.key,t)>=0&&n.call(r,a))return this;a=a.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},t.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},t.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,n=[],r=!1,i=new rd(null,null),o=i;for(;!r;)e?(n.push(e),e=e.left):n.length>0?e=(e=o=o.next=n.pop()).right:r=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&fd(t,e,0,r-1,i),null===this._root)this._root=cd(t,e,0,r),this._size=r;else{var o=function(t,e,n){var r=new rd(null,null),i=r,o=t,a=e;for(;null!==o&&null!==a;)n(o.key,a.key)<0?(i.next=o,o=o.next):(i.next=a,a=a.next),i=i.next;null!==o?i.next=o:null!==a&&(i.next=a);return r.next}(this.toList(),function(t,e){for(var n=new rd(null,null),r=n,i=0;i0){var o=n+Math.floor(i/2),a=t[o],s=e[o],u=new rd(a,s);return u.left=cd(t,e,n,o),u.right=cd(t,e,o+1,r),u}return null}function hd(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=hd(t,e,i),a=t.head;return a.left=o,t.head=t.head.next,a.right=hd(t,i+1,n),a}return null}function fd(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],a=n-1,s=r+1;;){do{a++}while(i(t[a],o)<0);do{s--}while(i(t[s],o)>0);if(a>=s)break;var u=t[a];t[a]=t[s],t[s]=u,u=e[a],e[a]=e[s],e[s]=u}fd(t,e,n,s,i),fd(t,e,s+1,r,i)}}function pd(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gd(t,e){for(var n=0;ne.x?1:t.ye.y?1:0}}]),yd(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n=0&&u>=0?al?-1:0:o<0&&u<0?al?1:0:uo?1:0}}}]),t}(),Rd=0,Cd=function(){function t(e,n,r,i){pd(this,t),this.id=++Rd,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return yd(t,null,[{key:"compare",value:function(t,e){var n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(oa&&s>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(n>r){if(as&&a>l)return 1;var f=e.comparePoint(t.leftSE.point);if(0!==f)return f;var p=t.comparePoint(e.rightSE.point);return p<0?1:p>0?-1:1}if(as)return 1;if(io){var y=t.comparePoint(e.rightSE.point);if(y<0)return 1;if(y>0)return-1}if(i!==o){var v=u-a,d=i-n,m=l-s,_=o-r;if(v>d&&m<_)return 1;if(v_)return-1}return i>o?1:il?1:t.ide.id?1:0}}]),yd(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:te?t:e}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x0&&s.swapEvents(),Ld.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e0){var o=n;n=r,r=o}if(n.prev===r){var a=n;n=r,r=a}for(var s=0,u=r.rings.length;s0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=n,o=e,a=-1}return new t(new Ld(i,!0),new Ld(o,!1),[r],[a])}}]),t}(),Td=function(){function t(e,n,r){if(pd(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=wd.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,a=1,s=e.length;athis.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(Cd.fromRing(o,i,this))}return yd(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;ethis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}return yd(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;ethis.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}return yd(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e0&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),Fd=function(){function t(e){pd(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return yd(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e1&&void 0!==arguments[1]?arguments[1]:Cd.compare;pd(this,t),this.queue=e,this.tree=new ld(n),this.segments=[]}return yd(t,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,a=void 0,s=void 0;void 0===a;)null===(i=this.tree.prev(i))?a=null:void 0===i.key.consumedBy&&(a=i.key);for(;void 0===s;)null===(o=this.tree.next(o))?s=null:void 0===o.key.consumedBy&&(s=o.key);if(t.isLeft){var u=null;if(a){var l=a.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!a.isAnEndpoint(l)))for(var c=this._splitSafely(a,l),h=0,f=c.length;h0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=a)}else{if(a&&s){var E=a.getIntersection(s);if(null!==E){if(!a.isAnEndpoint(E))for(var w=this._splitSafely(a,E),k=0,S=w.length;kVd)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var _=new qd(p),b=p.size,x=p.pop();x;){var E=x.key;if(p.size===b){var w=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(w.id," ")+"[".concat(w.leftSE.point.x,", ").concat(w.leftSE.point.y,"] -> ")+"[".concat(w.rightSE.point.x,", ").concat(w.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>Vd)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(_.segments.length>Gd)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var k=_.process(E),S=0,I=k.length;S1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1?e-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:{};if(!Qu(e=e||{}))throw new Error("options is invalid");var n=e.propertyName;ll(t,"Polygon","dissolve");var r=[];if(!n)return Zd(qu(Ud.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};Tl(t,(function(t){t.properties&&(Object.prototype.hasOwnProperty.call(i,t.properties[n])||(i[t.properties[n]]=[]),i[t.properties[n]].push(t))}));for(var o=Object.keys(i),a=0;a2&&void 0!==arguments[2]?arguments[2]:2,r=il(t),i=il(e),o=r[0]-i[0],a=r[1]-i[1];return 1===n?Math.abs(o)+Math.abs(a):Math.pow(Math.pow(o,n)+Math.pow(a,n),1/n)}function em(t,e){var n,r,i=(e=e||{}).threshold||1e4,o=e.p||2,a=null!=(n=e.binary)&&n,s=e.alpha||-1,u=null!=(r=e.standardization)&&r,l=[];Tl(t,(function(t){l.push(Ug(t))}));for(var c=[],h=0;h3&&void 0!==arguments[3]?arguments[3]:{},i=e<0,o=Zu(Math.abs(e),r.units,"meters");i&&(o=-Math.abs(o));var a=il(t),s=om(a,o,n);return s[0]+=s[0]-a[0]>180?-360:a[0]-s[0]>180?360:0,Lu(s,r.properties)}function om(t,e,n,r){var i=e/(r=void 0===r?Iu:Number(r)),o=t[0]*Math.PI/180,a=Hu(t[1]),s=Hu(n),u=i*Math.cos(s),l=a+u;Math.abs(l)>Math.PI/2&&(l=l>0?Math.PI-l:-Math.PI-l);var c=Math.log(Math.tan(l/2+Math.PI/4)/Math.tan(a/2+Math.PI/4)),h=Math.abs(c)>1e-11?u/c:Math.cos(a);return[(180*(o+i*Math.sin(s)/h)/Math.PI+540)%360-180,180*l/Math.PI]}rm(im,"rhumbDestination"),rm(om,"calculateRhumbDestination");var am=Object.defineProperty,sm=function(t,e){return am(t,"name",{value:e,configurable:!0})};function um(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=il(t),i=il(e);return i[0]+=i[0]-r[0]>180?-360:r[0]-i[0]>180?360:0,Zu(lm(r,i),"meters",n.units)}function lm(t,e,n){var r=n=void 0===n?Iu:Number(n),i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,a=o-i,s=Math.abs(e[0]-t[0])*Math.PI/180;s>Math.PI&&(s-=2*Math.PI);var u=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),l=Math.abs(u)>1e-11?a/u:Math.cos(i);return Math.sqrt(a*a+l*l*s*s)*r}sm(um,"rhumbDistance"),sm(lm,"calculateRhumbDistance");var cm=Object.defineProperty;function hm(t,e,n){if(!Qu(n=n||{}))throw new Error("options is invalid");var r=n.pivot,i=n.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("angle is required");return 0===e||(r||(r=Ug(t)),!1!==i&&void 0!==i||(t=Ry(t)),Ol(t,(function(t){var n=kl(r,t)+e,i=um(r,t),o=ol(im(r,i,n));t[0]=o[0],t[1]=o[1]}))),t}!function(t,e){cm(t,"name",{value:e,configurable:!0})}(hm,"transformRotate");var fm=Object.defineProperty,pm=function(t,e){return fm(t,"name",{value:e,configurable:!0})};function gm(t,e,n,r){var i=(r=r||{}).steps||64,o=r.units||"kilometers",a=r.angle||0,s=r.pivot||t,u=r.properties||{};if(!t)throw new Error("center is required");if(!e)throw new Error("xSemiAxis is required");if(!n)throw new Error("ySemiAxis is required");if(!Qu(r))throw new Error("options must be an object");if(!$u(i))throw new Error("steps must be a number");if(!$u(a))throw new Error("angle must be a number");var l=il(t);if("degrees"!==o){var c=im(t,e,90,{units:o}),h=im(t,n,0,{units:o});e=il(c)[0]-l[0],n=il(h)[1]-l[1]}for(var f=[],p=0;p=-270&&(y=-y),g<-180&&g>=-360&&(v=-v),"degrees"===o){var d=Hu(a),m=y*Math.cos(d)+v*Math.sin(d),_=v*Math.cos(d)-y*Math.sin(d);y=m,v=_}f.push([y+l[0],v+l[1]])}return f.push(f[0]),"degrees"===o?Cu([f],u):hm(Cu([f],u),a,{pivot:s})}function ym(t){var e=t*Math.PI/180;return Math.tan(e)}pm(gm,"ellipse"),pm(ym,"getTanDeg");var vm=Object.defineProperty;function dm(t){return pc(rc(t))}!function(t,e){vm(t,"name",{value:e,configurable:!0})}(dm,"envelope");var mm=Object.defineProperty;function _m(t){var e=[];return"FeatureCollection"===t.type?Tl(t,(function(t){Ol(t,(function(n){e.push(Lu(n,t.properties))}))})):"Feature"===t.type?Ol(t,(function(n){e.push(Lu(n,t.properties))})):Ol(t,(function(t){e.push(Lu(t))})),ju(e)}!function(t,e){mm(t,"name",{value:e,configurable:!0})}(_m,"explode");var bm=Object.defineProperty;function xm(t,e){var n;if(!Qu(e=e||{}))throw new Error("options is invalid");var r=null!=(n=e.mutate)&&n;if(!t)throw new Error("geojson is required");return!1!==r&&void 0!==r||(t=Ry(t)),Ol(t,(function(t){var e=t[0],n=t[1];t[0]=n,t[1]=e})),t}!function(t,e){bm(t,"name",{value:e,configurable:!0})}(xm,"flip");var Em=Object.defineProperty,wm=function(t,e){return Em(t,"name",{value:e,configurable:!0})},km=Math.PI/180,Sm=180/Math.PI,Im=wm((function(t,e){this.lon=t,this.lat=e,this.x=km*t,this.y=km*e}),"Coord");Im.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)},Im.prototype.antipode=function(){var t=-1*this.lat,e=this.lon<0?180+this.lon:-1*(180-this.lon);return new Im(e,t)};var Pm=wm((function(){this.coords=[],this.length=0}),"LineString");Pm.prototype.move_to=function(t){this.length++,this.coords.push(t)};var Nm=wm((function(t){this.properties=t||{},this.geometries=[]}),"Arc");Nm.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(1===this.geometries.length)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var t=[],e=0;ef&&(y>c&&gc&&yu&&(u=v)}var d=[];if(s&&u0&&Math.abs(b-n[_-1][0])>f){var x=parseFloat(n[_-1][0]),E=parseFloat(n[_-1][1]),w=parseFloat(n[_][0]),k=parseFloat(n[_][1]);if(x>-180&&x-180&&n[_-1][0]c&&x<180&&-180===w&&_+1c&&n[_-1][0]<180){m.push([180,n[_][1]]),_++,m.push([n[_][0],n[_][1]]);continue}if(xc){var S=x;x=w,w=S;var I=E;E=k,k=I}if(x>c&&w=180&&xc?180:-180,N]),(m=[]).push([n[_-1][0]>c?-180:180,N]),d.push(m)}else m=[],d.push(m);m.push([b,n[_][1]])}else m.push([n[_][0],n[_][1]])}}else{var M=[];d.push(M);for(var O=0;O1&&void 0!==arguments[1]?arguments[1]:{},n=[];if(jl(t,(function(t){n.push(t.coordinates)})),n.length<2)throw new Error("Must specify at least 2 geometries");var r=Ud.intersection.apply(Ud,[n[0]].concat(s(n.slice(1))));return 0===r.length?null:1===r.length?Cu(r[0],e.properties):qu(r,e.properties)}!function(t,e){Lm(t,"name",{value:e,configurable:!0})}(Rm,"intersect");var Cm=Object.defineProperty,Tm=function(t,e){return Cm(t,"name",{value:e,configurable:!0})};function Am(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=JSON.stringify(n.properties||{}),i=a(t,4),o=i[0],s=i[1],u=i[2],l=i[3],c=(s+l)/2,h=(o+u)/2,f=2*e/_l([o,c],[u,c],n)*(u-o),p=2*e/_l([h,s],[h,l],n)*(l-s),g=f/2,y=2*g,v=Math.sqrt(3)/2*p,d=u-o,m=l-s,_=3/4*y,b=v,x=(d-y)/(y-g/2),E=Math.floor(x),w=(E*_-g/2-d)/2-g/2+_/2,k=Math.floor((m-v)/v),S=(m-k*v)/2,I=k*v-m>v/2;I&&(S-=v/4);for(var P=[],N=[],M=0;M<6;M++){var O=2*Math.PI/6*M;P.push(Math.cos(O)),N.push(Math.sin(O))}for(var L=[],R=0;R<=E;R++)for(var C=0;C<=k;C++){var T=R%2==1;if((0!==C||!T)&&(0!==C||!I)){var A=R*_+o-w,D=C*b+s+S;if(T&&(D-=v/2),!0===n.triangles)jm([A,D],f/2,p/2,JSON.parse(r),P,N).forEach((function(t){n.mask?Rm(ju([n.mask,t]))&&L.push(t):L.push(t)}));else{var j=Dm([A,D],f/2,p/2,JSON.parse(r),P,N);n.mask?Rm(ju([n.mask,j]))&&L.push(j):L.push(j)}}}return ju(L)}function Dm(t,e,n,r,i,o){for(var a=[],s=0;s<6;s++){var u=t[0]+e*i[s],l=t[1]+n*o[s];a.push([u,l])}return a.push(a[0].slice()),Cu([a],r)}function jm(t,e,n,r,i,o){for(var a=[],s=0;s<6;s++){var u=[];u.push(t),u.push([t[0]+e*i[s],t[1]+n*o[s]]),u.push([t[0]+e*i[(s+1)%6],t[1]+n*o[(s+1)%6]]),u.push(t),a.push(Cu([u],r))}return a}Tm(Am,"hexGrid"),Tm(Dm,"hexagon"),Tm(jm,"hexTriangles");var Fm=Object.defineProperty;function Bm(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.mask&&!n.units&&(n.units="kilometers");for(var r=[],i=t[0],o=t[1],a=t[2],s=t[3],u=e/_l([i,o],[a,o],n)*(a-i),l=e/_l([i,o],[i,s],n)*(s-o),c=a-i,h=s-o,f=Math.floor(c/u),p=(h-Math.floor(h/l)*l)/2,g=i+(c-f*u)/2;g<=a;){for(var y=o+p;y<=s;){var v=Lu([g,y],n.properties);n.mask?Jf(v,n.mask)&&r.push(v):r.push(v),y+=l}g+=u}return ju(r)}!function(t,e){Fm(t,"name",{value:e,configurable:!0})}(Bm,"pointGrid");var qm=Object.defineProperty;function Vm(t,e,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=[],o=t[0],a=t[1],s=t[2],u=t[3],l=s-o,c=Zu(e,r.units,"degrees"),h=u-a,f=Zu(n,r.units,"degrees"),p=Math.floor(Math.abs(l)/c),g=Math.floor(Math.abs(h)/f),y=(h-g*f)/2,v=o+(l-p*c)/2,d=0;d2&&void 0!==arguments[2]?arguments[2]:{})}!function(t,e){Gm(t,"name",{value:e,configurable:!0})}(Ym,"squareGrid");var zm=Object.defineProperty;function Um(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=[],i=e/_l([t[0],t[1]],[t[2],t[1]],n)*(t[2]-t[0]),o=e/_l([t[0],t[1]],[t[0],t[3]],n)*(t[3]-t[1]),a=0,s=t[0];s<=t[2];){for(var u=0,l=t[1];l<=t[3];){var c=null,h=null;a%2==0&&u%2==0?(c=Cu([[[s,l],[s,l+o],[s+i,l],[s,l]]],n.properties),h=Cu([[[s,l+o],[s+i,l+o],[s+i,l],[s,l+o]]],n.properties)):a%2==0&&u%2==1?(c=Cu([[[s,l],[s+i,l+o],[s+i,l],[s,l]]],n.properties),h=Cu([[[s,l],[s,l+o],[s+i,l+o],[s,l]]],n.properties)):u%2==0&&a%2==1?(c=Cu([[[s,l],[s,l+o],[s+i,l+o],[s,l]]],n.properties),h=Cu([[[s,l],[s+i,l+o],[s+i,l],[s,l]]],n.properties)):u%2==1&&a%2==1&&(c=Cu([[[s,l],[s,l+o],[s+i,l],[s,l]]],n.properties),h=Cu([[[s,l+o],[s+i,l+o],[s+i,l],[s,l+o]]],n.properties)),n.mask?(Rm(ju([n.mask,c]))&&r.push(c),Rm(ju([n.mask,h]))&&r.push(h)):(r.push(c),r.push(h)),l+=o,u++}a++,s+=i}return ju(r)}!function(t,e){zm(t,"name",{value:e,configurable:!0})}(Um,"triangleGrid");var Xm=Object.defineProperty;function Wm(t,n,r){if("object"!==e(r=r||{}))throw new Error("options is invalid");var i=r.gridType,o=r.property,a=r.weight;if(!t)throw new Error("points is required");if(ll(t,"Point","input must contain Points"),!n)throw new Error("cellSize is required");if(void 0!==a&&"number"!=typeof a)throw new Error("weight must be a number");o=o||"elevation",i=i||"square",a=a||1;var s,u=rc(t);switch(i){case"point":case"points":s=Bm(u,n,r);break;case"square":case"squares":s=Ym(u,n,r);break;case"hex":case"hexes":s=Am(u,n,r);break;case"triangle":case"triangles":s=Um(u,n,r);break;default:throw new Error("invalid gridType")}var l=[];return Tl(s,(function(e){var n=0,s=0;Tl(t,(function(t){var u,l=_l("point"===i?e:Ug(e),t,r);if(void 0!==o&&(u=t.properties[o]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(n=u);var c=1/Math.pow(l,a);s+=c,n+=c*u}));var u=Ry(e);u.properties[o]=n/s,l.push(u)})),ju(l)} /*! * MarchingSquaresJS * version 1.3.3 * https://github.com/RaumZeit/MarchingSquares.js * * @license GNU Affero General Public License. * Copyright (c) 2015-2019 Ronny Lorenz */ function Hm(t,e,n){return tr&&(i=n,n=r,r=i),tr?(t-r)/(t-e):(t-n)/(t-e)}function Jm(t,e,n,r){return t1){for(;0!==o;)o>>=1,s++;r===1<1){for(;0!==a;)a>>=1,u++;i===1<0&&(this.childB=new n_(t,e+o,n,r-o,a),this.lowerBound=Math.min(this.lowerBound,this.childB.lowerBound),this.upperBound=Math.max(this.upperBound,this.childB.upperBound),i-a>0&&(this.childC=new n_(t,e+o,n+a,r-o,i-a),this.lowerBound=Math.min(this.lowerBound,this.childC.lowerBound),this.upperBound=Math.max(this.upperBound,this.childC.upperBound))),i-a>0&&(this.childD=new n_(t,e,n+a,o,i-a),this.lowerBound=Math.min(this.lowerBound,this.childD.lowerBound),this.upperBound=Math.max(this.upperBound,this.childD.upperBound))}}function r_(t){var e,n;if(!t)throw new Error("data is required");if(!Array.isArray(t)||!Array.isArray(t[0]))throw new Error("data must be scalar field, i.e. array of arrays");if(t.length<2)throw new Error("data must contain at least two rows");if((n=t[0].length)<2)throw new Error("data must contain at least two columns");for(e=1;e=e||t[a][r-1]>=e){n=!1;break}if(n&&(t[i-1][0]>=e||t[i-1][r-1]>=e)&&(n=!1),n)for(o=0;o=e||t[i-1][o]>e){n=!1;break}return n}(t,r.threshold)&&(r.linearRing?_.push([[0,0],[0,b],[x,b],[x,0],[0,0]]):_.push([[0,0],[0,b],[x,b],[x,0]])),n.forEach((function(t,I){t.forEach((function(t,P){for(i=null,o=0;o<4;o++)if(i=E[o],"object"===e(t.edges[i])){for(u=[],a=t.edges[i],l=i,c=I,h=P,f=!1,p=[I+a.path[0][0],P+a.path[0][1]],u.push(p);!f&&"object"===e((s=n[c][h]).edges[l]);)if(a=s.edges[l],delete s.edges[l],(g=a.path[1])[0]+=c,g[1]+=h,u.push(g),l=a.move.enter,c+=a.move.x,h+=a.move.y,void 0===n[c]||void 0===n[c][h]){if(!r.linearRing)break;if(y=0,v=0,c===x?(c--,y=0):c<0?(c++,y=2):h===b?(h--,y=3):h<0&&(h++,y=1),c===I&&h===P&&y===S[i]){f=!0,l=i;break}for(;;){if(d=!1,v>4)throw new Error("Direction change counter overflow! This should never happen!");if(void 0!==n[c]&&void 0!==n[c][h]&&(s=n[c][h],m=E[y],"object"===e(s.edges[m]))){a=s.edges[m],u.push(t_(c,h,y,a.path)),l=m,d=!0;break}if(d)break;if(u.push(e_(c,h,y)),h+=k[y],void 0!==n[c+=w[y]]&&void 0!==n[c][h]||(0===y&&h<0||1===y&&c<0||2===y&&h===b||3===y&&c===x)&&(c-=w[y],h-=k[y],y=(y+1)%4,v++),c===I&&h===P&&y===S[i]){f=!0,l=i;break}}}!r.linearRing||u[u.length-1][0]===p[0]&&u[u.length-1][1]===p[1]||u.push(p),_.push(u)}}))})),_}(h,f,i)}u?g.push(p):g=p,"function"==typeof i.successCallback&&i.successCallback(g,t)})),g}function o_(t,e,n,r){var i,o,a,s,u,l,c=0,h=t[n+1][e],f=t[n+1][e+1],p=t[n][e+1],g=t[n][e],y=r.threshold;if(!(isNaN(g)||isNaN(p)||isNaN(f)||isNaN(h))){switch(c|=h>=y?8:0,c|=f>=y?4:0,c|=p>=y?2:0,l={cval:c=+(c|=g>=y?1:0),polygons:[],edges:{},x0:g,x1:p,x2:f,x3:h},c){case 0:r.polygons&&l.polygons.push([[0,0],[0,1],[1,1],[1,0]]);break;case 15:break;case 14:i=r.interpolate(g,h,y),s=r.interpolate(g,p,y),r.polygons_full&&(l.edges.left={path:[[0,i],[s,0]],move:{x:0,y:-1,enter:"top"}}),r.polygons&&l.polygons.push([[0,0],[0,i],[s,0]]);break;case 13:s=r.interpolate(g,p,y),o=r.interpolate(p,f,y),r.polygons_full&&(l.edges.bottom={path:[[s,0],[1,o]],move:{x:1,y:0,enter:"left"}}),r.polygons&&l.polygons.push([[s,0],[1,o],[1,0]]);break;case 11:o=r.interpolate(p,f,y),a=r.interpolate(h,f,y),r.polygons_full&&(l.edges.right={path:[[1,o],[a,1]],move:{x:0,y:1,enter:"bottom"}}),r.polygons&&l.polygons.push([[1,o],[a,1],[1,1]]);break;case 7:i=r.interpolate(g,h,y),a=r.interpolate(h,f,y),r.polygons_full&&(l.edges.top={path:[[a,1],[0,i]],move:{x:-1,y:0,enter:"right"}}),r.polygons&&l.polygons.push([[a,1],[0,i],[0,1]]);break;case 1:i=r.interpolate(g,h,y),s=r.interpolate(g,p,y),r.polygons_full&&(l.edges.bottom={path:[[s,0],[0,i]],move:{x:-1,y:0,enter:"right"}}),r.polygons&&l.polygons.push([[s,0],[0,i],[0,1],[1,1],[1,0]]);break;case 2:s=r.interpolate(g,p,y),o=r.interpolate(p,f,y),r.polygons_full&&(l.edges.right={path:[[1,o],[s,0]],move:{x:0,y:-1,enter:"top"}}),r.polygons&&l.polygons.push([[0,0],[0,1],[1,1],[1,o],[s,0]]);break;case 4:o=r.interpolate(p,f,y),a=r.interpolate(h,f,y),r.polygons_full&&(l.edges.top={path:[[a,1],[1,o]],move:{x:1,y:0,enter:"left"}}),r.polygons&&l.polygons.push([[0,0],[0,1],[a,1],[1,o],[1,0]]);break;case 8:i=r.interpolate(g,h,y),a=r.interpolate(h,f,y),r.polygons_full&&(l.edges.left={path:[[0,i],[a,1]],move:{x:0,y:1,enter:"bottom"}}),r.polygons&&l.polygons.push([[0,0],[0,i],[a,1],[1,1],[1,0]]);break;case 12:i=r.interpolate(g,h,y),o=r.interpolate(p,f,y),r.polygons_full&&(l.edges.left={path:[[0,i],[1,o]],move:{x:1,y:0,enter:"left"}}),r.polygons&&l.polygons.push([[0,0],[0,i],[1,o],[1,0]]);break;case 9:s=r.interpolate(g,p,y),a=r.interpolate(h,f,y),r.polygons_full&&(l.edges.bottom={path:[[s,0],[a,1]],move:{x:0,y:1,enter:"bottom"}}),r.polygons&&l.polygons.push([[s,0],[a,1],[1,1],[1,0]]);break;case 3:i=r.interpolate(g,h,y),o=r.interpolate(p,f,y),r.polygons_full&&(l.edges.right={path:[[1,o],[0,i]],move:{x:-1,y:0,enter:"right"}}),r.polygons&&l.polygons.push([[0,i],[0,1],[1,1],[1,o]]);break;case 6:s=r.interpolate(g,p,y),a=r.interpolate(h,f,y),r.polygons_full&&(l.edges.top={path:[[a,1],[s,0]],move:{x:0,y:-1,enter:"top"}}),r.polygons&&l.polygons.push([[0,0],[0,1],[a,1],[s,0]]);break;case 10:i=r.interpolate(g,h,y),o=r.interpolate(p,f,y),s=r.interpolate(g,p,y),a=r.interpolate(h,f,y),u=(g+p+f+h)/4,r.polygons_full&&(ue||this.upperBound=e)&&r.push({x:this.x,y:this.y})),r},n_.prototype.cellsBelowThreshold=function(t,e){var n=[];return e=void 0===e||e,this.lowerBound>t||(this.childA||this.childB||this.childC||this.childD?(this.childA&&(n=n.concat(this.childA.cellsBelowThreshold(t,e))),this.childB&&(n=n.concat(this.childB.cellsBelowThreshold(t,e))),this.childD&&(n=n.concat(this.childD.cellsBelowThreshold(t,e))),this.childC&&(n=n.concat(this.childC.cellsBelowThreshold(t,e)))):(e||this.upperBound>=t)&&n.push({x:this.x,y:this.y})),n};var a_={square:function(t,e,n,r,i,o){o.polygons&&t.polygons.push([[0,0],[0,1],[1,1],[1,0]])},triangle_bl:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate(e,i,o.minV,o.maxV);o.polygons_full&&(t.edges.lb={path:[[0,s],[a,0]],move:{x:0,y:-1,enter:"tl"}}),o.polygons&&t.polygons.push([[0,s],[a,0],[0,0]])},triangle_br:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.br={path:[[a,0],[1,s]],move:{x:1,y:0,enter:"lb"}}),o.polygons&&t.polygons.push([[a,0],[1,s],[1,0]])},triangle_tr:function(t,e,n,r,i,o){var a=o.interpolate(n,r,o.minV,o.maxV),s=o.interpolate(i,r,o.minV,o.maxV);o.polygons_full&&(t.edges.rt={path:[[1,a],[s,1]],move:{x:0,y:1,enter:"br"}}),o.polygons&&t.polygons.push([[1,a],[s,1],[1,1]])},triangle_tl:function(t,e,n,r,i,o){var a=o.interpolate(i,r,o.minV,o.maxV),s=o.interpolate(e,i,o.minV,o.maxV);o.polygons_full&&(t.edges.tl={path:[[a,1],[0,s]],move:{x:-1,y:0,enter:"rt"}}),o.polygons&&t.polygons.push([[0,s],[0,1],[a,1]])},tetragon_t:function(t,e,n,r,i,o){var a=o.interpolate(n,r,o.minV,o.maxV),s=o.interpolate(e,i,o.minV,o.maxV);o.polygons_full&&(t.edges.rt={path:[[1,a],[0,s]],move:{x:-1,y:0,enter:"rt"}}),o.polygons&&t.polygons.push([[0,s],[0,1],[1,1],[1,a]])},tetragon_r:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate(i,r,o.minV,o.maxV);o.polygons_full&&(t.edges.br={path:[[a,0],[s,1]],move:{x:0,y:1,enter:"br"}}),o.polygons&&t.polygons.push([[a,0],[s,1],[1,1],[1,0]])},tetragon_b:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.lb={path:[[0,a],[1,s]],move:{x:1,y:0,enter:"lb"}}),o.polygons&&t.polygons.push([[0,0],[0,a],[1,s],[1,0]])},tetragon_l:function(t,e,n,r,i,o){var a=o.interpolate(i,r,o.minV,o.maxV),s=o.interpolate(e,n,o.minV,o.maxV);o.polygons_full&&(t.edges.tl={path:[[a,1],[s,0]],move:{x:0,y:-1,enter:"tl"}}),o.polygons&&t.polygons.push([[0,0],[0,1],[a,1],[s,0]])},tetragon_bl:function(t,e,n,r,i,o){var a=o.interpolate_a(e,n,o.minV,o.maxV),s=o.interpolate_b(e,n,o.minV,o.maxV),u=o.interpolate_a(e,i,o.minV,o.maxV),l=o.interpolate_b(e,i,o.minV,o.maxV);o.polygons_full&&(t.edges.bl={path:[[a,0],[0,u]],move:{x:-1,y:0,enter:"rb"}},t.edges.lt={path:[[0,l],[s,0]],move:{x:0,y:-1,enter:"tr"}}),o.polygons&&t.polygons.push([[a,0],[0,u],[0,l],[s,0]])},tetragon_br:function(t,e,n,r,i,o){var a=o.interpolate_a(e,n,o.minV,o.maxV),s=o.interpolate_b(e,n,o.minV,o.maxV),u=o.interpolate_a(n,r,o.minV,o.maxV),l=o.interpolate_b(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.bl={path:[[a,0],[1,l]],move:{x:1,y:0,enter:"lt"}},t.edges.rb={path:[[1,u],[s,0]],move:{x:0,y:-1,enter:"tr"}}),o.polygons&&t.polygons.push([[a,0],[1,l],[1,u],[s,0]])},tetragon_tr:function(t,e,n,r,i,o){var a=o.interpolate_a(i,r,o.minV,o.maxV),s=o.interpolate_b(i,r,o.minV,o.maxV),u=o.interpolate_b(n,r,o.minV,o.maxV),l=o.interpolate_a(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.rb={path:[[1,l],[a,1]],move:{x:0,y:1,enter:"bl"}},t.edges.tr={path:[[s,1],[1,u]],move:{x:1,y:0,enter:"lt"}}),o.polygons&&t.polygons.push([[1,l],[a,1],[s,1],[1,u]])},tetragon_tl:function(t,e,n,r,i,o){var a=o.interpolate_a(i,r,o.minV,o.maxV),s=o.interpolate_b(i,r,o.minV,o.maxV),u=o.interpolate_b(e,i,o.minV,o.maxV),l=o.interpolate_a(e,i,o.minV,o.maxV);o.polygons_full&&(t.edges.tr={path:[[s,1],[0,l]],move:{x:-1,y:0,enter:"rb"}},t.edges.lt={path:[[0,u],[a,1]],move:{x:0,y:1,enter:"bl"}}),o.polygons&&t.polygons.push([[s,1],[0,l],[0,u],[a,1]])},tetragon_lr:function(t,e,n,r,i,o){var a=o.interpolate_a(e,i,o.minV,o.maxV),s=o.interpolate_b(e,i,o.minV,o.maxV),u=o.interpolate_b(n,r,o.minV,o.maxV),l=o.interpolate_a(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.lt={path:[[0,s],[1,u]],move:{x:1,y:0,enter:"lt"}},t.edges.rb={path:[[1,l],[0,a]],move:{x:-1,y:0,enter:"rb"}}),o.polygons&&t.polygons.push([[0,a],[0,s],[1,u],[1,l]])},tetragon_tb:function(t,e,n,r,i,o){var a=o.interpolate_a(i,r,o.minV,o.maxV),s=o.interpolate_b(i,r,o.minV,o.maxV),u=o.interpolate_b(e,n,o.minV,o.maxV),l=o.interpolate_a(e,n,o.minV,o.maxV);o.polygons_full&&(t.edges.tr={path:[[s,1],[u,0]],move:{x:0,y:-1,enter:"tr"}},t.edges.bl={path:[[l,0],[a,1]],move:{x:0,y:1,enter:"bl"}}),o.polygons&&t.polygons.push([[l,0],[a,1],[s,1],[u,0]])},pentagon_tr:function(t,e,n,r,i,o){var a=o.interpolate(i,r,o.minV,o.maxV),s=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.tl={path:[[a,1],[1,s]],move:{x:1,y:0,enter:"lb"}}),o.polygons&&t.polygons.push([[0,0],[0,1],[a,1],[1,s],[1,0]])},pentagon_tl:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate(i,r,o.minV,o.maxV);o.polygons_full&&(t.edges.lb={path:[[0,a],[s,1]],move:{x:0,y:1,enter:"br"}}),o.polygons&&t.polygons.push([[0,0],[0,a],[s,1],[1,1],[1,0]])},pentagon_br:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.rt={path:[[1,s],[a,0]],move:{x:0,y:-1,enter:"tl"}}),o.polygons&&t.polygons.push([[0,0],[0,1],[1,1],[1,s],[a,0]])},pentagon_bl:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate(e,n,o.minV,o.maxV);o.polygons_full&&(t.edges.br={path:[[s,0],[0,a]],move:{x:-1,y:0,enter:"rt"}}),o.polygons&&t.polygons.push([[0,a],[0,1],[1,1],[1,0],[s,0]])},pentagon_tr_rl:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate(i,r,o.minV,o.maxV),u=o.interpolate_b(n,r,o.minV,o.maxV),l=o.interpolate_a(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.tl={path:[[s,1],[1,u]],move:{x:1,y:0,enter:"lt"}},t.edges.rb={path:[[1,l],[0,a]],move:{x:-1,y:0,enter:"rt"}}),o.polygons&&t.polygons.push([[0,a],[0,1],[s,1],[1,u],[1,l]])},pentagon_rb_bt:function(t,e,n,r,i,o){var a=o.interpolate(n,r,o.minV,o.maxV),s=o.interpolate_b(e,n,o.minV,o.maxV),u=o.interpolate_a(e,n,o.minV,o.maxV),l=o.interpolate(i,r,o.minV,o.maxV);o.polygons_full&&(t.edges.rt={path:[[1,a],[s,0]],move:{x:0,y:-1,enter:"tr"}},t.edges.bl={path:[[u,0],[l,1]],move:{x:0,y:1,enter:"br"}}),o.polygons&&t.polygons.push([[l,1],[1,1],[1,a],[s,0],[u,0]])},pentagon_bl_lr:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate_a(e,i,o.minV,o.maxV),u=o.interpolate_b(e,i,o.minV,o.maxV),l=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.br={path:[[a,0],[0,s]],move:{x:-1,y:0,enter:"rb"}},t.edges.lt={path:[[0,u],[1,l]],move:{x:1,y:0,enter:"lb"}}),o.polygons&&t.polygons.push([[a,0],[0,s],[0,u],[1,l],[1,0]])},pentagon_lt_tb:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate_a(i,r,o.minV,o.maxV),u=o.interpolate_b(i,r,o.minV,o.maxV),l=o.interpolate(e,n,o.minV,o.maxV);o.polygons_full&&(t.edges.lb={path:[[0,a],[s,1]],move:{x:0,y:1,enter:"bl"}},t.edges.tr={path:[[u,1],[l,0]],move:{x:0,y:-1,enter:"tl"}}),o.polygons&&t.polygons.push([[0,0],[0,a],[s,1],[u,1],[l,0]])},pentagon_bl_tb:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate(i,r,o.minV,o.maxV),u=o.interpolate_b(e,n,o.minV,o.maxV),l=o.interpolate_a(e,n,o.minV,o.maxV);o.polygons_full&&(t.edges.bl={path:[[l,0],[0,a]],move:{x:-1,y:0,enter:"rt"}},t.edges.tl={path:[[s,1],[u,0]],move:{x:0,y:-1,enter:"tr"}}),o.polygons&&t.polygons.push([[0,a],[0,1],[s,1],[u,0],[l,0]])},pentagon_lt_rl:function(t,e,n,r,i,o){var a=o.interpolate_a(e,i,o.minV,o.maxV),s=o.interpolate_b(e,i,o.minV,o.maxV),u=o.interpolate(i,r,o.minV,o.maxV),l=o.interpolate(n,i,o.minV,o.maxV);o.polygons_full&&(t.edges.lt={path:[[0,s],[u,1]],move:{x:0,y:1,enter:"br"}},t.edges.rt={path:[[1,l],[0,a]],move:{x:-1,y:0,enter:"rb"}}),o.polygons&&t.polygons.push([[0,a],[0,s],[u,1],[1,1],[1,l]])},pentagon_tr_bt:function(t,e,n,r,i,o){var a=o.interpolate_a(i,r,o.minV,o.maxV),s=o.interpolate_b(i,r,o.minV,o.maxV),u=o.interpolate(n,r,o.minV,o.maxV),l=o.interpolate(e,n,o.minV,o.maxV);o.polygons_full&&(t.edges.br={path:[[l,0],[a,1]],move:{x:0,y:1,enter:"bl"}},t.edges.tr={path:[[s,1],[1,u]],move:{x:1,y:0,enter:"lb"}}),o.polygons&&t.polygons.push([[a,1],[s,1],[1,u],[1,0],[l,0]])},pentagon_rb_lr:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate_b(n,r,o.minV,o.maxV),u=o.interpolate_a(n,r,o.minV,o.maxV),l=o.interpolate(e,n,o.minV,o.maxV);o.polygons_full&&(t.edges.lb={path:[[0,a],[1,s]],move:{x:1,y:0,enter:"lt"}},t.edges.rb={path:[[1,u],[l,0]],move:{x:0,y:-1,enter:"tl"}}),o.polygons&&t.polygons.push([[0,0],[0,a],[1,s],[1,u],[l,0]])},hexagon_lt_tr:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate_a(i,r,o.minV,o.maxV),u=o.interpolate_b(i,r,o.minV,o.maxV),l=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.lb={path:[[0,a],[s,1]],move:{x:0,y:1,enter:"bl"}},t.edges.tr={path:[[u,1],[1,l]],move:{x:1,y:0,enter:"lb"}}),o.polygons&&t.polygons.push([[0,0],[0,a],[s,1],[u,1],[1,l],[1,0]])},hexagon_bl_lt:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate_a(e,i,o.minV,o.maxV),u=o.interpolate_b(e,i,o.minV,o.maxV),l=o.interpolate(i,r,o.minV,o.maxV);o.polygons_full&&(t.edges.br={path:[[a,0],[0,s]],move:{x:-1,y:0,enter:"rb"}},t.edges.lt={path:[[0,u],[l,1]],move:{x:0,y:1,enter:"br"}}),o.polygons&&t.polygons.push([[a,0],[0,s],[0,u],[l,1],[1,1],[1,0]])},hexagon_bl_rb:function(t,e,n,r,i,o){var a=o.interpolate_a(e,n,o.minV,o.maxV),s=o.interpolate_b(e,n,o.minV,o.maxV),u=o.interpolate(e,i,o.minV,o.maxV),l=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.bl={path:[[a,0],[0,u]],move:{x:-1,y:0,enter:"rt"}},t.edges.rt={path:[[1,l],[s,0]],move:{x:0,y:-1,enter:"tr"}}),o.polygons&&t.polygons.push([[a,0],[0,u],[0,1],[1,1],[1,l],[s,0]])},hexagon_tr_rb:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate(i,r,o.minV,o.maxV),u=o.interpolate_b(n,r,o.minV,o.maxV),l=o.interpolate_a(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.tl={path:[[s,1],[1,u]],move:{x:1,y:0,enter:"lt"}},t.edges.rb={path:[[1,l],[a,0]],move:{x:0,y:-1,enter:"tl"}}),o.polygons&&t.polygons.push([[0,0],[0,1],[s,1],[1,u],[1,l],[a,0]])},hexagon_lt_rb:function(t,e,n,r,i,o){var a=o.interpolate(e,i,o.minV,o.maxV),s=o.interpolate(i,r,o.minV,o.maxV),u=o.interpolate(n,r,o.minV,o.maxV),l=o.interpolate(e,n,o.minV,o.maxV);o.polygons_full&&(t.edges.lb={path:[[0,a],[s,1]],move:{x:0,y:1,enter:"br"}},t.edges.rt={path:[[1,u],[l,0]],move:{x:0,y:-1,enter:"tl"}}),o.polygons&&t.polygons.push([[0,0],[0,a],[s,1],[1,1],[1,u],[l,0]])},hexagon_bl_tr:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate(e,i,o.minV,o.maxV),u=o.interpolate(i,r,o.minV,o.maxV),l=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.br={path:[[a,0],[0,s]],move:{x:-1,y:0,enter:"rt"}},t.edges.tl={path:[[u,1],[1,l]],move:{x:1,y:0,enter:"lb"}}),o.polygons&&t.polygons.push([[a,0],[0,s],[0,1],[u,1],[1,l],[1,0]])},heptagon_tr:function(t,e,n,r,i,o){var a=o.interpolate_a(e,n,o.minV,o.maxV),s=o.interpolate_b(e,n,o.minV,o.maxV),u=o.interpolate_a(e,i,o.minV,o.maxV),l=o.interpolate_b(e,i,o.minV,o.maxV),c=o.interpolate(i,r,o.minV,o.maxV),h=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.bl={path:[[a,0],[0,u]],move:{x:-1,y:0,enter:"rb"}},t.edges.lt={path:[[0,l],[c,1]],move:{x:0,y:1,enter:"br"}},t.edges.rt={path:[[1,h],[s,0]],move:{x:0,y:-1,enter:"tr"}}),o.polygons&&t.polygons.push([[a,0],[0,u],[0,l],[c,1],[1,1],[1,h],[s,0]])},heptagon_bl:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate(e,i,o.minV,o.maxV),u=o.interpolate_a(i,r,o.minV,o.maxV),l=o.interpolate_b(i,r,o.minV,o.maxV),c=o.interpolate_b(n,r,o.minV,o.maxV),h=o.interpolate_a(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.lb={path:[[0,s],[u,1]],move:{x:0,y:1,enter:"bl"}},t.edges.tr={path:[[l,1],[1,c]],move:{x:1,y:0,enter:"lt"}},t.edges.rb={path:[[1,h],[a,0]],move:{x:0,y:-1,enter:"tl"}}),o.polygons&&t.polygons.push([[0,0],[0,s],[u,1],[l,1],[1,c],[1,h],[a,0]])},heptagon_tl:function(t,e,n,r,i,o){var a=o.interpolate_a(e,n,o.minV,o.maxV),s=o.interpolate_b(e,n,o.minV,o.maxV),u=o.interpolate(e,i,o.minV,o.maxV),l=o.interpolate(i,r,o.minV,o.maxV),c=o.interpolate_b(n,r,o.minV,o.maxV),h=o.interpolate_a(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.bl={path:[[a,0],[0,u]],move:{x:-1,y:0,enter:"rt"}},t.edges.tl={path:[[l,1],[1,c]],move:{x:1,y:0,enter:"lt"}},t.edges.rb={path:[[1,h],[s,0]],move:{x:0,y:-1,enter:"tr"}}),o.polygons&&t.polygons.push([[a,0],[0,u],[0,1],[l,1],[1,c],[1,h],[s,0]])},heptagon_br:function(t,e,n,r,i,o){var a=o.interpolate(e,n,o.minV,o.maxV),s=o.interpolate_a(e,i,o.minV,o.maxV),u=o.interpolate_b(e,i,o.minV,o.maxV),l=o.interpolate_a(i,r,o.minV,o.maxV),c=o.interpolate_b(i,r,o.minV,o.maxV),h=o.interpolate(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.br={path:[[a,0],[0,s]],move:{x:-1,y:0,enter:"rb"}},t.edges.lt={path:[[0,u],[l,1]],move:{x:0,y:1,enter:"bl"}},t.edges.tr={path:[[c,1],[1,h]],move:{x:1,y:0,enter:"lb"}}),o.polygons&&t.polygons.push([[a,0],[0,s],[0,u],[l,1],[c,1],[1,h],[1,0]])},octagon:function(t,e,n,r,i,o){var a=o.interpolate_a(e,n,o.minV,o.maxV),s=o.interpolate_b(e,n,o.minV,o.maxV),u=o.interpolate_a(e,i,o.minV,o.maxV),l=o.interpolate_b(e,i,o.minV,o.maxV),c=o.interpolate_a(i,r,o.minV,o.maxV),h=o.interpolate_b(i,r,o.minV,o.maxV),f=o.interpolate_b(n,r,o.minV,o.maxV),p=o.interpolate_a(n,r,o.minV,o.maxV);o.polygons_full&&(t.edges.bl={path:[[a,0],[0,u]],move:{x:-1,y:0,enter:"rb"}},t.edges.lt={path:[[0,l],[c,1]],move:{x:0,y:1,enter:"bl"}},t.edges.tr={path:[[h,1],[1,f]],move:{x:1,y:0,enter:"lt"}},t.edges.rb={path:[[1,p],[s,0]],move:{x:0,y:-1,enter:"tr"}}),o.polygons&&t.polygons.push([[a,0],[0,u],[0,l],[c,1],[h,1],[1,f],[1,p],[s,0]])}};function s_(t,n,r,i){var o,a,s,u=!1,l=null,c=null,h=null,f=null,p=!1,g=[],y=[],v=[];if(!t)throw new Error("data is required");if(null==n)throw new Error("lowerBound is required");if(null==r)throw new Error("bandWidth is required");if(i&&"object"!==e(i))throw new Error("options must be an object");if(s=function(t){var e,n,r,i,o;for(i=new Qm,t=t||{},o=Object.keys(i),e=0;en||t[s][i-1]n){r=!1;break}if(r&&(t[o-1][0]n||t[o-1][i-1]n)&&(r=!1),r)for(a=0;an||t[o-1][a]n){r=!1;break}return r}(t,r.minV,r.maxV)&&(r.linearRing?b.push([[0,0],[0,x],[E,x],[E,0],[0,0]]):b.push([[0,0],[0,x],[E,x],[E,0]])),n.forEach((function(t,N){t.forEach((function(t,M){for(i=null,a=0;a<8;a++)if(i=I[a],"object"===e(t.edges[i])){for(o=[],s=t.edges[i],c=i,h=N,f=M,p=!1,g=[N+s.path[0][0],M+s.path[0][1]],o.push(g);!p&&"object"===e((y=n[h][f]).edges[c]);)if(s=y.edges[c],delete y.edges[c],(m=s.path[1])[0]+=h,m[1]+=f,o.push(m),c=s.move.enter,h+=s.move.x,f+=s.move.y,void 0===n[h]||void 0===n[h][f]){if(v=0,d=0,h===E)h--,v=0;else if(h<0)h++,v=2;else if(f===x)f--,v=3;else{if(!(f<0))throw new Error("Left the grid somewhere in the interior!");f++,v=1}if(h===N&&f===M&&v===P[i]){p=!0,c=i;break}for(;;){if(_=!1,d>4)throw new Error("Direction change counter overflow! This should never happen!");if(void 0!==n[h]&&void 0!==n[h][f])for(y=n[h][f],u=0;uo?2:af?128:64,a|=uf?32:16,a|=lf?8:4,o=0,i={cval:a=+(a|=cf?2:1),polygons:[],edges:{},x0:c,x1:l,x2:u,x3:s,x:e,y:n},a){case 85:a_.square(i,c,l,u,s,r);case 0:case 170:break;case 169:a_.triangle_bl(i,c,l,u,s,r);break;case 166:a_.triangle_br(i,c,l,u,s,r);break;case 154:a_.triangle_tr(i,c,l,u,s,r);break;case 106:a_.triangle_tl(i,c,l,u,s,r);break;case 1:a_.triangle_bl(i,c,l,u,s,r);break;case 4:a_.triangle_br(i,c,l,u,s,r);break;case 16:a_.triangle_tr(i,c,l,u,s,r);break;case 64:a_.triangle_tl(i,c,l,u,s,r);break;case 168:a_.tetragon_bl(i,c,l,u,s,r);break;case 162:a_.tetragon_br(i,c,l,u,s,r);break;case 138:a_.tetragon_tr(i,c,l,u,s,r);break;case 42:a_.tetragon_tl(i,c,l,u,s,r);break;case 2:a_.tetragon_bl(i,c,l,u,s,r);break;case 8:a_.tetragon_br(i,c,l,u,s,r);break;case 32:a_.tetragon_tr(i,c,l,u,s,r);break;case 128:a_.tetragon_tl(i,c,l,u,s,r);break;case 5:a_.tetragon_b(i,c,l,u,s,r);break;case 20:a_.tetragon_r(i,c,l,u,s,r);break;case 80:a_.tetragon_t(i,c,l,u,s,r);break;case 65:a_.tetragon_l(i,c,l,u,s,r);break;case 165:a_.tetragon_b(i,c,l,u,s,r);break;case 150:a_.tetragon_r(i,c,l,u,s,r);break;case 90:a_.tetragon_t(i,c,l,u,s,r);break;case 105:a_.tetragon_l(i,c,l,u,s,r);break;case 160:a_.tetragon_lr(i,c,l,u,s,r);break;case 130:a_.tetragon_tb(i,c,l,u,s,r);break;case 10:a_.tetragon_lr(i,c,l,u,s,r);break;case 40:a_.tetragon_tb(i,c,l,u,s,r);break;case 101:a_.pentagon_tr(i,c,l,u,s,r);break;case 149:a_.pentagon_tl(i,c,l,u,s,r);break;case 86:a_.pentagon_bl(i,c,l,u,s,r);break;case 89:a_.pentagon_br(i,c,l,u,s,r);break;case 69:a_.pentagon_tr(i,c,l,u,s,r);break;case 21:a_.pentagon_tl(i,c,l,u,s,r);break;case 84:a_.pentagon_bl(i,c,l,u,s,r);break;case 81:a_.pentagon_br(i,c,l,u,s,r);break;case 96:a_.pentagon_tr_rl(i,c,l,u,s,r);break;case 24:a_.pentagon_rb_bt(i,c,l,u,s,r);break;case 6:a_.pentagon_bl_lr(i,c,l,u,s,r);break;case 129:a_.pentagon_lt_tb(i,c,l,u,s,r);break;case 74:a_.pentagon_tr_rl(i,c,l,u,s,r);break;case 146:a_.pentagon_rb_bt(i,c,l,u,s,r);break;case 164:a_.pentagon_bl_lr(i,c,l,u,s,r);break;case 41:a_.pentagon_lt_tb(i,c,l,u,s,r);break;case 66:a_.pentagon_bl_tb(i,c,l,u,s,r);break;case 144:a_.pentagon_lt_rl(i,c,l,u,s,r);break;case 36:a_.pentagon_tr_bt(i,c,l,u,s,r);break;case 9:a_.pentagon_rb_lr(i,c,l,u,s,r);break;case 104:a_.pentagon_bl_tb(i,c,l,u,s,r);break;case 26:a_.pentagon_lt_rl(i,c,l,u,s,r);break;case 134:a_.pentagon_tr_bt(i,c,l,u,s,r);break;case 161:a_.pentagon_rb_lr(i,c,l,u,s,r);break;case 37:a_.hexagon_lt_tr(i,c,l,u,s,r);break;case 148:a_.hexagon_bl_lt(i,c,l,u,s,r);break;case 82:a_.hexagon_bl_rb(i,c,l,u,s,r);break;case 73:a_.hexagon_tr_rb(i,c,l,u,s,r);break;case 133:a_.hexagon_lt_tr(i,c,l,u,s,r);break;case 22:a_.hexagon_bl_lt(i,c,l,u,s,r);break;case 88:a_.hexagon_bl_rb(i,c,l,u,s,r);break;case 97:a_.hexagon_tr_rb(i,c,l,u,s,r);break;case 145:case 25:a_.hexagon_lt_rb(i,c,l,u,s,r);break;case 70:case 100:a_.hexagon_bl_tr(i,c,l,u,s,r);break;case 17:0===(o=u_(c,l,u,s,h,f))?(a_.triangle_bl(i,c,l,u,s,r),a_.triangle_tr(i,c,l,u,s,r)):a_.hexagon_lt_rb(i,c,l,u,s,r);break;case 68:0===(o=u_(c,l,u,s,h,f))?(a_.triangle_tl(i,c,l,u,s,r),a_.triangle_br(i,c,l,u,s,r)):a_.hexagon_bl_tr(i,c,l,u,s,r);break;case 153:2===(o=u_(c,l,u,s,h,f))?(a_.triangle_bl(i,c,l,u,s,r),a_.triangle_tr(i,c,l,u,s,r)):a_.hexagon_lt_rb(i,c,l,u,s,r);break;case 102:2===(o=u_(c,l,u,s,h,f))?(a_.triangle_tl(i,c,l,u,s,r),a_.triangle_br(i,c,l,u,s,r)):a_.hexagon_bl_tr(i,c,l,u,s,r);break;case 152:2===(o=u_(c,l,u,s,h,f))?(a_.triangle_tr(i,c,l,u,s,r),a_.tetragon_bl(i,c,l,u,s,r)):a_.heptagon_tr(i,c,l,u,s,r);break;case 137:2===(o=u_(c,l,u,s,h,f))?(a_.triangle_bl(i,c,l,u,s,r),a_.tetragon_tr(i,c,l,u,s,r)):a_.heptagon_bl(i,c,l,u,s,r);break;case 98:2===(o=u_(c,l,u,s,h,f))?(a_.triangle_tl(i,c,l,u,s,r),a_.tetragon_br(i,c,l,u,s,r)):a_.heptagon_tl(i,c,l,u,s,r);break;case 38:2===(o=u_(c,l,u,s,h,f))?(a_.triangle_br(i,c,l,u,s,r),a_.tetragon_tl(i,c,l,u,s,r)):a_.heptagon_br(i,c,l,u,s,r);break;case 18:0===(o=u_(c,l,u,s,h,f))?(a_.triangle_tr(i,c,l,u,s,r),a_.tetragon_bl(i,c,l,u,s,r)):a_.heptagon_tr(i,c,l,u,s,r);break;case 33:0===(o=u_(c,l,u,s,h,f))?(a_.triangle_bl(i,c,l,u,s,r),a_.tetragon_tr(i,c,l,u,s,r)):a_.heptagon_bl(i,c,l,u,s,r);break;case 72:0===(o=u_(c,l,u,s,h,f))?(a_.triangle_tl(i,c,l,u,s,r),a_.tetragon_br(i,c,l,u,s,r)):a_.heptagon_tl(i,c,l,u,s,r);break;case 132:0===(o=u_(c,l,u,s,h,f))?(a_.triangle_br(i,c,l,u,s,r),a_.tetragon_tl(i,c,l,u,s,r)):a_.heptagon_br(i,c,l,u,s,r);break;case 136:0===(o=u_(c,l,u,s,h,f))?(a_.tetragon_tl(i,c,l,u,s,r),a_.tetragon_br(i,c,l,u,s,r)):1===o?a_.octagon(i,c,l,u,s,r):(a_.tetragon_bl(i,c,l,u,s,r),a_.tetragon_tr(i,c,l,u,s,r));break;case 34:0===(o=u_(c,l,u,s,h,f))?(a_.tetragon_bl(i,c,l,u,s,r),a_.tetragon_tr(i,c,l,u,s,r)):1===o?a_.octagon(i,c,l,u,s,r):(a_.tetragon_tl(i,c,l,u,s,r),a_.tetragon_br(i,c,l,u,s,r))}return i}}var c_=Object.defineProperty,h_=Object.getOwnPropertySymbols,f_=Object.prototype.hasOwnProperty,p_=Object.prototype.propertyIsEnumerable,g_=function(t,e,n){return e in t?c_(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},y_=function(t,e){for(var n in e||(e={}))f_.call(e,n)&&g_(t,n,e[n]);if(h_){var r,i=c(h_(e));try{for(i.s();!(r=i.n()).done;){n=r.value;p_.call(e,n)&&g_(t,n,e[n])}}catch(t){i.e(t)}finally{i.f()}}return t},v_=function(t,e){return c_(t,"name",{value:e,configurable:!0})};function d_(t,e){if(!Qu(e=e||{}))throw new Error("options is invalid");var n=e.zProperty||"elevation",r=e.flip,i=e.flags;ll(t,"Point","input must contain Points");for(var o=m_(t,r),a=[],s=0;s1&&void 0!==arguments[1]?arguments[1]:{};return Gl(t,(function(t,n){var r=n.geometry.coordinates;return t+_l(r[0],r[1],e)}),0)}!function(t,e){V_(t,"name",{value:e,configurable:!0})}(G_,"length");var Y_=Object.defineProperty,z_=function(t,e){return Y_(t,"name",{value:e,configurable:!0})};function U_(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=i.steps||64,a=X_(n),s=X_(r),u=Array.isArray(t)||"Feature"!==t.type?{}:t.properties;if(a===s)return Au(My(t,e,i).geometry.coordinates[0],u);for(var l=a,c=a=c&&h===i.length-1);h++){if(c>e&&0===o.length){if(!(a=e-c))return o.push(i[h]),Au(o);s=yl(i[h],i[h-1])-180,u=dl(i[h],a,s,r),o.push(u.geometry.coordinates)}if(c>=n)return(a=n-c)?(s=yl(i[h],i[h-1])-180,u=dl(i[h],a,s,r),o.push(u.geometry.coordinates),Au(o)):(o.push(i[h]),Au(o));if(c>=e&&o.push(i[h]),h===i.length-1)return Au(o);c+=_l(i[h],i[h+1],r)}if(c0){var s=r[e-1],u=ub(n,s);!1!==u&&(s[1]=u,n[0]=u),a.push(s[0]),e===o.length-2&&(a.push(n[0]),a.push(n[1]))}2===o.length&&(a.push(n[0]),a.push(n[1]))}})),Au(a,t.properties)}function hb(t,e,n){var r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=t[0]+n*(e[1]-t[1])/r,o=e[0]+n*(e[1]-t[1])/r;return[[i,t[1]+n*(t[0]-e[0])/r],[o,e[1]+n*(t[0]-e[0])/r]]}tb(eb,"ab"),tb(nb,"crossProduct"),tb(rb,"add"),tb(ib,"sub"),tb(ob,"scalarMult"),tb(ab,"intersectSegments"),tb(sb,"isParallel"),tb(ub,"intersection"),tb(lb,"lineOffset"),tb(cb,"lineOffsetFeature"),tb(hb,"processSegment");var fb=Object.defineProperty;function pb(t,e,n){var r=ol(n);if("LineString"!==hl(n))throw new Error("line must be a LineString");for(var i,o=Sf(n,t),a=Sf(n,e),s=[(i=o.properties.index<=a.properties.index?[o,a]:[a,o])[0].geometry.coordinates],u=i[0].properties.index+1;u=_l(t.slice(0,2),[e,i])){var o=(n+i)/2;return[e,o-(r-e)/2,r,o+(r-e)/2]}var a=(e+r)/2;return[a-(i-n)/2,n,a+(i-n)/2,i]}!function(t,e){gb(t,"name",{value:e,configurable:!0})}(yb,"square");var vb=Object.defineProperty,db=function(t,e){return vb(t,"name",{value:e,configurable:!0})};function mb(t,e){if(!Qu(e=null!=e?e:{}))throw new Error("options is invalid");var n=e.precision,r=e.coordinates,i=e.mutate;if(n=null==n||isNaN(n)?6:n,r=null==r||isNaN(r)?3:r,!t)throw new Error(" is required");if("number"!=typeof n)throw new Error(" must be a number");if("number"!=typeof r)throw new Error(" must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return Ol(t,(function(t){_b(t,o,r)})),t}function _b(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r1&&n.push(Au(l)),ju(n)}function Sb(t,e){if(!e.features.length)throw new Error("lines must contain features");if(1===e.features.length)return e.features[0];var n,r=1/0;return Tl(e,(function(e){var i=Sf(e,t).properties.dist;i1&&void 0!==arguments[1]?arguments[1]:{},o=i.properties,a=null==(e=i.autoComplete)||e,s=null==(n=i.orderCoords)||n;if(null!=(r=i.mutate)&&r||(t=Ry(t)),"FeatureCollection"===t.type){var u=[];return t.features.forEach((function(t){u.push(ol(Ob(t,{},a,s)))})),qu(u,o)}return Ob(t,o,a,s)}function Ob(t,e,n,r){e=e||("Feature"===t.type?t.properties:{});var i=cl(t),o=i.coordinates,a=i.type;if(!o.length)throw new Error("line must contain coordinates");switch(a){case"LineString":return n&&(o=Lb(o)),Cu([o],e);case"MultiLineString":var s=[],u=0;return o.forEach((function(t){if(n&&(t=Lb(t)),r){var e=Rb(rc(Au(t)));e>u?(s.unshift(t),u=e):s.push(t)}else s.push(t)})),Cu(s,e);default:throw new Error("geometry type "+a+" is not supported")}}function Lb(t){var e=t[0],n=e[0],r=e[1],i=t[t.length-1],o=i[0],a=i[1];return n===o&&r===a||t.push(e),t}function Rb(t){var e=t[0],n=t[1],r=t[2],i=t[3];return Math.abs(e-r)*Math.abs(n-i)}Nb(Mb,"lineToPolygon"),Nb(Ob,"lineStringToPolygon"),Nb(Lb,"autoCompleteCoords"),Nb(Rb,"calculateArea");var Cb=Object.defineProperty,Tb=function(t,e){return Cb(t,"name",{value:e,configurable:!0})};function Ab(t,e){var n=Fb(e);return("FeatureCollection"===t.type?Db(t):jb(Ud.union(t.geometry.coordinates))).geometry.coordinates.forEach((function(t){n.geometry.coordinates.push(t[0])})),n}function Db(t){var e=2===t.features.length?Ud.union(t.features[0].geometry.coordinates,t.features[1].geometry.coordinates):Ud.union.apply(Ud,t.features.map((function(t){return t.geometry.coordinates})));return jb(e)}function jb(t){return qu(t)}function Fb(t){return Cu(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}Tb(Ab,"mask"),Tb(Db,"unionFc"),Tb(jb,"createGeomFromPolygonClippingOutput"),Tb(Fb,"createMask");var Bb=Object.defineProperty;function qb(t,e){return dl(t,_l(t,e)/2,yl(t,e))}!function(t,e){Bb(t,"name",{value:e,configurable:!0})}(qb,"midpoint");var Vb=Object.defineProperty,Gb=function(t,e){return Vb(t,"name",{value:e,configurable:!0})};function Yb(t,e){var n,r,i=e.inputField,o=e.threshold||1e5,a=e.p||2,s=null!=(n=e.binary)&&n,u=em(t,{alpha:e.alpha||-1,binary:s,p:a,standardization:null==(r=e.standardization)||r,threshold:o}),l=[];Tl(t,(function(t){var e=t.properties||{};l.push(e[i])}));for(var c=zb(l),h=Ub(l),f=0,p=0,g=0,y=0,v=u.length,d=0;d2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var r=1/0,i=0;Tl(e,(function(e,o){var a=_l(t,e,n);a2&&void 0!==arguments[2]?arguments[2]:{};if(n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=Lu(t):"Point"===t.type?t=Mu(t):ul(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=Au(e):"LineString"===e.type?e=Mu(e):ul(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return Vl(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],a=sx(i,e,o,n);a2&&void 0!==arguments[2]?arguments[2]:{},r=n.units,i=n.properties||{},o=mx(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==hl(e))throw new Error("line must be a LineString");var a=1/0,s=null;return Tl(o,(function(t){var n=ax(t,e,{units:r});n0)-(t<0)||+t}function Lx(t,e,n){var r=e[0]-t[0],i=e[1]-t[1],o=n[0]-e[0];return Ox(r*(n[1]-e[1])-o*i)}function Rx(t,e){var n=t.geometry.coordinates[0].map((function(t){return t[0]})),r=t.geometry.coordinates[0].map((function(t){return t[1]})),i=e.geometry.coordinates[0].map((function(t){return t[0]})),o=e.geometry.coordinates[0].map((function(t){return t[1]}));return Math.max.apply(null,n)===Math.max.apply(null,i)&&Math.max.apply(null,r)===Math.max.apply(null,o)&&Math.min.apply(null,n)===Math.min.apply(null,i)&&Math.min.apply(null,r)===Math.min.apply(null,o)}function Cx(t,e){return e.geometry.coordinates[0].every((function(e){return Nc(Lu(e),t)}))}function Tx(t,e){return t[0]===e[0]&&t[1]===e[1]}Mx(Ox,"mathSign"),Mx(Lx,"orientationIndex"),Mx(Rx,"envelopeIsEqual"),Mx(Cx,"envelopeContains"),Mx(Tx,"coordinatesEqual");var Ax=function(){function t(e){n(this,t),this.id=t.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return i(t,[{key:"removeInnerEdge",value:function(t){this.innerEdges=this.innerEdges.filter((function(e){return e.from.id!==t.from.id}))}},{key:"removeOuterEdge",value:function(t){this.outerEdges=this.outerEdges.filter((function(e){return e.to.id!==t.to.id}))}},{key:"addOuterEdge",value:function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1}},{key:"sortOuterEdges",value:function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort((function(e,n){var r=e.to,i=n.to;if(r.coordinates[0]-t.coordinates[0]>=0&&i.coordinates[0]-t.coordinates[0]<0)return 1;if(r.coordinates[0]-t.coordinates[0]<0&&i.coordinates[0]-t.coordinates[0]>=0)return-1;if(r.coordinates[0]-t.coordinates[0]==0&&i.coordinates[0]-t.coordinates[0]==0)return r.coordinates[1]-t.coordinates[1]>=0||i.coordinates[1]-t.coordinates[1]>=0?r.coordinates[1]-i.coordinates[1]:i.coordinates[1]-r.coordinates[1];var o=Lx(t.coordinates,r.coordinates,i.coordinates);return o<0?1:o>0?-1:Math.pow(r.coordinates[0]-t.coordinates[0],2)+Math.pow(r.coordinates[1]-t.coordinates[1],2)-(Math.pow(i.coordinates[0]-t.coordinates[0],2)+Math.pow(i.coordinates[1]-t.coordinates[1],2))})),this.outerEdgesSorted=!0)}},{key:"getOuterEdges",value:function(){return this.sortOuterEdges(),this.outerEdges}},{key:"getOuterEdge",value:function(t){return this.sortOuterEdges(),this.outerEdges[t]}},{key:"addInnerEdge",value:function(t){this.innerEdges.push(t)}}],[{key:"buildId",value:function(t){return t.join(",")}}]),t}();Mx(Ax,"Node");var Dx=Ax,jx=function(){function t(e,r){n(this,t),this.from=e,this.to=r,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return i(t,[{key:"getSymetric",value:function(){return this.symetric||(this.symetric=new t(this.to,this.from),this.symetric.symetric=this),this.symetric}},{key:"deleteEdge",value:function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)}},{key:"isEqual",value:function(t){return this.from.id===t.from.id&&this.to.id===t.to.id}},{key:"toString",value:function(){return"Edge { ".concat(this.from.id," -> ").concat(this.to.id," }")}},{key:"toLineString",value:function(){return Au([this.from.coordinates,this.to.coordinates])}},{key:"compareTo",value:function(t){return Lx(t.from.coordinates,t.to.coordinates,this.to.coordinates)}}]),t}();Mx(jx,"Edge");var Fx=jx,Bx=function(){function t(){n(this,t),this.edges=[],this.polygon=void 0,this.envelope=void 0}return i(t,[{key:"push",value:function(t){this.edges.push(t),this.polygon=this.envelope=void 0}},{key:"get",value:function(t){return this.edges[t]}},{key:"length",get:function(){return this.edges.length}},{key:"forEach",value:function(t){this.edges.forEach(t)}},{key:"map",value:function(t){return this.edges.map(t)}},{key:"some",value:function(t){return this.edges.some(t)}},{key:"isValid",value:function(){return!0}},{key:"isHole",value:function(){var t=this,e=this.edges.reduce((function(e,n,r){return n.from.coordinates[1]>t.edges[e].from.coordinates[1]&&(e=r),e}),0),n=(0===e?this.length:e)-1,r=(e+1)%this.length,i=Lx(this.edges[n].from.coordinates,this.edges[e].from.coordinates,this.edges[r].from.coordinates);return 0===i?this.edges[n].from.coordinates[0]>this.edges[r].from.coordinates[0]:i>0}},{key:"toMultiPoint",value:function(){return Bu(this.edges.map((function(t){return t.from.coordinates})))}},{key:"toPolygon",value:function(){if(this.polygon)return this.polygon;var t=this.edges.map((function(t){return t.from.coordinates}));return t.push(this.edges[0].from.coordinates),this.polygon=Cu([t])}},{key:"getEnvelope",value:function(){return this.envelope?this.envelope:this.envelope=dm(this.toPolygon())}},{key:"inside",value:function(t){return Nc(t,this.toPolygon())}}],[{key:"findEdgeRingContaining",value:function(t,e){var n,r,i=t.getEnvelope();return e.forEach((function(e){var o=e.getEnvelope();if(r&&(n=r.getEnvelope()),!Rx(o,i)&&Cx(o,i)){var a,s,u=c(t.map((function(t){return t.from.coordinates})));try{var l=function(){var t=s.value;e.some((function(e){return Tx(t,e.from.coordinates)}))||(a=t)};for(u.s();!(s=u.n()).done;)l()}catch(t){u.e(t)}finally{u.f()}a&&e.inside(Lu(a))&&(r&&!Cx(n,o)||(r=e))}})),r}}]),t}();Mx(Bx,"EdgeRing");var qx=Bx;function Vx(t){if(!t)throw new Error("No geojson passed");if("FeatureCollection"!==t.type&&"GeometryCollection"!==t.type&&"MultiLineString"!==t.type&&"LineString"!==t.type&&"Feature"!==t.type)throw new Error("Invalid input type '".concat(t.type,"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature"))}Mx(Vx,"validateGeoJson");var Gx=function(){function t(){n(this,t),this.edges=[],this.nodes={}}return i(t,[{key:"getNode",value:function(t){var e=Dx.buildId(t),n=this.nodes[e];return n||(n=this.nodes[e]=new Dx(t)),n}},{key:"addEdge",value:function(t,e){var n=new Fx(t,e),r=n.getSymetric();this.edges.push(n),this.edges.push(r)}},{key:"deleteDangles",value:function(){var t=this;Object.keys(this.nodes).map((function(e){return t.nodes[e]})).forEach((function(e){return t._removeIfDangle(e)}))}},{key:"_removeIfDangle",value:function(t){var e=this;if(t.innerEdges.length<=1){var n=t.getOuterEdges().map((function(t){return t.to}));this.removeNode(t),n.forEach((function(t){return e._removeIfDangle(t)}))}}},{key:"deleteCutEdges",value:function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach((function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))}))}},{key:"_computeNextCWEdges",value:function(t){var e=this;void 0===t?Object.keys(this.nodes).forEach((function(t){return e._computeNextCWEdges(e.nodes[t])})):t.getOuterEdges().forEach((function(e,n){t.getOuterEdge((0===n?t.getOuterEdges().length:n)-1).symetric.next=e}))}},{key:"_computeNextCCWEdges",value:function(t,e){for(var n,r,i=t.getOuterEdges(),o=i.length-1;o>=0;--o){var a=i[o],s=a.symetric,u=void 0,l=void 0;a.label===e&&(u=a),s.label===e&&(l=s),u&&l&&(l&&(r=l),u&&(r&&(r.next=u,r=void 0),n||(n=u)))}r&&(r.next=n)}},{key:"_findLabeledEdgeRings",value:function(){var t=[],e=0;return this.edges.forEach((function(n){if(!(n.label>=0)){t.push(n);var r=n;do{r.label=e,r=r.next}while(!n.isEqual(r));e++}})),t}},{key:"getEdgeRings",value:function(){var t=this;this._computeNextCWEdges(),this.edges.forEach((function(t){t.label=void 0})),this._findLabeledEdgeRings().forEach((function(e){t._findIntersectionNodes(e).forEach((function(n){t._computeNextCCWEdges(n,e.label)}))}));var e=[];return this.edges.forEach((function(n){n.ring||e.push(t._findEdgeRing(n))})),e}},{key:"_findIntersectionNodes",value:function(t){var e=[],n=t,r=function(){var r=0;n.from.getOuterEdges().forEach((function(e){e.label===t.label&&++r})),r>1&&e.push(n.from),n=n.next};do{r()}while(!t.isEqual(n));return e}},{key:"_findEdgeRing",value:function(t){var e=t,n=new qx;do{n.push(e),e.ring=n,e=e.next}while(!t.isEqual(e));return n}},{key:"removeNode",value:function(t){var e=this;t.getOuterEdges().forEach((function(t){return e.removeEdge(t)})),t.innerEdges.forEach((function(t){return e.removeEdge(t)})),delete this.nodes[t.id]}},{key:"removeEdge",value:function(t){this.edges=this.edges.filter((function(e){return!e.isEqual(t)})),t.deleteEdge()}}],[{key:"fromGeoJson",value:function(e){Vx(e);var n=new t;return Bl(e,(function(t){ul(t,"LineString","Graph::fromGeoJson"),Ll(t,(function(t,e){if(t){var r=n.getNode(t),i=n.getNode(e);n.addEdge(r,i)}return e}))})),n}}]),t}();Mx(Gx,"Graph");var Yx=Gx;function zx(t){var e=Yx.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?n.push(t):r.push(t)})),n.forEach((function(t){qx.findEdgeRingContaining(t,r)&&r.push(t)})),ju(r.map((function(t){return t.toPolygon()})))}Mx(zx,"polygonize");var Ux=Object.defineProperty,Xx=function(t,e){return Ux(t,"name",{value:e,configurable:!0})};function Wx(t,e){(e=e||{}).iterations=e.iterations||1;var n=e.iterations,r=[];if(!t)throw new Error("inputPolys is required");return jl(t,(function(t,e,i){if("Polygon"===t.type){for(var o=[[]],a=0;a0&&(u=Cu(o).geometry),Hx(u,s),o=s.slice(0)}r.push(Cu(o,i))}else{if("MultiPolygon"!==t.type)throw new Error("geometry is invalid, must be Polygon or MultiPolygon");for(var l=[[[]]],c=0;c0&&(f=qu(l).geometry),Zx(f,h),l=h.slice(0)}r.push(qu(l,i))}})),ju(r)}function Hx(t,e){var n,r;Ol(t,(function(t,i,o,a,s){if(r!==s)e.push([]);else{var u=n[0],l=n[1],c=t[0],h=t[1];e[s].push([.75*u+.25*c,.75*l+.25*h]),e[s].push([.25*u+.75*c,.25*l+.75*h])}n=t,r=s}),!1),e.forEach((function(t){t.push(t[0])}))}function Zx(t,e){var n,r,i;Ol(t,(function(t,o,a,s,u){if(r!==s)e.push([[]]);else if(i!==u)e[s].push([]);else{var l=n[0],c=n[1],h=t[0],f=t[1];e[s][u].push([.75*l+.25*h,.75*c+.25*f]),e[s][u].push([.25*l+.75*h,.25*c+.75*f])}n=t,r=s,i=u}),!1),e.forEach((function(t){t.forEach((function(t){t.push(t[0])}))}))}Xx(Wx,"polygonSmooth"),Xx(Hx,"processPolygon"),Xx(Zx,"processMultiPolygon");var Jx=Object.defineProperty,$x=function(t,e){return Jx(t,"name",{value:e,configurable:!0})};function Qx(t,e){var n,r=ol(t),i=ol(e),o=[],s=[],u=rc(e),l=0,c=null;switch(r[0]>u[0]&&r[0]u[1]&&r[1]0?eE(e,a,r)||(r=a):n>0&&u<=0&&(tE(e,a,i)||(i=a)),n=u}return[r,i]}function tE(t,e,n){return nE(t,e,n)>0}function eE(t,e,n){return nE(t,e,n)<0}function nE(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(e[1]-t[1])}$x(Qx,"polygonTangents"),$x(Kx,"processPolygon"),$x(tE,"isAbove"),$x(eE,"isBelow"),$x(nE,"isLeft");var rE=Object.defineProperty,iE=function(t,e){return rE(t,"name",{value:e,configurable:!0})};function oE(t){return sE(t,"mercator",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}function aE(t){return sE(t,"wgs84",arguments.length>1&&void 0!==arguments[1]?arguments[1]:{})}function sE(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(n=n||{}).mutate;if(!t)throw new Error("geojson is required");return Array.isArray(t)&&$u(t[0])?t="mercator"===e?uE(t):lE(t):(!0!==r&&(t=Ry(t)),Ol(t,(function(t){var n="mercator"===e?uE(t):lE(t);t[0]=n[0],t[1]=n[1]}))),t}function uE(t){var e=Math.PI/180,n=6378137,r=20037508.342789244,i=[n*(Math.abs(t[0])<=180?t[0]:t[0]-360*cE(t[0]))*e,n*Math.log(Math.tan(.25*Math.PI+.5*t[1]*e))];return i[0]>r&&(i[0]=r),i[0]<-r&&(i[0]=-r),i[1]>r&&(i[1]=r),i[1]<-r&&(i[1]=-r),i}function lE(t){var e=180/Math.PI,n=6378137;return[t[0]*e/n,(.5*Math.PI-2*Math.atan(Math.exp(-t[1]/n)))*e]}function cE(t){return t<0?-1:t>0?1:0}iE(oE,"toMercator"),iE(aE,"toWgs84"),iE(sE,"convert"),iE(uE,"convertToMercator"),iE(lE,"convertToWgs84"),iE(cE,"sign");var hE=Object.freeze({__proto__:null,toMercator:oE,toWgs84:aE}),fE=Object.defineProperty,pE=function(t,e){return fE(t,"name",{value:e,configurable:!0})};function gE(t,e){for(var n=(e=e||{}).studyBbox||rc(t),r=e.confidenceLevel||20,i=t.features,o=i.length,a=Jl(pc(n)),s=Ym(n,Math.sqrt(a/o*2),{units:"meters"}).features,u={},l=0;l_&&(_=E)}for(var w=[],k=Object.keys(u).length,S=f/k,I=0,P=0;P<_+1;P++)I+=Math.exp(-S)*Math.pow(S,P)/dE(P),w.push(I);for(var N=[],M=0,O=0;O<_+1;O++){for(var L=0,R=Object.keys(u);LT&&(T=D)}var j=yE[r]/Math.sqrt(k),F={criticalValue:j,isRandom:!0,maxAbsoluteDifference:T,observedDistribution:N};return T>j&&(F.isRandom=!1),F}pE(gE,"quadratAnalysis");var yE={20:1.07275,15:1.13795,10:1.22385,5:1.3581,2:1.51743,1:1.62762};function vE(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}function dE(t){var e=[];function n(t){return 0===t||1===t?1:e[t]>0?e[t]:e[t]=n(t-1)*t}return pE(n,"inner"),n(t)}pE(vE,"inBBox"),pE(dE,"factorial");var mE=Object.defineProperty,_E=function(t,e){return mE(t,"name",{value:e,configurable:!0})};function bE(t){return EE(t),xE(t)}function xE(t){return Array.isArray(t)?OE(t):t&&t.bbox?OE(t.bbox):[NE(),ME()]}function EE(t){null!=t&&(Array.isArray(t)?Ku(t):null!=t.bbox&&Ku(t.bbox))}function wE(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};EE(e.bbox),null==t&&(t=1);for(var n=[],r=0;r1&&void 0!==arguments[1]?arguments[1]:{};EE(e.bbox),null==t&&(t=1),$u(e.num_vertices)&&void 0!==e.num_vertices||(e.num_vertices=10),$u(e.max_radial_length)&&void 0!==e.max_radial_length||(e.max_radial_length=10);for(var n=[],r=function(){var t=[],r=s(Array(e.num_vertices+1)).map(Math.random);r.forEach((function(t,e,n){n[e]=e>0?t+n[e-1]:t})),r.forEach((function(n){n=2*n*Math.PI/r[r.length-1];var i=Math.random();t.push([i*(e.max_radial_length||10)*Math.sin(n),i*(e.max_radial_length||10)*Math.cos(n)])})),t[t.length-1]=t[0],t=t.map(IE(xE(e.bbox))),n.push(Cu([t]))},i=0;i1&&void 0!==arguments[1]?arguments[1]:{};if(!Qu(e=e||{}))throw new Error("options is invalid");var n=e.bbox;EE(n);var r=e.num_vertices,i=e.max_length,o=e.max_rotation;null==t&&(t=1),(!$u(r)||void 0===r||r<2)&&(r=10),$u(i)&&void 0!==i||(i=1e-4),$u(o)&&void 0!==o||(o=Math.PI/8);for(var a=[],s=0;s1&&void 0!==arguments[1]?arguments[1]:{};if(!Qu(r=r||{}))throw new Error("options is invalid");var i=null!=(e=r.mutate)&&e,o=null!=(n=r.reverse)&&n;if(!t)throw new Error(" is required");if("boolean"!=typeof o)throw new Error(" must be a boolean");if("boolean"!=typeof i)throw new Error(" must be a boolean");i||"Point"===t.type||"MultiPoint"===t.type||(t=Ry(t));var a=[];switch(t.type){case"GeometryCollection":return jl(t,(function(t){AE(t,o)})),t;case"FeatureCollection":return Tl(t,(function(t){Tl(AE(t,o),(function(t){a.push(t)}))})),ju(a)}return AE(t,o)}function AE(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return jl(t,(function(t){AE(t,e)})),t;case"LineString":return DE(ol(t),e),t;case"Polygon":return jE(ol(t),e),t;case"MultiLineString":return ol(t).forEach((function(t){DE(t,e)})),t;case"MultiPolygon":return ol(t).forEach((function(t){jE(t,e)})),t;case"Point":case"MultiPoint":return t}}function DE(t,e){Ec(t)===e&&t.reverse()}function jE(t,e){Ec(t[0])!==e&&t[0].reverse();for(var n=1;na;)n=i[r=Math.floor((o+1)*Math.random())],i[r]=i[o],i[o]=n;return i.slice(a)}BE(qE,"sample"),BE(VE,"getRandomSubarray");var GE=Object.defineProperty,YE=function(t,e){return GE(t,"name",{value:e,configurable:!0})};function zE(t,n,r,i){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};if(!Qu(o=o||{}))throw new Error("options is invalid");var a=o.properties;if(!t)throw new Error("center is required");if(null==r)throw new Error("bearing1 is required");if(null==i)throw new Error("bearing2 is required");if(!n)throw new Error("radius is required");if("object"!==e(o))throw new Error("options must be an object");if(UE(r)===UE(i))return My(t,n,o);var s=ol(t),u=U_(t,n,r,i,o),l=[[s]];return Ol(u,(function(t){l[0].push(t)})),l[0].push(s),Cu(l,a)}function UE(t){var e=t%360;return e<0&&(e+=360),e}YE(zE,"sector"),YE(UE,"convertAngleTo360");var XE=Object.defineProperty,WE=function(t,e){return XE(t,"name",{value:e,configurable:!0})};function HE(t,n,r){if(!Qu(r=r||{}))throw new Error("options is invalid");var i=r.origin,o=r.mutate;if(!t)throw new Error("geojson required");if("number"!=typeof n||n<=0)throw new Error("invalid factor");var a=Array.isArray(i)||"object"===e(i);return!0!==o&&(t=Ry(t)),"FeatureCollection"!==t.type||a?ZE(t,n,i):(Tl(t,(function(e,r){t.features[r]=ZE(e,n,i)})),t)}function ZE(t,e,n){var r="Point"===hl(t);return n=JE(t,n),1===e||r||(Ol(t,(function(t){var r=um(n,t),i=kl(n,t),o=ol(im(n,r*e,i));t[0]=o[0],t[1]=o[1],3===t.length&&(t[2]*=e)})),delete t.bbox),t}function JE(t,n){if(null==n&&(n="centroid"),Array.isArray(n)||"object"===e(n))return il(n);var r=t.bbox?t.bbox:rc(t,{recalculate:!0}),i=r[0],o=r[1],a=r[2],s=r[3];switch(n){case"sw":case"southwest":case"westsouth":case"bottomleft":return Lu([i,o]);case"se":case"southeast":case"eastsouth":case"bottomright":return Lu([a,o]);case"nw":case"northwest":case"westnorth":case"topleft":return Lu([i,s]);case"ne":case"northeast":case"eastnorth":case"topright":return Lu([a,s]);case"center":return up(t);case void 0:case null:case"centroid":return Ug(t);default:throw new Error("invalid origin")}}WE(HE,"transformScale"),WE(ZE,"scale"),WE(JE,"defineOrigin");var $E=Object.defineProperty,QE=function(t,e){return $E(t,"name",{value:e,configurable:!0})};function KE(t){for(var e=t,n=[];e.parent;)n.unshift(e),e=e.parent;return n}function tw(){return new iw((function(t){return t.f}))}QE(KE,"pathTo"),QE(tw,"getHeap");var ew={search:function(t,e,n,r){var i;t.cleanDirty();var o=(r=r||{}).heuristic||ew.heuristics.manhattan,a=null!=(i=r.closest)&&i,s=tw(),u=e;for(e.h=o(e,n),s.push(e);s.size()>0;){var l=s.pop();if(l===n)return KE(l);l.closed=!0;for(var c=t.neighbors(l),h=0,f=c.length;h2&&void 0!==arguments[2]?arguments[2]:{};if(!Qu(n=n||{}))throw new Error("options is invalid");var r=n.obstacles||ju([]),i=n.resolution||100;if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(i&&(!$u(i)||i<=0))throw new Error("options.resolution must be a number, greater than 0");var o=il(t),s=il(e);if(t=Lu(o),e=Lu(s),"FeatureCollection"===r.type){if(0===r.features.length)return Au([o,s])}else{if("Polygon"!==r.type)throw new Error("invalid obstacles");r=ju([Mu(cl(r))])}var u=r;u.features.push(t),u.features.push(e);var l=a(rc(HE(pc(rc(u)),1.15)),4),c=l[0],h=l[1],f=l[2],p=l[3],g=_l([c,h],[f,h],n)/i;u.features.pop(),u.features.pop();for(var y,v,d=g/_l([c,h],[f,h],n)*(f-c),m=g/_l([c,h],[c,p],n)*(p-h),_=f-c,b=p-h,x=Math.floor(_/d),E=Math.floor(b/m),w=(_-x*d)/2,k=[],S=[],I=1/0,P=1/0,N=p-(b-E*m)/2,M=0;N>=h;){for(var O=[],L=[],R=c+w,C=0;R<=f;){var T=Lu([R,N]),A=aw(T,r);O.push(A?0:1),L.push(R+"|"+N);var D=_l(T,t);!A&&D0&&(this.content[0]=e,this.bubbleUp(0)),t},remove:function(t){var e=this.content.indexOf(t),n=this.content.pop();e!==this.content.length-1&&(this.content[e]=n,this.scoreFunction(n)0;){var n=(t+1>>1)-1,r=this.content[n];if(!(this.scoreFunction(e)1?(r=n[0],i=n[1]):s>0&&(r+=o*s,i+=a*s)}return(o=t[0]-r)*o+(a=t[1]-i)*a}function hw(t,e){for(var n,r=t[0],i=[r],o=1,a=t.length;oe&&(i.push(n),r=n);return r!==n&&i.push(n),i}function fw(t,e,n,r,i){for(var o,a=r,s=e+1;sa&&(o=s,a=u)}a>r&&(o-e>1&&fw(t,e,o,r,i),i.push(t[o]),n-o>1&&fw(t,o,n,r,i))}function pw(t,e){var n=t.length-1,r=[t[0]];return fw(t,0,n,e,r),r.push(t[n]),r}function gw(t,e,n){if(t.length<=2)return t;var r=void 0!==e?e*e:1;return t=pw(t=n?t:hw(t,r),r)}function yw(t){var e,n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Qu(i=null!=i?i:{}))throw new Error("options is invalid");var o=null!=(e=i.tolerance)?e:1,a=null!=(n=i.highQuality)&&n,s=null!=(r=i.mutate)&&r;if(!t)throw new Error("geojson is required");if(o&&o<0)throw new Error("invalid tolerance");return!0!==s&&(t=Ry(t)),jl(t,(function(t){vw(t,o,a)})),t}function vw(t,e,n){var r=t.type;if("Point"===r||"MultiPoint"===r)return t;if(Ah(t,{mutate:!0}),"GeometryCollection"!==r)switch(r){case"LineString":t.coordinates=gw(t.coordinates,e,n);break;case"MultiLineString":t.coordinates=t.coordinates.map((function(t){return gw(t,e,n)}));break;case"Polygon":t.coordinates=dw(t.coordinates,e,n);break;case"MultiPolygon":t.coordinates=t.coordinates.map((function(t){return dw(t,e,n)}))}return t}function dw(t,e,n){return t.map((function(t){if(t.length<4)throw new Error("invalid polygon");for(var r=e,i=gw(t,r,n);!mw(i);)i=gw(t,r-=.01*r,n);return i[i.length-1][0]===i[0][0]&&i[i.length-1][1]===i[0][1]||i.push(i[0]),i}))}function mw(t){return!(t.length<3)&&!(3===t.length&&t[2][0]===t[0][0]&&t[2][1]===t[0][1])}uw(lw,"getSqDist"),uw(cw,"getSqSegDist"),uw(hw,"simplifyRadialDist"),uw(fw,"simplifyDPStep"),uw(pw,"simplifyDouglasPeucker"),uw(gw,"simplify"),uw(yw,"simplify"),uw(vw,"simplifyGeom"),uw(dw,"simplifyPolygon"),uw(mw,"checkValidity");var _w=Object.defineProperty,bw=function(t,e){return _w(t,"name",{value:e,configurable:!0})};function xw(t,e){if(!Qu(e=e||{}))throw new Error("options is invalid");var n=e.steps||64,r=e.weight,i=e.properties||{};if(!$u(n))throw new Error("steps must be a number");if(!Qu(i))throw new Error("properties must be a number");var o=Dl(t).length,a=Yg(t,{weight:r}),s=0,u=0,l=0;Tl(t,(function(t){var e=t.properties[r]||1,n=Ew(ol(t),ol(a));s+=Math.pow(n.x,2)*e,u+=Math.pow(n.y,2)*e,l+=n.x*n.y*e}));var c=s-u,h=Math.sqrt(Math.pow(c,2)+4*Math.pow(l,2)),f=2*l,p=Math.atan((c+h)/f),g=180*p/Math.PI,y=0,v=0,d=0;Tl(t,(function(t){var e=t.properties[r]||1,n=Ew(ol(t),ol(a));y+=Math.pow(n.x*Math.cos(p)-n.y*Math.sin(p),2)*e,v+=Math.pow(n.x*Math.sin(p)+n.y*Math.cos(p),2)*e,d+=e}));var m=Math.sqrt(2*y/d),_=Math.sqrt(2*v/d),b=gm(a,m,_,{units:"degrees",angle:g,steps:n,properties:i}),x=Px(t,ju([b])),E={meanCenterCoordinates:ol(a),semiMajorAxis:m,semiMinorAxis:_,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*Dl(x).length/o};return b.properties.standardDeviationalEllipse=E,b}function Ew(t,e){return{x:t[0]-e[0],y:t[1]-e[1]}}bw(xw,"standardDeviationalEllipse"),bw(Ew,"getDeviations");var ww=Object.defineProperty;function kw(t,e,n,r){return t=Ry(t),e=Ry(e),Tl(t,(function(t){t.properties||(t.properties={}),Tl(e,(function(e){t.properties&&e.properties&&void 0===t.properties[r]&&Nc(t,e)&&(t.properties[r]=e.properties[n])}))})),t}!function(t,e){ww(t,"name",{value:e,configurable:!0})}(kw,"tag");var Sw={exports:{}};function Iw(t,e,n){n=n||2;var r,i,o,a,s,u,l,c=e&&e.length,h=c?e[0]*n:t.length,f=Pw(t,0,h,n,!0),p=[];if(!f||f.next===f.prev)return p;if(c&&(f=function(t,e,n,r){var i,o,a,s=[];for(i=0,o=e.length;i80*n){r=o=t[0],i=a=t[1];for(var g=n;go&&(o=s),u>a&&(a=u);l=0!==(l=Math.max(o-r,a-i))?32767/l:0}return Mw(f,p,n,r,i,l,0),p}function Pw(t,e,n,r,i){var o,a;if(i===$w(t,e,n,r)>0)for(o=e;o=e;o-=r)a=Hw(o,t[o],t[o+1],a);return a&&Gw(a,a.next)&&(Zw(a),a=a.next),a}function Nw(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Gw(r,r.next)&&0!==Vw(r.prev,r,r.next))r=r.next;else{if(Zw(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Mw(t,e,n,r,i,o,a){if(t){!a&&o&&function(t,e,n,r){var i=t;do{0===i.z&&(i.z=jw(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,a,s,u,l=1;do{for(n=t,t=null,o=null,a=0;n;){for(a++,r=n,s=0,e=0;e0||u>0&&r;)0!==s&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(a>1)}(i)}(t,r,i,o);for(var s,u,l=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?Lw(t,r,i,o):Ow(t))e.push(s.i/n|0),e.push(t.i/n|0),e.push(u.i/n|0),Zw(t),t=u.next,l=u.next;else if((t=u)===l){a?1===a?Mw(t=Rw(Nw(t),e,n),e,n,r,i,o,2):2===a&&Cw(t,e,n,r,i,o):Mw(Nw(t),e,n,r,i,o,1);break}}}function Ow(t){var e=t.prev,n=t,r=t.next;if(Vw(e,n,r)>=0)return!1;for(var i=e.x,o=n.x,a=r.x,s=e.y,u=n.y,l=r.y,c=io?i>a?i:a:o>a?o:a,p=s>u?s>l?s:l:u>l?u:l,g=r.next;g!==e;){if(g.x>=c&&g.x<=f&&g.y>=h&&g.y<=p&&Bw(i,s,o,u,a,l,g.x,g.y)&&Vw(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Lw(t,e,n,r){var i=t.prev,o=t,a=t.next;if(Vw(i,o,a)>=0)return!1;for(var s=i.x,u=o.x,l=a.x,c=i.y,h=o.y,f=a.y,p=su?s>l?s:l:u>l?u:l,v=c>h?c>f?c:f:h>f?h:f,d=jw(p,g,e,n,r),m=jw(y,v,e,n,r),_=t.prevZ,b=t.nextZ;_&&_.z>=d&&b&&b.z<=m;){if(_.x>=p&&_.x<=y&&_.y>=g&&_.y<=v&&_!==i&&_!==a&&Bw(s,c,u,h,l,f,_.x,_.y)&&Vw(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,b.x>=p&&b.x<=y&&b.y>=g&&b.y<=v&&b!==i&&b!==a&&Bw(s,c,u,h,l,f,b.x,b.y)&&Vw(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;_&&_.z>=d;){if(_.x>=p&&_.x<=y&&_.y>=g&&_.y<=v&&_!==i&&_!==a&&Bw(s,c,u,h,l,f,_.x,_.y)&&Vw(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=m;){if(b.x>=p&&b.x<=y&&b.y>=g&&b.y<=v&&b!==i&&b!==a&&Bw(s,c,u,h,l,f,b.x,b.y)&&Vw(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Rw(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Gw(i,o)&&Yw(i,r,r.next,o)&&Xw(i,o)&&Xw(o,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(o.i/n|0),Zw(r),Zw(r.next),r=t=o),r=r.next}while(r!==t);return Nw(r)}function Cw(t,e,n,r,i,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&qw(a,s)){var u=Ww(a,s);return a=Nw(a,a.next),u=Nw(u,u.next),Mw(a,e,n,r,i,o,0),void Mw(u,e,n,r,i,o,0)}s=s.next}a=a.next}while(a!==t)}function Tw(t,e){return t.x-e.x}function Aw(t,e){var n=function(t,e){var n,r=e,i=t.x,o=t.y,a=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var s=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=i&&s>a&&(a=s,n=r.x=r.x&&r.x>=c&&i!==r.x&&Bw(on.x||r.x===n.x&&Dw(n,r)))&&(n=r,f=u)),r=r.next}while(r!==l);return n}(t,e);if(!n)return e;var r=Ww(n,t);return Nw(r,r.next),Nw(n,n.next)}function Dw(t,e){return Vw(t.prev,t,e.prev)<0&&Vw(e.next,t,t.next)<0}function jw(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Fw(t){var e=t,n=t;do{(e.x=(t-a)*(o-s)&&(t-a)*(r-s)>=(n-a)*(e-s)&&(n-a)*(o-s)>=(i-a)*(r-s)}function qw(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Yw(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&(Xw(t,e)&&Xw(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)&&(Vw(t.prev,t,e.prev)||Vw(t,e.prev,e))||Gw(t,e)&&Vw(t.prev,t,t.next)>0&&Vw(e.prev,e,e.next)>0)}function Vw(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Gw(t,e){return t.x===e.x&&t.y===e.y}function Yw(t,e,n,r){var i=Uw(Vw(t,e,n)),o=Uw(Vw(t,e,r)),a=Uw(Vw(n,r,t)),s=Uw(Vw(n,r,e));return i!==o&&a!==s||(!(0!==i||!zw(t,n,e))||(!(0!==o||!zw(t,r,e))||(!(0!==a||!zw(n,t,r))||!(0!==s||!zw(n,e,r)))))}function zw(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Uw(t){return t>0?1:t<0?-1:0}function Xw(t,e){return Vw(t.prev,t,t.next)<0?Vw(t,e,t.next)>=0&&Vw(t,t.prev,e)>=0:Vw(t,e,t.prev)<0||Vw(t,t.next,e)<0}function Ww(t,e){var n=new Jw(t.i,t.x,t.y),r=new Jw(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Hw(t,e,n,r){var i=new Jw(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Zw(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Jw(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function $w(t,e,n,r){for(var i=0,o=e,a=n-r;o0&&(r+=t[i-1].length,n.holes.push(r))}return n};var Qw=p(Sw.exports),Kw=Object.defineProperty,tk=function(t,e){return Kw(t,"name",{value:e,configurable:!0})};function ek(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=nk(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(nk(t))})),e}function nk(t){var e=rk(t),n=Qw(e.vertices,e.holes,2),r=[],i=[];n.forEach((function(t,r){var o=n[r];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var o=0;o0&&(r+=t[i-1].length,n.holes.push(r))}return n}tk(ek,"tesselate"),tk(nk,"processPolygon"),tk(rk,"flattenCoords");var ik=Object.defineProperty;function ok(t,e,n,r){if(!Qu(r=r||{}))throw new Error("options is invalid");var i=r.units,o=r.zTranslation,a=r.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===e&&0===o)return t;if(null==n||isNaN(n))throw new Error("direction is required");return e<0&&(e=-e,n+=180),!1!==a&&void 0!==a||(t=Ry(t)),Ol(t,(function(t){var r=ol(im(t,e,n,{units:i}));t[0]=r[0],t[1]=r[1],o&&3===t.length&&(t[2]+=o)})),t}!function(t,e){ik(t,"name",{value:e,configurable:!0})}(ok,"transformTranslate");var ak=Object.defineProperty;function sk(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[];if(jl(t,(function(t){n.push(t.coordinates)})),n.length<2)throw new Error("Must have at least 2 geometries");var r=Ud.union.apply(Ud,[n[0]].concat(s(n.slice(1))));return 0===r.length?null:1===r.length?Cu(r[0],e.properties):qu(r,e.properties)}!function(t,e){ak(t,"name",{value:e,configurable:!0})}(sk,"union");var uk=Object.defineProperty,lk=function(t,e){return uk(t,"name",{value:e,configurable:!0})};function ck(t,e,n){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===n&&(n=1);var r=t.geometry.coordinates,i=[],o={};if(n){for(var a=[],s=0;s=1||u<=0||l>=1||l<=0))){var y=g,v=!o[y];v&&(o[y]=!0),e?i.push(e(g,t,n,c,h,u,a,s,f,p,l,v)):i.push(g)}}function y(t,e){var n,i,o,a,s=r[t][e],u=r[t][e+1];return s[0]f[e.isect].coord?-1:1}));for(l=[];b.length>0;){var S=b.pop(),I=S.isect,P=S.parent,N=S.winding,M=l.length,O=[f[I].coord],L=I;if(f[I].ringAndEdge1Walkable)var R=f[I].ringAndEdge1,C=f[I].nxtIsectAlongRingAndEdge1;else R=f[I].ringAndEdge2,C=f[I].nxtIsectAlongRingAndEdge2;for(;!mk(f[I].coord,f[C].coord);){O.push(f[C].coord);var T=void 0;for(r=0;r1)for(e=0;e=0==e}function dk(t){for(var e=0,n=0;n0)){if(o/=f,f<0){if(o0){if(o>h)return;o>c&&(c=o)}if(o=r-u,f||!(o<0)){if(o/=f,f<0){if(o>h)return;o>c&&(c=o)}else if(f>0){if(o0)){if(o/=p,p<0){if(o0){if(o>h)return;o>c&&(c=o)}if(o=i-l,p||!(o<0)){if(o/=p,p<0){if(o>h)return;o>c&&(c=o)}else if(p>0){if(o0||h<1)||(c>0&&(t[0]=[u+c*f,l+c*p]),h<1&&(t[1]=[u+h*f,l+h*p]),!0)}}}}}function Tk(t,e,n,r,i){var o=t[1];if(o)return!0;var a,s,u=t[0],l=t.left,c=t.right,h=l[0],f=l[1],p=c[0],g=c[1],y=(h+p)/2,v=(f+g)/2;if(g===f){if(y=r)return;if(h>p){if(u){if(u[1]>=i)return}else u=[y,n];o=[y,i]}else{if(u){if(u[1]1)if(h>p){if(u){if(u[1]>=i)return}else u=[(n-s)/a,n];o=[(i-s)/a,i]}else{if(u){if(u[1]=r)return}else u=[e,a*e+s];o=[r,a*r+s]}else{if(u){if(u[0]=-nS)){var p=u*u+l*l,g=c*c+h*h,y=(h*p-l*g)/f,v=(u*g-c*p)/f,d=Bk.pop()||new qk;d.arc=t,d.site=i,d.x=y+a,d.y=(d.cy=v+s)+Math.sqrt(y*y+v*v),t.circle=d;for(var m=null,_=Kk._;_;)if(d.y<_.y||d.y===_.y&&d.x<=_.x){if(!_.L){m=_.P;break}_=_.L}else{if(!_.R){m=_;break}_=_.R}Kk.insert(m,d),m||(Fk=d)}}}}function Gk(t){var e=t.circle;e&&(e.P||(Fk=e.N),Kk.remove(e),Bk.push(e),Ik(e),t.circle=null)}var Yk=[];function zk(){Ik(this),this.edge=this.site=this.circle=null}function Uk(t){var e=Yk.pop()||new zk;return e.site=t,e}function Xk(t){Gk(t),$k.remove(t),Yk.push(t),Ik(t)}function Wk(t){var e=t.circle,n=e.x,r=e.cy,i=[n,r],o=t.P,a=t.N,s=[t];Xk(t);for(var u=o;u.circle&&Math.abs(n-u.circle.x)eS)s=s.L;else{if(!((i=o-Jk(s,a))>eS)){r>-eS?(e=s.P,n=s):i>-eS?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}!function(t){Qk[t.index]={site:t,halfedges:[]}}(t);var u=Uk(t);if($k.insert(e,u),e||n){if(e===n)return Gk(e),n=Uk(e.site),$k.insert(u,n),u.edge=n.edge=Ok(e.site,u.site),Vk(e),void Vk(n);if(n){Gk(e),Gk(n);var l=e.site,c=l[0],h=l[1],f=t[0]-c,p=t[1]-h,g=n.site,y=g[0]-c,v=g[1]-h,d=2*(f*v-p*y),m=f*f+p*p,_=y*y+v*v,b=[(v*m-p*_)/d+c,(f*_-y*m)/d+h];Rk(n.edge,l,g,b),u.edge=Ok(l,t,null,b),n.edge=Ok(t,g,null,b),Vk(e),Vk(n)}else u.edge=Ok(e.site,u.site)}}function Zk(t,e){var n=t.site,r=n[0],i=n[1],o=i-e;if(!o)return r;var a=t.P;if(!a)return-1/0;var s=(n=a.site)[0],u=n[1],l=u-e;if(!l)return s;var c=s-r,h=1/o-1/l,f=c/l;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*l)-u+l/2+i-o/2)))/h+r:(r+s)/2}function Jk(t,e){var n=t.N;if(n)return Zk(n,e);var r=t.site;return r[1]===e?r[0]:1/0}var $k,Qk,Kk,tS,eS=1e-6,nS=1e-12;function rS(t,e){return e[1]-t[1]||e[0]-t[0]}function iS(t,e){var n,r,i,o=t.sort(rS).pop();for(tS=[],Qk=new Array(t.length),$k=new Sk,Kk=new Sk;;)if(i=Fk,o&&(!i||o[1]eS||Math.abs(i[0][1]-i[1][1])>eS)||delete tS[o]}(a,s,u,l),function(t,e,n,r){var i,o,a,s,u,l,c,h,f,p,g,y,v=Qk.length,d=!0;for(i=0;ieS||Math.abs(y-f)>eS)&&(u.splice(s,0,tS.push(Lk(a,p,Math.abs(g-t)eS?[t,Math.abs(h-t)eS?[Math.abs(f-r)eS?[n,Math.abs(h-n)eS?[Math.abs(f-e)=s)return null;var u=t-i.site[0],l=e-i.site[1],c=u*u+l*l;do{i=o.cells[r=a],a=null,i.halfedges.forEach((function(n){var r=o.edges[n],s=r.left;if(s!==i.site&&s||(s=r.right)){var u=t-s[0],l=e-s[1],h=u*u+l*l;h